[Libreoffice-commits] core.git: editeng/source filter/source include/editeng sd/source sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 30 16:03:44 UTC 2021
editeng/source/items/numitem.cxx | 12 ++++++++++++
editeng/source/outliner/outlvw.cxx | 4 ++--
filter/source/msfilter/svdfppt.cxx | 2 +-
include/editeng/numitem.hxx | 2 ++
sd/source/core/drawdoc4.cxx | 2 +-
sd/source/core/stlpool.cxx | 6 +++---
sd/source/ui/dlg/dlgolbul.cxx | 2 +-
sd/source/ui/func/fuolbull.cxx | 2 +-
sd/source/ui/view/drtxtob1.cxx | 2 +-
sd/source/ui/view/drviews2.cxx | 2 +-
sd/source/ui/view/viewshel.cxx | 2 +-
sw/source/uibase/app/docstyle.cxx | 2 +-
sw/source/uibase/shells/txtnum.cxx | 2 +-
13 files changed, 28 insertions(+), 14 deletions(-)
New commits:
commit 738f7a8cb971a884f74766da0cbf7e59ef8b90e7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jun 30 15:10:44 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jun 30 18:03:06 2021 +0200
reduce cost of allocating and copying SvxNumRule
by using std::move to avoid copying unnecessarily
Change-Id: I940b57c9a05c8d75b9a16291fc4f05756fdeea12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118164
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 54bec9d892ea..41ee6e4cf952 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -1013,12 +1013,24 @@ SvxNumBulletItem::SvxNumBulletItem(SvxNumRule const & rRule) :
{
}
+SvxNumBulletItem::SvxNumBulletItem(SvxNumRule && rRule) :
+ SfxPoolItem(SID_ATTR_NUMBERING_RULE),
+ maNumRule(std::move(rRule))
+{
+}
+
SvxNumBulletItem::SvxNumBulletItem(SvxNumRule const & rRule, sal_uInt16 _nWhich ) :
SfxPoolItem(_nWhich),
maNumRule(rRule)
{
}
+SvxNumBulletItem::SvxNumBulletItem(SvxNumRule && rRule, sal_uInt16 _nWhich ) :
+ SfxPoolItem(_nWhich),
+ maNumRule(std::move(rRule))
+{
+}
+
SvxNumBulletItem::SvxNumBulletItem(const SvxNumBulletItem& rCopy) :
SfxPoolItem(rCopy),
maNumRule(rCopy.maNumRule)
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index aabe51c9efd8..6cd2f6d7515e 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -878,7 +878,7 @@ void OutlinerView::ToggleBullets()
{
SfxItemSet aAttrs( pOwner->GetParaAttribs( nPara ) );
SvxNumRule aNewNumRule( *pDefaultBulletNumRule );
- aAttrs.Put( SvxNumBulletItem( aNewNumRule, EE_PARA_NUMBULLET ) );
+ aAttrs.Put( SvxNumBulletItem( std::move(aNewNumRule), EE_PARA_NUMBULLET ) );
pOwner->SetParaAttribs( nPara, aAttrs );
}
}
@@ -1050,7 +1050,7 @@ void OutlinerView::ApplyBulletsNumbering(
}
}
- aAttrs.Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET));
+ aAttrs.Put(SvxNumBulletItem(std::move(aNewRule), EE_PARA_NUMBULLET));
}
}
pOwner->SetParaAttribs(nPara, aAttrs);
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 1b5a30110a94..f7ef3675a03d 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -4411,7 +4411,7 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd
aRule.SetLevel( nDepth, aNumberFormat );
}
}
- mpNumBulletItem[ i ] = std::make_unique<SvxNumBulletItem>( aRule, EE_PARA_NUMBULLET );
+ mpNumBulletItem[ i ] = std::make_unique<SvxNumBulletItem>( std::move(aRule), EE_PARA_NUMBULLET );
}
}
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 2e2e660267e8..bbcbecdf4c79 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -308,7 +308,9 @@ class EDITENG_DLLPUBLIC SvxNumBulletItem final : public SfxPoolItem
SvxNumRule maNumRule;
public:
explicit SvxNumBulletItem(SvxNumRule const & rRule);
+ explicit SvxNumBulletItem(SvxNumRule && rRule);
SvxNumBulletItem(SvxNumRule const & rRule, sal_uInt16 nWhich );
+ SvxNumBulletItem(SvxNumRule && rRule, sal_uInt16 nWhich );
SvxNumBulletItem(const SvxNumBulletItem& rCopy);
virtual ~SvxNumBulletItem() override;
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index e3d7080f953b..e078afc58b54 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -1268,7 +1268,7 @@ void SdDrawDocument::SetTextDefaults() const
aNumRule.SetLevel( i, aNumberFormat );
}
- SvxNumBulletItem aNumBulletItem( aNumRule, EE_PARA_NUMBULLET );
+ SvxNumBulletItem aNumBulletItem( std::move(aNumRule), EE_PARA_NUMBULLET );
m_pItemPool->SetPoolDefaultItem( aNumBulletItem );
}
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index d6256bd6f9ae..d15aaf632b04 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -1095,7 +1095,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
aNumRule.SetLevel( i, aNumberFormat );
}
- rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
+ rSet.Put( SvxNumBulletItem( std::move(aNumRule), EE_PARA_NUMBULLET ) );
static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxHint( SfxHintId::DataChanged ) );
}
break;
@@ -1127,7 +1127,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
aNumRule.SetLevel(i, aFrmt);
}
- rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
+ rSet.Put( SvxNumBulletItem( std::move(aNumRule), EE_PARA_NUMBULLET ) );
static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxHint( SfxHintId::DataChanged ) );
}
}
@@ -1151,7 +1151,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
aNumRule.SetLevel( i, aNumberFormat );
}
- rSet.Put( SvxNumBulletItem( aNumRule, EE_PARA_NUMBULLET ) );
+ rSet.Put( SvxNumBulletItem( std::move(aNumRule), EE_PARA_NUMBULLET ) );
static_cast<SfxStyleSheet*>(pSheet)->Broadcast(SfxHint( SfxHintId::DataChanged ) );
}
break;
diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx
index e82768d7dfa4..c30b31ad3ba7 100644
--- a/sd/source/ui/dlg/dlgolbul.cxx
+++ b/sd/source/ui/dlg/dlgolbul.cxx
@@ -108,7 +108,7 @@ OutlineBulletDlg::OutlineBulletDlg(weld::Window* pParent, const SfxItemSet* pAtt
SvxNumRule aNewRule( rRule );
aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS );
- SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
+ SvxNumBulletItem aNewItem( std::move(aNewRule), EE_PARA_NUMBULLET );
m_aInputSet.Put(aNewItem);
}
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index 13db35c73079..5d1cf1dec398 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -327,7 +327,7 @@ const SfxPoolItem* FuBulletAndPosition::GetNumBulletItem(SfxItemSet& aNewAttr, s
SvxNumRule aNewRule( rLclRule );
aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS );
- SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
+ SvxNumBulletItem aNewItem( std::move(aNewRule), EE_PARA_NUMBULLET );
aNewAttr.Put(aNewItem);
}
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index 09f37d6a2872..8c636345fc5b 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -488,7 +488,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
aNewRule.SetLevel(nLevel, aFmt);
}
- pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET));
+ pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(std::move(aNewRule), EE_PARA_NUMBULLET));
SdStyleSheet::BroadcastSdStyleSheetChange(pFirstStyleSheet, PresentationObjects::Outline_1, pSSPool);
}
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 5a68e30abab9..dae22d8dfde8 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -446,7 +446,7 @@ private:
aItemSet.Put(SvxWeightItem(WEIGHT_NORMAL, EE_CHAR_WEIGHT));
SvxNumRule aDefaultNumRule(SvxNumRuleFlags::NONE, 0, false);
- aItemSet.Put(SvxNumBulletItem(aDefaultNumRule, EE_PARA_NUMBULLET));
+ aItemSet.Put(SvxNumBulletItem(std::move(aDefaultNumRule), EE_PARA_NUMBULLET));
pOutliner->SetParaAttribs(nParagraph, aItemSet);
}
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 7f481d9677bc..ac7a5d3489ac 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -857,7 +857,7 @@ const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16&
SvxNumRule aNewRule( rRule );
aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS );
- SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
+ SvxNumBulletItem aNewItem( std::move(aNewRule), EE_PARA_NUMBULLET );
aNewAttr.Put(aNewItem);
}
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 2a0427e0f30f..b10570b348a2 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -1357,7 +1357,7 @@ SfxItemSet& SwDocStyleSheet::GetItemSet()
{
OSL_ENSURE(m_pNumRule, "No NumRule");
SvxNumRule aRule = m_pNumRule->MakeSvxNumRule();
- m_aCoreSet.Put(SvxNumBulletItem(aRule));
+ m_aCoreSet.Put(SvxNumBulletItem(std::move(aRule)));
}
break;
diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx
index e1890bbd6f34..6f2885397325 100644
--- a/sw/source/uibase/shells/txtnum.cxx
+++ b/sw/source/uibase/shells/txtnum.cxx
@@ -183,7 +183,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
}
aSvxRule.SetFeatureFlag(SvxNumRuleFlags::ENABLE_EMBEDDED_BMP, false);
}
- aSet.Put( SvxNumBulletItem( aSvxRule ) );
+ aSet.Put( SvxNumBulletItem( std::move(aSvxRule) ) );
}
aSet.Put( SfxBoolItem( SID_PARAM_NUM_PRESET,false ));
More information about the Libreoffice-commits
mailing list