include/svl/style.hxx | 3 -- sc/source/filter/excel/xeextlst.cxx | 3 +- sd/source/core/drawdoc3.cxx | 4 +-- sfx2/source/dialog/styledlg.cxx | 2 - sw/source/core/doc/docdesc.cxx | 2 - sw/source/core/unocore/unostyle.cxx | 39 ++++++++++++++++++------------------ 6 files changed, 26 insertions(+), 27 deletions(-)
New commits: commit e3517eefed2d4767648cb52d4a9863908cadc3d8 Author: Caolán McNamara <[email protected]> AuthorDate: Sun May 3 17:11:24 2020 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Sun May 3 21:28:50 2020 +0200 Related: tdf#130108 expand single arg SfxStyleSheetBasePool::Find uses remove it and expand its uses to explicitly show what it does Change-Id: I2d4511c58b51003c327a2c70e3cc4f60751f520d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93352 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/include/svl/style.hxx b/include/svl/style.hxx index 9ed7122d4238..1c71e0d39478 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -282,9 +282,6 @@ public: const OUString &rStyle, const OUString &rParent); - SfxStyleSheetBase* Find(const OUString& rStr) - { return Find(rStr, nSearchFamily, nMask); } - void SetSearchMask(SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All ); SfxStyleSearchBits GetSearchMask() const { return nMask;} SfxStyleFamily GetSearchFamily() const { return nSearchFamily; } diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx index a034472b8bb1..0b2efd97ef22 100644 --- a/sc/source/filter/excel/xeextlst.cxx +++ b/sc/source/filter/excel/xeextlst.cxx @@ -152,7 +152,8 @@ XclExpExtCF::XclExpExtCF( const XclExpRoot& rRoot, const ScCondFormatEntry& rFor void XclExpExtCF::SaveXml( XclExpXmlStream& rStrm ) { OUString aStyleName = mrFormat.GetStyle(); - SfxStyleSheetBase* pStyle = GetDoc().GetStyleSheetPool()->Find(aStyleName); + SfxStyleSheetBasePool* pPool = GetDoc().GetStyleSheetPool(); + SfxStyleSheetBase* pStyle = pPool->Find(aStyleName, pPool->GetSearchFamily(), pPool->GetSearchMask()); SfxItemSet& rSet = pStyle->GetItemSet(); std::unique_ptr<ScTokenArray> pTokenArray(mrFormat.CreateFlatCopiedTokenArray(0)); diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 4e2c364f3c53..95d530155309 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -1584,8 +1584,8 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum, { for ( const auto& rRData : aReplList ) { - SfxStyleSheetBase* pSOld = mxStyleSheetPool->Find(rRData.aName); - SfxStyleSheetBase* pSNew = mxStyleSheetPool->Find(rRData.aNewName); + SfxStyleSheetBase* pSOld = mxStyleSheetPool->Find(rRData.aName, mxStyleSheetPool->GetSearchFamily(), mxStyleSheetPool->GetSearchMask()); + SfxStyleSheetBase* pSNew = mxStyleSheetPool->Find(rRData.aNewName, mxStyleSheetPool->GetSearchFamily(), mxStyleSheetPool->GetSearchMask()); if (pSOld && pSNew) { diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx index e86f63f9ef53..133c338d1176 100644 --- a/sfx2/source/dialog/styledlg.cxx +++ b/sfx2/source/dialog/styledlg.cxx @@ -113,7 +113,7 @@ OUString SfxStyleDialogController::GenerateUnusedName(SfxStyleSheetBasePool &rPo OUString aNo(SfxResId(STR_NONAME)); sal_uInt16 i = 1; OUString aNoName = aNo + OUString::number(i); - while (rPool.Find(aNoName)) + while (rPool.Find(aNoName, rPool.GetSearchFamily(), rPool.GetSearchMask())) { ++i; aNoName = aNo + OUString::number(i); diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index eccbe3cc1b3a..59a287e5959d 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -603,7 +603,7 @@ void SwDoc::BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamil if (pPool) { pPool->SetSearchMask(eFamily); - SfxStyleSheetBase * pBase = pPool->Find(rName); + SfxStyleSheetBase* pBase = pPool->Find(rName, pPool->GetSearchFamily(), pPool->GetSearchMask()); if (pBase != nullptr) pPool->Broadcast(SfxStyleSheetHint( nOp, *pBase )); diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 8236d9d928dd..328334961eb1 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -891,7 +891,7 @@ uno::Any XStyleFamily::getByName(const OUString& rName) if(!m_pBasePool) throw uno::RuntimeException(); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); if(!pBase) throw container::NoSuchElementException(); uno::Reference<style::XStyle> xStyle = FindStyle(sStyleName); @@ -924,7 +924,7 @@ sal_Bool XStyleFamily::hasByName(const OUString& rName) OUString sStyleName; SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.m_aPoolId); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); return nullptr != pBase; } @@ -937,8 +937,8 @@ void XStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement) OUString sStyleName; SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.m_aPoolId); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName); - SfxStyleSheetBase* pUINameBase = m_pBasePool->Find( sStyleName ); + SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); + SfxStyleSheetBase* pUINameBase = m_pBasePool->Find(sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); if(pBase || pUINameBase) throw container::ElementExistException(); if(rElement.getValueType().getTypeClass() != uno::TypeClass_INTERFACE) @@ -990,7 +990,7 @@ void XStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement) if (!sParentStyleName.isEmpty()) { m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pParentBase = m_pBasePool->Find(sParentStyleName); + SfxStyleSheetBase* pParentBase = m_pBasePool->Find(sParentStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); if(pParentBase && pParentBase->GetFamily() == m_rEntry.m_eFamily && pParentBase->GetPool() == m_pBasePool) m_pBasePool->SetParent(m_rEntry.m_eFamily, sStyleName, sParentStyleName); @@ -1008,7 +1008,7 @@ void XStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement OUString sStyleName; SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.m_aPoolId); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); // replacements only for userdefined styles if(!pBase) throw container::NoSuchElementException(); @@ -1070,7 +1070,7 @@ void XStyleFamily::removeByName(const OUString& rName) m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); OUString sName; SwStyleNameMapper::FillUIName(rName, sName, m_rEntry.m_aPoolId); - SfxStyleSheetBase* pBase = m_pBasePool->Find( sName ); + SfxStyleSheetBase* pBase = m_pBasePool->Find(sName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); if(!pBase) throw container::NoSuchElementException(); if (SwGetPoolIdFromName::CellStyle == m_rEntry.m_aPoolId) @@ -1306,7 +1306,7 @@ static bool lcl_InitConditional(SfxStyleSheetBasePool* pBasePool, const SfxStyle if(!pBasePool || eFamily != SfxStyleFamily::Para) return false; pBasePool->SetSearchMask(eFamily); - SfxStyleSheetBase* pBase = pBasePool->Find(rStyleName); + SfxStyleSheetBase* pBase = pBasePool->Find(rStyleName, pBasePool->GetSearchFamily(), pBasePool->GetSearchMask()); SAL_WARN_IF(!pBase, "sw.uno", "where is the style?" ); if(!pBase) return false; @@ -1375,7 +1375,7 @@ OUString SwXStyle::getName() if(!m_pBasePool) return m_sStyleName; m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); SAL_WARN_IF(!pBase, "sw.uno", "where is the style?"); if(!pBase) throw uno::RuntimeException(); @@ -1393,7 +1393,7 @@ void SwXStyle::setName(const OUString& rName) return; } m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); SAL_WARN_IF(!pBase, "sw.uno", "where is the style?"); if(!pBase || !pBase->IsUserDefined()) throw uno::RuntimeException(); @@ -1409,7 +1409,7 @@ sal_Bool SwXStyle::isUserDefined() if(!m_pBasePool) throw uno::RuntimeException(); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); //if it is not found it must be non user defined return pBase && pBase->IsUserDefined(); } @@ -1420,7 +1420,7 @@ sal_Bool SwXStyle::isInUse() if(!m_pBasePool) throw uno::RuntimeException(); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, SfxStyleSearchBits::Used); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); return pBase && pBase->IsUsed(); } @@ -1434,7 +1434,7 @@ OUString SwXStyle::getParentStyle() return m_sParentStyleName; } m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); OUString aString; if(pBase) aString = pBase->GetParent(); @@ -1462,7 +1462,7 @@ void SwXStyle::setParentStyle(const OUString& rParentStyle) return; } m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); if(!pBase) throw uno::RuntimeException(); rtl::Reference<SwDocStyleSheet> xBase(new SwDocStyleSheet(*static_cast<SwDocStyleSheet*>(pBase))); @@ -2076,7 +2076,7 @@ void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNa { const SfxStyleSearchBits nSaveMask = m_pBasePool->GetSearchMask(); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, nSaveMask); SAL_WARN_IF(!pBase, "sw.uno", "where is the style?"); if(!pBase) @@ -2129,7 +2129,7 @@ SfxStyleSheetBase* SwXStyle::GetStyleSheetBase() return nullptr; const SfxStyleSearchBits nSaveMask = m_pBasePool->GetSearchMask(); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, nSaveMask ); return pBase; } @@ -2521,7 +2521,7 @@ uno::Sequence<beans::PropertyState> SwXStyle::getPropertyStates(const uno::Seque if(!m_pBasePool) throw uno::RuntimeException(); m_pBasePool->SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName); + SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName, m_pBasePool->GetSearchFamily(), m_pBasePool->GetSearchMask()); SAL_WARN_IF(!pBase, "sw.uno", "where is the style?"); if(!pBase) @@ -2817,8 +2817,9 @@ void SwXStyle::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) } else if(rHint.GetId() == SfxHintId::StyleSheetChanged) { - static_cast<SfxStyleSheetBasePool&>(rBC).SetSearchMask(m_rEntry.m_eFamily); - SfxStyleSheetBase* pOwnBase = static_cast<SfxStyleSheetBasePool&>(rBC).Find(m_sStyleName); + SfxStyleSheetBasePool& rBP = static_cast<SfxStyleSheetBasePool&>(rBC); + rBP.SetSearchMask(m_rEntry.m_eFamily); + SfxStyleSheetBase* pOwnBase = rBP.Find(m_sStyleName, rBP.GetSearchFamily(), rBP.GetSearchMask()); if(!pOwnBase) { SfxListener::EndListening(rBC); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
