Warning, file /office/calligra/libs/text/KoInlineObjectFactoryBase.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  * Copyright (C) 2006 Thomas Zander <zander@kde.org>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #include "KoInlineObjectFactoryBase.h"
0021 #include <KoProperties.h>
0022 
0023 #include <QStringList>
0024 
0025 class InlineObjectFactoryPrivate
0026 {
0027 public:
0028     InlineObjectFactoryPrivate(const QString &identifier)
0029             : id(identifier) {
0030     }
0031 
0032     ~InlineObjectFactoryPrivate() {
0033         foreach(const KoInlineObjectTemplate &t, templates)
0034             delete t.properties;
0035         templates.clear();
0036     }
0037 
0038     const QString id;
0039     QString iconName;
0040     QString odfNameSpace;
0041     QStringList odfElementNames;
0042     QVector<KoInlineObjectTemplate> templates;
0043     KoInlineObjectFactoryBase::ObjectType type;
0044 };
0045 
0046 KoInlineObjectFactoryBase::KoInlineObjectFactoryBase(const QString &id, ObjectType type)
0047         : d(new InlineObjectFactoryPrivate(id))
0048 {
0049     d->type = type;
0050 }
0051 
0052 KoInlineObjectFactoryBase::~KoInlineObjectFactoryBase()
0053 {
0054     delete d;
0055 }
0056 
0057 QString KoInlineObjectFactoryBase::id() const
0058 {
0059     return d->id;
0060 }
0061 
0062 QVector<KoInlineObjectTemplate> KoInlineObjectFactoryBase::templates() const
0063 {
0064     return d->templates;
0065 }
0066 
0067 void KoInlineObjectFactoryBase::addTemplate(const KoInlineObjectTemplate &params)
0068 {
0069     d->templates.append(params);
0070 }
0071 
0072 QStringList KoInlineObjectFactoryBase::odfElementNames() const
0073 {
0074     return d->odfElementNames;
0075 }
0076 
0077 QString KoInlineObjectFactoryBase::odfNameSpace() const
0078 {
0079     return d->odfNameSpace;
0080 }
0081 
0082 void KoInlineObjectFactoryBase::setOdfElementNames(const QString & nameSpace, const QStringList &names)
0083 {
0084     d->odfNameSpace = nameSpace;
0085     d->odfElementNames = names;
0086 }
0087 
0088 KoInlineObjectFactoryBase::ObjectType KoInlineObjectFactoryBase::type() const
0089 {
0090     return d->type;
0091 }