summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-04-19 09:33:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-04-19 11:57:10 +0200
commit65834914dbc79ab2f4095bf7a47a78f4145afa62 (patch)
treeac0555a1943e48d4b27ae58501645cbcab291660 /svx
parent628c1c3b0791bb0866917442040dc491de2acb61 (diff)
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@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/weldeditview.cxx72
1 files changed, 28 insertions, 44 deletions
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