accessibility/inc/extended/AccessibleBrowseBox.hxx | 2 accessibility/inc/extended/AccessibleBrowseBoxBase.hxx | 4 accessibility/inc/extended/AccessibleBrowseBoxHeaderBar.hxx | 2 accessibility/inc/extended/AccessibleBrowseBoxHeaderCell.hxx | 2 accessibility/inc/extended/AccessibleBrowseBoxTable.hxx | 2 accessibility/inc/extended/AccessibleGridControl.hxx | 2 accessibility/inc/extended/AccessibleGridControlBase.hxx | 4 accessibility/inc/extended/AccessibleGridControlHeader.hxx | 2 accessibility/inc/extended/AccessibleGridControlHeaderCell.hxx | 2 accessibility/inc/extended/AccessibleGridControlTable.hxx | 2 accessibility/inc/extended/AccessibleGridControlTableCell.hxx | 2 accessibility/inc/extended/accessiblebrowseboxcell.hxx | 2 accessibility/inc/extended/accessibleiconchoicectrlentry.hxx | 4 accessibility/inc/helper/IComboListBoxHelper.hxx | 3 accessibility/inc/helper/listboxhelper.hxx | 4 accessibility/source/extended/AccessibleBrowseBox.cxx | 2 accessibility/source/extended/AccessibleBrowseBoxBase.cxx | 4 accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx | 4 accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx | 4 accessibility/source/extended/AccessibleBrowseBoxTable.cxx | 4 accessibility/source/extended/AccessibleGridControl.cxx | 2 accessibility/source/extended/AccessibleGridControlBase.cxx | 4 accessibility/source/extended/AccessibleGridControlHeader.cxx | 8 accessibility/source/extended/AccessibleGridControlHeaderCell.cxx | 6 accessibility/source/extended/AccessibleGridControlTable.cxx | 4 accessibility/source/extended/AccessibleGridControlTableCell.cxx | 6 accessibility/source/extended/accessiblebrowseboxcell.cxx | 4 accessibility/source/extended/accessibleiconchoicectrlentry.cxx | 20 accessibility/source/extended/accessiblelistboxentry.cxx | 2 accessibility/source/extended/textwindowaccessibility.cxx | 2 accessibility/source/standard/accessiblemenucomponent.cxx | 4 accessibility/source/standard/accessiblemenuitemcomponent.cxx | 2 accessibility/source/standard/vclxaccessiblelistitem.cxx | 2 chart2/source/controller/main/ChartController_Tools.cxx | 2 dbaccess/source/ui/querydesign/TableWindowAccess.cxx | 4 desktop/source/splash/splash.cxx | 4 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx | 2 embeddedobj/source/general/docholder.cxx | 2 framework/source/layoutmanager/layoutmanager.cxx | 2 include/svtools/brwbox.hxx | 2 include/toolkit/helper/convert.hxx | 4 include/tools/gen.hxx | 831 +++++----- include/vcl/accessibletable.hxx | 2 include/vcl/accessibletableprovider.hxx | 2 include/vcl/svapp.hxx | 4 include/vcl/toolkit/floatwin.hxx | 10 include/vcl/toolkit/svtabbx.hxx | 2 include/vcl/weld.hxx | 4 include/vcl/window.hxx | 12 sc/source/ui/Accessibility/AccessibleCell.cxx | 6 sc/source/ui/Accessibility/AccessibleContextBase.cxx | 4 sc/source/ui/Accessibility/AccessibleDocument.cxx | 6 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx | 4 sc/source/ui/Accessibility/AccessibleEditObject.cxx | 22 sc/source/ui/Accessibility/AccessiblePageHeader.cxx | 6 sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx | 8 sc/source/ui/Accessibility/AccessiblePreviewCell.cxx | 6 sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx | 6 sc/source/ui/Accessibility/AccessiblePreviewTable.cxx | 6 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx | 4 sc/source/ui/inc/AccessibleCell.hxx | 2 sc/source/ui/inc/AccessibleContextBase.hxx | 3 sc/source/ui/inc/AccessibleDocument.hxx | 2 sc/source/ui/inc/AccessibleDocumentPagePreview.hxx | 2 sc/source/ui/inc/AccessibleEditObject.hxx | 4 sc/source/ui/inc/AccessiblePageHeader.hxx | 2 sc/source/ui/inc/AccessiblePageHeaderArea.hxx | 2 sc/source/ui/inc/AccessiblePreviewCell.hxx | 2 sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx | 2 sc/source/ui/inc/AccessiblePreviewTable.hxx | 2 sc/source/ui/inc/AccessibleSpreadsheet.hxx | 2 sc/source/ui/unoobj/viewuno.cxx | 2 sc/source/ui/view/select.cxx | 4 sc/source/ui/view/tabview.cxx | 4 sfx2/source/appl/newhelp.cxx | 4 sfx2/source/appl/newhelp.hxx | 2 sfx2/source/control/recentdocsview.cxx | 2 sfx2/source/control/templatedefaultview.cxx | 2 svtools/source/brwbox/brwbox2.cxx | 6 svtools/source/brwbox/brwbox3.cxx | 2 svx/source/accessibility/AccessibleFrameSelector.cxx | 2 svx/source/dialog/weldeditview.cxx | 2 sw/qa/extras/layout/data/tdf125334.odt |binary sw/qa/extras/layout/layout2.cxx | 5 sw/source/core/access/acccontext.cxx | 4 sw/source/core/access/accmap.cxx | 2 sw/source/uibase/table/chartins.cxx | 4 sw/source/uibase/uiview/viewport.cxx | 4 toolkit/inc/controls/table/tablecontrol.hxx | 2 toolkit/source/awt/vclxaccessiblecomponent.cxx | 6 toolkit/source/awt/vclxtoolkit.cxx | 2 toolkit/source/controls/table/tablecontrol.cxx | 2 tools/source/generic/gen.cxx | 47 tools/source/generic/point.cxx | 16 vbahelper/source/vbahelper/vbahelper.cxx | 4 vcl/android/androidinst.cxx | 8 vcl/headless/svpdummies.cxx | 6 vcl/headless/svpframe.cxx | 6 vcl/inc/android/androidinst.hxx | 2 vcl/inc/headless/svpdummies.hxx | 2 vcl/inc/headless/svpframe.hxx | 2 vcl/inc/osx/salframe.h | 2 vcl/inc/osx/salsys.h | 2 vcl/inc/qt5/QtFrame.hxx | 2 vcl/inc/qt5/QtSystem.hxx | 3 vcl/inc/qt5/QtTools.hxx | 5 vcl/inc/salframe.hxx | 2 vcl/inc/salsys.hxx | 2 vcl/inc/salvtables.hxx | 4 vcl/inc/salwtype.hxx | 6 vcl/inc/unx/gtk/gtkdata.hxx | 2 vcl/inc/unx/gtk/gtkframe.hxx | 2 vcl/inc/unx/gtk/gtksys.hxx | 2 vcl/inc/unx/saldisp.hxx | 8 vcl/inc/unx/salframe.h | 8 vcl/inc/unx/wmadaptor.hxx | 4 vcl/inc/unx/x11/x11sys.hxx | 2 vcl/inc/win/salframe.h | 2 vcl/inc/win/salsys.h | 6 vcl/osx/salframe.cxx | 6 vcl/osx/salmenu.cxx | 2 vcl/osx/salsys.cxx | 13 vcl/qt5/QtFrame.cxx | 4 vcl/qt5/QtMenu.cxx | 2 vcl/qt5/QtSystem.cxx | 4 vcl/source/app/help.cxx | 22 vcl/source/app/salvtables.cxx | 4 vcl/source/app/svapp.cxx | 20 vcl/source/app/weldutils.cxx | 4 vcl/source/control/combobox.cxx | 4 vcl/source/control/listbox.cxx | 8 vcl/source/treelist/svtabbx.cxx | 6 vcl/source/window/brdwin.cxx | 6 vcl/source/window/bubblewindow.cxx | 2 vcl/source/window/dockwin.cxx | 13 vcl/source/window/floatwin.cxx | 66 vcl/source/window/menu.cxx | 8 vcl/source/window/status.cxx | 4 vcl/source/window/syswin.cxx | 6 vcl/source/window/taskpanelist.cxx | 10 vcl/source/window/toolbox2.cxx | 4 vcl/source/window/window.cxx | 35 vcl/source/window/winproc.cxx | 12 vcl/unx/generic/app/randrwrapper.cxx | 2 vcl/unx/generic/app/saldisp.cxx | 8 vcl/unx/generic/app/wmadaptor.cxx | 72 vcl/unx/generic/window/salframe.cxx | 66 vcl/unx/gtk3/gtkframe.cxx | 16 vcl/unx/gtk3/gtkinst.cxx | 12 vcl/unx/gtk3/gtksalmenu.cxx | 6 vcl/unx/gtk3/gtksys.cxx | 8 vcl/unx/x11/x11sys.cxx | 8 vcl/win/app/salinfo.cxx | 14 vcl/win/window/salframe.cxx | 22 154 files changed, 972 insertions(+), 862 deletions(-)
New commits: commit b6b26421a1029b18b48b69dbdac4bb70fb622604 Author: Noel Grandin <[email protected]> AuthorDate: Thu Jul 20 08:19:52 2023 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Aug 2 08:13:15 2023 +0200 split Point/Size/Rectangle into AbsoluteScreenPixel* types to attempt to make it obvious in code what kind of coordinate system we are dealing with. The idea is that by doing this, the compile-time type checking will flush out inconsistencies between different code. I started with vcl::Window::OutputToAbsoluteScreenPixel and worked outwards from there. Change-Id: Ia967d7a0bb38886695f3a761b85c8b9340ddb1c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154676 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/accessibility/inc/extended/AccessibleBrowseBox.hxx b/accessibility/inc/extended/AccessibleBrowseBox.hxx index 82211f1aec32..6605ff02be8b 100644 --- a/accessibility/inc/extended/AccessibleBrowseBox.hxx +++ b/accessibility/inc/extended/AccessibleBrowseBox.hxx @@ -143,7 +143,7 @@ protected: virtual tools::Rectangle implGetBoundingBox() override; /** @attention This method requires locked mutex's and a living object. @return The bounding box (VCL rect.) in screen coordinates. */ - virtual tools::Rectangle implGetBoundingBoxOnScreen() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; // internal helper methods diff --git a/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx b/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx index c91d39efab0d..ef199ee2da5c 100644 --- a/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx +++ b/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx @@ -241,7 +241,7 @@ protected: /** Derived classes return the bounding box in screen coordinates. @attention This method requires locked mutex's and a living object. @return The bounding box (VCL rect.) in screen coordinates. */ - virtual tools::Rectangle implGetBoundingBoxOnScreen() = 0; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() = 0; /** Creates a bitset of states of the current object. This method calls FillStateSet at the BrowseBox which @@ -268,7 +268,7 @@ protected: @return The bounding box (VCL rect.) in screen coordinates. @throws css::lang::DisposedException */ - tools::Rectangle getBoundingBoxOnScreen(); + AbsoluteScreenPixelRectangle getBoundingBoxOnScreen(); ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; } void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; } diff --git a/accessibility/inc/extended/AccessibleBrowseBoxHeaderBar.hxx b/accessibility/inc/extended/AccessibleBrowseBoxHeaderBar.hxx index c8f2e8b835c4..d353b8c6018b 100644 --- a/accessibility/inc/extended/AccessibleBrowseBoxHeaderBar.hxx +++ b/accessibility/inc/extended/AccessibleBrowseBoxHeaderBar.hxx @@ -163,7 +163,7 @@ private: virtual tools::Rectangle implGetBoundingBox() override; /** @attention This method requires locked mutex's and a living object. @return The bounding box (VCL rect.) in screen coordinates. */ - virtual tools::Rectangle implGetBoundingBoxOnScreen() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; /** @attention This method requires locked mutex's and a living object. @return The count of used rows. */ diff --git a/accessibility/inc/extended/AccessibleBrowseBoxHeaderCell.hxx b/accessibility/inc/extended/AccessibleBrowseBoxHeaderCell.hxx index a3062a12ea89..530e9f37f1e2 100644 --- a/accessibility/inc/extended/AccessibleBrowseBoxHeaderCell.hxx +++ b/accessibility/inc/extended/AccessibleBrowseBoxHeaderCell.hxx @@ -61,7 +61,7 @@ namespace accessibility private: virtual tools::Rectangle implGetBoundingBox() override; - virtual tools::Rectangle implGetBoundingBoxOnScreen() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; }; } diff --git a/accessibility/inc/extended/AccessibleBrowseBoxTable.hxx b/accessibility/inc/extended/AccessibleBrowseBoxTable.hxx index 3f8d3a274c5b..8892ff384e9e 100644 --- a/accessibility/inc/extended/AccessibleBrowseBoxTable.hxx +++ b/accessibility/inc/extended/AccessibleBrowseBoxTable.hxx @@ -109,7 +109,7 @@ protected: virtual tools::Rectangle implGetBoundingBox() override; /** @attention This method requires locked mutex's and a living object. @return The bounding box (VCL rect.) in screen coordinates. */ - virtual tools::Rectangle implGetBoundingBoxOnScreen() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; // internal helper methods diff --git a/accessibility/inc/extended/AccessibleGridControl.hxx b/accessibility/inc/extended/AccessibleGridControl.hxx index c58880b9a0f4..7df6b82c3453 100644 --- a/accessibility/inc/extended/AccessibleGridControl.hxx +++ b/accessibility/inc/extended/AccessibleGridControl.hxx @@ -111,7 +111,7 @@ private: virtual tools::Rectangle implGetBoundingBox() override; /** @attention This method requires locked mutex's and a living object. @return The bounding box (VCL rect.) in screen coordinates. */ - virtual tools::Rectangle implGetBoundingBoxOnScreen() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; // internal helper methods ------------------------------------------------ diff --git a/accessibility/inc/extended/AccessibleGridControlBase.hxx b/accessibility/inc/extended/AccessibleGridControlBase.hxx index 75bfa96ce87e..186edc83797c 100644 --- a/accessibility/inc/extended/AccessibleGridControlBase.hxx +++ b/accessibility/inc/extended/AccessibleGridControlBase.hxx @@ -204,7 +204,7 @@ protected: ///** Derived classes return the bounding box in screen coordinates. // @attention This method requires locked mutex's and a living object. // @return The bounding box (VCL rect.) in screen coordinates. */ - virtual tools::Rectangle implGetBoundingBoxOnScreen() = 0; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() = 0; /** Creates a bitset of states of the current object. This method calls FillStateSet at the GridControl which @@ -229,7 +229,7 @@ protected: // coordinates. // @return The bounding box (VCL rect.) in screen coordinates. */ /// @throws css::lang::DisposedException - tools::Rectangle getBoundingBoxOnScreen(); + AbsoluteScreenPixelRectangle getBoundingBoxOnScreen(); ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; } void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; } diff --git a/accessibility/inc/extended/AccessibleGridControlHeader.hxx b/accessibility/inc/extended/AccessibleGridControlHeader.hxx index 419ec28233cd..7e1c3e7ab26b 100644 --- a/accessibility/inc/extended/AccessibleGridControlHeader.hxx +++ b/accessibility/inc/extended/AccessibleGridControlHeader.hxx @@ -125,7 +125,7 @@ private: virtual tools::Rectangle implGetBoundingBox() override; /** @attention This method requires locked mutex's and a living object. @return The bounding box (VCL rect.) in screen coordinates. */ - virtual tools::Rectangle implGetBoundingBoxOnScreen() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; // internal helper methods diff --git a/accessibility/inc/extended/AccessibleGridControlHeaderCell.hxx b/accessibility/inc/extended/AccessibleGridControlHeaderCell.hxx index d530a06736de..6e78029a84fd 100644 --- a/accessibility/inc/extended/AccessibleGridControlHeaderCell.hxx +++ b/accessibility/inc/extended/AccessibleGridControlHeaderCell.hxx @@ -71,7 +71,7 @@ namespace accessibility private: virtual tools::Rectangle implGetBoundingBox() override; - virtual tools::Rectangle implGetBoundingBoxOnScreen() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; }; } diff --git a/accessibility/inc/extended/AccessibleGridControlTable.hxx b/accessibility/inc/extended/AccessibleGridControlTable.hxx index deb6fbf6e06b..ef029ec4a71e 100644 --- a/accessibility/inc/extended/AccessibleGridControlTable.hxx +++ b/accessibility/inc/extended/AccessibleGridControlTable.hxx @@ -153,7 +153,7 @@ private: virtual tools::Rectangle implGetBoundingBox() override; ///** @attention This method requires locked mutex's and a living object. // @return The bounding box (VCL rect.) in screen coordinates. */ - virtual tools::Rectangle implGetBoundingBoxOnScreen() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; //// internal helper methods diff --git a/accessibility/inc/extended/AccessibleGridControlTableCell.hxx b/accessibility/inc/extended/AccessibleGridControlTableCell.hxx index cbb06ebd1477..f9f8c4f7f16e 100644 --- a/accessibility/inc/extended/AccessibleGridControlTableCell.hxx +++ b/accessibility/inc/extended/AccessibleGridControlTableCell.hxx @@ -74,7 +74,7 @@ namespace accessibility virtual css::lang::Locale implGetLocale() override; virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override final; virtual tools::Rectangle implGetBoundingBox() override; - virtual tools::Rectangle implGetBoundingBoxOnScreen() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; public: AccessibleGridControlTableCell( const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, diff --git a/accessibility/inc/extended/accessiblebrowseboxcell.hxx b/accessibility/inc/extended/accessiblebrowseboxcell.hxx index ba4654654a1f..4db205c1d77c 100644 --- a/accessibility/inc/extended/accessiblebrowseboxcell.hxx +++ b/accessibility/inc/extended/accessiblebrowseboxcell.hxx @@ -44,7 +44,7 @@ namespace accessibility protected: // AccessibleBrowseBoxBase overridables virtual tools::Rectangle implGetBoundingBox() override; - virtual tools::Rectangle implGetBoundingBoxOnScreen() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; // XAccessibleComponent virtual void SAL_CALL grabFocus() override; diff --git a/accessibility/inc/extended/accessibleiconchoicectrlentry.hxx b/accessibility/inc/extended/accessibleiconchoicectrlentry.hxx index 67724ae710b8..3a6c8bfdfdf7 100644 --- a/accessibility/inc/extended/accessibleiconchoicectrlentry.hxx +++ b/accessibility/inc/extended/accessibleiconchoicectrlentry.hxx @@ -66,7 +66,7 @@ namespace accessibility css::uno::Reference< css::accessibility::XAccessible > m_xParent; tools::Rectangle GetBoundingBox_Impl() const; - tools::Rectangle GetBoundingBoxOnScreen_Impl() const; + AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen_Impl() const; bool IsAlive_Impl() const; bool IsShowing_Impl() const; @@ -75,7 +75,7 @@ namespace accessibility tools::Rectangle GetBoundingBox(); /// @throws css::lang::DisposedException /// @throws css::uno::RuntimeException - tools::Rectangle GetBoundingBoxOnScreen(); + AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen(); /// @throws css::lang::DisposedException void EnsureIsAlive() const; diff --git a/accessibility/inc/helper/IComboListBoxHelper.hxx b/accessibility/inc/helper/IComboListBoxHelper.hxx index 749a0c7b6f7c..43d30aadab74 100644 --- a/accessibility/inc/helper/IComboListBoxHelper.hxx +++ b/accessibility/inc/helper/IComboListBoxHelper.hxx @@ -28,6 +28,7 @@ namespace com::sun::star::datatransfer::clipboard { class XClipboard; } +class AbsoluteScreenPixelRectangle; class Point; namespace tools { class Rectangle; } namespace vcl { class Window; } @@ -41,7 +42,7 @@ namespace accessibility virtual OUString GetEntry( sal_Int32 nPos ) const = 0; virtual tools::Rectangle GetDropDownPosSizePixel( ) const = 0; virtual tools::Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const = 0; - virtual tools::Rectangle GetWindowExtentsAbsolute() = 0; + virtual AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() = 0; virtual bool IsEnabled() const = 0; virtual bool IsEntryVisible( sal_Int32 nPos ) const = 0; virtual sal_uInt16 GetDisplayLineCount() const = 0; diff --git a/accessibility/inc/helper/listboxhelper.hxx b/accessibility/inc/helper/listboxhelper.hxx index 98b6d9ee2f51..4f1c5dde1e49 100644 --- a/accessibility/inc/helper/listboxhelper.hxx +++ b/accessibility/inc/helper/listboxhelper.hxx @@ -49,7 +49,7 @@ public: virtual tools::Rectangle GetDropDownPosSizePixel() const override { - tools::Rectangle aTemp = m_aComboListBox.GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aTemp = m_aComboListBox.GetWindowExtentsAbsolute(); tools::Rectangle aRet = m_aComboListBox.GetDropDownPosSizePixel(); aRet.Move(aTemp.Left(), aTemp.Top()); return aRet; @@ -74,7 +74,7 @@ public: return aRect; } - virtual tools::Rectangle GetWindowExtentsAbsolute() override + virtual AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() override { return m_aComboListBox.GetWindowExtentsAbsolute(); } diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx b/accessibility/source/extended/AccessibleBrowseBox.cxx index b5d0051ffc1d..e8276958f0f1 100644 --- a/accessibility/source/extended/AccessibleBrowseBox.cxx +++ b/accessibility/source/extended/AccessibleBrowseBox.cxx @@ -185,7 +185,7 @@ tools::Rectangle AccessibleBrowseBox::implGetBoundingBox() } -tools::Rectangle AccessibleBrowseBox::implGetBoundingBoxOnScreen() +AbsoluteScreenPixelRectangle AccessibleBrowseBox::implGetBoundingBoxOnScreen() { return mpBrowseBox->GetWindowExtentsAbsolute(); } diff --git a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx index da793c01540b..121655d78823 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx @@ -399,12 +399,12 @@ tools::Rectangle AccessibleBrowseBoxBase::getBoundingBox() return aRect; } -tools::Rectangle AccessibleBrowseBoxBase::getBoundingBoxOnScreen() +AbsoluteScreenPixelRectangle AccessibleBrowseBoxBase::getBoundingBoxOnScreen() { SolarMethodGuard aGuard(getMutex()); ensureIsAlive(); - tools::Rectangle aRect = implGetBoundingBoxOnScreen(); + AbsoluteScreenPixelRectangle aRect = implGetBoundingBoxOnScreen(); if ( aRect.Left() == 0 && aRect.Top() == 0 && aRect.Right() == 0 && aRect.Bottom() == 0 ) { SAL_WARN( "accessibility", "rectangle doesn't exist" ); diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx index 50f5d0c33422..8bd19f825221 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx @@ -306,9 +306,9 @@ tools::Rectangle AccessibleBrowseBoxHeaderBar::implGetBoundingBox() return mpBrowseBox->calcHeaderRect(isColumnBar(), false); } -tools::Rectangle AccessibleBrowseBoxHeaderBar::implGetBoundingBoxOnScreen() +AbsoluteScreenPixelRectangle AccessibleBrowseBoxHeaderBar::implGetBoundingBoxOnScreen() { - return mpBrowseBox->calcHeaderRect(isColumnBar()); + return AbsoluteScreenPixelRectangle(mpBrowseBox->calcHeaderRect(isColumnBar())); } sal_Int32 AccessibleBrowseBoxHeaderBar::implGetRowCount() const diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx index 67ffa47a3415..536c3d4c25b6 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx @@ -134,9 +134,9 @@ tools::Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBox() } -tools::Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBoxOnScreen() +AbsoluteScreenPixelRectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBoxOnScreen() { - return getRectangle(mpBrowseBox,m_nColumnRowId,true,isRowBarCell()); + return AbsoluteScreenPixelRectangle(getRectangle(mpBrowseBox,m_nColumnRowId,true,isRowBarCell())); } sal_Int64 SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleIndexInParent() diff --git a/accessibility/source/extended/AccessibleBrowseBoxTable.cxx b/accessibility/source/extended/AccessibleBrowseBoxTable.cxx index 9b58bf83d785..cdf918359a64 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxTable.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxTable.cxx @@ -195,9 +195,9 @@ tools::Rectangle AccessibleBrowseBoxTable::implGetBoundingBox() return mpBrowseBox->calcTableRect(false); } -tools::Rectangle AccessibleBrowseBoxTable::implGetBoundingBoxOnScreen() +AbsoluteScreenPixelRectangle AccessibleBrowseBoxTable::implGetBoundingBoxOnScreen() { - return mpBrowseBox->calcTableRect(); + return AbsoluteScreenPixelRectangle(mpBrowseBox->calcTableRect()); } // internal helper methods ---------------------------------------------------- diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx index a9d946c9eea7..00c982a943bc 100644 --- a/accessibility/source/extended/AccessibleGridControl.cxx +++ b/accessibility/source/extended/AccessibleGridControl.cxx @@ -195,7 +195,7 @@ tools::Rectangle AccessibleGridControl::implGetBoundingBox() } -tools::Rectangle AccessibleGridControl::implGetBoundingBoxOnScreen() +AbsoluteScreenPixelRectangle AccessibleGridControl::implGetBoundingBoxOnScreen() { return m_aTable.GetWindowExtentsAbsolute(); } diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx index fe00a2aaf266..254758205030 100644 --- a/accessibility/source/extended/AccessibleGridControlBase.cxx +++ b/accessibility/source/extended/AccessibleGridControlBase.cxx @@ -321,11 +321,11 @@ tools::Rectangle AccessibleGridControlBase::getBoundingBox() return aRect; } -tools::Rectangle AccessibleGridControlBase::getBoundingBoxOnScreen() +AbsoluteScreenPixelRectangle AccessibleGridControlBase::getBoundingBoxOnScreen() { SolarMutexGuard aSolarGuard; ensureIsAlive(); - tools::Rectangle aRect = implGetBoundingBoxOnScreen(); + AbsoluteScreenPixelRectangle aRect = implGetBoundingBoxOnScreen(); if ( aRect.Left() == 0 && aRect.Top() == 0 && aRect.Right() == 0 && aRect.Bottom() == 0 ) { SAL_WARN( "accessibility", "rectangle doesn't exist" ); diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx index 20a91ceb7b7b..86b3228d42a8 100644 --- a/accessibility/source/extended/AccessibleGridControlHeader.cxx +++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx @@ -200,14 +200,14 @@ tools::Rectangle AccessibleGridControlHeader::implGetBoundingBox() } -tools::Rectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen() +AbsoluteScreenPixelRectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen() { - tools::Rectangle aGridRect( m_aTable.GetWindowExtentsAbsolute() ); + AbsoluteScreenPixelRectangle aGridRect( m_aTable.GetWindowExtentsAbsolute() ); tools::Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar())); if(isColumnBar()) - return tools::Rectangle(aGridRect.TopLeft(), Size(aGridRect.getOpenWidth(),aHeaderRect.getOpenHeight())); + return AbsoluteScreenPixelRectangle(aGridRect.TopLeft(), Size(aGridRect.getOpenWidth(),aHeaderRect.getOpenHeight())); else - return tools::Rectangle(aGridRect.TopLeft(), Size(aHeaderRect.getOpenWidth(),aGridRect.getOpenHeight())); + return AbsoluteScreenPixelRectangle(aGridRect.TopLeft(), Size(aHeaderRect.getOpenWidth(),aGridRect.getOpenHeight())); } // internal helper methods ---------------------------------------------------- diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx index 7275934b4c65..a174afd00556 100644 --- a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx +++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx @@ -136,16 +136,16 @@ tools::Rectangle AccessibleGridControlHeaderCell::implGetBoundingBox() } -tools::Rectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen() +AbsoluteScreenPixelRectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen() { - tools::Rectangle aGridRect( m_aTable.GetWindowExtentsAbsolute() ); + AbsoluteScreenPixelRectangle aGridRect( m_aTable.GetWindowExtentsAbsolute() ); sal_Int32 nIndex = getAccessibleIndexInParent(); tools::Rectangle aCellRect; if (m_eObjType == AccessibleTableControlObjType::COLUMNHEADERCELL) aCellRect = m_aTable.calcHeaderCellRect(true, nIndex); else aCellRect = m_aTable.calcHeaderCellRect(false, nIndex); - return tools::Rectangle(Point(aGridRect.Left()+aCellRect.Left(),aGridRect.Top()+aCellRect.Top()), aCellRect.GetSize()); + return AbsoluteScreenPixelRectangle(AbsoluteScreenPixelPoint(aGridRect.Left()+aCellRect.Left(),aGridRect.Top()+aCellRect.Top()), aCellRect.GetSize()); } sal_Int64 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleIndexInParent() diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx index f2dd9bbba8ec..11f0f0a1d584 100644 --- a/accessibility/source/extended/AccessibleGridControlTable.cxx +++ b/accessibility/source/extended/AccessibleGridControlTable.cxx @@ -356,7 +356,7 @@ tools::Rectangle AccessibleGridControlTable::implGetBoundingBox() return aTable; } -tools::Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen() +AbsoluteScreenPixelRectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen() { tools::Rectangle aGridRect( m_aTable.GetWindowExtentsAbsolute()); tools::Rectangle aTableRect( m_aTable.calcTableRect() ); @@ -364,7 +364,7 @@ tools::Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen() tools::Long nY = aGridRect.Top() + aTableRect.Top(); tools::Long nWidth = aGridRect.GetSize().Width()-aTableRect.Left(); tools::Long nHeight = aGridRect.GetSize().Height()-aTableRect.Top(); - tools::Rectangle aTable( Point( nX, nY ), Size( nWidth, nHeight )); + AbsoluteScreenPixelRectangle aTable( AbsoluteScreenPixelPoint( nX, nY ), AbsoluteScreenPixelSize( nWidth, nHeight )); return aTable; } // internal helper methods ---------------------------------------------------- diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx index a81886977cba..3f3a59bb508d 100644 --- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx +++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx @@ -339,14 +339,14 @@ namespace accessibility return aCell; } - tools::Rectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen() + AbsoluteScreenPixelRectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen() { - tools::Rectangle aGridRect = m_aTable.GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aGridRect = m_aTable.GetWindowExtentsAbsolute(); sal_Int64 nIndex = getAccessibleIndexInParent(); tools::Rectangle aCellRect = m_aTable.calcCellRect(nIndex%m_aTable.GetColumnCount(), nIndex/m_aTable.GetColumnCount()); tools::Long nX = aGridRect.Left() + aCellRect.Left(); tools::Long nY = aGridRect.Top() + aCellRect.Top(); - tools::Rectangle aCell( Point( nX, nY ), aCellRect.GetSize()); + AbsoluteScreenPixelRectangle aCell( AbsoluteScreenPixelPoint( nX, nY ), aCellRect.GetSize()); return aCell; } } diff --git a/accessibility/source/extended/accessiblebrowseboxcell.cxx b/accessibility/source/extended/accessiblebrowseboxcell.cxx index a5fbb47bc4f4..07c62001418b 100644 --- a/accessibility/source/extended/accessiblebrowseboxcell.cxx +++ b/accessibility/source/extended/accessiblebrowseboxcell.cxx @@ -60,9 +60,9 @@ namespace accessibility return mpBrowseBox->GetFieldRectPixel( m_nRowPos, m_nColPos, false, /*bOnScreen*/false ); } - ::tools::Rectangle AccessibleBrowseBoxCell::implGetBoundingBoxOnScreen() + AbsoluteScreenPixelRectangle AccessibleBrowseBoxCell::implGetBoundingBoxOnScreen() { - return mpBrowseBox->GetFieldRectPixel( m_nRowPos, m_nColPos, false, /*bOnScreen*/true ); + return AbsoluteScreenPixelRectangle(mpBrowseBox->GetFieldRectPixel( m_nRowPos, m_nColPos, false, /*bOnScreen*/true )); } } // namespace accessibility diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx index 0edf5535fc12..44ac61e9252a 100644 --- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx +++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx @@ -108,19 +108,15 @@ namespace accessibility return aRect; } - tools::Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const + AbsoluteScreenPixelRectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const { - tools::Rectangle aRect; SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); - if ( pEntry ) - { - aRect = m_pIconCtrl->GetBoundingBox( pEntry ); - Point aTopLeft = aRect.TopLeft(); - aTopLeft += m_pIconCtrl->GetWindowExtentsAbsolute().TopLeft(); - aRect = tools::Rectangle( aTopLeft, aRect.GetSize() ); - } - - return aRect; + if ( !pEntry ) + return AbsoluteScreenPixelRectangle(); + tools::Rectangle aRect = m_pIconCtrl->GetBoundingBox( pEntry ); + AbsoluteScreenPixelPoint aTopLeft = m_pIconCtrl->GetWindowExtentsAbsolute().TopLeft(); + aTopLeft += AbsoluteScreenPixelPoint(aRect.TopLeft()); + return AbsoluteScreenPixelRectangle( aTopLeft, aRect.GetSize() ); } bool AccessibleIconChoiceCtrlEntry::IsAlive_Impl() const @@ -152,7 +148,7 @@ namespace accessibility return GetBoundingBox_Impl(); } - tools::Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() + AbsoluteScreenPixelRectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() { SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index de291fe529cb..e0c96fe8d845 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -151,7 +151,7 @@ namespace accessibility { aRect = m_pTreeListBox->GetBoundingRect( pEntry ); Point aTopLeft = aRect.TopLeft(); - aTopLeft += m_pTreeListBox->GetWindowExtentsAbsolute().TopLeft(); + aTopLeft += Point(m_pTreeListBox->GetWindowExtentsAbsolute().TopLeft()); aRect = tools::Rectangle( aTopLeft, aRect.GetSize() ); } diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index ab24cc6a0cf8..9a092d8fd6b8 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -789,7 +789,7 @@ Document::retrieveParagraphBounds(Paragraph const * pParagraph, Point aOrig(0, 0); if (bAbsolute) - aOrig = m_rView.GetWindow()->OutputToAbsoluteScreenPixel(aOrig); + aOrig = Point(m_rView.GetWindow()->OutputToAbsoluteScreenPixel(aOrig)); return css::awt::Rectangle( static_cast< ::sal_Int32 >(aOrig.X()), diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx index 02c67944960e..9d86f0246a42 100644 --- a/accessibility/source/standard/accessiblemenucomponent.cxx +++ b/accessibility/source/standard/accessiblemenucomponent.cxx @@ -97,7 +97,7 @@ awt::Rectangle OAccessibleMenuComponent::implGetBounds() if ( pWindow ) { // get bounding rectangle of the window in screen coordinates - tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); aBounds = AWTRectangle( aRect ); // get position of the accessible parent in screen coordinates @@ -234,7 +234,7 @@ awt::Point OAccessibleMenuComponent::getLocationOnScreen( ) vcl::Window* pWindow = m_pMenu->GetWindow(); if ( pWindow ) { - tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); aPos = AWTPoint( aRect.TopLeft() ); } } diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/accessibility/source/standard/accessiblemenuitemcomponent.cxx index 6561ff12d1cf..d3cc712bbcd7 100644 --- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx +++ b/accessibility/source/standard/accessiblemenuitemcomponent.cxx @@ -248,7 +248,7 @@ awt::Rectangle OAccessibleMenuItemComponent::implGetBounds() vcl::Window* pWindow = m_pParent->GetWindow(); if ( pWindow ) { - tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); awt::Point aWindowScreenLoc = AWTPoint( aRect.TopLeft() ); // get position of accessible parent in screen coordinates diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx b/accessibility/source/standard/vclxaccessiblelistitem.cxx index 7f9aa7d109e3..e1bb9cb18883 100644 --- a/accessibility/source/standard/vclxaccessiblelistitem.cxx +++ b/accessibility/source/standard/vclxaccessiblelistitem.cxx @@ -342,7 +342,7 @@ awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( ) { tools::Rectangle aRect = pListBoxHelper->GetBoundingRectangle(static_cast<sal_uInt16>(m_nIndexInParent)); aPoint = aRect.TopLeft(); - aPoint += pListBoxHelper->GetWindowExtentsAbsolute().TopLeft(); + aPoint += Point(pListBoxHelper->GetWindowExtentsAbsolute().TopLeft()); } return AWTPoint( aPoint ); } diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 1a8f5071982f..6d4a463a4487 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -263,7 +263,7 @@ void ChartController::executeDispatch_Paste() Graphic aGraphic; // paste location: center of window - Point aPos = pChartWindow->PixelToLogic( tools::Rectangle( {}, pChartWindow->GetSizePixel()).Center()); + Point aPos = pChartWindow->PixelToLogic( tools::Rectangle(Point{}, pChartWindow->GetSizePixel()).Center()); // handle different formats TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pChartWindow )); diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx index 8d3ce6b2de77..2af1168d58f1 100644 --- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx @@ -141,8 +141,8 @@ namespace dbaui Reference< XAccessible > aRet; if(m_pTable && !m_pTable->isDisposed()) { - Point aPoint(_aPoint.X,_aPoint.Y); - tools::Rectangle aRect(m_pTable->GetDesktopRectPixel()); + AbsoluteScreenPixelPoint aPoint(_aPoint.X,_aPoint.Y); + AbsoluteScreenPixelRectangle aRect(m_pTable->GetDesktopRectPixel()); if( aRect.Contains(aPoint) ) aRet = this; else if( m_pTable->GetListBox()->GetDesktopRectPixel().Contains(aPoint)) diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index f3146b2b5782..17cc7fb53438 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -466,7 +466,7 @@ void SplashScreen::SetScreenBitmap(BitmapEx &rBitmap) if ( nCount > 0 ) { // retrieve size from first screen - tools::Rectangle aScreenArea = Application::GetScreenPosSizePixel(static_cast<unsigned int>(0)); + AbsoluteScreenPixelRectangle aScreenArea = Application::GetScreenPosSizePixel(static_cast<unsigned int>(0)); nWidth = aScreenArea.GetWidth(); nHeight = aScreenArea.GetHeight(); } @@ -494,7 +494,7 @@ void SplashScreen::determineProgressRatioValues( if ( nCount > 0 ) { // retrieve size from first screen - tools::Rectangle aScreenArea = Application::GetScreenPosSizePixel(static_cast<unsigned int>(0)); + AbsoluteScreenPixelRectangle aScreenArea = Application::GetScreenPosSizePixel(static_cast<unsigned int>(0)); sal_Int32 nWidth = aScreenArea.GetWidth(); sal_Int32 nHeight = aScreenArea.GetHeight(); nScreenRatio = nHeight ? sal_Int32( rtl::math::round( double( nWidth ) / double( nHeight ), 2 ) * 100 ) : 0; diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index f90049bf8773..28d383230eef 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -396,7 +396,7 @@ impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const basegfx::B2DRange& aRangePixel.transform(mrOutDev.GetViewTransformation()); maDestPixel = tools::Rectangle(floor(aRangePixel.getMinX()), floor(aRangePixel.getMinY()), ceil(aRangePixel.getMaxX()), ceil(aRangePixel.getMaxY())); - maDestPixel.Intersection({ {}, mrOutDev.GetOutputSizePixel() }); + maDestPixel.Intersection(tools::Rectangle{ Point{}, mrOutDev.GetOutputSizePixel() }); if (!isVisible()) return; diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index bcac2d08c9e5..1ce552d926fe 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -874,7 +874,7 @@ uno::Reference< frame::XFrame > const & DocumentHolder::GetDocFrame() { sal_Int32 nDisplay = Application::GetDisplayBuiltInScreen(); - tools::Rectangle aWorkRect = Application::GetScreenPosSizePixel( nDisplay ); + AbsoluteScreenPixelRectangle aWorkRect = Application::GetScreenPosSizePixel( nDisplay ); awt::Rectangle aWindowRect = xHWindow->getPosSize(); if (( aWindowRect.Width < aWorkRect.GetWidth()) && ( aWindowRect.Height < aWorkRect.GetHeight() )) diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 13a21a7b7714..ec8bcbdb8b88 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -2327,7 +2327,7 @@ bool LayoutManager::implts_resizeContainerWindow( const awt::Size& rContainerSiz // calculate the maximum size we have for the container window sal_Int32 nDisplay = xContainerTopWindow->getDisplay(); - tools::Rectangle aWorkArea = Application::GetScreenPosSizePixel( nDisplay ); + AbsoluteScreenPixelRectangle aWorkArea = Application::GetScreenPosSizePixel( nDisplay ); if (!aWorkArea.IsEmpty()) { diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index b25ce4a7d827..2bdd2b910465 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -831,7 +831,7 @@ public: virtual bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override; virtual OUString GetAccessibleCellText(sal_Int32 _nRow, sal_uInt16 _nColPos) const override; virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) override; - virtual tools::Rectangle GetWindowExtentsAbsolute() const override; + virtual AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() const override; virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const override; virtual void GrabFocus() override; virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override; diff --git a/include/toolkit/helper/convert.hxx b/include/toolkit/helper/convert.hxx index 3e4d23696249..255d5b26b4c6 100644 --- a/include/toolkit/helper/convert.hxx +++ b/include/toolkit/helper/convert.hxx @@ -36,7 +36,7 @@ inline ::Size VCLSize( const css::awt::Size& rAWTSize ) return ::Size( rAWTSize.Width, rAWTSize.Height ); } -inline css::awt::Point AWTPoint( const ::Point& rVCLPoint ) +inline css::awt::Point AWTPoint( const PointTemplateBase& rVCLPoint ) { return css::awt::Point( rVCLPoint.X(), rVCLPoint.Y() ); } @@ -46,7 +46,7 @@ inline ::Point VCLPoint( const css::awt::Point& rAWTPoint ) return ::Point( rAWTPoint.X, rAWTPoint.Y ); } -inline css::awt::Rectangle AWTRectangle( const ::tools::Rectangle& rVCLRect ) +inline css::awt::Rectangle AWTRectangle( const RectangleTemplateBase& rVCLRect ) { return css::awt::Rectangle( rVCLRect.Left(), rVCLRect.Top(), rVCLRect.GetWidth(), rVCLRect.GetHeight() ); } diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index c6372d7c92dc..0555889e0cb2 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -73,34 +73,77 @@ inline bool equal(Pair const & p1, Pair const & p2) // Point -class Size; -class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Point final : protected Pair +class RectangleTemplateBase; + +class TOOLS_DLLPUBLIC PointTemplateBase : protected Pair { +friend class RectangleTemplateBase; public: - constexpr Point() {} - constexpr Point( tools::Long nX, tools::Long nY ) : Pair( nX, nY ) {} + PointTemplateBase() = default; +protected: + constexpr PointTemplateBase( tools::Long nX, tools::Long nY ) : Pair( nX, nY ) {} + // Rotate parameter point using This as origin; store result back into parameter point + void RotateAround( tools::Long& rX, tools::Long& rY, Degree10 nOrientation ) const; + void RotateAround( PointTemplateBase&, Degree10 nOrientation ) const; +public: constexpr tools::Long X() const { return mnA; } constexpr tools::Long Y() const { return mnB; } +}; + +template<class PointT, class SizeT> +class PointTemplate : public PointTemplateBase +{ +public: + constexpr PointTemplate() {} + constexpr PointTemplate( tools::Long nX, tools::Long nY ) : PointTemplateBase( nX, nY ) {} + + using PointTemplateBase::X; + using PointTemplateBase::Y; + + void Move( tools::Long nHorzMove, tools::Long nVertMove ) + { + mnA += nHorzMove; + mnB += nVertMove; + } + void Move( SizeT const & s ) + { + AdjustX(s.Width()); + AdjustY(s.Height()); + } - void Move( tools::Long nHorzMove, tools::Long nVertMove ); - void Move( Size const & s ); tools::Long AdjustX( tools::Long nHorzMove ) { mnA += nHorzMove; return mnA; } tools::Long AdjustY( tools::Long nVertMove ) { mnB += nVertMove; return mnB; } - // Rotate parameter point using This as origin; store result back into parameter point - void RotateAround( tools::Long& rX, tools::Long& rY, Degree10 nOrientation ) const; - void RotateAround( Point&, Degree10 nOrientation ) const; - - Point& operator += ( const Point& rPoint ); - Point& operator -= ( const Point& rPoint ); - Point& operator *= ( const tools::Long nVal ); - Point& operator /= ( const tools::Long nVal ); + void RotateAround( tools::Long& rX, tools::Long& rY, Degree10 nOrientation ) const + { PointTemplateBase::RotateAround(rX, rY, nOrientation); } + void RotateAround( PointT& p, Degree10 nOrientation ) const + { PointTemplateBase::RotateAround(p, nOrientation); } - friend inline Point operator+( const Point &rVal1, const Point &rVal2 ); - friend inline Point operator-( const Point &rVal1, const Point &rVal2 ); - friend inline Point operator*( const Point &rVal1, const tools::Long nVal2 ); - friend inline Point operator/( const Point &rVal1, const tools::Long nVal2 ); + PointT& operator+=( const PointT& rPoint ) + { + mnA += rPoint.mnA; + mnB += rPoint.mnB; + return reinterpret_cast<PointT&>(*this); + } + PointT& operator-=( const PointT& rPoint ) + { + mnA -= rPoint.mnA; + mnB -= rPoint.mnB; + return reinterpret_cast<PointT&>(*this); + } + PointT& operator*=( const tools::Long nVal ) + { + mnA *= nVal; + mnB *= nVal; + return reinterpret_cast<PointT&>(*this); + } + PointT& operator/=( const tools::Long nVal ) + { + mnA /= nVal; + mnB /= nVal; + return reinterpret_cast<PointT&>(*this); + } constexpr tools::Long getX() const { return X(); } constexpr tools::Long getY() const { return Y(); } @@ -111,112 +154,140 @@ public: Pair & toPair() { return *this; } // Scales relative to 0,0 - constexpr inline Point scale(sal_Int64 nMulX, sal_Int64 nDivX, - sal_Int64 nMulY, sal_Int64 nDivY) const; + constexpr PointT scale(sal_Int64 nMulX, sal_Int64 nDivX, + sal_Int64 nMulY, sal_Int64 nDivY) const + { + return PointT(o3tl::convert(getX(), nMulX, nDivX), + o3tl::convert(getY(), nMulY, nDivY)); + } using Pair::toString; using Pair::GetHashValue; }; -inline void Point::Move( tools::Long nHorzMove, tools::Long nVertMove ) -{ - mnA += nHorzMove; - mnB += nVertMove; -} +class Size; +class AbsoluteScreenPixelSize; +class Point; +class AbsoluteScreenPixelPoint; +namespace tools { class Rectangle; } +class AbsoluteScreenPixelRectangle; -inline Point& Point::operator += ( const Point& rPoint ) +class SAL_WARN_UNUSED Point : public PointTemplate<::Point, ::Size> { - mnA += rPoint.mnA; - mnB += rPoint.mnB; - return *this; -} +public: + constexpr Point() {} + constexpr Point( tools::Long nX, tools::Long nY ) : PointTemplate( nX, nY ) {} + // TODO delete this to expose more problems + constexpr explicit Point(const AbsoluteScreenPixelPoint&); +}; -inline Point& Point::operator -= ( const Point& rPoint ) -{ - mnA -= rPoint.mnA; - mnB -= rPoint.mnB; - return *this; -} +// A point relative to top-level parent or screen, in screen pixels +class AbsoluteScreenPixelSize; +class SAL_WARN_UNUSED AbsoluteScreenPixelPoint : public PointTemplate<AbsoluteScreenPixelPoint, AbsoluteScreenPixelSize> { +public: + constexpr AbsoluteScreenPixelPoint() {} + constexpr AbsoluteScreenPixelPoint( tools::Long nX, tools::Long nY ) : PointTemplate( nX, nY ) {} + constexpr explicit AbsoluteScreenPixelPoint(const Point & pt) : PointTemplate(pt.X(), pt.Y()) {} +}; -inline Point& Point::operator *= ( const tools::Long nVal ) +inline Point operator+( const Point &rVal1, const Point &rVal2 ) { - mnA *= nVal; - mnB *= nVal; - return *this; + return Point( rVal1.X()+rVal2.X(), rVal1.Y()+rVal2.Y() ); } - -inline Point& Point::operator /= ( const tools::Long nVal ) +inline AbsoluteScreenPixelPoint operator+( const AbsoluteScreenPixelPoint &rVal1, const AbsoluteScreenPixelPoint &rVal2 ) { - mnA /= nVal; - mnB /= nVal; - return *this; + return AbsoluteScreenPixelPoint( rVal1.X()+rVal2.X(), rVal1.Y()+rVal2.Y() ); } -inline Point operator+( const Point &rVal1, const Point &rVal2 ) +inline Point operator-( const Point &rVal1, const Point &rVal2 ) { - return Point( rVal1.mnA+rVal2.mnA, rVal1.mnB+rVal2.mnB ); + return Point( rVal1.X()-rVal2.X(), rVal1.Y()-rVal2.Y() ); } - -inline Point operator-( const Point &rVal1, const Point &rVal2 ) +inline AbsoluteScreenPixelPoint operator-( const AbsoluteScreenPixelPoint &rVal1, const AbsoluteScreenPixelPoint &rVal2 ) { - return Point( rVal1.mnA-rVal2.mnA, rVal1.mnB-rVal2.mnB ); + return AbsoluteScreenPixelPoint( rVal1.X()-rVal2.X(), rVal1.Y()-rVal2.Y() ); } inline Point operator*( const Point &rVal1, const tools::Long nVal2 ) { - return Point( rVal1.mnA*nVal2, rVal1.mnB*nVal2 ); + return Point( rVal1.X()*nVal2, rVal1.Y()*nVal2 ); +} +inline AbsoluteScreenPixelPoint operator*( const AbsoluteScreenPixelPoint &rVal1, const tools::Long nVal2 ) +{ + return AbsoluteScreenPixelPoint( rVal1.X()*nVal2, rVal1.Y()*nVal2 ); } inline Point operator/( const Point &rVal1, const tools::Long nVal2 ) { - return Point( rVal1.mnA/nVal2, rVal1.mnB/nVal2 ); + return Point( rVal1.X()/nVal2, rVal1.Y()/nVal2 ); +} +inline AbsoluteScreenPixelPoint operator/( const AbsoluteScreenPixelPoint &rVal1, const tools::Long nVal2 ) +{ + return AbsoluteScreenPixelPoint( rVal1.X()/nVal2, rVal1.Y()/nVal2 ); } inline bool operator ==(Point const & p1, Point const & p2) { return tools::detail::equal(p1.toPair(), p2.toPair()); } +inline bool operator ==(AbsoluteScreenPixelPoint const & p1, AbsoluteScreenPixelPoint const & p2) +{ + return tools::detail::equal(p1.toPair(), p2.toPair()); +} inline bool operator !=(Point const & p1, Point const & p2) { return !(p1 == p2); } - -constexpr inline Point Point::scale(sal_Int64 nMulX, sal_Int64 nDivX, sal_Int64 nMulY, sal_Int64 nDivY) const +inline bool operator !=(AbsoluteScreenPixelPoint const & p1, AbsoluteScreenPixelPoint const & p2) { - return Point(o3tl::convert(getX(), nMulX, nDivX), - o3tl::convert(getY(), nMulY, nDivY)); + return !(p1 == p2); } + +constexpr Point::Point(const AbsoluteScreenPixelPoint& p) : Point(p.X(), p.Y()) {} + namespace o3tl { - constexpr Point convert(const Point& rPoint, o3tl::Length eFrom, o3tl::Length eTo) { const auto [num, den] = o3tl::getConversionMulDiv(eFrom, eTo); return rPoint.scale(num, den, num, den); } - -} // end o3tl +constexpr AbsoluteScreenPixelPoint convert(const AbsoluteScreenPixelPoint& rPoint, o3tl::Length eFrom, o3tl::Length eTo) +{ + const auto [num, den] = o3tl::getConversionMulDiv(eFrom, eTo); + return rPoint.scale(num, den, num, den); +} +} // namespace o3tl template< typename charT, typename traits > inline std::basic_ostream<charT, traits> & operator <<( - std::basic_ostream<charT, traits> & stream, const Point& point ) + std::basic_ostream<charT, traits> & stream, const PointTemplateBase& point ) { return stream << point.X() << ',' << point.Y(); } // Size -class SAL_WARN_UNUSED Size final : protected Pair +class SizeTemplateBase : protected Pair { public: - constexpr Size() {} - constexpr Size( tools::Long nWidth, tools::Long nHeight ) : Pair( nWidth, nHeight ) {} + constexpr SizeTemplateBase() = default; + constexpr SizeTemplateBase( tools::Long nWidth, tools::Long nHeight ) : Pair( nWidth, nHeight ) {} constexpr tools::Long Width() const { return mnA; } constexpr tools::Long Height() const { return mnB; } +}; + +template<class SizeT> +class SizeTemplate : public SizeTemplateBase +{ +public: + constexpr SizeTemplate() {} + constexpr SizeTemplate( tools::Long nWidth, tools::Long nHeight ) : SizeTemplateBase( nWidth, nHeight ) {} + tools::Long AdjustWidth( tools::Long n ) { mnA += n; return mnA; } tools::Long AdjustHeight( tools::Long n ) { mnB += n; return mnB; } @@ -239,84 +310,111 @@ public: using Pair::toString; using Pair::GetHashValue; - Size& operator += ( const Size& rSize ); - Size& operator -= ( const Size& rSize ); - Size& operator *= ( const tools::Long nVal ); - Size& operator /= ( const tools::Long nVal ); + SizeT& operator += ( const SizeT& rSize ) + { + mnA += rSize.mnA; + mnB += rSize.mnB; + return reinterpret_cast<SizeT&>(*this); + } + SizeT& operator -= ( const SizeT& rSize ) + { + mnA -= rSize.mnA; + mnB -= rSize.mnB; + return reinterpret_cast<SizeT&>(*this); + } + SizeT& operator *= ( const tools::Long nVal ) + { + mnA *= nVal; + mnB *= nVal; + return reinterpret_cast<SizeT&>(*this); + } + SizeT& operator /= ( const tools::Long nVal ) + { + mnA /= nVal; + mnB /= nVal; + return reinterpret_cast<SizeT&>(*this); + } - friend inline Size operator+( const Size &rVal1, const Size &rVal2 ); - friend inline Size operator-( const Size &rVal1, const Size &rVal2 ); - friend inline Size operator*( const Size &rVal1, const tools::Long nVal2 ); - friend inline Size operator/( const Size &rVal1, const tools::Long nVal2 ); + constexpr SizeT scale(sal_Int64 nMulX, sal_Int64 nDivX, + sal_Int64 nMulY, sal_Int64 nDivY) const + { + return SizeT(o3tl::convert(Width(), nMulX, nDivX), + o3tl::convert(Height(), nMulY, nDivY)); + } +}; - constexpr inline Size scale(sal_Int64 nMulX, sal_Int64 nDivX, - sal_Int64 nMulY, sal_Int64 nDivY) const; +class SAL_WARN_UNUSED Size : public SizeTemplate<::Size> +{ +public: + constexpr Size() {} + constexpr Size( tools::Long nWidth, tools::Long nHeight ) : SizeTemplate( nWidth, nHeight ) {} + // TODO delete to find more problems + constexpr explicit Size(const AbsoluteScreenPixelSize& pt); +}; +// Screen pixels +class SAL_WARN_UNUSED AbsoluteScreenPixelSize : public SizeTemplate<AbsoluteScreenPixelSize> +{ +public: + constexpr AbsoluteScreenPixelSize() {} + constexpr AbsoluteScreenPixelSize( tools::Long nWidth, tools::Long nHeight ) : SizeTemplate( nWidth, nHeight ) {} + constexpr explicit AbsoluteScreenPixelSize(const Size & pt) : SizeTemplate(pt.Width(), pt.Height()) {} }; +constexpr Size::Size(const AbsoluteScreenPixelSize& pt) : SizeTemplate(pt.Width(), pt.Height()) {} + inline bool operator ==(Size const & s1, Size const & s2) { return tools::detail::equal(s1.toPair(), s2.toPair()); } +inline bool operator ==(AbsoluteScreenPixelSize const & s1, AbsoluteScreenPixelSize const & s2) +{ + return tools::detail::equal(s1.toPair(), s2.toPair()); +} inline bool operator !=(Size const & s1, Size const & s2) { return !(s1 == s2); } - -inline Size& Size::operator += ( const Size& rSize ) +inline bool operator !=(AbsoluteScreenPixelSize const & s1, AbsoluteScreenPixelSize const & s2) { - mnA += rSize.mnA; - mnB += rSize.mnB; - return *this; + return !(s1 == s2); } -inline Size& Size::operator -= ( const Size& rSize ) +inline Size operator+( const Size &rVal1, const Size &rVal2 ) { - mnA -= rSize.mnA; - mnB -= rSize.mnB; - return *this; + return Size( rVal1.Width()+rVal2.Width(), rVal1.Height()+rVal2.Height() ); } - -inline Size& Size::operator *= ( const tools::Long nVal ) +inline AbsoluteScreenPixelSize operator+( const AbsoluteScreenPixelSize &rVal1, const AbsoluteScreenPixelSize &rVal2 ) { - mnA *= nVal; - mnB *= nVal; - return *this; + return AbsoluteScreenPixelSize( rVal1.Width()+rVal2.Width(), rVal1.Height()+rVal2.Height() ); } -inline Size& Size::operator /= ( const tools::Long nVal ) +inline Size operator-( const Size &rVal1, const Size &rVal2 ) { - mnA /= nVal; - mnB /= nVal; - return *this; + return Size( rVal1.Width()-rVal2.Width(), rVal1.Height()-rVal2.Height() ); } - -inline Size operator+( const Size &rVal1, const Size &rVal2 ) +inline AbsoluteScreenPixelSize operator-( const AbsoluteScreenPixelSize &rVal1, const AbsoluteScreenPixelSize &rVal2 ) { - return Size( rVal1.mnA+rVal2.mnA, rVal1.mnB+rVal2.mnB ); + return AbsoluteScreenPixelSize( rVal1.Width()-rVal2.Width(), rVal1.Height()-rVal2.Height() ); } -inline Size operator-( const Size &rVal1, const Size &rVal2 ) +inline Size operator*( const Size &rVal1, const tools::Long nVal2 ) { - return Size( rVal1.mnA-rVal2.mnA, rVal1.mnB-rVal2.mnB ); + return Size( rVal1.Width()*nVal2, rVal1.Height()*nVal2 ); } - -inline Size operator*( const Size &rVal1, const tools::Long nVal2 ) +inline AbsoluteScreenPixelSize operator*( const AbsoluteScreenPixelSize &rVal1, const tools::Long nVal2 ) { - return Size( rVal1.mnA*nVal2, rVal1.mnB*nVal2 ); + return AbsoluteScreenPixelSize( rVal1.Width()*nVal2, rVal1.Height()*nVal2 ); } inline Size operator/( const Size &rVal1, const tools::Long nVal2 ) { - return Size( rVal1.mnA/nVal2, rVal1.mnB/nVal2 ); + return Size( rVal1.Width()/nVal2, rVal1.Height()/nVal2 ); } - -constexpr inline Size Size::scale(sal_Int64 nMulX, sal_Int64 nDivX, - sal_Int64 nMulY, sal_Int64 nDivY) const +inline AbsoluteScreenPixelSize operator/( const AbsoluteScreenPixelSize &rVal1, const tools::Long nVal2 ) { - return Size(o3tl::convert(Width(), nMulX, nDivX), - o3tl::convert(Height(), nMulY, nDivY)); + return AbsoluteScreenPixelSize( rVal1.Width()/nVal2, rVal1.Height()/nVal2 ); } namespace o3tl @@ -327,22 +425,21 @@ constexpr Size convert(const Size& rSize, o3tl::Length eFrom, o3tl::Length eTo) const auto [num, den] = o3tl::getConversionMulDiv(eFrom, eTo); return rSize.scale(num, den, num, den); } +constexpr AbsoluteScreenPixelSize convert(const AbsoluteScreenPixelSize& rSize, o3tl::Length eFrom, o3tl::Length eTo) +{ + const auto [num, den] = o3tl::getConversionMulDiv(eFrom, eTo); + return rSize.scale(num, den, num, den); +} } // end o3tl template< typename charT, typename traits > inline std::basic_ostream<charT, traits> & operator <<( - std::basic_ostream<charT, traits> & stream, const Size& size ) + std::basic_ostream<charT, traits> & stream, const SizeTemplateBase& size ) { return stream << size.Width() << 'x' << size.Height(); } -inline void Point::Move( Size const & s ) -{ - AdjustX(s.Width()); - AdjustY(s.Height()); -} - // Range #define RANGE_MAX LONG_MAX @@ -480,22 +577,28 @@ inline std::basic_ostream<charT, traits> & operator <<( /// /// (Eventually you might notice, that the same engineer was also working on /// Qt at some point; see documentation on QRect::bottom / QRect::right ;-). -namespace tools -{ -class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Rectangle final + +class TOOLS_DLLPUBLIC RectangleTemplateBase { - static constexpr short RECT_EMPTY = -32767; public: - constexpr Rectangle() = default; - constexpr Rectangle( const Point& rLT, const Point& rRB ); - constexpr Rectangle( tools::Long mnLeft, tools::Long mnTop, - tools::Long mnRight, tools::Long mnBottom ); + static constexpr short RECT_EMPTY = -32767; + + constexpr RectangleTemplateBase() = default; + constexpr RectangleTemplateBase( tools::Long nLeft, tools::Long nTop, + tools::Long nRight, tools::Long nBottom ) + : mnLeft( nLeft ), mnTop( nTop ), mnRight( nRight ), mnBottom( nBottom ) + {} /// Constructs an empty Rectangle, with top/left at the specified params - constexpr Rectangle( tools::Long mnLeft, tools::Long mnTop ); + constexpr RectangleTemplateBase( tools::Long nLeft, tools::Long nTop ) + : mnLeft(nLeft), mnTop(nTop) + {} /// Constructs a closed interval rectangle - constexpr Rectangle( const Point& rLT, const Size& rSize ); - - constexpr inline static Rectangle Normalize(const Point& rLT, const Point& rRB); + constexpr RectangleTemplateBase( const PointTemplateBase& rLT, const SizeTemplateBase& rSize ) + : mnLeft( rLT.X()) + , mnTop( rLT.Y()) + , mnRight(rSize.Width() ? mnLeft + (rSize.Width() + (rSize.Width() > 0 ? -1 : 1)) : RECT_EMPTY) + , mnBottom(rSize.Height() ? mnTop + (rSize.Height() + (rSize.Height() > 0 ? -1 : 1)) : RECT_EMPTY) + {} constexpr tools::Long Left() const { return mnLeft; } constexpr tools::Long Right() const { return IsWidthEmpty() ? mnLeft : mnRight; } @@ -507,66 +610,12 @@ public: constexpr void SetTop(tools::Long v) { mnTop = v; } constexpr void SetBottom(tools::Long v) { mnBottom = v; } - constexpr Point TopLeft() const { return { Left(), Top() }; } - constexpr Point TopRight() const { return { Right(), Top() }; } - constexpr Point TopCenter() const { return { (Left() + Right()) / 2, Top() }; } - constexpr Point BottomLeft() const { return { Left(), Bottom() }; } - constexpr Point BottomRight() const { return { Right(), Bottom() }; } - constexpr Point BottomCenter() const { return { (Left() + Right()) / 2, Bottom() }; } - constexpr Point LeftCenter() const { return { Left(), (Top() + Bottom()) / 2 }; } - constexpr Point RightCenter() const { return { Right(), (Top() + Bottom()) / 2 }; } - constexpr Point Center() const { return { (Left() + Right()) / 2, (Top() + Bottom()) / 2 }; } - - /// Move the top and left edges by a delta, preserving width and height - inline void Move( tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta ); - void Move( Size const & s ) { Move(s.Width(), s.Height()); } - tools::Long AdjustLeft( tools::Long nHorzMoveDelta ) { mnLeft += nHorzMoveDelta; return mnLeft; } - tools::Long AdjustRight( tools::Long nHorzMoveDelta ); - tools::Long AdjustTop( tools::Long nVertMoveDelta ) { mnTop += nVertMoveDelta; return mnTop; } - tools::Long AdjustBottom( tools::Long nVertMoveDelta ); - /// Set the left edge of the rectangle to x, preserving the width - inline void SetPosX(tools::Long x); - /// Set the top edge of the rectangle to y, preserving the height - inline void SetPosY(tools::Long y); - inline void SetPos( const Point& rPoint ); - inline void SetWidth(tools::Long); - inline void SetHeight(tools::Long); - inline void SetSize(const Size&); - - constexpr Point GetPos() const { return TopLeft(); } - constexpr Size GetSize() const { return { GetWidth(), GetHeight() }; } - - /// Returns the difference between right and left, assuming the range is inclusive. - constexpr inline tools::Long GetWidth() const; - /// Returns the difference between bottom and top, assuming the range is inclusive. - constexpr inline tools::Long GetHeight() const; - - tools::Rectangle& Union( const tools::Rectangle& rRect ); - tools::Rectangle& Intersection( const tools::Rectangle& rRect ); - inline tools::Rectangle GetUnion( const tools::Rectangle& rRect ) const; - inline tools::Rectangle GetIntersection( const tools::Rectangle& rRect ) const; - - void Normalize(); - - bool Contains( const Point& rPOINT ) const; - bool Contains( const tools::Rectangle& rRect ) const; - bool Overlaps( const tools::Rectangle& rRect ) const; - void SetEmpty() { mnRight = mnBottom = RECT_EMPTY; } - void SetWidthEmpty() { mnRight = RECT_EMPTY; } - void SetHeightEmpty() { mnBottom = RECT_EMPTY; } constexpr bool IsEmpty() const { return IsWidthEmpty() || IsHeightEmpty(); } constexpr bool IsWidthEmpty() const { return mnRight == RECT_EMPTY; } constexpr bool IsHeightEmpty() const { return mnBottom == RECT_EMPTY; } - - inline bool operator == ( const tools::Rectangle& rRect ) const; - inline bool operator != ( const tools::Rectangle& rRect ) const; - - inline tools::Rectangle& operator += ( const Point& rPt ); - inline tools::Rectangle& operator -= ( const Point& rPt ); - - friend inline tools::Rectangle operator + ( const tools::Rectangle& rRect, const Point& rPt ); - friend inline tools::Rectangle operator - ( const tools::Rectangle& rRect, const Point& rPt ); + void SetWidthEmpty() { mnRight = RECT_EMPTY; } + void SetHeightEmpty() { mnBottom = RECT_EMPTY; } tools::Long getX() const { return mnLeft; } tools::Long getY() const { return mnTop; } @@ -576,8 +625,83 @@ public: tools::Long getOpenHeight() const { return Bottom() - Top(); } void setWidth( tools::Long n ) { mnRight = mnLeft + n; } void setHeight( tools::Long n ) { mnBottom = mnTop + n; } - /// Returns the string representation of the rectangle, format is "x, y, width, height". - rtl::OString toString() const; + + /// Returns the difference between right and left, assuming the range is inclusive. + constexpr tools::Long GetWidth() const + { + tools::Long n = 0; + + if (!IsWidthEmpty()) + { + n = mnRight - mnLeft; + if (n < 0) + n--; + else + n++; + } + + return n; + } + /// Returns the difference between bottom and top, assuming the range is inclusive. + constexpr tools::Long GetHeight() const + { + tools::Long n = 0; + + if (!IsHeightEmpty()) + { + n = mnBottom - mnTop; + if (n < 0) + n--; + else + n++; + } + + return n; + } + + + tools::Long AdjustLeft( tools::Long nHorzMoveDelta ) { mnLeft += nHorzMoveDelta; return mnLeft; } + tools::Long AdjustRight( tools::Long nHorzMoveDelta ); + tools::Long AdjustTop( tools::Long nVertMoveDelta ) { mnTop += nVertMoveDelta; return mnTop; } + tools::Long AdjustBottom( tools::Long nVertMoveDelta ); + /// Set the left edge of the rectangle to x, preserving the width + void SetPosX(tools::Long x) + { + if (!IsWidthEmpty()) + mnRight += x - mnLeft; + mnLeft = x; + } + /// Set the top edge of the rectangle to y, preserving the height + void SetPosY(tools::Long y) + { + if (!IsHeightEmpty()) + mnBottom += y - mnTop; + mnTop = y; + } + + void SaturatingSetPosX(tools::Long x); + void SaturatingSetPosY(tools::Long y); + + void SetWidth(tools::Long nWidth) + { + if (nWidth < 0) + mnRight = mnLeft + nWidth + 1; + else if (nWidth > 0) + mnRight = mnLeft + nWidth - 1; + else + SetWidthEmpty(); + } + void SetHeight(tools::Long nHeight) + { + if (nHeight < 0) + mnBottom = mnTop + nHeight + 1; + else if (nHeight > 0) + mnBottom = mnTop + nHeight - 1; + else + SetHeightEmpty(); + } + + void Normalize(); /** * Expands the rectangle in all directions by the input value. @@ -585,210 +709,201 @@ public: void expand(tools::Long nExpandBy); void shrink(tools::Long nShrinkBy); - /** - * Sanitizing variants for handling data from the outside - */ - void SaturatingSetSize(const Size& rSize); - void SaturatingSetPosX(tools::Long x); - void SaturatingSetPosY(tools::Long y); + /// Move the top and left edges by a delta, preserving width and height + void Move( tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta ) + { + mnLeft += nHorzMoveDelta; + mnTop += nVertMoveDelta; + if (!IsWidthEmpty()) + mnRight += nHorzMoveDelta; + if (!IsHeightEmpty()) + mnBottom += nVertMoveDelta; + } - // Scales relative to 0,0 - constexpr inline tools::Rectangle scale(sal_Int64 nMulX, sal_Int64 nDivX, - sal_Int64 nMulY, sal_Int64 nDivY) const; + /// Returns the string representation of the rectangle, format is "x, y, width, height". + rtl::OString toString() const; + +protected: + void SaturatingSetSize(const SizeTemplateBase& rSize); + void Union( const RectangleTemplateBase& rRect ); + void Intersection( const RectangleTemplateBase& rRect ); + bool Contains( const PointTemplateBase& rPOINT ) const; + bool Contains( const RectangleTemplateBase& rRect ) const; + bool Overlaps( const RectangleTemplateBase& rRect ) const; -private: tools::Long mnLeft = 0; tools::Long mnTop = 0; tools::Long mnRight = RECT_EMPTY; tools::Long mnBottom = RECT_EMPTY; }; -} - -constexpr inline tools::Rectangle::Rectangle( const Point& rLT, const Point& rRB ) - : Rectangle(rLT.X(), rLT.Y(), rRB.X(), rRB.Y()) -{} - -constexpr inline tools::Rectangle::Rectangle( tools::Long nLeft, tools::Long nTop, - tools::Long nRight, tools::Long nBottom ) - : mnLeft( nLeft ) - , mnTop( nTop ) - , mnRight( nRight ) - , mnBottom( nBottom ) -{} - -constexpr inline tools::Rectangle::Rectangle( tools::Long nLeft, tools::Long nTop ) - : mnLeft(nLeft) - , mnTop(nTop) -{} - -constexpr inline tools::Rectangle::Rectangle( const Point& rLT, const Size& rSize ) - : mnLeft( rLT.X()) - , mnTop( rLT.Y()) - , mnRight(rSize.Width() ? mnLeft + (rSize.Width() + (rSize.Width() > 0 ? -1 : 1)) : RECT_EMPTY) - , mnBottom(rSize.Height() ? mnTop + (rSize.Height() + (rSize.Height() > 0 ? -1 : 1)) : RECT_EMPTY) -{} -constexpr inline tools::Rectangle tools::Rectangle::Normalize(const Point& rLT, const Point& rRB) +template<class RectangleT, class PointT, class SizeT> +class RectangleTemplate : public RectangleTemplateBase { - const std::pair<tools::Long, tools::Long> aLeftRight = std::minmax(rLT.X(), rRB.X()); - const std::pair<tools::Long, tools::Long> aTopBottom = std::minmax(rLT.Y(), rRB.Y()); - return { aLeftRight.first, aTopBottom.first, aLeftRight.second, aTopBottom.second }; -} - -inline void tools::Rectangle::Move( tools::Long nHorzMove, tools::Long nVertMove ) -{ - mnLeft += nHorzMove; - mnTop += nVertMove; - if (!IsWidthEmpty()) - mnRight += nHorzMove; - if (!IsHeightEmpty()) - mnBottom += nVertMove; -} - -inline void tools::Rectangle::SetPosX(tools::Long x) -{ - if (!IsWidthEmpty()) - mnRight += x - mnLeft; - mnLeft = x; -} +friend class ::tools::Rectangle; +friend class AbsoluteScreenPixelRectangle; +public: + using PointType = PointT; + using SizeType = SizeT; -inline void tools::Rectangle::SetPosY(tools::Long y) -{ - if (!IsHeightEmpty()) - mnBottom += y - mnTop; - mnTop = y; -} +public: + constexpr RectangleTemplate() = default; + constexpr RectangleTemplate( const PointT& rLT, const PointT& rRB ) + : RectangleTemplate(rLT.X(), rLT.Y(), rRB.X(), rRB.Y()) {} + constexpr RectangleTemplate( tools::Long nLeft, tools::Long nTop, + tools::Long nRight, tools::Long nBottom ) + : RectangleTemplateBase(nLeft, nTop, nRight, nBottom ) + {} + /// Constructs an empty Rectangle, with top/left at the specified params + constexpr RectangleTemplate( tools::Long nLeft, tools::Long nTop ) + : RectangleTemplateBase(nLeft, nTop) + {} + /// Constructs a closed interval rectangle + constexpr RectangleTemplate( const PointT& rLT, const SizeT& rSize ) + : RectangleTemplateBase( rLT, rSize ) + {} -inline void tools::Rectangle::SetPos( const Point& rPoint ) -{ - SetPosX(rPoint.X()); - SetPosY(rPoint.Y()); -} + using RectangleTemplateBase::Normalize; + constexpr static RectangleT Normalize(const PointT& rLT, const PointT& rRB) + { + const std::pair<tools::Long, tools::Long> aLeftRight = std::minmax(rLT.X(), rRB.X()); + const std::pair<tools::Long, tools::Long> aTopBottom = std::minmax(rLT.Y(), rRB.Y()); + return { aLeftRight.first, aTopBottom.first, aLeftRight.second, aTopBottom.second }; + } -inline void tools::Rectangle::SetWidth(tools::Long nWidth) -{ - if (nWidth < 0) - mnRight = mnLeft + nWidth + 1; - else if (nWidth > 0) - mnRight = mnLeft + nWidth - 1; - else - SetWidthEmpty(); -} + constexpr PointT TopLeft() const { return { Left(), Top() }; } + constexpr PointT TopRight() const { return { Right(), Top() }; } + constexpr PointT TopCenter() const { return { (Left() + Right()) / 2, Top() }; } + constexpr PointT BottomLeft() const { return { Left(), Bottom() }; } + constexpr PointT BottomRight() const { return { Right(), Bottom() }; } + constexpr PointT BottomCenter() const { return { (Left() + Right()) / 2, Bottom() }; } + constexpr PointT LeftCenter() const { return { Left(), (Top() + Bottom()) / 2 }; } + constexpr PointT RightCenter() const { return { Right(), (Top() + Bottom()) / 2 }; } + constexpr PointT Center() const { return { (Left() + Right()) / 2, (Top() + Bottom()) / 2 }; } + + using RectangleTemplateBase::Move; + void Move( SizeT const & s ) { Move(s.Width(), s.Height()); } + void SetPos( const PointT& rPoint ) + { + SetPosX(rPoint.X()); + SetPosY(rPoint.Y()); + } + void SetSize(const SizeT& rSize) + { + SetWidth(rSize.Width()); + SetHeight(rSize.Height()); + } -inline void tools::Rectangle::SetHeight(tools::Long nHeight) -{ - if (nHeight < 0) - mnBottom = mnTop + nHeight + 1; - else if (nHeight > 0) - mnBottom = mnTop + nHeight - 1; - else - SetHeightEmpty(); -} + constexpr PointT GetPos() const { return TopLeft(); } + constexpr SizeT GetSize() const { return { GetWidth(), GetHeight() }; } -inline void tools::Rectangle::SetSize(const Size& rSize) -{ - SetWidth(rSize.Width()); - SetHeight(rSize.Height()); -} + RectangleT& Union( const RectangleT& rRect ) { RectangleTemplateBase::Union(rRect); return reinterpret_cast<RectangleT&>(*this); } + RectangleT& Intersection( const RectangleT& rRect ) { RectangleTemplateBase::Intersection(rRect); return reinterpret_cast<RectangleT&>(*this); } + RectangleT GetUnion( const RectangleT& rRect ) const + { + RectangleT aTmpRect( reinterpret_cast<const RectangleT&>(*this) ); + return aTmpRect.Union( rRect ); + } + RectangleT GetIntersection( const RectangleT& rRect ) const + { + RectangleT aTmpRect( reinterpret_cast<const RectangleT&>(*this) ); + return aTmpRect.Intersection( rRect ); + } -constexpr inline tools::Long tools::Rectangle::GetWidth() const -{ - tools::Long n = 0; + bool Contains( const PointT& rPt ) const { return RectangleTemplateBase::Contains(rPt); } + bool Contains( const RectangleT& rRect ) const { return RectangleTemplateBase::Contains(rRect); } + bool Overlaps( const RectangleT& rRect ) const { return RectangleTemplateBase::Overlaps(rRect); } - if (!IsWidthEmpty()) + bool operator == ( const RectangleT& rRect ) const { - n = mnRight - mnLeft; - if (n < 0) - n--; - else - n++; + return (mnLeft == rRect.mnLeft ) && + (mnTop == rRect.mnTop ) && + (mnRight == rRect.mnRight ) && + (mnBottom == rRect.mnBottom ); + } + bool operator != ( const RectangleT& rRect ) const + { + return (mnLeft != rRect.mnLeft ) || + (mnTop != rRect.mnTop ) || + (mnRight != rRect.mnRight ) || + (mnBottom != rRect.mnBottom ); } - return n; -} - -constexpr inline tools::Long tools::Rectangle::GetHeight() const -{ - tools::Long n = 0; + RectangleT& operator += ( const PointT& rPt ) + { + Move(rPt.X(), rPt.Y()); + return reinterpret_cast<RectangleT&>(*this); + } + RectangleT& operator -= ( const PointT& rPt ) + { + Move(-rPt.X(), -rPt.Y()); + return reinterpret_cast<RectangleT&>(*this); + } - if (!IsHeightEmpty()) + RectangleT operator+( const Point& rPt ) const { - n = mnBottom - mnTop; - if (n < 0) - n--; - else - n++; + RectangleT aTmp(mnLeft, mnTop, mnRight, mnBottom); + aTmp += rPt; + return aTmp; + } + RectangleT operator-( const Point& rPt ) const + { + RectangleT aTmp(mnLeft, mnTop, mnRight, mnBottom); + aTmp -= rPt; + return aTmp; } - return n; -} + /** + * Sanitizing variants for handling data from the outside + */ + void SaturatingSetSize(const SizeT& rSize) { RectangleTemplateBase::SaturatingSetSize(rSize); } -inline tools::Rectangle tools::Rectangle::GetUnion( const tools::Rectangle& rRect ) const -{ - tools::Rectangle aTmpRect( *this ); - return aTmpRect.Union( rRect ); -} + // Scales relative to 0,0 + constexpr RectangleT scale(sal_Int64 nMulX, sal_Int64 nDivX, + sal_Int64 nMulY, sal_Int64 nDivY) const + { + // 1. Create an empty rectangle with correct left and top + RectangleT aRect(o3tl::convert(Left(), nMulX, nDivX), + o3tl::convert(Top(), nMulY, nDivY)); + // 2. If source has width/height, set respective right and bottom + if (!IsWidthEmpty()) + aRect.SetRight(o3tl::convert(Right(), nMulX, nDivX)); + if (!IsHeightEmpty()) + aRect.SetBottom(o3tl::convert(Bottom(), nMulY, nDivY)); + return aRect; + } +}; -inline tools::Rectangle tools::Rectangle::GetIntersection( const tools::Rectangle& rRect ) const +namespace tools { - tools::Rectangle aTmpRect( *this ); - return aTmpRect.Intersection( rRect ); -} - -inline bool tools::Rectangle::operator == ( const tools::Rectangle& rRect ) const +class SAL_WARN_UNUSED Rectangle final : public RectangleTemplate<Rectangle, Point, Size> { - return (mnLeft == rRect.mnLeft ) && - (mnTop == rRect.mnTop ) && - (mnRight == rRect.mnRight ) && - (mnBottom == rRect.mnBottom ); -} +public: + using RectangleTemplate::RectangleTemplate; + // TODO remove this to find more issues + constexpr Rectangle(const AbsoluteScreenPixelPoint& pt, const Size& sz) : RectangleTemplate(Point(pt.X(), pt.Y()), sz) {} + // TODO remove this to find more issues + constexpr Rectangle(const Point& pt, const AbsoluteScreenPixelSize& sz) : RectangleTemplate(pt, Size(sz.Width(), sz.Height())) {} + // TODO remove this to find more issues + constexpr explicit Rectangle(const AbsoluteScreenPixelRectangle & r); +}; -inline bool tools::Rectangle::operator != ( const tools::Rectangle& rRect ) const -{ - return (mnLeft != rRect.mnLeft ) || - (mnTop != rRect.mnTop ) || - (mnRight != rRect.mnRight ) || - (mnBottom != rRect.mnBottom ); -} +} // namespace tools -inline tools::Rectangle& tools::Rectangle::operator +=( const Point& rPt ) -{ - Move(rPt.X(), rPt.Y()); - return *this; -} -inline tools::Rectangle& tools::Rectangle::operator -= ( const Point& rPt ) -{ - Move(-rPt.X(), -rPt.Y()); - return *this; -} +// A rectangle relative to top-level screen, in screen pixels +class SAL_WARN_UNUSED AbsoluteScreenPixelRectangle : public RectangleTemplate<AbsoluteScreenPixelRectangle, AbsoluteScreenPixelPoint, AbsoluteScreenPixelSize> { +public: + using RectangleTemplate::RectangleTemplate; + // TODO remove + constexpr explicit AbsoluteScreenPixelRectangle(const tools::Rectangle & r) : RectangleTemplate(r.mnLeft, r.mnTop, r.mnRight, r.mnBottom) {} + // TODO remove + constexpr AbsoluteScreenPixelRectangle(const AbsoluteScreenPixelPoint& pt, const Size& sz) : RectangleTemplate(pt, AbsoluteScreenPixelSize(sz.Width(), sz.Height())) {} +}; namespace tools { -inline Rectangle operator + ( const Rectangle& rRect, const Point& rPt ) -{ - return Rectangle{ rRect }.operator+=(rPt); -} - -inline Rectangle operator - ( const Rectangle& rRect, const Point& rPt ) -{ - return Rectangle{ rRect }.operator-=(rPt); -} - -} - -constexpr inline tools::Rectangle tools::Rectangle::scale(sal_Int64 nMulX, sal_Int64 nDivX, - sal_Int64 nMulY, sal_Int64 nDivY) const -{ - // 1. Create an empty rectangle with correct left and top - tools::Rectangle aRect(o3tl::convert(Left(), nMulX, nDivX), - o3tl::convert(Top(), nMulY, nDivY)); - // 2. If source has width/height, set respective right and bottom - if (!IsWidthEmpty()) - aRect.SetRight(o3tl::convert(Right(), nMulX, nDivX)); - if (!IsHeightEmpty()) - aRect.SetBottom(o3tl::convert(Bottom(), nMulY, nDivY)); - return aRect; + constexpr Rectangle::Rectangle(const AbsoluteScreenPixelRectangle & r) : RectangleTemplate(r.mnLeft, r.mnTop, r.mnRight, r.mnBottom) {} } namespace o3tl @@ -799,14 +914,17 @@ constexpr tools::Rectangle convert(const tools::Rectangle& rRectangle, o3tl::Len const auto [num, den] = o3tl::getConversionMulDiv(eFrom, eTo); return rRectangle.scale(num, den, num, den); } +constexpr AbsoluteScreenPixelRectangle convert(const AbsoluteScreenPixelRectangle& rRectangle, o3tl::Length eFrom, o3tl::Length eTo) +{ + const auto [num, den] = o3tl::getConversionMulDiv(eFrom, eTo); + return rRectangle.scale(num, den, num, den); +} } // end o3tl -namespace tools -{ template< typename charT, typename traits > inline std::basic_ostream<charT, traits> & operator <<( - std::basic_ostream<charT, traits> & stream, const tools::Rectangle& rectangle ) + std::basic_ostream<charT, traits> & stream, const RectangleTemplateBase& rectangle ) { if (rectangle.IsEmpty()) return stream << "EMPTY"; @@ -814,6 +932,5 @@ inline std::basic_ostream<charT, traits> & operator <<( return stream << rectangle.GetWidth() << 'x' << rectangle.GetHeight() << "@(" << rectangle.getX() << ',' << rectangle.getY() << ")"; } -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/accessibletable.hxx b/include/vcl/accessibletable.hxx index f5cdad02c0ef..e662675c7dd1 100644 --- a/include/vcl/accessibletable.hxx +++ b/include/vcl/accessibletable.hxx @@ -73,7 +73,7 @@ public: AccessibleTableControlObjType eObjType ) const= 0; // Window - virtual tools::Rectangle GetWindowExtentsAbsolute() const = 0; + virtual AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() const = 0; virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const = 0; virtual void GrabFocus()= 0; virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible()= 0; diff --git a/include/vcl/accessibletableprovider.hxx b/include/vcl/accessibletableprovider.hxx index 67c16e8febfe..a58576031422 100644 --- a/include/vcl/accessibletableprovider.hxx +++ b/include/vcl/accessibletableprovider.hxx @@ -113,7 +113,7 @@ public: virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) = 0; // Window - virtual tools::Rectangle GetWindowExtentsAbsolute() const = 0; + virtual AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() const = 0; virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const = 0; virtual void GrabFocus() = 0; virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() = 0; diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 60741c13344c..36d7eeb1fc06 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -979,13 +979,13 @@ public: @see GetScreenCount */ - static tools::Rectangle GetScreenPosSizePixel( unsigned int nScreen ); + static AbsoluteScreenPixelRectangle GetScreenPosSizePixel( unsigned int nScreen ); /** Get the "best" screen. @returns the return value will be nearest screen of the target rectangle. */ - SAL_DLLPRIVATE static unsigned int GetBestScreen( const tools::Rectangle& ); + SAL_DLLPRIVATE static unsigned int GetBestScreen( const AbsoluteScreenPixelRectangle& ); /** Get the built-in screen. diff --git a/include/vcl/toolkit/floatwin.hxx b/include/vcl/toolkit/floatwin.hxx index d640eb33554b..f71d6641369a 100644 --- a/include/vcl/toolkit/floatwin.hxx +++ b/include/vcl/toolkit/floatwin.hxx @@ -61,7 +61,7 @@ private: VclPtr<vcl::Window> mpFirstPopupModeWin; VclPtr<vcl::Window> mxPrevFocusWin; std::unique_ptr<ImplData> mpImplData; - tools::Rectangle maFloatRect; + AbsoluteScreenPixelRectangle maFloatRect; ImplSVEvent * mnPostId; FloatWinPopupFlags mnPopupModeFlags; FloatWinTitleType mnTitle; @@ -96,11 +96,11 @@ public: static Point ImplCalcPos(vcl::Window* pWindow, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags, sal_uInt16& rArrangeIndex, Point* pLOKTwipsPos = nullptr); - static Point ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos); - static tools::Rectangle ImplConvertToAbsPos(vcl::Window* pReference, const tools::Rectangle& rRect); - static tools::Rectangle ImplConvertToRelPos(vcl::Window* pReference, const tools::Rectangle& rRect); + static AbsoluteScreenPixelPoint ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos); + static AbsoluteScreenPixelRectangle ImplConvertToAbsPos(vcl::Window* pReference, const tools::Rectangle& rRect); + static tools::Rectangle ImplConvertToRelPos(vcl::Window* pReference, const AbsoluteScreenPixelRectangle& rRect); SAL_DLLPRIVATE void ImplEndPopupMode( FloatWinPopupEndFlags nFlags, const VclPtr<vcl::Window>& xFocusId ); - SAL_DLLPRIVATE tools::Rectangle ImplGetItemEdgeClipRect() const; + SAL_DLLPRIVATE AbsoluteScreenPixelRectangle ImplGetItemEdgeClipRect(); SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; } virtual void doDeferredInit(WinBits nBits) override; void PixelInvalidate(const tools::Rectangle* pRectangle) override; diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx index b9aed978e3c5..c154969678b9 100644 --- a/include/vcl/toolkit/svtabbx.hxx +++ b/include/vcl/toolkit/svtabbx.hxx @@ -192,7 +192,7 @@ public: virtual bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, std::vector< tools::Rectangle >& rVector ) override; // Window - virtual tools::Rectangle GetWindowExtentsAbsolute() const override; + virtual AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() const override; virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const override; virtual void GrabFocus() override; virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 707d93099ef4..e37bd36f65f4 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -535,7 +535,7 @@ public: virtual bool get_resizable() const = 0; virtual Size get_size() const = 0; virtual Point get_position() const = 0; - virtual tools::Rectangle get_monitor_workarea() const = 0; + virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const = 0; // center window on is parent // // bTrackGeometryRequests set to true tries to ensure the window will end @@ -2370,7 +2370,7 @@ public: virtual a11yref get_accessible_parent() = 0; virtual a11yrelationset get_accessible_relation_set() = 0; - virtual Point get_accessible_location_on_screen() = 0; + virtual AbsoluteScreenPixelPoint get_accessible_location_on_screen() = 0; private: friend class ::LOKTrigger; diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 9db3125be3f5..2d64be451370 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -686,8 +686,8 @@ private: SAL_DLLPRIVATE static void ImplHandleScroll(Scrollable* pHScrl, double nX, Scrollable* pVScrl, double nY); - SAL_DLLPRIVATE tools::Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) const; - SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle& rRect ) const; + SAL_DLLPRIVATE AbsoluteScreenPixelRectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) const; + SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel( const AbsoluteScreenPixelRectangle& rRect ) const; SAL_DLLPRIVATE tools::Long ImplGetUnmirroredOutOffX() const; // retrieves the list of owner draw decorated windows for this window hierarchy @@ -942,13 +942,13 @@ public: // the normalized screen methods work independent from UI mirroring Point OutputToNormalizedScreenPixel( const Point& rPos ) const; Point NormalizedScreenToOutputPixel( const Point& rPos ) const; - Point OutputToAbsoluteScreenPixel( const Point& rPos ) const; - Point AbsoluteScreenToOutputPixel( const Point& rPos ) const; - tools::Rectangle GetDesktopRectPixel() const; + AbsoluteScreenPixelPoint OutputToAbsoluteScreenPixel( const Point& rPos ) const; + Point AbsoluteScreenToOutputPixel( const AbsoluteScreenPixelPoint& rPos ) const; + AbsoluteScreenPixelRectangle GetDesktopRectPixel() const; // window extents including border and decoration, relative to passed in window tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const; // window extents including border and decoration, in absolute screen coordinates - tools::Rectangle GetWindowExtentsAbsolute() const; + AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() const; bool IsScrollable() const; virtual void Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index ef59f0f07c0a..855bdf957546 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -154,15 +154,15 @@ void SAL_CALL ScAccessibleCell::grabFocus( ) } } -tools::Rectangle ScAccessibleCell::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleCell::GetBoundingBoxOnScreen() const { - tools::Rectangle aCellRect(GetBoundingBox()); + AbsoluteScreenPixelRectangle aCellRect(GetBoundingBox()); if (mpViewShell) { vcl::Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos); if (pWindow) { - tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); aCellRect.Move(aRect.Left(), aRect.Top()); } } diff --git a/sc/source/ui/Accessibility/AccessibleContextBase.cxx b/sc/source/ui/Accessibility/AccessibleContextBase.cxx index f66f51077ca8..5bb0c83c144c 100644 --- a/sc/source/ui/Accessibility/AccessibleContextBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleContextBase.cxx @@ -452,10 +452,10 @@ void ScAccessibleContextBase::CommitFocusLost() const CommitChange(aEvent); } -tools::Rectangle ScAccessibleContextBase::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleContextBase::GetBoundingBoxOnScreen() const { OSL_FAIL("not implemented"); - return tools::Rectangle(); + return AbsoluteScreenPixelRectangle(); } tools::Rectangle ScAccessibleContextBase::GetBoundingBox() const diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 8a6ed0723e43..7fbb6b792941 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -2011,7 +2011,7 @@ Point ScAccessibleDocument::LogicToPixel (const Point& rPoint) const if (pWin) { aPoint = pWin->LogicToPixel(rPoint, pWin->GetDrawMapMode()); - aPoint += pWin->GetWindowExtentsAbsolute().TopLeft(); + aPoint += Point(pWin->GetWindowExtentsAbsolute().TopLeft()); } return aPoint; } @@ -2054,9 +2054,9 @@ OUString return sName; } -tools::Rectangle ScAccessibleDocument::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleDocument::GetBoundingBoxOnScreen() const { - tools::Rectangle aRect; + AbsoluteScreenPixelRectangle aRect; if (mpViewShell) { vcl::Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos); diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index 9f8af9e648ee..672785f7d35f 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -1487,9 +1487,9 @@ OUString ScAccessibleDocumentPagePreview::createAccessibleName() return sName; } -tools::Rectangle ScAccessibleDocumentPagePreview::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleDocumentPagePreview::GetBoundingBoxOnScreen() const { - tools::Rectangle aRect; + AbsoluteScreenPixelRectangle aRect; if (mpViewShell) { vcl::Window* pWindow = mpViewShell->GetWindow(); diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/sc/source/ui/Accessibility/AccessibleEditObject.cxx index 94e488a8ca33..8666666e5c79 100644 --- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx +++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx @@ -183,9 +183,9 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleEditObject::getAccessibleAtPo return xRet; } -tools::Rectangle ScAccessibleEditObject::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleEditObject::GetBoundingBoxOnScreen() const { - tools::Rectangle aScreenBounds; + AbsoluteScreenPixelRectangle aScreenBounds; if ( mpWindow ) { @@ -194,12 +194,12 @@ tools::Rectangle ScAccessibleEditObject::GetBoundingBoxOnScreen() const if ( mpEditView && mpEditView->GetEditEngine() ) { MapMode aMapMode( mpEditView->GetEditEngine()->GetRefMapMode() ); - aScreenBounds = mpWindow->LogicToPixel( mpEditView->GetOutputArea(), aMapMode ); - Point aCellLoc = aScreenBounds.TopLeft(); - tools::Rectangle aWindowRect = mpWindow->GetWindowExtentsAbsolute(); - Point aWindowLoc = aWindowRect.TopLeft(); - Point aPos( aCellLoc.getX() + aWindowLoc.getX(), aCellLoc.getY() + aWindowLoc.getY() ); - aScreenBounds.SetPos( aPos ); + tools::Rectangle aScreenBoundsLog = mpWindow->LogicToPixel( mpEditView->GetOutputArea(), aMapMode ); + Point aCellLoc = aScreenBoundsLog.TopLeft(); + AbsoluteScreenPixelRectangle aWindowRect = mpWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelPoint aWindowLoc = aWindowRect.TopLeft(); + AbsoluteScreenPixelPoint aPos( aCellLoc.getX() + aWindowLoc.getX(), aCellLoc.getY() + aWindowLoc.getY() ); + aScreenBounds = AbsoluteScreenPixelRectangle( aPos, aScreenBoundsLog.GetSize() ); } } else @@ -531,13 +531,13 @@ uno::Reference< XAccessibleRelationSet > ScAccessibleEditObject::getAccessibleRe return uno::Reference< XAccessibleRelationSet >(); } -tools::Rectangle ScAccessibleEditControlObject::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleEditControlObject::GetBoundingBoxOnScreen() const { - tools::Rectangle aScreenBounds; + AbsoluteScreenPixelRectangle aScreenBounds; if (m_pController && m_pController->GetDrawingArea()) { - aScreenBounds = tools::Rectangle(m_pController->GetDrawingArea()->get_accessible_location_on_screen(), + aScreenBounds = AbsoluteScreenPixelRectangle(m_pController->GetDrawingArea()->get_accessible_location_on_screen(), m_pController->GetOutputSizePixel()); } diff --git a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx index 909556e3586d..773e04e4c4bb 100644 --- a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx +++ b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx @@ -301,7 +301,7 @@ OUString ScAccessiblePageHeader::createAccessibleName() return sName.replaceFirst("%1", ScResId(SCSTR_UNKNOWN)); } -tools::Rectangle ScAccessiblePageHeader::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessiblePageHeader::GetBoundingBoxOnScreen() const { tools::Rectangle aCellRect(GetBoundingBox()); if (mpViewShell) @@ -309,11 +309,11 @@ tools::Rectangle ScAccessiblePageHeader::GetBoundingBoxOnScreen() const vcl::Window* pWindow = mpViewShell->GetWindow(); if (pWindow) { - tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); aCellRect.Move(aRect.Left(), aRect.Top()); } } - return aCellRect; + return AbsoluteScreenPixelRectangle(aCellRect); } tools::Rectangle ScAccessiblePageHeader::GetBoundingBox() const diff --git a/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx b/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx index df019683a708..ec1fbf3add1b 100644 --- a/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx +++ b/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx @@ -222,9 +222,9 @@ OUString ScAccessiblePageHeaderArea::createAccessibleName() return sName; } -tools::Rectangle ScAccessiblePageHeaderArea::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessiblePageHeaderArea::GetBoundingBoxOnScreen() const { - tools::Rectangle aRect; + AbsoluteScreenPixelRectangle aRect; if (mxParent.is()) { uno::Reference<XAccessibleContext> xContext = mxParent->getAccessibleContext(); @@ -232,7 +232,9 @@ tools::Rectangle ScAccessiblePageHeaderArea::GetBoundingBoxOnScreen() const if (xComp.is()) { // has the same size and position on screen like the parent - aRect = tools::Rectangle(VCLPoint(xComp->getLocationOnScreen()), VCLRectangle(xComp->getBounds()).GetSize()); + aRect = AbsoluteScreenPixelRectangle( + AbsoluteScreenPixelPoint(VCLPoint(xComp->getLocationOnScreen())), + AbsoluteScreenPixelSize(VCLRectangle(xComp->getBounds()).GetSize())); } } return aRect; diff --git a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx index 2e70dedd915d..3c4d33430552 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx @@ -191,7 +191,7 @@ uno::Sequence<sal_Int8> SAL_CALL //==== internal ========================================================= -tools::Rectangle ScAccessiblePreviewCell::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessiblePreviewCell::GetBoundingBoxOnScreen() const { tools::Rectangle aCellRect; if (mpViewShell) @@ -200,11 +200,11 @@ tools::Rectangle ScAccessiblePreviewCell::GetBoundingBoxOnScreen() const vcl::Window* pWindow = mpViewShell->GetWindow(); if (pWindow) { - tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); aCellRect.Move(aRect.Left(), aRect.Top()); } } - return aCellRect; + return AbsoluteScreenPixelRectangle(aCellRect); } tools::Rectangle ScAccessiblePreviewCell::GetBoundingBox() const diff --git a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx index 9203fe9c3157..d772db890a59 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx @@ -282,7 +282,7 @@ uno::Sequence<sal_Int8> SAL_CALL //==== internal ========================================================= -tools::Rectangle ScAccessiblePreviewHeaderCell::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessiblePreviewHeaderCell::GetBoundingBoxOnScreen() const { tools::Rectangle aCellRect; @@ -301,11 +301,11 @@ tools::Rectangle ScAccessiblePreviewHeaderCell::GetBoundingBoxOnScreen() const vcl::Window* pWindow = mpViewShell->GetWindow(); if (pWindow) { - tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); aCellRect.Move(aRect.Left(), aRect.Top()); } } - return aCellRect; + return AbsoluteScreenPixelRectangle(aCellRect); } tools::Rectangle ScAccessiblePreviewHeaderCell::GetBoundingBox() const diff --git a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx index 8300078c00ed..925ad1075c6f 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx ... etc. - the rest is truncated
