diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-01-04 11:04:05 +0100 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@collabora.com> | 2019-06-17 19:25:26 +0200 |
commit | ff7de7476e0492cbfcc43c076fc2a24370dcb0ac (patch) | |
tree | 0fb1b6652d91af949c37cb6dba52c1ef0eaf6bbc /svtools | |
parent | eeba1b0298296c06392282830f51bdc8d3b502eb (diff) |
svtools: expose document position in DocumentToGraphicRenderer
Writer pages always have an offset inside the root frame, and this is
visible in the generated metafile as well. The offset is minimal for a
small window and a single page, but the vertical offset increases with
every page. Make this information visible, so sfx2 can compensate this.
This is somewhat similar to what SfxObjectShell::DoDraw_Impl() does, but
that works for the first page only (use case is thumbnail generation),
while this is 0 offset for Calc/Impress and a proper offset for all
Writer pages.
Change-Id: I1075c98faf74f9e77c916572b4d63d40fbd80ab1
Reviewed-on: https://gerrit.libreoffice.org/65850
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Reviewed-on: https://gerrit.libreoffice.org/74188
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Tested-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/filter/DocumentToGraphicRenderer.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx index 1c11438473ea..771ca36152b0 100644 --- a/svtools/source/filter/DocumentToGraphicRenderer.cxx +++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx @@ -114,7 +114,8 @@ uno::Any DocumentToGraphicRenderer::getSelection() const return aSelection; } -Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 nCurrentPage) +Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 nCurrentPage, + Point* pDocumentPosition) { Reference< awt::XDevice > xDevice(mxToolkit->createScreenCompatibleDevice( 32, 32 ) ); @@ -133,6 +134,7 @@ Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 nCurrentPage) renderProperties[3].Value <<= true; awt::Size aSize; + awt::Point aPos; sal_Int32 nPages = mxRenderable->getRendererCount( selection, renderProperties ); if (nPages >= nCurrentPage) @@ -144,9 +146,18 @@ Size DocumentToGraphicRenderer::getDocumentSizeIn100mm(sal_Int32 nCurrentPage) { aResult[ nProperty ].Value >>= aSize; } + else if (aResult[nProperty].Name == "PagePos") + { + aResult[nProperty].Value >>= aPos; + } } } + if (pDocumentPosition) + { + *pDocumentPosition = Point(aPos.X, aPos.Y); + } + return Size( aSize.Width, aSize.Height ); } |