diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2020-06-18 18:09:19 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.com> | 2020-07-06 18:05:59 +0200 |
commit | 345f9480618d0867f6b42a83a7ae1d62c8ef9c0c (patch) | |
tree | 045ecf7e88a644535680d101888e31694a00f9ee /sc/source/ui/view/viewdata.cxx | |
parent | 711c45449847fb95e8ee68ff578389ea903c0378 (diff) |
scPrintTwipsMsgs: Use print logical coordinates for draw objects
as a result LOK_CALLBACK_GRAPHIC(_VIEW)_SELECTION messages will now be
in print-twips.
For tile-rendering, it needs the pixel-aligned coordinates of each
object. The translation of print coordinates to pixel-aligned
coordinates can be done behind the scenes by the
ViewContact/ObjectContact/ViewObjectContact objects associated with the
draw object which uses the cached "grid-offset" for each object
(introduced in the patch "Refactor calc non-linear ViewToDevice
transform"). For doing this, a subclass of FmFormView with a specialized
"createViewSpecificObjectContact" method is used for tile-rendering. The
createViewSpecificObjectContact creates a "proxy" object-contact object
that delegates the grid-offsets queries to the actual ScDrawView
generated ObjectContact. This is needed because currently there is no
way to share the ObjectContact/ViewObjectContact instances between
different SdrPaintWindow's without making changes ~everywhere.
Change-Id: Ifdfb623c8d6dd81700ec4a5dfeeb6b2391a96154
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98166
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc/source/ui/view/viewdata.cxx')
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 887f4e632ce6..6632e51ee918 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2434,6 +2434,21 @@ Point ScViewData::GetPrintTwipsPos(SCCOL nCol, SCROW nRow) const return Point(nPosX, nPosY); } +Point ScViewData::GetPrintTwipsPosFromTileTwips(const Point& rTileTwipsPos) const +{ + const long nPixelX = static_cast<long>(rTileTwipsPos.X() * nPPTX); + const long nPixelY = static_cast<long>(rTileTwipsPos.Y() * nPPTY); + SCCOL nCol = 0; + SCROW nRow = 0; + + // The following call (with bTestMerge = false) will not modify any members. + const_cast<ScViewData*>(this)->GetPosFromPixel(nPixelX, nPixelY, SC_SPLIT_TOPLEFT, nCol, nRow, false /* bTestMerge */); + const Point aPixCellPos = GetScrPos(nCol, nRow, SC_SPLIT_TOPLEFT, true /* bAllowNeg */); + const Point aTileTwipsCellPos(aPixCellPos.X() / nPPTX, aPixCellPos.Y() / nPPTY); + const Point aPrintTwipsCellPos = GetPrintTwipsPos(nCol, nRow); + return aPrintTwipsCellPos + (rTileTwipsPos - aTileTwipsCellPos); +} + OString ScViewData::describeCellCursorAt(SCCOL nX, SCROW nY, bool bPixelAligned) const { const bool bPosSizeInPixels = bPixelAligned; |