[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/inc sw/source

Michael Stahl mstahl at redhat.com
Thu May 8 00:51:57 PDT 2014


 sw/inc/ndtxt.hxx                 |    3 +++
 sw/source/core/doc/doccomp.cxx   |   13 +++++++++++++
 sw/source/core/txtnode/ndtxt.cxx |   11 ++++++++---
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 8fb7fa143cca628654933459135eee6c3f1450d4
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed May 7 17:52:16 2014 +0200

    fdo#74790: sw: Compare Document: fix assertions about RSID-only hints
    
    For ordinary documents the SwTxtNode::MakeFrm() would set the
    m_bFormatIgnoreStart/End flags of the RSID-only hints, but the document
    loaded by Compare Document (and Merge Document) is special because it
    is loaded, there are editing operations on it, but it has no layout,
    so the assertions about these flags trigger.
    
    (regression from 6db39dbd7378351f6476f6db25eb7110c9cfb291)
    
    Change-Id: I8a6e02b68f22e609640adbe93ff194e4081d9856
    (cherry picked from commit 80b131038d2375c9855ee5fbe225e75bdad2645e)
    Reviewed-on: https://gerrit.libreoffice.org/9274
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index d8e1fbb..072aecb 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -280,6 +280,9 @@ public:
     // delete all attributes from SwpHintsArray.
     void    ClearSwpHintsArr( bool bDelFields );
 
+    /// initialize the hints after file loading (which takes shortcuts)
+    void    FileLoadedInitHints();
+
     /// Insert pAttr into hints array. @return true iff inserted successfully
     bool    InsertHint( SwTxtAttr * const pAttr,
                   const SetAttrMode nMode = nsSetAttrMode::SETATTR_DEFAULT );
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index aaefd2a..ac06f62 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1756,12 +1756,23 @@ void SwCompareData::SetRedlinesToDoc( sal_Bool bUseDocInfo )
     }
 }
 
+static bool lcl_MergePortions(SwNode *const& pNode, void *)
+{
+    if (pNode->IsTxtNode())
+    {
+        pNode->GetTxtNode()->FileLoadedInitHints();
+    }
+    return true;
+}
+
 // Returns (the difference count?) if something is different
 long SwDoc::CompareDoc( const SwDoc& rDoc )
 {
     if( &rDoc == this )
         return 0;
 
+    const_cast<SwDoc&>(rDoc).GetNodes().ForEach(&lcl_MergePortions);
+
     long nRet = 0;
 
     // Get comparison options
@@ -2005,6 +2016,8 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
 
     long nRet = 0;
 
+    const_cast<SwDoc&>(rDoc).GetNodes().ForEach(&lcl_MergePortions);
+
     GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
 
     SwDoc& rSrcDoc = (SwDoc&)rDoc;
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 2be6fbb9..f6bf93d 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -257,14 +257,19 @@ SwTxtNode::~SwTxtNode()
     InitSwParaStatistics( false );
 }
 
-SwCntntFrm *SwTxtNode::MakeFrm( SwFrm* pSib )
+void SwTxtNode::FileLoadedInitHints()
 {
-    // fdo#52028: ODF file import does not result in MergePortions being called
-    // for every attribute, since that would be inefficient.  So call it here.
     if (m_pSwpHints)
     {
         m_pSwpHints->MergePortions(*this);
     }
+}
+
+SwCntntFrm *SwTxtNode::MakeFrm( SwFrm* pSib )
+{
+    // fdo#52028: ODF file import does not result in MergePortions being called
+    // for every attribute, since that would be inefficient.  So call it here.
+    FileLoadedInitHints();
     SwCntntFrm *pFrm = new SwTxtFrm( this, pSib );
     return pFrm;
 }


More information about the Libreoffice-commits mailing list