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/svdmark.hxx>
21 #include <svx/svdview.hxx>
22 #include <svx/svdopath.hxx>
27 #include "drawbase.hxx"
28 #include "conpoly.hxx"
29 #include <basegfx/polygon/b2dpolygon.hxx>
31 ConstPolygon::ConstPolygon(SwWrtShell
* pWrtShell
, SwEditWin
* pEditWin
, SwView
* pSwView
) :
32 SwDrawBase(pWrtShell
, pEditWin
, pSwView
)
36 sal_Bool
ConstPolygon::MouseButtonDown(const MouseEvent
& rMEvt
)
40 if ((bReturn
= SwDrawBase::MouseButtonDown(rMEvt
)) == sal_True
)
41 aLastPos
= rMEvt
.GetPosPixel();
46 sal_Bool
ConstPolygon::MouseMove(const MouseEvent
& rMEvt
)
48 sal_Bool bReturn
= SwDrawBase::MouseMove(rMEvt
);
53 sal_Bool
ConstPolygon::MouseButtonUp(const MouseEvent
& rMEvt
)
55 sal_Bool bReturn
= sal_False
;
57 if (m_pSh
->IsDrawCreate())
59 if (rMEvt
.IsLeft() && rMEvt
.GetClicks() == 1 &&
60 m_pWin
->GetSdrDrawMode() != OBJ_FREELINE
)
62 if (!m_pSh
->EndCreate(SDRCREATE_NEXTPOINT
))
65 EnterSelectMode(rMEvt
);
71 bReturn
= SwDrawBase::MouseButtonUp(rMEvt
);
73 // #i85045# removed double mechanism to check for AutoClose polygon
74 // after construction; the method here did not check for already closed and
75 // also worked only for a single polygon. Removing.
79 bReturn
= SwDrawBase::MouseButtonUp(rMEvt
);
84 void ConstPolygon::Activate(const sal_uInt16 nSlotId
)
88 case SID_DRAW_POLYGON_NOFILL
:
89 m_pWin
->SetSdrDrawMode(OBJ_PLIN
);
92 case SID_DRAW_BEZIER_NOFILL
:
93 m_pWin
->SetSdrDrawMode(OBJ_PATHLINE
);
96 case SID_DRAW_FREELINE_NOFILL
:
97 m_pWin
->SetSdrDrawMode(OBJ_FREELINE
);
104 SwDrawBase::Activate(nSlotId
);
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */