kspread

kspread_map.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __kspread_map_h__
00021 #define __kspread_map_h__
00022 
00023 #include <qcstring.h>
00024 #include <qptrlist.h>
00025 #include <qstring.h>
00026 #include <qstringlist.h>
00027 #include <qintdict.h>
00028 #include <qobject.h>
00029 #include <qdict.h>
00030 
00031 #include <koffice_export.h>
00032 
00033 class KoStore;
00034 class KoOasisLoadingContext;
00035 class KoOasisStyles;
00036 
00037 class DCOPObject;
00038 
00039 class QDomElement;
00040 class QDomDocument;
00041 class KoXmlWriter;
00042 class KoGenStyles;
00043 class KoOasisSettings;
00044 
00045 namespace KSpread
00046 {
00047 class Changes;
00048 class Map;
00049 class Doc;
00050 class Sheet;
00051 class GenValidationStyles;
00052 class Style;
00053 
00058 class KSPREAD_EXPORT Map : public QObject
00059 {
00060 Q_OBJECT
00061 public:
00065   Map(Doc* doc, const char* name = 0);
00069   virtual ~Map();
00070 
00071   Doc* doc() const;
00072 
00073   QDomElement save( QDomDocument& doc );
00074 
00075     void saveOasisSettings( KoXmlWriter &settingsWriter );
00076     void loadOasisSettings( KoOasisSettings &settings );
00077 
00078     bool saveOasis( KoXmlWriter & xmlWriter, KoGenStyles & mainStyles, KoStore *store, KoXmlWriter* manifestWriter, int &_indexObj, int &_partIndexObj );
00079 
00080   bool loadOasis( const QDomElement& mymap, KoOasisLoadingContext& oasisContext );
00081   bool loadXML( const QDomElement& mymap );
00082   bool loadChildren( KoStore* _store );
00083 
00084   bool saveChildren( KoStore* _store );
00085 
00086   void password( QCString & passwd ) const { passwd = m_strPassword; }
00087   bool isProtected() const { return !m_strPassword.isNull(); }
00088   void setProtected( QCString const & passwd );
00089   bool checkPassword( QCString const & passwd ) const { return ( passwd == m_strPassword ); }
00090 
00096   void moveSheet( const QString & _from, const QString & _to, bool _before = true );
00097 
00102   Sheet* findSheet( const QString & _name );
00103   Sheet* nextSheet( Sheet* );
00104   Sheet* previousSheet( Sheet* );
00105 
00106   Sheet* initialActiveSheet()const { return m_initialActiveSheet; }
00107   int initialMarkerColumn() const { return m_initialMarkerColumn; }
00108   int initialMarkerRow()    const { return m_initialMarkerRow; }
00109   double initialXOffset()   const { return m_initialXOffset; }
00110   double initialYOffset()   const { return m_initialYOffset; }
00111 
00112 
00117   Sheet * createSheet();
00119   void addSheet( Sheet *_sheet );
00120 
00122   Sheet *addNewSheet ();
00123 
00130   Sheet* firstSheet() { return m_lstSheets.first();  }
00131 
00138   Sheet* lastSheet() { return m_lstSheets.last();  }
00139 
00146   Sheet* nextSheet() { return m_lstSheets.next();  }
00147 
00148   QPtrList<Sheet>& sheetList() { return m_lstSheets; }
00149 
00153   int count()const { return m_lstSheets.count(); }
00154 
00155   void update();
00156 
00160     // void draw( QPaintDevice* _dev, long int _width, long int _height,
00161     // float _scale );
00162 
00163   virtual DCOPObject* dcopObject();
00164 
00165   void takeSheet( Sheet * sheet );
00166   void insertSheet( Sheet * sheet );
00167 
00168   QStringList visibleSheets() const;
00169   QStringList hiddenSheets() const;
00170 
00171     static bool respectCase;
00172 
00173 signals:
00174 
00178   void sig_addSheet( Sheet *_table );
00179 private:
00180 
00181   Doc* m_doc;
00182 
00186   QPtrList<Sheet> m_lstSheets;
00187   QPtrList<Sheet> m_lstDeletedSheets;
00188 
00192   QCString m_strPassword;
00196   Sheet * m_initialActiveSheet;
00197   int m_initialMarkerColumn;
00198   int m_initialMarkerRow;
00199   double m_initialXOffset;
00200   double m_initialYOffset;
00201 
00202   // used to give every Sheet a unique default name.
00203   int tableId;
00204 
00205   DCOPObject* m_dcop;
00206 };
00207 
00208 } // namespace KSpread
00209 
00210 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys