From 9b784a74a2f09e9eb9a0fd41d58c1f6b47ee6ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 26 Mar 2020 17:21:33 +0000 Subject: [PATCH] these methods can take a const argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0ec68d40dcc34075c72c0d60d3a4b6e8262a8e0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91152 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- dbaccess/source/ui/app/AppDetailView.cxx | 4 ++-- dbaccess/source/ui/app/AppDetailView.hxx | 2 +- include/vcl/treelistbox.hxx | 8 ++++---- vcl/inc/iconview.hxx | 2 +- vcl/inc/svimpbox.hxx | 8 ++++---- vcl/source/treelist/iconview.cxx | 2 +- vcl/source/treelist/iconviewimpl.cxx | 4 ++-- vcl/source/treelist/iconviewimpl.hxx | 4 ++-- vcl/source/treelist/svimpbox.cxx | 6 +++--- vcl/source/treelist/treelistbox.cxx | 10 +++++----- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx index edcee4c901b3..1a4947ea7a1b 100644 --- a/dbaccess/source/ui/app/AppDetailView.cxx +++ b/dbaccess/source/ui/app/AppDetailView.cxx @@ -147,13 +147,13 @@ void OCreationList::ExecuteSearchEntry( const void* _pEntry ) const onSelected( pEntry ); } -tools::Rectangle OCreationList::GetFocusRect( SvTreeListEntry* _pEntry, long _nLine ) +tools::Rectangle OCreationList::GetFocusRect(const SvTreeListEntry* _pEntry, long _nLine) { tools::Rectangle aRect = SvTreeListBox::GetFocusRect( _pEntry, _nLine ); aRect.SetLeft( 0 ); // try to let the focus rect start before the bitmap item - this looks better - SvLBoxItem* pBitmapItem = _pEntry->GetFirstItem(SvLBoxItemType::ContextBmp); + const SvLBoxItem* pBitmapItem = _pEntry->GetFirstItem(SvLBoxItemType::ContextBmp); SvLBoxTab* pTab = pBitmapItem ? GetTab( _pEntry, pBitmapItem ) : nullptr; SvViewDataItem* pItemData = pBitmapItem ? GetViewDataItem( _pEntry, pBitmapItem ) : nullptr; OSL_ENSURE( pTab && pItemData, "OCreationList::GetFocusRect: could not find the first bitmap item!" ); diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx index 345db14bb577..38bc41ab1e46 100644 --- a/dbaccess/source/ui/app/AppDetailView.hxx +++ b/dbaccess/source/ui/app/AppDetailView.hxx @@ -71,7 +71,7 @@ namespace dbaui protected: virtual void PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry& rEntry) override; - virtual tools::Rectangle GetFocusRect( SvTreeListEntry* _pEntry, long _nLine ) override; + virtual tools::Rectangle GetFocusRect(const SvTreeListEntry* _pEntry, long _nLine) override; virtual void ModelHasCleared() override; // IMnemonicEntryList diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx index 915730390f7a..ad68a900abb2 100644 --- a/include/vcl/treelistbox.hxx +++ b/include/vcl/treelistbox.hxx @@ -485,7 +485,7 @@ public: @param pEntry The entry. @return The bounding rectangle of an entry. */ - tools::Rectangle GetBoundingRect( SvTreeListEntry* pEntry ); + tools::Rectangle GetBoundingRect(const SvTreeListEntry* pEntry); SvTreeFlags GetTreeFlags() const {return nTreeFlags;} @@ -650,7 +650,7 @@ public: // Place the expander checkitem at the optimal indent for hierarchical lists void SetOptimalImageIndent() { SetIndent(12); } void SetSpaceBetweenEntries( short nSpace ); - Point GetEntryPosition( SvTreeListEntry* ) const; + Point GetEntryPosition(const SvTreeListEntry*) const; void MakeVisible( SvTreeListEntry* pEntry ); void MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop ); @@ -665,9 +665,9 @@ public: SvTreeListEntry* GetEntry( const Point& rPos, bool bHit = false ) const; - virtual tools::Rectangle GetFocusRect( SvTreeListEntry*, long nLine ); + virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, long nLine ); // Respects indentation - virtual sal_IntPtr GetTabPos( SvTreeListEntry*, SvLBoxTab* ); + virtual sal_IntPtr GetTabPos(const SvTreeListEntry*, SvLBoxTab*); void InvalidateEntry( SvTreeListEntry* ); SvLBoxItem* GetItem( SvTreeListEntry*, long nX, SvLBoxTab** ppTab); SvLBoxItem* GetItem( SvTreeListEntry*, long nX ); diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx index ebc60f08aa23..09d1a0b02fe7 100644 --- a/vcl/inc/iconview.hxx +++ b/vcl/inc/iconview.hxx @@ -29,7 +29,7 @@ public: virtual void Resize() override; - virtual tools::Rectangle GetFocusRect( SvTreeListEntry*, long nEntryPos ) override; + virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, long nEntryPos) override; void PaintEntry( SvTreeListEntry&, long nX, long nY, vcl::RenderContext& rRenderContext); }; diff --git a/vcl/inc/svimpbox.hxx b/vcl/inc/svimpbox.hxx index df25a63ed42c..3ff2d23e5f99 100644 --- a/vcl/inc/svimpbox.hxx +++ b/vcl/inc/svimpbox.hxx @@ -218,7 +218,7 @@ protected: long m_nNextVerVisSize; long m_nNodeBmpTabDistance; // typical smaller than 0 - virtual long GetEntryLine( SvTreeListEntry* pEntry ) const; + virtual long GetEntryLine(const SvTreeListEntry* pEntry) const; virtual void CursorDown(); virtual void CursorUp(); virtual void PageDown( sal_uInt16 nDelta ); @@ -285,7 +285,7 @@ public: virtual SvTreeListEntry* GetClickedEntry( const Point& ) const; SvTreeListEntry* GetCurEntry() const { return m_pCursor; } void SetCurEntry( SvTreeListEntry* ); - virtual Point GetEntryPosition( SvTreeListEntry* ) const; + virtual Point GetEntryPosition(const SvTreeListEntry*) const; void MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop = false ); void ScrollToAbsPos( long nPos ); @@ -386,9 +386,9 @@ inline const Image& SvImpLBox::GetDefaultEntryColBmp( ) return implGetImageLocation( ImageType::EntryDefCollapsed ); } -inline Point SvImpLBox::GetEntryPosition( SvTreeListEntry* pEntry ) const +inline Point SvImpLBox::GetEntryPosition(const SvTreeListEntry* pEntry) const { - return Point( 0, GetEntryLine( pEntry ) ); + return Point(0, GetEntryLine(pEntry)); } inline bool SvImpLBox::IsLineVisible( long nY ) const diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx index 45740a38cde5..527070bac11a 100644 --- a/vcl/source/treelist/iconview.cxx +++ b/vcl/source/treelist/iconview.cxx @@ -47,7 +47,7 @@ void IconView::Resize() SvTreeListBox::Resize(); } -tools::Rectangle IconView::GetFocusRect( SvTreeListEntry*, long nEntryPos ) +tools::Rectangle IconView::GetFocusRect(const SvTreeListEntry*, long nEntryPos) { Size aSize; aSize.setHeight( nEntryHeight ); diff --git a/vcl/source/treelist/iconviewimpl.cxx b/vcl/source/treelist/iconviewimpl.cxx index 3494dee741bc..5df7ae1a7345 100644 --- a/vcl/source/treelist/iconviewimpl.cxx +++ b/vcl/source/treelist/iconviewimpl.cxx @@ -207,7 +207,7 @@ void IconViewImpl::KeyUp( bool bPageUp ) EndScroll(); } -long IconViewImpl::GetEntryLine( SvTreeListEntry* pEntry ) const +long IconViewImpl::GetEntryLine(const SvTreeListEntry* pEntry) const { if(!m_pStartEntry ) return -1; // invisible position @@ -219,7 +219,7 @@ long IconViewImpl::GetEntryLine( SvTreeListEntry* pEntry ) const return nFirstVisPos; } -Point IconViewImpl::GetEntryPosition( SvTreeListEntry* pEntry ) const +Point IconViewImpl::GetEntryPosition(const SvTreeListEntry* pEntry) const { const int pos = m_pView->GetAbsPos( pEntry ); diff --git a/vcl/source/treelist/iconviewimpl.hxx b/vcl/source/treelist/iconviewimpl.hxx index 5f8d4d89956e..efc58795084f 100644 --- a/vcl/source/treelist/iconviewimpl.hxx +++ b/vcl/source/treelist/iconviewimpl.hxx @@ -34,7 +34,7 @@ public: void KeyUp( bool bPageUp ) override; - Point GetEntryPosition( SvTreeListEntry* pEntry ) const override; + Point GetEntryPosition(const SvTreeListEntry* pEntry) const override; SvTreeListEntry* GetClickedEntry( const Point& rPoint ) const override; @@ -52,7 +52,7 @@ public: void InvalidateEntry( long nId ) const override; protected: - long GetEntryLine( SvTreeListEntry* pEntry ) const override; + long GetEntryLine(const SvTreeListEntry* pEntry) const override; void CursorUp() override; void CursorDown() override; diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index bc407216a696..5a2e1990a502 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -1437,7 +1437,7 @@ bool SvImpLBox::IsEntryInView( SvTreeListEntry* pEntry ) const } -long SvImpLBox::GetEntryLine( SvTreeListEntry* pEntry ) const +long SvImpLBox::GetEntryLine(const SvTreeListEntry* pEntry) const { if(!m_pStartEntry ) return -1; // invisible position @@ -3292,8 +3292,8 @@ void SvImpLBox::ShowFocusRect( const SvTreeListEntry* pEntry ) { if( pEntry ) { - long nY = GetEntryLine( const_cast(pEntry) ); - tools::Rectangle aRect = m_pView->GetFocusRect( const_cast(pEntry), nY ); + long nY = GetEntryLine(pEntry); + tools::Rectangle aRect = m_pView->GetFocusRect(pEntry, nY); vcl::Region aOldClip( m_pView->GetClipRegion()); vcl::Region aClipRegion( GetClipRegionRect() ); m_pView->SetClipRegion( aClipRegion ); diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 6c25d2fd658e..b4f73dbd9b8f 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -2374,7 +2374,7 @@ Image const & SvTreeListBox::GetExpandedNodeBmp( ) const return pImpl->GetExpandedNodeBmp( ); } -Point SvTreeListBox::GetEntryPosition( SvTreeListEntry* pEntry ) const +Point SvTreeListBox::GetEntryPosition(const SvTreeListEntry* pEntry) const { return pImpl->GetEntryPosition( pEntry ); } @@ -2890,7 +2890,7 @@ void SvTreeListBox::PreparePaint(vcl::RenderContext& /*rRenderContext*/, SvTreeL { } -tools::Rectangle SvTreeListBox::GetFocusRect( SvTreeListEntry* pEntry, long nLine ) +tools::Rectangle SvTreeListBox::GetFocusRect(const SvTreeListEntry* pEntry, long nLine ) { pImpl->UpdateContextBmpWidthMax( pEntry ); @@ -2925,7 +2925,7 @@ tools::Rectangle SvTreeListBox::GetFocusRect( SvTreeListEntry* pEntry, long nLin { if( pTab && nCurTab < pEntry->ItemCount() ) { - SvLBoxItem& rItem = pEntry->GetItem( nCurTab ); + const SvLBoxItem& rItem = pEntry->GetItem( nCurTab ); aSize.setWidth(rItem.GetWidth(this, pEntry)); if( !aSize.Width() ) aSize.setWidth( 15 ); @@ -2986,7 +2986,7 @@ tools::Rectangle SvTreeListBox::GetFocusRect( SvTreeListEntry* pEntry, long nLin return aRect; } -sal_IntPtr SvTreeListBox::GetTabPos( SvTreeListEntry* pEntry, SvLBoxTab* pTab) +sal_IntPtr SvTreeListBox::GetTabPos(const SvTreeListEntry* pEntry, SvLBoxTab* pTab) { assert(pTab); sal_IntPtr nPos = pTab->GetPos(); @@ -3586,7 +3586,7 @@ void SvTreeListBox::FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, ::utl: } } -tools::Rectangle SvTreeListBox::GetBoundingRect( SvTreeListEntry* pEntry ) +tools::Rectangle SvTreeListBox::GetBoundingRect(const SvTreeListEntry* pEntry) { Point aPos = GetEntryPosition( pEntry ); tools::Rectangle aRect = GetFocusRect( pEntry, aPos.Y() );