add /* ====================================================================

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895476 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-12-01 19:26:11 +00:00
parent 02e9a7bdb4
commit 8538a7ee76
4 changed files with 45 additions and 16 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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;