opencalcexport.h
1/* This file is part of the KDE project
2 Copyright (C) 2000 - 2003 David Faure <faure@kde.org>
3 Copyright (C) 2003 Norbert Andres <nandres@web.de>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef OPENCALCEXPORT_H
22#define OPENCALCEXPORT_H
23
24#include "opencalcstyleexport.h"
25
26#include <KoFilter.h>
27#include <tqptrlist.h>
28
29class TQDomDocument;
30class TQDomElement;
31class TDELocale;
32class KoStore;
33
34namespace KSpread
35{
36class Doc;
37class Sheet;
38}
39
40class OpenCalcExport : public KoFilter
41{
42 TQ_OBJECT
43
44
45 public:
46 OpenCalcExport( KoFilter * parent, const char * name, const TQStringList & );
47 virtual ~OpenCalcExport() {}
48
49 virtual KoFilter::ConversionStatus convert( const TQCString & from,
50 const TQCString & to );
51
52 private:
53 enum files { metaXML = 0x01, contentXML = 0x02, stylesXML = 0x04, settingsXML = 0x08 };
54 OpenCalcStyles m_styles;
55
56 bool writeFile( const KSpread::Doc * ksdoc );
57
58 bool exportDocInfo( KoStore * store, const KSpread::Doc * ksdoc );
59 bool exportStyles ( KoStore * store, const KSpread::Doc * ksdoc );
60 bool exportContent( KoStore * store, const KSpread::Doc * ksdoc );
61 bool exportSettings( KoStore * store, const KSpread::Doc * ksdoc );
62
63 bool exportBody( TQDomDocument & doc, TQDomElement & content, const KSpread::Doc * ksdoc );
64 void exportSheet( TQDomDocument & doc, TQDomElement & tabElem,
65 const KSpread::Sheet * sheet, int maxCols, int maxRows );
66 void exportCells( TQDomDocument & doc, TQDomElement & rowElem,
67 const KSpread::Sheet * sheet, int row, int maxCols );
68 void exportDefaultCellStyle( TQDomDocument & doc, TQDomElement & officeStyles );
69 void exportPageAutoStyles( TQDomDocument & doc, TQDomElement & autoStyles,
70 const KSpread::Doc * ksdoc );
71 void exportMasterStyles( TQDomDocument & doc, TQDomElement & masterStyles,
72 const KSpread::Doc *ksdoc );
73
74 bool writeMetaFile( KoStore * store, uint filesWritten );
75
76 void maxRowCols( const KSpread::Sheet * sheet,
77 int & maxCols, int & maxRows );
78 void convertPart( TQString const & part, TQDomDocument & doc,
79 TQDomElement & parent, const KSpread::Doc * ksdoc );
80 void addText( TQString const & text, TQDomDocument & doc,
81 TQDomElement & parent );
82
83 void createDefaultStyles();
84 TQString convertFormula( TQString const & formula ) const;
85private:
87 TDELocale* m_locale;
88};
89
90#endif