LibreOffice Module sw (master)  1
conpoly.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <svx/svdmark.hxx>
21 #include <svx/svdview.hxx>
22 #include <svx/svdopath.hxx>
23 #include <svx/svxids.hrc>
24 
25 #include <view.hxx>
26 #include <edtwin.hxx>
27 #include <wrtsh.hxx>
28 #include <drawbase.hxx>
29 #include <conpoly.hxx>
31 
32 ConstPolygon::ConstPolygon(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
33  SwDrawBase(pWrtShell, pEditWin, pSwView)
34 {
35 }
36 
38 {
39  bool bReturn = false;
40 
41  if (m_pSh->IsDrawCreate())
42  {
43  if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 &&
46  {
47  if (!m_pSh->EndCreate(SdrCreateCmd::NextPoint))
48  {
49  m_pSh->BreakCreate();
50  EnterSelectMode(rMEvt);
51  return true;
52  }
53  }
54  else
55  {
56  bReturn = SwDrawBase::MouseButtonUp(rMEvt);
57 
58  // #i85045# removed double mechanism to check for AutoClose polygon
59  // after construction; the method here did not check for already closed and
60  // also worked only for a single polygon. Removing.
61  }
62  }
63  else
64  bReturn = SwDrawBase::MouseButtonUp(rMEvt);
65 
66  return bReturn;
67 }
68 
69 void ConstPolygon::Activate(const sal_uInt16 nSlotId)
70 {
71  switch (nSlotId)
72  {
73  case SID_DRAW_POLYGON_NOFILL:
74  case SID_DRAW_XPOLYGON_NOFILL:
76  break;
77 
78  case SID_DRAW_POLYGON:
79  case SID_DRAW_XPOLYGON:
81  break;
82 
83  case SID_DRAW_BEZIER_NOFILL:
85  break;
86 
87  case SID_DRAW_BEZIER_FILL:
89  break;
90 
91  case SID_DRAW_FREELINE_NOFILL:
93  break;
94 
95  case SID_DRAW_FREELINE:
97  break;
98 
99  default:
100  break;
101  }
102 
103  SwDrawBase::Activate(nSlotId);
104 }
105 
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Activate(const sal_uInt16 nSlotId) override
Definition: conpoly.cxx:69
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: conpoly.cxx:37
void EnterSelectMode(const MouseEvent &rMEvt)
Definition: drawbase.cxx:486
SwWrtShell * m_pSh
Definition: drawbase.hxx:36
OBJ_POLY
OBJ_FREEFILL
OBJ_PLIN
virtual bool MouseButtonUp(const MouseEvent &rMEvt)
Definition: drawbase.cxx:241
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
sal_uInt16 GetClicks() const
void SetSdrDrawMode(SdrObjKind eSdrObjectKind)
Definition: edtwin.hxx:212
OBJ_PATHLINE
virtual void Activate(const sal_uInt16 nSlotId)
Definition: drawbase.cxx:429
VclPtr< SwEditWin > m_pWin
Definition: drawbase.hxx:37
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
void BreakCreate()
Definition: feshview.cxx:2141
SdrObjKind GetSdrDrawMode() const
Definition: edtwin.hxx:211
OBJ_FREELINE
bool IsLeft() const
bool IsDrawCreate() const
Definition: feshview.cxx:2148
OBJ_PATHFILL
Definition: view.hxx:146
ConstPolygon(SwWrtShell *pSh, SwEditWin *pWin, SwView *pView)
Definition: conpoly.cxx:32
bool EndCreate(SdrCreateCmd eSdrCreateCmd)
Definition: feshview.cxx:1750