diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-30 15:10:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-30 18:03:06 +0200 |
commit | 738f7a8cb971a884f74766da0cbf7e59ef8b90e7 (patch) | |
tree | 79775212880433f4e7e860bf0efef57baf9f24c8 /editeng | |
parent | cf15c4dad74e31a035c0d1ca899dfbef4da90ad2 (diff) |
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@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/numitem.cxx | 12 | ||||
-rw-r--r-- | editeng/source/outliner/outlvw.cxx | 4 |
2 files changed, 14 insertions, 2 deletions
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); |