diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-01-04 11:04:05 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2019-03-27 21:39:20 +0100 |
commit | 5ceee417fef834cd6b033603d72eaf4708970a1d (patch) | |
tree | 7699050a4643c44fdc8e1294cad60f2328c73ead /sfx2 | |
parent | cbbe3edc5668fa21f8507a6435547dbfe5eef4d0 (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/69758
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 689dc36b42e7..4102bebe3435 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -549,7 +549,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) sal_Int16 nPage = 1; ::Size aDocumentSizePixel = aRenderer.getDocumentSizeInPixels(nPage); - ::Size aLogic = aRenderer.getDocumentSizeIn100mm(nPage); + ::Point aLogicPos; + ::Size aLogic = aRenderer.getDocumentSizeIn100mm(nPage, &aLogicPos); // FIXME: This is a temporary hack. Need to figure out a proper way to derive this scale factor. ::Size aTargetSize(aDocumentSizePixel.Width() * 1.23, aDocumentSizePixel.Height() * 1.23); @@ -560,6 +561,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // will be correct in MM. MapMode aMapMode; aMapMode.SetMapUnit(MapUnit::Map100thMM); + aMapMode.SetOrigin(::Point(-aLogicPos.getX(), -aLogicPos.getY())); rGDIMetaFile.SetPrefMapMode(aMapMode); rGDIMetaFile.SetPrefSize(aLogic); |