[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/source

Caolán McNamara caolanm at redhat.com
Wed Apr 1 00:28:22 PDT 2015


 sw/source/core/docnode/ndtbl.cxx |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 501be50b5de178d6ae1047e1ba4bf144e248eb81
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 23 13:17:39 2015 +0000

    Resolves: fdo#87977 ensure RegisterFormat is called before SetModified
    
    was Related: fdo#78599 ensure RegisterFormat is called before SetModified
    
    TextToTable is called which calls lcl_SetTableBoxWidths2 which calls
    SwDoc::MakeTableBoxFmt which calls SetModified.
    
    there happens to be a listener on modified which tries to get an updated
    preview for embedded objects which draws the page to a metafile, but this
    SwTableNode in SwTableNode::MakeFrm doesn't have a FrmFmt set on it yet, so
    falls over and dies.
    
    Move the RegisterFormat into SwNodes::TextToTable before the tablebox widths
    are set to avoid this
    
    (cherry picked from commit 162c72d64077d9e0dae820d881ce2b56a5b2040c)
    
    Conflicts:
    	sw/source/core/docnode/ndtbl.cxx
    
    Change-Id: I3e5141c9901ff0f473e2eaab3e5cd9be61f810bd
    Reviewed-on: https://gerrit.libreoffice.org/15095
    Tested-by: David Tardon <dtardon at redhat.com>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index bdd3b9c..ba6351d 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -746,7 +746,6 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
 
     // Set Orientation in the Table's Fmt
     pTableFmt->SetFmtAttr( SwFmtHoriOrient( 0, eAdjust ) );
-    pNdTbl->RegisterToFormat( *pTableFmt );
 
     if( pTAFmt || ( rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) )
     {
@@ -1110,6 +1109,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
 
     lcl_BalanceTable(*pTable, nMaxBoxes, *pTblNd, *pBoxFmt, *pTxtColl,
             pUndo, &aPosArr);
+    pTable->RegisterToFormat(*pTblFmt);
     lcl_SetTableBoxWidths(*pTable, nMaxBoxes, *pBoxFmt, *pDoc, &aPosArr);
 
     return pTblNd;
@@ -1215,9 +1215,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
             rTableNodes, pTableFmt, pLineFmt, pBoxFmt,
             getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD )/*, pUndo*/ );
 
-    SwTable * pNdTbl = &pTblNd->GetTable();
-    OSL_ENSURE( pNdTbl, "No Table Node created"  );
-    pNdTbl->RegisterToFormat( *pTableFmt );
+    SwTable& rNdTbl = pTblNd->GetTable();
 
     if( !pBoxFmt->GetDepends() )
     {
@@ -1232,7 +1230,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
 
     getIDocumentState().SetModified();
     getIDocumentFieldsAccess().SetFieldsDirty( true, NULL, 0 );
-    return pNdTbl;
+    return &rNdTbl;
 }
 
 SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange)
@@ -1407,6 +1405,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
             nMaxBoxes = nBoxes;
     }
 
+    pTable->RegisterToFormat(*pTblFmt);
     lcl_SetTableBoxWidths2(*pTable, nMaxBoxes, *pBoxFmt, *pDoc);
 
     return pTblNd;


More information about the Libreoffice-commits mailing list