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 : :
29 : : #include <svx/svdobj.hxx>
30 : :
31 : :
32 : : #include "view.hxx"
33 : : #include "edtwin.hxx"
34 : : #include "wrtsh.hxx"
35 : : #include "drawbase.hxx"
36 : : #include "conarc.hxx"
37 : :
38 : :
39 : :
40 : : /*************************************************************************
41 : : |*
42 : : |* Konstruktor
43 : : |*
44 : : \************************************************************************/
45 : :
46 : :
47 : :
48 : 0 : ConstArc::ConstArc(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView)
49 : 0 : : SwDrawBase(pWrtShell, pEditWin, pSwView), nAnzButUp(0)
50 : : {
51 : 0 : }
52 : :
53 : : /*************************************************************************
54 : : |*
55 : : |* MouseButtonDown-event
56 : : |*
57 : : \************************************************************************/
58 : :
59 : :
60 : :
61 : 0 : sal_Bool ConstArc::MouseButtonDown( const MouseEvent& rMEvt )
62 : : {
63 : : sal_Bool bReturn;
64 : :
65 [ # # ]: 0 : if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == sal_True)
66 : : {
67 [ # # ]: 0 : if (!nAnzButUp)
68 : 0 : aStartPnt = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
69 : : }
70 : 0 : return (bReturn);
71 : : }
72 : :
73 : : /*************************************************************************
74 : : |*
75 : : |* MouseButtonUp-event
76 : : |*
77 : : \************************************************************************/
78 : :
79 : :
80 : :
81 : 0 : sal_Bool ConstArc::MouseButtonUp( const MouseEvent& rMEvt )
82 : : {
83 : 0 : sal_Bool bReturn = sal_False;
84 : :
85 [ # # ][ # # ]: 0 : if ((m_pSh->IsDrawCreate() || m_pWin->IsDrawAction()) && rMEvt.IsLeft())
[ # # ][ # # ]
86 : : {
87 [ # # ]: 0 : Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
88 [ # # ][ # # ]: 0 : if (!nAnzButUp && aPnt == aStartPnt)
[ # # ]
89 : : {
90 [ # # ]: 0 : SwDrawBase::MouseButtonUp(rMEvt);
91 : 0 : bReturn = sal_True;
92 : : }
93 : : else
94 : 0 : { nAnzButUp++;
95 : :
96 [ # # ]: 0 : if (nAnzButUp == 3) // Kreisbogenerzeugung beendet
97 : : {
98 [ # # ]: 0 : SwDrawBase::MouseButtonUp(rMEvt);
99 : 0 : nAnzButUp = 0;
100 : 0 : bReturn = sal_True;
101 : : }
102 : : else
103 [ # # ]: 0 : m_pSh->EndCreate(SDRCREATE_NEXTPOINT);
104 : : }
105 : : }
106 : :
107 : 0 : return (bReturn);
108 : : }
109 : :
110 : : /*************************************************************************
111 : : |*
112 : : |* Function aktivieren
113 : : |*
114 : : \************************************************************************/
115 : :
116 : :
117 : :
118 : 0 : void ConstArc::Activate(const sal_uInt16 nSlotId)
119 : : {
120 [ # # # # ]: 0 : switch (nSlotId)
121 : : {
122 : : case SID_DRAW_ARC:
123 : 0 : m_pWin->SetSdrDrawMode(OBJ_CARC);
124 : 0 : break;
125 : : case SID_DRAW_PIE:
126 : 0 : m_pWin->SetSdrDrawMode(OBJ_SECT);
127 : 0 : break;
128 : : case SID_DRAW_CIRCLECUT:
129 : 0 : m_pWin->SetSdrDrawMode(OBJ_CCUT);
130 : 0 : break;
131 : : default:
132 : 0 : m_pWin->SetSdrDrawMode(OBJ_NONE);
133 : 0 : break;
134 : : }
135 : :
136 : 0 : SwDrawBase::Activate(nSlotId);
137 : 0 : }
138 : :
139 : : /*************************************************************************
140 : : |*
141 : : |* Funktion deaktivieren
142 : : |*
143 : : \************************************************************************/
144 : :
145 : 0 : void ConstArc::Deactivate()
146 : : {
147 : 0 : nAnzButUp = 0;
148 : :
149 : 0 : SwDrawBase::Deactivate();
150 : 0 : }
151 : :
152 : :
153 : :
154 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|