1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
25 #include "drawbase.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
)
37 if ((bReturn
= SwDrawBase::MouseButtonDown(rMEvt
)) == sal_True
)
40 aStartPnt
= m_pWin
->PixelToLogic(rMEvt
.GetPosPixel());
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
);
60 if (nAnzButUp
== 3) // Generating of circular arc finished
62 SwDrawBase::MouseButtonUp(rMEvt
);
67 m_pSh
->EndCreate(SDRCREATE_NEXTPOINT
);
74 void ConstArc::Activate(const sal_uInt16 nSlotId
)
79 m_pWin
->SetSdrDrawMode(OBJ_CARC
);
82 m_pWin
->SetSdrDrawMode(OBJ_SECT
);
84 case SID_DRAW_CIRCLECUT
:
85 m_pWin
->SetSdrDrawMode(OBJ_CCUT
);
88 m_pWin
->SetSdrDrawMode(OBJ_NONE
);
92 SwDrawBase::Activate(nSlotId
);
95 void ConstArc::Deactivate()
99 SwDrawBase::Deactivate();
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */