diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-06-16 09:58:13 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-06-16 17:28:41 +0200 |
commit | 13bb5a4b09f5b2ad19dad1b55f45d0fe2b2fb908 (patch) | |
tree | d38ad18688a292ff6ccdfaa7c51080197ec95934 /svx | |
parent | f83d8ae84584c0967e2346566d21d65d6d7a432f (diff) |
Make SfxItemSet ranges correct by construction
This is a follow-up to 45a7f5b62d0b1b21763c1c94255ef2309ea4280b "Keep WID ranges
sorted, and join adjacent ones". While SfxItemSet::MergeRange relies on the
m_pWhichRanges being sorted (and, under DBG_UTIL, asserts if they are not), the
various SfxItemSet constructors curiously only check (via assert or DBG_ASSERT)
that each individual range has an upper bound not smaller than its lower bound.
Arguably, all SfxItemSet instances should fulfill the stronger guarantees
required and checked by MergeRange.
And in many cases the ranges are statically known, so that the checking can
happen at compile time. Therefore, replace the two SfxItemSet ctors taking
explicit ranges with two other ctors that actually do proper checking. The
(templated) overload taking an svl::Items struct should be used in all cases
where the range values are statically known at compile time, while the overload
taking a std::initializer_list<Pair> is for the remaining cases (that can only
do runtime checking via assert). Most of those latter cases are simple cases
with a single range covering a single item, but a few are more complex.
(At least some of the uses of the existing SfxItemSet overload taking a
const sal_uInt16* pWhichPairTable
can probably also be strengthened, but that is left for another day.)
This commit is the first in a series of two. Apart from the manual changes to
compilerplugins/clang/store/sfxitemsetrewrite.cxx, include/svl/itemset.hxx, and
svl/source/items/itemset.cxx, it only consists of automatic rewriting of the
relevant SfxItemSet ctor calls (plus a few required manual fixes, see next).
But it does not yet check that the individual ranges are properly sorted (see
the TODO in svl::detail::validGap). That check will be enabled, and the ensuing
manual fixes will be made in a follow-up commit, to reduce the likelyhood of
accidents.
There were three cases of necessary manual intervention:
* sw/source/core/unocore/unostyle.cxx uses eAtr of enum type RES_FRMATR in
braced-init-list syntax now, so needs explicit narrowing conversion to
sal_uInt16.
* In sw/source/uibase/uiview/formatclipboard.cxx, the trailiing comma in the
definition of macro FORMAT_PAINTBRUSH_FRAME_IDS needed to be removed manually.
* In svx/source/svdraw/svdoashp.cxx, svx/source/svdraw/svdotext.cxx,
sw/source/uibase/app/docstyle.cxx, sw/source/uibase/shells/frmsh.cxx,
sw/source/uibase/shells/grfsh.cxx, and sw/source/uibase/shells/textsh1.cxx,
some comments had to be put back (see "TODO: the replaced range can contain
relevant comments" in compilerplugins/clang/store/sfxitemsetrewrite.cxx).
A few uses of the variadic form erroneously used nullptr instead of 0 for
termination. But this should have been harmless even if promoted std::nullptr_t
is larger than promoted sal_uInt16, assuming that the part of the nullptr value
that was interpreted as sal_uInt16/promoted int was all-zero bits. Similarly,
some uses made the harmless error of using 0L instead of 0.
Change-Id: I2afea97282803cb311b9321a99bb627520ef5e35
Reviewed-on: https://gerrit.libreoffice.org/38861
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svx')
36 files changed, 97 insertions, 142 deletions
diff --git a/svx/source/dialog/databaseregistrationui.cxx b/svx/source/dialog/databaseregistrationui.cxx index 4827a7580361..68c8ffa6bf7c 100644 --- a/svx/source/dialog/databaseregistrationui.cxx +++ b/svx/source/dialog/databaseregistrationui.cxx @@ -33,7 +33,7 @@ namespace svx { sal_uInt16 nResult = RET_CANCEL; - SfxItemSet aRegistrationItems( SfxGetpApp()->GetPool(), SID_SB_DB_REGISTER, SID_SB_DB_REGISTER, 0 ); + SfxItemSet aRegistrationItems( SfxGetpApp()->GetPool(), svl::Items<SID_SB_DB_REGISTER, SID_SB_DB_REGISTER>{} ); SvxAbstractDialogFactory* pDialogFactory = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractDialog> pDialog; diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index 17952278e00d..0fe4c3535fbd 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -131,9 +131,8 @@ void Svx3DPreviewControl::Construct() mpScene->SetRectsDirty(); SfxItemSet aSet( mpModel->GetItemPool(), - XATTR_LINESTYLE, XATTR_LINESTYLE, - XATTR_FILL_FIRST, XATTR_FILLBITMAP, - 0, 0 ); + svl::Items<XATTR_LINESTYLE, XATTR_LINESTYLE, + XATTR_FILL_FIRST, XATTR_FILLBITMAP>{} ); aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) ); aSet.Put( XFillColorItem( "", Color( COL_WHITE ) ) ); @@ -189,7 +188,7 @@ void Svx3DPreviewControl::SetObjectType(SvxPreviewObjectType nType) { if( mnObjectType != nType || !mp3DObj) { - SfxItemSet aSet(mpModel->GetItemPool(), SDRATTR_START, SDRATTR_END, 0, 0); + SfxItemSet aSet(mpModel->GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>{}); mnObjectType = nType; if( mp3DObj ) diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index 044a1d9f7ddc..6a4d0bb2ece3 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -599,12 +599,11 @@ IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, Button*, void) { pBBSet = new SfxItemSet( *GetItemSet().GetPool(), - XATTR_FILL_FIRST, XATTR_FILL_LAST, // DrawingLayer FillStyle definitions - SID_COLOR_TABLE, SID_PATTERN_LIST, // XPropertyLists for Color, Gradient, Hatch and Graphic fills - nOuter, nOuter, - nInner, nInner, - nShadow, nShadow, - 0, 0); + {{XATTR_FILL_FIRST, XATTR_FILL_LAST}, // DrawingLayer FillStyle definitions + {SID_COLOR_TABLE, SID_PATTERN_LIST}, // XPropertyLists for Color, Gradient, Hatch and Graphic fills + {nOuter, nOuter}, + {nInner, nInner}, + {nShadow, nShadow}}); // copy items for XPropertyList entries from the DrawModel so that // the Area TabPage can access them @@ -637,11 +636,10 @@ IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, Button*, void) pBBSet = new SfxItemSet( *GetItemSet().GetPool(), - nBrush, nBrush, - nOuter, nOuter, - nInner, nInner, - nShadow, nShadow, - 0, 0); + {{nBrush, nBrush}, + {nOuter, nOuter}, + {nInner, nInner}, + {nShadow, nShadow}}); } const SfxPoolItem* pItem; @@ -713,7 +711,7 @@ IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl, Button*, void) { // create FillAttributes from SvxBrushItem const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(pBBSet->Get(nWhich)); - SfxItemSet aTempSet(*pBBSet->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + SfxItemSet aTempSet(*pBBSet->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); @@ -800,7 +798,7 @@ void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet ) { // create FillAttributes from SvxBrushItem const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich)); - SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + SfxItemSet aTempSet(*rTmpSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); @@ -844,7 +842,7 @@ void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet ) { // create FillAttributes from SvxBrushItem const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich)); - SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + SfxItemSet aTempSet(*rTmpSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); @@ -877,7 +875,7 @@ void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet ) { // create FillAttributes from SvxBrushItem const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rSet.Get(nWhich)); - SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + SfxItemSet aTempSet(*rSet.GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 44534a92627d..8b7456d585a9 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -635,7 +635,7 @@ void IMapWindow::DoMacroAssign() if ( pSdrObj ) { - SfxItemSet aSet( *pIMapPool, SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 ); + SfxItemSet aSet( *pIMapPool, svl::Items<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG>{} ); SfxEventNamesItem aNamesItem(SID_EVENTCONFIG); aNamesItem.AddEvent( "MouseOver", "", SFX_EVENT_MOUSEOVER_OBJECT ); diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index f55dd445ec40..d2b3077d71fa 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -468,9 +468,8 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) mpRemember2DAttributes->ClearItem(); else mpRemember2DAttributes = o3tl::make_unique<SfxItemSet>(*rAttrs.GetPool(), - SDRATTR_START, SDRATTR_SHADOW_LAST, - SDRATTR_3D_FIRST, SDRATTR_3D_LAST, - 0, 0); + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, + SDRATTR_3D_FIRST, SDRATTR_3D_LAST>{}); SfxWhichIter aIter(*mpRemember2DAttributes); sal_uInt16 nWhich(aIter.FirstWhich()); @@ -2793,7 +2792,7 @@ void Svx3DWin::UpdatePreview() pModel = new FmFormModel(); // Get Itemset - SfxItemSet aSet( pModel->GetItemPool(), SDRATTR_START, SDRATTR_END); + SfxItemSet aSet( pModel->GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>{}); // Get Attributes and set the preview GetAttr( aSet ); diff --git a/svx/source/engine3d/view3d1.cxx b/svx/source/engine3d/view3d1.cxx index 74ada1128d04..27cf4a30e5b9 100644 --- a/svx/source/engine3d/view3d1.cxx +++ b/svx/source/engine3d/view3d1.cxx @@ -103,9 +103,8 @@ SfxItemSet E3dView::Get3DAttributes() const // Creating itemset with corresponding field SfxItemSet aSet( mpModel->GetItemPool(), - SDRATTR_START, SDRATTR_END, - SID_ATTR_3D_INTERN, SID_ATTR_3D_INTERN, - 0, 0); + svl::Items<SDRATTR_START, SDRATTR_END, + SID_ATTR_3D_INTERN, SID_ATTR_3D_INTERN>{}); sal_uInt32 nSelectedItems(0L); @@ -129,7 +128,7 @@ SfxItemSet E3dView::Get3DAttributes() const if(!nSelectedItems) { // Get defaults and apply - SfxItemSet aDefaultSet(mpModel->GetItemPool(), SDRATTR_3D_FIRST, SDRATTR_3D_LAST); + SfxItemSet aDefaultSet(mpModel->GetItemPool(), svl::Items<SDRATTR_3D_FIRST, SDRATTR_3D_LAST>{}); GetAttributes(aDefaultSet); aSet.Put(aDefaultSet); @@ -169,7 +168,7 @@ void E3dView::Set3DAttributes( const SfxItemSet& rAttr) if(!nSelectedItems) { // Set defaults - SfxItemSet aDefaultSet(mpModel->GetItemPool(), SDRATTR_3D_FIRST, SDRATTR_3D_LAST); + SfxItemSet aDefaultSet(mpModel->GetItemPool(), svl::Items<SDRATTR_3D_FIRST, SDRATTR_3D_LAST>{}); aDefaultSet.Put(rAttr); SetAttributes(aDefaultSet); } diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index 137cc6bd93c0..de3873a8179f 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -118,12 +118,9 @@ namespace sdr return o3tl::make_unique<SfxItemSet>(rPool, // ranges from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, - SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, - - // end - 0, 0); + SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION>{}); } AttributeProperties::AttributeProperties(SdrObject& rObj) diff --git a/svx/source/sdr/properties/captionproperties.cxx b/svx/source/sdr/properties/captionproperties.cxx index be25e2ed6e50..2a32b8dab720 100644 --- a/svx/source/sdr/properties/captionproperties.cxx +++ b/svx/source/sdr/properties/captionproperties.cxx @@ -38,7 +38,7 @@ namespace sdr return o3tl::make_unique<SfxItemSet>(rPool, // range from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, @@ -46,10 +46,7 @@ namespace sdr SDRATTR_CAPTION_FIRST, SDRATTR_CAPTION_LAST, // range from SdrTextObj - EE_ITEMS_START, EE_ITEMS_END, - - // end - 0, 0); + EE_ITEMS_START, EE_ITEMS_END>{}); } CaptionProperties::CaptionProperties(SdrObject& rObj) diff --git a/svx/source/sdr/properties/circleproperties.cxx b/svx/source/sdr/properties/circleproperties.cxx index 4168e28e29e7..4782128d79ff 100644 --- a/svx/source/sdr/properties/circleproperties.cxx +++ b/svx/source/sdr/properties/circleproperties.cxx @@ -40,7 +40,7 @@ namespace sdr return o3tl::make_unique<SfxItemSet>(rPool, // range from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, @@ -48,10 +48,7 @@ namespace sdr SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST, // range from SdrTextObj - EE_ITEMS_START, EE_ITEMS_END, - - // end - 0, 0); + EE_ITEMS_START, EE_ITEMS_END>{}); } CircleProperties::CircleProperties(SdrObject& rObj) diff --git a/svx/source/sdr/properties/connectorproperties.cxx b/svx/source/sdr/properties/connectorproperties.cxx index 05501095a21c..fc7b278fdb77 100644 --- a/svx/source/sdr/properties/connectorproperties.cxx +++ b/svx/source/sdr/properties/connectorproperties.cxx @@ -38,7 +38,7 @@ namespace sdr return o3tl::make_unique<SfxItemSet>(rPool, // range from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, @@ -46,10 +46,7 @@ namespace sdr SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST, // range from SdrTextObj - EE_ITEMS_START, EE_ITEMS_END, - - // end - 0, 0); + EE_ITEMS_START, EE_ITEMS_END>{}); } ConnectorProperties::ConnectorProperties(SdrObject& rObj) diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx index f674ab5b51b0..05e28368f529 100644 --- a/svx/source/sdr/properties/customshapeproperties.cxx +++ b/svx/source/sdr/properties/customshapeproperties.cxx @@ -67,7 +67,7 @@ namespace sdr return o3tl::make_unique<SfxItemSet>(rPool, // ranges from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, @@ -81,10 +81,7 @@ namespace sdr SDRATTR_CUSTOMSHAPE_FIRST, SDRATTR_CUSTOMSHAPE_LAST, // range from SdrTextObj - EE_ITEMS_START, EE_ITEMS_END, - - // end - 0, 0); + EE_ITEMS_START, EE_ITEMS_END>{}); } bool CustomShapeProperties::AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem ) const diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index ce5d927ba270..167e368382c4 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -96,7 +96,7 @@ namespace sdr ItemChange(nWhichID, &rItem); PostItemChange(nWhichID); - SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhichID, nWhichID); + SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), {{nWhichID, nWhichID}}); aSet.Put(rItem); ItemSetChanged(aSet); } @@ -121,7 +121,7 @@ namespace sdr if(nWhich) { - SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), nWhich, nWhich, 0, 0); + SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), {{nWhich, nWhich}}); ItemSetChanged(aSet); } } @@ -142,7 +142,7 @@ namespace sdr const SfxPoolItem *pPoolItem; std::vector< sal_uInt16 > aPostItemChangeList; bool bDidChange(false); - SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), SDRATTR_START, EE_ITEMS_END); + SfxItemSet aSet(GetSdrObject().GetObjectItemPool(), svl::Items<SDRATTR_START, EE_ITEMS_END>{}); // give a hint to STL_Vector aPostItemChangeList.reserve(rSet.Count()); diff --git a/svx/source/sdr/properties/e3dcompoundproperties.cxx b/svx/source/sdr/properties/e3dcompoundproperties.cxx index 5b24f56273ae..7da70b568254 100644 --- a/svx/source/sdr/properties/e3dcompoundproperties.cxx +++ b/svx/source/sdr/properties/e3dcompoundproperties.cxx @@ -58,7 +58,7 @@ namespace sdr GetObjectItemSet(); // add filtered scene properties (SDRATTR_3DSCENE_) to local itemset - SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST); + SfxItemSet aSet(*mpItemSet->GetPool(), svl::Items<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>{}); aSet.Put(pScene->GetProperties().GetObjectItemSet()); mpItemSet->Put(aSet); } @@ -79,7 +79,7 @@ namespace sdr GetObjectItemSet(); // Generate filtered scene properties (SDRATTR_3DSCENE_) itemset - SfxItemSet aSet(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST); + SfxItemSet aSet(*mpItemSet->GetPool(), svl::Items<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>{}); aSet.Put(rSet); if(bClearAllItems) diff --git a/svx/source/sdr/properties/e3dproperties.cxx b/svx/source/sdr/properties/e3dproperties.cxx index 2a674886e570..e22c10d2ed5f 100644 --- a/svx/source/sdr/properties/e3dproperties.cxx +++ b/svx/source/sdr/properties/e3dproperties.cxx @@ -36,15 +36,12 @@ namespace sdr return o3tl::make_unique<SfxItemSet>(rPool, // ranges from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, // ranges from E3dObject, contains object and scene because of GetMergedItemSet() - SDRATTR_3D_FIRST, SDRATTR_3D_LAST, - - // end - 0, 0); + SDRATTR_3D_FIRST, SDRATTR_3D_LAST>{}); } E3dProperties::E3dProperties(SdrObject& rObj) diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx index f7e459ac66ed..2639a96d9e7a 100644 --- a/svx/source/sdr/properties/e3dsceneproperties.cxx +++ b/svx/source/sdr/properties/e3dsceneproperties.cxx @@ -55,7 +55,7 @@ namespace sdr if(mpItemSet) { // filter for SDRATTR_3DSCENE_ items, only keep those items - SfxItemSet aNew(*mpItemSet->GetPool(), SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST); + SfxItemSet aNew(*mpItemSet->GetPool(), svl::Items<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>{}); aNew.Put(*mpItemSet); mpItemSet->ClearItem(); mpItemSet->Put(aNew); diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx index 955384961f70..8ea829f85c5b 100644 --- a/svx/source/sdr/properties/graphicproperties.cxx +++ b/svx/source/sdr/properties/graphicproperties.cxx @@ -39,7 +39,7 @@ namespace sdr return o3tl::make_unique<SfxItemSet>(rPool, // range from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, @@ -47,10 +47,7 @@ namespace sdr SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST, // range from SdrTextObj - EE_ITEMS_START, EE_ITEMS_END, - - // end - 0, 0); + EE_ITEMS_START, EE_ITEMS_END>{}); } GraphicProperties::GraphicProperties(SdrObject& rObj) diff --git a/svx/source/sdr/properties/measureproperties.cxx b/svx/source/sdr/properties/measureproperties.cxx index 03f10aeda774..3b1ae3ee3fda 100644 --- a/svx/source/sdr/properties/measureproperties.cxx +++ b/svx/source/sdr/properties/measureproperties.cxx @@ -44,7 +44,7 @@ namespace sdr return o3tl::make_unique<SfxItemSet>(rPool, // range from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, @@ -52,10 +52,7 @@ namespace sdr SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST, // range from SdrTextObj - EE_ITEMS_START, EE_ITEMS_END, - - // end - 0, 0); + EE_ITEMS_START, EE_ITEMS_END>{}); } MeasureProperties::MeasureProperties(SdrObject& rObj) diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index 4749a1c02506..76317ca6683c 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -50,15 +50,12 @@ namespace sdr return o3tl::make_unique<SfxItemSet>(rPool, // range from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, // range from SdrTextObj - EE_ITEMS_START, EE_ITEMS_END, - - // end - 0, 0); + EE_ITEMS_START, EE_ITEMS_END>{}); } TextProperties::TextProperties(SdrObject& rObj) @@ -483,7 +480,7 @@ namespace sdr if(bHasURL) { - SfxItemSet aColorSet(*aSet.GetPool(), EE_CHAR_COLOR, EE_CHAR_COLOR ); + SfxItemSet aColorSet(*aSet.GetPool(), svl::Items<EE_CHAR_COLOR, EE_CHAR_COLOR>{} ); aColorSet.Put(aSet, false); ESelection aSel(nPara, 0); diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index b46d6ae7e0c8..da33c32f0d26 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -3978,7 +3978,7 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/) sal_Int32 nBottomCrop = static_cast<sal_Int32>( rOldCrop.GetBottom() - nDiffBottom * fScaleY ); SfxItemPool& rPool = getSdrDragView().GetModel()->GetItemPool(); - SfxItemSet aSet( rPool, SDRATTR_GRAFCROP, SDRATTR_GRAFCROP ); + SfxItemSet aSet( rPool, svl::Items<SDRATTR_GRAFCROP, SDRATTR_GRAFCROP>{} ); aSet.Put( SdrGrafCropItem( nLeftCrop, nTopCrop, nRightCrop, nBottomCrop ) ); getSdrDragView().SetAttributes( aSet, false ); diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 062c828ca20c..d45f9ab819c1 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -1270,10 +1270,9 @@ bool SdrEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHard SfxItemSet SdrEditView::GetGeoAttrFromMarked() const { SfxItemSet aRetSet(mpModel->GetItemPool(), // SID_ATTR_TRANSFORM_... from s:svxids.hrc - SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE, + svl::Items<SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE, SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_AUTOHEIGHT, - SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS, - 0); + SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS>{}); if (AreObjectsMarked()) { diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 671f1d4591e8..b26b34cc48a6 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -549,10 +549,9 @@ void SdrEditView::ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest) if(pSource && pDest) { SfxItemSet aSet(mpModel->GetItemPool(), - SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1, + svl::Items<SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1, SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END, - EE_ITEMS_START, EE_ITEMS_END, - 0, 0); + EE_ITEMS_START, EE_ITEMS_END>{}); aSet.Put(pSource->GetMergedItemSet()); diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 9b08878962ef..54b8604b1dcd 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -110,9 +110,9 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport( mpVD->SetLineColor(); mpVD->SetFillColor(); maOldLineColor.SetRed( mpVD->GetLineColor().GetRed() + 1 ); - mpLineAttr = o3tl::make_unique<SfxItemSet>(rModel.GetItemPool(), XATTR_LINE_FIRST, XATTR_LINE_LAST, 0, 0); - mpFillAttr = o3tl::make_unique<SfxItemSet>(rModel.GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0); - mpTextAttr = o3tl::make_unique<SfxItemSet>(rModel.GetItemPool(), EE_ITEMS_START, EE_ITEMS_END, 0, 0); + mpLineAttr = o3tl::make_unique<SfxItemSet>(rModel.GetItemPool(), svl::Items<XATTR_LINE_FIRST, XATTR_LINE_LAST>{}); + mpFillAttr = o3tl::make_unique<SfxItemSet>(rModel.GetItemPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); + mpTextAttr = o3tl::make_unique<SfxItemSet>(rModel.GetItemPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{}); checkClip(); } @@ -715,7 +715,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaRoundRectAction& rAct) SetAttributes(pRect); long nRad=(rAct.GetHorzRound()+rAct.GetVertRound())/2; if (nRad!=0) { - SfxItemSet aSet(*mpLineAttr->GetPool(), SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS, 0, 0); + SfxItemSet aSet(*mpLineAttr->GetPool(), svl::Items<SDRATTR_ECKENRADIUS, SDRATTR_ECKENRADIUS>{}); aSet.Put(SdrMetricItem(SDRATTR_ECKENRADIUS, nRad)); pRect->SetMergedItemSet(aSet); } @@ -1016,7 +1016,7 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const OUString& rSt if (!aFnt.IsTransparent()) { - SfxItemSet aAttr(*mpFillAttr->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0); + SfxItemSet aAttr(*mpFillAttr->GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); aAttr.Put(XFillStyleItem(drawing::FillStyle_SOLID)); aAttr.Put(XFillColorItem(OUString(), aFnt.GetFillColor())); pText->SetMergedItemSet(aAttr); diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx index a83797f3c11a..303ecff96f45 100644 --- a/svx/source/svdraw/svdibrow.cxx +++ b/svx/source/svdraw/svdibrow.cxx @@ -1138,7 +1138,7 @@ IMPL_LINK(SdrItemBrowser, ChangedHdl, SdrItemBrowserControl&, rBrowse, void) SfxItemSet aSet(pView->GetModel()->GetItemPool()); pView->GetAttributes(aSet); - SfxItemSet aNewSet(*aSet.GetPool(),pEntry->nWhichId,pEntry->nWhichId); + SfxItemSet aNewSet(*aSet.GetPool(),{{pEntry->nWhichId,pEntry->nWhichId}}); OUString aNewText(rBrowse.GetNewEntryValue()); bool bDel( aNewText == "del" || aNewText == "Del" diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 1b8b0dbe0311..1be76ee3b955 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1389,9 +1389,8 @@ void SdrObjCustomShape::AdaptTextMinSize() const bool bResizeShapeToFitText(static_cast< const SdrOnOffItem& >(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue()); SfxItemSet aSet( *GetObjectItemSet().GetPool(), - SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, - SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH, // contains SDRATTR_TEXT_MAXFRAMEWIDTH - 0, 0); + svl::Items<SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, + SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH>{}); // contains SDRATTR_TEXT_MAXFRAMEWIDTH bool bChanged(false); if(bResizeShapeToFitText) @@ -2202,11 +2201,10 @@ void SdrObjCustomShape::SetVerticalWriting( bool bVertical ) // prepare ItemSet to set exchanged width and height items SfxItemSet aNewSet(*rSet.GetPool(), - SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, + svl::Items<SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, // Expanded item ranges to also support horizontal and vertical adjust. SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST, - SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST, - 0, 0); + SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST>{}); aNewSet.Put(rSet); diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 52f8bf1e616e..3ee0475d31f9 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -544,9 +544,8 @@ void SdrTextObj::AdaptTextMinSize() SfxItemSet aSet( *GetObjectItemSet().GetPool(), - SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, - SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH, // contains SDRATTR_TEXT_MAXFRAMEWIDTH - 0, 0); + svl::Items<SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, + SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH>{}); // contains SDRATTR_TEXT_MAXFRAMEWIDTH if(bW) { @@ -1555,11 +1554,10 @@ void SdrTextObj::SetVerticalWriting(bool bVertical) // prepare ItemSet to set exchanged width and height items SfxItemSet aNewSet(*rSet.GetPool(), - SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, + svl::Items<SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, // Expanded item ranges to also support hor and ver adjust. SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST, - SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST, - 0, 0); + SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST>{}); aNewSet.Put(rSet); aNewSet.Put(makeSdrTextAutoGrowWidthItem(bAutoGrowHeight)); diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx index 3d4b392bab22..515277a4cd18 100644 --- a/svx/source/svdraw/svdotxed.cxx +++ b/svx/source/svdraw/svdotxed.cxx @@ -96,7 +96,7 @@ bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl) // at SetParaAttribs(), all attributes contained in the parent become // attributed hard to the paragraph. const SfxItemSet& rSet = GetObjectItemSet(); - SfxItemSet aFilteredSet(*rSet.GetPool(), EE_ITEMS_START, EE_ITEMS_END); + SfxItemSet aFilteredSet(*rSet.GetPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{}); aFilteredSet.Put(rSet); rOutl.SetParaAttribs(0, aFilteredSet); } diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 24e440fab2e0..b50e0990caa8 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1081,7 +1081,7 @@ SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) : SfxListener(), mpSdrPage(&rSdrPage), mpStyleSheet(nullptr), - maProperties(mpSdrPage->GetModel()->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST) + maProperties(mpSdrPage->GetModel()->GetItemPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}) { if(!rSdrPage.IsMasterPage()) { diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index c1703c9cb88e..c2d539cc25d4 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -183,7 +183,7 @@ namespace sdr return o3tl::make_unique<SfxItemSet>(rPool, // range from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, @@ -191,10 +191,7 @@ namespace sdr SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST, // range from SdrTextObj - EE_ITEMS_START, EE_ITEMS_END, - - // end - 0, 0); + EE_ITEMS_START, EE_ITEMS_END>{}); } const svx::ITextProvider& CellProperties::getTextProvider() const @@ -360,8 +357,7 @@ namespace sdr // prepare ItemSet to set exchanged width and height items SfxItemSet aNewSet(*rSet.GetPool(), - SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, - 0, 0); + svl::Items<SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT>{}); aNewSet.Put(rSet); aNewSet.Put(makeSdrTextAutoGrowWidthItem(bAutoGrowHeight)); @@ -1116,7 +1112,7 @@ void SAL_CALL Cell::setPropertyValue( const OUString& rPropertyName, const Any& } default: { - SfxItemSet aSet( GetModel()->GetItemPool(), pMap->nWID, pMap->nWID); + SfxItemSet aSet( GetModel()->GetItemPool(), {{pMap->nWID, pMap->nWID}}); aSet.Put(mpProperties->GetItem(pMap->nWID)); bool bSpecial = false; @@ -1236,7 +1232,7 @@ Any SAL_CALL Cell::getPropertyValue( const OUString& PropertyName ) } default: { - SfxItemSet aSet( GetModel()->GetItemPool(), pMap->nWID, pMap->nWID); + SfxItemSet aSet( GetModel()->GetItemPool(), {{pMap->nWID, pMap->nWID}}); aSet.Put(mpProperties->GetItem(pMap->nWID)); Any aAny; @@ -1570,7 +1566,7 @@ Any SAL_CALL Cell::getPropertyDefault( const OUString& aPropertyName ) { if( SfxItemPool::IsWhich(pMap->nWID) ) { - SfxItemSet aSet( GetModel()->GetItemPool(), pMap->nWID, pMap->nWID); + SfxItemSet aSet( GetModel()->GetItemPool(), {{pMap->nWID, pMap->nWID}}); aSet.Put(GetModel()->GetItemPool().GetDefaultItem(pMap->nWID)); return GetAnyForItem( aSet, pMap ); } diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 2e2d01887fa2..98ff74e07471 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -130,7 +130,7 @@ std::unique_ptr<SfxItemSet> TableProperties::CreateObjectSpecificItemSet(SfxItem return o3tl::make_unique<SfxItemSet>(rPool, // range from SdrAttrObj - SDRATTR_START, SDRATTR_SHADOW_LAST, + svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, @@ -138,10 +138,7 @@ std::unique_ptr<SfxItemSet> TableProperties::CreateObjectSpecificItemSet(SfxItem SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST, // range from SdrTextObj - EE_ITEMS_START, EE_ITEMS_END, - - // end - 0, 0); + EE_ITEMS_START, EE_ITEMS_END>{}); } class TableObjectGeoData : public SdrTextObjGeoData diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index 7b45fdadd62c..e753d7c6f1a6 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -550,7 +550,7 @@ VclPtr<vcl::Window> SvxGrafModeToolBoxControl::CreateItemWindow( vcl::Window *pP void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) { SfxItemPool& rPool = rView.GetModel()->GetItemPool(); - SfxItemSet aSet( rPool, SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST ); + SfxItemSet aSet( rPool, svl::Items<SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST>{} ); OUString aUndoStr; const bool bUndo = rView.IsUndoEnabled(); @@ -669,7 +669,7 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) ( pObj->GetGraphicType() != GraphicType::NONE ) && ( pObj->GetGraphicType() != GraphicType::Default ) ) { - SfxItemSet aGrfAttr( rPool, SDRATTR_GRAFCROP, SDRATTR_GRAFCROP, 0 ); + SfxItemSet aGrfAttr( rPool, svl::Items<SDRATTR_GRAFCROP, SDRATTR_GRAFCROP>{} ); const MapUnit eOldMetric = rPool.GetMetric( 0 ); const MapMode aMap100( MapUnit::Map100thMM ); const MapMode aMapTwip( MapUnit::MapTwip ); @@ -678,11 +678,11 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) rPool.SetDefaultMetric( MapUnit::MapTwip ); SfxItemSet aCropDlgAttr( rPool, - SDRATTR_GRAFCROP, SDRATTR_GRAFCROP, + svl::Items<SDRATTR_GRAFCROP, SDRATTR_GRAFCROP, SID_ATTR_GRAF_GRAPHIC, SID_ATTR_GRAF_GRAPHIC, SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_FRMSIZE, - SID_ATTR_GRAF_CROP, SID_ATTR_GRAF_CROP, 0 ); + SID_ATTR_GRAF_CROP, SID_ATTR_GRAF_CROP>{} ); aCropDlgAttr.Put( SvxBrushItem( pObj->GetGraphic(), GPOS_MM, SID_ATTR_GRAF_GRAPHIC ) ); aCropDlgAttr.Put( SvxSizeItem( SID_ATTR_PAGE_SIZE, diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx index cab1dace59ce..422e4c1e769b 100644 --- a/svx/source/unodraw/UnoNameItemTable.cxx +++ b/svx/source/unodraw/UnoNameItemTable.cxx @@ -81,7 +81,7 @@ sal_Bool SAL_CALL SvxUnoNameItemTable::supportsService( const OUString& Service void SAL_CALL SvxUnoNameItemTable::ImplInsertByName( const OUString& aName, const uno::Any& aElement ) { - maItemSetVector.push_back( o3tl::make_unique< SfxItemSet >( *mpModelPool, mnWhich, mnWhich ) ); + maItemSetVector.push_back( o3tl::make_unique< SfxItemSet >( *mpModelPool, std::initializer_list<SfxItemSet::Pair>{{mnWhich, mnWhich}} ) ); std::unique_ptr<NameOrIndex> pNewItem(createItem()); pNewItem->SetName( aName ); diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx index ebb05b90733b..17a54744e6a2 100644 --- a/svx/source/unodraw/unomtabl.cxx +++ b/svx/source/unodraw/unomtabl.cxx @@ -143,7 +143,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoMarkerTable::getSupportedServiceNames( void SAL_CALL SvxUnoMarkerTable::ImplInsertByName( const OUString& aName, const uno::Any& aElement ) { maItemSetVector.push_back( - o3tl::make_unique<SfxItemSet>( *mpModelPool, XATTR_LINESTART, XATTR_LINEEND )); + o3tl::make_unique<SfxItemSet>( *mpModelPool, svl::Items<XATTR_LINESTART, XATTR_LINEEND>{} )); auto pInSet = maItemSetVector.back().get(); XLineEndItem aEndMarker(XATTR_LINEEND); diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index ba50ddedc577..b213c026ebbd 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -649,7 +649,7 @@ void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet) DBG_TESTSOLARMUTEX(); if(mpObj.is() && rPropSet.AreThereOwnUsrAnys() && mpModel) { - SfxItemSet aSet( mpModel->GetItemPool(), SDRATTR_START, SDRATTR_END); + SfxItemSet aSet( mpModel->GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>{}); Reference< beans::XPropertySet > xShape( static_cast<OWeakObject*>(this), UNO_QUERY ); SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, aSet, xShape, &mpPropSet->getPropertyMap() ); @@ -1399,7 +1399,7 @@ void SAL_CALL SvxShape::removeVetoableChangeListener( const OUString& , const Re bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName ) { - SfxItemSet aSet( mpModel->GetItemPool(), (sal_uInt16)nWID, (sal_uInt16)nWID ); + SfxItemSet aSet( mpModel->GetItemPool(), {{(sal_uInt16)nWID, (sal_uInt16)nWID}} ); if( SetFillAttribute( nWID, rName, aSet, mpModel ) ) { @@ -1651,7 +1651,7 @@ void SAL_CALL SvxShape::_setPropertyValue( const OUString& rPropertyName, const } else { - pSet = new SfxItemSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID); + pSet = new SfxItemSet( mpModel->GetItemPool(), {{pMap->nWID, pMap->nWID}}); } if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET ) @@ -1727,7 +1727,7 @@ uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName ) DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" ); DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" ); - SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID); + SfxItemSet aSet( mpModel->GetItemPool(), {{pMap->nWID, pMap->nWID}}); aSet.Put(mpObj->GetMergedItem(pMap->nWID)); if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pMap, aAny )) @@ -3011,7 +3011,7 @@ uno::Any SAL_CALL SvxShape::_getPropertyDefault( const OUString& aPropertyName ) if(!SfxItemPool::IsWhich(pMap->nWID)) throw beans::UnknownPropertyException( "No WhichID " + OUString::number(pMap->nWID) + " for " + aPropertyName, static_cast<cppu::OWeakObject*>(this)); - SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID); + SfxItemSet aSet( mpModel->GetItemPool(), {{pMap->nWID, pMap->nWID}}); aSet.Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID)); return GetAnyForItem( aSet, pMap ); diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index a9441061442a..e71df58049c6 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -3479,7 +3479,7 @@ XLineAttrSetItem::XLineAttrSetItem( std::unique_ptr<SfxItemSet>&& pItemSet ) : XLineAttrSetItem::XLineAttrSetItem( SfxItemPool* pItemPool ) : SfxSetItem( XATTRSET_LINE, - o3tl::make_unique<SfxItemSet>( *pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST)) + o3tl::make_unique<SfxItemSet>( *pItemPool, svl::Items<XATTR_LINE_FIRST, XATTR_LINE_LAST>{})) { } @@ -3503,7 +3503,7 @@ SfxPoolItem* XLineAttrSetItem::Clone( SfxItemPool* pPool ) const SfxPoolItem* XLineAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const { auto pSet2 = o3tl::make_unique<SfxItemSet>( *GetItemSet().GetPool(), - XATTR_LINE_FIRST, XATTR_LINE_LAST); + svl::Items<XATTR_LINE_FIRST, XATTR_LINE_LAST>{}); pSet2->Load( rStream ); return new XLineAttrSetItem( std::move(pSet2) ); } @@ -3516,7 +3516,7 @@ XFillAttrSetItem::XFillAttrSetItem( std::unique_ptr<SfxItemSet>&& pItemSet ) : XFillAttrSetItem::XFillAttrSetItem( SfxItemPool* pItemPool ) : SfxSetItem( XATTRSET_FILL, - o3tl::make_unique<SfxItemSet>( *pItemPool, XATTR_FILL_FIRST, XATTR_FILL_LAST)) + o3tl::make_unique<SfxItemSet>( *pItemPool, svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{})) { } @@ -3540,7 +3540,7 @@ SfxPoolItem* XFillAttrSetItem::Clone( SfxItemPool* pPool ) const SfxPoolItem* XFillAttrSetItem::Create( SvStream& rStream, sal_uInt16 /*nVersion*/) const { auto pSet2 = o3tl::make_unique<SfxItemSet>( *GetItemSet().GetPool(), - XATTR_FILL_FIRST, XATTR_FILL_LAST); + svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); pSet2->Load( rStream ); return new XFillAttrSetItem( std::move(pSet2) ); } diff --git a/svx/source/xoutdev/xexch.cxx b/svx/source/xoutdev/xexch.cxx index 156554223b99..73145abe31cc 100644 --- a/svx/source/xoutdev/xexch.cxx +++ b/svx/source/xoutdev/xexch.cxx @@ -86,7 +86,7 @@ SvStream& ReadXFillExchangeData( SvStream& rIStm, XFillExchangeData& rData ) { DBG_ASSERT( rData.pPool, "XFillExchangeData has no pool" ); - auto pSet = o3tl::make_unique<SfxItemSet>( *rData.pPool, XATTR_FILL_FIRST, XATTR_FILL_LAST ); + auto pSet = o3tl::make_unique<SfxItemSet>( *rData.pPool, svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{} ); sal_uInt32 nItemCount = 0; sal_uInt16 nWhich, nItemVersion; diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx index 591a57fc2575..0146afe75120 100644 --- a/svx/source/xoutdev/xpool.cxx +++ b/svx/source/xoutdev/xpool.cxx @@ -111,10 +111,10 @@ XOutdevItemPool::XOutdevItemPool(SfxItemPool* _pMaster, bool bLoadRefCounts) // create SetItems rPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem( o3tl::make_unique<SfxItemSet>( - *_pMaster, XATTR_LINE_FIRST, XATTR_LINE_LAST)); + *_pMaster, svl::Items<XATTR_LINE_FIRST, XATTR_LINE_LAST>{})); rPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem( o3tl::make_unique<SfxItemSet>( - *_pMaster, XATTR_FILL_FIRST, XATTR_FILL_LAST)); + *_pMaster, svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{})); // create ItemInfos for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++) |