diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-10-01 21:27:49 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2018-10-09 14:02:55 +0200 |
commit | 60011cefbccd91065dadf66896a688b807e76964 (patch) | |
tree | 9f3f4319b7dc473fe3ee2df0dd9d3995f2b637b0 | |
parent | 73f9100a3d3f28ebfd676b42a833bba4ba9f05f1 (diff) |
tdf#115262 sc: fix cumulative placement error of images
Commit 708d1c5ab242b545ced598879233fc662d7e6cc0 (sc lok: emit
RowColumnHeader info in twips, 2015-11-02) improved precision of the
twip -> pixel conversion ratio, but ignored the detail that limited
precision used to silence cumulative errors that appear with larger
precision.
The original use-case was better precision of row/column headers for the
LOK API, so keep that as-is, but go back to the original behavior on the
desktop.
(cherry picked from commit 616fd241838069e18c59064e33c4b24f5ae112c6)
Change-Id: Ide169ab1745a9a9299caf3334559884ff7223cbe
Reviewed-on: https://gerrit.libreoffice.org/61312
Tested-by: Jenkins
Tested-by: Xisco FaulĂ <xiscofauli@libreoffice.org>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | sc/source/core/data/global.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 7c05743572a2..f3819735f6dc 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -487,8 +487,19 @@ void ScGlobal::InitPPT() { OutputDevice* pDev = Application::GetDefaultDevice(); - nScreenPPTX = double(pDev->GetDPIX()) / double(TWIPS_PER_INCH); - nScreenPPTY = double(pDev->GetDPIY()) / double(TWIPS_PER_INCH); + if (comphelper::LibreOfficeKit::isActive()) + { + nScreenPPTX = double(pDev->GetDPIX()) / double(TWIPS_PER_INCH); + nScreenPPTY = double(pDev->GetDPIY()) / double(TWIPS_PER_INCH); + } + else + { + // Avoid cumulative placement errors by intentionally limiting + // precision. + Point aPix1000 = pDev->LogicToPixel(Point(1000, 1000), MapMode(MapUnit::MapTwip)); + nScreenPPTX = aPix1000.X() / 1000.0; + nScreenPPTY = aPix1000.Y() / 1000.0; + } } const OUString& ScGlobal::GetClipDocName() |