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 )
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);
const RedlineMode_t nOrigRedlineMode = pOutDoc->getIDocumentRedlineAccess().GetRedlineMode();
sal_uLong nError = 0;
if( pMedium )
......@@ -869,7 +870,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName )
else if( xStg.is() )
nError = rxWriter->Write( *pPam, xStg, pRealFileName );
pOutDoc->getIDocumentSettingAccess().set(DocumentSettingId::PURGE_OLE, bWasPurgeOle );
pOutDoc->getIDocumentSettingAccess().set(DocumentSettingId::PURGE_OLE, bOrigPurgeOle );
if( pESh )
{
......@@ -887,10 +888,12 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName )
else
delete pPam;
}
pOutDoc->getIDocumentRedlineAccess().SetRedlineMode(nOrigRedlineMode);
}
else
{
delete pPam; // delete the created Pam
pOutDoc->getIDocumentRedlineAccess().SetRedlineMode(nOrigRedlineMode);
// Everything was written successfully? Tell the document!
if ( !IsError( nError ) && !pDoc )
{
......
......@@ -421,7 +421,7 @@ void DocxExport::OutputDML(uno::Reference<drawing::XShape>& xShape)
void DocxExport::ExportDocument_Impl()
{
// 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();
......
......@@ -510,7 +510,7 @@ void RtfExport::ExportDocument_Impl()
OutULong(pViewShell->GetViewOptions()->GetZoom());
}
// Record changes?
if (nsRedlineMode_t::REDLINE_ON & mnRedlineMode)
if (nsRedlineMode_t::REDLINE_ON & mnOrigRedlineMode)
Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_REVISIONS);
// Mirror margins?
if ((nsUseOnPage::PD_MIRROR & pDoc->GetPageDesc(0).ReadUseOn()) == nsUseOnPage::PD_MIRROR)
......
......@@ -3050,11 +3050,13 @@ void MSWordExportBase::ExportDocument( bool bWriteAll )
// #i81405# - Collect anchored objects before changing the redline mode.
maFrames = GetFrames( *pDoc, bWriteAll? NULL : pOrigPam );
mnRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
mnOrigRedlineMode = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
if ( !pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
pDoc->getIDocumentRedlineAccess().SetRedlineMode( (RedlineMode_t)(mnRedlineMode | nsRedlineMode_t::REDLINE_SHOW_DELETE |
nsRedlineMode_t::REDLINE_SHOW_INSERT) );
//restored to original state by SwWriter::Write
pDoc->getIDocumentRedlineAccess().SetRedlineMode(mnOrigRedlineMode |
nsRedlineMode_t::REDLINE_SHOW_DELETE |
nsRedlineMode_t::REDLINE_SHOW_INSERT);
}
maFontHelper.InitFontTable( SupportsUnicode(), *pDoc );
......@@ -3067,14 +3069,6 @@ void MSWordExportBase::ExportDocument( bool bWriteAll )
pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )->RecalcObjOrdNums();
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 )
......@@ -3215,8 +3209,8 @@ void WW8Export::ExportDocument_Impl()
pPiece = new WW8_WrPct( pFib->fcMin, bWrtWW8 );
pDop = new WW8Dop;
pDop->fRevMarking = 0 != ( nsRedlineMode_t::REDLINE_ON & mnRedlineMode );
pDop->fRMView = 0 != ( nsRedlineMode_t::REDLINE_SHOW_DELETE & mnRedlineMode );
pDop->fRevMarking = 0 != ( nsRedlineMode_t::REDLINE_ON & mnOrigRedlineMode );
pDop->fRMView = 0 != ( nsRedlineMode_t::REDLINE_SHOW_DELETE & mnOrigRedlineMode );
pDop->fRMPrint = pDop->fRMView;
// set AutoHyphenation flag if found in default para style
......@@ -3477,7 +3471,7 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM
, nLastFmtId(0)
, nUniqueList(0)
, mnHdFtIndex(0)
, mnRedlineMode(0)
, mnOrigRedlineMode(0)
, pAktPageDesc(0)
, bPrevTextNodeIsEmpty(false)
, pPapPlc(0)
......
......@@ -477,7 +477,7 @@ public:
sal_uInt16 nUniqueList; ///< current number for creating unique list names
unsigned int mnHdFtIndex;
sal_uInt16 mnRedlineMode; ///< Remember the original redline mode
RedlineMode_t mnOrigRedlineMode; ///< Remember the original redline mode
public:
/* 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