示例#1
0
 /**
  * add a new paragraph run to this shape
  *
  * @return created paragraph run
  */
 public XSLFTextParagraph addNewTextParagraph() {
   CTTextBody txBody = getTextBody(true);
   CTTextParagraph p = txBody.addNewP();
   XSLFTextParagraph paragraph = new XSLFTextParagraph(p, this);
   _paragraphs.add(paragraph);
   return paragraph;
 }
示例#2
0
  @SuppressWarnings("deprecation")
  /*package*/ XSLFTextShape(XmlObject shape, XSLFSheet sheet) {
    super(shape, sheet);

    _paragraphs = new ArrayList<XSLFTextParagraph>();
    CTTextBody txBody = getTextBody(false);
    if (txBody != null) {
      for (CTTextParagraph p : txBody.getPArray()) {
        _paragraphs.add(new XSLFTextParagraph(p, this));
      }
    }
  }
示例#3
0
  @Override
  void copy(XSLFShape other) {
    super.copy(other);

    XSLFTextShape otherTS = (XSLFTextShape) other;
    CTTextBody otherTB = otherTS.getTextBody(false);
    CTTextBody thisTB = getTextBody(true);
    if (otherTB == null) {
      return;
    }

    thisTB.setBodyPr((CTTextBodyProperties) otherTB.getBodyPr().copy());

    if (thisTB.isSetLstStyle()) thisTB.unsetLstStyle();
    if (otherTB.isSetLstStyle()) {
      thisTB.setLstStyle((CTTextListStyle) otherTB.getLstStyle().copy());
    }

    boolean srcWordWrap = otherTS.getWordWrap();
    if (srcWordWrap != getWordWrap()) {
      setWordWrap(srcWordWrap);
    }

    double leftInset = otherTS.getLeftInset();
    if (leftInset != getLeftInset()) {
      setLeftInset(leftInset);
    }
    double rightInset = otherTS.getRightInset();
    if (rightInset != getRightInset()) {
      setRightInset(rightInset);
    }
    double topInset = otherTS.getTopInset();
    if (topInset != getTopInset()) {
      setTopInset(topInset);
    }
    double bottomInset = otherTS.getBottomInset();
    if (bottomInset != getBottomInset()) {
      setBottomInset(bottomInset);
    }

    VerticalAlignment vAlign = otherTS.getVerticalAlignment();
    if (vAlign != getVerticalAlignment()) {
      setVerticalAlignment(vAlign);
    }

    clearText();

    for (XSLFTextParagraph srcP : otherTS.getTextParagraphs()) {
      XSLFTextParagraph tgtP = addNewTextParagraph();
      tgtP.copy(srcP);
    }
  }
示例#4
0
 /** unset text from this shape */
 public void clearText() {
   _paragraphs.clear();
   CTTextBody txBody = getTextBody(true);
   txBody.setPArray(null); // remove any existing paragraphs
 }
示例#5
0
 protected CTTextBodyProperties getTextBodyPr() {
   CTTextBody textBody = getTextBody(false);
   return textBody == null ? null : textBody.getBodyPr();
 }