[Libreoffice-commits] libvisio.git: src/lib

Fridrich Å trba fridrich.strba at bluewin.ch
Sat Jul 20 05:23:07 PDT 2013


 src/lib/Makefile.am    |    2 +
 src/lib/VSDXParser.cpp |   15 ++++++------
 src/lib/VSDXParser.h   |    2 +
 src/lib/VSDXTheme.cpp  |   57 +++++++++++++++++++++++++++++++++++++++++++++++++
 src/lib/VSDXTheme.h    |   55 +++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 123 insertions(+), 8 deletions(-)

New commits:
commit 232fedbe3421dc256a77ac49519cce9322479ce3
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Sat Jul 20 14:22:39 2013 +0200

    Stub the theme class to keep theme information

diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 869beec..c5b5d45 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -75,6 +75,8 @@ libtokenmap_la_SOURCES = \
 	VSDXMLTokenMap.h \
 	VSDXParser.cpp \
 	VSDXParser.h \
+	VSDXTheme.cpp \
+	VSDXTheme.h \
 	$(generated_files)
 	
 
diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp
index b1dee7d..730a353 100644
--- a/src/lib/VSDXParser.cpp
+++ b/src/lib/VSDXParser.cpp
@@ -67,7 +67,12 @@ std::string getRelationshipsForTarget(const char *target)
 
 
 libvisio::VSDXParser::VSDXParser(WPXInputStream *input, libwpg::WPGPaintInterface *painter)
-  : VSDXMLParserBase(), m_input(input), m_painter(painter), m_currentDepth(0), m_rels(0)
+  : VSDXMLParserBase(),
+    m_input(input),
+    m_painter(painter),
+    m_currentDepth(0),
+    m_rels(0),
+    m_currentTheme()
 {
   input->seek(0, WPX_SEEK_CUR);
   m_input = new VSDZipStream(input);
@@ -294,14 +299,8 @@ bool libvisio::VSDXParser::parseTheme(WPXInputStream *input, const char *name)
   WPXInputStream *stream = input->getDocumentOLEStream(name);
   if (!stream)
     return false;
-  WPXInputStream *relStream = input->getDocumentOLEStream(getRelationshipsForTarget(name).c_str());
-  input->seek(0, WPX_SEEK_SET);
-  VSDXRelationships rels(relStream);
-  if (relStream)
-    delete relStream;
-  rels.rebaseTargets(getTargetBaseDirectory(name).c_str());
 
-  processXmlDocument(stream, rels);
+  m_currentTheme.parse(stream);
 
   delete stream;
   return true;
diff --git a/src/lib/VSDXParser.h b/src/lib/VSDXParser.h
index 40c8847..dec2bbb 100644
--- a/src/lib/VSDXParser.h
+++ b/src/lib/VSDXParser.h
@@ -32,6 +32,7 @@
 
 #include <libwpd-stream/libwpd-stream.h>
 #include <libwpg/libwpg.h>
+#include "VSDXTheme.h"
 #include "VSDXMLParserBase.h"
 
 namespace libvisio
@@ -99,6 +100,7 @@ private:
   libwpg::WPGPaintInterface *m_painter;
   int m_currentDepth;
   VSDXRelationships *m_rels;
+  VSDXTheme m_currentTheme;
 };
 
 } // namespace libvisio
diff --git a/src/lib/VSDXTheme.cpp b/src/lib/VSDXTheme.cpp
new file mode 100644
index 0000000..616737c
--- /dev/null
+++ b/src/lib/VSDXTheme.cpp
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* libvisio
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2013 Fridrich Strba <fridrich.strba at bluewin.ch>
+ *
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
+ * instead of those above.
+ */
+
+#include "VSDXTheme.h"
+
+libvisio::VSDXTheme::VSDXTheme()
+{
+}
+
+libvisio::VSDXTheme::~VSDXTheme()
+{
+}
+
+bool libvisio::VSDXTheme::parse(WPXInputStream *input)
+{
+  if (!input)
+    return false;
+
+  try
+  {
+    return true;
+  }
+  catch (...)
+  {
+    return false;
+  }
+  return false;
+}
+
+
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/VSDXTheme.h b/src/lib/VSDXTheme.h
new file mode 100644
index 0000000..41e806c
--- /dev/null
+++ b/src/lib/VSDXTheme.h
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* libvisio
+ * Version: MPL 1.1 / GPLv2+ / LGPLv2+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2013 Fridrich Strba <fridrich.strba at bluewin.ch>
+ *
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
+ * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
+ * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
+ * instead of those above.
+ */
+
+#ifndef __VSDXTHEME_H__
+#define __VSDXTHEME_H__
+
+#include <libwpd-stream/libwpd-stream.h>
+
+namespace libvisio
+{
+
+class VSDCollector;
+
+class VSDXTheme
+{
+public:
+  VSDXTheme();
+  ~VSDXTheme();
+  bool parse(WPXInputStream *input);
+
+private:
+  VSDXTheme(const VSDXTheme &);
+  VSDXTheme &operator=(const VSDXTheme &);
+};
+
+} // namespace libvisio
+
+#endif // __VSDXTHEME_H__
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */


More information about the Libreoffice-commits mailing list