org.apache.poi.hssf.usermodel
Class HSSFClientAnchor

java.lang.Object
  extended by org.apache.poi.hssf.usermodel.HSSFAnchor
      extended by org.apache.poi.hssf.usermodel.HSSFClientAnchor
All Implemented Interfaces:
ClientAnchor

public final class HSSFClientAnchor
extends HSSFAnchor
implements ClientAnchor

A client anchor is attached to an excel worksheet. It anchors against a top-left and buttom-right cell.

Author:
Glen Stampoultzis (glens at apache.org)

Field Summary
 
Fields inherited from class org.apache.poi.hssf.usermodel.HSSFAnchor
_isHorizontallyFlipped, _isVerticallyFlipped
 
Fields inherited from interface org.apache.poi.ss.usermodel.ClientAnchor
DONT_MOVE_AND_RESIZE, MOVE_AND_RESIZE, MOVE_DONT_RESIZE
 
Constructor Summary
HSSFClientAnchor()
          Creates a new client anchor and defaults all the anchor positions to 0.
HSSFClientAnchor(EscherClientAnchorRecord escherClientAnchorRecord)
           
HSSFClientAnchor(int dx1, int dy1, int dx2, int dy2, short col1, int row1, short col2, int row2)
          Creates a new client anchor and sets the top-left and bottom-right coordinates of the anchor.
 
Method Summary
protected  void createEscherAnchor()
           
 boolean equals(java.lang.Object obj)
           
 float getAnchorHeightInPoints(HSSFSheet sheet)
          Calculates the height of a client anchor in points.
 int getAnchorType()
          Gets the anchor type

0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.

 short getCol1()
          Returns the column (0 based) of the first cell.
 short getCol2()
          Returns the column (0 based) of the second cell.
 int getDx1()
          Returns the x coordinate within the first cell.
 int getDx2()
          Returns the x coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL
 int getDy1()
          Returns the y coordinate within the first cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL
 int getDy2()
          Sets the y coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL
protected  EscherRecord getEscherAnchor()
           
 int getRow1()
          Returns the row (0 based) of the first cell.
 int getRow2()
          Returns the row (0 based) of the second cell.
 boolean isHorizontallyFlipped()
           
 boolean isVerticallyFlipped()
           
 void setAnchor(short col1, int row1, int x1, int y1, short col2, int row2, int x2, int y2)
          Dets the top-left and bottom-right coordinates of the anchor.
 void setAnchorType(int anchorType)
          Sets the anchor type

0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.

 void setCol1(int col1)
          Sets the column (0 based) of the first cell.
 void setCol1(short col1)
           
 void setCol2(int col2)
          Returns the column (0 based) of the second cell.
 void setCol2(short col2)
           
 void setDx1(int dx1)
          Sets the x coordinate within the first cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL
 void setDx2(int dx2)
          Sets the x coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL
 void setDy1(int dy1)
          Sets the y coordinate within the first cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL
 void setDy2(int dy2)
          Sets the y coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL
 void setRow1(int row1)
          Returns the row (0 based) of the first cell.
 void setRow2(int row2)
          Returns the row (0 based) of the first cell.
 
Methods inherited from class org.apache.poi.hssf.usermodel.HSSFAnchor
createAnchorFromEscher
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HSSFClientAnchor

public HSSFClientAnchor(EscherClientAnchorRecord escherClientAnchorRecord)

HSSFClientAnchor

public HSSFClientAnchor()
Creates a new client anchor and defaults all the anchor positions to 0.


HSSFClientAnchor

public HSSFClientAnchor(int dx1,
                        int dy1,
                        int dx2,
                        int dy2,
                        short col1,
                        int row1,
                        short col2,
                        int row2)
Creates a new client anchor and sets the top-left and bottom-right coordinates of the anchor.

Parameters:
dx1 - the x coordinate within the first cell.
dy1 - the y coordinate within the first cell.
dx2 - the x coordinate within the second cell.
dy2 - the y coordinate within the second cell.
col1 - the column (0 based) of the first cell.
row1 - the row (0 based) of the first cell.
col2 - the column (0 based) of the second cell.
row2 - the row (0 based) of the second cell.
Method Detail

getAnchorHeightInPoints

public float getAnchorHeightInPoints(HSSFSheet sheet)
Calculates the height of a client anchor in points.

Parameters:
sheet - the sheet the anchor will be attached to
Returns:
the shape height.

getCol1

public short getCol1()
Description copied from interface: ClientAnchor
Returns the column (0 based) of the first cell.

Specified by:
getCol1 in interface ClientAnchor
Returns:
the column(0 based) of the first cell.

setCol1

public void setCol1(short col1)
Parameters:
col1 - the column(0 based) of the first cell.

setCol1

public void setCol1(int col1)
Description copied from interface: ClientAnchor
Sets the column (0 based) of the first cell.

Specified by:
setCol1 in interface ClientAnchor
Parameters:
col1 - 0-based column of the first cell.

getCol2

public short getCol2()
Description copied from interface: ClientAnchor
Returns the column (0 based) of the second cell.

Specified by:
getCol2 in interface ClientAnchor
Returns:
the column(0 based) of the first cell.

setCol2

public void setCol2(short col2)
Parameters:
col2 - the column(0 based) of the second cell.

setCol2

public void setCol2(int col2)
Description copied from interface: ClientAnchor
Returns the column (0 based) of the second cell.

Specified by:
setCol2 in interface ClientAnchor
Parameters:
col2 - the column(0 based) of the second cell.

getRow1

public int getRow1()
Description copied from interface: ClientAnchor
Returns the row (0 based) of the first cell.

Specified by:
getRow1 in interface ClientAnchor
Returns:
the row(0 based) of the first cell.

setRow1

public void setRow1(int row1)
Description copied from interface: ClientAnchor
Returns the row (0 based) of the first cell.

Specified by:
setRow1 in interface ClientAnchor
Parameters:
row1 - 0-based row of the first cell.

getRow2

public int getRow2()
Description copied from interface: ClientAnchor
Returns the row (0 based) of the second cell.

Specified by:
getRow2 in interface ClientAnchor
Returns:
the row(0 based) of the second cell.

setRow2

public void setRow2(int row2)
Description copied from interface: ClientAnchor
Returns the row (0 based) of the first cell.

Specified by:
setRow2 in interface ClientAnchor
Parameters:
row2 - the row(0 based) of the second cell.

setAnchor

public void setAnchor(short col1,
                      int row1,
                      int x1,
                      int y1,
                      short col2,
                      int row2,
                      int x2,
                      int y2)
Dets the top-left and bottom-right coordinates of the anchor.

Parameters:
x1 - the x coordinate within the first cell.
y1 - the y coordinate within the first cell.
x2 - the x coordinate within the second cell.
y2 - the y coordinate within the second cell.
col1 - the column (0 based) of the first cell.
row1 - the row (0 based) of the first cell.
col2 - the column (0 based) of the second cell.
row2 - the row (0 based) of the second cell.

isHorizontallyFlipped

public boolean isHorizontallyFlipped()
Specified by:
isHorizontallyFlipped in class HSSFAnchor
Returns:
whether this shape is horizontally flipped

isVerticallyFlipped

public boolean isVerticallyFlipped()
Specified by:
isVerticallyFlipped in class HSSFAnchor
Returns:
whether this shape is vertically flipped

getEscherAnchor

protected EscherRecord getEscherAnchor()
Specified by:
getEscherAnchor in class HSSFAnchor

createEscherAnchor

protected void createEscherAnchor()
Specified by:
createEscherAnchor in class HSSFAnchor

getAnchorType

public int getAnchorType()
Gets the anchor type

0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.

Specified by:
getAnchorType in interface ClientAnchor
Returns:
the anchor type
See Also:
ClientAnchor.MOVE_AND_RESIZE, ClientAnchor.MOVE_DONT_RESIZE, ClientAnchor.DONT_MOVE_AND_RESIZE

setAnchorType

public void setAnchorType(int anchorType)
Sets the anchor type

0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.

Specified by:
setAnchorType in interface ClientAnchor
Parameters:
anchorType - the anchor type
See Also:
ClientAnchor.MOVE_AND_RESIZE, ClientAnchor.MOVE_DONT_RESIZE, ClientAnchor.DONT_MOVE_AND_RESIZE

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getDx1

public int getDx1()
Description copied from interface: ClientAnchor
Returns the x coordinate within the first cell. Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL

Specified by:
getDx1 in interface ClientAnchor
Specified by:
getDx1 in class HSSFAnchor
Returns:
x coordinate of the left up corner

setDx1

public void setDx1(int dx1)
Description copied from interface: ClientAnchor
Sets the x coordinate within the first cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL

Specified by:
setDx1 in interface ClientAnchor
Specified by:
setDx1 in class HSSFAnchor
Parameters:
dx1 - x coordinate of the left up corner

getDy1

public int getDy1()
Description copied from interface: ClientAnchor
Returns the y coordinate within the first cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL

Specified by:
getDy1 in interface ClientAnchor
Specified by:
getDy1 in class HSSFAnchor
Returns:
y coordinate of the left up corner

setDy1

public void setDy1(int dy1)
Description copied from interface: ClientAnchor
Sets the y coordinate within the first cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL

Specified by:
setDy1 in interface ClientAnchor
Specified by:
setDy1 in class HSSFAnchor
Parameters:
dy1 - y coordinate of the left up corner

getDy2

public int getDy2()
Description copied from interface: ClientAnchor
Sets the y coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL

Specified by:
getDy2 in interface ClientAnchor
Specified by:
getDy2 in class HSSFAnchor
Returns:
y coordinate of the right down corner

setDy2

public void setDy2(int dy2)
Description copied from interface: ClientAnchor
Sets the y coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL

Specified by:
setDy2 in interface ClientAnchor
Specified by:
setDy2 in class HSSFAnchor
Parameters:
dy2 - y coordinate of the right down corner

getDx2

public int getDx2()
Description copied from interface: ClientAnchor
Returns the x coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL

Specified by:
getDx2 in interface ClientAnchor
Specified by:
getDx2 in class HSSFAnchor
Returns:
x coordinate of the right down corner

setDx2

public void setDx2(int dx2)
Description copied from interface: ClientAnchor
Sets the x coordinate within the second cell Note - XSSF and HSSF have a slightly different coordinate system, values in XSSF are larger by a factor of XSSFShape.EMU_PER_PIXEL

Specified by:
setDx2 in interface ClientAnchor
Specified by:
setDx2 in class HSSFAnchor
Parameters:
dx2 - x coordinate of the right down corner


Copyright 2013 The Apache Software Foundation or its licensors, as applicable.