summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-01-22 15:18:45 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-01-23 09:05:02 +0100
commita54787669b9283efdfdd18b0cbafc3184cdde58f (patch)
treec64aac62a0c2d2e7baf1b5eddaba396270ec09d4 /svtools
parent75f5d70d5d9f58a76e42d151f187c50bad50378c (diff)
EPUB export, fixed layout: add chapter names to the navigation document
Extend vcl::PDFExtOutDevData so that it's possible to use it outside the PDF export; this way the EPUB export can know which chapters start on which page. This means fixed and reflowable layout has the same table of contents, instead of just Page <N> in the fixed layout case. Change-Id: I935fb23c66ec747431b91e83b0e677d4e5f704b9 Reviewed-on: https://gerrit.libreoffice.org/48332 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/filter/DocumentToGraphicRenderer.cxx26
-rw-r--r--svtools/source/filter/exportdialog.cxx2
2 files changed, 25 insertions, 3 deletions
diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx
index 74275afa5c79..8d48bca87706 100644
--- a/svtools/source/filter/DocumentToGraphicRenderer.cxx
+++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx
@@ -22,6 +22,7 @@
#include <vcl/graphicfilter.hxx>
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
+#include <vcl/pdfextoutdevdata.hxx>
#include <tools/fract.hxx>
@@ -154,7 +155,8 @@ Graphic DocumentToGraphicRenderer::renderToGraphic(
sal_Int32 nCurrentPage,
Size aDocumentSizePixel,
Size aTargetSizePixel,
- Color aPageColor)
+ Color aPageColor,
+ bool bExtOutDevData)
{
if (!mxModel.is() || !mxController.is() || !mxRenderable.is())
@@ -171,7 +173,7 @@ Graphic DocumentToGraphicRenderer::renderToGraphic(
double fScaleY = aTargetSizePixel.Height() / static_cast<double>(aDocumentSizePixel.Height());
PropertyValues renderProps;
- renderProps.realloc( 4 );
+ renderProps.realloc( 6 );
renderProps[0].Name = "IsPrinter";
renderProps[0].Value <<= true;
renderProps[1].Name = "RenderDevice";
@@ -180,10 +182,22 @@ Graphic DocumentToGraphicRenderer::renderToGraphic(
renderProps[2].Value <<= mxController;
renderProps[3].Name = "RenderToGraphic";
renderProps[3].Value <<= true;
+ renderProps[4].Name = "HasPDFExtOutDevData";
+ renderProps[4].Value <<= bExtOutDevData;
+ renderProps[5].Name = "PageRange";
+ renderProps[5].Value <<= OUString::number(nCurrentPage);
GDIMetaFile aMtf;
OutputDevice* pOutputDev = VCLUnoHelper::GetOutputDevice( xDevice );
+
+ vcl::PDFExtOutDevData aPDFExtOutDevData(*pOutputDev);
+ if (bExtOutDevData)
+ {
+ aPDFExtOutDevData.SetIsExportBookmarks(true);
+ pOutputDev->SetExtOutDevData(&aPDFExtOutDevData);
+ }
+
pOutputDev->SetAntialiasing(pOutputDev->GetAntialiasing() | AntialiasingFlags::EnableB2dDraw);
MapMode mm = pOutputDev->GetMapMode();
mm.SetScaleX( Fraction(fScaleX) );
@@ -205,9 +219,17 @@ Graphic DocumentToGraphicRenderer::renderToGraphic(
aMtf.WindStart();
aMtf.SetPrefSize( aTargetSizePixel );
+ if (bExtOutDevData)
+ maChapterNames = aPDFExtOutDevData.GetChapterNames();
+
return Graphic(aMtf);
}
+const std::vector<OUString>& DocumentToGraphicRenderer::getChapterNames() const
+{
+ return maChapterNames;
+}
+
sal_Int32 DocumentToGraphicRenderer::getCurrentPage()
{
if (hasSelection())
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index a309b748e096..931e4008dd27 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -434,7 +434,7 @@ void ExportDialog::GetGraphicStream()
aDocumentSizePixel );
Graphic aGraphic( aRenderer.renderToGraphic( nCurrentPage,
- aDocumentSizePixel, aTargetSizePixel, COL_WHITE));
+ aDocumentSizePixel, aTargetSizePixel, COL_WHITE, /*bExtOutDevData=*/false));
xGraphic = aGraphic.GetXGraphic();
}