Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SC_SOURCE_UI_INC_FUPOOR_HXX
21 : #define INCLUDED_SC_SOURCE_UI_INC_FUPOOR_HXX
22 :
23 : #include <vcl/event.hxx>
24 : #include <vcl/timer.hxx>
25 : #include <sfx2/request.hxx>
26 :
27 : class ScDrawView;
28 : class ScTabViewShell;
29 : namespace vcl { class Window; }
30 : class SdrModel;
31 : class Dialog;
32 :
33 : // Create default drawing objects via keyboard
34 : class SdrObject;
35 :
36 : // Return values for command
37 : #define SC_CMD_NONE 0
38 : #define SC_CMD_USED 1
39 : #define SC_CMD_IGNORE 2
40 :
41 : /** Base class for all functions */
42 : class FuPoor
43 : {
44 : protected:
45 : ScDrawView* pView;
46 : ScTabViewShell* pViewShell;
47 : vcl::Window* pWindow;
48 : SdrModel* pDrDoc;
49 :
50 : SfxRequest aSfxRequest;
51 : Dialog* pDialog;
52 :
53 : Timer aScrollTimer; // for Autoscrolling
54 : DECL_LINK( ScrollHdl, void * );
55 : void ForceScroll(const Point& aPixPos);
56 :
57 : Timer aDragTimer; // for Drag&Drop
58 : DECL_LINK( DragTimerHdl, void * );
59 : DECL_LINK( DragHdl, void * );
60 : bool bIsInDragMode;
61 : Point aMDPos; // Position of MouseButtonDown
62 :
63 : // member to hold state of the mouse buttons for creation
64 : // of own MouseEvents (like in ScrollHdl)
65 : private:
66 : sal_uInt16 mnCode;
67 :
68 : public:
69 : FuPoor(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawView* pView,
70 : SdrModel* pDoc, SfxRequest& rReq);
71 : virtual ~FuPoor();
72 :
73 : // see member
74 0 : void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
75 0 : sal_uInt16 GetMouseButtonCode() const { return mnCode; }
76 :
77 0 : virtual void Paint(const Rectangle&, vcl::Window*) {}
78 :
79 : virtual void DoCut();
80 : virtual void DoCopy();
81 : virtual void DoPaste();
82 :
83 : // Mouse- & Key-Events; return value=TRUE: Event was processed
84 : virtual bool KeyInput(const KeyEvent& rKEvt);
85 0 : virtual bool MouseMove(const MouseEvent&) { return false; }
86 :
87 : // moved from inline to *.cxx
88 : virtual bool MouseButtonUp(const MouseEvent& rMEvt); // { return FALSE; }
89 :
90 : // moved from inline to *.cxx
91 : virtual bool MouseButtonDown(const MouseEvent& rMEvt); // { return FALSE; }
92 :
93 : virtual sal_uInt8 Command(const CommandEvent& rCEvt);
94 :
95 : virtual void Activate();
96 : virtual void Deactivate();
97 :
98 772 : void SetWindow(vcl::Window* pWin) { pWindow = pWin; }
99 :
100 2664 : sal_uInt16 GetSlotID() const { return( aSfxRequest.GetSlot() ); }
101 :
102 : bool IsDetectiveHit( const Point& rLogicPos );
103 :
104 : void StopDragTimer();
105 :
106 : // Create default drawing objects via keyboard
107 : virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
108 :
109 : protected:
110 : void ImpForceQuadratic(Rectangle& rRect);
111 :
112 : public:
113 : // #i33136#
114 : virtual bool doConstructOrthogonal() const;
115 : };
116 :
117 : #endif // _SD_FUPOOR_HXX
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|