1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: conarc.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <svx/svdobj.hxx>
41 #include "drawbase.hxx"
46 /*************************************************************************
50 \************************************************************************/
54 ConstArc::ConstArc(SwWrtShell
* pWrtShell
, SwEditWin
* pEditWin
, SwView
* pSwView
)
55 : SwDrawBase(pWrtShell
, pEditWin
, pSwView
), nAnzButUp(0)
59 /*************************************************************************
61 |* MouseButtonDown-event
63 \************************************************************************/
67 BOOL
ConstArc::MouseButtonDown( const MouseEvent
& rMEvt
)
71 if ((bReturn
= SwDrawBase::MouseButtonDown(rMEvt
)) == TRUE
)
74 aStartPnt
= m_pWin
->PixelToLogic(rMEvt
.GetPosPixel());
79 /*************************************************************************
81 |* MouseButtonUp-event
83 \************************************************************************/
87 BOOL
ConstArc::MouseButtonUp( const MouseEvent
& rMEvt
)
91 if ((m_pSh
->IsDrawCreate() || m_pWin
->IsDrawAction()) && rMEvt
.IsLeft())
93 Point
aPnt(m_pWin
->PixelToLogic(rMEvt
.GetPosPixel()));
94 if (!nAnzButUp
&& aPnt
== aStartPnt
)
96 SwDrawBase::MouseButtonUp(rMEvt
);
102 if (nAnzButUp
== 3) // Kreisbogenerzeugung beendet
104 SwDrawBase::MouseButtonUp(rMEvt
);
109 m_pSh
->EndCreate(SDRCREATE_NEXTPOINT
);
112 /* else if ( pView->IsCreateObj() && rMEvt.IsRight() )
114 pView->EndCreateObj( SDRCREATE_FORCEEND );
121 /*************************************************************************
123 |* Function aktivieren
125 \************************************************************************/
129 void ConstArc::Activate(const USHORT nSlotId
)
134 m_pWin
->SetSdrDrawMode(OBJ_CARC
);
137 m_pWin
->SetSdrDrawMode(OBJ_SECT
);
139 case SID_DRAW_CIRCLECUT
:
140 m_pWin
->SetSdrDrawMode(OBJ_CCUT
);
143 m_pWin
->SetSdrDrawMode(OBJ_NONE
);
147 SwDrawBase::Activate(nSlotId
);
150 /*************************************************************************
152 |* Funktion deaktivieren
154 \************************************************************************/
156 void ConstArc::Deactivate()
160 SwDrawBase::Deactivate();