Kaydet (Commit) c117ab83 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#103938 replace fix for tdf#78599/tdf#87977

i.e. revert

commit 162c72d6
Author: Caolán McNamara <caolanm@redhat.com>
Date:   Fri Jan 23 13:17:39 2015 +0000

and

commit ad50b9a8
Author: Caolán McNamara <caolanm@redhat.com>
Date:   Fri Jan 23 15:52:58 2015 +0000

    Related: fdo#78599 wrong method

and restore the original RegisterToFormat logic, and
instead block setting modifications of the document
until the explicit SetModified call to avoid the
original problem of trying to generate a preview
of the document during the section where it cannot be
done

Change-Id: I9dbec0a371d4d747b780aa271789d50a46eccefd
Reviewed-on: https://gerrit.libreoffice.org/31917Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Tested-by: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 82f25d5d
...@@ -719,6 +719,11 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, ...@@ -719,6 +719,11 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts,
} }
} }
//Resolves: tdf#87977, tdf#78599, disable broadcasting modifications
//until after RegisterToFormat is completed
bool bEnableSetModified = getIDocumentState().IsEnableSetModified();
getIDocumentState().SetEnableSetModified(false);
SwTableNode* pTableNd = GetNodes().TextToTable( SwTableNode* pTableNd = GetNodes().TextToTable(
aRg, cCh, pTableFormat, pLineFormat, pBoxFormat, aRg, cCh, pTableFormat, pLineFormat, pBoxFormat,
getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ), pUndo ); getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD ), pUndo );
...@@ -744,6 +749,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, ...@@ -744,6 +749,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts,
// Set Orientation in the Table's Format // Set Orientation in the Table's Format
pTableFormat->SetFormatAttr( SwFormatHoriOrient( 0, eAdjust ) ); pTableFormat->SetFormatAttr( SwFormatHoriOrient( 0, eAdjust ) );
rNdTable.RegisterToFormat(*pTableFormat);
if( pTAFormat || ( rInsTableOpts.mnInsMode & tabopts::DEFAULT_BORDER) ) if( pTAFormat || ( rInsTableOpts.mnInsMode & tabopts::DEFAULT_BORDER) )
{ {
...@@ -873,6 +879,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, ...@@ -873,6 +879,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts,
GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE, nullptr ); GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE, nullptr );
} }
getIDocumentState().SetEnableSetModified(bEnableSetModified);
getIDocumentState().SetModified(); getIDocumentState().SetModified();
getIDocumentFieldsAccess().SetFieldsDirty(true, nullptr, 0); getIDocumentFieldsAccess().SetFieldsDirty(true, nullptr, 0);
return &rNdTable; return &rNdTable;
...@@ -1106,7 +1113,6 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh, ...@@ -1106,7 +1113,6 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
lcl_BalanceTable(rTable, nMaxBoxes, *pTableNd, *pBoxFormat, *pTextColl, lcl_BalanceTable(rTable, nMaxBoxes, *pTableNd, *pBoxFormat, *pTextColl,
pUndo, &aPosArr); pUndo, &aPosArr);
rTable.RegisterToFormat(*pTableFormat);
lcl_SetTableBoxWidths(rTable, nMaxBoxes, *pBoxFormat, *pDoc, &aPosArr); lcl_SetTableBoxWidths(rTable, nMaxBoxes, *pBoxFormat, *pDoc, &aPosArr);
return pTableNd; return pTableNd;
...@@ -1236,11 +1242,17 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > ...@@ -1236,11 +1242,17 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
} }
} }
//Resolves: tdf#87977, tdf#78599, disable broadcasting modifications
//until after RegisterToFormat is completed
bool bEnableSetModified = getIDocumentState().IsEnableSetModified();
getIDocumentState().SetEnableSetModified(false);
SwTableNode* pTableNd = GetNodes().TextToTable( SwTableNode* pTableNd = GetNodes().TextToTable(
rTableNodes, pTableFormat, pLineFormat, pBoxFormat, rTableNodes, pTableFormat, pLineFormat, pBoxFormat,
getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD )/*, pUndo*/ ); getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_STANDARD )/*, pUndo*/ );
SwTable& rNdTable = pTableNd->GetTable(); SwTable& rNdTable = pTableNd->GetTable();
rNdTable.RegisterToFormat(*pTableFormat);
if( !pBoxFormat->HasWriterListeners() ) if( !pBoxFormat->HasWriterListeners() )
{ {
...@@ -1253,6 +1265,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > ...@@ -1253,6 +1265,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
sal_uLong nIdx = pTableNd->GetIndex(); sal_uLong nIdx = pTableNd->GetIndex();
aNode2Layout.RestoreUpperFrames( GetNodes(), nIdx, nIdx + 1 ); aNode2Layout.RestoreUpperFrames( GetNodes(), nIdx, nIdx + 1 );
getIDocumentState().SetEnableSetModified(bEnableSetModified);
getIDocumentState().SetModified(); getIDocumentState().SetModified();
getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
return &rNdTable; return &rNdTable;
...@@ -1430,7 +1443,6 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes, ...@@ -1430,7 +1443,6 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
nMaxBoxes = nBoxes; nMaxBoxes = nBoxes;
} }
rTable.RegisterToFormat(*pTableFormat);
lcl_SetTableBoxWidths2(rTable, nMaxBoxes, *pBoxFormat, *pDoc); lcl_SetTableBoxWidths2(rTable, nMaxBoxes, *pBoxFormat, *pDoc);
return pTableNd; return pTableNd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment