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

Michael Stahl mstahl at redhat.com
Wed May 7 09:05:58 PDT 2014


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

New commits:
commit bba3c94155c1c3b56a0d475bb2cd293a5ef370c0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed May 7 17:57:17 2014 +0200

    SwTxtNode::CopyText(): actually check hints of destination node too
    
    Change-Id: I1bb883502ccd4c6fb5bdfd93f2fa5a04de0b2701

diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index fa12315..386e4c5 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1783,6 +1783,7 @@ void SwTxtNode::CopyText( SwTxtNode *const pDest,
     }
 
     CHECK_SWPHINTS(this);
+    CHECK_SWPHINTS(pDest);
 }
 
 OUString SwTxtNode::InsertText( const OUString & rStr, const SwIndex & rIdx,
commit 80b131038d2375c9855ee5fbe225e75bdad2645e
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

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 2bcc64b..b7af846 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -277,6 +277,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 2472cab..3a6e4f3 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1757,12 +1757,23 @@ void SwCompareData::SetRedlinesToDoc( 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
@@ -2004,6 +2015,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 d6de6d5..fa12315 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -255,14 +255,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