diff options
author | Stef Walter <stef@memberwebs.com> | 2004-07-11 21:33:06 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-07-11 21:33:06 +0000 |
commit | 6469807b6ca403cb585616fe3b9c0607ba391529 (patch) | |
tree | 7e55e57e28e39c0f2f43d0523cded967053f3f2d | |
parent | 6e217760d3d737a4d291f21764a227b3abea8060 (diff) |
Some level fixes
-rw-r--r-- | src/xmlcomposehelpers.cpp | 20 | ||||
-rw-r--r-- | src/xmlcomposehelpers.h | 2 | ||||
-rw-r--r-- | src/xmlcomposer.cpp | 17 |
3 files changed, 21 insertions, 18 deletions
diff --git a/src/xmlcomposehelpers.cpp b/src/xmlcomposehelpers.cpp index a1bc73f..6612df9 100644 --- a/src/xmlcomposehelpers.cpp +++ b/src/xmlcomposehelpers.cpp @@ -58,7 +58,10 @@ Level::Level(const Level& level) : Level::~Level() { - + if(m_analyser) + m_analyser->done(); + if(m_destination) + m_destination->done(); } LevelPtr Level::pushLevel() @@ -106,15 +109,21 @@ void Level::setAnalyser(AnalyserPtr analyser, bool deep) { if(deep && m_previous && !m_analyser) m_previous->setAnalyser(analyser, deep); + else + { + if(m_analyser != NULL) + m_analyser->done(); + m_analyser = analyser; + } } -DestinationPtr Level::getDestination() +DestinationPtr Level::getDestination(bool deep) { if(m_destination) return m_destination; - else if(m_previous) + else if(deep && m_previous) return m_previous->getDestination(); else return NULL; @@ -125,7 +134,12 @@ void Level::setDestination(DestinationPtr destination, bool deep) if(deep && m_previous && !m_destination) m_previous->setDestination(destination, deep); else + { + if(m_destination != NULL) + m_destination->done(); + m_destination = destination; + } } RtfFormatting& Level::getFormatting() diff --git a/src/xmlcomposehelpers.h b/src/xmlcomposehelpers.h index 8d7e515..f91923e 100644 --- a/src/xmlcomposehelpers.h +++ b/src/xmlcomposehelpers.h @@ -103,7 +103,7 @@ public: void setElement(DOM::Element element, bool deep = false); AnalyserPtr getAnalyser(bool deep = true); void setAnalyser(AnalyserPtr analyser, bool deep = false); - DestinationPtr getDestination(); + DestinationPtr getDestination(bool deep = true); void setDestination(DestinationPtr destination, bool deep = false); RtfFormatting& getFormatting(); void setTextProperties(RtfFormatting& textProperties); diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp index 11ed2a0..4091adb 100644 --- a/src/xmlcomposer.cpp +++ b/src/xmlcomposer.cpp @@ -280,22 +280,11 @@ void RtfParser::groupEnd() ASSERT(m_curLevel != NULL); bool done = true; - // First see if this level has an ananlyser - AnalyserPtr analyser = m_curLevel->getAnalyser(false); - if(!analyser) - { - // If not then the analyser is going to live and we - // get one from a previous level - done = false; - analyser = m_curLevel->getAnalyser(); - } + LevelHandler::groupEnd(); - if(done) - analyser->done(); - else + AnalyserPtr analyser = m_curLevel->getAnalyser(); + if(analyser) analyser->groupEnd(); - - LevelHandler::groupEnd(); } #define ON_INITIALIZE(cls) \ |