diff options
author | Noel Grandin <noel@peralex.com> | 2021-09-28 14:55:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-28 18:25:33 +0200 |
commit | 2d45cef3cd18c9d0198b9d302016a7598ce0484c (patch) | |
tree | 7127bc4b4ac55986cc70cf805633533c999e579b /sw | |
parent | b62153753a9f21afb2a49110ef0459e427b0b01a (diff) |
no need to allocate SvxTabStopItem separately in SwLineInfo
Change-Id: Ia2cbf997427a2450a576436d7c0159b7bbe34578
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122774
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/text/inftxt.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/text/inftxt.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/txttab.cxx | 6 |
3 files changed, 14 insertions, 14 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 26e7246a2a98..e3546c66db1a 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -99,7 +99,7 @@ SwLineInfo::~SwLineInfo() void SwLineInfo::CtorInitLineInfo( const SwAttrSet& rAttrSet, const SwTextNode& rTextNode ) { - m_pRuler.reset( new SvxTabStopItem( rAttrSet.GetTabStops() ) ); + m_oRuler.emplace( rAttrSet.GetTabStops() ); if ( rTextNode.GetListTabStopPosition( m_nListTabStopPosition ) ) { m_bListTabStopIncluded = true; @@ -107,15 +107,15 @@ void SwLineInfo::CtorInitLineInfo( const SwAttrSet& rAttrSet, // insert the list tab stop into SvxTabItem instance <pRuler> const SvxTabStop aListTabStop( m_nListTabStopPosition, SvxTabAdjust::Left ); - m_pRuler->Insert( aListTabStop ); + m_oRuler->Insert( aListTabStop ); // remove default tab stops, which are before the inserted list tab stop - for ( sal_uInt16 i = 0; i < m_pRuler->Count(); i++ ) + for ( sal_uInt16 i = 0; i < m_oRuler->Count(); i++ ) { - if ( (*m_pRuler)[i].GetTabPos() < m_nListTabStopPosition && - (*m_pRuler)[i].GetAdjustment() == SvxTabAdjust::Default ) + if ( (*m_oRuler)[i].GetTabPos() < m_nListTabStopPosition && + (*m_oRuler)[i].GetAdjustment() == SvxTabAdjust::Default ) { - m_pRuler->Remove(i); + m_oRuler->Remove(i); continue; } } @@ -124,12 +124,12 @@ void SwLineInfo::CtorInitLineInfo( const SwAttrSet& rAttrSet, if ( !rTextNode.getIDocumentSettingAccess()->get(DocumentSettingId::TABS_RELATIVE_TO_INDENT) ) { // remove default tab stop at position 0 - for ( sal_uInt16 i = 0; i < m_pRuler->Count(); i++ ) + for ( sal_uInt16 i = 0; i < m_oRuler->Count(); i++ ) { - if ( (*m_pRuler)[i].GetTabPos() == 0 && - (*m_pRuler)[i].GetAdjustment() == SvxTabAdjust::Default ) + if ( (*m_oRuler)[i].GetTabPos() == 0 && + (*m_oRuler)[i].GetAdjustment() == SvxTabAdjust::Default ) { - m_pRuler->Remove(i); + m_oRuler->Remove(i); break; } } diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index 91fbf0c3aa7c..9ee658364355 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -61,7 +61,7 @@ class SwLineInfo { friend class SwTextIter; - std::unique_ptr<SvxTabStopItem> m_pRuler; + std::optional<SvxTabStopItem> m_oRuler; const SvxLineSpacingItem *m_pSpace; SvxParaVertAlignItem::Align m_nVertAlign; sal_uInt16 m_nDefTabStop; diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index f4690a9aa496..fec16e962f0a 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -42,9 +42,9 @@ */ const SvxTabStop* SwLineInfo::GetTabStop(const SwTwips nSearchPos, SwTwips& nRight) const { - for( sal_uInt16 i = 0; i < m_pRuler->Count(); ++i ) + for( sal_uInt16 i = 0; i < m_oRuler->Count(); ++i ) { - const SvxTabStop &rTabStop = m_pRuler->operator[](i); + const SvxTabStop &rTabStop = m_oRuler->operator[](i); if (nRight && rTabStop.GetTabPos() > nRight) { // Consider the first tabstop to always be in-bounds. @@ -64,7 +64,7 @@ const SvxTabStop* SwLineInfo::GetTabStop(const SwTwips nSearchPos, SwTwips& nRig sal_uInt16 SwLineInfo::NumberOfTabStops() const { - return m_pRuler->Count(); + return m_oRuler->Count(); } SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto ) const |