update dev300-m58
[ooovba.git] / sd / source / ui / inc / fupoor.hxx
blob937dc8f8755b93bf3a3aab8cfb0163e5aada7ea9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fupoor.hxx,v $
10 * $Revision: 1.14.108.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_FU_POOR_HXX
32 #define SD_FU_POOR_HXX
34 #include <tools/rtti.hxx>
35 #include <vcl/timer.hxx>
36 #include <tools/link.hxx>
37 #include <tools/gen.hxx>
38 #include <vcl/event.hxx>
39 #include <rtl/ref.hxx>
41 #ifndef _SALHELPER_SIMPLEREFERENCECOMPONENT_HXX_
42 #include "helper/simplereferencecomponent.hxx"
43 #endif
45 class SdDrawDocument;
46 class SfxRequest;
47 class Dialog;
48 class SdrObject;
50 namespace sd {
52 class DrawDocShell;
53 class View;
54 class ViewShell;
55 class Window;
57 /*************************************************************************
59 |* Basisklasse fuer alle Funktionen
61 \************************************************************************/
63 class FuPoor : public SimpleReferenceComponent
65 public:
66 static const int HITPIX = 2; // Hit-Toleranz in Pixel
67 static const int DRGPIX = 2; // Drag MinMove in Pixel
69 TYPEINFO();
71 virtual void DoExecute( SfxRequest& rReq );
73 // #95491# see member
74 void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
75 sal_uInt16 GetMouseButtonCode() const { return mnCode; }
77 DrawDocShell* GetDocSh() { return mpDocSh; }
78 SdDrawDocument* GetDoc() { return mpDoc; }
80 virtual void DoCut();
81 virtual void DoCopy();
82 virtual void DoPaste();
84 // Mouse- & Key-Events; Returnwert=TRUE: Event wurde bearbeitet
85 virtual BOOL KeyInput(const KeyEvent& rKEvt);
86 virtual BOOL MouseMove(const MouseEvent& );
87 virtual BOOL MouseButtonUp(const MouseEvent& rMEvt);
89 // #95491# moved from inline to *.cxx
90 virtual BOOL MouseButtonDown(const MouseEvent& rMEvt);
92 virtual BOOL Command(const CommandEvent& rCEvt);
93 virtual BOOL RequestHelp(const HelpEvent& rHEvt);
94 virtual void Paint(const Rectangle&, ::sd::Window* );
95 virtual void ReceiveRequest(SfxRequest& rReq);
97 virtual void Activate(); // Function aktivieren
98 virtual void Deactivate(); // Function deaktivieren
100 virtual void ScrollStart() {} // diese Funktionen werden von
101 virtual void ScrollEnd() {} // ForceScroll aufgerufen
103 void SetWindow(::sd::Window* pWin) { mpWindow = pWin; }
104 void WriteStatus(const String& aStr); // Statuszeile schreiben
106 // #97016# II
107 virtual void SelectionHasChanged();
109 USHORT GetSlotID() const { return( nSlotId ); }
110 USHORT GetSlotValue() const { return( nSlotValue ); }
112 void SetNoScrollUntilInside(BOOL bNoScroll = TRUE)
113 { bNoScrollUntilInside = bNoScroll; }
115 void StartDelayToScrollTimer ();
117 // #97016#
118 virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
120 /** is called when the currenct function should be aborted. <p>
121 This is used when a function gets a KEY_ESCAPE but can also
122 be called directly.
124 @returns true if a active function was aborted
126 virtual bool cancel();
128 // #i33136#
129 /** Decide if the object to be created should be created
130 orthogonal. Default implementation uses nSlotID
131 to decide. May be overloaded to use other criterias
132 for this decision
134 @returns true if the to be created object should be orthogonal.
136 virtual bool doConstructOrthogonal() const;
138 protected:
140 @param pViewSh
141 May be NULL.
143 FuPoor (ViewShell* pViewSh,
144 ::sd::Window* pWin,
145 ::sd::View* pView,
146 SdDrawDocument* pDoc,
147 SfxRequest& rReq);
148 virtual ~FuPoor (void);
150 DECL_LINK( DelayHdl, Timer * );
151 long diffPoint (long pos1, long pos2);
153 void ImpForceQuadratic(Rectangle& rRect);
155 /** Switch to another layer. The layer to switch to is specified by an
156 offset relative to the active layer. With respect to the layer bar
157 control at the lower left of the document window positive values
158 move to the right and negative values move to the left.
160 <p>Switching the layer is independant of the view's layer mode. The
161 layers are switched even when the layer mode is turned off and the
162 layer control is not visible.</p>
163 @param nOffset
164 If the offset is positive skip that many layers in selecting the
165 next layer. If it is negative then select a previous one. An
166 offset or zero does not change the current layer. If the
167 resulting index lies outside the valid range of indices then it
168 is set to either the minimal or maximal valid index, whitchever
169 is nearer.
171 void SwitchLayer (sal_Int32 nOffset);
173 ::sd::View* mpView;
174 ViewShell* mpViewShell;
175 ::sd::Window* mpWindow;
176 DrawDocShell* mpDocSh;
177 SdDrawDocument* mpDoc;
179 USHORT nSlotId;
180 USHORT nSlotValue;
182 Dialog* pDialog;
184 Timer aScrollTimer; // fuer Autoscrolling
185 DECL_LINK( ScrollHdl, Timer * );
186 void ForceScroll(const Point& aPixPos);
188 Timer aDragTimer; // fuer Drag&Drop
189 DECL_LINK( DragHdl, Timer * );
190 BOOL bIsInDragMode;
191 Point aMDPos; // Position von MouseButtonDown
193 // Flag, um AutoScrolling zu verhindern, bis von ausserhalb in das
194 // Fenster hinein gedragt wurde
195 BOOL bNoScrollUntilInside;
197 // Timer um das scrolling zu verzoegern, wenn aus dem fenster
198 // herausgedraggt wird (ca. 1 sec.)
199 Timer aDelayToScrollTimer; // fuer Verzoegerung bis scroll
200 BOOL bScrollable;
201 BOOL bDelayActive;
202 BOOL bFirstMouseMove;
204 // #95491# member to hold state of the mouse buttons for creation
205 // of own MouseEvents (like in ScrollHdl)
207 private:
208 sal_uInt16 mnCode;
212 typedef rtl::Reference< FuPoor > FunctionReference;
214 } // end of namespace sd
216 #endif // _SD_FUPOOR_HXX