File indexing completed on 2024-05-12 16:36:48

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2007 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 #ifndef KPRSOUNDCOLLECTION_H
0020 #define KPRSOUNDCOLLECTION_H
0021 
0022 #include <KoDataCenterBase.h>
0023 #include <QStringList>
0024 #include <QObject>
0025 #include <QVariant>
0026 
0027 #include "stage_export.h"
0028 
0029 class KPrSoundData;
0030 class KoStore;
0031 
0032 /**
0033  * An collection of KPrSoundData objects to allow loading and saving them all together to the KoStore.
0034  */
0035 class STAGE_EXPORT KPrSoundCollection : public QObject, public KoDataCenterBase {
0036     Q_OBJECT
0037 public:
0038     /// constructor
0039     explicit KPrSoundCollection(QObject *parent = 0);
0040     ~KPrSoundCollection() override;
0041 
0042     /**
0043      * Load all sounds from the store which have a recognized KPrSoundData::storeHref().
0044      * @return returns true if load was successful (no sounds failed).
0045      */
0046     bool completeLoading(KoStore *store) override;
0047 
0048     /**
0049      * Save all sounds to the store which are tagged for saving
0050      * and have a recognized KPrSoundData::storeHref().
0051      * @return returns true if save was successful (no sounds failed).
0052      */
0053     bool completeSaving(KoStore *store, KoXmlWriter * manifestWriter, KoShapeSavingContext * context ) override;
0054 
0055     KPrSoundData *findSound(const QString &title);
0056 
0057     QStringList titles();
0058 
0059 protected:
0060     friend class KPrSoundData;
0061     void addSound(KPrSoundData *image);
0062     void removeSound(KPrSoundData *image);
0063 
0064 
0065 private:
0066     class Private;
0067     Private * const d;
0068 };
0069 
0070 Q_DECLARE_METATYPE(KPrSoundCollection*)
0071 #endif