Package org.odftoolkit.odfdom.dom.element

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


   * get a map containing text properties of the specified styleable element.
   * @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 = ((OdfDocument) ((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 = ((OdfDocument) ((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

      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

          }
          if (node instanceof OdfStylableElement) {
            try {
              //LOG.info(indent + "-style info...");
              OdfStylableElement se = (OdfStylableElement) node;
              OdfStyleBase as = se.getAutomaticStyle();
              OdfStyle ds = se.getDocumentStyle();
              if (as != null) {
                LOG.log(INFO, "{0}-AutomaticStyle: {1}", new Object[]{indent, as});
              }
              if (ds != null) {
View Full Code Here

      if (mWritablePageLayoutProperties != null)
        return mWritablePageLayoutProperties;
      else if (mPageLayoutProperties != null)
        return mPageLayoutProperties;

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

    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

    if (mWritableTableProperties != null)
      return mWritableTableProperties;
    else if (mTableProperties != null)
      return mTableProperties;

    OdfStyleBase style = getStyleElementForRead();
    if (style == null) {
      Logger.getLogger(DefaultStyleHandler.class.getName()).log(
          Level.FINE, "No style definition is found!", "");
      return null;
    }
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.