diff --git a/src/conditions.cpp b/src/conditions.cpp
index 8d1770d6abc7f26fa135b315c5bddcf4e2189060..d35f18cf1f66391e942ce2ef2422ec77c9de0ca6 100644 (file)
--- a/src/conditions.cpp
+++ b/src/conditions.cpp
-#define __SP_CONDITIONS_CPP__
-
/*
* SVG conditional attribute evaluation
*
* Authors:
* Andrius R. <knutux@gmail.com>
+ * Abhishek Sharma
*
* Copyright (C) 2006 authors
*
{ "requiredExtensions", evaluateRequiredExtensions },
};
-/* function which evaluates if item should be displayed */
+// function which evaluates if item should be displayed
bool sp_item_evaluate(SPItem const *item) {
- Inkscape::XML::Node *grepr = SP_OBJECT_REPR (item);
-
- for ( unsigned int i = 0 ; i < sizeof(_condition_handlers)/sizeof(_condition_handlers[0]) ; i++ ) {
- gchar const *value = grepr->attribute(_condition_handlers[i].attribute);
- if ( NULL == value )
- continue;
-
- if (!_condition_handlers[i].evaluator(item, value))
- return false;
+ bool needDisplay = true;
+ for ( unsigned int i = 0 ; needDisplay && (i < sizeof(_condition_handlers) / sizeof(_condition_handlers[0])) ; i++ ) {
+ gchar const *value = item->getAttribute(_condition_handlers[i].attribute);
+ if ( value && !_condition_handlers[i].evaluator(item, value) ) {
+ needDisplay = false;
+ }
}
-
- return true;
+ return needDisplay;
}
#define ISALNUM(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= '0' && (c) <= '9'))