karbon

karbon_part.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001, 2002, 2003 The Karbon Developers
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 __KARBON_PART_H__
00021 #define __KARBON_PART_H__
00022 
00023 
00024 #include <qptrlist.h>
00025 
00026 #include <KoDocument.h>
00027 #include <KoUnit.h>
00028 #include "vdocument.h"
00029 #include "koffice_export.h"
00030 
00031 class DCOPObject;
00032 class KoRect;
00033 class QRect;
00034 class VCommand;
00035 class VDocument;
00036 class VCommandHistory;
00037 
00045 class KARBONCOMMON_EXPORT KarbonPart : public KoDocument
00046 {
00047     Q_OBJECT
00048 public:
00049     KarbonPart( QWidget* parentWidget = 0L, const char* widgetName = 0L,
00050                 QObject* parent = 0L, const char* name = 0L, bool singleViewMode = false );
00051     virtual ~KarbonPart();
00052 
00053     virtual void paintContent( QPainter& painter, const QRect& rect,
00054                                bool transparent = false, double zoomX = 1.0, double zoomY = 1.0 );
00055 
00057     virtual bool initDoc(InitDocFlags flags, QWidget* parentWidget=0);
00058 
00060     virtual bool loadXML( QIODevice*, const QDomDocument& document );
00061     virtual bool loadOasis( const QDomDocument &doc, KoOasisStyles &styles, const QDomDocument &settings, KoStore *store );
00062 
00064     virtual QDomDocument saveXML();
00065     virtual bool saveOasis( KoStore *store, KoXmlWriter *manifestWriter );
00066 
00067     virtual void addShell( KoMainWindow *shell );
00068 
00069     virtual DCOPObject* dcopObject();
00070 
00072     void insertObject( VObject* object );
00073 
00075     void addCommand( VCommand* cmd, bool repaint = false );
00076 
00077     // access static document:
00078     VDocument& document() { return m_doc; }
00079 
00080     // Clear history.
00081     void clearHistory();
00082 
00084     VCommandHistory* commandHistory()
00085     {
00086         return m_commandHistory;
00087     }
00088 
00089     bool showStatusBar() const
00090     {
00091         return m_bShowStatusBar;
00092     }
00093 
00094     void setShowStatusBar( bool b );
00097     void reorganizeGUI();
00098 
00099     void setUndoRedoLimit( int undos );
00100 
00101     void initConfig();
00102     unsigned int maxRecentFiles() const { return m_maxRecentFiles; }
00103 
00104     void setPageLayout( KoPageLayout& layout, KoUnit::Unit _unit );
00105 
00106     bool mergeNativeFormat( const QString & file );
00107 
00108 public slots:
00110     void repaintAllViews( bool repaint = true );
00111     void repaintAllViews( const KoRect& );
00112     void slotDocumentRestored();
00113     void slotCommandExecuted( VCommand * );
00114     void slotUnitChanged( KoUnit::Unit unit );
00115 
00116 protected:
00117     virtual KoView* createViewInstance( QWidget* parent, const char* name );
00118     virtual void removeView( KoView *view );
00119     void saveOasisSettings( KoXmlWriter &/*settingsWriter*/ );
00120     void loadOasisSettings( const QDomDocument&settingsDoc );
00121 
00122 private:
00123     VDocument m_doc;                    
00124     VCommandHistory* m_commandHistory;  
00125 
00126     bool m_bShowStatusBar;              
00127     bool m_merge;
00128     unsigned int m_maxRecentFiles;              
00129     DCOPObject *dcop;
00130 };
00131 
00132 #endif
00133 
KDE Home | KDE Accessibility Home | Description of Access Keys