/** * Gets the value of the tag property. * * @return * possible object is * {@link SdtPr.Tag } * */ public Tag getTag() { for (Object o : getRPrOrAliasOrLock()) { if ( o instanceof Tag ) { log.debug("found tag"); return (Tag)o; } } return null; }
/** * Gets the value of the id property. * * @return * possible object is * {@link Id } * */ public Id getId() { for (Object o : getRPrOrAliasOrLock()) { if ( o instanceof Id ) { log.debug("found id"); return (Id)o; } } return null; }
private SdtPr.Picture getPicture(SdtPr sdtPr) { for (Object o : sdtPr.getRPrOrAliasOrLock() ) { o = XmlUtils.unwrap(o); if (o instanceof SdtPr.Picture) return (SdtPr.Picture)o; } return null; }
protected SdtPr.Alias getAlias(SdtPr sdtPr) { for (Object o : sdtPr.getRPrOrAliasOrLock() ) { o = XmlUtils.unwrap(o); if (o instanceof SdtPr.Alias) return (SdtPr.Alias)o; } return null; }
private static RPr findBlockRPr(SdtBlock currentBlock) { for (Object obj:currentBlock.getSdtPr().getRPrOrAliasOrLock()) { if (obj instanceof RPr) { return (RPr)obj; } } return null; }
private boolean isRichText(SdtPr sdtPr) { for (Object o : sdtPr.getRPrOrAliasOrLock() ) { o = XmlUtils.unwrap(o); if (o instanceof SdtPr.RichText) return true; } return false; }
public CTDataBinding getDataBinding() { for (Object o : getRPrOrAliasOrLock()) { o = XmlUtils.unwrap(o); log.debug("inspecting " + o.getClass().getName() ); if ( o instanceof CTDataBinding ) { return (CTDataBinding)o; } } return null; }
/** * return the first object * @param clazz * @return * @since 3.0.1 */ public Object getByClass(Class clazz) { for (Object o : getRPrOrAliasOrLock()) { Object o2 = XmlUtils.unwrap(o); if ( o2.getClass().equals(clazz) ) { log.debug("found " + clazz.getName()); return o2; } } return null; }
for (Object o : getRPrOrAliasOrLock() ) { Object unwrapped = XmlUtils.unwrap(o); if (unwrapped instanceof CTDataBinding) { getRPrOrAliasOrLock().remove(existingBinding);
private CTSdtDocPart getDocPartObj(SdtPr sdtPr) { if (sdtPr==null) return null; for (Object o : sdtPr.getRPrOrAliasOrLock()) { if ( XmlUtils.unwrap(o) instanceof CTSdtDocPart) { return (CTSdtDocPart)XmlUtils.unwrap(o); } } return null; }
private boolean isMultiline(SdtPr sdtPr) { for (Object o : sdtPr.getRPrOrAliasOrLock() ) { o = XmlUtils.unwrap(o); if (o instanceof CTSdtText) { return ((CTSdtText)o).isMultiLine(); } } return false; }
private boolean isMultiline(SdtPr sdtPr) { for (Object o : sdtPr.getRPrOrAliasOrLock() ) { o = XmlUtils.unwrap(o); if (o instanceof CTSdtText) { return ((CTSdtText)o).isMultiLine(); } } return false; }
for (Object o : getRPrOrAliasOrLock()) { if (o instanceof JAXBElement && ((JAXBElement)o).getName().getLocalPart().equals("showingPlcHdr")) { getRPrOrAliasOrLock().add(plcHdr); getRPrOrAliasOrLock().remove(plcHdr);
sdtPr.getRPrOrAliasOrLock().remove(binding);
/** * Workaround for the fact that Xalan doesn't let us pass an AtomicInteger into an extension * function. Instead, it converts it into an int, which means the object in our * bookmarkIdCounter parameter isn't updated. * * So here we wrap the AtomicInteger in a class, * * @author jharrop * */ public static class BookmarkCounter { protected AtomicInteger bookmarkId; BookmarkCounter(AtomicInteger bookmarkId) { this.bookmarkId = bookmarkId; } }
for (Object o : sdtPr.getRPrOrAliasOrLock() ) { Object unwrapped = XmlUtils.unwrap(o); if (unwrapped instanceof CTSdtText) { sdtPr.getRPrOrAliasOrLock().remove(sdtPrText);
private SdtBlock createSdt(){ org.docx4j.wml.ObjectFactory wmlObjectFactory = Context.getWmlObjectFactory(); SdtBlock sdtBlock = wmlObjectFactory.createSdtBlock(); SdtPr sdtpr = wmlObjectFactory.createSdtPr(); // Create object for docPartObj (wrapped in JAXBElement) CTSdtDocPart sdtdocpart = wmlObjectFactory.createCTSdtDocPart(); JAXBElement<org.docx4j.wml.CTSdtDocPart> sdtdocpartWrapped = wmlObjectFactory.createSdtPrDocPartObj(sdtdocpart); sdtpr.getRPrOrAliasOrLock().add( sdtdocpartWrapped); // Create object for docPartGallery CTSdtDocPart.DocPartGallery sdtdocpartdocpartgallery = wmlObjectFactory.createCTSdtDocPartDocPartGallery(); sdtdocpart.setDocPartGallery(sdtdocpartdocpartgallery); sdtdocpartdocpartgallery.setVal( "Table of Contents"); // Create object for docPartUnique BooleanDefaultTrue booleandefaulttrue = wmlObjectFactory.createBooleanDefaultTrue(); sdtdocpart.setDocPartUnique(booleandefaulttrue); // Create object for id sdtpr.setId(); sdtBlock.setSdtPr(sdtpr); return sdtBlock; }
sdtPr.getRPrOrAliasOrLock().add(alias); sdtPr.getRPrOrAliasOrLock().add(new SdtPr.RichText()); } else { CTDataBinding ctDataBinding = Context.getWmlObjectFactory().createCTDataBinding();
sdtPr.getRPrOrAliasOrLock().add( Context.getWmlObjectFactory().createSdtPrText(sdtText));
private static SdtBlock createSdt(String tagVal, RPr rPr) { // .. so create content control! SdtBlock sdtBlock = Context.getWmlObjectFactory().createSdtBlock(); SdtPr sdtPr = Context.getWmlObjectFactory().createSdtPr(); sdtBlock.setSdtPr(sdtPr); SdtContentBlock sdtContent = Context.getWmlObjectFactory().createSdtContentBlock(); sdtBlock.setSdtContent(sdtContent); // For borders/shading, we'll use the values in this first paragraph. // We'll use a tag, so the XSLT can detect that its supposed to do something special. Tag tag = Context.getWmlObjectFactory().createTag(); tag.setVal(tagVal); sdtPr.setTag(tag); if (rPr != null) { sdtPr.getRPrOrAliasOrLock().add((RPr)XmlUtils.deepCopy(rPr)); /* * ECMA-376 says "specifies the set of run properties which shall be applied to * the text entered into the parent structured document tag in replacement of * placeholder text. When placeholder text is present in a structured document * tag, its formatting is often different than the desired underlying formatting, * and this element specifies the formatting which shall be used for non-placeholder * text contents when they are initially added to the control. " * * Note that docx2fo.xslt is co-opting this to do something else. */ } return sdtBlock; }