summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editeng/source/uno/unotext.cxx20
-rw-r--r--include/svl/isethint.hxx8
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx24
-rw-r--r--sd/source/ui/view/drviews2.cxx22
-rw-r--r--sd/source/ui/view/drviews7.cxx10
-rw-r--r--sfx2/source/appl/appopen.cxx8
-rw-r--r--svl/source/notify/isethint.cxx2
-rw-r--r--svx/source/sdr/properties/e3dsceneproperties.cxx9
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx14
9 files changed, 58 insertions, 59 deletions
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 81549327bf24..60e19748fcd8 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -601,16 +601,16 @@ uno::Any SvxUnoTextRangeBase::_getPropertyValue(const OUString& PropertyName, sa
const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName );
if( pMap )
{
- std::unique_ptr<SfxItemSet> pAttribs;
+ std::optional<SfxItemSet> oAttribs;
if( nPara != -1 )
- pAttribs = pForwarder->GetParaAttribs( nPara ).Clone();
+ oAttribs.emplace(pForwarder->GetParaAttribs( nPara ).CloneAsValue());
else
- pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
+ oAttribs.emplace(pForwarder->GetAttribs( GetSelection() ).CloneAsValue());
// Replace Dontcare with Default, so that one always has a mirror
- pAttribs->ClearInvalidItems();
+ oAttribs->ClearInvalidItems();
- getPropertyValue( pMap, aAny, *pAttribs );
+ getPropertyValue( pMap, aAny, *oAttribs );
return aAny;
}
@@ -879,13 +879,13 @@ uno::Sequence< uno::Any > SvxUnoTextRangeBase::_getPropertyValues( const uno::Se
SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr;
if( pForwarder )
{
- std::unique_ptr<SfxItemSet> pAttribs;
+ std::optional<SfxItemSet> oAttribs;
if( nPara != -1 )
- pAttribs = pForwarder->GetParaAttribs( nPara ).Clone();
+ oAttribs.emplace(pForwarder->GetParaAttribs( nPara ).CloneAsValue());
else
- pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
+ oAttribs.emplace(pForwarder->GetAttribs( GetSelection() ).CloneAsValue() );
- pAttribs->ClearInvalidItems();
+ oAttribs->ClearInvalidItems();
const OUString* pPropertyNames = aPropertyNames.getConstArray();
uno::Any* pValues = aValues.getArray();
@@ -895,7 +895,7 @@ uno::Sequence< uno::Any > SvxUnoTextRangeBase::_getPropertyValues( const uno::Se
const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
if( pMap )
{
- getPropertyValue( pMap, *pValues, *pAttribs );
+ getPropertyValue( pMap, *pValues, *oAttribs );
}
}
}
diff --git a/include/svl/isethint.hxx b/include/svl/isethint.hxx
index a96f993dca01..89dbc3b71829 100644
--- a/include/svl/isethint.hxx
+++ b/include/svl/isethint.hxx
@@ -21,20 +21,18 @@
#include <svl/svldllapi.h>
#include <svl/hint.hxx>
-#include <memory>
-
-class SfxItemSet;
+#include <svl/itemset.hxx>
class SVL_DLLPUBLIC SfxItemSetHint final : public SfxHint
{
- std::unique_ptr<SfxItemSet> _pItemSet;
+ SfxItemSet maItemSet;
public:
SfxItemSetHint( const SfxItemSet &rItemSet );
virtual ~SfxItemSetHint() override;
- const SfxItemSet& GetItemSet() const { return *_pItemSet; }
+ const SfxItemSet& GetItemSet() const { return maItemSet; }
};
#endif
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 348fb56d53d6..760974b95ffe 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -68,12 +68,12 @@ SFX_IMPL_INTERFACE(ScDrawShell, SfxShell)
namespace
{
- void lcl_convertStringArguments(sal_uInt16 nSlot, const std::unique_ptr<SfxItemSet>& pArgs)
+ void lcl_convertStringArguments(sal_uInt16 nSlot, SfxItemSet& rArgs)
{
Color aColor;
const SfxPoolItem* pItem = nullptr;
- if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LINE_WIDTH_ARG, false, &pItem))
+ if (SfxItemState::SET == rArgs.GetItemState(SID_ATTR_LINE_WIDTH_ARG, false, &pItem))
{
double fValue = static_cast<const SvxDoubleItem*>(pItem)->GetValue();
// FIXME: different units...
@@ -81,9 +81,9 @@ namespace
int nValue = fValue * nPow;
XLineWidthItem aItem(nValue);
- pArgs->Put(aItem);
+ rArgs.Put(aItem);
}
- else if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
+ else if (SfxItemState::SET == rArgs.GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
{
OUString sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
@@ -97,33 +97,33 @@ namespace
case SID_ATTR_LINE_COLOR:
{
XLineColorItem aLineColorItem(OUString(), aColor);
- pArgs->Put(aLineColorItem);
+ rArgs.Put(aLineColorItem);
break;
}
case SID_ATTR_FILL_COLOR:
{
XFillColorItem aFillColorItem(OUString(), aColor);
- pArgs->Put(aFillColorItem);
+ rArgs.Put(aFillColorItem);
break;
}
case SID_ATTR_SHADOW_COLOR:
{
XColorItem aItem(SDRATTR_SHADOWCOLOR, aColor);
- pArgs->Put(aItem);
+ rArgs.Put(aItem);
break;
}
}
}
- if (SfxItemState::SET == pArgs->GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
+ if (SfxItemState::SET == rArgs.GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
{
const SfxStringItem* pJSON = static_cast<const SfxStringItem*>(pItem);
if (pJSON)
{
XGradient aGradient = XGradient::fromJSON(pJSON->GetValue());
XFillGradientItem aItem(aGradient);
- pArgs->Put(aItem);
+ rArgs.Put(aItem);
}
}
}
@@ -294,9 +294,9 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
if( pView->AreObjectsMarked() )
{
- std::unique_ptr<SfxItemSet> pNewArgs = rReq.GetArgs()->Clone();
- lcl_convertStringArguments( rReq.GetSlot(), pNewArgs );
- pView->SetAttrToMarked( *pNewArgs, false );
+ SfxItemSet aNewArgs = rReq.GetArgs()->CloneAsValue();
+ lcl_convertStringArguments( rReq.GetSlot(), aNewArgs );
+ pView->SetAttrToMarked( aNewArgs, false );
}
else
pView->SetDefaultAttr( *rReq.GetArgs(), false);
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index bef73c1726d3..1cd427e8b6f8 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -543,12 +543,12 @@ public:
}
};
- void lcl_convertStringArguments(sal_uInt16 nSlot, const std::unique_ptr<SfxItemSet>& pArgs)
+ void lcl_convertStringArguments(sal_uInt16 nSlot, SfxItemSet& rArgs)
{
Color aColor;
const SfxPoolItem* pItem = nullptr;
- if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LINE_WIDTH_ARG, false, &pItem))
+ if (SfxItemState::SET == rArgs.GetItemState(SID_ATTR_LINE_WIDTH_ARG, false, &pItem))
{
double fValue = static_cast<const SvxDoubleItem*>(pItem)->GetValue();
// FIXME: different units...
@@ -556,9 +556,9 @@ public:
int nValue = fValue * nPow;
XLineWidthItem aItem(nValue);
- pArgs->Put(aItem);
+ rArgs.Put(aItem);
}
- if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
+ if (SfxItemState::SET == rArgs.GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
{
OUString sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
@@ -572,26 +572,26 @@ public:
case SID_ATTR_LINE_COLOR:
{
XLineColorItem aLineColorItem(OUString(), aColor);
- pArgs->Put(aLineColorItem);
+ rArgs.Put(aLineColorItem);
break;
}
case SID_ATTR_FILL_COLOR:
{
XFillColorItem aFillColorItem(OUString(), aColor);
- pArgs->Put(aFillColorItem);
+ rArgs.Put(aFillColorItem);
break;
}
}
}
- if (SfxItemState::SET == pArgs->GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
+ if (SfxItemState::SET == rArgs.GetItemState(SID_FILL_GRADIENT_JSON, false, &pItem))
{
const SfxStringItem* pJSON = static_cast<const SfxStringItem*>(pItem);
if (pJSON)
{
XGradient aGradient = XGradient::fromJSON(pJSON->GetValue());
XFillGradientItem aItem(aGradient);
- pArgs->Put(aItem);
+ rArgs.Put(aItem);
}
}
}
@@ -683,9 +683,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
if( rReq.GetArgs() )
{
- std::unique_ptr<SfxItemSet> pNewArgs = rReq.GetArgs()->Clone();
- lcl_convertStringArguments(rReq.GetSlot(), pNewArgs);
- mpDrawView->SetAttributes(*pNewArgs);
+ SfxItemSet aNewArgs = rReq.GetArgs()->CloneAsValue();
+ lcl_convertStringArguments(rReq.GetSlot(), aNewArgs);
+ mpDrawView->SetAttributes(aNewArgs);
rReq.Done();
}
else
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 0f94af51feb8..cf0eb92c3828 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1780,7 +1780,7 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
{
SdrPageProperties& rPageProperties = pPage->getSdrPageProperties();
const SfxItemSet &aPageItemSet = rPageProperties.GetItemSet();
- std::unique_ptr<SfxItemSet> pTempSet = aPageItemSet.Clone(false, &mpDrawView->GetModel()->GetItemPool());
+ SfxItemSet aTempSet = aPageItemSet.CloneAsValue(false, &mpDrawView->GetModel()->GetItemPool());
const SfxPoolItem* pItem = nullptr;
rPageProperties.ClearItem(XATTR_FILLSTYLE);
@@ -1837,10 +1837,10 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
// MigrateItemSet guarantees unique gradient names
SfxItemSetFixed<XATTR_FILLGRADIENT, XATTR_FILLGRADIENT> aMigrateSet( mpDrawView->GetModel()->GetItemPool() );
aMigrateSet.Put( aGradientItem );
- SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDrawView->GetModel() );
+ SdrModel::MigrateItemSet( &aMigrateSet, &aTempSet, mpDrawView->GetModel() );
rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
- rPageProperties.PutItemSet( *pTempSet );
+ rPageProperties.PutItemSet( aTempSet );
}
else
{
@@ -1849,10 +1849,10 @@ void DrawViewShell::SetPageProperties (SfxRequest& rReq)
// MigrateItemSet guarantees unique gradient names
SfxItemSetFixed<XATTR_FILLGRADIENT, XATTR_FILLGRADIENT> aMigrateSet( mpDrawView->GetModel()->GetItemPool() );
aMigrateSet.Put( aGradientItem );
- SdrModel::MigrateItemSet( &aMigrateSet, pTempSet.get(), mpDrawView->GetModel() );
+ SdrModel::MigrateItemSet( &aMigrateSet, &aTempSet, mpDrawView->GetModel() );
rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
- rPageProperties.PutItemSet( *pTempSet );
+ rPageProperties.PutItemSet( aTempSet );
}
}
break;
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 5d8a28b7d21c..a2e3fc5e3f10 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -388,11 +388,11 @@ ErrCode SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &
css::uno::Reference< css::frame::XModel > xModel = xDoc->GetModel();
if ( xModel.is() )
{
- std::unique_ptr<SfxItemSet> pNew = xDoc->GetMedium()->GetItemSet()->Clone();
- pNew->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL );
- pNew->ClearItem( SID_FILTER_NAME );
+ SfxItemSet aNew = xDoc->GetMedium()->GetItemSet()->CloneAsValue();
+ aNew.ClearItem( SID_PROGRESS_STATUSBAR_CONTROL );
+ aNew.ClearItem( SID_FILTER_NAME );
css::uno::Sequence< css::beans::PropertyValue > aArgs;
- TransformItems( SID_OPENDOC, *pNew, aArgs );
+ TransformItems( SID_OPENDOC, aNew, aArgs );
sal_Int32 nLength = aArgs.getLength();
aArgs.realloc( nLength + 1 );
auto pArgs = aArgs.getArray();
diff --git a/svl/source/notify/isethint.cxx b/svl/source/notify/isethint.cxx
index 2ac61804312b..c0012377eccb 100644
--- a/svl/source/notify/isethint.cxx
+++ b/svl/source/notify/isethint.cxx
@@ -24,7 +24,7 @@
* Copies the SfxItemSet passed as a parameter.
*/
SfxItemSetHint::SfxItemSetHint(const SfxItemSet& rItemSet)
- : _pItemSet(rItemSet.Clone())
+ : maItemSet(rItemSet.CloneAsValue())
{
}
diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx
index 93d4e2eed9f8..a0887cc15aee 100644
--- a/svx/source/sdr/properties/e3dsceneproperties.cxx
+++ b/svx/source/sdr/properties/e3dsceneproperties.cxx
@@ -115,15 +115,14 @@ namespace sdr::properties
{
// Generate filtered ItemSet which contains all but the SDRATTR_3DSCENE items.
// #i50808# Leak fix, Clone produces a new instance and we get ownership here
- std::unique_ptr<SfxItemSet> pNewSet(rSet.Clone());
- DBG_ASSERT(pNewSet, "E3dSceneProperties::SetMergedItemSet(): Could not clone ItemSet (!)");
+ SfxItemSet aNewSet(rSet.CloneAsValue());
for(sal_uInt16 b(SDRATTR_3DSCENE_FIRST); b <= SDRATTR_3DSCENE_LAST; b++)
{
- pNewSet->ClearItem(b);
+ aNewSet.ClearItem(b);
}
- if(pNewSet->Count())
+ if(aNewSet.Count())
{
for(size_t a = 0; a < nCount; ++a)
{
@@ -132,7 +131,7 @@ namespace sdr::properties
if(dynamic_cast<const E3dCompoundObject* >(pObj))
{
// set merged ItemSet at contained 3d object.
- pObj->SetMergedItemSet(*pNewSet, bClearAllItems);
+ pObj->SetMergedItemSet(aNewSet, bClearAllItems);
}
}
}
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index e47f69fe4444..01ba8b743c63 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -85,13 +85,13 @@ using namespace ::com::sun::star;
namespace
{
- void lcl_convertStringArguments(sal_uInt16 nSlot, const std::unique_ptr<SfxItemSet>& pArgs)
+ void lcl_convertStringArguments(sal_uInt16 nSlot, SfxItemSet& rArgs)
{
Color aColor;
OUString sColor;
const SfxPoolItem* pItem = nullptr;
- if (SfxItemState::SET != pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
+ if (SfxItemState::SET != rArgs.GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
return;
sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
@@ -106,14 +106,14 @@ namespace
case SID_ATTR_CHAR_COLOR:
{
SvxColorItem aColorItem(aColor, EE_CHAR_COLOR);
- pArgs->Put(aColorItem);
+ rArgs.Put(aColorItem);
break;
}
case SID_ATTR_CHAR_BACK_COLOR:
{
SvxColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR);
- pArgs->Put(pBackgroundItem);
+ rArgs.Put(pBackgroundItem);
break;
}
}
@@ -130,7 +130,9 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
const sal_uInt16 nSlot = rReq.GetSlot();
const sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
- std::unique_ptr<SfxItemSet> pNewAttrs(rReq.GetArgs() ? rReq.GetArgs()->Clone() : nullptr);
+ std::optional<SfxItemSet> pNewAttrs;
+ if (rReq.GetArgs())
+ pNewAttrs.emplace(rReq.GetArgs()->CloneAsValue());
bool bRestoreSelection = false;
ESelection aOldSelection;
@@ -639,7 +641,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
}
if (nEEWhich && pNewAttrs)
{
- lcl_convertStringArguments(nSlot, pNewAttrs);
+ lcl_convertStringArguments(nSlot, *pNewAttrs);
aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich));
}