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/svxids.hrc>
21 #include <vcl/event.hxx>
22 
23 #include <view.hxx>
24 #include <edtwin.hxx>
25 #include <wrtsh.hxx>
26 #include <drawbase.hxx>
27 #include <conpoly.hxx>
28 
29 ConstPolygon::ConstPolygon(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
30  SwDrawBase(pWrtShell, pEditWin, pSwView)
31 {
32 }
33 
35 {
36  bool bReturn = false;
37 
38  if (m_pSh->IsDrawCreate())
39  {
40  if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 &&
43  {
44  if (!m_pSh->EndCreate(SdrCreateCmd::NextPoint))
45  {
46  m_pSh->BreakCreate();
47  EnterSelectMode(rMEvt);
48  return true;
49  }
50  }
51  else
52  {
53  bReturn = SwDrawBase::MouseButtonUp(rMEvt);
54 
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.
58  }
59  }
60  else
61  bReturn = SwDrawBase::MouseButtonUp(rMEvt);
62 
63  return bReturn;
64 }
65 
66 void ConstPolygon::Activate(const sal_uInt16 nSlotId)
67 {
68  switch (nSlotId)
69  {
70  case SID_DRAW_POLYGON_NOFILL:
71  case SID_DRAW_XPOLYGON_NOFILL:
73  break;
74 
75  case SID_DRAW_POLYGON:
76  case SID_DRAW_XPOLYGON:
78  break;
79 
80  case SID_DRAW_BEZIER_NOFILL:
82  break;
83 
84  case SID_DRAW_BEZIER_FILL:
86  break;
87 
88  case SID_DRAW_FREELINE_NOFILL:
90  break;
91 
92  case SID_DRAW_FREELINE:
94  break;
95 
96  default:
97  break;
98  }
99 
100  SwDrawBase::Activate(nSlotId);
101 }
102 
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Activate(const sal_uInt16 nSlotId) override
Definition: conpoly.cxx:66
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: conpoly.cxx:34
void EnterSelectMode(const MouseEvent &rMEvt)
Definition: drawbase.cxx:484
SwWrtShell * m_pSh
Definition: drawbase.hxx:36
OBJ_POLY
OBJ_FREEFILL
OBJ_PLIN
virtual bool MouseButtonUp(const MouseEvent &rMEvt)
Definition: drawbase.cxx:239
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
sal_uInt16 GetClicks() const
void SetSdrDrawMode(SdrObjKind eSdrObjectKind)
Definition: edtwin.hxx:212
OBJ_PATHLINE
virtual void Activate(const sal_uInt16 nSlotId)
Definition: drawbase.cxx:427
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:2125
SdrObjKind GetSdrDrawMode() const
Definition: edtwin.hxx:211
OBJ_FREELINE
bool IsLeft() const
bool IsDrawCreate() const
Definition: feshview.cxx:2132
OBJ_PATHFILL
Definition: view.hxx:146
ConstPolygon(SwWrtShell *pSh, SwEditWin *pWin, SwView *pView)
Definition: conpoly.cxx:29
bool EndCreate(SdrCreateCmd eSdrCreateCmd)
Definition: feshview.cxx:1733