summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f951374)
raw | patch | inline | side by side (parent: f951374)
author | ishmal <ishmal@users.sourceforge.net> | |
Thu, 16 Feb 2006 01:15:35 +0000 (01:15 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Thu, 16 Feb 2006 01:15:35 +0000 (01:15 +0000) |
src/extension/internal/Makefile_insert | patch | blob | history | |
src/extension/internal/odf.cpp | [new file with mode: 0644] | patch | blob |
src/extension/internal/odf.h | [new file with mode: 0644] | patch | blob |
src/extension/internal/pov-out.cpp | patch | blob | history |
index c6c7aefe2713855d374b716c8b0335be68390cca..f29b37227be60429f9f4399eceb0f19ea2ecfff1 100644 (file)
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
--- /dev/null
@@ -0,0 +1,154 @@
+/**\r
+ * OpenDocument <drawing> input and output\r
+ *\r
+ * This is an an entry in the extensions mechanism to begin to enable\r
+ * the inputting and outputting of OpenDocument Format (ODF) files from\r
+ * within Inkscape. Although the initial implementations will be very lossy\r
+ * do to the differences in the models of SVG and ODF, they will hopefully\r
+ * improve greatly with time.\r
+ *\r
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html\r
+ *\r
+ * Authors:\r
+ * Bob Jamison\r
+ *\r
+ * Copyright (C) 2006 Bob Jamison\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ * Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
+ */\r
+\r
+\r
+\r
+#ifdef HAVE_CONFIG_H\r
+# include <config.h>\r
+#endif\r
+#include "odf.h"\r
+#include "clear-n_.h"\r
+#include "inkscape.h"\r
+#include "sp-path.h"\r
+#include <style.h>\r
+#include "display/curve.h"\r
+#include "libnr/n-art-bpath.h"\r
+#include "extension/system.h"\r
+\r
+\r
+\r
+#include "io/sys.h"\r
+\r
+namespace Inkscape\r
+{\r
+namespace Extension\r
+{\r
+namespace Internal\r
+{\r
+\r
+\r
+//########################################################################\r
+//# O U T P U T\r
+//########################################################################\r
+\r
+\r
+/**\r
+ * Make sure that we are in the database\r
+ */\r
+bool\r
+OdfOutput::check (Inkscape::Extension::Extension *module)\r
+{\r
+ /* We don't need a Key\r
+ if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_OUTPUT_POV))\r
+ return FALSE;\r
+ */\r
+\r
+ return TRUE;\r
+}\r
+\r
+\r
+\r
+\r
+/**\r
+ * This function searches the Repr tree recursively from the given node,\r
+ * and adds refs to all nodes with the given name, to the result vector\r
+ */\r
+static void\r
+findElementsByTagName(std::vector<Inkscape::XML::Node *> &results,\r
+ Inkscape::XML::Node *node,\r
+ char const *name)\r
+{\r
+ if ( !name || strcmp(node->name(), name) == 0 )\r
+ {\r
+ results.push_back(node);\r
+ }\r
+\r
+ for (Inkscape::XML::Node *child = node->firstChild() ; child ; child = child->next())\r
+ findElementsByTagName( results, child, name );\r
+\r
+}\r
+\r
+\r
+/**\r
+ * Descends into the SVG tree, mapping things to ODF when appropriate\r
+ */\r
+void\r
+OdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *uri)\r
+{\r
+ FILE *f = fopen(uri, "rb");\r
+ fclose(f);\r
+}\r
+\r
+\r
+/**\r
+ * This is the definition of PovRay output. This function just\r
+ * calls the extension system with the memory allocated XML that\r
+ * describes the data.\r
+*/\r
+void\r
+OdfOutput::init()\r
+{\r
+ Inkscape::Extension::build_from_mem(\r
+ "<inkscape-extension>\n"\r
+ "<name>" N_("OpenDocument Drawing Output") "</name>\n"\r
+ "<id>org.inkscape.output.odf</id>\n"\r
+ "<output>\n"\r
+ "<extension>.odg</extension>\n"\r
+ "<mimetype>text/x-povray-script</mimetype>\n"\r
+ "<filetypename>" N_("OpenDocument drawing (*.odg)(placeholder)") "</filetypename>\n"\r
+ "<filetypetooltip>" N_("OpenDocument drawing file") "</filetypetooltip>\n"\r
+ "</output>\n"\r
+ "</inkscape-extension>",\r
+ new OdfOutput());\r
+}\r
+\r
+//########################################################################\r
+//# I N P U T\r
+//########################################################################\r
+\r
+\r
+\r
+\r
+} //namespace Internal\r
+} //namespace Extension\r
+} //namespace Inkscape\r
+\r
+\r
+/*\r
+ Local Variables:\r
+ mode:c++\r
+ c-file-style:"stroustrup"\r
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
+ indent-tabs-mode:nil\r
+ fill-column:99\r
+ End:\r
+*/\r
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :\r
diff --git a/src/extension/internal/odf.h b/src/extension/internal/odf.h
--- /dev/null
@@ -0,0 +1,72 @@
+/**\r
+ * OpenDocument <drawing> input and output\r
+ *\r
+ * This is an an entry in the extensions mechanism to begin to enable\r
+ * the inputting and outputting of OpenDocument Format (ODF) files from\r
+ * within Inkscape. Although the initial implementations will be very lossy\r
+ * do to the differences in the models of SVG and ODF, they will hopefully\r
+ * improve greatly with time.\r
+ *\r
+ * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html\r
+ *\r
+ * Authors:\r
+ * Bob Jamison\r
+ *\r
+ * Copyright (C) 2006 Bob Jamison\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Lesser General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2.1 of the License, or (at your option) any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ * Lesser General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
+ */\r
+\r
+#ifndef EXTENSION_INTERNAL_ODG_OUT_H\r
+#define EXTENSION_INTERNAL_ODG_OUT_H\r
+\r
+#include <glib.h>\r
+#include "extension/implementation/implementation.h"\r
+\r
+namespace Inkscape\r
+{\r
+namespace Extension\r
+{\r
+namespace Internal\r
+{\r
+\r
+\r
+class OdfOutput : public Inkscape::Extension::Implementation::Implementation\r
+{\r
+\r
+ public:\r
+\r
+ bool check (Inkscape::Extension::Extension * module);\r
+\r
+ void save (Inkscape::Extension::Output *mod,\r
+ SPDocument *doc,\r
+ const gchar *uri);\r
+\r
+ static void init (void);\r
+\r
+\r
+};\r
+\r
+\r
+\r
+\r
+} //namespace Internal\r
+} //namespace Extension\r
+} //namespace Inkscape\r
+\r
+\r
+\r
+#endif /* EXTENSION_INTERNAL_ODG_OUT_H */\r
+\r
index 05811604038f727e39f842ed5eb65e044b463e0e..fbe64bd8188c0fe111085a058a2517f0419f5d4d 100644 (file)
#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;