org.apache.poi.xssf.streaming.SXSSFDrawing Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apache-poi-ooxml Show documentation
Show all versions of apache-poi-ooxml Show documentation
The Apache Commons Codec package contains simple encoder and decoders for
various formats such as Base64 and Hexadecimal. In addition to these
widely used encoders and decoders, the codec package also maintains a
collection of phonetic encoding utilities.
/* ====================================================================
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.streaming;
import java.util.Iterator;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.Comment;
import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.ss.usermodel.ObjectData;
import org.apache.poi.xssf.usermodel.XSSFDrawing;
import org.apache.poi.xssf.usermodel.XSSFPicture;
import org.apache.poi.xssf.usermodel.XSSFShape;
/**
* Streaming version of Drawing.
* Delegates most tasks to the non-streaming XSSF code.
* TODO: Potentially, Comment and Chart need a similar streaming wrapper like Picture.
*/
public class SXSSFDrawing implements Drawing {
private final SXSSFWorkbook _wb;
private final XSSFDrawing _drawing;
public SXSSFDrawing(SXSSFWorkbook workbook, XSSFDrawing drawing) {
this._wb = workbook;
this._drawing = drawing;
}
@Override
public SXSSFPicture createPicture(ClientAnchor anchor, int pictureIndex) {
XSSFPicture pict = _drawing.createPicture(anchor, pictureIndex);
return new SXSSFPicture(_wb, pict);
}
@Override
public Comment createCellComment(ClientAnchor anchor) {
return _drawing.createCellComment(anchor);
}
@Override
public ClientAnchor createAnchor(int dx1, int dy1, int dx2, int dy2, int col1, int row1, int col2, int row2) {
return _drawing.createAnchor(dx1, dy1, dx2, dy2, col1, row1, col2, row2);
}
@Override
public ObjectData createObjectData(ClientAnchor anchor, int storageId, int pictureIndex) {
return _drawing.createObjectData(anchor, storageId, pictureIndex);
}
@Override
public Iterator iterator() {
return _drawing.getShapes().iterator();
}
}