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/05/21 21:22:41 UTC
svn commit: r1890089 [4/6] - in /poi/trunk: ./ poi-examples/
poi-examples/src/main/java/org/apache/poi/examples/hpsf/
poi-examples/src/main/java/org/apache/poi/examples/xssf/eventusermodel/
poi-examples/src/main/java/org/apache/poi/examples/xssf/stream...
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/HeaderStories.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/HeaderStories.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/HeaderStories.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/HeaderStories.java Fri May 21 21:22:40 2021
@@ -34,7 +34,7 @@ import org.apache.poi.hwpf.model.Subdocu
* as offsets are not yet updated!
*/
public final class HeaderStories {
- private Range headerStories;
+ private final Range headerStories;
private PlexOfCps plcfHdd;
private boolean stripFields;
@@ -50,7 +50,7 @@ public final class HeaderStories {
if (fib.getSubdocumentTextStreamLength( SubdocumentType.HEADER ) == 0)
return;
-
+
if(fib.getPlcfHddSize() == 0) {
return;
}
@@ -58,7 +58,7 @@ public final class HeaderStories {
// Handle the PlcfHdd
/*
* Page 88:
- *
+ *
* "The plcfhdd, a table whose location and length within the file is
* stored in fib.fcPlcfhdd and fib.cbPlcfhdd, describes where the text
* of each header/footer begins. If there are n headers/footers stored
@@ -69,11 +69,11 @@ public final class HeaderStories {
* plcfhdd. Note: at the limit CP - 1, Word always places a chEop as a
* placeholder which is never displayed as part of the header/footer.
* This allows Word to change an existing header/footer to be empty.
- *
+ *
* If there are n header/footers, the n+2nd CP entry value is always 1
* greater than the n+1st CP entry value. A paragraph end (ASCII 13) is
* always stored at the file position marked by the n+1st CP value.
- *
+ *
* The transformation in a full saved file from a header/footer CP to an
* offset from the beginning of a file (fc) is
* fc=fib.fcMin+ccpText+ccpFtn+cp."
@@ -83,7 +83,7 @@ public final class HeaderStories {
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getFootnoteSeparator()
@@ -92,7 +92,7 @@ public final class HeaderStories {
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getFootnoteContSeparator()
@@ -101,7 +101,7 @@ public final class HeaderStories {
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getFootnoteContNote()
@@ -110,7 +110,7 @@ public final class HeaderStories {
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getEndnoteSeparator()
@@ -119,7 +119,7 @@ public final class HeaderStories {
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getEndnoteContSeparator()
@@ -128,7 +128,7 @@ public final class HeaderStories {
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getEndnoteContNote()
@@ -167,27 +167,27 @@ public final class HeaderStories {
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getEvenHeader() {
return getAt(6+0);
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getOddHeader() {
return getAt(6+1);
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getFirstHeader() {
return getAt(6+4);
}
-
+
public Range getEvenHeaderSubrange() {
return getSubrangeAt(6+0);
@@ -198,7 +198,7 @@ public final class HeaderStories {
public Range getFirstHeaderSubrange() {
return getSubrangeAt(6+4);
}
-
+
/**
* Returns the correct, defined header for the given
* one based page
@@ -226,7 +226,7 @@ public final class HeaderStories {
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getEvenFooter()
@@ -235,7 +235,7 @@ public final class HeaderStories {
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getOddFooter()
@@ -244,7 +244,7 @@ public final class HeaderStories {
}
/**
- * @deprecated 3.8 beta 4
+ * @deprecated 3.8 beta 4
*/
@Deprecated
public String getFirstFooter()
@@ -370,7 +370,7 @@ public final class HeaderStories {
/**
* Are fields currently being stripped from
- * the text that this {@link HeaderStories} returns?
+ * the text that this HeaderStories returns?
* Default is false, but can be changed
*/
public boolean areFieldsStripped() {
@@ -380,7 +380,6 @@ public final class HeaderStories {
* Should fields (eg macros) be stripped from
* the text that this class returns?
* Default is not to strip.
- * @param stripFields
*/
public void setAreFieldsStripped(boolean stripFields) {
this.stripFields = stripFields;
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/Picture.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/Picture.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/Picture.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/Picture.java Fri May 21 21:22:40 2021
@@ -30,15 +30,19 @@ import org.apache.logging.log4j.Logger;
import org.apache.poi.ddf.EscherBSERecord;
import org.apache.poi.ddf.EscherBlipRecord;
import org.apache.poi.ddf.EscherComplexProperty;
+import org.apache.poi.ddf.EscherContainerRecord;
import org.apache.poi.ddf.EscherOptRecord;
import org.apache.poi.ddf.EscherProperty;
import org.apache.poi.ddf.EscherPropertyTypes;
import org.apache.poi.ddf.EscherRecord;
+import org.apache.poi.ddf.EscherRecordTypes;
+import org.apache.poi.ddf.EscherSimpleProperty;
import org.apache.poi.hwpf.model.PICF;
import org.apache.poi.hwpf.model.PICFAndOfficeArtData;
import org.apache.poi.sl.image.ImageHeaderPNG;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.StringUtil;
+import org.apache.poi.util.Units;
/**
* Represents embedded picture extracted from Word Document
@@ -264,43 +268,43 @@ public final class Picture {
/**
* @return The amount the picture has been cropped on the left in twips
- * @deprecated POI 3.8 beta 4.
*/
- @Deprecated
- public int getDxaCropLeft()
- {
- // TODO: use new properties
- // if (_picfAndOfficeArtData == null || _picfAndOfficeArtData.getShape()
- // == null)
- // return 0;
- //
- // final EscherContainerRecord shape = _picfAndOfficeArtData.getShape();
- // EscherOptRecord optRecord = shape.getChildById( (short) 0xF00B );
- // if (optRecord == null)
- // return 0;
- //
- // EscherProperty property = optRecord.lookup( 0x0102 );
- // if (property == null || !(property instanceof EscherSimpleProperty))
- // return 0;
- //
- // EscherSimpleProperty simpleProperty = (EscherSimpleProperty)
- // property;
- // return simpleProperty.getPropertyValue();
-
+ public int getDxaCropLeft() {
return _picf.getDxaReserved1();
}
/**
+ * The location, expressed as a fraction of the image width, of the left side of
+ * the crop rectangle. A value of 0 specifies that the left side of the image is uncropped.
+ * Positive values specify cropping into the image. Negative values specify cropping out from the
+ * image. The default value for this property is 0.
+ *
+ * @return the left crop percent
+ */
+ public double getCropLeft() {
+ return getCrop(EscherPropertyTypes.BLIP__CROPFROMLEFT);
+ }
+
+ /**
* @return The amount the picture has been cropped on the right in twips
- * @deprecated POI 3.8 beta 4.
*/
- @Deprecated
- public int getDxaCropRight()
- {
+ public int getDxaCropRight() {
return _picf.getDxaReserved2();
}
/**
+ * the location of the right side, expressed as a fraction of the image width, of
+ * the crop rectangle. A value of 0 specifies that the right side of the image is uncropped.
+ * Positive values specify cropping into the image. Negative values specify cropping out from the
+ * image. The default value for this property is 0.
+ *
+ * @return the right crop percent
+ */
+ public double getCropRight() {
+ return getCrop(EscherPropertyTypes.BLIP__CROPFROMRIGHT);
+ }
+
+ /**
* Gets the initial width of the picture, in twips, prior to cropping or
* scaling.
*
@@ -313,25 +317,58 @@ public final class Picture {
/**
* @return The amount the picture has been cropped on the bottom in twips
- * @deprecated POI 3.8 beta 5.
*/
- @Deprecated
- public int getDyaCropBottom()
- {
+ public int getDyaCropBottom() {
return _picf.getDyaReserved2();
}
/**
+ * the location, expressed as a fraction of the image height, of the bottom of
+ * the crop rectangle. A value of 0 specifies that the bottom of the image is uncropped.
+ * Positive values specify cropping into the image. Negative values specify cropping out from the
+ * image. The default value for this property is 0
+ *
+ * @return the bottom crop percent
+ */
+ public double getCropBottom() {
+ return getCrop(EscherPropertyTypes.BLIP__CROPFROMBOTTOM);
+ }
+
+ /**
* @return The amount the picture has been cropped on the top in twips
- * @deprecated POI 3.8 beta 5.
*/
- @Deprecated
- public int getDyaCropTop()
- {
+ public int getDyaCropTop() {
return _picf.getDyaReserved1();
}
/**
+ * the location, expressed as a fraction of the image height, of the top of the crop
+ * rectangle. A value of 0 specifies that the top of the image is uncropped. Positive values
+ * specify cropping into the image. Negative values specify cropping out from the image. The default
+ * value for this property is 0.
+ *
+ * @return the top crop percent
+ */
+ public double getCropTop() {
+ return getCrop(EscherPropertyTypes.BLIP__CROPFROMTOP);
+ }
+
+ private double getCrop(EscherPropertyTypes propType) {
+ EscherContainerRecord shape;
+ if (_picfAndOfficeArtData != null && (shape = _picfAndOfficeArtData.getShape()) != null) {
+ EscherOptRecord optRecord = shape.getChildById(EscherRecordTypes.OPT.typeID);
+ if (optRecord != null) {
+ EscherProperty property = optRecord.lookup(propType);
+ if (property instanceof EscherSimpleProperty) {
+ EscherSimpleProperty simpleProperty = (EscherSimpleProperty) property;
+ return Units.fixedPointToDouble(simpleProperty.getPropertyValue());
+ }
+ }
+ }
+ return 0;
+ }
+
+ /**
* Gets the initial height of the picture, in twips, prior to cropping or
* scaling.
*
@@ -490,62 +527,59 @@ public final class Picture {
+ ( fileExt.length() > 0 ? "." + fileExt : "" );
}
- public PictureType suggestPictureType()
- {
+ public PictureType suggestPictureType() {
if (_blipRecords.size() != 1 ) {
return PictureType.UNKNOWN;
}
EscherRecord escherRecord = _blipRecords.get( 0 );
- switch ( escherRecord.getRecordId() )
- {
- case (short) 0xF007:
- {
+ if (escherRecord instanceof EscherBSERecord) {
EscherBSERecord bseRecord = (EscherBSERecord) escherRecord;
- switch ( bseRecord.getBlipTypeWin32() )
- {
- case 0x00:
- return PictureType.UNKNOWN;
- case 0x01:
- return PictureType.UNKNOWN;
- case 0x02:
+ switch ( bseRecord.getBlipTypeWin32() ) {
+ case 0x00:
+ return PictureType.UNKNOWN;
+ case 0x01:
+ return PictureType.UNKNOWN;
+ case 0x02:
+ return PictureType.EMF;
+ case 0x03:
+ return PictureType.WMF;
+ case 0x04:
+ return PictureType.PICT;
+ case 0x05:
+ return PictureType.JPEG;
+ case 0x06:
+ return PictureType.PNG;
+ case 0x07:
+ return PictureType.BMP;
+ case 0x11:
+ return PictureType.TIFF;
+ case 0x12:
+ return PictureType.JPEG;
+ default:
+ return PictureType.UNKNOWN;
+ }
+ }
+
+ Enum<?> recordType = escherRecord.getGenericRecordType();
+ assert (recordType instanceof EscherRecordTypes);
+ switch ((EscherRecordTypes)recordType) {
+ case BLIP_EMF:
return PictureType.EMF;
- case 0x03:
+ case BLIP_WMF:
return PictureType.WMF;
- case 0x04:
+ case BLIP_PICT:
return PictureType.PICT;
- case 0x05:
+ case BLIP_JPEG:
return PictureType.JPEG;
- case 0x06:
+ case BLIP_PNG:
return PictureType.PNG;
- case 0x07:
+ case BLIP_DIB:
return PictureType.BMP;
- case 0x11:
+ case BLIP_TIFF:
return PictureType.TIFF;
- case 0x12:
- return PictureType.JPEG;
default:
return PictureType.UNKNOWN;
- }
- }
- case (short) 0xF01A:
- return PictureType.EMF;
- case (short) 0xF01B:
- return PictureType.WMF;
- case (short) 0xF01C:
- return PictureType.PICT;
- case (short) 0xF01D:
- return PictureType.JPEG;
- case (short) 0xF01E:
- return PictureType.PNG;
- case (short) 0xF01F:
- return PictureType.BMP;
- case (short) 0xF029:
- return PictureType.TIFF;
- case (short) 0xF02A:
- return PictureType.JPEG;
- default:
- return PictureType.UNKNOWN;
}
}
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/util/DoubleByteUtil.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/util/DoubleByteUtil.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/util/DoubleByteUtil.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/util/DoubleByteUtil.java Fri May 21 21:22:40 2021
@@ -40,9 +40,6 @@ public class DoubleByteUtil
* We know MS zero-padded ascii, and we drop those.
* There may be areas for improvement in this.
*
- * @param data
- * @param offset
- * @param lengthInBytes
* @return Decoded String
*/
public static String cp950ToString(byte[] data, int offset, int lengthInBytes) {
Modified: poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java (original)
+++ poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToHtmlConverter.java Fri May 21 21:22:40 2021
@@ -100,7 +100,7 @@ public class TestWordToHtmlConverter {
})
void testFile(String file, String contains) throws Exception {
- boolean emulatePictureStorage = file.contains("picture");
+ boolean emulatePictureStorage = !file.contains("equation");
String result = getHtmlText(file, emulatePictureStorage);
assertNotNull(result);
Modified: poi/trunk/poi/build.gradle
URL: http://svn.apache.org/viewvc/poi/trunk/poi/build.gradle?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/build.gradle (original)
+++ poi/trunk/poi/build.gradle Fri May 21 21:22:40 2021
@@ -50,6 +50,7 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
+ // needed for locating the external references
javadocs project(':poi-ooxml')
javadocs project(':poi-scratchpad')
}
@@ -59,13 +60,6 @@ final Pattern MODULE_NOT_REGEX = ~'(poi[
final Pattern MODULE_REGEX = ~'\\.jar$'
final List MODULE_PATH = sourceSets.test.runtimeClasspath.findAll{ it.path =~ MODULE_REGEX && !(it.path =~ MODULE_NOT_REGEX) }.collect{ it.parent }.unique()
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
- withJavadocJar()
- withSourcesJar()
-}
-
task compileJava9(type: JavaCompile) {
dependsOn 'compileJava'
@@ -110,8 +104,6 @@ task cacheTest9(type: Copy) {
}
jar {
- destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
-
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
into('META-INF/versions/9') {
from JAVA9_SRC include '*.class'
@@ -145,24 +137,12 @@ task testJar(type: Jar, dependsOn: testC
}
}
-sourcesJar {
- destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
- exclude 'META-INF/services/**'
-}
-
javadoc {
- failOnError = true
+ dependsOn configurations.javadocs.dependencies.collect{ ':' + it.dependencyProject.name + ':compileJava' }
+
doFirst {
options {
- if (JavaVersion.current().isJava9Compatible()) {
- addBooleanOption('html5', true)
- }
- links 'https://poi.apache.org/apidocs/dev/'
- links 'https://docs.oracle.com/javase/8/docs/api/'
- use = true
- splitIndex = true
- source = "1.8"
- classpath += configurations.javadocs.files
+ classpath += files(configurations.javadocs.dependencies.collect{ it.dependencyProject.sourceSets.main.output.classesDirs })
}
}
}
@@ -174,39 +154,10 @@ artifacts {
test {
dependsOn { testJar }
- useJUnitPlatform()
-
doFirst {
- jvmArgs = [
- '-Djava.io.tmpdir=build',
- '-DPOI.testdata.path=../test-data',
- '-Djava.awt.headless=true',
- '-Djava.locale.providers=JRE,CLDR',
- '-Duser.language=en',
- '-Duser.country=US',
- '-Djavax.xml.stream.XMLInputFactory=com.sun.xml.internal.stream.XMLInputFactoryImpl',
- "-Dversion.id=${project.version}",
- '-ea',
- '-Djunit.jupiter.execution.parallel.enabled=true',
- '-Djunit.jupiter.execution.parallel.config.strategy=fixed',
- '-Djunit.jupiter.execution.parallel.config.fixed.parallelism=3'
- // -Xjit:verbose={compileStart|compileEnd},vlog=build/jit.log${no.jit.sherlock} ... if ${isIBMVM}
- ]
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
- jvmArgs += [
- '-Dsun.reflect.debugModuleAccessChecks=true',
- '-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true',
- '--illegal-access=warn',
-
+ jvmArgs << [
'--add-modules', MODULE_NAME,
-
- // see https://github.com/java9-modularity/gradle-modules-plugin/issues/97
- // opposed to the recommendation there, it doesn't work to add ... to the dependencies
- // testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.7.1'
- // gradles gradle-worker.jar is still not a JPMS module and thus runs as unnamed module
- '--add-exports','org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED',
- '--add-exports','org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED',
-
'--module-path', '../build/dist/maven/poi-tests:' + files(MODULE_PATH).asPath,
]
}
@@ -216,16 +167,10 @@ test {
publishing {
publications {
POI(MavenPublication) {
- artifactId project.archivesBaseName
-
- from components.java
-
pom {
- name = 'Apache POI'
+ name = 'Apache POI - Common'
description = 'Apache POI - Java API To Access Microsoft Format Files'
}
}
}
-}
-
-generatePomFileForPOIPublication.destination = "../build/dist/maven/${project.archivesBaseName}/${project.archivesBaseName}-${project.version}.pom"
+}
\ No newline at end of file
Modified: poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherRecordTypes.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherRecordTypes.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherRecordTypes.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherRecordTypes.java Fri May 21 21:22:40 2021
@@ -79,6 +79,7 @@ public enum EscherRecordTypes {
BLIP_JPEG(0xf018 + 5 /* 0xf01d */, "BlipJpeg", null, EscherBitmapBlip::new),
BLIP_PNG(0xf018 + 6 /* 0xf01e */, "BlipPng", null, EscherBitmapBlip::new),
BLIP_DIB(0xf018 + 7 /* 0xf01f */, "BlipDib", null, EscherBitmapBlip::new),
+ BLIP_TIFF(0xf018 + 17 /* 0xf029 */, "BlipTiff", null, EscherBitmapBlip::new),
BLIP_END(0xf117, "Blip", "msofbtBlip", null),
REGROUP_ITEMS(0xf118, null, null, null),
SELECTION(0xf119, null, null, null),
@@ -111,6 +112,11 @@ public enum EscherRecordTypes {
Stream.of(values()).collect(Collectors.toMap(EscherRecordTypes::getTypeId, Function.identity()));
public static EscherRecordTypes forTypeID(int typeID) {
+ // Section 2.2.23: 0xF02A is treated as 0xF01D
+ if (typeID == 0xF02A) {
+ return EscherRecordTypes.BLIP_JPEG;
+ }
+
EscherRecordTypes rt = LOOKUP.get((short)typeID);
return (rt != null) ? rt : EscherRecordTypes.UNKNOWN;
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherShapePathProperty.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherShapePathProperty.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherShapePathProperty.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ddf/EscherShapePathProperty.java Fri May 21 21:22:40 2021
@@ -30,9 +30,6 @@ public class EscherShapePathProperty ext
/**
* Create an instance of an escher shape path property.
- *
- * @param propertyNumber
- * @param shapePath
*/
public EscherShapePathProperty( short propertyNumber, int shapePath ) {
super( propertyNumber, false, false, shapePath );
Modified: poi/trunk/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/extractor/ExtractorFactory.java Fri May 21 21:22:40 2021
@@ -30,6 +30,7 @@ import java.util.stream.StreamSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.EmptyFileException;
+import org.apache.poi.OldFileFormatException;
import org.apache.poi.hssf.extractor.ExcelExtractor;
import org.apache.poi.poifs.crypt.Decryptor;
import org.apache.poi.poifs.filesystem.DirectoryEntry;
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/ProtectionRev4Record.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/ProtectionRev4Record.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/ProtectionRev4Record.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/ProtectionRev4Record.java Fri May 21 21:22:40 2021
@@ -26,7 +26,7 @@ import org.apache.poi.util.GenericRecord
import org.apache.poi.util.LittleEndianOutput;
/**
- * Describes whether this is a protected shared/tracked workbook<p>
+ * Describes whether this is a protected shared/tracked workbook
*/
public final class ProtectionRev4Record extends StandardRecord {
public static final short sid = 0x01AF;
@@ -69,14 +69,17 @@ public final class ProtectionRev4Record
return protectedFlag.isSet(_options);
}
+ @Override
public void serialize(LittleEndianOutput out) {
out.writeShort(_options);
}
+ @Override
protected int getDataSize() {
return 2;
}
+ @Override
public short getSid() {
return sid;
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/RKRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/RKRecord.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/RKRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/RKRecord.java Fri May 21 21:22:40 2021
@@ -29,7 +29,7 @@ import org.apache.poi.util.LittleEndianO
* This is part of a bizarre scheme to save disk space and memory (gee look at all the other whole
* records that are in the file just "cause".., far better to waste processor cycles on this then
* leave on of those "valuable" records out).
- * We support this in READ-ONLY mode. HSSF converts these to NUMBER records<p>
+ * We support this in READ-ONLY mode. HSSF converts these to NUMBER records
*
* @see org.apache.poi.hssf.record.NumberRecord
*/
@@ -40,7 +40,7 @@ public final class RKRecord extends Cell
public static final short RK_INTEGER = 2;
public static final short RK_INTEGER_TIMES_100 = 3;
- private int field_4_rk_number;
+ private final int field_4_rk_number;
public RKRecord(RKRecord other) {
super(other);
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/WriteAccessRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/WriteAccessRecord.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/WriteAccessRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/WriteAccessRecord.java Fri May 21 21:22:40 2021
@@ -31,7 +31,7 @@ import org.apache.poi.util.StringUtil;
* Title: Write Access Record (0x005C)<p>
*
* Description: Stores the username of that who owns the spreadsheet generator (on unix the user's
- * login, on Windoze its the name you typed when you installed the thing)<p>
+ * login, on Windoze its the name you typed when you installed the thing)
*/
public final class WriteAccessRecord extends StandardRecord {
public static final short sid = 0x005C;
@@ -124,6 +124,7 @@ public final class WriteAccessRecord ext
return field_1_username;
}
+ @Override
public void serialize(LittleEndianOutput out) {
String username = getUsername();
boolean is16bit = StringUtil.hasMultibyte(username);
@@ -140,10 +141,12 @@ public final class WriteAccessRecord ext
out.write(PADDING, 0, paddingSize);
}
+ @Override
protected int getDataSize() {
return DATA_SIZE;
}
+ @Override
public short getSid() {
return sid;
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/aggregates/MergedCellsTable.java Fri May 21 21:22:40 2021
@@ -40,7 +40,6 @@ public final class MergedCellsTable exte
/**
* reads zero or more consecutive {@link MergeCellsRecord}s
- * @param rs
*/
public void read(RecordStream rs) {
while (rs.peekNextClass() == MergeCellsRecord.class) {
@@ -92,8 +91,8 @@ public final class MergedCellsTable exte
}
}
public void addRecords(MergeCellsRecord[] mcrs) {
- for (int i = 0; i < mcrs.length; i++) {
- addMergeCellsRecord(mcrs[i]);
+ for (MergeCellsRecord mcr : mcrs) {
+ addMergeCellsRecord(mcr);
}
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/chart/TickRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/chart/TickRecord.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/chart/TickRecord.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/chart/TickRecord.java Fri May 21 21:22:40 2021
@@ -32,7 +32,7 @@ import org.apache.poi.util.BitFieldFacto
import org.apache.poi.util.LittleEndianOutput;
/**
- * The Tick record defines how tick marks and label positioning/formatting<p>
+ * The Tick record defines how tick marks and label positioning/formatting
*/
public final class TickRecord extends StandardRecord {
public static final short sid = 0x101E;
@@ -90,6 +90,7 @@ public final class TickRecord extends St
field_12_zero5 = in.readShort();
}
+ @Override
public void serialize(LittleEndianOutput out) {
out.writeByte(field_1_majorTickType);
out.writeByte(field_2_minorTickType);
@@ -105,10 +106,12 @@ public final class TickRecord extends St
out.writeShort(field_12_zero5);
}
+ @Override
protected int getDataSize() {
return 1 + 1 + 1 + 1 + 4 + 8 + 8 + 2 + 2 + 2;
}
+ @Override
public short getSid()
{
return sid;
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/common/UnicodeString.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/common/UnicodeString.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/common/UnicodeString.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/record/common/UnicodeString.java Fri May 21 21:22:40 2021
@@ -42,7 +42,7 @@ import static org.apache.logging.log4j.u
/**
* Unicode String - just standard fields that are in several records.
* It is considered more desirable then repeating it in all of them.<p>
- * This is often called a XLUnicodeRichExtendedString in MS documentation.<p>
+ * This is often called a XLUnicodeRichExtendedString in MS documentation.
*/
public class UnicodeString implements Comparable<UnicodeString>, Duplicatable, GenericRecord {
private static final Logger LOG = LogManager.getLogger(UnicodeString.class);
@@ -445,6 +445,7 @@ public class UnicodeString implements Co
}
}
+ @Override
public int compareTo(UnicodeString str) {
int result = getString().compareTo(str.getString());
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/EscherGraphics.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/EscherGraphics.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/EscherGraphics.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/EscherGraphics.java Fri May 21 21:22:40 2021
@@ -48,15 +48,14 @@ import java.text.AttributedCharacterIter
* verticalPointsPerPixel. This the amount the font should be scaled by when
* you issue commands such as drawString(). A good way to calculate this
* is to use the follow formula:
- * <p>
- * <pre>
- * multipler = groupHeightInPoints / heightOfGroup
- * </pre>
+ * <pre>{@code
+ * multiplier = groupHeightInPoints / heightOfGroup
+ * }</pre>
* <p>
* The height of the group is calculated fairly simply by calculating the
* difference between the y coordinates of the bounding box of the shape. The
* height of the group can be calculated by using a convenience called
- * <code>HSSFClientAnchor.getAnchorHeightInPoints()</code>.
+ * {@code HSSFClientAnchor.getAnchorHeightInPoints()}.
* </blockquote>
*/
public class EscherGraphics extends Graphics {
@@ -64,7 +63,7 @@ public class EscherGraphics extends Grap
private final HSSFShapeGroup escherGroup;
private final HSSFWorkbook workbook;
- private float verticalPointsPerPixel = 1.0f;
+ private final float verticalPointsPerPixel;
private final float verticalPixelsPerPoint;
private Color foreground;
private Color background = Color.white;
@@ -290,7 +289,7 @@ public class EscherGraphics extends Grap
if (str == null || str.isEmpty())
return;
- Font excelFont = font;
+ Font excelFont;
if ( font.getName().equals( "SansSerif" ) )
{
excelFont = new Font( "Arial", font.getStyle(), (int) ( font.getSize() / verticalPixelsPerPoint ) );
@@ -374,18 +373,18 @@ public class EscherGraphics extends Grap
* Fills a (closed) polygon, as defined by a pair of arrays, which
* hold the <i>x</i> and <i>y</i> coordinates.
* <p>
- * This draws the polygon, with <code>nPoint</code> line segments.
- * The first <code>nPoint - 1</code> line segments are
+ * This draws the polygon, with {@code nPoint} line segments.
+ * The first {@code nPoint - 1} line segments are
* drawn between sequential points
- * (<code>xPoints[i],yPoints[i],xPoints[i+1],yPoints[i+1]</code>).
+ * ({@code xPoints[i],yPoints[i],xPoints[i+1],yPoints[i+1]}).
* The final line segment is a closing one, from the last point to
* the first (assuming they are different).
* <p>
* The area inside of the polygon is defined by using an
* even-odd fill rule (also known as the alternating rule), and
* the area inside of it is filled.
- * @param xPoints array of the <code>x</code> coordinates.
- * @param yPoints array of the <code>y</code> coordinates.
+ * @param xPoints array of the {@code x} coordinates.
+ * @param yPoints array of the {@code y} coordinates.
* @param nPoints the total number of points in the polygon.
* @see Graphics#drawPolygon(int[], int[], int)
*/
@@ -407,10 +406,9 @@ public class EscherGraphics extends Grap
private int findBiggest( int[] values )
{
int result = Integer.MIN_VALUE;
- for ( int i = 0; i < values.length; i++ )
- {
- if (values[i] > result)
- result = values[i];
+ for (int value : values) {
+ if (value > result)
+ result = value;
}
return result;
}
@@ -418,10 +416,9 @@ public class EscherGraphics extends Grap
private int findSmallest( int[] values )
{
int result = Integer.MAX_VALUE;
- for ( int i = 0; i < values.length; i++ )
- {
- if (values[i] < result)
- result = values[i];
+ for (int value : values) {
+ if (value < result)
+ result = value;
}
return result;
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/EscherGraphics2d.java Fri May 21 21:22:40 2021
@@ -59,21 +59,20 @@ import java.util.Map;
* This the amount the font should be scaled by when
* you issue commands such as drawString(). A good way to calculate this
* is to use the follow formula:
- * <p>
- * <pre>
+ * <pre>{@code
* multipler = groupHeightInPoints / heightOfGroup
- * </pre>
+ * }</pre>
* <p>
* The height of the group is calculated fairly simply by calculating the
* difference between the y coordinates of the bounding box of the shape. The
* height of the group can be calculated by using a convenience called
- * <code>HSSFClientAnchor.getAnchorHeightInPoints()</code>.
+ * {@code HSSFClientAnchor.getAnchorHeightInPoints()}.
* </blockquote>
*/
public final class EscherGraphics2d extends Graphics2D {
private static final Logger LOG = LogManager.getLogger(EscherGraphics2d.class);
- private EscherGraphics _escherGraphics;
+ private final EscherGraphics _escherGraphics;
private BufferedImage _img;
private AffineTransform _trans;
private Stroke _stroke;
@@ -92,11 +91,13 @@ public final class EscherGraphics2d exte
setColor(Color.black);
}
+ @Override
public void addRenderingHints(Map<?, ?> map)
{
getG2D().addRenderingHints(map);
}
+ @Override
public void clearRect(int i, int j, int k, int l)
{
Paint paint1 = getPaint();
@@ -105,6 +106,7 @@ public final class EscherGraphics2d exte
setPaint(paint1);
}
+ @Override
public void clip(Shape shape)
{
if(getDeviceclip() != null)
@@ -117,22 +119,26 @@ public final class EscherGraphics2d exte
setClip(shape);
}
+ @Override
public void clipRect(int x, int y, int width, int height)
{
clip(new Rectangle(x,y,width,height));
}
+ @Override
public void copyArea(int x, int y, int width, int height,
int dx, int dy)
{
getG2D().copyArea(x,y,width,height,dx,dy);
}
+ @Override
public Graphics create()
{
return new EscherGraphics2d(_escherGraphics);
}
+ @Override
public void dispose()
{
getEscherGraphics().dispose();
@@ -140,6 +146,7 @@ public final class EscherGraphics2d exte
getImg().flush();
}
+ @Override
public void draw(Shape shape)
{
if (shape instanceof Line2D)
@@ -159,17 +166,20 @@ public final class EscherGraphics2d exte
}
}
+ @Override
public void drawArc(int x, int y, int width, int height,
int startAngle, int arcAngle)
{
draw(new Arc2D.Float(x, y, width, height, startAngle, arcAngle, 0));
}
+ @Override
public void drawGlyphVector(GlyphVector g, float x, float y)
{
fill(g.getOutline(x, y));
}
+ @Override
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
int sx2, int sy2, Color bgColor, ImageObserver imageobserver)
{
@@ -177,18 +187,21 @@ public final class EscherGraphics2d exte
return true;
}
+ @Override
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
int sx2, int sy2, ImageObserver imageobserver)
{
LOG.atWarn().log("drawImage() not supported");
return drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, imageobserver);
}
+ @Override
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, Color bgColor, ImageObserver imageobserver)
{
LOG.atWarn().log("drawImage() not supported");
return true;
}
+ @Override
public boolean drawImage(Image img, int x, int y,
int width, int height,
ImageObserver observer)
@@ -196,16 +209,19 @@ public final class EscherGraphics2d exte
return drawImage(img, x,y,width,height, null, observer);
}
+ @Override
public boolean drawImage(Image image, int x, int y, Color bgColor, ImageObserver imageobserver)
{
return drawImage(image, x, y, image.getWidth(imageobserver), image.getHeight(imageobserver), bgColor, imageobserver);
}
+ @Override
public boolean drawImage(Image image, int x, int y, ImageObserver imageobserver)
{
return drawImage(image, x, y, image.getWidth(imageobserver), image.getHeight(imageobserver), imageobserver);
}
+ @Override
public boolean drawImage(Image image, AffineTransform affinetransform, ImageObserver imageobserver)
{
AffineTransform affinetransform1 = (AffineTransform)getTrans().clone();
@@ -215,6 +231,7 @@ public final class EscherGraphics2d exte
return true;
}
+ @Override
public void drawImage(BufferedImage bufferedimage, BufferedImageOp op, int x, int y)
{
BufferedImage img = op.filter(bufferedimage, null);
@@ -226,6 +243,7 @@ public final class EscherGraphics2d exte
getEscherGraphics().drawLine(x1,y1,x2,y2, width);
}
+ @Override
public void drawLine(int x1, int y1, int x2, int y2)
{
int width = 0;
@@ -236,18 +254,21 @@ public final class EscherGraphics2d exte
// draw(new GeneralPath(new java.awt.geom.Line2D.Float(x1, y1, x2, y2)));
}
+ @Override
public void drawOval(int x, int y, int width, int height)
{
getEscherGraphics().drawOval(x,y,width,height);
// draw(new java.awt.geom.Ellipse2D.Float(x, y, width, height));
}
+ @Override
public void drawPolygon(int[] xPoints, int[] yPoints,
int nPoints)
{
getEscherGraphics().drawPolygon(xPoints, yPoints, nPoints);
}
+ @Override
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
{
if(nPoints > 0)
@@ -261,16 +282,19 @@ public final class EscherGraphics2d exte
}
}
+ @Override
public void drawRect(int x, int y, int width, int height)
{
_escherGraphics.drawRect(x,y,width,height);
}
+ @Override
public void drawRenderableImage(RenderableImage renderableimage, AffineTransform affinetransform)
{
drawRenderedImage(renderableimage.createDefaultRendering(), affinetransform);
}
+ @Override
public void drawRenderedImage(RenderedImage renderedimage, AffineTransform affinetransform)
{
BufferedImage bufferedimage = new BufferedImage(renderedimage.getColorModel(), renderedimage.getData().createCompatibleWritableRaster(), false, null);
@@ -278,21 +302,25 @@ public final class EscherGraphics2d exte
drawImage(bufferedimage, affinetransform, null);
}
+ @Override
public void drawRoundRect(int i, int j, int k, int l, int i1, int j1)
{
draw(new RoundRectangle2D.Float(i, j, k, l, i1, j1));
}
+ @Override
public void drawString(String string, float x, float y)
{
getEscherGraphics().drawString(string, (int)x, (int)y);
}
+ @Override
public void drawString(String string, int x, int y)
{
getEscherGraphics().drawString(string, x, y);
}
+ @Override
public void drawString(AttributedCharacterIterator attributedcharacteriterator, float x, float y)
{
TextLayout textlayout = new TextLayout(attributedcharacteriterator, getFontRenderContext());
@@ -302,21 +330,25 @@ public final class EscherGraphics2d exte
setPaint(paint1);
}
+ @Override
public void drawString(AttributedCharacterIterator attributedcharacteriterator, int x, int y)
{
getEscherGraphics().drawString(attributedcharacteriterator, x, y);
}
+ @Override
public void fill(Shape shape)
{
LOG.atWarn().log("fill(Shape) not supported");
}
+ @Override
public void fillArc(int i, int j, int k, int l, int i1, int j1)
{
fill(new Arc2D.Float(i, j, k, l, i1, j1, 2));
}
+ @Override
public void fillOval(int x, int y, int width, int height)
{
_escherGraphics.fillOval(x,y,width,height);
@@ -326,42 +358,47 @@ public final class EscherGraphics2d exte
* Fills a (closed) polygon, as defined by a pair of arrays, which
* hold the <i>x</i> and <i>y</i> coordinates.
* <p>
- * This draws the polygon, with <code>nPoint</code> line segments.
- * The first <code>nPoint - 1</code> line segments are
+ * This draws the polygon, with {@code nPoint} line segments.
+ * The first {@code nPoint - 1} line segments are
* drawn between sequential points
- * (<code>xPoints[i],yPoints[i],xPoints[i+1],yPoints[i+1]</code>).
+ * ({@code xPoints[i],yPoints[i],xPoints[i+1],yPoints[i+1]}).
* The final line segment is a closing one, from the last point to
* the first (assuming they are different).
* <p>
* The area inside of the polygon is defined by using an
* even-odd fill rule (also known as the alternating rule), and
* the area inside of it is filled.
- * @param xPoints array of the <code>x</code> coordinates.
- * @param yPoints array of the <code>y</code> coordinates.
+ * @param xPoints array of the {@code x} coordinates.
+ * @param yPoints array of the {@code y} coordinates.
* @param nPoints the total number of points in the polygon.
* @see Graphics#drawPolygon(int[], int[], int)
*/
+ @Override
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
{
_escherGraphics.fillPolygon(xPoints, yPoints, nPoints);
}
+ @Override
public void fillRect(int x, int y, int width, int height)
{
getEscherGraphics().fillRect(x,y,width,height);
}
+ @Override
public void fillRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
fill(new RoundRectangle2D.Float(x, y, width, height, arcWidth, arcHeight));
}
+ @Override
public Color getBackground()
{
return getEscherGraphics().getBackground();
}
+ @Override
public Shape getClip()
{
try
@@ -374,6 +411,7 @@ public final class EscherGraphics2d exte
}
}
+ @Override
public Rectangle getClipBounds()
{
if(getDeviceclip() != null) {
@@ -383,62 +421,74 @@ public final class EscherGraphics2d exte
return null;
}
+ @Override
public Color getColor()
{
return _escherGraphics.getColor();
}
+ @Override
public Composite getComposite()
{
return getG2D().getComposite();
}
+ @Override
public GraphicsConfiguration getDeviceConfiguration()
{
return getG2D().getDeviceConfiguration();
}
+ @Override
public Font getFont()
{
return getEscherGraphics().getFont();
}
+ @Override
public FontMetrics getFontMetrics(Font font)
{
return getEscherGraphics().getFontMetrics(font);
}
+ @Override
public FontRenderContext getFontRenderContext()
{
getG2D().setTransform(getTrans());
return getG2D().getFontRenderContext();
}
+ @Override
public Paint getPaint()
{
return _paint;
}
+ @Override
public Object getRenderingHint(RenderingHints.Key key)
{
return getG2D().getRenderingHint(key);
}
+ @Override
public RenderingHints getRenderingHints()
{
return getG2D().getRenderingHints();
}
+ @Override
public Stroke getStroke()
{
return _stroke;
}
+ @Override
public AffineTransform getTransform()
{
return (AffineTransform)getTrans().clone();
}
+ @Override
public boolean hit(Rectangle rectangle, Shape shape, boolean flag)
{
getG2D().setTransform(getTrans());
@@ -447,51 +497,61 @@ public final class EscherGraphics2d exte
return getG2D().hit(rectangle, shape, flag);
}
+ @Override
public void rotate(double d)
{
getTrans().rotate(d);
}
+ @Override
public void rotate(double d, double d1, double d2)
{
getTrans().rotate(d, d1, d2);
}
+ @Override
public void scale(double d, double d1)
{
getTrans().scale(d, d1);
}
+ @Override
public void setBackground(Color c)
{
getEscherGraphics().setBackground(c);
}
+ @Override
public void setClip(int i, int j, int k, int l)
{
setClip(new Rectangle(i, j, k, l));
}
+ @Override
public void setClip(Shape shape)
{
setDeviceclip( getTrans().createTransformedShape(shape) );
}
+ @Override
public void setColor(Color c)
{
_escherGraphics.setColor(c);
}
+ @Override
public void setComposite(Composite composite)
{
getG2D().setComposite(composite);
}
+ @Override
public void setFont(Font font)
{
getEscherGraphics().setFont(font);
}
+ @Override
public void setPaint(Paint paint1)
{
if(paint1 != null)
@@ -502,51 +562,61 @@ public final class EscherGraphics2d exte
}
}
+ @Override
public void setPaintMode()
{
getEscherGraphics().setPaintMode();
}
+ @Override
public void setRenderingHint(RenderingHints.Key key, Object obj)
{
getG2D().setRenderingHint(key, obj);
}
+ @Override
public void setRenderingHints(Map<?, ?> map)
{
getG2D().setRenderingHints(map);
}
+ @Override
public void setStroke(Stroke s)
{
_stroke = s;
}
+ @Override
public void setTransform(AffineTransform affinetransform)
{
setTrans( (AffineTransform)affinetransform.clone() );
}
+ @Override
public void setXORMode(Color color1)
{
getEscherGraphics().setXORMode(color1);
}
+ @Override
public void shear(double d, double d1)
{
getTrans().shear(d, d1);
}
+ @Override
public void transform(AffineTransform affinetransform)
{
getTrans().concatenate(affinetransform);
}
+ @Override
public void translate(double d, double d1)
{
getTrans().translate(d, d1);
}
+ @Override
public void translate(int i, int j)
{
getTrans().translate(i, j);
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFCell.java Fri May 21 21:22:40 2021
@@ -56,7 +56,6 @@ import org.apache.poi.ss.util.CellRangeA
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.ss.util.NumberToTextConverter;
import org.apache.poi.util.LocaleUtil;
-import org.apache.poi.util.Removal;
/**
* High level representation of a cell in a row of a spreadsheet.
@@ -68,7 +67,6 @@ import org.apache.poi.util.Removal;
* <p>
* Cells should have their number (0 based) before being added to a row. Only
* cells that have values should be added.
- * <p>
*/
public class HSSFCell extends CellBase {
private static final String FILE_FORMAT_NAME = "BIFF8";
@@ -119,9 +117,6 @@ public class HSSFCell extends CellBase {
setCellType(CellType.BLANK, false, row, col,xfindex);
}
- /**
- * {@inheritDoc}
- */
@Override
protected SpreadsheetVersion getSpreadsheetVersion() {
return SpreadsheetVersion.EXCEL97;
@@ -132,6 +127,7 @@ public class HSSFCell extends CellBase {
*
* @return the HSSFSheet that owns this cell
*/
+ @Override
public HSSFSheet getSheet() {
return _sheet;
}
@@ -141,6 +137,7 @@ public class HSSFCell extends CellBase {
*
* @return the HSSFRow that owns this cell
*/
+ @Override
public HSSFRow getRow() {
int rowIndex = getRowIndex();
return _sheet.getRow(rowIndex);
@@ -190,13 +187,11 @@ public class HSSFCell extends CellBase {
_stringValue = new HSSFRichTextString(book.getWorkbook(), (LabelSSTRecord ) cval);
break;
- case BLANK :
- break;
-
case FORMULA :
_stringValue=new HSSFRichTextString(((FormulaRecordAggregate) cval).getStringValue());
break;
+ case BLANK :
default :
break;
}
@@ -428,9 +423,6 @@ public class HSSFCell extends CellBase {
return _cellType;
}
- /**
- * {@inheritDoc}
- */
@Override
@SuppressWarnings("fallthrough")
protected void setCellValueImpl(double value) {
@@ -458,6 +450,7 @@ public class HSSFCell extends CellBase {
* @see DateUtil
* @see org.apache.poi.ss.usermodel.DateUtil
*/
+ @Override
protected void setCellValueImpl(Date value) {
setCellValue(DateUtil.getExcelDate(value, _book.getWorkbook().isUsing1904DateWindowing()));
}
@@ -469,29 +462,21 @@ public class HSSFCell extends CellBase {
* @see DateUtil
* @see org.apache.poi.ss.usermodel.DateUtil
*/
+ @Override
protected void setCellValueImpl(LocalDateTime value) {
setCellValue(DateUtil.getExcelDate(value, _book.getWorkbook().isUsing1904DateWindowing()));
}
- /**
- * {@inheritDoc}
- */
@Override
protected void setCellValueImpl(Calendar value) {
setCellValue( DateUtil.getExcelDate(value, _book.getWorkbook().isUsing1904DateWindowing()) );
}
- /**
- * {@inheritDoc}
- */
@Override
protected void setCellValueImpl(String value) {
setCellValueImpl(new HSSFRichTextString(value));
}
- /**
- * {@inheritDoc}
- */
@Override
protected void setCellValueImpl(RichTextString value) {
if (_cellType == CellType.FORMULA) {
@@ -526,9 +511,6 @@ public class HSSFCell extends CellBase {
_stringValue.setUnicodeString(_book.getWorkbook().getSSTString(index));
}
- /**
- * {@inheritDoc}
- */
@Override
protected void setCellFormulaImpl(String formula) {
// formula cells always have a value. If the cell is blank (either initially or after removing an
@@ -640,6 +622,7 @@ public class HSSFCell extends CellBase {
}
}
+ @Override
public String getCellFormula() {
if (!(_record instanceof FormulaRecordAggregate)) {
throw typeMismatch(CellType.FORMULA, _cellType, true);
@@ -668,6 +651,7 @@ public class HSSFCell extends CellBase {
* number into a string similar to that which
* Excel would render this number as.
*/
+ @Override
public double getNumericCellValue() {
switch(_cellType) {
@@ -692,6 +676,7 @@ public class HSSFCell extends CellBase {
* See {@link HSSFDataFormatter} for formatting
* this date into a string similar to how excel does.
*/
+ @Override
public Date getDateCellValue() {
if (_cellType == CellType.BLANK) {
@@ -711,6 +696,7 @@ public class HSSFCell extends CellBase {
* See {@link HSSFDataFormatter} for formatting
* this date into a string similar to how excel does.
*/
+ @Override
public LocalDateTime getLocalDateTimeCellValue() {
if (_cellType == CellType.BLANK) {
@@ -728,6 +714,7 @@ public class HSSFCell extends CellBase {
* For blank cells we return an empty string.
* For formulaCells that are not string Formulas, we throw an exception
*/
+ @Override
public String getStringCellValue()
{
HSSFRichTextString str = getRichStringCellValue();
@@ -739,6 +726,7 @@ public class HSSFCell extends CellBase {
* For blank cells we return an empty string.
* For formulaCells that are not string Formulas, we throw an exception
*/
+ @Override
public HSSFRichTextString getRichStringCellValue() {
switch(_cellType) {
@@ -764,6 +752,7 @@ public class HSSFCell extends CellBase {
* precalculated value, for booleans we'll set its value. For other types we
* will change the cell to a boolean cell and set its value.
*/
+ @Override
@SuppressWarnings("fallthrough")
public void setCellValue(boolean value) {
int row=_record.getRow();
@@ -793,6 +782,8 @@ public class HSSFCell extends CellBase {
* For error code byte, see {@link FormulaError}.
* @deprecated 3.15 beta 2. Use {@link #setCellErrorValue(FormulaError)} instead.
*/
+ @Override
+ @Deprecated
public void setCellErrorValue(byte errorCode) {
FormulaError error = FormulaError.forInt(errorCode);
setCellErrorValue(error);
@@ -948,6 +939,7 @@ public class HSSFCell extends CellBase {
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createCellStyle()
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(int)
*/
+ @Override
public void setCellStyle(CellStyle style) {
setCellStyle( (HSSFCellStyle)style );
}
@@ -977,6 +969,7 @@ public class HSSFCell extends CellBase {
* object.
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(int)
*/
+ @Override
public HSSFCellStyle getCellStyle()
{
short styleIndex=_record.getXFIndex();
@@ -1006,9 +999,6 @@ public class HSSFCell extends CellBase {
}
}
- /**
- * {@inheritDoc}
- */
@Override
public void setAsActiveCell()
{
@@ -1062,6 +1052,7 @@ public class HSSFCell extends CellBase {
*
* @param comment comment associated with this cell
*/
+ @Override
public void setCellComment(Comment comment){
if(comment == null) {
removeCellComment();
@@ -1078,6 +1069,7 @@ public class HSSFCell extends CellBase {
*
* @return comment associated with this cell
*/
+ @Override
public HSSFComment getCellComment(){
if (_comment == null) {
_comment = _sheet.findCellComment(_record.getRow(), _record.getColumn());
@@ -1091,6 +1083,7 @@ public class HSSFCell extends CellBase {
* WARNING - some versions of excel will loose
* all comments after performing this action!
*/
+ @Override
public void removeCellComment() {
HSSFComment comment = _sheet.findCellComment(_record.getRow(), _record.getColumn());
_comment = null;
@@ -1101,7 +1094,7 @@ public class HSSFCell extends CellBase {
}
/**
- * @return hyperlink associated with this cell or <code>null</code> if not found
+ * @return hyperlink associated with this cell or {@code null} if not found
*/
@Override
public HSSFHyperlink getHyperlink(){
@@ -1151,6 +1144,7 @@ public class HSSFCell extends CellBase {
/**
* Removes the hyperlink for this cell, if there is one.
*/
+ @Override
public void removeHyperlink() {
for (Iterator<RecordBase> it = _sheet.getSheet().getRecords().iterator(); it.hasNext();) {
RecordBase rec = it.next();
@@ -1193,6 +1187,7 @@ public class HSSFCell extends CellBase {
agg.setParsedExpression(ptgsForCell);
}
+ @Override
public CellRangeAddress getArrayFormulaRange() {
if (_cellType != CellType.FORMULA) {
String ref = new CellReference(this).formatAsString();
@@ -1202,6 +1197,7 @@ public class HSSFCell extends CellBase {
return ((FormulaRecordAggregate)_record).getArrayFormulaRange();
}
+ @Override
public boolean isPartOfArrayFormulaGroup() {
return _cellType == CellType.FORMULA && ((FormulaRecordAggregate) _record).isPartOfArrayFormula();
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFChildAnchor.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFChildAnchor.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFChildAnchor.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFChildAnchor.java Fri May 21 21:22:40 2021
@@ -27,7 +27,6 @@ public final class HSSFChildAnchor exten
/**
* create anchor from existing file
- * @param escherChildAnchorRecord
*/
public HSSFChildAnchor(EscherChildAnchorRecord escherChildAnchorRecord) {
this._escherChildAnchor = escherChildAnchorRecord;
@@ -108,11 +107,13 @@ public final class HSSFChildAnchor exten
}
+ @Override
public boolean isHorizontallyFlipped() {
return _isHorizontallyFlipped;
}
+ @Override
public boolean isVerticallyFlipped() {
return _isVerticallyFlipped;
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFComment.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFComment.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFComment.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFComment.java Fri May 21 21:22:40 2021
@@ -66,7 +66,6 @@ public class HSSFComment extends HSSFTex
/**
* Construct a new comment with the given parent and anchor.
*
- * @param parent
* @param anchor defines position of this anchor in the sheet
*/
public HSSFComment(HSSFShape parent, HSSFAnchor anchor) {
@@ -100,6 +99,7 @@ public class HSSFComment extends HSSFTex
protected EscherContainerRecord createSpContainer() {
EscherContainerRecord spContainer = super.createSpContainer();
EscherOptRecord opt = spContainer.getChildById(EscherOptRecord.RECORD_ID);
+ assert(opt != null);
opt.removeEscherProperty(EscherPropertyTypes.TEXT__TEXTLEFT);
opt.removeEscherProperty(EscherPropertyTypes.TEXT__TEXTRIGHT);
opt.removeEscherProperty(EscherPropertyTypes.TEXT__TEXTTOP);
@@ -147,7 +147,7 @@ public class HSSFComment extends HSSFTex
/**
* Sets whether this comment is visible.
*
- * @param visible <code>true</code> if the comment is visible, <code>false</code> otherwise
+ * @param visible {@code true} if the comment is visible, {@code false} otherwise
*/
@Override
public void setVisible(boolean visible) {
@@ -158,7 +158,7 @@ public class HSSFComment extends HSSFTex
/**
* Returns whether this comment is visible.
*
- * @return <code>true</code> if the comment is visible, <code>false</code> otherwise
+ * @return {@code true} if the comment is visible, {@code false} otherwise
*/
@Override
public boolean isVisible() {
@@ -253,9 +253,7 @@ public class HSSFComment extends HSSFTex
* Do we know which cell this comment belongs to?
*/
public boolean hasPosition() {
- if (_note == null) return false;
- if (getColumn() < 0 || getRow() < 0) return false;
- return true;
+ return _note != null && getColumn() >= 0 && getRow() >= 0;
}
@Override
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFEvaluationSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFEvaluationSheet.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFEvaluationSheet.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFEvaluationSheet.java Fri May 21 21:22:40 2021
@@ -36,7 +36,7 @@ final class HSSFEvaluationSheet implemen
public HSSFSheet getHSSFSheet() {
return _hs;
}
-
+
/* (non-Javadoc)
* @see org.apache.poi.ss.formula.EvaluationSheet#getlastRowNum()
* @since POI 4.0.0
@@ -50,6 +50,7 @@ final class HSSFEvaluationSheet implemen
* @see org.apache.poi.ss.formula.EvaluationSheet#isRowHidden(int)
* @since POI 4.1.0
*/
+ @Override
public boolean isRowHidden(int rowIndex) {
HSSFRow row = _hs.getRow(rowIndex);
if (row == null) return false;
@@ -71,7 +72,7 @@ final class HSSFEvaluationSheet implemen
/* (non-JavaDoc), inherit JavaDoc from EvaluationSheet
* @since POI 3.15 beta 3
- */
+ */
@Override
public void clearAllCachedResultValues() {
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFont.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFont.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFont.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFont.java Fri May 21 21:22:40 2021
@@ -49,8 +49,8 @@ public final class HSSFFont implements F
public static final String FONT_ARIAL = "Arial";
- private FontRecord font;
- private int index;
+ private final FontRecord font;
+ private final int index;
/** Creates a new instance of HSSFFont */
@@ -66,6 +66,7 @@ public final class HSSFFont implements F
* @see #FONT_ARIAL
*/
+ @Override
public void setFontName(String name)
{
font.setFontName(name);
@@ -76,6 +77,7 @@ public final class HSSFFont implements F
* @return String representing the name of the font to use
* @see #FONT_ARIAL
*/
+ @Override
public String getFontName()
{
return font.getFontName();
@@ -99,6 +101,7 @@ public final class HSSFFont implements F
* @see #setFontHeightInPoints(short)
*/
+ @Override
public void setFontHeight(short height)
{
font.setFontHeight(height);
@@ -110,6 +113,7 @@ public final class HSSFFont implements F
* @see #setFontHeight(short)
*/
+ @Override
public void setFontHeightInPoints(short height)
{
font.setFontHeight(( short ) (height * Font.TWIPS_PER_POINT));
@@ -122,6 +126,7 @@ public final class HSSFFont implements F
* @see #getFontHeightInPoints()
*/
+ @Override
public short getFontHeight()
{
return font.getFontHeight();
@@ -133,6 +138,7 @@ public final class HSSFFont implements F
* @see #getFontHeight()
*/
+ @Override
public short getFontHeightInPoints()
{
return ( short ) (font.getFontHeight() / Font.TWIPS_PER_POINT);
@@ -143,6 +149,7 @@ public final class HSSFFont implements F
* @param italic italics or not
*/
+ @Override
public void setItalic(boolean italic)
{
font.setItalic(italic);
@@ -153,6 +160,7 @@ public final class HSSFFont implements F
* @return italics or not
*/
+ @Override
public boolean getItalic()
{
return font.isItalic();
@@ -163,6 +171,7 @@ public final class HSSFFont implements F
* @param strikeout or not
*/
+ @Override
public void setStrikeout(boolean strikeout)
{
font.setStrikeout(strikeout);
@@ -173,6 +182,7 @@ public final class HSSFFont implements F
* @return strikeout or not
*/
+ @Override
public boolean getStrikeout()
{
return font.isStruckout();
@@ -185,6 +195,7 @@ public final class HSSFFont implements F
* @see #COLOR_RED
*/
+ @Override
public void setColor(short color)
{
font.setColorPaletteIndex(color);
@@ -197,6 +208,7 @@ public final class HSSFFont implements F
* @see #COLOR_RED
* @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
*/
+ @Override
public short getColor()
{
return font.getColorPaletteIndex();
@@ -214,6 +226,7 @@ public final class HSSFFont implements F
/**
* sets the font to be bold or not
*/
+ @Override
public void setBold(boolean bold)
{
if (bold)
@@ -225,6 +238,7 @@ public final class HSSFFont implements F
/**
* get if the font is bold or not
*/
+ @Override
public boolean getBold()
{
return font.getBoldWeight() == BOLDWEIGHT_BOLD;
@@ -238,6 +252,7 @@ public final class HSSFFont implements F
* @see #SS_SUB
*/
+ @Override
public void setTypeOffset(short offset)
{
font.setSuperSubScript(offset);
@@ -251,6 +266,7 @@ public final class HSSFFont implements F
* @see #SS_SUB
*/
+ @Override
public short getTypeOffset()
{
return font.getSuperSubScript();
@@ -266,6 +282,7 @@ public final class HSSFFont implements F
* @see #U_DOUBLE_ACCOUNTING
*/
+ @Override
public void setUnderline(byte underline)
{
font.setUnderline(underline);
@@ -281,6 +298,7 @@ public final class HSSFFont implements F
* @see #U_DOUBLE_ACCOUNTING
*/
+ @Override
public byte getUnderline()
{
return font.getUnderline();
@@ -294,6 +312,7 @@ public final class HSSFFont implements F
* @see #DEFAULT_CHARSET
* @see #SYMBOL_CHARSET
*/
+ @Override
public int getCharSet()
{
byte charset = font.getCharset();
@@ -310,6 +329,7 @@ public final class HSSFFont implements F
* @see #DEFAULT_CHARSET
* @see #SYMBOL_CHARSET
*/
+ @Override
public void setCharSet(int charset)
{
byte cs = (byte)charset;
@@ -325,6 +345,7 @@ public final class HSSFFont implements F
* @see #DEFAULT_CHARSET
* @see #SYMBOL_CHARSET
*/
+ @Override
public void setCharSet(byte charset)
{
font.setCharset(charset);
@@ -347,14 +368,14 @@ public final class HSSFFont implements F
if (obj instanceof HSSFFont) {
final HSSFFont other = (HSSFFont) obj;
if (font == null) {
- if (other.font != null)
- return false;
- } else if (!font.equals(other.font))
- return false;
- if (index != other.index)
- return false;
- return true;
- }
+ if (other.font != null) {
+ return false;
+ }
+ } else if (!font.equals(other.font)) {
+ return false;
+ }
+ return index == other.index;
+ }
return false;
}
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java Fri May 21 21:22:40 2021
@@ -50,7 +50,7 @@ public class HSSFFormulaEvaluator extend
}
/**
* @param workbook The workbook to perform the formula evaluations in
- * @param stabilityClassifier used to optimise caching performance. Pass <code>null</code>
+ * @param stabilityClassifier used to optimise caching performance. Pass {@code null}
* for the (conservative) assumption that any cell may have its definition changed after
* evaluation begins.
*/
@@ -60,10 +60,10 @@ public class HSSFFormulaEvaluator extend
/**
* @param workbook The workbook to perform the formula evaluations in
- * @param stabilityClassifier used to optimise caching performance. Pass <code>null</code>
+ * @param stabilityClassifier used to optimise caching performance. Pass {@code null}
* for the (conservative) assumption that any cell may have its definition changed after
* evaluation begins.
- * @param udfFinder pass <code>null</code> for default (AnalysisToolPak only)
+ * @param udfFinder pass {@code null} for default (AnalysisToolPak only)
*/
private HSSFFormulaEvaluator(HSSFWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) {
super(new WorkbookEvaluator(HSSFEvaluationWorkbook.create(workbook), stabilityClassifier, udfFinder));
@@ -72,15 +72,15 @@ public class HSSFFormulaEvaluator extend
/**
* @param workbook The workbook to perform the formula evaluations in
- * @param stabilityClassifier used to optimise caching performance. Pass <code>null</code>
+ * @param stabilityClassifier used to optimise caching performance. Pass {@code null}
* for the (conservative) assumption that any cell may have its definition changed after
* evaluation begins.
- * @param udfFinder pass <code>null</code> for default (AnalysisToolPak only)
+ * @param udfFinder pass {@code null} for default (AnalysisToolPak only)
*/
public static HSSFFormulaEvaluator create(HSSFWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) {
return new HSSFFormulaEvaluator(workbook, stabilityClassifier, udfFinder);
}
-
+
@Override
protected RichTextString createRichTextString(String str) {
return new HSSFRichTextString(str);
@@ -140,7 +140,7 @@ public class HSSFFormulaEvaluator extend
public void notifySetFormula(Cell cell) {
_bookEvaluator.notifyUpdateCell(new HSSFEvaluationCell((HSSFCell)cell));
}
-
+
@Override
public HSSFCell evaluateInCell(Cell cell) {
return (HSSFCell) super.evaluateInCell(cell);
@@ -196,6 +196,7 @@ public class HSSFFormulaEvaluator extend
* Returns a CellValue wrapper around the supplied ValueEval instance.
* @param cell The cell with the formula
*/
+ @Override
protected CellValue evaluateFormulaCellValue(Cell cell) {
ValueEval eval = _bookEvaluator.evaluate(new HSSFEvaluationCell((HSSFCell)cell));
if (eval instanceof BoolEval) {
@@ -216,13 +217,11 @@ public class HSSFFormulaEvaluator extend
throw new RuntimeException("Unexpected eval class (" + eval.getClass().getName() + ")");
}
- /** {@inheritDoc} */
@Override
public void setIgnoreMissingWorkbooks(boolean ignore){
_bookEvaluator.setIgnoreMissingWorkbooks(ignore);
}
- /** {@inheritDoc} */
@Override
public void setDebugEvaluationOutputForNextEval(boolean value){
_bookEvaluator.setDebugEvaluationOutputForNextEval(value);
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java Fri May 21 21:22:40 2021
@@ -66,9 +66,7 @@ public class HSSFHyperlink implements Hy
}
/**
- * Initialize the hyperlink by a <code>HyperlinkRecord</code> record
- *
- * @param record
+ * Initialize the hyperlink by a {@code HyperlinkRecord} record
*/
protected HSSFHyperlink( HyperlinkRecord record )
{
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPatternFormatting.java Fri May 21 21:22:40 2021
@@ -32,7 +32,7 @@ public class HSSFPatternFormatting imple
protected HSSFPatternFormatting(CFRuleBase cfRuleRecord, HSSFWorkbook workbook) {
this.workbook = workbook;
- this.cfRuleRecord = cfRuleRecord;
+ this.cfRuleRecord = cfRuleRecord;
this.patternFormatting = cfRuleRecord.getPatternFormatting();
}
@@ -41,10 +41,12 @@ public class HSSFPatternFormatting imple
return patternFormatting;
}
+ @Override
public HSSFColor getFillBackgroundColorColor() {
return workbook.getCustomPalette().getColor(getFillBackgroundColor());
}
+ @Override
public HSSFColor getFillForegroundColorColor() {
return workbook.getCustomPalette().getColor(getFillForegroundColor());
}
@@ -52,6 +54,7 @@ public class HSSFPatternFormatting imple
/**
* @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillBackgroundColor()
*/
+ @Override
public short getFillBackgroundColor()
{
return (short)patternFormatting.getFillBackgroundColor();
@@ -60,6 +63,7 @@ public class HSSFPatternFormatting imple
/**
* @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillForegroundColor()
*/
+ @Override
public short getFillForegroundColor()
{
return (short)patternFormatting.getFillForegroundColor();
@@ -68,11 +72,13 @@ public class HSSFPatternFormatting imple
/**
* @see org.apache.poi.hssf.record.cf.PatternFormatting#getFillPattern()
*/
+ @Override
public short getFillPattern()
{
return (short)patternFormatting.getFillPattern();
}
+ @Override
public void setFillBackgroundColor(Color bg) {
HSSFColor hcolor = HSSFColor.toHSSFColor(bg);
if (hcolor == null) {
@@ -82,6 +88,7 @@ public class HSSFPatternFormatting imple
}
}
+ @Override
public void setFillForegroundColor(Color fg) {
HSSFColor hcolor = HSSFColor.toHSSFColor(fg);
if (hcolor == null) {
@@ -92,9 +99,9 @@ public class HSSFPatternFormatting imple
}
/**
- * @param bg
* @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillBackgroundColor(int)
*/
+ @Override
public void setFillBackgroundColor(short bg)
{
patternFormatting.setFillBackgroundColor(bg);
@@ -105,9 +112,9 @@ public class HSSFPatternFormatting imple
}
/**
- * @param fg
* @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillForegroundColor(int)
*/
+ @Override
public void setFillForegroundColor(short fg)
{
patternFormatting.setFillForegroundColor(fg);
@@ -118,9 +125,9 @@ public class HSSFPatternFormatting imple
}
/**
- * @param fp
* @see org.apache.poi.hssf.record.cf.PatternFormatting#setFillPattern(int)
*/
+ @Override
public void setFillPattern(short fp)
{
patternFormatting.setFillPattern(fp);
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFPictureData.java Fri May 21 21:22:40 2021
@@ -42,7 +42,7 @@ public class HSSFPictureData implements
/**
* Underlying escher blip record containing the bitmap data.
*/
- private EscherBlipRecord blip;
+ private final EscherBlipRecord blip;
/**
* Constructs a picture object.
@@ -57,6 +57,7 @@ public class HSSFPictureData implements
/* (non-Javadoc)
* @see org.apache.poi.hssf.usermodel.PictureData#getData()
*/
+ @Override
public byte[] getData() {
return new ImageHeaderPNG(blip.getPicturedata()).extractPNG();
}
@@ -77,8 +78,9 @@ public class HSSFPictureData implements
/**
* @see #getFormat
- * @return 'wmf', 'jpeg' etc depending on the format. never <code>null</code>
+ * @return 'wmf', 'jpeg' etc depending on the format. never {@code null}
*/
+ @Override
public String suggestFileExtension() {
switch (EscherRecordTypes.forTypeID(blip.getRecordId())) {
case BLIP_WMF:
@@ -93,14 +95,17 @@ public class HSSFPictureData implements
return "jpeg";
case BLIP_DIB:
return "dib";
+ case BLIP_TIFF:
+ return "tif";
default:
return "";
}
}
-
+
/**
* Returns the mime type for the image
*/
+ @Override
public String getMimeType() {
switch (EscherRecordTypes.forTypeID(blip.getRecordId())) {
case BLIP_WMF:
@@ -115,11 +120,13 @@ public class HSSFPictureData implements
return "image/jpeg";
case BLIP_DIB:
return "image/bmp";
+ case BLIP_TIFF:
+ return "image/tiff";
default:
return "image/unknown";
}
}
-
+
/**
* @return the POI internal image type, 0 if unknown image type (was -1 prior to 5.0.0 but
* that was inconsistent with other {@link PictureData} implementations)
@@ -131,6 +138,7 @@ public class HSSFPictureData implements
* @see Workbook#PICTURE_TYPE_PNG
* @see Workbook#PICTURE_TYPE_WMF
*/
+ @Override
public int getPictureType() {
switch (EscherRecordTypes.forTypeID(blip.getRecordId())) {
case BLIP_WMF:
@@ -145,8 +153,10 @@ public class HSSFPictureData implements
return Workbook.PICTURE_TYPE_JPEG;
case BLIP_DIB:
return Workbook.PICTURE_TYPE_DIB;
+ case BLIP_TIFF:
+ // not another int constant ...
default:
return 0;
- }
+ }
}
}
Modified: poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java?rev=1890089&r1=1890088&r2=1890089&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRichTextString.java Fri May 21 21:22:40 2021
@@ -33,18 +33,18 @@ import org.apache.poi.ss.usermodel.RichT
* Note, that in certain cases creating too many HSSFRichTextString cells may cause Excel 2003 and lower to crash
* when changing the color of the cells and then saving the Excel file. Compare two snippets that produce equivalent output:
*
- * <p><blockquote><pre>
+ * <pre>{@code
* HSSFCell hssfCell = row.createCell(idx);
* //rich text consists of two runs
* HSSFRichTextString richString = new HSSFRichTextString( "Hello, World!" );
* richString.applyFont( 0, 6, font1 );
* richString.applyFont( 6, 13, font2 );
* hssfCell.setCellValue( richString );
- * </pre></blockquote>
+ * }</pre>
*
* and
*
- * <p><blockquote><pre>
+ * <pre>{@code
* //create a cell style and assign the first font to it
* HSSFCellStyle style = workbook.createCellStyle();
* style.setFont(font1);
@@ -56,7 +56,7 @@ import org.apache.poi.ss.usermodel.RichT
* HSSFRichTextString richString = new HSSFRichTextString( "Hello, World!" );
* richString.applyFont( 6, 13, font2 );
* hssfCell.setCellValue( richString );
- * </pre></blockquote><p>
+ * }</pre><p>
*
* Excel always uses the latter approach: for a reach text containing N runs Excel saves the font of the first run in the cell's
* style and subsequent N-1 runs override this font.
@@ -126,6 +126,7 @@ public final class HSSFRichTextString im
* @param endIndex The end index to apply the font to (exclusive)
* @param fontIndex The font to use.
*/
+ @Override
public void applyFont(int startIndex, int endIndex, short fontIndex) {
if (startIndex > endIndex)
throw new IllegalArgumentException("Start index must be less than end index.");
@@ -167,6 +168,7 @@ public final class HSSFRichTextString im
* @param endIndex The end index to apply to font to (exclusive)
* @param font The index of the font to use.
*/
+ @Override
public void applyFont(int startIndex, int endIndex, Font font) {
applyFont(startIndex, endIndex, (short)font.getIndex());
}
@@ -175,6 +177,7 @@ public final class HSSFRichTextString im
* Sets the font of the entire string.
* @param font The font to use.
*/
+ @Override
public void applyFont(Font font) {
applyFont(0, _string.getCharCount(), font);
}
@@ -182,6 +185,7 @@ public final class HSSFRichTextString im
/**
* Removes any formatting that may have been applied to the string.
*/
+ @Override
public void clearFormatting() {
_string = cloneStringIfRequired();
_string.clearFormatting();
@@ -191,6 +195,7 @@ public final class HSSFRichTextString im
/**
* Returns the plain string representation.
*/
+ @Override
public String getString() {
return _string.getString();
}
@@ -224,6 +229,7 @@ public final class HSSFRichTextString im
/**
* @return the number of characters in the text.
*/
+ @Override
public int length() {
return _string.getCharCount();
}
@@ -258,6 +264,7 @@ public final class HSSFRichTextString im
*
* @see #NO_FONT
*/
+ @Override
public int numFormattingRuns() {
return _string.getFormatRunCount();
}
@@ -267,6 +274,7 @@ public final class HSSFRichTextString im
* @param index the index of the formatting run
* @return the index within the string.
*/
+ @Override
public int getIndexOfFormattingRun(int index) {
FormatRun r = _string.getFormatRun(index);
return r.getCharacterPos();
@@ -286,6 +294,7 @@ public final class HSSFRichTextString im
/**
* Compares one rich text string to another.
*/
+ @Override
public int compareTo(HSSFRichTextString r) {
return _string.compareTo(r._string);
}
@@ -318,6 +327,7 @@ public final class HSSFRichTextString im
*
* @param fontIndex the font to apply.
*/
+ @Override
public void applyFont( short fontIndex ) {
applyFont(0, _string.getCharCount(), fontIndex);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org