Author: abearez Date: Sun Aug 26 21:18:54 2018 New Revision: 1839255 URL: http://svn.apache.org/viewvc?rev=1839255&view=rev Log: fill in the text body, its paragraphs and text runs
Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPicture.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/AutonumberScheme.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/CapsType.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/FontAlignment.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/StrikeType.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TabAlignment.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextAlignment.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextContainer.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/UnderlineType.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFAutoFit.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBodyProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSize.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizeFollowText.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizePercent.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizePoints.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyle.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleAutoNumbered.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleCharacter.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleNone.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStylePicture.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFFont.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFHyperlink.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFNoAutoFit.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFNormalAutoFit.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFParagraphBulletProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFParagraphProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFRunProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFShapeAutoFit.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFSpacing.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFSpacingPercent.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFSpacingPoints.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTabStop.java - copied, changed from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFColor.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectContainer.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFExtensionList.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFGradientFillProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFGroupFillProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFLineProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFNoFillProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPatternFillProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPictureFillProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFSolidFillProperties.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartLegend.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLegendEntry.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFColor.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFColor.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFColor.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFColor.java Sun Aug 26 21:18:54 2018 @@ -52,7 +52,7 @@ public abstract class XDDFColor { } @Internal - protected static XDDFColor forColorContainer(CTColor container) { + public static XDDFColor forColorContainer(CTColor container) { if (container.isSetHslClr()) { return new XDDFColorHsl(container.getHslClr(), container); } else if (container.isSetPrstClr()) { @@ -70,7 +70,7 @@ public abstract class XDDFColor { } @Internal - protected CTColor getColorContainer() { + public CTColor getColorContainer() { return container; } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectContainer.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectContainer.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectContainer.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectContainer.java Sun Aug 26 21:18:54 2018 @@ -26,7 +26,7 @@ public class XDDFEffectContainer { private CTEffectContainer container; @Internal - protected XDDFEffectContainer(CTEffectContainer container) { + public XDDFEffectContainer(CTEffectContainer container) { this.container = container; } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java Sun Aug 26 21:18:54 2018 @@ -26,7 +26,7 @@ public class XDDFEffectList { private CTEffectList list; @Internal - protected XDDFEffectList(CTEffectList list) { + public XDDFEffectList(CTEffectList list) { this.list = list; } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFExtensionList.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFExtensionList.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFExtensionList.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFExtensionList.java Sun Aug 26 21:18:54 2018 @@ -26,7 +26,7 @@ public class XDDFExtensionList { private CTOfficeArtExtensionList list; @Internal - protected XDDFExtensionList(CTOfficeArtExtensionList list) { + public XDDFExtensionList(CTOfficeArtExtensionList list) { this.list = list; } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFGradientFillProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFGradientFillProperties.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFGradientFillProperties.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFGradientFillProperties.java Sun Aug 26 21:18:54 2018 @@ -38,7 +38,7 @@ public class XDDFGradientFillProperties } @Internal - protected CTGradientFillProperties getXmlObject() { + public CTGradientFillProperties getXmlObject() { return props; } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFGroupFillProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFGroupFillProperties.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFGroupFillProperties.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFGroupFillProperties.java Sun Aug 26 21:18:54 2018 @@ -34,7 +34,7 @@ public class XDDFGroupFillProperties imp } @Internal - protected CTGroupFillProperties getXmlObject() { + public CTGroupFillProperties getXmlObject() { return props; } } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFLineProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFLineProperties.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFLineProperties.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFLineProperties.java Sun Aug 26 21:18:54 2018 @@ -34,12 +34,12 @@ public class XDDFLineProperties { } @Internal - protected XDDFLineProperties(CTLineProperties properties) { + public XDDFLineProperties(CTLineProperties properties) { this.props = properties; } @Internal - protected CTLineProperties getXmlObject() { + public CTLineProperties getXmlObject() { return props; } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFNoFillProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFNoFillProperties.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFNoFillProperties.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFNoFillProperties.java Sun Aug 26 21:18:54 2018 @@ -34,7 +34,7 @@ public class XDDFNoFillProperties implem } @Internal - protected CTNoFillProperties getXmlObject() { + public CTNoFillProperties getXmlObject() { return props; } } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPatternFillProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPatternFillProperties.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPatternFillProperties.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPatternFillProperties.java Sun Aug 26 21:18:54 2018 @@ -34,7 +34,7 @@ public class XDDFPatternFillProperties i } @Internal - protected CTPatternFillProperties getXmlObject() { + public CTPatternFillProperties getXmlObject() { return props; } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPicture.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPicture.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPicture.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPicture.java Sun Aug 26 21:18:54 2018 @@ -19,19 +19,19 @@ package org.apache.poi.xddf.usermodel; import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTEffectList; +import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip; @Beta -public class XDDFEffectList { - private CTEffectList list; +public class XDDFPicture { + private CTBlip blip; @Internal - protected XDDFEffectList(CTEffectList list) { - this.list = list; + public XDDFPicture(CTBlip blip) { + this.blip = blip; } @Internal - public CTEffectList getXmlObject() { - return list; + public CTBlip getXmlObject() { + return blip; } } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPictureFillProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPictureFillProperties.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPictureFillProperties.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFPictureFillProperties.java Sun Aug 26 21:18:54 2018 @@ -19,7 +19,6 @@ package org.apache.poi.xddf.usermodel; import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip; import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties; @Beta @@ -35,27 +34,23 @@ public class XDDFPictureFillProperties i } @Internal - protected CTBlipFillProperties getXmlObject() { + public CTBlipFillProperties getXmlObject() { return props; } - @Internal - public CTBlip getCTBlip() { + public XDDFPicture getPicture() { if (props.isSetBlip()) { - return props.getBlip(); + return new XDDFPicture(props.getBlip()); } else { return null; } } - @Internal - public void setBlip(CTBlip blip) { - if (blip == null) { - if (props.isSetBlip()) { - props.unsetBlip(); - } + public void setPicture(XDDFPicture picture) { + if (picture == null) { + props.unsetBlip(); } else { - props.setBlip(blip); + props.setBlip(picture.getXmlObject()); } } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFSolidFillProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFSolidFillProperties.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFSolidFillProperties.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFSolidFillProperties.java Sun Aug 26 21:18:54 2018 @@ -40,12 +40,13 @@ public class XDDFSolidFillProperties imp setColor(color); } - protected XDDFSolidFillProperties(CTSolidColorFillProperties properties) { + @Internal + public XDDFSolidFillProperties(CTSolidColorFillProperties properties) { this.props = properties; } @Internal - protected CTSolidColorFillProperties getXmlObject() { + public CTSolidColorFillProperties getXmlObject() { return props; } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartLegend.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartLegend.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartLegend.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartLegend.java Sun Aug 26 21:18:54 2018 @@ -18,20 +18,25 @@ package org.apache.poi.xddf.usermodel.chart; import java.util.List; +import java.util.Optional; +import java.util.function.Function; import java.util.stream.Collectors; import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; +import org.apache.poi.xddf.usermodel.text.TextContainer; import org.apache.poi.xddf.usermodel.text.XDDFTextBody; import org.openxmlformats.schemas.drawingml.x2006.chart.CTChart; import org.openxmlformats.schemas.drawingml.x2006.chart.CTLegend; import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties; /** * Represents a DrawingML chart legend */ @Beta -public final class XDDFChartLegend { +public final class XDDFChartLegend implements TextContainer { /** * Underlying CTLegend bean @@ -89,7 +94,7 @@ public final class XDDFChartLegend { public XDDFTextBody getTextBody() { if (legend.isSetTxPr()) { - return new XDDFTextBody(legend.getTxPr()); + return new XDDFTextBody(this, legend.getTxPr()); } else { return null; } @@ -189,4 +194,16 @@ public final class XDDFChartLegend { public void setOverlay(boolean value) { legend.getOverlay().setVal(value); } + + public <R> Optional<R> findDefinedParagraphProperty( + Function<CTTextParagraphProperties, Boolean> isSet, + Function<CTTextParagraphProperties, R> getter) { + return Optional.empty(); // chart legend has no (indirect) paragraph properties + } + + public <R> Optional<R> findDefinedRunProperty( + Function<CTTextCharacterProperties, Boolean> isSet, + Function<CTTextCharacterProperties, R> getter) { + return Optional.empty(); // chart legend has no (indirect) paragraph properties + } } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLegendEntry.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLegendEntry.java?rev=1839255&r1=1839254&r2=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLegendEntry.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLegendEntry.java Sun Aug 26 21:18:54 2018 @@ -17,13 +17,19 @@ package org.apache.poi.xddf.usermodel.chart; +import java.util.Optional; +import java.util.function.Function; + import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; +import org.apache.poi.xddf.usermodel.text.TextContainer; import org.apache.poi.xddf.usermodel.text.XDDFTextBody; import org.openxmlformats.schemas.drawingml.x2006.chart.CTLegendEntry; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties; @Beta -public class XDDFLegendEntry { +public class XDDFLegendEntry implements TextContainer { private CTLegendEntry entry; @Internal @@ -38,7 +44,7 @@ public class XDDFLegendEntry { public XDDFTextBody getTextBody() { if (entry.isSetTxPr()) { - return new XDDFTextBody(entry.getTxPr()); + return new XDDFTextBody(this, entry.getTxPr()); } else { return null; } @@ -101,4 +107,16 @@ public class XDDFLegendEntry { return null; } } + + public <R> Optional<R> findDefinedParagraphProperty( + Function<CTTextParagraphProperties, Boolean> isSet, + Function<CTTextParagraphProperties, R> getter) { + return Optional.empty(); // legend entry has no (indirect) paragraph properties + } + + public <R> Optional<R> findDefinedRunProperty( + Function<CTTextCharacterProperties, Boolean> isSet, + Function<CTTextCharacterProperties, R> getter) { + return Optional.empty(); // legend entry has no (indirect) paragraph properties + } } Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/AutonumberScheme.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/AutonumberScheme.java?rev=1839255&view=auto ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/AutonumberScheme.java (added) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/AutonumberScheme.java Sun Aug 26 21:18:54 2018 @@ -0,0 +1,83 @@ +/* ==================================================================== + 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.STTextAutonumberScheme; + +public enum AutonumberScheme { + ALPHABETIC_LOWERCASE_PARENTHESES_BOTH(STTextAutonumberScheme.ALPHA_LC_PAREN_BOTH), + ALPHABETIC_LOWERCASE_PARENTHESIS_RIGHT(STTextAutonumberScheme.ALPHA_LC_PAREN_R), + ALPHABETIC_LOWERCASE_PERIOD(STTextAutonumberScheme.ALPHA_LC_PERIOD), + ALPHABETIC_UPPERCASE_PARENTHESES_BOTH(STTextAutonumberScheme.ALPHA_UC_PAREN_BOTH), + ALPHABETIC_UPPERCASE_PARENTHESIS_RIGHT(STTextAutonumberScheme.ALPHA_UC_PAREN_R), + ALPHABETIC_UPPERCASE_PERIOD(STTextAutonumberScheme.ALPHA_UC_PERIOD), + ARABIC_1_MINUS(STTextAutonumberScheme.ARABIC_1_MINUS), + ARABIC_2_MINUS(STTextAutonumberScheme.ARABIC_2_MINUS), + ARABIC_DOUBLE_BYTE_PERIOD(STTextAutonumberScheme.ARABIC_DB_PERIOD), + ARABIC_DOUBLE_BYTE_PLAIN(STTextAutonumberScheme.ARABIC_DB_PLAIN), + ARABIC_PARENTHESES_BOTH(STTextAutonumberScheme.ARABIC_PAREN_BOTH), + ARABIC_PARENTHESIS_RIGHT(STTextAutonumberScheme.ARABIC_PAREN_R), + ARABIC_PERIOD(STTextAutonumberScheme.ARABIC_PERIOD), + ARABIC_PLAIN(STTextAutonumberScheme.ARABIC_PLAIN), + CIRCLE_NUMBER_DOUBLE_BYTE_PLAIN(STTextAutonumberScheme.CIRCLE_NUM_DB_PLAIN), + CIRCLE_NUMBER_WINGDINGS_BLACK_PLAIN(STTextAutonumberScheme.CIRCLE_NUM_WD_BLACK_PLAIN), + CIRCLE_NUMBER_WINGDINGS_WHITE_PLAIN(STTextAutonumberScheme.CIRCLE_NUM_WD_WHITE_PLAIN), + EAST_ASIAN_CHINESE_SIMPLIFIED_PERIOD(STTextAutonumberScheme.EA_1_CHS_PERIOD), + EAST_ASIAN_CHINESE_SIMPLIFIED_PLAIN(STTextAutonumberScheme.EA_1_CHS_PLAIN), + EAST_ASIAN_CHINESE_TRADITIONAL_PERIOD(STTextAutonumberScheme.EA_1_CHT_PERIOD), + EAST_ASIAN_CHINESE_TRADITIONAL_PLAIN(STTextAutonumberScheme.EA_1_CHT_PLAIN), + EAST_ASIAN_JAPANESE_DOUBLE_BYTE_PERIOD(STTextAutonumberScheme.EA_1_JPN_CHS_DB_PERIOD), + EAST_ASIAN_JAPANESE_KOREAN_PERIOD(STTextAutonumberScheme.EA_1_JPN_KOR_PERIOD), + EAST_ASIAN_JAPANESE_KOREAN_PLAIN(STTextAutonumberScheme.EA_1_JPN_KOR_PLAIN), + HEBREW_2_MINUS(STTextAutonumberScheme.HEBREW_2_MINUS), + HINDI_ALPHA_1_PERIOD(STTextAutonumberScheme.HINDI_ALPHA_1_PERIOD), + HINDI_ALPHA_PERIOD(STTextAutonumberScheme.HINDI_ALPHA_PERIOD), + HINDI_NUMBER_PARENTHESIS_RIGHT(STTextAutonumberScheme.HINDI_NUM_PAREN_R), + HINDI_NUMBER_PERIOD(STTextAutonumberScheme.HINDI_NUM_PERIOD), + ROMAN_LOWERCASE_PARENTHESES_BOTH(STTextAutonumberScheme.ROMAN_LC_PAREN_BOTH), + ROMAN_LOWERCASE_PARENTHESIS_RIGHT(STTextAutonumberScheme.ROMAN_LC_PAREN_R), + ROMAN_LOWERCASE_PERIOD(STTextAutonumberScheme.ROMAN_LC_PERIOD), + ROMAN_UPPERCASE_PARENTHESES_BOTH(STTextAutonumberScheme.ROMAN_UC_PAREN_BOTH), + ROMAN_UPPERCASE_PARENTHESIS_RIGHT(STTextAutonumberScheme.ROMAN_UC_PAREN_R), + ROMAN_UPPERCASE_PERIOD(STTextAutonumberScheme.ROMAN_UC_PERIOD), + THAI_ALPHABETIC_PARENTHESES_BOTH(STTextAutonumberScheme.THAI_ALPHA_PAREN_BOTH), + THAI_ALPHABETIC_PARENTHESIS_RIGHT(STTextAutonumberScheme.THAI_ALPHA_PAREN_R), + THAI_ALPHABETIC_PERIOD(STTextAutonumberScheme.THAI_ALPHA_PERIOD), + THAI_NUMBER_PARENTHESES_BOTH(STTextAutonumberScheme.THAI_NUM_PAREN_BOTH), + THAI_NUMBER_PARENTHESIS_RIGHT(STTextAutonumberScheme.THAI_NUM_PAREN_R), + THAI_NUMBER_PERIOD(STTextAutonumberScheme.THAI_NUM_PERIOD); + + final STTextAutonumberScheme.Enum underlying; + + AutonumberScheme(STTextAutonumberScheme.Enum scheme) { + this.underlying = scheme; + } + + private final static HashMap<STTextAutonumberScheme.Enum, AutonumberScheme> reverse = new HashMap<STTextAutonumberScheme.Enum, AutonumberScheme>(); + static { + for (AutonumberScheme value : values()) { + reverse.put(value.underlying, value); + } + } + + static AutonumberScheme valueOf(STTextAutonumberScheme.Enum scheme) { + return reverse.get(scheme); + } +} Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/CapsType.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/CapsType.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/CapsType.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/CapsType.java Sun Aug 26 21:18:54 2018 @@ -17,25 +17,29 @@ package org.apache.poi.xddf.usermodel.text; -import org.apache.poi.util.Beta; -import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; - -@Beta -public class XDDFTextBody { - private CTTextBody body; +import java.util.HashMap; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); +import org.openxmlformats.schemas.drawingml.x2006.main.STTextCapsType; + +public enum CapsType { + ALL(STTextCapsType.ALL), + NONE(STTextCapsType.NONE), + SMALL(STTextCapsType.SMALL); + + final STTextCapsType.Enum underlying; + + CapsType(STTextCapsType.Enum caps) { + this.underlying = caps; } - @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + private final static HashMap<STTextCapsType.Enum, CapsType> reverse = new HashMap<STTextCapsType.Enum, CapsType>(); + static { + for (CapsType value : values()) { + reverse.put(value.underlying, value); + } } - @Internal - public CTTextBody getXmlObject() { - return body; + static CapsType valueOf(STTextCapsType.Enum caps) { + return reverse.get(caps); } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/FontAlignment.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/FontAlignment.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/FontAlignment.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/FontAlignment.java Sun Aug 26 21:18:54 2018 @@ -17,25 +17,31 @@ package org.apache.poi.xddf.usermodel.text; -import org.apache.poi.util.Beta; -import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; - -@Beta -public class XDDFTextBody { - private CTTextBody body; +import java.util.HashMap; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); +import org.openxmlformats.schemas.drawingml.x2006.main.STTextFontAlignType; + +public enum FontAlignment { + AUTOMATIC(STTextFontAlignType.AUTO), + BOTTOM(STTextFontAlignType.B), + BASELINE(STTextFontAlignType.BASE), + CENTER(STTextFontAlignType.CTR), + TOP(STTextFontAlignType.T); + + final STTextFontAlignType.Enum underlying; + + FontAlignment(STTextFontAlignType.Enum align) { + this.underlying = align; } - @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + private final static HashMap<STTextFontAlignType.Enum, FontAlignment> reverse = new HashMap<STTextFontAlignType.Enum, FontAlignment>(); + static { + for (FontAlignment value : values()) { + reverse.put(value.underlying, value); + } } - @Internal - public CTTextBody getXmlObject() { - return body; + static FontAlignment valueOf(STTextFontAlignType.Enum align) { + return reverse.get(align); } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/StrikeType.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/StrikeType.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/StrikeType.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/StrikeType.java Sun Aug 26 21:18:54 2018 @@ -17,25 +17,29 @@ package org.apache.poi.xddf.usermodel.text; -import org.apache.poi.util.Beta; -import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; - -@Beta -public class XDDFTextBody { - private CTTextBody body; +import java.util.HashMap; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); +import org.openxmlformats.schemas.drawingml.x2006.main.STTextStrikeType; + +public enum StrikeType { + DOUBLE_STRIKE(STTextStrikeType.DBL_STRIKE), + NO_STRIKE(STTextStrikeType.NO_STRIKE), + SINGLE_STRIKE(STTextStrikeType.SNG_STRIKE); + + final STTextStrikeType.Enum underlying; + + StrikeType(STTextStrikeType.Enum strike) { + this.underlying = strike; } - @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + private final static HashMap<STTextStrikeType.Enum, StrikeType> reverse = new HashMap<STTextStrikeType.Enum, StrikeType>(); + static { + for (StrikeType value : values()) { + reverse.put(value.underlying, value); + } } - @Internal - public CTTextBody getXmlObject() { - return body; + static StrikeType valueOf(STTextStrikeType.Enum strike) { + return reverse.get(strike); } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TabAlignment.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TabAlignment.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TabAlignment.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TabAlignment.java Sun Aug 26 21:18:54 2018 @@ -17,25 +17,30 @@ package org.apache.poi.xddf.usermodel.text; -import org.apache.poi.util.Beta; -import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; - -@Beta -public class XDDFTextBody { - private CTTextBody body; +import java.util.HashMap; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); +import org.openxmlformats.schemas.drawingml.x2006.main.STTextTabAlignType; + +public enum TabAlignment { + CENTER(STTextTabAlignType.CTR), + DECIMAL(STTextTabAlignType.DEC), + LEFT(STTextTabAlignType.L), + RIGHT(STTextTabAlignType.R); + + final STTextTabAlignType.Enum underlying; + + TabAlignment(STTextTabAlignType.Enum align) { + this.underlying = align; } - @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + private final static HashMap<STTextTabAlignType.Enum, TabAlignment> reverse = new HashMap<STTextTabAlignType.Enum, TabAlignment>(); + static { + for (TabAlignment value : values()) { + reverse.put(value.underlying, value); + } } - @Internal - public CTTextBody getXmlObject() { - return body; + static TabAlignment valueOf(STTextTabAlignType.Enum align) { + return reverse.get(align); } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextAlignment.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextAlignment.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextAlignment.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextAlignment.java Sun Aug 26 21:18:54 2018 @@ -17,25 +17,33 @@ package org.apache.poi.xddf.usermodel.text; -import org.apache.poi.util.Beta; -import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; - -@Beta -public class XDDFTextBody { - private CTTextBody body; +import java.util.HashMap; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); +import org.openxmlformats.schemas.drawingml.x2006.main.STTextAlignType; + +public enum TextAlignment { + CENTER(STTextAlignType.CTR), + DISTRIBUTED(STTextAlignType.DIST), + JUSTIFIED(STTextAlignType.JUST), + JUSTIFIED_LOW(STTextAlignType.JUST_LOW), + LEFT(STTextAlignType.L), + RIGHT(STTextAlignType.R), + THAI_DISTRIBUTED(STTextAlignType.THAI_DIST); + + final STTextAlignType.Enum underlying; + + TextAlignment(STTextAlignType.Enum align) { + this.underlying = align; } - @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + private final static HashMap<STTextAlignType.Enum, TextAlignment> reverse = new HashMap<STTextAlignType.Enum, TextAlignment>(); + static { + for (TextAlignment value : values()) { + reverse.put(value.underlying, value); + } } - @Internal - public CTTextBody getXmlObject() { - return body; + static TextAlignment valueOf(STTextAlignType.Enum align) { + return reverse.get(align); } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextContainer.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextContainer.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextContainer.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextContainer.java Sun Aug 26 21:18:54 2018 @@ -17,25 +17,20 @@ package org.apache.poi.xddf.usermodel.text; +import java.util.Optional; +import java.util.function.Function; + import org.apache.poi.util.Beta; -import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties; @Beta -public class XDDFTextBody { - private CTTextBody body; +public interface TextContainer { + + <R> Optional<R> findDefinedParagraphProperty(Function<CTTextParagraphProperties, Boolean> isSet, + Function<CTTextParagraphProperties, R> getter); + + <R> Optional<R> findDefinedRunProperty(Function<CTTextCharacterProperties, Boolean> isSet, + Function<CTTextCharacterProperties, R> getter); - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); - } - - @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; - } - - @Internal - public CTTextBody getXmlObject() { - return body; - } } Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/UnderlineType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/UnderlineType.java?rev=1839255&view=auto ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/UnderlineType.java (added) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/UnderlineType.java Sun Aug 26 21:18:54 2018 @@ -0,0 +1,60 @@ +/* ==================================================================== + 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.STTextUnderlineType; + +public enum UnderlineType { + DASH(STTextUnderlineType.DASH), + DASH_HEAVY(STTextUnderlineType.DASH_HEAVY), + DASH_LONG(STTextUnderlineType.DASH_LONG), + DASH_LONG_HEAVY(STTextUnderlineType.DASH_LONG_HEAVY), + DOUBLE(STTextUnderlineType.DBL), + DOT_DASH(STTextUnderlineType.DOT_DASH), + DOT_DASH_HEAVY(STTextUnderlineType.DOT_DASH_HEAVY), + DOT_DOT_DASH(STTextUnderlineType.DOT_DOT_DASH), + DOT_DOT_DASH_HEAVY(STTextUnderlineType.DOT_DOT_DASH_HEAVY), + DOTTED(STTextUnderlineType.DOTTED), + DOTTED_HEAVY(STTextUnderlineType.DOTTED_HEAVY), + HEAVY(STTextUnderlineType.HEAVY), + NONE(STTextUnderlineType.NONE), + SINGLE(STTextUnderlineType.SNG), + WAVY(STTextUnderlineType.WAVY), + WAVY_DOUBLE(STTextUnderlineType.WAVY_DBL), + WAVY_HEAVY(STTextUnderlineType.WAVY_HEAVY), + WORDS(STTextUnderlineType.WORDS); + + final STTextUnderlineType.Enum underlying; + + UnderlineType(STTextUnderlineType.Enum underline) { + this.underlying = underline; + } + + private final static HashMap<STTextUnderlineType.Enum, UnderlineType> reverse = new HashMap<STTextUnderlineType.Enum, UnderlineType>(); + static { + for (UnderlineType value : values()) { + reverse.put(value.underlying, value); + } + } + + static UnderlineType valueOf(STTextUnderlineType.Enum underline) { + return reverse.get(underline); + } +} Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFAutoFit.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFAutoFit.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFAutoFit.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFAutoFit.java Sun Aug 26 21:18:54 2018 @@ -15,23 +15,12 @@ limitations under the License. ==================================================================== */ -package org.apache.poi.xddf.usermodel; +package org.apache.poi.xddf.usermodel.text; import org.apache.poi.util.Beta; -import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTEffectList; @Beta -public class XDDFEffectList { - private CTEffectList list; - - @Internal - protected XDDFEffectList(CTEffectList list) { - this.list = list; - } - - @Internal - public CTEffectList getXmlObject() { - return list; - } +public interface XDDFAutoFit { + int getFontScale(); + int getLineSpaceReduction(); } Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBodyProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBodyProperties.java?rev=1839255&view=auto ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBodyProperties.java (added) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBodyProperties.java Sun Aug 26 21:18:54 2018 @@ -0,0 +1,78 @@ +/* ==================================================================== + 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 org.apache.poi.util.Beta; +import org.apache.poi.util.Internal; +import org.apache.poi.xddf.usermodel.XDDFExtensionList; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties; + +@Beta +public class XDDFBodyProperties { + private CTTextBodyProperties props; + + @Internal + protected XDDFBodyProperties(CTTextBodyProperties properties) { + this.props = properties; + } + + @Internal + protected CTTextBodyProperties getXmlObject() { + return props; + } + + public XDDFAutoFit getAutoFit() { + if (props.isSetNoAutofit()) { + return new XDDFNoAutoFit(props.getNoAutofit()); + } else if (props.isSetNormAutofit()) { + return new XDDFNormalAutoFit(props.getNormAutofit()); + } else if (props.isSetSpAutoFit()) { + return new XDDFShapeAutoFit(props.getSpAutoFit()); + } + return new XDDFNoAutoFit(); + } + + public void setAutoFit(XDDFAutoFit autofit) { + props.unsetNoAutofit(); + props.unsetNormAutofit(); + props.unsetSpAutoFit(); + if (autofit instanceof XDDFNoAutoFit) { + props.setNoAutofit(((XDDFNoAutoFit) autofit).getXmlObject()); + } else if (autofit instanceof XDDFNormalAutoFit) { + props.setNormAutofit(((XDDFNormalAutoFit) autofit).getXmlObject()); + } else if (autofit instanceof XDDFShapeAutoFit) { + props.setSpAutoFit(((XDDFShapeAutoFit) autofit).getXmlObject()); + } + } + + public XDDFExtensionList getExtensionList() { + if (props.isSetExtLst()) { + return new XDDFExtensionList(props.getExtLst()); + } else { + return null; + } + } + + public void setExtensionList(XDDFExtensionList list) { + if (list == null) { + props.unsetExtLst(); + } else { + props.setExtLst(list.getXmlObject()); + } + } +} Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSize.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSize.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSize.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSize.java Sun Aug 26 21:18:54 2018 @@ -15,23 +15,22 @@ limitations under the License. ==================================================================== */ -package org.apache.poi.xddf.usermodel; +package org.apache.poi.xddf.usermodel.text; import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTEffectList; @Beta -public class XDDFEffectList { - private CTEffectList list; - - @Internal - protected XDDFEffectList(CTEffectList list) { - this.list = list; +public abstract class XDDFBulletSize { + public static enum Kind { + PERCENT, + POINTS, + TEXT; } @Internal - public CTEffectList getXmlObject() { - return list; + protected XDDFBulletSize() { } + + public abstract Kind getType(); } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizeFollowText.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizeFollowText.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizeFollowText.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizeFollowText.java Sun Aug 26 21:18:54 2018 @@ -19,23 +19,28 @@ package org.apache.poi.xddf.usermodel.te import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizeFollowText; @Beta -public class XDDFTextBody { - private CTTextBody body; +public class XDDFBulletSizeFollowText extends XDDFBulletSize { + private CTTextBulletSizeFollowText follow; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); + public XDDFBulletSizeFollowText() { + this(CTTextBulletSizeFollowText.Factory.newInstance()); } @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + protected XDDFBulletSizeFollowText(CTTextBulletSizeFollowText follow) { + this.follow = follow; } @Internal - public CTTextBody getXmlObject() { - return body; + protected CTTextBulletSizeFollowText getXmlObject() { + return follow; + } + + @Override + public Kind getType() { + return Kind.TEXT; } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizePercent.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizePercent.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizePercent.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizePercent.java Sun Aug 26 21:18:54 2018 @@ -19,23 +19,39 @@ package org.apache.poi.xddf.usermodel.te import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePercent; @Beta -public class XDDFTextBody { - private CTTextBody body; +public class XDDFBulletSizePercent extends XDDFBulletSize { + private CTTextBulletSizePercent percent; + private Double scale; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); + public XDDFBulletSizePercent(double value) { + this(CTTextBulletSizePercent.Factory.newInstance(), null); + setPercent(value); } @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + protected XDDFBulletSizePercent(CTTextBulletSizePercent percent, Double scale) { + this.percent = percent; + this.scale = (scale == null) ? 0.001 : scale * 0.001; } @Internal - public CTTextBody getXmlObject() { - return body; + protected CTTextBulletSizePercent getXmlObject() { + return percent; + } + + @Override + public Kind getType() { + return Kind.PERCENT; + } + + public double getPercent() { + return percent.getVal() * scale; + } + + public void setPercent(double value) { + percent.setVal((int)(1000 * value)); } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizePoints.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizePoints.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizePoints.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletSizePoints.java Sun Aug 26 21:18:54 2018 @@ -19,23 +19,37 @@ package org.apache.poi.xddf.usermodel.te import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePoint; @Beta -public class XDDFTextBody { - private CTTextBody body; +public class XDDFBulletSizePoints extends XDDFBulletSize { + private CTTextBulletSizePoint points; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); + public XDDFBulletSizePoints(double value) { + this(CTTextBulletSizePoint.Factory.newInstance()); + setPoints(value); } @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + protected XDDFBulletSizePoints(CTTextBulletSizePoint points) { + this.points = points; } @Internal - public CTTextBody getXmlObject() { - return body; + protected CTTextBulletSizePoint getXmlObject() { + return points; + } + + @Override + public Kind getType() { + return Kind.POINTS; + } + + public double getPoints() { + return points.getVal() * 0.01; + } + + public void setPoints(double value) { + points.setVal((int)(100 * value)); } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyle.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyle.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyle.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/XDDFEffectList.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyle.java Sun Aug 26 21:18:54 2018 @@ -15,23 +15,11 @@ limitations under the License. ==================================================================== */ -package org.apache.poi.xddf.usermodel; +package org.apache.poi.xddf.usermodel.text; import org.apache.poi.util.Beta; -import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTEffectList; @Beta -public class XDDFEffectList { - private CTEffectList list; +public abstract class XDDFBulletStyle { - @Internal - protected XDDFEffectList(CTEffectList list) { - this.list = list; - } - - @Internal - public CTEffectList getXmlObject() { - return list; - } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleAutoNumbered.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleAutoNumbered.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleAutoNumbered.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleAutoNumbered.java Sun Aug 26 21:18:54 2018 @@ -19,23 +19,43 @@ package org.apache.poi.xddf.usermodel.te import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextAutonumberBullet; @Beta -public class XDDFTextBody { - private CTTextBody body; +public class XDDFBulletStyleAutoNumbered extends XDDFBulletStyle { + private CTTextAutonumberBullet style; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); + @Internal + protected XDDFBulletStyleAutoNumbered(CTTextAutonumberBullet style) { + this.style =style; } @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + protected CTTextAutonumberBullet getXmlObject() { + return style; } - @Internal - public CTTextBody getXmlObject() { - return body; + public AutonumberScheme getType() { + return AutonumberScheme.valueOf(style.getType()); + } + + public void setType(AutonumberScheme scheme) { + style.setType(scheme.underlying); + } + + public int getStartAt() { + if (style.isSetStartAt()) { + return style.getStartAt(); + } else { + return 1; + } + } + + public void setStartAt(Integer value) { + if (value == null) { + style.unsetStartAt(); + } else { + style.setStartAt(value); + } } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleCharacter.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleCharacter.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleCharacter.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleCharacter.java Sun Aug 26 21:18:54 2018 @@ -19,23 +19,27 @@ package org.apache.poi.xddf.usermodel.te import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharBullet; @Beta -public class XDDFTextBody { - private CTTextBody body; +public class XDDFBulletStyleCharacter extends XDDFBulletStyle { + private CTTextCharBullet style; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); + @Internal + protected XDDFBulletStyleCharacter(CTTextCharBullet style) { + this.style = style; } @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + protected CTTextCharBullet getXmlObject() { + return style; } - @Internal - public CTTextBody getXmlObject() { - return body; + public String getCharacter() { + return style.getChar(); + } + + public void setCharacter(String value) { + style.setChar(value); } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleNone.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleNone.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleNone.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStyleNone.java Sun Aug 26 21:18:54 2018 @@ -19,23 +19,19 @@ package org.apache.poi.xddf.usermodel.te import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNoBullet; @Beta -public class XDDFTextBody { - private CTTextBody body; - - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); - } +public class XDDFBulletStyleNone extends XDDFBulletStyle { + private CTTextNoBullet style; @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + protected XDDFBulletStyleNone(CTTextNoBullet style) { + this.style = style; } @Internal - public CTTextBody getXmlObject() { - return body; + protected CTTextNoBullet getXmlObject() { + return style; } } Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStylePicture.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStylePicture.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStylePicture.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFBulletStylePicture.java Sun Aug 26 21:18:54 2018 @@ -19,23 +19,30 @@ package org.apache.poi.xddf.usermodel.te import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; +import org.apache.poi.xddf.usermodel.XDDFPicture; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBlipBullet; @Beta -public class XDDFTextBody { - private CTTextBody body; +public class XDDFBulletStylePicture extends XDDFBulletStyle { + private CTTextBlipBullet style; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); + @Internal + protected XDDFBulletStylePicture(CTTextBlipBullet style) { + this.style = style; } @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + protected CTTextBlipBullet getXmlObject() { + return style; } - @Internal - public CTTextBody getXmlObject() { - return body; + public XDDFPicture getPicture() { + return new XDDFPicture(style.getBlip()); + } + + public void setPicture(XDDFPicture picture) { + if (picture != null) { + style.setBlip(picture.getXmlObject()); + } } } Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFFont.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFFont.java?rev=1839255&view=auto ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFFont.java (added) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFFont.java Sun Aug 26 21:18:54 2018 @@ -0,0 +1,104 @@ +/* ==================================================================== + 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 org.apache.poi.common.usermodel.fonts.FontGroup; +import org.apache.poi.util.Beta; +import org.apache.poi.util.Internal; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont; + +@Beta +public class XDDFFont { + private FontGroup group; + private CTTextFont font; + + public static XDDFFont unsetFontForGroup(FontGroup group) { + return new XDDFFont(group, null); + } + + public XDDFFont(FontGroup group, String typeface, Byte charset, Byte pitch, byte[] panose) { + this(group, CTTextFont.Factory.newInstance()); + if (typeface == null) { + font.unsetTypeface(); + } else { + font.setTypeface(typeface); + } + if (charset == null) { + font.unsetCharset(); + } else { + font.setCharset(charset); + } + if (pitch == null) { + font.unsetPitchFamily(); + } else { + font.setPitchFamily(pitch); + } + if (panose == null || panose.length == 0) { + font.unsetPanose(); + } else { + font.setPanose(panose); + } + } + + @Internal + protected XDDFFont(FontGroup group, CTTextFont font) { + this.group = group; + this.font = font; + } + + @Internal + protected CTTextFont getXmlObject() { + return font; + } + + public FontGroup getGroup() { + return group; + } + + public String getTypeface() { + if (font.isSetTypeface()) { + return font.getTypeface(); + } else { + return null; + } + } + + public Byte getCharset() { + if (font.isSetCharset()) { + return font.getCharset(); + } else { + return null; + } + } + + public Byte getPitchFamily() { + if (font.isSetPitchFamily()) { + return font.getPitchFamily(); + } else { + return null; + } + } + + public byte[] getPanose() { + if (font.isSetPanose()) { + return font.getPanose(); + } else { + return null; + } + } +} Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFHyperlink.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFHyperlink.java?rev=1839255&view=auto ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFHyperlink.java (added) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFHyperlink.java Sun Aug 26 21:18:54 2018 @@ -0,0 +1,176 @@ +/* ==================================================================== + 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 org.apache.poi.util.Beta; +import org.apache.poi.util.Internal; +import org.apache.poi.xddf.usermodel.XDDFExtensionList; +import org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink; + +@Beta +public class XDDFHyperlink { + private CTHyperlink link; + + public XDDFHyperlink(String id) { + this(CTHyperlink.Factory.newInstance()); + this.link.setId(id);; + } + + public XDDFHyperlink(String id, String action) { + this(id); + this.link.setAction(action); + } + + @Internal + protected XDDFHyperlink(CTHyperlink link) { + this.link = link; + } + + @Internal + protected CTHyperlink getXmlObject() { + return link; + } + + public String getAction() { + if (link.isSetAction()) { + return link.getAction(); + } else { + return null; + } + } + + public String getId() { + if (link.isSetId()) { + return link.getId(); + } else { + return null; + } + } + + public Boolean getEndSound() { + if (link.isSetEndSnd()) { + return link.getEndSnd(); + } else { + return null; + } + } + + public void setEndSound(Boolean ends) { + if (ends == null) { + link.unsetEndSnd(); + } else { + link.setEndSnd(ends); + } + } + + public Boolean getHighlightClick() { + if (link.isSetHighlightClick()) { + return link.getHighlightClick(); + } else { + return null; + } + } + + public void setHighlightClick(Boolean highlights) { + if (highlights == null) { + link.unsetHighlightClick(); + } else { + link.setHighlightClick(highlights); + } + } + public Boolean getHistory() { + if (link.isSetHistory()) { + return link.getHistory(); + } else { + return null; + } + } + + public void setHistory(Boolean history) { + if (history == null) { + link.unsetHistory(); + } else { + link.setHistory(history); + } + } + + + public String getInvalidURL() { + if (link.isSetInvalidUrl()) { + return link.getInvalidUrl(); + } else { + return null; + } + } + + public void setInvalidURL(String invalid) { + if (invalid == null) { + link.unsetInvalidUrl(); + } else { + link.setInvalidUrl(invalid); + } + } + + public String getTargetFrame() { + if (link.isSetTgtFrame()) { + return link.getTgtFrame(); + } else { + return null; + } + } + + public void setTargetFrame(String frame) { + if (frame == null) { + link.unsetTgtFrame(); + } else { + link.setTgtFrame(frame); + } + } + + public String getTooltip() { + if (link.isSetTooltip()) { + return link.getTooltip(); + } else { + return null; + } + } + + public void setTooltip(String tooltip) { + if (tooltip == null) { + link.unsetTooltip(); + } else { + link.setTooltip(tooltip); + } + } + + public XDDFExtensionList getExtensionList() { + if (link.isSetExtLst()) { + return new XDDFExtensionList(link.getExtLst()); + } else { + return null; + } + } + + public void setExtensionList(XDDFExtensionList list) { + if (list == null) { + link.unsetExtLst(); + } else { + link.setExtLst(list.getXmlObject()); + } + } +} Copied: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFNoAutoFit.java (from r1839252, poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFNoAutoFit.java?p2=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFNoAutoFit.java&p1=poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java&r1=1839252&r2=1839255&rev=1839255&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFNoAutoFit.java Sun Aug 26 21:18:54 2018 @@ -19,23 +19,33 @@ package org.apache.poi.xddf.usermodel.te import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNoAutofit; @Beta -public class XDDFTextBody { - private CTTextBody body; +public class XDDFNoAutoFit implements XDDFAutoFit { + private CTTextNoAutofit autofit; - public XDDFTextBody() { - this(CTTextBody.Factory.newInstance()); + public XDDFNoAutoFit() { + this(CTTextNoAutofit.Factory.newInstance()); } @Internal - public XDDFTextBody(CTTextBody body) { - this.body = body; + protected XDDFNoAutoFit(CTTextNoAutofit autofit) { + this.autofit = autofit; } @Internal - public CTTextBody getXmlObject() { - return body; + protected CTTextNoAutofit getXmlObject() { + return autofit; + } + + @Override + public int getFontScale() { + return 100_000; + } + + @Override + public int getLineSpaceReduction() { + return 0; } } Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFNormalAutoFit.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFNormalAutoFit.java?rev=1839255&view=auto ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFNormalAutoFit.java (added) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFNormalAutoFit.java Sun Aug 26 21:18:54 2018 @@ -0,0 +1,75 @@ +/* ==================================================================== + 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 org.apache.poi.util.Beta; +import org.apache.poi.util.Internal; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit; + +@Beta +public class XDDFNormalAutoFit implements XDDFAutoFit { + private CTTextNormalAutofit autofit; + + public XDDFNormalAutoFit() { + this(CTTextNormalAutofit.Factory.newInstance()); + } + + @Internal + protected XDDFNormalAutoFit(CTTextNormalAutofit autofit) { + this.autofit = autofit; + } + + @Internal + protected CTTextNormalAutofit getXmlObject() { + return autofit; + } + + @Override + public int getFontScale() { + if (autofit.isSetFontScale()) { + return autofit.getFontScale(); + } else { + return 100_000; + } + } + + public void setFontScale(Integer value) { + if (value == null) { + autofit.unsetFontScale(); + } else { + autofit.setFontScale(value); + } + } + + @Override + public int getLineSpaceReduction() { + if (autofit.isSetLnSpcReduction()) { + return autofit.getLnSpcReduction(); + } else { + return 0; + } + } + + public void setLineSpaceReduction(Integer value) { + if (value == null) { + autofit.unsetLnSpcReduction(); + } else { + autofit.setLnSpcReduction(value); + } + } +} Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFParagraphBulletProperties.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFParagraphBulletProperties.java?rev=1839255&view=auto ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFParagraphBulletProperties.java (added) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFParagraphBulletProperties.java Sun Aug 26 21:18:54 2018 @@ -0,0 +1,159 @@ +/* ==================================================================== + 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 org.apache.poi.common.usermodel.fonts.FontGroup; +import org.apache.poi.util.Beta; +import org.apache.poi.util.Internal; +import org.apache.poi.xddf.usermodel.XDDFColor; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties; + +@Beta +public class XDDFParagraphBulletProperties { + private CTTextParagraphProperties props; + + @Internal + protected XDDFParagraphBulletProperties(CTTextParagraphProperties properties) { + this.props = properties; + } + + public XDDFBulletStyle getBulletStyle() { + if (props.isSetBuAutoNum()) { + return new XDDFBulletStyleAutoNumbered(props.getBuAutoNum()); + } else if (props.isSetBuBlip()) { + return new XDDFBulletStylePicture(props.getBuBlip()); + } else if (props.isSetBuChar()) { + return new XDDFBulletStyleCharacter(props.getBuChar()); + } else if (props.isSetBuNone()) { + return new XDDFBulletStyleNone(props.getBuNone()); + } else { + return null; + } + } + + public void setBulletStyle(XDDFBulletStyle style) { + props.unsetBuAutoNum(); + props.unsetBuBlip(); + props.unsetBuChar(); + props.unsetBuNone(); + if (style != null) { + if (style instanceof XDDFBulletStyleAutoNumbered) { + props.setBuAutoNum(((XDDFBulletStyleAutoNumbered) style).getXmlObject()); + } else if (style instanceof XDDFBulletStyleCharacter) { + props.setBuChar(((XDDFBulletStyleCharacter) style).getXmlObject()); + } else if (style instanceof XDDFBulletStyleNone) { + props.setBuNone(((XDDFBulletStyleNone) style).getXmlObject()); + } else if (style instanceof XDDFBulletStylePicture) { + props.setBuBlip(((XDDFBulletStylePicture) style).getXmlObject()); + } + } + } + + public XDDFColor getBulletColor() { + if (props.isSetBuClr()) { + return XDDFColor.forColorContainer(props.getBuClr()); + } else { + return null; + } + } + + public void setBulletColor(XDDFColor color) { + props.unsetBuClrTx(); + if (color == null) { + props.unsetBuClr(); + } else { + props.setBuClr(color.getColorContainer()); + } + } + + public void setBulletColorFollowText() { + props.unsetBuClr(); + if (props.isSetBuClrTx()) { + // nothing to do: already set + } else { + props.addNewBuClrTx(); + } + } + + public XDDFFont getBulletFont() { + if (props.isSetBuFont()) { + return new XDDFFont(FontGroup.SYMBOL, props.getBuFont()); + } else { + return null; + } + } + + public void setBulletFont(XDDFFont font) { + props.unsetBuFontTx(); + if (font == null) { + props.unsetBuFont(); + } else { + props.setBuFont(font.getXmlObject()); + } + } + + public void setBulletFontFollowText() { + props.unsetBuFont(); + if (props.isSetBuFontTx()) { + // nothing to do: already set + } else { + props.addNewBuFontTx(); + } + } + + public XDDFBulletSize getBulletSize() { + if (props.isSetBuSzPct()) { + return new XDDFBulletSizePercent(props.getBuSzPct(), null); + } else if (props.isSetBuSzPts()) { + return new XDDFBulletSizePoints(props.getBuSzPts()); + } else if (props.isSetBuSzTx()) { + return new XDDFBulletSizeFollowText(props.getBuSzTx()); + } else { + return null; + } + } + + public void setBulletSize(XDDFBulletSize size) { + props.unsetBuSzPct(); + props.unsetBuSzPts(); + props.unsetBuSzTx(); + if (size != null) { + if (size instanceof XDDFBulletSizeFollowText) { + props.setBuSzTx(((XDDFBulletSizeFollowText) size).getXmlObject()); + } else if (size instanceof XDDFBulletSizePercent) { + props.setBuSzPct(((XDDFBulletSizePercent) size).getXmlObject()); + } else if (size instanceof XDDFBulletSizePoints) { + props.setBuSzPts(((XDDFBulletSizePoints) size).getXmlObject()); + } + } + } + + public void clearAll() { + props.unsetBuAutoNum(); + props.unsetBuBlip(); + props.unsetBuChar(); + props.unsetBuNone(); + props.unsetBuClr(); + props.unsetBuClrTx(); + props.unsetBuFont(); + props.unsetBuFontTx(); + props.unsetBuSzPct(); + props.unsetBuSzPts(); + props.unsetBuSzTx(); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org