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 : #ifndef _SW_DRAWBASE_HXX
20 : #define _SW_DRAWBASE_HXX
21 :
22 : #include <tools/gen.hxx>
23 :
24 : class SwView;
25 : class SwWrtShell;
26 : class SwEditWin;
27 : class KeyEvent;
28 : class MouseEvent;
29 :
30 : #define MIN_FREEHAND_DISTANCE 10
31 :
32 : /*************************************************************************
33 : |*
34 : |* base class for all functions
35 : |*
36 : \************************************************************************/
37 :
38 : class SwDrawBase
39 : {
40 : protected:
41 : SwView* m_pView;
42 : SwWrtShell* m_pSh;
43 : SwEditWin* m_pWin;
44 : Point m_aStartPos; // position of BeginCreate
45 : Point m_aMDPos; // position of MouseButtonDown
46 : sal_uInt16 m_nSlotId;
47 : sal_Bool m_bCreateObj :1;
48 : sal_Bool m_bInsForm :1;
49 :
50 : Point GetDefaultCenterPos();
51 : public:
52 : SwDrawBase(SwWrtShell *pSh, SwEditWin* pWin, SwView* pView);
53 : virtual ~SwDrawBase();
54 :
55 : void SetDrawPointer();
56 : void EnterSelectMode(const MouseEvent& rMEvt);
57 0 : inline sal_Bool IsInsertForm() const { return m_bInsForm; }
58 0 : inline sal_Bool IsCreateObj() const { return m_bCreateObj; }
59 :
60 : // mouse- & key events; return value=sal_True: event was edited
61 : virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
62 : virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
63 : virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
64 : virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
65 :
66 : void BreakCreate();
67 0 : void SetSlotId(sal_uInt16 nSlot) {m_nSlotId = nSlot;}
68 0 : sal_uInt16 GetSlotId() { return m_nSlotId;}
69 :
70 : virtual void Activate(const sal_uInt16 nSlotId); // activate fuction
71 : virtual void Deactivate(); // deactivate function
72 :
73 : virtual void CreateDefaultObject();
74 :
75 : // #i33136#
76 : virtual bool doConstructOrthogonal() const;
77 : };
78 :
79 :
80 :
81 : #endif // _SW_DRAWBASE_HXX
82 :
83 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|