include/svl/style.hxx | 6 +++--- svl/source/items/style.cxx | 8 ++++---- sw/inc/docstyle.hxx | 2 +- sw/source/uibase/app/docstyle.cxx | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-)
New commits: commit 94be0c12fe419cc7f50f5cfc6cdf161805e7490f Author: Caolán McNamara <[email protected]> AuthorDate: Mon Jun 20 09:44:28 2022 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Jun 20 14:41:48 2022 +0200 SfxStyleSheetBasePool::Find can be const Change-Id: I5cf2737d05cfe4b0be936a77cfb96db053483438 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136141 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/include/svl/style.hxx b/include/svl/style.hxx index b5b7aa3adcf5..29127eb77356 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -192,7 +192,7 @@ public: /** Constructor. * The iterator will only iterate over style sheets which have the family \p eFam */ - SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase, + SfxStyleSheetIterator(const SfxStyleSheetBasePool *pBase, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All ); SfxStyleSearchBits GetSearchMask() const; SfxStyleFamily GetSearchFamily() const; @@ -207,7 +207,7 @@ public: protected: - SfxStyleSheetBasePool* pBasePool; + const SfxStyleSheetBasePool* pBasePool; SfxStyleFamily nSearchFamily; SfxStyleSearchBits nMask; @@ -274,7 +274,7 @@ public: SfxStyleSheetBase* First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask = SfxStyleSearchBits::All); SfxStyleSheetBase* Next(); - virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All ); + virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All ) const; virtual bool SetParent(SfxStyleFamily eFam, const OUString &rStyle, diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 50952a8857d2..0179635f7493 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -385,12 +385,12 @@ struct DoesStyleMatchStyleSheetPredicate final : public svl::StyleSheetPredicate } -SfxStyleSheetIterator::SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase, +SfxStyleSheetIterator::SfxStyleSheetIterator(const SfxStyleSheetBasePool *pBase, SfxStyleFamily eFam, SfxStyleSearchBits n) - : pCurrentStyle(nullptr) + : pBasePool(pBase) + , pCurrentStyle(nullptr) , mnCurrentPosition(0) { - pBasePool=pBase; nSearchFamily=eFam; bSearchUsed=false; if( (( n & SfxStyleSearchBits::AllVisible ) != SfxStyleSearchBits::AllVisible ) @@ -690,7 +690,7 @@ SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator+=( const SfxStyleSheetBas SfxStyleSheetBase* SfxStyleSheetBasePool::Find(const OUString& rName, SfxStyleFamily eFamily, - SfxStyleSearchBits eMask) + SfxStyleSearchBits eMask) const { SfxStyleSheetIterator aIter(this, eFamily, eMask); return aIter.Find(rName); diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index 91a03b8614b9..d727245c059e 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -222,7 +222,7 @@ public: SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override; virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam, - SfxStyleSearchBits n=SfxStyleSearchBits::All ) override; + SfxStyleSearchBits n=SfxStyleSearchBits::All ) const override; virtual bool SetParent( SfxStyleFamily eFam, const OUString &rStyle, const OUString &rParent ) override; diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index efaf6853e0ad..7bc284a4824f 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -2578,8 +2578,8 @@ bool SwDocStyleSheetPool::SetParent( SfxStyleFamily eFam, return bRet; } -SfxStyleSheetBase* SwDocStyleSheetPool::Find( const OUString& rName, - SfxStyleFamily eFam, SfxStyleSearchBits n ) +SfxStyleSheetBase* SwDocStyleSheetPool::Find(const OUString& rName, + SfxStyleFamily eFam, SfxStyleSearchBits n) const { SfxStyleSearchBits nSMask = n; if( SfxStyleFamily::Para == eFam && m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) ) @@ -2706,14 +2706,14 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() // Delete current mxIterSheet->Reset(); - SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc(); + const SwDoc& rDoc = static_cast<const SwDocStyleSheetPool*>(pBasePool)->GetDoc(); const SfxStyleSearchBits nSrchMask = nMask; const bool bIsSearchUsed = SearchUsed(); bool bSearchHidden( nMask & SfxStyleSearchBits::Hidden ); bool bOnlyHidden = nMask == SfxStyleSearchBits::Hidden; - const bool bOrganizer = static_cast<SwDocStyleSheetPool*>(pBasePool)->IsOrganizerMode(); + const bool bOrganizer = static_cast<const SwDocStyleSheetPool*>(pBasePool)->IsOrganizerMode(); bool bAll = ( nSrchMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible; if( nSearchFamily == SfxStyleFamily::Char @@ -3154,7 +3154,7 @@ void SwStyleSheetIterator::AppendStyleList(const std::vector<OUString>& rList, bool bTestUsed, bool bTestHidden, bool bOnlyHidden, SwGetPoolIdFromName nSection, SfxStyleFamily eFamily ) { - SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc(); + const SwDoc& rDoc = static_cast<const SwDocStyleSheetPool*>(pBasePool)->GetDoc(); bool bUsed = false; for (const auto & i : rList) {
