summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-23 14:04:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-23 19:49:43 +0200
commitd4248915d7db69aa7bf31d9d6189b7375aca70ed (patch)
tree03e53496dd63b2a9725ede707c78cc02079d1018 /sw/source/core
parent3cbcaa8d36ef889a28d790e18d68b838cfc46bb2 (diff)
pass SvxBrushItem around by unique_ptr
we never create an object that is actually shared, so this is wasted Note1: in IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void) there was a comparison if( aBrush != pRepr->GetBackground() || ... which I removed Note2: In bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill ) which had a condition else if( rToFill != xBack ) I changed to compare contents Change-Id: Idd769f44917c5ccc7e9f4bfbaddf12f9cd4151cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/attr/format.cxx4
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx14
-rw-r--r--sw/source/core/frmedt/fetab.cxx16
-rw-r--r--sw/source/core/layout/atrfrm.cxx4
-rw-r--r--sw/source/core/layout/flylay.cxx2
-rw-r--r--sw/source/core/layout/paintfrm.cxx2
-rw-r--r--sw/source/core/layout/tabfrm.cxx2
-rw-r--r--sw/source/core/layout/wsfrm.cxx6
-rw-r--r--sw/source/core/unocore/unoframe.cxx6
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx2
-rw-r--r--sw/source/core/unocore/unostyle.cxx12
-rw-r--r--sw/source/core/unocore/unotbl.cxx38
12 files changed, 54 insertions, 54 deletions
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index ac03070f20d0..c856abb50b34 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -779,7 +779,7 @@ void SwFormat::SetGrabBagItem(const uno::Any& rVal)
m_pGrabBagItem->PutValue(rVal, 0);
}
-std::shared_ptr<SvxBrushItem> SwFormat::makeBackgroundBrushItem(bool bInP) const
+std::unique_ptr<SvxBrushItem> SwFormat::makeBackgroundBrushItem(bool bInP) const
{
if (supportsFullDrawingLayerFillAttributeSet())
{
@@ -792,7 +792,7 @@ std::shared_ptr<SvxBrushItem> SwFormat::makeBackgroundBrushItem(bool bInP) const
return getSvxBrushItemFromSourceSet(m_aSet, RES_BACKGROUND, bInP);
}
- return std::shared_ptr<SvxBrushItem>(m_aSet.GetBackground(bInP).Clone());
+ return std::unique_ptr<SvxBrushItem>(m_aSet.GetBackground(bInP).Clone());
}
drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFormat::getSdrAllFillAttributesHelper() const
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index b23324a914aa..8d8fa399ac9a 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -504,7 +504,7 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew
}
}
-bool SwDoc::GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushItem>& rToFill )
+bool SwDoc::GetRowBackground( const SwCursor& rCursor, std::unique_ptr<SvxBrushItem>& rToFill )
{
bool bRet = false;
SwTableNode* pTableNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
@@ -520,9 +520,9 @@ bool SwDoc::GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushI
bRet = true;
for ( std::vector<SwTableLine*>::size_type i = 1; i < aRowArr.size(); ++i )
{
- std::shared_ptr<SvxBrushItem> aAlternative(aRowArr[i]->GetFrameFormat()->makeBackgroundBrushItem());
+ std::unique_ptr<SvxBrushItem> aAlternative(aRowArr[i]->GetFrameFormat()->makeBackgroundBrushItem());
- if ( rToFill != aAlternative && rToFill && aAlternative && *rToFill != *aAlternative )
+ if ( rToFill && aAlternative && *rToFill != *aAlternative )
{
bRet = false;
break;
@@ -1190,7 +1190,7 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
}
}
-bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill )
+bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::unique_ptr<SfxPoolItem>& rToFill )
{
bool bRet = false;
SwTableNode* pTableNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
@@ -1206,14 +1206,14 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& r
{
case RES_BACKGROUND:
{
- std::shared_ptr<SvxBrushItem> aBack =
+ std::unique_ptr<SvxBrushItem> xBack =
aBoxes[i]->GetFrameFormat()->makeBackgroundBrushItem();
if( !bOneFound )
{
- rToFill.reset(aBack->Clone());
+ rToFill = std::move(xBack);
bOneFound = true;
}
- else if( rToFill != aBack )
+ else if( *rToFill != *xBack )
bRet = false;
}
break;
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index fcadbac2717a..242c148f89b0 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -745,7 +745,7 @@ void SwFEShell::SetRowBackground( const SvxBrushItem &rNew )
EndAllActionAndCall();
}
-bool SwFEShell::GetRowBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const
+bool SwFEShell::GetRowBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const
{
return SwDoc::GetRowBackground( *getShellCursor( false ), rToFill );
}
@@ -781,11 +781,11 @@ void SwFEShell::SetBoxBackground( const SvxBrushItem &rNew )
EndAllActionAndCall();
}
-bool SwFEShell::GetBoxBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const
+bool SwFEShell::GetBoxBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const
{
- std::shared_ptr<SfxPoolItem> aTemp(rToFill);
+ std::unique_ptr<SfxPoolItem> aTemp = std::move(rToFill);
bool bRetval(SwDoc::GetBoxAttr(*getShellCursor( false ), aTemp));
- rToFill = std::static_pointer_cast<SvxBrushItem>(aTemp);
+ rToFill.reset(static_cast<SvxBrushItem*>(aTemp.release()));
return bRetval;
}
@@ -797,11 +797,11 @@ void SwFEShell::SetBoxDirection( const SvxFrameDirectionItem& rNew )
EndAllActionAndCall();
}
-bool SwFEShell::GetBoxDirection( std::shared_ptr<SvxFrameDirectionItem>& rToFill ) const
+bool SwFEShell::GetBoxDirection( std::unique_ptr<SvxFrameDirectionItem>& rToFill ) const
{
- std::shared_ptr<SfxPoolItem> aTemp(rToFill);
+ std::unique_ptr<SfxPoolItem> aTemp = std::move(rToFill);
bool bRetval(SwDoc::GetBoxAttr(*getShellCursor( false ), aTemp));
- rToFill = std::static_pointer_cast<SvxFrameDirectionItem>(aTemp);
+ rToFill.reset(static_cast<SvxFrameDirectionItem*>(aTemp.release()));
return bRetval;
}
@@ -831,7 +831,7 @@ void SwFEShell::SetTabBackground( const SvxBrushItem &rNew )
GetDoc()->getIDocumentState().SetModified();
}
-void SwFEShell::GetTabBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const
+void SwFEShell::GetTabBackground( std::unique_ptr<SvxBrushItem>& rToFill ) const
{
SwFrame *pFrame = GetCurrFrame();
if( pFrame && pFrame->IsInTab() )
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index d4e24094dd1f..f6475124cddf 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -3188,7 +3188,7 @@ bool SwFlyFrameFormat::IsBackgroundTransparent() const
// NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT)
// and there is no background graphic, it "inherites" the background
// from its anchor.
- std::shared_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
+ std::unique_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
if ( aBackground &&
(aBackground->GetColor().GetTransparency() != 0) &&
(aBackground->GetColor() != COL_TRANSPARENT)
@@ -3228,7 +3228,7 @@ bool SwFlyFrameFormat::IsBackgroundBrushInherited() const
}
else
{
- std::shared_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
+ std::unique_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem());
if ( aBackground &&
(aBackground->GetColor() == COL_TRANSPARENT) &&
!(aBackground->GetGraphicObject()) )
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 15719ce4b9fc..4c41de8ed325 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -358,7 +358,7 @@ bool SwFlyFreeFrame::supportsAutoContour() const
}
else
{
- const std::shared_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
+ const std::unique_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
if(aBack && aBack->isUsed())
{
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index d5ec987896b1..8c9872b7743f 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3980,7 +3980,7 @@ void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
}
else
{
- std::shared_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem();
+ std::unique_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem();
// to determine, if background has to be painted, by checking, if
// background color is not COL_TRANSPARENT ("no fill"/"auto fill")
// or a background graphic exists.
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 9adfcbef6988..ef59cf08d82e 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3200,7 +3200,7 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
InvalidatePage( pPage );
SetComplete();
- std::shared_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem();
+ std::unique_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem();
const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
SetCompletePaint();
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index d143ec52d868..57db1547a1c6 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1686,7 +1686,7 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst )
GetNext()->InvalidatePos_();
//Trigger a repaint if necessary.
- std::shared_ptr<SvxBrushItem> aBack(pUp->GetFormat()->makeBackgroundBrushItem());
+ std::unique_ptr<SvxBrushItem> aBack(pUp->GetFormat()->makeBackgroundBrushItem());
const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
if ( ePos != GPOS_NONE && ePos != GPOS_TILED )
pViewShell->InvalidateWindows( pUp->getFrameArea() );
@@ -2723,7 +2723,7 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
if( IsCellFrame() )
InvaPercentLowers( nReal );
- std::shared_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
+ std::unique_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
SetCompletePaint();
@@ -2909,7 +2909,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
const SwFrameFormat* pFormat = GetFormat();
if (pFormat)
{
- std::shared_ptr<SvxBrushItem> aBack(pFormat->makeBackgroundBrushItem());
+ std::unique_ptr<SvxBrushItem> aBack(pFormat->makeBackgroundBrushItem());
const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE;
if ( GPOS_NONE == ePos || GPOS_TILED == ePos )
bCompletePaint = false;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 5ffb98a44c61..760418f4be6a 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1746,8 +1746,8 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
if(RES_BACKGROUND == pEntry->nWID)
{
const SwAttrSet& rSet = pFormat->GetAttrSet();
- const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
- std::shared_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
+ const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND, true, pDoc->IsInXMLImport()));
+ std::unique_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
aChangedBrushItem->PutValue(aValue, nMemberId);
@@ -2238,7 +2238,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
if(RES_BACKGROUND == pEntry->nWID)
{
- const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+ const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
if(!aOriginalBrushItem->QueryValue(aAny, nMemberId))
{
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index d10a19527b96..3fef41218cad 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -447,7 +447,7 @@ void SwXParagraph::Impl::GetSinglePropertyValue_Impl(
{
case RES_BACKGROUND:
{
- const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+ const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
if(!aOriginalBrushItem->QueryValue(rAny, rEntry.nMemberId))
{
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 446e07638ab8..16c089e78d0b 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1682,8 +1682,8 @@ template<>
void SwXStyle::SetPropertyValue<sal_uInt16(RES_BACKGROUND)>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
{
SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet();
- const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport()));
- std::shared_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
+ const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport()));
+ std::unique_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
uno::Any aValue(rValue);
const auto nMemberId(lcl_TranslateMetric(rEntry, m_pDoc, aValue));
@@ -2317,7 +2317,7 @@ uno::Any SwXStyle::GetStyleProperty<sal_uInt16(RES_BACKGROUND)>(const SfxItemPro
{
PrepareStyleBase(rBase);
const SfxItemSet& rSet = rBase.GetItemSet();
- const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
+ const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
uno::Any aResult;
if(!aOriginalBrushItem->QueryValue(aResult, rEntry.nMemberId))
SAL_WARN("sw.uno", "error getting attribute from RES_BACKGROUND.");
@@ -3675,8 +3675,8 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
}
case RES_BACKGROUND:
{
- const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, m_pDocShell->GetDoc()->IsInXMLImport()));
- std::shared_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
+ const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, m_pDocShell->GetDoc()->IsInXMLImport()));
+ std::unique_ptr<SvxBrushItem> aChangedBrushItem(aOriginalBrushItem->Clone());
aChangedBrushItem->PutValue(aValue, nMemberId);
@@ -4003,7 +4003,7 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl(
{
case RES_BACKGROUND:
{
- const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND));
+ const std::unique_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND));
if(!aOriginalBrushItem->QueryValue(aTarget, pEntry->nMemberId))
{
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 7945d1cfc585..762dcf73dd1d 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1666,7 +1666,7 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u
{
case FN_UNO_TABLE_CELL_BACKGROUND:
{
- std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+ std::unique_ptr<SfxPoolItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
SwDoc::GetBoxAttr(rUnoCursor, aBrush);
aBrush->PutValue(aValue, pEntry->nMemberId);
pDoc->SetBoxAttr(rUnoCursor, *aBrush);
@@ -1719,7 +1719,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
{
case FN_UNO_TABLE_CELL_BACKGROUND:
{
- std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+ std::unique_ptr<SfxPoolItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
if (SwDoc::GetBoxAttr(rUnoCursor, aBrush))
aBrush->QueryValue(aResult, pEntry->nMemberId);
}
@@ -1778,9 +1778,8 @@ public:
void SetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& aVal);
bool GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& rpAny);
- template<typename Tpoolitem>
- inline void AddItemToSet(SfxItemSet& rSet, std::function<Tpoolitem()> aItemFactory, sal_uInt16 nWhich, std::initializer_list<sal_uInt16> vMember, bool bAddTwips = false);
-
+ void AddItemToSet(SfxItemSet& rSet, std::function<std::unique_ptr<SfxPoolItem>()> aItemFactory,
+ sal_uInt16 nWhich, std::initializer_list<sal_uInt16> vMember, bool bAddTwips = false);
void ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc);
};
@@ -1795,8 +1794,9 @@ void SwTableProperties_Impl::SetProperty(sal_uInt16 nWhichId, sal_uInt16 nMember
bool SwTableProperties_Impl::GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& rpAny )
{ return aAnyMap.FillValue( nWhichId, nMemberId, rpAny ); }
-template<typename Tpoolitem>
-void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet, std::function<Tpoolitem()> aItemFactory, sal_uInt16 nWhich, std::initializer_list<sal_uInt16> vMember, bool bAddTwips)
+void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet,
+ std::function<std::unique_ptr<SfxPoolItem>()> aItemFactory,
+ sal_uInt16 nWhich, std::initializer_list<sal_uInt16> vMember, bool bAddTwips)
{
std::vector< std::pair<sal_uInt16, const uno::Any* > > vMemberAndAny;
for(sal_uInt16 nMember : vMember)
@@ -1808,7 +1808,7 @@ void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet, std::function<Tpooli
}
if(!vMemberAndAny.empty())
{
- Tpoolitem aItem = aItemFactory();
+ std::unique_ptr<SfxPoolItem> aItem(aItemFactory());
for(const auto& aMemberAndAny : vMemberAndAny)
aItem->PutValue(*aMemberAndAny.second, aMemberAndAny.first | (bAddTwips ? CONVERT_TWIPS : 0) );
rSet.Put(*aItem);
@@ -1833,7 +1833,7 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
const_cast<SwTable&>(rTable).SetRowsToRepeat( bVal ? 1 : 0 ); // TODO: MULTIHEADER
}
- AddItemToSet<std::shared_ptr<SvxBrushItem>>(aSet, [&rFrameFormat]() { return rFrameFormat.makeBackgroundBrushItem(); }, RES_BACKGROUND, {
+ AddItemToSet(aSet, [&rFrameFormat]() { return rFrameFormat.makeBackgroundBrushItem(); }, RES_BACKGROUND, {
MID_BACK_COLOR,
MID_GRAPHIC_TRANSPARENT,
MID_GRAPHIC_POSITION,
@@ -1865,10 +1865,10 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
}
if(bPutBreak)
- AddItemToSet<std::shared_ptr<SvxFormatBreakItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxFormatBreakItem>(rFrameFormat.GetBreak().Clone()); }, RES_BREAK, {0});
- AddItemToSet<std::shared_ptr<SvxShadowItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxShadowItem>(rFrameFormat.GetShadow().Clone()); }, RES_SHADOW, {0}, true);
- AddItemToSet<std::shared_ptr<SvxFormatKeepItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxFormatKeepItem>(rFrameFormat.GetKeep().Clone()); }, RES_KEEP, {0});
- AddItemToSet<std::shared_ptr<SwFormatHoriOrient>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SwFormatHoriOrient>(rFrameFormat.GetHoriOrient().Clone()); }, RES_HORI_ORIENT, {MID_HORIORIENT_ORIENT}, true);
+ AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetBreak().Clone()); }, RES_BREAK, {0});
+ AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetShadow().Clone()); }, RES_SHADOW, {0}, true);
+ AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetKeep().Clone()); }, RES_KEEP, {0});
+ AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetHoriOrient().Clone()); }, RES_HORI_ORIENT, {MID_HORIORIENT_ORIENT}, true);
const uno::Any* pSzRel(nullptr);
GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff, pSzRel);
@@ -1895,10 +1895,10 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc)
aSz.SetWidth(MINLAY);
aSet.Put(aSz);
}
- AddItemToSet<std::shared_ptr<SvxLRSpaceItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxLRSpaceItem>(rFrameFormat.GetLRSpace().Clone()); }, RES_LR_SPACE, {
+ AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetLRSpace().Clone()); }, RES_LR_SPACE, {
MID_L_MARGIN|CONVERT_TWIPS,
MID_R_MARGIN|CONVERT_TWIPS });
- AddItemToSet<std::shared_ptr<SvxULSpaceItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxULSpaceItem>(rFrameFormat.GetULSpace().Clone()); }, RES_UL_SPACE, {
+ AddItemToSet(aSet, [&rFrameFormat]() { return std::unique_ptr<SfxPoolItem>(rFrameFormat.GetULSpace().Clone()); }, RES_UL_SPACE, {
MID_UP_MARGIN|CONVERT_TWIPS,
MID_LO_MARGIN|CONVERT_TWIPS });
const::uno::Any* pSplit(nullptr);
@@ -3393,7 +3393,7 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
{
case FN_UNO_TABLE_CELL_BACKGROUND:
{
- std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+ std::unique_ptr<SfxPoolItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aBrush);
aBrush->PutValue(aValue, pEntry->nMemberId);
pDoc->SetBoxAttr(*m_pImpl->m_pTableCursor, *aBrush);
@@ -3503,7 +3503,7 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName)
{
case FN_UNO_TABLE_CELL_BACKGROUND:
{
- std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND));
+ std::unique_ptr<SfxPoolItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
if (SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aBrush))
aBrush->QueryValue(aRet, pEntry->nMemberId);
@@ -3542,8 +3542,8 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName)
break;
case RES_VERT_ORIENT:
{
- std::shared_ptr<SfxPoolItem> aVertOrient(
- std::make_shared<SwFormatVertOrient>(RES_VERT_ORIENT));
+ std::unique_ptr<SfxPoolItem> aVertOrient(
+ std::make_unique<SwFormatVertOrient>(RES_VERT_ORIENT));
if (SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aVertOrient))
{
aVertOrient->QueryValue( aRet, pEntry->nMemberId );