libs/flake
KoConnectionShapeFactory.cpp
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2007 Boudewijn Rempt <boud@kde.org> 00004 * Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org> 00005 * Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net> 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Library General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public License 00018 * along with this library; see the file COPYING.LIB. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #include "KoConnectionShapeFactory.h" 00024 00025 #include "KoConnectionShape.h" 00026 #include "KoConnectionShapeConfigWidget.h" 00027 00028 #include <KoXmlNS.h> 00029 #include <klocale.h> 00030 #include <KoLineBorder.h> 00031 00032 KoConnectionShapeFactory::KoConnectionShapeFactory(QObject* parent) 00033 : KoShapeFactory(parent, KOCONNECTIONSHAPEID, i18n("Tie")) 00034 { 00035 setToolTip(i18n("A connection between two other shapes")); 00036 setIcon("x-shape-connection"); 00037 setOdfElementNames(KoXmlNS::draw, QStringList("connector")); 00038 setLoadingPriority(1); 00039 } 00040 00041 KoShape* KoConnectionShapeFactory::createDefaultShape() const 00042 { 00043 KoConnectionShape * shape = new KoConnectionShape(); 00044 shape->setBorder(new KoLineBorder()); 00045 shape->setShapeId(KoPathShapeId); 00046 return shape; 00047 } 00048 00049 KoShape* KoConnectionShapeFactory::createShape(const KoProperties* params) const 00050 { 00051 Q_UNUSED(params); 00052 return createDefaultShape(); 00053 } 00054 00055 bool KoConnectionShapeFactory::supports(const KoXmlElement & e) const 00056 { 00057 return (e.localName() == "connector" && e.namespaceURI() == KoXmlNS::draw); 00058 } 00059 00060 QList<KoShapeConfigWidgetBase*> KoConnectionShapeFactory::createShapeOptionPanels() 00061 { 00062 QList<KoShapeConfigWidgetBase*> panels; 00063 panels.append(new KoConnectionShapeConfigWidget()); 00064 return panels; 00065 }
