summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-09-22 21:04:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-24 08:38:54 +0200
commitd21a1d999f8872f22a96ad7d1dc2f0e3b48421b5 (patch)
tree74fcd059bdb3356253075b4b31cacdcc613951c0 /sw
parent2be1605cdab5e3662ea0180fb607f3968cc8716c (diff)
no need to allocate this OUString on the heap
Change-Id: Iea9afe291e9dbf964bf1577818ce1a44058eb943 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122538 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/ndtxt.hxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx10
2 files changed, 6 insertions, 6 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index ad6a3c4ac27e..6b64fdef8b19 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -117,7 +117,7 @@ class SW_DLLPUBLIC SwTextNode final
Needed to avoid duplicate handling of attribute change actions. */
bool mbInSetOrResetAttr;
- std::unique_ptr< OUString > m_pNumStringCache;
+ std::optional< OUString > m_oNumStringCache;
css::uno::WeakReference<css::text::XTextContent> m_wXParagraph;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 190b39a5a7fa..05548bb3e69b 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1971,9 +1971,9 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
if (pDest->GetDoc().IsClipBoard() && GetNum())
{
// #i111677# cache expansion of source (for clipboard)
- pDest->m_pNumStringCache.reset( (nTextStartIdx != 0)
- ? new OUString // fdo#49076: numbering only if copy from para start
- : new OUString(GetNumString()));
+ pDest->m_oNumStringCache = (nTextStartIdx != 0)
+ ? OUString() // fdo#49076: numbering only if copy from para start
+ : GetNumString();
}
if( !nLen )
@@ -3086,10 +3086,10 @@ OUString SwTextNode::GetNumString( const bool _bInclPrefixAndSuffixStrings,
const unsigned int _nRestrictToThisLevel,
SwRootFrame const*const pLayout) const
{
- if (GetDoc().IsClipBoard() && m_pNumStringCache)
+ if (GetDoc().IsClipBoard() && m_oNumStringCache)
{
// #i111677# do not expand number strings in clipboard documents
- return *m_pNumStringCache;
+ return *m_oNumStringCache;
}
const SwNumRule* pRule = GetNum(pLayout) ? GetNum(pLayout)->GetNumRule() : nullptr;
if ( pRule &&