filter/source/graphic/GraphicExportFilter.cxx       |    5 ++++-
 include/svtools/DocumentToGraphicRenderer.hxx       |    3 ++-
 svtools/source/filter/DocumentToGraphicRenderer.cxx |    9 ++++++++-
 3 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit a093c5cac3a7b5ecdddf10720f4543ddf82b9163
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com>
Date:   Mon Oct 19 14:04:21 2015 +0200

    Writer image export: cmd. line, default to white background
    
    This commit fixes the writer image export (jpeg, png) that didn't
    work because the export pixel size was set to 0 by default. Now
    the default is set to document size (which depends on system DPI).
    
    When exporting to a PNG the background was transparent, which may
    not  be desired. The background color is now by default white and
    can be changed for DocumentToGraphicRenderer, but the dialog or
    command line don't support such an option - for now.
    
    Change-Id: I16ffd3cd60c47b52768f43ae4c4c170fc821033b
    Reviewed-on: https://gerrit.libreoffice.org/19479
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/filter/source/graphic/GraphicExportFilter.cxx 
b/filter/source/graphic/GraphicExportFilter.cxx
index 2f4caba..604e4b3 100644
--- a/filter/source/graphic/GraphicExportFilter.cxx
+++ b/filter/source/graphic/GraphicExportFilter.cxx
@@ -112,7 +112,10 @@ sal_Bool SAL_CALL GraphicExportFilter::filter( const 
Sequence<PropertyValue>& rD
 
     Size aTargetSizePixel(mTargetWidth, mTargetHeight);
 
-    Graphic aGraphic = aRenderer.renderToGraphic( aCurrentPage, 
aDocumentSizePixel, aTargetSizePixel );
+    if (mTargetWidth == 0 || mTargetHeight == 0)
+        aTargetSizePixel = aDocumentSizePixel;
+
+    Graphic aGraphic = aRenderer.renderToGraphic(aCurrentPage, 
aDocumentSizePixel, aTargetSizePixel, COL_WHITE);
 
     GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
 
diff --git a/include/svtools/DocumentToGraphicRenderer.hxx 
b/include/svtools/DocumentToGraphicRenderer.hxx
index 68cdf2a..09de00e 100644
--- a/include/svtools/DocumentToGraphicRenderer.hxx
+++ b/include/svtools/DocumentToGraphicRenderer.hxx
@@ -49,7 +49,8 @@ public:
 
     Size getDocumentSizeIn100mm( sal_Int32 aCurrentPage );
 
-    Graphic renderToGraphic(sal_Int32 aCurrentPage, Size aDocumentSizePixel, 
Size aTargetSizePixel);
+    Graphic renderToGraphic(sal_Int32 aCurrentPage, Size aDocumentSizePixel,
+                            Size aTargetSizePixel, Color aPageColor = 
COL_TRANSPARENT);
 };
 
 #endif
diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx 
b/svtools/source/filter/DocumentToGraphicRenderer.cxx
index d410f4c..e33a94e 100644
--- a/svtools/source/filter/DocumentToGraphicRenderer.cxx
+++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx
@@ -94,7 +94,8 @@ Size 
DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 aCurrentPage)
 Graphic DocumentToGraphicRenderer::renderToGraphic(
     sal_Int32 aCurrentPage,
     Size aDocumentSizePixel,
-    Size aTargetSizePixel)
+    Size aTargetSizePixel,
+    Color aPageColor)
 
 {
     if (!mxModel.is() || !mxController.is() || !mxRenderable.is())
@@ -127,6 +128,12 @@ Graphic DocumentToGraphicRenderer::renderToGraphic(
 
     aMtf.Record( pOutputDev );
 
+    if (aPageColor != Color(COL_TRANSPARENT))
+    {
+        pOutputDev->SetBackground(Wallpaper(aPageColor));
+        pOutputDev->Erase();
+    }
+
     uno::Any aSelection;
     aSelection <<= mxDocument;
     mxRenderable->render(aCurrentPage - 1, aSelection, renderProps );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to