[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - editeng/source include/editeng svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 19 16:18:54 UTC 2021
editeng/source/editeng/editview.cxx | 5 ++
include/editeng/editview.hxx | 1
svx/source/dialog/weldeditview.cxx | 72 ++++++++++++++----------------------
3 files changed, 34 insertions(+), 44 deletions(-)
New commits:
commit c90ebaddc119759f286a65f3fcd9c89aad2e4da9
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Apr 19 09:33:12 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Apr 19 18:18:16 2021 +0200
a11y tests show we should use GetOutputDevice for pixel/logic conversions
Change-Id: I229ffb376b03ff2479385632319661dd35a63fea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114188
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
Tested-by: Jenkins
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 8e7c62f224e6..2938633978e0 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -351,6 +351,11 @@ vcl::Window* EditView::GetWindow() const
return pImpEditView->pOutWin;
}
+OutputDevice& EditView::GetOutputDevice() const
+{
+ return pImpEditView->GetOutputDevice();
+}
+
bool EditView::HasOtherViewWindow( vcl::Window* pWin )
{
OutWindowSet& rOutWindowSet = pImpEditView->aOutWindowSet;
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index e89cd356be72..96c629f2e039 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -160,6 +160,7 @@ public:
void SetWindow( vcl::Window* pWin );
vcl::Window* GetWindow() const;
+ OutputDevice& GetOutputDevice() const;
bool HasOtherViewWindow( vcl::Window* pWin );
bool AddOtherViewWindow( vcl::Window* pWin );
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx
index f62a3df178dc..1a315930c332 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -730,33 +730,25 @@ bool WeldViewForwarder::IsValid() const { return m_rEditAcc.GetEditView() != nul
Point WeldViewForwarder::LogicToPixel(const Point& rPoint, const MapMode& rMapMode) const
{
EditView* pEditView = m_rEditAcc.GetEditView();
- OutputDevice* pOutDev = pEditView ? pEditView->GetWindow() : nullptr;
-
- if (pOutDev)
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- Point aPoint(OutputDevice::LogicToLogic(rPoint, rMapMode, MapMode(aMapMode.GetMapUnit())));
- aMapMode.SetOrigin(Point());
- return pOutDev->LogicToPixel(aPoint, aMapMode);
- }
-
- return Point();
+ if (!pEditView)
+ return Point();
+ OutputDevice& rOutDev = pEditView->GetOutputDevice();
+ MapMode aMapMode(rOutDev.GetMapMode());
+ Point aPoint(OutputDevice::LogicToLogic(rPoint, rMapMode, MapMode(aMapMode.GetMapUnit())));
+ aMapMode.SetOrigin(Point());
+ return rOutDev.LogicToPixel(aPoint, aMapMode);
}
Point WeldViewForwarder::PixelToLogic(const Point& rPoint, const MapMode& rMapMode) const
{
EditView* pEditView = m_rEditAcc.GetEditView();
- OutputDevice* pOutDev = pEditView ? pEditView->GetWindow() : nullptr;
-
- if (pOutDev)
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- aMapMode.SetOrigin(Point());
- Point aPoint(pOutDev->PixelToLogic(rPoint, aMapMode));
- return OutputDevice::LogicToLogic(aPoint, MapMode(aMapMode.GetMapUnit()), rMapMode);
- }
-
- return Point();
+ if (!pEditView)
+ return Point();
+ OutputDevice& rOutDev = pEditView->GetOutputDevice();
+ MapMode aMapMode(rOutDev.GetMapMode());
+ aMapMode.SetOrigin(Point());
+ Point aPoint(rOutDev.PixelToLogic(rPoint, aMapMode));
+ return OutputDevice::LogicToLogic(aPoint, MapMode(aMapMode.GetMapUnit()), rMapMode);
}
WeldTextForwarder::WeldTextForwarder(WeldEditAccessible& rAcc, WeldEditSource& rSource)
@@ -1303,33 +1295,25 @@ bool WeldEditViewForwarder::IsValid() const { return m_rEditAcc.GetEditView() !=
Point WeldEditViewForwarder::LogicToPixel(const Point& rPoint, const MapMode& rMapMode) const
{
EditView* pEditView = m_rEditAcc.GetEditView();
- OutputDevice* pOutDev = pEditView ? pEditView->GetWindow() : nullptr;
-
- if (pOutDev)
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- Point aPoint(OutputDevice::LogicToLogic(rPoint, rMapMode, MapMode(aMapMode.GetMapUnit())));
- aMapMode.SetOrigin(Point());
- return pOutDev->LogicToPixel(aPoint, aMapMode);
- }
-
- return Point();
+ if (!pEditView)
+ return Point();
+ OutputDevice& rOutDev = pEditView->GetOutputDevice();
+ MapMode aMapMode(rOutDev.GetMapMode());
+ Point aPoint(OutputDevice::LogicToLogic(rPoint, rMapMode, MapMode(aMapMode.GetMapUnit())));
+ aMapMode.SetOrigin(Point());
+ return rOutDev.LogicToPixel(aPoint, aMapMode);
}
Point WeldEditViewForwarder::PixelToLogic(const Point& rPoint, const MapMode& rMapMode) const
{
EditView* pEditView = m_rEditAcc.GetEditView();
- OutputDevice* pOutDev = pEditView ? pEditView->GetWindow() : nullptr;
-
- if (pOutDev)
- {
- MapMode aMapMode(pOutDev->GetMapMode());
- aMapMode.SetOrigin(Point());
- Point aPoint(pOutDev->PixelToLogic(rPoint, aMapMode));
- return OutputDevice::LogicToLogic(aPoint, MapMode(aMapMode.GetMapUnit()), rMapMode);
- }
-
- return Point();
+ if (!pEditView)
+ return Point();
+ OutputDevice& rOutDev = pEditView->GetOutputDevice();
+ MapMode aMapMode(rOutDev.GetMapMode());
+ aMapMode.SetOrigin(Point());
+ Point aPoint(rOutDev.PixelToLogic(rPoint, aMapMode));
+ return OutputDevice::LogicToLogic(aPoint, MapMode(aMapMode.GetMapUnit()), rMapMode);
}
bool WeldEditViewForwarder::GetSelection(ESelection& rSelection) const
More information about the Libreoffice-commits
mailing list