Update ooo320-m1
[ooovba.git] / sw / source / ui / ribbar / conarc.cxx
blobeb7a7dc536b5675361060920bc45e2f03a5741f6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: conarc.cxx,v $
10 * $Revision: 1.7 $
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>
38 #include "view.hxx"
39 #include "edtwin.hxx"
40 #include "wrtsh.hxx"
41 #include "drawbase.hxx"
42 #include "conarc.hxx"
46 /*************************************************************************
48 |* Konstruktor
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 )
69 BOOL bReturn;
71 if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == TRUE)
73 if (!nAnzButUp)
74 aStartPnt = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
76 return (bReturn);
79 /*************************************************************************
81 |* MouseButtonUp-event
83 \************************************************************************/
87 BOOL ConstArc::MouseButtonUp( const MouseEvent& rMEvt )
89 BOOL bReturn = FALSE;
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);
97 bReturn = TRUE;
99 else
100 { nAnzButUp++;
102 if (nAnzButUp == 3) // Kreisbogenerzeugung beendet
104 SwDrawBase::MouseButtonUp(rMEvt);
105 nAnzButUp = 0;
106 bReturn = TRUE;
108 else
109 m_pSh->EndCreate(SDRCREATE_NEXTPOINT);
112 /* else if ( pView->IsCreateObj() && rMEvt.IsRight() )
114 pView->EndCreateObj( SDRCREATE_FORCEEND );
115 bReturn = TRUE;
118 return (bReturn);
121 /*************************************************************************
123 |* Function aktivieren
125 \************************************************************************/
129 void ConstArc::Activate(const USHORT nSlotId)
131 switch (nSlotId)
133 case SID_DRAW_ARC:
134 m_pWin->SetSdrDrawMode(OBJ_CARC);
135 break;
136 case SID_DRAW_PIE:
137 m_pWin->SetSdrDrawMode(OBJ_SECT);
138 break;
139 case SID_DRAW_CIRCLECUT:
140 m_pWin->SetSdrDrawMode(OBJ_CCUT);
141 break;
142 default:
143 m_pWin->SetSdrDrawMode(OBJ_NONE);
144 break;
147 SwDrawBase::Activate(nSlotId);
150 /*************************************************************************
152 |* Funktion deaktivieren
154 \************************************************************************/
156 void ConstArc::Deactivate()
158 nAnzButUp = 0;
160 SwDrawBase::Deactivate();