summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-23 13:17:39 +0000
committerDavid Tardon <dtardon@redhat.com>2015-04-01 07:27:52 +0000
commit501be50b5de178d6ae1047e1ba4bf144e248eb81 (patch)
tree5d2a04c341dd73584d8d3009df7858d3761a8346
parent11402a73876e4213f1a4b0583d74ac51e4dacb33 (diff)
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@redhat.com> Reviewed-by: David Tardon <dtardon@redhat.com>
-rw-r--r--sw/source/core/docnode/ndtbl.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index bdd3b9c1f4b6..ba6351d77831 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;