From 8c0c897c8cb92285e6461cc99ab0f2bbe15be65f Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 29 Aug 2017 11:15:57 +0200 Subject: Export to PNG: init DPI with screen resolution, tdf#108317 This whole concept of "use a JPG dialog for PNG export" is nonsense anyway, but.. as long as there isn't anything better at least have sensible defaults. Change-Id: I0c074f7bb2989122aed039c739fd1813f371cbca --- svtools/source/filter/GraphicExportOptionsDialog.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/svtools/source/filter/GraphicExportOptionsDialog.cxx b/svtools/source/filter/GraphicExportOptionsDialog.cxx index cb7928ad104e..cb7cb64c919e 100644 --- a/svtools/source/filter/GraphicExportOptionsDialog.cxx +++ b/svtools/source/filter/GraphicExportOptionsDialog.cxx @@ -18,6 +18,7 @@ */ #include +#include using namespace css::beans; using namespace css::lang; @@ -61,6 +62,12 @@ void GraphicExportOptionsDialog::initialize() { mCurrentPage = mRenderer.getCurrentPageWriter(); mSize100mm = mRenderer.getDocumentSizeIn100mm(mCurrentPage); + // Init DPI with screen resolution, taking width. This may lead to unusual + // DPI values but ensures a size in pixels that matches the actual screen + // content, which is vital for example for Calc with drawing layer and + // pixel images. + Size aSizePixels = Application::GetDefaultDevice()->LogicToPixel( mSize100mm, MapUnit::Map100thMM ); + mResolution = aSizePixels.Width() / getViewWidthInch(); } IMPL_LINK_NOARG( GraphicExportOptionsDialog, widthModifiedHandle, Edit&, void ) -- cgit v1.2.3