summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-07-18 10:41:34 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-07-18 11:07:59 +0200
commit54518a209d0ffe00f8e391472da92e398c474392 (patch)
tree95f675b8cbed966784b84af641b97125a746c0b4 /writerfilter
parent99d8ce56ecfc4af77cf9b2dc1120d821cba20bee (diff)
fdo#65632 RTF import: send NS_ooxml::LN_trackchange only once for one range
The problem was that in case we had {\deleted foo\b bar} then both "foo" and "bar" triggered a trackchange, but "}" only ended one, resulting in overlapping redline ranges. This was cought by core, but caused a performance problem. For the first bugdoc, before: real 3m57.803s after: real 0m3.072s Change-Id: Ibf6f2db30109f0b9a2571d2e4fb3cc76294f68d1
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx15
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx1
2 files changed, 13 insertions, 3 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index bd6971b19857..249e51b34a19 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -470,6 +470,15 @@ void RTFDocumentImpl::runProps()
RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms));
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
}
+
+ // Delete the sprm, so the trackchange range will be started only once.
+ // OTOH set a boolean flag, so we'll know we need to end the range later.
+ RTFValue::Pointer_t pTrackchange = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange);
+ if (pTrackchange.get())
+ {
+ m_aStates.top().bStartedTrackchange = true;
+ m_aStates.top().aCharacterSprms.erase(NS_ooxml::LN_trackchange);
+ }
}
void RTFDocumentImpl::runBreak()
@@ -4429,8 +4438,7 @@ int RTFDocumentImpl::popState()
}
// See if we need to end a track change
- RTFValue::Pointer_t pTrackchange = aState.aCharacterSprms.find(NS_ooxml::LN_trackchange);
- if (pTrackchange.get())
+ if (aState.bStartedTrackchange)
{
RTFSprms aTCSprms;
RTFValue::Pointer_t pValue(new RTFValue(0));
@@ -4795,7 +4803,8 @@ RTFParserState::RTFParserState(RTFDocumentImpl *pDocumentImpl)
bInBackground(false),
bHadShapeText(false),
bInShapeGroup(false),
- bCreatedShapeGroup(false)
+ bCreatedShapeGroup(false),
+ bStartedTrackchange(false)
{
}
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 6d05b900c276..d55572e74491 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -264,6 +264,7 @@ namespace writerfilter {
bool bHadShapeText;
bool bInShapeGroup; ///< If we're inside a \shpgrp group.
bool bCreatedShapeGroup; ///< A GroupShape was created and pushed to the parent stack.
+ bool bStartedTrackchange; ///< Track change is started, need to end it before popping.
};
class RTFTokenizer;