Code

fix linking
[inkscape.git] / src / extension / internal / odf.cpp
index 8645205f2e388fe50df1425eeeeb980a33e6d4a5..58d19be325fa79740dee78654349ec22e983febf 100644 (file)
@@ -15,7 +15,7 @@
  * Authors:
  *   Bob Jamison
  *
- * Copyright (C) 2006 Bob Jamison
+ * Copyright (C) 2006, 2007 Bob Jamison
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -884,12 +884,12 @@ int SingularValueDecomposition::rank()
 /**
  * Get the value of a node/attribute pair
  */
-static Glib::ustring getAttribute( Inkscape::XML::Node *node, char *attrName)
+static Glib::ustring getAttribute( Inkscape::XML::Node *node, char const *attrName)
 {
     Glib::ustring val;
-    char *valstr = (char *)node->attribute(attrName);
+    char const *valstr = node->attribute(attrName);
     if (valstr)
-        val = (const char *)valstr;
+        val = valstr;
     return val;
 }
 
@@ -902,7 +902,7 @@ static Glib::ustring getExtension(const Glib::ustring &fname)
 {
     Glib::ustring ext;
 
-    unsigned int pos = fname.rfind('.');
+    std::string::size_type pos = fname.rfind('.');
     if (pos == fname.npos)
         {
         ext = "";
@@ -1175,7 +1175,7 @@ bool OdfOutput::writeManifest(ZipFile &zf)
         else if (ext == ".jpg")
             outs.printf("image/jpeg");
         outs.printf("\" manifest:full-path=\"");
-        outs.printf((char *)newName.c_str());
+        outs.printf(newName.c_str());
         outs.printf("\"/>\n");
         }
     outs.printf("</manifest:manifest>\n");
@@ -1557,10 +1557,9 @@ bool OdfOutput::processStyle(Writer &outs, SPItem *item,
     StyleInfo si;
 
     //## FILL
-    if (style->fill.type == SP_PAINT_TYPE_COLOR)
+    if (style->fill.isColor())
         {
-        guint32 fillCol =
-            sp_color_get_rgba32_ualpha(&style->fill.value.color, 0);
+        guint32 fillCol = style->fill.value.color.toRGBA32( 0 );
         char buf[16];
         int r = (fillCol >> 24) & 0xff;
         int g = (fillCol >> 16) & 0xff;
@@ -1576,10 +1575,9 @@ bool OdfOutput::processStyle(Writer &outs, SPItem *item,
         }
 
     //## STROKE
-    if (style->stroke.type == SP_PAINT_TYPE_COLOR)
+    if (style->stroke.isColor())
         {
-        guint32 strokeCol =
-            sp_color_get_rgba32_ualpha(&style->stroke.value.color, 0);
+        guint32 strokeCol = style->stroke.value.color.toRGBA32( 0 );
         char buf[16];
         int r = (strokeCol >> 24) & 0xff;
         int g = (strokeCol >> 16) & 0xff;
@@ -1650,8 +1648,17 @@ bool OdfOutput::processStyle(Writer &outs, SPItem *item,
 bool OdfOutput::processGradient(Writer &outs, SPItem *item,
                                 const Glib::ustring &id, NR::Matrix &tf)
 {
+    if (!item)
+        return false;
+
     SPStyle *style = item->style;
 
+    if (!style)
+        return false;
+
+    if (!style->fill.isPaintserver())
+        return false;
+
     //## Gradient.  Look in writeStyle() below to see what info
     //   we need to read into GradientInfo.
     if (!SP_IS_GRADIENT(SP_STYLE_FILL_SERVER(style)))