xref: /AOO41X/main/sc/source/ui/inc/fupoor.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SC_FUPOOR_HXX
29 #define _SC_FUPOOR_HXX
30 
31 #include <vcl/event.hxx>
32 #include <vcl/timer.hxx>
33 #include <sfx2/request.hxx>
34 
35 class ScDrawView;
36 class ScTabViewShell;
37 class Window;
38 class SdrModel;
39 class Dialog;
40 
41 // #98185# Create default drawing objects via keyboard
42 class SdrObject;
43 
44 //	Return-Werte fuer Command
45 #define SC_CMD_NONE		0
46 #define SC_CMD_USED		1
47 #define SC_CMD_IGNORE	2
48 
49 /*************************************************************************
50 |*
51 |* Basisklasse fuer alle Funktionen
52 |*
53 \************************************************************************/
54 
55 class FuPoor
56 {
57 protected:
58 	ScDrawView*		pView;
59 	ScTabViewShell*	pViewShell;
60 	Window*			pWindow;
61 	SdrModel* 		pDrDoc;
62 
63 	SfxRequest		aSfxRequest;
64 	Dialog* 		pDialog;
65 
66 	Timer			aScrollTimer;			// fuer Autoscrolling
67 	DECL_LINK( ScrollHdl, Timer * );
68 	void ForceScroll(const Point& aPixPos);
69 
70 	Timer			aDragTimer; 			// fuer Drag&Drop
71 	DECL_LINK( DragTimerHdl, Timer * );
72 	DECL_LINK( DragHdl, void * );
73 	sal_Bool			bIsInDragMode;
74 	Point			aMDPos; 				// Position von MouseButtonDown
75 
76 	// #95491# member to hold state of the mouse buttons for creation
77 	// of own MouseEvents (like in ScrollHdl)
78 private:
79 	sal_uInt16		mnCode;
80 
81 public:
82 	FuPoor(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
83 		   SdrModel* pDoc, SfxRequest& rReq);
84 	virtual ~FuPoor();
85 
86 	// #95491# see member
87 	void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
88 	sal_uInt16 GetMouseButtonCode() const { return mnCode; }
89 
90     virtual void Paint(const Rectangle&, Window*) {}
91 
92 	virtual void DoCut();
93 	virtual void DoCopy();
94 	virtual void DoPaste();
95 
96 	// Mouse- & Key-Events; Returnwert=TRUE: Event wurde bearbeitet
97 	virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
98     virtual sal_Bool MouseMove(const MouseEvent&) { return sal_False; }
99 
100 	// #95491# moved from inline to *.cxx
101 	virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt); // { return sal_False; }
102 
103 	// #95491# moved from inline to *.cxx
104 	virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt); // { return sal_False; }
105 
106 	virtual sal_uInt8 Command(const CommandEvent& rCEvt);
107 
108 	virtual void Activate();		// Function aktivieren
109 	virtual void Deactivate();		// Function deaktivieren
110 
111 	virtual void ScrollStart() {}	// diese Funktionen werden von
112 	virtual void ScrollEnd() {} 	// ForceScroll aufgerufen
113 
114 	void SetWindow(Window* pWin) { pWindow = pWin; }
115 
116 	sal_uInt16 GetSlotID() const { return( aSfxRequest.GetSlot() ); }
117 
118 	sal_Bool	IsDetectiveHit( const Point& rLogicPos );
119 
120 	void	StopDragTimer();
121 
122 	// #98185# Create default drawing objects via keyboard
123 	virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
124 
125 protected:
126 	void ImpForceQuadratic(Rectangle& rRect);
127 
128 public:
129 	// #i33136#
130 	virtual bool doConstructOrthogonal() const;
131 };
132 
133 
134 
135 #endif		// _SD_FUPOOR_HXX
136 
137