summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2011-07-27 16:50:27 +0200
committerMiklos Vajna <vmiklos@frugalware.org>2011-07-29 17:32:40 +0200
commitdc3f8f86d6691b80b80ec4ba0d22ad470c036fa4 (patch)
treeb0ab0f1e6ab1a24ca49945f766f387ee808ad39f
parentb1b033ade9cea653ab3934c020dbb3e910ac1065 (diff)
Introduce RTFParserState::Clone, closes fdo#36922
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx24
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx2
2 files changed, 24 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 87e344ad0..01082eeb5 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2275,9 +2275,9 @@ int RTFDocumentImpl::pushState()
m_nGroupStartPos = Strm().Tell();
RTFParserState aState;
if (m_aStates.empty())
- aState = m_aDefaultState;
+ aState = m_aDefaultState.Clone();
else
- aState = m_aStates.top();
+ aState = m_aStates.top().Clone();
m_aStates.push(aState);
m_nGroup++;
@@ -2788,6 +2788,26 @@ RTFParserState::RTFParserState()
{
}
+RTFParserState RTFParserState::Clone()
+{
+ RTFParserState aRet(*this);
+ aRet.aTableSprms = RTFSprm::Clone(aTableSprms);
+ aRet.aTableAttributes = RTFSprm::Clone(aTableAttributes);
+ aRet.aCharacterSprms = RTFSprm::Clone(aCharacterSprms);
+ aRet.aCharacterAttributes = RTFSprm::Clone(aCharacterAttributes);
+ aRet.aParagraphSprms = RTFSprm::Clone(aParagraphSprms);
+ aRet.aParagraphAttributes = RTFSprm::Clone(aParagraphAttributes);
+ aRet.aSectionSprms = RTFSprm::Clone(aSectionSprms);
+ aRet.aSectionAttributes = RTFSprm::Clone(aSectionAttributes);
+ aRet.aTableRowSprms = RTFSprm::Clone(aTableRowSprms);
+ aRet.aTableRowAttributes = RTFSprm::Clone(aTableRowAttributes);
+ aRet.aTableCellSprms = RTFSprm::Clone(aTableCellSprms);
+ aRet.aTableCellAttributes = RTFSprm::Clone(aTableCellAttributes);
+ aRet.aTabAttributes = RTFSprm::Clone(aTabAttributes);
+ aRet.aListLevelEntries = RTFSprm::Clone(aListLevelEntries);
+ return aRet;
+}
+
RTFColorTableEntry::RTFColorTableEntry()
: nRed(0),
nGreen(0),
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index a7bd0260c..401ea6933 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -180,6 +180,8 @@ namespace writerfilter {
{
public:
RTFParserState();
+ /// Does a deep copy of the state data.
+ RTFParserState Clone();
RTFInternalState nInternalState;
RTFDesitnationState nDestinationState;
RTFBorderState nBorderState;