summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBob Jamison <ishmalius@gmail.com>2006-02-16 01:15:35 +0000
committerishmal <ishmal@users.sourceforge.net>2006-02-16 01:15:35 +0000
commit42c66786f609290a715bd85ce4c014154f941d1b (patch)
tree8a00b196b07aa163001c26f9028edf93aec0f79a /src
parentbulk trailing spaces removal. consistency through MD5 of binary (diff)
downloadinkscape-42c66786f609290a715bd85ce4c014154f941d1b.tar.gz
inkscape-42c66786f609290a715bd85ce4c014154f941d1b.zip
Add new placeholder for ODF
(bzr r150)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/Makefile_insert2
-rw-r--r--src/extension/internal/odf.cpp154
-rw-r--r--src/extension/internal/odf.h72
-rw-r--r--src/extension/internal/pov-out.cpp15
4 files changed, 237 insertions, 6 deletions
diff --git a/src/extension/internal/Makefile_insert b/src/extension/internal/Makefile_insert
index c6c7aefe2..f29b37227 100644
--- a/src/extension/internal/Makefile_insert
+++ b/src/extension/internal/Makefile_insert
@@ -33,6 +33,8 @@ extension_internal_libinternal_a_SOURCES = \
extension/internal/gdkpixbuf-input.cpp \
extension/internal/pov-out.cpp \
extension/internal/pov-out.h \
+ extension/internal/odf.cpp \
+ extension/internal/odf.h \
extension/internal/latex-pstricks.cpp \
extension/internal/latex-pstricks.h \
extension/internal/latex-pstricks-out.cpp \
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
new file mode 100644
index 000000000..6918e9ebb
--- /dev/null
+++ b/src/extension/internal/odf.cpp
@@ -0,0 +1,154 @@
+/**
+ * OpenDocument <drawing> input and output
+ *
+ * This is an an entry in the extensions mechanism to begin to enable
+ * the inputting and outputting of OpenDocument Format (ODF) files from
+ * within Inkscape. Although the initial implementations will be very lossy
+ * do to the differences in the models of SVG and ODF, they will hopefully
+ * improve greatly with time.
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include "odf.h"
+#include "clear-n_.h"
+#include "inkscape.h"
+#include "sp-path.h"
+#include <style.h>
+#include "display/curve.h"
+#include "libnr/n-art-bpath.h"
+#include "extension/system.h"
+
+
+
+#include "io/sys.h"
+
+namespace Inkscape
+{
+namespace Extension
+{
+namespace Internal
+{
+
+
+//########################################################################
+//# O U T P U T
+//########################################################################
+
+
+/**
+ * Make sure that we are in the database
+ */
+bool
+OdfOutput::check (Inkscape::Extension::Extension *module)
+{
+ /* We don't need a Key
+ if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_OUTPUT_POV))
+ return FALSE;
+ */
+
+ return TRUE;
+}
+
+
+
+
+/**
+ * This function searches the Repr tree recursively from the given node,
+ * and adds refs to all nodes with the given name, to the result vector
+ */
+static void
+findElementsByTagName(std::vector<Inkscape::XML::Node *> &results,
+ Inkscape::XML::Node *node,
+ char const *name)
+{
+ if ( !name || strcmp(node->name(), name) == 0 )
+ {
+ results.push_back(node);
+ }
+
+ for (Inkscape::XML::Node *child = node->firstChild() ; child ; child = child->next())
+ findElementsByTagName( results, child, name );
+
+}
+
+
+/**
+ * Descends into the SVG tree, mapping things to ODF when appropriate
+ */
+void
+OdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *uri)
+{
+ FILE *f = fopen(uri, "rb");
+ fclose(f);
+}
+
+
+/**
+ * This is the definition of PovRay output. This function just
+ * calls the extension system with the memory allocated XML that
+ * describes the data.
+*/
+void
+OdfOutput::init()
+{
+ Inkscape::Extension::build_from_mem(
+ "<inkscape-extension>\n"
+ "<name>" N_("OpenDocument Drawing Output") "</name>\n"
+ "<id>org.inkscape.output.odf</id>\n"
+ "<output>\n"
+ "<extension>.odg</extension>\n"
+ "<mimetype>text/x-povray-script</mimetype>\n"
+ "<filetypename>" N_("OpenDocument drawing (*.odg)(placeholder)") "</filetypename>\n"
+ "<filetypetooltip>" N_("OpenDocument drawing file") "</filetypetooltip>\n"
+ "</output>\n"
+ "</inkscape-extension>",
+ new OdfOutput());
+}
+
+//########################################################################
+//# I N P U T
+//########################################################################
+
+
+
+
+} //namespace Internal
+} //namespace Extension
+} //namespace Inkscape
+
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/extension/internal/odf.h b/src/extension/internal/odf.h
new file mode 100644
index 000000000..1e81e9986
--- /dev/null
+++ b/src/extension/internal/odf.h
@@ -0,0 +1,72 @@
+/**
+ * OpenDocument <drawing> input and output
+ *
+ * This is an an entry in the extensions mechanism to begin to enable
+ * the inputting and outputting of OpenDocument Format (ODF) files from
+ * within Inkscape. Although the initial implementations will be very lossy
+ * do to the differences in the models of SVG and ODF, they will hopefully
+ * improve greatly with time.
+ *
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
+ *
+ * Authors:
+ * Bob Jamison
+ *
+ * Copyright (C) 2006 Bob Jamison
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef EXTENSION_INTERNAL_ODG_OUT_H
+#define EXTENSION_INTERNAL_ODG_OUT_H
+
+#include <glib.h>
+#include "extension/implementation/implementation.h"
+
+namespace Inkscape
+{
+namespace Extension
+{
+namespace Internal
+{
+
+
+class OdfOutput : public Inkscape::Extension::Implementation::Implementation
+{
+
+ public:
+
+ bool check (Inkscape::Extension::Extension * module);
+
+ void save (Inkscape::Extension::Output *mod,
+ SPDocument *doc,
+ const gchar *uri);
+
+ static void init (void);
+
+
+};
+
+
+
+
+} //namespace Internal
+} //namespace Extension
+} //namespace Inkscape
+
+
+
+#endif /* EXTENSION_INTERNAL_ODG_OUT_H */
+
diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp
index 058116040..fbe64bd81 100644
--- a/src/extension/internal/pov-out.cpp
+++ b/src/extension/internal/pov-out.cpp
@@ -32,16 +32,19 @@
#include "io/sys.h"
-namespace Inkscape {
-namespace Extension {
-namespace Internal {
+namespace Inkscape
+{
+namespace Extension
+{
+namespace Internal
+{
static const char *
dstr(gchar *sbuffer, double d)
{
- return (const char *)g_ascii_formatd(sbuffer,
+ return (const char *)g_ascii_formatd(sbuffer,
G_ASCII_DTOSTR_BUF_SIZE, "%.8g", (gdouble)d);
}
@@ -147,13 +150,13 @@ PovOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *
gchar s6[G_ASCII_DTOSTR_BUF_SIZE + 1];
gchar s7[G_ASCII_DTOSTR_BUF_SIZE + 1];
gchar s8[G_ASCII_DTOSTR_BUF_SIZE + 1];
-
+
double bignum = 1000000.0;
double minx = bignum;
double maxx = -bignum;
double miny = bignum;
double maxy = -bignum;
-
+
unsigned indx;