aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/ss/usermodel
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/poi/ss/usermodel')
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Picture.java67
-rw-r--r--src/java/org/apache/poi/ss/usermodel/PictureData.java12
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Sheet.java21
3 files changed, 84 insertions, 16 deletions
diff --git a/src/java/org/apache/poi/ss/usermodel/Picture.java b/src/java/org/apache/poi/ss/usermodel/Picture.java
index c79260c6ee..58ad448125 100644
--- a/src/java/org/apache/poi/ss/usermodel/Picture.java
+++ b/src/java/org/apache/poi/ss/usermodel/Picture.java
@@ -16,6 +16,9 @@
==================================================================== */
package org.apache.poi.ss.usermodel;
+import java.awt.Dimension;
+
+
/**
* Repersents a picture in a SpreadsheetML document
*
@@ -24,38 +27,76 @@ package org.apache.poi.ss.usermodel;
public interface Picture {
/**
- * Reset the image to the original size.
+ * Reset the image to the dimension of the embedded image
*
- * <p>
- * Please note, that this method works correctly only for workbooks
- * with default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx).
- * If the default font is changed the resized image can be streched vertically or horizontally.
- * </p>
+ * @see #resize(double, double)
*/
void resize();
/**
- * Reset the image to the original size.
+ * Resize the image proportionally.
*
+ * @see #resize(double, double)
+ */
+ void resize(double scale);
+
+ /**
+ * Resize the image.
* <p>
* Please note, that this method works correctly only for workbooks
- * with default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx).
- * If the default font is changed the resize() procedure can be 'off'.
+ * with the default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx).
+ * If the default font is changed the resized image can be streched vertically or horizontally.
+ * </p>
+ * <p>
+ * <code>resize(1.0,1.0)</code> keeps the original size,<br/>
+ * <code>resize(0.5,0.5)</code> resize to 50% of the original,<br/>
+ * <code>resize(2.0,2.0)</code> resizes to 200% of the original.<br/>
+ * <code>resize({@link Double#MAX_VALUE},{@link Double#MAX_VALUE})</code> resizes to the dimension of the embedded image.
* </p>
*
- * @param scale the amount by which image dimensions are multiplied relative to the original size.
- * <code>resize(1.0)</code> sets the original size, <code>resize(0.5)</code> resize to 50% of the original,
- * <code>resize(2.0)</code> resizes to 200% of the original.
+ * @param scaleX the amount by which the image width is multiplied relative to the original width.
+ * @param scaleY the amount by which the image height is multiplied relative to the original height.
*/
- void resize(double scale);
+ void resize(double scaleX, double scaleY);
+ /**
+ * Calculate the preferred size for this picture.
+ *
+ * @return XSSFClientAnchor with the preferred size for this image
+ */
ClientAnchor getPreferredSize();
/**
+ * Calculate the preferred size for this picture.
+ *
+ * @param scaleX the amount by which image width is multiplied relative to the original width.
+ * @param scaleY the amount by which image height is multiplied relative to the original height.
+ * @return ClientAnchor with the preferred size for this image
+ */
+ ClientAnchor getPreferredSize(double scaleX, double scaleY);
+
+ /**
+ * Return the dimension of the embedded image in pixel
+ *
+ * @return image dimension in pixels
+ */
+ Dimension getImageDimension();
+
+ /**
* Return picture data for this picture
*
* @return picture data for this picture
*/
PictureData getPictureData();
+ /**
+ * @return the anchor that is used by this picture
+ */
+ ClientAnchor getClientAnchor();
+
+
+ /**
+ * @return the sheet which contains the picture
+ */
+ Sheet getSheet();
}
diff --git a/src/java/org/apache/poi/ss/usermodel/PictureData.java b/src/java/org/apache/poi/ss/usermodel/PictureData.java
index 954337829d..67d3cefcd1 100644
--- a/src/java/org/apache/poi/ss/usermodel/PictureData.java
+++ b/src/java/org/apache/poi/ss/usermodel/PictureData.java
@@ -37,4 +37,16 @@ public interface PictureData {
* Returns the mime type for the image
*/
String getMimeType();
+
+ /**
+ * @return the POI internal image type, 0 if unknown image type
+ *
+ * @see Workbook#PICTURE_TYPE_DIB
+ * @see Workbook#PICTURE_TYPE_EMF
+ * @see Workbook#PICTURE_TYPE_JPEG
+ * @see Workbook#PICTURE_TYPE_PICT
+ * @see Workbook#PICTURE_TYPE_PNG
+ * @see Workbook#PICTURE_TYPE_WMF
+ */
+ int getPictureType();
} \ No newline at end of file
diff --git a/src/java/org/apache/poi/ss/usermodel/Sheet.java b/src/java/org/apache/poi/ss/usermodel/Sheet.java
index 57c8785c6c..d1bd67416a 100644
--- a/src/java/org/apache/poi/ss/usermodel/Sheet.java
+++ b/src/java/org/apache/poi/ss/usermodel/Sheet.java
@@ -186,12 +186,27 @@ public interface Sheet extends Iterable<Row> {
* using the default font (first font in the workbook)
* </p>
*
- * @param columnIndex - the column to set (0-based)
+ * @param columnIndex - the column to get (0-based)
* @return width - the width in units of 1/256th of a character width
*/
int getColumnWidth(int columnIndex);
/**
+ * get the width in pixel
+ *
+ * <p>
+ * Please note, that this method works correctly only for workbooks
+ * with the default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx).
+ * If the default font is changed the column width can be streched
+ * </p>
+ *
+ * @param columnIndex - the column to set (0-based)
+ * @return width in pixels
+ */
+ float getColumnWidthInPixels(int columnIndex);
+
+
+ /**
* Set the default column width for the sheet (if the columns do not define their own width)
* in characters
*
@@ -214,7 +229,7 @@ public interface Sheet extends Iterable<Row> {
* @return default row height measured in twips (1/20 of a point)
*/
short getDefaultRowHeight();
-
+
/**
* Get the default row height for the sheet (if the rows do not define their own height) in
* points.
@@ -922,7 +937,7 @@ public interface Sheet extends Iterable<Row> {
public DataValidationHelper getDataValidationHelper();
- /**
+ /**
* Returns the list of DataValidation in the sheet.
* @return list of DataValidation in the sheet
*/