[Libreoffice-commits] core.git: sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 9 08:53:57 UTC 2020


 sw/source/core/inc/UndoCore.hxx  |    2 
 sw/source/core/inc/UndoTable.hxx |   34 +++++-----
 sw/source/core/undo/unoutl.cxx   |    8 +-
 sw/source/core/undo/untbl.cxx    |  126 +++++++++++++++++++--------------------
 4 files changed, 85 insertions(+), 85 deletions(-)

New commits:
commit 889ad68cffd0f721b77e21ee4a8b6f1a7915fce2
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Mar 9 08:50:19 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Mar 9 09:53:21 2020 +0100

    sw: prefix members of SwUndoMergeTable, SwUndoOutlineLeftRight, ...
    
    ... SwUndoSplitTable and SwUndoTableAutoFormat
    
    See tdf#94879 for motivation.
    
    Change-Id: I5e40c9ba391456c95b8ef44aa4cf11ebbd681d80
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90200
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/core/inc/UndoCore.hxx b/sw/source/core/inc/UndoCore.hxx
index c1825d30ab20..7015e3fc1f35 100644
--- a/sw/source/core/inc/UndoCore.hxx
+++ b/sw/source/core/inc/UndoCore.hxx
@@ -211,7 +211,7 @@ public:
 
 class SwUndoOutlineLeftRight : public SwUndo, private SwUndRng
 {
-    short const nOffset;
+    short const m_nOffset;
 
 public:
     SwUndoOutlineLeftRight( const SwPaM& rPam, short nOffset );
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index 76dfe3ce7720..efca52be8f9e 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -142,10 +142,10 @@ class SwUndoTableNumFormat;
 class SwUndoTableAutoFormat : public SwUndo
 {
     OUString m_TableStyleName;
-    sal_uLong nSttNode;
-    std::unique_ptr<SaveTable> pSaveTable;
+    sal_uLong m_nStartNode;
+    std::unique_ptr<SaveTable> m_pSaveTable;
     std::vector< std::shared_ptr<SwUndoTableNumFormat> > m_Undos;
-    bool bSaveContentAttr;
+    bool m_bSaveContentAttr;
     sal_uInt16 const m_nRepeatHeading;
 
     void UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext);
@@ -308,13 +308,13 @@ public:
 
 class SwUndoSplitTable : public SwUndo
 {
-    sal_uLong nTableNode, nOffset;
+    sal_uLong m_nTableNode, m_nOffset;
     std::unique_ptr<SwSaveRowSpan> mpSaveRowSpan; // stores row span values at the splitting row
-    std::unique_ptr<SaveTable> pSavTable;
-    std::unique_ptr<SwHistory> pHistory;
-    SplitTable_HeadlineOption const nMode;
-    sal_uInt16 nFormulaEnd;
-    bool const bCalcNewSize;
+    std::unique_ptr<SaveTable> m_pSavedTable;
+    std::unique_ptr<SwHistory> m_pHistory;
+    SplitTable_HeadlineOption const m_nMode;
+    sal_uInt16 m_nFormulaEnd;
+    bool const m_bCalcNewSize;
 
 public:
     SwUndoSplitTable( const SwTableNode& rTableNd, std::unique_ptr<SwSaveRowSpan> pRowSp,
@@ -326,19 +326,19 @@ public:
     virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
     virtual void RepeatImpl( ::sw::RepeatContext & ) override;
 
-    void SetTableNodeOffset( sal_uLong nIdx )     { nOffset = nIdx - nTableNode; }
-    SwHistory* GetHistory()                 { return pHistory.get(); }
+    void SetTableNodeOffset( sal_uLong nIdx )     { m_nOffset = nIdx - m_nTableNode; }
+    SwHistory* GetHistory()                 { return m_pHistory.get(); }
     void SaveFormula( SwHistory& rHistory );
 };
 
 class SwUndoMergeTable : public SwUndo
 {
-    OUString aName;
-    sal_uLong nTableNode;
-    std::unique_ptr<SaveTable> pSavTable, pSavHdl;
-    std::unique_ptr<SwHistory> pHistory;
-    sal_uInt16 const nMode;
-    bool const bWithPrev;
+    OUString m_aName;
+    sal_uLong m_nTableNode;
+    std::unique_ptr<SaveTable> m_pSaveTable, m_pSaveHdl;
+    std::unique_ptr<SwHistory> m_pHistory;
+    sal_uInt16 const m_nMode;
+    bool const m_bWithPrev;
 
 public:
     SwUndoMergeTable( const SwTableNode& rTableNd, const SwTableNode& rDelTableNd,
diff --git a/sw/source/core/undo/unoutl.cxx b/sw/source/core/undo/unoutl.cxx
index cac6dc937076..04341d61aa71 100644
--- a/sw/source/core/undo/unoutl.cxx
+++ b/sw/source/core/undo/unoutl.cxx
@@ -25,25 +25,25 @@
 
 SwUndoOutlineLeftRight::SwUndoOutlineLeftRight( const SwPaM& rPam,
                                                 short nOff )
-    : SwUndo( SwUndoId::OUTLINE_LR, rPam.GetDoc() ), SwUndRng( rPam ), nOffset( nOff )
+    : SwUndo( SwUndoId::OUTLINE_LR, rPam.GetDoc() ), SwUndRng( rPam ), m_nOffset( nOff )
 {
 }
 
 void SwUndoOutlineLeftRight::UndoImpl(::sw::UndoRedoContext & rContext)
 {
     SwPaM & rPaM( AddUndoRedoPaM(rContext) );
-    rContext.GetDoc().OutlineUpDown(rPaM, -nOffset);
+    rContext.GetDoc().OutlineUpDown(rPaM, -m_nOffset);
 }
 
 void SwUndoOutlineLeftRight::RedoImpl(::sw::UndoRedoContext & rContext)
 {
     SwPaM & rPaM( AddUndoRedoPaM(rContext) );
-    rContext.GetDoc().OutlineUpDown(rPaM,  nOffset);
+    rContext.GetDoc().OutlineUpDown(rPaM,  m_nOffset);
 }
 
 void SwUndoOutlineLeftRight::RepeatImpl(::sw::RepeatContext & rContext)
 {
-    rContext.GetDoc().OutlineUpDown(rContext.GetRepeatPaM(), nOffset);
+    rContext.GetDoc().OutlineUpDown(rContext.GetRepeatPaM(), m_nOffset);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index b841c0420344..de72ebd85457 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1398,18 +1398,18 @@ SwUndoTableAutoFormat::SwUndoTableAutoFormat( const SwTableNode& rTableNd,
                                     const SwTableAutoFormat& rAFormat )
     : SwUndo( SwUndoId::TABLE_AUTOFMT, rTableNd.GetDoc() )
     , m_TableStyleName(rTableNd.GetTable().GetTableStyleName())
-    , nSttNode( rTableNd.GetIndex() )
-    , bSaveContentAttr( false )
+    , m_nStartNode( rTableNd.GetIndex() )
+    , m_bSaveContentAttr( false )
     , m_nRepeatHeading(rTableNd.GetTable().GetRowsToRepeat())
 {
-    pSaveTable.reset( new SaveTable( rTableNd.GetTable() ) );
+    m_pSaveTable.reset( new SaveTable( rTableNd.GetTable() ) );
 
     if( rAFormat.IsFont() || rAFormat.IsJustify() )
     {
         // then also go over the ContentNodes of the EndBoxes and collect
         // all paragraph attributes
-        pSaveTable->SaveContentAttrs( const_cast<SwDoc*>(rTableNd.GetDoc()) );
-        bSaveContentAttr = true;
+        m_pSaveTable->SaveContentAttrs( const_cast<SwDoc*>(rTableNd.GetDoc()) );
+        m_bSaveContentAttr = true;
     }
 }
 
@@ -1426,7 +1426,7 @@ void
 SwUndoTableAutoFormat::UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext)
 {
     SwDoc & rDoc = rContext.GetDoc();
-    SwTableNode* pTableNd = rDoc.GetNodes()[ nSttNode ]->GetTableNode();
+    SwTableNode* pTableNd = rDoc.GetNodes()[ m_nStartNode ]->GetTableNode();
     OSL_ENSURE( pTableNd, "no TableNode" );
 
     SwTable& table = pTableNd->GetTable();
@@ -1439,7 +1439,7 @@ SwUndoTableAutoFormat::UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rConte
     SaveTable* pOrig = new SaveTable( table );
     // then go also over the ContentNodes of the EndBoxes and collect
     // all paragraph attributes
-    if( bSaveContentAttr )
+    if( m_bSaveContentAttr )
         pOrig->SaveContentAttrs( &rDoc );
 
     if (bUndo)
@@ -1452,8 +1452,8 @@ SwUndoTableAutoFormat::UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rConte
         table.SetRowsToRepeat(m_nRepeatHeading);
     }
 
-    pSaveTable->RestoreAttr( pTableNd->GetTable(), !bUndo );
-    pSaveTable.reset( pOrig );
+    m_pSaveTable->RestoreAttr( pTableNd->GetTable(), !bUndo );
+    m_pSaveTable.reset( pOrig );
 }
 
 void SwUndoTableAutoFormat::UndoImpl(::sw::UndoRedoContext & rContext)
@@ -2772,17 +2772,17 @@ void SwUndoCpyTable::RedoImpl(::sw::UndoRedoContext & rContext)
 SwUndoSplitTable::SwUndoSplitTable( const SwTableNode& rTableNd,
     std::unique_ptr<SwSaveRowSpan> pRowSp, SplitTable_HeadlineOption eMode, bool bNewSize )
     : SwUndo( SwUndoId::SPLIT_TABLE, rTableNd.GetDoc() ),
-    nTableNode( rTableNd.GetIndex() ), nOffset( 0 ), mpSaveRowSpan( std::move(pRowSp) ),
-    nMode( eMode ), nFormulaEnd( 0 ), bCalcNewSize( bNewSize )
+    m_nTableNode( rTableNd.GetIndex() ), m_nOffset( 0 ), mpSaveRowSpan( std::move(pRowSp) ),
+    m_nMode( eMode ), m_nFormulaEnd( 0 ), m_bCalcNewSize( bNewSize )
 {
-    switch( nMode )
+    switch( m_nMode )
     {
     case SplitTable_HeadlineOption::BoxAttrAllCopy:
-            pHistory.reset(new SwHistory);
+            m_pHistory.reset(new SwHistory);
             [[fallthrough]];
     case SplitTable_HeadlineOption::BorderCopy:
     case SplitTable_HeadlineOption::BoxAttrCopy:
-        pSavTable.reset(new SaveTable( rTableNd.GetTable(), 1, false ));
+        m_pSavedTable.reset(new SaveTable( rTableNd.GetTable(), 1, false ));
         break;
     default: break;
     }
@@ -2790,8 +2790,8 @@ SwUndoSplitTable::SwUndoSplitTable( const SwTableNode& rTableNd,
 
 SwUndoSplitTable::~SwUndoSplitTable()
 {
-    pSavTable.reset();
-    pHistory.reset();
+    m_pSavedTable.reset();
+    m_pHistory.reset();
     mpSaveRowSpan.reset();
 }
 
@@ -2801,13 +2801,13 @@ void SwUndoSplitTable::UndoImpl(::sw::UndoRedoContext & rContext)
     SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
 
     SwNodeIndex& rIdx = pPam->GetPoint()->nNode;
-    rIdx = nTableNode + nOffset;
+    rIdx = m_nTableNode + m_nOffset;
     pPam->GetPoint()->nContent.Assign(rIdx.GetNode().GetContentNode(), 0);
     assert(rIdx.GetNode().GetContentNode()->Len() == 0); // empty para inserted
 
     {
         // avoid asserts from ~SwIndexReg
-        SwNodeIndex const idx(pDoc->GetNodes(), nTableNode + nOffset);
+        SwNodeIndex const idx(pDoc->GetNodes(), m_nTableNode + m_nOffset);
         {
             SwPaM pam(idx);
             pam.Move(fnMoveBackward, GoInContent);
@@ -2818,7 +2818,7 @@ void SwUndoSplitTable::UndoImpl(::sw::UndoRedoContext & rContext)
         pDoc->GetNodes().Delete( idx );
     }
 
-    rIdx = nTableNode + nOffset;
+    rIdx = m_nTableNode + m_nOffset;
     SwTableNode* pTableNd = rIdx.GetNode().GetTableNode();
     SwTable& rTable = pTableNd->GetTable();
 
@@ -2826,17 +2826,17 @@ void SwUndoSplitTable::UndoImpl(::sw::UndoRedoContext & rContext)
     aMsgHint.m_eFlags = TBL_BOXPTR;
     pDoc->getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
 
-    switch( nMode )
+    switch( m_nMode )
     {
     case SplitTable_HeadlineOption::BoxAttrAllCopy:
-        if( pHistory )
-            pHistory->TmpRollback( pDoc, nFormulaEnd );
+        if( m_pHistory )
+            m_pHistory->TmpRollback( pDoc, m_nFormulaEnd );
         [[fallthrough]];
     case SplitTable_HeadlineOption::BoxAttrCopy:
     case SplitTable_HeadlineOption::BorderCopy:
         {
-            pSavTable->CreateNew( rTable, false );
-            pSavTable->RestoreAttr( rTable );
+            m_pSavedTable->CreateNew( rTable, false );
+            m_pSavedTable->RestoreAttr( rTable );
         }
         break;
 
@@ -2844,7 +2844,7 @@ void SwUndoSplitTable::UndoImpl(::sw::UndoRedoContext & rContext)
         // the created first line has to be removed again
         {
             SwSelBoxes aSelBoxes;
-            SwTableBox* pBox = rTable.GetTableBox( nTableNode + nOffset + 1 );
+            SwTableBox* pBox = rTable.GetTableBox( m_nTableNode + m_nOffset + 1 );
             SwTable::SelLineFromBox( pBox, aSelBoxes );
             FndBox_ aTmpBox( nullptr, nullptr );
             aTmpBox.SetTableLines( aSelBoxes, rTable );
@@ -2857,10 +2857,10 @@ void SwUndoSplitTable::UndoImpl(::sw::UndoRedoContext & rContext)
 
     pDoc->GetNodes().MergeTable( rIdx );
 
-    if( pHistory )
+    if( m_pHistory )
     {
-        pHistory->TmpRollback( pDoc, 0 );
-        pHistory->SetTmpEnd( pHistory->Count() );
+        m_pHistory->TmpRollback( pDoc, 0 );
+        m_pHistory->SetTmpEnd( m_pHistory->Count() );
     }
     if( mpSaveRowSpan )
     {
@@ -2877,8 +2877,8 @@ void SwUndoSplitTable::RedoImpl(::sw::UndoRedoContext & rContext)
     SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
 
     pPam->DeleteMark();
-    pPam->GetPoint()->nNode = nTableNode;
-    pDoc->SplitTable( *pPam->GetPoint(), nMode, bCalcNewSize );
+    pPam->GetPoint()->nNode = m_nTableNode;
+    pDoc->SplitTable( *pPam->GetPoint(), m_nMode, m_bCalcNewSize );
 
     ClearFEShellTabCols(*pDoc, nullptr);
 }
@@ -2888,43 +2888,43 @@ void SwUndoSplitTable::RepeatImpl(::sw::RepeatContext & rContext)
     SwPaM *const pPam = & rContext.GetRepeatPaM();
     SwDoc *const pDoc = & rContext.GetDoc();
 
-    pDoc->SplitTable( *pPam->GetPoint(), nMode, bCalcNewSize );
+    pDoc->SplitTable( *pPam->GetPoint(), m_nMode, m_bCalcNewSize );
     ClearFEShellTabCols(*pDoc, nullptr);
 }
 
 void SwUndoSplitTable::SaveFormula( SwHistory& rHistory )
 {
-    if( !pHistory )
-        pHistory.reset(new SwHistory);
+    if( !m_pHistory )
+        m_pHistory.reset(new SwHistory);
 
-    nFormulaEnd = rHistory.Count();
-    pHistory->Move( 0, &rHistory );
+    m_nFormulaEnd = rHistory.Count();
+    m_pHistory->Move( 0, &rHistory );
 }
 
 SwUndoMergeTable::SwUndoMergeTable( const SwTableNode& rTableNd,
                                 const SwTableNode& rDelTableNd,
                                 bool bWithPrv, sal_uInt16 nMd )
     : SwUndo( SwUndoId::MERGE_TABLE, rTableNd.GetDoc() ),
-    nMode( nMd ), bWithPrev( bWithPrv )
+    m_nMode( nMd ), m_bWithPrev( bWithPrv )
 {
     // memorize end node of the last table cell that'll stay in position
-    if( bWithPrev )
-        nTableNode = rDelTableNd.EndOfSectionIndex() - 1;
+    if( m_bWithPrev )
+        m_nTableNode = rDelTableNd.EndOfSectionIndex() - 1;
     else
-        nTableNode = rTableNd.EndOfSectionIndex() - 1;
+        m_nTableNode = rTableNd.EndOfSectionIndex() - 1;
 
-    aName = rDelTableNd.GetTable().GetFrameFormat()->GetName();
-    pSavTable.reset(new SaveTable( rDelTableNd.GetTable() ));
+    m_aName = rDelTableNd.GetTable().GetFrameFormat()->GetName();
+    m_pSaveTable.reset(new SaveTable( rDelTableNd.GetTable() ));
 
-    if (bWithPrev)
-        pSavHdl.reset( new SaveTable( rTableNd.GetTable(), 1 ) );
+    if (m_bWithPrev)
+        m_pSaveHdl.reset( new SaveTable( rTableNd.GetTable(), 1 ) );
 }
 
 SwUndoMergeTable::~SwUndoMergeTable()
 {
-    pSavTable.reset();
-    pSavHdl.reset();
-    pHistory.reset();
+    m_pSaveTable.reset();
+    m_pSaveHdl.reset();
+    m_pHistory.reset();
 }
 
 void SwUndoMergeTable::UndoImpl(::sw::UndoRedoContext & rContext)
@@ -2934,7 +2934,7 @@ void SwUndoMergeTable::UndoImpl(::sw::UndoRedoContext & rContext)
 
     pPam->DeleteMark();
     SwNodeIndex& rIdx = pPam->GetPoint()->nNode;
-    rIdx = nTableNode;
+    rIdx = m_nTableNode;
 
     SwTableNode* pTableNd = rIdx.GetNode().FindTableNode();
     SwTable* pTable = &pTableNd->GetTable();
@@ -2955,22 +2955,22 @@ void SwUndoMergeTable::UndoImpl(::sw::UndoRedoContext & rContext)
     aFndBox.MakeFrames( *pTable );
     // ? TL_CHART2: notification or locking of controller required ?
 
-    if( bWithPrev )
+    if( m_bWithPrev )
     {
         // move name
         pNew->GetTable().GetFrameFormat()->SetName( pTable->GetFrameFormat()->GetName() );
-        pSavHdl->RestoreAttr( pNew->GetTable() );
+        m_pSaveHdl->RestoreAttr( pNew->GetTable() );
     }
     else
         pTable = &pNew->GetTable();
 
-    pTable->GetFrameFormat()->SetName( aName );
-    pSavTable->RestoreAttr( *pTable );
+    pTable->GetFrameFormat()->SetName( m_aName );
+    m_pSaveTable->RestoreAttr( *pTable );
 
-    if( pHistory )
+    if( m_pHistory )
     {
-        pHistory->TmpRollback( pDoc, 0 );
-        pHistory->SetTmpEnd( pHistory->Count() );
+        m_pHistory->TmpRollback( pDoc, 0 );
+        m_pHistory->SetTmpEnd( m_pHistory->Count() );
     }
 
     // create frames for the new table
@@ -2998,13 +2998,13 @@ void SwUndoMergeTable::RedoImpl(::sw::UndoRedoContext & rContext)
     SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
 
     pPam->DeleteMark();
-    pPam->GetPoint()->nNode = nTableNode;
-    if( bWithPrev )
-        pPam->GetPoint()->nNode = nTableNode + 3;
+    pPam->GetPoint()->nNode = m_nTableNode;
+    if( m_bWithPrev )
+        pPam->GetPoint()->nNode = m_nTableNode + 3;
     else
-        pPam->GetPoint()->nNode = nTableNode;
+        pPam->GetPoint()->nNode = m_nTableNode;
 
-    pDoc->MergeTable( *pPam->GetPoint(), bWithPrev, nMode );
+    pDoc->MergeTable( *pPam->GetPoint(), m_bWithPrev, m_nMode );
 
     ClearFEShellTabCols(*pDoc, nullptr);
 }
@@ -3014,15 +3014,15 @@ void SwUndoMergeTable::RepeatImpl(::sw::RepeatContext & rContext)
     SwDoc *const pDoc = & rContext.GetDoc();
     SwPaM *const pPam = & rContext.GetRepeatPaM();
 
-    pDoc->MergeTable( *pPam->GetPoint(), bWithPrev, nMode );
+    pDoc->MergeTable( *pPam->GetPoint(), m_bWithPrev, m_nMode );
     ClearFEShellTabCols(*pDoc, nullptr);
 }
 
 void SwUndoMergeTable::SaveFormula( SwHistory& rHistory )
 {
-    if( !pHistory )
-        pHistory.reset( new SwHistory );
-    pHistory->Move( 0, &rHistory );
+    if( !m_pHistory )
+        m_pHistory.reset( new SwHistory );
+    m_pHistory->Move( 0, &rHistory );
 }
 
 void InsertSort( std::vector<sal_uInt16>& rArr, sal_uInt16 nIdx )


More information about the Libreoffice-commits mailing list