xref: /aoo42x/main/sw/source/ui/inc/drawbase.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SW_DRAWBASE_HXX
24 #define _SW_DRAWBASE_HXX
25 
26 #include <tools/gen.hxx>
27 
28 class SwView;
29 class SwWrtShell;
30 class SwEditWin;
31 class KeyEvent;
32 class MouseEvent;
33 
34 #define MIN_FREEHAND_DISTANCE	10
35 
36 /*************************************************************************
37 |*
38 |* Basisklasse fuer alle Funktionen
39 |*
40 \************************************************************************/
41 
42 class SwDrawBase
43 {
44 protected:
45     SwView*         m_pView;
46     SwWrtShell*     m_pSh;
47     SwEditWin*      m_pWin;
48     Point           m_aStartPos;                 // Position von BeginCreate
49     Point           m_aMDPos;                // Position von MouseButtonDown
50     sal_uInt16          m_nSlotId;
51     sal_Bool            m_bCreateObj  :1;
52     sal_Bool            m_bInsForm   :1;
53 
54     Point           GetDefaultCenterPos();
55 public:
56     SwDrawBase(SwWrtShell *pSh, SwEditWin* pWin, SwView* pView);
57 	virtual ~SwDrawBase();
58 
59 	void		 SetDrawPointer();
60 	void		 EnterSelectMode(const MouseEvent& rMEvt);
IsInsertForm() const61     inline sal_Bool  IsInsertForm() const { return m_bInsForm; }
IsCreateObj() const62     inline sal_Bool  IsCreateObj() const { return m_bCreateObj; }
63 
64 	// Mouse- & Key-Events; Returnwert=sal_True: Event wurde bearbeitet
65 	virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
66 	virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
67 	virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
68 	virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
69 
70 	void		 BreakCreate();
SetSlotId(sal_uInt16 nSlot)71     void         SetSlotId(sal_uInt16 nSlot) {m_nSlotId = nSlot;}
GetSlotId()72     sal_uInt16       GetSlotId() { return m_nSlotId;}
73 
74 	virtual void Activate(const sal_uInt16 nSlotId);	// Function aktivieren
75 	virtual void Deactivate();						// Function deaktivieren
76 
77     virtual void CreateDefaultObject();
78 
79 	// #i33136#
80 	virtual bool doConstructOrthogonal() const;
81 };
82 
83 
84 
85 #endif		// _SW_DRAWBASE_HXX
86 
87