1 /* 2 * Copyright (C) 2010-2015 by Stephen Allewell 3 * steve.allewell@gmail.com 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 */ 10 11 12 #ifndef DocumentPalette_H 13 #define DocumentPalette_H 14 15 16 #include <QDataStream> 17 #include <QList> 18 #include <QMap> 19 #include <QSharedDataPointer> 20 #include <QStringList> 21 22 #include "DocumentFloss.h" 23 24 25 class QString; 26 27 class DocumentPaletteData; 28 29 30 class DocumentPalette 31 { 32 public: 33 DocumentPalette(); 34 DocumentPalette(const DocumentPalette &other); 35 ~DocumentPalette(); 36 37 QString schemeName() const; 38 QString symbolLibrary() const; 39 QMap<int, DocumentFloss *> flosses() const; 40 QVector<int> sortedFlosses() const; 41 QList<qint16> usedSymbols() const; 42 const DocumentFloss *currentFloss() const; 43 DocumentFloss *floss(int); 44 int currentIndex() const; 45 46 void setSchemeName(const QString &); 47 void setSymbolLibrary(const QString &); 48 void setCurrentIndex(int); 49 void add(int, DocumentFloss *); 50 int add(const QColor &); 51 DocumentFloss *remove(int); 52 DocumentFloss *replace(int, DocumentFloss *); 53 void swap(int, int); 54 qint16 freeSymbol() const; 55 56 DocumentPalette &operator=(const DocumentPalette &); 57 bool operator==(const DocumentPalette &) const; 58 bool operator!=(const DocumentPalette &) const; 59 60 friend QDataStream &operator<<(QDataStream &, const DocumentPalette &); 61 friend QDataStream &operator>>(QDataStream &, DocumentPalette &); 62 63 private: 64 int freeIndex() const; 65 66 QSharedDataPointer<DocumentPaletteData> d; 67 }; 68 69 70 QDataStream &operator<<(QDataStream &, const DocumentPalette &); 71 QDataStream &operator>>(QDataStream &, DocumentPalette &); 72 73 74 #endif // DocumentPalette_H 75