summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2022-02-09 12:31:49 +0530
committerDennis Francis <dennis.francis@collabora.com>2022-02-10 11:29:17 +0100
commit4fd2a14c6ee68f0574766ec7ec3dca35debe9d20 (patch)
tree2065d966b8ff0b28297a435b1fea01b7a7e686b3 /sfx2
parent38e4d2f422afdeced7904b44687800d308b93249 (diff)
lokCalcRTL: global RTL: fix chart edit mode renderingcp-21.06.16-1
If global RTL flag is set, vcl-window X offset of chart window is mirrored w.r.t parent window rectangle. This has to be undone to get the correct chart bounding box in negative X document coordinates so that the offset calculations for tile rendering remains the same for RTL documents irrespective of the system/global RTL setting. Change-Id: I3e1666681af4e7ab1257bcc88d44bbdb053a7d47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129704 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokcharthelper.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx
index b0b71aaa0353..49bdf5860784 100644
--- a/sfx2/source/view/lokcharthelper.cxx
+++ b/sfx2/source/view/lokcharthelper.cxx
@@ -18,6 +18,7 @@
#include <tools/mapunit.hxx>
#include <tools/UnitConversion.hxx>
#include <vcl/virdev.hxx>
+#include <sal/log.hxx>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/frame/XDispatch.hpp>
@@ -137,6 +138,13 @@ tools::Rectangle LokChartHelper::GetChartBoundingBox()
double fXScale( aCWMapMode.GetScaleX() );
double fYScale( aCWMapMode.GetScaleY() );
Point aOffset = pWindow->GetOffsetPixelFrom(*pRootWin);
+ if (mbNegativeX && AllSettings::GetLayoutRTL())
+ {
+ // If global RTL flag is set, vcl-window X offset of chart window is
+ // mirrored w.r.t parent window rectangle. This needs to be reverted.
+ aOffset.setX(pRootWin->GetOutOffXPixel() + pRootWin->GetSizePixel().Width()
+ - pWindow->GetOutOffXPixel() - pWindow->GetSizePixel().Width());
+ }
aOffset.setX( aOffset.X() * (TWIPS_PER_PIXEL / fXScale) );
aOffset.setY( aOffset.Y() * (TWIPS_PER_PIXEL / fYScale) );
Size aSize = pWindow->GetSizePixel();
@@ -171,7 +179,7 @@ bool LokChartHelper::Hit(const Point& aPos)
return false;
}
-bool LokChartHelper::HitAny(const Point& aPos)
+bool LokChartHelper::HitAny(const Point& aPos, bool bNegativeX)
{
SfxViewShell* pCurView = SfxViewShell::Current();
int nPartForCurView = pCurView ? pCurView->getPart() : -1;
@@ -180,7 +188,7 @@ bool LokChartHelper::HitAny(const Point& aPos)
{
if (pViewShell->GetDocId() == pCurView->GetDocId() && pViewShell->getPart() == nPartForCurView)
{
- LokChartHelper aChartHelper(pViewShell);
+ LokChartHelper aChartHelper(pViewShell, bNegativeX);
if (aChartHelper.Hit(aPos))
return true;
}
@@ -265,7 +273,7 @@ void LokChartHelper::PaintAllChartsOnTile(VirtualDevice& rDevice,
{
if (pCurView && pViewShell->GetDocId() == pCurView->GetDocId() && pViewShell->getPart() == nPartForCurView)
{
- LokChartHelper aChartHelper(pViewShell);
+ LokChartHelper aChartHelper(pViewShell, bNegativeX);
aChartHelper.PaintTile(rDevice, aTileRect);
}
pViewShell = SfxViewShell::GetNext(*pViewShell);