lib

KoMainWindow.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 Copyright (C) 2000-2004 David Faure <faure@kde.org>
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 __ko_main_window_h__
22#define __ko_main_window_h__
23
24#include <tdeparts/mainwindow.h>
25#include <tdefiledialog.h>
26#include <koffice_export.h>
27#include "KoDocument.h"
28
29class TQLabel;
30class KoView;
31class KoMainWindowPrivate;
32class KURL;
34class KoFilterManager;
35class DCOPObject;
36
37namespace KParts
38{
39 class PartManager;
40}
41
51class KOFFICECORE_EXPORT KoMainWindow : public KParts::MainWindow
52{
53 TQ_OBJECT
54
55public:
56
62 KoMainWindow( TDEInstance *instance, const char *_name = 0 );
63
68
73 virtual void setRootDocument( KoDocument *doc );
74
79 void setDocToOpen( KoDocument *doc );
80
85 virtual void updateCaption();
86
90 virtual KoDocument* rootDocument() const;
91
92 virtual KoView *rootView() const;
93
94 virtual KParts::PartManager *partManager();
95
100 void print(bool quick);
101
106 void showToolbar( const char * tbName, bool shown );
107
111 bool toolbarIsVisible(const char *tbName);
112
117 TQLabel * statusBarLabel();
118
122 void setMaxRecentItems(uint _number);
123
127 void addRecentURL( const KURL& url );
128
135 virtual bool openDocument( const KURL & url );
136
142 bool openDocument( KoDocument *newdoc, const KURL & url );
143
144 virtual DCOPObject * dcopObject();
145
150
154 virtual void updateCaption( const TQString caption, bool mod );
155 void updateReloadFileAction(KoDocument *doc);
156 void updateVersionsFileAction(KoDocument *doc);
157
158signals:
165
166public slots:
167
174 void slotEmailFile();
175
182 virtual void slotFileNew();
183
190 virtual void slotFileOpen();
191
198 virtual void slotFileOpenRecent( const KURL & );
199
203 virtual void slotFileSave();
204
208 virtual void slotFileSaveAs();
209
213 virtual void slotFilePrint();
214
218 void slotFilePrintPreview(); // make virtual later
219
223 virtual void slotDocumentInfo();
224
228 virtual void slotFileClose();
229
233 virtual void slotFileQuit();
234
238 virtual void slotConfigureKeys();
239
243 virtual void slotConfigureToolbars();
244
249 virtual void slotNewToolbarConfig();
250
254 virtual void slotToolbarToggled( bool toggle );
255
259 virtual void slotSplitView();
260 virtual void slotRemoveView();
261 virtual void slotSetOrientation();
262
266 virtual void slotCloseAllViews();
267
271 void slotReloadFile();
272
276 void slotVersionsFile();
277
284 void slotImportFile();
285
292 void slotExportFile();
293
294protected: // protected methods are mostly for koshell, it's the only one deriving from KoMainWindow
295
297 void chooseNewDocument( int /*KoDocument::InitDocFlags*/ initDocFlags );
302 void setRootDocumentDirect( KoDocument *doc, const TQPtrList<KoView> & views );
303
307 virtual KoDocument* createDoc() const;
308
320 virtual bool saveDocument( bool saveas = false, bool silent = false );
321
322 virtual void closeEvent( TQCloseEvent * e );
323 virtual void resizeEvent( TQResizeEvent * e );
324
328 virtual bool queryClose();
329
330 virtual bool openDocumentInternal( const KURL & url, KoDocument * newdoc = 0L );
331
340 bool isExporting() const;
341
350 bool isImporting() const;
351
355 void saveRecentFiles();
356
357 TDERecentFilesAction *recentAction() const { return m_recent; }
358
359private:
360
367 bool exportConfirmation( const TQCString &outputFormat );
368
369 void saveWindowSettings();
370
371 TDERecentFilesAction *m_recent;
372
373protected slots:
374 virtual void slotActivePartChanged( KParts::Part *newPart );
375
376private slots:
377 void slotProgress(int value);
378 void slotLoadCompleted();
379 void slotLoadCanceled (const TQString &);
380 void slotSaveCompleted();
381 void slotSaveCanceled(const TQString &);
382
383private:
384 KoMainWindowPrivate *d;
385
386};
387
388#endif
virtual TDEInstance * instance() const
The KOffice document class.
Definition KoDocument.h:61
The class managing all the filters.
bool isImporting() const
Returns whether or not the current slotFileOpen() or openDocument() call is actually an import operat...
KoMainWindow(TDEInstance *instance, const char *_name=0)
Constructor.
virtual void slotToolbarToggled(bool toggle)
Shows or hides a toolbar.
void slotEmailFile()
Slot for eMailing the document using KMail.
virtual void slotConfigureKeys()
Configure key bindings.
void slotFilePrintPreview()
Show a print preview.
virtual void slotConfigureToolbars()
Configure toolbars.
virtual void slotNewToolbarConfig()
Post toolbar config.
virtual void slotDocumentInfo()
Show a dialog with author and document information.
void setRootDocumentDirect(KoDocument *doc, const TQPtrList< KoView > &views)
Special method for KOShell, to allow switching the root document (and its views) among a set of them.
virtual void slotFileClose()
Closes the document.
void slotImportFile()
File --> Import.
void saveRecentFiles()
Save the list of recent files.
bool isExporting() const
Returns whether or not the current slotFileSave[As]() or saveDocument() call is actually an export op...
void slotReloadFile()
Reload file.
virtual bool saveDocument(bool saveas=false, bool silent=false)
Saves the document, asking for a filename if necessary.
void print(bool quick)
Prints the document.
virtual void slotSplitView()
View splitting stuff.
void setDocToOpen(KoDocument *doc)
This is used to handle the document used at start up before it actually added as root document.
virtual void setRootDocument(KoDocument *doc)
Called when a document is assigned to this mainwindow.
void slotExportFile()
File --> Export.
TQLabel * statusBarLabel()
Get hold of the label in the statusbar, to write messages to it.
virtual void slotFileOpen()
Slot for opening a saved file.
virtual void slotFilePrint()
Prints the actual document.
virtual void slotFileSave()
Saves the current document with the current name.
virtual KoDocument * createDoc() const
Create a new empty document.
virtual void slotCloseAllViews()
Close all views.
void saveDialogShown()
This signals is emmitted before the save dialog is shown.
virtual void slotFileSaveAs()
Saves the current document with a new name.
virtual void slotFileOpenRecent(const KURL &)
Slot for opening a file among the recently opened files.
void slotVersionsFile()
This will call a dialogbox to add version to list of files.
void showToolbar(const char *tbName, bool shown)
The application should call this to show or hide a toolbar.
virtual KoDocument * rootDocument() const
Retrieves the document that is displayed in the mainwindow.
bool toolbarIsVisible(const char *tbName)
void setMaxRecentItems(uint _number)
Sets the maximum number of recent documents entries.
virtual bool openDocument(const KURL &url)
Load the desired document and show it.
void addRecentURL(const KURL &url)
The document opened a URL -> store into recent documents list.
virtual void slotFileQuit()
Closes the shell.
void reloadRecentFileList()
Reloads the recent documents list.
virtual void updateCaption()
Update caption from document info - call when document info (title in the about page) changes.
void chooseNewDocument(int initDocFlags)
Helper method for slotFileNew and slotFileClose.
void documentSaved()
This signal is emitted if the document has been saved successfully.
virtual void slotFileNew()
Slot for opening a new document.
This class is used to display a KoDocument.
Definition KoView.h:58
virtual bool queryClose()
virtual void closeEvent(TQCloseEvent *)