Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SC_FUPOOR_HXX
30 : : #define _SC_FUPOOR_HXX
31 : :
32 : : #include <vcl/event.hxx>
33 : : #include <vcl/timer.hxx>
34 : : #include <sfx2/request.hxx>
35 : :
36 : : class ScDrawView;
37 : : class ScTabViewShell;
38 : : class Window;
39 : : class SdrModel;
40 : : class Dialog;
41 : :
42 : : // Create default drawing objects via keyboard
43 : : class SdrObject;
44 : :
45 : : // Return values for command
46 : : #define SC_CMD_NONE 0
47 : : #define SC_CMD_USED 1
48 : : #define SC_CMD_IGNORE 2
49 : :
50 : : /** Base class for all functions */
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; // for Autoscrolling
63 : : DECL_LINK( ScrollHdl, void * );
64 : : void ForceScroll(const Point& aPixPos);
65 : :
66 : : Timer aDragTimer; // for Drag&Drop
67 : : DECL_LINK( DragTimerHdl, void * );
68 : : DECL_LINK( DragHdl, void * );
69 : : sal_Bool bIsInDragMode;
70 : : Point aMDPos; // Position of MouseButtonDown
71 : :
72 : : // 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 : : // see member
83 [ # # ]: 0 : void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
84 : 0 : sal_uInt16 GetMouseButtonCode() const { return mnCode; }
85 : :
86 : 0 : virtual void Paint(const Rectangle&, Window*) {}
87 : :
88 : : virtual void DoCut();
89 : : virtual void DoCopy();
90 : : virtual void DoPaste();
91 : :
92 : : // Mouse- & Key-Events; return value=TRUE: Event was processed
93 : : virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
94 : 0 : virtual sal_Bool MouseMove(const MouseEvent&) { return false; }
95 : :
96 : : // moved from inline to *.cxx
97 : : virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt); // { return FALSE; }
98 : :
99 : : // moved from inline to *.cxx
100 : : virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt); // { return FALSE; }
101 : :
102 : : virtual sal_uInt8 Command(const CommandEvent& rCEvt);
103 : :
104 : : virtual void Activate();
105 : : virtual void Deactivate();
106 : :
107 : 303 : void SetWindow(Window* pWin) { pWindow = pWin; }
108 : :
109 : 1041 : sal_uInt16 GetSlotID() const { return( aSfxRequest.GetSlot() ); }
110 : :
111 : : sal_Bool IsDetectiveHit( const Point& rLogicPos );
112 : :
113 : : void StopDragTimer();
114 : :
115 : : // Create default drawing objects via keyboard
116 : : virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
117 : :
118 : : protected:
119 : : void ImpForceQuadratic(Rectangle& rRect);
120 : :
121 : : public:
122 : : // #i33136#
123 : : virtual bool doConstructOrthogonal() const;
124 : : };
125 : :
126 : :
127 : :
128 : : #endif // _SD_FUPOOR_HXX
129 : :
130 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|