editeng/inc/ContentNode.hxx | 2 - editeng/source/editeng/ContentNode.cxx | 2 - editeng/source/editeng/editobj.cxx | 4 +- editeng/source/editeng/editobj2.hxx | 2 - sw/inc/fesh.hxx | 2 - sw/source/core/frmedt/fefly1.cxx | 4 +- sw/source/filter/ww8/ww8par2.hxx | 4 +- sw/source/filter/ww8/ww8par6.cxx | 10 ++--- sw/source/uibase/shells/basesh.cxx | 56 +++++++++++++++++---------------- 9 files changed, 44 insertions(+), 42 deletions(-)
New commits: commit 80c90897657896b94689513119bf05eafc21519b Author: rafaelhlima <rafael.palma.l...@gmail.com> AuthorDate: Wed Jan 15 20:40:48 2025 -0300 Commit: Rafael Lima <rafael.palma.l...@gmail.com> CommitDate: Fri Jan 31 00:58:48 2025 +0100 tdf#164685 Cleanup SfxItemSetFixed - Part 2 This is the continuation of the cleanup of class SfxItemSetFixed. This patch contains a few edge cases, more specifically when SfxItemSetFixed is used in header files. Change-Id: I2ed48177ca53311b20b9e2a8aed95d3b1c87f250 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180309 Tested-by: Jenkins Reviewed-by: Rafael Lima <rafael.palma.l...@gmail.com> diff --git a/editeng/inc/ContentNode.hxx b/editeng/inc/ContentNode.hxx index 6b764ccbb524..b802be9c87a8 100644 --- a/editeng/inc/ContentNode.hxx +++ b/editeng/inc/ContentNode.hxx @@ -38,7 +38,7 @@ class ContentAttribs { private: SfxStyleSheet* mpStyle = nullptr; - SfxItemSetFixed<EE_PARA_START, EE_CHAR_END> maAttribSet; + SfxItemSet maAttribSet; public: ContentAttribs(SfxItemPool& rItemPool); diff --git a/editeng/source/editeng/ContentNode.cxx b/editeng/source/editeng/ContentNode.cxx index 3721016db04c..8937b39002c7 100644 --- a/editeng/source/editeng/ContentNode.cxx +++ b/editeng/source/editeng/ContentNode.cxx @@ -649,7 +649,7 @@ void ContentNode::checkAndDeleteEmptyAttribs() const } ContentAttribs::ContentAttribs( SfxItemPool& rPool ) - : maAttribSet(rPool) + : maAttribSet(SfxItemSet::makeFixedSfxItemSet<EE_PARA_START, EE_CHAR_END>(rPool)) { } diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 536d7c2c6acb..858dec873a9e 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -87,7 +87,7 @@ const XParaPortion& XParaPortionList::operator [](size_t i) const ContentInfo::ContentInfo( SfxItemPool& rPool ) : eFamily(SfxStyleFamily::Para), - aParaAttribs(rPool) + aParaAttribs(SfxItemSet::makeFixedSfxItemSet<EE_PARA_START, EE_CHAR_END>(rPool)) { } @@ -96,7 +96,7 @@ ContentInfo::ContentInfo( const ContentInfo& rCopyFrom, SfxItemPool& rPoolToUse maText(rCopyFrom.maText), aStyle(rCopyFrom.aStyle), eFamily(rCopyFrom.eFamily), - aParaAttribs(rPoolToUse) + aParaAttribs(SfxItemSet::makeFixedSfxItemSet<EE_PARA_START, EE_CHAR_END>(rPoolToUse)) { // this should ensure that the Items end up in the correct Pool! aParaAttribs.Set( rCopyFrom.GetParaAttribs() ); diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index 9cfe1c09f5e5..30797fb8f238 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -125,7 +125,7 @@ private: std::vector<XEditAttribute> maCharAttribs; SfxStyleFamily eFamily; - SfxItemSetFixed<EE_PARA_START, EE_CHAR_END> aParaAttribs; + SfxItemSet aParaAttribs; std::unique_ptr<WrongList> mpWrongs; diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index c1b1ae7e9881..0c70295e9370 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -387,7 +387,7 @@ public: SW_DLLPUBLIC bool IsFrameSelected() const; bool GetFlyFrameAttr( SfxItemSet &rSet ) const; SW_DLLPUBLIC bool SetFlyFrameAttr( SfxItemSet &rSet ); - static SfxItemSetFixed<RES_VERT_ORIENT, RES_ANCHOR> makeItemSetFromFormatAnchor(SfxItemPool& rPool, const SwFormatAnchor &rAnchor); + static SfxItemSet makeItemSetFromFormatAnchor(SfxItemPool& rPool, const SwFormatAnchor &rAnchor); void ResetFlyFrameAttr( const SfxItemSet* pSet ); SW_DLLPUBLIC const SwFrameFormat *NewFlyFrame( const SfxItemSet &rSet, bool bAnchValid = false, SwFrameFormat *pParent = nullptr ); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index f8e68a65a001..fbcf6f823991 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1240,12 +1240,12 @@ bool SwFEShell::SetFlyFrameAttr( SfxItemSet& rSet ) return bRet; } -SfxItemSetFixed<RES_VERT_ORIENT, RES_ANCHOR> SwFEShell::makeItemSetFromFormatAnchor(SfxItemPool& rPool, const SwFormatAnchor &rAnchor) +SfxItemSet SwFEShell::makeItemSetFromFormatAnchor(SfxItemPool& rPool, const SwFormatAnchor &rAnchor) { // The set also includes VERT/HORI_ORIENT, because the align // shall be changed in FEShell::SetFlyFrameAttr/SetFlyFrameAnchor, // possibly as a result of the anchor change. - SfxItemSetFixed<RES_VERT_ORIENT, RES_ANCHOR> aSet(rPool); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_VERT_ORIENT, RES_ANCHOR>(rPool)); aSet.Put(rAnchor); return aSet; } diff --git a/sw/source/filter/ww8/ww8par2.hxx b/sw/source/filter/ww8/ww8par2.hxx index 9834c518a058..4ea805d08115 100644 --- a/sw/source/filter/ww8/ww8par2.hxx +++ b/sw/source/filter/ww8/ww8par2.hxx @@ -39,7 +39,7 @@ private: WW8DupProperties(const WW8DupProperties&) = delete; WW8DupProperties& operator=(const WW8DupProperties&) = delete; SwWW8FltControlStack* m_pCtrlStck; - SfxItemSetFixed<RES_CHRATR_BEGIN, RES_CHRATR_END - 1> m_aChrSet,m_aParSet; + SfxItemSet m_aChrSet, m_aParSet; }; struct WW8SwFlyPara @@ -140,7 +140,7 @@ public: SprmResult HasParaSprm(sal_uInt16 nId) const; }; -class WW8FlySet: public SfxItemSetFixed<RES_FRMATR_BEGIN,RES_FRMATR_END-1> +class WW8FlySet: public SfxItemSet { private: const WW8FlySet& operator=(const WW8FlySet&) = delete; diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 5423a52f4043..44c8024d8c51 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2178,12 +2178,12 @@ void WW8SwFlyPara::SetFlyFormat(SwFlyFrameFormat* pNewFlyFormat) m_xFlyFormat.reset(); } -// The class WW8FlySet is derived from SfxItemSetFixed and does not +// The class WW8FlySet is derived from SfxItemSet and does not // provide more, but is easier to handle for me. // WW8FlySet-ctor for Apos and graphics Apos WW8FlySet::WW8FlySet(SwWW8ImplReader& rReader, const WW8FlyPara* pFW, const WW8SwFlyPara* pFS, bool bGraf) - : SfxItemSetFixed(rReader.m_rDoc.GetAttrPool()) + : SfxItemSet(rReader.m_rDoc.GetAttrPool(), WhichRangesContainer(svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END-1>)) { Reader::ResetFrameFormatAttrs(*this); // remove distance/border // position @@ -2240,7 +2240,7 @@ WW8FlySet::WW8FlySet(SwWW8ImplReader& rReader, const WW8FlyPara* pFW, // WW8FlySet-ctor for character bound graphics WW8FlySet::WW8FlySet( SwWW8ImplReader& rReader, const SwPaM* pPaM, const WW8_PIC& rPic, tools::Long nWidth, tools::Long nHeight ) - : SfxItemSetFixed<RES_FRMATR_BEGIN,RES_FRMATR_END-1>(rReader.m_rDoc.GetAttrPool()) + : SfxItemSet(rReader.m_rDoc.GetAttrPool(), WhichRangesContainer(svl::Items<RES_FRMATR_BEGIN,RES_FRMATR_END-1>)) { Init(rReader, pPaM); @@ -2293,8 +2293,8 @@ void WW8FlySet::Init(const SwWW8ImplReader& rReader, const SwPaM* pPaM) WW8DupProperties::WW8DupProperties(SwDoc &rDoc, SwWW8FltControlStack *pStack) : m_pCtrlStck(pStack), - m_aChrSet(rDoc.GetAttrPool()), - m_aParSet(rDoc.GetAttrPool()) + m_aChrSet(SfxItemSet::makeFixedSfxItemSet<RES_CHRATR_BEGIN, RES_CHRATR_END - 1>(rDoc.GetAttrPool())), + m_aParSet(SfxItemSet::makeFixedSfxItemSet<RES_CHRATR_BEGIN, RES_CHRATR_END - 1>(rDoc.GetAttrPool())) { //Close any open character properties and duplicate them inside the //first table cell diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index b1e52d29e750..b49af5a0e2e9 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -176,7 +176,7 @@ static void lcl_UpdateIMapDlg( SwWrtShell& rSh ) TargetList aList; SfxFrame::GetDefaultTargetList(aList); - SfxItemSetFixed<RES_URL, RES_URL> aSet( rSh.GetAttrPool() ); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_URL, RES_URL>(rSh.GetAttrPool())); rSh.GetFlyFrameAttr( aSet ); const SwFormatURL &rURL = aSet.Get( RES_URL ); SvxIMapDlgChildWindow::UpdateIMapDlg( @@ -1302,7 +1302,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) if ( rSh.IsFrameSelected() && pDlg->GetEditingObject() == rSh.GetIMapInventor() ) { - SfxItemSetFixed<RES_URL, RES_URL> aSet( rSh.GetAttrPool() ); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_URL, RES_URL>(rSh.GetAttrPool())); rSh.GetFlyFrameAttr( aSet ); SwFormatURL aURL( aSet.Get( RES_URL ) ); aURL.SetMap( &pDlg->GetImageMap() ); @@ -1355,7 +1355,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) if (pDlg && pDlg->GetEditingObject() == rSh.GetIMapInventor()) { rSh.StartAction(); - SfxItemSetFixed<RES_SURROUND, RES_SURROUND> aSet( rSh.GetAttrPool() ); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_SURROUND, RES_SURROUND>(rSh.GetAttrPool())); rSh.GetFlyFrameAttr( aSet ); SwFormatSurround aSur( aSet.Get( RES_SURROUND ) ); if ( !aSur.IsContour() ) @@ -1417,7 +1417,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); if( nHtmlMode ) { - SfxItemSetFixed<RES_SURROUND, RES_HORI_ORIENT> aSet(GetPool()); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_SURROUND, RES_HORI_ORIENT>(GetPool())); rSh.GetFlyFrameAttr(aSet); const SwFormatSurround& rSurround = aSet.Get(RES_SURROUND); @@ -1670,7 +1670,7 @@ IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl, SwCursorShell&, void) case FN_FRAME_WRAP_CONTOUR: if( !bProtect ) { - SfxItemSetFixed<RES_SURROUND, RES_SURROUND> aSet(GetPool()); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_SURROUND, RES_SURROUND>(GetPool())); rSh.GetFlyFrameAttr(aSet); const SwFormatSurround& rWrap = aSet.Get(RES_SURROUND); bSetState = true; @@ -1777,7 +1777,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) break; case RES_SHADOW: { - SfxItemSetFixed<RES_SHADOW, RES_SHADOW> aSet( rSh.GetAttrPool()); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_SHADOW, RES_SHADOW>(rSh.GetAttrPool())); // Table cell(s) selected? if ( rSh.IsTableMode() ) @@ -1959,7 +1959,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) if( !bParentCntProt && (bObj || rSh.IsFrameSelected())) { - SfxItemSetFixed<RES_ANCHOR, RES_ANCHOR> aSet(GetPool()); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_ANCHOR, RES_ANCHOR>(GetPool())); if(bObj) rSh.GetObjAttr(aSet); else @@ -2010,7 +2010,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) if( !bParentCntProt && (bObj || rSh.IsFrameSelected())) { - SfxItemSetFixed<RES_OPAQUE, RES_ANCHOR> aSet(GetPool()); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_OPAQUE, RES_ANCHOR>(GetPool())); RndStdIds nAnchorType; if(bObj) { @@ -2212,7 +2212,7 @@ void SwBaseShell::SetWrapMode( sal_uInt16 nSlot ) if( !bObj && !rSh.IsFrameSelected()) return; - SfxItemSetFixed<RES_OPAQUE, RES_SURROUND> aSet(GetPool()); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<RES_OPAQUE, RES_SURROUND>(GetPool())); if(bObj) rSh.GetObjAttr(aSet); else @@ -2370,10 +2370,10 @@ void SwBaseShell::ExecTextCtrl( SfxRequest& rReq ) SfxItemPool& rPool = rSh.GetAttrPool(); sal_uInt16 nWhich = rPool.GetWhichIDFromSlotID( nSlot ); SvtScriptType nScripts = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX; - SfxItemSetFixed<RES_CHRATR_FONTSIZE, RES_CHRATR_FONTSIZE, - RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, - RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_FONTSIZE> - aHeightSet( GetPool() ); + SfxItemSet aHeightSet(SfxItemSet::makeFixedSfxItemSet< + RES_CHRATR_FONTSIZE, RES_CHRATR_FONTSIZE, + RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, + RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_FONTSIZE>(GetPool())); switch( nSlot ) { @@ -2415,10 +2415,10 @@ void SwBaseShell::ExecTextCtrl( SfxRequest& rReq ) sal_uInt32 nHeight = static_cast< const SvxFontHeightItem& >(pArgs->Get( nWhich )).GetHeight(); SwStdFontConfig* pStdFont = SwModule::get()->GetStdFontConfig(); - SfxItemSetFixed<RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, - RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, - RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE> - aLangSet( GetPool() ); + SfxItemSet aLangSet(SfxItemSet::makeFixedSfxItemSet< + RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, + RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, + RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE>(GetPool())); rSh.GetCurAttr( aLangSet ); sal_Int32 nWesternSize = @@ -2593,7 +2593,7 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet) else { // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set - SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aCoreSet(GetPool()); + SfxItemSet aCoreSet(SfxItemSet::makeFixedSfxItemSet<XATTR_FILL_FIRST, XATTR_FILL_LAST>(GetPool())); aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet()); @@ -2657,7 +2657,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) else { // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set - SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aCoreSet(GetPool()); + SfxItemSet aCoreSet(SfxItemSet::makeFixedSfxItemSet<XATTR_FILL_FIRST, XATTR_FILL_LAST>(GetPool())); aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet()); @@ -2725,7 +2725,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) else { // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set - SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aCoreSet(GetPool()); + SfxItemSet aCoreSet(SfxItemSet::makeFixedSfxItemSet<XATTR_FILL_FIRST, XATTR_FILL_LAST>(GetPool())); aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet()); setSvxBrushItemAsFillAttributesToTargetSet(*aBrushItem, aCoreSet); @@ -2770,8 +2770,9 @@ void SwBaseShell::GetBorderState(SfxItemSet &rSet) bool bTableMode = rSh.IsTableMode(); if ( bTableMode ) { - SfxItemSetFixed<RES_BOX, RES_BOX, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet( GetPool() ); + SfxItemSet aCoreSet(SfxItemSet::makeFixedSfxItemSet< + RES_BOX, RES_BOX, SID_ATTR_BORDER_INNER, + SID_ATTR_BORDER_INNER>(GetPool())); SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); aCoreSet.Put( aBoxInfo ); rSh.GetTabBorders( aCoreSet ); @@ -2857,8 +2858,8 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) break; case FN_FORMAT_BORDER_DLG: { - SfxItemSetFixed<RES_BOX , RES_SHADOW, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aSet( rSh.GetAttrPool() ); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet< + RES_BOX, RES_SHADOW, SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>(rSh.GetAttrPool())); ScopedVclPtr<SfxAbstractDialog> pDlg; // Table cell(s) selected? if ( rSh.IsTableMode() ) @@ -2912,8 +2913,9 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) break; case FN_FORMAT_BACKGROUND_DLG: { - SfxItemSetFixed<RES_BACKGROUND, RES_BACKGROUND, - XATTR_FILL_FIRST, XATTR_FILL_LAST> aSet( rSh.GetAttrPool() ); + SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet< + RES_BACKGROUND, RES_BACKGROUND, + XATTR_FILL_FIRST, XATTR_FILL_LAST>(rSh.GetAttrPool())); ScopedVclPtr<SfxAbstractDialog> pDlg; SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); @@ -3312,7 +3314,7 @@ void SwBaseShell::ExecuteGallery(SfxRequest &rReq) rSh.SetBoxBackground( aBrush ); else if ( nPos == nFramePos || nPos == nGraphicPos || nPos == nOlePos ) { - SfxItemSetFixed<RES_BACKGROUND, RES_BACKGROUND> aCoreSet(GetPool()); + SfxItemSet aCoreSet(SfxItemSet::makeFixedSfxItemSet<RES_BACKGROUND, RES_BACKGROUND>(GetPool())); aCoreSet.Put( aBrush ); rSh.SetFlyFrameAttr( aCoreSet ); }