kword
KWViewMode Class Reference
#include <KWViewMode.h>

Detailed Description
Abstract base class for KWCanvas's view modes.The 'normal' mode is the WYSIWYG mode ("page mode"), in which pages are one below another. Since frames are in this coordinate system, the view modes other than the normal mode implement a transformation between the normal mode's coordinate system and its own. When drawing, we use normalcoord->viewcoord and when handling mouse clicks we use viewcoord->normalcoord. Note that this all in zoomed (pixel) coordinates (see DESIGN file).
The View Mode is obviously also responsible for drawing pages etc.
Definition at line 47 of file KWViewMode.h.
Public Member Functions | |
virtual QPoint | normalToView (const QPoint &nPoint)=0 |
QRect | normalToView (const QRect &nRect) |
virtual QPoint | viewToNormal (const QPoint &vPoint)=0 |
QRect | viewToNormal (const QRect &nRect) |
virtual QRect | viewPageRect (int pgNum)=0 |
virtual QSize | contentsSize ()=0 |
virtual QSize | availableSizeForText (KWTextFrameSet *textfs) |
virtual QPoint | pageCorner () |
virtual QRect | rulerFrameRect () |
virtual void | setPageLayout (KoRuler *hRuler, KoRuler *vRuler, const KoPageLayout &layout) |
virtual void | drawPageBorders (QPainter *painter, const QRect &crect, const QRegion &emptySpaceRegion)=0 |
virtual void | setPagesPerRow (int) |
virtual int | pagesPerRow () |
virtual bool | drawSelections () |
virtual bool | drawFrameBackground () |
bool | drawFrameBorders () const |
void | setDrawFrameBorders (bool b) |
virtual bool | isFrameSetVisible (const KWFrameSet *) |
virtual bool | shouldFormatVertically () |
virtual bool | shouldAdjustMargins () |
virtual bool | hasFrames () |
virtual bool | hasPages () |
virtual const QString | type () const =0 |
virtual bool | isTextModeFrameset (KWFrameSet *) const |
KWCanvas * | canvas () const |
Static Public Member Functions | |
static KWViewMode * | create (const QString &viewModeType, KWDocument *doc, KWCanvas *canvas) |
Protected Member Functions | |
KWViewMode (KWDocument *doc, KWCanvas *canvas, bool drawFrameBorders) | |
void | drawOnePageBorder (QPainter *painter, const QRect &crect, const QRect &pageRect, const QRegion &emptySpaceRegion) |
QRect | drawRightShadow (QPainter *painter, const QRect &crect, const QRect &pageRect, int topOffset) |
QRect | drawBottomShadow (QPainter *painter, const QRect &crect, const QRect &pageRect, int leftOffset) |
Protected Attributes | |
KWDocument * | m_doc |
KWCanvas * | m_canvas |
bool | m_drawFrameBorders |
Static Protected Attributes | |
static const unsigned short | s_shadowOffset = 3 |
Member Function Documentation
virtual QPoint KWViewMode::normalToView | ( | const QPoint & | nPoint | ) | [pure virtual] |
Normal coord -> view coord.
Implemented in KWViewModeNormal, KWViewModeEmbedded, KWViewModePreview, and KWViewModeText.
QRect KWViewMode::normalToView | ( | const QRect & | nRect | ) | [inline] |
virtual QPoint KWViewMode::viewToNormal | ( | const QPoint & | vPoint | ) | [pure virtual] |
View coord -> normal coord.
Implemented in KWViewModeNormal, KWViewModeEmbedded, KWViewModePreview, and KWViewModeText.
QRect KWViewMode::viewToNormal | ( | const QRect & | nRect | ) | [inline] |
virtual QRect KWViewMode::viewPageRect | ( | int | pgNum | ) | [pure virtual] |
Return view coord for page rect.
Avoids rounding problems when doing normalToView(zoomedRect)
Implemented in KWViewModeNormal, KWViewModeEmbedded, KWViewModePreview, and KWViewModeText.
virtual QSize KWViewMode::contentsSize | ( | ) | [pure virtual] |
Size of the contents area, in pixels.
Implemented in KWViewModeNormal, KWViewModeEmbedded, KWViewModePreview, and KWViewModeText.
QSize KWViewMode::availableSizeForText | ( | KWTextFrameSet * | textfs | ) | [virtual] |
Size (in pixels) of the total area available for text in a given textframeset This is used by KWTextFrameSet::drawFrame to erase between the bottom of the last paragraph and the bottom of the available area.
Reimplemented in KWViewModeText.
Definition at line 37 of file KWViewMode.cpp.
QPoint KWViewMode::pageCorner | ( | ) | [virtual] |
"Topleft of current page" - concept used by the rulers.
The default implementation is good enough for any page-based viewmode, since it calls normalToView. But the textmode has no page concept.
Reimplemented in KWViewModeText.
Definition at line 92 of file KWViewMode.cpp.
QRect KWViewMode::rulerFrameRect | ( | ) | [virtual] |
The result of this is passed to setFrameStartEnd for both rulers (after adjustement with pageCorner()).
Reimplemented in KWViewModeText.
Definition at line 115 of file KWViewMode.cpp.
void KWViewMode::setPageLayout | ( | KoRuler * | hRuler, | |
KoRuler * | vRuler, | |||
const KoPageLayout & | layout | |||
) | [virtual] |
Called when the page layout is set, or changes.
Usually this is directly passed to KoRuler (for page-based viewmodes)
Reimplemented in KWViewModeText.
Definition at line 147 of file KWViewMode.cpp.
virtual void KWViewMode::setPagesPerRow | ( | int | ) | [inline, virtual] |
Config option for KWViewModePreview (a bit of a hack).
Reimplemented in KWViewModePreview.
Definition at line 95 of file KWViewMode.h.
virtual bool KWViewMode::drawSelections | ( | ) | [inline, virtual] |
Should selected text be drawn as such?
Reimplemented in KWViewModePrint, and KWViewModeEmbedded.
Definition at line 99 of file KWViewMode.h.
virtual bool KWViewMode::drawFrameBackground | ( | ) | [inline, virtual] |
Should frame background be drawn? Usually yes, but not for embedded docs with transparent=true.
Reimplemented in KWViewModeEmbedded.
Definition at line 102 of file KWViewMode.h.
bool KWViewMode::drawFrameBorders | ( | ) | const [inline] |
Should we see frame borders? This setting doesn't always come from KWView.
..
Definition at line 105 of file KWViewMode.h.
virtual bool KWViewMode::isFrameSetVisible | ( | const KWFrameSet * | ) | [inline, virtual] |
Should this frameset be visible in this viewmode? True by default, all are shown.
Reimplemented in KWViewModeText.
Definition at line 109 of file KWViewMode.h.
virtual bool KWViewMode::shouldFormatVertically | ( | ) | [inline, virtual] |
Should formatVertically() happen (to skip frame bottom, frames on top, etc.
)
Reimplemented in KWViewModeText.
Definition at line 113 of file KWViewMode.h.
virtual bool KWViewMode::shouldAdjustMargins | ( | ) | [inline, virtual] |
Should adjust[LR]Margin() happen (to run the text around frames on top etc.
)
Reimplemented in KWViewModeText.
Definition at line 116 of file KWViewMode.h.
virtual bool KWViewMode::hasFrames | ( | ) | [inline, virtual] |
Does this viewmode know anything about frames?
Reimplemented in KWViewModeText.
Definition at line 119 of file KWViewMode.h.
virtual bool KWViewMode::hasPages | ( | ) | [inline, virtual] |
Does this viewmode know anything about pages?
Reimplemented in KWViewModeEmbedded, and KWViewModeText.
Definition at line 122 of file KWViewMode.h.
virtual const QString KWViewMode::type | ( | ) | const [pure virtual] |
Return the name of the viewmode, used for loading/saving.
Implemented in KWViewModeNormal, KWViewModeEmbedded, KWViewModePreview, and KWViewModeText.
virtual bool KWViewMode::isTextModeFrameset | ( | KWFrameSet * | ) | const [inline, virtual] |
Answers the question if argument frameset has to be drawn as a text-mode text area if true, or if false as a frame with its own contents.
Reimplemented in KWViewModeText.
Definition at line 129 of file KWViewMode.h.
void KWViewMode::drawOnePageBorder | ( | QPainter * | painter, | |
const QRect & | crect, | |||
const QRect & | pageRect, | |||
const QRegion & | emptySpaceRegion | |||
) | [protected] |
Draw the border around one page, and clear up the empty space in that page.
- Parameters:
-
crect the rect we're interested in painting (in view pixels) pageRect the rect for the page, in view pixels emptySpaceRegion the empty space to clear up inside the page (in view pixels) painter the painter to paint the border on.
Definition at line 44 of file KWViewMode.cpp.
The documentation for this class was generated from the following files: