diff options
author | Muhammet Kara <muhammet.kara@collabora.com> | 2019-05-07 22:03:25 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@collabora.com> | 2019-05-08 13:25:29 +0200 |
commit | 141e33bc1d56f7b7af5037988eeb5ca36864a511 (patch) | |
tree | 5ea183262170cfbf296557be736b6390e1fff1c4 /sfx2/source/doc/objserv.cxx | |
parent | d3581eb79e204419a6906004c199512c1fa48a2c (diff) |
Respect page margins of the source doc during redaction
Change-Id: Ieaa50a2eba17145180ddd5d2bfc77add4801c43a
Reviewed-on: https://gerrit.libreoffice.org/71929
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'sfx2/source/doc/objserv.cxx')
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index eec137331a54..2063f40aa090 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -556,6 +556,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) DocumentToGraphicRenderer aRenderer(xSourceDoc, false); + // Get the page margins of the original doc + PageMargins aPageMargins = {-1, -1, -1, -1}; + if (aRenderer.isWriter()) + aPageMargins = SfxRedactionHelper::getPageMarginsForWriter(xModel); + else if (aRenderer.isCalc()) + aPageMargins = SfxRedactionHelper::getPageMarginsForCalc(xModel); + sal_Int32 nPages = aRenderer.getPageCount(); std::vector< GDIMetaFile > aMetaFiles; std::vector< ::Size > aPageSizes; @@ -569,7 +576,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) uno::Reference<lang::XComponent> xComponent = xComponentLoader->loadComponentFromURL("private:factory/sdraw", "_default", 0, {}); // Add the doc pages to the new draw document - SfxRedactionHelper::addPagesToDraw(xComponent, nPages, aMetaFiles, aPageSizes); + SfxRedactionHelper::addPagesToDraw(xComponent, nPages, aMetaFiles, aPageSizes, aPageMargins); // Show the Redaction toolbar SfxViewFrame* pViewFrame = SfxViewFrame::Current(); |