Package org.odftoolkit.simple.style

Examples of org.odftoolkit.simple.style.ParagraphProperties


   * @return the horizontal alignment; null if there is no horizontal
   *         alignment setting.
   */
  public HorizontalAlignmentType getHorizontalAlignment() {
    HorizontalAlignmentType tempAlign = null;
    ParagraphProperties properties = getParagraphPropertiesForRead();
    if (properties != null) {
      tempAlign = properties.getHorizontalAlignment();
    }
    if (tempAlign != null) {
      return tempAlign;
    }
    boolean isDefault = isUseDefaultStyle;
    // find in parent style definition
    OdfStyleBase parentStyle = null;
    if (!isDefault) {
      parentStyle = getParentStyle((OdfStyle) getCurrentUsedStyle());
    }
    while ((!isDefault) && (parentStyle != null)) {
      ParagraphProperties parentStyleSetting = ParagraphProperties.getParagraphProperties(parentStyle);
      tempAlign = parentStyleSetting.getHorizontalAlignment();
      if (tempAlign != null) {
        return tempAlign;
      }
      if (parentStyle instanceof OdfDefaultStyle) {
        isDefault = true;
      } else {
        parentStyle = getParentStyle((OdfStyle) parentStyle);
      }
    }
    // find in default style definition
    if (!isDefault) {
      OdfDefaultStyle defaultStyle = getParagraphDefaultStyle();
      ParagraphProperties defaultStyleSetting = ParagraphProperties.getParagraphProperties(defaultStyle);
      tempAlign = defaultStyleSetting.getHorizontalAlignment();
    }
    // use default
    if (tempAlign == null) {
      return HorizontalAlignmentType.DEFAULT;
    }
View Full Code Here


   * @return - the horizontal alignment; null if there is no horizontal
   *         alignment setting.
   */
  public HorizontalAlignmentType getHorizontalAlignment() {
    HorizontalAlignmentType tempAlign = null;
    ParagraphProperties properties = getParagraphPropertiesForRead();
    if (properties != null)
      tempAlign = properties.getHorizontalAlignment();
    if (tempAlign != null)
      return tempAlign;

    boolean isDefault = isUseDefaultStyle;
    // find in parent style definition
    OdfStyleBase parentStyle = null;
    if (!isDefault)
      parentStyle = getParentStyle((OdfStyle) getCurrentUsedStyle());
    while ((!isDefault) && (parentStyle != null)) {
      ParagraphProperties parentStyleSetting = ParagraphProperties.getParagraphProperties(parentStyle);
      tempAlign = parentStyleSetting.getHorizontalAlignment();
      if (tempAlign != null)
        return tempAlign;

      if (parentStyle instanceof OdfDefaultStyle)
        isDefault = true;
      else
        parentStyle = getParentStyle((OdfStyle) parentStyle);
    }
    // find in default style definition
    if (!isDefault) {
      OdfDefaultStyle defaultStyle = getCellDefaultStyle();
      ParagraphProperties defaultStyleSetting = ParagraphProperties.getParagraphProperties(defaultStyle);
      tempAlign = defaultStyleSetting.getHorizontalAlignment();
    }
    // use default
    if (tempAlign == null)
      return HorizontalAlignmentType.DEFAULT;
    return tempAlign;
View Full Code Here

      int size = nodes.getLength();
      for (int i = 0; i < size; i++) {
        element.removeChild(nodes.item(0));
      }
    }
    ParagraphProperties properties = paragraphContainer.getStyleHandler()
        .getParagraphPropertiesForWrite();
    return properties;
  }
View Full Code Here

  private void handlePageBreak(Paragraph origParagraph, String pos,
      boolean continued) {
    if (continued
        && this.textSelection.getTextNavigation().isHandlePageBreak())
      return;
    ParagraphProperties orgParaPty = origParagraph.getStyleHandler()
        .getParagraphPropertiesForRead();
    boolean handleBreak = false;
    String posInPara = "middle";
    if (continued && pos.equals("whole")) {
      posInPara = "end";
    } else if (continued && pos.endsWith("head")) {
      posInPara = "middle";
    } else if (continued && pos.endsWith("end")) {
      posInPara = "end";
    } else if (!continued && pos.endsWith("whole")) {
      posInPara = "whole";
    } else if (!continued && pos.endsWith("head")) {
      posInPara = "head";
    } else if (!continued && pos.endsWith("end")) {
      posInPara = "end";
    }
    if (orgParaPty != null) {
      String breakAttribute = orgParaPty.getBreakBefore();
      if (breakAttribute != null) {
        if (posInPara.equals("head") || posInPara.equals("whole")) {
          getParagraphPropertiesForWrite().setBreak("before",
              breakAttribute);
          handleBreak = true;
        }
      }
      breakAttribute = orgParaPty.getBreakAfter();
      if (breakAttribute != null) {
        if (posInPara.equals("end") || posInPara.equals("whole")) {
          getParagraphPropertiesForWrite().setBreak("after",
              breakAttribute);
          handleBreak = true;
        }
      }
    }
    String masterStyle = origParagraph
        .getStyleHandler()
        .getStyleElementForRead()
        .getOdfAttributeValue(
            OdfName.newName(OdfDocumentNamespace.STYLE,
                "master-page-name"));
    if (masterStyle != null && !masterStyle.isEmpty()) {
      if (posInPara.equals("head") || posInPara.equals("whole")) {
        getParagraphStyleElementForWrite().setOdfAttributeValue(
            OdfName.newName(OdfDocumentNamespace.STYLE,
                "master-page-name"), masterStyle);
        handleBreak = true;
        try {
          int pageNumber = orgParaPty.getPageNumber();
          if (pos.equals("head")) {
            paragraphContainer.getStyleHandler()
                .getParagraphPropertiesForWrite()
                .setPageNumber(pageNumber);
          }
View Full Code Here

  private void handlePageBreak(Paragraph origParagraph, String pos,
      boolean continued) {
    if (continued
        && this.textSelection.getTextNavigation().isHandlePageBreak())
      return;
    ParagraphProperties orgParaPty = origParagraph.getStyleHandler()
        .getParagraphPropertiesForRead();
    boolean handleBreak = false;
    String posInPara = "middle";
    if (continued && pos.equals("whole")) {
      posInPara = "end";
    } else if (continued && pos.endsWith("head")) {
      posInPara = "middle";
    } else if (continued && pos.endsWith("end")) {
      posInPara = "end";
    } else if (!continued && pos.endsWith("whole")) {
      posInPara = "whole";
    } else if (!continued && pos.endsWith("head")) {
      posInPara = "head";
    } else if (!continued && pos.endsWith("end")) {
      posInPara = "end";
    }
    if (orgParaPty != null) {
      String breakAttribute = orgParaPty.getBreakBefore();
      if (breakAttribute != null) {
        if (posInPara.equals("head") || posInPara.equals("whole")) {
          getTablePropertiesForWrite().setBreak("before",
              breakAttribute);
          handleBreak = true;
        }
      }
      breakAttribute = orgParaPty.getBreakAfter();
      if (breakAttribute != null) {
        if (posInPara.equals("end") || posInPara.equals("whole")) {
          getTablePropertiesForWrite().setBreak("after",
              breakAttribute);
          handleBreak = true;
        }
      }
    }
    String masterStyle = origParagraph
        .getStyleHandler()
        .getStyleElementForRead()
        .getOdfAttributeValue(
            OdfName.newName(OdfDocumentNamespace.STYLE,
                "master-page-name"));
    if (masterStyle != null && !masterStyle.isEmpty()) {
      if (posInPara.equals("head") || posInPara.equals("whole")) {
        getParagraphStyleElementForWrite().setOdfAttributeValue(
            OdfName.newName(OdfDocumentNamespace.STYLE,
                "master-page-name"), masterStyle);
        handleBreak = true;
        try {
          int pageNumber = orgParaPty.getPageNumber();
          if (pos.equals("head")) {
            tableContainer.getStyleHandler()
                .getParagraphPropertiesForWrite()
                .setPageNumber(pageNumber);
          }
View Full Code Here

TOP

Related Classes of org.odftoolkit.simple.style.ParagraphProperties

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.