List<Object> resultElts = new ArrayList<Object>();
SdtBlock currentBlock = null;
CTBorder lastBorder = null;
CTBorder currentBorder = null;
R run = null;
// java.util.Stack stack = new java.util.Stack();
// stack.push(newList);
for (Object o : paragraphElts) {
if (o instanceof R) {
run = (R)o;
currentBorder = null;
if (run.getRPr() != null ) {
currentBorder = run.getRPr().getBdr();
}
if ( borderChanged(currentBorder, lastBorder )) {
appendRun(currentBlock, resultElts);
currentBlock = null;
// could mean null to borders; borders to null; or bordersA to bordersB
if (currentBorder != null) {
currentBlock = createSdt(TAG_RPR, run.getRPr());
}
}
}
if (currentBlock!=null) {
currentBlock.getSdtContent().getContent().add(o);