LibreOffice Module sc (master)  1
fupoor.hxx
Go to the documentation of this file.
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/timer.hxx>
24 #include <sfx2/request.hxx>
25 #include <svx/svdobj.hxx>
26 #include <vcl/window.hxx>
27 
28 class ScDrawView;
29 class ScTabViewShell;
30 class SdrModel;
31 class CommandEvent;
32 class KeyEvent;
33 class MouseEvent;
34 
35 // Return values for command
36 #define SC_CMD_NONE 0
37 #define SC_CMD_USED 1
38 
40 class FuPoor
41 {
42 protected:
47 
49 
50  Timer aScrollTimer; // for Autoscrolling
51  DECL_LINK( ScrollHdl, Timer *, void );
52  void ForceScroll(const Point& aPixPos);
53 
54  Timer aDragTimer; // for Drag&Drop
55  DECL_LINK( DragTimerHdl, Timer *, void );
56  DECL_LINK( DragHdl, void *, void );
58  Point aMDPos; // Position of MouseButtonDown
59 
60  // member to hold state of the mouse buttons for creation
61  // of own MouseEvents (like in ScrollHdl)
62 private:
63  sal_uInt16 mnCode;
64 
65 public:
66  FuPoor(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pView,
67  SdrModel* pDoc, const SfxRequest& rReq);
68  virtual ~FuPoor();
69 
70  // see member
71  void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
72  sal_uInt16 GetMouseButtonCode() const { return mnCode; }
73 
74  // Mouse- & Key-Events; return value=TRUE: Event was processed
75  virtual bool KeyInput(const KeyEvent& rKEvt);
76  virtual bool MouseMove(const MouseEvent&) { return false; }
77 
78  // moved from inline to *.cxx
79  virtual bool MouseButtonUp(const MouseEvent& rMEvt); // { return FALSE; }
80 
81  // moved from inline to *.cxx
82  virtual bool MouseButtonDown(const MouseEvent& rMEvt); // { return FALSE; }
83 
84  sal_uInt8 Command(const CommandEvent& rCEvt);
85 
86  virtual void Activate();
87  virtual void Deactivate();
88 
89  void SetWindow(vcl::Window* pWin) { pWindow = pWin; }
90 
91  sal_uInt16 GetSlotID() const { return aSfxRequest.GetSlot(); }
92 
93  bool IsDetectiveHit( const Point& rLogicPos );
94 
95  void StopDragTimer();
96 
97  // Create default drawing objects via keyboard
98  virtual SdrObjectUniquePtr CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle& rRectangle);
99 
100 protected:
101  static void ImpForceQuadratic(tools::Rectangle& rRect);
102 
103 public:
104  // #i33136#
105  virtual bool doConstructOrthogonal() const;
106 };
107 
108 #endif // _SD_FUPOOR_HXX
109 
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool bIsInDragMode
Definition: fupoor.hxx:57
virtual bool MouseButtonUp(const MouseEvent &rMEvt)
Definition: fupoor.cxx:118
virtual bool doConstructOrthogonal() const
Definition: fupoor.cxx:240
SdrModel * pDrDoc
Definition: fupoor.hxx:46
FuPoor(ScTabViewShell &rViewSh, vcl::Window *pWin, ScDrawView *pView, SdrModel *pDoc, const SfxRequest &rReq)
Definition: fupoor.cxx:35
virtual bool MouseButtonDown(const MouseEvent &rMEvt)
Definition: fupoor.cxx:126
void SetMouseButtonCode(sal_uInt16 nNew)
Definition: fupoor.hxx:71
void SetWindow(vcl::Window *pWin)
Definition: fupoor.hxx:89
bool IsDetectiveHit(const Point &rLogicPos)
Definition: fupoor.cxx:184
ScTabViewShell & rViewShell
Definition: fupoor.hxx:44
Timer aDragTimer
Definition: fupoor.hxx:54
void ForceScroll(const Point &aPixPos)
Definition: fupoor.cxx:70
virtual bool KeyInput(const KeyEvent &rKEvt)
Definition: fupoor.cxx:135
sal_uInt16 GetSlotID() const
Definition: fupoor.hxx:91
sal_uInt16 GetMouseButtonCode() const
Definition: fupoor.hxx:72
virtual SdrObjectUniquePtr CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle &rRectangle)
Definition: fupoor.cxx:217
SfxRequest aSfxRequest
Definition: fupoor.hxx:48
Timer aScrollTimer
Definition: fupoor.hxx:50
Base class for all functions.
Definition: fupoor.hxx:40
Point aMDPos
Definition: fupoor.hxx:58
sal_uInt16 GetSlot() const
sal_uInt8 Command(const CommandEvent &rCEvt)
Definition: fupoor.cxx:140
virtual ~FuPoor()
Definition: fupoor.cxx:53
void StopDragTimer()
Definition: fupoor.cxx:210
unsigned char sal_uInt8
ScDrawView * pView
Definition: fupoor.hxx:43
virtual bool MouseMove(const MouseEvent &)
Definition: fupoor.hxx:76
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
static void ImpForceQuadratic(tools::Rectangle &rRect)
Definition: fupoor.cxx:223
DECL_LINK(ScrollHdl, Timer *, void)
sal_uInt16 mnCode
Definition: fupoor.hxx:63
virtual void Activate()
Definition: fupoor.cxx:59
VclPtr< vcl::Window > pWindow
Definition: fupoor.hxx:45
virtual void Deactivate()
Definition: fupoor.cxx:63