Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SW_DRAWBASE_HXX
29 : : #define _SW_DRAWBASE_HXX
30 : :
31 : : #include <tools/gen.hxx>
32 : :
33 : : class SwView;
34 : : class SwWrtShell;
35 : : class SwEditWin;
36 : : class KeyEvent;
37 : : class MouseEvent;
38 : :
39 : : #define MIN_FREEHAND_DISTANCE 10
40 : :
41 : : /*************************************************************************
42 : : |*
43 : : |* base class for all functions
44 : : |*
45 : : \************************************************************************/
46 : :
47 : : class SwDrawBase
48 : : {
49 : : protected:
50 : : SwView* m_pView;
51 : : SwWrtShell* m_pSh;
52 : : SwEditWin* m_pWin;
53 : : Point m_aStartPos; // position of BeginCreate
54 : : Point m_aMDPos; // position of MouseButtonDown
55 : : sal_uInt16 m_nSlotId;
56 : : sal_Bool m_bCreateObj :1;
57 : : sal_Bool m_bInsForm :1;
58 : :
59 : : Point GetDefaultCenterPos();
60 : : public:
61 : : SwDrawBase(SwWrtShell *pSh, SwEditWin* pWin, SwView* pView);
62 : : virtual ~SwDrawBase();
63 : :
64 : : void SetDrawPointer();
65 : : void EnterSelectMode(const MouseEvent& rMEvt);
66 : 0 : inline sal_Bool IsInsertForm() const { return m_bInsForm; }
67 : 0 : inline sal_Bool IsCreateObj() const { return m_bCreateObj; }
68 : :
69 : : // mouse- & key events; return value=sal_True: event was edited
70 : : virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
71 : : virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
72 : : virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
73 : : virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
74 : :
75 : : void BreakCreate();
76 : 0 : void SetSlotId(sal_uInt16 nSlot) {m_nSlotId = nSlot;}
77 : 0 : sal_uInt16 GetSlotId() { return m_nSlotId;}
78 : :
79 : : virtual void Activate(const sal_uInt16 nSlotId); // activate fuction
80 : : virtual void Deactivate(); // deactivate function
81 : :
82 : : virtual void CreateDefaultObject();
83 : :
84 : : // #i33136#
85 : : virtual bool doConstructOrthogonal() const;
86 : : };
87 : :
88 : :
89 : :
90 : : #endif // _SW_DRAWBASE_HXX
91 : :
92 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|