xref: /aoo42x/main/sc/source/ui/inc/fupoor.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SC_FUPOOR_HXX
25 #define _SC_FUPOOR_HXX
26 
27 #include <vcl/event.hxx>
28 #include <vcl/timer.hxx>
29 #include <sfx2/request.hxx>
30 
31 class ScDrawView;
32 class ScTabViewShell;
33 class Window;
34 class SdrModel;
35 class Dialog;
36 
37 // #98185# Create default drawing objects via keyboard
38 class SdrObject;
39 
40 //	Return-Werte fuer Command
41 #define SC_CMD_NONE		0
42 #define SC_CMD_USED		1
43 #define SC_CMD_IGNORE	2
44 
45 /*************************************************************************
46 |*
47 |* Basisklasse fuer alle Funktionen
48 |*
49 \************************************************************************/
50 
51 class FuPoor
52 {
53 protected:
54 	ScDrawView*		pView;
55 	ScTabViewShell*	pViewShell;
56 	Window*			pWindow;
57 	SdrModel* 		pDrDoc;
58 
59 	SfxRequest		aSfxRequest;
60 	Dialog* 		pDialog;
61 
62 	Timer			aScrollTimer;			// fuer Autoscrolling
63 	DECL_LINK( ScrollHdl, Timer * );
64 	void ForceScroll(const Point& aPixPos);
65 
66 	Timer			aDragTimer; 			// fuer Drag&Drop
67 	DECL_LINK( DragTimerHdl, Timer * );
68 	DECL_LINK( DragHdl, void * );
69 	sal_Bool			bIsInDragMode;
70 	Point			aMDPos; 				// Position von MouseButtonDown
71 
72 	// #95491# member to hold state of the mouse buttons for creation
73 	// of own MouseEvents (like in ScrollHdl)
74 private:
75 	sal_uInt16		mnCode;
76 
77 public:
78 	FuPoor(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
79 		   SdrModel* pDoc, SfxRequest& rReq);
80 	virtual ~FuPoor();
81 
82 	// #95491# see member
SetMouseButtonCode(sal_uInt16 nNew)83 	void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
GetMouseButtonCode() const84 	sal_uInt16 GetMouseButtonCode() const { return mnCode; }
85 
Paint(const Rectangle &,Window *)86     virtual void Paint(const Rectangle&, Window*) {}
87 
88 	virtual void DoCut();
89 	virtual void DoCopy();
90 	virtual void DoPaste();
91 
92 	// Mouse- & Key-Events; Returnwert=TRUE: Event wurde bearbeitet
93 	virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
MouseMove(const MouseEvent &)94     virtual sal_Bool MouseMove(const MouseEvent&) { return sal_False; }
95 
96 	// #95491# moved from inline to *.cxx
97 	virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt); // { return sal_False; }
98 
99 	// #95491# moved from inline to *.cxx
100 	virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt); // { return sal_False; }
101 
102 	virtual sal_uInt8 Command(const CommandEvent& rCEvt);
103 
104 	virtual void Activate();		// Function aktivieren
105 	virtual void Deactivate();		// Function deaktivieren
106 
ScrollStart()107 	virtual void ScrollStart() {}	// diese Funktionen werden von
ScrollEnd()108 	virtual void ScrollEnd() {} 	// ForceScroll aufgerufen
109 
SetWindow(Window * pWin)110 	void SetWindow(Window* pWin) { pWindow = pWin; }
111 
GetSlotID() const112 	sal_uInt16 GetSlotID() const { return( aSfxRequest.GetSlot() ); }
113 
114 	sal_Bool	IsDetectiveHit( const Point& rLogicPos );
115 
116 	void	StopDragTimer();
117 
118 	// #98185# Create default drawing objects via keyboard
119 	virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
120 
121 protected:
122 	void ImpForceQuadratic(Rectangle& rRect);
123 
124 public:
125 	// #i33136#
126 	virtual bool doConstructOrthogonal() const;
127 };
128 
129 
130 
131 #endif		// _SD_FUPOOR_HXX
132 
133