Author: kiwiwings
Date: Fri Sep 7 21:26:56 2018
New Revision: 1840324
URL: http://svn.apache.org/viewvc?rev=1840324&view=rev
Log:
merge trunk
Modified:
poi/branches/hemf/ (props changed)
poi/branches/hemf/build.gradle
poi/branches/hemf/build.xml
poi/branches/hemf/doap_POI.rdf
poi/branches/hemf/jenkins/create_jobs.groovy
poi/branches/hemf/osgi/build.xml
poi/branches/hemf/sonar/examples/pom.xml
poi/branches/hemf/sonar/excelant/pom.xml
poi/branches/hemf/sonar/main/pom.xml
poi/branches/hemf/sonar/ooxml-schema-encryption/pom.xml
poi/branches/hemf/sonar/ooxml-schema-security/pom.xml
poi/branches/hemf/sonar/ooxml-schema/pom.xml
poi/branches/hemf/sonar/ooxml/pom.xml
poi/branches/hemf/sonar/pom.xml
poi/branches/hemf/sonar/scratchpad/pom.xml
poi/branches/hemf/src/examples/groovy/build.gradle
poi/branches/hemf/src/examples/scala/build.sbt
poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java
poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java
poi/branches/hemf/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
Propchange: poi/branches/hemf/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep 7 21:26:56 2018
@@ -5,4 +5,4 @@
/poi/branches/ss_border_property_template:1747847-1748074
/poi/branches/xml_signature:1617139-1628347
/poi/branches/xssf_structured_references:1747607-1747656
-/poi/trunk:693591-694881,695264-695420,695621,695649-711764
+/poi/trunk:693591-694881,695264-695420,695621,695649-711764,1839877-1840323
Modified: poi/branches/hemf/build.gradle
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/build.gradle?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/build.gradle (original)
+++ poi/branches/hemf/build.gradle Fri Sep 7 21:26:56 2018
@@ -91,9 +91,9 @@ subprojects {
// See https://github.com/melix/japicmp-gradle-plugin
apply plugin: 'me.champeau.gradle.japicmp'
- version = '4.0.0-SNAPSHOT'
+ version = '4.0.1-SNAPSHOT'
ext {
- japicmpversion = '3.17'
+ japicmpversion = '4.0.0'
}
tasks.withType(JavaCompile) {
Modified: poi/branches/hemf/build.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/build.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/build.xml (original)
+++ poi/branches/hemf/build.xml Fri Sep 7 21:26:56 2018
@@ -42,7 +42,7 @@ under the License.
<description>The Apache POI project Ant build.</description>
- <property name="version.id" value="4.0.1-beta1"/>
+ <property name="version.id" value="4.0.1-SNAPSHOT"/>
<property name="release.rc" value="RC1"/>
<property environment="env"/>
@@ -552,7 +552,6 @@ under the License.
<scriptdef name="release_tag" language="javascript">
var rel =
("REL_"+project.getProperty("version.id")).toUpperCase().replace(/\W/g,"_");
- if (rel.search(/BETA/) == -1) rel += "_FINAL";
project.setProperty("RELEASE_TAG", rel);
</scriptdef>
<release_tag/>
@@ -2545,7 +2544,6 @@ under the License.
<scriptdef name="getnextrel" language="javascript">
var relCurr = new String(project.getProperty("version.id"));
var relNext = relCurr.replace(/[0-9]+$/, function(lastNum){ return
new String(new Number(lastNum)+1); });
- if (relNext.search(/beta/i) == -1) relNext += "-beta1";
project.setProperty("rel_next", relNext);
</scriptdef>
<getnextrel/>
@@ -2591,7 +2589,7 @@ under the License.
message="tag r${svn_version2} as ${version.id}"/>
</svn>
- <!-- update build.xml to the next beta version -->
+ <!-- update build.xml to the next snapshot version -->
<antcall target="-update-build.xml">
<param name="version_id" value="${rel_next}"/>
</antcall>
@@ -2605,7 +2603,7 @@ under the License.
</fileset>
</replaceregexp>
- <!-- unpin documentation and commit next beta version -->
+ <!-- unpin documentation and commit next snapshot version -->
<svn refid="svn.settings">
<update dir="." recurse="true"/>
<propset path="src" name="svn:externals" value="documentation
https://svn.apache.org/repos/asf/poi/site/src/documentation"/>
@@ -2656,6 +2654,45 @@ under the License.
</svn>
</target>
+ <target name="release-finish" description="write the dist to the release
candidate repo - needs Java7+">
+ <!--svn refid="svn.settings">
+ <update dir="." recurse="true"/>
+ </svn-->
+ <local name="rel_prev"/>
+ <local name="file_date"/>
+ <local name="file_date_iso"/>
+
+ <tstamp>
+ <!-- usually overwritten by a command line argument -->
+ <!-- for convience this is kept in the same format as in the
release-prep call -->
+ <format property="file_date" pattern="yyyyMMdd" locale="US"/>
+ </tstamp>
+
+
+ <scriptdef name="getnextrel" language="javascript">
+ var relPrev = new String(project.getProperty("version.id"))
+ .replace(/([0-9]+)[^0-9]*$/, function(all,lastNum){ return new
String(new Number(lastNum)-1); });
+ project.setProperty("rel_prev", relPrev);
+ var fileDateIso = new String(project.getProperty("file_date"))
+ .replace(/([0-9]{4})([0-9]{2})([0-9]{2})/, "$1-$2-$3");
+ project.setProperty("file_date_iso", fileDateIso);
+ </scriptdef>
+ <getnextrel/>
+
+ <replaceregexp file="build.gradle" match="( +version += +)'[^']+'"
replace="\1'${version.id}'"/>
+ <replaceregexp file="build.gradle" match="(japicmpversion +=
+)'[^']+'" replace="\1'${rel_prev}'"/>
+ <replaceregexp file="src/examples/groovy/build.gradle" match="(
*compile 'org.apache.poi:[^0-9]+)([0-9.]+)'" replace="\1${rel_prev}'"
byline="true"/>
+ <replaceregexp file="src/examples/scala/build.sbt" match='(
*org.apache.poi.* ")[0-9.]+(.+)' replace="\1${rel_prev}\2" byline="true"/>
+ <replaceregexp file="osgi/build.xml" match='(name="version.id"
value=")[^"]+' replace="\1${version.id}"/>
+ <replaceregexp file="doap_POI.rdf" match="<release>"
replace="<release> <Version>
<name>Apache POI ${rel_prev}</name>
<created>${file_date_iso}</created>
<revision>${rel_prev}</revision> </Version>
</release> <release>"/>
+
+ <replaceregexp match="(<version>)[^<]+"
replace="\1${version.id}">
+ <fileset dir="sonar" includes="**/pom.xml"/>
+ </replaceregexp>
+ </target>
+
+
+
<target name="-update-build.xml">
<replaceregexp byline="true">
<regexp pattern="(<property name="version.id"
value=")[^"]+("/>)"/>
@@ -2758,21 +2795,15 @@ under the License.
<format property="rel_date" pattern="dd MMMM yyyy" locale="US"/>
<format property="file_date" pattern="yyyyMMdd" locale="US"/>
</tstamp>
- <!-- TODO: change reltype (dev/release), depending on BETA / FINAL -->
- <property name="reltype" value="dev"/>
- <property name="baseurl"
value="https://www.apache.org/dist/poi/${reltype}"/>
+ <property name="baseurl"
value="https://www.apache.org/dist/poi/release"/>
- <loadChecksum property="bin-tar-md5"
url="${baseurl}/bin/poi-bin-${version.id}-${file_date}.tar.gz.md5"/>
- <loadChecksum property="bin-tar-sha1"
url="${baseurl}/bin/poi-bin-${version.id}-${file_date}.tar.gz.sha1"/>
+ <loadChecksum property="bin-tar-sha256"
url="${baseurl}/bin/poi-bin-${version.id}-${file_date}.tar.gz.sha256"/>
<loadChecksum property="bin-tar-sha512"
url="${baseurl}/bin/poi-bin-${version.id}-${file_date}.tar.gz.sha512"/>
- <loadChecksum property="bin-zip-md5"
url="${baseurl}/bin/poi-bin-${version.id}-${file_date}.zip.md5"/>
- <loadChecksum property="bin-zip-sha1"
url="${baseurl}/bin/poi-bin-${version.id}-${file_date}.zip.sha1"/>
+ <loadChecksum property="bin-zip-sha256"
url="${baseurl}/bin/poi-bin-${version.id}-${file_date}.zip.sha256"/>
<loadChecksum property="bin-zip-sha512"
url="${baseurl}/bin/poi-bin-${version.id}-${file_date}.zip.sha512"/>
- <loadChecksum property="src-tar-md5"
url="${baseurl}/src/poi-src-${version.id}-${file_date}.tar.gz.md5"/>
- <loadChecksum property="src-tar-sha1"
url="${baseurl}/src/poi-src-${version.id}-${file_date}.tar.gz.sha1"/>
+ <loadChecksum property="src-tar-sha256"
url="${baseurl}/src/poi-src-${version.id}-${file_date}.tar.gz.sha256"/>
<loadChecksum property="src-tar-sha512"
url="${baseurl}/src/poi-src-${version.id}-${file_date}.tar.gz.sha512"/>
- <loadChecksum property="src-zip-md5"
url="${baseurl}/src/poi-src-${version.id}-${file_date}.zip.md5"/>
- <loadChecksum property="src-zip-sha1"
url="${baseurl}/src/poi-src-${version.id}-${file_date}.zip.sha1"/>
+ <loadChecksum property="src-zip-sha256"
url="${baseurl}/src/poi-src-${version.id}-${file_date}.zip.sha256"/>
<loadChecksum property="src-zip-sha512"
url="${baseurl}/src/poi-src-${version.id}-${file_date}.zip.sha512"/>
<loadFilesize property="bin-tar-size"
url="${baseurl}/bin/poi-bin-${version.id}-${file_date}.tar.gz"/>
@@ -2785,69 +2816,57 @@ under the License.
<p>The Apache POI team is pleased to announce the release of
${version.id}.
Featured are a handful of new areas of functionality and numerous bug
fixes.</p>
<p>A summary of changes is available in the
- <link
href="https://www.apache.org/dyn/closer.lua/poi/dev/RELEASE-NOTES-${version.id}.txt">Release
Notes</link>.
- A full list of changes is available in the <link
href="changes.html">change log</link>.
- People interested should also follow the <link
href="mailinglists.html">dev list</link>
+ <a
href="https://www.apache.org/dyn/closer.lua/poi/dev/RELEASE-NOTES-${version.id}.txt">Release
Notes</a>.
+ A full list of changes is available in the <a
href="site:changes">change log</a>.
+ People interested should also follow the <a
href="site:mailinglists">dev list</a>
to track progress.</p>
<p>
The POI source release as well as the pre-built binary deployment
packages are listed below.
- Pre-built versions of all <link href="overview.html#components">POI
components</link>
+ Pre-built versions of all <a href="site:components">POI components</a>
are available in the central Maven repository under Group ID
"org.apache.poi" and Version
"${version.id}".
</p>
<section id="POI-${version.id}-bin"><title>Binary Distribution</title>
<ul>
- <li><link
href="https://www.apache.org/dyn/closer.lua/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.tar.gz">poi-bin-${version.id}-${file_date}.tar.gz</link>
- (${bin-tar-size} MB, <link
href="https://www.apache.org/dist/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.tar.gz.asc">signature
(.asc)</link>)
- <br/>
- MD5 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.tar.gz.md5">
- ${bin-tar-md5}</link>
+ <li><a
href="https://www.apache.org/dyn/closer.lua/poi/release/bin/poi-bin-${version.id}-${file_date}.tar.gz">poi-bin-${version.id}-${file_date}.tar.gz</a>
+ (${bin-tar-size} MB, <a
href="https://www.apache.org/dist/poi/release/bin/poi-bin-${version.id}-${file_date}.tar.gz.asc">signature
(.asc)</a>)
<br/>
- SHA1 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.tar.gz.sha1">
- ${bin-tar-sha1}</link>
+ SHA256 checksum: <a
href="https://www.apache.org/dist/poi/release/bin/poi-bin-${version.id}-${file_date}.tar.gz.sha256">
+ ${bin-tar-sha256}</a>
<br/>
- SHA512 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.tar.gz.sha512">
- ${bin-tar-sha512}</link>
+ SHA512 checksum: <a
href="https://www.apache.org/dist/poi/release/bin/poi-bin-${version.id}-${file_date}.tar.gz.sha512">
+ ${bin-tar-sha512}</a>
</li>
- <li><link
href="https://www.apache.org/dyn/closer.lua/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.zip">poi-bin-${version.id}-${file_date}.zip</link>
- (${bin-zip-size} MB, <link
href="https://www.apache.org/dist/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.zip.asc">signature
(.asc)</link>)
- <br/>
- MD5 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.zip.md5">
- ${bin-zip-md5}</link>
+ <li><a
href="https://www.apache.org/dyn/closer.lua/poi/release/bin/poi-bin-${version.id}-${file_date}.zip">poi-bin-${version.id}-${file_date}.zip</a>
+ (${bin-zip-size} MB, <a
href="https://www.apache.org/dist/poi/release/bin/poi-bin-${version.id}-${file_date}.zip.asc">signature
(.asc)</a>)
<br/>
- SHA1 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.zip.sha1">
- ${bin-zip-sha1}</link>
+ SHA256 checksum: <a
href="https://www.apache.org/dist/poi/release/bin/poi-bin-${version.id}-${file_date}.zip.sha256">
+ ${bin-zip-sha256}</a>
<br/>
- SHA512 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.zip.sha512">
- ${bin-zip-sha512}</link>
+ SHA512 checksum: <a
href="https://www.apache.org/dist/poi/release/bin/poi-bin-${version.id}-${file_date}.zip.sha512">
+ ${bin-zip-sha512}</a>
</li>
</ul>
</section>
<section id="POI-${version.id}-src"><title>Source Distribution</title>
<ul>
- <li><link
href="https://www.apache.org/dyn/closer.lua/poi/${reltype}/src/poi-src-${version.id}-${file_date}.tar.gz">poi-src-${version.id}-${file_date}.tar.gz</link>
- (${src-tar-size} MB, <link
href="https://www.apache.org/dist/poi/${reltype}/src/poi-src-${version.id}-${file_date}.tar.gz.asc">signature
(.asc)</link>)
+ <li><a
href="https://www.apache.org/dyn/closer.lua/poi/release/src/poi-src-${version.id}-${file_date}.tar.gz">poi-src-${version.id}-${file_date}.tar.gz</a>
+ (${src-tar-size} MB, <a
href="https://www.apache.org/dist/poi/release/src/poi-src-${version.id}-${file_date}.tar.gz.asc">signature
(.asc)</a>)
<br/>
- MD5 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/src/poi-src-${version.id}-${file_date}.tar.gz.md5">
- ${src-tar-md5}</link>
+ SHA256 checksum: <a
href="https://www.apache.org/dist/poi/release/src/poi-src-${version.id}-${file_date}.tar.gz.sha256">
+ ${src-tar-sha256}</a>
<br/>
- SHA1 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/src/poi-src-${version.id}-${file_date}.tar.gz.sha1">
- ${src-tar-sha1}</link>
- <br/>
- SHA512 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/src/poi-src-${version.id}-${file_date}.tar.gz.sha512">
- ${src-tar-sha512}</link>
+ SHA512 checksum: <a
href="https://www.apache.org/dist/poi/release/src/poi-src-${version.id}-${file_date}.tar.gz.sha512">
+ ${src-tar-sha512}</a>
</li>
- <li><link
href="https://www.apache.org/dyn/closer.lua/poi/${reltype}/src/poi-src-${version.id}-${file_date}.zip">poi-src-${version.id}-${file_date}.zip</link>
- (${src-zip-size} MB, <link
href="https://www.apache.org/dist/poi/${reltype}/src/poi-src-${version.id}-${file_date}.zip.asc">signature
(.asc)</link>)
- <br/>
- MD5 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/src/poi-src-${version.id}-${file_date}.zip.md5">
- ${src-zip-md5}</link>
+ <li><a
href="https://www.apache.org/dyn/closer.lua/poi/release/src/poi-src-${version.id}-${file_date}.zip">poi-src-${version.id}-${file_date}.zip</a>
+ (${src-zip-size} MB, <a
href="https://www.apache.org/dist/poi/release/src/poi-src-${version.id}-${file_date}.zip.asc">signature
(.asc)</a>)
<br/>
- SHA1 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/src/poi-src-${version.id}-${file_date}.zip.sha1">
- ${src-zip-sha1}</link>
+ SHA256 checksum: <a
href="https://www.apache.org/dist/poi/release/src/poi-src-${version.id}-${file_date}.zip.sha256">
+ ${src-zip-sha256}</a>
<br/>
- SHA512 checksum: <link
href="https://www.apache.org/dist/poi/${reltype}/src/poi-src-${version.id}-${file_date}.zip.sha512">
- ${src-zip-sha512}</link>
+ SHA512 checksum: <a
href="https://www.apache.org/dist/poi/release/src/poi-src-${version.id}-${file_date}.zip.sha512">
+ ${src-zip-sha512}</a>
</li>
</ul>
</section>
Modified: poi/branches/hemf/doap_POI.rdf
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/doap_POI.rdf?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/doap_POI.rdf (original)
+++ poi/branches/hemf/doap_POI.rdf Fri Sep 7 21:26:56 2018
@@ -37,6 +37,13 @@
<category rdf:resource="https://projects.apache.org/category/library" />
<release>
<Version>
+ <name>Apache POI 4.0.0</name>
+ <created>2018-09-07</created>
+ <revision>4.0.0</revision>
+ </Version>
+ </release>
+ <release>
+ <Version>
<name>Apache POI 3.17</name>
<created>2017-09-15</created>
<revision>3.17</revision>
Modified: poi/branches/hemf/jenkins/create_jobs.groovy
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/jenkins/create_jobs.groovy?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/jenkins/create_jobs.groovy (original)
+++ poi/branches/hemf/jenkins/create_jobs.groovy Fri Sep 7 21:26:56 2018
@@ -11,7 +11,7 @@ H H * * 0
'''
def xercesUrl =
'http://repo1.maven.org/maven2/xerces/xercesImpl/2.6.1/xercesImpl-2.6.1.jar'
-def xercesLib = 'compile-lib/xercesImpl-2.6.1.jar'
+def xercesLib = './xercesImpl-2.6.1.jar'
def poijobs = [
[ name: 'POI-DSL-1.8', trigger: 'H */12 * * *'
@@ -88,7 +88,7 @@ def poijobs = [
disabled: true, skipcigame: true
],
[ name: 'POI-DSL-old-Xerces', trigger: triggerSundays,
- shell: "mkdir -p compile-lib && test -f ${xercesLib} || wget -O
${xercesLib} ${xercesUrl}\n",
+ shell: "test -f ${xercesLib} || wget -O ${xercesLib} ${xercesUrl}\n",
// the property triggers using Xerces as XML Parser and previously
showed some exception that can occur
properties: ["-Dadditionaljar=${xercesLib}"]
],
Modified: poi/branches/hemf/osgi/build.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/osgi/build.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/osgi/build.xml (original)
+++ poi/branches/hemf/osgi/build.xml Fri Sep 7 21:26:56 2018
@@ -26,7 +26,7 @@ under the License.
<!-- TODO Import these from the parent build file -->
<property name="repository.m2" value="http://repo1.maven.org"/>
- <property name="version.id" value="4.0.0-SNAPSHOT"/>
+ <property name="version.id" value="4.0.1-SNAPSHOT"/>
<property name="dist.dir" value="build/dist"/>
<!-- jars in the /lib directory, see the fetch-bundle-jars target-->
Modified: poi/branches/hemf/sonar/examples/pom.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/sonar/examples/pom.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/sonar/examples/pom.xml (original)
+++ poi/branches/hemf/sonar/examples/pom.xml Fri Sep 7 21:26:56 2018
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
- <version>4.0.1-beta1-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
</parent>
<artifactId>poi-examples</artifactId>
<packaging>jar</packaging>
Modified: poi/branches/hemf/sonar/excelant/pom.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/sonar/excelant/pom.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/sonar/excelant/pom.xml (original)
+++ poi/branches/hemf/sonar/excelant/pom.xml Fri Sep 7 21:26:56 2018
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
- <version>4.0.1-beta1-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
</parent>
<artifactId>poi-excelant</artifactId>
<packaging>jar</packaging>
Modified: poi/branches/hemf/sonar/main/pom.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/sonar/main/pom.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/sonar/main/pom.xml (original)
+++ poi/branches/hemf/sonar/main/pom.xml Fri Sep 7 21:26:56 2018
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
- <version>4.0.1-beta1-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
</parent>
<artifactId>poi-main</artifactId>
<packaging>jar</packaging>
Modified: poi/branches/hemf/sonar/ooxml-schema-encryption/pom.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/sonar/ooxml-schema-encryption/pom.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/sonar/ooxml-schema-encryption/pom.xml (original)
+++ poi/branches/hemf/sonar/ooxml-schema-encryption/pom.xml Fri Sep 7 21:26:56
2018
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
- <version>4.0.1-beta1-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>poi-ooxml-schema-encryption</artifactId>
Modified: poi/branches/hemf/sonar/ooxml-schema-security/pom.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/sonar/ooxml-schema-security/pom.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/sonar/ooxml-schema-security/pom.xml (original)
+++ poi/branches/hemf/sonar/ooxml-schema-security/pom.xml Fri Sep 7 21:26:56
2018
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
- <version>4.0.1-beta1-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>poi-ooxml-schema-security</artifactId>
Modified: poi/branches/hemf/sonar/ooxml-schema/pom.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/sonar/ooxml-schema/pom.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/sonar/ooxml-schema/pom.xml (original)
+++ poi/branches/hemf/sonar/ooxml-schema/pom.xml Fri Sep 7 21:26:56 2018
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
- <version>4.0.1-beta1-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>poi-ooxml-schema</artifactId>
Modified: poi/branches/hemf/sonar/ooxml/pom.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/sonar/ooxml/pom.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/sonar/ooxml/pom.xml (original)
+++ poi/branches/hemf/sonar/ooxml/pom.xml Fri Sep 7 21:26:56 2018
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
- <version>4.0.1-beta1-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
</parent>
<artifactId>poi-ooxml</artifactId>
<packaging>jar</packaging>
Modified: poi/branches/hemf/sonar/pom.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/sonar/pom.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/sonar/pom.xml (original)
+++ poi/branches/hemf/sonar/pom.xml Fri Sep 7 21:26:56 2018
@@ -4,7 +4,7 @@
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<packaging>pom</packaging>
- <version>4.0.1-beta1-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
<name>Apache POI - the Java API for Microsoft Documents</name>
<description>Maven build of Apache POI for Sonar checks</description>
<url>http://poi.apache.org/</url>
Modified: poi/branches/hemf/sonar/scratchpad/pom.xml
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/sonar/scratchpad/pom.xml?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/sonar/scratchpad/pom.xml (original)
+++ poi/branches/hemf/sonar/scratchpad/pom.xml Fri Sep 7 21:26:56 2018
@@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
- <version>4.0.1-beta1-SNAPSHOT</version>
+ <version>4.0.1-SNAPSHOT</version>
</parent>
<artifactId>poi-scratchpad</artifactId>
<packaging>jar</packaging>
Modified: poi/branches/hemf/src/examples/groovy/build.gradle
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/src/examples/groovy/build.gradle?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/src/examples/groovy/build.gradle (original)
+++ poi/branches/hemf/src/examples/groovy/build.gradle Fri Sep 7 21:26:56 2018
@@ -23,8 +23,8 @@ repositories {
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.4.13'
- compile 'org.apache.poi:poi:3.17'
- compile 'org.apache.poi:poi-ooxml:3.17'
+ compile 'org.apache.poi:poi:4.0.0'
+ compile 'org.apache.poi:poi-ooxml:4.0.0'
}
// Our files are in the current directory
Modified: poi/branches/hemf/src/examples/scala/build.sbt
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/src/examples/scala/build.sbt?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
--- poi/branches/hemf/src/examples/scala/build.sbt (original)
+++ poi/branches/hemf/src/examples/scala/build.sbt Fri Sep 7 21:26:56 2018
@@ -17,7 +17,7 @@
// Add the POI core and OOXML support dependencies into your build.sbt
libraryDependencies ++= Seq(
- "org.apache.poi" % "poi" % "3.17",
- "org.apache.poi" % "poi-ooxml" % "3.17",
- "org.apache.poi" % "poi-ooxml-schemas" "3.17",
+ "org.apache.poi" % "poi" % "4.0.0",
+ "org.apache.poi" % "poi-ooxml" % "4.0.0",
+ "org.apache.poi" % "poi-ooxml-schemas" "4.0.0",
)
Modified:
poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
---
poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java
(original)
+++
poi/branches/hemf/src/ooxml/java/org/apache/poi/ooxml/util/DocumentHelper.java
Fri Sep 7 21:26:56 2018
@@ -20,6 +20,7 @@ package org.apache.poi.ooxml.util;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
+import java.util.concurrent.TimeUnit;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
@@ -38,6 +39,7 @@ import org.xml.sax.SAXParseException;
public final class DocumentHelper {
private static POILogger logger =
POILogFactory.getLogger(DocumentHelper.class);
+ private static long lastLog;
private DocumentHelper() {}
@@ -102,19 +104,19 @@ public final class DocumentHelper {
//this doesn't appear to work, and we still need to limit
//entity expansions to 1 in trySetXercesSecurityManager
documentBuilderFactory.setExpandEntityReferences(false);
- trySetSAXFeature(documentBuilderFactory,
XMLConstants.FEATURE_SECURE_PROCESSING, true);
- trySetSAXFeature(documentBuilderFactory,
POIXMLConstants.FEATURE_LOAD_DTD_GRAMMAR, false);
- trySetSAXFeature(documentBuilderFactory,
POIXMLConstants.FEATURE_LOAD_EXTERNAL_DTD, false);
+ trySetFeature(documentBuilderFactory,
XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ trySetFeature(documentBuilderFactory,
POIXMLConstants.FEATURE_LOAD_DTD_GRAMMAR, false);
+ trySetFeature(documentBuilderFactory,
POIXMLConstants.FEATURE_LOAD_EXTERNAL_DTD, false);
trySetXercesSecurityManager(documentBuilderFactory);
}
- private static void trySetSAXFeature(DocumentBuilderFactory dbf, String
feature, boolean enabled) {
+ private static void trySetFeature(DocumentBuilderFactory dbf, String
feature, boolean enabled) {
try {
dbf.setFeature(feature, enabled);
} catch (Exception e) {
- logger.log(POILogger.WARN, "SAX Feature unsupported", feature, e);
+ logger.log(POILogger.WARN, "DocumentBuilderFactory Feature
unsupported", feature, e);
} catch (AbstractMethodError ame) {
- logger.log(POILogger.WARN, "Cannot set SAX feature because
outdated XML parser in classpath", feature, ame);
+ logger.log(POILogger.WARN, "Cannot set DocumentBuilderFactory
feature because outdated XML parser in classpath", feature, ame);
}
}
@@ -134,13 +136,23 @@ public final class DocumentHelper {
} catch (ClassNotFoundException e) {
// continue without log, this is expected in some setups
} catch (Throwable e) { // NOSONAR - also catch things like
NoClassDefError here
- logger.log(POILogger.WARN, "SAX Security Manager could not be
setup", e);
+ if(System.currentTimeMillis() > lastLog +
TimeUnit.MINUTES.toMillis(5)) {
+ logger.log(POILogger.WARN, "DocumentBuilderFactory
Security Manager could not be setup [log suppressed for 5 minutes]", e);
+ lastLog = System.currentTimeMillis();
+ }
}
}
// separate old version of Xerces not found => use the builtin way of
setting the property
// Note: when entity_expansion_limit==0, there is no limit!
- dbf.setAttribute(POIXMLConstants.PROPERTY_ENTITY_EXPANSION_LIMIT, 1);
+ try {
+ dbf.setAttribute(POIXMLConstants.PROPERTY_ENTITY_EXPANSION_LIMIT,
1);
+ } catch (Throwable e) {
+ if(System.currentTimeMillis() > lastLog +
TimeUnit.MINUTES.toMillis(5)) {
+ logger.log(POILogger.WARN, "DocumentBuilderFactory Entity
Expansion Limit could not be setup [log suppressed for 5 minutes]", e);
+ lastLog = System.currentTimeMillis();
+ }
+ }
}
/**
Modified:
poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
---
poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java
(original)
+++
poi/branches/hemf/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java
Fri Sep 7 21:26:56 2018
@@ -101,40 +101,44 @@ public final class XSSFDrawing extends P
/**
* Construct a SpreadsheetML drawing from a package part
*
- * @param part the package part holding the drawing data,
- * the content type must be
<code>application/vnd.openxmlformats-officedocument.drawing+xml</code>
+ * @param part
+ * the package part holding the drawing data, the content type
+ * must be
+ *
<code>application/vnd.openxmlformats-officedocument.drawing+xml</code>
*
* @since POI 3.14-Beta1
*/
public XSSFDrawing(PackagePart part) throws IOException, XmlException {
super(part);
- XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
- //Removing root element
+ XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
+ // Removing root element
options.setLoadReplaceDocumentElement(null);
InputStream is = part.getInputStream();
try {
- drawing = CTDrawing.Factory.parse(is,options);
+ drawing = CTDrawing.Factory.parse(is, options);
} finally {
is.close();
}
}
/**
- * Construct a new CTDrawing bean. By default, it's just an empty
placeholder for drawing objects
+ * Construct a new CTDrawing bean. By default, it's just an empty
+ * placeholder for drawing objects
*
* @return a new CTDrawing bean
*/
- private static CTDrawing newDrawing(){
+ private static CTDrawing newDrawing() {
return CTDrawing.Factory.newInstance();
}
/**
- * Return the underlying CTDrawing bean, the root element of the
SpreadsheetML Drawing part.
+ * Return the underlying CTDrawing bean, the root element of the
+ * SpreadsheetML Drawing part.
*
* @return the underlying CTDrawing bean
*/
@Internal
- public CTDrawing getCTDrawing(){
+ public CTDrawing getCTDrawing() {
return drawing;
}
@@ -143,14 +147,13 @@ public final class XSSFDrawing extends P
XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
/*
- Saved drawings must have the following namespaces set:
- <xdr:wsDr
- xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
-
xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing">
- */
- xmlOptions.setSaveSyntheticDocumentElement(
- new QName(CTDrawing.type.getName().getNamespaceURI(), "wsDr",
"xdr")
- );
+ * Saved drawings must have the following namespaces set: <xdr:wsDr
+ * xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
+ * xmlns:xdr=
+ *
"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing">
+ */
+ xmlOptions
+ .setSaveSyntheticDocumentElement(new
QName(CTDrawing.type.getName().getNamespaceURI(), "wsDr", "xdr"));
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
@@ -158,20 +161,20 @@ public final class XSSFDrawing extends P
out.close();
}
- @Override
- public XSSFClientAnchor createAnchor(int dx1, int dy1, int dx2, int dy2,
- int col1, int row1, int col2, int row2) {
- return new XSSFClientAnchor(dx1, dy1, dx2, dy2, col1, row1,
col2, row2);
- }
+ @Override
+ public XSSFClientAnchor createAnchor(int dx1, int dy1, int dx2, int dy2,
int col1, int row1, int col2, int row2) {
+ return new XSSFClientAnchor(dx1, dy1, dx2, dy2, col1, row1, col2,
row2);
+ }
/**
* Constructs a textbox under the drawing.
*
- * @param anchor the client anchor describes how this group is attached
- * to the sheet.
- * @return the newly created textbox.
+ * @param anchor
+ * the client anchor describes how this group is attached to the
+ * sheet.
+ * @return the newly created textbox.
*/
- public XSSFTextBox createTextbox(XSSFClientAnchor anchor){
+ public XSSFTextBox createTextbox(XSSFClientAnchor anchor) {
long shapeId = newShapeId();
CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor);
CTShape ctShape = ctAnchor.addNewSp();
@@ -186,14 +189,18 @@ public final class XSSFDrawing extends P
/**
* Creates a picture.
*
- * @param anchor the client anchor describes how this picture is
attached to the sheet.
- * @param pictureIndex the index of the picture in the workbook collection
of pictures,
- * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} .
+ * @param anchor
+ * the client anchor describes how this picture is attached to
+ * the sheet.
+ * @param pictureIndex
+ * the index of the picture in the workbook collection of
+ * pictures,
+ * {@link
org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()}
+ * .
*
- * @return the newly created picture shape.
+ * @return the newly created picture shape.
*/
- public XSSFPicture createPicture(XSSFClientAnchor anchor, int pictureIndex)
- {
+ public XSSFPicture createPicture(XSSFClientAnchor anchor, int
pictureIndex) {
PackageRelationship rel = addPictureReference(pictureIndex);
long shapeId = newShapeId();
@@ -212,23 +219,24 @@ public final class XSSFDrawing extends P
}
@Override
- public XSSFPicture createPicture(ClientAnchor anchor, int pictureIndex){
- return createPicture((XSSFClientAnchor)anchor, pictureIndex);
+ public XSSFPicture createPicture(ClientAnchor anchor, int pictureIndex) {
+ return createPicture((XSSFClientAnchor) anchor, pictureIndex);
}
- /**
- * Creates a chart.
- * @param anchor the client anchor describes how this chart is attached
to
- * the sheet.
- * @return the newly created chart
- * @see
org.apache.poi.xssf.usermodel.XSSFDrawing#createChart(ClientAnchor)
- */
+ /**
+ * Creates a chart.
+ *
+ * @param anchor
+ * the client anchor describes how this chart is attached to the
+ * sheet.
+ * @return the newly created chart
+ * @see org.apache.poi.xssf.usermodel.XSSFDrawing#createChart(ClientAnchor)
+ */
public XSSFChart createChart(XSSFClientAnchor anchor) {
- int chartNumber = getPackagePart().getPackage().
- getPartsByContentType(XSSFRelation.CHART.getContentType()).size()
+ 1;
+ int chartNumber =
getPackagePart().getPackage().getPartsByContentType(XSSFRelation.CHART.getContentType())
+ .size() + 1;
- RelationPart rp = createRelationship(
- XSSFRelation.CHART, XSSFFactory.getInstance(), chartNumber, false);
+ RelationPart rp = createRelationship(XSSFRelation.CHART,
XSSFFactory.getInstance(), chartNumber, false);
XSSFChart chart = rp.getDocumentPart();
String chartRelId = rp.getRelationship().getId();
@@ -239,25 +247,52 @@ public final class XSSFDrawing extends P
return chart;
}
- /**
- * Creates a chart.
- * @param anchor the client anchor describes how this chart is attached
to
- * the sheet.
- * @return the newly created chart
- */
+ /**
+ * Creates a chart.
+ *
+ * @param anchor
+ * the client anchor describes how this chart is attached to the
+ * sheet.
+ * @return the newly created chart
+ */
public XSSFChart createChart(ClientAnchor anchor) {
- return createChart((XSSFClientAnchor)anchor);
- }
+ return createChart((XSSFClientAnchor) anchor);
+ }
+
+ /**
+ * Imports the chart from the <code>srcChart</code> into this drawing.
+ *
+ * @param srcChart
+ * the source chart to be cloned into this drawing.
+ * @return the newly created chart.
+ * @throws XmlException
+ * @throws IOException
+ * @since 4.0.0
+ */
+ public XSSFChart importChart(XSSFChart srcChart) throws IOException,
XmlException {
+ CTTwoCellAnchor anchor = ((XSSFDrawing)
srcChart.getParent()).getCTDrawing().getTwoCellAnchorArray(0);
+ CTMarker from = (CTMarker) anchor.getFrom().copy();
+ CTMarker to = (CTMarker) anchor.getTo().copy();
+ XSSFClientAnchor destAnchor = new XSSFClientAnchor(from, to);
+ destAnchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);
+ XSSFChart destChart = createChart(destAnchor);
+ destChart.getCTChartSpace().set(srcChart.getCTChartSpace().copy());
+ destChart.getCTChart().set(srcChart.getCTChart().copy());
+ return destChart;
+ }
/**
* Add the indexed picture to this drawing relations
*
- * @param pictureIndex the index of the picture in the workbook collection
of pictures,
- * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} .
+ * @param pictureIndex
+ * the index of the picture in the workbook collection of
+ * pictures,
+ * {@link
org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()}
+ * .
*/
@SuppressWarnings("resource")
- protected PackageRelationship addPictureReference(int pictureIndex){
- XSSFWorkbook wb = (XSSFWorkbook)getParent().getParent();
+ protected PackageRelationship addPictureReference(int pictureIndex) {
+ XSSFWorkbook wb = (XSSFWorkbook) getParent().getParent();
XSSFPictureData data = wb.getAllPictures().get(pictureIndex);
XSSFPictureData pic = new XSSFPictureData(data.getPackagePart());
RelationPart rp = addRelation(null, XSSFRelation.IMAGES, pic);
@@ -265,15 +300,15 @@ public final class XSSFDrawing extends P
}
/**
- * Creates a simple shape. This includes such shapes as lines, rectangles,
+ * Creates a simple shape. This includes such shapes as lines, rectangles,
* and ovals.
*
- * @param anchor the client anchor describes how this group is attached
- * to the sheet.
- * @return the newly created shape.
+ * @param anchor
+ * the client anchor describes how this group is attached to the
+ * sheet.
+ * @return the newly created shape.
*/
- public XSSFSimpleShape createSimpleShape(XSSFClientAnchor anchor)
- {
+ public XSSFSimpleShape createSimpleShape(XSSFClientAnchor anchor) {
long shapeId = newShapeId();
CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor);
CTShape ctShape = ctAnchor.addNewSp();
@@ -286,15 +321,15 @@ public final class XSSFDrawing extends P
}
/**
- * Creates a simple shape. This includes such shapes as lines, rectangles,
+ * Creates a simple shape. This includes such shapes as lines, rectangles,
* and ovals.
*
- * @param anchor the client anchor describes how this group is attached
- * to the sheet.
- * @return the newly created shape.
+ * @param anchor
+ * the client anchor describes how this group is attached to the
+ * sheet.
+ * @return the newly created shape.
*/
- public XSSFConnector createConnector(XSSFClientAnchor anchor)
- {
+ public XSSFConnector createConnector(XSSFClientAnchor anchor) {
CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor);
CTConnector ctShape = ctAnchor.addNewCxnSp();
ctShape.set(XSSFConnector.prototype());
@@ -305,20 +340,20 @@ public final class XSSFDrawing extends P
}
/**
- * Creates a simple shape. This includes such shapes as lines, rectangles,
+ * Creates a simple shape. This includes such shapes as lines, rectangles,
* and ovals.
*
- * @param anchor the client anchor describes how this group is attached
- * to the sheet.
- * @return the newly created shape.
+ * @param anchor
+ * the client anchor describes how this group is attached to the
+ * sheet.
+ * @return the newly created shape.
*/
- public XSSFShapeGroup createGroup(XSSFClientAnchor anchor)
- {
+ public XSSFShapeGroup createGroup(XSSFClientAnchor anchor) {
CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor);
CTGroupShape ctGroup = ctAnchor.addNewGrpSp();
ctGroup.set(XSSFShapeGroup.prototype());
CTTransform2D xfrm = createXfrm(anchor);
- CTGroupTransform2D grpXfrm =ctGroup.getGrpSpPr().getXfrm();
+ CTGroupTransform2D grpXfrm = ctGroup.getGrpSpPr().getXfrm();
grpXfrm.setOff(xfrm.getOff());
grpXfrm.setExt(xfrm.getExt());
grpXfrm.setChExt(xfrm.getExt());
@@ -328,38 +363,38 @@ public final class XSSFDrawing extends P
return shape;
}
- /**
- * Creates a comment.
- * @param anchor the client anchor describes how this comment is
attached
- * to the sheet.
- * @return the newly created comment.
- */
+ /**
+ * Creates a comment.
+ *
+ * @param anchor
+ * the client anchor describes how this comment is attached to
+ * the sheet.
+ * @return the newly created comment.
+ */
@Override
public XSSFComment createCellComment(ClientAnchor anchor) {
- XSSFClientAnchor ca = (XSSFClientAnchor)anchor;
+ XSSFClientAnchor ca = (XSSFClientAnchor) anchor;
XSSFSheet sheet = getSheet();
- //create comments and vmlDrawing parts if they don't exist
+ // create comments and vmlDrawing parts if they don't exist
CommentsTable comments = sheet.getCommentsTable(true);
XSSFVMLDrawing vml = sheet.getVMLDrawing(true);
com.microsoft.schemas.vml.CTShape vmlShape = vml.newCommentShape();
- if(ca.isSet()){
- // convert offsets from emus to pixels since we get a
DrawingML-anchor
+ if (ca.isSet()) {
+ // convert offsets from emus to pixels since we get a
+ // DrawingML-anchor
// but create a VML Drawing
- int dx1Pixels = ca.getDx1()/Units.EMU_PER_PIXEL;
- int dy1Pixels = ca.getDy1()/Units.EMU_PER_PIXEL;
- int dx2Pixels = ca.getDx2()/Units.EMU_PER_PIXEL;
- int dy2Pixels = ca.getDy2()/Units.EMU_PER_PIXEL;
- String position =
- ca.getCol1() + ", " + dx1Pixels + ", " +
- ca.getRow1() + ", " + dy1Pixels + ", " +
- ca.getCol2() + ", " + dx2Pixels + ", " +
- ca.getRow2() + ", " + dy2Pixels;
+ int dx1Pixels = ca.getDx1() / Units.EMU_PER_PIXEL;
+ int dy1Pixels = ca.getDy1() / Units.EMU_PER_PIXEL;
+ int dx2Pixels = ca.getDx2() / Units.EMU_PER_PIXEL;
+ int dy2Pixels = ca.getDy2() / Units.EMU_PER_PIXEL;
+ String position = ca.getCol1() + ", " + dx1Pixels + ", " +
ca.getRow1() + ", " + dy1Pixels + ", " + ca
+ .getCol2() + ", " + dx2Pixels + ", " + ca.getRow2() + ", " +
dy2Pixels;
vmlShape.getClientDataArray(0).setAnchorArray(0, position);
}
CellAddress ref = new CellAddress(ca.getRow1(), ca.getCol1());
- if(comments.findCellComment(ref) != null) {
+ if (comments.findCellComment(ref) != null) {
throw new IllegalArgumentException("Multiple cell comments in one
cell are not allowed, cell: " + ref);
}
@@ -369,9 +404,10 @@ public final class XSSFDrawing extends P
/**
* Creates a new graphic frame.
*
- * @param anchor the client anchor describes how this frame is attached
- * to the sheet
- * @return the newly created graphic frame
+ * @param anchor
+ * the client anchor describes how this frame is attached to the
+ * sheet
+ * @return the newly created graphic frame
*/
private XSSFGraphicFrame createGraphicFrame(XSSFClientAnchor anchor) {
CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor);
@@ -395,36 +431,40 @@ public final class XSSFDrawing extends P
/*
* The shape id of the ole object seems to be a legacy shape id.
*
- * see 5.3.2.1 legacyDrawing (Legacy Drawing Object):
- * Legacy Shape ID that is unique throughout the entire document.
- * Legacy shape IDs should be assigned based on which portion of the
document the
- * drawing resides on. The assignment of these ids is broken down into
clusters of
- * 1024 values. The first cluster is 1-1024, the second 1025-2048 and
so on.
+ * see 5.3.2.1 legacyDrawing (Legacy Drawing Object): Legacy Shape ID
+ * that is unique throughout the entire document. Legacy shape IDs
+ * should be assigned based on which portion of the document the
drawing
+ * resides on. The assignment of these ids is broken down into clusters
+ * of 1024 values. The first cluster is 1-1024, the second 1025-2048
and
+ * so on.
*
- * Ole shapes seem to start with 1025 on the first sheet ...
- * and not sure, if the ids need to be reindexed when sheets are
removed
- * or more than 1024 shapes are on a given sheet (see #51332 for a
similar issue)
+ * Ole shapes seem to start with 1025 on the first sheet ... and not
+ * sure, if the ids need to be reindexed when sheets are removed or
more
+ * than 1024 shapes are on a given sheet (see #51332 for a similar
+ * issue)
*/
XSSFSheet sheet = getSheet();
XSSFWorkbook wb = sheet.getWorkbook();
int sheetIndex = wb.getSheetIndex(sheet);
- long shapeId = (sheetIndex+1)*1024 + newShapeId();
+ long shapeId = (sheetIndex + 1) * 1024 + newShapeId();
// add reference to OLE part
PackagePartName olePN;
try {
- olePN = PackagingURIHelper.createPartName(
"/xl/embeddings/oleObject"+storageId+".bin" );
+ olePN =
PackagingURIHelper.createPartName("/xl/embeddings/oleObject" + storageId +
".bin");
} catch (InvalidFormatException e) {
throw new POIXMLException(e);
}
- PackageRelationship olePR = sheetPart.addRelationship( olePN,
TargetMode.INTERNAL, POIXMLDocument.OLE_OBJECT_REL_TYPE );
+ PackageRelationship olePR = sheetPart.addRelationship(olePN,
TargetMode.INTERNAL,
+ POIXMLDocument.OLE_OBJECT_REL_TYPE);
// add reference to image part
XSSFPictureData imgPD =
sh.getWorkbook().getAllPictures().get(pictureIndex);
PackagePartName imgPN = imgPD.getPackagePart().getPartName();
- PackageRelationship imgSheetPR = sheetPart.addRelationship( imgPN,
TargetMode.INTERNAL, PackageRelationshipTypes.IMAGE_PART );
- PackageRelationship imgDrawPR = getPackagePart().addRelationship(
imgPN, TargetMode.INTERNAL, PackageRelationshipTypes.IMAGE_PART );
-
+ PackageRelationship imgSheetPR = sheetPart.addRelationship(imgPN,
TargetMode.INTERNAL,
+ PackageRelationshipTypes.IMAGE_PART);
+ PackageRelationship imgDrawPR =
getPackagePart().addRelationship(imgPN, TargetMode.INTERNAL,
+ PackageRelationshipTypes.IMAGE_PART);
// add OLE part metadata to sheet
CTWorksheet cwb = sh.getCTWorksheet();
@@ -443,7 +483,7 @@ public final class XSSFDrawing extends P
cur1.beginElement("anchor", XSSFRelation.NS_SPREADSHEETML);
cur1.insertAttributeWithValue("moveWithCells", "1");
- CTTwoCellAnchor ctAnchor =
createTwoCellAnchor((XSSFClientAnchor)anchor);
+ CTTwoCellAnchor ctAnchor = createTwoCellAnchor((XSSFClientAnchor)
anchor);
XmlCursor cur2 = ctAnchor.newCursor();
cur2.copyXmlContents(cur1);
@@ -460,7 +500,7 @@ public final class XSSFDrawing extends P
// add a new shape and link OLE & image part
CTShape ctShape = ctAnchor.addNewSp();
ctShape.set(XSSFObjectData.prototype());
- ctShape.getSpPr().setXfrm(createXfrm((XSSFClientAnchor)anchor));
+ ctShape.getSpPr().setXfrm(createXfrm((XSSFClientAnchor) anchor));
// workaround for not having the vmlDrawing filled
CTBlipFillProperties blipFill = ctShape.getSpPr().addNewBlipFill();
@@ -469,35 +509,35 @@ public final class XSSFDrawing extends P
CTNonVisualDrawingProps cNvPr = ctShape.getNvSpPr().getCNvPr();
cNvPr.setId(shapeId);
- cNvPr.setName("Object "+shapeId);
+ cNvPr.setName("Object " + shapeId);
XmlCursor extCur = cNvPr.getExtLst().getExtArray(0).newCursor();
extCur.toFirstChild();
- extCur.setAttributeText(new QName("spid"), "_x0000_s"+shapeId);
+ extCur.setAttributeText(new QName("spid"), "_x0000_s" + shapeId);
extCur.dispose();
XSSFObjectData shape = new XSSFObjectData(this, ctShape);
- shape.anchor = (XSSFClientAnchor)anchor;
+ shape.anchor = (XSSFClientAnchor) anchor;
return shape;
}
-
/**
* Returns all charts in this drawing.
*/
public List<XSSFChart> getCharts() {
- List<XSSFChart> charts = new ArrayList<>();
- for(POIXMLDocumentPart part : getRelations()) {
- if(part instanceof XSSFChart) {
- charts.add((XSSFChart)part);
- }
- }
- return charts;
+ List<XSSFChart> charts = new ArrayList<>();
+ for (POIXMLDocumentPart part : getRelations()) {
+ if (part instanceof XSSFChart) {
+ charts.add((XSSFChart) part);
+ }
+ }
+ return charts;
}
/**
- * Create and initialize a CTTwoCellAnchor that anchors a shape against
top-left and bottom-right cells.
+ * Create and initialize a CTTwoCellAnchor that anchors a shape against
+ * top-left and bottom-right cells.
*
* @return a new CTTwoCellAnchor
*/
@@ -508,14 +548,21 @@ public final class XSSFDrawing extends P
ctAnchor.addNewClientData();
anchor.setTo(ctAnchor.getTo());
anchor.setFrom(ctAnchor.getFrom());
- STEditAs.Enum aditAs;
- switch(anchor.getAnchorType()) {
- case DONT_MOVE_AND_RESIZE: aditAs = STEditAs.ABSOLUTE; break;
- case MOVE_AND_RESIZE: aditAs = STEditAs.TWO_CELL; break;
- case MOVE_DONT_RESIZE: aditAs = STEditAs.ONE_CELL; break;
- default: aditAs = STEditAs.ONE_CELL;
+ STEditAs.Enum editAs;
+ switch (anchor.getAnchorType()) {
+ case DONT_MOVE_AND_RESIZE:
+ editAs = STEditAs.ABSOLUTE;
+ break;
+ case MOVE_AND_RESIZE:
+ editAs = STEditAs.TWO_CELL;
+ break;
+ case MOVE_DONT_RESIZE:
+ editAs = STEditAs.ONE_CELL;
+ break;
+ default:
+ editAs = STEditAs.ONE_CELL;
}
- ctAnchor.setEditAs(aditAs);
+ ctAnchor.setEditAs(editAs);
return ctAnchor;
}
@@ -526,15 +573,15 @@ public final class XSSFDrawing extends P
off.setY(anchor.getDy1());
XSSFSheet sheet = getSheet();
double widthPx = 0;
- for (int col=anchor.getCol1(); col<anchor.getCol2(); col++) {
+ for (int col = anchor.getCol1(); col < anchor.getCol2(); col++) {
widthPx += sheet.getColumnWidthInPixels(col);
}
double heightPx = 0;
- for (int row=anchor.getRow1(); row<anchor.getRow2(); row++) {
+ for (int row = anchor.getRow1(); row < anchor.getRow2(); row++) {
heightPx += ImageUtils.getRowHeightInPixels(sheet, row);
}
- long width = Units.pixelToEMU((int)widthPx);
- long height = Units.pixelToEMU((int)heightPx);
+ long width = Units.pixelToEMU((int) widthPx);
+ long height = Units.pixelToEMU((int) heightPx);
CTPositiveSize2D ext = xfrm.addNewExt();
ext.setCx(width - anchor.getDx1() + anchor.getDx2());
ext.setCy(height - anchor.getDy1() + anchor.getDy2());
@@ -543,17 +590,15 @@ public final class XSSFDrawing extends P
return xfrm;
}
- private long newShapeId(){
- return 1+
- drawing.sizeOfAbsoluteAnchorArray()+
- drawing.sizeOfOneCellAnchorArray()+
- drawing.sizeOfTwoCellAnchorArray();
+ private long newShapeId() {
+ return 1 + drawing.sizeOfAbsoluteAnchorArray() +
drawing.sizeOfOneCellAnchorArray() + drawing
+ .sizeOfTwoCellAnchorArray();
}
/**
* @return list of shapes in this drawing
*/
- public List<XSSFShape> getShapes(){
+ public List<XSSFShape> getShapes() {
List<XSSFShape> lst = new ArrayList<>();
XmlCursor cur = drawing.newCursor();
try {
@@ -569,7 +614,7 @@ public final class XSSFDrawing extends P
/**
* @return list of shapes in this shape group
*/
- public List<XSSFShape> getShapes(XSSFShapeGroup groupshape){
+ public List<XSSFShape> getShapes(XSSFShapeGroup groupshape) {
List<XSSFShape> lst = new ArrayList<>();
XmlCursor cur = groupshape.getCTGroupShape().newCursor();
try {
@@ -593,29 +638,28 @@ public final class XSSFDrawing extends P
// ignore anchor elements
continue;
} else if (obj instanceof CTPicture) {
- shape = new XSSFPicture(this, (CTPicture)obj) ;
- } else if(obj instanceof CTConnector) {
- shape = new XSSFConnector(this, (CTConnector)obj) ;
- } else if(obj instanceof CTShape) {
- shape = hasOleLink(obj)
- ? new XSSFObjectData(this, (CTShape)obj)
- : new XSSFSimpleShape(this, (CTShape)obj) ;
- } else if(obj instanceof CTGraphicalObjectFrame) {
- shape = new XSSFGraphicFrame(this,
(CTGraphicalObjectFrame)obj) ;
- } else if(obj instanceof CTGroupShape) {
- shape = new XSSFShapeGroup(this,
(CTGroupShape)obj) ;
- } else if(obj instanceof XmlAnyTypeImpl) {
- LOG.log(POILogger.WARN, "trying to parse
AlternateContent, "
- + "this unlinks the returned Shapes from
the underlying xml content, "
- + "so those shapes can't be used to modify
the drawing, "
- + "i.e. modifications will be ignored!");
+ shape = new XSSFPicture(this, (CTPicture) obj);
+ } else if (obj instanceof CTConnector) {
+ shape = new XSSFConnector(this, (CTConnector) obj);
+ } else if (obj instanceof CTShape) {
+ shape = hasOleLink(obj) ? new XSSFObjectData(this,
(CTShape) obj)
+ : new XSSFSimpleShape(this, (CTShape) obj);
+ } else if (obj instanceof CTGraphicalObjectFrame) {
+ shape = new XSSFGraphicFrame(this,
(CTGraphicalObjectFrame) obj);
+ } else if (obj instanceof CTGroupShape) {
+ shape = new XSSFShapeGroup(this, (CTGroupShape)
obj);
+ } else if (obj instanceof XmlAnyTypeImpl) {
+ LOG.log(POILogger.WARN,
+ "trying to parse AlternateContent, " + "this
unlinks the returned Shapes from the underlying xml content, " + "so those
shapes can't be used to modify the drawing, " + "i.e. modifications will be
ignored!");
- // XmlAnyTypeImpl is returned for AlternateContent
parts, which might contain a CTDrawing
+ // XmlAnyTypeImpl is returned for AlternateContent
+ // parts, which might contain a CTDrawing
cur.push();
cur.toFirstChild();
XmlCursor cur2 = null;
try {
- // need to parse AlternateContent again,
otherwise the child elements aren't typed,
+ // need to parse AlternateContent again,
+ // otherwise the child elements aren't typed,
// but also XmlAnyTypes
CTDrawing alterWS =
CTDrawing.Factory.parse(cur.newXMLStreamReader());
cur2 = alterWS.newCursor();
@@ -636,7 +680,7 @@ public final class XSSFDrawing extends P
continue;
}
- assert(shape != null);
+ assert (shape != null);
shape.anchor = getAnchorFromParent(obj);
lst.add(shape);
@@ -651,7 +695,7 @@ public final class XSSFDrawing extends P
private boolean hasOleLink(XmlObject shape) {
QName uriName = new QName(null, "uri");
- String xquery = "declare namespace a='"+XSSFRelation.NS_DRAWINGML+"'
.//a:extLst/a:ext";
+ String xquery = "declare namespace a='" + XSSFRelation.NS_DRAWINGML +
"' .//a:extLst/a:ext";
XmlCursor cur = shape.newCursor();
cur.selectPath(xquery);
try {
@@ -667,21 +711,21 @@ public final class XSSFDrawing extends P
return false;
}
- private XSSFAnchor getAnchorFromParent(XmlObject obj){
+ private XSSFAnchor getAnchorFromParent(XmlObject obj) {
XSSFAnchor anchor = null;
XmlObject parentXbean = null;
XmlCursor cursor = obj.newCursor();
- if(cursor.toParent()) {
+ if (cursor.toParent()) {
parentXbean = cursor.getObject();
}
cursor.dispose();
- if(parentXbean != null){
+ if (parentXbean != null) {
if (parentXbean instanceof CTTwoCellAnchor) {
- CTTwoCellAnchor ct = (CTTwoCellAnchor)parentXbean;
+ CTTwoCellAnchor ct = (CTTwoCellAnchor) parentXbean;
anchor = new XSSFClientAnchor(ct.getFrom(), ct.getTo());
} else if (parentXbean instanceof CTOneCellAnchor) {
- CTOneCellAnchor ct = (CTOneCellAnchor)parentXbean;
+ CTOneCellAnchor ct = (CTOneCellAnchor) parentXbean;
anchor = new XSSFClientAnchor(getSheet(), ct.getFrom(),
ct.getExt());
} else if (parentXbean instanceof CTAbsoluteAnchor) {
CTAbsoluteAnchor ct = (CTAbsoluteAnchor) parentXbean;
@@ -700,7 +744,7 @@ public final class XSSFDrawing extends P
* @return the sheet associated with the drawing
*/
public XSSFSheet getSheet() {
- return (XSSFSheet)getParent();
+ return (XSSFSheet) getParent();
}
}
Modified:
poi/branches/hemf/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
URL:
http://svn.apache.org/viewvc/poi/branches/hemf/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java?rev=1840324&r1=1840323&r2=1840324&view=diff
==============================================================================
---
poi/branches/hemf/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
(original)
+++
poi/branches/hemf/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
Fri Sep 7 21:26:56 2018
@@ -84,7 +84,6 @@ import org.openxmlformats.schemas.wordpr
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.StylesDocument;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
/**
* <p>High(ish) level class for working with .docx files.</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]