libs/flake

KoShapeLoadingContext.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
00003    Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KOSHAPELOADINGCONTEXT_H
00022 #define KOSHAPELOADINGCONTEXT_H
00023 
00024 #include <QMap>
00025 #include <QSet>
00026 #include <QString>
00027 
00028 #include "flake_export.h"
00029 
00030 class KoOdfLoadingContext;
00031 class KoShapeLayer;
00032 class KoShape;
00033 class KoShapeControllerBase;
00034 class KoLoadingShapeUpdater;
00035 class KoImageCollection;
00036 class KoSharedLoadingData;
00037 class KoDataCenter;
00038 
00044 class FLAKE_EXPORT KoShapeLoadingContext
00045 {
00046 public:
00055     struct AdditionalAttributeData {
00056         AdditionalAttributeData(const char * const ns, const char * const tag, const char * name)
00057                 : ns(ns)
00058                 , tag(tag)
00059                 , name(name) {
00060         }
00061 
00062         const char * const ns;
00063         const char * const tag;
00064         const char * const name;
00065 
00066         bool operator==(const AdditionalAttributeData & other) const {
00067             return (qstrcmp(name, other.name) == 0);
00068         }
00069     };
00070 
00077     KoShapeLoadingContext(KoOdfLoadingContext & context, const QMap<QString, KoDataCenter *> & dataCenterMap);
00078 
00080     ~KoShapeLoadingContext();
00081 
00083     KoOdfLoadingContext & odfLoadingContext();
00084 
00086     KoShapeLayer * layer(const QString & layerName);
00088     void addLayer(KoShapeLayer * layer, const QString & layerName);
00089 
00095     void clearLayers();
00096 
00098     void addShapeId(KoShape * shape, const QString & id);
00100     KoShape * shapeById(const QString & id);
00101 
00106     void updateShape(const QString & id, KoLoadingShapeUpdater * shapeUpdater);
00107 
00112     void shapeLoaded(KoShape * shape);
00113 
00115     KoImageCollection * imageCollection();
00116 
00118     int zIndex();
00119 
00121     void setZIndex(int index);
00122 
00140     void addSharedData(const QString & id, KoSharedLoadingData * data);
00141 
00150     KoSharedLoadingData * sharedData(const QString & id) const;
00151 
00162     static void addAdditionalAttributeData(const AdditionalAttributeData & attributeData);
00163 
00170     static QSet<AdditionalAttributeData> additionalAttributeData();
00171 
00177     KoDataCenter * dataCenter(const QString & dataCenterName);
00178 
00182     QMap<QString, KoDataCenter *> dataCenterMap() const;
00183 
00184 private:
00185     // to allow only the KoShapeRegistry access to the KoShapeControllerBase
00186     class Private;
00187     Private * const d;
00188 };
00189 
00190 #endif /* KOSHAPELOADINGCONTEXT_H */