[Libreoffice-commits] core.git: include/svtools include/vcl svtools/inc svtools/source vcl/inc vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 26 19:58:22 UTC 2020


 include/svtools/brwbox.hxx              |    2 +-
 include/vcl/accessibletable.hxx         |    2 +-
 include/vcl/accessibletableprovider.hxx |    2 +-
 include/vcl/toolkit/svtabbx.hxx         |    2 +-
 include/vcl/weld.hxx                    |    4 ++--
 include/vcl/window.hxx                  |    6 +++---
 svtools/inc/table/tablecontrol.hxx      |    2 +-
 svtools/source/brwbox/brwbox3.cxx       |    2 +-
 svtools/source/table/tablecontrol.cxx   |    9 +--------
 vcl/inc/salvtables.hxx                  |    6 +++---
 vcl/source/app/salvtables.cxx           |    8 ++++----
 vcl/source/control/combobox.cxx         |    2 +-
 vcl/source/control/ctrl.cxx             |    2 +-
 vcl/source/control/listbox.cxx          |    2 +-
 vcl/source/treelist/svtabbx.cxx         |    2 +-
 vcl/source/window/window.cxx            |    6 +++---
 vcl/unx/gtk3/gtk3gtkinst.cxx            |    8 ++++----
 17 files changed, 30 insertions(+), 37 deletions(-)

New commits:
commit a387bf54a944212cff94dbd1182bb55ab39a4324
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 26 15:07:45 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Aug 26 21:57:39 2020 +0200

    make get_extents_relative_to const
    
    Change-Id: I031c42cd85395a777c20bdd052da4233bc2fedab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101414
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index 63796c752ef8..e466a89d4d14 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -826,7 +826,7 @@ public:
     virtual bool                    IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
     virtual OUString                GetAccessibleCellText(long _nRow, sal_uInt16 _nColPos) const override;
     virtual bool                    GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector ) override;
-    virtual tools::Rectangle               GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const override;
+    virtual tools::Rectangle        GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const override;
     virtual void                    GrabFocus() override;
     virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
     virtual vcl::Window*            GetAccessibleParentWindow() const override;
diff --git a/include/vcl/accessibletable.hxx b/include/vcl/accessibletable.hxx
index 88b1890f2805..8c2aeba6b7c3 100644
--- a/include/vcl/accessibletable.hxx
+++ b/include/vcl/accessibletable.hxx
@@ -74,7 +74,7 @@ public:
             AccessibleTableControlObjType eObjType ) const= 0;
 
     // Window
-    virtual tools::Rectangle GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const = 0;
+    virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const = 0;
     virtual void GrabFocus()= 0;
     virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible()= 0;
     virtual vcl::Window* GetAccessibleParentWindow() const= 0;
diff --git a/include/vcl/accessibletableprovider.hxx b/include/vcl/accessibletableprovider.hxx
index ff24c98b04b0..b69548ef2355 100644
--- a/include/vcl/accessibletableprovider.hxx
+++ b/include/vcl/accessibletableprovider.hxx
@@ -114,7 +114,7 @@ public:
     virtual bool                    GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector ) = 0;
 
     // Window
-    virtual tools::Rectangle               GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const = 0;
+    virtual tools::Rectangle        GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const = 0;
     virtual void                    GrabFocus() = 0;
     virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() = 0;
     virtual vcl::Window*                 GetAccessibleParentWindow() const = 0;
diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx
index 3e1a8a00b032..e73cbc47c1e2 100644
--- a/include/vcl/toolkit/svtabbx.hxx
+++ b/include/vcl/toolkit/svtabbx.hxx
@@ -202,7 +202,7 @@ public:
     virtual bool                    GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector ) override;
 
     // Window
-    virtual tools::Rectangle        GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const override;
+    virtual tools::Rectangle        GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const override;
     virtual void                    GrabFocus() override;
     virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
     /** Creates and returns the accessible object of the whole BrowseBox. */
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 16be52e8054d..62a143a8565b 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -160,8 +160,8 @@ public:
      * either widget was not realized, or there was no common ancestor.
      * Otherwise true.
      */
-    virtual bool get_extents_relative_to(Widget& rRelative, int& x, int& y, int& width, int& height)
-        = 0;
+    virtual bool get_extents_relative_to(const Widget& rRelative, int& x, int& y, int& width,
+                                         int& height) const = 0;
 
     virtual void set_accessible_name(const OUString& rName) = 0;
     virtual OUString get_accessible_name() const = 0;
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 42febb1df8a3..24b74328dc63 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -718,7 +718,7 @@ private:
 
     SAL_DLLPRIVATE vcl::Window*         ImplGetTopmostFrameWindow();
 
-    SAL_DLLPRIVATE tools::Rectangle     ImplGetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const;
+    SAL_DLLPRIVATE tools::Rectangle     ImplGetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const;
 
     SAL_DLLPRIVATE bool                 ImplStopDnd();
     SAL_DLLPRIVATE void                 ImplStartDnd();
@@ -1042,9 +1042,9 @@ public:
     Point                               NormalizedScreenToOutputPixel( const Point& rPos ) const;
     Point                               OutputToAbsoluteScreenPixel( const Point& rPos ) const;
     Point                               AbsoluteScreenToOutputPixel( const Point& rPos ) const;
-    tools::Rectangle                           GetDesktopRectPixel() const;
+    tools::Rectangle                    GetDesktopRectPixel() const;
     //  window extents including border and decoration
-    tools::Rectangle                           GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const;
+    tools::Rectangle                    GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const;
 
     bool                                IsScrollable() const;
     virtual void                        Scroll( long nHorzScroll, long nVertScroll,
diff --git a/svtools/inc/table/tablecontrol.hxx b/svtools/inc/table/tablecontrol.hxx
index fb6868f3d5b0..1e780440a05a 100644
--- a/svtools/inc/table/tablecontrol.hxx
+++ b/svtools/inc/table/tablecontrol.hxx
@@ -128,7 +128,7 @@ namespace svt::table
 
 
         // IAccessibleTable
-        virtual tools::Rectangle GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const override;
+        virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const override;
         virtual void GrabFocus() override;
         virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
         virtual vcl::Window* GetAccessibleParentWindow() const override;
diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx
index 0c4f60316541..e6148aa217ce 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 Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector );
 }
 
-tools::Rectangle BrowseBox::GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const
+tools::Rectangle BrowseBox::GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
 {
     return Control::GetWindowExtentsRelative( pRelativeWindow );
 }
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index ce88591a5048..e2310b798bcd 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -469,45 +469,38 @@ namespace svt::table
         }
     }
 
-
     void TableControl::commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue )
     {
         if ( m_pImpl->isAccessibleAlive() )
             m_pImpl->commitCellEvent( i_eventID, i_newValue, i_oldValue );
     }
 
-
     void TableControl::commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue )
     {
         if ( m_pImpl->isAccessibleAlive() )
             m_pImpl->commitTableEvent( i_eventID, i_newValue, i_oldValue );
     }
 
-
-    tools::Rectangle TableControl::GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const
+    tools::Rectangle TableControl::GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
     {
         return Control::GetWindowExtentsRelative( pRelativeWindow );
     }
 
-
     void TableControl::GrabFocus()
     {
         Control::GrabFocus();
     }
 
-
     Reference< XAccessible > TableControl::GetAccessible()
     {
         return Control::GetAccessible();
     }
 
-
     vcl::Window* TableControl::GetAccessibleParentWindow() const
     {
         return Control::GetAccessibleParentWindow();
     }
 
-
     vcl::Window* TableControl::GetWindowInstance()
     {
         return this;
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index be3d99ada9bb..654a704931e8 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -338,8 +338,8 @@ public:
 
     virtual void connect_key_release(const Link<const KeyEvent&, bool>& rLink) override;
 
-    virtual bool get_extents_relative_to(Widget& rRelative, int& x, int& y, int& width,
-                                         int& height) override;
+    virtual bool get_extents_relative_to(const Widget& rRelative, int& x, int& y, int& width,
+                                         int& height) const override;
 
     virtual void grab_add() override;
 
@@ -359,7 +359,7 @@ public:
 
     virtual ~SalInstanceWidget() override;
 
-    vcl::Window* getWidget();
+    vcl::Window* getWidget() const;
 
     void disable_notify_events();
 
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index cd4de6bd1e3c..0783c26dbfba 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -443,11 +443,11 @@ void SalInstanceWidget::connect_key_release(const Link<const KeyEvent&, bool>& r
     weld::Widget::connect_key_release(rLink);
 }
 
-bool SalInstanceWidget::get_extents_relative_to(Widget& rRelative, int& x, int& y, int& width,
-                                                int& height)
+bool SalInstanceWidget::get_extents_relative_to(const Widget& rRelative, int& x, int& y, int& width,
+                                                int& height) const
 {
     tools::Rectangle aRect(m_xWidget->GetWindowExtentsRelative(
-        dynamic_cast<SalInstanceWidget&>(rRelative).getWidget()));
+        dynamic_cast<const SalInstanceWidget&>(rRelative).getWidget()));
     x = aRect.Left();
     y = aRect.Top();
     width = aRect.GetWidth();
@@ -483,7 +483,7 @@ SalInstanceWidget::~SalInstanceWidget()
         m_xWidget.disposeAndClear();
 }
 
-vcl::Window* SalInstanceWidget::getWidget() { return m_xWidget; }
+vcl::Window* SalInstanceWidget::getWidget() const { return m_xWidget; }
 
 void SalInstanceWidget::disable_notify_events() { ++m_nBlockNotify; }
 
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 6e0f7c6e5a9c..00764d68bf12 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1332,7 +1332,7 @@ sal_Int32 ComboBox::GetTopEntry() const
 tools::Rectangle ComboBox::GetDropDownPosSizePixel() const
 {
     return m_pImpl->m_pFloatWin
-        ? m_pImpl->m_pFloatWin->GetWindowExtentsRelative(const_cast<ComboBox*>(this))
+        ? m_pImpl->m_pFloatWin->GetWindowExtentsRelative(this)
         : tools::Rectangle();
 }
 
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 81fea00009da..dc8f2d7a9e85 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -285,7 +285,7 @@ void Control::AppendLayoutData( const Control& rSubControl ) const
     for( n = 1; n < nLines; n++ )
         mpControlData->mpLayoutData->m_aLineIndices.push_back( rSubControl.mpControlData->mpLayoutData->m_aLineIndices[n] + nCurrentIndex );
     int nRectangles = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects.size();
-    tools::Rectangle aRel = const_cast<Control&>(rSubControl).GetWindowExtentsRelative( const_cast<Control*>(this) );
+    tools::Rectangle aRel = rSubControl.GetWindowExtentsRelative(this);
     for( n = 0; n < nRectangles; n++ )
     {
         tools::Rectangle aRect = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects[n];
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index 2061b0b32f22..fbada6496e89 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -1348,7 +1348,7 @@ sal_uInt16 ListBox::GetDisplayLineCount() const
 
 tools::Rectangle ListBox::GetDropDownPosSizePixel() const
 {
-    return mpFloatWin ? mpFloatWin->GetWindowExtentsRelative( const_cast<ListBox*>(this) ) : tools::Rectangle();
+    return mpFloatWin ? mpFloatWin->GetWindowExtentsRelative(this) : tools::Rectangle();
 }
 
 const Wallpaper& ListBox::GetDisplayBackground() const
diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index 2504cf2e1fd6..2f866dc0c377 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -958,7 +958,7 @@ bool SvHeaderTabListBox::GetGlyphBoundRects( const Point& rOrigin, const OUStrin
     return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector );
 }
 
-tools::Rectangle SvHeaderTabListBox::GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const
+tools::Rectangle SvHeaderTabListBox::GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
 {
     return Control::GetWindowExtentsRelative( pRelativeWindow );
 }
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 95c0ccb203ff..a0b4441e966a 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2933,13 +2933,13 @@ tools::Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const tools:
     return tools::Rectangle( p1, p2 );
 }
 
-tools::Rectangle Window::GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const
+tools::Rectangle Window::GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
 {
     // with decoration
     return ImplGetWindowExtentsRelative( pRelativeWindow );
 }
 
-tools::Rectangle Window::ImplGetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const
+tools::Rectangle Window::ImplGetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
 {
     SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
     // make sure we use the extent of our border window,
@@ -2961,7 +2961,7 @@ tools::Rectangle Window::ImplGetWindowExtentsRelative( vcl::Window *pRelativeWin
     if( pRelativeWindow )
     {
         // #106399# express coordinates relative to borderwindow
-        vcl::Window *pRelWin = pRelativeWindow->mpWindowImpl->mpBorderWindow ? pRelativeWindow->mpWindowImpl->mpBorderWindow.get() : pRelativeWindow;
+        const vcl::Window *pRelWin = pRelativeWindow->mpWindowImpl->mpBorderWindow ? pRelativeWindow->mpWindowImpl->mpBorderWindow.get() : pRelativeWindow;
         aPos = pRelWin->AbsoluteScreenToOutputPixel( aPos );
     }
     return tools::Rectangle( aPos, aSize );
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index c6e557a69275..50068de7b280 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2756,13 +2756,13 @@ public:
         g_object_unref(pRelationSet);
     }
 
-    virtual bool get_extents_relative_to(weld::Widget& rRelative, int& x, int &y, int& width, int &height) override
+    virtual bool get_extents_relative_to(const weld::Widget& rRelative, int& x, int &y, int& width, int &height) const override
     {
         //for toplevel windows this is sadly futile under wayland, so we can't tell where a dialog is in order to allow
         //the document underneath to auto-scroll to place content in a visible location
         bool ret = gtk_widget_translate_coordinates(m_pWidget,
-                                                        dynamic_cast<GtkInstanceWidget&>(rRelative).getWidget(),
-                                                        0, 0, &x, &y);
+                                                    dynamic_cast<const GtkInstanceWidget&>(rRelative).getWidget(),
+                                                    0, 0, &x, &y);
         width = gtk_widget_get_allocated_width(m_pWidget);
         height = gtk_widget_get_allocated_height(m_pWidget);
         return ret;
@@ -2800,7 +2800,7 @@ public:
         return sRet;
     }
 
-    GtkWidget* getWidget()
+    GtkWidget* getWidget() const
     {
         return m_pWidget;
     }


More information about the Libreoffice-commits mailing list