summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBob Jamison <ishmalius@gmail.com>2006-04-12 21:17:50 +0000
committerishmal <ishmal@users.sourceforge.net>2006-04-12 21:17:50 +0000
commit212c98feecaedb224dea2de06d67489b2b86d707 (patch)
treef3af295b00d0fe3ca45a270c72df3c9a2a5bc40f /src
parentchanged CVS to SVN updated link to svn hints (diff)
downloadinkscape-212c98feecaedb224dea2de06d67489b2b86d707.tar.gz
inkscape-212c98feecaedb224dea2de06d67489b2b86d707.zip
still WIP. added tree-descending code
(bzr r503)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/odf.cpp73
-rw-r--r--src/extension/internal/odf.h1
2 files changed, 49 insertions, 25 deletions
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index 97e58600d..37f26966c 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -182,21 +182,26 @@ void OdfOutput::po(char *str)
+
+
/**
- * Make sure that we are in the database
+ * 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
*/
-bool
-OdfOutput::check (Inkscape::Extension::Extension *module)
+static void
+findElementsByTagName(std::vector<Inkscape::XML::Node *> &results,
+ Inkscape::XML::Node *node,
+ char const *name)
{
- /* We don't need a Key
- if (NULL == Inkscape::Extension::db.get(SP_MODULE_KEY_OUTPUT_POV))
- return FALSE;
- */
-
- return TRUE;
-}
+ 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 );
+}
/**
* This function searches the Repr tree recursively from the given node,
@@ -320,28 +325,32 @@ OdfOutput::preprocess(SPDocument *doc)
}
-
-
-/**
- * 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)
+bool OdfOutput::writeTree(Inkscape::XML::Node *node)
{
- if ( !name || strcmp(node->name(), name) == 0 )
+ //# Get the SPItem, if applicable
+ SPObject *reprobj = SP_ACTIVE_DOCUMENT->getObjectByRepr(node);
+ if (!reprobj)
+ return true;
+ if (!SP_IS_ITEM(reprobj))
{
- results.push_back(node);
+ return true;
}
+ SPItem *item = SP_ITEM(reprobj);
- for (Inkscape::XML::Node *child = node->firstChild() ; child ; child = child->next())
- findElementsByTagName( results, child, name );
+ //# Do our stuff
+
+ //# Iterate through the children
+ for (Inkscape::XML::Node *child = node->firstChild() ; child ; child = child->next())
+ {
+ if (!writeTree(child))
+ return false;
+ }
+ return true;
}
+
/**
* Descends into the SVG tree, mapping things to ODF when appropriate
*/
@@ -371,13 +380,27 @@ OdfOutput::init()
"<output>\n"
"<extension>.odg</extension>\n"
"<mimetype>text/x-povray-script</mimetype>\n"
- "<filetypename>" N_("OpenDocument drawing (*.odg)(placeholder)") "</filetypename>\n"
+ "<filetypename>" N_("OpenDocument drawing (*.odg)") "</filetypename>\n"
"<filetypetooltip>" N_("OpenDocument drawing file") "</filetypetooltip>\n"
"</output>\n"
"</inkscape-extension>",
new OdfOutput());
}
+/**
+ * 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;
+}
+
//########################################################################
//# I N P U T
//########################################################################
diff --git a/src/extension/internal/odf.h b/src/extension/internal/odf.h
index 7a2b1bd32..4d4421b6b 100644
--- a/src/extension/internal/odf.h
+++ b/src/extension/internal/odf.h
@@ -73,6 +73,7 @@ private:
void preprocess(SPDocument *doc);
void preprocess(Inkscape::XML::Node *node);
+ bool writeTree(Inkscape::XML::Node *node);
void po(char *str);
org::w3c::dom::io::StringOutputStream outs;