summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-05-07 17:52:16 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-05-08 07:51:24 +0000
commit8fb7fa143cca628654933459135eee6c3f1450d4 (patch)
treea8942e75901a48561da8e35e711164163be0aa6d
parent0500ac6f276f7e0a5522e1ecdbd3688462ee4533 (diff)
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@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/inc/ndtxt.hxx3
-rw-r--r--sw/source/core/doc/doccomp.cxx13
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx11
3 files changed, 24 insertions, 3 deletions
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index d8e1fbb2ad6c..072aecb240e6 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 aaefd2a674f9..ac06f6223329 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 2be6fbb9edf8..f6bf93d6bf33 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;
}