kword

KWFrameViewManager.h
1/* This file is part of the KOffice project
2 * Copyright (C) 2005 Thomas Zander <zander@kde.org>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; version 2.
7
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
12 *
13 * You should have received a copy of the GNU Library General Public License
14 * along with this library; see the file COPYING.LIB. If not, write to
15 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18#ifndef kwframeviewmanager_h
19#define kwframeviewmanager_h
20#include <tqobject.h>
21#include <tqptrlist.h>
22#include <tqvaluelist.h>
23#include <tqvaluevector.h>
24#include <defs.h>
25
26class KWDocument;
27class KWFrame;
28class KWFrameSet;
29class KWView;
30class KWViewMode;
31class KWFramesListener;
32class KWFrameSetEdit;
33class KWFrameView;
34
35class KoPoint;
36class KoRect;
37
38class TQPointer;
39class TQRegion;
40
51class KWFrameViewManager : public TQObject {
52 TQ_OBJECT
53
54
55public:
56 KWFrameViewManager();
61 KWFrameViewManager(KWDocument *doc);
62 virtual ~KWFrameViewManager();
63
77 enum SelectionType { selected, unselected, nextUnselected, frameOnTop };
86 KWFrameView *view(const KoPoint &point, SelectionType select, bool borderOnly = false) const;
88 KWFrameView *view(const KWFrame *frame) const;
89
93 TQValueList<KWFrameView*> selectedFrames() const;
99
100 // this should be changed to a real iterator
101 const TQValueList<KWFrameView*> frameViewsIterator() const { return m_frames; }
102
110 MouseMeaning mouseMeaning( const KoPoint &point, int keyState) const;
117 TQCursor mouseCursor( const KoPoint &point, int keyState ) const;
118
128 void showPopup( const KoPoint &point, KWView *view, int keyState, const TQPoint &popupPoint) const;
129
130 // listeners; see the fireEvents method signature for more info.
131 void addKWFramesListener(KWFramesListener *listener);
132 void removeKWFramesListener(KWFramesListener *listener);
133
142 void selectFrames(const KoPoint &point, int keyState, bool leftClick);
143
144public slots:
146 void slotFrameSetAdded(KWFrameSet *fs);
148 void slotFrameSetRemoved(KWFrameSet *fs);
150 void slotFrameAdded(KWFrame *f);
152 void slotFrameRemoved(KWFrame *f);
159 void slotFrameMoved(KWFrame *f, double previousYPosition);
161 void slotFrameResized(KWFrame *f);
165 void slotFrameSetRenamed(KWFrameSet *fs);
166
167signals:
173 void sigFrameResized(const TQValueList<KWFrame*>&);
175 void sigFrameMoved(const TQValueList<KWFrame*>&);
176
177protected slots:
183 void fireEvents();
184
185protected:
187#ifndef NDEBUG
188 virtual
189#endif
190 void requestFireEvents();
191
192private:
194 class FrameEvent {
195 public:
196 enum ActionType { FrameRemoved, FrameAdded, FrameSetRemoved, FrameSetAdded, FrameMoved,
197 FrameResized, FrameSelectionChanged, FrameSetRenamed };
198 FrameEvent (ActionType action);
199 FrameEvent (ActionType action, KWFrame *frame);
200 FrameEvent (ActionType action, KWFrameSet *frameSet);
201 private:
202 ActionType m_action;
203 KWFrame *m_frame;
204 KWFrameSet *m_frameSet;
205 friend class KWFrameViewManager;
206 };
207
209 void recalculateFrameCache();
210
216 TQValueVector<KWFrameView*> framesAt(const KoPoint &point, bool borderOnly = false) const;
222 static bool compareFrameViewZOrder(KWFrameView *f1, KWFrameView *f2);
223
224private:
225 TQValueList<KWFrameView*> m_frames; // TODO TQHash<KWFrame*,KWFrameView*>
226 TQValueList<KWFramesListener*> m_framesListener;
227 TQValueList<FrameEvent*> m_frameEvents;
228 bool m_queueRequested, m_blockEvents;
229};
230
231class KWFramesListener {
232public:
233 virtual void frameSetAdded(KWFrameSet *fs) = 0;
234 virtual void frameSetRemoved(KWFrameSet *fs) = 0;
235 virtual void frameAdded(KWFrame *f) = 0;
236 virtual void frameRemoved(KWFrame *f) = 0;
237};
238
239#endif
This object is created to edit a particular frameset in a particular view The view's canvas creates i...
Class: KWFrameSet Base type, a frameset holds content as well as frames to show that content.
Definition KWFrameSet.h:62
Class that knows about all the (visible) frames in the document and will act as a manager between the...
SelectionType
Used to change the behavior of view().
void slotFrameResized(KWFrame *f)
notify this slot if a Frame has been resized
KWFrameView * selectedFrame() const
Returns the first selected frame.
void showPopup(const KoPoint &point, KWView *view, int keyState, const TQPoint &popupPoint) const
Show a context-sensitive popup menu based on the location of 'point'.
void sigFrameMoved(const TQValueList< KWFrame * > &)
emitted after frames were moved
void slotFrameAdded(KWFrame *f)
notify this slot if a Frame has been created and should become visible.
void sigFrameSelectionChanged()
emitted after one or more incoming slotFrameSelectionChanged events.
MouseMeaning mouseMeaning(const KoPoint &point, int keyState) const
Return the MouseMeaning of what a click of the mouse would do at the point.
TQValueList< KWFrameView * > selectedFrames() const
Return all currently selected frames.
KWFrameView * view(const KoPoint &point, SelectionType select, bool borderOnly=false) const
Returns a frameView representing a frame positioned at point, or 0 when no match found.
void slotFrameSetRemoved(KWFrameSet *fs)
notify this slot if a FrameSet has been removed
void sigFrameSetRenamed()
emitted after a frameset that had at least one selected frame was renamed.
void slotFrameSetRenamed(KWFrameSet *fs)
notify this slot if a frameset was renamed
void selectFrames(const KoPoint &point, int keyState, bool leftClick)
Select frames based on a mouse click at point using keystate.
void slotFrameSetAdded(KWFrameSet *fs)
notify this slot if a FrameSet has been created and should become visible.
void sigFrameResized(const TQValueList< KWFrame * > &)
emitted after frames were resized
TQCursor mouseCursor(const KoPoint &point, int keyState) const
Similar to mouseMeaning(), but instead of returning the meaning this will return a mouse cursor to re...
void slotFrameMoved(KWFrame *f, double previousYPosition)
notify this slot if a Frame has been moved
virtual void requestFireEvents()
prepare or update the singleshot timer to fire events.
void fireEvents()
This method will propagate all the events saved up to the listeners.
void slotFrameRemoved(KWFrame *f)
notify this slot if a Frame has been removed
void slotFrameSelectionChanged()
notify this slot if one or more frames have been selected or unselected.
an instance of a KWFrameView represents the view in the MVC model of a frame; there can be multiple K...
Definition KWFrameView.h:82
This class represents a single frame.
Definition KWFrame.h:68
Abstract base class for KWCanvas's view modes.
Definition KWViewMode.h:48