예제 #1
0
 /**
  * Sets the top margin.
  *
  * @see #getTopInset()
  * @param margin the top margin
  */
 public void setTopInset(double margin) {
   CTTextBodyProperties bodyPr = getTextBodyPr();
   if (bodyPr != null) {
     if (margin == -1) bodyPr.unsetTIns();
     else bodyPr.setTIns(Units.toEMU(margin));
   }
 }
예제 #2
0
 /** @return type of autofit */
 public TextAutofit getTextAutofit() {
   CTTextBodyProperties bodyPr = getTextBodyPr();
   if (bodyPr != null) {
     if (bodyPr.isSetNoAutofit()) return TextAutofit.NONE;
     else if (bodyPr.isSetNormAutofit()) return TextAutofit.NORMAL;
     else if (bodyPr.isSetSpAutoFit()) return TextAutofit.SHAPE;
   }
   return TextAutofit.NORMAL;
 }
예제 #3
0
 /** @return vertical orientation of the text */
 public TextDirection getTextDirection() {
   CTTextBodyProperties bodyPr = getTextBodyPr();
   if (bodyPr != null) {
     STTextVerticalType.Enum val = bodyPr.getVert();
     if (val != null) {
       return TextDirection.values()[val.intValue() - 1];
     }
   }
   return TextDirection.HORIZONTAL;
 }
예제 #4
0
 /** @param orientation vertical orientation of the text */
 public void setTextDirection(TextDirection orientation) {
   CTTextBodyProperties bodyPr = getTextBodyPr();
   if (bodyPr != null) {
     if (orientation == null) {
       if (bodyPr.isSetVert()) bodyPr.unsetVert();
     } else {
       bodyPr.setVert(STTextVerticalType.Enum.forInt(orientation.ordinal() + 1));
     }
   }
 }
예제 #5
0
 /**
  * Sets if the paragraphs are horizontal centered
  *
  * @param isCentered true, if the paragraphs are horizontal centered A {@code null} values unsets
  *     this property.
  * @see TextShape#isHorizontalCentered()
  */
 public void setHorizontalCentered(Boolean isCentered) {
   CTTextBodyProperties bodyPr = getTextBodyPr();
   if (bodyPr != null) {
     if (isCentered == null) {
       if (bodyPr.isSetAnchorCtr()) bodyPr.unsetAnchorCtr();
     } else {
       bodyPr.setAnchorCtr(isCentered);
     }
   }
 }
예제 #6
0
 /**
  * Sets the type of vertical alignment for the text.
  *
  * @param anchor - the type of alignment. A {@code null} values unsets this property.
  */
 public void setVerticalAlignment(VerticalAlignment anchor) {
   CTTextBodyProperties bodyPr = getTextBodyPr();
   if (bodyPr != null) {
     if (anchor == null) {
       if (bodyPr.isSetAnchor()) bodyPr.unsetAnchor();
     } else {
       bodyPr.setAnchor(STTextAnchoringType.Enum.forInt(anchor.ordinal() + 1));
     }
   }
 }
예제 #7
0
  /**
   * Specifies that a shape should be auto-fit to fully contain the text described within it.
   * Auto-fitting is when text within a shape is scaled in order to contain all the text inside
   *
   * @param value type of autofit
   */
  public void setTextAutofit(TextAutofit value) {
    CTTextBodyProperties bodyPr = getTextBodyPr();
    if (bodyPr != null) {
      if (bodyPr.isSetSpAutoFit()) bodyPr.unsetSpAutoFit();
      if (bodyPr.isSetNoAutofit()) bodyPr.unsetNoAutofit();
      if (bodyPr.isSetNormAutofit()) bodyPr.unsetNormAutofit();

      switch (value) {
        case NONE:
          bodyPr.addNewNoAutofit();
          break;
        case NORMAL:
          bodyPr.addNewNormAutofit();
          break;
        case SHAPE:
          bodyPr.addNewSpAutoFit();
          break;
      }
    }
  }
예제 #8
0
 /** @param wrap whether to wrap words within the bounding rectangle */
 public void setWordWrap(boolean wrap) {
   CTTextBodyProperties bodyPr = getTextBodyPr();
   if (bodyPr != null) {
     bodyPr.setWrap(wrap ? STTextWrappingType.SQUARE : STTextWrappingType.NONE);
   }
 }