[Libreoffice-commits] core.git: sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 24 06:39:45 UTC 2021
sw/source/core/txtnode/thints.cxx | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
New commits:
commit 044fa30a4c77013c87a7e2a6dd9022a2f6599778
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Sep 23 18:44:42 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 24 08:39:10 2021 +0200
no need to allocate this SfxItemSet on the heap
Change-Id: I973d6ef5d3ddcb1b3cd0506c59ee63411e80a4ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122539
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 995d82606dab..2464bc9d6860 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -912,7 +912,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
// #i81764# This should not be applied for no length attributes!!! <--
if ( !bNoLengthAttribute && rNode.HasSwAttrSet() && pNewStyle->Count() )
{
- std::unique_ptr<SfxItemSet> pNewSet;
+ std::optional<SfxItemSet> oNewSet;
SfxItemIter aIter2( *pNewStyle );
const SfxPoolItem* pItem = aIter2.GetCurItem();
@@ -927,19 +927,19 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
// Do not clear item if the attribute is set in a character format:
if ( !pCurrentCharFormat || nullptr == CharFormat::GetItem( *pCurrentCharFormat, pItem->Which() ) )
{
- if ( !pNewSet )
- pNewSet = pNewStyle->Clone();
- pNewSet->ClearItem( pItem->Which() );
+ if ( !oNewSet )
+ oNewSet.emplace(pNewStyle->CloneAsValue());
+ oNewSet->ClearItem( pItem->Which() );
}
}
}
while ((pItem = aIter2.NextItem()));
- if ( pNewSet )
+ if ( oNewSet )
{
bOptimizeAllowed = false;
- if ( pNewSet->Count() )
- pNewStyle = rNode.getIDocumentStyleAccess().getAutomaticStyle( *pNewSet, IStyleAccess::AUTO_STYLE_CHAR );
+ if ( oNewSet->Count() )
+ pNewStyle = rNode.getIDocumentStyleAccess().getAutomaticStyle( *oNewSet, IStyleAccess::AUTO_STYLE_CHAR );
else
pNewStyle.reset();
}
@@ -1038,9 +1038,9 @@ SwTextAttr* MakeTextAttr(
// If the attribute is an auto-style which refers to a pool that is
// different from rDoc's pool, we have to correct this:
const std::shared_ptr<SfxItemSet> pAutoStyle = static_cast<const SwFormatAutoFormat&>(rAttr).GetStyleHandle();
- std::unique_ptr<const SfxItemSet> pNewSet(
- pAutoStyle->SfxItemSet::Clone( true, &rDoc.GetAttrPool() ));
- SwTextAttr* pNew = MakeTextAttr( rDoc, *pNewSet, nStt, nEnd );
+ SfxItemSet aNewSet =
+ pAutoStyle->SfxItemSet::CloneAsValue( true, &rDoc.GetAttrPool() );
+ SwTextAttr* pNew = MakeTextAttr( rDoc, aNewSet, nStt, nEnd );
return pNew;
}
More information about the Libreoffice-commits
mailing list