summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStef <stef@ws.local>2004-07-11 21:33:06 +0000
committerStef <stef@ws.local>2004-07-11 21:33:06 +0000
commit9e0f8dfa9a67b5ceb37db033df4db2b46874aa87 (patch)
tree7e55e57e28e39c0f2f43d0523cded967053f3f2d /src
parent7f776ee854b84c51b471c69a702152feb5672bdb (diff)
Some level fixes
Diffstat (limited to 'src')
-rw-r--r--src/xmlcomposehelpers.cpp20
-rw-r--r--src/xmlcomposehelpers.h2
-rw-r--r--src/xmlcomposer.cpp17
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) \