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