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 = SwDrawBase::MouseMove(rMEvt);
73 :
74 0 : return bReturn;
75 : }
76 :
77 : /*************************************************************************
78 : |*
79 : |* MouseButtonUp-event
80 : |*
81 : \************************************************************************/
82 :
83 :
84 :
85 0 : sal_Bool ConstPolygon::MouseButtonUp(const MouseEvent& rMEvt)
86 : {
87 0 : sal_Bool bReturn = sal_False;
88 :
89 0 : if (m_pSh->IsDrawCreate())
90 : {
91 0 : if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 &&
92 0 : m_pWin->GetSdrDrawMode() != OBJ_FREELINE)
93 : {
94 0 : if (!m_pSh->EndCreate(SDRCREATE_NEXTPOINT))
95 : {
96 0 : m_pSh->BreakCreate();
97 0 : EnterSelectMode(rMEvt);
98 0 : return sal_True;
99 : }
100 : }
101 : else
102 : {
103 0 : bReturn = SwDrawBase::MouseButtonUp(rMEvt);
104 :
105 : // #i85045# removed double mechanism to check for AutoClose polygon
106 : // after construction; the method here did not check for already closed and
107 : // also worked only for a single polygon. Removing.
108 : }
109 : }
110 : else
111 0 : bReturn = SwDrawBase::MouseButtonUp(rMEvt);
112 :
113 0 : return (bReturn);
114 : }
115 :
116 : /*************************************************************************
117 : |*
118 : |* Function aktivieren
119 : |*
120 : \************************************************************************/
121 :
122 :
123 :
124 0 : void ConstPolygon::Activate(const sal_uInt16 nSlotId)
125 : {
126 0 : switch (nSlotId)
127 : {
128 : case SID_DRAW_POLYGON_NOFILL:
129 0 : m_pWin->SetSdrDrawMode(OBJ_PLIN);
130 0 : break;
131 :
132 : case SID_DRAW_BEZIER_NOFILL:
133 0 : m_pWin->SetSdrDrawMode(OBJ_PATHLINE);
134 0 : break;
135 :
136 : case SID_DRAW_FREELINE_NOFILL:
137 0 : m_pWin->SetSdrDrawMode(OBJ_FREELINE);
138 0 : break;
139 :
140 : default:
141 0 : break;
142 : }
143 :
144 0 : SwDrawBase::Activate(nSlotId);
145 0 : }
146 :
147 :
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|