diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-09-19 20:59:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-20 10:01:42 +0200 |
commit | 5b3bf3306797271c90df5a4a00463d327a65e96b (patch) | |
tree | 29252f85f161beb877c2e1adb0b8ce1c937b0510 /sw | |
parent | dfb0c861e0d277f93482c58e607112b5e3baf5f5 (diff) |
no need to allocate these SfxItemSet on the heap
Change-Id: I5a80d85225d1e5ba98a52885a79bed5bb873243d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122330
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unosect.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index a93a90b7e097..52853bf6448d 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -531,7 +531,7 @@ lcl_UpdateLinkType(SwSection & rSection, bool const bLinkUpdateAlways) static void lcl_UpdateSection(SwSectionFormat *const pFormat, std::unique_ptr<SwSectionData> const& pSectionData, - std::unique_ptr<SfxItemSet> const& pItemSet, + std::optional<SfxItemSet> const& oItemSet, bool const bLinkModeChanged, bool const bLinkUpdateAlways = true) { if (!pFormat) @@ -546,7 +546,7 @@ lcl_UpdateSection(SwSectionFormat *const pFormat, if (rFormats[i]->GetSection()->GetSectionName() == rSection.GetSectionName()) { - pDoc->UpdateSection(i, *pSectionData, pItemSet.get(), + pDoc->UpdateSection(i, *pSectionData, oItemSet ? &*oItemSet : nullptr, pDoc->IsInReading()); { // temporarily remove actions to allow cursor update @@ -583,7 +583,7 @@ void SwXTextSection::Impl::SetPropertyValues_Impl( OUString const*const pPropertyNames = rPropertyNames.getConstArray(); uno::Any const*const pValues = rValues.getConstArray(); - std::unique_ptr<SfxItemSet> pItemSet; + std::optional<SfxItemSet> oItemSet; bool bLinkModeChanged = false; bool bLinkMode = false; @@ -829,10 +829,10 @@ void SwXTextSection::Impl::SetPropertyValues_Impl( if (pFormat) { const SfxItemSet& rOldAttrSet = pFormat->GetAttrSet(); - pItemSet.reset( new SfxItemSet(*rOldAttrSet.GetPool(), pEntry->nWID, pEntry->nWID)); - pItemSet->Put(rOldAttrSet); + oItemSet.emplace(*rOldAttrSet.GetPool(), pEntry->nWID, pEntry->nWID); + oItemSet->Put(rOldAttrSet); m_rPropSet.setPropertyValue(*pEntry, - pValues[nProperty], *pItemSet); + pValues[nProperty], *oItemSet); } else { @@ -918,7 +918,7 @@ void SwXTextSection::Impl::SetPropertyValues_Impl( } } - lcl_UpdateSection(pFormat, pSectionData, pItemSet, bLinkModeChanged, + lcl_UpdateSection(pFormat, pSectionData, oItemSet, bLinkModeChanged, bLinkMode); } @@ -1469,7 +1469,7 @@ SwXTextSection::setPropertyToDefault(const OUString& rPropertyName) std::unique_ptr<SwSectionData> const pSectionData( pFormat ? new SwSectionData(*pFormat->GetSection()) : nullptr); - std::unique_ptr<SfxItemSet> pNewAttrSet; + std::optional<SfxItemSet> oNewAttrSet; bool bLinkModeChanged = false; switch (pEntry->nWID) @@ -1561,8 +1561,8 @@ SwXTextSection::setPropertyToDefault(const OUString& rPropertyName) if (pFormat) { const SfxItemSet& rOldAttrSet = pFormat->GetAttrSet(); - pNewAttrSet.reset( new SfxItemSet(*rOldAttrSet.GetPool(), pEntry->nWID, pEntry->nWID)); - pNewAttrSet->ClearItem(pEntry->nWID); + oNewAttrSet.emplace(*rOldAttrSet.GetPool(), pEntry->nWID, pEntry->nWID); + oNewAttrSet->ClearItem(pEntry->nWID); } else { @@ -1579,7 +1579,7 @@ SwXTextSection::setPropertyToDefault(const OUString& rPropertyName) } } - lcl_UpdateSection(pFormat, pSectionData, pNewAttrSet, bLinkModeChanged); + lcl_UpdateSection(pFormat, pSectionData, oNewAttrSet, bLinkModeChanged); } uno::Any SAL_CALL |