116
137
* AnySide, OddSide or EvenSide
118
139
enum SheetSide { AnySide=0, OddSide=1, EvenSide=2};
119
SheetSide getSheetSide() { return sheetSide; }
120
void setSheetSide( SheetSide ss ) { sheetSide = ss; }
122
/** What happens on new page (create a new frame and reconnect, no followup, make copy) */
123
enum NewFrameBehaviour { Reconnect=0, NoFollowup=1, Copy=2 };
124
NewFrameBehaviour getNewFrameBehaviour() { return newFrameBehaviour; }
125
void setNewFrameBehaviour( NewFrameBehaviour nfb ) { newFrameBehaviour = nfb; }
127
/** Drawing property: if isCopy, this frame is a copy of the previous frame in the frameset */
128
bool isCopy() { return m_bCopy; }
140
SheetSide sheetSide()const { return (SheetSide)m_sheetSide; }
141
void setSheetSide( SheetSide ss ) { m_sheetSide = ss; }
143
/** What happens on new page
144
* (create a new frame and reconnect, no followup, make copy) */
145
enum NewFrameBehavior { Reconnect=0, NoFollowup=1, Copy=2 };
146
NewFrameBehavior newFrameBehavior()const { return (NewFrameBehavior)m_newFrameBehavior; }
147
void setNewFrameBehavior( NewFrameBehavior nfb ) { m_newFrameBehavior = nfb; }
149
/** Drawing property: if isCopy, this frame is a copy of the previous frame in the frameset
151
bool isCopy()const { return m_bCopy; }
129
152
void setCopy( bool copy ) { m_bCopy = copy; }
131
/* Data stucture methods */
132
KWFrameSet *getFrameSet() const { return frameSet; }
133
void setFrameSet( KWFrameSet *fs ) { frameSet = fs; }
154
/** Data stucture methods
156
KWFrameSet *frameSet() const { return m_frameSet; }
157
void setFrameSet( KWFrameSet *fs ) { m_frameSet = fs; }
135
/* The page on which this frame is (0 based)*/
159
/** The page on which this frame is (0 based)
136
161
int pageNum() const;
138
/* All borders can be custom drawn with their own colors etc. */
139
const Border &leftBorder() const { return brd_left; }
140
const Border &rightBorder() const { return brd_right; }
141
const Border &topBorder() const { return brd_top; }
142
const Border &bottomBorder() const { return brd_bottom; }
144
void setLeftBorder( Border _brd ) { brd_left = _brd; }
145
void setRightBorder( Border _brd ) { brd_right = _brd; }
146
void setTopBorder( Border _brd ) { brd_top = _brd; }
147
void setBottomBorder( Border _brd ) { brd_bottom = _brd; }
149
/** Return the _zoomed_ rectangle for this frame, including the border - for drawing */
150
QRect outerRect() const;
162
/** Same as pageNum(), but works if the frame hasn't been added to a frameset yet
164
int pageNum( KWDocument* doc ) const;
166
/** The z-order of the frame, relative to the other frames on the same page
168
void setZOrder( int z ) { m_zOrder = z; }
169
int zOrder() const { return m_zOrder; }
171
/** For KWFrameSet::updateFrames only. Clear list of frames on top of this one.
173
void clearFramesOnTop() { m_framesOnTop.clear(); }
174
void clearFramesBelow() { m_framesBelow.clear(); }
176
/** For KWFrameSet::updateFrames only. Add a frame on top of this one.
177
* Note that order doesn't matter in that list, it's for clipping only. */
178
void addFrameOnTop( KWFrame* fot ) { m_framesOnTop.append( fot ); }
181
* order DOES matter for this one tho. this one is for transparency & selection.
183
void addFrameBelow( KWFrame* fbl ) { m_framesBelow.append( fbl ); }
184
void sortFramesBelow() { m_framesBelow.sort(); }
186
const QPtrList<KWFrame>& framesOnTop() const { return m_framesOnTop; }
187
const QPtrList<KWFrame>& framesBelow() const { return m_framesBelow; }
189
/** All borders can be custom drawn with their own colors etc.
191
const KoBorder &leftBorder() const { return brd_left; }
192
const KoBorder &rightBorder() const { return brd_right; }
193
const KoBorder &topBorder() const { return brd_top; }
194
const KoBorder &bottomBorder() const { return brd_bottom; }
197
void setLeftBorder( KoBorder _brd ) { brd_left = _brd; }
198
void setRightBorder( KoBorder _brd ) { brd_right = _brd; }
199
void setTopBorder( KoBorder _brd ) { brd_top = _brd; }
200
void setBottomBorder( KoBorder _brd ) { brd_bottom = _brd; }
202
void invalidateParentFrameset();
204
/** Return the _zoomed_ rectangle for this frame, including the border - for drawing
205
* @param viewMode needed to know if borders are visible or not
207
QRect outerRect( KWViewMode* viewMode ) const;
151
209
/** Return the unzoomed rectangle, including the border, for the frames-on-top list.
152
The default border of size 1-pixel that is drawn on screen is _not_ included here
153
[since it depends on the zoom] */
210
* The default border of size 1-pixel that is drawn on screen is _not_ included here
211
* [since it depends on the zoom]
154
213
KoRect outerKoRect() const;
156
/* Resize handles (in kwcanvas.h) are the dots that are drawn on selected
215
/** Return the rectangle for this frame including the border and the runaround gap.
216
* This is the rectangle that the surrounding text must run around.
218
KoRect runAroundRect() const;
220
/** Resize handles (in kwcanvas.h) are the dots that are drawn on selected
157
221
frames, this creates and deletes them */
158
222
void createResizeHandles();
159
223
void createResizeHandlesForPage(KWCanvas *canvas);
160
224
void removeResizeHandlesForPage(KWCanvas *canvas);
161
225
void removeResizeHandles();
226
void frameBordersChanged();
162
227
void updateResizeHandles();
228
void repaintResizeHandles();
163
229
void updateRulerHandles();
165
QBrush getBackgroundColor() const { return backgroundColor; }
166
void setBackgroundColor( QBrush _color ) { backgroundColor = _color; }
168
// For text frames only
169
void setInternalY( int y ) { m_internalY = y; }
170
int internalY() const { return m_internalY; }
172
/** set left margin size */
230
void updateCursorType();
232
QBrush backgroundColor() const { return m_backgroundColor; }
233
void setBackgroundColor( const QBrush &_color );
235
KoRect innerRect() const;
237
double innerWidth() const;
238
double innerHeight() const;
241
/** The "internal Y" is the offset (in pt) of the real frame showed in this one
242
* ("real" means "the last that isn't a copy")
243
* This offset in pt is the sum of the height of the frames before that one.
244
* For text frames, this is equivalent to the layout units (after multiplication). */
245
void setInternalY( double y ) { m_internalY = y; }
246
double internalY() const { return m_internalY; }
248
/** set left margin size
173
250
void setBLeft( double b ) { bleft = b; }
174
/** set right margin size */
251
/** set right margin size
175
253
void setBRight( double b ) { bright = b; }
176
/** set top margin size */
254
/** set top margin size
177
256
void setBTop( double b ) { btop = b; }
178
/** set bottom margin size */
257
/** set bottom margin size
179
259
void setBBottom( double b ) { bbottom = b; }
181
/** get left margin size */
182
double getBLeft() { return bleft; }
183
/** get right margin size */
184
double getBRight() { return bright; }
185
/** get top margin size */
186
double getBTop() { return btop; }
187
/** get bottom margin size */
188
double getBBottom() { return bbottom; }
261
/** get left margin size
263
double bLeft()const { return bleft; }
264
/** get right margin size
266
double bRight()const { return bright; }
267
/** get top margin size
269
double bTop()const { return btop; }
270
/** get bottom margin size
272
double bBottom()const { return bbottom; }
190
/** returns a copy of self */
274
void setFrameMargins( double _left, double _top, double right, double bottom);
275
/** returns a copy of self
191
277
KWFrame *getCopy();
193
279
void copySettings(KWFrame *frm);
195
/** create XML to describe yourself */
281
/** create XML to describe yourself
196
283
void save( QDomElement &frameElem );
197
/** read attributes from XML. @p headerOrFooter if true some defaults are different */
198
void load( QDomElement &frameElem, bool headerOrFooter, int syntaxVersion );
284
/** read attributes from XML. @p headerOrFooter if true some defaults are different
286
void load( QDomElement &frameElem, KWFrameSet* frameSet, int syntaxVersion );
200
288
void setMinFrameHeight(double h) {m_minFrameHeight=h;}
201
double minFrameHeight(void) {return m_minFrameHeight;}
289
double minFrameHeight(void)const {return m_minFrameHeight;}
291
/** Return if the point is on the frame.
292
@param point the point in normal coordinates.
293
@param borderOfFrameOnly when true an additional check is done if the point
295
bool frameAtPos( const QPoint& nPoint, bool borderOfFrameOnly=false );
298
* Only applicable to frames of the main text frameset.
299
* Set to true by KWFrameLayout if the "footnote line" should be
300
* drawn under this frame.
302
void setDrawFootNoteLine( bool b ) { m_drawFootNoteLine = b; }
303
bool drawFootNoteLine()const { return m_drawFootNoteLine; }
205
RunAround m_runAround;
206
FrameBehaviour frameBehaviour;
207
NewFrameBehaviour newFrameBehaviour;
306
char /*SheetSide*/ m_sheetSide;
307
char /*RunAroundSide*/ m_runAround; // includes runaround side
308
char /*FrameBehavior*/ m_frameBehavior;
309
char /*NewFrameBehavior*/ m_newFrameBehavior;
208
310
double m_runAroundGap;
209
311
double bleft, bright, btop, bbottom; // margins
312
double m_minFrameHeight;
213
int m_internalY; // for text frames only
214
double m_minFrameHeight;
216
QBrush backgroundColor;
217
Border brd_left, brd_right, brd_top, brd_bottom;
219
QList<KWResizeHandle> handles;
220
KWFrameSet *frameSet;
222
// Prevent operator= and copy constructor
318
bool m_drawFootNoteLine;
320
QBrush m_backgroundColor;
321
KoBorder brd_left, brd_right, brd_top, brd_bottom;
323
QPtrList<KWResizeHandle> handles;
324
KWFrameList m_framesOnTop; // List of frames on top of us, those we shouldn't overwrite
325
KWFrameList m_framesBelow; // List of frames below us. needed for selection code & transparency
326
KWFrameSet *m_frameSet;
328
/** Prevent operator=
223
330
KWFrame &operator=( const KWFrame &_frame );
331
/** Prevent copy constructor
224
333
KWFrame ( const KWFrame &_frame );
303
421
virtual ~KWFrameSet();
423
virtual KWordFrameSetIface* dcopObject();
425
/** The type of frameset. Use this to differentiate between different instantiations of
426
* the framesets. Each implementation will return a different frameType.
305
428
virtual FrameSetType type() { return FT_BASE; }
307
virtual void addTextFramesets( QList<KWTextFrameSet> & /*lst*/ ) {};
431
* Return the type of FrameSet that would have been used in KWord 1.1
433
virtual FrameSetType typeAsKOffice1Dot1(void) { return type(); }
435
virtual void addTextFrameSets( QPtrList<KWTextFrameSet> & /*lst*/, bool /*onlyReadWrite*/ = false ) {};
436
virtual bool ownLine() const { return FALSE;}
309
438
/** The different types of textFramesets (that TEXT is important here!)
310
439
* FI_BODY = normal text frames.<br>
311
440
* FI_FIRST_HEADER = Header on page 1<br>
441
* FI_EVEN_HEADER = header on any even page<br>
312
442
* FI_ODD_HEADER = header on any odd page (can be including page 1)<br>
313
* FI_EVEN_HEADER = header on any even page<br>
314
443
* FI_FIRST_FOOTER = footer on page 1<br>
444
* FI_EVEN_FOOTER = footer on any even page<br>
315
445
* FI_ODD_FOOTER = footer on any odd page (can be including page 1)<br>
316
* FI_EVEN_FOOTER = footer on any even page<br>
317
446
* FI_FOOTNOTE = a footnote frame.
319
enum Info { FI_BODY = 0, FI_FIRST_HEADER = 1, FI_ODD_HEADER = 2, FI_EVEN_HEADER = 3,
320
FI_FIRST_FOOTER = 4, FI_ODD_FOOTER = 5, FI_EVEN_FOOTER = 6,
448
enum Info { FI_BODY = 0, FI_FIRST_HEADER = 1, FI_EVEN_HEADER = 2, FI_ODD_HEADER = 3,
449
FI_FIRST_FOOTER = 4, FI_EVEN_FOOTER = 5, FI_ODD_FOOTER = 6,
321
450
FI_FOOTNOTE = 7 };
322
Info frameSetInfo() { return m_info; }
451
/** Returns the type of TextFrameSet this is */
452
Info frameSetInfo()const { return m_info; }
453
/** Set the type of TextFrameSet this is */
323
454
void setFrameSetInfo( Info fi ) { m_info = fi; }
325
456
bool isAHeader() const;
326
457
bool isAFooter() const;
327
458
bool isHeaderOrFooter() const { return isAHeader() || isAFooter(); }
459
bool isFootEndNote() const;
329
bool isAWrongHeader( KoHFType t ) const;
330
bool isAWrongFooter( KoHFType t ) const;
461
virtual bool isFootNote() const { return false; }
462
virtual bool isEndNote() const { return false; }
332
464
bool isMainFrameset() const;
333
465
bool isMoveable() const;
335
467
// frame management
336
468
virtual void addFrame( KWFrame *_frame, bool recalc = true );
337
virtual void delFrame( unsigned int _num );
338
virtual void delFrame( KWFrame *frm, bool remove = true );
470
/** Delete a frame from the set of frames this frameSet has.
471
* @param num The frameNumber to be removed.
472
* @param remove passing true means that there can not be an undo of the action.
473
* @param recalc do an updateFrames()
475
virtual void delFrame( unsigned int _num, bool remove = true, bool recalc = true );
477
/** Delete a frame from the set of frames this frameSet has.
478
* @param frm. The frame that should be deleted
479
* @param remove passing true means that there can not be an undo of the action.
480
* @param recalc do an updateFrames()
482
void delFrame( KWFrame *frm, bool remove = true, bool recalc = true ); // calls the virtual one
484
/// Called by delFrame when it really deletes a frame (remove=true), to remove it from the table too
485
virtual void frameDeleted( KWFrame* /*frm*/, bool /*recalc*/ ) {}
339
487
void deleteAllFrames();
340
488
void deleteAllCopies(); // for headers/footers only
342
490
/** retrieve frame from x and y coords (unzoomed coords) */
343
491
KWFrame *frameAtPos( double _x, double _y );
493
/** Return if the point is on the frame.
494
@param point the point in normal coordinates.
495
@param borderOfFrameOnly when true an additional check is done if the point
497
bool isFrameAtPos( KWFrame* frame, const QPoint& nPoint, bool borderOfFrameOnly=false );
344
499
/** return a frame if nPoint in on one of its borders */
345
virtual KWFrame *frameByBorder( const QPoint & nPoint );
500
KWFrame *frameByBorder( const QPoint & nPoint );
347
502
/** get a frame by number */
348
KWFrame *getFrame( unsigned int _num );
503
KWFrame *frame( unsigned int _num );
350
505
/** get the frame whose settings apply for @p frame
351
506
(usually @p frame, but can also be the real frame if frame is a copy) */
352
static KWFrame * settingsFrame(KWFrame* frame);
507
static KWFrame * settingsFrame( const KWFrame* frame );
354
/* Iterator over the child frames */
355
const QList<KWFrame> &frameIterator() const { return frames; }
356
/* Get frame number */
357
int getFrameFromPtr( KWFrame *frame );
358
/* Get number of child frames */
509
/** Iterator over the child frames */
510
const QPtrList<KWFrame> &frameIterator() const { return frames; }
511
/** Get frame number */
512
int frameFromPtr( KWFrame *frame );
513
/** Get number of child frames */
359
514
unsigned int getNumFrames() const { return frames.count(); }
516
/** Called when the user resizes a frame. Calls resizeFrame. */
517
void resizeFrameSetCoords( KWFrame* frame, double newLeft, double newTop, double newRight, double newBottom, bool finalSize );
518
/** Called when the user resizes a frame. Reimplemented by KWPictureFrameSet. */
519
virtual void resizeFrame( KWFrame* frame, double newWidth, double newHeight, bool finalSize );
520
/** Called when the user moves a frame. */
521
virtual void moveFrame( KWFrame* ) {}
361
523
/** True if the frameset was deleted (but not destroyed, since it's in the undo/redo) */
362
524
bool isDeleted() const { return frames.isEmpty(); }
404
556
* Framesets shouldn't reimplement this one in theory [but KWTableFrameSet has to].
406
558
virtual void drawContents( QPainter *painter, const QRect &crect,
407
QColorGroup &cg, bool onlyChanged, bool resetChanged,
408
KWFrameSetEdit *edit, KWViewMode *viewMode, KWCanvas *canvas );
410
// This is used (e.g. by KWTextParag) to get the view settings
411
KWCanvas * currentDrawnCanvas() const { return m_currentDrawnCanvas; }
559
const QColorGroup &cg, bool onlyChanged, bool resetChanged,
560
KWFrameSetEdit *edit, KWViewMode *viewMode );
563
* This one is called by drawContents for each frame.
564
* It sets up clip rect and painter translation, and calls drawFrame, drawFrameBorder and drawMargins
566
* @param drawUnderlyingFrames if the frame implements it, then it should draw underlying frames.
567
* This is set to false by the default drawFrame implementation, so that the frames under a
568
* transparent frame are simply drawn, without transparency handling (nor their own
571
void drawFrameAndBorders( KWFrame *frame,
572
QPainter *painter, const QRect &crect,
573
const QColorGroup &cg, bool, bool,
574
KWFrameSetEdit *edit, KWViewMode *viewMode,
575
KWFrame *settingsFrame, bool drawUnderlyingFrames );
578
* Paint the borders for one frame of this frameset.
579
* @param painter The painter in which to draw the contents of the frameset
580
* @param frame The frame to be drawn
581
* @param settingsFrame The frame from which we take the settings (usually @p frame, but not with Copy behaviour)
582
* @param crect The rectangle (in "contents coordinates") to be painted
584
void drawFrameBorder( QPainter *painter, KWFrame *frame, KWFrame *settingsFrame,
585
const QRect &crect, KWViewMode *viewMode );
414
588
* Draw a particular frame of this frameset.
415
589
* This is called by drawContents and is what framesets must reimplement.
417
virtual void drawFrame( KWFrame *frame, QPainter *painter, const QRect &crect,
418
QColorGroup &cg, bool onlyChanged, bool resetChanged,
419
KWFrameSetEdit *edit ) = 0;
590
* @param fcrect rectangle to be repainted, in the _frame_'s coordinate system (in pixels). Doesn't include margins.
592
* @param crect rectangle to be repainted, in view coordinates. Includes margins.
593
* Default implementation does double-buffering and calls drawFrameContents.
595
virtual void drawFrame( KWFrame *frame, QPainter *painter, const QRect &fcrect, const QRect &crect,
596
const QPoint& translationOffset,
597
KWFrame *settingsFrame, const QColorGroup &cg, bool onlyChanged, bool resetChanged,
598
KWFrameSetEdit *edit, KWViewMode *viewMode, bool drawUnderlyingFrames );
601
* Implement this one instead of drawFrame to benefit from double-buffering
602
* AND transparency handling (painting frames below this one) automatically.
603
* You MUST reimplement one or the other, or you'll get infinite recursion ;)
605
* In this method, the painter has been translated to the frame's coordinate system
606
* @param fcrect rectangle to be repainted, in the _frame_'s coordinate system (in pixels). Doesn't include margins.
608
virtual void drawFrameContents( KWFrame * frame, QPainter *painter, const QRect& fcrect,
609
const QColorGroup &cg, bool onlyChanged, bool resetChanged,
610
KWFrameSetEdit * edit, KWViewMode *viewMode );
613
* Draw a margin of a specific frame of this frameSet
615
virtual void drawMargins( KWFrame *frame, QPainter *p, const QRect &fcrect, const QColorGroup &cg, KWViewMode *viewMode);
617
enum UpdateFramesFlags {
618
UpdateFramesInPage = 1,
619
SortFrames = 2 // kwtextframeset only
620
// next one is 4, not 3 ;)
422
623
* Called when our frames change, or when another frameset's frames change.
423
624
* Framesets can reimplement it, but should always call the parent method.
425
virtual void updateFrames();
626
virtual void updateFrames( int flags = 0xff );
628
/** Return list of frames in page @p pageNum.
629
* This is fast since it uses the m_framesInPage array.*/
630
const QPtrList<KWFrame> & framesInPage( int pageNum ) const;
632
/** Allows to detect that updateFrames() hasn't been called yet (e.g. on loading) */
633
bool hasFramesInPageArray() const { return !m_framesInPage.isEmpty(); }
427
635
/** relayout text in frames, so that it flows correctly around other frames */
428
636
virtual void layout() {}
451
673
/** Apply the new zoom/resolution - values are to be taken from kWordDocument() */
452
674
virtual void zoom( bool forPrint );
454
virtual void preparePrinting( QPainter *, QProgressDialog *, int & ) { }
676
//virtual void preparePrinting( QPainter *, QProgressDialog *, int & ) { }
456
678
/** Called once the frameset has been completely loaded or constructed.
457
679
* The default implementation calls updateFrames() and zoom(). Call the parent :) */
458
680
virtual void finalize();
460
682
virtual int paragraphs() { return 0; }
683
virtual int paragraphsSelected() { return 0; }
461
684
virtual bool statistics( QProgressDialog */*progress*/, ulong & /*charsWithSpace*/, ulong & /*charsWithoutSpace*/, ulong & /*words*/,
462
ulong & /*sentences*/, ulong & /*syllables*/ ) { return true; }
685
ulong & /*sentences*/, ulong & /*syllables*/, ulong & /*lines*/, bool /*process only selected */ ) { return true; }
464
687
KWDocument* kWordDocument() const { return m_doc; }
466
689
// Return true if page @p num can be removed, as far as this frameset is concerned
467
690
virtual bool canRemovePage( int num );
469
// only used for headers and footers...
470
void setCurrent( int i ) { m_current = i; }
471
int getCurrent() { return m_current; }
473
692
//Note: none of those floating-frameset methods creates undo/redo
474
693
//They are _called_ by the undo/redo commands.
476
695
/** Make this frameset floating, as close to its current position as possible. */
477
696
void setFloating();
478
697
/** Make this frameset floating, with the anchor at @p paragId,@p index in the text frameset @p textfs */
479
void setAnchored( KWTextFrameSet* textfs, int paragId, int index, bool placeHolderExists = false );
698
void setAnchored( KWTextFrameSet* textfs, int paragId, int index, bool placeHolderExists = false, bool repaint = true );
480
699
/** Note that this frameset has been made floating already, and store anchor position */
481
700
void setAnchored( KWTextFrameSet* textfs );
482
701
/** Make this frameset fixed, i.e. not anchored */
484
/** Return true if this frameset is floating, false if it's fixed */
703
/** Return true if this frameset is floating (inline), false if it's fixed */
485
704
bool isFloating() const { return m_anchorTextFs; }
486
705
/** Return the frameset in which our anchor is - assuming isFloating() */
487
706
KWTextFrameSet * anchorFrameset() const { return m_anchorTextFs; }
488
707
/** Return the anchor object for this frame number */
489
708
KWAnchor * findAnchor( int frameNum );
709
/** Tell this frame the format of it's anchor */
710
virtual void setAnchorFormat( KoTextFormat* /*format*/, int /*frameNum*/ ) {}
491
712
/** Create an anchor for the floating frame identified by frameNum */
492
virtual KWAnchor * createAnchor( KWTextDocument * textdoc, int frameNum );
713
virtual KWAnchor * createAnchor( KoTextDocument *txt, int frameNum );
494
715
/** Move the frame frameNum to the given position - this is called when
495
716
the frame is anchored and the anchor moves (see KWAnchor). */
496
virtual void moveFloatingFrame( int frameNum, const QPoint &position );
497
/** Get the [zoomed] size of the "floating frame" identified by frameNum.
717
virtual void moveFloatingFrame( int frameNum, const KoPoint &position );
718
/** Get the size of the "floating frame" identified by frameNum.
498
719
By default a real frame but not for tables. */
499
virtual QSize floatingFrameSize( int frameNum );
720
virtual KoSize floatingFrameSize( int frameNum = 0 );
721
/** Get the rect of the "floating frame" identified by frameNum,
722
in coordinates RELATIVE TO THE PARENT FRAMESET.
723
This is especially important for multi-parent inline frames. */
724
KoRect floatingFrameRect( int frameNum = 0 );
500
725
/** Get the 'baseline' to use for the "floating frame" identified by frameNum.
501
726
-1 means same as the height (usual case) */
502
727
virtual int floatingFrameBaseline( int /*frameNum*/ ) { return -1; }
552
796
/** save the common attributes for the frameset */
553
797
void saveCommon( QDomElement &parentElem, bool saveFrames );
555
// Determine the clipping rectangle for drawing the contents of @p frame with @p painter
556
// in the rectangle delimited by @p crect.
799
/**Determine the clipping rectangle for drawing the contents of @p frame with @p painter
800
* in the rectangle delimited by @p crect.
801
* This determines where to clip the painter to draw the contents of a given frame
557
803
QRegion frameClipRegion( QPainter * painter, KWFrame *frame, const QRect & crect,
558
KWViewMode * viewMode, bool onlyChanged );
804
KWViewMode * viewMode );
560
806
void deleteAnchor( KWAnchor * anchor );
561
807
virtual void deleteAnchors();
562
virtual void createAnchors( KWTextParag * parag, int index, bool placeHolderExists = false );
808
virtual void createAnchors( KWTextParag * parag, int index, bool placeHolderExists = false, bool repaint = true );
564
811
KWDocument *m_doc; // Document
565
QList<KWFrame> frames; // Our frames
567
FrameOnTop() {} // for QValueList
568
FrameOnTop( const KoRect & r, KWFrame * f )
569
: intersection( r ), frame( f ) {}
573
QValueList<FrameOnTop> m_framesOnTop; // List of frames on top of us, those we shouldn't overwrite
812
QPtrList<KWFrame> frames; // Our frames
814
// Cached info for optimization
815
/** This array provides a direct access to the frames on page N */
816
QPtrVector< QPtrList<KWFrame> > m_framesInPage;
817
/** always equal to m_framesInPage[0].first()->pageNum() :) */
819
/** always empty, for convenience in @ref framesInPage */
820
QPtrList<KWFrame> m_emptyList; // ## make static pointer to save memory ?
576
int m_current; // used for headers and footers, not too sure what it means
577
823
KWTableFrameSet *grpMgr;
578
824
bool m_removeableHeader, m_visible;
580
827
KWTextFrameSet * m_anchorTextFs;
581
KWCanvas * m_currentDrawnCanvas; // The canvas currently being drawn.
828
KWordFrameSetIface *m_dcop;
584
831
/******************************************************************/
590
837
KWPictureFrameSet( KWDocument *_doc, const QString & name );
591
838
virtual ~KWPictureFrameSet();
593
virtual FrameSetType type() { return FT_PICTURE; }
595
void setImage( const KWImage &image ) { m_image = image; }
596
KWImage image() const { return m_image; }
598
KoImageKey key() const { return m_image.key(); }
600
void loadImage( const QString &fileName, const QSize &_imgSize );
840
virtual KWordFrameSetIface* dcopObject();
843
* The type of frameset. Use this to differentiate between different instantiations of
844
* the framesets. Each implementation will return a different frameType.
846
virtual FrameSetType type( void );
848
virtual FrameSetType typeAsKOffice1Dot1( void );
850
void setPicture( const KoPicture &picture ) { m_picture = picture; }
851
KoPicture picture() const { return m_picture; }
853
KoPictureKey key() const { return m_picture.getKey(); }
855
void loadPicture( const QString &fileName );
856
void insertPicture( const KoPicture& picture );
859
* Reload a picture, which already exists in the picture collection
860
* (if not, it gives a defaulft KoPicture() )
862
void reloadPicture( const KoPictureKey& key );
866
* The size of the image is now only needed at drawing time, not before anymore.
867
* However at drawing time, it is the frame's size that matters.
601
869
void setSize( const QSize & _imgSize );
872
* Called when the user resizes a frame.
874
virtual void resizeFrame( KWFrame* frame, double newWidth, double newHeight, bool finalSize );
603
876
virtual QDomElement save( QDomElement &parentElem, bool saveFrames = true );
604
877
virtual void load( QDomElement &attributes, bool loadFrames = true );
606
virtual void drawFrame( KWFrame *frame, QPainter *painter, const QRect & crect,
607
QColorGroup &, bool onlyChanged, bool resetChanged,
608
KWFrameSetEdit *edit = 0L );
879
virtual void drawFrameContents( KWFrame * frame, QPainter *painter, const QRect & crect,
880
const QColorGroup &cg, bool onlyChanged, bool resetChanged,
881
KWFrameSetEdit * edit, KWViewMode *viewMode );
610
883
// Pixmaps can be transparent
611
884
virtual void createEmptyRegion( const QRect &, QRegion &, KWViewMode * ) { }
613
virtual KWFrame *frameByBorder( const QPoint & nPoint );
615
// RMB -> normal frame popup
616
virtual QString getPopupName() { return "frame_popup"; }
618
bool keepAspectRatio() const { return m_keepAspectRatio; }
619
void setKeepAspectRatio( bool b ) { m_keepAspectRatio = b; }
887
virtual void printDebug( KWFrame* frame );
890
bool keepAspectRatio() const;
891
void setKeepAspectRatio( bool b );
622
895
bool m_keepAspectRatio;
625
/******************************************************************/
626
/* Class: KWClipartFrameSet */
627
/******************************************************************/
628
class KWClipartFrameSet : public KWFrameSet
631
KWClipartFrameSet( KWDocument *_doc, const QString & name );
632
virtual ~KWClipartFrameSet() {}
634
virtual FrameSetType type() { return FT_CLIPART; }
636
void setClipart( const KoClipart &clipart ) { m_clipart = clipart; }
637
KoClipart clipart() const { return m_clipart; }
639
KoClipartKey key() const { return m_clipart.key(); }
641
void loadClipart( const QString &fileName );
642
//void setSize( const QSize & _imgSize );
644
virtual QDomElement save( QDomElement &parentElem, bool saveFrames = true );
645
virtual void load( QDomElement &attributes, bool loadFrames = true );
647
virtual void drawFrame( KWFrame *frame, QPainter *painter, const QRect & crect,
648
QColorGroup &, bool onlyChanged, bool resetChanged,
649
KWFrameSetEdit *edit = 0L );
651
// Cliparts can be transparent
652
virtual void createEmptyRegion( const QRect &, QRegion &, KWViewMode * ) { }
654
virtual KWFrame *frameByBorder( const QPoint & nPoint );
656
// RMB -> normal frame popup
657
virtual QString getPopupName() { return "frame_popup"; }
662
/******************************************************************/
663
/* Class: KWPartFrameSet */
664
/******************************************************************/
666
class KWPartFrameSet : public KWFrameSet
670
KWPartFrameSet( KWDocument *_doc, KWChild *_child, const QString & name );
671
virtual ~KWPartFrameSet();
673
virtual FrameSetType type() { return FT_PART; }
675
virtual KWFrameSetEdit * createFrameSetEdit( KWCanvas * );
677
KWChild *getChild() { return m_child; }
679
void updateChildGeometry();
680
virtual void updateFrames();
682
virtual void drawFrame( KWFrame * frame, QPainter * p, const QRect & crect,
683
QColorGroup &, bool onlyChanged, bool resetChanged,
684
KWFrameSetEdit *edit = 0L );
686
// Embedded parts can be transparent
687
virtual void createEmptyRegion( const QRect &, QRegion &, KWViewMode * ) { }
689
virtual QDomElement save( QDomElement &parentElem, bool saveFrames = true );
690
virtual void load( QDomElement &attributes, bool loadFrames = true );
692
// RMB -> normal frame popup
693
virtual QString getPopupName() { return "frame_popup"; }
700
class KWPartFrameSetEdit : public QObject, public KWFrameSetEdit
704
KWPartFrameSetEdit( KWPartFrameSet * fs, KWCanvas * canvas );
705
virtual ~KWPartFrameSetEdit();
707
KWPartFrameSet * partFrameSet() const
709
return static_cast<KWPartFrameSet*>(frameSet());
712
// Events forwarded by the canvas (when being in "edit" mode)
713
virtual void mousePressEvent( QMouseEvent *, const QPoint &, const KoPoint & );
714
virtual void mouseDoubleClickEvent( QMouseEvent *, const QPoint &, const KoPoint & );
717
KWFramePartMoveCommand *m_cmdMoveChild;
719
void slotChildChanged();
720
void slotChildActivated(bool);
723
/******************************************************************/
724
/* Class: KWFormulaFrameSet */
725
/******************************************************************/
727
class KWFormulaFrameSet : public KWFrameSet
731
KWFormulaFrameSet( KWDocument *_doc, const QString & name );
732
virtual ~KWFormulaFrameSet();
734
virtual FrameSetType type() { return FT_FORMULA; }
736
virtual KWFrameSetEdit* createFrameSetEdit(KWCanvas*);
739
* Paint this frameset
741
virtual void drawFrame(KWFrame *, QPainter*, const QRect&,
742
QColorGroup&, bool onlyChanged, bool resetChanged,
743
KWFrameSetEdit *edit = 0L);
745
virtual void updateFrames();
747
virtual QDomElement save( QDomElement &parentElem, bool saveFrames = true );
748
virtual void load( QDomElement &attributes, bool loadFrames = true );
750
/** Apply the new zoom/resolution - values are to be taken from kWordDocument() */
751
virtual void zoom( bool forPrint );
753
KFormula::KFormulaContainer* getFormula() const { return formula; }
755
void setChanged() { m_changed = true; }
757
virtual int floatingFrameBaseline( int /*frameNum*/ );
759
virtual QString getPopupName() { return "Formula";}
763
void slotFormulaChanged(int width, int height);
766
KFormula::KFormulaContainer* formula;
771
class KWFormulaFrameSetEdit : public QObject, public KWFrameSetEdit
775
KWFormulaFrameSetEdit(KWFormulaFrameSet* fs, KWCanvas* canvas);
776
virtual ~KWFormulaFrameSetEdit();
778
KWFormulaFrameSet* formulaFrameSet() const
780
return static_cast<KWFormulaFrameSet*>(frameSet());
783
KFormula::KFormulaView* getFormulaView() const
788
// Events forwarded by the canvas (when being in "edit" mode)
789
virtual void keyPressEvent(QKeyEvent*);
790
virtual void mousePressEvent(QMouseEvent*, const QPoint & n, const KoPoint & d );
791
virtual void mouseMoveEvent(QMouseEvent*, const QPoint & n, const KoPoint & d); // only called if button is pressed
792
virtual void mouseReleaseEvent(QMouseEvent*, const QPoint & n, const KoPoint & d);
793
//virtual void mouseDoubleClickEvent( QMouseEvent *, const QPoint & n, const KoPoint & d ) {}
794
//virtual void dragEnterEvent( QDragEnterEvent * ) {}
795
//virtual void dragMoveEvent( QDragMoveEvent *, const QPoint &, const KoPoint & ) {}
796
//virtual void dragLeaveEvent( QDragLeaveEvent * ) {}
797
//virtual void dropEvent( QDropEvent *, const QPoint &, const KoPoint & ) {}
798
virtual void focusInEvent();
799
virtual void focusOutEvent();
802
virtual void paste();
803
virtual void selectAll();
805
/** Moves the cursor to the first position */
807
/** Moves the cursor to the last position */
813
* Make sure the cursor can be seen at its new position.
815
void cursorChanged( bool visible, bool selecting );
818
KFormula::KFormulaView* formulaView;
896
/// Cache the finalSize parameter of the method resizeFrame for drawFrame
900
#if 0 // KWORD_HORIZONTAL_LINE
902
/******************************************************************/
903
/* Class: KWHorzLineFrameSet */
904
/******************************************************************/
905
class KWHorzLineFrameSet : public KWPictureFrameSet
908
KWHorzLineFrameSet( KWDocument *_doc, const QString & name );
909
virtual ~KWHorzLineFrameSet();
911
virtual KWordFrameSetIface* dcopObject();
914
* The type of frameset. Use this to differentiate between different instantiations of
915
* the framesets. Each implementation will return a different frameType.
917
virtual FrameSetType type( void );
918
virtual bool ownLine() const;
919
void drawFrameContents( KWFrame *frame, QPainter *painter, const QRect &crect,
920
const QColorGroup &, bool, bool, KWFrameSetEdit *, KWViewMode * );