lib Library API Documentation

KoMainWindow Class Reference

This class is used to represent a main window of a KOffice component. Main window for a KOffice application. More...

#include <koMainWindow.h>

List of all members.

Public Slots

void slotEmailFile ()
virtual void slotFileNew ()
virtual void slotFileOpen ()
virtual void slotFileOpenRecent (const KURL &)
virtual void slotFileSave ()
virtual void slotFileSaveAs ()
virtual void slotFilePrint ()
void slotFilePrintPreview ()
virtual void slotDocumentInfo ()
virtual void slotFileClose ()
virtual void slotFileQuit ()
virtual void slotConfigureKeys ()
virtual void slotConfigureToolbars ()
virtual void slotNewToolbarConfig ()
virtual void slotToolbarToggled (bool toggle)
virtual void slotSplitView ()
virtual void slotRemoveView ()
virtual void slotSetOrientation ()
virtual void slotCloseAllViews ()
void slotReloadFile ()
void slotImportFile ()
void slotExportFile ()

Signals

void documentSaved ()

Public Member Functions

 KoMainWindow (KInstance *instance, const char *_name=0)
 ~KoMainWindow ()
virtual void setRootDocument (KoDocument *doc)
virtual void updateCaption ()
virtual KoDocumentrootDocument () const
virtual KoViewrootView () const
virtual KParts::PartManager * partManager ()
void print (bool quick)
void showToolbar (const char *tbName, bool shown)
bool toolbarIsVisible (const char *tbName)
QLabelstatusBarLabel ()
void setMaxRecentItems (uint _number)
void addRecentURL (const KURL &url)
virtual bool openDocument (const KURL &url)
bool openDocument (KoDocument *newdoc, const KURL &url)
virtual DCOPObject * dcopObject ()
void reloadRecentFileList ()
void updateCaption (const QString caption, bool mod)
void updateReloadFileAction (KoDocument *doc)

Protected Slots

virtual void slotActivePartChanged (KParts::Part *newPart)

Protected Member Functions

void chooseNewDocument (intinitDocFlags)
void setRootDocumentDirect (KoDocument *doc, const QPtrList< KoView > &views)
virtual KoDocumentcreateDoc () const
virtual bool saveDocument (bool saveas=false)
bool exportConfirmation (const QCString &outputFormat, const QCString &nativeFormat)
virtual void closeEvent (QCloseEvent *e)
virtual void resizeEvent (QResizeEvent *e)
virtual bool queryClose ()
virtual bool openDocumentInternal (const KURL &url, KoDocument *newdoc=0L)
void saveRecentFiles ()
bool isExporting () const
bool isImporting () const
KRecentFilesAction * recentAction () const


Detailed Description

This class is used to represent a main window of a KOffice component. Main window for a KOffice application.

Each main window contains a menubar and some toolbars.

This class does NOT need to be subclassed in your application.

Definition at line 49 of file koMainWindow.h.


Constructor & Destructor Documentation

KoMainWindow::KoMainWindow KInstance *  instance,
const char *  _name = 0
 

Constructor.

Initializes a KOffice main window (with its basic GUI etc.).

Definition at line 222 of file koMainWindow.cc.

References KoMainWindow(), slotCloseAllViews(), slotConfigureKeys(), slotConfigureToolbars(), slotDocumentInfo(), slotEmailFile(), slotExportFile(), slotFileClose(), slotFileNew(), slotFileOpen(), slotFileOpenRecent(), slotFilePrint(), slotFilePrintPreview(), slotFileQuit(), slotFileSave(), slotFileSaveAs(), slotImportFile(), slotReloadFile(), and slotSplitView().

Referenced by KoMainWindow().

KoMainWindow::~KoMainWindow  ) 
 

Destructor.

Definition at line 348 of file koMainWindow.cc.


Member Function Documentation

void KoMainWindow::setRootDocument KoDocument doc  )  [virtual]
 

Called when a document is assigned to this mainwindow.

This creates a view for this document, makes it the active part, etc.

Definition at line 378 of file koMainWindow.cc.

References KoDocument::createView(), KoDocument::removeShell(), setRootDocument(), updateCaption(), and KoDocument::viewCount().

Referenced by chooseNewDocument(), KoView::newView(), setRootDocument(), slotCloseAllViews(), slotFileClose(), slotReloadFile(), and KoApplication::start().

void KoMainWindow::updateCaption  )  [virtual]
 

Update caption from document info - call when document info (title in the about page) changes.

Definition at line 509 of file koMainWindow.cc.

References KoDocument::documentInfo(), KoDocument::isCurrent(), and rootDocument().

Referenced by setRootDocument().

KoDocument * KoMainWindow::rootDocument  )  const [virtual]
 

Retrieves the document that is displayed in the mainwindow.

Definition at line 540 of file koMainWindow.cc.

Referenced by chooseNewDocument(), queryClose(), saveDocument(), slotConfigureKeys(), slotConfigureToolbars(), slotDocumentInfo(), slotNewToolbarConfig(), slotReloadFile(), slotToolbarToggled(), and updateCaption().

void KoMainWindow::print bool  quick  ) 
 

Prints the document.

Parameters:
quick whether the print setup dialog is to be displayed

Definition at line 1164 of file koMainWindow.cc.

References KoDocument::documentInfo(), KoView::koDocument(), and print().

Referenced by print(), slotFilePrint(), and KoApplication::start().

void KoMainWindow::showToolbar const char *  tbName,
bool  shown
 

The application should call this to show or hide a toolbar.

It also takes care of the corresponding action in the settings menu.

Definition at line 1310 of file koMainWindow.cc.

References showToolbar().

Referenced by showToolbar().

bool KoMainWindow::toolbarIsVisible const char *  tbName  ) 
 

Returns:
TRUE if the toolbar tbName is visible

Definition at line 1304 of file koMainWindow.cc.

References toolbarIsVisible().

Referenced by toolbarIsVisible().

QLabel * KoMainWindow::statusBarLabel  ) 
 

Get hold of the label in the statusbar, to write messages to it.

You can also insert other items in the status bar by using QStatusBar::addWidget.

Definition at line 1537 of file koMainWindow.cc.

void KoMainWindow::setMaxRecentItems uint  _number  ) 
 

Sets the maximum number of recent documents entries.

Definition at line 1547 of file koMainWindow.cc.

References setMaxRecentItems().

Referenced by setMaxRecentItems().

void KoMainWindow::addRecentURL const KURL &  url  ) 
 

The document opened a URL -> store into recent documents list.

Definition at line 452 of file koMainWindow.cc.

References addRecentURL(), and saveRecentFiles().

Referenced by addRecentURL(), and saveDocument().

bool KoMainWindow::openDocument const KURL &  url  )  [virtual]
 

Load the desired document and show it.

Parameters:
url the URL to open
Returns:
TRUE on success.

Definition at line 557 of file koMainWindow.cc.

References openDocument().

Referenced by openDocument(), slotFileOpenRecent(), slotReloadFile(), and KoApplication::start().

bool KoMainWindow::openDocument KoDocument newdoc,
const KURL &  url
 

Load the URL into this document (and make it root doc after loading).

Special method for KoApplication::start, don't use.

Definition at line 563 of file koMainWindow.cc.

References openDocument().

void KoMainWindow::reloadRecentFileList  ) 
 

Reloads the recent documents list.

Definition at line 496 of file koMainWindow.cc.

void KoMainWindow::updateCaption const QString  caption,
bool  mod
 

Updates the window caption based on the document info and path.

Definition at line 534 of file koMainWindow.cc.

void KoMainWindow::documentSaved  )  [signal]
 

This signal is emitted if the document has been saved successfully.

Referenced by slotFileSave(), and slotFileSaveAs().

void KoMainWindow::slotEmailFile  )  [slot]
 

Slot for eMailing the document using KMail.

This is a very simple extension that will allow any document that is currently being edited to be emailed using KMail.

Definition at line 1562 of file koMainWindow.cc.

References saveDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotFileNew  )  [virtual, slot]
 

Slot for opening a new document.

If the current document is empty, the new document replaces it. If not, a new shell will be opened for showing the document.

Definition at line 1079 of file koMainWindow.cc.

References chooseNewDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotFileOpen  )  [virtual, slot]
 

Slot for opening a saved file.

If the current document is empty, the opened document replaces it. If not a new shell will be opened for showing the opened file.

Definition at line 1084 of file koMainWindow.cc.

References isImporting().

Referenced by KoMainWindow(), and slotImportFile().

void KoMainWindow::slotFileOpenRecent const KURL &   )  [virtual, slot]
 

Slot for opening a file among the recently opened files.

If the current document is empty, the opened document replaces it. If not a new shell will be opened for showing the opened file.

Definition at line 1107 of file koMainWindow.cc.

References openDocument(), and slotFileOpenRecent().

Referenced by KoMainWindow(), and slotFileOpenRecent().

void KoMainWindow::slotFileSave  )  [virtual, slot]
 

Saves the current document with the current name.

Definition at line 1112 of file koMainWindow.cc.

References documentSaved(), and saveDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotFileSaveAs  )  [virtual, slot]
 

Saves the current document with a new name.

Definition at line 1118 of file koMainWindow.cc.

References documentSaved(), and saveDocument().

Referenced by KoMainWindow(), and slotExportFile().

void KoMainWindow::slotFilePrint  )  [virtual, slot]
 

Prints the actual document.

Definition at line 1199 of file koMainWindow.cc.

References print().

Referenced by KoMainWindow().

void KoMainWindow::slotFilePrintPreview  )  [slot]
 

Show a print preview.

Definition at line 1204 of file koMainWindow.cc.

References KoView::print(), and KoView::setupPrinter().

Referenced by KoMainWindow().

void KoMainWindow::slotDocumentInfo  )  [virtual, slot]
 

Show a dialog with author and document information.

Definition at line 1124 of file koMainWindow.cc.

References KoDocument::documentInfo(), rootDocument(), KoDocument::setModified(), and KoDocument::setTitleModified().

Referenced by KoMainWindow().

void KoMainWindow::slotFileClose  )  [virtual, slot]
 

Closes the document.

Definition at line 1145 of file koMainWindow.cc.

References chooseNewDocument(), queryClose(), and setRootDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotFileQuit  )  [virtual, slot]
 

Closes the shell.

Definition at line 1157 of file koMainWindow.cc.

References queryClose().

Referenced by KoMainWindow().

void KoMainWindow::slotConfigureKeys  )  [virtual, slot]
 

Configure key bindings.

Definition at line 1239 of file koMainWindow.cc.

References rootDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotConfigureToolbars  )  [virtual, slot]
 

Configure toolbars.

Definition at line 1255 of file koMainWindow.cc.

References rootDocument(), and slotNewToolbarConfig().

Referenced by KoMainWindow().

void KoMainWindow::slotNewToolbarConfig  )  [virtual, slot]
 

Post toolbar config.

(Plug action lists back in, etc.)

Definition at line 1264 of file koMainWindow.cc.

References rootDocument().

Referenced by slotConfigureToolbars().

void KoMainWindow::slotToolbarToggled bool  toggle  )  [virtual, slot]
 

Shows or hides a toolbar.

Definition at line 1285 of file koMainWindow.cc.

References rootDocument(), and slotToolbarToggled().

Referenced by slotToolbarToggled().

void KoMainWindow::slotSplitView  )  [virtual, slot]
 

View splitting stuff.

Definition at line 1334 of file koMainWindow.cc.

Referenced by KoMainWindow().

void KoMainWindow::slotCloseAllViews  )  [virtual, slot]
 

Close all views.

Definition at line 1344 of file koMainWindow.cc.

References queryClose(), and setRootDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotReloadFile  )  [slot]
 

Reload file.

Definition at line 1587 of file koMainWindow.cc.

References KoDocument::isEmpty(), KoDocument::isModified(), openDocument(), rootDocument(), and setRootDocument().

Referenced by KoMainWindow().

void KoMainWindow::slotImportFile  )  [slot]
 

File --> Import.

This will call slotFileOpen(). To differentiate this from an ordinary call to slotFileOpen() call isImporting().

Definition at line 1612 of file koMainWindow.cc.

References slotFileOpen().

Referenced by KoMainWindow().

void KoMainWindow::slotExportFile  )  [slot]
 

File --> Export.

This will call slotFileSaveAs(). To differentiate this from an ordinary call to slotFileSaveAs() call isExporting().

Definition at line 1621 of file koMainWindow.cc.

References slotFileSaveAs().

Referenced by KoMainWindow().

void KoMainWindow::chooseNewDocument intinitDocFlags   )  [protected]
 

Helper method for slotFileNew and slotFileClose.

Definition at line 1050 of file koMainWindow.cc.

References chooseNewDocument(), createDoc(), KoDocument::initDoc(), KoDocument::isEmbedded(), KoDocument::isEmpty(), rootDocument(), KoDocument::setInitDocFlags(), and setRootDocument().

Referenced by chooseNewDocument(), slotFileClose(), and slotFileNew().

void KoMainWindow::setRootDocumentDirect KoDocument doc,
const QPtrList< KoView > &  views
[protected]
 

Special method for KOShell, to allow switching the root document (and its views) among a set of them.

Definition at line 437 of file koMainWindow.cc.

References setRootDocumentDirect().

Referenced by setRootDocumentDirect().

KoDocument * KoMainWindow::createDoc  )  const [protected, virtual]
 

Create a new empty document.

Definition at line 502 of file koMainWindow.cc.

References KoDocumentEntry::createDoc().

Referenced by chooseNewDocument().

bool KoMainWindow::saveDocument bool  saveas = false  )  [protected, virtual]
 

Saves the document, asking for a filename if necessary.

Parameters:
saveas if set to TRUE the user is always prompted for a filename
Returns:
TRUE on success, false on error or cancel (don't display anything in this case, the error dialog box is also implemented here but restore the original URL in slotFileSaveAs)

Definition at line 703 of file koMainWindow.cc.

References addRecentURL(), KoDocument::confirmNonNativeSave(), KoDocument::exp0rt(), exportConfirmation(), KoDocument::file(), KoDocument::isEmpty(), isExporting(), KoFilterManager::mimeFilter(), KoDocument::mimeType(), KoDocument::nativeFormatMimeType(), KoDocument::outputMimeType(), rootDocument(), saveDocument(), KoDocument::setFile(), KoDocument::setModified(), KoDocument::setOutputMimeType(), KoDocument::setTitleModified(), KoDocument::setURL(), and KoDocument::specialOutputFlag().

Referenced by queryClose(), saveDocument(), slotEmailFile(), slotFileSave(), and slotFileSaveAs().

bool KoMainWindow::exportConfirmation const QCString outputFormat,
const QCString nativeFormat
[protected]
 

Asks the user if they really want to save the document if outputFormat != nativeFormat.

If outputFormat == nativeFormat, no dialog is shown and it is assumed that the user wishes to save.

Returns:
true if the document should be saved

Definition at line 655 of file koMainWindow.cc.

References exportConfirmation(), and isExporting().

Referenced by exportConfirmation(), and saveDocument().

bool KoMainWindow::queryClose  )  [protected, virtual]
 

Ask user about saving changes to the document upon exit.

Definition at line 990 of file koMainWindow.cc.

References KoDocument::documentInfo(), KoDocument::removeAutoSaveFiles(), rootDocument(), saveDocument(), KoDocument::setModified(), and KoDocument::shellCount().

Referenced by slotCloseAllViews(), slotFileClose(), and slotFileQuit().

void KoMainWindow::saveRecentFiles  )  [protected]
 

Save the list of recent files.

Definition at line 479 of file koMainWindow.cc.

Referenced by addRecentURL().

bool KoMainWindow::isExporting  )  const [protected]
 

Returns whether or not the current slotFileOpen() or openDocument() call is actually an import operation (like File --> Import).

If this is true, you must call KoDocument::import() instead of KoDocument::openURL(), in any reimplementation of openDocument() or openDocumentInternal().

Definition at line 1635 of file koMainWindow.cc.

Referenced by exportConfirmation(), and saveDocument().

bool KoMainWindow::isImporting  )  const [protected]
 

Returns whether or not the current slotFileSave[As]() or saveDocument() call is actually an export operation (like File --> Export).

If this is true, you must call KoDocument::export() instead of KoDocument::save() or KoDocument::saveAs(), in any reimplementation of saveDocument().

Definition at line 1630 of file koMainWindow.cc.

Referenced by slotFileOpen().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 06:54:22 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003