fixed compiler warnings. added some TODO comments
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@744257 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
521656d9c2
commit
7c870ecd41
@ -57,7 +57,7 @@ public class HSSFComment extends HSSFTextbox implements Comment {
|
|||||||
setShapeType(OBJECT_TYPE_COMMENT);
|
setShapeType(OBJECT_TYPE_COMMENT);
|
||||||
|
|
||||||
//default color for comments
|
//default color for comments
|
||||||
fillColor = 0x08000050;
|
_fillColor = 0x08000050;
|
||||||
|
|
||||||
//by default comments are hidden
|
//by default comments are hidden
|
||||||
_visible = false;
|
_visible = false;
|
||||||
|
@ -35,32 +35,29 @@ import org.apache.poi.ss.usermodel.ClientAnchor;
|
|||||||
*
|
*
|
||||||
* @author Glen Stampoultzis (glens at apache.org)
|
* @author Glen Stampoultzis (glens at apache.org)
|
||||||
*/
|
*/
|
||||||
public class HSSFPatriarch
|
public final class HSSFPatriarch implements HSSFShapeContainer, Drawing {
|
||||||
implements HSSFShapeContainer, Drawing
|
private final List<HSSFShape> _shapes = new ArrayList<HSSFShape>();
|
||||||
{
|
private int _x1 = 0;
|
||||||
List shapes = new ArrayList();
|
private int _y1 = 0 ;
|
||||||
HSSFSheet sheet;
|
private int _x2 = 1023;
|
||||||
int x1 = 0;
|
private int _y2 = 255;
|
||||||
int y1 = 0 ;
|
|
||||||
int x2 = 1023;
|
|
||||||
int y2 = 255;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The EscherAggregate we have been bound to.
|
* The EscherAggregate we have been bound to.
|
||||||
* (This will handle writing us out into records,
|
* (This will handle writing us out into records,
|
||||||
* and building up our shapes from the records)
|
* and building up our shapes from the records)
|
||||||
*/
|
*/
|
||||||
private EscherAggregate boundAggregate;
|
private EscherAggregate _boundAggregate;
|
||||||
|
final HSSFSheet _sheet; // TODO make private
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the patriarch.
|
* Creates the patriarch.
|
||||||
*
|
*
|
||||||
* @param sheet the sheet this patriarch is stored in.
|
* @param sheet the sheet this patriarch is stored in.
|
||||||
*/
|
*/
|
||||||
HSSFPatriarch(HSSFSheet sheet, EscherAggregate boundAggregate)
|
HSSFPatriarch(HSSFSheet sheet, EscherAggregate boundAggregate){
|
||||||
{
|
_sheet = sheet;
|
||||||
this.boundAggregate = boundAggregate;
|
_boundAggregate = boundAggregate;
|
||||||
this.sheet = sheet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +71,7 @@ public class HSSFPatriarch
|
|||||||
{
|
{
|
||||||
HSSFShapeGroup group = new HSSFShapeGroup(null, anchor);
|
HSSFShapeGroup group = new HSSFShapeGroup(null, anchor);
|
||||||
group.anchor = anchor;
|
group.anchor = anchor;
|
||||||
shapes.add(group);
|
_shapes.add(group);
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +87,7 @@ public class HSSFPatriarch
|
|||||||
{
|
{
|
||||||
HSSFSimpleShape shape = new HSSFSimpleShape(null, anchor);
|
HSSFSimpleShape shape = new HSSFSimpleShape(null, anchor);
|
||||||
shape.anchor = anchor;
|
shape.anchor = anchor;
|
||||||
shapes.add(shape);
|
_shapes.add(shape);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +103,8 @@ public class HSSFPatriarch
|
|||||||
HSSFPicture shape = new HSSFPicture(null, anchor);
|
HSSFPicture shape = new HSSFPicture(null, anchor);
|
||||||
shape.setPictureIndex( pictureIndex );
|
shape.setPictureIndex( pictureIndex );
|
||||||
shape.anchor = anchor;
|
shape.anchor = anchor;
|
||||||
shape.patriarch = this;
|
shape._patriarch = this;
|
||||||
shapes.add(shape);
|
_shapes.add(shape);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
public HSSFPicture createPicture(ClientAnchor anchor, int pictureIndex)
|
public HSSFPicture createPicture(ClientAnchor anchor, int pictureIndex)
|
||||||
@ -126,7 +123,7 @@ public class HSSFPatriarch
|
|||||||
{
|
{
|
||||||
HSSFPolygon shape = new HSSFPolygon(null, anchor);
|
HSSFPolygon shape = new HSSFPolygon(null, anchor);
|
||||||
shape.anchor = anchor;
|
shape.anchor = anchor;
|
||||||
shapes.add(shape);
|
_shapes.add(shape);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +138,7 @@ public class HSSFPatriarch
|
|||||||
{
|
{
|
||||||
HSSFTextbox shape = new HSSFTextbox(null, anchor);
|
HSSFTextbox shape = new HSSFTextbox(null, anchor);
|
||||||
shape.anchor = anchor;
|
shape.anchor = anchor;
|
||||||
shapes.add(shape);
|
_shapes.add(shape);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,41 +153,38 @@ public class HSSFPatriarch
|
|||||||
{
|
{
|
||||||
HSSFComment shape = new HSSFComment(null, anchor);
|
HSSFComment shape = new HSSFComment(null, anchor);
|
||||||
shape.anchor = anchor;
|
shape.anchor = anchor;
|
||||||
shapes.add(shape);
|
_shapes.add(shape);
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of all shapes contained by the patriarch.
|
* Returns a list of all shapes contained by the patriarch.
|
||||||
*/
|
*/
|
||||||
public List getChildren()
|
public List<HSSFShape> getChildren()
|
||||||
{
|
{
|
||||||
return shapes;
|
return _shapes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Total count of all children and their children's children.
|
* Total count of all children and their children's children.
|
||||||
*/
|
*/
|
||||||
public int countOfAllChildren()
|
public int countOfAllChildren() {
|
||||||
{
|
int count = _shapes.size();
|
||||||
int count = shapes.size();
|
for (Iterator<HSSFShape> iterator = _shapes.iterator(); iterator.hasNext();) {
|
||||||
for ( Iterator iterator = shapes.iterator(); iterator.hasNext(); )
|
HSSFShape shape = iterator.next();
|
||||||
{
|
|
||||||
HSSFShape shape = (HSSFShape) iterator.next();
|
|
||||||
count += shape.countOfAllChildren();
|
count += shape.countOfAllChildren();
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Sets the coordinate space of this group. All children are contrained
|
* Sets the coordinate space of this group. All children are constrained
|
||||||
* to these coordinates.
|
* to these coordinates.
|
||||||
*/
|
*/
|
||||||
public void setCoordinates( int x1, int y1, int x2, int y2 )
|
public void setCoordinates(int x1, int y1, int x2, int y2){
|
||||||
{
|
_x1 = x1;
|
||||||
this.x1 = x1;
|
_y1 = y1;
|
||||||
this.y1 = y1;
|
_x2 = x2;
|
||||||
this.x2 = x2;
|
_y2 = y2;
|
||||||
this.y2 = y2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -205,18 +199,18 @@ public class HSSFPatriarch
|
|||||||
|
|
||||||
// We're looking for a EscherOptRecord
|
// We're looking for a EscherOptRecord
|
||||||
EscherOptRecord optRecord = (EscherOptRecord)
|
EscherOptRecord optRecord = (EscherOptRecord)
|
||||||
boundAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
|
_boundAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
|
||||||
if(optRecord == null) {
|
if(optRecord == null) {
|
||||||
// No opt record, can't have chart
|
// No opt record, can't have chart
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Iterator it = optRecord.getEscherProperties().iterator(); it.hasNext();) {
|
for(Iterator<EscherProperty> it = optRecord.getEscherProperties().iterator(); it.hasNext();) {
|
||||||
EscherProperty prop = (EscherProperty)it.next();
|
EscherProperty prop = it.next();
|
||||||
if(prop.getPropertyNumber() == 896 && prop.isComplex()) {
|
if(prop.getPropertyNumber() == 896 && prop.isComplex()) {
|
||||||
EscherComplexProperty cp = (EscherComplexProperty)prop;
|
EscherComplexProperty cp = (EscherComplexProperty)prop;
|
||||||
String str = StringUtil.getFromUnicodeLE(cp.getComplexData());
|
String str = StringUtil.getFromUnicodeLE(cp.getComplexData());
|
||||||
//System.err.println(str);
|
|
||||||
if(str.equals("Chart 1\0")) {
|
if(str.equals("Chart 1\0")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -231,7 +225,7 @@ public class HSSFPatriarch
|
|||||||
*/
|
*/
|
||||||
public int getX1()
|
public int getX1()
|
||||||
{
|
{
|
||||||
return x1;
|
return _x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,7 +233,7 @@ public class HSSFPatriarch
|
|||||||
*/
|
*/
|
||||||
public int getY1()
|
public int getY1()
|
||||||
{
|
{
|
||||||
return y1;
|
return _y1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -247,7 +241,7 @@ public class HSSFPatriarch
|
|||||||
*/
|
*/
|
||||||
public int getX2()
|
public int getX2()
|
||||||
{
|
{
|
||||||
return x2;
|
return _x2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,13 +249,13 @@ public class HSSFPatriarch
|
|||||||
*/
|
*/
|
||||||
public int getY2()
|
public int getY2()
|
||||||
{
|
{
|
||||||
return y2;
|
return _y2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the aggregate escher record we're bound to
|
* Returns the aggregate escher record we're bound to
|
||||||
*/
|
*/
|
||||||
protected EscherAggregate _getBoundAggregate() {
|
protected EscherAggregate _getBoundAggregate() {
|
||||||
return boundAggregate;
|
return _boundAggregate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
/*
|
/* ====================================================================
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
* this work for additional information regarding copyright ownership.
|
this work for additional information regarding copyright ownership.
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
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 not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at
|
the License. You may obtain a copy of the License at
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
limitations under the License.
|
||||||
*/
|
==================================================================== */
|
||||||
|
|
||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.ddf.EscherBSERecord;
|
import org.apache.poi.ddf.EscherBSERecord;
|
||||||
@ -38,9 +39,7 @@ import java.util.Iterator;
|
|||||||
* @author Glen Stampoultzis
|
* @author Glen Stampoultzis
|
||||||
* @author Yegor Kozlov (yegor at apache.org)
|
* @author Yegor Kozlov (yegor at apache.org)
|
||||||
*/
|
*/
|
||||||
public class HSSFPicture
|
public final class HSSFPicture extends HSSFSimpleShape implements Picture {
|
||||||
extends HSSFSimpleShape implements Picture
|
|
||||||
{
|
|
||||||
public static final int PICTURE_TYPE_EMF = HSSFWorkbook.PICTURE_TYPE_EMF; // Windows Enhanced Metafile
|
public static final int PICTURE_TYPE_EMF = HSSFWorkbook.PICTURE_TYPE_EMF; // Windows Enhanced Metafile
|
||||||
public static final int PICTURE_TYPE_WMF = HSSFWorkbook.PICTURE_TYPE_WMF; // Windows Metafile
|
public static final int PICTURE_TYPE_WMF = HSSFWorkbook.PICTURE_TYPE_WMF; // Windows Metafile
|
||||||
public static final int PICTURE_TYPE_PICT = HSSFWorkbook.PICTURE_TYPE_PICT; // Macintosh PICT
|
public static final int PICTURE_TYPE_PICT = HSSFWorkbook.PICTURE_TYPE_PICT; // Macintosh PICT
|
||||||
@ -62,8 +61,8 @@ public class HSSFPicture
|
|||||||
*/
|
*/
|
||||||
private static final int PX_ROW = 15;
|
private static final int PX_ROW = 15;
|
||||||
|
|
||||||
int pictureIndex;
|
private int _pictureIndex;
|
||||||
HSSFPatriarch patriarch;
|
HSSFPatriarch _patriarch; // TODO make private
|
||||||
|
|
||||||
private static final POILogger log = POILogFactory.getLogger(HSSFPicture.class);
|
private static final POILogger log = POILogFactory.getLogger(HSSFPicture.class);
|
||||||
|
|
||||||
@ -78,12 +77,12 @@ public class HSSFPicture
|
|||||||
|
|
||||||
public int getPictureIndex()
|
public int getPictureIndex()
|
||||||
{
|
{
|
||||||
return pictureIndex;
|
return _pictureIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPictureIndex( int pictureIndex )
|
public void setPictureIndex( int pictureIndex )
|
||||||
{
|
{
|
||||||
this.pictureIndex = pictureIndex;
|
this._pictureIndex = pictureIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,7 +184,7 @@ public class HSSFPicture
|
|||||||
|
|
||||||
private float getColumnWidthInPixels(int column){
|
private float getColumnWidthInPixels(int column){
|
||||||
|
|
||||||
int cw = patriarch.sheet.getColumnWidth(column);
|
int cw = _patriarch._sheet.getColumnWidth(column);
|
||||||
float px = getPixelWidth(column);
|
float px = getPixelWidth(column);
|
||||||
|
|
||||||
return cw/px;
|
return cw/px;
|
||||||
@ -193,18 +192,18 @@ public class HSSFPicture
|
|||||||
|
|
||||||
private float getRowHeightInPixels(int i){
|
private float getRowHeightInPixels(int i){
|
||||||
|
|
||||||
HSSFRow row = patriarch.sheet.getRow(i);
|
HSSFRow row = _patriarch._sheet.getRow(i);
|
||||||
float height;
|
float height;
|
||||||
if(row != null) height = row.getHeight();
|
if(row != null) height = row.getHeight();
|
||||||
else height = patriarch.sheet.getDefaultRowHeight();
|
else height = _patriarch._sheet.getDefaultRowHeight();
|
||||||
|
|
||||||
return height/PX_ROW;
|
return height/PX_ROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getPixelWidth(int column){
|
private float getPixelWidth(int column){
|
||||||
|
|
||||||
int def = patriarch.sheet.getDefaultColumnWidth()*256;
|
int def = _patriarch._sheet.getDefaultColumnWidth()*256;
|
||||||
int cw = patriarch.sheet.getColumnWidth(column);
|
int cw = _patriarch._sheet.getColumnWidth(column);
|
||||||
|
|
||||||
return cw == def ? PX_DEFAULT : PX_MODIFIED;
|
return cw == def ? PX_DEFAULT : PX_MODIFIED;
|
||||||
}
|
}
|
||||||
@ -238,7 +237,7 @@ public class HSSFPicture
|
|||||||
* @return image dimension
|
* @return image dimension
|
||||||
*/
|
*/
|
||||||
public Dimension getImageDimension(){
|
public Dimension getImageDimension(){
|
||||||
EscherBSERecord bse = patriarch.sheet.book.getBSERecord(pictureIndex);
|
EscherBSERecord bse = _patriarch._sheet._book.getBSERecord(_pictureIndex);
|
||||||
byte[] data = bse.getBlipRecord().getPicturedata();
|
byte[] data = bse.getBlipRecord().getPicturedata();
|
||||||
int type = bse.getBlipTypeWin32();
|
int type = bse.getBlipTypeWin32();
|
||||||
Dimension size = new Dimension();
|
Dimension size = new Dimension();
|
||||||
@ -252,8 +251,8 @@ public class HSSFPicture
|
|||||||
try {
|
try {
|
||||||
//read the image using javax.imageio.*
|
//read the image using javax.imageio.*
|
||||||
ImageInputStream iis = ImageIO.createImageInputStream( new ByteArrayInputStream(data) );
|
ImageInputStream iis = ImageIO.createImageInputStream( new ByteArrayInputStream(data) );
|
||||||
Iterator i = ImageIO.getImageReaders( iis );
|
Iterator<ImageReader> i = ImageIO.getImageReaders( iis );
|
||||||
ImageReader r = (ImageReader) i.next();
|
ImageReader r = i.next();
|
||||||
r.setInput( iis );
|
r.setInput( iis );
|
||||||
BufferedImage img = r.read(0);
|
BufferedImage img = r.read(0);
|
||||||
|
|
||||||
|
@ -22,8 +22,7 @@ package org.apache.poi.hssf.usermodel;
|
|||||||
*
|
*
|
||||||
* @author Glen Stampoultzis (glens at apache.org)
|
* @author Glen Stampoultzis (glens at apache.org)
|
||||||
*/
|
*/
|
||||||
public abstract class HSSFShape
|
public abstract class HSSFShape {
|
||||||
{
|
|
||||||
public static final int LINEWIDTH_ONE_PT = 12700;
|
public static final int LINEWIDTH_ONE_PT = 12700;
|
||||||
public static final int LINEWIDTH_DEFAULT = 9525;
|
public static final int LINEWIDTH_DEFAULT = 9525;
|
||||||
|
|
||||||
@ -40,13 +39,14 @@ public abstract class HSSFShape
|
|||||||
public static final int LINESTYLE_LONGDASHDOTDOTGEL = 10; // long dash short dash short dash
|
public static final int LINESTYLE_LONGDASHDOTDOTGEL = 10; // long dash short dash short dash
|
||||||
public static final int LINESTYLE_NONE = -1;
|
public static final int LINESTYLE_NONE = -1;
|
||||||
|
|
||||||
HSSFShape parent;
|
// TODO - make all these fields private
|
||||||
|
final HSSFShape parent;
|
||||||
HSSFAnchor anchor;
|
HSSFAnchor anchor;
|
||||||
int lineStyleColor = 0x08000040;
|
private int _lineStyleColor = 0x08000040;
|
||||||
int fillColor = 0x08000009;
|
int _fillColor = 0x08000009;
|
||||||
int lineWidth = LINEWIDTH_DEFAULT; // 12700 = 1pt
|
private int _lineWidth = LINEWIDTH_DEFAULT; // 12700 = 1pt
|
||||||
int lineStyle = LINESTYLE_SOLID;
|
private int _lineStyle = LINESTYLE_SOLID;
|
||||||
boolean noFill = false;
|
private boolean _noFill = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new shape with the specified parent and anchor.
|
* Create a new shape with the specified parent and anchor.
|
||||||
@ -103,25 +103,22 @@ public abstract class HSSFShape
|
|||||||
/**
|
/**
|
||||||
* The color applied to the lines of this shape.
|
* The color applied to the lines of this shape.
|
||||||
*/
|
*/
|
||||||
public int getLineStyleColor()
|
public int getLineStyleColor() {
|
||||||
{
|
return _lineStyleColor;
|
||||||
return lineStyleColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color applied to the lines of this shape.
|
* The color applied to the lines of this shape.
|
||||||
*/
|
*/
|
||||||
public void setLineStyleColor( int lineStyleColor )
|
public void setLineStyleColor(int lineStyleColor) {
|
||||||
{
|
_lineStyleColor = lineStyleColor;
|
||||||
this.lineStyleColor = lineStyleColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color applied to the lines of this shape.
|
* The color applied to the lines of this shape.
|
||||||
*/
|
*/
|
||||||
public void setLineStyleColor( int red, int green, int blue )
|
public void setLineStyleColor(int red, int green, int blue) {
|
||||||
{
|
this._lineStyleColor = ((blue) << 16) | ((green) << 8) | red;
|
||||||
this.lineStyleColor = ((blue) << 16) | ((green) << 8) | red;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,15 +126,14 @@ public abstract class HSSFShape
|
|||||||
*/
|
*/
|
||||||
public int getFillColor()
|
public int getFillColor()
|
||||||
{
|
{
|
||||||
return fillColor;
|
return _fillColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color used to fill this shape.
|
* The color used to fill this shape.
|
||||||
*/
|
*/
|
||||||
public void setFillColor( int fillColor )
|
public void setFillColor(int fillColor) {
|
||||||
{
|
_fillColor = fillColor;
|
||||||
this.fillColor = fillColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,15 +141,14 @@ public abstract class HSSFShape
|
|||||||
*/
|
*/
|
||||||
public void setFillColor( int red, int green, int blue )
|
public void setFillColor( int red, int green, int blue )
|
||||||
{
|
{
|
||||||
this.fillColor = ((blue) << 16) | ((green) << 8) | red;
|
this._fillColor = ((blue) << 16) | ((green) << 8) | red;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return returns with width of the line in EMUs. 12700 = 1 pt.
|
* @return returns with width of the line in EMUs. 12700 = 1 pt.
|
||||||
*/
|
*/
|
||||||
public int getLineWidth()
|
public int getLineWidth() {
|
||||||
{
|
return _lineWidth;
|
||||||
return lineWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -163,17 +158,15 @@ public abstract class HSSFShape
|
|||||||
*
|
*
|
||||||
* @see HSSFShape#LINEWIDTH_ONE_PT
|
* @see HSSFShape#LINEWIDTH_ONE_PT
|
||||||
*/
|
*/
|
||||||
public void setLineWidth( int lineWidth )
|
public void setLineWidth(int lineWidth) {
|
||||||
{
|
_lineWidth = lineWidth;
|
||||||
this.lineWidth = lineWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return One of the constants in LINESTYLE_*
|
* @return One of the constants in LINESTYLE_*
|
||||||
*/
|
*/
|
||||||
public int getLineStyle()
|
public int getLineStyle() {
|
||||||
{
|
return _lineStyle;
|
||||||
return lineStyle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,32 +174,28 @@ public abstract class HSSFShape
|
|||||||
*
|
*
|
||||||
* @param lineStyle One of the constants in LINESTYLE_*
|
* @param lineStyle One of the constants in LINESTYLE_*
|
||||||
*/
|
*/
|
||||||
public void setLineStyle( int lineStyle )
|
public void setLineStyle(int lineStyle) {
|
||||||
{
|
_lineStyle = lineStyle;
|
||||||
this.lineStyle = lineStyle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if this shape is not filled with a color.
|
* @return <code>true</code> if this shape is not filled with a color.
|
||||||
*/
|
*/
|
||||||
public boolean isNoFill()
|
public boolean isNoFill() {
|
||||||
{
|
return _noFill;
|
||||||
return noFill;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether this shape is filled or transparent.
|
* Sets whether this shape is filled or transparent.
|
||||||
*/
|
*/
|
||||||
public void setNoFill( boolean noFill )
|
public void setNoFill(boolean noFill) {
|
||||||
{
|
_noFill = noFill;
|
||||||
this.noFill = noFill;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count of all children and their childrens children.
|
* Count of all children and their children's children.
|
||||||
*/
|
*/
|
||||||
public int countOfAllChildren()
|
public int countOfAllChildren() {
|
||||||
{
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,15 +87,15 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
public final static int INITIAL_CAPACITY = 20;
|
public final static int INITIAL_CAPACITY = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reference to the low level Sheet object
|
* reference to the low level {@link Sheet} object
|
||||||
*/
|
*/
|
||||||
private final Sheet sheet;
|
private final Sheet _sheet;
|
||||||
/** stores rows by zero-based row number */
|
/** stores rows by zero-based row number */
|
||||||
private final TreeMap<Integer, HSSFRow> rows;
|
private final TreeMap<Integer, HSSFRow> _rows;
|
||||||
protected final Workbook book;
|
protected final Workbook _book;
|
||||||
protected final HSSFWorkbook workbook;
|
protected final HSSFWorkbook _workbook;
|
||||||
private int firstrow;
|
private int _firstrow;
|
||||||
private int lastrow;
|
private int _lastrow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new HSSFSheet - called by HSSFWorkbook to create a sheet from
|
* Creates new HSSFSheet - called by HSSFWorkbook to create a sheet from
|
||||||
@ -105,10 +105,10 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
|
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
|
||||||
*/
|
*/
|
||||||
protected HSSFSheet(HSSFWorkbook workbook) {
|
protected HSSFSheet(HSSFWorkbook workbook) {
|
||||||
sheet = Sheet.createSheet();
|
_sheet = Sheet.createSheet();
|
||||||
rows = new TreeMap<Integer, HSSFRow>();
|
_rows = new TreeMap<Integer, HSSFRow>();
|
||||||
this.workbook = workbook;
|
this._workbook = workbook;
|
||||||
this.book = workbook.getWorkbook();
|
this._book = workbook.getWorkbook();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,15 +120,15 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
|
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
|
||||||
*/
|
*/
|
||||||
protected HSSFSheet(HSSFWorkbook workbook, Sheet sheet) {
|
protected HSSFSheet(HSSFWorkbook workbook, Sheet sheet) {
|
||||||
this.sheet = sheet;
|
this._sheet = sheet;
|
||||||
rows = new TreeMap<Integer, HSSFRow>();
|
_rows = new TreeMap<Integer, HSSFRow>();
|
||||||
this.workbook = workbook;
|
this._workbook = workbook;
|
||||||
this.book = workbook.getWorkbook();
|
this._book = workbook.getWorkbook();
|
||||||
setPropertiesFromSheet(sheet);
|
setPropertiesFromSheet(sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
HSSFSheet cloneSheet(HSSFWorkbook workbook) {
|
HSSFSheet cloneSheet(HSSFWorkbook workbook) {
|
||||||
return new HSSFSheet(workbook, sheet.cloneSheet());
|
return new HSSFSheet(workbook, _sheet.cloneSheet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -137,7 +137,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return the parent workbook
|
* @return the parent workbook
|
||||||
*/
|
*/
|
||||||
public HSSFWorkbook getWorkbook(){
|
public HSSFWorkbook getWorkbook(){
|
||||||
return workbook;
|
return _workbook;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -208,7 +208,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public HSSFRow createRow(int rownum)
|
public HSSFRow createRow(int rownum)
|
||||||
{
|
{
|
||||||
HSSFRow row = new HSSFRow(workbook, this, rownum);
|
HSSFRow row = new HSSFRow(_workbook, this, rownum);
|
||||||
|
|
||||||
addRow(row, true);
|
addRow(row, true);
|
||||||
return row;
|
return row;
|
||||||
@ -223,7 +223,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
private HSSFRow createRowFromRecord(RowRecord row)
|
private HSSFRow createRowFromRecord(RowRecord row)
|
||||||
{
|
{
|
||||||
HSSFRow hrow = new HSSFRow(workbook, this, row);
|
HSSFRow hrow = new HSSFRow(_workbook, this, row);
|
||||||
|
|
||||||
addRow(hrow, false);
|
addRow(hrow, false);
|
||||||
return hrow;
|
return hrow;
|
||||||
@ -236,24 +236,24 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void removeRow(Row row) {
|
public void removeRow(Row row) {
|
||||||
HSSFRow hrow = (HSSFRow) row;
|
HSSFRow hrow = (HSSFRow) row;
|
||||||
if (rows.size() > 0) {
|
if (_rows.size() > 0) {
|
||||||
Integer key = new Integer(row.getRowNum());
|
Integer key = new Integer(row.getRowNum());
|
||||||
HSSFRow removedRow = rows.remove(key);
|
HSSFRow removedRow = _rows.remove(key);
|
||||||
if (removedRow != row) {
|
if (removedRow != row) {
|
||||||
if (removedRow != null) {
|
if (removedRow != null) {
|
||||||
rows.put(key, removedRow);
|
_rows.put(key, removedRow);
|
||||||
}
|
}
|
||||||
throw new RuntimeException("Specified row does not belong to this sheet");
|
throw new RuntimeException("Specified row does not belong to this sheet");
|
||||||
}
|
}
|
||||||
if (hrow.getRowNum() == getLastRowNum())
|
if (hrow.getRowNum() == getLastRowNum())
|
||||||
{
|
{
|
||||||
lastrow = findLastRow(lastrow);
|
_lastrow = findLastRow(_lastrow);
|
||||||
}
|
}
|
||||||
if (hrow.getRowNum() == getFirstRowNum())
|
if (hrow.getRowNum() == getFirstRowNum())
|
||||||
{
|
{
|
||||||
firstrow = findFirstRow(firstrow);
|
_firstrow = findFirstRow(_firstrow);
|
||||||
}
|
}
|
||||||
sheet.removeRow(hrow.getRowRecord());
|
_sheet.removeRow(hrow.getRowRecord());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,18 +304,18 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
private void addRow(HSSFRow row, boolean addLow)
|
private void addRow(HSSFRow row, boolean addLow)
|
||||||
{
|
{
|
||||||
rows.put(new Integer(row.getRowNum()), row);
|
_rows.put(new Integer(row.getRowNum()), row);
|
||||||
if (addLow)
|
if (addLow)
|
||||||
{
|
{
|
||||||
sheet.addRow(row.getRowRecord());
|
_sheet.addRow(row.getRowRecord());
|
||||||
}
|
}
|
||||||
if (row.getRowNum() > getLastRowNum())
|
if (row.getRowNum() > getLastRowNum())
|
||||||
{
|
{
|
||||||
lastrow = row.getRowNum();
|
_lastrow = row.getRowNum();
|
||||||
}
|
}
|
||||||
if (row.getRowNum() < getFirstRowNum())
|
if (row.getRowNum() < getFirstRowNum())
|
||||||
{
|
{
|
||||||
firstrow = row.getRowNum();
|
_firstrow = row.getRowNum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,14 +326,14 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return HSSFRow representing the row number or null if its not defined on the sheet
|
* @return HSSFRow representing the row number or null if its not defined on the sheet
|
||||||
*/
|
*/
|
||||||
public HSSFRow getRow(int rowIndex) {
|
public HSSFRow getRow(int rowIndex) {
|
||||||
return rows.get(new Integer(rowIndex));
|
return _rows.get(new Integer(rowIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of physically defined rows (NOT the number of rows in the sheet)
|
* Returns the number of physically defined rows (NOT the number of rows in the sheet)
|
||||||
*/
|
*/
|
||||||
public int getPhysicalNumberOfRows() {
|
public int getPhysicalNumberOfRows() {
|
||||||
return rows.size();
|
return _rows.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -341,7 +341,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return the number of the first logical row on the sheet, zero based
|
* @return the number of the first logical row on the sheet, zero based
|
||||||
*/
|
*/
|
||||||
public int getFirstRowNum() {
|
public int getFirstRowNum() {
|
||||||
return firstrow;
|
return _firstrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -357,7 +357,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return the number of the last row contained in this sheet, zero based.
|
* @return the number of the last row contained in this sheet, zero based.
|
||||||
*/
|
*/
|
||||||
public int getLastRowNum() {
|
public int getLastRowNum() {
|
||||||
return lastrow;
|
return _lastrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -368,7 +368,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
if (dataValidation == null) {
|
if (dataValidation == null) {
|
||||||
throw new IllegalArgumentException("objValidation must not be null");
|
throw new IllegalArgumentException("objValidation must not be null");
|
||||||
}
|
}
|
||||||
DataValidityTable dvt = sheet.getOrCreateDataValidityTable();
|
DataValidityTable dvt = _sheet.getOrCreateDataValidityTable();
|
||||||
|
|
||||||
DVRecord dvRecord = dataValidation.createDVRecord(this);
|
DVRecord dvRecord = dataValidation.createDVRecord(this);
|
||||||
dvt.addDataValidation(dvRecord);
|
dvt.addDataValidation(dvRecord);
|
||||||
@ -416,7 +416,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param hidden - the visiblity state of the column
|
* @param hidden - the visiblity state of the column
|
||||||
*/
|
*/
|
||||||
public void setColumnHidden(int columnIndex, boolean hidden) {
|
public void setColumnHidden(int columnIndex, boolean hidden) {
|
||||||
sheet.setColumnHidden(columnIndex, hidden);
|
_sheet.setColumnHidden(columnIndex, hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -425,7 +425,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return hidden - <code>false</code> if the column is visible
|
* @return hidden - <code>false</code> if the column is visible
|
||||||
*/
|
*/
|
||||||
public boolean isColumnHidden(int columnIndex) {
|
public boolean isColumnHidden(int columnIndex) {
|
||||||
return sheet.isColumnHidden(columnIndex);
|
return _sheet.isColumnHidden(columnIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -441,7 +441,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @throws IllegalArgumentException if width > 65536 (the maximum column width in Excel)
|
* @throws IllegalArgumentException if width > 65536 (the maximum column width in Excel)
|
||||||
*/
|
*/
|
||||||
public void setColumnWidth(int columnIndex, int width) {
|
public void setColumnWidth(int columnIndex, int width) {
|
||||||
sheet.setColumnWidth(columnIndex, width);
|
_sheet.setColumnWidth(columnIndex, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -450,7 +450,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return width - the width in units of 1/256th of a character width
|
* @return width - the width in units of 1/256th of a character width
|
||||||
*/
|
*/
|
||||||
public int getColumnWidth(int columnIndex) {
|
public int getColumnWidth(int columnIndex) {
|
||||||
return sheet.getColumnWidth(columnIndex);
|
return _sheet.getColumnWidth(columnIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -459,7 +459,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return default column width
|
* @return default column width
|
||||||
*/
|
*/
|
||||||
public int getDefaultColumnWidth() {
|
public int getDefaultColumnWidth() {
|
||||||
return sheet.getDefaultColumnWidth();
|
return _sheet.getDefaultColumnWidth();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* set the default column width for the sheet (if the columns do not define their own width) in
|
* set the default column width for the sheet (if the columns do not define their own width) in
|
||||||
@ -467,7 +467,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param width default column width
|
* @param width default column width
|
||||||
*/
|
*/
|
||||||
public void setDefaultColumnWidth(int width) {
|
public void setDefaultColumnWidth(int width) {
|
||||||
sheet.setDefaultColumnWidth(width);
|
_sheet.setDefaultColumnWidth(width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return default row height
|
* @return default row height
|
||||||
*/
|
*/
|
||||||
public short getDefaultRowHeight() {
|
public short getDefaultRowHeight() {
|
||||||
return sheet.getDefaultRowHeight();
|
return _sheet.getDefaultRowHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -488,7 +488,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
public float getDefaultRowHeightInPoints()
|
public float getDefaultRowHeightInPoints()
|
||||||
{
|
{
|
||||||
return (sheet.getDefaultRowHeight() / 20);
|
return (_sheet.getDefaultRowHeight() / 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -499,7 +499,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
public void setDefaultRowHeight(short height)
|
public void setDefaultRowHeight(short height)
|
||||||
{
|
{
|
||||||
sheet.setDefaultRowHeight(height);
|
_sheet.setDefaultRowHeight(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -510,7 +510,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
public void setDefaultRowHeightInPoints(float height)
|
public void setDefaultRowHeightInPoints(float height)
|
||||||
{
|
{
|
||||||
sheet.setDefaultRowHeight((short) (height * 20));
|
_sheet.setDefaultRowHeight((short) (height * 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -519,15 +519,15 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* set for that column
|
* set for that column
|
||||||
*/
|
*/
|
||||||
public HSSFCellStyle getColumnStyle(int column) {
|
public HSSFCellStyle getColumnStyle(int column) {
|
||||||
short styleIndex = sheet.getXFIndexForColAt((short)column);
|
short styleIndex = _sheet.getXFIndexForColAt((short)column);
|
||||||
|
|
||||||
if(styleIndex == 0xf) {
|
if(styleIndex == 0xf) {
|
||||||
// None set
|
// None set
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedFormatRecord xf = book.getExFormatAt(styleIndex);
|
ExtendedFormatRecord xf = _book.getExFormatAt(styleIndex);
|
||||||
return new HSSFCellStyle(styleIndex, xf, book);
|
return new HSSFCellStyle(styleIndex, xf, _book);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -537,7 +537,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
public boolean isGridsPrinted()
|
public boolean isGridsPrinted()
|
||||||
{
|
{
|
||||||
return sheet.isGridsPrinted();
|
return _sheet.isGridsPrinted();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -547,7 +547,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
public void setGridsPrinted(boolean value)
|
public void setGridsPrinted(boolean value)
|
||||||
{
|
{
|
||||||
sheet.setGridsPrinted(value);
|
_sheet.setGridsPrinted(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -555,7 +555,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public int addMergedRegion(org.apache.poi.ss.util.Region region)
|
public int addMergedRegion(org.apache.poi.ss.util.Region region)
|
||||||
{
|
{
|
||||||
return sheet.addMergedRegion( region.getRowFrom(),
|
return _sheet.addMergedRegion( region.getRowFrom(),
|
||||||
region.getColumnFrom(),
|
region.getColumnFrom(),
|
||||||
//(short) region.getRowTo(),
|
//(short) region.getRowTo(),
|
||||||
region.getRowTo(),
|
region.getRowTo(),
|
||||||
@ -568,7 +568,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public int addMergedRegion(CellRangeAddress region)
|
public int addMergedRegion(CellRangeAddress region)
|
||||||
{
|
{
|
||||||
return sheet.addMergedRegion( region.getFirstRow(),
|
return _sheet.addMergedRegion( region.getFirstRow(),
|
||||||
region.getFirstColumn(),
|
region.getFirstColumn(),
|
||||||
region.getLastRow(),
|
region.getLastRow(),
|
||||||
region.getLastColumn());
|
region.getLastColumn());
|
||||||
@ -581,7 +581,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setForceFormulaRecalculation(boolean value)
|
public void setForceFormulaRecalculation(boolean value)
|
||||||
{
|
{
|
||||||
sheet.setUncalced(value);
|
_sheet.setUncalced(value);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Whether a record must be inserted or not at generation to indicate that
|
* Whether a record must be inserted or not at generation to indicate that
|
||||||
@ -590,7 +590,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public boolean getForceFormulaRecalculation()
|
public boolean getForceFormulaRecalculation()
|
||||||
{
|
{
|
||||||
return sheet.getUncalced();
|
return _sheet.getUncalced();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -601,7 +601,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
public void setVerticallyCenter(boolean value)
|
public void setVerticallyCenter(boolean value)
|
||||||
{
|
{
|
||||||
sheet.getPageSettings().getVCenter().setVCenter(value);
|
_sheet.getPageSettings().getVCenter().setVCenter(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -617,7 +617,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public boolean getVerticallyCenter()
|
public boolean getVerticallyCenter()
|
||||||
{
|
{
|
||||||
return sheet.getPageSettings().getVCenter().getVCenter();
|
return _sheet.getPageSettings().getVCenter().getVCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -627,7 +627,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
public void setHorizontallyCenter(boolean value)
|
public void setHorizontallyCenter(boolean value)
|
||||||
{
|
{
|
||||||
sheet.getPageSettings().getHCenter().setHCenter(value);
|
_sheet.getPageSettings().getHCenter().setHCenter(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -637,7 +637,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
public boolean getHorizontallyCenter()
|
public boolean getHorizontallyCenter()
|
||||||
{
|
{
|
||||||
|
|
||||||
return sheet.getPageSettings().getHCenter().getHCenter();
|
return _sheet.getPageSettings().getHCenter().getHCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -649,7 +649,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
public void removeMergedRegion(int index)
|
public void removeMergedRegion(int index)
|
||||||
{
|
{
|
||||||
sheet.removeMergedRegion(index);
|
_sheet.removeMergedRegion(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -659,7 +659,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
public int getNumMergedRegions()
|
public int getNumMergedRegions()
|
||||||
{
|
{
|
||||||
return sheet.getNumMergedRegions();
|
return _sheet.getNumMergedRegions();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -675,7 +675,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return the merged region at the specified index
|
* @return the merged region at the specified index
|
||||||
*/
|
*/
|
||||||
public CellRangeAddress getMergedRegion(int index) {
|
public CellRangeAddress getMergedRegion(int index) {
|
||||||
return sheet.getMergedRegionAt(index);
|
return _sheet.getMergedRegionAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -685,7 +685,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public Iterator<Row> rowIterator() {
|
public Iterator<Row> rowIterator() {
|
||||||
@SuppressWarnings("unchecked") // can this clumsy generic syntax be improved?
|
@SuppressWarnings("unchecked") // can this clumsy generic syntax be improved?
|
||||||
Iterator<Row> result = (Iterator<Row>)(Iterator<? extends Row>)rows.values().iterator();
|
Iterator<Row> result = (Iterator<Row>)(Iterator<? extends Row>)_rows.values().iterator();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -703,7 +703,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return Sheet - low level representation of this HSSFSheet.
|
* @return Sheet - low level representation of this HSSFSheet.
|
||||||
*/
|
*/
|
||||||
Sheet getSheet() {
|
Sheet getSheet() {
|
||||||
return sheet;
|
return _sheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -712,7 +712,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setAlternativeExpression(boolean b) {
|
public void setAlternativeExpression(boolean b) {
|
||||||
WSBoolRecord record =
|
WSBoolRecord record =
|
||||||
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
(WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
||||||
|
|
||||||
record.setAlternateExpression(b);
|
record.setAlternateExpression(b);
|
||||||
}
|
}
|
||||||
@ -723,7 +723,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setAlternativeFormula(boolean b) {
|
public void setAlternativeFormula(boolean b) {
|
||||||
WSBoolRecord record =
|
WSBoolRecord record =
|
||||||
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
(WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
||||||
|
|
||||||
record.setAlternateFormula(b);
|
record.setAlternateFormula(b);
|
||||||
}
|
}
|
||||||
@ -734,7 +734,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setAutobreaks(boolean b) {
|
public void setAutobreaks(boolean b) {
|
||||||
WSBoolRecord record =
|
WSBoolRecord record =
|
||||||
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
(WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
||||||
|
|
||||||
record.setAutobreaks(b);
|
record.setAutobreaks(b);
|
||||||
}
|
}
|
||||||
@ -745,7 +745,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setDialog(boolean b) {
|
public void setDialog(boolean b) {
|
||||||
WSBoolRecord record =
|
WSBoolRecord record =
|
||||||
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
(WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
||||||
|
|
||||||
record.setDialog(b);
|
record.setDialog(b);
|
||||||
}
|
}
|
||||||
@ -757,7 +757,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setDisplayGuts(boolean b) {
|
public void setDisplayGuts(boolean b) {
|
||||||
WSBoolRecord record =
|
WSBoolRecord record =
|
||||||
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
(WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
||||||
|
|
||||||
record.setDisplayGuts(b);
|
record.setDisplayGuts(b);
|
||||||
}
|
}
|
||||||
@ -768,7 +768,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setFitToPage(boolean b) {
|
public void setFitToPage(boolean b) {
|
||||||
WSBoolRecord record =
|
WSBoolRecord record =
|
||||||
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
(WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
||||||
|
|
||||||
record.setFitToPage(b);
|
record.setFitToPage(b);
|
||||||
}
|
}
|
||||||
@ -779,7 +779,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setRowSumsBelow(boolean b) {
|
public void setRowSumsBelow(boolean b) {
|
||||||
WSBoolRecord record =
|
WSBoolRecord record =
|
||||||
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
(WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
||||||
|
|
||||||
record.setRowSumsBelow(b);
|
record.setRowSumsBelow(b);
|
||||||
}
|
}
|
||||||
@ -790,7 +790,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setRowSumsRight(boolean b) {
|
public void setRowSumsRight(boolean b) {
|
||||||
WSBoolRecord record =
|
WSBoolRecord record =
|
||||||
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
(WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid);
|
||||||
|
|
||||||
record.setRowSumsRight(b);
|
record.setRowSumsRight(b);
|
||||||
}
|
}
|
||||||
@ -800,7 +800,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return alternative expression evaluation or not
|
* @return alternative expression evaluation or not
|
||||||
*/
|
*/
|
||||||
public boolean getAlternateExpression() {
|
public boolean getAlternateExpression() {
|
||||||
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
||||||
.getAlternateExpression();
|
.getAlternateExpression();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,7 +809,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return alternative formulas or not
|
* @return alternative formulas or not
|
||||||
*/
|
*/
|
||||||
public boolean getAlternateFormula() {
|
public boolean getAlternateFormula() {
|
||||||
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
||||||
.getAlternateFormula();
|
.getAlternateFormula();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,7 +818,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return whether to show auto page breaks
|
* @return whether to show auto page breaks
|
||||||
*/
|
*/
|
||||||
public boolean getAutobreaks() {
|
public boolean getAutobreaks() {
|
||||||
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
||||||
.getAutobreaks();
|
.getAutobreaks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,7 +827,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return isDialog or not
|
* @return isDialog or not
|
||||||
*/
|
*/
|
||||||
public boolean getDialog() {
|
public boolean getDialog() {
|
||||||
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
||||||
.getDialog();
|
.getDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,7 +837,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return guts or no guts (or glory)
|
* @return guts or no guts (or glory)
|
||||||
*/
|
*/
|
||||||
public boolean getDisplayGuts() {
|
public boolean getDisplayGuts() {
|
||||||
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
||||||
.getDisplayGuts();
|
.getDisplayGuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,7 +846,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return fit or not
|
* @return fit or not
|
||||||
*/
|
*/
|
||||||
public boolean getFitToPage() {
|
public boolean getFitToPage() {
|
||||||
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
||||||
.getFitToPage();
|
.getFitToPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,7 +855,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return below or not
|
* @return below or not
|
||||||
*/
|
*/
|
||||||
public boolean getRowSumsBelow() {
|
public boolean getRowSumsBelow() {
|
||||||
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
||||||
.getRowSumsBelow();
|
.getRowSumsBelow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,7 +864,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return right or not
|
* @return right or not
|
||||||
*/
|
*/
|
||||||
public boolean getRowSumsRight() {
|
public boolean getRowSumsRight() {
|
||||||
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
return ((WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid))
|
||||||
.getRowSumsRight();
|
.getRowSumsRight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -890,7 +890,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return The user model for the print setup object.
|
* @return The user model for the print setup object.
|
||||||
*/
|
*/
|
||||||
public HSSFPrintSetup getPrintSetup() {
|
public HSSFPrintSetup getPrintSetup() {
|
||||||
return new HSSFPrintSetup(sheet.getPageSettings().getPrintSetup());
|
return new HSSFPrintSetup(_sheet.getPageSettings().getPrintSetup());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -898,7 +898,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return The Document header.
|
* @return The Document header.
|
||||||
*/
|
*/
|
||||||
public HSSFHeader getHeader() {
|
public HSSFHeader getHeader() {
|
||||||
return new HSSFHeader(sheet.getPageSettings().getHeader());
|
return new HSSFHeader(_sheet.getPageSettings().getHeader());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -906,7 +906,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return The Document footer.
|
* @return The Document footer.
|
||||||
*/
|
*/
|
||||||
public HSSFFooter getFooter() {
|
public HSSFFooter getFooter() {
|
||||||
return new HSSFFooter(sheet.getPageSettings().getFooter());
|
return new HSSFFooter(_sheet.getPageSettings().getFooter());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -943,7 +943,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return the size of the margin
|
* @return the size of the margin
|
||||||
*/
|
*/
|
||||||
public double getMargin(short margin) {
|
public double getMargin(short margin) {
|
||||||
return sheet.getPageSettings().getMargin(margin);
|
return _sheet.getPageSettings().getMargin(margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -952,7 +952,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param size the size of the margin
|
* @param size the size of the margin
|
||||||
*/
|
*/
|
||||||
public void setMargin(short margin, double size) {
|
public void setMargin(short margin, double size) {
|
||||||
sheet.getPageSettings().setMargin(margin, size);
|
_sheet.getPageSettings().setMargin(margin, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1030,7 +1030,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return short indicating the rownum (0 based) of the top row
|
* @return short indicating the rownum (0 based) of the top row
|
||||||
*/
|
*/
|
||||||
public short getTopRow() {
|
public short getTopRow() {
|
||||||
return sheet.getTopRow();
|
return _sheet.getTopRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1039,7 +1039,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return short indicating the rownum (0 based) of the top row
|
* @return short indicating the rownum (0 based) of the top row
|
||||||
*/
|
*/
|
||||||
public short getLeftCol() {
|
public short getLeftCol() {
|
||||||
return sheet.getLeftCol();
|
return _sheet.getLeftCol();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1049,8 +1049,8 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param leftcol the left column to show in desktop window pane
|
* @param leftcol the left column to show in desktop window pane
|
||||||
*/
|
*/
|
||||||
public void showInPane(short toprow, short leftcol){
|
public void showInPane(short toprow, short leftcol){
|
||||||
sheet.setTopRow(toprow);
|
_sheet.setTopRow(toprow);
|
||||||
sheet.setLeftCol(leftcol);
|
_sheet.setLeftCol(leftcol);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1088,9 +1088,9 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//read so it doesn't get shifted again
|
//read so it doesn't get shifted again
|
||||||
Iterator iterator = shiftedRegions.iterator();
|
Iterator<CellRangeAddress> iterator = shiftedRegions.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
CellRangeAddress region = (CellRangeAddress)iterator.next();
|
CellRangeAddress region = iterator.next();
|
||||||
|
|
||||||
this.addMergedRegion(region);
|
this.addMergedRegion(region);
|
||||||
}
|
}
|
||||||
@ -1171,13 +1171,13 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
}
|
}
|
||||||
NoteRecord[] noteRecs;
|
NoteRecord[] noteRecs;
|
||||||
if (moveComments) {
|
if (moveComments) {
|
||||||
noteRecs = sheet.getNoteRecords();
|
noteRecs = _sheet.getNoteRecords();
|
||||||
} else {
|
} else {
|
||||||
noteRecs = NoteRecord.EMPTY_ARRAY;
|
noteRecs = NoteRecord.EMPTY_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
shiftMerged(startRow, endRow, n, true);
|
shiftMerged(startRow, endRow, n, true);
|
||||||
sheet.getPageSettings().shiftRowBreaks(startRow, endRow, n);
|
_sheet.getPageSettings().shiftRowBreaks(startRow, endRow, n);
|
||||||
|
|
||||||
for ( int rowNum = s; rowNum >= startRow && rowNum <= endRow && rowNum >= 0 && rowNum < 65536; rowNum += inc ) {
|
for ( int rowNum = s; rowNum >= startRow && rowNum <= endRow && rowNum >= 0 && rowNum < 65536; rowNum += inc ) {
|
||||||
HSSFRow row = getRow( rowNum );
|
HSSFRow row = getRow( rowNum );
|
||||||
@ -1213,7 +1213,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
CellValueRecordInterface cellRecord = cell.getCellValueRecord();
|
CellValueRecordInterface cellRecord = cell.getCellValueRecord();
|
||||||
cellRecord.setRow( rowNum + n );
|
cellRecord.setRow( rowNum + n );
|
||||||
row2Replace.createCellFromRecord( cellRecord );
|
row2Replace.createCellFromRecord( cellRecord );
|
||||||
sheet.addValueRecord( rowNum + n, cellRecord );
|
_sheet.addValueRecord( rowNum + n, cellRecord );
|
||||||
|
|
||||||
HSSFHyperlink link = cell.getHyperlink();
|
HSSFHyperlink link = cell.getHyperlink();
|
||||||
if(link != null){
|
if(link != null){
|
||||||
@ -1241,31 +1241,31 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( endRow == lastrow || endRow + n > lastrow ) lastrow = Math.min( endRow + n, 65535 );
|
if ( endRow == _lastrow || endRow + n > _lastrow ) _lastrow = Math.min( endRow + n, 65535 );
|
||||||
if ( startRow == firstrow || startRow + n < firstrow ) firstrow = Math.max( startRow + n, 0 );
|
if ( startRow == _firstrow || startRow + n < _firstrow ) _firstrow = Math.max( startRow + n, 0 );
|
||||||
|
|
||||||
// Update any formulas on this sheet that point to
|
// Update any formulas on this sheet that point to
|
||||||
// rows which have been moved
|
// rows which have been moved
|
||||||
int sheetIndex = workbook.getSheetIndex(this);
|
int sheetIndex = _workbook.getSheetIndex(this);
|
||||||
short externSheetIndex = book.checkExternSheet(sheetIndex);
|
short externSheetIndex = _book.checkExternSheet(sheetIndex);
|
||||||
FormulaShifter shifter = FormulaShifter.createForRowShift(externSheetIndex, startRow, endRow, n);
|
FormulaShifter shifter = FormulaShifter.createForRowShift(externSheetIndex, startRow, endRow, n);
|
||||||
sheet.updateFormulasAfterCellShift(shifter, externSheetIndex);
|
_sheet.updateFormulasAfterCellShift(shifter, externSheetIndex);
|
||||||
|
|
||||||
int nSheets = workbook.getNumberOfSheets();
|
int nSheets = _workbook.getNumberOfSheets();
|
||||||
for(int i=0; i<nSheets; i++) {
|
for(int i=0; i<nSheets; i++) {
|
||||||
Sheet otherSheet = workbook.getSheetAt(i).getSheet();
|
Sheet otherSheet = _workbook.getSheetAt(i).getSheet();
|
||||||
if (otherSheet == this.sheet) {
|
if (otherSheet == this._sheet) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
short otherExtSheetIx = book.checkExternSheet(i);
|
short otherExtSheetIx = _book.checkExternSheet(i);
|
||||||
otherSheet.updateFormulasAfterCellShift(shifter, otherExtSheetIx);
|
otherSheet.updateFormulasAfterCellShift(shifter, otherExtSheetIx);
|
||||||
}
|
}
|
||||||
// TODO - adjust formulas in named ranges
|
// TODO - adjust formulas in named ranges
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void insertChartRecords(List<Record> records) {
|
protected void insertChartRecords(List<Record> records) {
|
||||||
int window2Loc = sheet.findFirstRecordLocBySid(WindowTwoRecord.sid);
|
int window2Loc = _sheet.findFirstRecordLocBySid(WindowTwoRecord.sid);
|
||||||
sheet.getRecords().addAll(window2Loc, records);
|
_sheet.getRecords().addAll(window2Loc, records);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1322,7 +1322,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param show whether to show gridlines or not
|
* @param show whether to show gridlines or not
|
||||||
*/
|
*/
|
||||||
public void setDisplayGridlines(boolean show) {
|
public void setDisplayGridlines(boolean show) {
|
||||||
sheet.setDisplayGridlines(show);
|
_sheet.setDisplayGridlines(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1330,7 +1330,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return whether gridlines are displayed
|
* @return whether gridlines are displayed
|
||||||
*/
|
*/
|
||||||
public boolean isDisplayGridlines() {
|
public boolean isDisplayGridlines() {
|
||||||
return sheet.isDisplayGridlines();
|
return _sheet.isDisplayGridlines();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1338,7 +1338,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param show whether to show formulas or not
|
* @param show whether to show formulas or not
|
||||||
*/
|
*/
|
||||||
public void setDisplayFormulas(boolean show) {
|
public void setDisplayFormulas(boolean show) {
|
||||||
sheet.setDisplayFormulas(show);
|
_sheet.setDisplayFormulas(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1346,7 +1346,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return whether formulas are displayed
|
* @return whether formulas are displayed
|
||||||
*/
|
*/
|
||||||
public boolean isDisplayFormulas() {
|
public boolean isDisplayFormulas() {
|
||||||
return sheet.isDisplayFormulas();
|
return _sheet.isDisplayFormulas();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1354,7 +1354,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param show whether to show RowColHeadings or not
|
* @param show whether to show RowColHeadings or not
|
||||||
*/
|
*/
|
||||||
public void setDisplayRowColHeadings(boolean show) {
|
public void setDisplayRowColHeadings(boolean show) {
|
||||||
sheet.setDisplayRowColHeadings(show);
|
_sheet.setDisplayRowColHeadings(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1362,7 +1362,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return whether RowColHeadings are displayed
|
* @return whether RowColHeadings are displayed
|
||||||
*/
|
*/
|
||||||
public boolean isDisplayRowColHeadings() {
|
public boolean isDisplayRowColHeadings() {
|
||||||
return sheet.isDisplayRowColHeadings();
|
return _sheet.isDisplayRowColHeadings();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1371,21 +1371,21 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setRowBreak(int row) {
|
public void setRowBreak(int row) {
|
||||||
validateRow(row);
|
validateRow(row);
|
||||||
sheet.getPageSettings().setRowBreak(row, (short)0, (short)255);
|
_sheet.getPageSettings().setRowBreak(row, (short)0, (short)255);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return <code>true</code> if there is a page break at the indicated row
|
* @return <code>true</code> if there is a page break at the indicated row
|
||||||
*/
|
*/
|
||||||
public boolean isRowBroken(int row) {
|
public boolean isRowBroken(int row) {
|
||||||
return sheet.getPageSettings().isRowBroken(row);
|
return _sheet.getPageSettings().isRowBroken(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the page break at the indicated row
|
* Removes the page break at the indicated row
|
||||||
*/
|
*/
|
||||||
public void removeRowBreak(int row) {
|
public void removeRowBreak(int row) {
|
||||||
sheet.getPageSettings().removeRowBreak(row);
|
_sheet.getPageSettings().removeRowBreak(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1393,7 +1393,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public int[] getRowBreaks() {
|
public int[] getRowBreaks() {
|
||||||
//we can probably cache this information, but this should be a sparsely used function
|
//we can probably cache this information, but this should be a sparsely used function
|
||||||
return sheet.getPageSettings().getRowBreaks();
|
return _sheet.getPageSettings().getRowBreaks();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1401,7 +1401,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public int[] getColumnBreaks() {
|
public int[] getColumnBreaks() {
|
||||||
//we can probably cache this information, but this should be a sparsely used function
|
//we can probably cache this information, but this should be a sparsely used function
|
||||||
return sheet.getPageSettings().getColumnBreaks();
|
return _sheet.getPageSettings().getColumnBreaks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1411,7 +1411,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public void setColumnBreak(short column) {
|
public void setColumnBreak(short column) {
|
||||||
validateColumn(column);
|
validateColumn(column);
|
||||||
sheet.getPageSettings().setColumnBreak(column, (short)0, (short)65535);
|
_sheet.getPageSettings().setColumnBreak(column, (short)0, (short)65535);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1420,7 +1420,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @return FIXME: Document this!
|
* @return FIXME: Document this!
|
||||||
*/
|
*/
|
||||||
public boolean isColumnBroken(short column) {
|
public boolean isColumnBroken(short column) {
|
||||||
return sheet.getPageSettings().isColumnBroken(column);
|
return _sheet.getPageSettings().isColumnBroken(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1428,7 +1428,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param column
|
* @param column
|
||||||
*/
|
*/
|
||||||
public void removeColumnBreak(short column) {
|
public void removeColumnBreak(short column) {
|
||||||
sheet.getPageSettings().removeColumnBreak(column);
|
_sheet.getPageSettings().removeColumnBreak(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1454,18 +1454,18 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* to the standard output.
|
* to the standard output.
|
||||||
*/
|
*/
|
||||||
public void dumpDrawingRecords(boolean fat) {
|
public void dumpDrawingRecords(boolean fat) {
|
||||||
sheet.aggregateDrawingRecords(book.getDrawingManager(), false);
|
_sheet.aggregateDrawingRecords(_book.getDrawingManager(), false);
|
||||||
|
|
||||||
EscherAggregate r = (EscherAggregate) getSheet().findFirstRecordBySid(EscherAggregate.sid);
|
EscherAggregate r = (EscherAggregate) getSheet().findFirstRecordBySid(EscherAggregate.sid);
|
||||||
List escherRecords = r.getEscherRecords();
|
List<EscherRecord> escherRecords = r.getEscherRecords();
|
||||||
PrintWriter w = new PrintWriter(System.out);
|
PrintWriter w = new PrintWriter(System.out);
|
||||||
for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); )
|
for (Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext();) {
|
||||||
{
|
EscherRecord escherRecord = iterator.next();
|
||||||
EscherRecord escherRecord = (EscherRecord) iterator.next();
|
if (fat) {
|
||||||
if (fat)
|
System.out.println(escherRecord.toString());
|
||||||
System.out.println(escherRecord.toString());
|
} else {
|
||||||
else
|
escherRecord.display(w, 0);
|
||||||
escherRecord.display(w, 0);
|
}
|
||||||
}
|
}
|
||||||
w.flush();
|
w.flush();
|
||||||
}
|
}
|
||||||
@ -1479,10 +1479,10 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
*/
|
*/
|
||||||
public HSSFPatriarch createDrawingPatriarch() {
|
public HSSFPatriarch createDrawingPatriarch() {
|
||||||
// Create the drawing group if it doesn't already exist.
|
// Create the drawing group if it doesn't already exist.
|
||||||
book.createDrawingGroup();
|
_book.createDrawingGroup();
|
||||||
|
|
||||||
sheet.aggregateDrawingRecords(book.getDrawingManager(), true);
|
_sheet.aggregateDrawingRecords(_book.getDrawingManager(), true);
|
||||||
EscherAggregate agg = (EscherAggregate) sheet.findFirstRecordBySid(EscherAggregate.sid);
|
EscherAggregate agg = (EscherAggregate) _sheet.findFirstRecordBySid(EscherAggregate.sid);
|
||||||
HSSFPatriarch patriarch = new HSSFPatriarch(this, agg);
|
HSSFPatriarch patriarch = new HSSFPatriarch(this, agg);
|
||||||
agg.clear(); // Initially the behaviour will be to clear out any existing shapes in the sheet when
|
agg.clear(); // Initially the behaviour will be to clear out any existing shapes in the sheet when
|
||||||
// creating a new patriarch.
|
// creating a new patriarch.
|
||||||
@ -1499,16 +1499,16 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* certainly be lost or corrupted when written out.
|
* certainly be lost or corrupted when written out.
|
||||||
*/
|
*/
|
||||||
public EscherAggregate getDrawingEscherAggregate() {
|
public EscherAggregate getDrawingEscherAggregate() {
|
||||||
book.findDrawingGroup();
|
_book.findDrawingGroup();
|
||||||
|
|
||||||
// If there's now no drawing manager, then there's
|
// If there's now no drawing manager, then there's
|
||||||
// no drawing escher records on the workbook
|
// no drawing escher records on the workbook
|
||||||
if(book.getDrawingManager() == null) {
|
if(_book.getDrawingManager() == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int found = sheet.aggregateDrawingRecords(
|
int found = _sheet.aggregateDrawingRecords(
|
||||||
book.getDrawingManager(), false
|
_book.getDrawingManager(), false
|
||||||
);
|
);
|
||||||
if(found == -1) {
|
if(found == -1) {
|
||||||
// Workbook has drawing stuff, but this sheet doesn't
|
// Workbook has drawing stuff, but this sheet doesn't
|
||||||
@ -1516,7 +1516,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Grab our aggregate record, and wire it up
|
// Grab our aggregate record, and wire it up
|
||||||
EscherAggregate agg = (EscherAggregate) sheet.findFirstRecordBySid(EscherAggregate.sid);
|
EscherAggregate agg = (EscherAggregate) _sheet.findFirstRecordBySid(EscherAggregate.sid);
|
||||||
return agg;
|
return agg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1574,7 +1574,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param collapsed true = collapse group, false = expand group.
|
* @param collapsed true = collapse group, false = expand group.
|
||||||
*/
|
*/
|
||||||
public void setColumnGroupCollapsed(int columnNumber, boolean collapsed) {
|
public void setColumnGroupCollapsed(int columnNumber, boolean collapsed) {
|
||||||
sheet.setColumnGroupCollapsed(columnNumber, collapsed);
|
_sheet.setColumnGroupCollapsed(columnNumber, collapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1584,11 +1584,11 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param toColumn end of the column range.
|
* @param toColumn end of the column range.
|
||||||
*/
|
*/
|
||||||
public void groupColumn(int fromColumn, int toColumn) {
|
public void groupColumn(int fromColumn, int toColumn) {
|
||||||
sheet.groupColumnRange(fromColumn, toColumn, true);
|
_sheet.groupColumnRange(fromColumn, toColumn, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ungroupColumn(int fromColumn, int toColumn) {
|
public void ungroupColumn(int fromColumn, int toColumn) {
|
||||||
sheet.groupColumnRange(fromColumn, toColumn, false);
|
_sheet.groupColumnRange(fromColumn, toColumn, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1598,18 +1598,18 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param toRow end row (0-based)
|
* @param toRow end row (0-based)
|
||||||
*/
|
*/
|
||||||
public void groupRow(int fromRow, int toRow) {
|
public void groupRow(int fromRow, int toRow) {
|
||||||
sheet.groupRowRange(fromRow, toRow, true);
|
_sheet.groupRowRange(fromRow, toRow, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ungroupRow(int fromRow, int toRow) {
|
public void ungroupRow(int fromRow, int toRow) {
|
||||||
sheet.groupRowRange(fromRow, toRow, false);
|
_sheet.groupRowRange(fromRow, toRow, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRowGroupCollapsed(int rowIndex, boolean collapse) {
|
public void setRowGroupCollapsed(int rowIndex, boolean collapse) {
|
||||||
if (collapse) {
|
if (collapse) {
|
||||||
sheet.getRowsAggregate().collapseRow(rowIndex);
|
_sheet.getRowsAggregate().collapseRow(rowIndex);
|
||||||
} else {
|
} else {
|
||||||
sheet.getRowsAggregate().expandRow(rowIndex);
|
_sheet.getRowsAggregate().expandRow(rowIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1620,7 +1620,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
* @param style the style to set
|
* @param style the style to set
|
||||||
*/
|
*/
|
||||||
public void setDefaultColumnStyle(int column, CellStyle style) {
|
public void setDefaultColumnStyle(int column, CellStyle style) {
|
||||||
sheet.setDefaultColumnStyle(column, ((HSSFCellStyle)style).getIndex());
|
_sheet.setDefaultColumnStyle(column, ((HSSFCellStyle)style).getIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1667,7 +1667,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
FontRenderContext frc = new FontRenderContext(null, true, true);
|
FontRenderContext frc = new FontRenderContext(null, true, true);
|
||||||
|
|
||||||
HSSFWorkbook wb = new HSSFWorkbook(book);
|
HSSFWorkbook wb = new HSSFWorkbook(_book);
|
||||||
HSSFFont defaultFont = wb.getFontAt((short) 0);
|
HSSFFont defaultFont = wb.getFontAt((short) 0);
|
||||||
|
|
||||||
str = new AttributedString("" + defaultChar);
|
str = new AttributedString("" + defaultChar);
|
||||||
@ -1677,7 +1677,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
|
|
||||||
double width = -1;
|
double width = -1;
|
||||||
rows:
|
rows:
|
||||||
for (Iterator it = rowIterator(); it.hasNext();) {
|
for (Iterator<Row> it = rowIterator(); it.hasNext();) {
|
||||||
HSSFRow row = (HSSFRow) it.next();
|
HSSFRow row = (HSSFRow) it.next();
|
||||||
HSSFCell cell = row.getCell(column);
|
HSSFCell cell = row.getCell(column);
|
||||||
|
|
||||||
@ -1788,7 +1788,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
if (width > Short.MAX_VALUE) { //width can be bigger that Short.MAX_VALUE!
|
if (width > Short.MAX_VALUE) { //width can be bigger that Short.MAX_VALUE!
|
||||||
width = Short.MAX_VALUE;
|
width = Short.MAX_VALUE;
|
||||||
}
|
}
|
||||||
sheet.setColumnWidth(column, (short) (width));
|
_sheet.setColumnWidth(column, (short) (width));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1817,11 +1817,10 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
HSSFCell c = r.getCell(column);
|
HSSFCell c = r.getCell(column);
|
||||||
if(c != null) {
|
if(c != null) {
|
||||||
return c.getCellComment();
|
return c.getCellComment();
|
||||||
} else {
|
|
||||||
// No cell, so you will get new
|
|
||||||
// objects every time, sorry...
|
|
||||||
return HSSFCell.findCellComment(sheet, row, column);
|
|
||||||
}
|
}
|
||||||
|
// No cell, so you will get new
|
||||||
|
// objects every time, sorry...
|
||||||
|
return HSSFCell.findCellComment(_sheet, row, column);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user