/** Clone this JAXB object, using default JAXBContext. */ public static <T> T deepCopy(T value) { return deepCopy(value, Context.jc); }
@Override protected ResolvedLayout clone() throws CloneNotSupportedException { ResolvedLayout clone = (ResolvedLayout)super.clone(); if (this.bg!=null) { clone.bg = XmlUtils.deepCopy( this.bg, Context.jcPML); } if (this.shapeTree!=null) { clone.shapeTree = XmlUtils.deepCopy( this.shapeTree, Context.jcPML); } return clone; }
public Object traverseToBind(JaxbXmlPart part, org.docx4j.openpackaging.packages.OpcPackage pkg, Map<String, org.opendope.xpaths.Xpaths.Xpath> xpathsMap) throws Docx4JException { this.part = part; this.pkg = pkg; this.xpathsMap = xpathsMap; Object clone = XmlUtils.deepCopy(part.getJaxbElement()); BindingTraversor bt = new BindingTraversor(); new TraversalUtil(clone, bt); return clone; }
public static TrPr apply(TrPr source, TrPr destination) { List<JAXBElement<?>> defsSource = null; List<JAXBElement<?>> defsDestination = null; JAXBElement<?> defsSourceElement = null; if (isEmpty(source)) return destination; if (!isEmpty(destination)) { defsSource = source.getCnfStyleOrDivIdOrGridBefore(); defsDestination = destination.getCnfStyleOrDivIdOrGridBefore(); for (int i=0; i<defsSource.size(); i++) { defsSourceElement = defsSource.get(i); // If there's an element with this name already, remove it for (int j=0; j<defsDestination.size(); j++) { if (defsSourceElement.getName().equals(defsDestination.get(j).getName())) { defsDestination.remove(j); break; } } // Now add the element defsDestination.add(XmlUtils.deepCopy(defsSourceElement)); } } return destination; }
private static void handleTxBody(CTTextBody sp, CTTextBody layoutShape) { // a slide layout p:sp/p:txBody can override, with a <a:lstStyle> element // so copy a:lstStyle over if (sp.getLstStyle()!=null) { log.warn("Slide shape contains lstStyle! (Not expected at that level)"); log.debug(XmlUtils.marshaltoString(sp.getLstStyle(), false, true, Context.jcPML, "FIXME", "lstStyle", CTTextListStyle.class)); } if (layoutShape.getLstStyle()!=null) { sp.setLstStyle( XmlUtils.deepCopy(layoutShape.getLstStyle(), Context.jcPML )); } }
} else { Style clone = XmlUtils.deepCopy(s); stylesPartStyles.getStyle().add(clone);
newContent.add(XmlUtils.deepCopy(sdt)); totalRepeated++;
Relationship r2 = (Relationship)XmlUtils.deepCopy(r, Context.jcRelationships);
private static void handleSpPr(CTShapeProperties sp, CTShapeProperties layoutShape) { // a:xrm if (sp.getXfrm()==null && layoutShape.getXfrm()!=null) { sp.setXfrm( XmlUtils.deepCopy(layoutShape.getXfrm(), Context.jcPML )); } }
public void importSources(BibliographyPart otherPart) { org.docx4j.bibliography.CTSources ourSources = (CTSources)XmlUtils.unwrap(this.getJaxbElement()); org.docx4j.bibliography.CTSources otherSourcesTmp = (CTSources)XmlUtils.unwrap(otherPart.getJaxbElement()); org.docx4j.bibliography.CTSources otherSourcesCloned = XmlUtils.deepCopy(otherSourcesTmp); for (CTSourceType sourceType : otherSourcesCloned.getSource()) { // TODO duplicate detection. ourSources.getSource().add(sourceType); } }
result = XmlUtils.deepCopy(tableStyleStack.pop()); } else { result = Context.getWmlObjectFactory().createStyle();
effectivePPr = Context.getWmlObjectFactory().createPPr(); } else { effectivePPr = (PPr)XmlUtils.deepCopy(resolvedPPr);
((JaxbXmlPart)destination).setJaxbElement(XmlUtils.deepCopy(((JaxbXmlPart)source).getJaxbElement(), ((JaxbXmlPart)source).getJAXBContext())); ((JaxbXmlPart)destination).setJAXBContext(((JaxbXmlPart)source).getJAXBContext());
Style clonedStyle = XmlUtils.deepCopy(style);
P clonedP = (P)XmlUtils.deepCopy(sourceP);
= XmlUtils.deepCopy( shapeTree, Context.jcPML );
effectiveRPr = Context.getWmlObjectFactory().createRPr(); } else { effectiveRPr=(RPr)XmlUtils.deepCopy(rPrFromPStyle);
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; }
/** * Create a ResolvedLayout for a SlideLayoutPart. * @param slideLayoutPart * @return */ public static ResolvedLayout resolveSlideLayout(SlideLayoutPart slideLayoutPart) { ResolvedLayout resolvedLayout = new ResolvedLayout(); // Get the master layout SlideMasterPart master = slideLayoutPart.getSlideMasterPart(); ResolvedLayout masterLayout = master.getResolvedLayout(); Map<String, ShapeWrapper> masterPlaceholders = master.getIndexedPlaceHolders(); // Assume the slide layout doesn't itself have a bg if (masterLayout.getBg() != null) { resolvedLayout.bg = XmlUtils.deepCopy( masterLayout.getBg(), Context.jcPML); } // ShapeTree resolvedLayout.shapeTree = createEffectiveShapeTree( slideLayoutPart.getJaxbElement().getCSld().getSpTree(), masterPlaceholders ); resolvedLayout.masterNumber = 1; // TODO FIXME return resolvedLayout; }
newCondition = XmlUtils.deepCopy(this);