1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/* This file is part of the KDE project
Copyright (C) 2001 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef kwanchor_h
#define kwanchor_h
#include "KWTextDocument.h"
class KCommand;
class KWTextFrameSet;
class KWFrame;
class KWFrameSet;
/**
* An anchor is a special character, or 'custom item'.
* It never appears as such. It is as big as the frame it is related to,
* so that the frame is effectively inline in the text.
*/
class KWAnchor : public KoTextCustomItem
{
public:
/**
* Constructor.
* @param textdoc the document this ancher will be one character of.
* @param frameset The frameset that is anchored. This frameset contains the content we are
displaying.
* @param frameNum Which frame of the frameset (previos argument) is used for displaying.
*/
KWAnchor( KoTextDocument *textdoc, KWFrameSet * frameset, int frameNum );
~KWAnchor();
bool ownLine() const;
virtual void setFormat( KoTextFormat* );
/** The frameset that will provide the content to display in this anchor object */
KWFrameSet * frameSet() const { return m_frameset; }
/** The index the frameset needs to access which content is displayed in the anchor object */
int frameNum() const { return m_frameNum; }
/** Return the size of the item, i.e. the size of the frame (zoomed) */
TQSize size() const;
/* overloaded methods, see lib/kotext/kotextcustomitem.h for docu*/
virtual void resize();
virtual void finalize();
/* overloaded methods, see korichtext.h for docu*/
virtual Placement placement() const { return PlaceInline; }
virtual int widthHint() const { return size().width(); }
virtual int minimumWidth() const { return size().width(); }
virtual int ascent() const;
virtual void draw( TQPainter* p, int x, int y, int cx, int cy, int cw, int ch, const TQColorGroup& cg, bool selected );
/** Never called since we reimplement draw */
virtual void drawCustomItem(TQPainter*, int, int, int, int, int, int, int, int, int, const TQColorGroup&, bool, int, bool) { }
virtual KCommand * createCommand();
virtual KCommand * deleteCommand();
virtual void setDeleted( bool b );
virtual void save( TQDomElement &formatElem );
virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context ) const;
virtual int typeId() const { return 6; }
private:
KWFrameSet * m_frameset; // the frameset that implements the content for this special char.
int m_frameNum; // the reference the frameset needs to identify the content in its
// set of frames
};
#endif
|