/** * @param destinationUnit The unit to be converted to * @return The converted value as result */ public String mapToUnit(Unit destinationUnit) { return mapToUnit(mLengthString, destinationUnit); }
/** * @param destinationUnit The unit to be converted to * @return The converted value as result */ public String mapToUnit(Unit destinationUnit) { return mapToUnit(mLengthString, destinationUnit); }
/** * @param destinationUnit The unit to be converted to * @return The converted value as result */ public String mapToUnit(Unit destinationUnit) { return mapToUnit(mLengthString, destinationUnit); }
/** * Returns the provided Millimeter value as Inch value * * @param value the value to set the attribute value to (in Millimeter) */ private static String getInchValue(double value) { // build the string for mm final String mmValueString = value + Unit.MILLIMETER.abbr(); // convert the length to inch final String inchValueString = Length.mapToUnit(mmValueString, Unit.INCH); // return the value return inchValueString; }
/** * Returns the provided Millimeter value as Inch value * * @param value the value to set the attribute value to (in Millimeter) */ private static String getInchValue(double value) { // build the string for mm final String mmValueString = value + Unit.MILLIMETER.abbr(); // convert the length to inch final String inchValueString = Length.mapToUnit(mmValueString, Unit.INCH); // return the value return inchValueString; }
/** * Returns the provided Millimeter value as Inch value * * @param value * the value to set the attribute value to (in Millimeter) */ private static String getInchValue(double value) { // build the string for mm final String mmValueString = value + Unit.MILLIMETER.abbr(); // convert the length to inch final String inchValueString = Length.mapToUnit(mmValueString, Unit.INCH); // return the value return inchValueString; }
/** * Returns the provided Millimeter value as Inch value * * @param value * the value to set the attribute value to (in Millimeter) */ private static String getInchValue(double value) { // build the string for mm final String mmValueString = value + Unit.MILLIMETER.abbr(); // convert the length to inch final String inchValueString = Length.mapToUnit(mmValueString, Unit.INCH); // return the value return inchValueString; }
private void configureInsertedImage(String packagePath) throws Exception { // Set path to image attribute setImagePath(packagePath); // Set mandatory attribute xlink:type setXlinkTypeAttribute("simple"); // A draw:image is always embedded in a draw:frame InputStream is = mOdfPackage.getInputStream(packagePath); OdfDrawFrame odfFrame = (OdfDrawFrame) this.getParentNode(); if (odfFrame != null) { BufferedImage image = ImageIO.read(is); int height = image.getHeight(null); int width = image.getWidth(null); odfFrame.setSvgHeightAttribute(Length.mapToUnit(String.valueOf(height) + "px", Unit.CENTIMETER)); odfFrame.setSvgWidthAttribute(Length.mapToUnit(String.valueOf(width) + "px", Unit.CENTIMETER)); } }
private void configureInsertedImage(String packagePath) throws Exception { // Set path to image attribute setImagePath(packagePath); // Set mandatory attribute xlink:type setXlinkTypeAttribute("simple"); // A draw:image is always embedded in a draw:frame InputStream is = mOdfPackage.getInputStream(packagePath); OdfDrawFrame odfFrame = (OdfDrawFrame) this.getParentNode(); if (odfFrame != null) { BufferedImage image = ImageIO.read(is); // some image formats like SVG might not be understood by ImageIO if (image != null) { int height = image.getHeight(null); int width = image.getWidth(null); odfFrame.setSvgHeightAttribute(Length.mapToUnit(String.valueOf(height) + "px", Unit.CENTIMETER)); odfFrame.setSvgWidthAttribute(Length.mapToUnit(String.valueOf(width) + "px", Unit.CENTIMETER)); } } }
private void configureInsertedImage(String packagePath) throws Exception { // Set path to image attribute setImagePath(packagePath); // Set mandatory attribute xlink:type setXlinkTypeAttribute("simple"); // A draw:image is always embedded in a draw:frame InputStream is = mOdfPackage.getInputStream(packagePath); OdfDrawFrame odfFrame = (OdfDrawFrame) this.getParentNode(); if (odfFrame != null) { BufferedImage image = ImageIO.read(is); // some image formats like SVG might not be understood by ImageIO if (image != null) { int height = image.getHeight(null); int width = image.getWidth(null); odfFrame.setSvgHeightAttribute(Length.mapToUnit(String.valueOf(height) + "px", Unit.CENTIMETER)); odfFrame.setSvgWidthAttribute(Length.mapToUnit(String.valueOf(width) + "px", Unit.CENTIMETER)); } } }
public static URI configureInsertedImage(OdfSchemaDocument mOdfSchemaDoc, DrawImageElement imageElement, String packagePath, boolean isResetSize) throws Exception { // Set path to image attribute URI uri = new URI(AnyURI.encodePath(packagePath).toString()); imageElement.setXlinkHrefAttribute(AnyURI.decodePath(uri.toString())); // Set mandatory attribute xlink:type imageElement.setXlinkTypeAttribute("simple"); // A draw:image is always embedded in a draw:frame InputStream is = mOdfSchemaDoc.getPackage().getInputStream(packagePath); DrawFrameElement odfFrame = (DrawFrameElement) imageElement.getParentNode(); Frame aFrame = Frame.getInstanceof(odfFrame); FrameRectangle oldRect = aFrame.getRectangle(); if (oldRect.getLinearMeasure() != StyleTypeDefinitions.SupportedLinearMeasure.CM) oldRect.setLinearMeasure(StyleTypeDefinitions.SupportedLinearMeasure.CM); if (odfFrame != null) { BufferedImage image = ImageIO.read(is); int height = image.getHeight(null); int width = image.getWidth(null); odfFrame.setSvgHeightAttribute(Length.mapToUnit(String.valueOf(height) + "px", Unit.CENTIMETER)); odfFrame.setSvgWidthAttribute(Length.mapToUnit(String.valueOf(width) + "px", Unit.CENTIMETER)); if (isResetSize) { FrameRectangle newRect = aFrame.getRectangle(); newRect.setX(oldRect.getX()+(oldRect.getWidth()-newRect.getWidth())/2); newRect.setY(oldRect.getY()+(oldRect.getHeight()-newRect.getHeight())/2); aFrame.setRectangle(newRect); } } return uri; }
private static URI configureInsertedImage(OdfSchemaDocument mOdfSchemaDoc, DrawImageElement imageElement, String packagePath, boolean isResetSize) throws Exception { // Set path to image attribute URI uri = new URI(AnyURI.encodePath(packagePath).toString()); imageElement.setXlinkHrefAttribute(AnyURI.decodePath(uri.toString())); // Set mandatory attribute xlink:type imageElement.setXlinkTypeAttribute("simple"); // A draw:image is always embedded in a draw:frame InputStream is = mOdfSchemaDoc.getPackage().getInputStream(packagePath); DrawFrameElement odfFrame = (DrawFrameElement) imageElement.getParentNode(); Frame aFrame = Frame.getInstanceof(odfFrame); FrameRectangle oldRect = aFrame.getRectangle(); if (oldRect.getLinearMeasure() != StyleTypeDefinitions.SupportedLinearMeasure.CM) oldRect.setLinearMeasure(StyleTypeDefinitions.SupportedLinearMeasure.CM); if (odfFrame != null) { BufferedImage image = ImageIO.read(is); int height = image.getHeight(null); int width = image.getWidth(null); odfFrame.setSvgHeightAttribute(Length.mapToUnit(String.valueOf(height) + "px", Unit.CENTIMETER)); odfFrame.setSvgWidthAttribute(Length.mapToUnit(String.valueOf(width) + "px", Unit.CENTIMETER)); if (isResetSize) { FrameRectangle newRect = aFrame.getRectangle(); newRect.setX(oldRect.getX()+(oldRect.getWidth()-newRect.getWidth())/2); newRect.setY(oldRect.getY()+(oldRect.getHeight()-newRect.getHeight())/2); aFrame.setRectangle(newRect); } } return uri; }
public static URI configureInsertedImage(OdfSchemaDocument mOdfSchemaDoc, DrawImageElement imageElement, String packagePath, boolean isResetSize) throws Exception { // Set path to image attribute URI uri = new URI(AnyURI.encodePath(packagePath).toString()); imageElement.setXlinkHrefAttribute(AnyURI.decodePath(uri.toString())); // Set mandatory attribute xlink:type imageElement.setXlinkTypeAttribute("simple"); // A draw:image is always embedded in a draw:frame InputStream is = mOdfSchemaDoc.getPackage().getInputStream(packagePath); DrawFrameElement odfFrame = (DrawFrameElement) imageElement.getParentNode(); Frame aFrame = Frame.getInstanceof(odfFrame); FrameRectangle oldRect = aFrame.getRectangle(); if (oldRect.getLinearMeasure() != StyleTypeDefinitions.SupportedLinearMeasure.CM) oldRect.setLinearMeasure(StyleTypeDefinitions.SupportedLinearMeasure.CM); if (odfFrame != null) { BufferedImage image = ImageIO.read(is); int height = image.getHeight(null); int width = image.getWidth(null); odfFrame.setSvgHeightAttribute(Length.mapToUnit(String.valueOf(height) + "px", Unit.CENTIMETER)); odfFrame.setSvgWidthAttribute(Length.mapToUnit(String.valueOf(width) + "px", Unit.CENTIMETER)); if (isResetSize) { FrameRectangle newRect = aFrame.getRectangle(); newRect.setX(oldRect.getX()+(oldRect.getWidth()-newRect.getWidth())/2); newRect.setY(oldRect.getY()+(oldRect.getHeight()-newRect.getHeight())/2); aFrame.setRectangle(newRect); } } return uri; }
String originalRelWidth = maColumnElement.getProperty(OdfTableColumnProperties.RelColumnWidth); if (originalWidth != null) { columnWidthStr = Length.mapToUnit(originalWidth, Unit.MILLIMETER); columnWidth = PositiveLength.parseLong(columnWidthStr, Unit.MILLIMETER);
String originalRelWidth = maColumnElement.getProperty(OdfTableColumnProperties.RelColumnWidth); if (originalWidth != null) { columnWidthStr = Length.mapToUnit(originalWidth, Unit.MILLIMETER); columnWidth = PositiveLength.parseLong(columnWidthStr, Unit.MILLIMETER);
String originalRelWidth = maColumnElement.getProperty(OdfTableColumnProperties.RelColumnWidth); if (originalWidth != null) { columnWidthStr = Length.mapToUnit(originalWidth, Unit.MILLIMETER); columnWidth = PositiveLength.parseLong(columnWidthStr, Unit.MILLIMETER);