Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <svx/svdmark.hxx>
30 : : #include <svx/svdview.hxx>
31 : : #include <svx/svdopath.hxx>
32 : :
33 : : #include "view.hxx"
34 : : #include "edtwin.hxx"
35 : : #include "wrtsh.hxx"
36 : : #include "drawbase.hxx"
37 : : #include "conpoly.hxx"
38 : : #include <basegfx/polygon/b2dpolygon.hxx>
39 : :
40 : : /*************************************************************************
41 : : |*
42 : : |* Konstruktor
43 : : |*
44 : : \************************************************************************/
45 : :
46 : :
47 : :
48 : 0 : ConstPolygon::ConstPolygon(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
49 : 0 : SwDrawBase(pWrtShell, pEditWin, pSwView)
50 : : {
51 : 0 : }
52 : :
53 : : /*************************************************************************
54 : : |*
55 : : |* MouseButtonDown-event
56 : : |*
57 : : \************************************************************************/
58 : :
59 : :
60 : :
61 : 0 : sal_Bool ConstPolygon::MouseButtonDown(const MouseEvent& rMEvt)
62 : : {
63 : : sal_Bool bReturn;
64 : :
65 [ # # ]: 0 : if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == sal_True)
66 : 0 : aLastPos = rMEvt.GetPosPixel();
67 : :
68 : 0 : return (bReturn);
69 : : }
70 : :
71 : : /*************************************************************************
72 : : |*
73 : : |* MouseMove-event
74 : : |*
75 : : \************************************************************************/
76 : :
77 : :
78 : :
79 : 0 : sal_Bool ConstPolygon::MouseMove(const MouseEvent& rMEvt)
80 : : {
81 : 0 : sal_Bool bReturn = sal_False;
82 : :
83 : 0 : bReturn = SwDrawBase::MouseMove(rMEvt);
84 : :
85 : 0 : return bReturn;
86 : : }
87 : :
88 : : /*************************************************************************
89 : : |*
90 : : |* MouseButtonUp-event
91 : : |*
92 : : \************************************************************************/
93 : :
94 : :
95 : :
96 : 0 : sal_Bool ConstPolygon::MouseButtonUp(const MouseEvent& rMEvt)
97 : : {
98 : 0 : sal_Bool bReturn = sal_False;
99 : :
100 [ # # ]: 0 : if (m_pSh->IsDrawCreate())
101 : : {
102 [ # # ]: 0 : if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 &&
[ # # # # ]
[ # # ]
103 : 0 : m_pWin->GetSdrDrawMode() != OBJ_FREELINE)
104 : : {
105 [ # # ]: 0 : if (!m_pSh->EndCreate(SDRCREATE_NEXTPOINT))
106 : : {
107 : 0 : m_pSh->BreakCreate();
108 : 0 : EnterSelectMode(rMEvt);
109 : 0 : return sal_True;
110 : : }
111 : : }
112 : : else
113 : : {
114 : 0 : bReturn = SwDrawBase::MouseButtonUp(rMEvt);
115 : :
116 : : // #i85045# removed double mechanism to check for AutoClose polygon
117 : : // after construction; the method here did not check for already closed and
118 : : // also worked only for a single polygon. Removing.
119 : : }
120 : : }
121 : : else
122 : 0 : bReturn = SwDrawBase::MouseButtonUp(rMEvt);
123 : :
124 : 0 : return (bReturn);
125 : : }
126 : :
127 : : /*************************************************************************
128 : : |*
129 : : |* Function aktivieren
130 : : |*
131 : : \************************************************************************/
132 : :
133 : :
134 : :
135 : 0 : void ConstPolygon::Activate(const sal_uInt16 nSlotId)
136 : : {
137 [ # # # # ]: 0 : switch (nSlotId)
138 : : {
139 : : case SID_DRAW_POLYGON_NOFILL:
140 : 0 : m_pWin->SetSdrDrawMode(OBJ_PLIN);
141 : 0 : break;
142 : :
143 : : case SID_DRAW_BEZIER_NOFILL:
144 : 0 : m_pWin->SetSdrDrawMode(OBJ_PATHLINE);
145 : 0 : break;
146 : :
147 : : case SID_DRAW_FREELINE_NOFILL:
148 : 0 : m_pWin->SetSdrDrawMode(OBJ_FREELINE);
149 : 0 : break;
150 : :
151 : : default:
152 : 0 : break;
153 : : }
154 : :
155 : 0 : SwDrawBase::Activate(nSlotId);
156 : 0 : }
157 : :
158 : :
159 : :
160 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|