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>
This commit is contained in:
Noel Grandin
2021-09-28 18:25:33 +02:00
committed by Noel Grandin
parent b62153753a
commit 2d45cef3cd
3 changed files with 14 additions and 14 deletions
+10 -10
View File
@@ -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;
}
}
+1 -1
View File
@@ -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;
+3 -3
View File
@@ -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