Changed CRLF to LF in ooxml/java. Minor fixes for compiler warnings and formatting

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@776607 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2009-05-20 08:02:35 +00:00
parent 54a729eb7d
commit 7b5b57423f
56 changed files with 7716 additions and 7713 deletions

View File

@ -21,13 +21,13 @@ package org.apache.poi;
*
* @author Yegor Kozlov
*/
public class POIXMLException extends RuntimeException{
public final class POIXMLException extends RuntimeException{
/**
* Create a new <code>POIXMLException</code> with no
* detail mesage.
*/
public POIXMLException() {
super();
super();
}
/**
@ -37,7 +37,7 @@ public class POIXMLException extends RuntimeException{
* @param msg The error message for the exception.
*/
public POIXMLException(String msg) {
super(msg);
super(msg);
}
/**

View File

@ -19,7 +19,6 @@ package org.apache.poi;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.openxml4j.opc.PackagePart;
/**
* Defines a factory API that enables sub-classes to create instances of <code>POIXMLDocumentPart</code>
*

View File

@ -101,7 +101,7 @@ public abstract class POIXMLRelation {
/**
* Returns the filename for the nth one of these,
* eg /xl/comments4.xml
* e.g. /xl/comments4.xml
*/
public String getFileName(int index) {
if(_defaultName.indexOf("#") == -1) {

View File

@ -13,13 +13,12 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
====================================================================
*/
==================================================================== */
package org.apache.poi.openxml4j.exceptions;
@SuppressWarnings("serial")
public class InvalidFormatException extends OpenXML4JException{
public final class InvalidFormatException extends OpenXML4JException{
public InvalidFormatException(String message){
super(message);

View File

@ -24,7 +24,7 @@ package org.apache.poi.openxml4j.exceptions;
* @version 1.0
*/
@SuppressWarnings("serial")
public class InvalidOperationException extends OpenXML4JRuntimeException{
public final class InvalidOperationException extends OpenXML4JRuntimeException{
public InvalidOperationException(String message){
super(message);

View File

@ -21,10 +21,9 @@ package org.apache.poi.openxml4j.opc;
* Specifies the location where the X.509 certificate that is used in signing is stored.
*
* @author Julien Chable
* @version 1.0
*/
public enum CertificateEmbeddingOption {
/** The certificate is embedded in its own PackagePart. */
/** The certificate is embedded in its own PackagePart. */
IN_CERTIFICATE_PART,
/** The certificate is embedded in the SignaturePart that is created for the signature being added. */
IN_SIGNATURE_PART,

View File

@ -26,7 +26,7 @@ import java.io.File;
* @author CDubettier, Julen Chable
* @version 1.0
*/
public class Configuration {
public final class Configuration {
// TODO configuration by default. should be clearly stated that it should be
// changed to match installation path
// as schemas dir is needed in runtime

View File

@ -22,9 +22,8 @@ package org.apache.poi.openxml4j.opc;
* and Content Types).
*
* @author CDubettier define some constants, Julien Chable
* @version 0.1
*/
public class ContentTypes {
public final class ContentTypes {
/*
* Open Packaging Convention (Annex F : Standard Namespaces and Content
@ -86,7 +85,7 @@ public class ContentTypes {
* TIFF image format.
*
* @see <a href="http://partners.adobe.com/public/developer/tiff/index.html#spec">
* http://partners.adobe.com/public/developer/tiff/index.html#spec</a>
* http://partners.adobe.com/public/developer/tiff/index.html#spec</a>
*/
public static final String IMAGE_TIFF = "image/tiff";
@ -96,7 +95,7 @@ public class ContentTypes {
* Pict image format.
*
* @see <a href="http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-2.html">
* http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-2.html</a>
* http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-2.html</a>
*/
public static final String IMAGE_PICT = "image/pict";

View File

@ -27,7 +27,6 @@ import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
* An immutable Open Packaging Convention compliant part name.
*
* @author Julien Chable
* @version 0.1
*
* @see <a href="http://www.ietf.org/rfc/rfc3986.txt">http://www.ietf.org/rfc/rfc3986.txt</a>
*/
@ -267,9 +266,7 @@ public final class PackagePartName implements Comparable<PackagePartName> {
+ partUri.getPath());
}
/*
* Check for rule M1.6, M1.7, M1.8
*/
// Check for rule M1.6, M1.7, M1.8
checkPCharCompliance(seg);
}
}

View File

@ -21,7 +21,6 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@ -49,11 +48,10 @@ import org.apache.poi.util.POILogFactory;
* Physical zip package.
*
* @author Julien Chable
* @version 0.2
*/
public final class ZipPackage extends Package {
private static POILogger logger = POILogFactory.getLogger(ZipPackage.class);
private static POILogger logger = POILogFactory.getLogger(ZipPackage.class);
/**
* Zip archive, as either a file on disk,
@ -127,81 +125,79 @@ public final class ZipPackage extends Package {
if (this.zipArchive == null) {
return this.partList.values().toArray(
new PackagePart[this.partList.values().size()]);
} else {
// First we need to parse the content type part
Enumeration<? extends ZipEntry> entries = this.zipArchive.getEntries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
if (entry.getName().equals(
ContentTypeManager.CONTENT_TYPES_PART_NAME)) {
try {
this.contentTypeManager = new ZipContentTypeManager(
getZipArchive().getInputStream(entry), this);
} catch (IOException e) {
throw new InvalidFormatException(e.getMessage());
}
break;
}
}
// At this point, we should have loaded the content type part
if (this.contentTypeManager == null) {
throw new InvalidFormatException(
"Package should contain a content type part [M1.13]");
}
// Now create all the relationships
// (Need to create relationships before other
// parts, otherwise we might create a part before
// its relationship exists, and then it won't tie up)
entries = this.zipArchive.getEntries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
PackagePartName partName = buildPartName(entry);
if(partName == null) continue;
// Only proceed for Relationships at this stage
String contentType = contentTypeManager.getContentType(partName);
if (contentType != null && contentType.equals(ContentTypes.RELATIONSHIPS_PART)) {
try {
partList.put(partName, new ZipPackagePart(this, entry,
partName, contentType));
} catch (InvalidOperationException e) {
throw new InvalidFormatException(e.getMessage());
}
}
}
// Then we can go through all the other parts
entries = this.zipArchive.getEntries();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
PackagePartName partName = buildPartName(entry);
if(partName == null) continue;
String contentType = contentTypeManager
.getContentType(partName);
if (contentType != null && contentType.equals(ContentTypes.RELATIONSHIPS_PART)) {
// Already handled
}
else if (contentType != null) {
try {
partList.put(partName, new ZipPackagePart(this, entry,
partName, contentType));
} catch (InvalidOperationException e) {
throw new InvalidFormatException(e.getMessage());
}
} else {
throw new InvalidFormatException(
"The part "
+ partName.getURI().getPath()
+ " does not have any content type ! Rule: Package require content types when retrieving a part from a package. [M.1.14]");
}
}
return (ZipPackagePart[]) partList.values().toArray(
new ZipPackagePart[partList.size()]);
}
// First we need to parse the content type part
Enumeration<? extends ZipEntry> entries = this.zipArchive.getEntries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
if (entry.getName().equals(
ContentTypeManager.CONTENT_TYPES_PART_NAME)) {
try {
this.contentTypeManager = new ZipContentTypeManager(
getZipArchive().getInputStream(entry), this);
} catch (IOException e) {
throw new InvalidFormatException(e.getMessage());
}
break;
}
}
// At this point, we should have loaded the content type part
if (this.contentTypeManager == null) {
throw new InvalidFormatException(
"Package should contain a content type part [M1.13]");
}
// Now create all the relationships
// (Need to create relationships before other
// parts, otherwise we might create a part before
// its relationship exists, and then it won't tie up)
entries = this.zipArchive.getEntries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
PackagePartName partName = buildPartName(entry);
if(partName == null) continue;
// Only proceed for Relationships at this stage
String contentType = contentTypeManager.getContentType(partName);
if (contentType != null && contentType.equals(ContentTypes.RELATIONSHIPS_PART)) {
try {
partList.put(partName, new ZipPackagePart(this, entry,
partName, contentType));
} catch (InvalidOperationException e) {
throw new InvalidFormatException(e.getMessage());
}
}
}
// Then we can go through all the other parts
entries = this.zipArchive.getEntries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
PackagePartName partName = buildPartName(entry);
if(partName == null) continue;
String contentType = contentTypeManager
.getContentType(partName);
if (contentType != null && contentType.equals(ContentTypes.RELATIONSHIPS_PART)) {
// Already handled
}
else if (contentType != null) {
try {
partList.put(partName, new ZipPackagePart(this, entry,
partName, contentType));
} catch (InvalidOperationException e) {
throw new InvalidFormatException(e.getMessage());
}
} else {
throw new InvalidFormatException(
"The part "
+ partName.getURI().getPath()
+ " does not have any content type ! Rule: Package require content types when retrieving a part from a package. [M.1.14]");
}
}
return partList.values().toArray(new ZipPackagePart[partList.size()]);
}
/**
@ -215,10 +211,9 @@ public final class ZipPackage extends Package {
if (entry.getName().equals(
ContentTypeManager.CONTENT_TYPES_PART_NAME)) {
return null;
} else {
return PackagingURIHelper.createPartName(ZipHelper
.getOPCNameFromZipItemName(entry.getName()));
}
return PackagingURIHelper.createPartName(ZipHelper
.getOPCNameFromZipItemName(entry.getName()));
} catch (Exception e) {
// We assume we can continue, even in degraded mode ...
logger.log(POILogger.WARN,"Entry "

View File

@ -30,7 +30,7 @@ import org.apache.poi.openxml4j.opc.internal.PartMarshaller;
* @version 1.0
* @see PartMarshaller
*/
public class DefaultMarshaller implements PartMarshaller {
public final class DefaultMarshaller implements PartMarshaller {
/**
* Save part in the output stream by using the save() method of the part.

View File

@ -33,7 +33,6 @@ import org.apache.poi.openxml4j.opc.internal.PartMarshaller;
* Package properties marshaller.
*
* @author CDubet, Julien Chable
* @version 1.0
*/
public class PackagePropertiesMarshaller implements PartMarshaller {

View File

@ -31,9 +31,8 @@ import org.apache.poi.openxml4j.opc.internal.ZipHelper;
* Package core properties marshaller specialized for zipped package.
*
* @author Julien Chable
* @version 1.0
*/
public class ZipPackagePropertiesMarshaller extends PackagePropertiesMarshaller {
public final class ZipPackagePropertiesMarshaller extends PackagePropertiesMarshaller {
@Override
public boolean marshall(PackagePart part, OutputStream out)

View File

@ -47,10 +47,9 @@ import org.apache.poi.util.POILogFactory;
* Zip part marshaller. This marshaller is use to save any part in a zip stream.
*
* @author Julien Chable
* @version 0.1
*/
public class ZipPartMarshaller implements PartMarshaller {
private static POILogger logger = POILogFactory.getLogger(ZipPartMarshaller.class);
public final class ZipPartMarshaller implements PartMarshaller {
private static POILogger logger = POILogFactory.getLogger(ZipPartMarshaller.class);
/**
* Save the specified part.
@ -63,7 +62,7 @@ public class ZipPartMarshaller implements PartMarshaller {
if (!(os instanceof ZipOutputStream)) {
logger.log(POILogger.ERROR,"Unexpected class " + os.getClass().getName());
throw new OpenXML4JException("ZipOutputStream expected !");
// Normally should happen only in developpement phase, so just throw
// Normally should happen only in developement phase, so just throw
// exception
}
@ -83,9 +82,8 @@ public class ZipPartMarshaller implements PartMarshaller {
if (resultRead == -1) {
// End of file reached
break;
} else {
zos.write(buff, 0, resultRead);
}
zos.write(buff, 0, resultRead);
}
zos.closeEntry();
} catch (IOException ioe) {
@ -156,7 +154,7 @@ public class ZipPartMarshaller implements PartMarshaller {
if (rel.getTargetMode() == TargetMode.EXTERNAL) {
// Save the target as-is - we don't need to validate it,
// alter it etc
targetValue = uri.toString();
targetValue = uri.toString();
// add TargetMode attribute (as it is external link external)
relElem.addAttribute(

View File

@ -23,6 +23,6 @@ package org.apache.poi.openxml4j.opc.internal.signature;
* @author Julien Chable
* @version 0.1
*/
public class DigitalSignatureOriginPart {
public final class DigitalSignatureOriginPart {
}

View File

@ -46,7 +46,7 @@ import org.apache.poi.openxml4j.opc.internal.ZipHelper;
* @author Julien Chable
* @version 1.0
*/
public class PackagePropertiesUnmarshaller implements PartUnmarshaller {
public final class PackagePropertiesUnmarshaller implements PartUnmarshaller {
private final static Namespace namespaceDC = new Namespace("dc",
PackageProperties.NAMESPACE_DC);
@ -165,145 +165,145 @@ public class PackagePropertiesUnmarshaller implements PartUnmarshaller {
private String loadCategory(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_CATEGORY, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadContentStatus(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_CONTENT_STATUS, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadContentType(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_CONTENT_TYPE, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadCreated(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_CREATED, namespaceDcTerms));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadCreator(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_CREATOR, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadDescription(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_DESCRIPTION, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadIdentifier(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_IDENTIFIER, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadKeywords(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_KEYWORDS, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadLanguage(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_LANGUAGE, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadLastModifiedBy(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_LAST_MODIFIED_BY, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadLastPrinted(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_LAST_PRINTED, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadModified(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_MODIFIED, namespaceDcTerms));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadRevision(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_REVISION, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadSubject(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_SUBJECT, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadTitle(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_TITLE, namespaceDC));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
private String loadVersion(Document xmlDoc) {
Element el = xmlDoc.getRootElement().element(
new QName(KEYWORD_VERSION, namespaceCP));
if (el != null)
return el.getStringValue();
else
if (el == null) {
return null;
}
return el.getStringValue();
}
/* OPC Compliance methods */
@ -329,15 +329,16 @@ public class PackagePropertiesUnmarshaller implements PartUnmarshaller {
* and shall hold the value dcterms:W3CDTF, where dcterms is the namespace
* prefix of the Dublin Core namespace. Consumers shall consider a document
* element that violates this constraint to be an error.
* </p>
* </p>
*/
public void checkElementForOPCCompliance(Element el)
throws InvalidFormatException {
// Check the current element
List declaredNamespaces = el.declaredNamespaces();
Iterator itNS = declaredNamespaces.iterator();
@SuppressWarnings("unchecked")
List<Namespace> declaredNamespaces = el.declaredNamespaces();
Iterator<Namespace> itNS = declaredNamespaces.iterator();
while (itNS.hasNext()) {
Namespace ns = (Namespace) itNS.next();
Namespace ns = itNS.next();
// Rule M4.2
if (ns.getURI().equals(PackageNamespaces.MARKUP_COMPATIBILITY))
@ -384,8 +385,9 @@ public class PackagePropertiesUnmarshaller implements PartUnmarshaller {
}
// Check its children
Iterator itChildren = el.elementIterator();
@SuppressWarnings("unchecked")
Iterator<Element> itChildren = el.elementIterator();
while (itChildren.hasNext())
checkElementForOPCCompliance((Element) itChildren.next());
checkElementForOPCCompliance(itChildren.next());
}
}

View File

@ -26,7 +26,7 @@ import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.internal.ContentType;
public class PackageDigitalSignature extends PackagePart {
public final class PackageDigitalSignature extends PackagePart {
public PackageDigitalSignature() throws InvalidFormatException {
super(null, null, new ContentType(""));

View File

@ -17,6 +17,6 @@
package org.apache.poi.openxml4j.opc.signature;
public class PackageDigitalSignatureManager {
public final class PackageDigitalSignatureManager {
}

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.openxml4j.util;
/**

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.dev;
import org.apache.xmlbeans.XmlObject;
@ -31,7 +32,7 @@ import java.util.Enumeration;
*
* @author Yegor Kozlov
*/
public class XSSFDump {
public final class XSSFDump {
public static void main(String[] args) throws Exception {
for (int i = 0; i < args.length; i++) {

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.dev;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -26,7 +27,7 @@ import java.io.FileOutputStream;
*
* @author Yegor Kozlov
*/
public class XSSFSave {
public final class XSSFSave {
public static void main(String[] args) throws Exception {
for (int i = 0; i < args.length; i++) {
XSSFWorkbook wb = new XSSFWorkbook(args[i]);

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
/**

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
@ -23,7 +24,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D;
/**
* @author Yegor Kozlov
*/
public class XSSFChildAnchor extends XSSFAnchor {
public final class XSSFChildAnchor extends XSSFAnchor {
private CTTransform2D t2d;
public XSSFChildAnchor(int x, int y, int cx, int cy) {

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
@ -25,7 +26,7 @@ import org.apache.poi.ss.usermodel.ClientAnchor;
*
* @author Yegor Kozlov
*/
public class XSSFClientAnchor extends XSSFAnchor implements ClientAnchor {
public final class XSSFClientAnchor extends XSSFAnchor implements ClientAnchor {
private int anchorType;
/**

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
@ -25,7 +26,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.*;
*
* @author Yegor Kozlov
*/
public class XSSFConnector extends XSSFShape {
public final class XSSFConnector extends XSSFShape {
private static CTConnector prototype = null;

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.apache.poi.POIXMLDocumentPart;
@ -36,7 +37,7 @@ import java.util.HashMap;
*
* @author Yegor Kozlov
*/
public class XSSFDrawing extends POIXMLDocumentPart implements Drawing {
public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing {
/**
* Root element of the SpreadsheetML Drawing part
*/

View File

@ -68,16 +68,16 @@ public final class XSSFEvaluationWorkbook implements FormulaRenderingWorkbook, E
return convertToExternalSheetIndex(sheetIndex);
}
public EvaluationName getName(String name, int sheetIndex) {
for(int i=0; i < _uBook.getNumberOfNames(); i++) {
XSSFName nm = _uBook.getNameAt(i);
String nameText = nm.getNameName();
if (name.equalsIgnoreCase(nameText) && nm.getSheetIndex() == sheetIndex) {
return new Name(_uBook.getNameAt(i), i, this);
}
}
return sheetIndex == -1 ? null : getName(name, -1);
}
public EvaluationName getName(String name, int sheetIndex) {
for (int i = 0; i < _uBook.getNumberOfNames(); i++) {
XSSFName nm = _uBook.getNameAt(i);
String nameText = nm.getNameName();
if (name.equalsIgnoreCase(nameText) && nm.getSheetIndex() == sheetIndex) {
return new Name(_uBook.getNameAt(i), i, this);
}
}
return sheetIndex == -1 ? null : getName(name, -1);
}
public int getSheetIndex(EvaluationSheet evalSheet) {
XSSFSheet sheet = ((XSSFEvaluationSheet)evalSheet).getXSSFSheet();
@ -108,10 +108,10 @@ public final class XSSFEvaluationWorkbook implements FormulaRenderingWorkbook, E
return _uBook.getSheetIndex(sheetName);
}
/**
* TODO - figure out what the hell this methods does in
* HSSF...
*/
/**
* TODO - figure out what the hell this methods does in
* HSSF...
*/
public String resolveNameXText(NameXPtg n) {
throw new RuntimeException("method not implemented yet");
}
@ -174,7 +174,7 @@ public final class XSSFEvaluationWorkbook implements FormulaRenderingWorkbook, E
}
}
public SpreadsheetVersion getSpreadsheetVersion(){
return SpreadsheetVersion.EXCEL2007;
}
public SpreadsheetVersion getSpreadsheetVersion(){
return SpreadsheetVersion.EXCEL2007;
}
}

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.apache.poi.POIXMLDocumentPart;
@ -32,7 +33,7 @@ import java.lang.reflect.Constructor;
*
* @author Yegor Kozlov
*/
public class XSSFFactory extends POIXMLFactory {
public final class XSSFFactory extends POIXMLFactory {
private static POILogger logger = POILogFactory.getLogger(XSSFFactory.class);
private XSSFFactory(){

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
@ -41,7 +42,7 @@ import java.util.Iterator;
*
* @author Yegor Kozlov
*/
public class XSSFPicture extends XSSFShape implements Picture {
public final class XSSFPicture extends XSSFShape implements Picture {
private static final POILogger logger = POILogFactory.getLogger(XSSFPicture.class);
/**

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.main.*;

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
@ -28,7 +29,7 @@ import org.apache.poi.openxml4j.opc.PackageRelationship;
*
* @author Yegor Kozlov
*/
public class XSSFShapeGroup extends XSSFShape {
public final class XSSFShapeGroup extends XSSFShape {
private static CTGroupShape prototype = null;
private CTGroupShape ctGroup;

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape;
@ -27,7 +28,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
*
* @author Yegor Kozlov
*/
public class XSSFSimpleShape extends XSSFShape {
public class XSSFSimpleShape extends XSSFShape { // TODO - instantiable superclass
/**
* A default instance of CTShape used for creating new shapes.
*/

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
@ -23,10 +24,9 @@ import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.*;
*
* @author Yegor Kozlov
*/
public class XSSFTextBox extends XSSFSimpleShape {
public final class XSSFTextBox extends XSSFSimpleShape {
protected XSSFTextBox(XSSFDrawing drawing, CTShape ctShape) {
super(drawing, ctShape);
}
}

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.usermodel.helpers;
import org.apache.poi.xssf.usermodel.*;
@ -34,7 +35,7 @@ import java.util.ArrayList;
/**
* @author Yegor Kozlov
*/
public class XSSFRowShifter {
public final class XSSFRowShifter {
private final XSSFSheet sheet;
public XSSFRowShifter(XSSFSheet sh) {

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xwpf.usermodel;
import java.util.HashMap;
@ -601,26 +602,25 @@ public enum Borders {
private final int value;
private Borders(int val) {
value = val;
value = val;
}
public int getValue() {
return value;
return value;
}
private static Map<Integer, Borders> imap = new HashMap<Integer, Borders>();
static {
for (Borders p : values()) {
imap.put(p.getValue(), p);
}
for (Borders p : values()) {
imap.put(new Integer(p.getValue()), p);
}
}
public static Borders valueOf(int type) {
Borders pBorder = imap.get(type);
if (pBorder == null)
throw new IllegalArgumentException("Unknown paragraph border: "
+ type);
return pBorder;
Borders pBorder = imap.get(new Integer(type));
if (pBorder == null) {
throw new IllegalArgumentException("Unknown paragraph border: " + type);
}
return pBorder;
}
}

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xwpf.usermodel;
import java.util.Map;

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xwpf.usermodel;
import org.apache.poi.POIXMLFactory;
@ -30,7 +31,7 @@ import java.lang.reflect.Constructor;
/**
* @author Yegor Kozlov
*/
public class XWPFFactory extends POIXMLFactory {
public final class XWPFFactory extends POIXMLFactory {
private static POILogger logger = POILogFactory.getLogger(XWPFFactory.class);

View File

@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xwpf.usermodel;
import org.apache.poi.POIXMLRelation;
@ -25,7 +26,7 @@ import java.util.HashMap;
/**
* @author Yegor Kozlov
*/
public class XWPFRelation extends POIXMLRelation {
public final class XWPFRelation extends POIXMLRelation {
/**
* A map to lookup POIXMLRelation by its relation type