File indexing completed on 2024-05-12 16:34:02

0001 /* This file is part of the KDE project
0002 
0003    Copyright 2008 Johannes Simon <johannes.simon@gmail.com>
0004    Copyright 2010 Inge Wallin <inge@lysator.liu.se>
0005 
0006    This library is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU Library General Public
0008    License as published by the Free Software Foundation; either
0009    version 2 of the License, or (at your option) any later version.
0010 
0011    This library is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014    Library General Public License for more details.
0015 
0016    You should have received a copy of the GNU Library General Public License
0017    along with this library; see the file COPYING.LIB.  If not, write to
0018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019  * Boston, MA 02110-1301, USA.
0020 */
0021 
0022 #ifndef KFORMULA_FORMULADOCUMENT_H
0023 #define KFORMULA_FORMULADOCUMENT_H
0024 
0025 // Calligra
0026 #include <KoDocument.h>
0027 #include <KoXmlReaderForward.h>
0028 
0029 
0030 class KoView;
0031 class KoOdfReadStore;
0032 class QPainter;
0033 class QWidget;
0034 
0035 class KoFormulaShape;
0036 
0037 #define FORMULA_MIME_TYPE "application/vnd.oasis.opendocument.formula"
0038 
0039 class FormulaDocument : public KoDocument
0040 {
0041 public:
0042     explicit FormulaDocument(KoFormulaShape *parent);
0043     ~FormulaDocument() override;
0044     
0045 
0046     /// reimplemented from KoDocument
0047     QByteArray nativeFormatMimeType() const override { return FORMULA_MIME_TYPE; }
0048     /// reimplemented from KoDocument
0049     QByteArray nativeOasisMimeType() const override {return FORMULA_MIME_TYPE; }
0050     /// reimplemented from KoDocument
0051     QStringList extraNativeMimeTypes() const override
0052     {
0053         return QStringList() << "application/x-kformula"
0054                              << "application/vnd.oasis.opendocument.formula-template"
0055                              << "text/mathml";
0056 
0057     }
0058 
0059     bool loadOdf( KoOdfReadStore &odfStore ) override;
0060     bool loadXML( const KoXmlDocument &doc, KoStore *store ) override;
0061     
0062     bool saveOdf( SavingContext &context ) override;
0063     KoView *createViewInstance( QWidget *parent );
0064     
0065     void paintContent( QPainter &painter, const QRect &rect ) override; 
0066     
0067 private:
0068     class Private;
0069     Private * const d;
0070 };
0071 
0072 #endif // KFORMULA_FORMULADOCUMENT_H
0073