lib

KoView Class Reference

#include <KoView.h>

Inheritance diagram for KoView:

KParts::PartBase KXMLGUIClient List of all members.

Detailed Description

This class is used to display a KoDocument.

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

Definition at line 57 of file KoView.h.


Public Slots

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

Signals

void activated (bool active)
void selected (bool select)
void autoScroll (const QPoint &scrollDistance)
void childSelected (KoDocumentChild *child)
void childUnselected (KoDocumentChild *child)
void childActivated (KoDocumentChild *child)
void childDeactivated (KoDocumentChild *child)
void regionInvalidated (const QRegion &region, bool erase)
void invalidated ()
void embeddImage (const QString &filename)

Public Member Functions

 KoView (KoDocument *document, QWidget *parent=0, const char *name=0)
virtual ~KoView ()
KoDocumentkoDocument () const
void setDocumentDeleted ()
bool documentDeleted () const
virtual void setPartManager (KParts::PartManager *manager)
virtual KParts::PartManagerpartManager () const
virtual KActionaction (const QDomElement &element) const
virtual KoDocumenthitTest (const QPoint &pos)
virtual int leftBorder () const
virtual int rightBorder () const
virtual int topBorder () const
virtual int bottomBorder () const
virtual void setZoom (double zoom)
virtual double zoom () const
virtual QWidget * canvas () const
virtual int canvasXOffset () const
virtual int canvasYOffset () const
virtual void canvasAddChild (KoViewChild *child)
virtual KoDocumentChildselectedChild ()
virtual KoDocumentChildactiveChild ()
void enableAutoScroll ()
void disableAutoScroll ()
virtual void paintEverything (QPainter &painter, const QRect &rect, bool transparent=false)
bool hasDocumentInWindow (KoDocument *doc)
virtual QWMatrix matrix () const KDE_DEPRECATED
virtual QPoint applyViewTransformations (const QPoint &) const
virtual QPoint reverseViewTransformations (const QPoint &) const
virtual QRect applyViewTransformations (const QRect &) const
virtual QRect reverseViewTransformations (const QRect &) const
KoViewChildchild (KoView *view)
KoViewChildchild (KoDocument *document)
virtual DCOPObjectdcopObject ()
virtual void setupPrinter (KPrinter &printer)
virtual void print (KPrinter &printer)
KoMainWindowshell () const
KMainWindowmainWindow () const
KStatusBarstatusBar () const
void addStatusBarItem (QWidget *widget, int stretch=0, bool permanent=false)
void removeStatusBarItem (QWidget *widget)
void showAllStatusBarItems (bool show)
virtual void updateReadWrite (bool readwrite)=0
bool isInOperation () const

Protected Slots

virtual void slotChildActivated (bool a)
virtual void slotChildChanged (KoDocumentChild *child)
virtual void slotAutoScroll ()

Protected Member Functions

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

Constructor & Destructor Documentation

KoView::KoView KoDocument document,
QWidget *  parent = 0,
const char *  name = 0
 

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.
name Name of the view. The name is used in DCOP, so the name should match the pattern [A-Za-z_][A-Za-z_0-9]*.

Definition at line 109 of file KoView.cpp.

KoView::~KoView  )  [virtual]
 

Destroys the view and unregisters at the document.

Definition at line 164 of file KoView.cpp.


Member Function Documentation

KAction * 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

Reimplemented from KXMLGUIClient.

Definition at line 220 of file KoView.cpp.

KoDocumentChild * KoView::activeChild  )  [virtual]
 

Returns:
the active child. The function returns 0 if no direct child is currently active.

Definition at line 457 of file KoView.cpp.

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 417 of file KoView.cpp.

QRect KoView::applyViewTransformations const QRect &   )  const [virtual]
 

Overload for QRect, usually it's not needed to reimplement this one.

Definition at line 838 of file KoView.cpp.

QPoint KoView::applyViewTransformations const QPoint &   )  const [virtual]
 

Apply the transformations that the view makes to its contents.

This is used for embedded objects. By default this simply applies the zoom(). Reimplement to add some translation if needed (e.g. to center the page)

Definition at line 828 of file KoView.cpp.

void KoView::beginOperation  )  [virtual, slot]
 

Slot to allow code to signal the beginning of an operation where the screen should not update until it is done.

See also:
endOperation

Definition at line 658 of file KoView.cpp.

int KoView::bottomBorder  )  const [virtual]
 

See also:
leftBorder

Definition at line 283 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 299 of file KoView.cpp.

void KoView::canvasAddChild KoViewChild child  )  [virtual]
 

Overload this function if you need to perform some actions after KoView (the part widget) is inserted into canvas.

You should call for example addChild(QWidget*) method of QScrollView here, if canvas is a viewport of QScrollView.

By default this function does nothing.

Definition at line 316 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 306 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 311 of file KoView.cpp.

KoViewChild * KoView::child KoDocument document  ) 
 

A convenience function which returns the KoViewChild which in turn holds the KoView that in turn holds the document.

Definition at line 495 of file KoView.cpp.

KoViewChild * KoView::child KoView view  ) 
 

Returns:
the KoViewChild which is responsible for the view or 0.
This method does no recursion.

Definition at line 485 of file KoView.cpp.

void KoView::customEvent QCustomEvent *  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 320 of file KoView.cpp.

DCOPObject * KoView::dcopObject  )  [virtual]
 

Return a DCOP interface for this view KOffice Applications are strongly recommended to reimplement this method, so that their dcop interface provides more functionality than the basic KoViewIface.

Definition at line 702 of file KoView.cpp.

void KoView::disableAutoScroll  ) 
 

Stops the emitting of autoScroll signals.

Definition at line 475 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 192 of file KoView.cpp.

void KoView::embeddImage 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 470 of file KoView.cpp.

void KoView::endOperation  )  [virtual, slot]
 

Slot to allow code to signal the end of an operation where the screen should not have been updating.

So now it will update.

See also:
beginOperation

Definition at line 664 of file KoView.cpp.

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

Handles the event KParts::GUIActivateEvent.

Definition at line 399 of file KoView.cpp.

bool KoView::hasDocumentInWindow KoDocument doc  ) 
 

Returns:
TRUE if the document doc is represented in this view by some KoViewChild.
This is just a convenience function for child.

Definition at line 197 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 233 of file KoView.cpp.

bool KoView::isInOperation  )  const
 

Check to see if the view is currently in the middle of an operation which means that there will be no screen refreshes until a signal from the document hits the endOperation slot.

Definition at line 653 of file KoView.cpp.

KoDocument * KoView::koDocument  )  const
 

Retrieves the document object of this view.

Definition at line 182 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.

KoFrame uses this border information. If an embedded document becomes active then it is resized so that it has enough space to display the borders and to display the same content as before the activation. So if for example all of your borders are 20 pixels, then activating the embedded document causes the KoView to move 20 pixels up/left and the size and width increases by 20+20 pixels each.

The default border is 0.

Definition at line 268 of file KoView.cpp.

KMainWindow * KoView::mainWindow  )  const
 

Returns:
the KMainWindow in which this view is currently. This one should never return 0L, in a KDE app.

Definition at line 677 of file KoView.cpp.

QWMatrix KoView::matrix  )  const [virtual]
 

Returns the matrix which is used by the view to transform the content.

Currently only scaling is supported.

The matrix changes when calling setZoom.

Deprecated:
, use applyViewTransformations / reverseViewTransformations instead.

Definition at line 505 of file KoView.cpp.

void KoView::newView  )  [virtual, slot]
 

Slot to create a new view around the contained koDocument.

Definition at line 644 of file KoView.cpp.

void KoView::paintEverything QPainter &  painter,
const QRect &  rect,
bool  transparent = false
[virtual]
 

calls KoDocument::paintEverything()

Definition at line 480 of file KoView.cpp.

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

Handles the event KParts::PartActivateEvent.

Definition at line 330 of file KoView.cpp.

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

Handles the event KParts::PartSelectEvent.

Definition at line 370 of file KoView.cpp.

void KoView::print KPrinter &  printer  )  [virtual]
 

Overload this method with your own printing code.

Definition at line 639 of file KoView.cpp.

void KoView::removeStatusBarItem QWidget *  widget  ) 
 

Remove a widget from the statusbar for this view.

Definition at line 428 of file KoView.cpp.

QRect KoView::reverseViewTransformations const QRect &   )  const [virtual]
 

Overload for QRect, usually it's not needed to reimplement this one.

Definition at line 844 of file KoView.cpp.

QPoint KoView::reverseViewTransformations const QPoint &   )  const [virtual]
 

Reverse the transformations that the view makes to its contents, i.e.

undo the transformations done by applyViewTransformations(). This is used for embedded objects. By default this simply unzooms the point. Reimplement to add some translation if needed (e.g. to center the page)

Definition at line 833 of file KoView.cpp.

int KoView::rightBorder  )  const [virtual]
 

See also:
leftBorder

Definition at line 273 of file KoView.cpp.

KoDocumentChild * KoView::selectedChild  )  [virtual]
 

Returns:
the selected child. The function returns 0 if no direct child is currently selected.

Definition at line 444 of file KoView.cpp.

void KoView::setDocumentDeleted  ) 
 

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

Definition at line 187 of file KoView.cpp.

void KoView::setupPrinter KPrinter &  printer  )  [virtual]
 

Overload this method to setup KPrinter before the actual printing.

See also:
print

Definition at line 634 of file KoView.cpp.

void KoView::setZoom double  zoom  )  [virtual]
 

Scales the view on the content.

This does not affect the contents data structures. You can use this mechanism to implement a zoom for example.

The method calls QWidget::update so that the scaled content is automatically displayed.

The default scaling is 1.0 in both orientations.

Definition at line 288 of file KoView.cpp.

KoMainWindow * KoView::shell  )  const
 

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

Definition at line 672 of file KoView.cpp.

void KoView::showAllStatusBarItems bool  show  ) 
 

Show or hide all statusbar items.

Used by KoMainWindow during saving.

Definition at line 404 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 688 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 695 of file KoView.cpp.

KStatusBar * KoView::statusBar  )  const
 

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

Definition at line 682 of file KoView.cpp.

int KoView::topBorder  )  const [virtual]
 

See also:
leftBorder

Definition at line 278 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.

double KoView::zoom  )  const [virtual]
 

Returns:
the current scaling factor (zoom level)
See also:
setZoom

Definition at line 294 of file KoView.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys