diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-04-19 09:33:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-04-19 18:18:16 +0200 |
commit | c90ebaddc119759f286a65f3fcd9c89aad2e4da9 (patch) | |
tree | 13b236871570c5368ac496b13a9872be69722840 /svx | |
parent | 2b258e8c5e0bd12af1ecea76be99bb384327fda9 (diff) |
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@allotropia.de>
Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/weldeditview.cxx | 72 |
1 files changed, 28 insertions, 44 deletions
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 |