Warning, file /office/calligra/libs/flake/KoConnectionShapeFactory.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  *
0003  * Copyright (C) 2007 Boudewijn Rempt <boud@kde.org>
0004  * Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
0005  * Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
0006  *
0007  * This library is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU Library General Public
0009  * License as published by the Free Software Foundation; either
0010  * version 2 of the License, or (at your option) any later version.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Library General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Library General Public License
0018  * along with this library; see the file COPYING.LIB.  If not, write to
0019  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020  * Boston, MA 02110-1301, USA.
0021  */
0022 
0023 #include "KoConnectionShapeFactory.h"
0024 
0025 #include "KoConnectionShape.h"
0026 #include "KoConnectionShapeConfigWidget.h"
0027 
0028 #include <KoXmlNS.h>
0029 #include <KoIcon.h>
0030 #include <klocalizedstring.h>
0031 #include <KoShapeStroke.h>
0032 #include <KoShapeLoadingContext.h>
0033 
0034 KoConnectionShapeFactory::KoConnectionShapeFactory()
0035         : KoShapeFactoryBase(KOCONNECTIONSHAPEID, i18n("Tie"))
0036 {
0037     setToolTip(i18n("A connection between two other shapes"));
0038     setIconName(koIconName("x-shape-connection"));
0039     setXmlElementNames(KoXmlNS::draw, QStringList("connector"));
0040     setLoadingPriority(1);
0041     setHidden(true); // Don't show this shape in collections. Only ConnectionTool should create
0042 }
0043 
0044 KoShape* KoConnectionShapeFactory::createDefaultShape(KoDocumentResourceManager *) const
0045 {
0046     KoConnectionShape * shape = new KoConnectionShape();
0047     shape->setStroke(new KoShapeStroke());
0048     shape->setShapeId(KoPathShapeId);
0049     return shape;
0050 }
0051 
0052 bool KoConnectionShapeFactory::supports(const KoXmlElement & e, KoShapeLoadingContext &context) const
0053 {
0054     Q_UNUSED(context);
0055     return (e.localName() == "connector" && e.namespaceURI() == KoXmlNS::draw);
0056 }
0057 
0058 QList<KoShapeConfigWidgetBase*> KoConnectionShapeFactory::createShapeOptionPanels()
0059 {
0060     QList<KoShapeConfigWidgetBase*> panels;
0061     panels.append(new KoConnectionShapeConfigWidget());
0062     return panels;
0063 }