diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-12-01 19:26:11 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-12-01 19:26:11 +0000 |
commit | 8538a7ee760633fa7565a74bbd41a89422620839 (patch) | |
tree | 2aca9615768646b11be95243de622a917ff3865a /poi-ooxml | |
parent | 02e9a7bdb4ffed73baf0f7cf4f8144eae0a21fe5 (diff) | |
download | poi-8538a7ee760633fa7565a74bbd41a89422620839.tar.gz poi-8538a7ee760633fa7565a74bbd41a89422620839.zip |
add /* ====================================================================
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895476 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
4 files changed, 45 insertions, 16 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/model/CommentsTable.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/model/CommentsTable.java index ab555cb346..dee0fd49c4 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/model/CommentsTable.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/model/CommentsTable.java @@ -34,11 +34,7 @@ import org.apache.poi.ss.util.CellAddress; import org.apache.poi.util.Internal; import org.apache.poi.util.Removal; import org.apache.poi.util.Units; -import org.apache.poi.xssf.streaming.SXSSFSheet; -import org.apache.poi.xssf.usermodel.XSSFClientAnchor; -import org.apache.poi.xssf.usermodel.XSSFComment; -import org.apache.poi.xssf.usermodel.XSSFSheet; -import org.apache.poi.xssf.usermodel.XSSFVMLDrawing; +import org.apache.poi.xssf.usermodel.*; import org.apache.xmlbeans.XmlException; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCommentList; @@ -339,10 +335,8 @@ public class CommentsTable extends POIXMLDocumentPart implements Comments { private XSSFVMLDrawing getVMLDrawing(Sheet sheet, boolean autocreate) { if (vmlDrawing == null) { - if (sheet instanceof XSSFSheet) { - vmlDrawing = ((XSSFSheet)sheet).getVMLDrawing(autocreate); - } else if (sheet instanceof SXSSFSheet) { - vmlDrawing = ((SXSSFSheet)sheet).getVMLDrawing(autocreate); + if (sheet instanceof OoxmlSheetExtensions) { + vmlDrawing = ((OoxmlSheetExtensions)sheet).getVMLDrawing(autocreate); } } return vmlDrawing; diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java index 37d0ca5c4b..a29ce60499 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java @@ -57,8 +57,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet; /** * Streaming version of XSSFSheet implementing the "BigGridDemo" strategy. */ -public class SXSSFSheet implements Sheet -{ +public class SXSSFSheet implements Sheet, OoxmlSheetExtensions { /*package*/ final XSSFSheet _sh; protected final SXSSFWorkbook _workbook; private final TreeMap<Integer,SXSSFRow> _rows = new TreeMap<>(); @@ -345,14 +344,13 @@ public class SXSSFSheet implements Sheet /** - * Get VML drawing for this sheet (aka 'legacy' drawing). This method is for internal POI use only. + * Get VML drawing for this sheet (aka 'legacy' drawing). * * @param autoCreate if true, then a new VML drawing part is created * * @return the VML drawing of {@code null} if the drawing was not found and autoCreate=false * @since POI 5.2.0 */ - @Internal public XSSFVMLDrawing getVMLDrawing(boolean autoCreate) { XSSFSheet xssfSheet = getWorkbook().getXSSFSheet(this); return xssfSheet == null ? null : xssfSheet.getVMLDrawing(autoCreate); diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/OoxmlSheetExtensions.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/OoxmlSheetExtensions.java new file mode 100644 index 0000000000..6d5d33582a --- /dev/null +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/OoxmlSheetExtensions.java @@ -0,0 +1,37 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.xssf.usermodel; + +import org.apache.poi.ss.usermodel.Sheet; + +/** + * Methods exposed by XSSF, SXSSF and related sheets - that are additional to the ones on the {@link Sheet} interface. + * + * @since POI 5.2.0 + */ +public interface OoxmlSheetExtensions { + /** + * Get VML drawing for this sheet (aka 'legacy' drawing). + * + * @param autoCreate if true, then a new VML drawing part is created + * + * @return the VML drawing or {@code null} if the drawing was not found and autoCreate=false + * (or this method is not implemented) + */ + XSSFVMLDrawing getVMLDrawing(boolean autoCreate); +} diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index dfb586c325..b2696643ca 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -77,7 +77,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.*; * contain text, numbers, dates, and formulas. Cells can also be formatted. * </p> */ -public class XSSFSheet extends POIXMLDocumentPart implements Sheet { +public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetExtensions { private static final Logger LOG = LogManager.getLogger(XSSFSheet.class); private static final double DEFAULT_ROW_HEIGHT = 15.0; @@ -560,13 +560,13 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { } /** - * Get VML drawing for this sheet (aka 'legacy' drawing). This method is for internal POI use only. + * Get VML drawing for this sheet (aka 'legacy' drawing). * * @param autoCreate if true, then a new VML drawing part is created * * @return the VML drawing of {@code null} if the drawing was not found and autoCreate=false */ - @Internal + @Override public XSSFVMLDrawing getVMLDrawing(boolean autoCreate) { if (xssfvmlDrawing == null) { XSSFVMLDrawing drawing = null; |