libs/main

KoView Class Reference

This class is used to display a KoDocument. More...

#include <KoView.h>

Inheritance diagram for KoView:

List of all members.

Public Slots

virtual void newView ()
void slotActionStatusText (const QString &text)
void slotClearStatusText ()

Signals

void activated (bool active)
void autoScroll (const QPoint &scrollDistance)
void embedImage (const QString &filename)
void invalidated ()
void regionInvalidated (const QRegion &region, bool erase)
void selected (bool select)

Public Member Functions

 KoView (KoDocument *document, QWidget *parent=0)
virtual ~KoView ()
virtual QActionaction (const char *name) const
virtual QActionaction (const QDomElement &element) const
void addStatusBarItem (QWidget *widget, int stretch=0, bool permanent=false)
virtual int bottomBorder () const
virtual QWidgetcanvas () const
virtual int canvasXOffset () const
virtual int canvasYOffset () const
QList< QAction * > createChangeUnitActions ()
QDockWidgetcreateDockWidget (KoDockFactory *factory)
virtual KoPrintJobcreatePrintJob ()
void disableAutoScroll ()
KoDockerManagerdockerManager () const
bool documentDeleted () const
void enableAutoScroll ()
virtual KoDocumenthitTest (const QPoint &pos)
KoDocumentkoDocument () const
virtual int leftBorder () const
KXmlGuiWindow * mainWindow () const
virtual void paintEverything (QPainter &painter, const QRect &rect)
virtual KParts::PartManager * partManager () const
void removeDockWidget (QDockWidget *dock)
void removeStatusBarItem (QWidget *widget)
void restoreDockWidget (QDockWidget *dock)
virtual int rightBorder () const
void setDockerManager (KoDockerManager *)
void setDocumentDeleted ()
virtual void setPartManager (KParts::PartManager *manager)
KoMainWindowshell () const
void showAllStatusBarItems (bool show)
KStatusBar * statusBar () const
virtual int topBorder () const
virtual void updateReadWrite (bool readwrite)=0
QToolBarviewBar ()
virtual KoZoomController * zoomController () const =0

Protected Slots

virtual void slotAutoScroll ()

Protected Member Functions

virtual void customEvent (QEvent *ev)
virtual void guiActivateEvent (KParts::GUIActivateEvent *)
QString newObjectName ()
virtual void partActivateEvent (KParts::PartActivateEvent *event)
virtual void partSelectEvent (KParts::PartSelectEvent *event)

Detailed Description

This class is used to display a KoDocument.

Multiple views can be attached to one document at a time.

Definition at line 49 of file KoView.h.


Constructor & Destructor Documentation

KoView::KoView ( KoDocument document,
QWidget parent = 0 
) [explicit]

Creates a new view for the document.

Usually you don't create views yourself since the KOffice components come with their own view classes which inherit KoView.

The standard way to retrieve a KoView is to call KoDocument::createView.

Parameters:
document is the document which should be displayed in this view. This pointer must not be zero.
parent parent widget for this view.

Definition at line 130 of file KoView.cpp.

KoView::~KoView (  )  [virtual]

Destroys the view and unregisters at the document.

Definition at line 183 of file KoView.cpp.


Member Function Documentation

QAction * KoView::action ( const char *  name  )  const [virtual]

Returns the action with the given name.

The method searches in the KActionCollection of this view.

Please notice that KoView indirectly inherits KXMLGUIClient.

See also:
KXMLGUIClient
KXMLGUIClient::actionCollection
KoDocument::action

Definition at line 247 of file KoView.cpp.

QAction * KoView::action ( const QDomElement element  )  const [virtual]

Returns the action described action object.

In fact only the "name" attribute of element is of interest here. The method searches in the KActionCollection of this view.

Please notice that KoView indirectly inherits KXMLGUIClient.

See also:
KXMLGUIClient
KXMLGUIClient::actionCollection
KoDocument::action

Definition at line 230 of file KoView.cpp.

void KoView::activated ( bool  active  )  [signal]
void KoView::addStatusBarItem ( QWidget widget,
int  stretch = 0,
bool  permanent = false 
)

This adds a widget to the statusbar for this view.

If you use this method instead of using statusBar() directly, KoView will take care of removing the items when the view GUI is deactivated and readding them when it is reactivated. The parameters are the same as QStatusBar::addWidget().

Note that you can't use KStatusBar methods (inserting text items by id). But you can create a KStatusBarLabel with a dummy id instead, and use it directly, to get the same look and feel.

Definition at line 345 of file KoView.cpp.

void KoView::autoScroll ( const QPoint scrollDistance  )  [signal]
int KoView::bottomBorder (  )  const [virtual]
See also:
leftBorder

Definition at line 282 of file KoView.cpp.

QWidget * KoView::canvas (  )  const [virtual]

Overload this function if the content will be displayed on some child widget instead of the view directly.

By default this function returns a pointer to the view.

Definition at line 287 of file KoView.cpp.

int KoView::canvasXOffset (  )  const [virtual]

Overload this function if the content will be displayed with an offset relative to the upper left corner of the canvas widget.

By default this function returns 0.

Definition at line 294 of file KoView.cpp.

int KoView::canvasYOffset (  )  const [virtual]

Overload this function if the content will be displayed with an offset relative to the upper left corner of the canvas widget.

By default this function returns 0.

Definition at line 299 of file KoView.cpp.

QList< QAction * > KoView::createChangeUnitActions (  ) 

create a list of actions that when activated will change the unit on the document.

Definition at line 529 of file KoView.cpp.

QDockWidget * KoView::createDockWidget ( KoDockFactory *  factory  ) 

Creates a dockwidget if needed from factory if the mainwindow is a KoMainWindow by calling KoMainWindow::createDockWidget().

Parameters:
factory the factory used to the create the dockwidget
Returns:
the created dockwidget or NULL if the mainwindow isn't a KoMainWindow

Definition at line 502 of file KoView.cpp.

KoPrintJob * KoView::createPrintJob (  )  [virtual]

In order to print the document represented by this view a new print job should be constructed that is capable of doing the printing.

The default implementation returns 0, which silently cancels printing.

Definition at line 428 of file KoView.cpp.

void KoView::customEvent ( QEvent ev  )  [protected, virtual]

This method handles three events: KParts::PartActivateEvent, KParts::PartSelectEvent and KParts::GUIActivateEvent.

The respective handlers are called if such an event is found.

Definition at line 304 of file KoView.cpp.

void KoView::disableAutoScroll (  ) 

Stops the emitting of autoScroll signals.

Definition at line 377 of file KoView.cpp.

KoDockerManager * KoView::dockerManager (  )  const
Returns:
the KoDockerManager which is assigned to the KoMainWindow of this view WARNING: this could be 0, if the main window isn't a koffice main window. (e.g. it can be any KParts application). or if no docker have been assigned yet. In that case create one and then use Note KoDockerManager is not actually defined in the main module but rather in guiutils setDockerManager to assign it.

Definition at line 451 of file KoView.cpp.

bool KoView::documentDeleted (  )  const
Returns:
true if the document has already got deleted. This can be useful for the view destructor to know if it can access the document or not.

Definition at line 209 of file KoView.cpp.

void KoView::embedImage ( const QString filename  )  [signal]

Make it possible for plugins to request the embedding of an image into the current document.

Used e.g. by the scan-plugin

void KoView::enableAutoScroll (  ) 

Sets up so that autoScroll signals are emitted when the mouse pointer is outside the view.

Definition at line 372 of file KoView.cpp.

void KoView::guiActivateEvent ( KParts::GUIActivateEvent *  ev  )  [protected, virtual]

Handles the event KParts::GUIActivateEvent.

Definition at line 324 of file KoView.cpp.

KoDocument * KoView::hitTest ( const QPoint pos  )  [virtual]

Retrieves the document that is hit.

This can be an embedded document.

The default implementation asks KoDocument::hitTest. This will iterate over all child documents to detect a hit.

If your koffice component has multiple pages, like for example KSpread, then the hittest may not succeed for a child that is not on the visible page. In those cases you need to reimplement this method.

Definition at line 261 of file KoView.cpp.

void KoView::invalidated (  )  [signal]
KoDocument * KoView::koDocument (  )  const

Retrieves the document object of this view.

Definition at line 199 of file KoView.cpp.

int KoView::leftBorder (  )  const [virtual]

Retrieves the left border width that is displayed around the content if the view is active.

In a spread sheet this border is for example used to display the rows, while a top border is used to display the names of the cells and a right and bottom border is used to display scrollbars. If the view becomes inactive, then this stuff is not displayed anymore.

The default border is 0.

Definition at line 267 of file KoView.cpp.

KXmlGuiWindow * KoView::mainWindow (  )  const
Returns:
the KXmlGuiWindow in which this view is currently. This one should never return 0, in a KDE app.

Definition at line 470 of file KoView.cpp.

QString KoView::newObjectName (  )  [protected]

Generate a name for this view.

Definition at line 47 of file KoView.cpp.

void KoView::newView (  )  [virtual, slot]

Slot to create a new view around the contained koDocument.

Definition at line 441 of file KoView.cpp.

void KoView::paintEverything ( QPainter painter,
const QRect rect 
) [virtual]

calls KoDocument::paintEverything()

Definition at line 382 of file KoView.cpp.

void KoView::partActivateEvent ( KParts::PartActivateEvent *  event  )  [protected, virtual]

Handles the event KParts::PartActivateEvent.

Definition at line 314 of file KoView.cpp.

KParts::PartManager * KoView::partManager (  )  const [virtual]

Definition at line 225 of file KoView.cpp.

void KoView::partSelectEvent ( KParts::PartSelectEvent *  event  )  [protected, virtual]

Handles the event KParts::PartSelectEvent.

Definition at line 319 of file KoView.cpp.

void KoView::regionInvalidated ( const QRegion region,
bool  erase 
) [signal]
void KoView::removeDockWidget ( QDockWidget dock  ) 

Programatically closes (but doesn't delete) a dockwidget if the mainwindow is a KoMainWindow by calling KoMainWindow::removeDockWidget().

Parameters:
dock the docker that you want to close

Definition at line 507 of file KoView.cpp.

void KoView::removeStatusBarItem ( QWidget widget  ) 

Remove a widget from the statusbar for this view.

Definition at line 355 of file KoView.cpp.

void KoView::restoreDockWidget ( QDockWidget dock  ) 

Programatically restore a (previously removed) dockwidget if the mainwindow is a KoMainWindow by calling KoMainWindow::restoreDockWidget().

Parameters:
dock the docker that you want to close

Definition at line 513 of file KoView.cpp.

int KoView::rightBorder (  )  const [virtual]
See also:
leftBorder

Definition at line 272 of file KoView.cpp.

void KoView::selected ( bool  select  )  [signal]
void KoView::setDockerManager ( KoDockerManager dm  ) 

use this to assign a KoDockerManager to the KoMainWindow of this view.

This function may not do anything if the main window isn't a koffice main window. (e.g. it can be any KParts application) Note KoDockerManager is not actually defined in the main module but rather in guiutils dockerManager to retrieve it.

Definition at line 457 of file KoView.cpp.

void KoView::setDocumentDeleted (  ) 

Tells this view that its document has got deleted (called internally).

Definition at line 204 of file KoView.cpp.

void KoView::setPartManager ( KParts::PartManager *  manager  )  [virtual]

Definition at line 214 of file KoView.cpp.

KoMainWindow * KoView::shell (  )  const
Returns:
the KoMainWindow in which this view is currently. WARNING: this could be 0, if the main window isn't a koffice main window. (e.g. it can be any KParts application).

Definition at line 465 of file KoView.cpp.

void KoView::showAllStatusBarItems ( bool  show  ) 

Show or hide all statusbar items.

Used by KoMainWindow during saving.

Definition at line 329 of file KoView.cpp.

void KoView::slotActionStatusText ( const QString text  )  [slot]

Display a message in the status bar (calls QStatusBar::message()).

Todo:
rename to something more generic

Definition at line 481 of file KoView.cpp.

void KoView::slotAutoScroll (  )  [protected, virtual, slot]

Definition at line 395 of file KoView.cpp.

void KoView::slotClearStatusText (  )  [slot]

End of the message in the status bar (calls QStatusBar::clear()).

Todo:
rename to something more generic

Definition at line 488 of file KoView.cpp.

KStatusBar * KoView::statusBar (  )  const
Returns:
the statusbar of the KoMainWindow in which this view is currently. WARNING: this could be 0, if the main window isn't a koffice main window. (e.g. it can be any KParts application).

Definition at line 475 of file KoView.cpp.

int KoView::topBorder (  )  const [virtual]
See also:
leftBorder

Definition at line 277 of file KoView.cpp.

virtual void KoView::updateReadWrite ( bool  readwrite  )  [pure virtual]

You have to implement this method and disable/enable certain functionality (actions for example) in your view to allow/disallow editing of the document.

QToolBar * KoView::viewBar (  ) 
Returns:
the view bar. The bar is created only if this function is called.

Definition at line 519 of file KoView.cpp.

virtual KoZoomController* KoView::zoomController (  )  const [pure virtual]

Return the zoomController for this view.


The documentation for this class was generated from the following files: