Kaydet (Commit) b424ffd2 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Miklos Vajna

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/19478Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
Tested-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst c7f1f227
...@@ -112,7 +112,10 @@ sal_Bool SAL_CALL GraphicExportFilter::filter( const Sequence<PropertyValue>& rD ...@@ -112,7 +112,10 @@ sal_Bool SAL_CALL GraphicExportFilter::filter( const Sequence<PropertyValue>& rD
Size aTargetSizePixel(mTargetWidth, mTargetHeight); 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(); GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
......
...@@ -49,7 +49,8 @@ public: ...@@ -49,7 +49,8 @@ public:
Size getDocumentSizeIn100mm( sal_Int32 aCurrentPage ); 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 #endif
......
...@@ -94,7 +94,8 @@ Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 aCurrentPage) ...@@ -94,7 +94,8 @@ Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 aCurrentPage)
Graphic DocumentToGraphicRenderer::renderToGraphic( Graphic DocumentToGraphicRenderer::renderToGraphic(
sal_Int32 aCurrentPage, sal_Int32 aCurrentPage,
Size aDocumentSizePixel, Size aDocumentSizePixel,
Size aTargetSizePixel) Size aTargetSizePixel,
Color aPageColor)
{ {
if (!mxModel.is() || !mxController.is() || !mxRenderable.is()) if (!mxModel.is() || !mxController.is() || !mxRenderable.is())
...@@ -127,6 +128,12 @@ Graphic DocumentToGraphicRenderer::renderToGraphic( ...@@ -127,6 +128,12 @@ Graphic DocumentToGraphicRenderer::renderToGraphic(
aMtf.Record( pOutputDev ); aMtf.Record( pOutputDev );
if (aPageColor != Color(COL_TRANSPARENT))
{
pOutputDev->SetBackground(Wallpaper(aPageColor));
pOutputDev->Erase();
}
uno::Any aSelection; uno::Any aSelection;
aSelection <<= mxDocument; aSelection <<= mxDocument;
mxRenderable->render(aCurrentPage - 1, aSelection, renderProps ); mxRenderable->render(aCurrentPage - 1, aSelection, renderProps );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment