[Libreoffice-commits] core.git: sw/source

Caolán McNamara caolanm at redhat.com
Tue Apr 14 08:22:57 PDT 2015


 sw/source/filter/basflt/shellio.cxx |    7 +++++--
 sw/source/filter/ww8/docxexport.cxx |    2 +-
 sw/source/filter/ww8/rtfexport.cxx  |    2 +-
 sw/source/filter/ww8/wrtww8.cxx     |   22 ++++++++--------------
 sw/source/filter/ww8/wrtww8.hxx     |    2 +-
 5 files changed, 16 insertions(+), 19 deletions(-)

New commits:
commit 0b037361b890a83a735186b98d5a3cef124027f4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 14 15:56:48 2015 +0100

    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

diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 2004492..567aad5 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -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 )
         {
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 30ea867..2490066 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -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();
 
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index e6e503a..60ca1f0 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -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)
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 695a189..75732f1 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -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)
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index bc0c12f..e2e2421 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -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 */


More information about the Libreoffice-commits mailing list