Package org.odftoolkit.odfdom.dom.element

Examples of org.odftoolkit.odfdom.dom.element.OdfStyleBase


    if (mWritableTextProperties != null)
      return mWritableTextProperties;
    else if (mTextProperties != null)
      return mTextProperties;

    OdfStyleBase style = getStyleElementForRead();
    if (style == null) {
      Logger.getLogger(CellStyleHandler.class.getName()).log(Level.FINE, "No style definition is found!", "");
      return null;
    }
    mTextProperties = TextProperties.getTextProperties(style);
View Full Code Here


    if (mWritableTableCellProperties != null)
      return mWritableTableCellProperties;
    else if (mTableCellProperties != null)
      return mTableCellProperties;

    OdfStyleBase style = getStyleElementForRead();
    if (style == null) {
      Logger.getLogger(CellStyleHandler.class.getName()).log(Level.FINE, "No style definition is found!", "");
      return null;
    }
    mTableCellProperties = TableCellProperties.getTableCellProperties(style);
View Full Code Here

    if (mWritableParagraphProperties != null)
      return mWritableParagraphProperties;
    else if (mParagraphProperties != null)
      return mParagraphProperties;

    OdfStyleBase style = getStyleElementForRead();
    if (style == null) {
      Logger.getLogger(CellStyleHandler.class.getName()).log(Level.FINE, "No style definition is found!", "");
      return null;
    }
    mParagraphProperties = ParagraphProperties.getParagraphProperties(style);
View Full Code Here

    if (mWritableGraphicProperties != null)
      return mWritableGraphicProperties;
    else if (mGraphicProperties != null)
      return mGraphicProperties;

    OdfStyleBase style = getStyleElementForRead();
    if (style == null) {
      Logger.getLogger(CellStyleHandler.class.getName()).log(Level.FINE, "No style definition is found!", "");
      return null;
    }
    mGraphicProperties = GraphicProperties.getGraphicProperties(style);
View Full Code Here

   * @since 0.5.5
   */
  public void setVerticalMargin(double spaceTop, double spaceBottom) {
    String tableStyleName = mTableElement.getStyleName();
    OdfOfficeAutomaticStyles automaticStyles = mTableElement.getAutomaticStyles();
    OdfStyleBase tableStyle = automaticStyles.getStyle(tableStyleName, OdfStyleFamily.Table);
    if (tableStyle != null) {
      tableStyle.setProperty(StyleTablePropertiesElement.MarginTop,
          (new DecimalFormat("#0.##").format(spaceTop) + Unit.CENTIMETER.abbr()).replace(",", "."));
      tableStyle.setProperty(StyleTablePropertiesElement.MarginBottom, (new DecimalFormat("#0.##")
          .format(spaceBottom) + Unit.CENTIMETER.abbr()).replace(",", "."));
    }
  }
View Full Code Here

      autoStyles = doc.getContentDom().getAutomaticStyles();
    } catch (Exception e1) {
      Assert.fail("Failed with " + e1.getClass().getName() + ": '" + e1.getMessage() + "'");
    }
    // T4 is the bold style for text
    OdfStyleBase style = autoStyles.getStyle("T4", OdfStyleFamily.Text);
    Assert.assertNotNull(style);

    while (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      try {
View Full Code Here

   *
   * @return a map of text properties.
   */
  private Map<OdfStyleProperty, String> getTextStyleProperties(OdfStylableElement element) {
    String styleName = element.getStyleName();
    OdfStyleBase styleElement = element.getAutomaticStyles().getStyle(styleName, element.getStyleFamily());

    if (styleElement == null) {
      styleElement = element.getDocumentStyle();
    }
    if (styleElement != null) {
      // check if it is the style:defaut-style
      if ((styleElement.getPropertiesElement(OdfStylePropertiesSet.ParagraphProperties) == null)
          && (styleElement.getPropertiesElement(OdfStylePropertiesSet.TextProperties) == null)) {
        styleElement = ((Document) ((OdfFileDom) styleElement.getOwnerDocument()).getDocument())
            .getDocumentStyles().getDefaultStyle(styleElement.getFamily());
      }
      TreeMap<OdfStyleProperty, String> result = new TreeMap<OdfStyleProperty, String>();
      OdfStyleFamily family = OdfStyleFamily.Text;
      if (family != null) {
        for (OdfStyleProperty property : family.getProperties()) {
          if (styleElement.hasProperty(property)) {
            result.put(property, styleElement.getProperty(property));
          }
        }
      }
      return result;
    }
View Full Code Here

   *
   * @return a map of text properties.
   */
  private Map<OdfStyleProperty, String> getTextStylePropertiesDeep(OdfStylableElement element) {
    String styleName = element.getStyleName();
    OdfStyleBase styleElement = element.getAutomaticStyles().getStyle(styleName, element.getStyleFamily());
    if (styleElement == null) {
      styleElement = element.getDocumentStyle();
    }
    TreeMap<OdfStyleProperty, String> result = new TreeMap<OdfStyleProperty, String>();
    while (styleElement != null) {
      // check if it is the style:defaut-style
      if ((styleElement.getPropertiesElement(OdfStylePropertiesSet.ParagraphProperties) == null)
          && (styleElement.getPropertiesElement(OdfStylePropertiesSet.TextProperties) == null)) {
        styleElement = ((Document) ((OdfFileDom) styleElement.getOwnerDocument()).getDocument())
            .getDocumentStyles().getDefaultStyle(styleElement.getFamily());
      }
      OdfStyleFamily family = OdfStyleFamily.Text;
      if (family != null) {
        for (OdfStyleProperty property : family.getProperties()) {
          if (styleElement.hasProperty(property)) {
            result.put(property, styleElement.getProperty(property));
          }
        }
      }
      styleElement = styleElement.getParentStyle();
    }
    return result;
  }
View Full Code Here

   * If no horizontal alignment is set, null will be returned.
   *
   * @return the horizontal alignment setting.
   */
  public String getHorizontalAlignment() {
    OdfStyleBase styleElement = getCellStyleElement();
    if (styleElement != null) {
      OdfStyleProperty property = OdfStyleProperty.get(OdfStylePropertiesSet.ParagraphProperties,
          OdfName.newName(OdfDocumentNamespace.FO, "text-align"));
      return styleElement.getProperty(property);
    }
    return null;
  }
View Full Code Here

    }
    if (FoTextAlignAttribute.Value.RIGHT.toString().equalsIgnoreCase(horizontalAlignment)) {
      horizontalAlignment = FoTextAlignAttribute.Value.END.toString();
    }
    splitRepeatedCells();
    OdfStyleBase styleElement = getCellStyleElementForWrite();
    if (styleElement != null) {
      OdfStyleProperty property = OdfStyleProperty.get(OdfStylePropertiesSet.ParagraphProperties, OdfName.newName(
          OdfDocumentNamespace.FO, "text-align"));
      if (horizontalAlignment != null) {
        styleElement.setProperty(property, horizontalAlignment);
      } else {
        styleElement.removeProperty(property);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.OdfStyleBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.