You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2021/10/03 21:05:20 UTC
svn commit: r1893859 [1/2] - in /poi: site/src/documentation/content/xdocs/
trunk/ trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/
trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/
trunk/poi-ooxml/src/main/java/org/apache/poi/xs...
Author: kiwiwings
Date: Sun Oct 3 21:05:19 2021
New Revision: 1893859
URL: http://svn.apache.org/viewvc?rev=1893859&view=rev
Log:
#65612 - XSLF CustomGeometry - replace XmlStreamReader access with XmlBeans delegate
Added:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustPoint.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustValue.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFArcTo.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFConnectionSite.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCurveTo.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCustomGeometry.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFGuide.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFLineTo.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFMoveTo.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPath.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPolarAdjustHandle.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFQuadTo.java (with props)
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFXYAdjustHandle.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPointIf.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValueIf.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommandIf.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommandIf.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSiteIf.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/CurveToCommandIf.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/GuideIf.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/LineToCommandIf.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/MoveToCommandIf.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/PathIf.java (with props)
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/QuadToCommandIf.java (with props)
Modified:
poi/site/src/documentation/content/xdocs/changes.xml
poi/trunk/build.gradle
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFBackground.java
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTable.java
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/util/PPTX2PNG.java
poi/trunk/poi-ooxml/src/main/java9/module-info.class
poi/trunk/poi-ooxml/src/main/java9/module-info.java
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java
poi/trunk/poi-ooxml/src/test/java9/module-info.class
poi/trunk/poi-ooxml/src/test/java9/module-info.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/DrawSimpleShape.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPoint.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValue.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommand.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommand.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSite.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/Context.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/CurveToCommand.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/CustomGeometry.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/Guide.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/IAdjustableShape.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/LineToCommand.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/MoveToCommand.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/Outline.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/Path.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/PresetGeometries.java
poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/QuadToCommand.java
poi/trunk/poi/src/test/java/org/apache/poi/sl/draw/geom/TestPresetGeometries.java
Modified: poi/site/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/changes.xml (original)
+++ poi/site/src/documentation/content/xdocs/changes.xml Sun Oct 3 21:05:19 2021
@@ -110,6 +110,7 @@
<action type="add" fixes-bug="65581" context="OOXML">add optional support in ZipArchiveFakeEntry to use a temp file</action>
<action type="fix" fixes-bug="65595" context="SS_Common">Strip color formatting in headers and footers</action>
<action type="fix" fixes-bug="65606" context="SS_Common">Fix issues with WEEKNUM function evaluation</action>
+ <action type="fix" fixes-bug="65612" context="XSLF">XSLF CustomGeometry - replace XmlStreamReader access with XmlBeans delegate</action>
</actions>
</release>
Modified: poi/trunk/build.gradle
URL: http://svn.apache.org/viewvc/poi/trunk/build.gradle?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/build.gradle (original)
+++ poi/trunk/build.gradle Sun Oct 3 21:05:19 2021
@@ -136,6 +136,7 @@ subprojects {
resolutionStrategy {
force "commons-io:commons-io:${commonsIoVersion}"
force 'org.slf4j:slf4j-api:1.7.32'
+ force 'com.fasterxml.woodstox:woodstox-core:6.2.6'
}
}
}
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustPoint.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustPoint.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustPoint.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustPoint.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,66 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.AdjustPointIf;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTAdjPoint2D;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFAdjustPoint implements AdjustPointIf {
+
+ private final CTAdjPoint2D pnt;
+
+ public XSLFAdjustPoint(CTAdjPoint2D pnt) {
+ this.pnt = pnt;
+ }
+
+ @Override
+ public String getX() {
+ return pnt.xgetX().getStringValue();
+ }
+
+ @Override
+ public void setX(String value) {
+ pnt.setX(value);
+ }
+
+ @Override
+ public boolean isSetX() {
+ return pnt.xgetX() != null;
+ }
+
+ @Override
+ public String getY() {
+ return pnt.xgetY().getStringValue();
+ }
+
+ @Override
+ public void setY(String value) {
+ pnt.setY(value);
+ }
+
+ @Override
+ public boolean isSetY() {
+ return pnt.xgetY() != null;
+
+ }
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustPoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustValue.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustValue.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustValue.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustValue.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,32 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.AdjustValueIf;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGeomGuide;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFAdjustValue extends XSLFGuide implements AdjustValueIf {
+ public XSLFAdjustValue(CTGeomGuide guide) {
+ super(guide);
+ }
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFAdjustValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFArcTo.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFArcTo.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFArcTo.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFArcTo.java Sun Oct 3 21:05:19 2021
@@ -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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.ArcToCommandIf;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DArcTo;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFArcTo implements ArcToCommandIf {
+ private final CTPath2DArcTo arc;
+
+ public XSLFArcTo(CTPath2DArcTo arc) {
+ this.arc = arc;
+ }
+
+ @Override
+ public String getHR() {
+ return arc.xgetHR().getStringValue();
+ }
+
+ @Override
+ public void setHR(String hr) {
+ arc.setHR(hr);
+ }
+
+ @Override
+ public String getWR() {
+ return arc.xgetHR().getStringValue();
+ }
+
+ @Override
+ public void setWR(String wr) {
+ arc.setWR(wr);
+ }
+
+ @Override
+ public String getStAng() {
+ return arc.xgetStAng().getStringValue();
+ }
+
+ @Override
+ public void setStAng(String stAng) {
+ arc.setStAng(stAng);
+ }
+
+ @Override
+ public String getSwAng() {
+ return arc.xgetSwAng().getStringValue();
+ }
+
+ @Override
+ public void setSwAng(String swAng) {
+ arc.setSwAng(swAng);
+ }
+
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFArcTo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFConnectionSite.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFConnectionSite.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFConnectionSite.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFConnectionSite.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,71 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.AdjustPointIf;
+import org.apache.poi.sl.draw.geom.ConnectionSiteIf;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTAdjPoint2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTConnectionSite;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFConnectionSite implements ConnectionSiteIf {
+
+ final CTConnectionSite cxn;
+
+ public XSLFConnectionSite(CTConnectionSite cxn) {
+ this.cxn = cxn;
+ }
+
+ @Override
+ public AdjustPointIf getPos() {
+ return new XSLFAdjustPoint(cxn.getPos());
+ }
+
+ @Override
+ public void setPos(AdjustPointIf pos) {
+ CTAdjPoint2D p = cxn.getPos();
+ if (p == null) {
+ p = cxn.addNewPos();
+ }
+ p.setX(pos.getX());
+ p.setY(pos.getY());
+ }
+
+ @Override
+ public String getAng() {
+ return cxn.xgetAng().getStringValue();
+ }
+
+ /**
+ * Sets the value of the ang property.
+ */
+ @Override
+ public void setAng(String value) {
+ cxn.setAng(value);
+ }
+
+ @Override
+ public boolean isSetAng() {
+ return cxn.xgetAng() == null;
+ }
+
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFConnectionSite.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCurveTo.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCurveTo.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCurveTo.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCurveTo.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,79 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.AdjustPointIf;
+import org.apache.poi.sl.draw.geom.CurveToCommandIf;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTAdjPoint2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DCubicBezierTo;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFCurveTo implements CurveToCommandIf {
+ private final CTPath2DCubicBezierTo bezier;
+
+ public XSLFCurveTo(CTPath2DCubicBezierTo bezier) {
+ this.bezier = bezier;
+ }
+
+ @Override
+ public XSLFAdjustPoint getPt1() {
+ return new XSLFAdjustPoint(bezier.getPtArray(0));
+ }
+
+ @Override
+ public void setPt1(AdjustPointIf pt1) {
+ CTAdjPoint2D xpt = getOrCreate(0);
+ xpt.setX(pt1.getX());
+ xpt.setY(pt1.getY());
+ }
+
+ @Override
+ public XSLFAdjustPoint getPt2() {
+ return new XSLFAdjustPoint(bezier.getPtArray(1));
+ }
+
+ @Override
+ public void setPt2(AdjustPointIf pt2) {
+ CTAdjPoint2D xpt = getOrCreate(1);
+ xpt.setX(pt2.getX());
+ xpt.setY(pt2.getY());
+ }
+
+ @Override
+ public XSLFAdjustPoint getPt3() {
+ return new XSLFAdjustPoint(bezier.getPtArray(2));
+ }
+
+ @Override
+ public void setPt3(AdjustPointIf pt3) {
+ CTAdjPoint2D xpt = getOrCreate(2);
+ xpt.setX(pt3.getX());
+ xpt.setY(pt3.getY());
+ }
+
+ private CTAdjPoint2D getOrCreate(int idx) {
+ for (int i=(idx+1)-bezier.sizeOfPtArray(); i > 0; i--) {
+ bezier.addNewPt();
+ }
+ return bezier.getPtArray(idx);
+ }
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCurveTo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCustomGeometry.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCustomGeometry.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCustomGeometry.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCustomGeometry.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,89 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.CustomGeometry;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTAdjustHandleList;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTConnectionSite;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTCustomGeometry2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGeomGuide;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGeomGuideList;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGeomRect;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DList;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPolarAdjustHandle;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTXYAdjustHandle;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFCustomGeometry {
+ public static CustomGeometry convertCustomGeometry(CTCustomGeometry2D custGeom) {
+ CustomGeometry cg = new CustomGeometry();
+
+ if (custGeom.isSetAhLst()) {
+ CTAdjustHandleList ahLst = custGeom.getAhLst();
+ for (CTXYAdjustHandle xy : ahLst.getAhXYArray()) {
+ cg.addAdjustHandle(new XSLFXYAdjustHandle(xy));
+ }
+ for (CTPolarAdjustHandle pol : ahLst.getAhPolarArray()) {
+ cg.addAdjustHandle(new XSLFPolarAdjustHandle(pol));
+ }
+ }
+
+ if (custGeom.isSetAvLst()) {
+ CTGeomGuideList avLst = custGeom.getAvLst();
+ for (CTGeomGuide gg : avLst.getGdArray()) {
+ cg.addAdjustGuide(new XSLFAdjustValue(gg));
+ }
+ }
+
+ if (custGeom.isSetGdLst()) {
+ CTGeomGuideList gdLst = custGeom.getGdLst();
+ for (CTGeomGuide gg : gdLst.getGdArray()) {
+ cg.addGeomGuide(new XSLFGuide(gg));
+ }
+ }
+
+ if (custGeom.isSetRect()) {
+ CTGeomRect r = custGeom.getRect();
+ cg.setTextBounds(
+ r.xgetL().getStringValue(),
+ r.xgetT().getStringValue(),
+ r.xgetR().getStringValue(),
+ r.xgetB().getStringValue());
+ }
+
+ if (custGeom.isSetCxnLst()) {
+ for (CTConnectionSite cxn : custGeom.getCxnLst().getCxnArray()) {
+ cg.addConnectionSite(new XSLFConnectionSite((cxn)));
+ }
+ }
+
+ CTPath2DList pl = custGeom.getPathLst();
+ if (pl != null) {
+ for (CTPath2D p : pl.getPathArray()) {
+ cg.addPath(new XSLFPath(p));
+ }
+ }
+
+ return cg;
+ }
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFCustomGeometry.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFGuide.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFGuide.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFGuide.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFGuide.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,55 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.GuideIf;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTGeomGuide;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFGuide implements GuideIf {
+ final CTGeomGuide guide;
+
+ public XSLFGuide(CTGeomGuide guide) {
+ this.guide = guide;
+ }
+
+ @Override
+ public String getName() {
+ return guide.getName();
+ }
+
+ @Override
+ public void setName(String name) {
+ guide.setName(name);
+ }
+
+ @Override
+ public String getFmla() {
+ return guide.getFmla();
+ }
+
+ @Override
+ public void setFmla(String fmla) {
+ guide.setFmla(fmla);
+ }
+
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFGuide.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFLineTo.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFLineTo.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFLineTo.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFLineTo.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,52 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.AdjustPointIf;
+import org.apache.poi.sl.draw.geom.LineToCommandIf;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTAdjPoint2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DLineTo;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFLineTo implements LineToCommandIf {
+
+ private final CTPath2DLineTo lineTo;
+
+ public XSLFLineTo(CTPath2DLineTo lineTo) {
+ this.lineTo = lineTo;
+ }
+
+ @Override
+ public AdjustPointIf getPt() {
+ return new XSLFAdjustPoint(lineTo.getPt());
+ }
+
+ @Override
+ public void setPt(AdjustPointIf pt) {
+ CTAdjPoint2D xpt = lineTo.getPt();
+ if (xpt == null) {
+ xpt = lineTo.addNewPt();
+ }
+ xpt.setX(pt.getX());
+ xpt.setY(pt.getY());
+ }
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFLineTo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFMoveTo.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFMoveTo.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFMoveTo.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFMoveTo.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,52 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.AdjustPointIf;
+import org.apache.poi.sl.draw.geom.MoveToCommandIf;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTAdjPoint2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DMoveTo;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFMoveTo implements MoveToCommandIf {
+
+ private final CTPath2DMoveTo moveTo;
+
+ public XSLFMoveTo(CTPath2DMoveTo moveTo) {
+ this.moveTo = moveTo;
+ }
+
+ @Override
+ public XSLFAdjustPoint getPt() {
+ return new XSLFAdjustPoint(moveTo.getPt());
+ }
+
+ @Override
+ public void setPt(AdjustPointIf pt) {
+ CTAdjPoint2D xpt = moveTo.getPt();
+ if (xpt == null) {
+ xpt = moveTo.addNewPt();
+ }
+ xpt.setX(pt.getX());
+ xpt.setY(pt.getY());
+ }
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFMoveTo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPath.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPath.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPath.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPath.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,178 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import java.awt.geom.Path2D;
+
+import org.apache.poi.sl.draw.geom.ClosePathCommand;
+import org.apache.poi.sl.draw.geom.Context;
+import org.apache.poi.sl.draw.geom.PathCommand;
+import org.apache.poi.sl.draw.geom.PathIf;
+import org.apache.poi.sl.usermodel.PaintStyle;
+import org.apache.poi.util.Beta;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2D;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DArcTo;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DClose;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DCubicBezierTo;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DLineTo;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DMoveTo;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DQuadBezierTo;
+import org.openxmlformats.schemas.drawingml.x2006.main.STPathFillMode;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFPath implements PathIf {
+
+ private final CTPath2D pathXml;
+
+ public XSLFPath(CTPath2D pathXml) {
+ this.pathXml = pathXml;
+ }
+
+ @Override
+ public void addCommand(PathCommand cmd) {
+ // not supported
+ }
+
+ @Override
+ public Path2D.Double getPath(Context ctx) {
+ Path2D.Double path2D = new Path2D.Double();
+ XmlCursor cur = pathXml.newCursor();
+ try {
+ for (boolean hasNext = cur.toFirstChild(); hasNext; hasNext = cur.toNextSibling()) {
+ XmlObject xo = cur.getObject();
+ PathCommand pc;
+ if (xo instanceof CTPath2DArcTo) {
+ pc = new XSLFArcTo((CTPath2DArcTo) xo);
+ } else if (xo instanceof CTPath2DCubicBezierTo) {
+ pc = new XSLFCurveTo((CTPath2DCubicBezierTo) xo);
+ } else if (xo instanceof CTPath2DMoveTo) {
+ pc = new XSLFMoveTo((CTPath2DMoveTo) xo);
+ } else if (xo instanceof CTPath2DLineTo) {
+ pc = new XSLFLineTo((CTPath2DLineTo) xo);
+ } else if (xo instanceof CTPath2DQuadBezierTo) {
+ pc = new XSLFQuadTo((CTPath2DQuadBezierTo) xo);
+ } else if (xo instanceof CTPath2DClose) {
+ pc = new ClosePathCommand();
+ } else {
+ continue;
+ }
+ pc.execute(path2D, ctx);
+ }
+ } finally {
+ cur.dispose();
+ }
+ return path2D;
+ }
+
+ @Override
+ public boolean isStroked() {
+ return pathXml.getStroke();
+ }
+
+ @Override
+ public void setStroke(boolean stroke) {
+ pathXml.setStroke(stroke);
+ }
+
+ @Override
+ public boolean isFilled() {
+ return pathXml.getFill() != STPathFillMode.NONE;
+ }
+
+ @Override
+ public PaintStyle.PaintModifier getFill() {
+ switch (pathXml.getFill().intValue()) {
+ default:
+ case STPathFillMode.INT_NONE:
+ return PaintStyle.PaintModifier.NONE;
+ case STPathFillMode.INT_NORM:
+ return PaintStyle.PaintModifier.NORM;
+ case STPathFillMode.INT_LIGHTEN:
+ return PaintStyle.PaintModifier.LIGHTEN;
+ case STPathFillMode.INT_LIGHTEN_LESS:
+ return PaintStyle.PaintModifier.LIGHTEN_LESS;
+ case STPathFillMode.INT_DARKEN:
+ return PaintStyle.PaintModifier.DARKEN;
+ case STPathFillMode.INT_DARKEN_LESS:
+ return PaintStyle.PaintModifier.DARKEN_LESS;
+ }
+ }
+
+ @Override
+ public void setFill(PaintStyle.PaintModifier fill) {
+ STPathFillMode.Enum f;
+ switch (fill) {
+ default:
+ case NONE:
+ f = STPathFillMode.NONE;
+ break;
+ case NORM:
+ f = STPathFillMode.NORM;
+ break;
+ case LIGHTEN:
+ f = STPathFillMode.LIGHTEN;
+ break;
+ case LIGHTEN_LESS:
+ f = STPathFillMode.LIGHTEN_LESS;
+ break;
+ case DARKEN:
+ f = STPathFillMode.DARKEN;
+ break;
+ case DARKEN_LESS:
+ f = STPathFillMode.DARKEN_LESS;
+ break;
+ }
+ pathXml.setFill(f);
+ }
+
+ @Override
+ public long getW() {
+ return pathXml.getW();
+ }
+
+ @Override
+ public void setW(long w) {
+ pathXml.setW(w);
+ }
+
+ @Override
+ public long getH() {
+ return pathXml.getH();
+ }
+
+ @Override
+ public void setH(long h) {
+ pathXml.setH(h);
+ }
+
+ @Override
+ public boolean isExtrusionOk() {
+ return pathXml.getExtrusionOk();
+ }
+
+ @Override
+ public void setExtrusionOk(boolean extrusionOk) {
+ pathXml.setExtrusionOk(extrusionOk);
+ }
+
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPath.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPolarAdjustHandle.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPolarAdjustHandle.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPolarAdjustHandle.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPolarAdjustHandle.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,36 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.AdjustHandle;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPolarAdjustHandle;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFPolarAdjustHandle implements AdjustHandle {
+ final CTPolarAdjustHandle xobj;
+
+ public XSLFPolarAdjustHandle(CTPolarAdjustHandle xobj) {
+ this.xobj = xobj;
+ }
+
+ // define more getter/setter when needed
+}
\ No newline at end of file
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFPolarAdjustHandle.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFQuadTo.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFQuadTo.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFQuadTo.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFQuadTo.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,56 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.AdjustPointIf;
+import org.apache.poi.sl.draw.geom.QuadToCommandIf;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DQuadBezierTo;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFQuadTo implements QuadToCommandIf {
+
+ private final CTPath2DQuadBezierTo bezier;
+
+ public XSLFQuadTo(CTPath2DQuadBezierTo bezier) {
+ this.bezier = bezier;
+ }
+
+ @Override
+ public AdjustPointIf getPt1() {
+ return new XSLFAdjustPoint(bezier.getPtArray(0));
+ }
+
+ @Override
+ public void setPt1(AdjustPointIf pt1) {
+
+ }
+
+ @Override
+ public AdjustPointIf getPt2() {
+ return new XSLFAdjustPoint(bezier.getPtArray(1));
+ }
+
+ @Override
+ public void setPt2(AdjustPointIf pt2) {
+
+ }
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFQuadTo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFXYAdjustHandle.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFXYAdjustHandle.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFXYAdjustHandle.java (added)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFXYAdjustHandle.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,35 @@
+/* ====================================================================
+ 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.xslf.draw.geom;
+
+import org.apache.poi.sl.draw.geom.AdjustHandle;
+import org.apache.poi.util.Beta;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTXYAdjustHandle;
+
+/**
+ * Wrapper / delegate for XmlBeans custom geometry
+ */
+@Beta
+public class XSLFXYAdjustHandle implements AdjustHandle {
+ final CTXYAdjustHandle xobj;
+ public XSLFXYAdjustHandle(CTXYAdjustHandle xobj) {
+ this.xobj = xobj;
+ }
+
+ // define more getter/setter when needed
+}
Propchange: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/draw/geom/XSLFXYAdjustHandle.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFBackground.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFBackground.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFBackground.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFBackground.java Sun Oct 3 21:05:19 2021
@@ -75,6 +75,7 @@ public class XSLFBackground extends XSLF
return bg.getBgPr();
}
+ @Override
public void setFillColor(Color color) {
CTBackgroundProperties bgPr = getBgPr(true);
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFFreeformShape.java Sun Oct 3 21:05:19 2021
@@ -24,21 +24,16 @@ import java.awt.geom.Path2D;
import java.awt.geom.PathIterator;
import java.awt.geom.Rectangle2D;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import org.apache.poi.ooxml.POIXMLTypeLoader;
import org.apache.poi.ooxml.util.POIXMLUnits;
import org.apache.poi.sl.draw.geom.CustomGeometry;
-import org.apache.poi.sl.draw.geom.PresetGeometries;
import org.apache.poi.sl.usermodel.FreeformShape;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Units;
+import org.apache.poi.xslf.draw.geom.XSLFCustomGeometry;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
import org.openxmlformats.schemas.drawingml.x2006.main.CTAdjPoint2D;
import org.openxmlformats.schemas.drawingml.x2006.main.CTCustomGeometry2D;
import org.openxmlformats.schemas.drawingml.x2006.main.CTGeomRect;
@@ -135,18 +130,7 @@ public class XSLFFreeformShape extends X
return null;
}
- XmlOptions xop = new XmlOptions(POIXMLTypeLoader.DEFAULT_XML_OPTIONS);
- xop.setSaveOuter();
-
- XMLStreamReader staxReader = ((CTShapeProperties)xo).getCustGeom().newXMLStreamReader(xop);
- CustomGeometry custGeo = PresetGeometries.convertCustomGeometry(staxReader);
- try {
- staxReader.close();
- } catch (XMLStreamException e) {
- LOG.atWarn().log("An error occurred while closing a Custom Geometry XML Stream Reader: {}", e.getMessage());
- }
-
- return custGeo;
+ return XSLFCustomGeometry.convertCustomGeometry(((CTShapeProperties)xo).getCustGeom());
}
@Override
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java Sun Oct 3 21:05:19 2021
@@ -22,9 +22,6 @@ package org.apache.poi.xslf.usermodel;
import java.awt.Color;
import java.awt.geom.Rectangle2D;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.ooxml.util.POIXMLUnits;
@@ -47,6 +44,7 @@ import org.apache.poi.sl.usermodel.Strok
import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Units;
+import org.apache.poi.xslf.draw.geom.XSLFCustomGeometry;
import org.apache.poi.xslf.model.PropertyFetcher;
import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFEffectProperties;
import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties;
@@ -240,7 +238,7 @@ public abstract class XSLFSimpleShape ex
/**
* @param color the color to paint the shape outline.
- * A <code>null</code> value turns off the shape outline.
+ * A {@code null} value turns off the shape outline.
*/
public void setLineColor(Color color) {
CTLineProperties ln = getLn(this, true);
@@ -273,7 +271,7 @@ public abstract class XSLFSimpleShape ex
/**
*
- * @return the color of the shape outline or <code>null</code>
+ * @return the color of the shape outline or {@code null}
* if outline is turned off
*/
@SuppressWarnings("WeakerAccess")
@@ -351,7 +349,7 @@ public abstract class XSLFSimpleShape ex
/**
*
- * @param width line width in points. <code>0</code> means no line
+ * @param width line width in points. {@code 0} means no line
*/
@SuppressWarnings("WeakerAccess")
public void setLineWidth(double width) {
@@ -386,7 +384,7 @@ public abstract class XSLFSimpleShape ex
}
/**
- * @return line width in points. <code>0</code> means no line.
+ * @return line width in points. {@code 0} means no line.
*/
@SuppressWarnings("WeakerAccess")
public double getLineWidth() {
@@ -709,14 +707,7 @@ public abstract class XSLFSimpleShape ex
throw new IllegalStateException("Unknown shape geometry: " + name + ", available geometries are: " + dict.keySet());
}
} else if (gp.isSetCustGeom()){
- XMLStreamReader staxReader = gp.getCustGeom().newXMLStreamReader();
- geom = PresetGeometries.convertCustomGeometry(staxReader);
- try {
- staxReader.close();
- }
- catch (XMLStreamException e) {
- LOG.atWarn().log("An error occurred while closing a Custom Geometry XML Stream Reader: {}", e.getMessage());
- }
+ geom = XSLFCustomGeometry.convertCustomGeometry(gp.getCustGeom());
} else {
geom = dict.get("rect");
}
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTable.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTable.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFTable.java Sun Oct 3 21:05:19 2021
@@ -27,6 +27,8 @@ import java.util.List;
import javax.xml.namespace.QName;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.poi.ooxml.util.POIXMLUnits;
import org.apache.poi.sl.draw.DrawFactory;
import org.apache.poi.sl.draw.DrawTableShape;
@@ -52,6 +54,7 @@ import org.openxmlformats.schemas.presen
public class XSLFTable extends XSLFGraphicFrame implements Iterable<XSLFTableRow>,
TableShape<XSLFShape,XSLFTextParagraph> {
/* package */ static final String TABLE_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
+ private static final Logger LOG = LogManager.getLogger(XSLFTable.class);
private final CTTable _table;
private final List<XSLFTableRow> _rows;
@@ -425,13 +428,17 @@ public class XSLFTable extends XSLFGraph
for (int col2=col+1; col2<col+tc.getGridSpan(); col2++) {
assert(col2 < cols);
XSLFTableCell tc2 = getCell(row, col2);
- assert(tc2.getGridSpan() == 1 && tc2.getRowSpan() == 1);
+ if (tc2.getGridSpan() != 1 || tc2.getRowSpan() != 1) {
+ LOG.warn("invalid table span - rendering result is probably wrong");
+ }
mergedBounds.add(tc2.getAnchor());
}
for (int row2=row+1; row2<row+tc.getRowSpan(); row2++) {
assert(row2 < rows);
XSLFTableCell tc2 = getCell(row2, col);
- assert(tc2.getGridSpan() == 1 && tc2.getRowSpan() == 1);
+ if (tc2.getGridSpan() != 1 || tc2.getRowSpan() != 1) {
+ LOG.warn("invalid table span - rendering result is probably wrong");
+ }
mergedBounds.add(tc2.getAnchor());
}
tc.setAnchor(mergedBounds);
Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/util/PPTX2PNG.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/util/PPTX2PNG.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/util/PPTX2PNG.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/util/PPTX2PNG.java Sun Oct 3 21:05:19 2021
@@ -477,7 +477,13 @@ public final class PPTX2PNG {
if (outfile != null) {
return outfile;
}
- String inname = String.format(Locale.ROOT, "%04d|%s|%s", slideNo, format, file.getName());
+
+ String fileName = file.getName();
+ if ("stdin".equals(fileName)) {
+ fileName += ".ext";
+ }
+
+ String inname = String.format(Locale.ROOT, "%04d|%s|%s", slideNo, format, fileName);
String outpat = (proxy.getSlideCount() > 1 && slideNo > 0 ? outPattern : outPattern.replaceAll("-?\\$\\{slideno}", ""));
return INPUT_PATTERN.matcher(inname).replaceAll(outpat);
}
Modified: poi/trunk/poi-ooxml/src/main/java9/module-info.class
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java9/module-info.class?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
Binary files - no diff available.
Modified: poi/trunk/poi-ooxml/src/main/java9/module-info.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java9/module-info.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java9/module-info.java (original)
+++ poi/trunk/poi-ooxml/src/main/java9/module-info.java Sun Oct 3 21:05:19 2021
@@ -72,6 +72,7 @@ module org.apache.poi.ooxml {
exports org.apache.poi.xssf.streaming;
exports org.apache.poi.xssf.util;
exports org.apache.poi.xslf.draw;
+ exports org.apache.poi.xslf.draw.geom;
exports org.apache.poi.xslf.usermodel;
exports org.apache.poi.xslf.model;
exports org.apache.poi.xslf.util;
Modified: poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java (original)
+++ poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java Sun Oct 3 21:05:19 2021
@@ -35,6 +35,7 @@ import java.util.zip.ZipFile;
import org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry;
import org.apache.commons.compress.archivers.sevenz.SevenZFile;
+import org.apache.commons.io.FilenameUtils;
import org.apache.poi.POIDataSamples;
import org.apache.poi.poifs.filesystem.FileMagic;
import org.apache.poi.xslf.util.PPTX2PNG;
@@ -126,7 +127,6 @@ class TestPPTX2PNG {
"-format", format, // png,gif,jpg,svg,pdf or null for test
"-slide", "-1", // -1 for all
"-outdir", tmpDir.getCanonicalPath(),
- "-outpat", "${basename}-${slideno}-${ext}.${format}",
// "-dump", new File("build/tmp/", pptFile+".json").getCanonicalPath(),
"-dump", "null",
"-quiet",
@@ -157,17 +157,26 @@ class TestPPTX2PNG {
args.add("GBK");
}
+ final String basename = FilenameUtils.getBaseName(fileName);
+ final String ext = FilenameUtils.getExtension(fileName);
+
if (fileObj instanceof ZipEntry) {
ZipEntry ze = (ZipEntry)fileObj;
ZipFile zf = (ZipFile)fileContainer;
System.setIn(zf.getInputStream(ze));
+ args.add("-outpat");
+ args.add(basename+"-${slideno}-"+ext+".${format}");
args.add("stdin");
} else if (fileObj instanceof SevenZArchiveEntry) {
SevenZArchiveEntry ze = (SevenZArchiveEntry)fileObj;
SevenZFile zf = (SevenZFile)fileContainer;
System.setIn(zf.getInputStream(ze));
+ args.add("-outpat");
+ args.add(basename+"-${slideno}-"+ext+".${format}");
args.add("stdin");
} else if (fileObj instanceof File) {
+ args.add("-outpat");
+ args.add("${basename}-${slideno}-${ext}.${format}");
args.add(((File)fileObj).getAbsolutePath());
}
Modified: poi/trunk/poi-ooxml/src/test/java9/module-info.class
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java9/module-info.class?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
Binary files - no diff available.
Modified: poi/trunk/poi-ooxml/src/test/java9/module-info.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java9/module-info.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/test/java9/module-info.java (original)
+++ poi/trunk/poi-ooxml/src/test/java9/module-info.java Sun Oct 3 21:05:19 2021
@@ -70,6 +70,7 @@ module org.apache.poi.ooxml {
exports org.apache.poi.xssf.streaming;
exports org.apache.poi.xssf.util;
exports org.apache.poi.xslf.draw;
+ exports org.apache.poi.xslf.draw.geom;
exports org.apache.poi.xslf.usermodel;
exports org.apache.poi.xslf.model;
exports org.apache.poi.xslf.util;
Modified: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/DrawSimpleShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/DrawSimpleShape.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/DrawSimpleShape.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/DrawSimpleShape.java Sun Oct 3 21:05:19 2021
@@ -37,6 +37,7 @@ import org.apache.poi.sl.draw.geom.Conte
import org.apache.poi.sl.draw.geom.CustomGeometry;
import org.apache.poi.sl.draw.geom.Outline;
import org.apache.poi.sl.draw.geom.Path;
+import org.apache.poi.sl.draw.geom.PathIf;
import org.apache.poi.sl.usermodel.LineDecoration;
import org.apache.poi.sl.usermodel.LineDecoration.DecorationShape;
import org.apache.poi.sl.usermodel.LineDecoration.DecorationSize;
@@ -85,7 +86,7 @@ public class DrawSimpleShape extends Dra
PaintModifier pm = null;
for (Outline o : elems) {
- Path path = o.getPath();
+ PathIf path = o.getPath();
if (path.isFilled()) {
PaintModifier pmOld = pm;
pm = path.getFill();
@@ -169,7 +170,7 @@ public class DrawSimpleShape extends Dra
for(Outline o : lst){
java.awt.Shape s = o.getOutline();
- Path p = o.getPath();
+ PathIf p = o.getPath();
graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, s);
if(p.isFilled()) {
@@ -197,10 +198,12 @@ public class DrawSimpleShape extends Dra
double lineWidth = Math.max(2.5, stroke.getLineWidth());
Rectangle2D anchor = getAnchor(graphics, getShape());
- double x2 = anchor.getX() + anchor.getWidth(),
- y2 = anchor.getY() + anchor.getHeight();
-
- double alpha = Math.atan(anchor.getHeight() / anchor.getWidth());
+ double x2 = 0, y2 = 0, alpha = 0;
+ if (anchor != null) {
+ x2 = anchor.getX() + anchor.getWidth();
+ y2 = anchor.getY() + anchor.getHeight();
+ alpha = Math.atan(anchor.getHeight() / anchor.getWidth());
+ }
AffineTransform at = new AffineTransform();
java.awt.Shape tailShape = null;
@@ -273,9 +276,12 @@ public class DrawSimpleShape extends Dra
double lineWidth = Math.max(2.5, stroke.getLineWidth());
Rectangle2D anchor = getAnchor(graphics, getShape());
- double x1 = anchor.getX(), y1 = anchor.getY();
-
- double alpha = Math.atan(anchor.getHeight() / anchor.getWidth());
+ double x1 = 0, y1 = 0, alpha = 0;
+ if (anchor != null) {
+ x1 = anchor.getX();
+ y1 = anchor.getY();
+ alpha = Math.atan(anchor.getHeight() / anchor.getWidth());
+ }
AffineTransform at = new AffineTransform();
java.awt.Shape headShape = null;
@@ -362,7 +368,7 @@ public class DrawSimpleShape extends Dra
for (Outline o : outlines) {
java.awt.Shape s = o.getOutline();
- Path p = o.getPath();
+ PathIf p = o.getPath();
graphics.setRenderingHint(Drawable.GRADIENT_SHAPE, s);
graphics.setPaint(shadowColor);
@@ -389,7 +395,7 @@ public class DrawSimpleShape extends Dra
if(anchor == null) {
return lst;
}
- for (Path p : geom) {
+ for (PathIf p : geom) {
double w = p.getW(), h = p.getH(), scaleX, scaleY;
if (w == -1) {
Modified: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPoint.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPoint.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPoint.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPoint.java Sun Oct 3 21:05:19 2021
@@ -39,66 +39,39 @@ import java.util.Objects;
*/
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "CT_AdjPoint2D")
-public class AdjustPoint {
+public class AdjustPoint implements AdjustPointIf {
// @XmlAttribute(name = "x", required = true)
private String x;
// @XmlAttribute(name = "y", required = true)
private String y;
-
- /**
- * Gets the value of the x property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
+ @Override
public String getX() {
return x;
}
- /**
- * Sets the value of the x property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
+ @Override
public void setX(String value) {
this.x = value;
}
+ @Override
public boolean isSetX() {
return (this.x!= null);
}
- /**
- * Gets the value of the y property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
+ @Override
public String getY() {
return y;
}
- /**
- * Sets the value of the y property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
+ @Override
public void setY(String value) {
this.y = value;
}
+ @Override
public boolean isSetY() {
return (this.y!= null);
}
Added: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPointIf.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPointIf.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPointIf.java (added)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPointIf.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,44 @@
+/* ====================================================================
+ 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.sl.draw.geom;
+
+public interface AdjustPointIf {
+ /**
+ * Gets the value of the x property.
+ */
+ String getX();
+
+ /**
+ * Sets the value of the x property.
+ */
+ void setX(String value);
+
+ boolean isSetX();
+
+ /**
+ * Gets the value of the y property.
+ */
+ String getY();
+
+ /**
+ * Sets the value of the y property.
+ */
+ void setY(String value);
+
+ boolean isSetY();
+}
Propchange: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustPointIf.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValue.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValue.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValue.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValue.java Sun Oct 3 21:05:19 2021
@@ -22,12 +22,6 @@ package org.apache.poi.sl.draw.geom;
/**
* Represents a shape adjust values (see section 20.1.9.5 in the spec)
*/
-public class AdjustValue extends Guide {
+public class AdjustValue extends Guide implements AdjustValueIf {
- @Override
- public double evaluate(Context ctx){
- String name = getName();
- Guide adj = ctx.getAdjustValue(name);
- return (adj != null) ? adj.evaluate(ctx) : super.evaluate(ctx);
- }
}
Added: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValueIf.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValueIf.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValueIf.java (added)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValueIf.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,32 @@
+/* ====================================================================
+ 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.sl.draw.geom;
+
+public interface AdjustValueIf extends GuideIf {
+ @Override
+ default double evaluate(Context ctx) {
+ return evaluateAdjustValue(ctx);
+ }
+
+ default double evaluateAdjustValue(Context ctx){
+ String name = getName();
+ GuideIf adj = ctx.getAdjustValue(name);
+ return (adj != null) ? adj.evaluate(ctx) : evaluateGuide(ctx);
+ }
+
+}
Propchange: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/AdjustValueIf.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommand.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommand.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommand.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommand.java Sun Oct 3 21:05:19 2021
@@ -19,11 +19,6 @@
package org.apache.poi.sl.draw.geom;
-import static org.apache.poi.sl.draw.geom.Formula.OOXML_DEGREE;
-
-import java.awt.geom.Arc2D;
-import java.awt.geom.Path2D;
-import java.awt.geom.Point2D;
import java.util.Objects;
import org.apache.poi.util.Internal;
@@ -57,7 +52,7 @@ import org.apache.poi.util.Internal;
*/
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "CT_Path2DArcTo")
-public class ArcToCommand implements PathCommand {
+public class ArcToCommand implements ArcToCommandIf {
// @XmlAttribute(name = "wR", required = true)
private String wr;
@@ -68,51 +63,51 @@ public class ArcToCommand implements Pat
// @XmlAttribute(name = "swAng", required = true)
private String swAng;
+ @Override
public void setHR(String hr) {
this.hr = hr;
}
+ @Override
+ public String getHR() {
+ return hr;
+ }
+
+ @Override
+ public String getStAng() {
+ return stAng;
+ }
+
+ @Override
+ public String getWR() {
+ return wr;
+ }
+
+ @Override
public void setWR(String wr) {
this.wr = wr;
}
+ @Override
public void setStAng(String stAng) {
this.stAng = stAng;
}
- public void setSwAng(String swAng) {
- this.swAng = swAng;
+ @Override
+ public String getSwAng() {
+ return swAng;
}
@Override
- public void execute(Path2D.Double path, Context ctx){
- double rx = ctx.getValue(wr);
- double ry = ctx.getValue(hr);
- double ooStart = ctx.getValue(stAng) / OOXML_DEGREE;
- double ooExtent = ctx.getValue(swAng) / OOXML_DEGREE;
-
- // skew the angles for AWT output
- double awtStart = convertOoxml2AwtAngle(ooStart, rx, ry);
- double awtSweep = convertOoxml2AwtAngle(ooStart+ooExtent, rx, ry)-awtStart;
-
- // calculate the inverse angle - taken from the (reversed) preset definition
- double radStart = Math.toRadians(ooStart);
- double invStart = Math.atan2(rx * Math.sin(radStart), ry * Math.cos(radStart));
-
- Point2D pt = path.getCurrentPoint();
- // calculate top/left corner
- double x0 = pt.getX() - rx * Math.cos(invStart) - rx;
- double y0 = pt.getY() - ry * Math.sin(invStart) - ry;
-
- Arc2D arc = new Arc2D.Double(x0, y0, 2 * rx, 2 * ry, awtStart, awtSweep, Arc2D.OPEN);
- path.append(arc, true);
+ public void setSwAng(String swAng) {
+ this.swAng = swAng;
}
/**
* Arc2D angles are skewed, OOXML aren't ... so we need to unskew them<p>
*
- * Furthermore ooxml angle starts at the X-axis and increases clock-wise,
- * where as Arc2D api states
+ * Furthermore, ooxml angle starts at the X-axis and increases clock-wise,
+ * whereas Arc2D api states
* "45 degrees always falls on the line from the center of the ellipse to
* the upper right corner of the framing rectangle"
* so we need to reverse it
Added: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommandIf.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommandIf.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommandIf.java (added)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommandIf.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,72 @@
+/*
+ * ====================================================================
+ * 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.sl.draw.geom;
+
+import static org.apache.poi.sl.draw.geom.Formula.OOXML_DEGREE;
+
+import java.awt.geom.Arc2D;
+import java.awt.geom.Path2D;
+import java.awt.geom.Point2D;
+
+public interface ArcToCommandIf extends PathCommand {
+
+ void setHR(String hr);
+
+ void setWR(String wr);
+
+ void setStAng(String stAng);
+
+ void setSwAng(String swAng);
+
+ String getHR();
+
+ String getWR();
+
+ String getStAng();
+
+ String getSwAng();
+
+
+ @Override
+ default void execute(Path2D.Double path, Context ctx){
+ double rx = ctx.getValue(getWR());
+ double ry = ctx.getValue(getHR());
+ double ooStart = ctx.getValue(getStAng()) / OOXML_DEGREE;
+ double ooExtent = ctx.getValue(getSwAng()) / OOXML_DEGREE;
+
+ // skew the angles for AWT output
+ double awtStart = ArcToCommand.convertOoxml2AwtAngle(ooStart, rx, ry);
+ double awtSweep = ArcToCommand.convertOoxml2AwtAngle(ooStart+ooExtent, rx, ry)-awtStart;
+
+ // calculate the inverse angle - taken from the (reversed) preset definition
+ double radStart = Math.toRadians(ooStart);
+ double invStart = Math.atan2(rx * Math.sin(radStart), ry * Math.cos(radStart));
+
+ Point2D pt = path.getCurrentPoint();
+ // calculate top/left corner
+ double x0 = pt.getX() - rx * Math.cos(invStart) - rx;
+ double y0 = pt.getY() - ry * Math.sin(invStart) - ry;
+
+ Arc2D arc = new Arc2D.Double(x0, y0, 2 * rx, 2 * ry, awtStart, awtSweep, Arc2D.OPEN);
+ path.append(arc, true);
+ }
+
+
+}
Propchange: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ArcToCommandIf.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommand.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommand.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommand.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommand.java Sun Oct 3 21:05:19 2021
@@ -39,7 +39,7 @@ import java.awt.geom.Path2D;
*/
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "CT_Path2DClose")
-public class ClosePathCommand implements PathCommand {
+public class ClosePathCommand implements ClosePathCommandIf {
@Override
public void execute(Path2D.Double path, Context ctx){
Added: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommandIf.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommandIf.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommandIf.java (added)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommandIf.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,23 @@
+/*
+ * ====================================================================
+ * 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.sl.draw.geom;
+
+public interface ClosePathCommandIf extends PathCommand {
+}
Propchange: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ClosePathCommandIf.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSite.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSite.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSite.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSite.java Sun Oct 3 21:05:19 2021
@@ -41,64 +41,37 @@ import java.util.Objects;
*/
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "CT_ConnectionSite", propOrder = {"pos"})
-public final class ConnectionSite {
+public final class ConnectionSite implements ConnectionSiteIf {
// @XmlElement(required = true)
private final AdjustPoint pos = new AdjustPoint();
// @XmlAttribute(name = "ang", required = true)
private String ang;
- /**
- * Gets the value of the pos property.
- *
- * @return
- * possible object is
- * {@link AdjustPoint }
- *
- */
+ @Override
public AdjustPoint getPos() {
return pos;
}
- /**
- * Sets the value of the pos property.
- *
- * @param pos
- * allowed object is
- * {@link AdjustPoint }
- *
- */
- public void setPos(AdjustPoint pos) {
+ @Override
+ public void setPos(AdjustPointIf pos) {
if (pos != null) {
this.pos.setX(pos.getX());
this.pos.setY(pos.getY());
}
}
- /**
- * Gets the value of the ang property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
+ @Override
public String getAng() {
return ang;
}
- /**
- * Sets the value of the ang property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
+ @Override
public void setAng(String value) {
this.ang = value;
}
+ @Override
public boolean isSetAng() {
return (this.ang!= null);
}
Added: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSiteIf.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSiteIf.java?rev=1893859&view=auto
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSiteIf.java (added)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSiteIf.java Sun Oct 3 21:05:19 2021
@@ -0,0 +1,44 @@
+/* ====================================================================
+ 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.sl.draw.geom;
+
+public interface ConnectionSiteIf {
+
+ /**
+ * Gets the value of the pos property.
+ */
+ AdjustPointIf getPos();
+
+ /**
+ * Sets the value of the pos property.
+ */
+ void setPos(AdjustPointIf pos);
+
+ /**
+ * Gets the value of the ang property.
+ */
+ String getAng();
+
+ /**
+ * Sets the value of the ang property.
+ */
+ void setAng(String value);
+
+ boolean isSetAng();
+
+}
Propchange: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/ConnectionSiteIf.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/Context.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/Context.java?rev=1893859&r1=1893858&r2=1893859&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/Context.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/sl/draw/geom/Context.java Sun Oct 3 21:05:19 2021
@@ -34,14 +34,14 @@ public class Context {
private final Map<String, Double> _ctx = new HashMap<>();
private final IAdjustableShape _props;
private final Rectangle2D _anchor;
-
+
public Context(CustomGeometry geom, Rectangle2D anchor, IAdjustableShape props){
_props = props;
_anchor = anchor;
- for(Guide gd : geom.adjusts) {
+ for(GuideIf gd : geom.adjusts) {
evaluate(gd);
}
- for(Guide gd : geom.guides) {
+ for(GuideIf gd : geom.guides) {
evaluate(gd);
}
}
@@ -50,7 +50,7 @@ public class Context {
return _anchor;
}
- Guide getAdjustValue(String name){
+ GuideIf getAdjustValue(String name){
return _props.getAdjustValue(name);
}
@@ -65,8 +65,8 @@ public class Context {
public double evaluate(Formula fmla){
double result = fmla.evaluate(this);
- if (fmla instanceof Guide) {
- String key = ((Guide)fmla).getName();
+ if (fmla instanceof GuideIf) {
+ String key = ((GuideIf)fmla).getName();
if (key != null) {
_ctx.put(key, result);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org