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 <editeng/eeitem.hxx>
30 : :
31 : : #include "svx/svdstr.hrc" // names taken from the resource
32 : : #include "svx/svdglob.hxx" // StringCache
33 : : #include <svx/svdpagv.hxx>
34 : : #include <svx/svdmrkv.hxx>
35 : : #include <svx/svdedxv.hxx>
36 : : #include <svx/svdobj.hxx>
37 : : #include <svx/svdopath.hxx> // for GetContext
38 : : #include <svx/svdograf.hxx> // for GetContext
39 : : #include <svx/svdomedia.hxx> // for GetContext
40 : : #include <svx/svdetc.hxx> // for SdrEngineDefaults
41 : :
42 : : #ifdef DBG_UTIL
43 : : #include <svdibrow.hxx>
44 : : #endif
45 : :
46 : : #include "svx/svdoutl.hxx"
47 : : #include "svx/svdview.hxx"
48 : : #include "editeng/editview.hxx" // for GetField
49 : : #include "editeng/flditem.hxx" // for URLField
50 : : #include "svx/obj3d.hxx"
51 : : #include "svx/svddrgmt.hxx"
52 : : #include "svx/svdotable.hxx"
53 : : #include <tools/tenccvt.hxx>
54 : : #include <svx/sdr/overlay/overlaypolypolygon.hxx>
55 : : #include <svx/sdr/overlay/overlaymanager.hxx>
56 : : #include <svx/sdrpaintwindow.hxx>
57 : : #include <svx/sdrpagewindow.hxx>
58 : : #include <svx/sdrhittesthelper.hxx>
59 : :
60 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
61 : :
62 : 810 : SdrViewEvent::SdrViewEvent()
63 : : : pHdl(NULL),
64 : : pObj(NULL),
65 : : pRootObj(NULL),
66 : : pPV(NULL),
67 : : pURLField(NULL),
68 : : eHit(SDRHIT_NONE),
69 : : eEvent(SDREVENT_NONE),
70 : : eHdlKind(HDL_MOVE),
71 : : eEndCreateCmd(SDRCREATE_NEXTPOINT),
72 : : nMouseClicks(0),
73 : : nMouseMode(0),
74 : : nMouseCode(0),
75 : : nHlplIdx(0),
76 : : nGlueId(0),
77 : : bMouseDown(sal_False),
78 : : bMouseUp(sal_False),
79 : : bDoubleHdlSize(sal_False),
80 : : bIsAction(sal_False),
81 : : bIsTextEdit(sal_False),
82 : : bTextEditHit(sal_False),
83 : : bAddMark(sal_False),
84 : : bUnmark(sal_False),
85 : : bPrevNextMark(sal_False),
86 : : bMarkPrev(sal_False),
87 : : bInsPointNewObj(sal_False),
88 : : bDragWithCopy(sal_False),
89 : : bCaptureMouse(sal_False),
90 : 810 : bReleaseMouse(sal_False)
91 : : {
92 : 810 : }
93 : :
94 : 810 : SdrViewEvent::~SdrViewEvent()
95 : : {
96 : 810 : }
97 : :
98 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
99 : : // helper class for all D&D overlays
100 : :
101 : 0 : void SdrDropMarkerOverlay::ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rPolyPolygon)
102 : : {
103 [ # # ]: 0 : for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
104 : : {
105 [ # # ]: 0 : SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
106 [ # # ]: 0 : rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager();
107 : :
108 [ # # ]: 0 : if (xTargetOverlay.is())
109 : : {
110 : : ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(
111 [ # # ][ # # ]: 0 : rPolyPolygon);
112 [ # # ]: 0 : xTargetOverlay->add(*pNew);
113 [ # # ]: 0 : maObjects.append(*pNew);
114 : : }
115 [ # # ]: 0 : }
116 : 0 : }
117 : :
118 : 0 : SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject)
119 : : {
120 [ # # ][ # # ]: 0 : ImplCreateOverlays(rView, rObject.TakeXorPoly());
[ # # ]
121 : 0 : }
122 : :
123 : 0 : SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle)
124 : : {
125 [ # # ]: 0 : basegfx::B2DPolygon aB2DPolygon;
126 [ # # ]: 0 : aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top()));
127 [ # # ]: 0 : aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Top()));
128 [ # # ]: 0 : aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom()));
129 [ # # ]: 0 : aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
130 [ # # ]: 0 : aB2DPolygon.setClosed(true);
131 : :
132 [ # # ]: 0 : basegfx::B2DPolyPolygon aB2DPolyPolygon;
133 [ # # ]: 0 : aB2DPolyPolygon.append(aB2DPolygon);
134 : :
135 [ # # ][ # # ]: 0 : ImplCreateOverlays(rView, aB2DPolyPolygon);
[ # # ]
136 : 0 : }
137 : :
138 : 0 : SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd)
139 : : {
140 [ # # ]: 0 : basegfx::B2DPolygon aB2DPolygon;
141 [ # # ]: 0 : aB2DPolygon.append(basegfx::B2DPoint(rStart.X(), rStart.Y()));
142 [ # # ]: 0 : aB2DPolygon.append(basegfx::B2DPoint(rEnd.X(), rEnd.Y()));
143 [ # # ]: 0 : aB2DPolygon.setClosed(true);
144 : :
145 [ # # ]: 0 : basegfx::B2DPolyPolygon aB2DPolyPolygon;
146 [ # # ]: 0 : aB2DPolyPolygon.append(aB2DPolygon);
147 : :
148 [ # # ][ # # ]: 0 : ImplCreateOverlays(rView, aB2DPolyPolygon);
[ # # ]
149 : 0 : }
150 : :
151 : 0 : SdrDropMarkerOverlay::~SdrDropMarkerOverlay()
152 : : {
153 : : // The OverlayObjects are cleared using the destructor of OverlayObjectList.
154 : : // That destructor calls clear() at the list which removes all objects from the
155 : : // OverlayManager and deletes them.
156 : 0 : }
157 : :
158 : :
159 [ + - ][ # # ]: 905186 : TYPEINIT1(SdrView,SdrCreateView);
160 : :
161 : 4699 : SdrView::SdrView(SdrModel* pModel1, OutputDevice* pOut)
162 : : : SdrCreateView(pModel1,pOut),
163 : : bNoExtendedMouseDispatcher(sal_False),
164 : : bNoExtendedKeyDispatcher(sal_False),
165 : : bNoExtendedCommandDispatcher(sal_False),
166 [ + - ]: 4699 : mbMasterPagePaintCaching(sal_False)
167 : : {
168 : 4699 : bTextEditOnObjectsWithoutTextIfTextTool=sal_False;
169 : :
170 [ + - ]: 4699 : maAccessibilityOptions.AddListener(this);
171 : :
172 [ + - ]: 4699 : onAccessibilityOptionsChanged();
173 : 4699 : }
174 : :
175 [ + - ][ + - ]: 4508 : SdrView::~SdrView()
176 : : {
177 [ + - ]: 4508 : maAccessibilityOptions.RemoveListener(this);
178 [ - + ]: 6772 : }
179 : :
180 : 0 : sal_Bool SdrView::KeyInput(const KeyEvent& rKEvt, Window* pWin)
181 : : {
182 : 0 : SetActualWin(pWin);
183 : 0 : sal_Bool bRet=SdrCreateView::KeyInput(rKEvt,pWin);
184 [ # # ][ # # ]: 0 : if (!bRet && !IsExtendedKeyInputDispatcherEnabled()) {
[ # # ]
185 : 0 : bRet=sal_True;
186 [ # # # # : 0 : switch (rKEvt.GetKeyCode().GetFullFunction()) {
# # # # ]
187 : 0 : case KEYFUNC_CUT : Cut(); break;
188 : 0 : case KEYFUNC_COPY : Yank(); break;
189 : 0 : case KEYFUNC_PASTE : Paste(pWin); break;
190 : 0 : case KEYFUNC_DELETE: DeleteMarked(); break;
191 : 0 : case KEYFUNC_UNDO: pMod->Undo(); break;
192 : 0 : case KEYFUNC_REDO: pMod->Redo(); break;
193 : 0 : case KEYFUNC_REPEAT: pMod->Repeat(*this); break;
194 : : default: {
195 [ # # # # : 0 : switch (rKEvt.GetKeyCode().GetFullCode()) {
# # # # #
# ]
196 : : case KEY_ESCAPE: {
197 [ # # ]: 0 : if (IsTextEdit()) SdrEndTextEdit();
198 [ # # ]: 0 : if (IsAction()) BrkAction();
199 [ # # ]: 0 : if (pWin!=NULL) pWin->ReleaseMouse();
200 : 0 : } break;
201 : 0 : case KEY_DELETE: DeleteMarked(); break;
202 : 0 : case KEY_CUT: case KEY_DELETE+KEY_SHIFT: Cut(); break;
203 : 0 : case KEY_COPY: case KEY_INSERT+KEY_MOD1: Yank(); break;
204 : 0 : case KEY_PASTE: case KEY_INSERT+KEY_SHIFT: Paste(pWin); break;
205 : 0 : case KEY_UNDO: case KEY_BACKSPACE+KEY_MOD2: pMod->Undo(); break;
206 : 0 : case KEY_BACKSPACE+KEY_MOD2+KEY_SHIFT: pMod->Redo(); break;
207 : 0 : case KEY_REPEAT: case KEY_BACKSPACE+KEY_MOD2+KEY_MOD1: pMod->Repeat(*this); break;
208 : 0 : case KEY_MOD1+KEY_A: MarkAll(); break;
209 : 0 : default: bRet=sal_False;
210 : : } // switch
211 : : }
212 : : } // switch
213 [ # # ][ # # ]: 0 : if (bRet && pWin!=NULL) {
214 : : pWin->SetPointer(GetPreferedPointer(
215 [ # # ]: 0 : pWin->PixelToLogic(pWin->ScreenToOutputPixel( pWin->GetPointerPosPixel() ) ),
216 : : pWin,
217 [ # # ][ # # ]: 0 : rKEvt.GetKeyCode().GetModifier()));
[ # # ]
218 : : }
219 : : }
220 : 0 : return bRet;
221 : : }
222 : :
223 : 0 : sal_Bool SdrView::MouseButtonDown(const MouseEvent& rMEvt, Window* pWin)
224 : : {
225 : 0 : SetActualWin(pWin);
226 [ # # ]: 0 : if (rMEvt.IsLeft()) aDragStat.SetMouseDown(sal_True);
227 : 0 : sal_Bool bRet=SdrCreateView::MouseButtonDown(rMEvt,pWin);
228 [ # # ][ # # ]: 0 : if (!bRet && !IsExtendedMouseEventDispatcherEnabled()) {
[ # # ]
229 [ # # ]: 0 : SdrViewEvent aVEvt;
230 [ # # ]: 0 : PickAnything(rMEvt,SDRMOUSEBUTTONDOWN,aVEvt);
231 [ # # ][ # # ]: 0 : bRet=DoMouseEvent(aVEvt);
232 : : }
233 : 0 : return bRet;
234 : : }
235 : :
236 : 0 : sal_Bool SdrView::MouseButtonUp(const MouseEvent& rMEvt, Window* pWin)
237 : : {
238 : 0 : SetActualWin(pWin);
239 [ # # ]: 0 : if (rMEvt.IsLeft()) aDragStat.SetMouseDown(sal_False);
240 : 0 : sal_Bool bAction=IsAction();
241 [ # # ][ # # ]: 0 : sal_Bool bRet=!bAction && SdrCreateView::MouseButtonUp(rMEvt,pWin);
242 [ # # ][ # # ]: 0 : if (!bRet && !IsExtendedMouseEventDispatcherEnabled()) {
[ # # ]
243 [ # # ]: 0 : SdrViewEvent aVEvt;
244 [ # # ]: 0 : PickAnything(rMEvt,SDRMOUSEBUTTONUP,aVEvt);
245 [ # # ][ # # ]: 0 : bRet=DoMouseEvent(aVEvt);
246 : : }
247 : 0 : return bRet;
248 : : }
249 : :
250 : 0 : sal_Bool SdrView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
251 : : {
252 : 0 : SetActualWin(pWin);
253 : 0 : aDragStat.SetMouseDown(rMEvt.IsLeft());
254 : 0 : sal_Bool bRet=SdrCreateView::MouseMove(rMEvt,pWin);
255 [ # # ][ # # ]: 0 : if (!IsExtendedMouseEventDispatcherEnabled() && !IsTextEditInSelectionMode()) {
[ # # ]
256 [ # # ]: 0 : SdrViewEvent aVEvt;
257 [ # # ]: 0 : PickAnything(rMEvt,SDRMOUSEMOVE,aVEvt);
258 [ # # ][ # # ]: 0 : if (DoMouseEvent(aVEvt)) bRet=sal_True;
[ # # ]
259 : : }
260 : :
261 : 0 : return bRet;
262 : : }
263 : :
264 : 0 : sal_Bool SdrView::Command(const CommandEvent& rCEvt, Window* pWin)
265 : : {
266 : 0 : SetActualWin(pWin);
267 : 0 : sal_Bool bRet=SdrCreateView::Command(rCEvt,pWin);
268 : 0 : return bRet;
269 : : }
270 : :
271 : 1216 : sal_Bool SdrView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
272 : : {
273 : 1216 : return SdrCreateView::GetAttributes(rTargetSet, bOnlyHardAttr);
274 : : }
275 : :
276 : 4 : SfxStyleSheet* SdrView::GetStyleSheet() const
277 : : {
278 : 4 : return SdrCreateView::GetStyleSheet();
279 : : }
280 : :
281 : 0 : SdrHitKind SdrView::PickAnything(const MouseEvent& rMEvt, sal_uInt16 nEventKind, SdrViewEvent& rVEvt) const
282 : : {
283 : 0 : rVEvt.bMouseDown=nEventKind==SDRMOUSEBUTTONDOWN;
284 : 0 : rVEvt.bMouseUp=nEventKind==SDRMOUSEBUTTONUP;
285 : 0 : rVEvt.nMouseClicks=rMEvt.GetClicks();
286 : 0 : rVEvt.nMouseMode=rMEvt.GetMode();
287 : 0 : rVEvt.nMouseCode=rMEvt.GetButtons() | rMEvt.GetModifier();
288 : 0 : const OutputDevice* pOut=pActualOutDev;
289 [ # # ]: 0 : if (pOut==NULL)
290 : : {
291 [ # # ]: 0 : pOut = GetFirstOutputDevice();
292 : : }
293 : 0 : Point aPnt(rMEvt.GetPosPixel());
294 [ # # ][ # # ]: 0 : if (pOut!=NULL) aPnt=pOut->PixelToLogic(aPnt);
295 : 0 : rVEvt.aLogicPos=aPnt;
296 [ # # ]: 0 : return PickAnything(aPnt,rVEvt);
297 : : }
298 : :
299 : : // Dragging with the Mouse (Move)
300 : : // Example when creating a rectangle: MouseDown has to happen without a ModKey,
301 : : // else we usually force a selection (see below).
302 : : // When pressing Shift, Ctrl and Alt at the same time while doing a MouseMove,
303 : : // a centered, not snapped square is created.
304 : : // The dual allocation of Ortho and Shift won't usually create a problem, as the
305 : : // two functions are in most cases mutually exclusive. Only shearing (the kind
306 : : // that happens when contorting, not when rotating) can use both functions at
307 : : // the same time. To get around this, the user can use e. g. help lines.
308 : : #define MODKEY_NoSnap bCtrl /* temporarily disable snapping */
309 : : #define MODKEY_Ortho bShift /* ortho */
310 : : #define MODKEY_Center bAlt /* create/resize centeredly */
311 : : #define MODKEY_AngleSnap bShift
312 : : #define MODKEY_CopyDrag bCtrl /* drag and copy */
313 : :
314 : : // click somewhere (MouseDown)
315 : : #define MODKEY_PolyPoly bAlt /* new Poly at InsPt and at Create */
316 : : #define MODKEY_MultiMark bShift /* MarkObj without doing UnmarkAll first */
317 : : #define MODKEY_Unmark bAlt /* deselect with a dragged frame */
318 : : #define MODKEY_ForceMark bCtrl /* force dragging a frame, even if there's an object at cursor position */
319 : : #define MODKEY_DeepMark bAlt /* MarkNextObj */
320 : : #define MODKEY_DeepBackw bShift /* MarkNextObj but backwards */
321 : :
322 : 405 : SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const
323 : : {
324 : 405 : const OutputDevice* pOut=pActualOutDev;
325 [ - + ]: 405 : if (pOut==NULL)
326 : : {
327 [ # # ]: 0 : pOut = GetFirstOutputDevice();
328 : : }
329 : :
330 : : // #i73628# Use a non-changeable copy of he logic position
331 : 405 : const Point aLocalLogicPosition(rLogicPos);
332 : :
333 : 405 : sal_Bool bEditMode=IsEditMode();
334 [ + - ][ - + ]: 405 : sal_Bool bPointMode=bEditMode && HasMarkablePoints();
[ + - ]
335 : 405 : sal_Bool bGluePointMode=IsGluePointEditMode();
336 [ # # ][ # # ]: 405 : sal_Bool bInsPolyPt=bPointMode && IsInsObjPointMode() && IsInsObjPointPossible();
[ # # ][ - + ]
337 [ - + ][ # # ]: 405 : sal_Bool bInsGluePt=bGluePointMode && IsInsGluePointMode() && IsInsGluePointPossible();
[ # # ][ # # ]
338 [ + - ]: 405 : sal_Bool bIsTextEdit=IsTextEdit();
339 [ + - ]: 405 : sal_Bool bTextEditHit=IsTextEditHit(aLocalLogicPosition,0/*nHitTolLog*/);
340 [ + - ]: 405 : sal_Bool bTextEditSel=IsTextEditInSelectionMode();
341 : 405 : sal_Bool bShift=(rVEvt.nMouseCode & KEY_SHIFT) !=0;
342 : 405 : sal_Bool bCtrl=(rVEvt.nMouseCode & KEY_MOD1) !=0;
343 : 405 : sal_Bool bAlt=(rVEvt.nMouseCode & KEY_MOD2) !=0;
344 : 405 : SdrHitKind eHit=SDRHIT_NONE;
345 [ + - ][ + - ]: 405 : SdrHdl* pHdl=pOut!=NULL && !bTextEditSel ? PickHandle(aLocalLogicPosition) : NULL;
[ + - ]
346 : 405 : SdrPageView* pPV=NULL;
347 : 405 : SdrObject* pObj=NULL;
348 : 405 : SdrObject* pHitObj=NULL;
349 : 405 : sal_uInt16 nHitPassNum=0;
350 : 405 : sal_uInt16 nHlplIdx=0;
351 : 405 : sal_uInt16 nGlueId=0;
352 [ + - ][ - + ]: 405 : if (bTextEditHit || bTextEditSel)
353 : : {
354 : 0 : eHit=SDRHIT_TEXTEDIT;
355 : 0 : bTextEditHit=sal_True;
356 : : }
357 [ - + ]: 405 : else if (pHdl!=NULL)
358 : : {
359 : 0 : eHit=SDRHIT_HANDLE; // handle is hit: highest priority
360 : : }
361 [ + - ][ - + ]: 405 : else if (bEditMode && IsHlplVisible() && IsHlplFront() && pOut!=NULL && PickHelpLine(aLocalLogicPosition,nHitTolLog,*pOut,nHlplIdx,pPV))
[ # # ][ # # ]
[ # # ][ # # ]
[ - + ]
362 : : {
363 : 0 : eHit=SDRHIT_HELPLINE; // help line in the foreground hit: can be moved now
364 : : }
365 [ - + ][ # # ]: 405 : else if (bGluePointMode && PickGluePoint(aLocalLogicPosition,pObj,nGlueId,pPV))
[ # # ][ - + ]
366 : : {
367 : 0 : eHit=SDRHIT_GLUEPOINT; // deselected glue point hit
368 : : }
369 [ + - ][ - + ]: 405 : else if (PickObj(aLocalLogicPosition,nHitTolLog,pHitObj,pPV,SDRSEARCH_DEEP|SDRSEARCH_MARKED,&pObj,NULL,&nHitPassNum))
370 : : {
371 : 0 : eHit=SDRHIT_MARKEDOBJECT;
372 [ # # ]: 0 : ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( pObj );
373 [ # # ]: 0 : if( pTableObj )
374 : : {
375 : 0 : sal_Int32 nX = 0, nY = 0;
376 [ # # ]: 0 : switch( pTableObj->CheckTableHit( aLocalLogicPosition, nX, nY, 0 ) )
[ # # # ]
377 : : {
378 : : case sdr::table::SDRTABLEHIT_CELL:
379 : 0 : eHit = SDRHIT_CELL;
380 : 0 : break;
381 : : case sdr::table::SDRTABLEHIT_CELLTEXTAREA:
382 : 0 : eHit = SDRHIT_TEXTEDITOBJ;
383 : 0 : break;
384 : : default:
385 : 0 : break;
386 : : }
387 : : }
388 : : }
389 [ + - ][ - + ]: 405 : else if (PickObj(aLocalLogicPosition,nHitTolLog,pHitObj,pPV,SDRSEARCH_DEEP|SDRSEARCH_ALSOONMASTER|SDRSEARCH_WHOLEPAGE,&pObj,NULL,&nHitPassNum))
390 : : {
391 : : // MasterPages and WholePage for Macro and URL
392 : 0 : eHit=SDRHIT_UNMARKEDOBJECT;
393 [ # # ]: 0 : ::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( pObj );
394 [ # # ]: 0 : if( pTableObj )
395 : : {
396 : 0 : sal_Int32 nX = 0, nY = 0;
397 [ # # ]: 0 : switch( pTableObj->CheckTableHit( aLocalLogicPosition, nX, nY, 0 ) )
[ # # # ]
398 : : {
399 : : case sdr::table::SDRTABLEHIT_CELL:
400 : 0 : eHit = SDRHIT_CELL;
401 : 0 : break;
402 : : case sdr::table::SDRTABLEHIT_CELLTEXTAREA:
403 : 0 : eHit = SDRHIT_TEXTEDITOBJ;
404 : 0 : break;
405 : : default:
406 : 0 : break;
407 : : }
408 : : }
409 : : }
410 [ + - ][ - + ]: 405 : else if (bEditMode && IsHlplVisible() && !IsHlplFront() && pOut!=NULL && PickHelpLine(aLocalLogicPosition,nHitTolLog,*pOut,nHlplIdx,pPV))
[ # # ][ # # ]
[ # # ][ # # ]
[ - + ]
411 : : {
412 : 0 : eHit=SDRHIT_HELPLINE; // help line in foreground hit: can be moved now
413 : : }
414 [ + - ][ - + ]: 405 : if (IsMacroMode() && eHit==SDRHIT_UNMARKEDOBJECT)
[ - + ]
415 : : {
416 [ # # ]: 0 : bool bRoot=pObj->HasMacro();
417 [ # # ][ # # ]: 0 : sal_Bool bDeep=pObj!=pHitObj && pHitObj->HasMacro();
[ # # ]
418 : 0 : sal_Bool bMid=sal_False; // Have we hit upon a grouped group with a macro?
419 : 0 : SdrObject* pMidObj=NULL;
420 [ # # ]: 0 : if (pObj!=pHitObj)
421 : : {
422 : 0 : SdrObject* pObjTmp=NULL;
423 [ # # ]: 0 : pObjTmp=pHitObj->GetUpGroup();
424 [ # # ]: 0 : if (pObjTmp==pObj) pObjTmp=NULL;
425 [ # # ]: 0 : while (pObjTmp!=NULL)
426 : : {
427 [ # # ][ # # ]: 0 : if (pObjTmp->HasMacro())
428 : : {
429 : 0 : bMid=sal_True;
430 : 0 : pMidObj=pObjTmp;
431 : : }
432 [ # # ]: 0 : pObjTmp=pObjTmp->GetUpGroup();
433 [ # # ]: 0 : if (pObjTmp==pObj) pObjTmp=NULL;
434 : : }
435 : : }
436 : :
437 [ # # ][ # # ]: 0 : if (bDeep || bMid || bRoot)
[ # # ]
438 : : {
439 [ # # ]: 0 : SdrObjMacroHitRec aHitRec;
440 : 0 : aHitRec.aPos=aLocalLogicPosition;
441 : 0 : aHitRec.aDownPos=aLocalLogicPosition;
442 : 0 : aHitRec.nTol=nHitTolLog;
443 : 0 : aHitRec.pVisiLayer=&pPV->GetVisibleLayers();
444 : 0 : aHitRec.pPageView=pPV;
445 [ # # ][ # # ]: 0 : if (bDeep) bDeep=pHitObj->IsMacroHit(aHitRec);
446 [ # # ][ # # ]: 0 : if (bMid ) bMid =pMidObj->IsMacroHit(aHitRec);
447 [ # # ][ # # ]: 0 : if (bRoot) bRoot=pObj->IsMacroHit(aHitRec);
448 [ # # ][ # # ]: 0 : if (bRoot || bMid || bDeep)
[ # # ]
449 : : {
450 : : // Priorities: 1. Root, 2. Mid, 3. Deep
451 : 0 : rVEvt.pRootObj=pObj;
452 [ # # ]: 0 : if (!bRoot) pObj=pMidObj;
453 [ # # ][ # # ]: 0 : if (!bRoot && !bMid) pObj=pHitObj;
454 : 0 : eHit=SDRHIT_MACRO;
455 : : }
456 : : }
457 : : }
458 : : // check for URL field
459 [ + - ][ - + ]: 405 : if (IsMacroMode() && eHit==SDRHIT_UNMARKEDOBJECT)
[ - + ]
460 : : {
461 [ # # ][ # # ]: 0 : SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pHitObj);
[ # # ][ # # ]
462 [ # # ][ # # ]: 0 : if (pTextObj!=NULL && pTextObj->HasText())
[ # # ][ # # ]
463 : : {
464 : : bool bTEHit(pPV &&
465 [ # # ][ # # ]: 0 : SdrObjectPrimitiveHit(*pTextObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true));
[ # # ]
466 : :
467 [ # # ]: 0 : if (bTEHit)
468 : : {
469 [ # # ]: 0 : Rectangle aTextRect;
470 [ # # ]: 0 : Rectangle aAnchor;
471 [ # # ]: 0 : SdrOutliner* pOutliner = &pTextObj->ImpGetDrawOutliner();
472 [ # # ][ # # ]: 0 : if( pTextObj->GetModel() )
473 [ # # ]: 0 : pOutliner = &pTextObj->GetModel()->GetHitTestOutliner();
474 : :
475 [ # # ]: 0 : pTextObj->TakeTextRect( *pOutliner, aTextRect, sal_False, &aAnchor, sal_False );
476 : :
477 : : // #i73628# Use a text-relative position for hit test in hit test outliner
478 : 0 : Point aTemporaryTextRelativePosition(aLocalLogicPosition - aTextRect.TopLeft());
479 : :
480 : : // account for FitToSize
481 [ # # ]: 0 : bool bFitToSize(pTextObj->IsFitToSize());
482 [ # # ]: 0 : if (bFitToSize) {
483 [ # # ][ # # ]: 0 : Fraction aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1);
[ # # ]
484 [ # # ][ # # ]: 0 : Fraction aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1);
[ # # ]
485 [ # # ][ # # ]: 0 : ResizePoint(aTemporaryTextRelativePosition,Point(),aX,aY);
[ # # ]
486 : : }
487 : : // account for rotation
488 : 0 : const GeoStat& rGeo=pTextObj->GetGeoStat();
489 [ # # ]: 0 : if (rGeo.nDrehWink!=0) RotatePoint(aTemporaryTextRelativePosition,Point(),-rGeo.nSin,rGeo.nCos); // -sin for Unrotate
490 : : // we currently don't account for ticker text
491 [ # # ][ # # ]: 0 : if(pActualOutDev && pActualOutDev->GetOutDevType() == OUTDEV_WINDOW)
[ # # ]
492 : : {
493 [ # # ]: 0 : OutlinerView aOLV(pOutliner, (Window*)pActualOutDev);
494 : 0 : const EditView& aEV=aOLV.GetEditView();
495 [ # # ]: 0 : const SvxFieldItem* pItem=aEV.GetField(aTemporaryTextRelativePosition);
496 [ # # ]: 0 : if (pItem!=NULL) {
497 : 0 : const SvxFieldData* pFld=pItem->GetField();
498 [ # # ][ # # ]: 0 : const SvxURLField* pURL=PTR_CAST(SvxURLField,pFld);
[ # # ][ # # ]
499 [ # # ]: 0 : if (pURL!=NULL) {
500 : 0 : eHit=SDRHIT_URLFIELD;
501 : 0 : rVEvt.pURLField=pURL;
502 : : }
503 [ # # ]: 0 : }
504 : : }
505 : : }
506 : : }
507 : : }
508 : :
509 [ - + ][ # # ]: 405 : if (nHitPassNum==SDRSEARCHPASS_DIRECT &&
[ # # ][ # #
# # # # ]
[ # # ][ - + ]
510 : : (eHit==SDRHIT_MARKEDOBJECT || eHit==SDRHIT_UNMARKEDOBJECT) &&
511 [ # # ][ # # ]: 0 : (IsTextTool() || (IsEditMode() && IsQuickTextEditMode())) && pHitObj->HasTextEdit())
512 : : {
513 : : // Around the TextEditArea there's a border to select without going into text edit mode.
514 [ # # ]: 0 : Rectangle aBoundRect(pHitObj->GetCurrentBoundRect());
515 : :
516 : : // Force to SnapRect when Fontwork
517 [ # # ][ # # ]: 0 : if(pHitObj->ISA(SdrTextObj) && ((SdrTextObj*)pHitObj)->IsFontwork())
[ # # ][ # # ]
[ # # ][ # # ]
518 : : {
519 [ # # ]: 0 : aBoundRect = pHitObj->GetSnapRect();
520 : : }
521 : :
522 : 0 : sal_Int32 nTolerance(nHitTolLog);
523 : 0 : sal_Bool bBoundRectHit(sal_False);
524 : :
525 [ # # ]: 0 : if(pOut)
526 : : {
527 [ # # ]: 0 : nTolerance = pOut->PixelToLogic(Size(2, 0)).Width();
528 : : }
529 : :
530 [ # # ][ # # : 0 : if( (aLocalLogicPosition.X() >= aBoundRect.Left() - nTolerance && aLocalLogicPosition.X() <= aBoundRect.Left() + nTolerance)
# # # # #
# # # # #
# # ][ # # ]
531 : 0 : || (aLocalLogicPosition.X() >= aBoundRect.Right() - nTolerance && aLocalLogicPosition.X() <= aBoundRect.Right() + nTolerance)
532 : 0 : || (aLocalLogicPosition.Y() >= aBoundRect.Top() - nTolerance && aLocalLogicPosition.Y() <= aBoundRect.Top() + nTolerance)
533 : 0 : || (aLocalLogicPosition.Y() >= aBoundRect.Bottom() - nTolerance && aLocalLogicPosition.Y() <= aBoundRect.Bottom() + nTolerance))
534 : : {
535 : 0 : bBoundRectHit = sal_True;
536 : : }
537 : :
538 [ # # ]: 0 : if(!bBoundRectHit)
539 : : {
540 : : bool bTEHit(pPV &&
541 [ # # ][ # # ]: 0 : SdrObjectPrimitiveHit(*pHitObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true));
[ # # ]
542 : :
543 : : // TextEdit attached to an object in a locked layer
544 [ # # ][ # # ]: 0 : if (pPV->GetLockedLayers().IsSet(pHitObj->GetLayer()))
545 : : {
546 : 0 : bTEHit=sal_False;
547 : : }
548 : :
549 [ # # ]: 0 : if (bTEHit)
550 : : {
551 : 0 : rVEvt.pRootObj=pObj;
552 : 0 : pObj=pHitObj;
553 : 0 : eHit=SDRHIT_TEXTEDITOBJ;
554 : : }
555 : : }
556 : : }
557 [ + - ][ - + ]: 405 : if (nHitPassNum!=SDRSEARCHPASS_DIRECT && eHit==SDRHIT_UNMARKEDOBJECT) {
558 : 0 : eHit=SDRHIT_NONE;
559 : 0 : pObj=NULL;
560 : 0 : pPV=NULL;
561 : : }
562 : 405 : sal_Bool bMouseLeft=(rVEvt.nMouseCode&MOUSE_LEFT)!=0;
563 : 405 : sal_Bool bMouseRight=(rVEvt.nMouseCode&MOUSE_RIGHT)!=0;
564 : 405 : sal_Bool bMouseDown=rVEvt.bMouseDown;
565 : 405 : sal_Bool bMouseUp=rVEvt.bMouseUp;
566 : 405 : SdrEventKind eEvent=SDREVENT_NONE;
567 [ + - ]: 405 : sal_Bool bIsAction=IsAction();
568 : :
569 [ - + ]: 405 : if (bIsAction)
570 : : {
571 [ # # ]: 0 : if (bMouseDown)
572 : : {
573 [ # # ]: 0 : if (bMouseRight) eEvent=SDREVENT_BCKACTION;
574 : : }
575 [ # # ]: 0 : else if (bMouseUp)
576 : : {
577 [ # # ]: 0 : if (bMouseLeft)
578 : : {
579 : 0 : eEvent=SDREVENT_ENDACTION;
580 [ # # ]: 0 : if (IsDragObj())
581 : : {
582 : 0 : eEvent=SDREVENT_ENDDRAG;
583 : 0 : rVEvt.bDragWithCopy=MODKEY_CopyDrag;
584 : : }
585 [ # # ][ # # ]: 0 : else if (IsCreateObj() || IsInsObjPoint())
[ # # ]
586 : : {
587 [ # # ]: 0 : eEvent=IsCreateObj() ? SDREVENT_ENDCREATE : SDREVENT_ENDINSOBJPOINT;
588 : 0 : rVEvt.eEndCreateCmd=SDRCREATE_NEXTPOINT;
589 [ # # ]: 0 : if (MODKEY_PolyPoly) rVEvt.eEndCreateCmd=SDRCREATE_NEXTOBJECT;
590 [ # # ]: 0 : if (rVEvt.nMouseClicks>1) rVEvt.eEndCreateCmd=SDRCREATE_FORCEEND;
591 : : }
592 [ # # ][ # # ]: 0 : else if (IsMarking())
593 : : {
594 : 0 : eEvent=SDREVENT_ENDMARK;
595 [ # # ]: 0 : if (!aDragStat.IsMinMoved())
596 : : {
597 : 0 : eEvent=SDREVENT_BRKMARK;
598 : 0 : rVEvt.bAddMark=MODKEY_MultiMark;
599 : : }
600 : : }
601 : : }
602 : : }
603 : : else
604 : : {
605 : 0 : eEvent=SDREVENT_MOVACTION;
606 : : }
607 : : }
608 [ - + ]: 405 : else if (eHit==SDRHIT_TEXTEDIT)
609 : : {
610 : 0 : eEvent=SDREVENT_TEXTEDIT;
611 : : }
612 [ + - ][ + - ]: 405 : else if (bMouseDown && bMouseLeft)
613 : : {
614 [ - + ][ # # ]: 405 : if (rVEvt.nMouseClicks==2 && rVEvt.nMouseCode==MOUSE_LEFT && pObj!=NULL && pHitObj!=NULL && pHitObj->HasTextEdit() && eHit==SDRHIT_MARKEDOBJECT)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ - + ]
615 : : {
616 : 0 : rVEvt.pRootObj=pObj;
617 : 0 : pObj=pHitObj;
618 : 0 : eEvent=SDREVENT_BEGTEXTEDIT;
619 : : }
620 [ - + ][ # # ]: 405 : else if (MODKEY_ForceMark && eHit!=SDRHIT_URLFIELD)
621 : : {
622 : 0 : eEvent=SDREVENT_BEGMARK; // AddMark,Unmark */
623 : : }
624 [ - + ]: 405 : else if (eHit==SDRHIT_HELPLINE)
625 : : {
626 : 0 : eEvent=SDREVENT_BEGDRAGHELPLINE; // nothing, actually
627 : : }
628 [ - + ]: 405 : else if (eHit==SDRHIT_GLUEPOINT)
629 : : {
630 : 0 : eEvent=SDREVENT_MARKGLUEPOINT; // AddMark+Drag
631 [ # # ][ # # ]: 0 : rVEvt.bAddMark=MODKEY_MultiMark || MODKEY_DeepMark; // if not hit with Deep
632 : : }
633 [ - + ]: 405 : else if (eHit==SDRHIT_HANDLE)
634 : : {
635 : 0 : eEvent=SDREVENT_BEGDRAGOBJ; // Mark+Drag,AddMark+Drag,DeepMark+Drag,Unmark
636 : 0 : sal_Bool bGlue=pHdl->GetKind()==HDL_GLUE;
637 [ # # ][ # # ]: 0 : sal_Bool bPoly=!bGlue && IsPointMarkable(*pHdl);
[ # # ]
638 [ # # ][ # # ]: 0 : sal_Bool bMarked=bGlue || (bPoly && pHdl->IsSelected());
[ # # ]
639 [ # # ][ # # ]: 0 : if (bGlue || bPoly)
640 : : {
641 [ # # ]: 0 : eEvent=bGlue ? SDREVENT_MARKGLUEPOINT : SDREVENT_MARKPOINT;
642 [ # # ]: 0 : if (MODKEY_DeepMark)
643 : : {
644 : 0 : rVEvt.bAddMark=sal_True;
645 : 0 : rVEvt.bPrevNextMark=sal_True;
646 : 0 : rVEvt.bMarkPrev=MODKEY_DeepBackw;
647 : : }
648 [ # # ]: 0 : else if (MODKEY_MultiMark)
649 : : {
650 : 0 : rVEvt.bAddMark=sal_True;
651 : 0 : rVEvt.bUnmark=bMarked; // Toggle
652 [ # # ]: 0 : if (bGlue)
653 : : {
654 : 0 : pObj=pHdl->GetObj();
655 : 0 : nGlueId=(sal_uInt16)pHdl->GetObjHdlNum();
656 : : }
657 : : }
658 [ # # ]: 0 : else if (bMarked)
659 : : {
660 : 0 : eEvent=SDREVENT_BEGDRAGOBJ; // don't change MarkState, only change Drag
661 : : }
662 : : }
663 : : }
664 [ - + ][ # # ]: 405 : else if (bInsPolyPt && (MODKEY_PolyPoly || (!MODKEY_MultiMark && !MODKEY_DeepMark)))
[ # # ][ # # ]
665 : : {
666 : 0 : eEvent=SDREVENT_BEGINSOBJPOINT;
667 : 0 : rVEvt.bInsPointNewObj=MODKEY_PolyPoly;
668 : : }
669 [ - + ][ # # ]: 405 : else if (bInsGluePt && !MODKEY_MultiMark && !MODKEY_DeepMark)
[ # # ]
670 : : {
671 : 0 : eEvent=SDREVENT_BEGINSGLUEPOINT;
672 : : }
673 [ - + ]: 405 : else if (eHit==SDRHIT_TEXTEDITOBJ)
674 : : {
675 : 0 : eEvent=SDREVENT_BEGTEXTEDIT; // AddMark+Drag,DeepMark+Drag,Unmark
676 [ # # ][ # # ]: 0 : if (MODKEY_MultiMark || MODKEY_DeepMark)
677 : : { // if not hit with Deep
678 : 0 : eEvent=SDREVENT_MARKOBJ;
679 : : }
680 : : }
681 [ - + ]: 405 : else if (eHit==SDRHIT_MACRO)
682 : : {
683 : 0 : eEvent=SDREVENT_BEGMACROOBJ; // AddMark+Drag
684 [ # # ][ # # ]: 0 : if (MODKEY_MultiMark || MODKEY_DeepMark)
685 : : { // if not hit with Deep
686 : 0 : eEvent=SDREVENT_MARKOBJ;
687 : : }
688 : : }
689 [ - + ]: 405 : else if (eHit==SDRHIT_URLFIELD)
690 : : {
691 : 0 : eEvent=SDREVENT_EXECUTEURL; // AddMark+Drag
692 [ # # ][ # # ]: 0 : if (MODKEY_MultiMark || MODKEY_DeepMark)
693 : : { // if not hit with Deep
694 : 0 : eEvent=SDREVENT_MARKOBJ;
695 : : }
696 : : }
697 [ - + ]: 405 : else if (eHit==SDRHIT_MARKEDOBJECT)
698 : : {
699 : 0 : eEvent=SDREVENT_BEGDRAGOBJ; // DeepMark+Drag,Unmark
700 : :
701 [ # # ][ # # ]: 0 : if (MODKEY_MultiMark || MODKEY_DeepMark)
702 : : { // if not hit with Deep
703 : 0 : eEvent=SDREVENT_MARKOBJ;
704 : : }
705 : : }
706 [ - + ]: 405 : else if (IsCreateMode())
707 : : {
708 : 0 : eEvent=SDREVENT_BEGCREATEOBJ; // nothing, actually
709 : : }
710 [ - + ]: 405 : else if (eHit==SDRHIT_UNMARKEDOBJECT)
711 : : {
712 : 0 : eEvent=SDREVENT_MARKOBJ; // AddMark+Drag
713 : : }
714 : : else
715 : : {
716 : 405 : eEvent=SDREVENT_BEGMARK;
717 : : }
718 : :
719 [ - + ]: 405 : if (eEvent==SDREVENT_MARKOBJ)
720 : : {
721 [ # # ][ # # ]: 0 : rVEvt.bAddMark=MODKEY_MultiMark || MODKEY_DeepMark; // if not hit with Deep
722 : 0 : rVEvt.bPrevNextMark=MODKEY_DeepMark;
723 [ # # ][ # # ]: 0 : rVEvt.bMarkPrev=MODKEY_DeepMark && MODKEY_DeepBackw;
724 : : }
725 [ + - ]: 405 : if (eEvent==SDREVENT_BEGMARK)
726 : : {
727 : 405 : rVEvt.bAddMark=MODKEY_MultiMark;
728 : 405 : rVEvt.bUnmark=MODKEY_Unmark;
729 : : }
730 : : }
731 : 405 : rVEvt.bIsAction=bIsAction;
732 : 405 : rVEvt.bIsTextEdit=bIsTextEdit;
733 : 405 : rVEvt.bTextEditHit=bTextEditHit;
734 : 405 : rVEvt.aLogicPos=aLocalLogicPosition;
735 : 405 : rVEvt.pHdl=pHdl;
736 : 405 : rVEvt.pObj=pObj;
737 [ + - ]: 405 : if(rVEvt.pRootObj==NULL)
738 : 405 : rVEvt.pRootObj=pObj;
739 : 405 : rVEvt.pPV=pPV;
740 : 405 : rVEvt.nHlplIdx=nHlplIdx;
741 : 405 : rVEvt.nGlueId=nGlueId;
742 : 405 : rVEvt.eHit=eHit;
743 : 405 : rVEvt.eEvent=eEvent;
744 [ + - ][ + - ]: 405 : rVEvt.bCaptureMouse=bMouseLeft && bMouseDown && eEvent!=SDREVENT_NONE;
[ + - ]
745 [ + - ][ - + ]: 405 : rVEvt.bReleaseMouse=bMouseLeft && bMouseUp;
746 : : #ifdef DGB_UTIL
747 : : if (rVEvt.pRootObj!=NULL) {
748 : : if (rVEvt.pRootObj->GetObjList()!=rVEvt.pPV->GetObjList()) {
749 : : OSL_FAIL("SdrView::PickAnything(): pRootObj->GetObjList()!=pPV->GetObjList() !");
750 : : }
751 : : }
752 : : #endif
753 : 405 : return eHit;
754 : : }
755 : :
756 : 0 : sal_Bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
757 : : {
758 : 0 : sal_Bool bRet=sal_False;
759 : 0 : SdrHitKind eHit=rVEvt.eHit;
760 : 0 : Point aLogicPos(rVEvt.aLogicPos);
761 : :
762 : 0 : sal_Bool bShift=(rVEvt.nMouseCode & KEY_SHIFT) !=0;
763 : 0 : sal_Bool bCtrl=(rVEvt.nMouseCode & KEY_MOD1) !=0;
764 : 0 : sal_Bool bAlt=(rVEvt.nMouseCode & KEY_MOD2) !=0;
765 : 0 : sal_Bool bMouseLeft=(rVEvt.nMouseCode&MOUSE_LEFT)!=0;
766 : 0 : sal_Bool bMouseDown=rVEvt.bMouseDown;
767 : 0 : sal_Bool bMouseUp=rVEvt.bMouseUp;
768 [ # # ]: 0 : if (bMouseDown) {
769 [ # # ]: 0 : if (bMouseLeft) aDragStat.SetMouseDown(sal_True);
770 [ # # ]: 0 : } else if (bMouseUp) {
771 [ # # ]: 0 : if (bMouseLeft) aDragStat.SetMouseDown(sal_False);
772 : : } else { // else, MouseMove
773 : 0 : aDragStat.SetMouseDown(bMouseLeft);
774 : : }
775 : :
776 : : #ifdef MODKEY_NoSnap
777 : 0 : SetSnapEnabled(!MODKEY_NoSnap);
778 : : #endif
779 : : #ifdef MODKEY_Ortho
780 [ # # ]: 0 : SetOrtho(MODKEY_Ortho!=IsOrthoDesired());
781 : : #endif
782 : : #ifdef MODKEY_BigOrtho
783 : : SetBigOrtho(MODKEY_BigOrtho);
784 : : #endif
785 : : #ifdef MODKEY_AngleSnap
786 : 0 : SetAngleSnapEnabled(MODKEY_AngleSnap);
787 : : #endif
788 : : #ifdef MODKEY_CopyDrag
789 : 0 : SetDragWithCopy(MODKEY_CopyDrag);
790 : : #endif
791 : : #ifdef MODKEY_Center
792 : 0 : SetCreate1stPointAsCenter(MODKEY_Center);
793 : 0 : SetResizeAtCenter(MODKEY_Center);
794 : 0 : SetCrookAtCenter(MODKEY_Center);
795 : : #endif
796 [ # # ][ # # ]: 0 : if (bMouseLeft && bMouseDown && rVEvt.bIsTextEdit && (eHit==SDRHIT_UNMARKEDOBJECT || eHit==SDRHIT_NONE)) {
[ # # ][ # # ]
[ # # ]
797 [ # # ]: 0 : SdrEndTextEdit(); // User has clicked beneath object, exit edit mode.
798 : : // pHdl is invalid, then, that shouldn't matter, though, as we expect
799 : : // pHdl==NULL (because of eHit).
800 : : }
801 [ # # # # : 0 : switch (rVEvt.eEvent) {
# # # # #
# # # # #
# # # # #
# # # # ]
802 : 0 : case SDREVENT_NONE: bRet=sal_False; break;
803 : 0 : case SDREVENT_TEXTEDIT: bRet=sal_False; break; // Events handled by the OutlinerView are not taken into account here.
804 [ # # ]: 0 : case SDREVENT_MOVACTION: MovAction(aLogicPos); bRet=sal_True; break;
805 [ # # ]: 0 : case SDREVENT_ENDACTION: EndAction(); bRet=sal_True; break;
806 [ # # ]: 0 : case SDREVENT_BCKACTION: BckAction(); bRet=sal_True; break;
807 [ # # ]: 0 : case SDREVENT_BRKACTION: BrkAction(); bRet=sal_True; break;
808 [ # # ]: 0 : case SDREVENT_ENDMARK : EndAction(); bRet=sal_True; break;
809 : : case SDREVENT_BRKMARK : {
810 [ # # ]: 0 : BrkAction();
811 [ # # ][ # # ]: 0 : if (!MarkObj(aLogicPos,nHitTolLog,rVEvt.bAddMark)) {
812 : : // No object hit. Do the following:
813 : : // 1. deselect any selected glue points
814 : : // 2. deselect any selected polygon points
815 : : // 3. deselect any selected objects
816 [ # # ][ # # ]: 0 : if (!rVEvt.bAddMark) UnmarkAll();
817 : : }
818 : 0 : bRet=sal_True;
819 : 0 : } break;
820 : : case SDREVENT_ENDCREATE: { // if necessary, MarkObj
821 : 0 : SdrCreateCmd eCmd=SDRCREATE_NEXTPOINT;
822 [ # # ]: 0 : if (MODKEY_PolyPoly) eCmd=SDRCREATE_NEXTOBJECT;
823 [ # # ]: 0 : if (rVEvt.nMouseClicks>1) eCmd=SDRCREATE_FORCEEND;
824 [ # # ][ # # ]: 0 : if (!EndCreateObj(eCmd)) { // Don't evaluate event for Create? -> Select
825 [ # # ][ # # ]: 0 : if (eHit==SDRHIT_UNMARKEDOBJECT || eHit==SDRHIT_TEXTEDIT) {
826 [ # # ]: 0 : MarkObj(rVEvt.pRootObj,rVEvt.pPV);
827 [ # # ]: 0 : if (eHit==SDRHIT_TEXTEDIT)
828 : : {
829 : 0 : sal_Bool bRet2(pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType() &&
830 [ # # # # ]: 0 : SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, (Window*)pActualOutDev, sal_False, (SdrOutliner*)0L));
[ # # ][ # # ]
831 : :
832 [ # # ]: 0 : if(bRet2)
833 : : {
834 : 0 : MouseEvent aMEvt(pActualOutDev->LogicToPixel(aLogicPos),
835 [ # # ][ # # ]: 0 : 1,rVEvt.nMouseMode,rVEvt.nMouseCode,rVEvt.nMouseCode);
836 : :
837 : 0 : OutlinerView* pOLV=GetTextEditOutlinerView();
838 [ # # ]: 0 : if (pOLV!=NULL) {
839 [ # # ]: 0 : pOLV->MouseButtonDown(aMEvt); // event for the Outliner, but without double-click
840 [ # # ]: 0 : pOLV->MouseButtonUp(aMEvt); // event for the Outliner, but without double-click
841 : : }
842 : : }
843 : : }
844 : 0 : bRet=sal_True; // object is selected and (if necessary) TextEdit is started
845 : 0 : } else bRet=sal_False; // canceled Create, nothing else
846 : 0 : } else bRet=sal_True; // return sal_True for EndCreate
847 : 0 : } break;
848 : : case SDREVENT_ENDDRAG: {
849 [ # # ]: 0 : bRet=EndDragObj(IsDragWithCopy());
850 [ # # ]: 0 : ForceMarkedObjToAnotherPage(); // TODO: Undo+bracing missing!
851 : 0 : } break;
852 : : case SDREVENT_MARKOBJ: { // + (if applicable) BegDrag
853 [ # # ][ # # ]: 0 : if (!rVEvt.bAddMark) UnmarkAllObj();
854 : 0 : sal_Bool bUnmark=rVEvt.bUnmark;
855 [ # # ]: 0 : if (rVEvt.bPrevNextMark) {
856 [ # # ]: 0 : bRet=MarkNextObj(aLogicPos,nHitTolLog,rVEvt.bMarkPrev);
857 : : } else {
858 [ # # ]: 0 : SortMarkedObjects();
859 : 0 : sal_uIntPtr nAnz0=GetMarkedObjectCount();
860 [ # # ]: 0 : bRet=MarkObj(aLogicPos,nHitTolLog,rVEvt.bAddMark);
861 [ # # ]: 0 : SortMarkedObjects();
862 : 0 : sal_uIntPtr nAnz1=GetMarkedObjectCount();
863 : 0 : bUnmark=nAnz1<nAnz0;
864 : : }
865 [ # # ]: 0 : if (!bUnmark) {
866 [ # # ]: 0 : BegDragObj(aLogicPos,NULL,(SdrHdl*)NULL,nMinMovLog);
867 : 0 : bRet=sal_True;
868 : : }
869 : 0 : } break;
870 : : case SDREVENT_MARKPOINT: { // + (if applicable) BegDrag
871 [ # # ][ # # ]: 0 : if (!rVEvt.bAddMark) UnmarkAllPoints();
872 [ # # ]: 0 : if (rVEvt.bPrevNextMark) {
873 [ # # ]: 0 : bRet=MarkNextPoint(aLogicPos,rVEvt.bMarkPrev);
874 : : } else {
875 [ # # ]: 0 : bRet=MarkPoint(*rVEvt.pHdl,rVEvt.bUnmark);
876 : : }
877 [ # # ][ # # ]: 0 : if (!rVEvt.bUnmark && !rVEvt.bPrevNextMark) {
878 [ # # ]: 0 : BegDragObj(aLogicPos,NULL,rVEvt.pHdl,nMinMovLog);
879 : 0 : bRet=sal_True;
880 : : }
881 : 0 : } break;
882 : : case SDREVENT_MARKGLUEPOINT: { // + (if applicable) BegDrag
883 [ # # ][ # # ]: 0 : if (!rVEvt.bAddMark) UnmarkAllGluePoints();
884 [ # # ]: 0 : if (rVEvt.bPrevNextMark) {
885 [ # # ]: 0 : bRet=MarkNextGluePoint(aLogicPos,rVEvt.bMarkPrev);
886 : : } else {
887 [ # # ]: 0 : bRet=MarkGluePoint(rVEvt.pObj,rVEvt.nGlueId,rVEvt.pPV,rVEvt.bUnmark);
888 : : }
889 [ # # ][ # # ]: 0 : if (!rVEvt.bUnmark && !rVEvt.bPrevNextMark) {
890 [ # # ]: 0 : SdrHdl* pHdl=GetGluePointHdl(rVEvt.pObj,rVEvt.nGlueId);
891 [ # # ]: 0 : BegDragObj(aLogicPos,NULL,pHdl,nMinMovLog);
892 : 0 : bRet=sal_True;
893 : : }
894 : 0 : } break;
895 [ # # ]: 0 : case SDREVENT_BEGMARK: bRet=BegMark(aLogicPos,rVEvt.bAddMark,rVEvt.bUnmark); break;
896 [ # # ]: 0 : case SDREVENT_BEGINSOBJPOINT: bRet = BegInsObjPoint(aLogicPos, MODKEY_PolyPoly); break;
897 : : case SDREVENT_ENDINSOBJPOINT: {
898 : 0 : SdrCreateCmd eCmd=SDRCREATE_NEXTPOINT;
899 [ # # ]: 0 : if (MODKEY_PolyPoly) eCmd=SDRCREATE_NEXTOBJECT;
900 [ # # ]: 0 : if (rVEvt.nMouseClicks>1) eCmd=SDRCREATE_FORCEEND;
901 [ # # ]: 0 : EndInsObjPoint(eCmd);
902 : 0 : bRet=sal_True;
903 : 0 : } break;
904 [ # # ]: 0 : case SDREVENT_BEGINSGLUEPOINT: bRet=BegInsGluePoint(aLogicPos); break;
905 [ # # ]: 0 : case SDREVENT_BEGDRAGHELPLINE: bRet=BegDragHelpLine(rVEvt.nHlplIdx,rVEvt.pPV); break;
906 [ # # ]: 0 : case SDREVENT_BEGDRAGOBJ: bRet=BegDragObj(aLogicPos,NULL,rVEvt.pHdl,nMinMovLog); break;
907 : : case SDREVENT_BEGCREATEOBJ: {
908 [ # # ][ # # ]: 0 : if (nAktInvent==SdrInventor && nAktIdent==OBJ_CAPTION) {
909 [ # # ]: 0 : long nHgt=SdrEngineDefaults::GetFontHeight();
910 [ # # ]: 0 : bRet=BegCreateCaptionObj(aLogicPos,Size(5*nHgt,2*nHgt));
911 [ # # ]: 0 : } else bRet=BegCreateObj(aLogicPos);
912 : 0 : } break;
913 [ # # ]: 0 : case SDREVENT_BEGMACROOBJ: bRet=BegMacroObj(aLogicPos,nHitTolLog,rVEvt.pObj,rVEvt.pPV,(Window*)pActualOutDev); break;
914 : : case SDREVENT_BEGTEXTEDIT: {
915 [ # # ][ # # ]: 0 : if (!IsObjMarked(rVEvt.pObj)) {
916 [ # # ]: 0 : UnmarkAllObj();
917 [ # # ]: 0 : MarkObj(rVEvt.pRootObj,rVEvt.pPV);
918 : : }
919 : :
920 : 0 : bRet = pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType()&&
921 [ # # # # ]: 0 : SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, (Window*)pActualOutDev, sal_False, (SdrOutliner*)0L);
[ # # ][ # # ]
922 : :
923 [ # # ]: 0 : if(bRet)
924 : : {
925 : 0 : MouseEvent aMEvt(pActualOutDev->LogicToPixel(aLogicPos),
926 [ # # ][ # # ]: 0 : 1,rVEvt.nMouseMode,rVEvt.nMouseCode,rVEvt.nMouseCode);
927 : 0 : OutlinerView* pOLV=GetTextEditOutlinerView();
928 [ # # ][ # # ]: 0 : if (pOLV!=NULL) pOLV->MouseButtonDown(aMEvt); // event for the Outliner, but without double-click
929 : : }
930 : 0 : } break;
931 : 0 : default: break;
932 : : } // switch
933 [ # # ][ # # ]: 0 : if (bRet && pActualOutDev!=NULL && pActualOutDev->GetOutDevType()==OUTDEV_WINDOW) {
[ # # ][ # # ]
934 : 0 : Window* pWin=(Window*)pActualOutDev;
935 : : // left mouse button pressed?
936 [ # # ][ # # ]: 0 : sal_Bool bLeftDown=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseDown;
937 : : // left mouse button released?
938 [ # # ][ # # ]: 0 : sal_Bool bLeftUp=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseUp;
939 : : // left mouse button pressed or held?
940 [ # # ][ # # ]: 0 : sal_Bool bLeftDown1=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && !rVEvt.bMouseUp;
941 : : pWin->SetPointer(GetPreferedPointer(rVEvt.aLogicPos,pWin,
942 [ # # ][ # # ]: 0 : rVEvt.nMouseCode & (KEY_SHIFT|KEY_MOD1|KEY_MOD2),bLeftDown1));
943 [ # # ]: 0 : sal_Bool bAction=IsAction();
944 [ # # ][ # # ]: 0 : if (bLeftDown && bAction) pWin->CaptureMouse();
[ # # ]
945 [ # # ][ # # ]: 0 : else if (bLeftUp || (rVEvt.bIsAction && !bAction)) pWin->ReleaseMouse();
[ # # ][ # # ]
946 : : }
947 : 0 : return bRet;
948 : : }
949 : : #include <editeng/outlobj.hxx>
950 : :
951 : 405 : Pointer SdrView::GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier, sal_Bool bLeftDown) const
952 : : {
953 : : // Actions
954 [ - + ]: 405 : if (IsCreateObj())
955 : : {
956 [ # # ]: 0 : return pAktCreate->GetCreatePointer();
957 : : }
958 [ - + ]: 405 : if (mpCurrentSdrDragMethod)
959 : : {
960 [ # # ][ # # ]: 0 : if ((IsDraggingPoints() || IsDraggingGluePoints()) && IsMouseHideWhileDraggingPoints())
[ # # ][ # # ]
961 : 0 : return Pointer(POINTER_NULL);
962 : :
963 [ # # ]: 0 : return mpCurrentSdrDragMethod->GetSdrDragPointer();
964 : : }
965 [ + - ][ + - ]: 405 : if (IsMarkObj() || IsMarkPoints() || IsMarkGluePoints() || IsSetPageOrg()) return Pointer(POINTER_ARROW);
[ + - ][ - + ]
[ - + ]
966 [ - + ][ # # ]: 405 : if (IsDragHelpLine()) return GetDraggedHelpLinePointer();
967 [ - + ]: 405 : if (IsMacroObj()) {
968 [ # # ]: 0 : SdrObjMacroHitRec aHitRec;
969 [ # # ]: 0 : aHitRec.aPos=pOut->LogicToPixel(rMousePos);
970 : 0 : aHitRec.aDownPos=aMacroDownPos;
971 : 0 : aHitRec.nTol=nMacroTol;
972 : 0 : aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
973 : 0 : aHitRec.pPageView=pMacroPV;
974 : 0 : aHitRec.pOut=pMacroWin;
975 : 0 : aHitRec.bDown=bMacroDown;
976 [ # # ]: 0 : return pMacroObj->GetMacroPointer(aHitRec);
977 : : }
978 : :
979 : : // TextEdit, ObjEdit, Macro
980 [ + - ][ - + ]: 405 : if (IsTextEdit() && (IsTextEditInSelectionMode() || IsTextEditHit(rMousePos,0/*nTol*/)))
[ # # ][ # # ]
[ # # ][ # # ]
[ - + ]
981 : : {
982 [ # # ][ # # ]: 0 : if(!pOut || IsTextEditInSelectionMode())
[ # # ][ # # ]
983 : : {
984 [ # # ][ # # ]: 0 : if(pTextEditOutliner->IsVertical())
985 : 0 : return Pointer(POINTER_TEXT_VERTICAL);
986 : : else
987 : 0 : return Pointer(POINTER_TEXT);
988 : : }
989 : : // Outliner should return something here...
990 [ # # ]: 0 : Point aPos(pOut->LogicToPixel(rMousePos));
991 [ # # ]: 0 : Pointer aPointer(pTextEditOutlinerView->GetPointer(aPos));
992 [ # # ]: 0 : if (aPointer==POINTER_ARROW)
993 : : {
994 [ # # ][ # # ]: 0 : if(pTextEditOutliner->IsVertical())
995 : 0 : aPointer = POINTER_TEXT_VERTICAL;
996 : : else
997 : 0 : aPointer = POINTER_TEXT;
998 : : }
999 : 0 : return aPointer;
1000 : : }
1001 : :
1002 [ + - ]: 405 : SdrViewEvent aVEvt;
1003 : 405 : aVEvt.nMouseCode=(nModifier&(KEY_SHIFT|KEY_MOD1|KEY_MOD2))|MOUSE_LEFT; // to see what would happen on MouseLeftDown
1004 : 405 : aVEvt.bMouseDown=!bLeftDown; // What if ..?
1005 : 405 : aVEvt.bMouseUp=bLeftDown; // What if ..?
1006 [ + - ]: 405 : if (pOut!=NULL)
1007 [ + - ]: 405 : ((SdrView*)this)->SetActualWin(pOut);
1008 [ + - ]: 405 : SdrHitKind eHit=PickAnything(rMousePos,aVEvt);
1009 : 405 : SdrEventKind eEvent=aVEvt.eEvent;
1010 [ - + - - : 405 : switch (eEvent)
- - - ]
1011 : : {
1012 : : case SDREVENT_BEGCREATEOBJ:
1013 : 0 : return aAktCreatePointer;
1014 : : case SDREVENT_MARKOBJ:
1015 : : case SDREVENT_BEGMARK:
1016 : 405 : return Pointer(POINTER_ARROW);
1017 : : case SDREVENT_MARKPOINT:
1018 : : case SDREVENT_MARKGLUEPOINT:
1019 : 0 : return Pointer(POINTER_MOVEPOINT);
1020 : : case SDREVENT_BEGINSOBJPOINT:
1021 : : case SDREVENT_BEGINSGLUEPOINT:
1022 : 0 : return Pointer(POINTER_CROSS);
1023 : : case SDREVENT_EXECUTEURL:
1024 : 0 : return Pointer(POINTER_REFHAND);
1025 : : case SDREVENT_BEGMACROOBJ:
1026 : : {
1027 [ # # ]: 0 : SdrObjMacroHitRec aHitRec;
1028 : 0 : aHitRec.aPos=aVEvt.aLogicPos;
1029 : 0 : aHitRec.aDownPos=aHitRec.aPos;
1030 : 0 : aHitRec.nTol=nHitTolLog;
1031 : 0 : aHitRec.pVisiLayer=&aVEvt.pPV->GetVisibleLayers();
1032 : 0 : aHitRec.pPageView=aVEvt.pPV;
1033 : 0 : aHitRec.pOut=(OutputDevice*)pOut;
1034 [ # # ]: 0 : return aVEvt.pObj->GetMacroPointer(aHitRec);
1035 : : }
1036 : 0 : default: break;
1037 : : } // switch
1038 : :
1039 [ # # # # : 0 : switch(eHit)
# ]
1040 : : {
1041 : : case SDRHIT_CELL:
1042 : 0 : return Pointer(POINTER_ARROW);
1043 : : case SDRHIT_HELPLINE :
1044 [ # # ][ # # ]: 0 : return aVEvt.pPV->GetHelpLines()[aVEvt.nHlplIdx].GetPointer();
1045 : : case SDRHIT_GLUEPOINT:
1046 : 0 : return Pointer(POINTER_MOVEPOINT);
1047 : : case SDRHIT_TEXTEDIT :
1048 : : case SDRHIT_TEXTEDITOBJ:
1049 : : {
1050 [ # # ]: 0 : SdrTextObj* pText = dynamic_cast< SdrTextObj* >( aVEvt.pObj );
1051 [ # # ][ # # ]: 0 : if(pText && pText->HasText())
[ # # ][ # # ]
1052 : : {
1053 [ # # ]: 0 : OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
1054 [ # # ][ # # ]: 0 : if(pParaObj && pParaObj->IsVertical())
[ # # ][ # # ]
1055 : 0 : return Pointer(POINTER_TEXT_VERTICAL);
1056 : : }
1057 : 0 : return Pointer(POINTER_TEXT);
1058 : : }
1059 : 0 : default: break;
1060 : : }
1061 : :
1062 : 0 : sal_Bool bMarkHit=eHit==SDRHIT_MARKEDOBJECT;
1063 : 0 : SdrHdl* pHdl=aVEvt.pHdl;
1064 : : // now check the pointers for dragging
1065 [ # # ][ # # ]: 0 : if (pHdl!=NULL || bMarkHit) {
1066 [ # # ]: 0 : SdrHdlKind eHdl= pHdl!=NULL ? pHdl->GetKind() : HDL_MOVE;
1067 [ # # ][ # # ]: 0 : sal_Bool bCorner=pHdl!=NULL && pHdl->IsCornerHdl();
1068 [ # # ][ # # ]: 0 : sal_Bool bVertex=pHdl!=NULL && pHdl->IsVertexHdl();
1069 : 0 : sal_Bool bMov=eHdl==HDL_MOVE;
1070 [ # # ][ # # ]: 0 : if (bMov && (eDragMode==SDRDRAG_MOVE || eDragMode==SDRDRAG_RESIZE || bMarkedHitMovesAlways)) {
[ # # ][ # # ]
1071 [ # # ][ # # ]: 0 : if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // because double click or drag & drop is possible
1072 : 0 : return Pointer(POINTER_MOVE);
1073 : : }
1074 [ # # # # : 0 : switch (eDragMode) {
# # # # ]
1075 : : case SDRDRAG_ROTATE: {
1076 [ # # ][ # # ]: 0 : if ((bCorner || bMov) && !IsRotateAllowed(sal_True))
[ # # ][ # # ]
[ # # ]
1077 : 0 : return Pointer(POINTER_NOTALLOWED);
1078 : :
1079 : : // are 3D objects selected?
1080 : 0 : sal_Bool b3DObjSelected = sal_False;
1081 [ # # ][ # # ]: 0 : for (sal_uInt32 a=0; !b3DObjSelected && a<GetMarkedObjectCount(); a++) {
[ # # ]
1082 [ # # ]: 0 : SdrObject* pObj = GetMarkedObjectByIndex(a);
1083 [ # # ][ # # ]: 0 : if(pObj && pObj->ISA(E3dObject))
[ # # ][ # # ]
[ # # ]
1084 : 0 : b3DObjSelected = sal_True;
1085 : : }
1086 : : // If we have a 3D object, go on despite !IsShearAllowed,
1087 : : // because then we have a rotation instead of a shear.
1088 [ # # ][ # # ]: 0 : if (bVertex && !IsShearAllowed() && !b3DObjSelected)
[ # # ][ # # ]
[ # # ]
1089 : 0 : return Pointer(POINTER_NOTALLOWED);
1090 [ # # ]: 0 : if (bMov)
1091 : 0 : return Pointer(POINTER_ROTATE);
1092 : 0 : } break;
1093 : : case SDRDRAG_SHEAR: case SDRDRAG_DISTORT: {
1094 [ # # ]: 0 : if (bCorner) {
1095 [ # # ][ # # ]: 0 : if (!IsDistortAllowed(sal_True) && !IsDistortAllowed(sal_False)) return Pointer(POINTER_NOTALLOWED);
[ # # ][ # # ]
[ # # ]
1096 : 0 : else return Pointer(POINTER_REFHAND);
1097 : : }
1098 [ # # ][ # # ]: 0 : if (bVertex && !IsShearAllowed()) return Pointer(POINTER_NOTALLOWED);
[ # # ][ # # ]
1099 [ # # ]: 0 : if (bMov) {
1100 [ # # ][ # # ]: 0 : if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // because double click or drag & drop is possible
1101 : 0 : return Pointer(POINTER_MOVE);
1102 : : }
1103 : 0 : } break;
1104 : : case SDRDRAG_MIRROR: {
1105 [ # # ][ # # ]: 0 : if (bCorner || bVertex || bMov) {
[ # # ]
1106 [ # # ]: 0 : SdrHdl* pH1=aHdl.GetHdl(HDL_REF1);
1107 [ # # ]: 0 : SdrHdl* pH2=aHdl.GetHdl(HDL_REF2);
1108 : 0 : sal_Bool b90=sal_False;
1109 : 0 : sal_Bool b45=sal_False;
1110 : 0 : Point aDif;
1111 [ # # ][ # # ]: 0 : if (pH1!=NULL && pH2!=NULL) {
1112 : 0 : aDif=pH2->GetPos()-pH1->GetPos();
1113 [ # # ][ # # ]: 0 : b90=(aDif.X()==0) || aDif.Y()==0;
1114 [ # # ][ # # ]: 0 : b45=b90 || (Abs(aDif.X())==Abs(aDif.Y()));
1115 : : }
1116 : 0 : sal_Bool bNo=sal_False;
1117 [ # # ][ # # ]: 0 : if (!IsMirrorAllowed(sal_True,sal_True)) bNo=sal_True; // any mirroring is forbidden
1118 [ # # ][ # # ]: 0 : if (!IsMirrorAllowed(sal_False,sal_False) && !b45) bNo=sal_True; // mirroring freely is forbidden
[ # # ][ # # ]
1119 [ # # ][ # # ]: 0 : if (!IsMirrorAllowed(sal_True,sal_False) && !b90) bNo=sal_True; // mirroring horizontally/vertically is allowed
[ # # ][ # # ]
1120 [ # # ]: 0 : if (bNo) return Pointer(POINTER_NOTALLOWED);
1121 [ # # ]: 0 : if (b90) {
1122 : 0 : return Pointer(POINTER_MIRROR);
1123 : : }
1124 : 0 : return Pointer(POINTER_MIRROR);
1125 : : }
1126 : 0 : } break;
1127 : :
1128 : : case SDRDRAG_TRANSPARENCE:
1129 : : {
1130 [ # # ][ # # ]: 0 : if(!IsTransparenceAllowed())
1131 : 0 : return Pointer(POINTER_NOTALLOWED);
1132 : :
1133 : 0 : return Pointer(POINTER_REFHAND);
1134 : : }
1135 : :
1136 : : case SDRDRAG_GRADIENT:
1137 : : {
1138 [ # # ][ # # ]: 0 : if(!IsGradientAllowed())
1139 : 0 : return Pointer(POINTER_NOTALLOWED);
1140 : :
1141 : 0 : return Pointer(POINTER_REFHAND);
1142 : : }
1143 : :
1144 : : case SDRDRAG_CROOK: {
1145 [ # # ][ # # ]: 0 : if (bCorner || bVertex || bMov) {
[ # # ]
1146 [ # # ][ # # ]: 0 : if (!IsCrookAllowed(sal_True) && !IsCrookAllowed(sal_False)) return Pointer(POINTER_NOTALLOWED);
[ # # ][ # # ]
[ # # ]
1147 : 0 : return Pointer(POINTER_CROOK);
1148 : : }
1149 : : }
1150 : :
1151 : : case SDRDRAG_CROP:
1152 : : {
1153 : 0 : return Pointer(POINTER_CROP);
1154 : : }
1155 : :
1156 : : default: {
1157 [ # # ][ # # ]: 0 : if ((bCorner || bVertex) && !IsResizeAllowed(sal_True)) return Pointer(POINTER_NOTALLOWED);
[ # # ][ # # ]
[ # # ]
1158 : : }
1159 : : }
1160 [ # # ][ # # ]: 0 : if (pHdl!=NULL) return pHdl->GetPointer();
1161 [ # # ]: 0 : if (bMov) {
1162 [ # # ][ # # ]: 0 : if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // because double click or drag & drop is possible
1163 : 0 : return Pointer(POINTER_MOVE);
1164 : : }
1165 : : }
1166 [ # # ]: 0 : if (eEditMode==SDREDITMODE_CREATE) return aAktCreatePointer;
1167 [ + - ]: 405 : return Pointer(POINTER_ARROW);
1168 : : }
1169 : :
1170 : : #define STR_NOTHING "nothing"
1171 : 248 : XubString SdrView::GetStatusText()
1172 : : {
1173 [ + - ]: 248 : XubString aStr;
1174 [ + - ]: 248 : XubString aName;
1175 : :
1176 [ + - ]: 248 : aStr.AppendAscii(STR_NOTHING);
1177 : :
1178 [ - + ]: 248 : if (pAktCreate!=NULL)
1179 : : {
1180 [ # # ][ # # ]: 0 : aStr=pAktCreate->getSpecialDragComment(aDragStat);
[ # # ]
1181 : :
1182 [ # # ]: 0 : if(!aStr.Len())
1183 : : {
1184 [ # # ]: 0 : pAktCreate->TakeObjNameSingul(aName);
1185 [ # # ][ # # ]: 0 : aStr = ImpGetResStr(STR_ViewCreateObj);
[ # # ]
1186 : : }
1187 : : }
1188 [ - + ]: 248 : else if (mpCurrentSdrDragMethod)
1189 : : {
1190 [ # # ][ # # ]: 0 : if (bInsPolyPoint || IsInsertGluePoint())
[ # # ]
1191 : : {
1192 [ # # ]: 0 : aStr=aInsPointUndoStr;
1193 : : }
1194 : : else
1195 : : {
1196 [ # # ]: 0 : if (aDragStat.IsMinMoved())
1197 : : {
1198 : : OSL_TRACE("SdrView::GetStatusText(%lx) %lx", this, mpCurrentSdrDragMethod);
1199 [ # # ]: 0 : mpCurrentSdrDragMethod->TakeSdrDragComment(aStr);
1200 : : }
1201 : : }
1202 : : }
1203 [ - + ]: 248 : else if(IsMarkObj())
1204 : : {
1205 [ # # ]: 0 : if(AreObjectsMarked())
1206 : : {
1207 [ # # ][ # # ]: 0 : aStr = ImpGetResStr(STR_ViewMarkMoreObjs);
[ # # ]
1208 : : }
1209 : : else
1210 : : {
1211 [ # # ][ # # ]: 0 : aStr = ImpGetResStr(STR_ViewMarkObjs);
[ # # ]
1212 : : }
1213 : : }
1214 [ - + ]: 248 : else if(IsMarkPoints())
1215 : : {
1216 [ # # ][ # # ]: 0 : if(HasMarkedPoints())
1217 : : {
1218 [ # # ][ # # ]: 0 : aStr = ImpGetResStr(STR_ViewMarkMorePoints);
[ # # ]
1219 : : }
1220 : : else
1221 : : {
1222 [ # # ][ # # ]: 0 : aStr = ImpGetResStr(STR_ViewMarkPoints);
[ # # ]
1223 : : }
1224 [ - + ]: 248 : } else if (IsMarkGluePoints())
1225 : : {
1226 [ # # ][ # # ]: 0 : if(HasMarkedGluePoints())
1227 : : {
1228 [ # # ][ # # ]: 0 : aStr = ImpGetResStr(STR_ViewMarkMoreGluePoints);
[ # # ]
1229 : : }
1230 : : else
1231 : : {
1232 [ # # ][ # # ]: 0 : aStr = ImpGetResStr(STR_ViewMarkGluePoints);
[ # # ]
1233 : : }
1234 : : }
1235 [ + - ][ - + ]: 248 : else if (IsTextEdit() && pTextEditOutlinerView!=NULL) {
[ # # ][ - + ]
1236 [ # # ][ # # ]: 0 : aStr=ImpGetResStr(STR_ViewTextEdit); // "TextEdit - Row y, Column x";
[ # # ]
1237 [ # # ]: 0 : ESelection aSel(pTextEditOutlinerView->GetSelection());
1238 : 0 : long nPar=aSel.nEndPara,nLin=0,nCol=aSel.nEndPos;
1239 [ # # ]: 0 : if (aSel.nEndPara>0) {
1240 [ # # ]: 0 : for (sal_uInt16 nParaNum=0; nParaNum<aSel.nEndPara; nParaNum++) {
1241 [ # # ]: 0 : nLin+=pTextEditOutliner->GetLineCount(nParaNum);
1242 : : }
1243 : : }
1244 : : // A little imperfection:
1245 : : // At the end of a line of any multi-line paragraph, we display the
1246 : : // position of the next line of the same paragraph, if there is one.
1247 : 0 : sal_uInt16 nParaLine=0;
1248 [ # # ]: 0 : sal_uIntPtr nParaLineAnz=pTextEditOutliner->GetLineCount(aSel.nEndPara);
1249 : 0 : sal_Bool bBrk=sal_False;
1250 [ # # ]: 0 : while (!bBrk) {
1251 [ # # ]: 0 : sal_uInt16 nLen=pTextEditOutliner->GetLineLen(aSel.nEndPara,nParaLine);
1252 : 0 : sal_Bool bLastLine=(nParaLine==nParaLineAnz-1);
1253 [ # # ][ # # ]: 0 : if (nCol>nLen || (!bLastLine && nCol==nLen)) {
[ # # ]
1254 : 0 : nCol-=nLen;
1255 : 0 : nLin++;
1256 : 0 : nParaLine++;
1257 : 0 : } else bBrk=sal_True;
1258 [ # # ]: 0 : if (nLen==0) bBrk=sal_True; // to be sure
1259 : : }
1260 : :
1261 [ # # ][ # # ]: 0 : aStr.SearchAndReplaceAscii("%1", UniString::CreateFromInt32(nPar + 1));
[ # # ]
1262 [ # # ][ # # ]: 0 : aStr.SearchAndReplaceAscii("%2", UniString::CreateFromInt32(nLin + 1));
[ # # ]
1263 [ # # ][ # # ]: 0 : aStr.SearchAndReplaceAscii("%3", UniString::CreateFromInt32(nCol + 1));
[ # # ]
1264 : :
1265 : : #ifdef DBG_UTIL
1266 : : aStr += UniString( RTL_CONSTASCII_USTRINGPARAM( ", Level " ) );
1267 : : aStr += UniString::CreateFromInt32( pTextEditOutliner->GetDepth( aSel.nEndPara ) );
1268 : : #endif
1269 : : }
1270 : :
1271 [ + - ][ + - ]: 248 : if(aStr.EqualsAscii(STR_NOTHING))
1272 : : {
1273 [ + + ]: 248 : if (AreObjectsMarked()) {
1274 [ + - ]: 1 : ImpTakeDescriptionStr(STR_ViewMarked,aStr);
1275 [ - + ]: 1 : if (IsGluePointEditMode()) {
1276 [ # # ][ # # ]: 0 : if (HasMarkedGluePoints()) {
1277 [ # # ]: 0 : ImpTakeDescriptionStr(STR_ViewMarked,aStr,0,IMPSDR_GLUEPOINTSDESCRIPTION);
1278 : : }
1279 : : } else {
1280 [ + - ][ - + ]: 1 : if (HasMarkedPoints()) {
1281 [ # # ]: 0 : ImpTakeDescriptionStr(STR_ViewMarked,aStr,0,IMPSDR_POINTSDESCRIPTION);
1282 : : }
1283 : : }
1284 : : } else {
1285 [ + - ]: 247 : aStr.Erase();
1286 : : }
1287 : : }
1288 [ # # ]: 0 : else if(aName.Len())
1289 : : {
1290 [ # # ]: 0 : aStr.SearchAndReplaceAscii("%1", aName);
1291 : : }
1292 : :
1293 [ + + ]: 248 : if(aStr.Len())
1294 : : {
1295 : : // capitalize first letter
1296 [ + - ]: 1 : String aTmpStr(aStr.Copy(0, 1));
1297 [ + - ]: 1 : aTmpStr.ToUpperAscii();
1298 [ + - ][ + - ]: 1 : aStr.Replace(0, 1, aTmpStr);
1299 : : }
1300 [ + - ]: 248 : return aStr;
1301 : : }
1302 : :
1303 : 1044 : SdrViewContext SdrView::GetContext() const
1304 : : {
1305 [ - + ]: 1044 : if( IsGluePointEditMode() )
1306 : 0 : return SDRCONTEXT_GLUEPOINTEDIT;
1307 : :
1308 : 1044 : const sal_uIntPtr nMarkAnz = GetMarkedObjectCount();
1309 : :
1310 [ # # ][ - + ]: 1044 : if( HasMarkablePoints() && !IsFrameHandles() )
[ - + ]
1311 : : {
1312 : 0 : sal_Bool bPath=sal_True;
1313 [ # # ][ # # ]: 0 : for( sal_uIntPtr nMarkNum = 0; nMarkNum < nMarkAnz && bPath; nMarkNum++ )
[ # # ]
1314 [ # # ]: 0 : if (!GetMarkedObjectByIndex(nMarkNum)->ISA(SdrPathObj))
1315 : 0 : bPath=sal_False;
1316 : :
1317 [ # # ]: 0 : if( bPath )
1318 : 0 : return SDRCONTEXT_POINTEDIT;
1319 : : }
1320 : :
1321 [ + + ]: 1044 : if( GetMarkedObjectCount() )
1322 : : {
1323 : 4 : sal_Bool bGraf = sal_True, bMedia = sal_True, bTable = sal_True;
1324 : :
1325 [ + + ][ - + ]: 8 : for( sal_uIntPtr nMarkNum = 0; nMarkNum < nMarkAnz && ( bGraf || bMedia ); nMarkNum++ )
[ # # ][ + + ]
1326 : : {
1327 : 4 : const SdrObject* pMarkObj = GetMarkedObjectByIndex( nMarkNum );
1328 : : DBG_ASSERT( pMarkObj, "SdrView::GetContext(), null pointer in mark list!" );
1329 : :
1330 [ - + ]: 4 : if( !pMarkObj )
1331 : 0 : continue;
1332 : :
1333 [ + - ]: 4 : if( !pMarkObj->ISA( SdrGrafObj ) )
1334 : 4 : bGraf = sal_False;
1335 : :
1336 [ + - ]: 4 : if( !pMarkObj->ISA( SdrMediaObj ) )
1337 : 4 : bMedia = sal_False;
1338 : :
1339 [ + - ]: 4 : if( !pMarkObj->ISA( ::sdr::table::SdrTableObj ) )
1340 : 4 : bTable = sal_False;
1341 : : }
1342 : :
1343 [ - + ]: 4 : if( bGraf )
1344 : 0 : return SDRCONTEXT_GRAPHIC;
1345 [ - + ]: 4 : else if( bMedia )
1346 : 0 : return SDRCONTEXT_MEDIA;
1347 [ - + ]: 4 : else if( bTable )
1348 : 0 : return SDRCONTEXT_TABLE;
1349 : : }
1350 : :
1351 : 1044 : return SDRCONTEXT_STANDARD;
1352 : : }
1353 : :
1354 : 0 : void SdrView::MarkAll()
1355 : : {
1356 [ # # ]: 0 : if (IsTextEdit()) {
1357 [ # # ]: 0 : GetTextEditOutlinerView()->SetSelection(ESelection(0,0,0xFFFF,0xFFFF));
1358 : : #ifdef DBG_UTIL
1359 : : if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1360 : : #endif
1361 [ # # ]: 0 : } else if (IsGluePointEditMode()) MarkAllGluePoints();
1362 [ # # ]: 0 : else if (HasMarkablePoints()) MarkAllPoints();
1363 : 0 : else MarkAllObj();
1364 : 0 : }
1365 : :
1366 : 2245 : void SdrView::UnmarkAll()
1367 : : {
1368 [ - + ]: 2245 : if (IsTextEdit()) {
1369 [ # # ]: 0 : ESelection eSel=GetTextEditOutlinerView()->GetSelection();
1370 : 0 : eSel.nStartPara=eSel.nEndPara;
1371 : 0 : eSel.nStartPos=eSel.nEndPos;
1372 [ # # ]: 0 : GetTextEditOutlinerView()->SetSelection(eSel);
1373 : : #ifdef DBG_UTIL
1374 : : if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1375 : : #endif
1376 [ - + ]: 2245 : } else if (HasMarkedGluePoints()) UnmarkAllGluePoints();
1377 [ - + ]: 2245 : else if (HasMarkedPoints()) UnmarkAllPoints(); // Marked, not Markable!
1378 : 2245 : else UnmarkAllObj();
1379 : 2245 : }
1380 : :
1381 : 0 : const Rectangle& SdrView::GetMarkedRect() const
1382 : : {
1383 [ # # ][ # # ]: 0 : if (IsGluePointEditMode() && HasMarkedGluePoints()) {
[ # # ]
1384 : 0 : return GetMarkedGluePointsRect();
1385 : : }
1386 [ # # ]: 0 : if (HasMarkedPoints()) {
1387 : 0 : return GetMarkedPointsRect();
1388 : : }
1389 : 0 : return GetMarkedObjRect();
1390 : : }
1391 : :
1392 : 0 : void SdrView::DeleteMarked()
1393 : : {
1394 [ # # ]: 0 : if (IsTextEdit())
1395 : : {
1396 [ # # ][ # # ]: 0 : SdrObjEditView::KeyInput(KeyEvent(0,KeyCode(KEYFUNC_DELETE)),pTextEditWin);
1397 : : }
1398 : : else
1399 : : {
1400 [ # # ][ # # ]: 0 : if( mxSelectionController.is() && mxSelectionController->DeleteMarked() )
[ # # ]
1401 : : {
1402 : : // action already performed by current selection controller, do nothing
1403 : : }
1404 [ # # ][ # # ]: 0 : else if (IsGluePointEditMode() && HasMarkedGluePoints())
[ # # ]
1405 : : {
1406 : 0 : DeleteMarkedGluePoints();
1407 : : }
1408 [ # # ][ # # ]: 0 : else if (GetContext()==SDRCONTEXT_POINTEDIT && HasMarkedPoints())
[ # # ]
1409 : : {
1410 : 0 : DeleteMarkedPoints();
1411 : : }
1412 : : else
1413 : : {
1414 : 0 : DeleteMarkedObj();
1415 : : }
1416 : : }
1417 : 0 : }
1418 : :
1419 : 0 : sal_Bool SdrView::BegMark(const Point& rPnt, sal_Bool bAddMark, sal_Bool bUnmark)
1420 : : {
1421 [ # # ]: 0 : if (bUnmark) bAddMark=sal_True;
1422 [ # # ]: 0 : if (IsGluePointEditMode()) {
1423 [ # # ]: 0 : if (!bAddMark) UnmarkAllGluePoints();
1424 : 0 : return BegMarkGluePoints(rPnt,bUnmark);
1425 [ # # ]: 0 : } else if (HasMarkablePoints()) {
1426 [ # # ]: 0 : if (!bAddMark) UnmarkAllPoints();
1427 : 0 : return BegMarkPoints(rPnt,bUnmark);
1428 : : } else {
1429 [ # # ]: 0 : if (!bAddMark) UnmarkAllObj();
1430 : 0 : return BegMarkObj(rPnt,bUnmark);
1431 : : }
1432 : : }
1433 : :
1434 : 144 : void SdrView::ConfigurationChanged( ::utl::ConfigurationBroadcaster*p, sal_uInt32 nHint)
1435 : : {
1436 : 144 : onAccessibilityOptionsChanged();
1437 : 144 : SdrCreateView::ConfigurationChanged(p, nHint);
1438 : 144 : }
1439 : :
1440 : 95618 : SvtAccessibilityOptions& SdrView::getAccessibilityOptions()
1441 : : {
1442 : 95618 : return maAccessibilityOptions;
1443 : : }
1444 : :
1445 : : /** method is called whenever the global SvtAccessibilityOptions is changed */
1446 : 4843 : void SdrView::onAccessibilityOptionsChanged()
1447 : : {
1448 : 4843 : }
1449 : :
1450 : 431 : void SdrView::SetMasterPagePaintCaching(sal_Bool bOn)
1451 : : {
1452 [ + - ]: 431 : if(mbMasterPagePaintCaching != bOn)
1453 : : {
1454 : 431 : mbMasterPagePaintCaching = bOn;
1455 : :
1456 : : // reset at all SdrPageWindows
1457 : 431 : SdrPageView* pPageView = GetSdrPageView();
1458 : :
1459 [ - + ]: 431 : if(pPageView)
1460 : : {
1461 [ # # ]: 0 : for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1462 : : {
1463 : 0 : SdrPageWindow* pPageWindow = pPageView->GetPageWindow(b);
1464 : : DBG_ASSERT(pPageWindow, "SdrView::SetMasterPagePaintCaching: Corrupt SdrPageWindow list (!)");
1465 : :
1466 : : // force deletion of ObjectContact, so at re-display all VOCs
1467 : : // will be re-created with updated flag setting
1468 : 0 : pPageWindow->ResetObjectContact();
1469 : : }
1470 : :
1471 : : // force redraw of this view
1472 : 0 : pPageView->InvalidateAllWin();
1473 : : }
1474 : : }
1475 : 431 : }
1476 : :
1477 : :
1478 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|