summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b981142)
raw | patch | inline | side by side (parent: b981142)
| author | ishmal <ishmal@users.sourceforge.net> | |
| Wed, 3 May 2006 23:43:14 +0000 (23:43 +0000) | ||
| committer | ishmal <ishmal@users.sourceforge.net> | |
| Wed, 3 May 2006 23:43:14 +0000 (23:43 +0000) |
| src/extension/internal/odf.cpp | patch | blob | history |
index 8d60f5fe01fd38b57a2a9c452b7491d835d2b977..11cf842d36931d9f06389d05b1aecabe2a0acecd 100644 (file)
* 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.
+ * improve greatly with time. People should consider this to be a framework
+ * that can be continously upgraded for ever improving fidelity. Potential
+ * developers should especially look in preprocess() and writeTree() to see how
+ * the SVG tree is scanned, read, translated, and then written to ODF.
*
* http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
*
//# O U T P U T
//########################################################################
+/**
+ * Get the value of a node/attribute pair
+ */
static std::string getAttribute( Inkscape::XML::Node *node, char *attrName)
{
std::string val;
}
+
+/**
+ * Get the extension suffix from the end of a file name
+ */
static std::string getExtension(const std::string &fname)
{
std::string ext;
+
/**
* Get the general transform from SVG pixels to
* ODF cm
}
+
+
/**
* Get the bounding box of an item, as mapped onto
* an ODF document, in cm.
/**
- * Method descends into the repr tree, converting image and style info
+ * FIRST PASS.
+ * Method descends into the repr tree, converting image, style, and gradient info
* into forms compatible in ODF.
*/
void
bool isGradient = false;
StyleInfo si;
+ //## Style. Look in writeStyle() below to see what info
+ // we need to read into StyleInfo. Note that we need to
+ // determine whether information goes into a style element
+ // or a gradient element.
//## FILL
if (style->fill.type == SP_PAINT_TYPE_COLOR)
{
+/**
+ * Writes the manifest. Currently it only changes according to the
+ * file names of images packed into the zip file.
+ */
bool OdfOutput::writeManifest(ZipFile &zf)
{
BufferOutputStream bouts;
}
+/**
+ * This writes the document meta information to meta.xml
+ */
bool OdfOutput::writeMeta(ZipFile &zf)
{
BufferOutputStream bouts;
}
+
+
+/**
+ * This is called just before writeTree(), since it will write style and
+ * gradient information above the <draw> tag in the content.xml file
+ */
bool OdfOutput::writeStyle(Writer &outs)
{
outs.printf("<office:automatic-styles>\n");
outs.printf(" <style:paragraph-properties fo:text-align=\"center\"/>\n");
outs.printf("</style:style>\n");
- //## Dump our style table
+ /*
+ ==========================================================
+ Dump our style table. Styles should have a general layout
+ something like the following. Look in:
+ http://books.evc-cit.info/odbook/ch06.html#draw-style-file-section
+ for style and gradient information.
+ <style:style style:name="gr13"
+ style:family="graphic" style:parent-style-name="standard">
+ <style:graphic-properties draw:stroke="solid"
+ svg:stroke-width="0.1cm"
+ svg:stroke-color="#ff0000"
+ draw:fill="solid" draw:fill-color="#e6e6ff"/>
+ </style:style>
+ ==========================================================
+ */
outs.printf("<!-- ####### Styles from Inkscape document ####### -->\n");
std::vector<StyleInfo>::iterator iter;
for (iter = styleTable.begin() ; iter != styleTable.end() ; iter++)
/**
+ * SECOND PASS.
* This is the main SPObject tree output to ODF. preprocess()
- * must be called prior to this
+ * must be called prior to this, as elements will often reference
+ * data parsed and tabled in preprocess().
*/
bool OdfOutput::writeTree(Writer &outs, Inkscape::XML::Node *node)
{
-
+/**
+ * Write the content.xml file. Writes the namesspace headers, then
+ * calls writeStyle() and writeTree().
+ */
bool OdfOutput::writeContent(ZipFile &zf, Inkscape::XML::Node *node)
{
BufferOutputStream bouts;
outs.printf("<office:scripts/>\n");
outs.printf("\n");
outs.printf("\n");
- //AffineTransform trans = new AffineTransform();
- //trans.scale(12.0, 12.0);
outs.printf("<!-- ######### CONVERSION FROM SVG STARTS ######## -->\n");
outs.printf("<!--\n");
outs.printf("*************************************************************************\n");