File indexing completed on 2024-12-22 04:15:26

0001 /* This file is part of the KDE project
0002  *
0003  * SPDX-FileCopyrightText: 2009 Inge Wallin <inge@lysator.liu.se>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 // Own
0009 #include "ImageShapeFactory.h"
0010 
0011 // ImageShape
0012 #include "ImageShape.h"
0013 //#include "ImageShapeConfigWidget.h"
0014 
0015 // Calligra
0016 #include <KoXmlNS.h>
0017 #include <KoShapeLoadingContext.h>
0018 #include <KoIcon.h>
0019 
0020 // KDE
0021 #include <klocalizedstring.h>
0022 
0023 ImageShapeFactory::ImageShapeFactory()
0024     : KoShapeFactoryBase(ImageShapeId, i18n("Image shape"))
0025 {
0026     setToolTip(i18n("A shape that shows an image (PNG/JPG/TIFF)"));
0027     setIconName(koIconNameCStrNeededWithSubs("a generic image icon", "x-shape-vectorimage", "application-x-wmf"));
0028 
0029     QList<QPair<QString, QStringList> > elementNamesList;
0030     elementNamesList.append(qMakePair(QString(KoXmlNS::draw), QStringList("image")));
0031     elementNamesList.append(qMakePair(QString(KoXmlNS::svg), QStringList("image")));
0032     setXmlElements(elementNamesList);
0033     setLoadingPriority(1);
0034 }
0035 
0036 KoShape *ImageShapeFactory::createDefaultShape(KoDocumentResourceManager */*documentResources*/) const
0037 {
0038     ImageShape *shape = new ImageShape();
0039     shape->setShapeId(ImageShapeId);
0040 
0041     return shape;
0042 }
0043 
0044 bool ImageShapeFactory::supports(const QDomElement &e, KoShapeLoadingContext &context) const
0045 {
0046     Q_UNUSED(context);
0047     return e.localName() == "image" &&
0048             (e.namespaceURI() == KoXmlNS::draw || e.namespaceURI() == KoXmlNS::svg);
0049 }
0050 
0051 QList<KoShapeConfigWidgetBase *> ImageShapeFactory::createShapeOptionPanels()
0052 {
0053     QList<KoShapeConfigWidgetBase *> result;
0054     //result.append(new ImageShapeConfigWidget());
0055     return result;
0056 }