Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / fupoor.hxx
blob799798983d934a04429070678b02af814d18595b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SC_FUPOOR_HXX
21 #define _SC_FUPOOR_HXX
23 #include <vcl/event.hxx>
24 #include <vcl/timer.hxx>
25 #include <sfx2/request.hxx>
27 class ScDrawView;
28 class ScTabViewShell;
29 class Window;
30 class SdrModel;
31 class Dialog;
33 // Create default drawing objects via keyboard
34 class SdrObject;
36 // Return values for command
37 #define SC_CMD_NONE 0
38 #define SC_CMD_USED 1
39 #define SC_CMD_IGNORE 2
41 /** Base class for all functions */
42 class FuPoor
44 protected:
45 ScDrawView* pView;
46 ScTabViewShell* pViewShell;
47 Window* pWindow;
48 SdrModel* pDrDoc;
50 SfxRequest aSfxRequest;
51 Dialog* pDialog;
53 Timer aScrollTimer; // for Autoscrolling
54 DECL_LINK( ScrollHdl, void * );
55 void ForceScroll(const Point& aPixPos);
57 Timer aDragTimer; // for Drag&Drop
58 DECL_LINK( DragTimerHdl, void * );
59 DECL_LINK( DragHdl, void * );
60 sal_Bool bIsInDragMode;
61 Point aMDPos; // Position of MouseButtonDown
63 // member to hold state of the mouse buttons for creation
64 // of own MouseEvents (like in ScrollHdl)
65 private:
66 sal_uInt16 mnCode;
68 public:
69 FuPoor(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pView,
70 SdrModel* pDoc, SfxRequest& rReq);
71 virtual ~FuPoor();
73 // see member
74 void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
75 sal_uInt16 GetMouseButtonCode() const { return mnCode; }
77 virtual void Paint(const Rectangle&, Window*) {}
79 virtual void DoCut();
80 virtual void DoCopy();
81 virtual void DoPaste();
83 // Mouse- & Key-Events; return value=TRUE: Event was processed
84 virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
85 virtual sal_Bool MouseMove(const MouseEvent&) { return false; }
87 // moved from inline to *.cxx
88 virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt); // { return FALSE; }
90 // moved from inline to *.cxx
91 virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt); // { return FALSE; }
93 virtual sal_uInt8 Command(const CommandEvent& rCEvt);
95 virtual void Activate();
96 virtual void Deactivate();
98 void SetWindow(Window* pWin) { pWindow = pWin; }
100 sal_uInt16 GetSlotID() const { return( aSfxRequest.GetSlot() ); }
102 sal_Bool IsDetectiveHit( const Point& rLogicPos );
104 void StopDragTimer();
106 // Create default drawing objects via keyboard
107 virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
109 protected:
110 void ImpForceQuadratic(Rectangle& rRect);
112 public:
113 // #i33136#
114 virtual bool doConstructOrthogonal() const;
119 #endif // _SD_FUPOOR_HXX
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */