/** * Return the font color. * <p> * Null will be returned if there is no font color setting. * * @return the font color */ public Color getFontColor() { String color = mElement.getFoColorAttribute(); if (color != null) return Color.valueOf(mElement.getFoColorAttribute()); else return null; }
/** * Return the font family name for a specific script type * <p> * Null will be returned if there is no font family name definition for this * script type. * * @param type - script type * @return the font family name for a specific script type */ public String getFontFamilyName(Document.ScriptType type) { switch (type) { case WESTERN: return mElement.getFoFontFamilyAttribute(); case CJK: return mElement.getStyleFontFamilyAsianAttribute(); case CTL: return mElement.getStyleFontFamilyComplexAttribute(); } return null; }
/** * Return the font name for a specific script type * <p> * Null will be returned if there is no font name setting for this script * type. * * @param type - script type * @return the font name for a specific script type */ public String getFontName(Document.ScriptType type) { if (type == null) { return null; } switch (type) { case WESTERN: return mElement.getStyleFontNameAttribute(); case CJK: return mElement.getStyleFontNameAsianAttribute(); case CTL: return mElement.getStyleFontNameComplexAttribute(); } return null; }
/** * Return the font text line style * <p> * TextLineStyle.REGULAR will be returned if there is no text line style setting * * @return the font style */ public StyleTypeDefinitions.TextLinePosition getTextLineStyle() { String throughLine = mElement.getStyleTextLineThroughStyleAttribute(); String underLine = mElement.getStyleTextUnderlineStyleAttribute(); if (throughLine ==null && underLine == null) return StyleTypeDefinitions.TextLinePosition.REGULAR; if (throughLine !=null && underLine == null) return StyleTypeDefinitions.TextLinePosition.THROUGH; if (throughLine !=null && underLine != null) return StyleTypeDefinitions.TextLinePosition.THROUGHUNDER; if (throughLine ==null && underLine != null) return StyleTypeDefinitions.TextLinePosition.UNDER; return null; }
String backgroundColor = ele.getFoBackgroundColorAttribute(); if ( StringUtils.isNotEmpty( backgroundColor ) ) String color = ele.getFoColorAttribute(); if ( StringUtils.isNotEmpty( color ) ) String fontFamily = ele.getFoFontFamilyAttribute(); if ( StringUtils.isNotEmpty( fontFamily ) ) String fontFamilyAsian = ele.getStyleFontFamilyAsianAttribute(); if ( StringUtils.isNotEmpty( fontFamilyAsian ) ) String fontFamilyComplex = ele.getStyleFontFamilyComplexAttribute(); if ( StringUtils.isNotEmpty( fontFamilyComplex ) ) String fontName = ele.getStyleFontNameAttribute(); if ( StringUtils.isNotEmpty( fontName ) ) String fontNameAsian = ele.getStyleFontNameAsianAttribute(); if ( StringUtils.isNotEmpty( fontNameAsian ) ) String fontNameComplex = ele.getStyleFontNameComplexAttribute(); if ( StringUtils.isNotEmpty( fontNameComplex ) ) String fontSize = ele.getFoFontSizeAttribute(); if ( StringUtils.isNotEmpty( fontSize ) ) String fontSizeAsian = ele.getStyleFontSizeAsianAttribute(); if ( StringUtils.isNotEmpty( fontSizeAsian ) )
String backgroundColor = ele.getFoBackgroundColorAttribute(); if (StringUtils.isNotEmpty(backgroundColor)) { cssStyleSheet.setCSSProperty(BACKGROUND_COLOR, backgroundColor); String color = ele.getFoColorAttribute(); if (StringUtils.isNotEmpty(color)) { cssStyleSheet.setCSSProperty(COLOR, color); String fontFamily = ele.getFoFontFamilyAttribute(); if (StringUtils.isNotEmpty(fontFamily)) { cssStyleSheet.setCSSProperty(FONT_FAMILY, "\"" + fontFamily + "\""); String fontName = ele.getStyleFontNameAttribute(); if (StringUtils.isNotEmpty(fontName)) { cssStyleSheet.setCSSProperty(FONT_FAMILY, "\"" + fontName + "\""); String fontSize = ele.getFoFontSizeAttribute(); if (StringUtils.isNotEmpty(fontSize)) { cssStyleSheet.setCSSProperty(FONT_SIZE, fontSize); String fontStyle = ele.getFoFontStyleAttribute(); if (StringUtils.isNotEmpty(fontStyle)) { cssStyleSheet.setCSSProperty(FONT_STYLE, fontStyle); String fontVariant = ele.getFoFontVariantAttribute(); if (StringUtils.isNotEmpty(fontVariant)) { cssStyleSheet.setCSSProperty(FONT_VARIANT, fontVariant); String fontWeight = ele.getFoFontWeightAttribute();
switch (type) { case WESTERN: fontstyle = mElement.getFoFontStyleAttribute(); fontweight = mElement.getFoFontWeightAttribute(); break; case CJK: fontstyle = mElement.getStyleFontStyleAsianAttribute(); fontweight = mElement.getStyleFontWeightAsianAttribute(); break; case CTL: fontstyle = mElement.getStyleFontStyleComplexAttribute(); fontweight = mElement.getStyleFontWeightComplexAttribute(); break;
switch (type) { case WESTERN: fontsize = mElement.getFoFontSizeAttribute(); break; case CJK: fontsize = mElement.getStyleFontSizeAsianAttribute(); break; case CTL: fontsize = mElement.getStyleFontSizeComplexAttribute(); break;
/** * Return the font style for western characters * <p> * Null will be returned if there is no font style setting for western * characters * * @return the font style */ public StyleTypeDefinitions.FontStyle getFontStyle() { String fontstyle = mElement.getFoFontStyleAttribute(); String fontweight = mElement.getFoFontWeightAttribute(); StyleTypeDefinitions.OdfFontStyle theFontType = StyleTypeDefinitions.OdfFontStyle.enumValueOf(fontstyle); StyleTypeDefinitions.OdfFontWeight theFontWeight = StyleTypeDefinitions.OdfFontWeight.enumValueOf(fontweight); if (theFontType == StyleTypeDefinitions.OdfFontStyle.NORMAL && theFontWeight == StyleTypeDefinitions.OdfFontWeight.NORMAL) { return StyleTypeDefinitions.FontStyle.REGULAR; } if (theFontType == StyleTypeDefinitions.OdfFontStyle.ITALIC && theFontWeight == StyleTypeDefinitions.OdfFontWeight.NORMAL) { return StyleTypeDefinitions.FontStyle.ITALIC; } if (theFontType == StyleTypeDefinitions.OdfFontStyle.ITALIC && theFontWeight == StyleTypeDefinitions.OdfFontWeight.BOLD) { return StyleTypeDefinitions.FontStyle.BOLDITALIC; } if (theFontType == StyleTypeDefinitions.OdfFontStyle.NORMAL && theFontWeight == StyleTypeDefinitions.OdfFontWeight.BOLD) { return StyleTypeDefinitions.FontStyle.BOLD; } return null; }
/** * Return the font name for western characters. * <p> * Null will be returned if there is no font name setting for western * characters. * * @return the font style for western characters */ public String getFontName() { return mElement.getStyleFontNameAttribute(); }
/** * Return the font size definition in measurement point(PT) for western * characters. * <p> * Zero will be returned if there is no font size definition for western * characters. * <p> * Zero will be returned if the line measurement is not point(PT). * * @return the font size in measurement point(PT) */ public double getFontSizeInPoint() { String fontsize = mElement.getFoFontSizeAttribute(); if (fontsize.endsWith("pt")) { fontsize = fontsize.substring(0, fontsize.length() - 2); double iSize; try { iSize = Double.parseDouble(fontsize.trim()); } catch (Exception e) { iSize = 0; } return iSize; } return 0; }
/** * * Gets backgroundColor represented by the OpenDocument format used data * type {@odf.datatype color} See * <a href="http://www.w3.org/TR/CSS21/syndata.html#value-def-color">W3C CSS * specification</a> for further details. * * @return bkColor as String (see above) */ public String getBackgroundColorAttribute() { return mElement.getFoBackgroundColorAttribute(); }
String backgroundColor = ele.getFoBackgroundColorAttribute(); if ( StringUtils.isNotEmpty( backgroundColor ) ) String color = ele.getFoColorAttribute(); if ( StringUtils.isNotEmpty( color ) ) String fontFamily = ele.getFoFontFamilyAttribute(); if ( StringUtils.isNotEmpty( fontFamily ) ) String fontFamilyAsian = ele.getStyleFontFamilyAsianAttribute(); if ( StringUtils.isNotEmpty( fontFamilyAsian ) ) String fontFamilyComplex = ele.getStyleFontFamilyComplexAttribute(); if ( StringUtils.isNotEmpty( fontFamilyComplex ) ) String fontName = ele.getStyleFontNameAttribute(); if ( StringUtils.isNotEmpty( fontName ) ) String fontNameAsian = ele.getStyleFontNameAsianAttribute(); if ( StringUtils.isNotEmpty( fontNameAsian ) ) String fontNameComplex = ele.getStyleFontNameComplexAttribute(); if ( StringUtils.isNotEmpty( fontNameComplex ) ) String fontSize = ele.getFoFontSizeAttribute(); if ( StringUtils.isNotEmpty( fontSize ) ) String fontSizeAsian = ele.getStyleFontSizeAsianAttribute(); if ( StringUtils.isNotEmpty( fontSizeAsian ) )
String backgroundColor = ele.getFoBackgroundColorAttribute(); if ( StringUtils.isNotEmpty( backgroundColor ) ) String color = ele.getFoColorAttribute(); if ( StringUtils.isNotEmpty( color ) ) String fontFamily = ele.getFoFontFamilyAttribute(); if ( StringUtils.isNotEmpty( fontFamily ) ) String fontName = ele.getStyleFontNameAttribute(); if ( StringUtils.isNotEmpty( fontName ) ) String fontSize = ele.getFoFontSizeAttribute(); if ( StringUtils.isNotEmpty( fontSize ) ) String fontStyle = ele.getFoFontStyleAttribute(); if ( StringUtils.isNotEmpty( fontStyle ) ) String fontVariant = ele.getFoFontVariantAttribute(); if ( StringUtils.isNotEmpty( fontVariant ) ) String fontWeight = ele.getFoFontWeightAttribute(); if ( StringUtils.isNotEmpty( fontWeight ) ) String underlineStyle = ele.getStyleTextUnderlineStyleAttribute(); if ( StringUtils.isNotEmpty( underlineStyle ) && !underlineStyle.equals( "none" ) ) String underlineType = ele.getStyleTextUnderlineTypeAttribute(); if ( StringUtils.isNotEmpty( underlineType ) && !underlineType.equals( "none" ) )
switch (type) { case WESTERN: fontstyle = mElement.getFoFontStyleAttribute(); fontweight = mElement.getFoFontWeightAttribute(); break; case CJK: fontstyle = mElement.getStyleFontStyleAsianAttribute(); fontweight = mElement.getStyleFontWeightAsianAttribute(); break; case CTL: fontstyle = mElement.getStyleFontStyleComplexAttribute(); fontweight = mElement.getStyleFontWeightComplexAttribute(); break;
switch (type) { case WESTERN: fontsize = mElement.getFoFontSizeAttribute(); break; case CJK: fontsize = mElement.getStyleFontSizeAsianAttribute(); break; case CTL: fontsize = mElement.getStyleFontSizeComplexAttribute(); break;
/** * Return the font style for western characters * <p> * Null will be returned if there is no font style setting for western * characters * * @return the font style */ public StyleTypeDefinitions.FontStyle getFontStyle() { String fontstyle = mElement.getFoFontStyleAttribute(); String fontweight = mElement.getFoFontWeightAttribute(); StyleTypeDefinitions.OdfFontStyle theFontType = StyleTypeDefinitions.OdfFontStyle.enumValueOf(fontstyle); StyleTypeDefinitions.OdfFontWeight theFontWeight = StyleTypeDefinitions.OdfFontWeight.enumValueOf(fontweight); if (theFontType == StyleTypeDefinitions.OdfFontStyle.NORMAL && theFontWeight == StyleTypeDefinitions.OdfFontWeight.NORMAL) return StyleTypeDefinitions.FontStyle.REGULAR; if (theFontType == StyleTypeDefinitions.OdfFontStyle.ITALIC && theFontWeight == StyleTypeDefinitions.OdfFontWeight.NORMAL) return StyleTypeDefinitions.FontStyle.ITALIC; if (theFontType == StyleTypeDefinitions.OdfFontStyle.ITALIC && theFontWeight == StyleTypeDefinitions.OdfFontWeight.BOLD) return StyleTypeDefinitions.FontStyle.BOLDITALIC; if (theFontType == StyleTypeDefinitions.OdfFontStyle.NORMAL && theFontWeight == StyleTypeDefinitions.OdfFontWeight.BOLD) return StyleTypeDefinitions.FontStyle.BOLD; return null; }
/** * Return the font text line style * <p> * TextLineStyle.REGULAR will be returned if there is no text line style * setting * * @return the font style */ public StyleTypeDefinitions.TextLinePosition getTextLineStyle() { String throughLine = mElement.getStyleTextLineThroughStyleAttribute(); String underLine = mElement.getStyleTextUnderlineStyleAttribute(); if (throughLine == null && underLine == null) { return StyleTypeDefinitions.TextLinePosition.REGULAR; } if (throughLine != null && underLine == null) { return StyleTypeDefinitions.TextLinePosition.THROUGH; } if (throughLine != null && underLine != null) { return StyleTypeDefinitions.TextLinePosition.THROUGHUNDER; } if (throughLine == null && underLine != null) { return StyleTypeDefinitions.TextLinePosition.UNDER; } return null; }
/** * Return the font name for western characters. * <p> * Null will be returned if there is no font name setting for western * characters. * * @return the font style for western characters */ public String getFontName() { return mElement.getStyleFontNameAttribute(); }
/** * Return the font size definition in measurement point(PT) for western * characters. * <p> * Zero will be returned if there is no font size definition for western * characters. * <p> * Zero will be returned if the line measurement is not point(PT). * * @return the font size in measurement point(PT) */ public double getFontSizeInPoint() { String fontsize = mElement.getFoFontSizeAttribute(); if (fontsize.endsWith("pt")) { fontsize = fontsize.substring(0, fontsize.length() - 2); double iSize; try { iSize = Double.parseDouble(fontsize.trim()); } catch (Exception e) { iSize = 0; } return iSize; } return 0; }