[Libreoffice-commits] core.git: Branch 'feature/table-style' - 6 commits - sw/source

Alex Ivan alexnivan at yahoo.com
Thu Aug 22 09:19:24 PDT 2013


 sw/source/core/doc/swtblfmt.cxx  |    8 ++++----
 sw/source/core/doc/tblrwcl.cxx   |    4 ++++
 sw/source/core/docnode/ndtbl.cxx |   17 ++++++++++++-----
 sw/source/core/inc/UndoTable.hxx |    1 -
 sw/source/core/undo/untbl.cxx    |    8 ++++++++
 5 files changed, 28 insertions(+), 10 deletions(-)

New commits:
commit 17d00196dbcaa8a98f65f6b3c1c33e507ddbf210
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Thu Aug 22 19:14:40 2013 +0300

    Proper undo for row/column insertion/deletion
    
    Change-Id: If0de2939334ecf10d96e26d5a5c3d99dfa3deba2

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 9a89ab1..8181640 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1792,6 +1792,10 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext)
     if( IsDelBox() )
         nSttNode = pTblNd->GetIndex();
     ClearFEShellTabCols();
+
+    SwTableFmt::AssignFormatParents( (SwTableFmt*)pTblNd->GetTable().GetFrmFmt()->GetRegisteredIn(),
+                                     pTblNd->GetTable() );
+
     CHECK_TABLE( pTblNd->GetTable() )
 }
 
@@ -1904,6 +1908,10 @@ void SwUndoTblNdsChg::RedoImpl(::sw::UndoRedoContext & rContext)
         ;
     }
     ClearFEShellTabCols();
+
+    SwTableFmt::AssignFormatParents( (SwTableFmt*)pTblNd->GetTable().GetFrmFmt()->GetRegisteredIn(),
+                                     pTblNd->GetTable() );
+
     CHECK_TABLE( pTblNd->GetTable() )
 }
 
commit 609527032d6ebc6df15a7082a0bbed681f924a47
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Thu Aug 22 18:10:34 2013 +0300

    Reapply table style after row/column deletion
    
    Change-Id: I24c851a2d1674aec96ca7577dfc92302e226fe4e

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 896861f..0a09ccd 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1986,6 +1986,10 @@ sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
             pTblNd->DelFrms();
             DeleteSection( pTblNd );
         }
+
+        SwTableFmt::AssignFormatParents( (SwTableFmt*)rTable.GetFrmFmt()->GetRegisteredIn(),
+                                            rTable );
+
         SetModified();
         SetFieldsDirty( true, NULL, 0 );
         return sal_True;
@@ -2017,6 +2021,9 @@ sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
         bRet = rTable.DeleteSel( this, aSelBoxes, 0, pUndo, true, true );
         if (bRet)
         {
+            SwTableFmt::AssignFormatParents( (SwTableFmt*)rTable.GetFrmFmt()->GetRegisteredIn(),
+                                            rTable );
+
             SetModified();
             SetFieldsDirty( true, NULL, 0 );
         }
commit 23241bd4c6f9e7a7094ba962223bd57edbae813c
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Thu Aug 22 15:47:23 2013 +0300

    Reapply table style after inserting rows
    
    Change-Id: I56cc24f80a3812f9a04fcb639cc38eaa628fc95e

diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 8e0ee86..70560a7 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -664,6 +664,8 @@ bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes,
         pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind );
     pDoc->UpdateCharts( GetFrmFmt()->GetName() );
 
+    SwTableFmt::AssignFormatParents( (SwTableFmt*)GetFrmFmt()->GetRegisteredIn(), *this );
+
     return true;
 }
 
commit 80090c35ad14c860abd195f6ced5fc37270e8943
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Thu Aug 22 15:43:00 2013 +0300

    Adjust format parent assigning
    
    Modify format parent assigning mechanism so that the format
    is claimed when assigning the parent, if it has other dependencies,
    instead of attempting to have each element created with its own
    Sw*Fmt on insertion.
    
    Change-Id: I569b2a865d41fa6da57e0a0cb090a0fbccddb13c

diff --git a/sw/source/core/doc/swtblfmt.cxx b/sw/source/core/doc/swtblfmt.cxx
index 5e3d88d..823f073 100644
--- a/sw/source/core/doc/swtblfmt.cxx
+++ b/sw/source/core/doc/swtblfmt.cxx
@@ -299,7 +299,7 @@ void SwTableFmt::AssignLineParents( SwTableFmt* pSrcFmt, SwTable &rTable )
     sal_uInt16 nLines = rTable.GetTabLines().size();
     for( sal_uInt16 n = 0; n < nLines; ++n )
     {
-        SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rTable.GetTabLines()[ n ]->GetFrmFmt();
+        SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rTable.GetTabLines()[ n ]->ClaimFrmFmt();
         SwTableLineFmt* pFmt = 0;
 
         if( pSrcFmt )
@@ -336,7 +336,7 @@ void SwTableFmt::AssignBoxParents( SwTableLineFmt* pSrcLineFmt, SwTableLine &rLi
     sal_uInt16 nBoxes = rLine.GetTabBoxes().size();
     for( sal_uInt16 n = 0; n < nBoxes; ++n )
     {
-        SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rLine.GetTabBoxes()[ n ]->GetFrmFmt();
+        SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rLine.GetTabBoxes()[ n ]->ClaimFrmFmt();
         SwTableBoxFmt* pFmt = 0;
 
         if( pSrcLineFmt )
@@ -374,7 +374,7 @@ void SwTableFmt::AssignLineParents_Complex( SwTableLineFmt* pSrcLineFmt, SwTable
     sal_uInt16 nLines = rBox.GetTabLines().size();
     for( sal_uInt16 n = 0; n < nLines; ++n )
     {
-        SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rBox.GetTabLines()[ n ]->GetFrmFmt();
+        SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rBox.GetTabLines()[ n ]->ClaimFrmFmt();
 
         if( pSrcLineFmt )
         {
@@ -398,7 +398,7 @@ void SwTableFmt::AssignBoxParents_Complex( SwTableLineFmt* pSrcLineFmt, SwTableB
     sal_uInt16 nBoxes = rLine.GetTabBoxes().size();
     for( sal_uInt16 n = 0; n < nBoxes; ++n )
     {
-        SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rLine.GetTabBoxes()[ n ]->GetFrmFmt();
+        SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rLine.GetTabBoxes()[ n ]->ClaimFrmFmt();
 
         if( pSrcBoxFmt )
         {
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 36763c8..896861f 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -167,7 +167,7 @@ lcl_SetDfltBoxAttr(SwTableBox& rBox, DfltBoxAttrList_t & rBoxFmtArr,
 
         (*pMap)[pBoxFrmFmt] = pNewTableBoxFmt;
     }
-    rBox.ChgFrmFmt( new SwTableBoxFmt( *pNewTableBoxFmt) );
+    rBox.ChgFrmFmt( pNewTableBoxFmt );
 }
 
 static SwTableBoxFmt *lcl_CreateDfltBoxFmt( SwDoc &rDoc, std::vector<SwTableBoxFmt*> &rBoxFmtArr,
@@ -455,7 +455,7 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
     SwTableLines& rLines = pNdTbl->GetTabLines();
     for( sal_uInt16 n = 0; n < nRows; ++n )
     {
-        SwTableLine* pLine = new SwTableLine( new SwTableLineFmt( *pLineFmt ), nCols, 0 );
+        SwTableLine* pLine = new SwTableLine( pLineFmt, nCols, 0 );
         rLines.insert( rLines.begin() + n, pLine );
         SwTableBoxes& rBoxes = pLine->GetTabBoxes();
         for( sal_uInt16 i = 0; i < nCols; ++i )
@@ -464,10 +464,10 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
             if( bDfltBorders )
             {
                 sal_uInt8 nBoxId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 );
-                pBoxF = new SwTableBoxFmt( *::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr, nCols, nBoxId, pTAFmt == 0) );
+                pBoxF = ::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr, nCols, nBoxId, pTAFmt == 0);
             }
             else
-                pBoxF = new SwTableBoxFmt( *pBoxFmt );
+                pBoxF = pBoxFmt;
 
             // For AutoFormat on input: the columns are set when inserting the Table
             // The Array contains the columns positions and not their widths!
@@ -736,7 +736,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
                     ::lcl_SetDfltBoxAttr( *pBox, *aBoxFmtArr1, nId, pTAFmt == 0 );
                 else
                 {
-                    pBoxF = new SwTableBoxFmt ( *::lcl_CreateDfltBoxFmt( *this, *aBoxFmtArr2, USHRT_MAX, nId, pTAFmt == 0 ) );
+                    pBoxF = ::lcl_CreateDfltBoxFmt( *this, *aBoxFmtArr2, USHRT_MAX, nId, pTAFmt == 0 );
                     pBoxF->SetFmtAttr( pBox->GetFrmFmt()->GetFrmSize() );
                     pBox->ChgFrmFmt( pBoxF );
                 }
commit f84b527b5919b6e0d6b0ab434448582dcc632ec0
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Thu Aug 22 13:03:04 2013 +0300

    Reapply table style after inserting columns
    
    Change-Id: If0550caf8d020623654eda05efc20d382f050275

diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index c0dd49d..8e0ee86 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -562,6 +562,8 @@ bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
         pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind );
     pDoc->UpdateCharts( GetFrmFmt()->GetName() );
 
+    SwTableFmt::AssignFormatParents( (SwTableFmt*)GetFrmFmt()->GetRegisteredIn(), *this );
+
     return bRes;
 }
 
commit 1ccec348fb3ed2dc346b96aeaa9855f80929950b
Author: Alex Ivan <alexnivan at yahoo.com>
Date:   Wed Aug 21 13:46:41 2013 +0300

    Undo Table Style cleanup
    
    Change-Id: I7f14ce2bd51a4c07e258d9b1aef425cf186414d1

diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index 4170c21..ebd871d 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -148,7 +148,6 @@ class SwUndoTblAutoFmt : public SwUndo
 {
     sal_uLong nSttNode;
     String sSaveFmtName;
-    //String sEmptyStr;
     sal_uInt16 m_nRepeatHeading;
 
     void UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext);


More information about the Libreoffice-commits mailing list