summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-10-26 11:47:13 +0100
committerMichael Stahl <mstahl@redhat.com>2012-10-26 19:19:13 +0200
commitf3820602b6f8d22ad4177cbd4e51b4153087986d (patch)
tree7b6ba5afbc730e44a4d73379214f7a979d96ca26
parentdc7fe4eec579dbb5bf816dfa3fd53f8fec88da7c (diff)
Resolves: fdo#50285 merging props unsafe with intermediate charstyle prop
Its a nice idea to merge properties of the same type and value if one starts and the same place the last one ended. But character styles are properties as well, so if we have character-style+superscript on range a, and character-style+superscript on range b and merge these so that we end up as... character-style on range a, superscript on range a+b, and character-style on range b then that clearly gives the wrong result if applied in that order. So its only safe to merge if there are no intermediate properties that can affect the merge candidates. A regression from b3cee382f449aa69213dc21f7b1ba6a5356d2865 Change-Id: I541563d11265426736b840de068922eef8d45573 (cherry picked from commit 08ffb7bc5ec4472126762f4cb9677349b61122f6) Signed-off-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/source/filter/ww1/fltshell.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx
index 42beaa12b28e..21ddff00050e 100644
--- a/sw/source/filter/ww1/fltshell.cxx
+++ b/sw/source/filter/ww1/fltshell.cxx
@@ -327,6 +327,8 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
myEIter aI = maEntries.begin();
while (aI != maEntries.end())
{
+ bool bLastEntry = aI == maEntries.end() - 1;
+
SwFltStackEntry& rEntry = *aI;
if (rEntry.bOpen)
{
@@ -352,7 +354,7 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
{
rEntry.bConsumedByField = consumedByField;
rEntry.SetEndPos(rPos);
- if (nAttrId == rEntry.pAttr->Which())
+ if (bLastEntry && nAttrId == rEntry.pAttr->Which())
{
//potential candidate for merging with an identical
//property beginning at rPos
@@ -379,7 +381,7 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos,
//we advance to the next node, or finish processing the document
if (rEntry.m_aPtPos.m_nNode.GetIndex() == aFltPos.m_nNode.GetIndex())
{
- if (nAttrId == rEntry.pAttr->Which() &&
+ if (bLastEntry && nAttrId == rEntry.pAttr->Which() &&
rEntry.m_aPtPos.m_nCntnt == aFltPos.m_nCntnt)
{
//potential candidate for merging with an identical