lib

KoMainWindow.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00003    Copyright (C) 2000-2004 David Faure <faure@kde.org>
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 __ko_main_window_h__
00022 #define __ko_main_window_h__
00023 
00024 #include <kparts/mainwindow.h>
00025 #include <kfiledialog.h>
00026 #include <koffice_export.h>
00027 #include "KoDocument.h"
00028 
00029 class QLabel;
00030 class KoView;
00031 class KoMainWindowPrivate;
00032 class KURL;
00033 class KRecentFilesAction;
00034 class KoFilterManager;
00035 class DCOPObject;
00036 
00037 namespace KParts
00038 {
00039   class PartManager;
00040 }
00041 
00051 class KOFFICECORE_EXPORT KoMainWindow : public KParts::MainWindow
00052 {
00053     Q_OBJECT
00054 public:
00055 
00061     KoMainWindow( KInstance *instance, const char *_name = 0 );
00062 
00066     ~KoMainWindow();
00067 
00072     virtual void setRootDocument( KoDocument *doc );
00073 
00078     void setDocToOpen( KoDocument *doc );
00079 
00084     virtual void updateCaption();
00085 
00089     virtual KoDocument* rootDocument() const;
00090 
00091     virtual KoView *rootView() const;
00092 
00093     virtual KParts::PartManager *partManager();
00094 
00099     void print(bool quick);
00100 
00105     void showToolbar( const char * tbName, bool shown );
00106 
00110     bool toolbarIsVisible(const char *tbName);
00111 
00116     QLabel * statusBarLabel();
00117 
00121     void setMaxRecentItems(uint _number);
00122 
00126     void addRecentURL( const KURL& url );
00127 
00134     virtual bool openDocument( const KURL & url );
00135 
00141     bool openDocument( KoDocument *newdoc, const KURL & url );
00142 
00143     virtual DCOPObject * dcopObject();
00144 
00148     void reloadRecentFileList();
00149 
00153     virtual void updateCaption( const QString caption, bool mod );
00154     void updateReloadFileAction(KoDocument *doc);
00155     void updateVersionsFileAction(KoDocument *doc);
00156 
00157 signals:
00161     void documentSaved();
00163     void saveDialogShown();
00164 
00165 public slots:
00166 
00173     void slotEmailFile();
00174 
00181     virtual void slotFileNew();
00182 
00189     virtual void slotFileOpen();
00190 
00197     virtual void slotFileOpenRecent( const KURL & );
00198 
00202     virtual void slotFileSave();
00203 
00207     virtual void slotFileSaveAs();
00208 
00212     virtual void slotFilePrint();
00213 
00217     void slotFilePrintPreview(); // make virtual later
00218 
00222     virtual void slotDocumentInfo();
00223 
00227     virtual void slotFileClose();
00228 
00232     virtual void slotFileQuit();
00233 
00237     virtual void slotConfigureKeys();
00238 
00242     virtual void slotConfigureToolbars();
00243 
00248     virtual void slotNewToolbarConfig();
00249 
00253     virtual void slotToolbarToggled( bool toggle );
00254 
00258     virtual void slotSplitView();
00259     virtual void slotRemoveView();
00260     virtual void slotSetOrientation();
00261 
00265     virtual void slotCloseAllViews();
00266 
00270     void slotReloadFile();
00271 
00275     void slotVersionsFile();
00276 
00283     void slotImportFile();
00284 
00291     void slotExportFile();
00292 
00293 protected: // protected methods are mostly for koshell, it's the only one deriving from KoMainWindow
00294 
00296     void chooseNewDocument( int /*KoDocument::InitDocFlags*/ initDocFlags );
00301     void setRootDocumentDirect( KoDocument *doc, const QPtrList<KoView> & views );
00302 
00306     virtual KoDocument* createDoc() const;
00307 
00319     virtual bool saveDocument( bool saveas = false, bool silent = false );
00320 
00321     virtual void closeEvent( QCloseEvent * e );
00322     virtual void resizeEvent( QResizeEvent * e );
00323 
00327     virtual bool queryClose();
00328 
00329     virtual bool openDocumentInternal( const KURL & url, KoDocument * newdoc = 0L );
00330 
00339     bool isExporting() const;
00340 
00349     bool isImporting() const;
00350 
00354     void saveRecentFiles();
00355 
00356     KRecentFilesAction *recentAction() const { return m_recent; }
00357 
00358 private:
00359 
00366     bool exportConfirmation( const QCString &outputFormat );
00367 
00368     void saveWindowSettings();
00369 
00370     KRecentFilesAction *m_recent;
00371 
00372 protected slots:
00373     virtual void slotActivePartChanged( KParts::Part *newPart );
00374 
00375 private slots:
00376     void slotProgress(int value);
00377     void slotLoadCompleted();
00378     void slotLoadCanceled (const QString &);
00379     void slotSaveCompleted();
00380     void slotSaveCanceled(const QString &);
00381 
00382 private:
00383     KoMainWindowPrivate *d;
00384 
00385 };
00386 
00387 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys