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/svxids.hrc>
21 #include <vcl/event.hxx>
26 #include <drawbase.hxx>
27 #include <conpoly.hxx>
29 ConstPolygon::ConstPolygon(SwWrtShell
* pWrtShell
, SwEditWin
* pEditWin
, SwView
* pSwView
) :
30 SwDrawBase(pWrtShell
, pEditWin
, pSwView
)
34 bool ConstPolygon::MouseButtonUp(const MouseEvent
& rMEvt
)
38 if (m_pSh
->IsDrawCreate())
40 if (rMEvt
.IsLeft() && rMEvt
.GetClicks() == 1 &&
41 m_pWin
->GetSdrDrawMode() != SdrObjKind::FreehandLine
&&
42 m_pWin
->GetSdrDrawMode() != SdrObjKind::FreehandFill
)
44 if (!m_pSh
->EndCreate(SdrCreateCmd::NextPoint
))
47 EnterSelectMode(rMEvt
);
53 bReturn
= SwDrawBase::MouseButtonUp(rMEvt
);
55 // #i85045# removed double mechanism to check for AutoClose polygon
56 // after construction; the method here did not check for already closed and
57 // also worked only for a single polygon. Removing.
61 bReturn
= SwDrawBase::MouseButtonUp(rMEvt
);
66 void ConstPolygon::Activate(const sal_uInt16 nSlotId
)
70 case SID_DRAW_POLYGON_NOFILL
:
71 case SID_DRAW_XPOLYGON_NOFILL
:
72 m_pWin
->SetSdrDrawMode(SdrObjKind::PolyLine
);
75 case SID_DRAW_POLYGON
:
76 case SID_DRAW_XPOLYGON
:
77 m_pWin
->SetSdrDrawMode(SdrObjKind::Polygon
);
80 case SID_DRAW_BEZIER_NOFILL
:
81 m_pWin
->SetSdrDrawMode(SdrObjKind::PathLine
);
84 case SID_DRAW_BEZIER_FILL
:
85 m_pWin
->SetSdrDrawMode(SdrObjKind::PathFill
);
88 case SID_DRAW_FREELINE_NOFILL
:
89 m_pWin
->SetSdrDrawMode(SdrObjKind::FreehandLine
);
92 case SID_DRAW_FREELINE
:
93 m_pWin
->SetSdrDrawMode(SdrObjKind::FreehandFill
);
100 SwDrawBase::Activate(nSlotId
);
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */