File indexing completed on 2024-05-12 16:35:44
0001 /* This file is part of the KDE project 0002 Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net> 0003 Copyright 2007 Thorsten Zachmann <zachmann@kde.org> 0004 Copyright 2004 Ariya Hidayat <ariya@kde.org> 0005 Copyright 2002-2003 Norbert Andres <nandres@web.de> 0006 Copyright 2000-2005 Laurent Montel <montel@kde.org> 0007 Copyright 2002 John Dailey <dailey@vt.edu> 0008 Copyright 2002 Phillip Mueller <philipp.mueller@gmx.de> 0009 Copyright 2000 Werner Trobin <trobin@kde.org> 0010 Copyright 1999-2000 Simon Hausmann <hausmann@kde.org> 0011 Copyright 1999 David Faure <faure@kde.org> 0012 Copyright 1998-2000 Torben Weis <weis@kde.org> 0013 0014 This library is free software; you can redistribute it and/or 0015 modify it under the terms of the GNU Library General Public 0016 License as published by the Free Software Foundation; either 0017 version 2 of the License, or (at your option) any later version. 0018 0019 This library is distributed in the hope that it will be useful, 0020 but WITHOUT ANY WARRANTY; without even the implied warranty of 0021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0022 Library General Public License for more details. 0023 0024 You should have received a copy of the GNU Library General Public License 0025 along with this library; see the file COPYING.LIB. If not, write to 0026 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0027 Boston, MA 02110-1301, USA. 0028 */ 0029 0030 #ifndef CALLIGRA_SHEETS_DOC 0031 #define CALLIGRA_SHEETS_DOC 0032 0033 #include <QList> 0034 #include <QMap> 0035 #include <QRect> 0036 #include <QString> 0037 0038 #include <KoDocument.h> 0039 #include <KoXmlReader.h> 0040 0041 #include "../Global.h" 0042 #include "../DocBase.h" 0043 0044 #include "sheets_common_export.h" 0045 0046 class QDomDocument; 0047 class QPainter; 0048 0049 class KoStore; 0050 class KoXmlWriter; 0051 class KoPart; 0052 0053 namespace Calligra 0054 { 0055 namespace Sheets 0056 { 0057 class Sheet; 0058 class Doc; 0059 class View; 0060 class Map; 0061 0062 /** 0063 * This class holds the data that makes up a spreadsheet. 0064 */ 0065 class CALLIGRA_SHEETS_COMMON_EXPORT Doc : public DocBase 0066 { 0067 Q_OBJECT 0068 Q_PROPERTY(int syntaxVersion READ syntaxVersion) 0069 0070 public: 0071 /** 0072 * Creates a new document. 0073 * @param part The KoPart that owns the document. XXX: should be removed! 0074 */ 0075 explicit Doc(KoPart *part); 0076 0077 /** 0078 * Destroys the document. 0079 */ 0080 ~Doc() override; 0081 0082 0083 0084 bool completeSaving(KoStore* _store) override; 0085 0086 0087 /** 0088 * \ingroup NativeFormat 0089 * Main saving method. 0090 */ 0091 QDomDocument saveXML() override; 0092 0093 /** 0094 * \ingroup NativeFormat 0095 * Main loading method. 0096 */ 0097 bool loadXML(const KoXmlDocument& doc, KoStore *store) override; 0098 0099 int supportedSpecialFormats() const override; 0100 0101 virtual bool loadChildren(KoStore* _store); 0102 0103 bool docData(QString const & xmlTag, QDomDocument & data); 0104 0105 // reimplemented; paints the thumbnail 0106 void paintContent(QPainter & painter, const QRect & rect) override; 0107 virtual void paintContent(QPainter & painter, const QRect & rect, Sheet* sheet); 0108 0109 void initConfig() override; 0110 void saveConfig(); 0111 0112 void addIgnoreWordAll(const QString & word); 0113 void clearIgnoreWordAll(); 0114 void addIgnoreWordAllList(const QStringList & _lst); 0115 QStringList spellListIgnoreAll() const ; 0116 0117 /* Function specific when we load config from file */ 0118 void loadConfigFromFile(); 0119 bool configLoadFromFile() const; 0120 0121 bool saveOdf(SavingContext &documentContext) override; 0122 0123 /** 0124 * Requests an update of all attached user interfaces (views). 0125 */ 0126 void updateAllViews(); 0127 0128 0129 public Q_SLOTS: 0130 void initEmpty() override; 0131 0132 Q_SIGNALS: 0133 /** 0134 * Emitted, if all user interfaces (views) have to be updated. 0135 */ 0136 void updateView(); 0137 0138 /** 0139 * Emitted, if all editors have to be closed. 0140 */ 0141 void closeEditor(bool); 0142 0143 protected Q_SLOTS: 0144 void sheetAdded(Sheet* sheet); 0145 0146 protected: 0147 0148 /** 0149 * @reimp Overloaded function of KoDocument. 0150 */ 0151 bool completeLoading(KoStore*) override; 0152 0153 private: 0154 Q_DISABLE_COPY(Doc) 0155 0156 class Private; 0157 Private * const dd; 0158 0159 /** 0160 * \ingroup NativeFormat 0161 */ 0162 void loadPaper(KoXmlElement const & paper); 0163 }; 0164 0165 } // namespace Sheets 0166 } // namespace Calligra 0167 0168 #endif /* CALLIGRA_SHEETS_DOC */