Code

Add new placeholder for ODF
[inkscape.git] / src / extension / internal / odf.cpp
1 /**\r
2  * OpenDocument <drawing> input and output\r
3  *\r
4  * This is an an entry in the extensions mechanism to begin to enable\r
5  * the inputting and outputting of OpenDocument Format (ODF) files from\r
6  * within Inkscape.  Although the initial implementations will be very lossy\r
7  * do to the differences in the models of SVG and ODF, they will hopefully\r
8  * improve greatly with time.\r
9  *\r
10  * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html\r
11  *\r
12  * Authors:\r
13  *   Bob Jamison\r
14  *\r
15  * Copyright (C) 2006 Bob Jamison\r
16  *\r
17  *  This library is free software; you can redistribute it and/or\r
18  *  modify it under the terms of the GNU Lesser General Public\r
19  *  License as published by the Free Software Foundation; either\r
20  *  version 2.1 of the License, or (at your option) any later version.\r
21  *\r
22  *  This library is distributed in the hope that it will be useful,\r
23  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
24  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
25  *  Lesser General Public License for more details.\r
26  *\r
27  *  You should have received a copy of the GNU Lesser General Public\r
28  *  License along with this library; if not, write to the Free Software\r
29  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
30  */\r
31 \r
32 \r
33 \r
34 #ifdef HAVE_CONFIG_H\r
35 # include <config.h>\r
36 #endif\r
37 #include "odf.h"\r
38 #include "clear-n_.h"\r
39 #include "inkscape.h"\r
40 #include "sp-path.h"\r
41 #include <style.h>\r
42 #include "display/curve.h"\r
43 #include "libnr/n-art-bpath.h"\r
44 #include "extension/system.h"\r
45 \r
46 \r
47 \r
48 #include "io/sys.h"\r
49 \r
50 namespace Inkscape\r
51 {\r
52 namespace Extension\r
53 {\r
54 namespace Internal\r
55 {\r
56 \r
57 \r
58 //########################################################################\r
59 //# O U T P U T\r
60 //########################################################################\r
61 \r
62 \r
63 /**\r
64  * Make sure that we are in the database\r
65  */\r
66 bool\r
67 OdfOutput::check (Inkscape::Extension::Extension *module)\r
68 {\r
69     /* We don't need a Key\r
70     if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_OUTPUT_POV))\r
71         return FALSE;\r
72     */\r
73 \r
74     return TRUE;\r
75 }\r
76 \r
77 \r
78 \r
79 \r
80 /**\r
81  * This function searches the Repr tree recursively from the given node,\r
82  * and adds refs to all nodes with the given name, to the result vector\r
83  */\r
84 static void\r
85 findElementsByTagName(std::vector<Inkscape::XML::Node *> &results,\r
86                       Inkscape::XML::Node *node,\r
87                       char const *name)\r
88 {\r
89     if ( !name || strcmp(node->name(), name) == 0 )\r
90         {\r
91         results.push_back(node);\r
92         }\r
93 \r
94     for (Inkscape::XML::Node *child = node->firstChild() ; child ; child = child->next())\r
95         findElementsByTagName( results, child, name );\r
96 \r
97 }\r
98 \r
99 \r
100 /**\r
101  * Descends into the SVG tree, mapping things to ODF when appropriate\r
102  */\r
103 void\r
104 OdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *uri)\r
105 {\r
106     FILE *f = fopen(uri, "rb");\r
107     fclose(f);\r
108 }\r
109 \r
110 \r
111 /**\r
112  * This is the definition of PovRay output.  This function just\r
113  * calls the extension system with the memory allocated XML that\r
114  * describes the data.\r
115 */\r
116 void\r
117 OdfOutput::init()\r
118 {\r
119     Inkscape::Extension::build_from_mem(\r
120         "<inkscape-extension>\n"\r
121             "<name>" N_("OpenDocument Drawing Output") "</name>\n"\r
122             "<id>org.inkscape.output.odf</id>\n"\r
123             "<output>\n"\r
124                 "<extension>.odg</extension>\n"\r
125                 "<mimetype>text/x-povray-script</mimetype>\n"\r
126                 "<filetypename>" N_("OpenDocument drawing (*.odg)(placeholder)") "</filetypename>\n"\r
127                 "<filetypetooltip>" N_("OpenDocument drawing file") "</filetypetooltip>\n"\r
128             "</output>\n"\r
129         "</inkscape-extension>",\r
130         new OdfOutput());\r
131 }\r
132 \r
133 //########################################################################\r
134 //# I N P U T\r
135 //########################################################################\r
136 \r
137 \r
138 \r
139 \r
140 }  //namespace Internal\r
141 }  //namespace Extension\r
142 }  //namespace Inkscape\r
143 \r
144 \r
145 /*\r
146   Local Variables:\r
147   mode:c++\r
148   c-file-style:"stroustrup"\r
149   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
150   indent-tabs-mode:nil\r
151   fill-column:99\r
152   End:\r
153 */\r
154 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :\r