1 /* This file is part of the KDE project
2  * Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #include "enhancedpath/EnhancedPathShapeFactory.h"
21 #include "enhancedpath/EnhancedPathShape.h"
22 
23 #include <KoShapeStroke.h>
24 #include <KoProperties.h>
25 #include <KoXmlNS.h>
26 #include <KoXmlReader.h>
27 #include <KoColorBackground.h>
28 #include <KoShapeLoadingContext.h>
29 
30 #include <KoIcon.h>
31 
32 #include <klocalizedstring.h>
33 #include "kis_pointer_utils.h"
34 
35 #include <QString>
36 
37 #include <math.h>
38 
EnhancedPathShapeFactory()39 EnhancedPathShapeFactory::EnhancedPathShapeFactory()
40     : KoShapeFactoryBase(EnhancedPathShapeId, i18n("An enhanced path shape"))
41 {
42     setToolTip(i18n("An enhanced path"));
43     setIconName(koIconNameCStr("krita_draw_path"));
44     setXmlElementNames(KoXmlNS::draw, QStringList("custom-shape"));
45     setLoadingPriority(1);
46 
47 //    addCross();
48 //    addArrow();
49 //    addCallout();
50 //    addSmiley();
51 //    addCircularArrow();
52 //    addGearhead();
53 }
54 
createDefaultShape(KoDocumentResourceManager *) const55 KoShape *EnhancedPathShapeFactory::createDefaultShape(KoDocumentResourceManager *) const
56 {
57     EnhancedPathShape *shape = new EnhancedPathShape(QRect(0, 0, 100, 100));
58     shape->setStroke(toQShared(new KoShapeStroke(1.0)));
59     shape->setShapeId(KoPathShapeId);
60 
61     shape->addModifiers("35");
62 
63     shape->addFormula("Right", "width - $0");
64     shape->addFormula("Bottom", "height - $0");
65     shape->addFormula("Half", "min(0.5 * height, 0.5 * width)");
66 
67     shape->addCommand("M $0 0");
68     shape->addCommand("L ?Right 0 ?Right $0 width $0 width ?Bottom ?Right ?Bottom");
69     shape->addCommand("L ?Right height $0 height $0 ?Bottom 0 ?Bottom 0 $0 $0 $0");
70     shape->addCommand("Z");
71 
72     ComplexType handle;
73     handle["draw:handle-position"] = "$0 0";
74     handle["draw:handle-range-x-minimum"] = '0';
75     handle["draw:handle-range-x-maximum"] = "?Half";
76     shape->addHandle(handle);
77     shape->setSize(QSize(100, 100));
78 
79     return shape;
80 }
81 
createShape(const KoProperties * params,KoDocumentResourceManager *) const82 KoShape *EnhancedPathShapeFactory::createShape(const KoProperties *params, KoDocumentResourceManager *) const
83 {
84     QVariant viewboxData;
85     const QRect viewBox = (params->property(QLatin1String("viewBox"), viewboxData)) ?
86                           viewboxData.toRect() :
87                           QRect(0, 0, 100, 100);
88 
89     EnhancedPathShape *shape = new EnhancedPathShape(viewBox);
90 
91     shape->setShapeId(KoPathShapeId);
92     shape->setStroke(toQShared(new KoShapeStroke(1.0)));
93     shape->addModifiers(params->stringProperty("modifiers"));
94 
95     ListType handles = params->property("handles").toList();
96     foreach (const QVariant &v, handles) {
97         shape->addHandle(v.toMap());
98     }
99 
100     ComplexType formulae = params->property("formulae").toMap();
101     ComplexType::const_iterator formula = formulae.constBegin();
102     ComplexType::const_iterator lastFormula = formulae.constEnd();
103     for (; formula != lastFormula; ++formula) {
104         shape->addFormula(formula.key(), formula.value().toString());
105     }
106 
107     QStringList commands = params->property("commands").toStringList();
108     foreach (const QString &cmd, commands) {
109         shape->addCommand(cmd);
110     }
111 
112     QVariant color;
113     if (params->property("background", color)) {
114         shape->setBackground(QSharedPointer<KoColorBackground>(new KoColorBackground(color.value<QColor>())));
115     }
116     QSizeF size = shape->size();
117     if (size.width() > size.height()) {
118         shape->setSize(QSizeF(100, 100 * size.height() / size.width()));
119     } else {
120         shape->setSize(QSizeF(100 * size.width() / size.height(), 100));
121     }
122 
123     return shape;
124 }
125 
dataToProperties(const QString & modifiers,const QStringList & commands,const ListType & handles,const ComplexType & formulae) const126 KoProperties *EnhancedPathShapeFactory::dataToProperties(
127     const QString &modifiers, const QStringList &commands,
128     const ListType &handles, const ComplexType &formulae) const
129 {
130     KoProperties *props = new KoProperties();
131     props->setProperty("modifiers", modifiers);
132     props->setProperty("commands", commands);
133     props->setProperty("handles", handles);
134     props->setProperty("formulae", formulae);
135     props->setProperty("background", QVariant::fromValue<QColor>(QColor(Qt::red)));
136 
137     return props;
138 }
139 
addCross()140 void EnhancedPathShapeFactory::addCross()
141 {
142     QString modifiers("35");
143 
144     QStringList commands;
145     commands.append("M $0 0");
146     commands.append("L ?Right 0 ?Right $0 width $0 width ?Bottom ?Right ?Bottom");
147     commands.append("L ?Right height $0 height $0 ?Bottom 0 ?Bottom 0 $0 $0 $0");
148     commands.append("Z");
149 
150     ListType handles;
151     ComplexType handle;
152     handle["draw:handle-position"] = "$0 0";
153     handle["draw:handle-range-x-minimum"] = '0';
154     handle["draw:handle-range-x-maximum"] = "?Half";
155     handles.append(QVariant(handle));
156 
157     ComplexType formulae;
158     formulae["Right"] = "width - $0";
159     formulae["Bottom"] = "height - $0";
160     formulae["Half"] = "min(0.5 * height, 0.5 * width)";
161 
162     KoShapeTemplate t;
163     t.id = KoPathShapeId;
164     t.templateId = "cross";
165     t.name = i18n("Cross");
166     t.family = "funny";
167     t.toolTip = i18n("A cross");
168     t.iconName = koIconName("cross-shape");
169     t.properties = dataToProperties(modifiers, commands, handles, formulae);
170 
171     addTemplate(t);
172 }
173 
addArrow()174 void EnhancedPathShapeFactory::addArrow()
175 {
176     {
177         // arrow right
178         QString modifiers("60 35");
179 
180         QStringList commands;
181         commands.append("M $0 $1");
182         commands.append("L $0 0 width ?HalfHeight $0 height $0 ?LowerCorner 0 ?LowerCorner 0 $1");
183         commands.append("Z");
184 
185         ListType handles;
186         ComplexType handle;
187         handle["draw:handle-position"] = "$0 $1";
188         handle["draw:handle-range-x-minimum"] = '0';
189         handle["draw:handle-range-x-maximum"] = "width";
190         handle["draw:handle-range-y-minimum"] = '0';
191         handle["draw:handle-range-y-maximum"] = "?HalfHeight";
192         handles.append(QVariant(handle));
193 
194         ComplexType formulae;
195         formulae["HalfHeight"] = "0.5 * height";
196         formulae["LowerCorner"] = "height - $1";
197 
198         KoShapeTemplate t;
199         t.id = KoPathShapeId;
200         t.templateId = "arrow_right";
201         t.name = i18n("Arrow");
202         t.family = "arrow";
203         t.toolTip = i18n("An arrow");
204         t.iconName = koIconName("draw-arrow-forward");
205         t.properties = dataToProperties(modifiers, commands, handles, formulae);
206 
207         addTemplate(t);
208     }
209 
210     {
211         // arrow left
212         QString modifiers("40 35");
213 
214         QStringList commands;
215         commands.append("M $0 $1");
216         commands.append("L $0 0 0 ?HalfHeight $0 height $0 ?LowerCorner width ?LowerCorner width $1");
217         commands.append("Z");
218 
219         ListType handles;
220         ComplexType handle;
221         handle["draw:handle-position"] = "$0 $1";
222         handle["draw:handle-range-x-minimum"] = '0';
223         handle["draw:handle-range-x-maximum"] = "width";
224         handle["draw:handle-range-y-minimum"] = '0';
225         handle["draw:handle-range-y-maximum"] = "?HalfHeight";
226         handles.append(QVariant(handle));
227 
228         ComplexType formulae;
229         formulae["HalfHeight"] = "0.5 * height";
230         formulae["LowerCorner"] = "height - $1";
231 
232         KoShapeTemplate t;
233         t.id = KoPathShapeId;
234         t.templateId = "arrow_left";
235         t.name = i18n("Arrow");
236         t.family = "arrow";
237         t.toolTip = i18n("An arrow");
238         t.iconName = koIconName("draw-arrow-back");
239         t.properties = dataToProperties(modifiers, commands, handles, formulae);
240 
241         addTemplate(t);
242     }
243 
244     {
245         // arrow top
246         QString modifiers("35 40");
247 
248         QStringList commands;
249         commands.append("M $0 $1");
250         commands.append("L 0 $1 ?HalfWidth 0 width $1 ?RightCorner $1 ?RightCorner height $0 height");
251         commands.append("Z");
252 
253         ListType handles;
254         ComplexType handle;
255         handle["draw:handle-position"] = "$0 $1";
256         handle["draw:handle-range-x-minimum"] = '0';
257         handle["draw:handle-range-x-maximum"] = "?HalfWidth";
258         handle["draw:handle-range-y-minimum"] = '0';
259         handle["draw:handle-range-y-maximum"] = "height";
260         handles.append(QVariant(handle));
261 
262         ComplexType formulae;
263         formulae["HalfWidth"] = "0.5 * width";
264         formulae["RightCorner"] = "width - $0";
265 
266         KoShapeTemplate t;
267         t.id = KoPathShapeId;
268         t.templateId = "arrow_top";
269         t.name = i18n("Arrow");
270         t.family = "arrow";
271         t.toolTip = i18n("An arrow");
272         t.iconName = koIconName("draw-arrow-up");
273         t.properties = dataToProperties(modifiers, commands, handles, formulae);
274 
275         addTemplate(t);
276     }
277 
278     {
279         // arrow bottom
280         QString modifiers("35 60");
281 
282         QStringList commands;
283         commands.append("M $0 $1");
284         commands.append("L 0 $1 ?HalfWidth height width $1 ?RightCorner $1 ?RightCorner 0 $0 0");
285         commands.append("Z");
286 
287         ListType handles;
288         ComplexType handle;
289         handle["draw:handle-position"] = "$0 $1";
290         handle["draw:handle-range-x-minimum"] = '0';
291         handle["draw:handle-range-x-maximum"] = "?HalfWidth";
292         handle["draw:handle-range-y-minimum"] = '0';
293         handle["draw:handle-range-y-maximum"] = "height";
294         handles.append(QVariant(handle));
295 
296         ComplexType formulae;
297         formulae["HalfWidth"] = "0.5 * width";
298         formulae["RightCorner"] = "width - $0";
299 
300         KoShapeTemplate t;
301         t.id = KoPathShapeId;
302         t.templateId = "arrow_bottom";
303         t.name = i18n("Arrow");
304         t.family = "arrow";
305         t.toolTip = i18n("An arrow");
306         t.iconName = koIconName("draw-arrow-down");
307         t.properties = dataToProperties(modifiers, commands, handles, formulae);
308 
309         addTemplate(t);
310     }
311 }
312 
addCallout()313 void EnhancedPathShapeFactory::addCallout()
314 {
315     QString modifiers("4250 45000");
316 
317     QStringList commands;
318     commands.append("M 3590 0");
319     commands.append("X 0 3590");
320     commands.append("L ?f2 ?f3 0 8970 0 12630 ?f4 ?f5 0 18010");
321     commands.append("Y 3590 21600");
322     commands.append("L ?f6 ?f7 8970 21600 12630 21600 ?f8 ?f9 18010 21600");
323     commands.append("X 21600 18010");
324     commands.append("L ?f10 ?f11 21600 12630 21600 8970 ?f12 ?f13 21600 3590");
325     commands.append("Y 18010 0");
326     commands.append("L ?f14 ?f15 12630 0 8970 0 ?f16 ?f17");
327     commands.append("Z");
328     commands.append("N");
329 
330     ComplexType formulae;
331     formulae["f0"] = "$0 -10800";
332     formulae["f1"] = "$1 -10800";
333     formulae["f2"] = "if(?f18 ,$0 ,0)";
334     formulae["f3"] = "if(?f18 ,$1 ,6280)";
335     formulae["f4"] = "if(?f23 ,$0 ,0)";
336     formulae["f5"] = "if(?f23 ,$1 ,15320)";
337     formulae["f6"] = "if(?f26 ,$0 ,6280)";
338     formulae["f7"] = "if(?f26 ,$1 ,21600)";
339     formulae["f8"] = "if(?f29 ,$0 ,15320)";
340     formulae["f9"] = "if(?f29 ,$1 ,21600)";
341     formulae["f10"] = "if(?f32 ,$0 ,21600)";
342     formulae["f11"] = "if(?f32 ,$1 ,15320)";
343     formulae["f12"] = "if(?f34 ,$0 ,21600)";
344     formulae["f13"] = "if(?f34 ,$1 ,6280)";
345     formulae["f14"] = "if(?f36 ,$0 ,15320)";
346     formulae["f15"] = "if(?f36 ,$1 ,0)";
347     formulae["f16"] = "if(?f38 ,$0 ,6280)";
348     formulae["f17"] = "if(?f38 ,$1 ,0)";
349     formulae["f18"] = "if($0 ,-1,?f19)";
350     formulae["f19"] = "if(?f1 ,-1,?f22)";
351     formulae["f20"] = "abs(?f0)";
352     formulae["f21"] = "abs(?f1)";
353     formulae["f22"] = "?f20 -?f21";
354     formulae["f23"] = "if($0 ,-1,?f24)";
355     formulae["f24"] = "if(?f1 ,?f22 ,-1)";
356     formulae["f25"] = "$1 -21600";
357     formulae["f26"] = "if(?f25 ,?f27 ,-1)";
358     formulae["f27"] = "if(?f0 ,-1,?f28)";
359     formulae["f28"] = "?f21 -?f20";
360     formulae["f29"] = "if(?f25 ,?f30 ,-1)";
361     formulae["f30"] = "if(?f0 ,?f28 ,-1)";
362     formulae["f31"] = "$0 -21600";
363     formulae["f32"] = "if(?f31 ,?f33 ,-1)";
364     formulae["f33"] = "if(?f1 ,?f22 ,-1)";
365     formulae["f34"] = "if(?f31 ,?f35 ,-1)";
366     formulae["f35"] = "if(?f1 ,-1,?f22)";
367     formulae["f36"] = "if($1 ,-1,?f37)";
368     formulae["f37"] = "if(?f0 ,?f28 ,-1)";
369     formulae["f38"] = "if($1 ,-1,?f39)";
370     formulae["f39"] = "if(?f0 ,-1,?f28)";
371     formulae["f40"] = "$0";
372     formulae["f41"] = "$1";
373 
374     ListType handles;
375     ComplexType handle;
376     handle["draw:handle-position"] = "$0 $1";
377     handles.append(QVariant(handle));
378 
379     KoShapeTemplate t;
380     t.id = KoPathShapeId;
381     t.templateId = "callout";
382     t.name = i18n("Callout");
383     t.family = "funny";
384     t.toolTip = i18n("A callout");
385     t.iconName = koIconName("callout-shape");
386     KoProperties *properties = dataToProperties(modifiers, commands, handles, formulae);
387     properties->setProperty(QLatin1String("viewBox"), QRect(0, 0, 21600, 21600));
388     t.properties = properties;
389 
390     addTemplate(t);
391 }
392 
addSmiley()393 void EnhancedPathShapeFactory::addSmiley()
394 {
395     QString modifiers("17520");
396 
397     QStringList commands;
398     commands.append("U 10800 10800 10800 10800 0 23592960");
399     commands.append("Z");
400     commands.append("N");
401     commands.append("U 7305 7515 1165 1165 0 23592960");
402     commands.append("Z");
403     commands.append("N");
404     commands.append("U 14295 7515 1165 1165 0 23592960");
405     commands.append("Z");
406     commands.append("N");
407     commands.append("M 4870 ?f1");
408     commands.append("C 8680 ?f2 12920 ?f2 16730 ?f1");
409     commands.append("Z");
410     commands.append("F");
411     commands.append("N");
412 
413     ComplexType formulae;
414     formulae["f0"] = "$0 -15510";
415     formulae["f1"] = "17520-?f0";
416     formulae["f2"] = "15510+?f0";
417 
418     ListType handles;
419     ComplexType handle;
420     handle["draw:handle-position"] = "10800 $0";
421     handle["draw:handle-range-y-minimum"] = "15510";
422     handle["draw:handle-range-y-maximum"] = "17520";
423     handles.append(QVariant(handle));
424 
425     KoShapeTemplate t;
426     t.id = KoPathShapeId;
427     t.templateId = "smiley";
428     t.name = i18n("Smiley");
429     t.family = "funny";
430     t.toolTip = i18n("Smiley");
431     t.iconName = koIconName("smiley-shape");
432     KoProperties *properties = dataToProperties(modifiers, commands, handles, formulae);
433     properties->setProperty(QLatin1String("viewBox"), QRect(0, 0, 21600, 21600));
434     t.properties = properties;
435 
436     addTemplate(t);
437 }
438 
addCircularArrow()439 void EnhancedPathShapeFactory::addCircularArrow()
440 {
441     QString modifiers("180 0 5500");
442 
443     QStringList commands;
444     commands.append("B ?f3 ?f3 ?f20 ?f20 ?f19 ?f18 ?f17 ?f16");
445     commands.append("W 0 0 21600 21600 ?f9 ?f8 ?f11 ?f10");
446     commands.append("L ?f24 ?f23 ?f36 ?f35 ?f29 ?f28");
447     commands.append("Z");
448     commands.append("N");
449 
450     ComplexType formulae;
451 
452     formulae["f0"] = "$0";
453     formulae["f1"] = "$1";
454     formulae["f2"] = "$2";
455     formulae["f3"] = "10800+$2";
456     formulae["f4"] = "10800*sin($0 *(pi/180))";
457     formulae["f5"] = "10800*cos($0 *(pi/180))";
458     formulae["f6"] = "10800*sin($1 *(pi/180))";
459     formulae["f7"] = "10800*cos($1 *(pi/180))";
460     formulae["f8"] = "?f4 +10800";
461     formulae["f9"] = "?f5 +10800";
462     formulae["f10"] = "?f6 +10800";
463     formulae["f11"] = "?f7 +10800";
464     formulae["f12"] = "?f3 *sin($0 *(pi/180))";
465     formulae["f13"] = "?f3 *cos($0 *(pi/180))";
466     formulae["f14"] = "?f3 *sin($1 *(pi/180))";
467     formulae["f15"] = "?f3 *cos($1 *(pi/180))";
468     formulae["f16"] = "?f12 +10800";
469     formulae["f17"] = "?f13 +10800";
470     formulae["f18"] = "?f14 +10800";
471     formulae["f19"] = "?f15 +10800";
472     formulae["f20"] = "21600-?f3";
473     formulae["f21"] = "13500*sin($1 *(pi/180))";
474     formulae["f22"] = "13500*cos($1 *(pi/180))";
475     formulae["f23"] = "?f21 +10800";
476     formulae["f24"] = "?f22 +10800";
477     formulae["f25"] = "$2 -2700";
478     formulae["f26"] = "?f25 *sin($1 *(pi/180))";
479     formulae["f27"] = "?f25 *cos($1 *(pi/180))";
480     formulae["f28"] = "?f26 +10800";
481     formulae["f29"] = "?f27 +10800";
482     formulae["f30"] = "($1+45)*pi/180";
483     formulae["f31"] = "sqrt(((?f29-?f24)*(?f29-?f24))+((?f28-?f23)*(?f28-?f23)))";
484     formulae["f32"] = "sqrt(2)/2*?f31";
485     formulae["f33"] = "?f32*sin(?f30)";
486     formulae["f34"] = "?f32*cos(?f30)";
487     formulae["f35"] = "?f28+?f33";
488     formulae["f36"] = "?f29+?f34";
489 
490     ListType handles;
491     ComplexType handle;
492     handle["draw:handle-position"] = "$0 10800";
493     handle["draw:handle-polar"] = "10800 10800";
494     handle["draw:handle-radius-range-minimum"] = "10800";
495     handle["draw:handle-radius-range-maximum"] = "10800";
496     handles.append(QVariant(handle));
497 
498     handle.clear();
499     handle["draw:handle-position"] = "$1 $2";
500     handle["draw:handle-polar"] = "10800 10800";
501     handle["draw:handle-radius-range-minimum"] = '0';
502     handle["draw:handle-radius-range-maximum"] = "10800";
503     handles.append(QVariant(handle));
504 
505     KoShapeTemplate t;
506     t.id = KoPathShapeId;
507     t.templateId = "circulararrow";
508     t.name = i18n("Circular Arrow");
509     t.family = "arrow";
510     t.toolTip = i18n("A circular-arrow");
511     t.iconName = koIconName("circular-arrow-shape");
512     KoProperties *properties = dataToProperties(modifiers, commands, handles, formulae);
513     properties->setProperty(QLatin1String("viewBox"), QRect(0, 0, 21600, 21600));
514     t.properties = properties;
515     addTemplate(t);
516 }
517 
addGearhead()518 void EnhancedPathShapeFactory::addGearhead()
519 {
520     QStringList commands;
521     commands.append("M 20 70");
522     commands.append("L 20 100 30 100 30 50 30 70 40 70 40 40 0 40 0 70 10 70 10 50 10 100 20 100");
523     commands.append("Z");
524     commands.append("N");
525 
526     uint toothCount = 10;
527     qreal toothAngle = 360.0 / qreal(toothCount);
528     //kDebug() <<"toothAngle =" << toothAngle;
529     qreal outerRadius = 0.5 * 25.0;
530     qreal innerRadius = 0.5 * 17.0;
531     QPointF center(20, 25);
532     qreal radian = (270.0 - 0.35 * toothAngle) * M_PI / 180.0;
533     commands.append(QString("M %1 %2").arg(center.x() + innerRadius * cos(radian)).arg(center.y() + innerRadius * sin(radian)));
534     QString cmd("L");
535     for (uint i = 0; i < toothCount; ++i) {
536         radian += 0.15 * toothAngle * M_PI / 180.0;
537         cmd += QString(" %1 %2").arg(center.x() + outerRadius * cos(radian)).arg(center.y() + outerRadius * sin(radian));
538         radian += 0.35 * toothAngle * M_PI / 180.0;
539         cmd += QString(" %1 %2").arg(center.x() + outerRadius * cos(radian)).arg(center.y() + outerRadius * sin(radian));
540         radian += 0.15 * toothAngle * M_PI / 180.0;
541         cmd += QString(" %1 %2").arg(center.x() + innerRadius * cos(radian)).arg(center.y() + innerRadius * sin(radian));
542         radian += 0.35 * toothAngle * M_PI / 180.0;
543         cmd += QString(" %1 %2").arg(center.x() + innerRadius * cos(radian)).arg(center.y() + innerRadius * sin(radian));
544     }
545     //kDebug() <<"gear command =" << cmd;
546     commands.append(cmd);
547     commands.append("Z");
548     commands.append("N");
549 
550     KoShapeTemplate t;
551     t.id = KoPathShapeId;
552     t.templateId = "gearhead";
553     t.name = i18n("Gearhead");
554     t.family = "funny";
555     t.toolTip = i18n("A gearhead");
556     t.iconName = koIconName("gearhead-shape");
557     KoProperties *properties = dataToProperties(QString(), commands, ListType(), ComplexType());
558     properties->setProperty("background", QVariant::fromValue<QColor>(QColor(Qt::blue)));
559     properties->setProperty(QLatin1String("viewBox"), QRect(0, 0, 40, 90));
560     t.properties = properties;
561     addTemplate(t);
562 }
563 
supports(const KoXmlElement & e,KoShapeLoadingContext & context) const564 bool EnhancedPathShapeFactory::supports(const KoXmlElement &e, KoShapeLoadingContext &context) const
565 {
566     Q_UNUSED(context);
567     return (e.localName() == "custom-shape" && e.namespaceURI() == KoXmlNS::draw);
568 }
569