Exemplo n.º 1
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);
    }
  }
Exemplo n.º 2
0
  /**
   * Copy placeholders from this layout to the destination slide
   *
   * @param slide destination slide
   */
  public void copyLayout(XSLFSlide slide) {
    for (XSLFShape sh : getShapes()) {
      if (sh instanceof XSLFTextShape) {
        XSLFTextShape tsh = (XSLFTextShape) sh;
        Placeholder ph = tsh.getTextType();
        if (ph == null) continue;

        switch (ph) {
            // these are special and not copied by default
          case DATETIME:
          case SLIDE_NUMBER:
          case FOOTER:
            break;
          default:
            slide.getSpTree().addNewSp().set(tsh.getXmlObject().copy());
        }
      }
    }
  }
Exemplo n.º 3
0
 @Override
 public String getTitle() {
   XSLFTextShape txt = getTextShapeByType(Placeholder.TITLE);
   return txt == null ? null : txt.getText();
 }