diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-04-19 17:07:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-19 21:48:06 +0200 |
commit | cd073a4a945a527cec3080523a0d7ec42bc49b26 (patch) | |
tree | 982b997ddc759a5c062ea5d87ed20cc17b1b09c6 /svx/source | |
parent | 35dac3d5d51cf58c3f49e039b8a67b129055f267 (diff) |
svx properties: pass SfxItemSet around by value
so we avoid heap allocation costs when loading lots of shapes
Change-Id: I0de5819acc7f845973a284e68ab709989f27d402
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114297
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/sdr/properties/attributeproperties.cxx | 30 | ||||
-rw-r--r-- | svx/source/sdr/properties/captionproperties.cxx | 6 | ||||
-rw-r--r-- | svx/source/sdr/properties/circleproperties.cxx | 10 | ||||
-rw-r--r-- | svx/source/sdr/properties/connectorproperties.cxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/properties/customshapeproperties.cxx | 8 | ||||
-rw-r--r-- | svx/source/sdr/properties/defaultproperties.cxx | 32 | ||||
-rw-r--r-- | svx/source/sdr/properties/e3dcompoundproperties.cxx | 6 | ||||
-rw-r--r-- | svx/source/sdr/properties/e3dproperties.cxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/properties/e3dsceneproperties.cxx | 20 | ||||
-rw-r--r-- | svx/source/sdr/properties/emptyproperties.cxx | 12 | ||||
-rw-r--r-- | svx/source/sdr/properties/graphicproperties.cxx | 24 | ||||
-rw-r--r-- | svx/source/sdr/properties/groupproperties.cxx | 14 | ||||
-rw-r--r-- | svx/source/sdr/properties/measureproperties.cxx | 16 | ||||
-rw-r--r-- | svx/source/sdr/properties/pageproperties.cxx | 16 | ||||
-rw-r--r-- | svx/source/sdr/properties/textproperties.cxx | 22 | ||||
-rw-r--r-- | svx/source/table/cell.cxx | 8 | ||||
-rw-r--r-- | svx/source/table/svdotable.cxx | 6 |
17 files changed, 119 insertions, 119 deletions
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index e67e560c1505..c61f95354020 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -55,7 +55,7 @@ namespace sdr::properties { if(SfxItemState::SET == rStyle.GetItemState(nWhich)) { - mpItemSet->ClearItem(nWhich); + mxItemSet->ClearItem(nWhich); } nWhich = aIter.NextWhich(); @@ -63,7 +63,7 @@ namespace sdr::properties } // set new stylesheet as parent - mpItemSet->SetParent(&mpStyleSheet->GetItemSet()); + mxItemSet->SetParent(&mpStyleSheet->GetItemSet()); } else { @@ -110,7 +110,7 @@ namespace sdr::properties // reset parent of ItemSet if(HasSfxItemSet()) { - mpItemSet->SetParent(nullptr); + mxItemSet->SetParent(nullptr); } SdrObject& rObj = GetSdrObject(); @@ -122,9 +122,9 @@ namespace sdr::properties } // create a new itemset - std::unique_ptr<SfxItemSet> AttributeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet AttributeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>(rPool, + return SfxItemSet(rPool, // ranges from SdrAttrObj svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, @@ -272,7 +272,7 @@ namespace sdr::properties } } - return *mpItemSet; + return *mxItemSet; } void AttributeProperties::ItemSetChanged(const SfxItemSet& /*rSet*/) @@ -339,14 +339,14 @@ namespace sdr::properties if(pResultItem) { // force ItemSet - mpItemSet->Put(*pResultItem); + mxItemSet->Put(*pResultItem); // delete item if it was a generated one pResultItem.reset(); } else { - mpItemSet->Put(*pNewItem); + mxItemSet->Put(*pNewItem); } } else @@ -354,7 +354,7 @@ namespace sdr::properties // clear item if ItemSet exists if(HasSfxItemSet()) { - mpItemSet->ClearItem(nWhich); + mxItemSet->ClearItem(nWhich); } } } @@ -386,8 +386,8 @@ namespace sdr::properties GetObjectItemSet(); // prepare copied, new itemset, but WITHOUT parent - SfxItemSet* pDestItemSet = new SfxItemSet(*mpItemSet); - pDestItemSet->SetParent(nullptr); + SfxItemSet aDestItemSet(*mxItemSet); + aDestItemSet.SetParent(nullptr); // prepare forgetting the current stylesheet like in RemoveStyleSheet() EndListening(*mpStyleSheet); @@ -395,7 +395,7 @@ namespace sdr::properties // prepare the iter; use the mpObjectItemSet which may have less // WhichIDs than the style. - SfxWhichIter aIter(*pDestItemSet); + SfxWhichIter aIter(aDestItemSet); sal_uInt16 nWhich(aIter.FirstWhich()); const SfxPoolItem *pItem = nullptr; @@ -404,16 +404,16 @@ namespace sdr::properties { // #i61284# use mpItemSet with parents, makes things easier and reduces to // one loop - if(SfxItemState::SET == mpItemSet->GetItemState(nWhich, true, &pItem)) + if(SfxItemState::SET == mxItemSet->GetItemState(nWhich, true, &pItem)) { - pDestItemSet->Put(*pItem); + aDestItemSet.Put(*pItem); } nWhich = aIter.NextWhich(); } // replace itemsets - mpItemSet.reset(pDestItemSet); + mxItemSet.emplace(std::move(aDestItemSet)); // set necessary changes like in RemoveStyleSheet() GetSdrObject().SetBoundRectDirty(); diff --git a/svx/source/sdr/properties/captionproperties.cxx b/svx/source/sdr/properties/captionproperties.cxx index 0afd70af5234..6f98fdb2a407 100644 --- a/svx/source/sdr/properties/captionproperties.cxx +++ b/svx/source/sdr/properties/captionproperties.cxx @@ -30,9 +30,9 @@ namespace sdr::properties { // create a new itemset - std::unique_ptr<SfxItemSet> CaptionProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet CaptionProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>( + return SfxItemSet( rPool, svl::Items< // Ranges from SdrAttrObj, SdrCaptionObj: @@ -92,7 +92,7 @@ namespace sdr::properties // this was set by TextProperties::ForceDefaultAttributes(), // reset to default - mpItemSet->ClearItem(XATTR_LINESTYLE); + mxItemSet->ClearItem(XATTR_LINESTYLE); } } // end of namespace diff --git a/svx/source/sdr/properties/circleproperties.cxx b/svx/source/sdr/properties/circleproperties.cxx index b6965fd235bb..08139805228c 100644 --- a/svx/source/sdr/properties/circleproperties.cxx +++ b/svx/source/sdr/properties/circleproperties.cxx @@ -32,9 +32,9 @@ namespace sdr::properties { // create a new itemset - std::unique_ptr<SfxItemSet> CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>( + return SfxItemSet( rPool, svl::Items< // Ranges from SdrAttrObj, SdrCircObj @@ -99,16 +99,16 @@ namespace sdr::properties // force ItemSet GetObjectItemSet(); - mpItemSet->Put(SdrCircKindItem(eKind)); + mxItemSet->Put(SdrCircKindItem(eKind)); if(rObj.GetStartAngle()) { - mpItemSet->Put(makeSdrCircStartAngleItem(rObj.GetStartAngle())); + mxItemSet->Put(makeSdrCircStartAngleItem(rObj.GetStartAngle())); } if(rObj.GetEndAngle() != 36000_deg100) { - mpItemSet->Put(makeSdrCircEndAngleItem(rObj.GetEndAngle())); + mxItemSet->Put(makeSdrCircEndAngleItem(rObj.GetEndAngle())); } } diff --git a/svx/source/sdr/properties/connectorproperties.cxx b/svx/source/sdr/properties/connectorproperties.cxx index 29a2b7edeb5f..58e773e91327 100644 --- a/svx/source/sdr/properties/connectorproperties.cxx +++ b/svx/source/sdr/properties/connectorproperties.cxx @@ -30,9 +30,9 @@ namespace sdr::properties { // create a new itemset - std::unique_ptr<SfxItemSet> ConnectorProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet ConnectorProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>( + return SfxItemSet( rPool, svl::Items< // Ranges from SdrAttrObj, SdrEdgeObj: diff --git a/svx/source/sdr/properties/customshapeproperties.cxx b/svx/source/sdr/properties/customshapeproperties.cxx index 1d0364941fae..4b372605576d 100644 --- a/svx/source/sdr/properties/customshapeproperties.cxx +++ b/svx/source/sdr/properties/customshapeproperties.cxx @@ -59,9 +59,9 @@ namespace sdr::properties } } - std::unique_ptr<SfxItemSet> CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet CustomShapeProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>( + return SfxItemSet( rPool, svl::Items< // Ranges from SdrAttrObj: @@ -93,7 +93,7 @@ namespace sdr::properties { if ( !nWhich ) { - SfxWhichIter aIter( *mpItemSet ); + SfxWhichIter aIter( *mxItemSet ); sal_uInt16 nWhich2 = aIter.FirstWhich(); while( nWhich2 ) { @@ -111,7 +111,7 @@ namespace sdr::properties { if ( !nWhich ) { - SfxWhichIter aIter( *mpItemSet ); + SfxWhichIter aIter( *mxItemSet ); sal_uInt16 nWhich2 = aIter.FirstWhich(); while( nWhich2 ) { diff --git a/svx/source/sdr/properties/defaultproperties.cxx b/svx/source/sdr/properties/defaultproperties.cxx index 0e459d87f9ad..b12e7bd5b82d 100644 --- a/svx/source/sdr/properties/defaultproperties.cxx +++ b/svx/source/sdr/properties/defaultproperties.cxx @@ -34,10 +34,10 @@ namespace sdr::properties { - std::unique_ptr<SfxItemSet> DefaultProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet DefaultProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { // Basic implementation; Basic object has NO attributes - return std::make_unique<SfxItemSet>(rPool); + return SfxItemSet(rPool); } DefaultProperties::DefaultProperties(SdrObject& rObj) @@ -48,15 +48,15 @@ namespace sdr::properties DefaultProperties::DefaultProperties(const DefaultProperties& rProps, SdrObject& rObj) : BaseProperties(rObj) { - if(!rProps.mpItemSet) + if(!rProps.mxItemSet) return; // Clone may be to another model and thus another ItemPool. // SfxItemSet supports that thus we are able to Clone all // SfxItemState::SET items to the target pool. - mpItemSet = rProps.mpItemSet->Clone( + mxItemSet.emplace(rProps.mxItemSet->CloneAsValue( true, - &rObj.getSdrModelFromSdrObject().GetItemPool()); + &rObj.getSdrModelFromSdrObject().GetItemPool())); // React on ModelChange: If metric has changed, scale items. // As seen above, clone is supported, but scale is not included, @@ -74,15 +74,15 @@ namespace sdr::properties { const Fraction aMetricFactor(GetMapFactor(aOldUnit, aNewUnit).X()); - ScaleItemSet(*mpItemSet, aMetricFactor); + ScaleItemSet(*mxItemSet, aMetricFactor); } } // do not keep parent info, this may be changed by later constructors. // This class just copies the ItemSet, ignore parent. - if(mpItemSet && mpItemSet->GetParent()) + if(mxItemSet && mxItemSet->GetParent()) { - mpItemSet->SetParent(nullptr); + mxItemSet->SetParent(nullptr); } } @@ -95,15 +95,15 @@ namespace sdr::properties const SfxItemSet& DefaultProperties::GetObjectItemSet() const { - if(!mpItemSet) + if(!mxItemSet) { - const_cast<DefaultProperties*>(this)->mpItemSet = const_cast<DefaultProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()); + mxItemSet.emplace(const_cast<DefaultProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool())); const_cast<DefaultProperties*>(this)->ForceDefaultAttributes(); } - assert(mpItemSet && "Could not create an SfxItemSet(!)"); + assert(mxItemSet && "Could not create an SfxItemSet(!)"); - return *mpItemSet; + return *mxItemSet; } void DefaultProperties::SetObjectItem(const SfxPoolItem& rItem) @@ -223,8 +223,8 @@ namespace sdr::properties void DefaultProperties::PostItemChange(const sal_uInt16 nWhich ) { - if( (nWhich == XATTR_FILLSTYLE) && (mpItemSet != nullptr) ) - CleanupFillProperties(*mpItemSet); + if( (nWhich == XATTR_FILLSTYLE) && mxItemSet ) + CleanupFillProperties(*mxItemSet); } void DefaultProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, bool /*bDontRemoveHardAttr*/) @@ -246,9 +246,9 @@ namespace sdr::properties { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("DefaultProperties")); BaseProperties::dumpAsXml(pWriter); - if (mpItemSet) + if (mxItemSet) { - mpItemSet->dumpAsXml(pWriter); + mxItemSet->dumpAsXml(pWriter); } (void)xmlTextWriterEndElement(pWriter); } diff --git a/svx/source/sdr/properties/e3dcompoundproperties.cxx b/svx/source/sdr/properties/e3dcompoundproperties.cxx index 8d023d033c64..8b6d1f5f60e2 100644 --- a/svx/source/sdr/properties/e3dcompoundproperties.cxx +++ b/svx/source/sdr/properties/e3dcompoundproperties.cxx @@ -56,9 +56,9 @@ namespace sdr::properties GetObjectItemSet(); // add filtered scene properties (SDRATTR_3DSCENE_) to local itemset - SfxItemSet aSet(*mpItemSet->GetPool(), svl::Items<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>{}); + SfxItemSet aSet(*mxItemSet->GetPool(), svl::Items<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>{}); aSet.Put(pScene->GetProperties().GetObjectItemSet()); - mpItemSet->Put(aSet); + mxItemSet->Put(aSet); } // call parent @@ -77,7 +77,7 @@ namespace sdr::properties GetObjectItemSet(); // Generate filtered scene properties (SDRATTR_3DSCENE_) itemset - SfxItemSet aSet(*mpItemSet->GetPool(), svl::Items<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>{}); + SfxItemSet aSet(*mxItemSet->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 0f435fd99c7f..393b3c9f072c 100644 --- a/svx/source/sdr/properties/e3dproperties.cxx +++ b/svx/source/sdr/properties/e3dproperties.cxx @@ -28,9 +28,9 @@ namespace sdr::properties { // create a new itemset - std::unique_ptr<SfxItemSet> E3dProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet E3dProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>(rPool, + return SfxItemSet(rPool, // ranges from SdrAttrObj svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx index e4ebfe194e4c..7635f32f806d 100644 --- a/svx/source/sdr/properties/e3dsceneproperties.cxx +++ b/svx/source/sdr/properties/e3dsceneproperties.cxx @@ -50,13 +50,13 @@ namespace sdr::properties const SfxItemSet& E3dSceneProperties::GetMergedItemSet() const { // prepare ItemSet - if(mpItemSet) + if(mxItemSet) { // filter for SDRATTR_3DSCENE_ items, only keep those items - SfxItemSet aNew(*mpItemSet->GetPool(), svl::Items<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>{}); - aNew.Put(*mpItemSet); - mpItemSet->ClearItem(); - mpItemSet->Put(aNew); + SfxItemSet aNew(*mxItemSet->GetPool(), svl::Items<SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST>{}); + aNew.Put(*mxItemSet); + mxItemSet->ClearItem(); + mxItemSet->Put(aNew); } else { @@ -87,11 +87,11 @@ namespace sdr::properties { if(SfxItemState::DONTCARE == rSet.GetItemState(nWhich, false)) { - mpItemSet->InvalidateItem(nWhich); + mxItemSet->InvalidateItem(nWhich); } else { - mpItemSet->MergeValue(rSet.Get(nWhich), true); + mxItemSet->MergeValue(rSet.Get(nWhich), true); } } @@ -280,13 +280,13 @@ namespace sdr::properties const Camera3D& aSceneCam(rObj.GetCamera()); // ProjectionType - mpItemSet->Put(Svx3DPerspectiveItem(aSceneCam.GetProjection())); + mxItemSet->Put(Svx3DPerspectiveItem(aSceneCam.GetProjection())); // CamPos - mpItemSet->Put(makeSvx3DDistanceItem(static_cast<sal_uInt32>(aSceneCam.GetPosition().getZ() + 0.5))); + mxItemSet->Put(makeSvx3DDistanceItem(static_cast<sal_uInt32>(aSceneCam.GetPosition().getZ() + 0.5))); // FocalLength - mpItemSet->Put(makeSvx3DFocalLengthItem(static_cast<sal_uInt32>((aSceneCam.GetFocalLength() * 100.0) + 0.5))); + mxItemSet->Put(makeSvx3DFocalLengthItem(static_cast<sal_uInt32>((aSceneCam.GetFocalLength() * 100.0) + 0.5))); } } // end of namespace diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx index 502fe2702c39..3837b23bfeec 100644 --- a/svx/source/sdr/properties/emptyproperties.cxx +++ b/svx/source/sdr/properties/emptyproperties.cxx @@ -27,11 +27,11 @@ namespace sdr::properties { // create a new itemset - std::unique_ptr<SfxItemSet> EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { // Basic implementation; Basic object has NO attributes assert(!"EmptyProperties::CreateObjectSpecificItemSet() should never be called"); - return std::make_unique<SfxItemSet>(rPool); + return SfxItemSet(rPool); } EmptyProperties::EmptyProperties(SdrObject& rObj) @@ -46,15 +46,15 @@ namespace sdr::properties const SfxItemSet& EmptyProperties::GetObjectItemSet() const { - if(!mpEmptyItemSet) + if(!mxEmptyItemSet) { - const_cast<EmptyProperties*>(this)->mpEmptyItemSet = const_cast<EmptyProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()); + mxEmptyItemSet.emplace(const_cast<EmptyProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool())); } - assert(mpEmptyItemSet); + assert(mxEmptyItemSet); assert(!"EmptyProperties::GetObjectItemSet() should never be called"); - return *mpEmptyItemSet; + return *mxEmptyItemSet; } void EmptyProperties::SetObjectItem(const SfxPoolItem& /*rItem*/) diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx index 2819826caad5..d50e58f3d883 100644 --- a/svx/source/sdr/properties/graphicproperties.cxx +++ b/svx/source/sdr/properties/graphicproperties.cxx @@ -55,9 +55,9 @@ namespace sdr::properties } // create a new itemset - std::unique_ptr<SfxItemSet> GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>(rPool, + return SfxItemSet(rPool, // range from SdrAttrObj svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, @@ -132,16 +132,16 @@ namespace sdr::properties // force ItemSet GetObjectItemSet(); - mpItemSet->Put( SdrGrafLuminanceItem( 0 ) ); - mpItemSet->Put( SdrGrafContrastItem( 0 ) ); - mpItemSet->Put( SdrGrafRedItem( 0 ) ); - mpItemSet->Put( SdrGrafGreenItem( 0 ) ); - mpItemSet->Put( SdrGrafBlueItem( 0 ) ); - mpItemSet->Put( SdrGrafGamma100Item( 100 ) ); - mpItemSet->Put( SdrGrafTransparenceItem( 0 ) ); - mpItemSet->Put( SdrGrafInvertItem( false ) ); - mpItemSet->Put( SdrGrafModeItem( GraphicDrawMode::Standard ) ); - mpItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) ); + mxItemSet->Put( SdrGrafLuminanceItem( 0 ) ); + mxItemSet->Put( SdrGrafContrastItem( 0 ) ); + mxItemSet->Put( SdrGrafRedItem( 0 ) ); + mxItemSet->Put( SdrGrafGreenItem( 0 ) ); + mxItemSet->Put( SdrGrafBlueItem( 0 ) ); + mxItemSet->Put( SdrGrafGamma100Item( 100 ) ); + mxItemSet->Put( SdrGrafTransparenceItem( 0 ) ); + mxItemSet->Put( SdrGrafInvertItem( false ) ); + mxItemSet->Put( SdrGrafModeItem( GraphicDrawMode::Standard ) ); + mxItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) ); } } // end of namespace diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx index 923bed6ade17..5f197c417688 100644 --- a/svx/source/sdr/properties/groupproperties.cxx +++ b/svx/source/sdr/properties/groupproperties.cxx @@ -30,12 +30,12 @@ namespace sdr::properties { // create a new itemset - std::unique_ptr<SfxItemSet> GroupProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet GroupProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { // Groups have in principle no ItemSet. To support methods like // GetMergedItemSet() the local one is used. Thus, all items in the pool // may be used and a pool itemset is created. - return std::make_unique<SfxItemSet>(rPool); + return SfxItemSet(rPool); } GroupProperties::GroupProperties(SdrObject& rObj) @@ -66,10 +66,10 @@ namespace sdr::properties const SfxItemSet& GroupProperties::GetMergedItemSet() const { // prepare ItemSet - if(mpItemSet) + if(mxItemSet) { // clear local itemset for merge - mpItemSet->ClearItem(); + mxItemSet->ClearItem(); } else { @@ -92,11 +92,11 @@ namespace sdr::properties { if(SfxItemState::DONTCARE == rSet.GetItemState(nWhich, false)) { - mpItemSet->InvalidateItem(nWhich); + mxItemSet->InvalidateItem(nWhich); } else { - mpItemSet->MergeValue(rSet.Get(nWhich), true); + mxItemSet->MergeValue(rSet.Get(nWhich), true); } nWhich = aIter.NextWhich(); @@ -105,7 +105,7 @@ namespace sdr::properties // For group properties, do not call parent since groups do // not have local ItemSets. - return *mpItemSet; + return *mxItemSet; } void GroupProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems) diff --git a/svx/source/sdr/properties/measureproperties.cxx b/svx/source/sdr/properties/measureproperties.cxx index 5519930e3dda..0675a6c1ddc4 100644 --- a/svx/source/sdr/properties/measureproperties.cxx +++ b/svx/source/sdr/properties/measureproperties.cxx @@ -38,9 +38,9 @@ namespace sdr::properties { // create a new itemset - std::unique_ptr<SfxItemSet> MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet MeasureProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>( + return SfxItemSet( rPool, svl::Items< // Ranges from SdrAttrObj, SdrMeasureObj: @@ -109,7 +109,7 @@ namespace sdr::properties //#71958# by default, the show units Bool-Item is set as hard // attribute to sal_True to avoid confusion when copying SdrMeasureObj's // from one application to another - mpItemSet->Put(SdrYesNoItem(SDRATTR_MEASURESHOWUNIT, true)); + mxItemSet->Put(SdrYesNoItem(SDRATTR_MEASURESHOWUNIT, true)); basegfx::B2DPolygon aNewPolygon; aNewPolygon.append(basegfx::B2DPoint(100.0, 0.0)); @@ -117,11 +117,11 @@ namespace sdr::properties aNewPolygon.append(basegfx::B2DPoint(0.0, 400.0)); aNewPolygon.setClosed(true); - mpItemSet->Put(XLineStartItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon))); - mpItemSet->Put(XLineStartWidthItem(200)); - mpItemSet->Put(XLineEndItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon))); - mpItemSet->Put(XLineEndWidthItem(200)); - mpItemSet->Put(XLineStyleItem(css::drawing::LineStyle_SOLID)); + mxItemSet->Put(XLineStartItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon))); + mxItemSet->Put(XLineStartWidthItem(200)); + mxItemSet->Put(XLineEndItem(OUString(), basegfx::B2DPolyPolygon(aNewPolygon))); + mxItemSet->Put(XLineEndWidthItem(200)); + mxItemSet->Put(XLineStyleItem(css::drawing::LineStyle_SOLID)); } } // end of namespace diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx index feca40ac7faa..ed75133f929f 100644 --- a/svx/source/sdr/properties/pageproperties.cxx +++ b/svx/source/sdr/properties/pageproperties.cxx @@ -29,10 +29,10 @@ namespace sdr::properties { // create a new itemset - std::unique_ptr<SfxItemSet> PageProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet PageProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { // override to legally return a valid ItemSet - return std::make_unique<SfxItemSet>(rPool); + return SfxItemSet(rPool); } PageProperties::PageProperties(SdrObject& rObj) @@ -58,14 +58,14 @@ namespace sdr::properties // without asserting const SfxItemSet& PageProperties::GetObjectItemSet() const { - if(!mpEmptyItemSet) + if(!mxEmptyItemSet) { - const_cast<PageProperties*>(this)->mpEmptyItemSet = const_cast<PageProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()); + mxEmptyItemSet.emplace(const_cast<PageProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool())); } - DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)"); + DBG_ASSERT(mxEmptyItemSet, "Could not create an SfxItemSet(!)"); - return *mpEmptyItemSet; + return *mxEmptyItemSet; } void PageProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) @@ -86,8 +86,8 @@ namespace sdr::properties void PageProperties::PostItemChange(const sal_uInt16 nWhich ) { - if( (nWhich == XATTR_FILLSTYLE) && (mpEmptyItemSet != nullptr) ) - CleanupFillProperties(*mpEmptyItemSet); + if( (nWhich == XATTR_FILLSTYLE) && mxEmptyItemSet ) + CleanupFillProperties(*mxEmptyItemSet); } void PageProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/) diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index 8a90de5c848b..a5ebc79efddc 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -46,9 +46,9 @@ using namespace com::sun::star; namespace sdr::properties { - std::unique_ptr<SfxItemSet> TextProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet TextProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>(rPool, + return SfxItemSet(rPool, // range from SdrAttrObj svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, @@ -126,7 +126,7 @@ namespace sdr::properties GetObjectItemSet(); SfxItemSet aNewSet(pOutliner->GetParaAttribs(0)); - mpItemSet->Put(aNewSet); + mxItemSet->Put(aNewSet); } std::unique_ptr<OutlinerParaObject> pTemp = pOutliner->CreateParaObject(0, nParaCount); @@ -367,15 +367,15 @@ namespace sdr::properties if(bTextFrame) { - mpItemSet->Put(XLineStyleItem(drawing::LineStyle_NONE)); - mpItemSet->Put(XFillColorItem(OUString(), COL_WHITE)); - mpItemSet->Put(XFillStyleItem(drawing::FillStyle_NONE)); + mxItemSet->Put(XLineStyleItem(drawing::LineStyle_NONE)); + mxItemSet->Put(XFillColorItem(OUString(), COL_WHITE)); + mxItemSet->Put(XFillStyleItem(drawing::FillStyle_NONE)); } else { - mpItemSet->Put(SvxAdjustItem(SvxAdjust::Center, EE_PARA_JUST)); - mpItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); - mpItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); + mxItemSet->Put(SvxAdjustItem(SvxAdjust::Center, EE_PARA_JUST)); + mxItemSet->Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); + mxItemSet->Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); } } @@ -387,7 +387,7 @@ namespace sdr::properties // #i61284# push hard ObjectItemSet to OutlinerParaObject attributes // using existing functionality GetObjectItemSet(); // force ItemSet - ItemSetChanged(*mpItemSet); + ItemSetChanged(*mxItemSet); // now the standard TextProperties stuff SdrTextObj& rObj = static_cast<SdrTextObj&>(GetSdrObject()); @@ -525,7 +525,7 @@ namespace sdr::properties void TextProperties::SetObjectItemNoBroadcast(const SfxPoolItem& rItem) { GetObjectItemSet(); - mpItemSet->Put(rItem); + mxItemSet->Put(rItem); } diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index c42db7cfd7d8..a4bc4a86ffec 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -150,7 +150,7 @@ namespace sdr::properties { protected: // create a new itemset - std::unique_ptr<SfxItemSet> CreateObjectSpecificItemSet(SfxItemPool& rPool) override; + SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; const svx::ITextProvider& getTextProvider() const override; @@ -177,9 +177,9 @@ namespace sdr::properties }; // create a new itemset - std::unique_ptr<SfxItemSet> CellProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) + SfxItemSet CellProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>(rPool, + return SfxItemSet(rPool, // range from SdrAttrObj svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, @@ -278,7 +278,7 @@ namespace sdr::properties GetObjectItemSet(); SfxItemSet aNewSet(pOutliner->GetParaAttribs(0)); - mpItemSet->Put(aNewSet); + mxItemSet->Put(aNewSet); } std::unique_ptr<OutlinerParaObject> pTemp = pOutliner->CreateParaObject(0, nParaCount); diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 33b134dbe2c2..5731c12acdd9 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -85,7 +85,7 @@ class TableProperties : public TextProperties { protected: // create a new itemset - std::unique_ptr<SfxItemSet> CreateObjectSpecificItemSet(SfxItemPool& rPool) override; + SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; public: // basic constructor @@ -126,9 +126,9 @@ void TableProperties::ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNe } // create a new itemset -std::unique_ptr<SfxItemSet> TableProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) +SfxItemSet TableProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) { - return std::make_unique<SfxItemSet>(rPool, + return SfxItemSet(rPool, // range from SdrAttrObj svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST, |