summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-07-21 11:07:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-21 14:07:48 +0200
commit49e559625dfb38bef82853c588eea88ab4f09a60 (patch)
tree3943dd4fbfcadc140b67de5715f083ddff716427 /sw
parent9659860c56164a3dade94714eabfdafdb90fd1c5 (diff)
allocate SwFormatVertOrient inline in SwNumFormat
which reduces allocation overhead when loading some documents Change-Id: I587752f9a59754e4cbb41963665d8be476f2d8c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137291 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/numrule.hxx4
-rw-r--r--sw/source/core/doc/number.cxx12
2 files changed, 8 insertions, 8 deletions
diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index 5003ab22e928..20e498961bda 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -32,6 +32,7 @@
#include <memory>
#include <vector>
#include "charfmt.hxx"
+#include "fmtornt.hxx"
class SwTextFormatColl;
class IDocumentListsAccess;
@@ -40,7 +41,6 @@ namespace vcl { class Font; }
class SvxBrushItem;
class SfxGrabBagItem;
class SwDoc;
-class SwFormatVertOrient;
class SwTextNode;
class Size;
class SwWrtShell;
@@ -49,7 +49,7 @@ const sal_Unicode cBulletChar = 0x2022; ///< Character for lists.
class SW_DLLPUBLIC SwNumFormat final : public SvxNumberFormat, public SwClient
{
- std::unique_ptr<SwFormatVertOrient> m_pVertOrient;
+ SwFormatVertOrient m_aVertOrient;
//For i120928,record the cp info of graphic within bullet
sal_Unicode m_cGrfBulletCP;
SAL_DLLPRIVATE void UpdateNumNodes(SwDoc& rDoc);
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 4e353a2b2803..91693cbd728d 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -186,7 +186,7 @@ static void lcl_SetRuleChgd( SwTextNode& rNd, sal_uInt8 nLevel )
SwNumFormat::SwNumFormat() :
SvxNumberFormat(SVX_NUM_ARABIC),
SwClient( nullptr ),
- m_pVertOrient(new SwFormatVertOrient( 0, text::VertOrientation::NONE))
+ m_aVertOrient( 0, text::VertOrientation::NONE )
,m_cGrfBulletCP(USHRT_MAX)//For i120928,record the cp info of graphic within bullet
{
}
@@ -194,7 +194,7 @@ SwNumFormat::SwNumFormat() :
SwNumFormat::SwNumFormat( const SwNumFormat& rFormat) :
SvxNumberFormat(rFormat),
SwClient( rFormat.GetRegisteredInNonConst() ),
- m_pVertOrient(new SwFormatVertOrient( 0, rFormat.GetVertOrient()))
+ m_aVertOrient( 0, rFormat.GetVertOrient() )
,m_cGrfBulletCP(rFormat.m_cGrfBulletCP)//For i120928,record the cp info of graphic within bullet
{
sal_Int16 eMyVertOrient = rFormat.GetVertOrient();
@@ -204,7 +204,7 @@ SwNumFormat::SwNumFormat( const SwNumFormat& rFormat) :
SwNumFormat::SwNumFormat(const SvxNumberFormat& rNumFormat, SwDoc* pDoc)
: SvxNumberFormat(rNumFormat)
- , m_pVertOrient(new SwFormatVertOrient( 0, rNumFormat.GetVertOrient()))
+ , m_aVertOrient( 0, rNumFormat.GetVertOrient() )
, m_cGrfBulletCP(USHRT_MAX)
{
sal_Int16 eMyVertOrient = rNumFormat.GetVertOrient();
@@ -319,7 +319,7 @@ void SwNumFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size
const sal_Int16* pOrient)
{
if(pOrient)
- m_pVertOrient->SetVertOrient( *pOrient );
+ m_aVertOrient.SetVertOrient( *pOrient );
SvxNumberFormat::SetGraphicBrush( pBrushItem, pSize, pOrient);
}
@@ -355,8 +355,8 @@ const SwFormatVertOrient* SwNumFormat::GetGraphicOrientation() const
return nullptr;
else
{
- m_pVertOrient->SetVertOrient(eOrient);
- return m_pVertOrient.get();
+ const_cast<SwFormatVertOrient&>(m_aVertOrient).SetVertOrient(eOrient);
+ return &m_aVertOrient;
}
}