[Libreoffice-commits] core.git: svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 19 09:57:48 UTC 2021
svx/source/dialog/weldeditview.cxx | 72 ++++++++++++++-----------------------
1 file changed, 28 insertions(+), 44 deletions(-)
New commits:
commit 65834914dbc79ab2f4095bf7a47a78f4145afa62
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 11:57:10 2021 +0200
a11y tests show we should use GetOutputDevice for pixel/logic conversions
Change-Id: I229ffb376b03ff2479385632319661dd35a63fea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114258
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx
index c81a3dad1c37..f08abb3b740e 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -799,33 +799,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)
@@ -1372,33 +1364,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