rebase XDDF text package
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1839369 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
85e2e8616d
commit
5b8f5a69db
@ -26,11 +26,15 @@ import java.util.Locale;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import org.apache.poi.ooxml.util.DocumentHelper;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;
|
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;
|
||||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
|
import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
|
||||||
import org.apache.poi.openxml4j.opc.*;
|
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||||
import org.apache.poi.ooxml.util.DocumentHelper;
|
import org.apache.poi.openxml4j.opc.PackageNamespaces;
|
||||||
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
|
import org.apache.poi.openxml4j.opc.PackagePartName;
|
||||||
|
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
@ -150,11 +154,12 @@ public abstract class ContentTypeManager {
|
|||||||
boolean defaultCTExists = this.defaultContentType.containsValue(contentType);
|
boolean defaultCTExists = this.defaultContentType.containsValue(contentType);
|
||||||
String extension = partName.getExtension().toLowerCase(Locale.ROOT);
|
String extension = partName.getExtension().toLowerCase(Locale.ROOT);
|
||||||
if ((extension.length() == 0)
|
if ((extension.length() == 0)
|
||||||
|| (this.defaultContentType.containsKey(extension) && !defaultCTExists))
|
|| (this.defaultContentType.containsKey(extension) && !defaultCTExists)) {
|
||||||
this.addOverrideContentType(partName, contentType);
|
this.addOverrideContentType(partName, contentType);
|
||||||
else if (!defaultCTExists)
|
} else if (!defaultCTExists) {
|
||||||
this.addDefaultContentType(extension, contentType);
|
this.addDefaultContentType(extension, contentType);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an override content type for a specific part.
|
* Add an override content type for a specific part.
|
||||||
@ -166,8 +171,9 @@ public abstract class ContentTypeManager {
|
|||||||
*/
|
*/
|
||||||
private void addOverrideContentType(PackagePartName partName,
|
private void addOverrideContentType(PackagePartName partName,
|
||||||
String contentType) {
|
String contentType) {
|
||||||
if (overrideContentType == null)
|
if (overrideContentType == null) {
|
||||||
overrideContentType = new TreeMap<>();
|
overrideContentType = new TreeMap<>();
|
||||||
|
}
|
||||||
overrideContentType.put(partName, contentType);
|
overrideContentType.put(partName, contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,8 +212,9 @@ public abstract class ContentTypeManager {
|
|||||||
*/
|
*/
|
||||||
public void removeContentType(PackagePartName partName)
|
public void removeContentType(PackagePartName partName)
|
||||||
throws InvalidOperationException {
|
throws InvalidOperationException {
|
||||||
if (partName == null)
|
if (partName == null) {
|
||||||
throw new IllegalArgumentException("partName");
|
throw new IllegalArgumentException("partName");
|
||||||
|
}
|
||||||
|
|
||||||
/* Override content type */
|
/* Override content type */
|
||||||
if (this.overrideContentType != null
|
if (this.overrideContentType != null
|
||||||
@ -251,11 +258,12 @@ public abstract class ContentTypeManager {
|
|||||||
try {
|
try {
|
||||||
for (PackagePart part : this.container.getParts()) {
|
for (PackagePart part : this.container.getParts()) {
|
||||||
if (!part.getPartName().equals(partName)
|
if (!part.getPartName().equals(partName)
|
||||||
&& this.getContentType(part.getPartName()) == null)
|
&& this.getContentType(part.getPartName()) == null) {
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
"Rule M2.4 is not respected: Nor a default element or override element is associated with the part: "
|
"Rule M2.4 is not respected: Nor a default element or override element is associated with the part: "
|
||||||
+ part.getPartName().getName());
|
+ part.getPartName().getName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (InvalidFormatException e) {
|
} catch (InvalidFormatException e) {
|
||||||
throw new InvalidOperationException(e.getMessage());
|
throw new InvalidOperationException(e.getMessage());
|
||||||
}
|
}
|
||||||
@ -271,8 +279,9 @@ public abstract class ContentTypeManager {
|
|||||||
* register, then <code>false</code>.
|
* register, then <code>false</code>.
|
||||||
*/
|
*/
|
||||||
public boolean isContentTypeRegister(String contentType) {
|
public boolean isContentTypeRegister(String contentType) {
|
||||||
if (contentType == null)
|
if (contentType == null) {
|
||||||
throw new IllegalArgumentException("contentType");
|
throw new IllegalArgumentException("contentType");
|
||||||
|
}
|
||||||
|
|
||||||
return (this.defaultContentType.values().contains(contentType) || (this.overrideContentType != null && this.overrideContentType
|
return (this.defaultContentType.values().contains(contentType) || (this.overrideContentType != null && this.overrideContentType
|
||||||
.values().contains(contentType)));
|
.values().contains(contentType)));
|
||||||
@ -318,16 +327,19 @@ public abstract class ContentTypeManager {
|
|||||||
* content from an existing part.
|
* content from an existing part.
|
||||||
*/
|
*/
|
||||||
public String getContentType(PackagePartName partName) {
|
public String getContentType(PackagePartName partName) {
|
||||||
if (partName == null)
|
if (partName == null) {
|
||||||
throw new IllegalArgumentException("partName");
|
throw new IllegalArgumentException("partName");
|
||||||
|
}
|
||||||
|
|
||||||
if ((this.overrideContentType != null)
|
if ((this.overrideContentType != null)
|
||||||
&& this.overrideContentType.containsKey(partName))
|
&& this.overrideContentType.containsKey(partName)) {
|
||||||
return this.overrideContentType.get(partName);
|
return this.overrideContentType.get(partName);
|
||||||
|
}
|
||||||
|
|
||||||
String extension = partName.getExtension().toLowerCase(Locale.ROOT);
|
String extension = partName.getExtension().toLowerCase(Locale.ROOT);
|
||||||
if (this.defaultContentType.containsKey(extension))
|
if (this.defaultContentType.containsKey(extension)) {
|
||||||
return this.defaultContentType.get(extension);
|
return this.defaultContentType.get(extension);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* [M2.4] : The package implementer shall require that the Content Types
|
* [M2.4] : The package implementer shall require that the Content Types
|
||||||
@ -338,7 +350,9 @@ public abstract class ContentTypeManager {
|
|||||||
*/
|
*/
|
||||||
if (this.container != null && this.container.getPart(partName) != null) {
|
if (this.container != null && this.container.getPart(partName) != null) {
|
||||||
throw new OpenXML4JRuntimeException(
|
throw new OpenXML4JRuntimeException(
|
||||||
"Rule M2.4 exception : this error should NEVER happen!\n"
|
"Rule M2.4 exception : Part \'"
|
||||||
|
+ partName
|
||||||
|
+ "\' not found - this error should NEVER happen!\n"
|
||||||
+ "Check that your code is closing the open resources in the correct order prior to filing a bug report.\n"
|
+ "Check that your code is closing the open resources in the correct order prior to filing a bug report.\n"
|
||||||
+ "If you can provide the triggering file, then please raise a bug at https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI and attach the file that triggers it, thanks!");
|
+ "If you can provide the triggering file, then please raise a bug at https://bz.apache.org/bugzilla/enter_bug.cgi?product=POI and attach the file that triggers it, thanks!");
|
||||||
}
|
}
|
||||||
@ -350,18 +364,20 @@ public abstract class ContentTypeManager {
|
|||||||
*/
|
*/
|
||||||
public void clearAll() {
|
public void clearAll() {
|
||||||
this.defaultContentType.clear();
|
this.defaultContentType.clear();
|
||||||
if (this.overrideContentType != null)
|
if (this.overrideContentType != null) {
|
||||||
this.overrideContentType.clear();
|
this.overrideContentType.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all override content types.
|
* Clear all override content types.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void clearOverrideContentTypes() {
|
public void clearOverrideContentTypes() {
|
||||||
if (this.overrideContentType != null)
|
if (this.overrideContentType != null) {
|
||||||
this.overrideContentType.clear();
|
this.overrideContentType.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the content types part.
|
* Parse the content types part.
|
||||||
|
@ -29,6 +29,8 @@ import java.util.HashMap;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
@ -46,6 +48,8 @@ import org.apache.poi.ss.util.CellReference;
|
|||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
|
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
|
||||||
|
import org.apache.poi.xddf.usermodel.text.TextContainer;
|
||||||
|
import org.apache.poi.xddf.usermodel.text.XDDFTextBody;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
@ -65,15 +69,19 @@ import org.openxmlformats.schemas.drawingml.x2006.chart.CTRadarChart;
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterChart;
|
import org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterChart;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerAx;
|
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerAx;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSurface;
|
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSurface;
|
||||||
|
import org.openxmlformats.schemas.drawingml.x2006.chart.CTTitle;
|
||||||
|
import org.openxmlformats.schemas.drawingml.x2006.chart.CTTx;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx;
|
import org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.chart.ChartSpaceDocument;
|
import org.openxmlformats.schemas.drawingml.x2006.chart.ChartSpaceDocument;
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
|
||||||
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties;
|
||||||
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumn;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumn;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumns;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumns;
|
||||||
|
|
||||||
@Beta
|
@Beta
|
||||||
public abstract class XDDFChart extends POIXMLDocumentPart {
|
public abstract class XDDFChart extends POIXMLDocumentPart implements TextContainer {
|
||||||
/**
|
/**
|
||||||
* Underlying workbook
|
* Underlying workbook
|
||||||
*/
|
*/
|
||||||
@ -109,8 +117,10 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
/**
|
/**
|
||||||
* Construct a DrawingML chart from a package part.
|
* Construct a DrawingML chart from a package part.
|
||||||
*
|
*
|
||||||
* @param part the package part holding the chart data,
|
* @param part
|
||||||
* the content type must be <code>application/vnd.openxmlformats-officedocument.drawingml.chart+xml</code>
|
* the package part holding the chart data, the content type must
|
||||||
|
* be
|
||||||
|
* <code>application/vnd.openxmlformats-officedocument.drawingml.chart+xml</code>
|
||||||
* @since POI 3.14-Beta1
|
* @since POI 3.14-Beta1
|
||||||
*/
|
*/
|
||||||
protected XDDFChart(PackagePart part) throws IOException, XmlException {
|
protected XDDFChart(PackagePart part) throws IOException, XmlException {
|
||||||
@ -121,7 +131,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the underlying CTChartSpace bean, the root element of the Chart part.
|
* Return the underlying CTChartSpace bean, the root element of the Chart
|
||||||
|
* part.
|
||||||
*
|
*
|
||||||
* @return the underlying CTChartSpace bean
|
* @return the underlying CTChartSpace bean
|
||||||
*/
|
*/
|
||||||
@ -152,8 +163,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if only visible cells will be present on the chart,
|
* @return true if only visible cells will be present on the chart, false
|
||||||
* false otherwise
|
* otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isPlotOnlyVisibleCells() {
|
public boolean isPlotOnlyVisibleCells() {
|
||||||
if (chart.isSetPlotVisOnly()) {
|
if (chart.isSetPlotVisOnly()) {
|
||||||
@ -164,8 +175,9 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param only a flag specifying if only visible cells should be
|
* @param only
|
||||||
* present on the chart
|
* a flag specifying if only visible cells should be present on
|
||||||
|
* the chart
|
||||||
*/
|
*/
|
||||||
public void setPlotOnlyVisibleCells(boolean only) {
|
public void setPlotOnlyVisibleCells(boolean only) {
|
||||||
if (!chart.isSetPlotVisOnly()) {
|
if (!chart.isSetPlotVisOnly()) {
|
||||||
@ -202,6 +214,42 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
chart.getAutoTitleDeleted().setVal(deleted);
|
chart.getAutoTitleDeleted().setVal(deleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the chart title body if there is one, i.e. title is set and is not a
|
||||||
|
* formula.
|
||||||
|
*
|
||||||
|
* @return text body or null, if title is a formula or no title is set.
|
||||||
|
*/
|
||||||
|
@Beta
|
||||||
|
public XDDFTextBody getFormattedTitle() {
|
||||||
|
if (!chart.isSetTitle()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
CTTitle title = chart.getTitle();
|
||||||
|
if (!title.isSetTx()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
CTTx tx = title.getTx();
|
||||||
|
if (!tx.isSetRich()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new XDDFTextBody(this, tx.getRich());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <R> Optional<R> findDefinedParagraphProperty(Function<CTTextParagraphProperties, Boolean> isSet,
|
||||||
|
Function<CTTextParagraphProperties, R> getter) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <R> Optional<R> findDefinedRunProperty(Function<CTTextCharacterProperties, Boolean> isSet,
|
||||||
|
Function<CTTextCharacterProperties, R> getter) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
public XDDFShapeProperties getOrAddShapeProperties() {
|
public XDDFShapeProperties getOrAddShapeProperties() {
|
||||||
CTPlotArea plotArea = getCTPlotArea();
|
CTPlotArea plotArea = getCTPlotArea();
|
||||||
CTShapeProperties properties;
|
CTShapeProperties properties;
|
||||||
@ -360,7 +408,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
|
|
||||||
private boolean hasAxes() {
|
private boolean hasAxes() {
|
||||||
CTPlotArea ctPlotArea = chart.getPlotArea();
|
CTPlotArea ctPlotArea = chart.getPlotArea();
|
||||||
int totalAxisCount = ctPlotArea.sizeOfValAxArray() + ctPlotArea.sizeOfCatAxArray() + ctPlotArea.sizeOfDateAxArray() + ctPlotArea.sizeOfSerAxArray();
|
int totalAxisCount = ctPlotArea.sizeOfValAxArray() + ctPlotArea.sizeOfCatAxArray() + ctPlotArea
|
||||||
|
.sizeOfDateAxArray() + ctPlotArea.sizeOfSerAxArray();
|
||||||
return totalAxisCount > 0;
|
return totalAxisCount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,11 +430,17 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set value range (basic Axis Options)
|
* Set value range (basic Axis Options)
|
||||||
* @param axisIndex 0 - primary axis, 1 - secondary axis
|
*
|
||||||
* @param minimum minimum value; Double.NaN - automatic; null - no change
|
* @param axisIndex
|
||||||
* @param maximum maximum value; Double.NaN - automatic; null - no change
|
* 0 - primary axis, 1 - secondary axis
|
||||||
* @param majorUnit major unit value; Double.NaN - automatic; null - no change
|
* @param minimum
|
||||||
* @param minorUnit minor unit value; Double.NaN - automatic; null - no change
|
* minimum value; Double.NaN - automatic; null - no change
|
||||||
|
* @param maximum
|
||||||
|
* maximum value; Double.NaN - automatic; null - no change
|
||||||
|
* @param majorUnit
|
||||||
|
* major unit value; Double.NaN - automatic; null - no change
|
||||||
|
* @param minorUnit
|
||||||
|
* minor unit value; Double.NaN - automatic; null - no change
|
||||||
*/
|
*/
|
||||||
public void setValueRange(int axisIndex, Double minimum, Double maximum, Double majorUnit, Double minorUnit) {
|
public void setValueRange(int axisIndex, Double minimum, Double maximum, Double majorUnit, Double minorUnit) {
|
||||||
XDDFChartAxis axis = getAxes().get(axisIndex);
|
XDDFChartAxis axis = getAxes().get(axisIndex);
|
||||||
@ -407,16 +462,21 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method to create relationship with embedded part
|
* method to create relationship with embedded part for example writing xlsx
|
||||||
* for example writing xlsx file stream into output stream
|
* file stream into output stream
|
||||||
*
|
*
|
||||||
* @param chartRelation relationship object
|
* @param chartRelation
|
||||||
* @param chartFactory ChartFactory object
|
* relationship object
|
||||||
* @param chartIndex index used to suffix on file
|
* @param chartFactory
|
||||||
* @return return relation part which used to write relation in .rels file and get relation id
|
* ChartFactory object
|
||||||
|
* @param chartIndex
|
||||||
|
* index used to suffix on file
|
||||||
|
* @return return relation part which used to write relation in .rels file
|
||||||
|
* and get relation id
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
public PackageRelationship createRelationshipInChart(POIXMLRelation chartRelation, POIXMLFactory chartFactory, int chartIndex) {
|
public PackageRelationship createRelationshipInChart(POIXMLRelation chartRelation, POIXMLFactory chartFactory,
|
||||||
|
int chartIndex) {
|
||||||
documentPart = createRelationship(chartRelation, chartFactory, chartIndex, true).getDocumentPart();
|
documentPart = createRelationship(chartRelation, chartFactory, chartIndex, true).getDocumentPart();
|
||||||
return this.addRelation(null, chartRelation, documentPart).getRelationship();
|
return this.addRelation(null, chartRelation, documentPart).getRelationship();
|
||||||
}
|
}
|
||||||
@ -424,14 +484,18 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
/**
|
/**
|
||||||
* if embedded part was null then create new part
|
* if embedded part was null then create new part
|
||||||
*
|
*
|
||||||
* @param chartRelation chart relation object
|
* @param chartRelation
|
||||||
* @param chartWorkbookRelation chart workbook relation object
|
* chart relation object
|
||||||
* @param chartFactory factory object of POIXMLFactory (XWPFFactory/XSLFFactory)
|
* @param chartWorkbookRelation
|
||||||
|
* chart workbook relation object
|
||||||
|
* @param chartFactory
|
||||||
|
* factory object of POIXMLFactory (XWPFFactory/XSLFFactory)
|
||||||
* @return return the new package part
|
* @return return the new package part
|
||||||
* @throws InvalidFormatException
|
* @throws InvalidFormatException
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
private PackagePart createWorksheetPart(POIXMLRelation chartRelation, POIXMLRelation chartWorkbookRelation, POIXMLFactory chartFactory) throws InvalidFormatException {
|
private PackagePart createWorksheetPart(POIXMLRelation chartRelation, POIXMLRelation chartWorkbookRelation,
|
||||||
|
POIXMLFactory chartFactory) throws InvalidFormatException {
|
||||||
PackageRelationship xlsx = createRelationshipInChart(chartWorkbookRelation, chartFactory, chartIndex);
|
PackageRelationship xlsx = createRelationshipInChart(chartWorkbookRelation, chartFactory, chartIndex);
|
||||||
this.setExternalId(xlsx.getId());
|
this.setExternalId(xlsx.getId());
|
||||||
return getTargetPart(xlsx);
|
return getTargetPart(xlsx);
|
||||||
@ -440,7 +504,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
/**
|
/**
|
||||||
* this method write the XSSFWorkbook object data into embedded excel file
|
* this method write the XSSFWorkbook object data into embedded excel file
|
||||||
*
|
*
|
||||||
* @param workbook XSSFworkbook object
|
* @param workbook
|
||||||
|
* XSSFworkbook object
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws InvalidFormatException
|
* @throws InvalidFormatException
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
@ -451,9 +516,7 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
POIXMLRelation chartRelation = getChartRelation();
|
POIXMLRelation chartRelation = getChartRelation();
|
||||||
POIXMLRelation chartWorkbookRelation = getChartWorkbookRelation();
|
POIXMLRelation chartWorkbookRelation = getChartWorkbookRelation();
|
||||||
POIXMLFactory chartFactory = getChartFactory();
|
POIXMLFactory chartFactory = getChartFactory();
|
||||||
if (chartRelation != null
|
if (chartRelation != null && chartWorkbookRelation != null && chartFactory != null) {
|
||||||
&& chartWorkbookRelation != null
|
|
||||||
&& chartFactory != null) {
|
|
||||||
worksheetPart = createWorksheetPart(chartRelation, chartWorkbookRelation, chartFactory);
|
worksheetPart = createWorksheetPart(chartRelation, chartWorkbookRelation, chartFactory);
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidFormatException("unable to determine chart relations");
|
throw new InvalidFormatException("unable to determine chart relations");
|
||||||
@ -489,9 +552,12 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
/**
|
/**
|
||||||
* this method writes the data into sheet
|
* this method writes the data into sheet
|
||||||
*
|
*
|
||||||
* @param sheet sheet of embedded excel
|
* @param sheet
|
||||||
* @param categoryData category values
|
* sheet of embedded excel
|
||||||
* @param valuesData data values
|
* @param categoryData
|
||||||
|
* category values
|
||||||
|
* @param valuesData
|
||||||
|
* data values
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
protected void fillSheet(XSSFSheet sheet, XDDFDataSource<?> categoryData, XDDFNumericalDataSource<?> valuesData) {
|
protected void fillSheet(XSSFSheet sheet, XDDFDataSource<?> categoryData, XDDFNumericalDataSource<?> valuesData) {
|
||||||
@ -504,11 +570,12 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this method return row on given index
|
* this method return row on given index if row is null then create new row
|
||||||
* if row is null then create new row
|
|
||||||
*
|
*
|
||||||
* @param sheet current sheet object
|
* @param sheet
|
||||||
* @param index index of current row
|
* current sheet object
|
||||||
|
* @param index
|
||||||
|
* index of current row
|
||||||
* @return this method return sheet row on given index
|
* @return this method return sheet row on given index
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
@ -521,11 +588,13 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this method return cell on given index
|
* this method return cell on given index if cell is null then create new
|
||||||
* if cell is null then create new cell
|
* cell
|
||||||
*
|
*
|
||||||
* @param row current row object
|
* @param row
|
||||||
* @param index index of current cell
|
* current row object
|
||||||
|
* @param index
|
||||||
|
* index of current cell
|
||||||
* @return this method return sheet cell on given index
|
* @return this method return sheet cell on given index
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
@ -540,7 +609,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
/**
|
/**
|
||||||
* import content from other chart to created chart
|
* import content from other chart to created chart
|
||||||
*
|
*
|
||||||
* @param other chart object
|
* @param other
|
||||||
|
* chart object
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
public void importContent(XDDFChart other) {
|
public void importContent(XDDFChart other) {
|
||||||
@ -553,7 +623,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
@Override
|
@Override
|
||||||
protected void commit() throws IOException {
|
protected void commit() throws IOException {
|
||||||
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
|
||||||
xmlOptions.setSaveSyntheticDocumentElement(new QName(CTChartSpace.type.getName().getNamespaceURI(), "chartSpace", "c"));
|
xmlOptions.setSaveSyntheticDocumentElement(
|
||||||
|
new QName(CTChartSpace.type.getName().getNamespaceURI(), "chartSpace", "c"));
|
||||||
|
|
||||||
if (workbook != null) {
|
if (workbook != null) {
|
||||||
try {
|
try {
|
||||||
@ -572,7 +643,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
/**
|
/**
|
||||||
* set sheet time in excel file
|
* set sheet time in excel file
|
||||||
*
|
*
|
||||||
* @param title title of sheet
|
* @param title
|
||||||
|
* title of sheet
|
||||||
* @return return cell reference
|
* @return return cell reference
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
@ -588,17 +660,19 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
/**
|
/**
|
||||||
* this method update column header of sheet into table
|
* this method update column header of sheet into table
|
||||||
*
|
*
|
||||||
* @param ctTable xssf table object
|
* @param ctTable
|
||||||
* @param title title of column
|
* xssf table object
|
||||||
* @param index index of column
|
* @param title
|
||||||
|
* title of column
|
||||||
|
* @param index
|
||||||
|
* index of column
|
||||||
*/
|
*/
|
||||||
private void updateSheetTable(CTTable ctTable, String title, int index) {
|
private void updateSheetTable(CTTable ctTable, String title, int index) {
|
||||||
CTTableColumns tableColumnList = ctTable.getTableColumns();
|
CTTableColumns tableColumnList = ctTable.getTableColumns();
|
||||||
CTTableColumn column = null;
|
CTTableColumn column = null;
|
||||||
if (tableColumnList.getCount() >= index) {
|
if (tableColumnList.getCount() >= index) {
|
||||||
column = tableColumnList.getTableColumnArray(index);
|
column = tableColumnList.getTableColumnArray(index);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
column = tableColumnList.addNewTableColumn();
|
column = tableColumnList.addNewTableColumn();
|
||||||
column.setId(index);
|
column.setId(index);
|
||||||
}
|
}
|
||||||
@ -632,9 +706,9 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this method is used to get worksheet part
|
* this method is used to get worksheet part if call is from saveworkbook
|
||||||
* if call is from saveworkbook method then check isCommitted
|
* method then check isCommitted isCommitted variable shows that we are
|
||||||
* isCommitted variable shows that we are writing xssfworkbook object into output stream of embedded part
|
* writing xssfworkbook object into output stream of embedded part
|
||||||
*
|
*
|
||||||
* @return returns the packagepart of embedded file
|
* @return returns the packagepart of embedded file
|
||||||
* @throws InvalidFormatException
|
* @throws InvalidFormatException
|
||||||
@ -683,10 +757,12 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* while reading chart from template file then we need to parse and store embedded excel
|
* while reading chart from template file then we need to parse and store
|
||||||
* file in chart object show that we can modify value according to use
|
* embedded excel file in chart object show that we can modify value
|
||||||
|
* according to use
|
||||||
*
|
*
|
||||||
* @param workbook workbook object which we read from chart embedded part
|
* @param workbook
|
||||||
|
* workbook object which we read from chart embedded part
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
public void setWorkbook(XSSFWorkbook workbook) {
|
public void setWorkbook(XSSFWorkbook workbook) {
|
||||||
@ -694,9 +770,12 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the relation id of embedded excel relation id into external data relation tag
|
* set the relation id of embedded excel relation id into external data
|
||||||
|
* relation tag
|
||||||
*
|
*
|
||||||
* @param id relation id of embedded excel relation id into external data relation tag
|
* @param id
|
||||||
|
* relation id of embedded excel relation id into external data
|
||||||
|
* relation tag
|
||||||
* @since POI 4.0.0
|
* @since POI 4.0.0
|
||||||
*/
|
*/
|
||||||
public void setExternalId(String id) {
|
public void setExternalId(String id) {
|
||||||
@ -714,7 +793,8 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
|
|||||||
/**
|
/**
|
||||||
* set chart index which can be use for relation part
|
* set chart index which can be use for relation part
|
||||||
*
|
*
|
||||||
* @param chartIndex chart index which can be use for relation part
|
* @param chartIndex
|
||||||
|
* chart index which can be use for relation part
|
||||||
*/
|
*/
|
||||||
public void setChartIndex(int chartIndex) {
|
public void setChartIndex(int chartIndex) {
|
||||||
this.chartIndex = chartIndex;
|
this.chartIndex = chartIndex;
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
/* ====================================================================
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
|
this work for additional information regarding copyright ownership.
|
||||||
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
(the "License"); you may not use this file except in compliance with
|
||||||
|
the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
==================================================================== */
|
||||||
|
|
||||||
|
package org.apache.poi.xddf.usermodel.text;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.openxmlformats.schemas.drawingml.x2006.main.STTextAnchoringType;
|
||||||
|
|
||||||
|
public enum AnchorType {
|
||||||
|
BOTTOM(STTextAnchoringType.B),
|
||||||
|
CENTER(STTextAnchoringType.CTR),
|
||||||
|
DISTRIBUTED(STTextAnchoringType.DIST),
|
||||||
|
JUSTIFIED(STTextAnchoringType.JUST),
|
||||||
|
TOP(STTextAnchoringType.T);
|
||||||
|
|
||||||
|
final STTextAnchoringType.Enum underlying;
|
||||||
|
|
||||||
|
AnchorType(STTextAnchoringType.Enum caps) {
|
||||||
|
this.underlying = caps;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static HashMap<STTextAnchoringType.Enum, AnchorType> reverse = new HashMap<STTextAnchoringType.Enum, AnchorType>();
|
||||||
|
static {
|
||||||
|
for (AnchorType value : values()) {
|
||||||
|
reverse.put(value.underlying, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static AnchorType valueOf(STTextAnchoringType.Enum caps) {
|
||||||
|
return reverse.get(caps);
|
||||||
|
}
|
||||||
|
}
|
@ -37,6 +37,42 @@ public class XDDFBodyProperties {
|
|||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AnchorType getAnchoring() {
|
||||||
|
if (props.isSetAnchor()) {
|
||||||
|
return AnchorType.valueOf(props.getAnchor());
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnchoring(AnchorType anchor) {
|
||||||
|
if (anchor == null) {
|
||||||
|
if (props.isSetAnchor()) {
|
||||||
|
props.unsetAnchor();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
props.setAnchor(anchor.underlying);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isAnchorCentered() {
|
||||||
|
if (props.isSetAnchorCtr()) {
|
||||||
|
return props.getAnchorCtr();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnchorCentered(Boolean centered) {
|
||||||
|
if (centered == null) {
|
||||||
|
if (props.isSetAnchorCtr()) {
|
||||||
|
props.unsetAnchorCtr();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
props.setAnchorCtr(centered);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public XDDFAutoFit getAutoFit() {
|
public XDDFAutoFit getAutoFit() {
|
||||||
if (props.isSetNoAutofit()) {
|
if (props.isSetNoAutofit()) {
|
||||||
return new XDDFNoAutoFit(props.getNoAutofit());
|
return new XDDFNoAutoFit(props.getNoAutofit());
|
||||||
@ -45,13 +81,19 @@ public class XDDFBodyProperties {
|
|||||||
} else if (props.isSetSpAutoFit()) {
|
} else if (props.isSetSpAutoFit()) {
|
||||||
return new XDDFShapeAutoFit(props.getSpAutoFit());
|
return new XDDFShapeAutoFit(props.getSpAutoFit());
|
||||||
}
|
}
|
||||||
return new XDDFNoAutoFit();
|
return new XDDFNormalAutoFit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutoFit(XDDFAutoFit autofit) {
|
public void setAutoFit(XDDFAutoFit autofit) {
|
||||||
|
if (props.isSetNoAutofit()) {
|
||||||
props.unsetNoAutofit();
|
props.unsetNoAutofit();
|
||||||
|
}
|
||||||
|
if (props.isSetNormAutofit()) {
|
||||||
props.unsetNormAutofit();
|
props.unsetNormAutofit();
|
||||||
|
}
|
||||||
|
if (props.isSetSpAutoFit()) {
|
||||||
props.unsetSpAutoFit();
|
props.unsetSpAutoFit();
|
||||||
|
}
|
||||||
if (autofit instanceof XDDFNoAutoFit) {
|
if (autofit instanceof XDDFNoAutoFit) {
|
||||||
props.setNoAutofit(((XDDFNoAutoFit) autofit).getXmlObject());
|
props.setNoAutofit(((XDDFNoAutoFit) autofit).getXmlObject());
|
||||||
} else if (autofit instanceof XDDFNormalAutoFit) {
|
} else if (autofit instanceof XDDFNormalAutoFit) {
|
||||||
@ -71,7 +113,9 @@ public class XDDFBodyProperties {
|
|||||||
|
|
||||||
public void setExtensionList(XDDFExtensionList list) {
|
public void setExtensionList(XDDFExtensionList list) {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
|
if (props.isSetExtLst()) {
|
||||||
props.unsetExtLst();
|
props.unsetExtLst();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setExtLst(list.getXmlObject());
|
props.setExtLst(list.getXmlObject());
|
||||||
}
|
}
|
||||||
@ -87,7 +131,9 @@ public class XDDFBodyProperties {
|
|||||||
|
|
||||||
public void setBottomInset(Double points) {
|
public void setBottomInset(Double points) {
|
||||||
if (points == null || Double.isNaN(points)) {
|
if (points == null || Double.isNaN(points)) {
|
||||||
|
if (props.isSetBIns()) {
|
||||||
props.unsetBIns();
|
props.unsetBIns();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setBIns(Units.toEMU(points));
|
props.setBIns(Units.toEMU(points));
|
||||||
}
|
}
|
||||||
@ -103,7 +149,9 @@ public class XDDFBodyProperties {
|
|||||||
|
|
||||||
public void setLeftInset(Double points) {
|
public void setLeftInset(Double points) {
|
||||||
if (points == null || Double.isNaN(points)) {
|
if (points == null || Double.isNaN(points)) {
|
||||||
|
if (props.isSetLIns()) {
|
||||||
props.unsetLIns();
|
props.unsetLIns();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setLIns(Units.toEMU(points));
|
props.setLIns(Units.toEMU(points));
|
||||||
}
|
}
|
||||||
@ -119,7 +167,9 @@ public class XDDFBodyProperties {
|
|||||||
|
|
||||||
public void setRightInset(Double points) {
|
public void setRightInset(Double points) {
|
||||||
if (points == null || Double.isNaN(points)) {
|
if (points == null || Double.isNaN(points)) {
|
||||||
|
if (props.isSetRIns()) {
|
||||||
props.unsetRIns();
|
props.unsetRIns();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setRIns(Units.toEMU(points));
|
props.setRIns(Units.toEMU(points));
|
||||||
}
|
}
|
||||||
@ -135,9 +185,47 @@ public class XDDFBodyProperties {
|
|||||||
|
|
||||||
public void setTopInset(Double points) {
|
public void setTopInset(Double points) {
|
||||||
if (points == null || Double.isNaN(points)) {
|
if (points == null || Double.isNaN(points)) {
|
||||||
|
if (props.isSetTIns()) {
|
||||||
props.unsetTIns();
|
props.unsetTIns();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setTIns(Units.toEMU(points));
|
props.setTIns(Units.toEMU(points));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean hasParagraphSpacing() {
|
||||||
|
if (props.isSetSpcFirstLastPara()) {
|
||||||
|
return props.getSpcFirstLastPara();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParagraphSpacing(Boolean spacing) {
|
||||||
|
if (spacing == null) {
|
||||||
|
if (props.isSetSpcFirstLastPara()) {
|
||||||
|
props.unsetSpcFirstLastPara();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
props.setSpcFirstLastPara(spacing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isRightToLeft() {
|
||||||
|
if (props.isSetRtlCol()) {
|
||||||
|
return props.getRtlCol();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRightToLeft(Boolean rightToLeft) {
|
||||||
|
if (rightToLeft == null) {
|
||||||
|
if (props.isSetRtlCol()) {
|
||||||
|
props.unsetRtlCol();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
props.setRtlCol(rightToLeft);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,19 +18,7 @@
|
|||||||
package org.apache.poi.xddf.usermodel.text;
|
package org.apache.poi.xddf.usermodel.text;
|
||||||
|
|
||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
import org.apache.poi.util.Internal;
|
|
||||||
|
|
||||||
@Beta
|
@Beta
|
||||||
public abstract class XDDFBulletSize {
|
public interface XDDFBulletSize {
|
||||||
public static enum Kind {
|
|
||||||
PERCENT,
|
|
||||||
POINTS,
|
|
||||||
TEXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Internal
|
|
||||||
protected XDDFBulletSize() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract Kind getType();
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import org.apache.poi.util.Internal;
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizeFollowText;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizeFollowText;
|
||||||
|
|
||||||
@Beta
|
@Beta
|
||||||
public class XDDFBulletSizeFollowText extends XDDFBulletSize {
|
public class XDDFBulletSizeFollowText implements XDDFBulletSize {
|
||||||
private CTTextBulletSizeFollowText follow;
|
private CTTextBulletSizeFollowText follow;
|
||||||
|
|
||||||
public XDDFBulletSizeFollowText() {
|
public XDDFBulletSizeFollowText() {
|
||||||
@ -38,9 +38,4 @@ public class XDDFBulletSizeFollowText extends XDDFBulletSize {
|
|||||||
protected CTTextBulletSizeFollowText getXmlObject() {
|
protected CTTextBulletSizeFollowText getXmlObject() {
|
||||||
return follow;
|
return follow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Kind getType() {
|
|
||||||
return Kind.TEXT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import org.apache.poi.util.Internal;
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePercent;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePercent;
|
||||||
|
|
||||||
@Beta
|
@Beta
|
||||||
public class XDDFBulletSizePercent extends XDDFBulletSize {
|
public class XDDFBulletSizePercent implements XDDFBulletSize {
|
||||||
private CTTextBulletSizePercent percent;
|
private CTTextBulletSizePercent percent;
|
||||||
private Double scale;
|
private Double scale;
|
||||||
|
|
||||||
@ -42,11 +42,6 @@ public class XDDFBulletSizePercent extends XDDFBulletSize {
|
|||||||
return percent;
|
return percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Kind getType() {
|
|
||||||
return Kind.PERCENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getPercent() {
|
public double getPercent() {
|
||||||
return percent.getVal() * scale;
|
return percent.getVal() * scale;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import org.apache.poi.util.Internal;
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePoint;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePoint;
|
||||||
|
|
||||||
@Beta
|
@Beta
|
||||||
public class XDDFBulletSizePoints extends XDDFBulletSize {
|
public class XDDFBulletSizePoints implements XDDFBulletSize {
|
||||||
private CTTextBulletSizePoint points;
|
private CTTextBulletSizePoint points;
|
||||||
|
|
||||||
public XDDFBulletSizePoints(double value) {
|
public XDDFBulletSizePoints(double value) {
|
||||||
@ -40,11 +40,6 @@ public class XDDFBulletSizePoints extends XDDFBulletSize {
|
|||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Kind getType() {
|
|
||||||
return Kind.POINTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getPoints() {
|
public double getPoints() {
|
||||||
return points.getVal() * 0.01;
|
return points.getVal() * 0.01;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,5 @@ package org.apache.poi.xddf.usermodel.text;
|
|||||||
import org.apache.poi.util.Beta;
|
import org.apache.poi.util.Beta;
|
||||||
|
|
||||||
@Beta
|
@Beta
|
||||||
public abstract class XDDFBulletStyle {
|
public interface XDDFBulletStyle {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import org.apache.poi.util.Internal;
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextAutonumberBullet;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextAutonumberBullet;
|
||||||
|
|
||||||
@Beta
|
@Beta
|
||||||
public class XDDFBulletStyleAutoNumbered extends XDDFBulletStyle {
|
public class XDDFBulletStyleAutoNumbered implements XDDFBulletStyle {
|
||||||
private CTTextAutonumberBullet style;
|
private CTTextAutonumberBullet style;
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
@ -53,7 +53,9 @@ public class XDDFBulletStyleAutoNumbered extends XDDFBulletStyle {
|
|||||||
|
|
||||||
public void setStartAt(Integer value) {
|
public void setStartAt(Integer value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
if (style.isSetStartAt()) {
|
||||||
style.unsetStartAt();
|
style.unsetStartAt();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
style.setStartAt(value);
|
style.setStartAt(value);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import org.apache.poi.util.Internal;
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharBullet;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharBullet;
|
||||||
|
|
||||||
@Beta
|
@Beta
|
||||||
public class XDDFBulletStyleCharacter extends XDDFBulletStyle {
|
public class XDDFBulletStyleCharacter implements XDDFBulletStyle {
|
||||||
private CTTextCharBullet style;
|
private CTTextCharBullet style;
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
|
@ -22,7 +22,7 @@ import org.apache.poi.util.Internal;
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNoBullet;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNoBullet;
|
||||||
|
|
||||||
@Beta
|
@Beta
|
||||||
public class XDDFBulletStyleNone extends XDDFBulletStyle {
|
public class XDDFBulletStyleNone implements XDDFBulletStyle {
|
||||||
private CTTextNoBullet style;
|
private CTTextNoBullet style;
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
|
@ -23,7 +23,7 @@ import org.apache.poi.xddf.usermodel.XDDFPicture;
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBlipBullet;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBlipBullet;
|
||||||
|
|
||||||
@Beta
|
@Beta
|
||||||
public class XDDFBulletStylePicture extends XDDFBulletStyle {
|
public class XDDFBulletStylePicture implements XDDFBulletStyle {
|
||||||
private CTTextBlipBullet style;
|
private CTTextBlipBullet style;
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
|
@ -34,22 +34,30 @@ public class XDDFFont {
|
|||||||
public XDDFFont(FontGroup group, String typeface, Byte charset, Byte pitch, byte[] panose) {
|
public XDDFFont(FontGroup group, String typeface, Byte charset, Byte pitch, byte[] panose) {
|
||||||
this(group, CTTextFont.Factory.newInstance());
|
this(group, CTTextFont.Factory.newInstance());
|
||||||
if (typeface == null) {
|
if (typeface == null) {
|
||||||
|
if (font.isSetTypeface()) {
|
||||||
font.unsetTypeface();
|
font.unsetTypeface();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
font.setTypeface(typeface);
|
font.setTypeface(typeface);
|
||||||
}
|
}
|
||||||
if (charset == null) {
|
if (charset == null) {
|
||||||
|
if (font.isSetCharset()) {
|
||||||
font.unsetCharset();
|
font.unsetCharset();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
font.setCharset(charset);
|
font.setCharset(charset);
|
||||||
}
|
}
|
||||||
if (pitch == null) {
|
if (pitch == null) {
|
||||||
|
if (font.isSetPitchFamily()) {
|
||||||
font.unsetPitchFamily();
|
font.unsetPitchFamily();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
font.setPitchFamily(pitch);
|
font.setPitchFamily(pitch);
|
||||||
}
|
}
|
||||||
if (panose == null || panose.length == 0) {
|
if (panose == null || panose.length == 0) {
|
||||||
|
if (font.isSetPanose()) {
|
||||||
font.unsetPanose();
|
font.unsetPanose();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
font.setPanose(panose);
|
font.setPanose(panose);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class XDDFHyperlink {
|
|||||||
|
|
||||||
public XDDFHyperlink(String id) {
|
public XDDFHyperlink(String id) {
|
||||||
this(CTHyperlink.Factory.newInstance());
|
this(CTHyperlink.Factory.newInstance());
|
||||||
this.link.setId(id);;
|
this.link.setId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XDDFHyperlink(String id, String action) {
|
public XDDFHyperlink(String id, String action) {
|
||||||
@ -72,7 +72,9 @@ public class XDDFHyperlink {
|
|||||||
|
|
||||||
public void setEndSound(Boolean ends) {
|
public void setEndSound(Boolean ends) {
|
||||||
if (ends == null) {
|
if (ends == null) {
|
||||||
|
if (link.isSetEndSnd()) {
|
||||||
link.unsetEndSnd();
|
link.unsetEndSnd();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
link.setEndSnd(ends);
|
link.setEndSnd(ends);
|
||||||
}
|
}
|
||||||
@ -88,11 +90,14 @@ public class XDDFHyperlink {
|
|||||||
|
|
||||||
public void setHighlightClick(Boolean highlights) {
|
public void setHighlightClick(Boolean highlights) {
|
||||||
if (highlights == null) {
|
if (highlights == null) {
|
||||||
|
if (link.isSetHighlightClick()) {
|
||||||
link.unsetHighlightClick();
|
link.unsetHighlightClick();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
link.setHighlightClick(highlights);
|
link.setHighlightClick(highlights);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getHistory() {
|
public Boolean getHistory() {
|
||||||
if (link.isSetHistory()) {
|
if (link.isSetHistory()) {
|
||||||
return link.getHistory();
|
return link.getHistory();
|
||||||
@ -103,13 +108,14 @@ public class XDDFHyperlink {
|
|||||||
|
|
||||||
public void setHistory(Boolean history) {
|
public void setHistory(Boolean history) {
|
||||||
if (history == null) {
|
if (history == null) {
|
||||||
|
if (link.isSetHistory()) {
|
||||||
link.unsetHistory();
|
link.unsetHistory();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
link.setHistory(history);
|
link.setHistory(history);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getInvalidURL() {
|
public String getInvalidURL() {
|
||||||
if (link.isSetInvalidUrl()) {
|
if (link.isSetInvalidUrl()) {
|
||||||
return link.getInvalidUrl();
|
return link.getInvalidUrl();
|
||||||
@ -120,7 +126,9 @@ public class XDDFHyperlink {
|
|||||||
|
|
||||||
public void setInvalidURL(String invalid) {
|
public void setInvalidURL(String invalid) {
|
||||||
if (invalid == null) {
|
if (invalid == null) {
|
||||||
|
if (link.isSetInvalidUrl()) {
|
||||||
link.unsetInvalidUrl();
|
link.unsetInvalidUrl();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
link.setInvalidUrl(invalid);
|
link.setInvalidUrl(invalid);
|
||||||
}
|
}
|
||||||
@ -136,7 +144,9 @@ public class XDDFHyperlink {
|
|||||||
|
|
||||||
public void setTargetFrame(String frame) {
|
public void setTargetFrame(String frame) {
|
||||||
if (frame == null) {
|
if (frame == null) {
|
||||||
|
if (link.isSetTgtFrame()) {
|
||||||
link.unsetTgtFrame();
|
link.unsetTgtFrame();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
link.setTgtFrame(frame);
|
link.setTgtFrame(frame);
|
||||||
}
|
}
|
||||||
@ -152,7 +162,9 @@ public class XDDFHyperlink {
|
|||||||
|
|
||||||
public void setTooltip(String tooltip) {
|
public void setTooltip(String tooltip) {
|
||||||
if (tooltip == null) {
|
if (tooltip == null) {
|
||||||
|
if (link.isSetTooltip()) {
|
||||||
link.unsetTooltip();
|
link.unsetTooltip();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
link.setTooltip(tooltip);
|
link.setTooltip(tooltip);
|
||||||
}
|
}
|
||||||
@ -168,7 +180,9 @@ public class XDDFHyperlink {
|
|||||||
|
|
||||||
public void setExtensionList(XDDFExtensionList list) {
|
public void setExtensionList(XDDFExtensionList list) {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
|
if (link.isSetExtLst()) {
|
||||||
link.unsetExtLst();
|
link.unsetExtLst();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
link.setExtLst(list.getXmlObject());
|
link.setExtLst(list.getXmlObject());
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,9 @@ public class XDDFNormalAutoFit implements XDDFAutoFit {
|
|||||||
|
|
||||||
public void setFontScale(Integer value) {
|
public void setFontScale(Integer value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
if (autofit.isSetFontScale()) {
|
||||||
autofit.unsetFontScale();
|
autofit.unsetFontScale();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
autofit.setFontScale(value);
|
autofit.setFontScale(value);
|
||||||
}
|
}
|
||||||
@ -67,7 +69,9 @@ public class XDDFNormalAutoFit implements XDDFAutoFit {
|
|||||||
|
|
||||||
public void setLineSpaceReduction(Integer value) {
|
public void setLineSpaceReduction(Integer value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
if (autofit.isSetLnSpcReduction()) {
|
||||||
autofit.unsetLnSpcReduction();
|
autofit.unsetLnSpcReduction();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
autofit.setLnSpcReduction(value);
|
autofit.setLnSpcReduction(value);
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,18 @@ public class XDDFParagraphBulletProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBulletStyle(XDDFBulletStyle style) {
|
public void setBulletStyle(XDDFBulletStyle style) {
|
||||||
|
if (props.isSetBuAutoNum()) {
|
||||||
props.unsetBuAutoNum();
|
props.unsetBuAutoNum();
|
||||||
|
}
|
||||||
|
if (props.isSetBuBlip()) {
|
||||||
props.unsetBuBlip();
|
props.unsetBuBlip();
|
||||||
|
}
|
||||||
|
if (props.isSetBuChar()) {
|
||||||
props.unsetBuChar();
|
props.unsetBuChar();
|
||||||
|
}
|
||||||
|
if (props.isSetBuNone()) {
|
||||||
props.unsetBuNone();
|
props.unsetBuNone();
|
||||||
|
}
|
||||||
if (style != null) {
|
if (style != null) {
|
||||||
if (style instanceof XDDFBulletStyleAutoNumbered) {
|
if (style instanceof XDDFBulletStyleAutoNumbered) {
|
||||||
props.setBuAutoNum(((XDDFBulletStyleAutoNumbered) style).getXmlObject());
|
props.setBuAutoNum(((XDDFBulletStyleAutoNumbered) style).getXmlObject());
|
||||||
@ -73,16 +81,22 @@ public class XDDFParagraphBulletProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBulletColor(XDDFColor color) {
|
public void setBulletColor(XDDFColor color) {
|
||||||
|
if (props.isSetBuClrTx()) {
|
||||||
props.unsetBuClrTx();
|
props.unsetBuClrTx();
|
||||||
|
}
|
||||||
if (color == null) {
|
if (color == null) {
|
||||||
|
if (props.isSetBuClr()) {
|
||||||
props.unsetBuClr();
|
props.unsetBuClr();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setBuClr(color.getColorContainer());
|
props.setBuClr(color.getColorContainer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBulletColorFollowText() {
|
public void setBulletColorFollowText() {
|
||||||
|
if (props.isSetBuClr()) {
|
||||||
props.unsetBuClr();
|
props.unsetBuClr();
|
||||||
|
}
|
||||||
if (props.isSetBuClrTx()) {
|
if (props.isSetBuClrTx()) {
|
||||||
// nothing to do: already set
|
// nothing to do: already set
|
||||||
} else {
|
} else {
|
||||||
@ -99,16 +113,22 @@ public class XDDFParagraphBulletProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBulletFont(XDDFFont font) {
|
public void setBulletFont(XDDFFont font) {
|
||||||
|
if (props.isSetBuFontTx()) {
|
||||||
props.unsetBuFontTx();
|
props.unsetBuFontTx();
|
||||||
|
}
|
||||||
if (font == null) {
|
if (font == null) {
|
||||||
|
if (props.isSetBuFont()) {
|
||||||
props.unsetBuFont();
|
props.unsetBuFont();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setBuFont(font.getXmlObject());
|
props.setBuFont(font.getXmlObject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBulletFontFollowText() {
|
public void setBulletFontFollowText() {
|
||||||
|
if (props.isSetBuFont()) {
|
||||||
props.unsetBuFont();
|
props.unsetBuFont();
|
||||||
|
}
|
||||||
if (props.isSetBuFontTx()) {
|
if (props.isSetBuFontTx()) {
|
||||||
// nothing to do: already set
|
// nothing to do: already set
|
||||||
} else {
|
} else {
|
||||||
@ -129,9 +149,15 @@ public class XDDFParagraphBulletProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBulletSize(XDDFBulletSize size) {
|
public void setBulletSize(XDDFBulletSize size) {
|
||||||
|
if (props.isSetBuSzPct()) {
|
||||||
props.unsetBuSzPct();
|
props.unsetBuSzPct();
|
||||||
|
}
|
||||||
|
if (props.isSetBuSzPts()) {
|
||||||
props.unsetBuSzPts();
|
props.unsetBuSzPts();
|
||||||
|
}
|
||||||
|
if (props.isSetBuSzTx()) {
|
||||||
props.unsetBuSzTx();
|
props.unsetBuSzTx();
|
||||||
|
}
|
||||||
if (size != null) {
|
if (size != null) {
|
||||||
if (size instanceof XDDFBulletSizeFollowText) {
|
if (size instanceof XDDFBulletSizeFollowText) {
|
||||||
props.setBuSzTx(((XDDFBulletSizeFollowText) size).getXmlObject());
|
props.setBuSzTx(((XDDFBulletSizeFollowText) size).getXmlObject());
|
||||||
@ -144,16 +170,38 @@ public class XDDFParagraphBulletProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearAll() {
|
public void clearAll() {
|
||||||
|
if (props.isSetBuAutoNum()) {
|
||||||
props.unsetBuAutoNum();
|
props.unsetBuAutoNum();
|
||||||
|
}
|
||||||
|
if (props.isSetBuBlip()) {
|
||||||
props.unsetBuBlip();
|
props.unsetBuBlip();
|
||||||
|
}
|
||||||
|
if (props.isSetBuChar()) {
|
||||||
props.unsetBuChar();
|
props.unsetBuChar();
|
||||||
|
}
|
||||||
|
if (props.isSetBuNone()) {
|
||||||
props.unsetBuNone();
|
props.unsetBuNone();
|
||||||
|
}
|
||||||
|
if (props.isSetBuClr()) {
|
||||||
props.unsetBuClr();
|
props.unsetBuClr();
|
||||||
|
}
|
||||||
|
if (props.isSetBuClrTx()) {
|
||||||
props.unsetBuClrTx();
|
props.unsetBuClrTx();
|
||||||
|
}
|
||||||
|
if (props.isSetBuFont()) {
|
||||||
props.unsetBuFont();
|
props.unsetBuFont();
|
||||||
|
}
|
||||||
|
if (props.isSetBuFontTx()) {
|
||||||
props.unsetBuFontTx();
|
props.unsetBuFontTx();
|
||||||
|
}
|
||||||
|
if (props.isSetBuSzPct()) {
|
||||||
props.unsetBuSzPct();
|
props.unsetBuSzPct();
|
||||||
|
}
|
||||||
|
if (props.isSetBuSzPts()) {
|
||||||
props.unsetBuSzPts();
|
props.unsetBuSzPts();
|
||||||
|
}
|
||||||
|
if (props.isSetBuSzTx()) {
|
||||||
props.unsetBuSzTx();
|
props.unsetBuSzTx();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -57,7 +57,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setLevel(Integer level) {
|
public void setLevel(Integer level) {
|
||||||
if (level == null) {
|
if (level == null) {
|
||||||
|
if (props.isSetLvl()) {
|
||||||
props.unsetLvl();
|
props.unsetLvl();
|
||||||
|
}
|
||||||
} else if (level < 1 || 9 < level) {
|
} else if (level < 1 || 9 < level) {
|
||||||
throw new IllegalArgumentException("Minimum inclusive: 1. Maximum inclusive: 9.");
|
throw new IllegalArgumentException("Minimum inclusive: 1. Maximum inclusive: 9.");
|
||||||
} else {
|
} else {
|
||||||
@ -75,7 +77,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setDefaultRunProperties(XDDFRunProperties properties) {
|
public void setDefaultRunProperties(XDDFRunProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
|
if (props.isSetDefRPr()) {
|
||||||
props.unsetDefRPr();
|
props.unsetDefRPr();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setDefRPr(properties.getXmlObject());
|
props.setDefRPr(properties.getXmlObject());
|
||||||
}
|
}
|
||||||
@ -83,7 +87,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setEastAsianLineBreak(Boolean value) {
|
public void setEastAsianLineBreak(Boolean value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
if (props.isSetEaLnBrk()) {
|
||||||
props.unsetEaLnBrk();
|
props.unsetEaLnBrk();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setEaLnBrk(value);
|
props.setEaLnBrk(value);
|
||||||
}
|
}
|
||||||
@ -91,7 +97,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setLatinLineBreak(Boolean value) {
|
public void setLatinLineBreak(Boolean value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
if (props.isSetLatinLnBrk()) {
|
||||||
props.unsetLatinLnBrk();
|
props.unsetLatinLnBrk();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setLatinLnBrk(value);
|
props.setLatinLnBrk(value);
|
||||||
}
|
}
|
||||||
@ -99,7 +107,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setHangingPunctuation(Boolean value) {
|
public void setHangingPunctuation(Boolean value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
if (props.isSetHangingPunct()) {
|
||||||
props.unsetHangingPunct();
|
props.unsetHangingPunct();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setHangingPunct(value);
|
props.setHangingPunct(value);
|
||||||
}
|
}
|
||||||
@ -107,7 +117,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setRightToLeft(Boolean value) {
|
public void setRightToLeft(Boolean value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
if (props.isSetRtl()) {
|
||||||
props.unsetRtl();
|
props.unsetRtl();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setRtl(value);
|
props.setRtl(value);
|
||||||
}
|
}
|
||||||
@ -115,7 +127,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setFontAlignment(FontAlignment align) {
|
public void setFontAlignment(FontAlignment align) {
|
||||||
if (align == null) {
|
if (align == null) {
|
||||||
|
if (props.isSetFontAlgn()) {
|
||||||
props.unsetFontAlgn();
|
props.unsetFontAlgn();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setFontAlgn(align.underlying);
|
props.setFontAlgn(align.underlying);
|
||||||
}
|
}
|
||||||
@ -123,7 +137,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setTextAlignment(TextAlignment align) {
|
public void setTextAlignment(TextAlignment align) {
|
||||||
if (align == null) {
|
if (align == null) {
|
||||||
|
if (props.isSetAlgn()) {
|
||||||
props.unsetAlgn();
|
props.unsetAlgn();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setAlgn(align.underlying);
|
props.setAlgn(align.underlying);
|
||||||
}
|
}
|
||||||
@ -131,7 +147,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setDefaultTabSize(Double points) {
|
public void setDefaultTabSize(Double points) {
|
||||||
if (points == null) {
|
if (points == null) {
|
||||||
|
if (props.isSetDefTabSz()) {
|
||||||
props.unsetDefTabSz();
|
props.unsetDefTabSz();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setDefTabSz(Units.toEMU(points));
|
props.setDefTabSz(Units.toEMU(points));
|
||||||
}
|
}
|
||||||
@ -139,7 +157,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setIndentation(Double points) {
|
public void setIndentation(Double points) {
|
||||||
if (points == null) {
|
if (points == null) {
|
||||||
|
if (props.isSetIndent()) {
|
||||||
props.unsetIndent();
|
props.unsetIndent();
|
||||||
|
}
|
||||||
} else if (points < -4032 || 4032 < points) {
|
} else if (points < -4032 || 4032 < points) {
|
||||||
throw new IllegalArgumentException("Minimum inclusive = -4032. Maximum inclusive = 4032.");
|
throw new IllegalArgumentException("Minimum inclusive = -4032. Maximum inclusive = 4032.");
|
||||||
} else {
|
} else {
|
||||||
@ -149,7 +169,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setMarginLeft(Double points) {
|
public void setMarginLeft(Double points) {
|
||||||
if (points == null) {
|
if (points == null) {
|
||||||
|
if (props.isSetMarL()) {
|
||||||
props.unsetMarL();
|
props.unsetMarL();
|
||||||
|
}
|
||||||
} else if (points < 0 || 4032 < points) {
|
} else if (points < 0 || 4032 < points) {
|
||||||
throw new IllegalArgumentException("Minimum inclusive = 0. Maximum inclusive = 4032.");
|
throw new IllegalArgumentException("Minimum inclusive = 0. Maximum inclusive = 4032.");
|
||||||
} else {
|
} else {
|
||||||
@ -159,7 +181,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setMarginRight(Double points) {
|
public void setMarginRight(Double points) {
|
||||||
if (points == null) {
|
if (points == null) {
|
||||||
|
if (props.isSetMarR()) {
|
||||||
props.unsetMarR();
|
props.unsetMarR();
|
||||||
|
}
|
||||||
} else if (points < 0 || 4032 < points) {
|
} else if (points < 0 || 4032 < points) {
|
||||||
throw new IllegalArgumentException("Minimum inclusive = 0. Maximum inclusive = 4032.");
|
throw new IllegalArgumentException("Minimum inclusive = 0. Maximum inclusive = 4032.");
|
||||||
} else {
|
} else {
|
||||||
@ -169,7 +193,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setLineSpacing(XDDFSpacing spacing) {
|
public void setLineSpacing(XDDFSpacing spacing) {
|
||||||
if (spacing == null) {
|
if (spacing == null) {
|
||||||
|
if (props.isSetLnSpc()) {
|
||||||
props.unsetLnSpc();
|
props.unsetLnSpc();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setLnSpc(spacing.getXmlObject());
|
props.setLnSpc(spacing.getXmlObject());
|
||||||
}
|
}
|
||||||
@ -177,7 +203,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setSpaceAfter(XDDFSpacing spacing) {
|
public void setSpaceAfter(XDDFSpacing spacing) {
|
||||||
if (spacing == null) {
|
if (spacing == null) {
|
||||||
|
if (props.isSetSpcAft()) {
|
||||||
props.unsetSpcAft();
|
props.unsetSpcAft();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setSpcAft(spacing.getXmlObject());
|
props.setSpcAft(spacing.getXmlObject());
|
||||||
}
|
}
|
||||||
@ -185,7 +213,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setSpaceBefore(XDDFSpacing spacing) {
|
public void setSpaceBefore(XDDFSpacing spacing) {
|
||||||
if (spacing == null) {
|
if (spacing == null) {
|
||||||
|
if (props.isSetSpcBef()) {
|
||||||
props.unsetSpcBef();
|
props.unsetSpcBef();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setSpcBef(spacing.getXmlObject());
|
props.setSpcBef(spacing.getXmlObject());
|
||||||
}
|
}
|
||||||
@ -250,7 +280,9 @@ public class XDDFParagraphProperties {
|
|||||||
|
|
||||||
public void setExtensionList(XDDFExtensionList list) {
|
public void setExtensionList(XDDFExtensionList list) {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
|
if (props.isSetExtLst()) {
|
||||||
props.unsetExtLst();
|
props.unsetExtLst();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setExtLst(list.getXmlObject());
|
props.setExtLst(list.getXmlObject());
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setBaseline(Integer value) {
|
public void setBaseline(Integer value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
if (props.isSetBaseline()) {
|
||||||
props.unsetBaseline();
|
props.unsetBaseline();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setBaseline(value);
|
props.setBaseline(value);
|
||||||
}
|
}
|
||||||
@ -64,7 +66,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setDirty(Boolean dirty) {
|
public void setDirty(Boolean dirty) {
|
||||||
if (dirty == null) {
|
if (dirty == null) {
|
||||||
|
if (props.isSetDirty()) {
|
||||||
props.unsetDirty();
|
props.unsetDirty();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setDirty(dirty);
|
props.setDirty(dirty);
|
||||||
}
|
}
|
||||||
@ -72,7 +76,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setSpellError(Boolean error) {
|
public void setSpellError(Boolean error) {
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
|
if (props.isSetErr()) {
|
||||||
props.unsetErr();
|
props.unsetErr();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setErr(error);
|
props.setErr(error);
|
||||||
}
|
}
|
||||||
@ -80,7 +86,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setNoProof(Boolean noproof) {
|
public void setNoProof(Boolean noproof) {
|
||||||
if (noproof == null) {
|
if (noproof == null) {
|
||||||
|
if (props.isSetNoProof()) {
|
||||||
props.unsetNoProof();
|
props.unsetNoProof();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setNoProof(noproof);
|
props.setNoProof(noproof);
|
||||||
}
|
}
|
||||||
@ -88,7 +96,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setNormalizeHeights(Boolean normalize) {
|
public void setNormalizeHeights(Boolean normalize) {
|
||||||
if (normalize == null) {
|
if (normalize == null) {
|
||||||
|
if (props.isSetNormalizeH()) {
|
||||||
props.unsetNormalizeH();
|
props.unsetNormalizeH();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setNormalizeH(normalize);
|
props.setNormalizeH(normalize);
|
||||||
}
|
}
|
||||||
@ -96,7 +106,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setKumimoji(Boolean kumimoji) {
|
public void setKumimoji(Boolean kumimoji) {
|
||||||
if (kumimoji == null) {
|
if (kumimoji == null) {
|
||||||
|
if (props.isSetKumimoji()) {
|
||||||
props.unsetKumimoji();
|
props.unsetKumimoji();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setKumimoji(kumimoji);
|
props.setKumimoji(kumimoji);
|
||||||
}
|
}
|
||||||
@ -104,7 +116,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setBold(Boolean bold) {
|
public void setBold(Boolean bold) {
|
||||||
if (bold == null) {
|
if (bold == null) {
|
||||||
|
if (props.isSetB()) {
|
||||||
props.unsetB();
|
props.unsetB();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setB(bold);
|
props.setB(bold);
|
||||||
}
|
}
|
||||||
@ -112,7 +126,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setItalic(Boolean italic) {
|
public void setItalic(Boolean italic) {
|
||||||
if (italic == null) {
|
if (italic == null) {
|
||||||
|
if (props.isSetI()) {
|
||||||
props.unsetI();
|
props.unsetI();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setI(italic);
|
props.setI(italic);
|
||||||
}
|
}
|
||||||
@ -120,7 +136,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setFontSize(Double size) {
|
public void setFontSize(Double size) {
|
||||||
if (size == null) {
|
if (size == null) {
|
||||||
|
if (props.isSetSz()) {
|
||||||
props.unsetSz();
|
props.unsetSz();
|
||||||
|
}
|
||||||
} else if (size < 1 || 400 < size) {
|
} else if (size < 1 || 400 < size) {
|
||||||
throw new IllegalArgumentException("Minimum inclusive = 1. Maximum inclusive = 400.");
|
throw new IllegalArgumentException("Minimum inclusive = 1. Maximum inclusive = 400.");
|
||||||
} else {
|
} else {
|
||||||
@ -129,12 +147,24 @@ public class XDDFRunProperties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setFillProperties(XDDFFillProperties properties) {
|
public void setFillProperties(XDDFFillProperties properties) {
|
||||||
|
if (props.isSetBlipFill()) {
|
||||||
props.unsetBlipFill();
|
props.unsetBlipFill();
|
||||||
|
}
|
||||||
|
if (props.isSetGradFill()) {
|
||||||
props.unsetGradFill();
|
props.unsetGradFill();
|
||||||
|
}
|
||||||
|
if (props.isSetGrpFill()) {
|
||||||
props.unsetGrpFill();
|
props.unsetGrpFill();
|
||||||
|
}
|
||||||
|
if (props.isSetNoFill()) {
|
||||||
props.unsetNoFill();
|
props.unsetNoFill();
|
||||||
|
}
|
||||||
|
if (props.isSetPattFill()) {
|
||||||
props.unsetPattFill();
|
props.unsetPattFill();
|
||||||
|
}
|
||||||
|
if (props.isSetSolidFill()) {
|
||||||
props.unsetSolidFill();
|
props.unsetSolidFill();
|
||||||
|
}
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -155,7 +185,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setCharacterKerning(Double kerning) {
|
public void setCharacterKerning(Double kerning) {
|
||||||
if (kerning == null) {
|
if (kerning == null) {
|
||||||
|
if (props.isSetKern()) {
|
||||||
props.unsetKern();
|
props.unsetKern();
|
||||||
|
}
|
||||||
} else if (kerning < 0 || 4000 < kerning) {
|
} else if (kerning < 0 || 4000 < kerning) {
|
||||||
throw new IllegalArgumentException("Minimum inclusive = 0. Maximum inclusive = 4000.");
|
throw new IllegalArgumentException("Minimum inclusive = 0. Maximum inclusive = 4000.");
|
||||||
} else {
|
} else {
|
||||||
@ -165,7 +197,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setCharacterSpacing(Double spacing) {
|
public void setCharacterSpacing(Double spacing) {
|
||||||
if (spacing == null) {
|
if (spacing == null) {
|
||||||
|
if (props.isSetSpc()) {
|
||||||
props.unsetSpc();
|
props.unsetSpc();
|
||||||
|
}
|
||||||
} else if (spacing < -4000 || 4000 < spacing) {
|
} else if (spacing < -4000 || 4000 < spacing) {
|
||||||
throw new IllegalArgumentException("Minimum inclusive = -4000. Maximum inclusive = 4000.");
|
throw new IllegalArgumentException("Minimum inclusive = -4000. Maximum inclusive = 4000.");
|
||||||
} else {
|
} else {
|
||||||
@ -179,25 +213,33 @@ public class XDDFRunProperties {
|
|||||||
switch (font.getGroup()) {
|
switch (font.getGroup()) {
|
||||||
case COMPLEX_SCRIPT:
|
case COMPLEX_SCRIPT:
|
||||||
if (xml == null) {
|
if (xml == null) {
|
||||||
|
if (props.isSetCs()) {
|
||||||
props.unsetCs();
|
props.unsetCs();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setCs(xml);
|
props.setCs(xml);
|
||||||
}
|
}
|
||||||
case EAST_ASIAN:
|
case EAST_ASIAN:
|
||||||
if (xml == null) {
|
if (xml == null) {
|
||||||
|
if (props.isSetEa()) {
|
||||||
props.unsetEa();
|
props.unsetEa();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setEa(xml);
|
props.setEa(xml);
|
||||||
}
|
}
|
||||||
case LATIN:
|
case LATIN:
|
||||||
if (xml == null) {
|
if (xml == null) {
|
||||||
|
if (props.isSetLatin()) {
|
||||||
props.unsetLatin();
|
props.unsetLatin();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setLatin(xml);
|
props.setLatin(xml);
|
||||||
}
|
}
|
||||||
case SYMBOL:
|
case SYMBOL:
|
||||||
if (xml == null) {
|
if (xml == null) {
|
||||||
|
if (props.isSetSym()) {
|
||||||
props.unsetSym();
|
props.unsetSym();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setSym(xml);
|
props.setSym(xml);
|
||||||
}
|
}
|
||||||
@ -207,7 +249,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setUnderline(UnderlineType underline) {
|
public void setUnderline(UnderlineType underline) {
|
||||||
if (underline == null) {
|
if (underline == null) {
|
||||||
|
if (props.isSetU()) {
|
||||||
props.unsetU();
|
props.unsetU();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setU(underline.underlying);
|
props.setU(underline.underlying);
|
||||||
}
|
}
|
||||||
@ -215,7 +259,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setStrikeThrough(StrikeType strike) {
|
public void setStrikeThrough(StrikeType strike) {
|
||||||
if (strike == null) {
|
if (strike == null) {
|
||||||
|
if (props.isSetStrike()) {
|
||||||
props.unsetStrike();
|
props.unsetStrike();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setStrike(strike.underlying);
|
props.setStrike(strike.underlying);
|
||||||
}
|
}
|
||||||
@ -223,7 +269,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setCapitals(CapsType caps) {
|
public void setCapitals(CapsType caps) {
|
||||||
if (caps == null) {
|
if (caps == null) {
|
||||||
|
if (props.isSetCap()) {
|
||||||
props.unsetCap();
|
props.unsetCap();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setCap(caps.underlying);
|
props.setCap(caps.underlying);
|
||||||
}
|
}
|
||||||
@ -231,7 +279,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setHyperlink(XDDFHyperlink link) {
|
public void setHyperlink(XDDFHyperlink link) {
|
||||||
if (link == null) {
|
if (link == null) {
|
||||||
|
if (props.isSetHlinkClick()) {
|
||||||
props.unsetHlinkClick();
|
props.unsetHlinkClick();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setHlinkClick(link.getXmlObject());
|
props.setHlinkClick(link.getXmlObject());
|
||||||
}
|
}
|
||||||
@ -239,7 +289,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setMouseOver(XDDFHyperlink link) {
|
public void setMouseOver(XDDFHyperlink link) {
|
||||||
if (link == null) {
|
if (link == null) {
|
||||||
|
if (props.isSetHlinkMouseOver()) {
|
||||||
props.unsetHlinkMouseOver();
|
props.unsetHlinkMouseOver();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setHlinkMouseOver(link.getXmlObject());
|
props.setHlinkMouseOver(link.getXmlObject());
|
||||||
}
|
}
|
||||||
@ -247,7 +299,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setLanguage(Locale lang) {
|
public void setLanguage(Locale lang) {
|
||||||
if (lang == null) {
|
if (lang == null) {
|
||||||
|
if (props.isSetLang()) {
|
||||||
props.unsetLang();
|
props.unsetLang();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setLang(lang.toLanguageTag());
|
props.setLang(lang.toLanguageTag());
|
||||||
}
|
}
|
||||||
@ -255,7 +309,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setAlternativeLanguage(Locale lang) {
|
public void setAlternativeLanguage(Locale lang) {
|
||||||
if (lang == null) {
|
if (lang == null) {
|
||||||
|
if (props.isSetAltLang()) {
|
||||||
props.unsetAltLang();
|
props.unsetAltLang();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setAltLang(lang.toLanguageTag());
|
props.setAltLang(lang.toLanguageTag());
|
||||||
}
|
}
|
||||||
@ -263,7 +319,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setHighlight(XDDFColor color) {
|
public void setHighlight(XDDFColor color) {
|
||||||
if (color == null) {
|
if (color == null) {
|
||||||
|
if (props.isSetHighlight()) {
|
||||||
props.unsetHighlight();
|
props.unsetHighlight();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setHighlight(color.getColorContainer());
|
props.setHighlight(color.getColorContainer());
|
||||||
}
|
}
|
||||||
@ -271,7 +329,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setLineProperties(XDDFLineProperties properties) {
|
public void setLineProperties(XDDFLineProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
|
if (props.isSetLn()) {
|
||||||
props.unsetLn();
|
props.unsetLn();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setLn(properties.getXmlObject());
|
props.setLn(properties.getXmlObject());
|
||||||
}
|
}
|
||||||
@ -279,7 +339,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setBookmark(String bookmark) {
|
public void setBookmark(String bookmark) {
|
||||||
if (bookmark == null) {
|
if (bookmark == null) {
|
||||||
|
if (props.isSetBmk()) {
|
||||||
props.unsetBmk();
|
props.unsetBmk();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setBmk(bookmark);
|
props.setBmk(bookmark);
|
||||||
}
|
}
|
||||||
@ -295,7 +357,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setExtensionList(XDDFExtensionList list) {
|
public void setExtensionList(XDDFExtensionList list) {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
|
if (props.isSetExtLst()) {
|
||||||
props.unsetExtLst();
|
props.unsetExtLst();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setExtLst(list.getXmlObject());
|
props.setExtLst(list.getXmlObject());
|
||||||
}
|
}
|
||||||
@ -311,7 +375,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setEffectContainer(XDDFEffectContainer container) {
|
public void setEffectContainer(XDDFEffectContainer container) {
|
||||||
if (container == null) {
|
if (container == null) {
|
||||||
|
if (props.isSetEffectDag()) {
|
||||||
props.unsetEffectDag();
|
props.unsetEffectDag();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setEffectDag(container.getXmlObject());
|
props.setEffectDag(container.getXmlObject());
|
||||||
}
|
}
|
||||||
@ -327,7 +393,9 @@ public class XDDFRunProperties {
|
|||||||
|
|
||||||
public void setEffectList(XDDFEffectList list) {
|
public void setEffectList(XDDFEffectList list) {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
|
if (props.isSetEffectLst()) {
|
||||||
props.unsetEffectLst();
|
props.unsetEffectLst();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
props.setEffectLst(list.getXmlObject());
|
props.setEffectLst(list.getXmlObject());
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,9 @@ public class XDDFSpacingPercent extends XDDFSpacing {
|
|||||||
|
|
||||||
public XDDFSpacingPercent(double value) {
|
public XDDFSpacingPercent(double value) {
|
||||||
this(CTTextSpacing.Factory.newInstance(), CTTextSpacingPercent.Factory.newInstance(), null);
|
this(CTTextSpacing.Factory.newInstance(), CTTextSpacingPercent.Factory.newInstance(), null);
|
||||||
|
if (spacing.isSetSpcPts()) {
|
||||||
spacing.unsetSpcPts();
|
spacing.unsetSpcPts();
|
||||||
|
}
|
||||||
spacing.setSpcPct(percent);
|
spacing.setSpcPct(percent);
|
||||||
setPercent(value);
|
setPercent(value);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,9 @@ public class XDDFSpacingPoints extends XDDFSpacing {
|
|||||||
|
|
||||||
public XDDFSpacingPoints(double value) {
|
public XDDFSpacingPoints(double value) {
|
||||||
this(CTTextSpacing.Factory.newInstance(), CTTextSpacingPoint.Factory.newInstance());
|
this(CTTextSpacing.Factory.newInstance(), CTTextSpacingPoint.Factory.newInstance());
|
||||||
|
if (spacing.isSetSpcPct()) {
|
||||||
spacing.unsetSpcPct();
|
spacing.unsetSpcPct();
|
||||||
|
}
|
||||||
spacing.setSpcPts(points);
|
spacing.setSpcPts(points);
|
||||||
setPoints(value);
|
setPoints(value);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,9 @@ public class XDDFTabStop {
|
|||||||
|
|
||||||
public void setAlignment(TabAlignment align) {
|
public void setAlignment(TabAlignment align) {
|
||||||
if (align == null) {
|
if (align == null) {
|
||||||
|
if (stop.isSetAlgn()) {
|
||||||
stop.unsetAlgn();
|
stop.unsetAlgn();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
stop.setAlgn(align.underlying);
|
stop.setAlgn(align.underlying);
|
||||||
}
|
}
|
||||||
@ -62,7 +64,9 @@ public class XDDFTabStop {
|
|||||||
|
|
||||||
public void setPosition(Double position) {
|
public void setPosition(Double position) {
|
||||||
if (position == null) {
|
if (position == null) {
|
||||||
|
if (stop.isSetPos()) {
|
||||||
stop.unsetPos();
|
stop.unsetPos();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
stop.setPos(Units.toEMU(position));
|
stop.setPos(Units.toEMU(position));
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ package org.apache.poi.xddf.usermodel.text;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -37,7 +38,7 @@ public class XDDFTextBody {
|
|||||||
|
|
||||||
public XDDFTextBody(TextContainer parent) {
|
public XDDFTextBody(TextContainer parent) {
|
||||||
this(parent, CTTextBody.Factory.newInstance());
|
this(parent, CTTextBody.Factory.newInstance());
|
||||||
this._body.addNewBodyPr();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Internal
|
@Internal
|
||||||
@ -55,6 +56,20 @@ public class XDDFTextBody {
|
|||||||
return _parent;
|
return _parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XDDFTextParagraph initialize() {
|
||||||
|
_body.addNewLstStyle();
|
||||||
|
_body.addNewBodyPr();
|
||||||
|
XDDFBodyProperties bp = getBodyProperties();
|
||||||
|
bp.setAnchoring(AnchorType.TOP);
|
||||||
|
bp.setRightToLeft(false);
|
||||||
|
XDDFTextParagraph p = addNewParagraph();
|
||||||
|
p.setTextAlignment(TextAlignment.LEFT);
|
||||||
|
XDDFRunProperties end = p.addAfterLastRunProperties();
|
||||||
|
end.setLanguage(Locale.US);
|
||||||
|
end.setFontSize(11.0);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
public XDDFTextParagraph addNewParagraph() {
|
public XDDFTextParagraph addNewParagraph() {
|
||||||
return new XDDFTextParagraph(_body.addNewP(), this);
|
return new XDDFTextParagraph(_body.addNewP(), this);
|
||||||
}
|
}
|
||||||
@ -72,11 +87,8 @@ public class XDDFTextBody {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<XDDFTextParagraph> getParagraphs() {
|
public List<XDDFTextParagraph> getParagraphs() {
|
||||||
return Collections.unmodifiableList(_body
|
return Collections.unmodifiableList(
|
||||||
.getPList()
|
_body.getPList().stream().map(ds -> new XDDFTextParagraph(ds, this)).collect(Collectors.toList()));
|
||||||
.stream()
|
|
||||||
.map(ds -> new XDDFTextParagraph(ds, this))
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public XDDFBodyProperties getBodyProperties() {
|
public XDDFBodyProperties getBodyProperties() {
|
||||||
@ -102,7 +114,10 @@ public class XDDFTextBody {
|
|||||||
public void setDefaultProperties(XDDFParagraphProperties properties) {
|
public void setDefaultProperties(XDDFParagraphProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
if (_body.isSetLstStyle()) {
|
if (_body.isSetLstStyle()) {
|
||||||
_body.getLstStyle().unsetDefPPr();
|
CTTextListStyle style = _body.getLstStyle();
|
||||||
|
if (style.isSetDefPPr()) {
|
||||||
|
style.unsetDefPPr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
||||||
@ -121,7 +136,10 @@ public class XDDFTextBody {
|
|||||||
public void setLevel1Properties(XDDFParagraphProperties properties) {
|
public void setLevel1Properties(XDDFParagraphProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
if (_body.isSetLstStyle()) {
|
if (_body.isSetLstStyle()) {
|
||||||
_body.getLstStyle().unsetLvl1PPr();
|
CTTextListStyle style = _body.getLstStyle();
|
||||||
|
if (style.isSetLvl1PPr()) {
|
||||||
|
style.unsetLvl1PPr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
||||||
@ -140,7 +158,10 @@ public class XDDFTextBody {
|
|||||||
public void setLevel2Properties(XDDFParagraphProperties properties) {
|
public void setLevel2Properties(XDDFParagraphProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
if (_body.isSetLstStyle()) {
|
if (_body.isSetLstStyle()) {
|
||||||
_body.getLstStyle().unsetLvl2PPr();
|
CTTextListStyle style = _body.getLstStyle();
|
||||||
|
if (style.isSetLvl2PPr()) {
|
||||||
|
style.unsetLvl2PPr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
||||||
@ -159,7 +180,10 @@ public class XDDFTextBody {
|
|||||||
public void setLevel3Properties(XDDFParagraphProperties properties) {
|
public void setLevel3Properties(XDDFParagraphProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
if (_body.isSetLstStyle()) {
|
if (_body.isSetLstStyle()) {
|
||||||
_body.getLstStyle().unsetLvl3PPr();
|
CTTextListStyle style = _body.getLstStyle();
|
||||||
|
if (style.isSetLvl3PPr()) {
|
||||||
|
style.unsetLvl3PPr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
||||||
@ -178,7 +202,10 @@ public class XDDFTextBody {
|
|||||||
public void setLevel4Properties(XDDFParagraphProperties properties) {
|
public void setLevel4Properties(XDDFParagraphProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
if (_body.isSetLstStyle()) {
|
if (_body.isSetLstStyle()) {
|
||||||
_body.getLstStyle().unsetLvl4PPr();
|
CTTextListStyle style = _body.getLstStyle();
|
||||||
|
if (style.isSetLvl4PPr()) {
|
||||||
|
style.unsetLvl4PPr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
||||||
@ -197,7 +224,10 @@ public class XDDFTextBody {
|
|||||||
public void setLevel5Properties(XDDFParagraphProperties properties) {
|
public void setLevel5Properties(XDDFParagraphProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
if (_body.isSetLstStyle()) {
|
if (_body.isSetLstStyle()) {
|
||||||
_body.getLstStyle().unsetLvl5PPr();
|
CTTextListStyle style = _body.getLstStyle();
|
||||||
|
if (style.isSetLvl5PPr()) {
|
||||||
|
style.unsetLvl5PPr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
||||||
@ -216,7 +246,10 @@ public class XDDFTextBody {
|
|||||||
public void setLevel6Properties(XDDFParagraphProperties properties) {
|
public void setLevel6Properties(XDDFParagraphProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
if (_body.isSetLstStyle()) {
|
if (_body.isSetLstStyle()) {
|
||||||
_body.getLstStyle().unsetLvl6PPr();
|
CTTextListStyle style = _body.getLstStyle();
|
||||||
|
if (style.isSetLvl6PPr()) {
|
||||||
|
style.unsetLvl6PPr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
||||||
@ -235,7 +268,10 @@ public class XDDFTextBody {
|
|||||||
public void setLevel7Properties(XDDFParagraphProperties properties) {
|
public void setLevel7Properties(XDDFParagraphProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
if (_body.isSetLstStyle()) {
|
if (_body.isSetLstStyle()) {
|
||||||
_body.getLstStyle().unsetLvl7PPr();
|
CTTextListStyle style = _body.getLstStyle();
|
||||||
|
if (style.isSetLvl7PPr()) {
|
||||||
|
style.unsetLvl7PPr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
||||||
@ -254,7 +290,10 @@ public class XDDFTextBody {
|
|||||||
public void setLevel8Properties(XDDFParagraphProperties properties) {
|
public void setLevel8Properties(XDDFParagraphProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
if (_body.isSetLstStyle()) {
|
if (_body.isSetLstStyle()) {
|
||||||
_body.getLstStyle().unsetLvl8PPr();
|
CTTextListStyle style = _body.getLstStyle();
|
||||||
|
if (style.isSetLvl8PPr()) {
|
||||||
|
style.unsetLvl8PPr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
||||||
@ -273,7 +312,10 @@ public class XDDFTextBody {
|
|||||||
public void setLevel9Properties(XDDFParagraphProperties properties) {
|
public void setLevel9Properties(XDDFParagraphProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
if (_body.isSetLstStyle()) {
|
if (_body.isSetLstStyle()) {
|
||||||
_body.getLstStyle().unsetLvl9PPr();
|
CTTextListStyle style = _body.getLstStyle();
|
||||||
|
if (style.isSetLvl9PPr()) {
|
||||||
|
style.unsetLvl9PPr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
CTTextListStyle style = _body.isSetLstStyle() ? _body.getLstStyle() : _body.addNewLstStyle();
|
||||||
@ -292,8 +334,10 @@ public class XDDFTextBody {
|
|||||||
} else {
|
} else {
|
||||||
return findDefinedParagraphProperty(isSet, getter, level - 1);
|
return findDefinedParagraphProperty(isSet, getter, level - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (_parent != null) {
|
||||||
return _parent.findDefinedParagraphProperty(isSet, getter);
|
return _parent.findDefinedParagraphProperty(isSet, getter);
|
||||||
|
} else {
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,59 +352,71 @@ public class XDDFTextBody {
|
|||||||
} else {
|
} else {
|
||||||
return findDefinedRunProperty(isSet, getter, level - 1);
|
return findDefinedRunProperty(isSet, getter, level - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (_parent != null) {
|
||||||
return _parent.findDefinedRunProperty(isSet, getter);
|
return _parent.findDefinedRunProperty(isSet, getter);
|
||||||
|
} else {
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CTTextParagraphProperties retrieveProperties(CTTextListStyle list, int level) {
|
private CTTextParagraphProperties retrieveProperties(CTTextListStyle list, int level) {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case 1: if (list.isSetLvl1PPr()) {
|
case 1:
|
||||||
|
if (list.isSetLvl1PPr()) {
|
||||||
return list.getLvl1PPr();
|
return list.getLvl1PPr();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case 2: if (list.isSetLvl2PPr()) {
|
case 2:
|
||||||
|
if (list.isSetLvl2PPr()) {
|
||||||
return list.getLvl2PPr();
|
return list.getLvl2PPr();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case 3: if (list.isSetLvl3PPr()) {
|
case 3:
|
||||||
|
if (list.isSetLvl3PPr()) {
|
||||||
return list.getLvl3PPr();
|
return list.getLvl3PPr();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case 4: if (list.isSetLvl4PPr()) {
|
case 4:
|
||||||
|
if (list.isSetLvl4PPr()) {
|
||||||
return list.getLvl4PPr();
|
return list.getLvl4PPr();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case 5: if (list.isSetLvl5PPr()) {
|
case 5:
|
||||||
|
if (list.isSetLvl5PPr()) {
|
||||||
return list.getLvl5PPr();
|
return list.getLvl5PPr();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case 6: if (list.isSetLvl6PPr()) {
|
case 6:
|
||||||
|
if (list.isSetLvl6PPr()) {
|
||||||
return list.getLvl6PPr();
|
return list.getLvl6PPr();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case 7: if (list.isSetLvl7PPr()) {
|
case 7:
|
||||||
|
if (list.isSetLvl7PPr()) {
|
||||||
return list.getLvl7PPr();
|
return list.getLvl7PPr();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case 8: if (list.isSetLvl8PPr()) {
|
case 8:
|
||||||
|
if (list.isSetLvl8PPr()) {
|
||||||
return list.getLvl8PPr();
|
return list.getLvl8PPr();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case 9: if (list.isSetLvl9PPr()) {
|
case 9:
|
||||||
|
if (list.isSetLvl9PPr()) {
|
||||||
return list.getLvl9PPr();
|
return list.getLvl9PPr();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
default: return null;
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,8 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties
|
|||||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextSpacing;
|
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextSpacing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a paragraph of text within the containing text body.
|
* Represents a paragraph of text within the containing text body. The paragraph
|
||||||
* The paragraph is the highest level text separation mechanism.
|
* is the highest level text separation mechanism.
|
||||||
*/
|
*/
|
||||||
@Beta
|
@Beta
|
||||||
public class XDDFTextParagraph {
|
public class XDDFTextParagraph {
|
||||||
@ -55,9 +55,7 @@ public class XDDFTextParagraph {
|
|||||||
this._p = paragraph;
|
this._p = paragraph;
|
||||||
this._parent = parent;
|
this._parent = parent;
|
||||||
|
|
||||||
final int count = paragraph.sizeOfBrArray()
|
final int count = paragraph.sizeOfBrArray() + paragraph.sizeOfFldArray() + paragraph.sizeOfRArray();
|
||||||
+ paragraph.sizeOfFldArray()
|
|
||||||
+ paragraph.sizeOfRArray();
|
|
||||||
this._runs = new ArrayList<>(count);
|
this._runs = new ArrayList<>(count);
|
||||||
|
|
||||||
for (XmlObject xo : _p.selectChildren(QNameSet.ALL)) {
|
for (XmlObject xo : _p.selectChildren(QNameSet.ALL)) {
|
||||||
@ -148,19 +146,20 @@ public class XDDFTextParagraph {
|
|||||||
* Returns the alignment that is applied to the paragraph.
|
* Returns the alignment that is applied to the paragraph.
|
||||||
*
|
*
|
||||||
* If this attribute is omitted, then a value of left is implied.
|
* If this attribute is omitted, then a value of left is implied.
|
||||||
|
*
|
||||||
* @return alignment that is applied to the paragraph
|
* @return alignment that is applied to the paragraph
|
||||||
*/
|
*/
|
||||||
public TextAlignment getTextAlignment() {
|
public TextAlignment getTextAlignment() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetAlgn(), props -> props.getAlgn())
|
return findDefinedParagraphProperty(props -> props.isSetAlgn(), props -> props.getAlgn())
|
||||||
.map(align -> TextAlignment.valueOf(align))
|
.map(align -> TextAlignment.valueOf(align)).orElse(null);
|
||||||
.orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the alignment that is to be applied to the paragraph.
|
* Specifies the alignment that is to be applied to the paragraph. Possible
|
||||||
* Possible values for this include left, right, centered, justified and distributed,
|
* values for this include left, right, centered, justified and distributed,
|
||||||
*
|
*
|
||||||
* @param align text alignment
|
* @param align
|
||||||
|
* text alignment
|
||||||
*/
|
*/
|
||||||
public void setTextAlignment(TextAlignment align) {
|
public void setTextAlignment(TextAlignment align) {
|
||||||
if (align != null || _p.isSetPPr()) {
|
if (align != null || _p.isSetPPr()) {
|
||||||
@ -169,25 +168,27 @@ public class XDDFTextParagraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns where vertically on a line of text the actual words are positioned. This deals
|
* Returns where vertically on a line of text the actual words are
|
||||||
* with vertical placement of the characters with respect to the baselines.
|
* positioned. This deals with vertical placement of the characters with
|
||||||
|
* respect to the baselines.
|
||||||
*
|
*
|
||||||
* If this attribute is omitted, then a value of baseline is implied.
|
* If this attribute is omitted, then a value of baseline is implied.
|
||||||
|
*
|
||||||
* @return alignment that is applied to the paragraph
|
* @return alignment that is applied to the paragraph
|
||||||
*/
|
*/
|
||||||
public FontAlignment getFontAlignment() {
|
public FontAlignment getFontAlignment() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetFontAlgn(), props -> props.getFontAlgn())
|
return findDefinedParagraphProperty(props -> props.isSetFontAlgn(), props -> props.getFontAlgn())
|
||||||
.map(align -> FontAlignment.valueOf(align))
|
.map(align -> FontAlignment.valueOf(align)).orElse(null);
|
||||||
.orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines where vertically on a line of text the actual words are positioned. This deals
|
* Determines where vertically on a line of text the actual words are
|
||||||
* with vertical placement of the characters with respect to the baselines. For instance
|
* positioned. This deals with vertical placement of the characters with
|
||||||
* having text anchored to the top baseline, anchored to the bottom baseline, centered in
|
* respect to the baselines. For instance having text anchored to the top
|
||||||
* between, etc.
|
* baseline, anchored to the bottom baseline, centered in between, etc.
|
||||||
*
|
*
|
||||||
* @param align text font alignment
|
* @param align
|
||||||
|
* text font alignment
|
||||||
*/
|
*/
|
||||||
public void setFontAlignment(FontAlignment align) {
|
public void setFontAlignment(FontAlignment align) {
|
||||||
if (align != null || _p.isSetPPr()) {
|
if (align != null || _p.isSetPPr()) {
|
||||||
@ -197,27 +198,31 @@ public class XDDFTextParagraph {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return the indentation, in points, applied to the first line of text in the paragraph.
|
* @return the indentation, in points, applied to the first line of text in
|
||||||
|
* the paragraph.
|
||||||
*/
|
*/
|
||||||
public Double getIndentation() {
|
public Double getIndentation() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetIndent(), props -> props.getIndent())
|
return findDefinedParagraphProperty(props -> props.isSetIndent(), props -> props.getIndent())
|
||||||
.map(emu -> Units.toPoints(emu))
|
.map(emu -> Units.toPoints(emu)).orElse(null);
|
||||||
.orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the indentation size that will be applied to the first line of text in the paragraph.
|
* Specifies the indentation size that will be applied to the first line of
|
||||||
|
* text in the paragraph.
|
||||||
*
|
*
|
||||||
* @param points the indentation in points.
|
* @param points
|
||||||
* The value <code>null</code> unsets the indentation for this paragraph.
|
* the indentation in points. The value <code>null</code> unsets
|
||||||
|
* the indentation for this paragraph.
|
||||||
* <dl>
|
* <dl>
|
||||||
* <dt>Minimum inclusive =</dt><dd>-4032</dd>
|
* <dt>Minimum inclusive =</dt>
|
||||||
* <dt>Maximum inclusive =</dt><dd>4032</dd>
|
* <dd>-4032</dd>
|
||||||
* </dt>
|
* <dt>Maximum inclusive =</dt>
|
||||||
|
* <dd>4032</dd></dt>
|
||||||
*/
|
*/
|
||||||
public void setIndentation(Double points) {
|
public void setIndentation(Double points) {
|
||||||
if (points != null || _p.isSetPPr()) {
|
if (points != null || _p.isSetPPr()) {
|
||||||
getOrCreateProperties().setIndentation(points);;
|
getOrCreateProperties().setIndentation(points);
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,21 +232,23 @@ public class XDDFTextParagraph {
|
|||||||
*/
|
*/
|
||||||
public Double getMarginLeft() {
|
public Double getMarginLeft() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetMarL(), props -> props.getMarL())
|
return findDefinedParagraphProperty(props -> props.isSetMarL(), props -> props.getMarL())
|
||||||
.map(emu -> Units.toPoints(emu))
|
.map(emu -> Units.toPoints(emu)).orElse(null);
|
||||||
.orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the left margin of the paragraph. This is specified in addition to the text body
|
* Specifies the left margin of the paragraph. This is specified in addition
|
||||||
* inset and applies only to this text paragraph. That is the text body inset and the LeftMargin
|
* to the text body inset and applies only to this text paragraph. That is
|
||||||
* attributes are additive with respect to the text position.
|
* the text body inset and the LeftMargin attributes are additive with
|
||||||
|
* respect to the text position.
|
||||||
*
|
*
|
||||||
* @param points the margin in points.
|
* @param points
|
||||||
* The value <code>null</code> unsets the left margin for this paragraph.
|
* the margin in points. The value <code>null</code> unsets the
|
||||||
|
* left margin for this paragraph.
|
||||||
* <dl>
|
* <dl>
|
||||||
* <dt>Minimum inclusive =</dt><dd>0</dd>
|
* <dt>Minimum inclusive =</dt>
|
||||||
* <dt>Maximum inclusive =</dt><dd>4032</dd>
|
* <dd>0</dd>
|
||||||
* </dt>
|
* <dt>Maximum inclusive =</dt>
|
||||||
|
* <dd>4032</dd></dt>
|
||||||
*/
|
*/
|
||||||
public void setMarginLeft(Double points) {
|
public void setMarginLeft(Double points) {
|
||||||
if (points != null || _p.isSetPPr()) {
|
if (points != null || _p.isSetPPr()) {
|
||||||
@ -255,21 +262,23 @@ public class XDDFTextParagraph {
|
|||||||
*/
|
*/
|
||||||
public Double getMarginRight() {
|
public Double getMarginRight() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetMarR(), props -> props.getMarR())
|
return findDefinedParagraphProperty(props -> props.isSetMarR(), props -> props.getMarR())
|
||||||
.map(emu -> Units.toPoints(emu))
|
.map(emu -> Units.toPoints(emu)).orElse(null);
|
||||||
.orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the right margin of the paragraph. This is specified in addition to the text body
|
* Specifies the right margin of the paragraph. This is specified in
|
||||||
* inset and applies only to this text paragraph. That is the text body inset and the RightMargin
|
* addition to the text body inset and applies only to this text paragraph.
|
||||||
* attributes are additive with respect to the text position.
|
* That is the text body inset and the RightMargin attributes are additive
|
||||||
|
* with respect to the text position.
|
||||||
*
|
*
|
||||||
* @param points the margin in points.
|
* @param points
|
||||||
* The value <code>null</code> unsets the right margin for this paragraph.
|
* the margin in points. The value <code>null</code> unsets the
|
||||||
|
* right margin for this paragraph.
|
||||||
* <dl>
|
* <dl>
|
||||||
* <dt>Minimum inclusive =</dt><dd>0</dd>
|
* <dt>Minimum inclusive =</dt>
|
||||||
* <dt>Maximum inclusive =</dt><dd>4032</dd>
|
* <dd>0</dd>
|
||||||
* </dt>
|
* <dt>Maximum inclusive =</dt>
|
||||||
|
* <dd>4032</dd></dt>
|
||||||
*/
|
*/
|
||||||
public void setMarginRight(Double points) {
|
public void setMarginRight(Double points) {
|
||||||
if (points != null || _p.isSetPPr()) {
|
if (points != null || _p.isSetPPr()) {
|
||||||
@ -279,19 +288,20 @@ public class XDDFTextParagraph {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return the default size for a tab character within this paragraph in points.
|
* @return the default size for a tab character within this paragraph in
|
||||||
|
* points.
|
||||||
*/
|
*/
|
||||||
public Double getDefaultTabSize() {
|
public Double getDefaultTabSize() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetDefTabSz(), props -> props.getDefTabSz())
|
return findDefinedParagraphProperty(props -> props.isSetDefTabSz(), props -> props.getDefTabSz())
|
||||||
.map(emu -> Units.toPoints(emu))
|
.map(emu -> Units.toPoints(emu)).orElse(null);
|
||||||
.orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the default size for a tab character within this paragraph.
|
* Specifies the default size for a tab character within this paragraph.
|
||||||
*
|
*
|
||||||
* @param points the default tab size in points.
|
* @param points
|
||||||
* The value <code>null</code> unsets the default tab size for this paragraph.
|
* the default tab size in points. The value <code>null</code>
|
||||||
|
* unsets the default tab size for this paragraph.
|
||||||
*/
|
*/
|
||||||
public void setDefaultTabSize(Double points) {
|
public void setDefaultTabSize(Double points) {
|
||||||
if (points != null || _p.isSetPPr()) {
|
if (points != null || _p.isSetPPr()) {
|
||||||
@ -301,30 +311,35 @@ public class XDDFTextParagraph {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the vertical line spacing that is to be used within a paragraph.
|
* Returns the vertical line spacing that is to be used within a paragraph.
|
||||||
* This may be specified in two different ways, percentage spacing or font points spacing:
|
* This may be specified in two different ways, percentage spacing or font
|
||||||
|
* points spacing:
|
||||||
* <p>
|
* <p>
|
||||||
* If line spacing is a percentage of normal line height, result is instance of XDDFSpacingPercent.
|
* If line spacing is a percentage of normal line height, result is instance
|
||||||
* If line spacing is expressed in points, result is instance of XDDFSpacingPoints.
|
* of XDDFSpacingPercent. If line spacing is expressed in points, result is
|
||||||
|
* instance of XDDFSpacingPoints.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return the vertical line spacing.
|
* @return the vertical line spacing.
|
||||||
*/
|
*/
|
||||||
public XDDFSpacing getLineSpacing() {
|
public XDDFSpacing getLineSpacing() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetLnSpc(), props -> props.getLnSpc())
|
return findDefinedParagraphProperty(props -> props.isSetLnSpc(), props -> props.getLnSpc())
|
||||||
.map(spacing -> extractSpacing(spacing))
|
.map(spacing -> extractSpacing(spacing)).orElse(null);
|
||||||
.orElse(null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This element specifies the vertical line spacing that is to be used within a paragraph.
|
* This element specifies the vertical line spacing that is to be used
|
||||||
* This may be specified in two different ways, percentage spacing or font points spacing:
|
* within a paragraph. This may be specified in two different ways,
|
||||||
|
* percentage spacing or font points spacing:
|
||||||
* <p>
|
* <p>
|
||||||
* If spacing is instance of XDDFSpacingPercent, then line spacing is a percentage of normal line height.
|
* If spacing is instance of XDDFSpacingPercent, then line spacing is a
|
||||||
* If spacing is instance of XDDFSpacingPoints, then line spacing is expressed in points.
|
* percentage of normal line height. If spacing is instance of
|
||||||
|
* XDDFSpacingPoints, then line spacing is expressed in points.
|
||||||
* </p>
|
* </p>
|
||||||
* Examples:
|
* Examples:
|
||||||
* <pre><code>
|
*
|
||||||
|
* <pre>
|
||||||
|
* <code>
|
||||||
* // spacing will be 120% of the size of the largest text on each line
|
* // spacing will be 120% of the size of the largest text on each line
|
||||||
* paragraph.setLineSpacing(new XDDFSpacingPercent(120));
|
* paragraph.setLineSpacing(new XDDFSpacingPercent(120));
|
||||||
*
|
*
|
||||||
@ -333,9 +348,11 @@ public class XDDFTextParagraph {
|
|||||||
*
|
*
|
||||||
* // spacing will be 48 points
|
* // spacing will be 48 points
|
||||||
* paragraph.setLineSpacing(new XDDFSpacingPoints(48.0));
|
* paragraph.setLineSpacing(new XDDFSpacingPoints(48.0));
|
||||||
* </code></pre>
|
* </code>
|
||||||
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param linespacing the vertical line spacing
|
* @param linespacing
|
||||||
|
* the vertical line spacing
|
||||||
*/
|
*/
|
||||||
public void setLineSpacing(XDDFSpacing linespacing) {
|
public void setLineSpacing(XDDFSpacing linespacing) {
|
||||||
if (linespacing != null || _p.isSetPPr()) {
|
if (linespacing != null || _p.isSetPPr()) {
|
||||||
@ -344,39 +361,46 @@ public class XDDFTextParagraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of vertical white space before the paragraph.
|
* The amount of vertical white space before the paragraph. This may be
|
||||||
* This may be specified in two different ways, percentage spacing or font points spacing:
|
* specified in two different ways, percentage spacing or font points
|
||||||
|
* spacing:
|
||||||
* <p>
|
* <p>
|
||||||
* If spacing is a percentage of normal line height, result is instance of XDDFSpacingPercent.
|
* If spacing is a percentage of normal line height, result is instance of
|
||||||
* If spacing is expressed in points, result is instance of XDDFSpacingPoints.
|
* XDDFSpacingPercent. If spacing is expressed in points, result is instance
|
||||||
|
* of XDDFSpacingPoints.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return the vertical white space before the paragraph.
|
* @return the vertical white space before the paragraph.
|
||||||
*/
|
*/
|
||||||
public XDDFSpacing getSpaceBefore() {
|
public XDDFSpacing getSpaceBefore() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetSpcBef(), props -> props.getSpcBef())
|
return findDefinedParagraphProperty(props -> props.isSetSpcBef(), props -> props.getSpcBef())
|
||||||
.map(spacing -> extractSpacing(spacing))
|
.map(spacing -> extractSpacing(spacing)).orElse(null);
|
||||||
.orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the amount of vertical white space that will be present before the paragraph.
|
* Set the amount of vertical white space that will be present before the
|
||||||
* This may be specified in two different ways, percentage spacing or font points spacing:
|
* paragraph. This may be specified in two different ways, percentage
|
||||||
|
* spacing or font points spacing:
|
||||||
* <p>
|
* <p>
|
||||||
* If spacing is instance of XDDFSpacingPercent, then spacing is a percentage of normal line height.
|
* If spacing is instance of XDDFSpacingPercent, then spacing is a
|
||||||
* If spacing is instance of XDDFSpacingPoints, then spacing is expressed in points.
|
* percentage of normal line height. If spacing is instance of
|
||||||
|
* XDDFSpacingPoints, then spacing is expressed in points.
|
||||||
* </p>
|
* </p>
|
||||||
* Examples:
|
* Examples:
|
||||||
* <pre><code>
|
*
|
||||||
|
* <pre>
|
||||||
|
* <code>
|
||||||
* // The paragraph will be formatted to have a spacing before the paragraph text.
|
* // The paragraph will be formatted to have a spacing before the paragraph text.
|
||||||
* // The spacing will be 200% of the size of the largest text on each line
|
* // The spacing will be 200% of the size of the largest text on each line
|
||||||
* paragraph.setSpaceBefore(new XDDFSpacingPercent(200));
|
* paragraph.setSpaceBefore(new XDDFSpacingPercent(200));
|
||||||
*
|
*
|
||||||
* // The spacing will be a size of 48 points
|
* // The spacing will be a size of 48 points
|
||||||
* paragraph.setSpaceBefore(new XDDFSpacingPoints(48.0));
|
* paragraph.setSpaceBefore(new XDDFSpacingPoints(48.0));
|
||||||
* </code></pre>
|
* </code>
|
||||||
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param spaceBefore the vertical white space before the paragraph.
|
* @param spaceBefore
|
||||||
|
* the vertical white space before the paragraph.
|
||||||
*/
|
*/
|
||||||
public void setSpaceBefore(XDDFSpacing spaceBefore) {
|
public void setSpaceBefore(XDDFSpacing spaceBefore) {
|
||||||
if (spaceBefore != null || _p.isSetPPr()) {
|
if (spaceBefore != null || _p.isSetPPr()) {
|
||||||
@ -385,39 +409,46 @@ public class XDDFTextParagraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The amount of vertical white space after the paragraph.
|
* The amount of vertical white space after the paragraph. This may be
|
||||||
* This may be specified in two different ways, percentage spacing or font points spacing:
|
* specified in two different ways, percentage spacing or font points
|
||||||
|
* spacing:
|
||||||
* <p>
|
* <p>
|
||||||
* If spacing is a percentage of normal line height, result is instance of XDDFSpacingPercent.
|
* If spacing is a percentage of normal line height, result is instance of
|
||||||
* If spacing is expressed in points, result is instance of XDDFSpacingPoints.
|
* XDDFSpacingPercent. If spacing is expressed in points, result is instance
|
||||||
|
* of XDDFSpacingPoints.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return the vertical white space after the paragraph.
|
* @return the vertical white space after the paragraph.
|
||||||
*/
|
*/
|
||||||
public XDDFSpacing getSpaceAfter() {
|
public XDDFSpacing getSpaceAfter() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetSpcAft(), props -> props.getSpcAft())
|
return findDefinedParagraphProperty(props -> props.isSetSpcAft(), props -> props.getSpcAft())
|
||||||
.map(spacing -> extractSpacing(spacing))
|
.map(spacing -> extractSpacing(spacing)).orElse(null);
|
||||||
.orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the amount of vertical white space that will be present after the paragraph.
|
* Set the amount of vertical white space that will be present after the
|
||||||
* This may be specified in two different ways, percentage spacing or font points spacing:
|
* paragraph. This may be specified in two different ways, percentage
|
||||||
|
* spacing or font points spacing:
|
||||||
* <p>
|
* <p>
|
||||||
* If spacing is instance of XDDFSpacingPercent, then spacing is a percentage of normal line height.
|
* If spacing is instance of XDDFSpacingPercent, then spacing is a
|
||||||
* If spacing is instance of XDDFSpacingPoints, then spacing is expressed in points.
|
* percentage of normal line height. If spacing is instance of
|
||||||
|
* XDDFSpacingPoints, then spacing is expressed in points.
|
||||||
* </p>
|
* </p>
|
||||||
* Examples:
|
* Examples:
|
||||||
* <pre><code>
|
*
|
||||||
|
* <pre>
|
||||||
|
* <code>
|
||||||
* // The paragraph will be formatted to have a spacing after the paragraph text.
|
* // The paragraph will be formatted to have a spacing after the paragraph text.
|
||||||
* // The spacing will be 200% of the size of the largest text on each line
|
* // The spacing will be 200% of the size of the largest text on each line
|
||||||
* paragraph.setSpaceAfter(new XDDFSpacingPercent(200));
|
* paragraph.setSpaceAfter(new XDDFSpacingPercent(200));
|
||||||
*
|
*
|
||||||
* // The spacing will be a size of 48 points
|
* // The spacing will be a size of 48 points
|
||||||
* paragraph.setSpaceAfter(new XDDFSpacingPoints(48.0));
|
* paragraph.setSpaceAfter(new XDDFSpacingPoints(48.0));
|
||||||
* </code></pre>
|
* </code>
|
||||||
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param spaceAfter the vertical white space after the paragraph.
|
* @param spaceAfter
|
||||||
|
* the vertical white space after the paragraph.
|
||||||
*/
|
*/
|
||||||
public void setSpaceAfter(XDDFSpacing spaceAfter) {
|
public void setSpaceAfter(XDDFSpacing spaceAfter) {
|
||||||
if (spaceAfter != null || _p.isSetPPr()) {
|
if (spaceAfter != null || _p.isSetPPr()) {
|
||||||
@ -427,20 +458,19 @@ public class XDDFTextParagraph {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return the color of bullet characters within a given paragraph.
|
* @return the color of bullet characters within a given paragraph. A
|
||||||
* A <code>null</code> value means to use the text font color.
|
* <code>null</code> value means to use the text font color.
|
||||||
*/
|
*/
|
||||||
public XDDFColor getBulletColor() {
|
public XDDFColor getBulletColor() {
|
||||||
return findDefinedParagraphProperty(
|
return findDefinedParagraphProperty(props -> props.isSetBuClr() || props.isSetBuClrTx(),
|
||||||
props -> props.isSetBuClr() || props.isSetBuClrTx(),
|
props -> new XDDFParagraphBulletProperties(props).getBulletColor()).orElse(null);
|
||||||
props -> new XDDFParagraphBulletProperties(props).getBulletColor()
|
|
||||||
).orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the color to be used on bullet characters within a given paragraph.
|
* Set the color to be used on bullet characters within a given paragraph.
|
||||||
*
|
*
|
||||||
* @param color the bullet color
|
* @param color
|
||||||
|
* the bullet color
|
||||||
*/
|
*/
|
||||||
public void setBulletColor(XDDFColor color) {
|
public void setBulletColor(XDDFColor color) {
|
||||||
if (color != null || _p.isSetPPr()) {
|
if (color != null || _p.isSetPPr()) {
|
||||||
@ -449,7 +479,8 @@ public class XDDFTextParagraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the color to be used on bullet characters has to follow text color within a given paragraph.
|
* Specifies the color to be used on bullet characters has to follow text
|
||||||
|
* color within a given paragraph.
|
||||||
*/
|
*/
|
||||||
public void setBulletColorFollowText() {
|
public void setBulletColorFollowText() {
|
||||||
getOrCreateBulletProperties().setBulletColorFollowText();
|
getOrCreateBulletProperties().setBulletColorFollowText();
|
||||||
@ -457,20 +488,19 @@ public class XDDFTextParagraph {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return the font of bullet characters within a given paragraph.
|
* @return the font of bullet characters within a given paragraph. A
|
||||||
* A <code>null</code> value means to use the text font font.
|
* <code>null</code> value means to use the text font font.
|
||||||
*/
|
*/
|
||||||
public XDDFFont getBulletFont() {
|
public XDDFFont getBulletFont() {
|
||||||
return findDefinedParagraphProperty(
|
return findDefinedParagraphProperty(props -> props.isSetBuFont() || props.isSetBuFontTx(),
|
||||||
props -> props.isSetBuFont() || props.isSetBuFontTx(),
|
props -> new XDDFParagraphBulletProperties(props).getBulletFont()).orElse(null);
|
||||||
props -> new XDDFParagraphBulletProperties(props).getBulletFont()
|
|
||||||
).orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the font to be used on bullet characters within a given paragraph.
|
* Set the font to be used on bullet characters within a given paragraph.
|
||||||
*
|
*
|
||||||
* @param font the bullet font
|
* @param font
|
||||||
|
* the bullet font
|
||||||
*/
|
*/
|
||||||
public void setBulletFont(XDDFFont font) {
|
public void setBulletFont(XDDFFont font) {
|
||||||
if (font != null || _p.isSetPPr()) {
|
if (font != null || _p.isSetPPr()) {
|
||||||
@ -479,19 +509,23 @@ public class XDDFTextParagraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the font to be used on bullet characters has to follow text font within a given paragraph.
|
* Specifies the font to be used on bullet characters has to follow text
|
||||||
|
* font within a given paragraph.
|
||||||
*/
|
*/
|
||||||
public void setBulletFontFollowText() {
|
public void setBulletFontFollowText() {
|
||||||
getOrCreateBulletProperties().setBulletFontFollowText();
|
getOrCreateBulletProperties().setBulletFontFollowText();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the bullet size that is to be used within a paragraph.
|
* Returns the bullet size that is to be used within a paragraph. This may
|
||||||
* This may be specified in three different ways, follows text size, percentage size and font points size:
|
* be specified in three different ways, follows text size, percentage size
|
||||||
|
* and font points size:
|
||||||
* <p>
|
* <p>
|
||||||
* If returned value is instance of XDDFBulletSizeFollowText, then bullet size is text size;
|
* If returned value is instance of XDDFBulletSizeFollowText, then bullet
|
||||||
* If returned value is instance of XDDFBulletSizePercent, then bullet size is a percentage of the font size;
|
* size is text size; If returned value is instance of
|
||||||
* If returned value is instance of XDDFBulletSizePoints, then bullet size is specified in points.
|
* XDDFBulletSizePercent, then bullet size is a percentage of the font size;
|
||||||
|
* If returned value is instance of XDDFBulletSizePoints, then bullet size
|
||||||
|
* is specified in points.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @return the bullet size
|
* @return the bullet size
|
||||||
@ -499,20 +533,22 @@ public class XDDFTextParagraph {
|
|||||||
public XDDFBulletSize getBulletSize() {
|
public XDDFBulletSize getBulletSize() {
|
||||||
return findDefinedParagraphProperty(
|
return findDefinedParagraphProperty(
|
||||||
props -> props.isSetBuSzPct() || props.isSetBuSzPts() || props.isSetBuSzTx(),
|
props -> props.isSetBuSzPct() || props.isSetBuSzPts() || props.isSetBuSzTx(),
|
||||||
props -> new XDDFParagraphBulletProperties(props).getBulletSize()
|
props -> new XDDFParagraphBulletProperties(props).getBulletSize()).orElse(null);
|
||||||
).orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the bullet size that is to be used within a paragraph.
|
* Sets the bullet size that is to be used within a paragraph. This may be
|
||||||
* This may be specified in three different ways, follows text size, percentage size and font points size:
|
* specified in three different ways, follows text size, percentage size and
|
||||||
|
* font points size:
|
||||||
* <p>
|
* <p>
|
||||||
* If given value is instance of XDDFBulletSizeFollowText, then bullet size is text size;
|
* If given value is instance of XDDFBulletSizeFollowText, then bullet size
|
||||||
* If given value is instance of XDDFBulletSizePercent, then bullet size is a percentage of the font size;
|
* is text size; If given value is instance of XDDFBulletSizePercent, then
|
||||||
* If given value is instance of XDDFBulletSizePoints, then bullet size is specified in points.
|
* bullet size is a percentage of the font size; If given value is instance
|
||||||
|
* of XDDFBulletSizePoints, then bullet size is specified in points.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param size the bullet size specification
|
* @param size
|
||||||
|
* the bullet size specification
|
||||||
*/
|
*/
|
||||||
public void setBulletSize(XDDFBulletSize size) {
|
public void setBulletSize(XDDFBulletSize size) {
|
||||||
if (size != null || _p.isSetPPr()) {
|
if (size != null || _p.isSetPPr()) {
|
||||||
@ -523,8 +559,7 @@ public class XDDFTextParagraph {
|
|||||||
public XDDFBulletStyle getBulletStyle() {
|
public XDDFBulletStyle getBulletStyle() {
|
||||||
return findDefinedParagraphProperty(
|
return findDefinedParagraphProperty(
|
||||||
props -> props.isSetBuAutoNum() || props.isSetBuBlip() || props.isSetBuChar() || props.isSetBuNone(),
|
props -> props.isSetBuAutoNum() || props.isSetBuBlip() || props.isSetBuChar() || props.isSetBuNone(),
|
||||||
props -> new XDDFParagraphBulletProperties(props).getBulletStyle()
|
props -> new XDDFParagraphBulletProperties(props).getBulletStyle()).orElse(null);
|
||||||
).orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBulletStyle(XDDFBulletStyle style) {
|
public void setBulletStyle(XDDFBulletStyle style) {
|
||||||
@ -534,8 +569,7 @@ public class XDDFTextParagraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasEastAsianLineBreak() {
|
public boolean hasEastAsianLineBreak() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetEaLnBrk(), props -> props.getEaLnBrk())
|
return findDefinedParagraphProperty(props -> props.isSetEaLnBrk(), props -> props.getEaLnBrk()).orElse(false);
|
||||||
.orElse(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEastAsianLineBreak(Boolean value) {
|
public void setEastAsianLineBreak(Boolean value) {
|
||||||
@ -567,8 +601,7 @@ public class XDDFTextParagraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRightToLeft() {
|
public boolean isRightToLeft() {
|
||||||
return findDefinedParagraphProperty(props -> props.isSetRtl(), props -> props.getRtl())
|
return findDefinedParagraphProperty(props -> props.isSetRtl(), props -> props.getRtl()).orElse(false);
|
||||||
.orElse(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRightToLeft(Boolean value) {
|
public void setRightToLeft(Boolean value) {
|
||||||
@ -641,6 +674,13 @@ public class XDDFTextParagraph {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XDDFRunProperties addAfterLastRunProperties() {
|
||||||
|
if (!_p.isSetEndParaRPr()) {
|
||||||
|
_p.addNewEndParaRPr();
|
||||||
|
}
|
||||||
|
return getAfterLastRunProperties();
|
||||||
|
}
|
||||||
|
|
||||||
public XDDFRunProperties getAfterLastRunProperties() {
|
public XDDFRunProperties getAfterLastRunProperties() {
|
||||||
if (_p.isSetEndParaRPr()) {
|
if (_p.isSetEndParaRPr()) {
|
||||||
return new XDDFRunProperties(_p.getEndParaRPr());
|
return new XDDFRunProperties(_p.getEndParaRPr());
|
||||||
@ -651,7 +691,9 @@ public class XDDFTextParagraph {
|
|||||||
|
|
||||||
public void setAfterLastRunProperties(XDDFRunProperties properties) {
|
public void setAfterLastRunProperties(XDDFRunProperties properties) {
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
|
if (_p.isSetEndParaRPr()) {
|
||||||
_p.unsetEndParaRPr();
|
_p.unsetEndParaRPr();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_p.setEndParaRPr(properties.getXmlObject());
|
_p.setEndParaRPr(properties.getXmlObject());
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ import java.util.Locale;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.apache.poi.POIXMLRelation;
|
|
||||||
import org.apache.poi.common.usermodel.fonts.FontGroup;
|
import org.apache.poi.common.usermodel.fonts.FontGroup;
|
||||||
|
import org.apache.poi.ooxml.POIXMLRelation;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePartName;
|
import org.apache.poi.openxml4j.opc.PackagePartName;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
@ -151,7 +151,8 @@ public class XDDFTextRun {
|
|||||||
/**
|
/**
|
||||||
* Specifies whether this run of text will be formatted as bold text.
|
* Specifies whether this run of text will be formatted as bold text.
|
||||||
*
|
*
|
||||||
* @param bold whether this run of text will be formatted as bold text.
|
* @param bold
|
||||||
|
* whether this run of text will be formatted as bold text.
|
||||||
*/
|
*/
|
||||||
public void setBold(Boolean bold) {
|
public void setBold(Boolean bold) {
|
||||||
getOrCreateProperties().setBold(bold);
|
getOrCreateProperties().setBold(bold);
|
||||||
@ -166,7 +167,8 @@ public class XDDFTextRun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param italic whether this run of text is formatted as italic text.
|
* @param italic
|
||||||
|
* whether this run of text is formatted as italic text.
|
||||||
*/
|
*/
|
||||||
public void setItalic(Boolean italic) {
|
public void setItalic(Boolean italic) {
|
||||||
getOrCreateProperties().setItalic(italic);
|
getOrCreateProperties().setItalic(italic);
|
||||||
@ -181,7 +183,8 @@ public class XDDFTextRun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param strike which strike style this run of text is formatted with.
|
* @param strike
|
||||||
|
* which strike style this run of text is formatted with.
|
||||||
*/
|
*/
|
||||||
public void setStrikeThrough(StrikeType strike) {
|
public void setStrikeThrough(StrikeType strike) {
|
||||||
getOrCreateProperties().setStrikeThrough(strike);
|
getOrCreateProperties().setStrikeThrough(strike);
|
||||||
@ -206,7 +209,8 @@ public class XDDFTextRun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param underline which underline style this run of text is formatted with.
|
* @param underline
|
||||||
|
* which underline style this run of text is formatted with.
|
||||||
*/
|
*/
|
||||||
public void setUnderline(UnderlineType underline) {
|
public void setUnderline(UnderlineType underline) {
|
||||||
getOrCreateProperties().setUnderline(underline);
|
getOrCreateProperties().setUnderline(underline);
|
||||||
@ -231,7 +235,8 @@ public class XDDFTextRun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param caps which caps style this run of text is formatted with.
|
* @param caps
|
||||||
|
* which caps style this run of text is formatted with.
|
||||||
*/
|
*/
|
||||||
public void setCapitals(CapsType caps) {
|
public void setCapitals(CapsType caps) {
|
||||||
getOrCreateProperties().setCapitals(caps);
|
getOrCreateProperties().setCapitals(caps);
|
||||||
@ -256,7 +261,8 @@ public class XDDFTextRun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return whether a run of text will be formatted as a subscript text. Default is false.
|
* @return whether a run of text will be formatted as a subscript text.
|
||||||
|
* Default is false.
|
||||||
*/
|
*/
|
||||||
public boolean isSubscript() {
|
public boolean isSubscript() {
|
||||||
return findDefinedProperty(props -> props.isSetBaseline(), props -> props.getBaseline())
|
return findDefinedProperty(props -> props.isSetBaseline(), props -> props.getBaseline())
|
||||||
@ -265,7 +271,8 @@ public class XDDFTextRun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return whether a run of text will be formatted as a superscript text. Default is false.
|
* @return whether a run of text will be formatted as a superscript text.
|
||||||
|
* Default is false.
|
||||||
*/
|
*/
|
||||||
public boolean isSuperscript() {
|
public boolean isSuperscript() {
|
||||||
return findDefinedProperty(props -> props.isSetBaseline(), props -> props.getBaseline())
|
return findDefinedProperty(props -> props.isSetBaseline(), props -> props.getBaseline())
|
||||||
@ -283,8 +290,12 @@ public class XDDFTextRun {
|
|||||||
* @param offset
|
* @param offset
|
||||||
*/
|
*/
|
||||||
public void setBaseline(Double offset) {
|
public void setBaseline(Double offset) {
|
||||||
|
if (offset == null) {
|
||||||
|
getOrCreateProperties().setBaseline(null);
|
||||||
|
} else {
|
||||||
getOrCreateProperties().setBaseline((int) (offset * 1000));
|
getOrCreateProperties().setBaseline((int) (offset * 1000));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether the text in this run is formatted as superscript.
|
* Set whether the text in this run is formatted as superscript.
|
||||||
@ -331,7 +342,8 @@ public class XDDFTextRun {
|
|||||||
* <em>Note</em>: In order to get fonts to unset the property for a given font family use
|
* <em>Note</em>: In order to get fonts to unset the property for a given font family use
|
||||||
* {@link XDDFFont#unsetFontForGroup(FontGroup)}
|
* {@link XDDFFont#unsetFontForGroup(FontGroup)}
|
||||||
*
|
*
|
||||||
* @param fonts to set or unset on the run.
|
* @param fonts
|
||||||
|
* to set or unset on the run.
|
||||||
*/
|
*/
|
||||||
public void setFonts(XDDFFont[] fonts) {
|
public void setFonts(XDDFFont[] fonts) {
|
||||||
getOrCreateProperties().setFonts(fonts);
|
getOrCreateProperties().setFonts(fonts);
|
||||||
@ -357,12 +369,14 @@ public class XDDFTextRun {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param size font size in points.
|
* @param size
|
||||||
* The value <code>null</code> unsets the size for this run.
|
* font size in points. The value <code>null</code> unsets the
|
||||||
|
* size for this run.
|
||||||
* <dl>
|
* <dl>
|
||||||
* <dt>Minimum inclusive =</dt><dd>1</dd>
|
* <dt>Minimum inclusive =</dt>
|
||||||
* <dt>Maximum inclusive =</dt><dd>400</dd>
|
* <dd>1</dd>
|
||||||
* </dt>
|
* <dt>Maximum inclusive =</dt>
|
||||||
|
* <dd>400</dd></dt>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void setFontSize(Double size) {
|
public void setFontSize(Double size) {
|
||||||
@ -382,11 +396,13 @@ public class XDDFTextRun {
|
|||||||
* The value <code>null</code> unsets the kerning for this run.
|
* The value <code>null</code> unsets the kerning for this run.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param kerning character kerning in points.
|
* @param kerning
|
||||||
|
* character kerning in points.
|
||||||
* <dl>
|
* <dl>
|
||||||
* <dt>Minimum inclusive =</dt><dd>0</dd>
|
* <dt>Minimum inclusive =</dt>
|
||||||
* <dt>Maximum inclusive =</dt><dd>4000</dd>
|
* <dd>0</dd>
|
||||||
* </dt>
|
* <dt>Maximum inclusive =</dt>
|
||||||
|
* <dd>4000</dd></dt>
|
||||||
*/
|
*/
|
||||||
public void setCharacterKerning(Double kerning) {
|
public void setCharacterKerning(Double kerning) {
|
||||||
getOrCreateProperties().setCharacterKerning(kerning);
|
getOrCreateProperties().setCharacterKerning(kerning);
|
||||||
@ -413,11 +429,13 @@ public class XDDFTextRun {
|
|||||||
* The value <code>null</code> unsets the spacing for this run.
|
* The value <code>null</code> unsets the spacing for this run.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param spacing character spacing in points.
|
* @param spacing
|
||||||
|
* character spacing in points.
|
||||||
* <dl>
|
* <dl>
|
||||||
* <dt>Minimum inclusive =</dt><dd>-4000</dd>
|
* <dt>Minimum inclusive =</dt>
|
||||||
* <dt>Maximum inclusive =</dt><dd>4000</dd>
|
* <dd>-4000</dd>
|
||||||
* </dt>
|
* <dt>Maximum inclusive =</dt>
|
||||||
|
* <dd>4000</dd></dt>
|
||||||
*/
|
*/
|
||||||
public void setCharacterSpacing(Double spacing) {
|
public void setCharacterSpacing(Double spacing) {
|
||||||
getOrCreateProperties().setCharacterSpacing(spacing);
|
getOrCreateProperties().setCharacterSpacing(spacing);
|
||||||
|
@ -77,8 +77,10 @@ public class XSLFAutoShape extends XSLFTextShape implements AutoShape<XSLFShape,
|
|||||||
CTShape shape = (CTShape) getXmlObject();
|
CTShape shape = (CTShape) getXmlObject();
|
||||||
CTTextBody txBody = shape.getTxBody();
|
CTTextBody txBody = shape.getTxBody();
|
||||||
if (txBody == null && create) {
|
if (txBody == null && create) {
|
||||||
txBody = shape.addNewTxBody();
|
XDDFTextBody body = new XDDFTextBody(this);
|
||||||
initTextBody(txBody);
|
initTextBody(body);
|
||||||
|
shape.setTxBody(body.getXmlObject());
|
||||||
|
txBody = shape.getTxBody();
|
||||||
}
|
}
|
||||||
return txBody;
|
return txBody;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user