update credits
[LibreOffice.git] / sw / source / ui / ribbar / conarc.cxx
blobd3cf4d146d16cad443d4955733ee53292603ba47
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svx/svdobj.hxx>
22 #include "view.hxx"
23 #include "edtwin.hxx"
24 #include "wrtsh.hxx"
25 #include "drawbase.hxx"
26 #include "conarc.hxx"
28 ConstArc::ConstArc(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView)
29 : SwDrawBase(pWrtShell, pEditWin, pSwView), nAnzButUp(0)
33 sal_Bool ConstArc::MouseButtonDown( const MouseEvent& rMEvt )
35 sal_Bool bReturn;
37 if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == sal_True)
39 if (!nAnzButUp)
40 aStartPnt = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
42 return (bReturn);
45 sal_Bool ConstArc::MouseButtonUp( const MouseEvent& rMEvt )
47 sal_Bool bReturn = sal_False;
49 if ((m_pSh->IsDrawCreate() || m_pWin->IsDrawAction()) && rMEvt.IsLeft())
51 Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
52 if (!nAnzButUp && aPnt == aStartPnt)
54 SwDrawBase::MouseButtonUp(rMEvt);
55 bReturn = sal_True;
57 else
58 { nAnzButUp++;
60 if (nAnzButUp == 3) // Generating of circular arc finished
62 SwDrawBase::MouseButtonUp(rMEvt);
63 nAnzButUp = 0;
64 bReturn = sal_True;
66 else
67 m_pSh->EndCreate(SDRCREATE_NEXTPOINT);
71 return (bReturn);
74 void ConstArc::Activate(const sal_uInt16 nSlotId)
76 switch (nSlotId)
78 case SID_DRAW_ARC:
79 m_pWin->SetSdrDrawMode(OBJ_CARC);
80 break;
81 case SID_DRAW_PIE:
82 m_pWin->SetSdrDrawMode(OBJ_SECT);
83 break;
84 case SID_DRAW_CIRCLECUT:
85 m_pWin->SetSdrDrawMode(OBJ_CCUT);
86 break;
87 default:
88 m_pWin->SetSdrDrawMode(OBJ_NONE);
89 break;
92 SwDrawBase::Activate(nSlotId);
95 void ConstArc::Deactivate()
97 nAnzButUp = 0;
99 SwDrawBase::Deactivate();
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */