filters

opencalcexport.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2000 - 2003 David Faure <faure@kde.org>
00003    Copyright (C) 2003 Norbert Andres <nandres@web.de>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef OPENCALCEXPORT_H
00022 #define OPENCALCEXPORT_H
00023 
00024 #include "opencalcstyleexport.h"
00025 
00026 #include <KoFilter.h>
00027 #include <qptrlist.h>
00028 
00029 class QDomDocument;
00030 class QDomElement;
00031 class KLocale;
00032 class KoStore;
00033 
00034 namespace KSpread
00035 {
00036 class Doc;
00037 class Sheet;
00038 }
00039 
00040 class OpenCalcExport : public KoFilter
00041 {
00042   Q_OBJECT
00043 
00044  public:
00045   OpenCalcExport( KoFilter * parent, const char * name, const QStringList & );
00046   virtual ~OpenCalcExport() {}
00047 
00048   virtual KoFilter::ConversionStatus convert( const QCString & from,
00049                                               const QCString & to );
00050 
00051  private:
00052   enum files { metaXML = 0x01, contentXML = 0x02, stylesXML = 0x04, settingsXML = 0x08 };
00053   OpenCalcStyles m_styles;
00054 
00055   bool writeFile( const KSpread::Doc * ksdoc );
00056 
00057   bool exportDocInfo( KoStore * store, const KSpread::Doc * ksdoc );
00058   bool exportStyles ( KoStore * store, const KSpread::Doc * ksdoc );
00059   bool exportContent( KoStore * store, const KSpread::Doc * ksdoc );
00060   bool exportSettings( KoStore * store, const KSpread::Doc * ksdoc );
00061 
00062   bool exportBody( QDomDocument & doc, QDomElement & content, const KSpread::Doc * ksdoc );
00063   void exportSheet( QDomDocument & doc, QDomElement & tabElem,
00064                     const KSpread::Sheet * sheet, int maxCols, int maxRows );
00065   void exportCells( QDomDocument & doc, QDomElement & rowElem,
00066                     const KSpread::Sheet * sheet, int row, int maxCols );
00067   void exportDefaultCellStyle( QDomDocument & doc, QDomElement & officeStyles );
00068   void exportPageAutoStyles( QDomDocument & doc, QDomElement & autoStyles,
00069                              const KSpread::Doc * ksdoc );
00070   void exportMasterStyles( QDomDocument & doc, QDomElement & masterStyles,
00071                            const KSpread::Doc *ksdoc );
00072 
00073   bool writeMetaFile( KoStore * store, uint filesWritten );
00074 
00075   void maxRowCols( const KSpread::Sheet * sheet,
00076                    int & maxCols, int & maxRows );
00077   void convertPart( QString const & part, QDomDocument & doc,
00078                     QDomElement & parent, const KSpread::Doc * ksdoc );
00079   void addText( QString const & text, QDomDocument & doc,
00080                 QDomElement & parent );
00081 
00082   void createDefaultStyles();
00083   QString convertFormula( QString const & formula ) const;
00084 private:
00086     KLocale* m_locale;
00087 };
00088 
00089 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys