summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am5
-rw-r--r--src/conv/Makefile.am5
-rw-r--r--src/conv/raw/.gitignore10
-rw-r--r--src/conv/raw/Makefile.am41
-rw-r--r--src/conv/raw/emfp2raw.cpp68
-rw-r--r--src/conv/raw/emfp2raw.rc.in31
-rw-r--r--src/conv/svg/.gitignore10
-rw-r--r--src/conv/svg/Makefile.am29
-rw-r--r--src/conv/svg/emfp2xhtml.cpp97
-rw-r--r--src/conv/svg/emfp2xhtml.rc.in31
-rw-r--r--src/conv/text/.gitignore10
-rw-r--r--src/conv/text/Makefile.am41
-rw-r--r--src/conv/text/emfp2text.cpp72
-rw-r--r--src/conv/text/emfp2text.rc.in31
-rw-r--r--src/lib/.gitignore8
-rw-r--r--src/lib/EMFPCollector.cpp21
-rw-r--r--src/lib/EMFPCollector.h43
-rw-r--r--src/lib/EMFPDocument.cpp40
-rw-r--r--src/lib/EMFPParser.cpp30
-rw-r--r--src/lib/EMFPParser.h37
-rw-r--r--src/lib/Makefile.am41
-rw-r--r--src/lib/libemfp.rc.in31
-rw-r--r--src/lib/libemfp_utils.cpp60
-rw-r--r--src/lib/libemfp_utils.h79
24 files changed, 871 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..64fd45e
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = lib
+
+if BUILD_TOOLS
+SUBDIRS += conv
+endif
diff --git a/src/conv/Makefile.am b/src/conv/Makefile.am
new file mode 100644
index 0000000..f46e7d9
--- /dev/null
+++ b/src/conv/Makefile.am
@@ -0,0 +1,5 @@
+if BUILD_TOOLS
+
+SUBDIRS = raw svg text
+
+endif
diff --git a/src/conv/raw/.gitignore b/src/conv/raw/.gitignore
new file mode 100644
index 0000000..a36b123
--- /dev/null
+++ b/src/conv/raw/.gitignore
@@ -0,0 +1,10 @@
+.deps
+.libs
+*.lo
+*.la
+*.o
+Makefile
+Makefile.in
+emfp2raw
+*.rc
+*.exe
diff --git a/src/conv/raw/Makefile.am b/src/conv/raw/Makefile.am
new file mode 100644
index 0000000..a62271e
--- /dev/null
+++ b/src/conv/raw/Makefile.am
@@ -0,0 +1,41 @@
+if BUILD_TOOLS
+
+bin_PROGRAMS = emfp2raw
+
+AM_CXXFLAGS = \
+ -I$(top_srcdir)/inc \
+ -I$(top_srcdir)/src/lib \
+ -I$(top_builddir)/src/lib \
+ $(REVENGE_CFLAGS) \
+ $(REVENGE_GENERATORS_CFLAGS) \
+ $(REVENGE_STREAM_CFLAGS) \
+ $(DEBUG_CXXFLAGS)
+
+emfp2raw_DEPENDENCIES = @EMFP2RAW_WIN32_RESOURCE@
+
+emfp2raw_LDADD = \
+ ../../lib/libemfp-@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.la \
+ $(REVENGE_GENERATORS_LIBS) \
+ $(REVENGE_LIBS) \
+ $(REVENGE_STREAM_LIBS) \
+ @EMFP2RAW_WIN32_RESOURCE@
+
+emfp2raw_SOURCES = \
+ emfp2raw.cpp
+
+if OS_WIN32
+
+@EMFP2RAW_WIN32_RESOURCE@ : emfp2raw.rc $(emfp2raw_OBJECTS)
+ chmod +x $(top_srcdir)/build/win32/*compile-resource
+ WINDRES=@WINDRES@ $(top_srcdir)/build/win32/lt-compile-resource emfp2raw.rc @EMFP2RAW_WIN32_RESOURCE@
+endif
+
+EXTRA_DIST = \
+ $(emfp2raw_SOURCES) \
+ emfp2raw.rc.in
+
+# These may be in the builddir too
+BUILD_EXTRA_DIST = \
+ emfp2raw.rc
+
+endif # BUILD_TOOLS
diff --git a/src/conv/raw/emfp2raw.cpp b/src/conv/raw/emfp2raw.cpp
new file mode 100644
index 0000000..8121f79
--- /dev/null
+++ b/src/conv/raw/emfp2raw.cpp
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libemfp project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <librevenge-stream/librevenge-stream.h>
+#include <librevenge/librevenge.h>
+#include <librevenge-generators/librevenge-generators.h>
+#include <libemfp/libemfp.h>
+
+namespace
+{
+
+int printUsage()
+{
+ printf("Usage: emfp2raw [OPTION] <EMF+ Document>\n");
+ printf("\n");
+ printf("Options:\n");
+ printf("--callgraph Display the call graph nesting level\n");
+ printf("--help Shows this help message\n");
+ return -1;
+}
+
+} // anonymous namespace
+
+int main(int argc, char *argv[])
+{
+ bool printIndentLevel = false;
+ char *file = 0;
+
+ if (argc < 2)
+ return printUsage();
+
+ for (int i = 1; i < argc; i++)
+ {
+ if (!strcmp(argv[i], "--callgraph"))
+ printIndentLevel = true;
+ else if (!file && strncmp(argv[i], "--", 2))
+ file = argv[i];
+ else
+ return printUsage();
+ }
+
+ if (!file)
+ return printUsage();
+
+ librevenge::RVNGFileStream input(file);
+
+ if (!libemfp::EMFPDocument::isSupported(&input))
+ {
+ fprintf(stderr, "ERROR: Unsupported file format!\n");
+ return 1;
+ }
+
+ librevenge::RVNGRawDrawingGenerator painter(printIndentLevel);
+ libemfp::EMFPDocument::parse(&input, &painter);
+
+ return 0;
+}
+
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/conv/raw/emfp2raw.rc.in b/src/conv/raw/emfp2raw.rc.in
new file mode 100644
index 0000000..fe41677
--- /dev/null
+++ b/src/conv/raw/emfp2raw.rc.in
@@ -0,0 +1,31 @@
+#include <winver.h>
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @EMFP_MAJOR_VERSION@,@EMFP_MINOR_VERSION@,@EMFP_MICRO_VERSION@,BUILDNUMBER
+ PRODUCTVERSION @EMFP_MAJOR_VERSION@,@EMFP_MINOR_VERSION@,@EMFP_MICRO_VERSION@,0
+ FILEFLAGSMASK 0
+ FILEFLAGS 0
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_APP
+ FILESUBTYPE VFT2_UNKNOWN
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "The libemfp developer community"
+ VALUE "FileDescription", "emfp2raw"
+ VALUE "FileVersion", "@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.@EMFP_MICRO_VERSION@.BUILDNUMBER"
+ VALUE "InternalName", "emfp2raw"
+ VALUE "LegalCopyright", "Copyright (C) 2004 Marc Oude Kotte, other contributers"
+ VALUE "OriginalFilename", "emfp2raw.exe"
+ VALUE "ProductName", "libemfp"
+ VALUE "ProductVersion", "@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.@EMFP_MICRO_VERSION@"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+ END
+
diff --git a/src/conv/svg/.gitignore b/src/conv/svg/.gitignore
new file mode 100644
index 0000000..7a3ca4d
--- /dev/null
+++ b/src/conv/svg/.gitignore
@@ -0,0 +1,10 @@
+.deps
+.libs
+*.lo
+*.la
+*.o
+Makefile
+Makefile.in
+emfp2xhtml
+*.rc
+*.exe
diff --git a/src/conv/svg/Makefile.am b/src/conv/svg/Makefile.am
new file mode 100644
index 0000000..d2981a9
--- /dev/null
+++ b/src/conv/svg/Makefile.am
@@ -0,0 +1,29 @@
+if BUILD_TOOLS
+
+bin_PROGRAMS = emfp2xhtml
+
+AM_CXXFLAGS = -I$(top_srcdir)/inc -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib $(REVENGE_CFLAGS) $(REVENGE_STREAM_CFLAGS) $(DEBUG_CXXFLAGS)
+
+emfp2xhtml_DEPENDENCIES = @EMFP2XHTML_WIN32_RESOURCE@
+
+emfp2xhtml_LDADD = ../../lib/libemfp-@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.la $(REVENGE_LIBS) $(REVENGE_STREAM_LIBS) @EMFP2XHTML_WIN32_RESOURCE@
+
+emfp2xhtml_SOURCES = \
+ emfp2xhtml.cpp
+
+if OS_WIN32
+
+@EMFP2XHTML_WIN32_RESOURCE@ : emfp2xhtml.rc $(emfp2xhtml_OBJECTS)
+ chmod +x $(top_srcdir)/build/win32/*compile-resource
+ WINDRES=@WINDRES@ $(top_srcdir)/build/win32/lt-compile-resource emfp2xhtml.rc @EMFP2XHTML_WIN32_RESOURCE@
+endif
+
+EXTRA_DIST = \
+ $(emfp2xhtml_SOURCES) \
+ emfp2xhtml.rc.in
+
+# These may be in the builddir too
+BUILD_EXTRA_DIST = \
+ emfp2xhtml.rc
+
+endif # BUILD_TOOLS
diff --git a/src/conv/svg/emfp2xhtml.cpp b/src/conv/svg/emfp2xhtml.cpp
new file mode 100644
index 0000000..20ac103
--- /dev/null
+++ b/src/conv/svg/emfp2xhtml.cpp
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libemfp project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <iostream>
+#include <sstream>
+#include <stdio.h>
+#include <string.h>
+#include <librevenge-stream/librevenge-stream.h>
+#include <librevenge/librevenge.h>
+#include <libemfp/libemfp.h>
+
+namespace
+{
+
+int printUsage()
+{
+ printf("Usage: emfp2xhtml [OPTION] <EMF+ Document>\n");
+ printf("\n");
+ printf("Options:\n");
+ printf("--help Shows this help message\n");
+ return -1;
+}
+
+} // anonymous namespace
+
+int main(int argc, char *argv[])
+{
+ if (argc < 2)
+ return printUsage();
+
+ char *file = 0;
+
+ for (int i = 1; i < argc; i++)
+ {
+ if (!file && strncmp(argv[i], "--", 2))
+ file = argv[i];
+ else
+ return printUsage();
+ }
+
+ if (!file)
+ return printUsage();
+
+ librevenge::RVNGFileStream input(file);
+
+ if (!libemfp::EMFPDocument::isSupported(&input))
+ {
+ std::cerr << "ERROR: Unsupported file format!" << std::endl;
+ return 1;
+ }
+
+ librevenge::RVNGStringVector output;
+ librevenge::RVNGSVGDrawingGenerator generator(output, "svg");
+ if (!libemfp::EMFPDocument::parse(&input, &generator))
+ {
+ std::cerr << "ERROR: SVG Generation failed!" << std::endl;
+ return 1;
+ }
+
+ if (output.empty())
+ {
+ std::cerr << "ERROR: No SVG document generated!" << std::endl;
+ return 1;
+ }
+
+ std::cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
+ std::cout << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">" << std::endl;
+ std::cout << "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">" << std::endl;
+ std::cout << "<body>" << std::endl;
+ std::cout << "<?import namespace=\"svg\" urn=\"http://www.w3.org/2000/svg\"?>" << std::endl;
+
+ for (unsigned k = 0; k<output.size(); ++k)
+ {
+ if (k>0)
+ std::cout << "<hr/>\n";
+
+ std::cout << "<!-- \n";
+ std::cout << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
+ std::cout << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"";
+ std::cout << " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
+ std::cout << " -->\n";
+
+ std::cout << output[k].cstr() << std::endl;
+ }
+
+ std::cout << "</body>" << std::endl;
+ std::cout << "</html>" << std::endl;
+
+ return 0;
+}
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/conv/svg/emfp2xhtml.rc.in b/src/conv/svg/emfp2xhtml.rc.in
new file mode 100644
index 0000000..b6cf389
--- /dev/null
+++ b/src/conv/svg/emfp2xhtml.rc.in
@@ -0,0 +1,31 @@
+#include <winver.h>
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @EMFP_MAJOR_VERSION@,@EMFP_MINOR_VERSION@,@EMFP_MICRO_VERSION@,BUILDNUMBER
+ PRODUCTVERSION @EMFP_MAJOR_VERSION@,@EMFP_MINOR_VERSION@,@EMFP_MICRO_VERSION@,0
+ FILEFLAGSMASK 0
+ FILEFLAGS 0
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_APP
+ FILESUBTYPE VFT2_UNKNOWN
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "The libemfp developer community"
+ VALUE "FileDescription", "emfp2xhtml"
+ VALUE "FileVersion", "@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.@EMFP_MICRO_VERSION@.BUILDNUMBER"
+ VALUE "InternalName", "emfp2xhtml"
+ VALUE "LegalCopyright", "Copyright (C) 2011 Fridrich Strba, other contribut0rs"
+ VALUE "OriginalFilename", "emfp2xhtml.exe"
+ VALUE "ProductName", "libemfp"
+ VALUE "ProductVersion", "@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.@EMFP_MICRO_VERSION@"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+ END
+
diff --git a/src/conv/text/.gitignore b/src/conv/text/.gitignore
new file mode 100644
index 0000000..7baf37f
--- /dev/null
+++ b/src/conv/text/.gitignore
@@ -0,0 +1,10 @@
+.deps
+.libs
+*.lo
+*.la
+*.o
+Makefile
+Makefile.in
+emfp2text
+*.rc
+*.exe
diff --git a/src/conv/text/Makefile.am b/src/conv/text/Makefile.am
new file mode 100644
index 0000000..510dfdd
--- /dev/null
+++ b/src/conv/text/Makefile.am
@@ -0,0 +1,41 @@
+if BUILD_TOOLS
+
+bin_PROGRAMS = emfp2text
+
+AM_CXXFLAGS = \
+ -I$(top_srcdir)/inc \
+ -I$(top_srcdir)/src/lib \
+ -I$(top_builddir)/src/lib \
+ $(REVENGE_CFLAGS) \
+ $(REVENGE_GENERATORS_CFLAGS) \
+ $(REVENGE_STREAM_CFLAGS) \
+ $(DEBUG_CXXFLAGS)
+
+emfp2text_DEPENDENCIES = @EMFP2TEXT_WIN32_RESOURCE@
+
+emfp2text_LDADD = \
+ ../../lib/libemfp-@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.la \
+ $(REVENGE_GENERATORS_LIBS) \
+ $(REVENGE_LIBS) \
+ $(REVENGE_STREAM_LIBS) \
+ @EMFP2TEXT_WIN32_RESOURCE@
+
+emfp2text_SOURCES = \
+ emfp2text.cpp
+
+if OS_WIN32
+
+@EMFP2TEXT_WIN32_RESOURCE@ : emfp2text.rc $(emfp2text_OBJECTS)
+ chmod +x $(top_srcdir)/build/win32/*compile-resource
+ WINDRES=@WINDRES@ $(top_srcdir)/build/win32/lt-compile-resource emfp2text.rc @EMFP2TEXT_WIN32_RESOURCE@
+endif
+
+EXTRA_DIST = \
+ $(emfp2text_SOURCES) \
+ emfp2text.rc.in
+
+# These may be in the builddir too
+BUILD_EXTRA_DIST = \
+ emfp2text.rc
+
+endif # BUILD_TOOLS
diff --git a/src/conv/text/emfp2text.cpp b/src/conv/text/emfp2text.cpp
new file mode 100644
index 0000000..a6bd968
--- /dev/null
+++ b/src/conv/text/emfp2text.cpp
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libemfp project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <librevenge-stream/librevenge-stream.h>
+#include <librevenge-generators/librevenge-generators.h>
+#include <librevenge/librevenge.h>
+#include <libemfp/libemfp.h>
+
+namespace
+{
+
+int printUsage()
+{
+ printf("Usage: emfp2text [OPTION] <EMF+ Document>\n");
+ printf("\n");
+ printf("Options:\n");
+ printf("--help Shows this help message\n");
+ return -1;
+}
+
+} // anonymous namespace
+
+int main(int argc, char *argv[])
+{
+ if (argc < 2)
+ return printUsage();
+
+ char *file = 0;
+
+ for (int i = 1; i < argc; i++)
+ {
+ if (!file && strncmp(argv[i], "--", 2))
+ file = argv[i];
+ else
+ return printUsage();
+ }
+
+ if (!file)
+ return printUsage();
+
+ librevenge::RVNGFileStream input(file);
+
+ if (!libemfp::EMFPDocument::isSupported(&input))
+ {
+ fprintf(stderr, "ERROR: Unsupported file format (unsupported version) or file is encrypted!\n");
+ return 1;
+ }
+
+ librevenge::RVNGStringVector pages;
+ librevenge::RVNGTextDrawingGenerator painter(pages);
+ if (!libemfp::EMFPDocument::parse(&input, &painter))
+ {
+ fprintf(stderr, "ERROR: Parsing of document failed!\n");
+ return 1;
+ }
+
+ for (unsigned i = 0; i != pages.size(); ++i)
+ printf("%s", pages[i].cstr());
+
+ return 0;
+}
+
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/conv/text/emfp2text.rc.in b/src/conv/text/emfp2text.rc.in
new file mode 100644
index 0000000..660f941
--- /dev/null
+++ b/src/conv/text/emfp2text.rc.in
@@ -0,0 +1,31 @@
+#include <winver.h>
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @EMFP_MAJOR_VERSION@,@EMFP_MINOR_VERSION@,@EMFP_MICRO_VERSION@,BUILDNUMBER
+ PRODUCTVERSION @EMFP_MAJOR_VERSION@,@EMFP_MINOR_VERSION@,@EMFP_MICRO_VERSION@,0
+ FILEFLAGSMASK 0
+ FILEFLAGS 0
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_APP
+ FILESUBTYPE VFT2_UNKNOWN
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "The libemfp developer community"
+ VALUE "FileDescription", "emfp2text"
+ VALUE "FileVersion", "@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.@EMFP_MICRO_VERSION@.BUILDNUMBER"
+ VALUE "InternalName", "emfp2text"
+ VALUE "LegalCopyright", "Copyright (C) 2011 Fridrich Strba, other contribut0rs"
+ VALUE "OriginalFilename", "emfp2text.exe"
+ VALUE "ProductName", "libemfp"
+ VALUE "ProductVersion", "@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.@EMFP_MICRO_VERSION@"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+ END
+
diff --git a/src/lib/.gitignore b/src/lib/.gitignore
new file mode 100644
index 0000000..3273b70
--- /dev/null
+++ b/src/lib/.gitignore
@@ -0,0 +1,8 @@
+.deps
+.libs
+*.lo
+*.la
+*.o
+*.rc
+Makefile
+Makefile.in
diff --git a/src/lib/EMFPCollector.cpp b/src/lib/EMFPCollector.cpp
new file mode 100644
index 0000000..a209398
--- /dev/null
+++ b/src/lib/EMFPCollector.cpp
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libemfp project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "EMFPCollector.h"
+
+libemfp::EMFPCollector::EMFPCollector(librevenge::RVNGDrawingInterface *painter) :
+ m_painter(painter)
+{
+}
+
+libemfp::EMFPCollector::~EMFPCollector()
+{
+}
+
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/EMFPCollector.h b/src/lib/EMFPCollector.h
new file mode 100644
index 0000000..79be298
--- /dev/null
+++ b/src/lib/EMFPCollector.h
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libemfp project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __EMFPCOLLECTOR_H__
+#define __EMFPCOLLECTOR_H__
+
+namespace librevenge
+{
+
+class RVNGDrawingInterface;
+
+} // namespace librevenge
+
+namespace libemfp
+{
+
+class EMFPCollector
+{
+public:
+ EMFPCollector(::librevenge::RVNGDrawingInterface *painter);
+ virtual ~EMFPCollector();
+
+ // collector functions
+
+private:
+ EMFPCollector(const EMFPCollector &);
+ EMFPCollector &operator=(const EMFPCollector &);
+
+ // helper functions
+
+ librevenge::RVNGDrawingInterface *m_painter;
+};
+
+} // namespace libemfp
+
+#endif /* __EMFPCOLLECTOR_H__ */
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/EMFPDocument.cpp b/src/lib/EMFPDocument.cpp
new file mode 100644
index 0000000..eb20f5a
--- /dev/null
+++ b/src/lib/EMFPDocument.cpp
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libemfp project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sstream>
+#include <string>
+#include <string.h>
+#include <libemfp/libemfp.h>
+#include "libemfp_utils.h"
+
+/**
+Analyzes the content of an input stream to see if it can be parsed
+\param input The input stream
+\return A value that indicates whether the content from the input
+stream is a EMF+ Document that libemfp is able to parse
+*/
+bool libemfp::EMFPDocument::isSupported(librevenge::RVNGInputStream *input)
+{
+ return false;
+}
+
+/**
+Parses the input stream content. It will make callbacks to the functions provided by a
+RVNGDrawingInterface class implementation when needed. This is often commonly called the
+'main parsing routine'.
+\param input The input stream
+\param painter A EMFPPainterInterface implementation
+\return A value that indicates whether the parsing was successful
+*/
+bool libemfp::EMFPDocument::parse(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter)
+{
+ return false;
+}
+
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/EMFPParser.cpp b/src/lib/EMFPParser.cpp
new file mode 100644
index 0000000..2af411a
--- /dev/null
+++ b/src/lib/EMFPParser.cpp
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libemfp project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sstream>
+#include <string>
+#include <string.h>
+#include "EMFPParser.h"
+#include "EMFPCollector.h"
+
+libemfp::EMFPParser::EMFPParser(librevenge::RVNGInputStream *input, EMFPCollector *collector)
+ : m_input(input), m_collector(collector)
+{
+}
+
+libemfp::EMFPParser::~EMFPParser()
+{
+}
+
+bool libemfp::EMFPParser::parse()
+{
+ return false;
+}
+
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/EMFPParser.h b/src/lib/EMFPParser.h
new file mode 100644
index 0000000..f8f6a1a
--- /dev/null
+++ b/src/lib/EMFPParser.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libemfp project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __EMFPPARSER_H__
+#define __EMFPPARSER_H__
+
+#include <librevenge/librevenge.h>
+
+namespace libemfp
+{
+class EMFPCollector;
+
+class EMFPParser
+{
+public:
+ explicit EMFPParser(librevenge::RVNGInputStream *input, EMFPCollector *collector);
+ virtual ~EMFPParser();
+ bool parse();
+private:
+ EMFPParser();
+ EMFPParser(const EMFPParser &);
+ EMFPParser &operator=(const EMFPParser &);
+
+ librevenge::RVNGInputStream *m_input;
+ EMFPCollector *m_collector;
+};
+
+} // namespace libemfp
+
+#endif // __EMFPRAPHICS_H__
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
new file mode 100644
index 0000000..0f7d7b1
--- /dev/null
+++ b/src/lib/Makefile.am
@@ -0,0 +1,41 @@
+if PLATFORM_WIN32
+version_info = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -avoid-version
+else
+version_info = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+endif
+
+lib_LTLIBRARIES = libemfp-@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.la
+libemfp_@EMFP_MAJOR_VERSION@_@EMFP_MINOR_VERSION@_includedir = $(includedir)/libemfp-@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@/libemfp
+libemfp_@EMFP_MAJOR_VERSION@_@EMFP_MINOR_VERSION@_include_HEADERS = \
+ $(top_srcdir)/inc/libemfp/libemfp.h \
+ $(top_srcdir)/inc/libemfp/EMFPDocument.h
+
+AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(DEBUG_CXXFLAGS)
+
+libemfp_@EMFP_MAJOR_VERSION@_@EMFP_MINOR_VERSION@_la_LIBADD = $(REVENGE_LIBS) @LIBEMFP_WIN32_RESOURCE@
+libemfp_@EMFP_MAJOR_VERSION@_@EMFP_MINOR_VERSION@_la_DEPENDENCIES = @LIBEMFP_WIN32_RESOURCE@
+libemfp_@EMFP_MAJOR_VERSION@_@EMFP_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic -no_undefined
+libemfp_@EMFP_MAJOR_VERSION@_@EMFP_MINOR_VERSION@_la_SOURCES = \
+ EMFPCollector.cpp \
+ EMFPDocument.cpp \
+ EMFPParser.cpp \
+ libemfp_utils.cpp \
+ EMFPCollector.h \
+ EMFPParser.h \
+ libemfp_utils.h
+
+if OS_WIN32
+
+@LIBEMFP_WIN32_RESOURCE@ : libemfp.rc $(libemfp_@EMFP_MAJOR_VERSION@_@EMFP_MINOR_VERSION@_la_OBJECTS)
+ chmod +x $(top_srcdir)/build/win32/*compile-resource
+ WINDRES=@WINDRES@ $(top_srcdir)/build/win32/lt-compile-resource libemfp.rc @LIBEMFP_WIN32_RESOURCE@
+
+endif
+
+
+EXTRA_DIST = \
+ libemfp.rc.in
+
+# These may be in the builddir too
+BUILD_EXTRA_DIST = \
+ libemfp.rc
diff --git a/src/lib/libemfp.rc.in b/src/lib/libemfp.rc.in
new file mode 100644
index 0000000..ab2f584
--- /dev/null
+++ b/src/lib/libemfp.rc.in
@@ -0,0 +1,31 @@
+#include <winver.h>
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @EMFP_MAJOR_VERSION@,@EMFP_MINOR_VERSION@,@EMFP_MICRO_VERSION@,BUILDNUMBER
+ PRODUCTVERSION @EMFP_MAJOR_VERSION@,@EMFP_MINOR_VERSION@,@EMFP_MICRO_VERSION@,0
+ FILEFLAGSMASK 0
+ FILEFLAGS 0
+ FILEOS VOS__WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE VFT2_UNKNOWN
+ BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904B0"
+ BEGIN
+ VALUE "CompanyName", "The libemfp developer community"
+ VALUE "FileDescription", "libemfp"
+ VALUE "FileVersion", "@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.@EMFP_MICRO_VERSION@.BUILDNUMBER"
+ VALUE "InternalName", "libemfp-0.1"
+ VALUE "LegalCopyright", "Copyright (C) 2004 Marc Oude Kotte, other contributers"
+ VALUE "OriginalFilename", "libemfp-0.1.dll"
+ VALUE "ProductName", "libemfp"
+ VALUE "ProductVersion", "@EMFP_MAJOR_VERSION@.@EMFP_MINOR_VERSION@.@EMFP_MICRO_VERSION@"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+ END
+
diff --git a/src/lib/libemfp_utils.cpp b/src/lib/libemfp_utils.cpp
new file mode 100644
index 0000000..28712ca
--- /dev/null
+++ b/src/lib/libemfp_utils.cpp
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libemfp project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "libemfp_utils.h"
+
+#define EMFP_NUM_ELEMENTS(array) sizeof(array)/sizeof(array[0])
+
+uint8_t libemfp::readU8(librevenge::RVNGInputStream *input)
+{
+ if (!input || input->isEnd())
+ throw EndOfStreamException();
+ unsigned long numBytesRead;
+ uint8_t const *p = input->read(sizeof(uint8_t), numBytesRead);
+
+ if (p && numBytesRead == sizeof(uint8_t))
+ return *(uint8_t const *)(p);
+ throw EndOfStreamException();
+}
+
+uint16_t libemfp::readU16(librevenge::RVNGInputStream *input)
+{
+ uint16_t p0 = (uint16_t)readU8(input);
+ uint16_t p1 = (uint16_t)readU8(input);
+ return (uint16_t)(p0|(p1<<8));
+}
+
+uint32_t libemfp::readU32(librevenge::RVNGInputStream *input)
+{
+ uint32_t p0 = (uint32_t)readU8(input);
+ uint32_t p1 = (uint32_t)readU8(input);
+ uint32_t p2 = (uint32_t)readU8(input);
+ uint32_t p3 = (uint32_t)readU8(input);
+ return (uint32_t)(p0|(p1<<8)|(p2<<16)|(p3<<24));
+}
+
+int32_t libemfp::readS32(librevenge::RVNGInputStream *input)
+{
+ return (int32_t)readU32(input);
+}
+
+uint64_t libemfp::readU64(librevenge::RVNGInputStream *input)
+{
+ uint64_t p0 = (uint64_t)readU8(input);
+ uint64_t p1 = (uint64_t)readU8(input);
+ uint64_t p2 = (uint64_t)readU8(input);
+ uint64_t p3 = (uint64_t)readU8(input);
+ uint64_t p4 = (uint64_t)readU8(input);
+ uint64_t p5 = (uint64_t)readU8(input);
+ uint64_t p6 = (uint64_t)readU8(input);
+ uint64_t p7 = (uint64_t)readU8(input);
+ return (uint64_t)(p0|(p1<<8)|(p2<<16)|(p3<<24)|(p4<<32)|(p5<<40)|(p6<<48)|(p7<<56));
+}
+
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/libemfp_utils.h b/src/lib/libemfp_utils.h
new file mode 100644
index 0000000..ff01295
--- /dev/null
+++ b/src/lib/libemfp_utils.h
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * This file is part of the libemfp project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __LIBEMFP_UTILS_H__
+#define __LIBEMFP_UTILS_H__
+
+#include <stdio.h>
+#include <string>
+#include <librevenge/librevenge.h>
+#include <librevenge-stream/librevenge-stream.h>
+
+#ifdef _MSC_VER
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned uint32_t;
+typedef int int32_t;
+typedef unsigned __int64 uint64_t;
+
+#else
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
+#endif
+
+// debug message includes source file and line number
+//#define VERBOSE_DEBUG 1
+
+// do nothing with debug messages in a release compile
+#ifdef DEBUG
+#ifdef VERBOSE_DEBUG
+#define EMFP_DEBUG_MSG(M) printf("%15s:%5d: ", __FILE__, __LINE__); printf M
+#define EMFP_DEBUG(M) M
+#else
+#define EMFP_DEBUG_MSG(M) printf M
+#define EMFP_DEBUG(M) M
+#endif
+#else
+#define EMFP_DEBUG_MSG(M)
+#define EMFP_DEBUG(M)
+#endif
+
+namespace libemfp
+{
+
+uint8_t readU8(librevenge::RVNGInputStream *input);
+uint16_t readU16(librevenge::RVNGInputStream *input);
+uint32_t readU32(librevenge::RVNGInputStream *input);
+uint64_t readU64(librevenge::RVNGInputStream *input);
+int32_t readS32(librevenge::RVNGInputStream *input);
+
+class EndOfStreamException
+{
+};
+
+class GenericException
+{
+};
+
+} // namespace libemfp
+
+#endif // __LIBEMFP_UTILS_H__
+/* vim:set shiftwidth=2 softtabstop=2 expandtab: */