org.apache.poi.xssf.streaming
Class SXSSFPicture

java.lang.Object
  extended by org.apache.poi.xssf.streaming.SXSSFPicture
All Implemented Interfaces:
Picture, Shape

public final class SXSSFPicture
extends java.lang.Object
implements Picture

Streaming version of Picture. Most of the code is a copy of the non-streaming XSSFPicture code. This is necessary as a private method getRowHeightInPixels of that class needs to be changed, which is called by a method call chain nested several levels. The main change is to access the rows in the SXSSF sheet, not the always empty rows in the XSSF sheet when checking the row heights.


Method Summary
 XSSFAnchor getAnchor()
           
 XSSFClientAnchor getClientAnchor()
           
 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture getCTPicture()
          Return the underlying CTPicture bean that holds all properties for this picture
 XSSFDrawing getDrawing()
           
 java.awt.Dimension getImageDimension()
           
protected static java.awt.Dimension getImageDimension(PackagePart part, int type)
          Return the dimension of this image
 Shape getParent()
           
 XSSFPictureData getPictureData()
          Return picture data for this shape
 XSSFClientAnchor getPreferredSize()
          Calculate the preferred size for this picture.
 XSSFClientAnchor getPreferredSize(double scale)
          Calculate the preferred size for this picture.
 XSSFClientAnchor getPreferredSize(double scaleX, double scaleY)
           
 java.lang.String getShapeName()
           
protected  org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties getShapeProperties()
           
 XSSFSheet getSheet()
           
 boolean isNoFill()
           
 void resize()
          Reset the image to the original size.
 void resize(double scale)
          Reset the image to the original size.
 void resize(double scaleX, double scaleY)
           
 void setFillColor(int red, int green, int blue)
           
 void setLineStyleColor(int red, int green, int blue)
           
 void setNoFill(boolean noFill)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCTPicture

@Internal
public org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture getCTPicture()
Return the underlying CTPicture bean that holds all properties for this picture

Returns:
the underlying CTPicture bean

resize

public void resize()
Reset the image to the original size.

Please note, that this method works correctly only for workbooks with the default font size (Calibri 11pt for .xlsx). If the default font is changed the resized image can be streched vertically or horizontally.

Specified by:
resize in interface Picture

resize

public void resize(double scale)
Reset the image to the original size.

Please note, that this method works correctly only for workbooks with the default font size (Calibri 11pt for .xlsx). If the default font is changed the resized image can be streched vertically or horizontally.

Specified by:
resize in interface Picture
Parameters:
scale - the amount by which image dimensions are multiplied relative to the original size. resize(1.0) sets the original size, resize(0.5) resize to 50% of the original, resize(2.0) resizes to 200% of the original.

getPreferredSize

public XSSFClientAnchor getPreferredSize()
Calculate the preferred size for this picture.

Specified by:
getPreferredSize in interface Picture
Returns:
XSSFClientAnchor with the preferred size for this image

getPreferredSize

public XSSFClientAnchor getPreferredSize(double scale)
Calculate the preferred size for this picture.

Parameters:
scale - the amount by which image dimensions are multiplied relative to the original size.
Returns:
XSSFClientAnchor with the preferred size for this image

getImageDimension

protected static java.awt.Dimension getImageDimension(PackagePart part,
                                                      int type)
Return the dimension of this image

Parameters:
part - the package part holding raw picture data
type - type of the picture: Workbook.PICTURE_TYPE_JPEG, Workbook.PICTURE_TYPE_PNG or Workbook.PICTURE_TYPE_DIB
Returns:
image dimension in pixels

getPictureData

public XSSFPictureData getPictureData()
Return picture data for this shape

Specified by:
getPictureData in interface Picture
Returns:
picture data for this shape

getShapeProperties

protected org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties getShapeProperties()

getAnchor

public XSSFAnchor getAnchor()
Specified by:
getAnchor in interface Shape

resize

public void resize(double scaleX,
                   double scaleY)
Specified by:
resize in interface Picture

getPreferredSize

public XSSFClientAnchor getPreferredSize(double scaleX,
                                         double scaleY)
Specified by:
getPreferredSize in interface Picture

getImageDimension

public java.awt.Dimension getImageDimension()
Specified by:
getImageDimension in interface Picture

getClientAnchor

public XSSFClientAnchor getClientAnchor()
Specified by:
getClientAnchor in interface Picture

getDrawing

public XSSFDrawing getDrawing()

getSheet

public XSSFSheet getSheet()
Specified by:
getSheet in interface Picture

getShapeName

public java.lang.String getShapeName()
Specified by:
getShapeName in interface Shape

getParent

public Shape getParent()
Specified by:
getParent in interface Shape

isNoFill

public boolean isNoFill()
Specified by:
isNoFill in interface Shape

setNoFill

public void setNoFill(boolean noFill)
Specified by:
setNoFill in interface Shape

setFillColor

public void setFillColor(int red,
                         int green,
                         int blue)
Specified by:
setFillColor in interface Shape

setLineStyleColor

public void setLineStyleColor(int red,
                              int green,
                              int blue)
Specified by:
setLineStyleColor in interface Shape