[Libreoffice-commits] core.git: sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Sep 20 08:02:19 UTC 2021
sw/source/core/unocore/unosect.cxx | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
New commits:
commit 5b3bf3306797271c90df5a4a00463d327a65e96b
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Sep 19 20:59:59 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Sep 20 10:01:42 2021 +0200
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 at collabora.co.uk>
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
More information about the Libreoffice-commits
mailing list