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

solve assert on restoring redline mode on exporting of abi9915-1.odt to doc

see also on export of ooo103014-1.odt to doc and many more

easiest thing is to move the restoration of the redline mode upwards for
all filters to the central SwWriter::Write after all pams have been
destroyed.

Change-Id: Ieb747ad2ed465d3fd3de81db0ef820073bc3ab55
üst 5ec5bb3f
...@@ -856,8 +856,9 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) ...@@ -856,8 +856,9 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName )
pESh->StartAllAction(); pESh->StartAllAction();
} }
bool bWasPurgeOle = pOutDoc->getIDocumentSettingAccess().get(DocumentSettingId::PURGE_OLE); const bool bOrigPurgeOle = pOutDoc->getIDocumentSettingAccess().get(DocumentSettingId::PURGE_OLE);
pOutDoc->getIDocumentSettingAccess().set(DocumentSettingId::PURGE_OLE, false); pOutDoc->getIDocumentSettingAccess().set(DocumentSettingId::PURGE_OLE, false);
const RedlineMode_t nOrigRedlineMode = pOutDoc->getIDocumentRedlineAccess().GetRedlineMode();
sal_uLong nError = 0; sal_uLong nError = 0;
if( pMedium ) if( pMedium )
...@@ -869,7 +870,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) ...@@ -869,7 +870,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName )
else if( xStg.is() ) else if( xStg.is() )
nError = rxWriter->Write( *pPam, xStg, pRealFileName ); nError = rxWriter->Write( *pPam, xStg, pRealFileName );
pOutDoc->getIDocumentSettingAccess().set(DocumentSettingId::PURGE_OLE, bWasPurgeOle ); pOutDoc->getIDocumentSettingAccess().set(DocumentSettingId::PURGE_OLE, bOrigPurgeOle );
if( pESh ) if( pESh )
{ {
...@@ -887,10 +888,12 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) ...@@ -887,10 +888,12 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName )
else else
delete pPam; delete pPam;
} }
pOutDoc->getIDocumentRedlineAccess().SetRedlineMode(nOrigRedlineMode);
} }
else else
{ {
delete pPam; // delete the created Pam delete pPam; // delete the created Pam
pOutDoc->getIDocumentRedlineAccess().SetRedlineMode(nOrigRedlineMode);
// Everything was written successfully? Tell the document! // Everything was written successfully? Tell the document!
if ( !IsError( nError ) && !pDoc ) if ( !IsError( nError ) && !pDoc )
{ {
......
...@@ -421,7 +421,7 @@ void DocxExport::OutputDML(uno::Reference<drawing::XShape>& xShape) ...@@ -421,7 +421,7 @@ void DocxExport::OutputDML(uno::Reference<drawing::XShape>& xShape)
void DocxExport::ExportDocument_Impl() void DocxExport::ExportDocument_Impl()
{ {
// Set the 'Track Revisions' flag in the settings structure // Set the 'Track Revisions' flag in the settings structure
m_aSettings.trackRevisions = 0 != ( nsRedlineMode_t::REDLINE_ON & mnRedlineMode ); m_aSettings.trackRevisions = 0 != ( nsRedlineMode_t::REDLINE_ON & mnOrigRedlineMode );
InitStyles(); InitStyles();
......
...@@ -510,7 +510,7 @@ void RtfExport::ExportDocument_Impl() ...@@ -510,7 +510,7 @@ void RtfExport::ExportDocument_Impl()
OutULong(pViewShell->GetViewOptions()->GetZoom()); OutULong(pViewShell->GetViewOptions()->GetZoom());
} }
// Record changes? // Record changes?
if (nsRedlineMode_t::REDLINE_ON & mnRedlineMode) if (nsRedlineMode_t::REDLINE_ON & mnOrigRedlineMode)
Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_REVISIONS); Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_REVISIONS);
// Mirror margins? // Mirror margins?
if ((nsUseOnPage::PD_MIRROR & pDoc->GetPageDesc(0).ReadUseOn()) == nsUseOnPage::PD_MIRROR) if ((nsUseOnPage::PD_MIRROR & pDoc->GetPageDesc(0).ReadUseOn()) == nsUseOnPage::PD_MIRROR)
......
...@@ -3050,11 +3050,13 @@ void MSWordExportBase::ExportDocument( bool bWriteAll ) ...@@ -3050,11 +3050,13 @@ void MSWordExportBase::ExportDocument( bool bWriteAll )
// #i81405# - Collect anchored objects before changing the redline mode. // #i81405# - Collect anchored objects before changing the redline mode.
maFrames = GetFrames( *pDoc, bWriteAll? NULL : pOrigPam ); maFrames = GetFrames( *pDoc, bWriteAll? NULL : pOrigPam );
mnRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode(); mnOrigRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
if ( !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() ) if ( !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{ {
pDoc->getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)(mnRedlineMode | nsRedlineMode_t::REDLINE_SHOW_DELETE | //restored to original state by SwWriter::Write
nsRedlineMode_t::REDLINE_SHOW_INSERT) ); pDoc->getIDocumentRedlineAccess().SetRedlineMode(mnOrigRedlineMode |
nsRedlineMode_t::REDLINE_SHOW_DELETE |
nsRedlineMode_t::REDLINE_SHOW_INSERT);
} }
maFontHelper.InitFontTable( SupportsUnicode(), *pDoc ); maFontHelper.InitFontTable( SupportsUnicode(), *pDoc );
...@@ -3067,14 +3069,6 @@ void MSWordExportBase::ExportDocument( bool bWriteAll ) ...@@ -3067,14 +3069,6 @@ void MSWordExportBase::ExportDocument( bool bWriteAll )
pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )->RecalcObjOrdNums(); pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )->RecalcObjOrdNums();
ExportDocument_Impl(); ExportDocument_Impl();
// park curpam in a "safe place" now that document is fully exported before
// toggling redline mode to avoid ~SwIndexReg assert e.g. export
// ooo103014-1.odt to .doc
*pCurPam = *pOrigPam;
if ( mnRedlineMode != pDoc->getIDocumentRedlineAccess().GetRedlineMode() )
pDoc->getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)(mnRedlineMode) );
} }
bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec ) bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec )
...@@ -3215,8 +3209,8 @@ void WW8Export::ExportDocument_Impl() ...@@ -3215,8 +3209,8 @@ void WW8Export::ExportDocument_Impl()
pPiece = new WW8_WrPct( pFib->fcMin, bWrtWW8 ); pPiece = new WW8_WrPct( pFib->fcMin, bWrtWW8 );
pDop = new WW8Dop; pDop = new WW8Dop;
pDop->fRevMarking = 0 != ( nsRedlineMode_t::REDLINE_ON & mnRedlineMode ); pDop->fRevMarking = 0 != ( nsRedlineMode_t::REDLINE_ON & mnOrigRedlineMode );
pDop->fRMView = 0 != ( nsRedlineMode_t::REDLINE_SHOW_DELETE & mnRedlineMode ); pDop->fRMView = 0 != ( nsRedlineMode_t::REDLINE_SHOW_DELETE & mnOrigRedlineMode );
pDop->fRMPrint = pDop->fRMView; pDop->fRMPrint = pDop->fRMView;
// set AutoHyphenation flag if found in default para style // set AutoHyphenation flag if found in default para style
...@@ -3477,7 +3471,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM ...@@ -3477,7 +3471,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM
, nLastFmtId(0) , nLastFmtId(0)
, nUniqueList(0) , nUniqueList(0)
, mnHdFtIndex(0) , mnHdFtIndex(0)
, mnRedlineMode(0) , mnOrigRedlineMode(0)
, pAktPageDesc(0) , pAktPageDesc(0)
, bPrevTextNodeIsEmpty(false) , bPrevTextNodeIsEmpty(false)
, pPapPlc(0) , pPapPlc(0)
......
...@@ -477,7 +477,7 @@ public: ...@@ -477,7 +477,7 @@ public:
sal_uInt16 nUniqueList; ///< current number for creating unique list names sal_uInt16 nUniqueList; ///< current number for creating unique list names
unsigned int mnHdFtIndex; unsigned int mnHdFtIndex;
sal_uInt16 mnRedlineMode; ///< Remember the original redline mode RedlineMode_t mnOrigRedlineMode; ///< Remember the original redline mode
public: public:
/* implicit bookmark vector containing pairs of node indexes and bookmark names */ /* implicit bookmark vector containing pairs of node indexes and bookmark names */
......
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