kword

#include <KWViewMode.h>

Inheritance diagram for KWViewMode:
KWViewModeEmbedded KWViewModeNormal KWViewModePreview KWViewModeText KWViewModePrint

Public Member Functions

virtual TQPoint normalToView (const TQPoint &nPoint)=0
TQRect normalToView (const TQRect &nRect)
virtual TQPoint viewToNormal (const TQPoint &vPoint)=0
TQRect viewToNormal (const TQRect &nRect)
virtual TQRect viewPageRect (int pgNum)=0
virtual TQSize contentsSize ()=0
virtual TQSize availableSizeForText (KWTextFrameSet *textfs)
virtual TQPoint pageCorner ()
virtual TQRect rulerFrameRect ()
virtual void setPageLayout (KoRuler *hRuler, KoRuler *vRuler, const KoPageLayout &layout)
virtual void drawPageBorders (TQPainter *painter, const TQRect &crect, const TQRegion &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 TQString type () const =0
virtual bool isTextModeFrameset (KWFrameSet *) const
KWCanvas * canvas () const

Static Public Member Functions

static KWViewMode * create (const TQString &viewModeType, KWDocument *doc, KWCanvas *canvas)

Protected Member Functions

 KWViewMode (KWDocument *doc, KWCanvas *canvas, bool drawFrameBorders)
void drawOnePageBorder (TQPainter *painter, const TQRect &crect, const TQRect &pageRect, const TQRegion &emptySpaceRegion)
TQRect drawRightShadow (TQPainter *painter, const TQRect &crect, const TQRect &pageRect, int topOffset)
TQRect drawBottomShadow (TQPainter *painter, const TQRect &crect, const TQRect &pageRect, int leftOffset)

Protected Attributes

KWDocument * m_doc
KWCanvas * m_canvas
bool m_drawFrameBorders

Static Protected Attributes

static const unsigned short s_shadowOffset = 3

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.

Constructor & Destructor Documentation

◆ KWViewMode()

KWViewMode::KWViewMode ( KWDocument * doc,
KWCanvas * canvas,
bool drawFrameBorders )
inlineprotected

Definition at line 50 of file KWViewMode.h.

◆ ~KWViewMode()

virtual KWViewMode::~KWViewMode ( )
inlinevirtual

Definition at line 54 of file KWViewMode.h.

Member Function Documentation

◆ availableSizeForText()

TQSize 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.

◆ canvas()

KWCanvas * KWViewMode::canvas ( ) const
inline

Definition at line 133 of file KWViewMode.h.

◆ contentsSize()

virtual TQSize KWViewMode::contentsSize ( )
pure virtual

Size of the contents area, in pixels.

Implemented in KWViewModeEmbedded, KWViewModeNormal, KWViewModePreview, and KWViewModeText.

◆ create()

KWViewMode * KWViewMode::create ( const TQString & viewModeType,
KWDocument * doc,
KWCanvas * canvas )
static

Definition at line 154 of file KWViewMode.cpp.

◆ drawBottomShadow()

TQRect KWViewMode::drawBottomShadow ( TQPainter * painter,
const TQRect & crect,
const TQRect & pageRect,
int leftOffset )
protected

Definition at line 82 of file KWViewMode.cpp.

◆ drawFrameBackground()

virtual bool KWViewMode::drawFrameBackground ( )
inlinevirtual

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.

◆ drawFrameBorders()

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.

◆ drawOnePageBorder()

void KWViewMode::drawOnePageBorder ( TQPainter * painter,
const TQRect & crect,
const TQRect & pageRect,
const TQRegion & emptySpaceRegion )
protected

Draw the border around one page, and clear up the empty space in that page.

Parameters
crectthe rect we're interested in painting (in view pixels)
pageRectthe rect for the page, in view pixels
emptySpaceRegionthe empty space to clear up inside the page (in view pixels)
painterthe painter to paint the border on.

Definition at line 44 of file KWViewMode.cpp.

◆ drawRightShadow()

TQRect KWViewMode::drawRightShadow ( TQPainter * painter,
const TQRect & crect,
const TQRect & pageRect,
int topOffset )
protected

Definition at line 70 of file KWViewMode.cpp.

◆ drawSelections()

virtual bool KWViewMode::drawSelections ( )
inlinevirtual

Should selected text be drawn as such?

Reimplemented in KWViewModeEmbedded, and KWViewModePrint.

Definition at line 99 of file KWViewMode.h.

◆ hasFrames()

virtual bool KWViewMode::hasFrames ( )
inlinevirtual

Does this viewmode know anything about frames?

Reimplemented in KWViewModeText.

Definition at line 119 of file KWViewMode.h.

◆ hasPages()

virtual bool KWViewMode::hasPages ( )
inlinevirtual

Does this viewmode know anything about pages?

Reimplemented in KWViewModeEmbedded, and KWViewModeText.

Definition at line 122 of file KWViewMode.h.

◆ isFrameSetVisible()

virtual bool KWViewMode::isFrameSetVisible ( const KWFrameSet * )
inlinevirtual

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.

◆ isTextModeFrameset()

virtual bool KWViewMode::isTextModeFrameset ( KWFrameSet * ) const
inlinevirtual

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.

◆ normalToView() [1/2]

virtual TQPoint KWViewMode::normalToView ( const TQPoint & nPoint)
pure virtual

Normal coord -> view coord.

Implemented in KWViewModeEmbedded, KWViewModeNormal, KWViewModePreview, and KWViewModeText.

◆ normalToView() [2/2]

TQRect KWViewMode::normalToView ( const TQRect & nRect)
inline

Normal coord -> view coord.

Definition at line 60 of file KWViewMode.h.

◆ pageCorner()

TQPoint 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.

◆ pagesPerRow()

virtual int KWViewMode::pagesPerRow ( )
inlinevirtual

Definition at line 96 of file KWViewMode.h.

◆ rulerFrameRect()

TQRect 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.

◆ setDrawFrameBorders()

void KWViewMode::setDrawFrameBorders ( bool b)
inline

Definition at line 106 of file KWViewMode.h.

◆ setPageLayout()

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.

◆ setPagesPerRow()

virtual void KWViewMode::setPagesPerRow ( int )
inlinevirtual

Config option for KWViewModePreview (a bit of a hack).

Reimplemented in KWViewModePreview.

Definition at line 95 of file KWViewMode.h.

◆ shouldAdjustMargins()

virtual bool KWViewMode::shouldAdjustMargins ( )
inlinevirtual

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.

◆ shouldFormatVertically()

virtual bool KWViewMode::shouldFormatVertically ( )
inlinevirtual

Should formatVertically() happen (to skip frame bottom, frames on top, etc.).

Reimplemented in KWViewModeText.

Definition at line 113 of file KWViewMode.h.

◆ type()

virtual const TQString KWViewMode::type ( ) const
pure virtual

Return the name of the viewmode, used for loading/saving.

Implemented in KWViewModeEmbedded, KWViewModeNormal, KWViewModePreview, and KWViewModeText.

◆ viewPageRect()

virtual TQRect KWViewMode::viewPageRect ( int pgNum)
pure virtual

Return view coord for page rect.

Avoids rounding problems when doing normalToView(zoomedRect)

Implemented in KWViewModeEmbedded, KWViewModeNormal, KWViewModePreview, and KWViewModeText.

◆ viewToNormal() [1/2]

virtual TQPoint KWViewMode::viewToNormal ( const TQPoint & vPoint)
pure virtual

View coord -> normal coord.

Implemented in KWViewModeEmbedded, KWViewModeNormal, KWViewModePreview, and KWViewModeText.

◆ viewToNormal() [2/2]

TQRect KWViewMode::viewToNormal ( const TQRect & nRect)
inline

View coord -> normal coord.

Definition at line 67 of file KWViewMode.h.

Member Data Documentation

◆ m_canvas

KWCanvas* KWViewMode::m_canvas
protected

Definition at line 150 of file KWViewMode.h.

◆ m_doc

KWDocument* KWViewMode::m_doc
protected

Definition at line 149 of file KWViewMode.h.

◆ m_drawFrameBorders

bool KWViewMode::m_drawFrameBorders
protected

Definition at line 151 of file KWViewMode.h.

◆ s_shadowOffset

const unsigned short KWViewMode::s_shadowOffset = 3
staticprotected

Definition at line 147 of file KWViewMode.h.


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