@@ -182,6 +182,54 @@ void Element::collectPrefixes(PrefixInfo & info, Element * selection, const bool
182
182
}
183
183
}
184
184
185
+ void Element::collectAllPrefixes (PrefixInfo & info, Element * selection, const bool inSelection, const bool inBookmark)
186
+ {
187
+ QSet<QString> prefixes;
188
+ QString name, prefix;
189
+ XmlUtils::decodeQualifiedName (tag (), prefix, name);
190
+ if (!prefix.isEmpty ()) {
191
+ prefixes.insert (prefix);
192
+ }
193
+ foreach (Attribute * attr, getAttributesList ()) {
194
+ XmlUtils::decodeQualifiedName (attr->name , prefix, name);
195
+ if (!prefix.isEmpty () && XmlUtils::isDataAttribute (attr->name )) {
196
+ prefixes.insert (prefix);
197
+ } else if (!prefix.isEmpty () && XmlUtils::isDeclaringNS (attr->name )) {
198
+ // handles xmlns:XXX
199
+ if (!name.isEmpty ()) {
200
+ prefixes.insert (name);
201
+ }
202
+ }
203
+ }
204
+ bool thisBookmark = false ;
205
+ bool isSelection = this == selection;
206
+ if (NULL != parentRule) {
207
+ if (parentRule->isBookmarked (this )) {
208
+ thisBookmark = true ;
209
+ }
210
+ }
211
+ foreach (const QString & prefix, prefixes.values ()) {
212
+ info.allPrefixes .insert (prefix);
213
+ if (isSelection) {
214
+ info.selectionPrefixes .insert (prefix);
215
+ }
216
+ if (inSelection || isSelection) {
217
+ info.selectionPrefixesRecursive .insert (prefix);
218
+ }
219
+ if (thisBookmark) {
220
+ info.bookmarksPrefixesRecursive .insert (prefix);
221
+ }
222
+ if (inBookmark || thisBookmark) {
223
+ info.bookmarksPrefixesRecursive .insert (prefix);
224
+ }
225
+ }
226
+ foreach (Element * child, getChildItemsRef ()) {
227
+ if (child->isElement ()) {
228
+ child->collectAllPrefixes (info, selection, inSelection || isSelection, inBookmark || thisBookmark);
229
+ }
230
+ }
231
+ }
232
+
185
233
bool Regola::removePrefix (const QString &removedPrefix, QList<Element*> elements, TargetSelection::Type targetSelection,
186
234
const bool isAllPrefixes, ElementUndoObserver *observer)
187
235
{
0 commit comments