Line data Source code
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 :
24 : #include "view.hxx"
25 : #include "edtwin.hxx"
26 : #include "wrtsh.hxx"
27 : #include "drawbase.hxx"
28 : #include "conpoly.hxx"
29 : #include <basegfx/polygon/b2dpolygon.hxx>
30 :
31 : /*************************************************************************
32 : |*
33 : |* Konstruktor
34 : |*
35 : \************************************************************************/
36 :
37 :
38 :
39 0 : ConstPolygon::ConstPolygon(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
40 0 : SwDrawBase(pWrtShell, pEditWin, pSwView)
41 : {
42 0 : }
43 :
44 : /*************************************************************************
45 : |*
46 : |* MouseButtonDown-event
47 : |*
48 : \************************************************************************/
49 :
50 :
51 :
52 0 : sal_Bool ConstPolygon::MouseButtonDown(const MouseEvent& rMEvt)
53 : {
54 : sal_Bool bReturn;
55 :
56 0 : if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == sal_True)
57 0 : aLastPos = rMEvt.GetPosPixel();
58 :
59 0 : return (bReturn);
60 : }
61 :
62 : /*************************************************************************
63 : |*
64 : |* MouseMove-event
65 : |*
66 : \************************************************************************/
67 :
68 :
69 :
70 0 : sal_Bool ConstPolygon::MouseMove(const MouseEvent& rMEvt)
71 : {
72 0 : sal_Bool bReturn = sal_False;
73 :
74 0 : bReturn = SwDrawBase::MouseMove(rMEvt);
75 :
76 0 : return bReturn;
77 : }
78 :
79 : /*************************************************************************
80 : |*
81 : |* MouseButtonUp-event
82 : |*
83 : \************************************************************************/
84 :
85 :
86 :
87 0 : sal_Bool ConstPolygon::MouseButtonUp(const MouseEvent& rMEvt)
88 : {
89 0 : sal_Bool bReturn = sal_False;
90 :
91 0 : if (m_pSh->IsDrawCreate())
92 : {
93 0 : if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 &&
94 0 : m_pWin->GetSdrDrawMode() != OBJ_FREELINE)
95 : {
96 0 : if (!m_pSh->EndCreate(SDRCREATE_NEXTPOINT))
97 : {
98 0 : m_pSh->BreakCreate();
99 0 : EnterSelectMode(rMEvt);
100 0 : return sal_True;
101 : }
102 : }
103 : else
104 : {
105 0 : bReturn = SwDrawBase::MouseButtonUp(rMEvt);
106 :
107 : // #i85045# removed double mechanism to check for AutoClose polygon
108 : // after construction; the method here did not check for already closed and
109 : // also worked only for a single polygon. Removing.
110 : }
111 : }
112 : else
113 0 : bReturn = SwDrawBase::MouseButtonUp(rMEvt);
114 :
115 0 : return (bReturn);
116 : }
117 :
118 : /*************************************************************************
119 : |*
120 : |* Function aktivieren
121 : |*
122 : \************************************************************************/
123 :
124 :
125 :
126 0 : void ConstPolygon::Activate(const sal_uInt16 nSlotId)
127 : {
128 0 : switch (nSlotId)
129 : {
130 : case SID_DRAW_POLYGON_NOFILL:
131 0 : m_pWin->SetSdrDrawMode(OBJ_PLIN);
132 0 : break;
133 :
134 : case SID_DRAW_BEZIER_NOFILL:
135 0 : m_pWin->SetSdrDrawMode(OBJ_PATHLINE);
136 0 : break;
137 :
138 : case SID_DRAW_FREELINE_NOFILL:
139 0 : m_pWin->SetSdrDrawMode(OBJ_FREELINE);
140 0 : break;
141 :
142 : default:
143 0 : break;
144 : }
145 :
146 0 : SwDrawBase::Activate(nSlotId);
147 0 : }
148 :
149 :
150 :
151 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|