summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-05-07 17:52:16 +0200
committerMichael Stahl <mstahl@redhat.com>2014-05-07 18:01:08 +0200
commit80b131038d2375c9855ee5fbe225e75bdad2645e (patch)
tree29c4b5a3545fd9a3096e763ecfd42e0c3100f472
parentb179235f702e474b115ca479b603052f422346fd (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
-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 2bcc64bd4684..b7af846bbf88 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 2472cab44e9b..3a6e4f349c32 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 d6de6d509696..fa123156eac7 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;
}