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