diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-07-20 08:19:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-08-02 08:13:15 +0200 |
commit | b6b26421a1029b18b48b69dbdac4bb70fb622604 (patch) | |
tree | 97b9ab25fef28063a3de4e3a67544d2ea13a70e0 | |
parent | d66ffef8558785f19908c8e526211b8225fa9125 (diff) |
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 <noel.grandin@collabora.co.uk>
152 files changed, 972 insertions, 857 deletions
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 +++ b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx @@ -578,7 +578,7 @@ OUString ScAccessiblePreviewTable::createAccessibleName() return sName; } -tools::Rectangle ScAccessiblePreviewTable::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessiblePreviewTable::GetBoundingBoxOnScreen() const { tools::Rectangle aCellRect(GetBoundingBox()); if (mpViewShell) @@ -586,11 +586,11 @@ tools::Rectangle ScAccessiblePreviewTable::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 ScAccessiblePreviewTable::GetBoundingBox() const diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index ec7be67d80f3..5319fd5ba442 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -1319,9 +1319,9 @@ void SAL_CALL ScAccessibleSpreadsheet::addAccessibleEventListener(const uno::Ref //==== internal ========================================================= -tools::Rectangle ScAccessibleSpreadsheet::GetBoundingBoxOnScreen() const +AbsoluteScreenPixelRectangle ScAccessibleSpreadsheet::GetBoundingBoxOnScreen() const { - tools::Rectangle aRect; + AbsoluteScreenPixelRectangle aRect; if (mpViewShell) { vcl::Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos); diff --git a/sc/source/ui/inc/AccessibleCell.hxx b/sc/source/ui/inc/AccessibleCell.hxx index 87c754992856..db6b4c3944fd 100644 --- a/sc/source/ui/inc/AccessibleCell.hxx +++ b/sc/source/ui/inc/AccessibleCell.hxx @@ -91,7 +91,7 @@ public: protected: /// Return the object's current bounding box relative to the desktop. - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; /// Return the object's current bounding box relative to the parent object. virtual tools::Rectangle GetBoundingBox() const override; diff --git a/sc/source/ui/inc/AccessibleContextBase.hxx b/sc/source/ui/inc/AccessibleContextBase.hxx index b7276873487f..9c9e86261492 100644 --- a/sc/source/ui/inc/AccessibleContextBase.hxx +++ b/sc/source/ui/inc/AccessibleContextBase.hxx @@ -33,6 +33,7 @@ #include <cppuhelper/implbase1.hxx> namespace tools { class Rectangle; } +class AbsoluteScreenPixelRectangle; /** @descr This base class provides an implementation of the @@ -203,7 +204,7 @@ protected: /// Return the object's current bounding box relative to the desktop. /// /// @throws css::uno::RuntimeException - virtual tools::Rectangle GetBoundingBoxOnScreen() const; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const; /// Return the object's current bounding box relative to the parent object. /// diff --git a/sc/source/ui/inc/AccessibleDocument.hxx b/sc/source/ui/inc/AccessibleDocument.hxx index 95122e789b87..d7935dfd768e 100644 --- a/sc/source/ui/inc/AccessibleDocument.hxx +++ b/sc/source/ui/inc/AccessibleDocument.hxx @@ -217,7 +217,7 @@ protected: createAccessibleName() override; /// Return the object's current bounding box relative to the desktop. - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; /// Return the object's current bounding box relative to the parent object. virtual tools::Rectangle GetBoundingBox() const override; diff --git a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx index c129a8879efc..956825a2dc20 100644 --- a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx +++ b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx @@ -106,7 +106,7 @@ protected: public: // needed in ScShapeChildren /// Return the object's current bounding box relative to the desktop. - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; protected: /// Return the object's current bounding box relative to the parent object. diff --git a/sc/source/ui/inc/AccessibleEditObject.hxx b/sc/source/ui/inc/AccessibleEditObject.hxx index b76ebe936eb0..159fa2eeb77e 100644 --- a/sc/source/ui/inc/AccessibleEditObject.hxx +++ b/sc/source/ui/inc/AccessibleEditObject.hxx @@ -94,7 +94,7 @@ public: protected: /// Return the object's current bounding box relative to the desktop. - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; /// Return the object's current bounding box relative to the parent object. virtual tools::Rectangle GetBoundingBox() const override; @@ -198,7 +198,7 @@ private: protected: /// Return the object's current bounding box relative to the desktop. - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; /// Return the object's current bounding box relative to the parent object. virtual tools::Rectangle GetBoundingBox() const override; diff --git a/sc/source/ui/inc/AccessiblePageHeader.hxx b/sc/source/ui/inc/AccessiblePageHeader.hxx index ff8cd8ffe1a5..d08db8dacdb7 100644 --- a/sc/source/ui/inc/AccessiblePageHeader.hxx +++ b/sc/source/ui/inc/AccessiblePageHeader.hxx @@ -69,7 +69,7 @@ protected: virtual OUString createAccessibleDescription() override; virtual OUString createAccessibleName() override; - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; virtual tools::Rectangle GetBoundingBox() const override; private: diff --git a/sc/source/ui/inc/AccessiblePageHeaderArea.hxx b/sc/source/ui/inc/AccessiblePageHeaderArea.hxx index de4ac2dcea24..a1e813ec67e0 100644 --- a/sc/source/ui/inc/AccessiblePageHeaderArea.hxx +++ b/sc/source/ui/inc/AccessiblePageHeaderArea.hxx @@ -97,7 +97,7 @@ protected: virtual OUString createAccessibleDescription() override; virtual OUString createAccessibleName() override; - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; virtual tools::Rectangle GetBoundingBox() const override; private: diff --git a/sc/source/ui/inc/AccessiblePreviewCell.hxx b/sc/source/ui/inc/AccessiblePreviewCell.hxx index 7dbe4d1e03b4..b40b65242df3 100644 --- a/sc/source/ui/inc/AccessiblePreviewCell.hxx +++ b/sc/source/ui/inc/AccessiblePreviewCell.hxx @@ -77,7 +77,7 @@ public: getImplementationId() override; protected: - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; virtual tools::Rectangle GetBoundingBox() const override; private: diff --git a/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx b/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx index 64d3670b78cf..f3317b41331b 100644 --- a/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx +++ b/sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx @@ -107,7 +107,7 @@ protected: virtual OUString createAccessibleDescription() override; virtual OUString createAccessibleName() override; - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; virtual tools::Rectangle GetBoundingBox() const override; private: diff --git a/sc/source/ui/inc/AccessiblePreviewTable.hxx b/sc/source/ui/inc/AccessiblePreviewTable.hxx index bd4ba93e689b..34fa7a8d3643 100644 --- a/sc/source/ui/inc/AccessiblePreviewTable.hxx +++ b/sc/source/ui/inc/AccessiblePreviewTable.hxx @@ -116,7 +116,7 @@ protected: virtual OUString createAccessibleDescription() override; virtual OUString createAccessibleName() override; - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; virtual tools::Rectangle GetBoundingBox() const override; private: diff --git a/sc/source/ui/inc/AccessibleSpreadsheet.hxx b/sc/source/ui/inc/AccessibleSpreadsheet.hxx index cfe604c7d4d6..2202d92cdd6b 100644 --- a/sc/source/ui/inc/AccessibleSpreadsheet.hxx +++ b/sc/source/ui/inc/AccessibleSpreadsheet.hxx @@ -215,7 +215,7 @@ private: virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) override; /// Return the object's current bounding box relative to the desktop. - virtual tools::Rectangle GetBoundingBoxOnScreen() const override; + virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override; /// Return the object's current bounding box relative to the parent object. virtual tools::Rectangle GetBoundingBox() const override; diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 80b1e4afdac7..96cf0e96efbe 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -1901,7 +1901,7 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const OUString& aPropertyName vcl::Window* pActiveWin = rViewData.GetActiveWin(); if ( pActiveWin ) { - tools::Rectangle aRect = pActiveWin->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = pActiveWin->GetWindowExtentsAbsolute(); aRet <<= AWTRectangle( aRect ); } } diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index 09a551396d44..961f511131ba 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -65,8 +65,8 @@ sal_uLong ScViewFunctionSet::CalcUpdateInterval( const Size& rWinSize, const Poi { sal_uLong nUpdateInterval = SELENG_AUTOREPEAT_INTERVAL_MAX; vcl::Window* pWin = m_pEngine->GetWindow(); - tools::Rectangle aScrRect = pWin->GetDesktopRectPixel(); - Point aRootPos = pWin->OutputToAbsoluteScreenPixel(Point(0,0)); + AbsoluteScreenPixelRectangle aScrRect = pWin->GetDesktopRectPixel(); + AbsoluteScreenPixelPoint aRootPos = pWin->OutputToAbsoluteScreenPixel(Point(0,0)); if (bRightScroll) { double nWinRight = rWinSize.getWidth() + aRootPos.getX(); diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index b6c7a2bd8e66..d158516fdb0a 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -1898,10 +1898,10 @@ Point ScTabView::GetChartDialogPos( const Size& rDialogSize, const tools::Rectan { MapMode aDrawMode = pWin->GetDrawMapMode(); tools::Rectangle aObjPixel = pWin->LogicToPixel( rLogicChart, aDrawMode ); - tools::Rectangle aObjAbs( pWin->OutputToAbsoluteScreenPixel( aObjPixel.TopLeft() ), + AbsoluteScreenPixelRectangle aObjAbs( pWin->OutputToAbsoluteScreenPixel( aObjPixel.TopLeft() ), pWin->OutputToAbsoluteScreenPixel( aObjPixel.BottomRight() ) ); - tools::Rectangle aDesktop = pWin->GetDesktopRectPixel(); + AbsoluteScreenPixelRectangle aDesktop = pWin->GetDesktopRectPixel(); Size aSpace = pWin->LogicToPixel( Size(8, 12), MapMode(MapUnit::MapAppFont)); ScDocument& rDoc = aViewData.GetDocument(); diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index e06407e017e2..3752cfbc41d1 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -2505,9 +2505,9 @@ void SfxHelpWindow_Impl::setContainerWindow( const Reference < css::awt::XWindow { VclPtr<vcl::Window> pScreenWin = VCLUnoHelper::GetWindow(xWindow); if (aWinSize.Width() && aWinSize.Height()) - pScreenWin->SetPosSizePixel(aWinPos, aWinSize); + pScreenWin->SetPosSizePixel(Point(aWinPos), aWinSize); else - pScreenWin->SetPosPixel(aWinPos); + pScreenWin->SetPosPixel(Point(aWinPos)); } } diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx index 08f2b8a20e23..8e828dad959d 100644 --- a/sfx2/source/appl/newhelp.hxx +++ b/sfx2/source/appl/newhelp.hxx @@ -437,7 +437,7 @@ friend class SfxHelpIndexWindow_Impl; bool bSplit; int nWidth; int nIndexSize; - Point aWinPos; + AbsoluteScreenPixelPoint aWinPos; Size aWinSize; OUString sTitle; diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index c094a4c966f8..f2c58cf6e12e 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -68,7 +68,7 @@ RecentDocsView::RecentDocsView(std::unique_ptr<weld::ScrolledWindow> xWindow, st , mpLoadRecentFile(nullptr) , m_nExecuteHdlId(nullptr) { - tools::Rectangle aScreen = Application::GetScreenPosSizePixel(Application::GetDisplayBuiltInScreen()); + AbsoluteScreenPixelRectangle aScreen = Application::GetScreenPosSizePixel(Application::GetDisplayBuiltInScreen()); mnItemMaxSize = std::min(aScreen.GetWidth(),aScreen.GetHeight()) > 800 ? 256 : 192; setItemMaxTextLength( 30 ); diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx index da174413e578..17ad2ba7cbda 100644 --- a/sfx2/source/control/templatedefaultview.cxx +++ b/sfx2/source/control/templatedefaultview.cxx @@ -25,7 +25,7 @@ TemplateDefaultView::TemplateDefaultView(std::unique_ptr<weld::ScrolledWindow> x std::unique_ptr<weld::Menu> xMenu) : TemplateLocalView(std::move(xWindow), std::move(xMenu)) { - tools::Rectangle aScreen = Application::GetScreenPosSizePixel(Application::GetDisplayBuiltInScreen()); + AbsoluteScreenPixelRectangle aScreen = Application::GetScreenPosSizePixel(Application::GetDisplayBuiltInScreen()); tools::Long nItemMaxSize = std::min(aScreen.GetWidth(),aScreen.GetHeight()) > 800 ? 256 : 192; ThumbnailView::setItemDimensions( nItemMaxSize, nItemMaxSize, gnTextHeight, gnItemPadding ); updateThumbnailDimensions(nItemMaxSize); diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 5174de54d1ef..33f0990de6e9 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -1966,7 +1966,7 @@ tools::Rectangle BrowseBox::calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen) if (pParent) aTopLeft += GetWindowExtentsRelative( *pParent ).TopLeft(); else - aTopLeft += GetWindowExtentsAbsolute().TopLeft(); + aTopLeft += Point(GetWindowExtentsAbsolute().TopLeft()); return tools::Rectangle(aTopLeft,Size(nWidth,nHeight)); } @@ -1980,7 +1980,7 @@ tools::Rectangle BrowseBox::calcTableRect(bool _bOnScreen) if (pParent) aRect = GetWindowExtentsRelative( *pParent ); else - aRect = GetWindowExtentsAbsolute(); + aRect = tools::Rectangle(GetWindowExtentsAbsolute()); tools::Rectangle aRowBar = calcHeaderRect(false, pParent == nullptr); tools::Long nX = aRowBar.Right() - aRect.Left(); @@ -2002,7 +2002,7 @@ tools::Rectangle BrowseBox::GetFieldRectPixel( sal_Int32 _nRowId, sal_uInt16 _nC if (pParent) aTopLeft += GetWindowExtentsRelative( *pParent ).TopLeft(); else - aTopLeft += GetWindowExtentsAbsolute().TopLeft(); + aTopLeft += Point(GetWindowExtentsAbsolute().TopLeft()); return tools::Rectangle(aTopLeft,aRect.GetSize()); } diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 4a1263d66e2b..4a5a8531e6ac 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -531,7 +531,7 @@ bool BrowseBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, return GetOutDev()->GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector ); } -tools::Rectangle BrowseBox::GetWindowExtentsAbsolute() const +AbsoluteScreenPixelRectangle BrowseBox::GetWindowExtentsAbsolute() const { return Control::GetWindowExtentsAbsolute(); } diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx index 862247bd98af..39bdaa88fdb7 100644 --- a/svx/source/accessibility/AccessibleFrameSelector.cxx +++ b/svx/source/accessibility/AccessibleFrameSelector.cxx @@ -202,7 +202,7 @@ css::awt::Point AccFrameSelector::getLocationOnScreen() if (weld::DrawingArea* pDrawingArea = mpFrameSel->GetDrawingArea()) { - Point aPos = pDrawingArea->get_accessible_location_on_screen(); + AbsoluteScreenPixelPoint aPos = pDrawingArea->get_accessible_location_on_screen(); aScreenLoc.X = aPos.X(); aScreenLoc.Y = aPos.Y(); } diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx index 886f01beebe1..415e9e7d109d 100644 --- a/svx/source/dialog/weldeditview.cxx +++ b/svx/source/dialog/weldeditview.cxx @@ -629,7 +629,7 @@ public: if (weld::DrawingArea* pDrawingArea = m_pController->GetDrawingArea()) { - Point aPos = pDrawingArea->get_accessible_location_on_screen(); + AbsoluteScreenPixelPoint aPos = pDrawingArea->get_accessible_location_on_screen(); aScreenLoc.X = aPos.X(); aScreenLoc.Y = aPos.Y(); } diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index 46d1d12f35f1..781533207793 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -950,8 +950,8 @@ awt::Point SAL_CALL SwAccessibleContext::getLocationOnScreen() throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); } - aPixPos = pWin->OutputToAbsoluteScreenPixel(aPixPos); - awt::Point aPoint(aPixPos.getX(), aPixPos.getY()); + AbsoluteScreenPixelPoint aPixPosAbs = pWin->OutputToAbsoluteScreenPixel(aPixPos); + awt::Point aPoint(aPixPosAbs.getX(), aPixPosAbs.getY()); return aPoint; } diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 0650b3d29a93..02038f14fc25 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -3006,7 +3006,7 @@ Point SwAccessibleMap::LogicToPixel( const Point& rPoint ) const MapMode aMapMode; GetMapMode( aPoint, aMapMode ); aPoint = pWin->LogicToPixel( aPoint, aMapMode ); - aPoint = pWin->OutputToAbsoluteScreenPixel( aPoint ); + aPoint = Point(pWin->OutputToAbsoluteScreenPixel( aPoint )); } return aPoint; diff --git a/sw/source/uibase/table/chartins.cxx b/sw/source/uibase/table/chartins.cxx index 58df4037b236..74bc534df966 100644 --- a/sw/source/uibase/table/chartins.cxx +++ b/sw/source/uibase/table/chartins.cxx @@ -60,10 +60,10 @@ Point SwGetChartDialogPos( const vcl::Window *pParentWin, const Size& rDialogSiz if (pParentWin) { tools::Rectangle aObjPixel = pParentWin->LogicToPixel( rLogicChart, pParentWin->GetMapMode() ); - tools::Rectangle aObjAbs( pParentWin->OutputToAbsoluteScreenPixel( aObjPixel.TopLeft() ), + AbsoluteScreenPixelRectangle aObjAbs( pParentWin->OutputToAbsoluteScreenPixel( aObjPixel.TopLeft() ), pParentWin->OutputToAbsoluteScreenPixel( aObjPixel.BottomRight() ) ); - tools::Rectangle aDesktop = pParentWin->GetDesktopRectPixel(); + AbsoluteScreenPixelRectangle aDesktop = pParentWin->GetDesktopRectPixel(); Size aSpace = pParentWin->LogicToPixel(Size(8, 12), MapMode(MapUnit::MapAppFont)); bool bCenterHor = false; diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 651a4abcf4c8..b66bbadab3bf 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -405,8 +405,8 @@ void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt tools::Rectangle aDlgRect; if (pCareDialog->get_extents_relative_to(*GetEditWin().GetFrameWeld(), x, y, width, height)) { - Point aTopLeft(GetEditWin().GetSystemWindow()->OutputToAbsoluteScreenPixel(Point(x, y))); - aTopLeft = GetEditWin().AbsoluteScreenToOutputPixel(aTopLeft); + AbsoluteScreenPixelPoint aTopLeftAbs(GetEditWin().GetSystemWindow()->OutputToAbsoluteScreenPixel(Point(x, y))); + Point aTopLeft = GetEditWin().AbsoluteScreenToOutputPixel(aTopLeftAbs); aDlgRect = GetEditWin().PixelToLogic(tools::Rectangle(aTopLeft, Size(width, height))); } diff --git a/toolkit/inc/controls/table/tablecontrol.hxx b/toolkit/inc/controls/table/tablecontrol.hxx index aae87ed4cba0..9d9f98ff11e3 100644 --- a/toolkit/inc/controls/table/tablecontrol.hxx +++ b/toolkit/inc/controls/table/tablecontrol.hxx @@ -127,7 +127,7 @@ namespace svt::table // IAccessibleTable - 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/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 36d0451b2575..2d290e1ad5e1 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -712,12 +712,12 @@ awt::Rectangle VCLXAccessibleComponent::implGetBounds() VclPtr<vcl::Window> pWindow = GetWindow(); if ( pWindow ) { - tools::Rectangle aRect = pWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); aBounds = AWTRectangle( aRect ); vcl::Window* pParent = pWindow->GetAccessibleParentWindow(); if ( pParent ) { - tools::Rectangle aParentRect = pParent->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aParentRect = pParent->GetWindowExtentsAbsolute(); awt::Point aParentScreenLoc = AWTPoint( aParentRect.TopLeft() ); aBounds.X -= aParentScreenLoc.X; aBounds.Y -= aParentScreenLoc.Y; @@ -734,7 +734,7 @@ awt::Point VCLXAccessibleComponent::getLocationOnScreen( ) awt::Point aPos; if ( GetWindow() ) { - tools::Rectangle aRect = GetWindow()->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = GetWindow()->GetWindowExtentsAbsolute(); aPos.X = aRect.Left(); aPos.Y = aRect.Top(); } diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index c8e918c2cea3..a5e3f71386b1 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -989,7 +989,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::getDesktopWindow( ) css::awt::Rectangle VCLXToolkit::getWorkArea( ) { sal_Int32 nDisplay = Application::GetDisplayBuiltInScreen(); - tools::Rectangle aWorkRect = Application::GetScreenPosSizePixel( nDisplay ); + AbsoluteScreenPixelRectangle aWorkRect = Application::GetScreenPosSizePixel( nDisplay ); css::awt::Rectangle aNotherRect; aNotherRect.X = aWorkRect.Left(); aNotherRect.Y = aWorkRect.Top(); diff --git a/toolkit/source/controls/table/tablecontrol.cxx b/toolkit/source/controls/table/tablecontrol.cxx index 0ce943f1698f..42b314569e82 100644 --- a/toolkit/source/controls/table/tablecontrol.cxx +++ b/toolkit/source/controls/table/tablecontrol.cxx @@ -479,7 +479,7 @@ namespace svt::table m_pImpl->commitTableEvent( i_eventID, i_newValue, i_oldValue ); } - tools::Rectangle TableControl::GetWindowExtentsAbsolute() const + AbsoluteScreenPixelRectangle TableControl::GetWindowExtentsAbsolute() const { return Control::GetWindowExtentsAbsolute(); } diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 69dc4d068ced..012318c0218d 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -42,7 +42,7 @@ size_t Pair::GetHashValue() const return hash; } -void tools::Rectangle::SaturatingSetSize(const Size& rSize) +void RectangleTemplateBase::SaturatingSetSize(const SizeTemplateBase& rSize) { if (rSize.Width() < 0) mnRight = o3tl::saturating_add(mnLeft, (rSize.Width() + 1)); @@ -59,24 +59,24 @@ void tools::Rectangle::SaturatingSetSize(const Size& rSize) SetHeightEmpty(); } -void tools::Rectangle::SaturatingSetPosX(tools::Long x) +void RectangleTemplateBase::SaturatingSetPosX(tools::Long x) { if (!IsWidthEmpty()) mnRight = o3tl::saturating_add(mnRight, x - mnLeft); mnLeft = x; } -void tools::Rectangle::SaturatingSetPosY(tools::Long y) +void RectangleTemplateBase::SaturatingSetPosY(tools::Long y) { if (!IsHeightEmpty()) mnBottom = o3tl::saturating_add(mnBottom, y - mnTop); mnTop = y; } -tools::Rectangle& tools::Rectangle::Union( const tools::Rectangle& rRect ) +void RectangleTemplateBase::Union( const RectangleTemplateBase& rRect ) { if ( rRect.IsEmpty() ) - return *this; + return; if ( IsEmpty() ) *this = rRect; @@ -85,22 +85,20 @@ tools::Rectangle& tools::Rectangle::Union( const tools::Rectangle& rRect ) std::tie(mnLeft, mnRight) = std::minmax({ mnLeft, rRect.mnLeft, mnRight, rRect.mnRight }); std::tie(mnTop, mnBottom) = std::minmax({ mnTop, rRect.mnTop, mnBottom, rRect.mnBottom }); } - - return *this; } -tools::Rectangle& tools::Rectangle::Intersection( const tools::Rectangle& rRect ) +void RectangleTemplateBase::Intersection( const RectangleTemplateBase& rRect ) { if ( IsEmpty() ) - return *this; + return; if ( rRect.IsEmpty() ) { *this = tools::Rectangle(); - return *this; + return; } // Normalize rectangle - tools::Rectangle aTmpRect( rRect ); + RectangleTemplateBase aTmpRect( rRect ); Normalize(); aTmpRect.Normalize(); @@ -113,11 +111,9 @@ tools::Rectangle& tools::Rectangle::Intersection( const tools::Rectangle& rRect // Determine if intersection is empty if ( mnRight < mnLeft || mnBottom < mnTop ) *this = tools::Rectangle(); - - return *this; } -void tools::Rectangle::Normalize() +void RectangleTemplateBase::Normalize() { if ((mnRight < mnLeft) && (!IsWidthEmpty())) { @@ -130,7 +126,7 @@ void tools::Rectangle::Normalize() } } -bool tools::Rectangle::Contains( const Point& rPoint ) const +bool RectangleTemplateBase::Contains( const PointTemplateBase& rPoint ) const { if ( IsEmpty() ) return false; @@ -158,18 +154,21 @@ bool tools::Rectangle::Contains( const Point& rPoint ) const return true; } -bool tools::Rectangle::Contains( const tools::Rectangle& rRect ) const +bool RectangleTemplateBase::Contains( const RectangleTemplateBase& rRect ) const { - return Contains( rRect.TopLeft() ) && Contains( rRect.BottomRight() ); + return Contains( PointTemplateBase{ rRect.Left(), rRect.Top() } ) + && Contains( PointTemplateBase{ rRect.Right(), rRect.Bottom() } ); } -bool tools::Rectangle::Overlaps( const tools::Rectangle& rRect ) const +bool RectangleTemplateBase::Overlaps( const RectangleTemplateBase& rRect ) const { // If there's no intersection, they don't overlap - return !GetIntersection( rRect ).IsEmpty(); + RectangleTemplateBase aTmp(*this); + aTmp.Intersection(rRect); + return !aTmp.IsEmpty(); } -OString tools::Rectangle::toString() const +OString RectangleTemplateBase::toString() const { // Note that this is not just used for debugging output but the // format is parsed by external code (passed in callbacks to @@ -180,7 +179,7 @@ OString tools::Rectangle::toString() const + OString::number(getOpenHeight()); } -void tools::Rectangle::expand(tools::Long nExpandBy) +void RectangleTemplateBase::expand(tools::Long nExpandBy) { AdjustLeft(-nExpandBy); AdjustTop(-nExpandBy); @@ -188,7 +187,7 @@ void tools::Rectangle::expand(tools::Long nExpandBy) AdjustBottom(nExpandBy); } -void tools::Rectangle::shrink(tools::Long nShrinkBy) +void RectangleTemplateBase::shrink(tools::Long nShrinkBy) { mnLeft += nShrinkBy; mnTop += nShrinkBy; @@ -198,7 +197,7 @@ void tools::Rectangle::shrink(tools::Long nShrinkBy) mnBottom -= nShrinkBy; } -tools::Long tools::Rectangle::AdjustRight(tools::Long nHorzMoveDelta) +tools::Long RectangleTemplateBase::AdjustRight(tools::Long nHorzMoveDelta) { if (IsWidthEmpty()) mnRight = mnLeft + nHorzMoveDelta - 1; @@ -207,7 +206,7 @@ tools::Long tools::Rectangle::AdjustRight(tools::Long nHorzMoveDelta) return mnRight; } -tools::Long tools::Rectangle::AdjustBottom( tools::Long nVertMoveDelta ) +tools::Long RectangleTemplateBase::AdjustBottom( tools::Long nVertMoveDelta ) { if (IsHeightEmpty()) mnBottom = mnTop + nVertMoveDelta - 1; diff --git a/tools/source/generic/point.cxx b/tools/source/generic/point.cxx index 1aba284ff27f..e71f60411a86 100644 --- a/tools/source/generic/point.cxx +++ b/tools/source/generic/point.cxx @@ -19,21 +19,21 @@ #include <tools/gen.hxx> -void Point::RotateAround( Point& rPoint, +void PointTemplateBase::RotateAround( PointTemplateBase& rPoint, Degree10 nOrientation ) const { - tools::Long nX = rPoint.X(); - tools::Long nY = rPoint.Y(); + tools::Long nX = rPoint.mnA; + tools::Long nY = rPoint.mnB; RotateAround(nX, nY, nOrientation); - rPoint.setX(nX); - rPoint.setY(nY); + rPoint.mnA = nX; + rPoint.mnB = nY; } -void Point::RotateAround( tools::Long& rX, tools::Long& rY, +void PointTemplateBase::RotateAround( tools::Long& rX, tools::Long& rY, Degree10 nOrientation ) const { - const tools::Long nOriginX = X(); - const tools::Long nOriginY = Y(); + const tools::Long nOriginX = mnA; + const tools::Long nOriginY = mnB; if ( (nOrientation >= 0_deg10) && !(nOrientation % 900_deg10) ) { diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 6fe0928686ef..20fa519dc0d6 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -892,7 +892,7 @@ double UserFormGeometryHelper::implGetSize( bool bHeight, bool bOuter ) const { if( const vcl::Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ) ) { - tools::Rectangle aOuterRect = pWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aOuterRect = pWindow->GetWindowExtentsAbsolute(); aSizePixel = awt::Size( aOuterRect.getOpenWidth(), aOuterRect.getOpenHeight() ); } } @@ -916,7 +916,7 @@ void UserFormGeometryHelper::implSetSize( double fSize, bool bHeight, bool bOute { if( const vcl::Window* pWindow = VCLUnoHelper::GetWindow( mxWindow ) ) { - tools::Rectangle aOuterRect = pWindow->GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aOuterRect = pWindow->GetWindowExtentsAbsolute(); if( !aOuterRect.IsEmpty() ) { awt::Rectangle aInnerRect = mxWindow->getPosSize(); diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx index ca130fb1b19f..7c3132d7dd42 100644 --- a/vcl/android/androidinst.cxx +++ b/vcl/android/androidinst.cxx @@ -26,10 +26,10 @@ // Horrible hack static int viewWidth = 1, viewHeight = 1; -void AndroidSalInstance::GetWorkArea(tools::Rectangle& rRect) +void AndroidSalInstance::GetWorkArea(AbsoluteScreenPixelRectangle& rRect) { - rRect = tools::Rectangle( Point( 0, 0 ), - Size( viewWidth, viewHeight ) ); + rRect = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( 0, 0 ), + AbsoluteScreenPixelSize( viewWidth, viewHeight ) ); } AndroidSalInstance *AndroidSalInstance::getInstance() @@ -106,7 +106,7 @@ public: SetPosSize(0, 0, viewWidth, viewHeight, SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT); } - virtual void GetWorkArea(tools::Rectangle& rRect) + virtual void GetWorkArea(AbsoluteScreenPixelRectangle& rRect) { AndroidSalInstance::getInstance()->GetWorkArea( rRect ); } diff --git a/vcl/headless/svpdummies.cxx b/vcl/headless/svpdummies.cxx index 4d8e639b78dc..944d494976ca 100644 --- a/vcl/headless/svpdummies.cxx +++ b/vcl/headless/svpdummies.cxx @@ -41,11 +41,11 @@ unsigned int SvpSalSystem::GetDisplayScreenCount() return 1; } -tools::Rectangle SvpSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) +AbsoluteScreenPixelRectangle SvpSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) { - tools::Rectangle aRect; + AbsoluteScreenPixelRectangle aRect; if( nScreen == 0 ) - aRect = tools::Rectangle( Point(0,0), Size(VIRTUAL_DESKTOP_WIDTH,VIRTUAL_DESKTOP_HEIGHT) ); + aRect = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint(0,0), AbsoluteScreenPixelSize(VIRTUAL_DESKTOP_WIDTH,VIRTUAL_DESKTOP_HEIGHT) ); return aRect; } diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index 5c6a713572d2..c6993860a7dd 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -293,10 +293,10 @@ void SvpSalFrame::GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) rHeight = maGeometry.height(); } -void SvpSalFrame::GetWorkArea( tools::Rectangle& rRect ) +void SvpSalFrame::GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) { - rRect = tools::Rectangle( Point( 0, 0 ), - Size( VIRTUAL_DESKTOP_WIDTH, VIRTUAL_DESKTOP_HEIGHT ) ); + rRect = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( 0, 0 ), + AbsoluteScreenPixelSize( VIRTUAL_DESKTOP_WIDTH, VIRTUAL_DESKTOP_HEIGHT ) ); } SalFrame* SvpSalFrame::GetParent() const diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx index 771eb4b1ed81..58ebdbb2531a 100644 --- a/vcl/inc/android/androidinst.hxx +++ b/vcl/inc/android/androidinst.hxx @@ -36,7 +36,7 @@ public: virtual SalSystem* CreateSalSystem(); // frame management - void GetWorkArea(tools::Rectangle& rRect); + void GetWorkArea(AbsoluteScreenPixelRectangle& rRect); SalFrame* CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle); SalFrame* CreateChildFrame(SystemParentData* pParent, SalFrameStyleFlags nStyle); diff --git a/vcl/inc/headless/svpdummies.hxx b/vcl/inc/headless/svpdummies.hxx index d3cbc9df957d..92958f8d5529 100644 --- a/vcl/inc/headless/svpdummies.hxx +++ b/vcl/inc/headless/svpdummies.hxx @@ -52,7 +52,7 @@ public: virtual ~SvpSalSystem() override; // get info about the display virtual unsigned int GetDisplayScreenCount() override; - virtual tools::Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; + virtual AbsoluteScreenPixelRectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; virtual int ShowNativeDialog( const OUString& rTitle, const OUString& rMessage, diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index 1d8d11926e2f..3789e44745e7 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -88,7 +88,7 @@ public: virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override; virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; - virtual void GetWorkArea( tools::Rectangle& rRect ) override; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override; virtual SalFrame* GetParent() const override; virtual void SetWindowState(const vcl::WindowData*) override; virtual bool GetWindowState(vcl::WindowData*) override; diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h index 87ab09868edd..21a4b963717d 100644 --- a/vcl/inc/osx/salframe.h +++ b/vcl/inc/osx/salframe.h @@ -123,7 +123,7 @@ public: override; virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; - virtual void GetWorkArea( tools::Rectangle& rRect ) override; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override; virtual SalFrame* GetParent() const override; virtual void SetWindowState(const vcl::WindowData*) override; virtual bool GetWindowState(vcl::WindowData*) override; diff --git a/vcl/inc/osx/salsys.h b/vcl/inc/osx/salsys.h index b0bc98578b35..4b8b077088c7 100644 --- a/vcl/inc/osx/salsys.h +++ b/vcl/inc/osx/salsys.h @@ -33,7 +33,7 @@ public: // get info about the display virtual unsigned int GetDisplayScreenCount() override; - virtual tools::Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; + virtual AbsoluteScreenPixelRectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; virtual int ShowNativeMessageBox( const OUString& rTitle, const OUString& rMessage) override; diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx index 90195f55a543..02146343e10d 100644 --- a/vcl/inc/qt5/QtFrame.hxx +++ b/vcl/inc/qt5/QtFrame.hxx @@ -175,7 +175,7 @@ public: virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags) override; virtual void GetClientSize(tools::Long& rWidth, tools::Long& rHeight) override; - virtual void GetWorkArea(tools::Rectangle& rRect) override; + virtual void GetWorkArea(AbsoluteScreenPixelRectangle& rRect) override; virtual SalFrame* GetParent() const override; virtual void SetModal(bool bModal) override; virtual bool GetModal() const override; diff --git a/vcl/inc/qt5/QtSystem.hxx b/vcl/inc/qt5/QtSystem.hxx index 6992e381c4c4..760520f42a41 100644 --- a/vcl/inc/qt5/QtSystem.hxx +++ b/vcl/inc/qt5/QtSystem.hxx @@ -15,7 +15,8 @@ class QtSystem final : public SalGenericSystem { public: virtual unsigned int GetDisplayScreenCount() override; - virtual tools::Rectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) override; + virtual AbsoluteScreenPixelRectangle + GetDisplayScreenPosSizePixel(unsigned int nScreen) override; virtual int ShowNativeDialog(const OUString& rTitle, const OUString& rMessage, const std::vector<OUString>& rButtons) override; }; diff --git a/vcl/inc/qt5/QtTools.hxx b/vcl/inc/qt5/QtTools.hxx index 9b4239ac826f..9a5d0da00ee4 100644 --- a/vcl/inc/qt5/QtTools.hxx +++ b/vcl/inc/qt5/QtTools.hxx @@ -62,6 +62,11 @@ inline QRect toQRect(const tools::Rectangle& rRect, const qreal fScale) return QRect(floor(rRect.Left() * fScale), floor(rRect.Top() * fScale), ceil(rRect.GetWidth() * fScale), ceil(rRect.GetHeight() * fScale)); } +inline QRect toQRect(const AbsoluteScreenPixelRectangle& rRect, const qreal fScale) +{ + return QRect(floor(rRect.Left() * fScale), floor(rRect.Top() * fScale), + ceil(rRect.GetWidth() * fScale), ceil(rRect.GetHeight() * fScale)); +} inline QRect scaledQRect(const QRect& rRect, const qreal fScale) { diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index 0c3b170ca239..f25f8de92777 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -158,7 +158,7 @@ public: virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) = 0; static OUString DumpSetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags); virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) = 0; - virtual void GetWorkArea( tools::Rectangle& rRect ) = 0; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) = 0; virtual SalFrame* GetParent() const = 0; // Note: x will be mirrored at parent if UI mirroring is active SalFrameGeometry GetGeometry() const; diff --git a/vcl/inc/salsys.hxx b/vcl/inc/salsys.hxx index a5950441d348..d7cf10edb149 100644 --- a/vcl/inc/salsys.hxx +++ b/vcl/inc/salsys.hxx @@ -55,7 +55,7 @@ public: else position relative to whole display size: size of the screen */ - virtual tools::Rectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) = 0; + virtual AbsoluteScreenPixelRectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) = 0; /* Shows a native message box with the specified title, message and button combination. diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index e0c61a5c15ef..fa4f3550280b 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -478,7 +478,7 @@ public: virtual Point get_position() const override; - virtual tools::Rectangle get_monitor_workarea() const override; + virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const override; virtual void set_centered_on_parent(bool /*bTrackGeometryRequests*/) override; @@ -1330,7 +1330,7 @@ public: virtual a11yrelationset get_accessible_relation_set() override; - virtual Point get_accessible_location_on_screen() override; + virtual AbsoluteScreenPixelPoint get_accessible_location_on_screen() override; virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants) override; diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx index 9e43d16d4135..fd2b938d3a2c 100644 --- a/vcl/inc/salwtype.hxx +++ b/vcl/inc/salwtype.hxx @@ -23,6 +23,7 @@ #include <i18nlangtag/lang.h> #include <rtl/ref.hxx> #include <rtl/ustring.hxx> +#include <tools/gen.hxx> #include <tools/solar.h> #include <tools/long.hxx> #include <vcl/GestureEventPan.hxx> @@ -222,10 +223,7 @@ struct SalSurroundingTextSelectionChangeEvent struct SalQueryCharPositionEvent { sal_uLong mnCharPos; // The index of character in a composition. - tools::Long mnCursorBoundX; // The cursor bounds corresponding to the character specified by mnCharPos - X - tools::Long mnCursorBoundY; // The cursor bounds corresponding to the character specified by mnCharPos - Y - tools::Long mnCursorBoundWidth; // The cursor bounds corresponding to the character specified by mnCharPos - Width - tools::Long mnCursorBoundHeight; // The cursor bounds corresponding to the character specified by mnCharPos - Height + AbsoluteScreenPixelRectangle maCursorBound; // The cursor bounds corresponding to the character specified by mnCharPos - X bool mbValid; // The data is valid or not. bool mbVertical; // The text is vertical or not. }; diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index cd03de599887..04c1485963f5 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -337,7 +337,7 @@ public: virtual int CaptureMouse( SalFrame* pFrame ); SalX11Screen GetDefaultXScreen() { return m_pSys->GetDisplayDefaultXScreen(); } - Size GetScreenSize( int nDisplayScreen ); + AbsoluteScreenPixelSize GetScreenSize( int nDisplayScreen ); void startupNotificationCompleted() { m_bStartupCompleted = true; } diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 62878279d577..be9a6a2dda83 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -534,7 +534,7 @@ public: virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override; virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; - virtual void GetWorkArea( tools::Rectangle& rRect ) override; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override; virtual SalFrame* GetParent() const override; virtual void SetWindowState(const vcl::WindowData*) override; virtual bool GetWindowState(vcl::WindowData*) override; diff --git a/vcl/inc/unx/gtk/gtksys.hxx b/vcl/inc/unx/gtk/gtksys.hxx index 31a1bead7bea..d7e5bcaf5aa4 100644 --- a/vcl/inc/unx/gtk/gtksys.hxx +++ b/vcl/inc/unx/gtk/gtksys.hxx @@ -28,7 +28,7 @@ public: virtual unsigned int GetDisplayScreenCount() override; virtual unsigned int GetDisplayBuiltInScreen() override; - virtual tools::Rectangle GetDisplayScreenPosSizePixel (unsigned int nScreen) override; + virtual AbsoluteScreenPixelRectangle GetDisplayScreenPosSizePixel(unsigned int nScreen) override; virtual int ShowNativeDialog (const OUString& rTitle, const OUString& rMessage, const std::vector< OUString >& rButtons) override; diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index 800f6af75bc5..6cdd13b97494 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -212,7 +212,7 @@ public: ::Window m_aRoot; ::Window m_aRefWindow; - Size m_aSize; + AbsoluteScreenPixelSize m_aSize; SalVisual m_aVisual; SalColormap m_aColormap; GC m_aMonoGC; @@ -265,7 +265,7 @@ protected: std::unique_ptr<vcl_sal::WMAdaptor> m_pWMAdaptor; bool m_bXinerama; - std::vector< tools::Rectangle > m_aXineramaScreens; + std::vector< AbsoluteScreenPixelRectangle > m_aXineramaScreens; std::vector< int > m_aXineramaScreenIndexMap; std::list<SalObject*> m_aSalObjects; @@ -325,7 +325,7 @@ public: ::Window GetDrawable( SalX11Screen nXScreen ) const { return getDataForScreen( nXScreen ).m_aRefWindow; } Display *GetDisplay() const { return pDisp_; } const SalX11Screen& GetDefaultXScreen() const { return m_nXDefaultScreen; } - const Size& GetScreenSize( SalX11Screen nXScreen ) const { return getDataForScreen( nXScreen ).m_aSize; } + const AbsoluteScreenPixelSize& GetScreenSize( SalX11Screen nXScreen ) const { return getDataForScreen( nXScreen ).m_aSize; } srv_vendor_t GetServerVendor() const { return meServerVendor; } bool IsDisplay() const { return !!pXLib_; } const SalColormap& GetColormap( SalX11Screen nXScreen ) const { return getDataForScreen(nXScreen).m_aColormap; } @@ -341,7 +341,7 @@ public: { mpKbdExtension = pKbdExtension; } ::vcl_sal::WMAdaptor* getWMAdaptor() const { return m_pWMAdaptor.get(); } bool IsXinerama() const { return m_bXinerama; } - const std::vector< tools::Rectangle >& GetXineramaScreens() const { return m_aXineramaScreens; } + const std::vector< AbsoluteScreenPixelRectangle >& GetXineramaScreens() const { return m_aXineramaScreens; } ::Window GetRootWindow( SalX11Screen nXScreen ) const { return getDataForScreen( nXScreen ).m_aRoot; } unsigned int GetXScreenCount() const { return m_aScreens.size(); } diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h index c14c3254c489..efd1a9016d1b 100644 --- a/vcl/inc/unx/salframe.h +++ b/vcl/inc/unx/salframe.h @@ -93,7 +93,7 @@ class X11SalFrame final : public SalFrame X11ShowState nShowState_; // show state int nWidth_; // client width int nHeight_; // client height - tools::Rectangle maRestorePosSize; + AbsoluteScreenPixelRectangle maRestorePosSize; SalFrameStyleFlags nStyle_; SalExtStyle mnExtStyle; bool bAlwaysOnTop_; @@ -133,10 +133,10 @@ class X11SalFrame final : public SalFrame bool mPendingSizeEvent; - void GetPosSize( tools::Rectangle &rPosSize ); + void GetPosSize( AbsoluteScreenPixelRectangle &rPosSize ); void SetSize ( const Size &rSize ); void Center(); - void SetPosSize( const tools::Rectangle &rPosSize ); + void SetPosSize( const AbsoluteScreenPixelRectangle &rPosSize ); void Minimize(); void Maximize(); void Restore(); @@ -222,7 +222,7 @@ public: virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override; virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; - virtual void GetWorkArea( tools::Rectangle& rRect ) override; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override; virtual SalFrame* GetParent() const override; virtual void SetWindowState(const vcl::WindowData*) override; virtual bool GetWindowState(vcl::WindowData*) override; diff --git a/vcl/inc/unx/wmadaptor.hxx b/vcl/inc/unx/wmadaptor.hxx index e76ba4d36938..c800a2270e27 100644 --- a/vcl/inc/unx/wmadaptor.hxx +++ b/vcl/inc/unx/wmadaptor.hxx @@ -131,7 +131,7 @@ protected: Atom m_aWMAtoms[ NetAtomMax]; int m_nDesktops; bool m_bEqualWorkAreas; - ::std::vector< tools::Rectangle > + ::std::vector< AbsoluteScreenPixelRectangle > m_aWMWorkAreas; bool m_bEnableAlwaysOnTopWorks; bool m_bLegacyPartialFullscreen; @@ -178,7 +178,7 @@ public: /* * gets the specified workarea */ - const tools::Rectangle& getWorkArea( int n ) const + const AbsoluteScreenPixelRectangle& getWorkArea( int n ) const { return m_aWMWorkAreas[n]; } /* diff --git a/vcl/inc/unx/x11/x11sys.hxx b/vcl/inc/unx/x11/x11sys.hxx index 50c30ac10062..4f43d0052e7b 100644 --- a/vcl/inc/unx/x11/x11sys.hxx +++ b/vcl/inc/unx/x11/x11sys.hxx @@ -32,7 +32,7 @@ public: // override pure virtual methods virtual unsigned int GetDisplayScreenCount() override; virtual unsigned int GetDisplayBuiltInScreen() override; - virtual tools::Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; + virtual AbsoluteScreenPixelRectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; virtual int ShowNativeDialog( const OUString& rTitle, const OUString& rMessage, const std::vector< OUString >& rButtons ) override; diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index 564872e65d2c..66da5e3a976f 100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h @@ -107,7 +107,7 @@ public: virtual void SetMaxClientSize( tools::Long nWidth, tools::Long nHeight ) override; virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, sal_uInt16 nFlags ) override; virtual void GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) override; - virtual void GetWorkArea( tools::Rectangle& rRect ) override; + virtual void GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) override; virtual SalFrame* GetParent() const override; virtual void SetWindowState(const vcl::WindowData*) override; virtual bool GetWindowState(vcl::WindowData*) override; diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h index 03f627b5abb2..cf1a6ecb4419 100644 --- a/vcl/inc/win/salsys.h +++ b/vcl/inc/win/salsys.h @@ -31,11 +31,11 @@ public: struct DisplayMonitor { OUString m_aName; - tools::Rectangle m_aArea; + AbsoluteScreenPixelRectangle m_aArea; DisplayMonitor() {} DisplayMonitor( const OUString& rName, - const tools::Rectangle& rArea ) + const AbsoluteScreenPixelRectangle& rArea ) : m_aName( rName ), m_aArea( rArea ) { @@ -51,7 +51,7 @@ public: virtual unsigned int GetDisplayScreenCount() override; virtual unsigned int GetDisplayBuiltInScreen() override; - virtual tools::Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; + virtual AbsoluteScreenPixelRectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override; virtual int ShowNativeMessageBox( const OUString& rTitle, const OUString& rMessage) override; bool initMonitors(); diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index a82cf9d2ebb0..9ecb6cfd2423 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -402,7 +402,7 @@ void AquaSalFrame::initShow() mbInitShow = false; if( ! mbPositioned && ! mbFullScreen ) { - tools::Rectangle aScreenRect; + AbsoluteScreenPixelRectangle aScreenRect; GetWorkArea( aScreenRect ); if( mpParent ) // center relative to parent { @@ -1613,12 +1613,12 @@ void AquaSalFrame::SetPosSize( } } -void AquaSalFrame::GetWorkArea( tools::Rectangle& rRect ) +void AquaSalFrame::GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) { if (!mpNSWindow) { if (Application::IsBitmapRendering()) - rRect = tools::Rectangle(Point(0, 0), Size(1024, 768)); + rRect = AbsoluteScreenPixelRectangle(AbsoluteScreenPixelPoint(0, 0), AbsoluteScreenPixelSize(1024, 768)); return; } diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index bc2c5bed7cce..7606df69ce80 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -301,7 +301,7 @@ bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectan // do the same strange semantics as vcl popup windows to arrive at a frame geometry // in mirrored UI case; best done by actually executing the same code sal_uInt16 nArrangeIndex; - pWin->SetPosPixel( FloatingWindow::ImplCalcPos( pWin, rRect, nFlags, nArrangeIndex ) ); + pWin->SetPosPixel( ::Point(FloatingWindow::ImplCalcPos( pWin, rRect, nFlags, nArrangeIndex )) ); displayPopupFrame.origin.x = pWin->ImplGetFrame()->maGeometry.x() - pParentAquaSalFrame->maGeometry.x() + offset; displayPopupFrame.origin.y = pWin->ImplGetFrame()->maGeometry.y() - pParentAquaSalFrame->maGeometry.y() + offset; pParentAquaSalFrame->VCLToCocoa(displayPopupFrame, false); diff --git a/vcl/osx/salsys.cxx b/vcl/osx/salsys.cxx index 80b53b785266..37ad48e7dcbd 100644 --- a/vcl/osx/salsys.cxx +++ b/vcl/osx/salsys.cxx @@ -38,18 +38,18 @@ unsigned int AquaSalSystem::GetDisplayScreenCount() return pScreens ? [pScreens count] : 1; } -tools::Rectangle AquaSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) +AbsoluteScreenPixelRectangle AquaSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) { if (Application::IsBitmapRendering()) { - tools::Rectangle aRect; + AbsoluteScreenPixelRectangle aRect; if (nScreen == 0) - aRect = tools::Rectangle(Point(0,0), Size(1024, 768)); + aRect = AbsoluteScreenPixelRectangle(AbsoluteScreenPixelPoint(0,0), AbsoluteScreenPixelSize(1024, 768)); return aRect; } NSArray* pScreens = [NSScreen screens]; - tools::Rectangle aRet; + AbsoluteScreenPixelRectangle aRet; NSScreen* pScreen = nil; if( pScreens && nScreen < [pScreens count] ) pScreen = [pScreens objectAtIndex: nScreen]; @@ -59,8 +59,9 @@ tools::Rectangle AquaSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScre if( pScreen ) { NSRect aFrame = [pScreen frame]; - aRet = tools::Rectangle( Point( static_cast<tools::Long>(aFrame.origin.x), static_cast<tools::Long>(aFrame.origin.y) ), - Size( static_cast<tools::Long>(aFrame.size.width), static_cast<tools::Long>(aFrame.size.height) ) ); + aRet = AbsoluteScreenPixelRectangle( + AbsoluteScreenPixelPoint( static_cast<tools::Long>(aFrame.origin.x), static_cast<tools::Long>(aFrame.origin.y) ), + AbsoluteScreenPixelSize( static_cast<tools::Long>(aFrame.size.width), static_cast<tools::Long>(aFrame.size.height) ) ); } return aRet; } diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 0bd436266714..5c9947922f47 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -591,7 +591,7 @@ void QtFrame::GetClientSize(tools::Long& rWidth, tools::Long& rHeight) rHeight = round(m_pQWidget->height() * devicePixelRatioF()); } -void QtFrame::GetWorkArea(tools::Rectangle& rRect) +void QtFrame::GetWorkArea(AbsoluteScreenPixelRectangle& rRect) { if (!isWindow()) return; @@ -600,7 +600,7 @@ void QtFrame::GetWorkArea(tools::Rectangle& rRect) return; QSize aSize = pScreen->availableVirtualSize() * devicePixelRatioF(); - rRect = tools::Rectangle(0, 0, aSize.width(), aSize.height()); + rRect = AbsoluteScreenPixelRectangle(0, 0, aSize.width(), aSize.height()); } SalFrame* QtFrame::GetParent() const { return m_pParent; } diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index b1e62bc09475..cd42139e713b 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -885,7 +885,7 @@ bool QtMenu::ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangle& r mpQMenu->setTearOffEnabled(bool(nFlags & FloatWinPopupFlags::AllowTearOff)); const VclPtr<vcl::Window> xParent = pWin->ImplGetWindowImpl()->mpRealParent; - tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect); + AbsoluteScreenPixelRectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect); // tdf#154447 Menu bar height has to be added QtFrame* pFrame = static_cast<QtFrame*>(pWin->ImplGetFrame()); diff --git a/vcl/qt5/QtSystem.cxx b/vcl/qt5/QtSystem.cxx index 5f5f4ad284e5..d43e47832faa 100644 --- a/vcl/qt5/QtSystem.cxx +++ b/vcl/qt5/QtSystem.cxx @@ -16,10 +16,10 @@ unsigned int QtSystem::GetDisplayScreenCount() { return QGuiApplication::screens().size(); } -tools::Rectangle QtSystem::GetDisplayScreenPosSizePixel(unsigned int nScreen) +AbsoluteScreenPixelRectangle QtSystem::GetDisplayScreenPosSizePixel(unsigned int nScreen) { QRect qRect = QGuiApplication::screens().at(nScreen)->geometry(); - return toRectangle(scaledQRect(qRect, qApp->devicePixelRatio())); + return AbsoluteScreenPixelRectangle(toRectangle(scaledQRect(qRect, qApp->devicePixelRatio()))); } int QtSystem::ShowNativeDialog(const OUString&, const OUString&, const std::vector<OUString>&) diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index 2ed0f96ec15d..bbdb0ea3c6f1 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -582,17 +582,17 @@ void ImplDestroyHelpWindow(ImplSVHelpData& rHelpData, bool bUpdateHideTime) void ImplSetHelpWindowPos( vcl::Window* pHelpWin, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, const Point& rPos, const tools::Rectangle& rHelpArea ) { - Point aPos; - Size aSz = pHelpWin->GetSizePixel(); - tools::Rectangle aScreenRect = pHelpWin->ImplGetFrameWindow()->GetDesktopRectPixel(); + AbsoluteScreenPixelPoint aPos; + AbsoluteScreenPixelSize aSz( pHelpWin->GetSizePixel() ); + AbsoluteScreenPixelRectangle aScreenRect = pHelpWin->ImplGetFrameWindow()->GetDesktopRectPixel(); vcl::Window* pWindow = pHelpWin->GetParent()->ImplGetFrameWindow(); // get mouse screen coords - Point aMousePos(pWindow->OutputToAbsoluteScreenPixel(pWindow->GetPointerPosPixel())); + AbsoluteScreenPixelPoint aMousePos(pWindow->OutputToAbsoluteScreenPixel(pWindow->GetPointerPosPixel())); if ( nStyle & QuickHelpFlags::NoAutoPos ) { // convert help area to screen coords - tools::Rectangle devHelpArea( + AbsoluteScreenPixelRectangle devHelpArea( pWindow->OutputToAbsoluteScreenPixel( rHelpArea.TopLeft() ), pWindow->OutputToAbsoluteScreenPixel( rHelpArea.BottomRight() ) ); @@ -666,12 +666,12 @@ void ImplSetHelpWindowPos( vcl::Window* pHelpWin, sal_uInt16 nHelpWinStyle, Quic // the popup must not appear under the mouse // otherwise it would directly be closed due to a focus change... */ - tools::Rectangle aHelpRect( aPos, aSz ); + AbsoluteScreenPixelRectangle aHelpRect( aPos, aSz ); if( aHelpRect.Contains( aMousePos ) ) { - Point delta(2,2); - Point aSize( aSz.Width(), aSz.Height() ); - Point aTest( aMousePos - aSize - delta ); + AbsoluteScreenPixelPoint delta(2,2); + AbsoluteScreenPixelPoint aSize( aSz.Width(), aSz.Height() ); + AbsoluteScreenPixelPoint aTest( aMousePos - aSize - delta ); if( aTest.X() > aScreenRect.Left() && aTest.Y() > aScreenRect.Top() ) aPos = aTest; else @@ -679,8 +679,8 @@ void ImplSetHelpWindowPos( vcl::Window* pHelpWin, sal_uInt16 nHelpWinStyle, Quic } } - aPos = pWindow->AbsoluteScreenToOutputPixel( aPos ); - pHelpWin->SetPosPixel( aPos ); + Point aPosOut = pWindow->AbsoluteScreenToOutputPixel( aPos ); + pHelpWin->SetPosPixel( aPosOut ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 2716a219fb81..f5275eb5c68e 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1604,7 +1604,7 @@ Size SalInstanceWindow::get_size() const { return m_xWindow->GetSizePixel(); } Point SalInstanceWindow::get_position() const { return m_xWindow->GetPosPixel(); } -tools::Rectangle SalInstanceWindow::get_monitor_workarea() const +AbsoluteScreenPixelRectangle SalInstanceWindow::get_monitor_workarea() const { return m_xWindow->GetDesktopRectPixel(); } @@ -6286,7 +6286,7 @@ a11yrelationset SalInstanceDrawingArea::get_accessible_relation_set() return pRelationSetHelper; } -Point SalInstanceDrawingArea::get_accessible_location_on_screen() +AbsoluteScreenPixelPoint SalInstanceDrawingArea::get_accessible_location_on_screen() { return m_xDrawingArea->OutputToAbsoluteScreenPixel(Point()); } diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index e7d88fe41394..6fed89a5fdd7 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1251,25 +1251,25 @@ unsigned int Application::GetDisplayExternalScreen() return nExternal; } -tools::Rectangle Application::GetScreenPosSizePixel( unsigned int nScreen ) +AbsoluteScreenPixelRectangle Application::GetScreenPosSizePixel( unsigned int nScreen ) { SalSystem* pSys = ImplGetSalSystem(); if (!pSys) { SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen << " failed"); assert(false); - return tools::Rectangle(); + return AbsoluteScreenPixelRectangle(); } - tools::Rectangle aRect = pSys->GetDisplayScreenPosSizePixel(nScreen); + AbsoluteScreenPixelRectangle aRect = pSys->GetDisplayScreenPosSizePixel(nScreen); if (aRect.GetHeight() == 0) SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen << " returned 0 height."); return aRect; } namespace { -tools::Long calcDistSquare( const Point& i_rPoint, const tools::Rectangle& i_rRect ) +tools::Long calcDistSquare( const AbsoluteScreenPixelPoint& i_rPoint, const AbsoluteScreenPixelRectangle& i_rRect ) { - const Point aRectCenter( (i_rRect.Left() + i_rRect.Right())/2, + const AbsoluteScreenPixelPoint aRectCenter( (i_rRect.Left() + i_rRect.Right())/2, (i_rRect.Top() + i_rRect.Bottom())/ 2 ); const tools::Long nDX = aRectCenter.X() - i_rPoint.X(); const tools::Long nDY = aRectCenter.Y() - i_rPoint.Y(); @@ -1277,19 +1277,19 @@ tools::Long calcDistSquare( const Point& i_rPoint, const tools::Rectangle& i_rRe } } -unsigned int Application::GetBestScreen( const tools::Rectangle& i_rRect ) +unsigned int Application::GetBestScreen( const AbsoluteScreenPixelRectangle& i_rRect ) { const unsigned int nScreens = GetScreenCount(); unsigned int nBestMatchScreen = 0; unsigned long nOverlap = 0; for( unsigned int i = 0; i < nScreens; i++ ) { - const tools::Rectangle aCurScreenRect( GetScreenPosSizePixel( i ) ); + const AbsoluteScreenPixelRectangle aCurScreenRect( GetScreenPosSizePixel( i ) ); // if a screen contains the rectangle completely it is obviously the best screen if( aCurScreenRect.Contains( i_rRect ) ) return i; // next the screen which contains most of the area of the rect is the best - tools::Rectangle aIntersection( aCurScreenRect.GetIntersection( i_rRect ) ); + AbsoluteScreenPixelRectangle aIntersection( aCurScreenRect.GetIntersection( i_rRect ) ); if( ! aIntersection.IsEmpty() ) { const unsigned long nCurOverlap( aIntersection.GetWidth() * aIntersection.GetHeight() ); @@ -1304,12 +1304,12 @@ unsigned int Application::GetBestScreen( const tools::Rectangle& i_rRect ) return nBestMatchScreen; // finally the screen which center is nearest to the rect is the best - const Point aCenter( (i_rRect.Left() + i_rRect.Right())/2, + const AbsoluteScreenPixelPoint aCenter( (i_rRect.Left() + i_rRect.Right())/2, (i_rRect.Top() + i_rRect.Bottom())/2 ); tools::Long nDist = std::numeric_limits<tools::Long>::max(); for( unsigned int i = 0; i < nScreens; i++ ) { - const tools::Rectangle aCurScreenRect( GetScreenPosSizePixel( i ) ); + const AbsoluteScreenPixelRectangle aCurScreenRect( GetScreenPosSizePixel( i ) ); const tools::Long nCurDist( calcDistSquare( aCenter, aCurScreenRect ) ); if( nCurDist < nDist ) { diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx index f67ea73d89a3..cbe0356a8e1f 100644 --- a/vcl/source/app/weldutils.cxx +++ b/vcl/source/app/weldutils.cxx @@ -607,11 +607,11 @@ IMPL_LINK_NOARG(ButtonPressRepeater, RepeatTimerHdl, Timer*, void) weld::Window* GetPopupParent(vcl::Window& rOutWin, tools::Rectangle& rRect) { rRect.SetPos(rOutWin.OutputToScreenPixel(rRect.TopLeft())); - rRect = FloatingWindow::ImplConvertToAbsPos(&rOutWin, rRect); + AbsoluteScreenPixelRectangle aRectAbs = FloatingWindow::ImplConvertToAbsPos(&rOutWin, rRect); vcl::Window* pWin = rOutWin.GetFrameWindow(); - rRect = FloatingWindow::ImplConvertToRelPos(pWin, rRect); + rRect = FloatingWindow::ImplConvertToRelPos(pWin, aRectAbs); rRect.SetPos(pWin->ScreenToOutputPixel(rRect.TopLeft())); return rOutWin.GetFrameWeld(); diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index fb610c116767..05b7a50006b9 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1458,8 +1458,8 @@ tools::Long ComboBox::GetIndexForPoint( const Point& rPoint, sal_Int32& rPos ) c // convert coordinates to ImplListBoxWindow pixel coordinate space Point aConvPoint = LogicToPixel( rPoint ); - aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint ); - aConvPoint = rMain->AbsoluteScreenToOutputPixel( aConvPoint ); + AbsoluteScreenPixelPoint aConvPointAbs = OutputToAbsoluteScreenPixel( aConvPoint ); + aConvPoint = rMain->AbsoluteScreenToOutputPixel( aConvPointAbs ); aConvPoint = rMain->PixelToLogic( aConvPoint ); // try to find entry diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index 79b971636125..7e87ae390185 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -661,8 +661,8 @@ tools::Long ListBox::GetIndexForPoint( const Point& rPoint, sal_Int32& rPos ) co // Convert coordinates to ImplListBoxWindow pixel coordinate space Point aConvPoint = LogicToPixel( rPoint ); - aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint ); - aConvPoint = rMain->AbsoluteScreenToOutputPixel( aConvPoint ); + AbsoluteScreenPixelPoint aConvPointAbs = OutputToAbsoluteScreenPixel( aConvPoint ); + aConvPoint = rMain->AbsoluteScreenToOutputPixel( aConvPointAbs ); aConvPoint = rMain->PixelToLogic( aConvPoint ); // Try to find entry @@ -674,8 +674,8 @@ tools::Long ListBox::GetIndexForPoint( const Point& rPoint, sal_Int32& rPos ) co { // Convert to impl window pixel coordinates aConvPoint = LogicToPixel( rPoint ); - aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint ); - aConvPoint = mpImplWin->AbsoluteScreenToOutputPixel( aConvPoint ); + aConvPointAbs = OutputToAbsoluteScreenPixel( aConvPoint ); + aConvPoint = mpImplWin->AbsoluteScreenToOutputPixel( aConvPointAbs ); // Check whether converted point is inside impl window Size aImplWinSize = mpImplWin->GetOutputSizePixel(); diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index a3ff58dcdd46..7458a67fd9f5 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -776,7 +776,7 @@ tools::Rectangle SvHeaderTabListBox::calcHeaderRect( bool _bIsColumnBar, bool _b tools::Rectangle SvHeaderTabListBox::calcTableRect( bool _bOnScreen ) { if ( _bOnScreen ) - return GetWindowExtentsAbsolute(); + return tools::Rectangle(GetWindowExtentsAbsolute()); else return GetWindowExtentsRelative( *GetAccessibleParentWindow() ); } @@ -797,7 +797,7 @@ tools::Rectangle SvHeaderTabListBox::GetFieldRectPixel( sal_Int32 _nRow, sal_uIn aRect = tools::Rectangle( aTopLeft, aSize ); aTopLeft = aRect.TopLeft(); if (_bOnScreen) - aTopLeft += GetWindowExtentsAbsolute().TopLeft(); + aTopLeft += Point(GetWindowExtentsAbsolute().TopLeft()); else aTopLeft += GetWindowExtentsRelative( *GetAccessibleParentWindow() ).TopLeft(); aRect = tools::Rectangle( aTopLeft, aRect.GetSize() ); @@ -1048,7 +1048,7 @@ bool SvHeaderTabListBox::GetGlyphBoundRects( const Point& rOrigin, const OUStrin return GetOutDev()->GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector ); } -tools::Rectangle SvHeaderTabListBox::GetWindowExtentsAbsolute() const +AbsoluteScreenPixelRectangle SvHeaderTabListBox::GetWindowExtentsAbsolute() const { return Control::GetWindowExtentsAbsolute(); } diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index b8a44ed2a1db..f0d8e3bed83f 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -1372,11 +1372,11 @@ void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, con if (pWin) { vcl::Region aClipRgn(aInRect); - tools::Rectangle aItemClipRect(pWin->ImplGetItemEdgeClipRect()); + AbsoluteScreenPixelRectangle aItemClipRect(pWin->ImplGetItemEdgeClipRect()); if (!aItemClipRect.IsEmpty()) { - aItemClipRect.SetPos(pData->mpBorderWindow->AbsoluteScreenToOutputPixel(aItemClipRect.TopLeft())); - aClipRgn.Exclude(aItemClipRect); + tools::Rectangle aTmp(pData->mpBorderWindow->AbsoluteScreenToOutputPixel(aItemClipRect.TopLeft()), aItemClipRect.GetSize()); + aClipRgn.Exclude(aTmp); rRenderContext.SetClipRegion(aClipRgn); } } diff --git a/vcl/source/window/bubblewindow.cxx b/vcl/source/window/bubblewindow.cxx index 9b8432a14a9a..aa9e51dfa364 100644 --- a/vcl/source/window/bubblewindow.cxx +++ b/vcl/source/window/bubblewindow.cxx @@ -163,7 +163,7 @@ void BubbleWindow::Show( bool bVisible ) Point aPos; aPos.setX( maTipPos.X() - aWindowSize.Width() + TIP_RIGHT_OFFSET ); aPos.setY( maTipPos.Y() ); - Point aScreenPos = GetParent()->OutputToAbsoluteScreenPixel( aPos ); + AbsoluteScreenPixelPoint aScreenPos = GetParent()->OutputToAbsoluteScreenPixel( aPos ); if ( aScreenPos.X() < 0 ) { mnTipOffset = aScreenPos.X(); diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 029438ba6ccc..3f8853877b08 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -925,11 +925,11 @@ Point DockingWindow::GetFloatingPos() const vcl::WindowData aData; aData.setMask(vcl::WindowDataMask::Pos); pWrapper->mpFloatWin->GetWindowState( aData ); - Point aPos(aData.x(), aData.y()); + AbsoluteScreenPixelPoint aPos(aData.x(), aData.y()); // LOK needs logic coordinates not absolute screen position for autofilter menu if (!comphelper::LibreOfficeKit::isActive() || get_id() != "check_list_menu") - aPos = pWrapper->mpFloatWin->GetParent()->ImplGetFrameWindow()->AbsoluteScreenToOutputPixel( aPos ); - return aPos; + return pWrapper->mpFloatWin->GetParent()->ImplGetFrameWindow()->AbsoluteScreenToOutputPixel( aPos ); + return Point(aPos); } else return maFloatPos; @@ -940,9 +940,8 @@ Point DockingWindow::GetFloatingPos() const vcl::WindowData aData; aData.setMask(vcl::WindowDataMask::Pos); mpFloatWin->GetWindowState( aData ); - Point aPos(aData.x(), aData.y()); - aPos = mpFloatWin->GetParent()->ImplGetFrameWindow()->AbsoluteScreenToOutputPixel( aPos ); - return aPos; + AbsoluteScreenPixelPoint aPos(aData.x(), aData.y()); + return mpFloatWin->GetParent()->ImplGetFrameWindow()->AbsoluteScreenToOutputPixel( aPos ); } else return maFloatPos; @@ -989,7 +988,7 @@ void DockingWindow::setOptimalLayoutSize() //resize DockingWindow to fit requisition on initial show Size aSize = get_preferred_size(); - Size aMax(bestmaxFrameSizeForScreenSize(GetDesktopRectPixel().GetSize())); + Size aMax(bestmaxFrameSizeForScreenSize(Size(GetDesktopRectPixel().GetSize()))); aSize.setWidth( std::min(aMax.Width(), aSize.Width()) ); aSize.setHeight( std::min(aMax.Height(), aSize.Height()) ); diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 3aff8ef400c0..170567f62794 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -40,7 +40,7 @@ public: ImplData(); VclPtr<ToolBox> mpBox; - tools::Rectangle maItemEdgeClipRect; // used to clip the common edge between a toolbar item and the border of this window + AbsoluteScreenPixelRectangle maItemEdgeClipRect; // used to clip the common edge between a toolbar item and the border of this window Point maPos; // position of the floating window wrt. parent Point maLOKTwipsPos; ///< absolute position of the floating window in the document - in twips (for toplevel floating windows). }; @@ -50,7 +50,7 @@ FloatingWindow::ImplData::ImplData() mpBox = nullptr; } -tools::Rectangle FloatingWindow::ImplGetItemEdgeClipRect() const +AbsoluteScreenPixelRectangle FloatingWindow::ImplGetItemEdgeClipRect() { return mpImplData->maItemEdgeClipRect; } @@ -233,9 +233,9 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, sal_uInt16& rArrangeIndex, Point* pLOKTwipsPos) { // get window position - Point aPos; + AbsoluteScreenPixelPoint aPos; Size aSize = ::isLayoutEnabled(pWindow) ? pWindow->get_preferred_size() : pWindow->GetSizePixel(); - tools::Rectangle aScreenRect = pWindow->ImplGetFrameWindow()->GetDesktopRectPixel(); + AbsoluteScreenPixelRectangle aScreenRect = pWindow->ImplGetFrameWindow()->GetDesktopRectPixel(); FloatingWindow *pFloatingWindow = dynamic_cast<FloatingWindow*>( pWindow ); // convert... @@ -248,10 +248,10 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, bool bRTL = AllSettings::GetLayoutRTL(); - tools::Rectangle devRect( pW->OutputToAbsoluteScreenPixel( normRect.TopLeft() ), + AbsoluteScreenPixelRectangle devRect( pW->OutputToAbsoluteScreenPixel( normRect.TopLeft() ), pW->OutputToAbsoluteScreenPixel( normRect.BottomRight() ) ); - tools::Rectangle devRectRTL( devRect ); + AbsoluteScreenPixelRectangle devRectRTL( devRect ); if( bRTL ) // create a rect that can be compared to desktop coordinates devRectRTL = pW->ImplOutputToUnmirroredAbsoluteScreenPixel( normRect ); @@ -261,7 +261,7 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, FloatWinPopupFlags nArrangeAry[5]; sal_uInt16 nArrangeAttempts = 5; - Point e1,e2; // the common edge between the item rect and the floating window + AbsoluteScreenPixelPoint e1,e2; // the common edge between the item rect and the floating window if ( nFlags & FloatWinPopupFlags::Left ) { @@ -445,13 +445,13 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, rArrangeIndex = nArrangeIndex; - aPos = pW->AbsoluteScreenToOutputPixel( aPos ); + Point aPosOut = pW->AbsoluteScreenToOutputPixel( aPos ); // store a cliprect that can be used to clip the common edge of the itemrect and the floating window if( pFloatingWindow && pFloatingWindow->mpImplData->mpBox ) { pFloatingWindow->mpImplData->maItemEdgeClipRect = - tools::Rectangle( e1, e2 ); + AbsoluteScreenPixelRectangle( e1, e2 ); } if (bLOKActive && pLOKTwipsPos) @@ -466,44 +466,41 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, // and anyway the following is what we already do in // ScGridWindow::LogicInvalidate when map mode is not enabled. - *pLOKTwipsPos = pW->PixelToLogic(aPos, MapMode(MapUnit::MapTwip)); + *pLOKTwipsPos = pW->PixelToLogic(aPosOut, MapMode(MapUnit::MapTwip)); } else { - *pLOKTwipsPos = OutputDevice::LogicToLogic(aPos, pW->GetMapMode(), MapMode(MapUnit::MapTwip)); + *pLOKTwipsPos = OutputDevice::LogicToLogic(aPosOut, pW->GetMapMode(), MapMode(MapUnit::MapTwip)); } } // caller expects coordinates relative to top-level win - return pW->OutputToScreenPixel( aPos ); + return pW->OutputToScreenPixel( aPosOut ); } -Point FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos) +AbsoluteScreenPixelPoint FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos) { - Point aAbsolute( rPos ); - const OutputDevice *pWindowOutDev = pReference->GetOutDev(); // compare coordinates in absolute screen coordinates if ( pWindowOutDev->HasMirroredGraphics() && !comphelper::LibreOfficeKit::isActive() ) { + Point aTmp(rPos); if(!pReference->IsRTLEnabled() ) - pWindowOutDev->ReMirror( aAbsolute ); + pWindowOutDev->ReMirror( aTmp ); - tools::Rectangle aRect( pReference->ScreenToOutputPixel(aAbsolute), Size(1,1) ) ; - aRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel( aRect ); - aAbsolute = aRect.TopLeft(); + tools::Rectangle aRect( pReference->ScreenToOutputPixel(aTmp), Size(1,1) ) ; + aRect = tools::Rectangle(pReference->ImplOutputToUnmirroredAbsoluteScreenPixel( aRect )); + return AbsoluteScreenPixelPoint(aRect.TopLeft()); } else - aAbsolute = pReference->OutputToAbsoluteScreenPixel( + return pReference->OutputToAbsoluteScreenPixel( pReference->ScreenToOutputPixel(rPos) ); - - return aAbsolute; } -tools::Rectangle FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, const tools::Rectangle& rRect) +AbsoluteScreenPixelRectangle FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, const tools::Rectangle& rRect) { - tools::Rectangle aFloatRect = rRect; + AbsoluteScreenPixelRectangle aFloatRect; const OutputDevice *pParentWinOutDev = pReference->GetOutDev(); @@ -511,21 +508,24 @@ tools::Rectangle FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, co // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509 if( pParentWinOutDev->HasMirroredGraphics() && !comphelper::LibreOfficeKit::isActive() ) { + tools::Rectangle aScreenRect(rRect); if(!pReference->IsRTLEnabled() ) - pParentWinOutDev->ReMirror(aFloatRect); + pParentWinOutDev->ReMirror(aScreenRect); - aFloatRect.SetPos(pReference->ScreenToOutputPixel(aFloatRect.TopLeft())); - aFloatRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel(aFloatRect); + tools::Rectangle aOutRect(pReference->ScreenToOutputPixel(aScreenRect.TopLeft()), aScreenRect.GetSize()); + aFloatRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel(aOutRect); } else - aFloatRect.SetPos(pReference->OutputToAbsoluteScreenPixel(pReference->ScreenToOutputPixel(rRect.TopLeft()))); + aFloatRect = AbsoluteScreenPixelRectangle( + pReference->OutputToAbsoluteScreenPixel(pReference->ScreenToOutputPixel(rRect.TopLeft())), + rRect.GetSize()); return aFloatRect; } -tools::Rectangle FloatingWindow::ImplConvertToRelPos(vcl::Window* pReference, const tools::Rectangle& rRect) +tools::Rectangle FloatingWindow::ImplConvertToRelPos(vcl::Window* pReference, const AbsoluteScreenPixelRectangle& rRect) { - tools::Rectangle aFloatRect = rRect; + tools::Rectangle aFloatRect; const OutputDevice *pParentWinOutDev = pReference->GetOutDev(); @@ -533,7 +533,7 @@ tools::Rectangle FloatingWindow::ImplConvertToRelPos(vcl::Window* pReference, co // Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509 if( pParentWinOutDev->HasMirroredGraphics() ) { - aFloatRect = pReference->ImplUnmirroredAbsoluteScreenToOutputPixel(aFloatRect); + aFloatRect = pReference->ImplUnmirroredAbsoluteScreenToOutputPixel(rRect); aFloatRect.SetPos(pReference->OutputToScreenPixel(aFloatRect.TopLeft())); if(!pReference->IsRTLEnabled() ) @@ -550,7 +550,7 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( vcl::Window* pReference, const FloatingWindow* pWin = this; rbHitTestInsideRect = false; - Point aAbsolute(FloatingWindow::ImplConvertToAbsPos(pReference, rPos)); + AbsoluteScreenPixelPoint aAbsolute(FloatingWindow::ImplConvertToAbsPos(pReference, rPos)); do { @@ -562,7 +562,7 @@ FloatingWindow* FloatingWindow::ImplFloatHitTest( vcl::Window* pReference, const break; // the top-left corner in output coordinates ie (0,0) - tools::Rectangle devRect( pBorderWin->ImplOutputToUnmirroredAbsoluteScreenPixel( tools::Rectangle( Point(), pBorderWin->GetSizePixel()) ) ) ; + AbsoluteScreenPixelRectangle devRect( pBorderWin->ImplOutputToUnmirroredAbsoluteScreenPixel( tools::Rectangle( Point(), pBorderWin->GetSizePixel()) ) ) ; if ( devRect.Contains( aAbsolute ) ) { // inside the window diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index b33219c82c8d..9a90b03ef93b 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2907,15 +2907,15 @@ bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>& pParentWin, tools::Rectang Size aSz = ImplCalcSize( pWin ); - tools::Rectangle aDesktopRect(pWin->GetDesktopRectPixel()); + AbsoluteScreenPixelRectangle aDesktopRect(pWin->GetDesktopRectPixel()); if( Application::GetScreenCount() > 1 ) { vcl::Window* pDeskW = pWindow->GetWindow( GetWindowType::RealParent ); if( ! pDeskW ) pDeskW = pWindow; - Point aDesktopTL(pDeskW->OutputToAbsoluteScreenPixel(rRect.TopLeft())); + AbsoluteScreenPixelPoint aDesktopTL(pDeskW->OutputToAbsoluteScreenPixel(rRect.TopLeft())); aDesktopRect = Application::GetScreenPosSizePixel( - Application::GetBestScreen(tools::Rectangle(aDesktopTL, rRect.GetSize()))); + Application::GetBestScreen(AbsoluteScreenPixelRectangle(aDesktopTL, rRect.GetSize()))); } tools::Long nMaxHeight = aDesktopRect.GetHeight(); @@ -2930,7 +2930,7 @@ bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>& pParentWin, tools::Rectang if ( pRef->GetParent() ) pRef = pRef->GetParent(); - tools::Rectangle devRect(pRef->OutputToAbsoluteScreenPixel(rRect.TopLeft()), + AbsoluteScreenPixelRectangle devRect(pRef->OutputToAbsoluteScreenPixel(rRect.TopLeft()), pRef->OutputToAbsoluteScreenPixel(rRect.BottomRight())); tools::Long nHeightAbove = devRect.Top() - aDesktopRect.Top(); diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index b2945bde49f7..23f4cfc086bf 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -502,8 +502,8 @@ void DrawProgress(vcl::Window* pWindow, vcl::RenderContext& rRenderContext, cons else { // restore transparent background - Point aTL(pWindow->OutputToAbsoluteScreenPixel(rFramePosSize.TopLeft())); - aTL = pEraseWindow->AbsoluteScreenToOutputPixel(aTL); + AbsoluteScreenPixelPoint aTL1(pWindow->OutputToAbsoluteScreenPixel(rFramePosSize.TopLeft())); + Point aTL = pEraseWindow->AbsoluteScreenToOutputPixel(aTL1); tools::Rectangle aRect(aTL, rFramePosSize.GetSize()); pEraseWindow->Invalidate(aRect, InvalidateFlags::NoChildren | InvalidateFlags::NoClipChildren | diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index d1071afbfd2c..6584c1e3b04c 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -567,7 +567,7 @@ OUString vcl::WindowData::toStr() const void SystemWindow::ImplMoveToScreen( tools::Long& io_rX, tools::Long& io_rY, tools::Long i_nWidth, tools::Long i_nHeight, vcl::Window const * i_pConfigureWin ) { - tools::Rectangle aScreenRect = Application::GetScreenPosSizePixel( 0 ); + AbsoluteScreenPixelRectangle aScreenRect = Application::GetScreenPosSizePixel( 0 ); for( unsigned int i = 1; i < Application::GetScreenCount(); i++ ) aScreenRect.Union( Application::GetScreenPosSizePixel( i ) ); // unfortunately most of the time width and height are not really known @@ -662,7 +662,7 @@ void SystemWindow::SetWindowState(const vcl::WindowData& rData) if( !((rData.mask() & vcl::WindowDataMask::State) && (nState & vcl::WindowState::Maximized)) ) if (rData.mask() & vcl::WindowDataMask::PosSize) { - tools::Rectangle aDesktop = GetDesktopRectPixel(); + AbsoluteScreenPixelRectangle aDesktop = GetDesktopRectPixel(); ImplSVData *pSVData = ImplGetSVData(); vcl::Window *pWin = pSVData->maFrameData.mpFirstFrame; bool bWrapped = false; @@ -1069,7 +1069,7 @@ void SystemWindow::setOptimalLayoutSize(bool bAllowWindowShrink) Size aSize = get_preferred_size(); - Size aMax(bestmaxFrameSizeForScreenSize(GetDesktopRectPixel().GetSize())); + Size aMax(bestmaxFrameSizeForScreenSize(Size(GetDesktopRectPixel().GetSize()))); aSize.setWidth( std::min(aMax.Width(), aSize.Width()) ); aSize.setHeight( std::min(aMax.Height(), aSize.Height()) ); diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx index 833c82a0a114..16747f0c08e1 100644 --- a/vcl/source/window/taskpanelist.cxx +++ b/vcl/source/window/taskpanelist.cxx @@ -28,17 +28,17 @@ namespace { -Point ImplTaskPaneListGetPos( const vcl::Window *w ) +AbsoluteScreenPixelPoint ImplTaskPaneListGetPos( const vcl::Window *w ) { - Point pos; + AbsoluteScreenPixelPoint pos; if( w->IsDockingWindow() ) { - pos = static_cast<const DockingWindow*>(w)->GetPosPixel(); + Point pos1 = static_cast<const DockingWindow*>(w)->GetPosPixel(); vcl::Window *pF = static_cast<const DockingWindow*>(w)->GetFloatingWindow(); if( pF ) - pos = pF->OutputToAbsoluteScreenPixel( pF->ScreenToOutputPixel( pos ) ); + pos = pF->OutputToAbsoluteScreenPixel( pF->ScreenToOutputPixel( pos1 ) ); else - pos = w->OutputToAbsoluteScreenPixel( pos ); + pos = w->OutputToAbsoluteScreenPixel( pos1 ); } else pos = w->OutputToAbsoluteScreenPixel( w->GetPosPixel() ); diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 699080f9a530..c799495b9b0a 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -790,14 +790,14 @@ Point ToolBox::ImplGetPopupPosition( const tools::Rectangle& rRect ) const Point aPos; if( !rRect.IsEmpty() ) { - tools::Rectangle aScreen = GetDesktopRectPixel(); + AbsoluteScreenPixelRectangle aScreen = GetDesktopRectPixel(); // the popup should be positioned so that it will not cover // the item rect and that it fits the desktop // the preferred direction is always towards the center of // the application window - Point devPos; // the position in device coordinates for screen comparison + AbsoluteScreenPixelPoint devPos; // the position in device coordinates for screen comparison switch( meAlign ) { case WindowAlign::Top: diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index bcbc4e5458c8..f7920f793f43 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -2796,9 +2796,9 @@ Point Window::GetPosPixel() const return mpWindowImpl->maPos; } -tools::Rectangle Window::GetDesktopRectPixel() const +AbsoluteScreenPixelRectangle Window::GetDesktopRectPixel() const { - tools::Rectangle rRect; + AbsoluteScreenPixelRectangle rRect; mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrame->GetWorkArea( rRect ); return rRect; } @@ -2852,27 +2852,27 @@ Point Window::NormalizedScreenToOutputPixel( const Point& rPos ) const return Point( rPos.X()-offx, rPos.Y() - GetOutDev()->mnOutOffY ); } -Point Window::OutputToAbsoluteScreenPixel( const Point& rPos ) const +AbsoluteScreenPixelPoint Window::OutputToAbsoluteScreenPixel( const Point& rPos ) const { // relative to the screen Point p = OutputToScreenPixel( rPos ); SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); p.AdjustX(g.x() ); p.AdjustY(g.y() ); - return p; + return AbsoluteScreenPixelPoint(p); } -Point Window::AbsoluteScreenToOutputPixel( const Point& rPos ) const +Point Window::AbsoluteScreenToOutputPixel( const AbsoluteScreenPixelPoint& rPos ) const { // relative to the screen - Point p = ScreenToOutputPixel( rPos ); + Point p = ScreenToOutputPixel( Point(rPos) ); SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry(); p.AdjustX( -(g.x()) ); p.AdjustY( -(g.y()) ); return p; } -tools::Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle &rRect ) const +AbsoluteScreenPixelRectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle &rRect ) const { // this method creates unmirrored screen coordinates to be compared with the desktop // and is used for positioning of RTL popup windows correctly on the screen @@ -2888,20 +2888,20 @@ tools::Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const tools: p2.setX( g.x()+g.width()-p2.X() ); p2.AdjustY(g.y() ); - return tools::Rectangle( p1, p2 ); + return AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint(p1), AbsoluteScreenPixelPoint(p2) ); } -tools::Rectangle Window::ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle &rRect ) const +tools::Rectangle Window::ImplUnmirroredAbsoluteScreenToOutputPixel( const AbsoluteScreenPixelRectangle &rRect ) const { // undo ImplOutputToUnmirroredAbsoluteScreenPixel SalFrameGeometry g = mpWindowImpl->mpFrame->GetUnmirroredGeometry(); - Point p1 = rRect.TopRight(); + Point p1( rRect.TopRight() ); p1.AdjustY(-g.y() ); p1.setX( g.x()+g.width()-p1.X() ); p1 = ScreenToOutputPixel(p1); - Point p2 = rRect.BottomLeft(); + Point p2( rRect.BottomLeft() ); p2.AdjustY(-g.y()); p2.setX( g.x()+g.width()-p2.X() ); p2 = ScreenToOutputPixel(p2); @@ -2913,21 +2913,22 @@ tools::Rectangle Window::ImplUnmirroredAbsoluteScreenToOutputPixel( const tools: // with decoration tools::Rectangle Window::GetWindowExtentsRelative(const vcl::Window & rRelativeWindow) const { - tools::Rectangle aRect = GetWindowExtentsAbsolute(); + AbsoluteScreenPixelRectangle aRect = GetWindowExtentsAbsolute(); // #106399# express coordinates relative to borderwindow const vcl::Window *pRelWin = rRelativeWindow.mpWindowImpl->mpBorderWindow ? rRelativeWindow.mpWindowImpl->mpBorderWindow.get() : &rRelativeWindow; - aRect.SetPos( pRelWin->AbsoluteScreenToOutputPixel( aRect.GetPos() ) ); - return aRect; + return tools::Rectangle( + pRelWin->AbsoluteScreenToOutputPixel( aRect.GetPos() ), + aRect.GetSize() ); } // with decoration -tools::Rectangle Window::GetWindowExtentsAbsolute() const +AbsoluteScreenPixelRectangle Window::GetWindowExtentsAbsolute() const { // make sure we use the extent of our border window, // otherwise we miss a few pixels const vcl::Window *pWin = mpWindowImpl->mpBorderWindow ? mpWindowImpl->mpBorderWindow : this; - Point aPos( pWin->OutputToAbsoluteScreenPixel( Point(0,0) ) ); + AbsoluteScreenPixelPoint aPos( pWin->OutputToAbsoluteScreenPixel( Point(0,0) ) ); Size aSize ( pWin->GetSizePixel() ); // #104088# do not add decoration to the workwindow to be compatible to java accessibility api if( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame && GetType() != WindowType::WORKWINDOW) ) @@ -2938,7 +2939,7 @@ tools::Rectangle Window::GetWindowExtentsAbsolute() const aSize.AdjustWidth(g.leftDecoration() + g.rightDecoration() ); aSize.AdjustHeight(g.topDecoration() + g.bottomDecoration() ); } - return tools::Rectangle( aPos, aSize ); + return AbsoluteScreenPixelRectangle( aPos, aSize ); } void Window::Scroll( tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags ) diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 11ef6f572858..e2e47160e97f 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -2612,10 +2612,7 @@ static void ImplHandleSalQueryCharPosition( vcl::Window *pWindow, { pEvt->mbValid = false; pEvt->mbVertical = false; - pEvt->mnCursorBoundX = 0; - pEvt->mnCursorBoundY = 0; - pEvt->mnCursorBoundWidth = 0; - pEvt->mnCursorBoundHeight = 0; + pEvt->maCursorBound = AbsoluteScreenPixelRectangle(); ImplSVData* pSVData = ImplGetSVData(); vcl::Window* pChild = pSVData->mpWinData->mpExtTextInputWin; @@ -2641,11 +2638,8 @@ static void ImplHandleSalQueryCharPosition( vcl::Window *pWindow, const OutputDevice *pChildOutDev = pChild->GetOutDev(); const tools::Rectangle& aRect = pWinData->mpCompositionCharRects[ pEvt->mnCharPos ]; tools::Rectangle aDeviceRect = pChildOutDev->ImplLogicToDevicePixel( aRect ); - Point aAbsScreenPos = pChild->OutputToAbsoluteScreenPixel( pChild->ScreenToOutputPixel(aDeviceRect.TopLeft()) ); - pEvt->mnCursorBoundX = aAbsScreenPos.X(); - pEvt->mnCursorBoundY = aAbsScreenPos.Y(); - pEvt->mnCursorBoundWidth = aDeviceRect.GetWidth(); - pEvt->mnCursorBoundHeight = aDeviceRect.GetHeight(); + AbsoluteScreenPixelPoint aAbsScreenPos = pChild->OutputToAbsoluteScreenPixel( pChild->ScreenToOutputPixel(aDeviceRect.TopLeft()) ); + pEvt->maCursorBound = AbsoluteScreenPixelRectangle(aAbsScreenPos, aDeviceRect.GetSize()); pEvt->mbVertical = pWinData->mbVertical; pEvt->mbValid = true; } diff --git a/vcl/unx/generic/app/randrwrapper.cxx b/vcl/unx/generic/app/randrwrapper.cxx index 431c70ae37af..1ef474c347f9 100644 --- a/vcl/unx/generic/app/randrwrapper.cxx +++ b/vcl/unx/generic/app/randrwrapper.cxx @@ -159,7 +159,7 @@ void SalDisplay::processRandREvent( XEvent* pEvent ) rScreen.m_aSize.Width() != pTargetSize->width || rScreen.m_aSize.Height() != pTargetSize->height; - rScreen.m_aSize = Size( pTargetSize->width, pTargetSize->height ); + rScreen.m_aSize = AbsoluteScreenPixelSize( pTargetSize->width, pTargetSize->height ); pWrapper->XRRFreeScreenConfigInfo( pConfig ); diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 174aa8761d7d..774b34bfbd0a 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -376,7 +376,7 @@ SalDisplay::initScreen( SalX11Screen nXScreen ) const Screen* pScreen = ScreenOfDisplay( pDisp_, nXScreen.getXScreen() ); - pSD->m_aSize = Size( WidthOfScreen( pScreen ), HeightOfScreen( pScreen ) ); + pSD->m_aSize = AbsoluteScreenPixelSize( WidthOfScreen( pScreen ), HeightOfScreen( pScreen ) ); pSD->m_aRoot = RootWindow( pDisp_, nXScreen.getXScreen() ); pSD->m_aVisual = SalVisual( &aVI ); pSD->m_aColormap = SalColormap( this, aColMap, nXScreen ); @@ -2194,13 +2194,13 @@ void SalDisplay::addXineramaScreenUnique( int i, tools::Long i_nX, tools::Long i m_aXineramaScreens[n].GetHeight() < i_nHeight ) { m_aXineramaScreenIndexMap[i] = n; - m_aXineramaScreens[n].SetSize( Size( i_nWidth, i_nHeight ) ); + m_aXineramaScreens[n].SetSize( AbsoluteScreenPixelSize( i_nWidth, i_nHeight ) ); } return; } } m_aXineramaScreenIndexMap[i] = m_aXineramaScreens.size(); - m_aXineramaScreens.emplace_back( Point( i_nX, i_nY ), Size( i_nWidth, i_nHeight ) ); + m_aXineramaScreens.emplace_back( AbsoluteScreenPixelPoint( i_nX, i_nY ), AbsoluteScreenPixelSize( i_nWidth, i_nHeight ) ); } void SalDisplay::InitXinerama() @@ -2220,7 +2220,7 @@ void SalDisplay::InitXinerama() if( nFramebuffers > 1 ) { - m_aXineramaScreens = std::vector<tools::Rectangle>(); + m_aXineramaScreens = std::vector<AbsoluteScreenPixelRectangle>(); m_aXineramaScreenIndexMap = std::vector<int>(nFramebuffers); for( int i = 0; i < nFramebuffers; i++ ) { diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index dd8a65712e7b..240517d7aab9 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -234,8 +234,8 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) : // default desktops m_nDesktops = 1; - m_aWMWorkAreas = ::std::vector< tools::Rectangle > - ( 1, tools::Rectangle( Point(), m_pSalDisplay->GetScreenSize( m_pSalDisplay->GetDefaultXScreen() ) ) ); + m_aWMWorkAreas = ::std::vector< AbsoluteScreenPixelRectangle > + ( 1, AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint(), m_pSalDisplay->GetScreenSize( m_pSalDisplay->GetDefaultXScreen() ) ) ); m_bEqualWorkAreas = true; memset( m_aWMAtoms, 0, sizeof( m_aWMAtoms ) ); @@ -464,15 +464,15 @@ NetWMAdaptor::NetWMAdaptor( SalDisplay* pSalDisplay ) : && nItems == 4*static_cast<unsigned>(m_nDesktops) ) { - m_aWMWorkAreas = ::std::vector< tools::Rectangle > ( m_nDesktops ); + m_aWMWorkAreas = ::std::vector< AbsoluteScreenPixelRectangle > ( m_nDesktops ); tools::Long* pValues = reinterpret_cast<long*>(pProperty); for( int i = 0; i < m_nDesktops; i++ ) { - Point aPoint( pValues[4*i], + AbsoluteScreenPixelPoint aPoint( pValues[4*i], pValues[4*i+1] ); - Size aSize( pValues[4*i+2], + AbsoluteScreenPixelSize aSize( pValues[4*i+2], pValues[4*i+3] ); - tools::Rectangle aWorkArea( aPoint, aSize ); + AbsoluteScreenPixelRectangle aWorkArea( aPoint, aSize ); m_aWMWorkAreas[i] = aWorkArea; if( aWorkArea != m_aWMWorkAreas[0] ) m_bEqualWorkAreas = false; @@ -1137,11 +1137,11 @@ void NetWMAdaptor::setNetWMState( X11SalFrame* pFrame ) const if( nCurrent < 0 ) nCurrent = 0; } - tools::Rectangle aPosSize = m_aWMWorkAreas[nCurrent]; + AbsoluteScreenPixelRectangle aPosSize = m_aWMWorkAreas[nCurrent]; const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); - aPosSize = tools::Rectangle( Point( aPosSize.Left() + rGeom.leftDecoration(), + aPosSize = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( aPosSize.Left() + rGeom.leftDecoration(), aPosSize.Top() + rGeom.topDecoration() ), - Size( aPosSize.GetWidth() + AbsoluteScreenPixelSize( aPosSize.GetWidth() - rGeom.leftDecoration() - rGeom.rightDecoration(), aPosSize.GetHeight() @@ -1225,11 +1225,11 @@ void GnomeWMAdaptor::setGnomeWMState( X11SalFrame* pFrame ) const if( nCurrent < 0 ) nCurrent = 0; } - tools::Rectangle aPosSize = m_aWMWorkAreas[nCurrent]; + AbsoluteScreenPixelRectangle aPosSize = m_aWMWorkAreas[nCurrent]; const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); - aPosSize = tools::Rectangle( Point( aPosSize.Left() + rGeom.leftDecoration(), + aPosSize = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( aPosSize.Left() + rGeom.leftDecoration(), aPosSize.Top() + rGeom.topDecoration() ), - Size( aPosSize.GetWidth() + AbsoluteScreenPixelSize( aPosSize.GetWidth() - rGeom.leftDecoration() - rGeom.rightDecoration(), aPosSize.GetHeight() @@ -1441,12 +1441,12 @@ void WMAdaptor::maximizeFrame( X11SalFrame* pFrame, bool bHorizontal, bool bVert if( bHorizontal || bVertical ) { - Size aScreenSize( m_pSalDisplay->GetScreenSize( pFrame->GetScreenNumber() ) ); - Point aTL( rGeom.leftDecoration(), rGeom.topDecoration() ); + AbsoluteScreenPixelSize aScreenSize( m_pSalDisplay->GetScreenSize( pFrame->GetScreenNumber() ) ); + AbsoluteScreenPixelPoint aTL( rGeom.leftDecoration(), rGeom.topDecoration() ); if( m_pSalDisplay->IsXinerama() ) { - Point aMed( aTL.X() + rGeom.width()/2, aTL.Y() + rGeom.height()/2 ); - const std::vector< tools::Rectangle >& rScreens = m_pSalDisplay->GetXineramaScreens(); + AbsoluteScreenPixelPoint aMed( aTL.X() + rGeom.width()/2, aTL.Y() + rGeom.height()/2 ); + const std::vector< AbsoluteScreenPixelRectangle >& rScreens = m_pSalDisplay->GetXineramaScreens(); for(const auto & rScreen : rScreens) if( rScreen.Contains( aMed ) ) { @@ -1455,13 +1455,13 @@ void WMAdaptor::maximizeFrame( X11SalFrame* pFrame, bool bHorizontal, bool bVert break; } } - tools::Rectangle aTarget( aTL, - Size( aScreenSize.Width() - rGeom.leftDecoration() - rGeom.topDecoration(), + AbsoluteScreenPixelRectangle aTarget( aTL, + AbsoluteScreenPixelSize( aScreenSize.Width() - rGeom.leftDecoration() - rGeom.topDecoration(), aScreenSize.Height() - rGeom.topDecoration() - rGeom.bottomDecoration() ) ); - const tools::Rectangle aReferenceGeometry = !pFrame->maRestorePosSize.IsEmpty() ? - pFrame->maRestorePosSize : rGeom.posSize(); + const AbsoluteScreenPixelRectangle aReferenceGeometry = !pFrame->maRestorePosSize.IsEmpty() ? + pFrame->maRestorePosSize : AbsoluteScreenPixelRectangle(rGeom.posSize()); if( ! bHorizontal ) { aTarget.SetSize({ aReferenceGeometry.GetWidth(), aTarget.GetHeight() }); @@ -1473,7 +1473,7 @@ void WMAdaptor::maximizeFrame( X11SalFrame* pFrame, bool bHorizontal, bool bVert aTarget.SetTop(aReferenceGeometry.Top()); } - tools::Rectangle aRestore(rGeom.posSize()); + AbsoluteScreenPixelRectangle aRestore(rGeom.posSize()); if( pFrame->bMapped_ ) { XSetInputFocus( m_pDisplay, @@ -1501,7 +1501,7 @@ void WMAdaptor::maximizeFrame( X11SalFrame* pFrame, bool bHorizontal, bool bVert else { pFrame->SetPosSize( pFrame->maRestorePosSize ); - pFrame->maRestorePosSize = tools::Rectangle(); + pFrame->maRestorePosSize = AbsoluteScreenPixelRectangle(); pFrame->nWidth_ = rGeom.width(); pFrame->nHeight_ = rGeom.height(); } @@ -1562,12 +1562,12 @@ void NetWMAdaptor::maximizeFrame( X11SalFrame* pFrame, bool bHorizontal, bool bV setNetWMState( pFrame ); } if( !bHorizontal && !bVertical ) - pFrame->maRestorePosSize = tools::Rectangle(); + pFrame->maRestorePosSize = AbsoluteScreenPixelRectangle(); else if( pFrame->maRestorePosSize.IsEmpty() ) { const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); pFrame->maRestorePosSize = - tools::Rectangle( Point( rGeom.x(), rGeom.y() ), Size( rGeom.width(), rGeom.height() ) ); + AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( rGeom.x(), rGeom.y() ), AbsoluteScreenPixelSize( rGeom.width(), rGeom.height() ) ); } } else @@ -1616,12 +1616,12 @@ void GnomeWMAdaptor::maximizeFrame( X11SalFrame* pFrame, bool bHorizontal, bool setGnomeWMState( pFrame ); if( !bHorizontal && !bVertical ) - pFrame->maRestorePosSize = tools::Rectangle(); + pFrame->maRestorePosSize = AbsoluteScreenPixelRectangle(); else if( pFrame->maRestorePosSize.IsEmpty() ) { const SalFrameGeometry& rGeom( pFrame->GetUnmirroredGeometry() ); pFrame->maRestorePosSize = - tools::Rectangle( Point( rGeom.x(), rGeom.y() ), Size( rGeom.width(), rGeom.height() ) ); + AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( rGeom.x(), rGeom.y() ), AbsoluteScreenPixelSize( rGeom.width(), rGeom.height() ) ); } } else @@ -1797,15 +1797,15 @@ int NetWMAdaptor::handlePropertyNotify( X11SalFrame* pFrame, XPropertyEvent* pEv } if( ! (pFrame->mbMaximizedHorz || pFrame->mbMaximizedVert ) ) - pFrame->maRestorePosSize = tools::Rectangle(); + pFrame->maRestorePosSize = AbsoluteScreenPixelRectangle(); else { const SalFrameGeometry& rGeom = pFrame->GetUnmirroredGeometry(); // the current geometry may already be changed by the corresponding // ConfigureNotify, but this cannot be helped pFrame->maRestorePosSize = - tools::Rectangle( Point( rGeom.x(), rGeom.y() ), - Size( rGeom.width(), rGeom.height() ) ); + AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( rGeom.x(), rGeom.y() ), + AbsoluteScreenPixelSize( rGeom.width(), rGeom.height() ) ); } } else if( pEvent->atom == m_aWMAtoms[ NET_WM_DESKTOP ] ) @@ -1860,15 +1860,15 @@ int GnomeWMAdaptor::handlePropertyNotify( X11SalFrame* pFrame, XPropertyEvent* p } if( ! (pFrame->mbMaximizedHorz || pFrame->mbMaximizedVert ) ) - pFrame->maRestorePosSize = tools::Rectangle(); + pFrame->maRestorePosSize = AbsoluteScreenPixelRectangle(); else { const SalFrameGeometry& rGeom = pFrame->GetUnmirroredGeometry(); // the current geometry may already be changed by the corresponding // ConfigureNotify, but this cannot be helped pFrame->maRestorePosSize = - tools::Rectangle( Point( rGeom.x(), rGeom.y() ), - Size( rGeom.width(), rGeom.height() ) ); + AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( rGeom.x(), rGeom.y() ), + AbsoluteScreenPixelSize( rGeom.width(), rGeom.height() ) ); } } else if( pEvent->atom == m_aWMAtoms[ NET_WM_DESKTOP ] ) @@ -1945,20 +1945,20 @@ void NetWMAdaptor::showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const m_pSalDisplay->GetRootWindow( pFrame->GetScreenNumber() ), &aRoot, &aChild, &root_x, &root_y, &lx, &ly, &mask ); - const std::vector< tools::Rectangle >& rScreens = m_pSalDisplay->GetXineramaScreens(); - Point aMousePoint( root_x, root_y ); + const std::vector< AbsoluteScreenPixelRectangle >& rScreens = m_pSalDisplay->GetXineramaScreens(); + AbsoluteScreenPixelPoint aMousePoint( root_x, root_y ); for(const auto & rScreen : rScreens) { if( rScreen.Contains( aMousePoint ) ) { - pFrame->maGeometry.setPosSize(rScreen); + pFrame->maGeometry.setPosSize(tools::Rectangle(rScreen)); break; } } } else { - Size aSize = m_pSalDisplay->GetScreenSize( pFrame->GetScreenNumber() ); + AbsoluteScreenPixelSize aSize = m_pSalDisplay->GetScreenSize( pFrame->GetScreenNumber() ); pFrame->maGeometry.setPosSize({ { 0, 0 }, aSize }); } pFrame->CallCallback( SalEvent::MoveResize, nullptr ); diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index f96c99b5c480..bce003bec4d9 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -472,9 +472,9 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nXScreen GetDisplay()->GetRootWindow( m_nXScreen ), &aRoot, &aChild, &root_x, &root_y, &lx, &ly, &mask ); - const std::vector< tools::Rectangle >& rScreens = GetDisplay()->GetXineramaScreens(); + const std::vector< AbsoluteScreenPixelRectangle >& rScreens = GetDisplay()->GetXineramaScreens(); for(const auto & rScreen : rScreens) - if( rScreen.Contains( Point( root_x, root_y ) ) ) + if( rScreen.Contains( AbsoluteScreenPixelPoint( root_x, root_y ) ) ) { x = rScreen.Left(); y = rScreen.Top(); @@ -1232,7 +1232,7 @@ void X11SalFrame::ToTop( SalFrameToTop nFlags ) } } -void X11SalFrame::GetWorkArea( tools::Rectangle& rWorkArea ) +void X11SalFrame::GetWorkArea( AbsoluteScreenPixelRectangle& rWorkArea ) { rWorkArea = pDisplay_->getWMAdaptor()->getWorkArea( 0 ); } @@ -1263,8 +1263,8 @@ void X11SalFrame::GetClientSize( tools::Long &rWidth, tools::Long &rHeight ) void X11SalFrame::Center( ) { int nX, nY; - Size aRealScreenSize(GetDisplay()->getDataForScreen(m_nXScreen).m_aSize); - tools::Rectangle aScreen({ 0, 0 }, aRealScreenSize); + AbsoluteScreenPixelSize aRealScreenSize(GetDisplay()->getDataForScreen(m_nXScreen).m_aSize); + AbsoluteScreenPixelRectangle aScreen({ 0, 0 }, aRealScreenSize); if( GetDisplay()->IsXinerama() ) { @@ -1286,9 +1286,9 @@ void X11SalFrame::Center( ) &root_x, &root_y, &x, &y, &mask ); - const std::vector< tools::Rectangle >& rScreens = GetDisplay()->GetXineramaScreens(); + const std::vector< AbsoluteScreenPixelRectangle >& rScreens = GetDisplay()->GetXineramaScreens(); for(const auto & rScreen : rScreens) - if( rScreen.Contains( Point( root_x, root_y ) ) ) + if( rScreen.Contains( AbsoluteScreenPixelPoint( root_x, root_y ) ) ) { aScreen.SetPos(rScreen.GetPos()); aRealScreenSize = rScreen.GetSize(); @@ -1303,9 +1303,9 @@ void X11SalFrame::Center( ) pFrame = pFrame->mpParent; if( pFrame->maGeometry.width() < 1 || pFrame->maGeometry.height() < 1 ) { - tools::Rectangle aRect; + AbsoluteScreenPixelRectangle aRect; pFrame->GetPosSize( aRect ); - pFrame->maGeometry.setPosSize(aRect); + pFrame->maGeometry.setPosSize(tools::Rectangle(aRect)); } if( pFrame->nStyle_ & SalFrameStyleFlags::PLUG ) @@ -1322,7 +1322,7 @@ void X11SalFrame::Center( ) aScreen = {{ nScreenX, nScreenY }, Size(nScreenWidth, nScreenHeight)}; } else - aScreen = pFrame->maGeometry.posSize(); + aScreen = AbsoluteScreenPixelRectangle(pFrame->maGeometry.posSize()); } if( mpParent && mpParent->nShowState_ == X11ShowState::Normal ) @@ -1363,8 +1363,8 @@ void X11SalFrame::updateScreenNumber() { if( GetDisplay()->IsXinerama() && GetDisplay()->GetXineramaScreens().size() > 1 ) { - Point aPoint( maGeometry.x(), maGeometry.y() ); - const std::vector<tools::Rectangle>& rScreenRects( GetDisplay()->GetXineramaScreens() ); + AbsoluteScreenPixelPoint aPoint( maGeometry.x(), maGeometry.y() ); + const std::vector<AbsoluteScreenPixelRectangle>& rScreenRects( GetDisplay()->GetXineramaScreens() ); size_t nScreens = rScreenRects.size(); for( size_t i = 0; i < nScreens; i++ ) { @@ -1385,7 +1385,7 @@ void X11SalFrame::SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth return; // relative positioning in X11SalFrame::SetPosSize - tools::Rectangle aPosSize( Point( maGeometry.x(), maGeometry.y() ), Size( maGeometry.width(), maGeometry.height() ) ); + AbsoluteScreenPixelRectangle aPosSize( AbsoluteScreenPixelPoint( maGeometry.x(), maGeometry.y() ), AbsoluteScreenPixelSize( maGeometry.width(), maGeometry.height() ) ); aPosSize.Normalize(); if( ! ( nFlags & SAL_FRAME_POSSIZE_X ) ) @@ -1405,13 +1405,13 @@ void X11SalFrame::SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth if( ! ( nFlags & SAL_FRAME_POSSIZE_HEIGHT ) ) nHeight = aPosSize.GetHeight(); - aPosSize = tools::Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ); + aPosSize = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( nX, nY ), AbsoluteScreenPixelSize( nWidth, nHeight ) ); if( ! ( nFlags & ( SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ) ) ) { if( bDefaultPosition_ ) { - maGeometry.setSize(aPosSize.GetSize()); + maGeometry.setSize(Size(aPosSize.GetSize())); Center(); } else @@ -1478,7 +1478,7 @@ void X11SalFrame::SetWindowState( const vcl::WindowData *pState ) else { bool bDoAdjust = false; - tools::Rectangle aPosSize; + AbsoluteScreenPixelRectangle aPosSize; // initialize with current geometry if ((pState->mask() & vcl::WindowDataMask::PosSize) != vcl::WindowDataMask::PosSize) GetPosSize(aPosSize); @@ -1509,7 +1509,7 @@ void X11SalFrame::SetWindowState( const vcl::WindowData *pState ) bDoAdjust = true; } - const Size& aScreenSize = pDisplay_->getDataForScreen( m_nXScreen ).m_aSize; + const AbsoluteScreenPixelSize& aScreenSize = pDisplay_->getDataForScreen( m_nXScreen ).m_aSize; if( bDoAdjust && aPosSize.GetWidth() <= aScreenSize.Width() && aPosSize.GetHeight() <= aScreenSize.Height() ) @@ -1562,7 +1562,7 @@ void X11SalFrame::SetWindowState( const vcl::WindowData *pState ) bool bVert(pState->state() & vcl::WindowState::MaximizedVert); GetDisplay()->getWMAdaptor()->maximizeFrame( this, bHorz, bVert ); } - maRestorePosSize = pState->posSize(); + maRestorePosSize = AbsoluteScreenPixelRectangle(pState->posSize()); } else if( mbMaximizedHorz || mbMaximizedVert ) GetDisplay()->getWMAdaptor()->maximizeFrame( this, false, false ); @@ -1587,7 +1587,7 @@ bool X11SalFrame::GetWindowState( vcl::WindowData* pState ) else pState->setState(vcl::WindowState::Normal); - tools::Rectangle aPosSize; + AbsoluteScreenPixelRectangle aPosSize; if( maRestorePosSize.IsEmpty() ) GetPosSize( aPosSize ); else @@ -1598,7 +1598,7 @@ bool X11SalFrame::GetWindowState( vcl::WindowData* pState ) if( mbMaximizedVert ) pState->rState() |= vcl::WindowState::MaximizedVert; - pState->setPosSize(aPosSize); + pState->setPosSize(tools::Rectangle(aPosSize)); pState->setMask(vcl::WindowDataMask::PosSizeState); if (! maRestorePosSize.IsEmpty() ) @@ -1619,19 +1619,19 @@ void X11SalFrame::SetMenu( SalMenu* ) { } -void X11SalFrame::GetPosSize( tools::Rectangle &rPosSize ) +void X11SalFrame::GetPosSize( AbsoluteScreenPixelRectangle &rPosSize ) { if( maGeometry.width() < 1 || maGeometry.height() < 1 ) { - const Size& aScreenSize = pDisplay_->getDataForScreen( m_nXScreen ).m_aSize; + const AbsoluteScreenPixelSize& aScreenSize = pDisplay_->getDataForScreen( m_nXScreen ).m_aSize; tools::Long w = aScreenSize.Width() - maGeometry.leftDecoration() - maGeometry.rightDecoration(); tools::Long h = aScreenSize.Height() - maGeometry.topDecoration() - maGeometry.bottomDecoration(); - rPosSize = tools::Rectangle( Point( maGeometry.x(), maGeometry.y() ), Size( w, h ) ); + rPosSize = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( maGeometry.x(), maGeometry.y() ), AbsoluteScreenPixelSize( w, h ) ); } else - rPosSize = tools::Rectangle( Point( maGeometry.x(), maGeometry.y() ), - Size( maGeometry.width(), maGeometry.height() ) ); + rPosSize = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( maGeometry.x(), maGeometry.y() ), + AbsoluteScreenPixelSize( maGeometry.width(), maGeometry.height() ) ); } void X11SalFrame::SetSize( const Size &rSize ) @@ -1677,7 +1677,7 @@ void X11SalFrame::SetSize( const Size &rSize ) mpInputContext->SetICFocus ( this ); } -void X11SalFrame::SetPosSize( const tools::Rectangle &rPosSize ) +void X11SalFrame::SetPosSize( const AbsoluteScreenPixelRectangle &rPosSize ) { XWindowChanges values; values.x = rPosSize.Left(); @@ -1906,17 +1906,17 @@ void X11SalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nScreen ) return; if( bFullScreen ) { - maRestorePosSize = maGeometry.posSize(); - tools::Rectangle aRect; + maRestorePosSize = AbsoluteScreenPixelRectangle(maGeometry.posSize()); + AbsoluteScreenPixelRectangle aRect; if( nScreen < 0 || o3tl::make_unsigned(nScreen) >= GetDisplay()->GetXineramaScreens().size() ) - aRect = tools::Rectangle( Point(0,0), GetDisplay()->GetScreenSize( m_nXScreen ) ); + aRect = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint(0,0), GetDisplay()->GetScreenSize( m_nXScreen ) ); else aRect = GetDisplay()->GetXineramaScreens()[nScreen]; m_bIsPartialFullScreen = true; bool bVisible = bMapped_; if( bVisible ) Show( false ); - maGeometry.setPosSize(aRect); + maGeometry.setPosSize(tools::Rectangle(aRect)); mbMaximizedHorz = mbMaximizedVert = false; mbFullScreen = true; createNewWindow( None, m_nXScreen ); @@ -1933,8 +1933,8 @@ void X11SalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nScreen ) mbFullScreen = false; m_bIsPartialFullScreen = false; bool bVisible = bMapped_; - tools::Rectangle aRect = maRestorePosSize; - maRestorePosSize = tools::Rectangle(); + AbsoluteScreenPixelRectangle aRect = maRestorePosSize; + maRestorePosSize = AbsoluteScreenPixelRectangle(); if( bVisible ) Show( false ); createNewWindow( None, m_nXScreen ); @@ -3488,7 +3488,7 @@ bool X11SalFrame::HandleReparentEvent( XReparentEvent *pEvent ) // #i81311# do this only for sizable frames if( nStyle_ & SalFrameStyleFlags::SIZEABLE ) { - Size aScreenSize = GetDisplay()->GetScreenSize( m_nXScreen ); + AbsoluteScreenPixelSize aScreenSize = GetDisplay()->GetScreenSize( m_nXScreen ); int nScreenWidth = aScreenSize.Width(); int nScreenHeight = aScreenSize.Height(); int nFrameWidth = maGeometry.width() + maGeometry.leftDecoration() + maGeometry.rightDecoration(); diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index ad9b6586080f..facf11b466c3 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -2227,17 +2227,17 @@ void GtkSalFrame::GetClientSize( tools::Long& rWidth, tools::Long& rHeight ) rWidth = rHeight = 0; } -void GtkSalFrame::GetWorkArea( tools::Rectangle& rRect ) +void GtkSalFrame::GetWorkArea( AbsoluteScreenPixelRectangle& rRect ) { GdkRectangle aRect; #if !GTK_CHECK_VERSION(4, 0, 0) GdkScreen *pScreen = gtk_widget_get_screen(m_pWindow); - tools::Rectangle aRetRect; + AbsoluteScreenPixelRectangle aRetRect; int max = gdk_screen_get_n_monitors (pScreen); for (int i = 0; i < max; ++i) { gdk_screen_get_monitor_workarea(pScreen, i, &aRect); - tools::Rectangle aMonitorRect(aRect.x, aRect.y, aRect.x+aRect.width, aRect.y+aRect.height); + AbsoluteScreenPixelRectangle aMonitorRect(aRect.x, aRect.y, aRect.x+aRect.width, aRect.y+aRect.height); aRetRect.Union(aMonitorRect); } rRect = aRetRect; @@ -2246,7 +2246,7 @@ void GtkSalFrame::GetWorkArea( tools::Rectangle& rRect ) GdkSurface* gdkWindow = widget_get_surface(m_pWindow); GdkMonitor* pMonitor = gdk_display_get_monitor_at_surface(pDisplay, gdkWindow); gdk_monitor_get_geometry(pMonitor, &aRect); - rRect = tools::Rectangle(aRect.x, aRect.y, aRect.x+aRect.width, aRect.y+aRect.height); + rRect = AbsoluteScreenPixelRectangle(aRect.x, aRect.y, aRect.x+aRect.width, aRect.y+aRect.height); #endif } @@ -3940,7 +3940,7 @@ void GtkSalFrame::signalRealize(GtkWidget*, gpointer frame) swapDirection(menu_anchor); } - tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(pVclParent, pThis->m_aFloatRect); + AbsoluteScreenPixelRectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(pVclParent, pThis->m_aFloatRect); if (gdk_window_get_window_type(widget_get_surface(pThis->m_pParent->m_pWindow)) != GDK_WINDOW_TOPLEVEL) { // See tdf#152155 for an example @@ -6086,10 +6086,10 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint return true; } -Size GtkSalDisplay::GetScreenSize( int nDisplayScreen ) +AbsoluteScreenPixelSize GtkSalDisplay::GetScreenSize( int nDisplayScreen ) { - tools::Rectangle aRect = m_pSys->GetDisplayScreenPosSizePixel( nDisplayScreen ); - return Size( aRect.GetWidth(), aRect.GetHeight() ); + AbsoluteScreenPixelRectangle aRect = m_pSys->GetDisplayScreenPosSizePixel( nDisplayScreen ); + return AbsoluteScreenPixelSize( aRect.GetWidth(), aRect.GetHeight() ); } sal_uIntPtr GtkSalFrame::GetNativeWindowHandle(GtkWidget *pWidget) diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index df7b8fc32e95..2cfd0d6b203a 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -2259,7 +2259,7 @@ namespace { // this is the relatively unusual case where pParent is the toplevel GtkSalFrame and not a stock GtkWidget // so use the same style of logic as GtkSalMenu::ShowNativePopupMenu to get the right position - tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(pFrame->GetWindow(), rInRect); + AbsoluteScreenPixelRectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(pFrame->GetWindow(), rInRect); aFloatRect.Move(-pFrame->maGeometry.x(), -pFrame->maGeometry.y()); rOutRect = GdkRectangle{static_cast<int>(aFloatRect.Left()), static_cast<int>(aFloatRect.Top()), @@ -6220,7 +6220,7 @@ namespace #endif } - tools::Rectangle get_monitor_workarea(GtkWidget* pWindow) + AbsoluteScreenPixelRectangle get_monitor_workarea(GtkWidget* pWindow) { GdkRectangle aRect; #if !GTK_CHECK_VERSION(4, 0, 0) @@ -6233,7 +6233,7 @@ namespace GdkMonitor* pMonitor = gdk_display_get_monitor_at_surface(pDisplay, gdkWindow); gdk_monitor_get_geometry(pMonitor, &aRect); #endif - return tools::Rectangle(aRect.x, aRect.y, aRect.x + aRect.width, aRect.y + aRect.height); + return AbsoluteScreenPixelRectangle(aRect.x, aRect.y, aRect.x + aRect.width, aRect.y + aRect.height); } @@ -6402,7 +6402,7 @@ public: GtkInstanceContainer::hide(); } - virtual tools::Rectangle get_monitor_workarea() const override + virtual AbsoluteScreenPixelRectangle get_monitor_workarea() const override { return ::get_monitor_workarea(GTK_WIDGET(m_pWindow)); } @@ -18651,7 +18651,7 @@ public: return uno::Reference<css::accessibility::XAccessibleRelationSet>(); } - virtual Point get_accessible_location_on_screen() override + virtual AbsoluteScreenPixelPoint get_accessible_location_on_screen() override { #if !GTK_CHECK_VERSION(4, 0, 0) AtkObject* pAtkObject = default_drawing_area_get_accessible(m_pWidget); @@ -18661,7 +18661,7 @@ public: if (pAtkObject && ATK_IS_COMPONENT(pAtkObject)) atk_component_get_extents(ATK_COMPONENT(pAtkObject), &x, &y, nullptr, nullptr, ATK_XY_SCREEN); #endif - return Point(x, y); + return AbsoluteScreenPixelPoint(x, y); } virtual void set_accessible_name(const OUString& rName) override diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index adcc9c8d485c..89f2d6a51e52 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -488,7 +488,7 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangl #if GTK_CHECK_VERSION(3,22,0) if (gtk_check_version(3, 22, 0) == nullptr) { - tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect); + AbsoluteScreenPixelRectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect); aFloatRect.Move(-mpFrame->maGeometry.x(), -mpFrame->maGeometry.y()); GdkRectangle rect {static_cast<int>(aFloatRect.Left()), static_cast<int>(aFloatRect.Top()), static_cast<int>(aFloatRect.GetWidth()), static_cast<int>(aFloatRect.GetHeight())}; @@ -539,10 +539,10 @@ bool GtkSalMenu::ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangl // (see code in FloatingWindow::StartPopupMode) sal_uInt16 nArrangeIndex; Point aPos = FloatingWindow::ImplCalcPos(pWin, rRect, nFlags, nArrangeIndex); - aPos = FloatingWindow::ImplConvertToAbsPos(xParent, aPos); + AbsoluteScreenPixelPoint aPosAbs = FloatingWindow::ImplConvertToAbsPos(xParent, aPos); gtk_menu_popup(GTK_MENU(mpMenuWidget), nullptr, nullptr, MenuPositionFunc, - &aPos, nButton, nTime); + &aPosAbs, nButton, nTime); } #endif diff --git a/vcl/unx/gtk3/gtksys.cxx b/vcl/unx/gtk3/gtksys.cxx index cfa7740c48c7..4dc191bd67d2 100644 --- a/vcl/unx/gtk3/gtksys.cxx +++ b/vcl/unx/gtk3/gtksys.cxx @@ -223,24 +223,24 @@ unsigned int GtkSalSystem::GetDisplayBuiltInScreen() #endif } -tools::Rectangle GtkSalSystem::GetDisplayScreenPosSizePixel(unsigned int nScreen) +AbsoluteScreenPixelRectangle GtkSalSystem::GetDisplayScreenPosSizePixel(unsigned int nScreen) { GdkRectangle aRect; #if GTK_CHECK_VERSION(4, 0, 0) GListModel* pList = gdk_display_get_monitors(mpDisplay); GdkMonitor* pMonitor = static_cast<GdkMonitor*>(g_list_model_get_item(pList, nScreen)); if (!pMonitor) - return tools::Rectangle(); + return AbsoluteScreenPixelRectangle(); gdk_monitor_get_geometry(pMonitor, &aRect); #else gint nMonitor; GdkScreen *pScreen; pScreen = getScreenMonitorFromIdx (nScreen, nMonitor); if (!pScreen) - return tools::Rectangle(); + return AbsoluteScreenPixelRectangle(); gdk_screen_get_monitor_geometry (pScreen, nMonitor, &aRect); #endif - return tools::Rectangle (Point(aRect.x, aRect.y), Size(aRect.width, aRect.height)); + return AbsoluteScreenPixelRectangle(AbsoluteScreenPixelPoint(aRect.x, aRect.y), AbsoluteScreenPixelSize(aRect.width, aRect.height)); } // convert ~ to indicate mnemonic to '_' diff --git a/vcl/unx/x11/x11sys.cxx b/vcl/unx/x11/x11sys.cxx index 66a5f2e70fb2..8f9478eb3bc9 100644 --- a/vcl/unx/x11/x11sys.cxx +++ b/vcl/unx/x11/x11sys.cxx @@ -52,13 +52,13 @@ unsigned int X11SalSystem::GetDisplayBuiltInScreen() return pSalDisp->GetDefaultXScreen().getXScreen(); } -tools::Rectangle X11SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) +AbsoluteScreenPixelRectangle X11SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) { - tools::Rectangle aRet; + AbsoluteScreenPixelRectangle aRet; SalDisplay* pSalDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData()); if( pSalDisp->IsXinerama() ) { - const std::vector< tools::Rectangle >& rScreens = pSalDisp->GetXineramaScreens(); + const std::vector< AbsoluteScreenPixelRectangle >& rScreens = pSalDisp->GetXineramaScreens(); // we shouldn't be able to pick a screen > number of screens available assert(nScreen < rScreens.size() ); @@ -70,7 +70,7 @@ tools::Rectangle X11SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScree { const SalDisplay::ScreenData& rScreen = pSalDisp->getDataForScreen( SalX11Screen( nScreen ) ); - aRet = tools::Rectangle( Point( 0, 0 ), rScreen.m_aSize ); + aRet = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( 0, 0 ), rScreen.m_aSize ); } return aRet; diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx index c028939fd65a..23d542d23b84 100644 --- a/vcl/win/app/salinfo.cxx +++ b/vcl/win/app/salinfo.cxx @@ -65,9 +65,9 @@ bool WinSalSystem::handleMonitorCallback( sal_IntPtr hMonitor, sal_IntPtr, sal_I if( it != m_aDeviceNameToMonitor.end() ) { DisplayMonitor& rMon( m_aMonitors[ it->second ] ); - rMon.m_aArea = tools::Rectangle( Point( aInfo.rcMonitor.left, + rMon.m_aArea = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( aInfo.rcMonitor.left, aInfo.rcMonitor.top ), - Size( aInfo.rcMonitor.right - aInfo.rcMonitor.left, + AbsoluteScreenPixelSize( aInfo.rcMonitor.right - aInfo.rcMonitor.left, aInfo.rcMonitor.bottom - aInfo.rcMonitor.top ) ); if( (aInfo.dwFlags & MONITORINFOF_PRIMARY) != 0 ) m_nPrimary = it->second; @@ -92,8 +92,8 @@ bool WinSalSystem::initMonitors() { int w = GetSystemMetrics( SM_CXSCREEN ); int h = GetSystemMetrics( SM_CYSCREEN ); - m_aMonitors.push_back( DisplayMonitor( OUString(), - tools::Rectangle( Point(), Size( w, h ) ) ) ); + AbsoluteScreenPixelRectangle aRect(AbsoluteScreenPixelPoint(), AbsoluteScreenPixelSize( w, h )); + m_aMonitors.push_back( DisplayMonitor( OUString(), aRect ) ); m_aDeviceNameToMonitor[ OUString() ] = 0; m_nPrimary = 0; } @@ -115,7 +115,7 @@ bool WinSalSystem::initMonitors() aDeviceStringCount[ aDeviceString ]++; m_aDeviceNameToMonitor[ aDeviceName ] = m_aMonitors.size(); m_aMonitors.push_back( DisplayMonitor( aDeviceString, - tools::Rectangle() ) ); + AbsoluteScreenPixelRectangle() ) ); } } HDC aDesktopRC = GetDC( nullptr ); @@ -151,7 +151,7 @@ unsigned int WinSalSystem::GetDisplayBuiltInScreen() return m_nPrimary; } -tools::Rectangle WinSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) +AbsoluteScreenPixelRectangle WinSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen ) { initMonitors(); if (nScreen >= m_aMonitors.size()) @@ -159,7 +159,7 @@ tools::Rectangle WinSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScree SAL_WARN("vcl", "Requested screen size/pos for screen #" << nScreen << ", but only " << m_aMonitors.size() << " screens found."); assert(false); - return tools::Rectangle(); + return AbsoluteScreenPixelRectangle(); } return m_aMonitors[nScreen].m_aArea; } diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 25c2e2b3b281..c7c0bdd4f328 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -793,7 +793,7 @@ static void ImplSalCalcFullScreenSize( const WinSalFrame* pFrame, try { - tools::Rectangle aRect; + AbsoluteScreenPixelRectangle aRect; sal_Int32 nMonitors = Application::GetScreenCount(); if( (pFrame->mnDisplay >= 0) && (pFrame->mnDisplay < nMonitors) ) { @@ -920,7 +920,7 @@ void WinSalFrame::updateScreenNumber() { const std::vector<WinSalSystem::DisplayMonitor>& rMonitors = pSys->getMonitors(); - Point aPoint(maGeometry.pos()); + AbsoluteScreenPixelPoint aPoint(maGeometry.pos()); size_t nMon = rMonitors.size(); for( size_t i = 0; i < nMon; i++ ) { @@ -1587,7 +1587,7 @@ void WinSalFrame::SetPluginParent( SystemParentData* pNewParent ) WinSalFrame::mbInReparent = false; } -void WinSalFrame::GetWorkArea( tools::Rectangle &rRect ) +void WinSalFrame::GetWorkArea( AbsoluteScreenPixelRectangle &rRect ) { RECT aRect; @@ -1785,8 +1785,8 @@ void WinSalFrame::SetScreenNumber( unsigned int nNewScreen ) size_t nMon = rMonitors.size(); if( nNewScreen < nMon ) { - Point aOldMonPos, aNewMonPos( rMonitors[nNewScreen].m_aArea.TopLeft() ); - Point aCurPos(maGeometry.pos()); + AbsoluteScreenPixelPoint aOldMonPos, aNewMonPos( rMonitors[nNewScreen].m_aArea.TopLeft() ); + AbsoluteScreenPixelPoint aCurPos(maGeometry.pos()); for( size_t i = 0; i < nMon; i++ ) { if( rMonitors[i].m_aArea.Contains( aCurPos ) ) @@ -5560,17 +5560,17 @@ static LRESULT ImplHandleIMEQueryCharPosition( HWND hWnd, LPARAM lParam ) { { // For vertical writing, the base line is left edge of the rectangle // and the target position is top-right corner. - pQueryCharPosition->pt.x = aEvt.mnCursorBoundX + aEvt.mnCursorBoundWidth; - pQueryCharPosition->pt.y = aEvt.mnCursorBoundY; - pQueryCharPosition->cLineHeight = aEvt.mnCursorBoundWidth; + pQueryCharPosition->pt.x = aEvt.maCursorBound.getX() + aEvt.maCursorBound.GetWidth(); + pQueryCharPosition->pt.y = aEvt.maCursorBound.getY(); + pQueryCharPosition->cLineHeight = aEvt.maCursorBound.GetWidth(); } else { // For horizontal writing, the base line is the bottom edge of the rectangle. // and the target position is top-left corner. - pQueryCharPosition->pt.x = aEvt.mnCursorBoundX; - pQueryCharPosition->pt.y = aEvt.mnCursorBoundY; - pQueryCharPosition->cLineHeight = aEvt.mnCursorBoundHeight; + pQueryCharPosition->pt.x = aEvt.maCursorBound.getX(); + pQueryCharPosition->pt.y = aEvt.maCursorBound.getY(); + pQueryCharPosition->cLineHeight = aEvt.maCursorBound.GetHeight(); } // Currently not supported but many IMEs usually ignore them. |