summaryrefslogtreecommitdiffstats
path: root/src/attribute-rel-svg.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2017-02-08 12:09:58 +0000
committertavmjong-free <tavmjong@free.fr>2017-02-08 12:09:58 +0000
commit116c4c4853a080ff7210de2d4e999959c0c0e0ce (patch)
tree29f465fd9f2c052ecc70abaf402f17f18c016aba /src/attribute-rel-svg.cpp
parentAllow dialog to be resizable. (Fixed inheritance.) Also basic housekeeping. (diff)
downloadinkscape-116c4c4853a080ff7210de2d4e999959c0c0e0ce.tar.gz
inkscape-116c4c4853a080ff7210de2d4e999959c0c0e0ce.zip
Add naive selector validation on entry in style dialog.
(bzr r15497)
Diffstat (limited to 'src/attribute-rel-svg.cpp')
-rw-r--r--src/attribute-rel-svg.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/attribute-rel-svg.cpp b/src/attribute-rel-svg.cpp
index afa578061..1f4bee1b3 100644
--- a/src/attribute-rel-svg.cpp
+++ b/src/attribute-rel-svg.cpp
@@ -28,6 +28,27 @@ SPAttributeRelSVG * SPAttributeRelSVG::instance = NULL;
bool SPAttributeRelSVG::foundFile = false;
/*
+ * This function returns true if element is an SVG element.
+ */
+bool SPAttributeRelSVG::isSVGElement(Glib::ustring element)
+{
+ if (SPAttributeRelSVG::instance == NULL) {
+ SPAttributeRelSVG::instance = new SPAttributeRelSVG();
+ }
+
+ // Always valid if data file not found!
+ if( !foundFile ) return true;
+
+ // Strip off "svg:" from the element's name
+ Glib::ustring temp = element;
+ if ( temp.find("svg:") != std::string::npos ) {
+ temp.erase( temp.find("svg:"), 4 );
+ }
+
+ return (SPAttributeRelSVG::instance->attributesOfElements.count(temp) > 0);
+}
+
+/*
* This functions checks whether an element -> attribute pair is allowed or not
*/
bool SPAttributeRelSVG::findIfValid(Glib::ustring attribute, Glib::ustring element)
@@ -39,7 +60,7 @@ bool SPAttributeRelSVG::findIfValid(Glib::ustring attribute, Glib::ustring eleme
// Always valid if data file not found!
if( !foundFile ) return true;
- // Strip of "svg:" from the element's name
+ // Strip off "svg:" from the element's name
Glib::ustring temp = element;
if ( temp.find("svg:") != std::string::npos ) {
temp.erase( temp.find("svg:"), 4 );