Warning, file /office/calligra/libs/flake/KoMarkerCollection.h 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) 2011 Thorsten Zachmann <zachmann@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 #ifndef KOMARKERCOLLECTION_H
0021 #define KOMARKERCOLLECTION_H
0022 
0023 #include "flake_export.h"
0024 
0025 #include <QObject>
0026 #include <QList>
0027 #include <QHash>
0028 #include <QMetaType>
0029 
0030 class KoMarker;
0031 class KoXmlElement;
0032 class KoShapeLoadingContext;
0033 
0034 class FLAKE_EXPORT KoMarkerCollection : public QObject
0035 {
0036     Q_OBJECT
0037 public:
0038     explicit KoMarkerCollection(QObject *parent = 0);
0039     ~KoMarkerCollection() override;
0040 
0041     bool loadOdf(KoShapeLoadingContext &context);
0042     // For now we only save the used markers and that is done with a KoSharedSavingData when a marker usage is encountered.
0043     //void saveOdf(KoShapeSavingContext &context) const;
0044 
0045     QList<KoMarker*> markers() const;
0046 
0047     /**
0048      * Add marker to collection
0049      *
0050      * The collection checks if a marker with the same content exists and if so deletes the
0051      * passed marker and returns a pointer to an existing marker. If no such marker exists it
0052      * adds the marker and return the same pointer as passed.
0053      * Calling that function passes ownership of the marker to this class.
0054      *
0055      * @param marker Marker to add
0056      * @return pointer to marker that should be used. This might be different to the marker passed
0057      */
0058     KoMarker * addMarker(KoMarker *marker);
0059 
0060 private:
0061     /// load the markers that are available per default.
0062     void loadDefaultMarkers();
0063     void loadOdfMarkers(const QHash<QString, KoXmlElement*> &markers, KoShapeLoadingContext &context, QHash<QString, KoMarker*> &lookupTable);
0064 
0065     class Private;
0066     Private * const d;
0067 };
0068 
0069 Q_DECLARE_METATYPE(KoMarkerCollection *)
0070 
0071 #endif /* KOMARKERCOLLECTION_H */