Code

fix pasting style after copying a text span
[inkscape.git] / src / preferences.h
index 2f2337b8131892f1dc6157cd8ad1970fc0e1f74b..a87a2771813816d9ef0722559522784868949ea4 100644 (file)
@@ -19,6 +19,7 @@
 #include <climits>
 #include <cfloat>
 #include "xml/xml-forward.h"
+#include "xml/repr.h"
 
 class SPCSSAttr;
 
@@ -109,6 +110,7 @@ public:
     friend class Preferences; // Preferences class has to access _value
     public:
         ~Entry() {}
+        Entry() : _pref_path(""), _value(NULL) {} // needed to enable use in maps
         Entry(Entry const &other) : _pref_path(other._pref_path), _value(other._value) {}
         /**
          * @brief Check whether the received entry is valid.
@@ -162,7 +164,7 @@ public:
         inline Glib::ustring getString() const;
         /**
          * @brief Interpret the preference as a CSS style.
-         * @return A CSS style that has to be unrefed when no longer necessary.
+         * @return A CSS style that has to be unrefed when no longer necessary. Never NULL.
          */
         inline SPCSSAttr *getStyle() const;
         /**
@@ -172,7 +174,7 @@ public:
          * This function will look up the preferences with the same entry name
          * in ancestor directories and return the inherited CSS style.
          *
-         * @return Inherited CSS style that has to be unrefed after use.
+         * @return Inherited CSS style that has to be unrefed after use. Never NULL.
          */
         inline SPCSSAttr *getInheritedStyle() const;
         
@@ -510,13 +512,13 @@ inline Glib::ustring Preferences::Entry::getString() const
 
 inline SPCSSAttr *Preferences::Entry::getStyle() const
 {
-    if (!this->isValid()) return NULL;
+    if (!this->isValid()) return sp_repr_css_attr_new();
     return Inkscape::Preferences::get()->_extractStyle(*this);
 }
 
 inline SPCSSAttr *Preferences::Entry::getInheritedStyle() const
 {
-    if (!this->isValid()) return NULL;
+    if (!this->isValid()) return sp_repr_css_attr_new();
     return Inkscape::Preferences::get()->_extractInheritedStyle(*this);
 }