if (content.size()==0) {
return null;
}
P p = null;
for (Object o : content ) {
if (o instanceof P ) {
p = (P)o;
break;
}
}
if (p==null) {
// No top level paragraph, so
// do the work of traversing the document
log.debug("traversing for w14, w15");
IgnorablePrefixFinder finder = new IgnorablePrefixFinder();
if (body.getSectPr()!=null
&& body.getSectPr().getFootnoteColumns()!=null) {
finder.needW15 = true;
}
new TraversalUtil(content, finder);
String mceIgnorableVal = "";
if (finder.needW14) {
mceIgnorableVal = "w14";
}
if (finder.needW15) {
mceIgnorableVal += " w15";
}
return mceIgnorableVal;
} else {
// The quick hack
// For W14, we'll check/set paraId, textId
if (p.getParaId()==null) {
// Values MUST be greater than 0 and less than 0x80000000
// So let's
String uuid = java.util.UUID.randomUUID().toString();
// That's 32 digits, but 8'll do nicely
/*
* 8 can create a number too large - using 7
* Bob Fleischman - July 24, 2014
*/
uuid = uuid.replace("-", "").substring(0, 7);
p.setParaId(uuid);
p.setTextId(uuid);
}
// For W15, collapse
PPr ppr = p.getPPr();
if (ppr==null) {
ppr = Context.getWmlObjectFactory().createPPr();
p.setPPr(ppr);
}
if (ppr.getCollapsed()==null) {
BooleanDefaultTrue notCollapsed = new BooleanDefaultTrue();
notCollapsed.setVal(Boolean.FALSE);
ppr.setCollapsed(notCollapsed);