private static boolean borderChanged(CTBorder currentBorder, CTBorder lastBorder) { if (currentBorder != lastBorder) { if ((currentBorder != null) && (lastBorder != null)) { return !currentBorder.getVal().equals(lastBorder.getVal()); } //one was null return true; } //both null or both identical return false; }
/** * Convenience method to getBody().getContent() * @since 2.7 */ public List<Object> getContent() { return getBody().getContent(); }
public P getLastParagraph() { // Create object for p P p = wmlObjectFactory.createP(); // Create object for r R r2 = wmlObjectFactory.createR(); p.getContent().add(r2); // Create object for fldChar (wrapped in JAXBElement) FldChar fldchar = wmlObjectFactory.createFldChar(); JAXBElement<FldChar> fldcharWrapped = wmlObjectFactory.createRFldChar(fldchar); r2.getContent().add(fldcharWrapped); fldchar.setFldCharType(STFldCharType.END); return p; } }
private static org.docx4j.wml.R createRunStructure(String textVal, P existingP, int rIndex ) { org.docx4j.wml.R newR = wmlFactory.createR(); org.docx4j.wml.Text newT = wmlFactory.createText(); newR.getRunContent().add(newT); newT.setValue(textVal); newT.setSpace("preserve"); org.docx4j.wml.RPr existingRPr = ((org.docx4j.wml.R)existingP.getParagraphContent().get(rIndex)).getRPr(); if ( existingRPr !=null ) newR.setRPr(existingRPr); return newR; }
private static void updateParagraph(P paragraph) { boolean containsPageBreak = checkPageBreak(paragraph.getContent()); if (containsPageBreak) { if (paragraph.getPPr() == null) { paragraph.setPPr(new PPr()); } paragraph.getPPr().setPageBreakBefore(new BooleanDefaultTrue()); } }
@Override public List<Object> apply(Object o) { if (firstSectPr==null && (o instanceof P)) { P p = (P)o; if ( p.getPPr()!=null && p.getPPr().getSectPr()!=null ) { // System.out.println("Found sectpr!"); enclosingP = (P)o; // just for sample MergeBlockRangeNViaTraversalUtilsSectPr firstSectPr = p.getPPr().getSectPr(); } } return null; }
private static boolean hasBreakBefore(PPr pPr) { return (pPr!=null && pPr.getPageBreakBefore()!=null && pPr.getPageBreakBefore().isVal()!=false ); }
public PageNumberInformation(SectPr sectPr) { CTPageNumber pageNumber = (sectPr != null ? sectPr.getPgNumType() : null); NumberFormat numberFormat = null; if (pageNumber != null) { if (pageNumber.getFmt() != null) { defaultNumberFormat = pageNumber.getFmt().value(); } if (pageNumber.getStart() != null) { pageStart = pageNumber.getStart().intValue(); } } }
private static RPr findBlockRPr(SdtBlock currentBlock) { for (Object obj:currentBlock.getSdtPr().getRPrOrAliasOrLock()) { if (obj instanceof RPr) { return (RPr)obj; } } return null; }
/** * Verifies the documentProtection tag inside settings.xml file * if the protection is enforced (w:enforcement="1") * and if the kind of protection equals to passed (STDocProtect.Enum editValue) * * @return true if documentProtection is enforced with option readOnly * @since 3.3.0 */ public boolean isRestrictEditingWith(STDocProtect editValue) { CTDocProtect ctDocProtect = this.jaxbElement.getDocumentProtection(); if (ctDocProtect == null) { return false; } return ctDocProtect.isEnforcement() && ctDocProtect.getEdit().equals(editValue); }
public static boolean areEqual(CTTextboxTightWrap textboxTightWrap1, CTTextboxTightWrap textboxTightWrap2) { return (textboxTightWrap1 == textboxTightWrap2) || ((textboxTightWrap1 != null) && (textboxTightWrap2 != null) && ((textboxTightWrap1.getVal() == textboxTightWrap2.getVal()) || ((textboxTightWrap1.getVal() != null) && (textboxTightWrap1.getVal().equals(textboxTightWrap2.getVal())) ) ) ); }
/** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); }
/** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); }
/** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); }
/** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); }
/** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); }
/** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); }
/** * Specifies that the parent complex field shall not have its field result recalculated, even if * an application attempts to recalculate the results of all fields in the document or a * recalculation is explicitly requested. * * @param lock the lock to set * @see <a href="http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/fldChar.html">the spec</a> */ public void setLock(boolean lock) { this.lock = lock; fldCharBegin.setFldLock(lock); }