summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2022-01-06 10:54:49 +0530
committerDennis Francis <dennis.francis@collabora.com>2022-02-05 08:01:23 +0100
commite3e8aaa2517dfbaf9ab5dcf10612547c6c6b0eb4 (patch)
tree094294c9897dd5c831ecf9d86af391b7e3ddb691 /sfx2
parent583185235389b55d6cfffac3067c0e1ccb2852b1 (diff)
lokCalcRTL: fix rendering of charts in edit mode
Inform Sfx2InPlaceClient and LokChartHelper when negated X coordinates are used. Ensure that invalidation rectangles have positive coordinates in all cases. Conflicts: include/sfx2/lokcharthelper.hxx sfx2/source/view/ipclient.cxx Change-Id: I8f5440718e288d8f0d379c8da5f49a29e51f6940 (cherry picked from commit 284068c7eb473bafd5cafeb30a78daab4538cff6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129362 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/ipclient.cxx26
-rw-r--r--sfx2/source/view/lokcharthelper.cxx6
2 files changed, 28 insertions, 4 deletions
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index ce9d2fdfb6c7..73fe6f241bae 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -91,6 +91,15 @@ public:
}
};
+tools::Rectangle lcl_negateRectX(const tools::Rectangle& rRect)
+{
+ return tools::Rectangle(
+ std::max(0l, -rRect.Right()),
+ rRect.Top(),
+ std::max(0l, -rRect.Left()),
+ rRect.Bottom());
+}
+
}
// SfxInPlaceClient_Impl
@@ -112,6 +121,7 @@ public:
bool m_bStoreObject;
bool m_bUIActive; // set and cleared when notification for UI (de)activation is sent
bool m_bResizeNoScale;
+ bool m_bNegativeX;
uno::Reference < embed::XEmbeddedObject > m_xObject;
@@ -122,6 +132,7 @@ public:
, m_bStoreObject( true )
, m_bUIActive( false )
, m_bResizeNoScale( false )
+ , m_bNegativeX( false )
{}
void SizeHasChanged();
@@ -347,7 +358,7 @@ void SAL_CALL SfxInPlaceClient_Impl::activatingInplace()
aRect = o3tl::convert(aRect, o3tl::Length::mm100, o3tl::Length::twip);
}
- OString str = aRect.toString() + ", \"INPLACE\"";
+ OString str = (m_bNegativeX ? lcl_negateRectX(aRect) : aRect).toString() + ", \"INPLACE\"";
pViewShell->libreOfficeKitViewCallback( LOK_CALLBACK_GRAPHIC_SELECTION, str.getStr() );
}
@@ -823,7 +834,8 @@ void SfxInPlaceClient::Invalidate()
tools::Rectangle aRealObjArea( m_xImp->m_aObjArea );
aRealObjArea.SetSize( Size( tools::Long( aRealObjArea.GetWidth() * m_xImp->m_aScaleWidth ),
tools::Long( aRealObjArea.GetHeight() * m_xImp->m_aScaleHeight ) ) );
- m_pEditWin->Invalidate( aRealObjArea );
+
+ m_pEditWin->Invalidate( IsNegativeX() ? lcl_negateRectX(aRealObjArea) : aRealObjArea );
ViewChanged();
}
@@ -1122,4 +1134,14 @@ bool SfxInPlaceClient::IsUIActive() const
return m_xImp->m_bUIActive;
}
+void SfxInPlaceClient::SetNegativeX(bool bSet)
+{
+ m_xImp->m_bNegativeX = bSet;
+}
+
+bool SfxInPlaceClient::IsNegativeX() const
+{
+ return m_xImp->m_bNegativeX;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx
index e5965802306c..a87388832755 100644
--- a/sfx2/source/view/lokcharthelper.cxx
+++ b/sfx2/source/view/lokcharthelper.cxx
@@ -223,7 +223,8 @@ void LokChartHelper::PaintTile(VirtualDevice& rRenderContext, const tools::Recta
void LokChartHelper::PaintAllChartsOnTile(VirtualDevice& rDevice,
int nOutputWidth, int nOutputHeight,
int nTilePosX, int nTilePosY,
- tools::Long nTileWidth, tools::Long nTileHeight)
+ tools::Long nTileWidth, tools::Long nTileHeight,
+ bool bNegativeX)
{
if (comphelper::LibreOfficeKit::isTiledAnnotations())
return;
@@ -245,7 +246,8 @@ void LokChartHelper::PaintAllChartsOnTile(VirtualDevice& rDevice,
SfxViewShell* pCurView = SfxViewShell::Current();
int nPartForCurView = pCurView ? pCurView->getPart() : -1;
- tools::Rectangle aTileRect(Point(nTilePosX, nTilePosY), Size(nTileWidth, nTileHeight));
+ tools::Long nTileRectLeft = bNegativeX ? -nTilePosX - nTileWidth : nTilePosX;
+ tools::Rectangle aTileRect(Point(nTileRectLeft, nTilePosY), Size(nTileWidth, nTileHeight));
SfxViewShell* pViewShell = SfxViewShell::GetFirst();
while (pViewShell)
{