koMainWindow.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., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef __ko_main_window_h__ 00021 #define __ko_main_window_h__ 00022 00023 #include <kparts/mainwindow.h> 00024 00025 class QLabel; 00026 class KoDocument; 00027 class KoView; 00028 class KoMainWindowPrivate; 00029 class KURL; 00030 class KRecentFilesAction; 00031 class KoFilterManager; 00032 class DCOPObject; 00033 00034 namespace KParts 00035 { 00036 class PartManager; 00037 } 00038 00049 class KoMainWindow : public KParts::MainWindow 00050 { 00051 Q_OBJECT 00052 public: 00053 00059 KoMainWindow( KInstance *instance, const char *_name = 0 ); 00060 00064 ~KoMainWindow(); 00065 00070 virtual void setRootDocument( KoDocument *doc ); 00071 00076 virtual void updateCaption(); 00077 00081 virtual KoDocument* rootDocument() const; 00082 00083 virtual KoView *rootView() const; 00084 00085 virtual KParts::PartManager *partManager(); 00086 00091 void print(bool quick); 00092 00097 void showToolbar( const char * tbName, bool shown ); 00098 00102 bool toolbarIsVisible(const char *tbName); 00103 00108 QLabel * statusBarLabel(); 00109 00113 void setMaxRecentItems(uint _number); 00114 00118 void addRecentURL( const KURL& url ); 00119 00126 virtual bool openDocument( const KURL & url ); 00127 00133 bool openDocument( KoDocument *newdoc, const KURL & url ); 00134 00135 virtual DCOPObject * dcopObject(); 00136 00140 void reloadRecentFileList(); 00141 00145 void updateCaption( const QString caption, bool mod ); // BCI: make virtual 00146 void updateReloadFileAction(KoDocument *doc); 00147 00148 signals: 00152 void documentSaved(); 00153 00154 public slots: 00155 00162 void slotEmailFile(); 00163 00170 virtual void slotFileNew(); 00171 00178 virtual void slotFileOpen(); 00179 00186 virtual void slotFileOpenRecent( const KURL & ); 00187 00191 virtual void slotFileSave(); 00192 00196 virtual void slotFileSaveAs(); 00197 00201 virtual void slotFilePrint(); 00202 00206 void slotFilePrintPreview(); // make virtual later 00207 00211 virtual void slotDocumentInfo(); 00212 00216 virtual void slotFileClose(); 00217 00221 virtual void slotFileQuit(); 00222 00226 virtual void slotConfigureKeys(); 00227 00231 virtual void slotConfigureToolbars(); 00232 00237 virtual void slotNewToolbarConfig(); 00238 00242 virtual void slotToolbarToggled( bool toggle ); 00243 00247 virtual void slotSplitView(); 00248 virtual void slotRemoveView(); 00249 virtual void slotSetOrientation(); 00250 00254 virtual void slotCloseAllViews(); 00255 00259 void slotReloadFile(); 00260 00267 void slotImportFile(); 00268 00275 void slotExportFile(); 00276 00277 protected: 00278 00280 void chooseNewDocument( int /*KoDocument::InitDocFlags*/ initDocFlags ); 00285 void setRootDocumentDirect( KoDocument *doc, const QPtrList<KoView> & views ); 00286 00290 virtual KoDocument* createDoc() const; 00291 00301 virtual bool saveDocument( bool saveas = false ); 00302 00310 bool exportConfirmation( const QCString &outputFormat, const QCString &nativeFormat ); 00311 00312 virtual void closeEvent( QCloseEvent * e ); 00313 virtual void resizeEvent( QResizeEvent * e ); 00314 00318 virtual bool queryClose(); 00319 00320 virtual bool openDocumentInternal( const KURL & url, KoDocument * newdoc = 0L ); 00321 00325 void saveRecentFiles(); 00326 00335 bool isExporting() const; 00336 00345 bool isImporting() const; 00346 00347 KRecentFilesAction *recentAction() const { return m_recent; } 00348 private: 00349 00350 void saveWindowSettings(); 00351 00352 KRecentFilesAction *m_recent; 00353 00354 protected slots: 00355 virtual void slotActivePartChanged( KParts::Part *newPart ); 00356 00357 private slots: 00358 void slotProgress(int value); 00359 void slotLoadCompleted(); 00360 void slotLoadCanceled (const QString &); 00361 void slotSaveCompleted(); 00362 void slotSaveCanceled(const QString &); 00363 00364 private: 00365 KoMainWindowPrivate *d; 00366 00367 }; 00368 00369 #endif