[Libreoffice-commits] .: 2 commits - writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Jun 11 07:29:06 PDT 2012


 writerfilter/source/doctok/WW8ResourceModelImpl.cxx |    2 -
 writerfilter/source/resourcemodel/resourcemodel.cxx |   32 ++++++++++----------
 writerfilter/source/resourcemodel/resourcemodel.hxx |   11 +++++-
 3 files changed, 25 insertions(+), 20 deletions(-)

New commits:
commit 00c23c39f512090cc70e975a27f3636d7b14f29c
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Jun 11 16:26:35 2012 +0200

    writerfilter/resourcemodel: don't use a global variable here
    
    Change-Id: I064070a51cb87c10c72917b19969672d2121be7a

diff --git a/writerfilter/source/resourcemodel/resourcemodel.cxx b/writerfilter/source/resourcemodel/resourcemodel.cxx
index 017fa66..7fea143 100644
--- a/writerfilter/source/resourcemodel/resourcemodel.cxx
+++ b/writerfilter/source/resourcemodel/resourcemodel.cxx
@@ -209,8 +209,6 @@ void WW8TableManager::endParagraphGroup()
     TableManager<string, TablePropsRef_t>::endParagraphGroup();
 }
 
-WW8TableManager gTableManager;
-
 /* WW8StreamHandler */
 
 WW8StreamHandler::WW8StreamHandler()
@@ -218,12 +216,14 @@ WW8StreamHandler::WW8StreamHandler()
 {
     output.closeGroup();
     output.addItem("<stream>");
-    gTableManager.startLevel();
+    mpTableManager = new WW8TableManager;
+    mpTableManager->startLevel();
 }
 
 WW8StreamHandler::~WW8StreamHandler()
 {
-    gTableManager.endLevel();
+    mpTableManager->endLevel();
+    delete mpTableManager;
 
     output.closeGroup();
     output.addItem("</stream>");
@@ -244,13 +244,13 @@ void WW8StreamHandler::startParagraphGroup()
     output.openGroup();
     output.addItem("<paragraph-group>");
 
-    gTableManager.startParagraphGroup();
-    gTableManager.handle(gInfo);
+    mpTableManager->startParagraphGroup();
+    mpTableManager->handle(gInfo);
 }
 
 void WW8StreamHandler::endParagraphGroup()
 {
-    gTableManager.endParagraphGroup();
+    mpTableManager->endParagraphGroup();
 
     output.addItem("</paragraph-group>");
     output.closeGroup();
@@ -316,7 +316,7 @@ void WW8StreamHandler::text(const sal_uInt8 * data, size_t len)
 
     output.addItem(tmpStr);
 
-    gTableManager.text(data, len);
+    mpTableManager->text(data, len);
 }
 
 void WW8StreamHandler::utext(const sal_uInt8 * data, size_t len)
@@ -357,26 +357,26 @@ void WW8StreamHandler::utext(const sal_uInt8 * data, size_t len)
 
     output.addItem(tmpStr);
 
-    gTableManager.utext(data, len);
+    mpTableManager->utext(data, len);
 
     mnUTextCount++;
 }
 
 void WW8StreamHandler::props(writerfilter::Reference<Properties>::Pointer_t ref)
 {
-    WW8PropertiesHandler aHandler;
+    WW8PropertiesHandler aHandler(mpTableManager);
 
     output.addItem("<properties type=\"" + ref->getType() + "\">");
     ref->resolve(aHandler);
 
-    //gTableManager.props(ref);
+    //mpTableManager->props(ref);
 
     output.addItem("</properties>");
 }
 
 void WW8StreamHandler::table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
 {
-    WW8TableHandler aHandler;
+    WW8TableHandler aHandler(mpTableManager);
 
     output.addItem("<table id=\"" + (*QNameToString::Instance())(name)
                    + "\">");
@@ -399,11 +399,11 @@ void WW8StreamHandler::substream(Id name,
     output.addItem("<substream name=\"" + (*QNameToString::Instance())(name)
                    + "\">");
 
-    gTableManager.startLevel();
+    mpTableManager->startLevel();
 
     ref->resolve(*this);
 
-    gTableManager.endLevel();
+    mpTableManager->endLevel();
 
     output.addItem("</substream>");
 }
@@ -525,7 +525,7 @@ void WW8PropertiesHandler::sprm(Sprm & sprm_)
         output.addItem("</stream>");
     }
 
-    gTableManager.sprm(sprm_);
+    mpTableManager->sprm(sprm_);
 
     output.addItem("</sprm>");
 }
@@ -535,7 +535,7 @@ void WW8TableHandler::entry(int /*pos*/,
 {
     output.addItem("<tableentry>");
 
-    WW8PropertiesHandler aHandler;
+    WW8PropertiesHandler aHandler(mpTableManager);
 
     try
     {
diff --git a/writerfilter/source/resourcemodel/resourcemodel.hxx b/writerfilter/source/resourcemodel/resourcemodel.hxx
index 02caa04..e050d45 100644
--- a/writerfilter/source/resourcemodel/resourcemodel.hxx
+++ b/writerfilter/source/resourcemodel/resourcemodel.hxx
@@ -28,9 +28,11 @@
 #include <resourcemodel/WW8ResourceModel.hxx>
 
 namespace writerfilter {
+class WW8TableManager;
 class WW8StreamHandler : public Stream
 {
     int mnUTextCount;
+    WW8TableManager* mpTableManager;
 
 public:
     WW8StreamHandler();
@@ -62,9 +64,11 @@ class WW8PropertiesHandler : public Properties
     typedef boost::shared_ptr<Sprm> SprmSharedPointer_t;
     typedef vector<SprmSharedPointer_t> SprmPointers_t;
     SprmPointers_t sprms;
+    WW8TableManager* mpTableManager;
 
 public:
-    WW8PropertiesHandler()
+    WW8PropertiesHandler(WW8TableManager* pTableManager)
+        : mpTableManager(pTableManager)
     {
     }
 
@@ -96,8 +100,11 @@ public:
 
 class WW8TableHandler : public Table
 {
+    WW8TableManager* mpTableManager;
+
 public:
-    WW8TableHandler()
+    WW8TableHandler(WW8TableManager* pTableManager)
+        : mpTableManager(pTableManager)
     {
     }
 
commit ea8347d079b0d47c8f2be4b89e7ae806930e1d95
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Jun 11 16:15:07 2012 +0200

    writerfilter/doctok: unused global variable
    
    Change-Id: I93c9c6e267270a07bd98ea408f0d6f78759265bb

diff --git a/writerfilter/source/doctok/WW8ResourceModelImpl.cxx b/writerfilter/source/doctok/WW8ResourceModelImpl.cxx
index 60eff45..bbbcc68 100644
--- a/writerfilter/source/doctok/WW8ResourceModelImpl.cxx
+++ b/writerfilter/source/doctok/WW8ResourceModelImpl.cxx
@@ -152,8 +152,6 @@ void WW8TableManager::endParagraphGroup()
     TableManager<string, TablePropsPointer_t>::endParagraphGroup();
 }
 
-WW8TableManager gTableManager;
-
 
 //-------- WW8TableReference -----------------------------------
 


More information about the Libreoffice-commits mailing list