*/
protected void exportReportToOasisZip(OutputStream os) throws JRException, IOException
{
OasisZip oasisZip = new FileBufferedOasisZip(((JROpenDocumentExporterNature)nature).getOpenDocumentNature());
ExportZipEntry tempBodyEntry = new FileBufferedZipEntry(null);
ExportZipEntry tempStyleEntry = new FileBufferedZipEntry(null);
tempBodyWriter = tempBodyEntry.getWriter();
tempStyleWriter = tempStyleEntry.getWriter();
styleCache = new StyleCache(tempStyleWriter, fontMap, getExporterKey());
Writer stylesWriter = oasisZip.getStylesEntry().getWriter();
StyleBuilder styleBuilder = new StyleBuilder(jasperPrintList, stylesWriter);
styleBuilder.build();
stylesWriter.close();
for(reportIndex = 0; reportIndex < jasperPrintList.size(); reportIndex++)
{
setJasperPrint((JasperPrint)jasperPrintList.get(reportIndex));
List pages = jasperPrint.getPages();
if (pages != null && pages.size() > 0)
{
if (isModeBatch)
{
startPageIndex = 0;
endPageIndex = pages.size() - 1;
}
JRPrintPage page = null;
for(pageIndex = startPageIndex; pageIndex <= endPageIndex; pageIndex++)
{
if (Thread.interrupted())
{
throw new JRException("Current thread interrupted.");
}
page = (JRPrintPage)pages.get(pageIndex);
exportPage(page);
}
}
}
tempBodyWriter.flush();
tempStyleWriter.flush();
tempBodyWriter.close();
tempStyleWriter.close();
/* */
ContentBuilder contentBuilder =
new ContentBuilder(
oasisZip.getContentEntry(),
tempStyleEntry,
tempBodyEntry,
styleCache.getFontFaces(),
((JROpenDocumentExporterNature)nature).getOpenDocumentNature()
);
contentBuilder.build();
tempStyleEntry.dispose();
tempBodyEntry.dispose();
if ((imagesToProcess != null && imagesToProcess.size() > 0))
{
for(Iterator it = imagesToProcess.iterator(); it.hasNext();)
{
JRPrintElementIndex imageIndex = (JRPrintElementIndex)it.next();
JRPrintImage image = getImage(jasperPrintList, imageIndex);
JRRenderable renderer = image.getRenderer();
if (renderer.getType() == JRRenderable.TYPE_SVG)
{
renderer =
new JRWrappingSvgRenderer(
renderer,
new Dimension(image.getWidth(), image.getHeight()),
ModeEnum.OPAQUE == image.getModeValue() ? image.getBackcolor() : null
);
}
oasisZip.addEntry(//FIXMEODT optimize with a different implementation of entry
new FileBufferedZipEntry(
"Pictures/" + getImageName(imageIndex),
renderer.getImageData()
)
);
}