android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / uibase / ribbar / conpoly.cxx
blobc4a245fda8af221c8591209936ad3adf3d4e4020
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/svxids.hrc>
21 #include <vcl/event.hxx>
23 #include <view.hxx>
24 #include <edtwin.hxx>
25 #include <wrtsh.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)
36 bool bReturn = false;
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))
46 m_pSh->BreakCreate();
47 EnterSelectMode(rMEvt);
48 return true;
51 else
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.
60 else
61 bReturn = SwDrawBase::MouseButtonUp(rMEvt);
63 return bReturn;
66 void ConstPolygon::Activate(const sal_uInt16 nSlotId)
68 switch (nSlotId)
70 case SID_DRAW_POLYGON_NOFILL:
71 case SID_DRAW_XPOLYGON_NOFILL:
72 m_pWin->SetSdrDrawMode(SdrObjKind::PolyLine);
73 break;
75 case SID_DRAW_POLYGON:
76 case SID_DRAW_XPOLYGON:
77 m_pWin->SetSdrDrawMode(SdrObjKind::Polygon);
78 break;
80 case SID_DRAW_BEZIER_NOFILL:
81 m_pWin->SetSdrDrawMode(SdrObjKind::PathLine);
82 break;
84 case SID_DRAW_BEZIER_FILL:
85 m_pWin->SetSdrDrawMode(SdrObjKind::PathFill);
86 break;
88 case SID_DRAW_FREELINE_NOFILL:
89 m_pWin->SetSdrDrawMode(SdrObjKind::FreehandLine);
90 break;
92 case SID_DRAW_FREELINE:
93 m_pWin->SetSdrDrawMode(SdrObjKind::FreehandFill);
94 break;
96 default:
97 break;
100 SwDrawBase::Activate(nSlotId);
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */