File indexing completed on 2024-04-28 16:21:22
0001 /* This file is part of the KDE project 0002 Copyright 2010 Marijn Kruisselbrink <mkruisselbrink@kde.org> 0003 Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net> 0004 Copyright 2007 Thorsten Zachmann <zachmann@kde.org> 0005 Copyright 2004 Ariya Hidayat <ariya@kde.org> 0006 Copyright 2002-2003 Norbert Andres <nandres@web.de> 0007 Copyright 2000-2005 Laurent Montel <montel@kde.org> 0008 Copyright 2002 John Dailey <dailey@vt.edu> 0009 Copyright 2002 Phillip Mueller <philipp.mueller@gmx.de> 0010 Copyright 2000 Werner Trobin <trobin@kde.org> 0011 Copyright 1999-2000 Simon Hausmann <hausmann@kde.org> 0012 Copyright 1999 David Faure <faure@kde.org> 0013 Copyright 1998-2000 Torben Weis <weis@kde.org> 0014 0015 This library is free software; you can redistribute it and/or 0016 modify it under the terms of the GNU Library General Public 0017 License as published by the Free Software Foundation; either 0018 version 2 of the License, or (at your option) any later version. 0019 0020 This library is distributed in the hope that it will be useful, 0021 but WITHOUT ANY WARRANTY; without even the implied warranty of 0022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0023 Library General Public License for more details. 0024 0025 You should have received a copy of the GNU Library General Public License 0026 along with this library; see the file COPYING.LIB. If not, write to 0027 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0028 Boston, MA 02110-1301, USA. 0029 */ 0030 0031 #ifndef CALLIGRA_SHEETS_DOCBASE_H 0032 #define CALLIGRA_SHEETS_DOCBASE_H 0033 0034 #include <KoDocument.h> 0035 0036 #include "sheets_odf_export.h" 0037 0038 class KoDocumentResourceManager; 0039 class KoPart; 0040 0041 #define SHEETS_MIME_TYPE "application/vnd.oasis.opendocument.spreadsheet" 0042 0043 namespace Calligra 0044 { 0045 namespace Sheets 0046 { 0047 class Map; 0048 class Sheet; 0049 class SheetAccessModel; 0050 0051 class CALLIGRA_SHEETS_ODF_EXPORT DocBase : public KoDocument 0052 { 0053 Q_OBJECT 0054 public: 0055 0056 /** 0057 * Creates a new document. 0058 * @param part The KoPart that owns the document. XXX: should be removed! 0059 */ 0060 explicit DocBase(KoPart *part); 0061 ~DocBase() override; 0062 0063 /** 0064 * @return list of all documents 0065 */ 0066 static QList<DocBase*> documents(); 0067 0068 void setReadWrite(bool readwrite = true) override; 0069 0070 /// reimplemented from KoDocument 0071 QByteArray nativeFormatMimeType() const override { return SHEETS_MIME_TYPE; } 0072 /// reimplemented from KoDocument 0073 QByteArray nativeOasisMimeType() const override {return SHEETS_MIME_TYPE;} 0074 /// reimplemented from KoDocument 0075 QStringList extraNativeMimeTypes() const override 0076 { 0077 return QStringList() << "application/vnd.oasis.opendocument.spreadsheet-template" 0078 << "application/x-kspread"; 0079 } 0080 0081 /** 0082 * @return the Map that belongs to this Document 0083 */ 0084 Map *map() const; 0085 0086 /** 0087 * Returns the syntax version of the currently opened file 0088 */ 0089 int syntaxVersion() const; 0090 0091 /** 0092 * Return a pointer to the resource manager associated with the 0093 * document. The resource manager contains 0094 * document wide resources * such as variable managers, the image 0095 * collection and others. 0096 * @see KoCanvasBase::resourceManager() 0097 */ 0098 KoDocumentResourceManager *resourceManager() const; 0099 0100 SheetAccessModel *sheetAccessModel() const; 0101 0102 virtual void initConfig(); 0103 0104 QStringList spellListIgnoreAll() const; 0105 void setSpellListIgnoreAll(const QStringList &list); 0106 0107 0108 /** 0109 * \ingroup OpenDocument 0110 * Main saving method. 0111 */ 0112 bool saveOdf(SavingContext &documentContext) override; 0113 0114 /** 0115 * \ingroup OpenDocument 0116 * Main loading method. Wrapper around Odf::loadDocument. 0117 * @see Map::loadOdf 0118 */ 0119 bool loadOdf(KoOdfReadStore & odfStore) override; 0120 protected: 0121 class Private; 0122 Private * const d; 0123 0124 void paintContent(QPainter & painter, const QRect & rect) override; 0125 bool loadXML(const KoXmlDocument& doc, KoStore *store) override; 0126 0127 private: 0128 Q_DISABLE_COPY(DocBase) 0129 }; 0130 0131 } // namespace Sheets 0132 } // namespace Calligra 0133 0134 #endif // CALLIGRA_SHEETS_DOCBASE_H