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 :
40 : /** Base class for all functions */
41 : class FuPoor
42 : {
43 : protected:
44 : ScDrawView* pView;
45 : ScTabViewShell* pViewShell;
46 : VclPtr<vcl::Window> pWindow;
47 : SdrModel* pDrDoc;
48 :
49 : SfxRequest aSfxRequest;
50 : VclPtr<Dialog> pDialog;
51 :
52 : Timer aScrollTimer; // for Autoscrolling
53 : DECL_LINK_TYPED( ScrollHdl, Timer *, void );
54 : void ForceScroll(const Point& aPixPos);
55 :
56 : Timer aDragTimer; // for Drag&Drop
57 : DECL_LINK_TYPED( DragTimerHdl, Timer *, void );
58 : DECL_LINK( DragHdl, void * );
59 : bool bIsInDragMode;
60 : Point aMDPos; // Position of MouseButtonDown
61 :
62 : // member to hold state of the mouse buttons for creation
63 : // of own MouseEvents (like in ScrollHdl)
64 : private:
65 : sal_uInt16 mnCode;
66 :
67 : public:
68 : FuPoor(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawView* pView,
69 : SdrModel* pDoc, SfxRequest& rReq);
70 : virtual ~FuPoor();
71 :
72 : // see member
73 0 : void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
74 0 : sal_uInt16 GetMouseButtonCode() const { return mnCode; }
75 :
76 : // Mouse- & Key-Events; return value=TRUE: Event was processed
77 : virtual bool KeyInput(const KeyEvent& rKEvt);
78 0 : virtual bool MouseMove(const MouseEvent&) { return false; }
79 :
80 : // moved from inline to *.cxx
81 : virtual bool MouseButtonUp(const MouseEvent& rMEvt); // { return FALSE; }
82 :
83 : // moved from inline to *.cxx
84 : virtual bool MouseButtonDown(const MouseEvent& rMEvt); // { return FALSE; }
85 :
86 : virtual sal_uInt8 Command(const CommandEvent& rCEvt);
87 :
88 : virtual void Activate();
89 : virtual void Deactivate();
90 :
91 605 : void SetWindow(vcl::Window* pWin) { pWindow = pWin; }
92 :
93 2061 : sal_uInt16 GetSlotID() const { return( aSfxRequest.GetSlot() ); }
94 :
95 : bool IsDetectiveHit( const Point& rLogicPos );
96 :
97 : void StopDragTimer();
98 :
99 : // Create default drawing objects via keyboard
100 : virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
101 :
102 : protected:
103 : static void ImpForceQuadratic(Rectangle& rRect);
104 :
105 : public:
106 : // #i33136#
107 : virtual bool doConstructOrthogonal() const;
108 : };
109 :
110 : #endif // _SD_FUPOOR_HXX
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|