PageArea pa = (PageArea) currentFrame.getData();
IContainerArea body = pa.getBody();
// locate body frame first
Frame bodyFrame = locateChildFrame(currentFrame, body);
if (bodyFrame instanceof AreaFrame) {
// adjust offsets
((AreaFrame) bodyFrame).setXOffset(-bodyFrame.getLeft());
((AreaFrame) bodyFrame).setYOffset(-bodyFrame.getTop());
}
if (exportSingleSheet) {
// aggregate only
if (singleContainer == null) {
singleContainer = new AggregateFrame();
singleContainer.setRight(bodyFrame.getRight() - bodyFrame.getLeft());
singleContainer.setBottom(bodyFrame.getBottom() - bodyFrame.getTop());
} else {
int yOff = singleContainer.getBottom();
singleContainer.setBottom(yOff + bodyFrame.getBottom() - bodyFrame.getTop());
if (bodyFrame instanceof AreaFrame) {
((AreaFrame) bodyFrame).setYOffset(yOff + ((AreaFrame) bodyFrame).getYOffset());
}
}
singleContainer.addChild(bodyFrame);
if (bodyFrame instanceof AreaFrame) {
((AreaFrame) bodyFrame).setParent(singleContainer);
}
if (DEBUG) {
logger.log(Level.INFO, "------------aggregate sheet[" //$NON-NLS-1$
+ (currentPageIndex) + "] using " //$NON-NLS-1$
+ (System.currentTimeMillis() - span) + " ms"); //$NON-NLS-1$
}
} else if (aggregateOnFirstLevel) {
// aggregate only
singleContainer = multiPageContainer.get(AggregateFinder.get().getPageNum());
if (singleContainer == null) {
singleContainer = new AggregateFrame();
singleContainer.setRight(bodyFrame.getRight() - bodyFrame.getLeft());
singleContainer.setBottom(bodyFrame.getBottom() - bodyFrame.getTop());
multiPageContainer.put(new Integer(AggregateFinder.get().getPageNum()), singleContainer);
} else {
int yOff = singleContainer.getBottom();
singleContainer.setBottom(yOff + bodyFrame.getBottom() - bodyFrame.getTop());
if (bodyFrame instanceof AreaFrame) {
((AreaFrame) bodyFrame).setYOffset(yOff + ((AreaFrame) bodyFrame).getYOffset());
}
}