xref: /aoo41x/main/svx/source/svdraw/svdview.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 #include <editeng/eeitem.hxx>
31 
32 #include "svx/svdstr.hrc"   // Namen aus der Resource
33 #include "svx/svdglob.hxx"  // StringCache
34 #include <svx/svdpagv.hxx>
35 #include <svx/svdmrkv.hxx>
36 #include <svx/svdedxv.hxx>
37 #include <svx/svdobj.hxx>
38 #include <svx/svdopath.hxx> // fuer GetContext
39 #include <svx/svdograf.hxx> // fuer GetContext
40 #include <svx/svdomedia.hxx> // fuer GetContext
41 #include <svx/svdetc.hxx>   // Fuer SdrEngineDefaults
42 
43 #ifdef DBG_UTIL
44 #include <svdibrow.hxx>
45 #endif
46 
47 #include "svx/svdoutl.hxx"
48 #include "svx/svdview.hxx"
49 #include "editeng/editview.hxx" // fuer GetField
50 #include "editeng/flditem.hxx"  // fuer URLField
51 #include "svx/obj3d.hxx"
52 #include "svx/svddrgmt.hxx"
53 #include "svx/svdoutl.hxx"
54 #include "svx/svdotable.hxx"
55 #include <tools/tenccvt.hxx>
56 #include <svx/sdr/overlay/overlaypolypolygon.hxx>
57 #include <svx/sdr/overlay/overlaymanager.hxx>
58 #include <svx/sdrpaintwindow.hxx>
59 #include <svx/sdrpagewindow.hxx>
60 #include <svx/sdrhittesthelper.hxx>
61 
62 ////////////////////////////////////////////////////////////////////////////////////////////////////
63 
64 SdrViewEvent::SdrViewEvent()
65 :	  pHdl(NULL),
66 	  pObj(NULL),
67 	  pRootObj(NULL),
68 	  pPV(NULL),
69 	  pURLField(NULL),
70 	  eHit(SDRHIT_NONE),
71 	  eEvent(SDREVENT_NONE),
72 	  eHdlKind(HDL_MOVE),
73 	  eEndCreateCmd(SDRCREATE_NEXTPOINT),
74 	  nMouseClicks(0),
75 	  nMouseMode(0),
76 	  nMouseCode(0),
77 	  nHlplIdx(0),
78 	  nGlueId(0),
79 	  bMouseDown(sal_False),
80 	  bMouseUp(sal_False),
81 	  bDoubleHdlSize(sal_False),
82 	  bIsAction(sal_False),
83 	  bIsTextEdit(sal_False),
84 	  bTextEditHit(sal_False),
85 	  bAddMark(sal_False),
86 	  bUnmark(sal_False),
87 	  bPrevNextMark(sal_False),
88 	  bMarkPrev(sal_False),
89 	  bInsPointNewObj(sal_False),
90 	  bDragWithCopy(sal_False),
91 	  bCaptureMouse(sal_False),
92 	  bReleaseMouse(sal_False)
93 {
94 }
95 
96 SdrViewEvent::~SdrViewEvent()
97 {
98 }
99 
100 ////////////////////////////////////////////////////////////////////////////////////////////////////
101 // helper class for all D&D overlays
102 
103 void SdrDropMarkerOverlay::ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rPolyPolygon)
104 {
105 	for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
106 	{
107 		SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
108 		::sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager();
109 
110 		if(pTargetOverlay)
111 		{
112 			::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(
113 				rPolyPolygon);
114 			pTargetOverlay->add(*pNew);
115 			maObjects.append(*pNew);
116 		}
117 	}
118 }
119 
120 SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject)
121 {
122 	ImplCreateOverlays(rView, rObject.TakeXorPoly());
123 }
124 
125 SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle)
126 {
127 	basegfx::B2DPolygon aB2DPolygon;
128 	aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top()));
129 	aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Top()));
130 	aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom()));
131 	aB2DPolygon.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
132 	aB2DPolygon.setClosed(true);
133 
134 	basegfx::B2DPolyPolygon aB2DPolyPolygon;
135 	aB2DPolyPolygon.append(aB2DPolygon);
136 
137 	ImplCreateOverlays(rView, aB2DPolyPolygon);
138 }
139 
140 SdrDropMarkerOverlay::SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd)
141 {
142 	basegfx::B2DPolygon aB2DPolygon;
143 	aB2DPolygon.append(basegfx::B2DPoint(rStart.X(), rStart.Y()));
144 	aB2DPolygon.append(basegfx::B2DPoint(rEnd.X(), rEnd.Y()));
145 	aB2DPolygon.setClosed(true);
146 
147 	basegfx::B2DPolyPolygon aB2DPolyPolygon;
148 	aB2DPolyPolygon.append(aB2DPolygon);
149 
150 	ImplCreateOverlays(rView, aB2DPolyPolygon);
151 }
152 
153 SdrDropMarkerOverlay::~SdrDropMarkerOverlay()
154 {
155 	// The OverlayObjects are cleared using the destructor of OverlayObjectList.
156 	// That destructor calls clear() at the list which removes all objects from the
157 	// OverlayManager and deletes them.
158 }
159 
160 ////////////////////////////////////////////////////////////////////////////////////////////////////
161 ////////////////////////////////////////////////////////////////////////////////////////////////////
162 //
163 //  @@ @@ @@ @@@@@ @@   @@
164 //  @@ @@ @@ @@    @@   @@
165 //  @@ @@ @@ @@    @@ @ @@
166 //  @@@@@ @@ @@@@  @@@@@@@
167 //   @@@  @@ @@    @@@@@@@
168 //   @@@  @@ @@    @@@ @@@
169 //    @   @@ @@@@@ @@   @@
170 //
171 ////////////////////////////////////////////////////////////////////////////////////////////////////
172 ////////////////////////////////////////////////////////////////////////////////////////////////////
173 
174 TYPEINIT1(SdrView,SdrCreateView);
175 
176 SdrView::SdrView(SdrModel* pModel1, OutputDevice* pOut)
177 :	SdrCreateView(pModel1,pOut),
178 	bNoExtendedMouseDispatcher(sal_False),
179 	bNoExtendedKeyDispatcher(sal_False),
180 	bNoExtendedCommandDispatcher(sal_False),
181 	mbMasterPagePaintCaching(sal_False)
182 {
183 	bTextEditOnObjectsWithoutTextIfTextTool=sal_False;
184 
185 	maAccessibilityOptions.AddListener(this);
186 
187 	onAccessibilityOptionsChanged();
188 }
189 
190 SdrView::~SdrView()
191 {
192 	maAccessibilityOptions.RemoveListener(this);
193 }
194 
195 sal_Bool SdrView::KeyInput(const KeyEvent& rKEvt, Window* pWin)
196 {
197 	SetActualWin(pWin);
198 	sal_Bool bRet=SdrCreateView::KeyInput(rKEvt,pWin);
199 	if (!bRet && !IsExtendedKeyInputDispatcherEnabled()) {
200 		bRet=sal_True;
201 		switch (rKEvt.GetKeyCode().GetFullFunction()) {
202 			case KEYFUNC_CUT   : Cut(); break;
203 			case KEYFUNC_COPY  : Yank(); break;
204 			case KEYFUNC_PASTE : Paste(pWin); break;
205 			case KEYFUNC_DELETE: DeleteMarked(); break;
206 			case KEYFUNC_UNDO: pMod->Undo(); break;
207 			case KEYFUNC_REDO: pMod->Redo(); break;
208 			case KEYFUNC_REPEAT: pMod->Repeat(*this); break;
209 			default: {
210 				switch (rKEvt.GetKeyCode().GetFullCode()) {
211 					case KEY_ESCAPE: {
212 						if (IsTextEdit()) SdrEndTextEdit();
213 						if (IsAction()) BrkAction();
214 						if (pWin!=NULL) pWin->ReleaseMouse();
215 					} break;
216 					case KEY_DELETE: DeleteMarked(); break;
217 					case KEY_CUT: case KEY_DELETE+KEY_SHIFT: Cut(); break;
218 					case KEY_COPY: case KEY_INSERT+KEY_MOD1: Yank(); break;
219 					case KEY_PASTE: case KEY_INSERT+KEY_SHIFT: Paste(pWin); break;
220 					case KEY_UNDO: case KEY_BACKSPACE+KEY_MOD2: pMod->Undo(); break;
221 					case KEY_BACKSPACE+KEY_MOD2+KEY_SHIFT: pMod->Redo(); break;
222 					case KEY_REPEAT: case KEY_BACKSPACE+KEY_MOD2+KEY_MOD1: pMod->Repeat(*this); break;
223 					case KEY_MOD1+KEY_A: MarkAll(); break;
224 					default: bRet=sal_False;
225 				} // switch
226 			}
227 		} // switch
228 		if (bRet && pWin!=NULL) {
229 			pWin->SetPointer(GetPreferedPointer(
230 				pWin->PixelToLogic(pWin->ScreenToOutputPixel( pWin->GetPointerPosPixel() ) ),
231 				pWin,
232 				rKEvt.GetKeyCode().GetModifier()));
233 		}
234 	}
235 	return bRet;
236 }
237 
238 sal_Bool SdrView::MouseButtonDown(const MouseEvent& rMEvt, Window* pWin)
239 {
240 	SetActualWin(pWin);
241 	if (rMEvt.IsLeft()) aDragStat.SetMouseDown(sal_True);
242 	sal_Bool bRet=SdrCreateView::MouseButtonDown(rMEvt,pWin);
243 	if (!bRet && !IsExtendedMouseEventDispatcherEnabled()) {
244 		SdrViewEvent aVEvt;
245 		PickAnything(rMEvt,SDRMOUSEBUTTONDOWN,aVEvt);
246 		bRet=DoMouseEvent(aVEvt);
247 	}
248 	return bRet;
249 }
250 
251 sal_Bool SdrView::MouseButtonUp(const MouseEvent& rMEvt, Window* pWin)
252 {
253 	SetActualWin(pWin);
254 	if (rMEvt.IsLeft()) aDragStat.SetMouseDown(sal_False);
255 	sal_Bool bAction=IsAction();
256 	sal_Bool bRet=!bAction && SdrCreateView::MouseButtonUp(rMEvt,pWin);
257 	if (!bRet && !IsExtendedMouseEventDispatcherEnabled()) {
258 		SdrViewEvent aVEvt;
259 		PickAnything(rMEvt,SDRMOUSEBUTTONUP,aVEvt);
260 		bRet=DoMouseEvent(aVEvt);
261 	}
262 	return bRet;
263 }
264 
265 sal_Bool SdrView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
266 {
267 	SetActualWin(pWin);
268 	aDragStat.SetMouseDown(rMEvt.IsLeft());
269 	sal_Bool bRet=SdrCreateView::MouseMove(rMEvt,pWin);
270 	if (!IsExtendedMouseEventDispatcherEnabled() && !IsTextEditInSelectionMode()) {
271 		SdrViewEvent aVEvt;
272 		PickAnything(rMEvt,SDRMOUSEMOVE,aVEvt);
273 		if (DoMouseEvent(aVEvt)) bRet=sal_True;
274 	}
275 
276 	// #87792# Removed code which did let the mouse snap on object
277 	// points
278 
279 	return bRet;
280 }
281 
282 sal_Bool SdrView::Command(const CommandEvent& rCEvt, Window* pWin)
283 {
284 	SetActualWin(pWin);
285 	sal_Bool bRet=SdrCreateView::Command(rCEvt,pWin);
286 	return bRet;
287 }
288 
289 /* new interface src537 */
290 sal_Bool SdrView::GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr) const
291 {
292 	return SdrCreateView::GetAttributes(rTargetSet, bOnlyHardAttr);
293 }
294 
295 SfxStyleSheet* SdrView::GetStyleSheet() const
296 {
297 	//sal_Bool bOk=sal_False;
298 	return SdrCreateView::GetStyleSheet(); //bOk);
299 }
300 
301 SdrHitKind SdrView::PickAnything(const MouseEvent& rMEvt, sal_uInt16 nEventKind, SdrViewEvent& rVEvt) const
302 {
303 	rVEvt.bMouseDown=nEventKind==SDRMOUSEBUTTONDOWN;
304 	rVEvt.bMouseUp=nEventKind==SDRMOUSEBUTTONUP;
305 	rVEvt.nMouseClicks=rMEvt.GetClicks();
306 	rVEvt.nMouseMode=rMEvt.GetMode();
307 	rVEvt.nMouseCode=rMEvt.GetButtons() | rMEvt.GetModifier();
308 	const OutputDevice* pOut=pActualOutDev;
309 	if (pOut==NULL)
310 	{
311 		pOut = GetFirstOutputDevice();
312 		//pOut=GetWin(0);
313 	}
314 	Point aPnt(rMEvt.GetPosPixel());
315 	if (pOut!=NULL) aPnt=pOut->PixelToLogic(aPnt);
316 	rVEvt.aLogicPos=aPnt;
317 	return PickAnything(aPnt,rVEvt);
318 }
319 
320 // Mit der Maus draggen (Move)
321 // Beispiel beim erzeugen eines Rechtecks. MouseDown muss ohne
322 // ModKey erfolgen, weil sonst i.d.R. Markieren forciert wird (s.u.)
323 // Drueckt man dann beim MouseMove gleichzeitig Shift, Ctrl, und Alt,
324 // so erzeugt man ein zentrisches Quadrat ohne Fang.
325 // Die Doppelbelegung von Ortho und Shift stellt i.d.R. kein Problem dar,
326 // da sich beides meisst gegenseitig ausschliesst. Einzig Shear (das beim
327 // Verzerren, nicht dass beim Drehen) beruecksichtigt beides gleichzeitig.
328 // Dass muss der Anwender erstmal noch umschiffen (z.B. mit einer Hilfslinie).
329 #define MODKEY_NoSnap    bCtrl  /* Fang temporaer aus */
330 #define MODKEY_Ortho     bShift /* na eben ortho */
331 #define MODKEY_Center    bAlt   /* Zentrisch erzeugen/resizen */
332 #define MODKEY_AngleSnap bShift
333 #define MODKEY_CopyDrag  bCtrl  /* Draggen mit kopieren */
334 
335 // irgendwo hinklicken (MouseDown)
336 #define MODKEY_PolyPoly  bAlt   /* Neues Poly bei InsPt und bei Create */
337 #define MODKEY_MultiMark bShift /* MarkObj ohne vorher UnmarkAll */
338 #define MODKEY_Unmark    bAlt   /* Unmark durch Rahmenaufziehen */
339 #define MODKEY_ForceMark bCtrl  /* Rahmenaufziehen erzwingen, auch wenn Obj an MausPos */
340 #define MODKEY_DeepMark  bAlt   /* MarkNextObj */
341 #define MODKEY_DeepBackw bShift /* MarkNextObj rueckwaerts */
342 
343 SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const
344 {
345 	const OutputDevice* pOut=pActualOutDev;
346 	if (pOut==NULL)
347 	{
348 		pOut = GetFirstOutputDevice();
349 		//pOut=GetWin(0);
350 	}
351 
352 	// #i73628# Use a non-changeable copy of he logic pos
353 	const Point aLocalLogicPosition(rLogicPos);
354 
355 	sal_Bool bEditMode=IsEditMode();
356 	sal_Bool bPointMode=bEditMode && HasMarkablePoints();
357 	sal_Bool bGluePointMode=IsGluePointEditMode();
358 	sal_Bool bInsPolyPt=bPointMode && IsInsObjPointMode() && IsInsObjPointPossible();
359 	sal_Bool bInsGluePt=bGluePointMode && IsInsGluePointMode() && IsInsGluePointPossible();
360 	sal_Bool bIsTextEdit=IsTextEdit();
361 	sal_Bool bTextEditHit=IsTextEditHit(aLocalLogicPosition,0/*nHitTolLog*/);
362 	sal_Bool bTextEditSel=IsTextEditInSelectionMode();
363 	sal_Bool bShift=(rVEvt.nMouseCode & KEY_SHIFT) !=0;
364 	sal_Bool bCtrl=(rVEvt.nMouseCode & KEY_MOD1) !=0;
365 	sal_Bool bAlt=(rVEvt.nMouseCode & KEY_MOD2) !=0;
366 	SdrHitKind eHit=SDRHIT_NONE;
367 	SdrHdl* pHdl=pOut!=NULL && !bTextEditSel ? PickHandle(aLocalLogicPosition) : NULL;
368 	SdrPageView* pPV=NULL;
369 	SdrObject* pObj=NULL;
370 	SdrObject* pHitObj=NULL;
371 	sal_uInt16 nHitPassNum=0;
372 	sal_uInt16 nHlplIdx=0;
373 	sal_uInt16 nGlueId=0;
374 	sal_Bool bUnmarkedObjHit=sal_False;
375 	if (bTextEditHit || bTextEditSel)
376 	{
377 		eHit=SDRHIT_TEXTEDIT;
378 		bTextEditHit=sal_True;
379 	}
380 	else if (pHdl!=NULL)
381 	{
382 		eHit=SDRHIT_HANDLE; // Handle getroffen hat hoechste Prioritaet
383 	}
384 	else if (bEditMode && IsHlplVisible() && IsHlplFront() && pOut!=NULL && PickHelpLine(aLocalLogicPosition,nHitTolLog,*pOut,nHlplIdx,pPV))
385 	{
386 		eHit=SDRHIT_HELPLINE; // Hilfslinie im Vordergrund getroffen zum verschieben
387 	}
388 	else if (bGluePointMode && PickGluePoint(aLocalLogicPosition,pObj,nGlueId,pPV))
389 	{
390 		eHit=SDRHIT_GLUEPOINT; // nichtmarkierter Klebepunkt getroffen
391 	}
392 	else if (PickObj(aLocalLogicPosition,nHitTolLog,pHitObj,pPV,SDRSEARCH_DEEP|SDRSEARCH_MARKED,&pObj,NULL,&nHitPassNum))
393 	{
394 		eHit=SDRHIT_MARKEDOBJECT;
395 		::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( pObj );
396 		if( pTableObj )
397 		{
398 			sal_Int32 nX = 0, nY = 0;
399 			switch( pTableObj->CheckTableHit( aLocalLogicPosition, nX, nY, 0 ) )
400 			{
401 				case sdr::table::SDRTABLEHIT_CELL:
402 					eHit = SDRHIT_CELL;
403 					break;
404 				case sdr::table::SDRTABLEHIT_CELLTEXTAREA:
405 					eHit = SDRHIT_TEXTEDITOBJ;
406 					break;
407 				default:
408 					break;
409 			}
410 		}
411 	}
412 	else if (PickObj(aLocalLogicPosition,nHitTolLog,pHitObj,pPV,SDRSEARCH_DEEP|/*SDRSEARCH_TESTMARKABLE|*/SDRSEARCH_ALSOONMASTER|SDRSEARCH_WHOLEPAGE,&pObj,NULL,&nHitPassNum))
413 	{
414 		// MasterPages und WholePage fuer Macro und URL
415 		eHit=SDRHIT_UNMARKEDOBJECT;
416 		::sdr::table::SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( pObj );
417 		if( pTableObj )
418 		{
419 			sal_Int32 nX = 0, nY = 0;
420 			switch( pTableObj->CheckTableHit( aLocalLogicPosition, nX, nY, 0 ) )
421 			{
422 				case sdr::table::SDRTABLEHIT_CELL:
423 					eHit = SDRHIT_CELL;
424 					break;
425 				case sdr::table::SDRTABLEHIT_CELLTEXTAREA:
426 					eHit = SDRHIT_TEXTEDITOBJ;
427 					break;
428 				default:
429 					break;
430 			}
431 		}
432 		bUnmarkedObjHit=sal_True;
433 	}
434 	else if (bEditMode && IsHlplVisible() && !IsHlplFront() && pOut!=NULL && PickHelpLine(aLocalLogicPosition,nHitTolLog,*pOut,nHlplIdx,pPV))
435 	{
436 		eHit=SDRHIT_HELPLINE; // Hilfslinie im Vordergrund getroffen zum verschieben
437 	}
438 	if (IsMacroMode() && eHit==SDRHIT_UNMARKEDOBJECT)
439 	{
440 		bool bRoot=pObj->HasMacro();
441 		sal_Bool bDeep=pObj!=pHitObj && pHitObj->HasMacro();
442 		sal_Bool bMid=sal_False; // Gruppierte Gruppe mit Macro getroffen?
443 		SdrObject* pMidObj=NULL;
444 		if (pObj!=pHitObj)
445 		{
446 			SdrObject* pObjTmp=NULL;
447 			pObjTmp=pHitObj->GetUpGroup();
448 			if (pObjTmp==pObj) pObjTmp=NULL;
449 			while (pObjTmp!=NULL)
450 			{
451 				if (pObjTmp->HasMacro())
452 				{
453 					bMid=sal_True;
454 					pMidObj=pObjTmp;
455 				}
456 				pObjTmp=pObjTmp->GetUpGroup();
457 				if (pObjTmp==pObj) pObjTmp=NULL;
458 			}
459 		}
460 
461 		if (bDeep || bMid || bRoot)
462 		{
463 			SdrObjMacroHitRec aHitRec;
464 			aHitRec.aPos=aLocalLogicPosition;
465 			aHitRec.aDownPos=aLocalLogicPosition;
466 			aHitRec.nTol=nHitTolLog;
467 			aHitRec.pVisiLayer=&pPV->GetVisibleLayers();
468 			aHitRec.pPageView=pPV;
469 			if (bDeep) bDeep=pHitObj->IsMacroHit(aHitRec);
470 			if (bMid ) bMid =pMidObj->IsMacroHit(aHitRec);
471 			if (bRoot) bRoot=pObj->IsMacroHit(aHitRec);
472 			if (bRoot || bMid || bDeep)
473 			{
474 				// Prio: 1.Root, 2.Mid, 3.Deep
475 				rVEvt.pRootObj=pObj;
476 				if (!bRoot) pObj=pMidObj;
477 				if (!bRoot && !bMid) pObj=pHitObj;
478 				eHit=SDRHIT_MACRO;
479 			}
480 		}
481 	}
482 	// auf URL-Field checken
483 	if (IsMacroMode() && eHit==SDRHIT_UNMARKEDOBJECT)
484 	{
485 		SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pHitObj);
486 		if (pTextObj!=NULL && pTextObj->HasText())
487 		{
488 			bool bTEHit(pPV &&
489                 SdrObjectPrimitiveHit(*pTextObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true));
490 
491 			if (bTEHit)
492 			{
493 				Rectangle aTextRect;
494 				Rectangle aAnchor;
495 				SdrOutliner* pOutliner = &pTextObj->ImpGetDrawOutliner();
496 				if( pTextObj->GetModel() )
497 					pOutliner = &pTextObj->GetModel()->GetHitTestOutliner();
498 
499 				pTextObj->TakeTextRect( *pOutliner, aTextRect, sal_False, &aAnchor, sal_False );
500 
501 				// #i73628# Use a text-relative position for hit test in hit test outliner
502 				Point aTemporaryTextRelativePosition(aLocalLogicPosition - aTextRect.TopLeft());
503 
504 				// FitToSize berueksichtigen
505 				SdrFitToSizeType eFit=pTextObj->GetFitToSize();
506 				sal_Bool bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
507 				if (bFitToSize) {
508 					Fraction aX(aTextRect.GetWidth()-1,aAnchor.GetWidth()-1);
509 					Fraction aY(aTextRect.GetHeight()-1,aAnchor.GetHeight()-1);
510 					ResizePoint(aTemporaryTextRelativePosition,Point(),aX,aY);
511 				}
512 				// Drehung berueksichtigen
513 				const GeoStat& rGeo=pTextObj->GetGeoStat();
514 				if (rGeo.nDrehWink!=0) RotatePoint(aTemporaryTextRelativePosition,Point(),-rGeo.nSin,rGeo.nCos); // -sin fuer Unrotate
515 				// Laufschrift berueksichtigen fehlt noch ...
516 				if(pActualOutDev && pActualOutDev->GetOutDevType() == OUTDEV_WINDOW)
517 				{
518 					OutlinerView aOLV(pOutliner, (Window*)pActualOutDev);
519 					const EditView& aEV=aOLV.GetEditView();
520 					const SvxFieldItem* pItem=aEV.GetField(aTemporaryTextRelativePosition);
521 					if (pItem!=NULL) {
522 						const SvxFieldData* pFld=pItem->GetField();
523 						const SvxURLField* pURL=PTR_CAST(SvxURLField,pFld);
524 						if (pURL!=NULL) {
525 							eHit=SDRHIT_URLFIELD;
526 							rVEvt.pURLField=pURL;
527 						}
528 					}
529 				}
530 			}
531 		}
532 	}
533 
534 	if (nHitPassNum==SDRSEARCHPASS_DIRECT &&
535 		(eHit==SDRHIT_MARKEDOBJECT || eHit==SDRHIT_UNMARKEDOBJECT) &&
536 		(IsTextTool() || (IsEditMode() && IsQuickTextEditMode())) && pHitObj->HasTextEdit())
537 	{
538 		// Ringsum die TextEditArea ein Rand zum Selektieren ohne Textedit
539 		Rectangle aBoundRect(pHitObj->GetCurrentBoundRect());
540 
541 		// #105130# Force to SnapRect when Fontwork
542 		if(pHitObj->ISA(SdrTextObj) && ((SdrTextObj*)pHitObj)->IsFontwork())
543 		{
544 			aBoundRect = pHitObj->GetSnapRect();
545 		}
546 
547 		// #105130# Old test for hit on BoundRect is completely wrong
548 		// and never worked, doing it new here.
549 		sal_Int32 nTolerance(nHitTolLog);
550 		sal_Bool bBoundRectHit(sal_False);
551 
552 		if(pOut)
553 		{
554 			nTolerance = pOut->PixelToLogic(Size(2, 0)).Width();
555 		}
556 
557 		if(	(aLocalLogicPosition.X() >= aBoundRect.Left() - nTolerance && aLocalLogicPosition.X() <= aBoundRect.Left() + nTolerance)
558 		 || (aLocalLogicPosition.X() >= aBoundRect.Right() - nTolerance && aLocalLogicPosition.X() <= aBoundRect.Right() + nTolerance)
559 		 || (aLocalLogicPosition.Y() >= aBoundRect.Top() - nTolerance && aLocalLogicPosition.Y() <= aBoundRect.Top() + nTolerance)
560 		 || (aLocalLogicPosition.Y() >= aBoundRect.Bottom() - nTolerance && aLocalLogicPosition.Y() <= aBoundRect.Bottom() + nTolerance))
561 		{
562 			bBoundRectHit = sal_True;
563 		}
564 
565 		if(!bBoundRectHit)
566 		{
567 			bool bTEHit(pPV &&
568                 SdrObjectPrimitiveHit(*pHitObj, aLocalLogicPosition, 0, *pPV, &pPV->GetVisibleLayers(), true));
569 
570 			// TextEdit an Objekten im gesperrten Layer
571 			if (pPV->GetLockedLayers().IsSet(pHitObj->GetLayer()))
572             {
573 				bTEHit=sal_False;
574             }
575 
576 			if (bTEHit)
577 			{
578 				rVEvt.pRootObj=pObj;
579 				pObj=pHitObj;
580 				eHit=SDRHIT_TEXTEDITOBJ;
581 			}
582 		}
583 	}
584 	if (nHitPassNum!=SDRSEARCHPASS_DIRECT && eHit==SDRHIT_UNMARKEDOBJECT) {
585 		eHit=SDRHIT_NONE;
586 		pObj=NULL;
587 		pPV=NULL;
588 	}
589 	sal_Bool bMouseLeft=(rVEvt.nMouseCode&MOUSE_LEFT)!=0;
590 	sal_Bool bMouseRight=(rVEvt.nMouseCode&MOUSE_RIGHT)!=0;
591 	sal_Bool bMouseDown=rVEvt.bMouseDown;
592 	sal_Bool bMouseUp=rVEvt.bMouseUp;
593 	SdrEventKind eEvent=SDREVENT_NONE;
594 	sal_Bool bIsAction=IsAction();
595 
596 	if (bIsAction)
597 	{
598 		if (bMouseDown)
599 		{
600 			if (bMouseRight) eEvent=SDREVENT_BCKACTION;
601 		}
602 		else if (bMouseUp)
603 		{
604 			if (bMouseLeft)
605 			{
606 				eEvent=SDREVENT_ENDACTION;
607 				if (IsDragObj())
608 				{
609 					eEvent=SDREVENT_ENDDRAG;
610 					rVEvt.bDragWithCopy=MODKEY_CopyDrag;
611 				}
612 				else if (IsCreateObj() || IsInsObjPoint())
613 				{
614 					eEvent=IsCreateObj() ? SDREVENT_ENDCREATE : SDREVENT_ENDINSOBJPOINT;
615 					rVEvt.eEndCreateCmd=SDRCREATE_NEXTPOINT;
616 					if (MODKEY_PolyPoly) rVEvt.eEndCreateCmd=SDRCREATE_NEXTOBJECT;
617 					if (rVEvt.nMouseClicks>1) rVEvt.eEndCreateCmd=SDRCREATE_FORCEEND;
618 				}
619 				else if (IsMarking())
620 				{
621 					eEvent=SDREVENT_ENDMARK;
622 					if (!aDragStat.IsMinMoved())
623 					{
624 						eEvent=SDREVENT_BRKMARK;
625 						rVEvt.bAddMark=MODKEY_MultiMark;
626 					}
627 				}
628 			}
629 		}
630 		else
631 		{
632 			eEvent=SDREVENT_MOVACTION;
633 		}
634 	}
635 	else if (eHit==SDRHIT_TEXTEDIT)
636 	{
637 		eEvent=SDREVENT_TEXTEDIT;
638 	}
639 	else if (bMouseDown && bMouseLeft)
640 	{
641 		if (rVEvt.nMouseClicks==2 && rVEvt.nMouseCode==MOUSE_LEFT && pObj!=NULL && pHitObj!=NULL && pHitObj->HasTextEdit() && eHit==SDRHIT_MARKEDOBJECT)
642 		{
643 			rVEvt.pRootObj=pObj;
644 			pObj=pHitObj;
645 			eEvent=SDREVENT_BEGTEXTEDIT;
646 		}
647 		else if (MODKEY_ForceMark && eHit!=SDRHIT_URLFIELD)
648 		{
649 			eEvent=SDREVENT_BEGMARK; // AddMark,Unmark */
650 		}
651 		else if (eHit==SDRHIT_HELPLINE)
652 		{
653 			eEvent=SDREVENT_BEGDRAGHELPLINE; // nix weiter
654 		}
655 		else if (eHit==SDRHIT_GLUEPOINT)
656 		{
657 			eEvent=SDREVENT_MARKGLUEPOINT; // AddMark+Drag
658 			rVEvt.bAddMark=MODKEY_MultiMark || MODKEY_DeepMark; // falls bei Deep nicht getroffen
659 		}
660 		else if (eHit==SDRHIT_HANDLE)
661 		{
662 			eEvent=SDREVENT_BEGDRAGOBJ;    // Mark+Drag,AddMark+Drag,DeepMark+Drag,Unmark
663 			sal_Bool bGlue=pHdl->GetKind()==HDL_GLUE;
664 			sal_Bool bPoly=!bGlue && IsPointMarkable(*pHdl);
665 			sal_Bool bMarked=bGlue || bPoly && pHdl->IsSelected();
666 			if (bGlue || bPoly)
667 			{
668 				eEvent=bGlue ? SDREVENT_MARKGLUEPOINT : SDREVENT_MARKPOINT;
669 				if (MODKEY_DeepMark)
670 				{
671 					rVEvt.bAddMark=sal_True;
672 					rVEvt.bPrevNextMark=sal_True;
673 					rVEvt.bMarkPrev=MODKEY_DeepBackw;
674 				}
675 				else if (MODKEY_MultiMark)
676 				{
677 					rVEvt.bAddMark=sal_True;
678 					rVEvt.bUnmark=bMarked; // Toggle
679 					if (bGlue)
680 					{
681 						pObj=pHdl->GetObj();
682 						nGlueId=(sal_uInt16)pHdl->GetObjHdlNum();
683 					}
684 				}
685 				else if (bMarked)
686 				{
687 					eEvent=SDREVENT_BEGDRAGOBJ; // MarkState nicht aendern, nur Drag
688 				}
689 			}
690 		}
691 		else if (bInsPolyPt && (MODKEY_PolyPoly || (!MODKEY_MultiMark && !MODKEY_DeepMark)))
692 		{
693 			eEvent=SDREVENT_BEGINSOBJPOINT;
694 			rVEvt.bInsPointNewObj=MODKEY_PolyPoly;
695 		}
696 		else if (bInsGluePt && !MODKEY_MultiMark && !MODKEY_DeepMark)
697 		{
698 			eEvent=SDREVENT_BEGINSGLUEPOINT;
699 		}
700 		else if (eHit==SDRHIT_TEXTEDITOBJ)
701 		{
702 			eEvent=SDREVENT_BEGTEXTEDIT; // AddMark+Drag,DeepMark+Drag,Unmark
703 			if (MODKEY_MultiMark || MODKEY_DeepMark)
704 			{ // falls bei Deep nicht getroffen
705 				eEvent=SDREVENT_MARKOBJ;
706 			}
707 		}
708 		else if (eHit==SDRHIT_MACRO)
709 		{
710 			eEvent=SDREVENT_BEGMACROOBJ;       // AddMark+Drag
711 			if (MODKEY_MultiMark || MODKEY_DeepMark)
712 			{ // falls bei Deep nicht getroffen
713 				eEvent=SDREVENT_MARKOBJ;
714 			}
715 		}
716 		else if (eHit==SDRHIT_URLFIELD)
717 		{
718 			eEvent=SDREVENT_EXECUTEURL;       // AddMark+Drag
719 			if (MODKEY_MultiMark || MODKEY_DeepMark)
720 			{ // falls bei Deep nicht getroffen
721 				eEvent=SDREVENT_MARKOBJ;
722 			}
723 		}
724 		else if (eHit==SDRHIT_MARKEDOBJECT)
725 		{
726 			eEvent=SDREVENT_BEGDRAGOBJ; // DeepMark+Drag,Unmark
727 
728 			if (MODKEY_MultiMark || MODKEY_DeepMark)
729 			{ // falls bei Deep nicht getroffen
730 				eEvent=SDREVENT_MARKOBJ;
731 			}
732 		}
733 		else if (IsCreateMode())
734 		{
735 			eEvent=SDREVENT_BEGCREATEOBJ;          // Nix weiter
736 		}
737 		else if (eHit==SDRHIT_UNMARKEDOBJECT)
738 		{
739 			eEvent=SDREVENT_MARKOBJ;  // AddMark+Drag
740 		}
741 		else
742 		{
743 			eEvent=SDREVENT_BEGMARK;
744 		}
745 
746 		if (eEvent==SDREVENT_MARKOBJ)
747 		{
748 			rVEvt.bAddMark=MODKEY_MultiMark || MODKEY_DeepMark; // falls bei Deep nicht getroffen
749 			rVEvt.bPrevNextMark=MODKEY_DeepMark;
750 			rVEvt.bMarkPrev=MODKEY_DeepMark && MODKEY_DeepBackw;
751 		}
752 		if (eEvent==SDREVENT_BEGMARK)
753 		{
754 			rVEvt.bAddMark=MODKEY_MultiMark;
755 			rVEvt.bUnmark=MODKEY_Unmark;
756 		}
757 	}
758 	rVEvt.bIsAction=bIsAction;
759 	rVEvt.bIsTextEdit=bIsTextEdit;
760 	rVEvt.bTextEditHit=bTextEditHit;
761 	rVEvt.aLogicPos=aLocalLogicPosition;
762 	rVEvt.pHdl=pHdl;
763 	rVEvt.pObj=pObj;
764 	if(rVEvt.pRootObj==NULL)
765 		rVEvt.pRootObj=pObj;
766 	rVEvt.pPV=pPV;
767 	rVEvt.nHlplIdx=nHlplIdx;
768 	rVEvt.nGlueId=nGlueId;
769 	rVEvt.eHit=eHit;
770 	rVEvt.eEvent=eEvent;
771 	rVEvt.bCaptureMouse=bMouseLeft && bMouseDown && eEvent!=SDREVENT_NONE;
772 	rVEvt.bReleaseMouse=bMouseLeft && bMouseUp;
773 #ifdef DGB_UTIL
774 	if (rVEvt.pRootObj!=NULL) {
775 		if (rVEvt.pRootObj->GetObjList()!=rVEvt.pPV->GetObjList()) {
776 			DBG_ERROR("SdrView::PickAnything(): pRootObj->GetObjList()!=pPV->GetObjList() !");
777 		}
778 	}
779 #endif
780 	return eHit;
781 }
782 
783 sal_Bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
784 {
785 	sal_Bool bRet=sal_False;
786 	SdrHitKind eHit=rVEvt.eHit;
787 	Point aLogicPos(rVEvt.aLogicPos);
788 
789 	sal_Bool bShift=(rVEvt.nMouseCode & KEY_SHIFT) !=0;
790 	sal_Bool bCtrl=(rVEvt.nMouseCode & KEY_MOD1) !=0;
791 	sal_Bool bAlt=(rVEvt.nMouseCode & KEY_MOD2) !=0;
792 	sal_Bool bMouseLeft=(rVEvt.nMouseCode&MOUSE_LEFT)!=0;
793 	//sal_Bool bMouseRight=(rVEvt.nMouseCode&MOUSE_RIGHT)!=0;
794 	sal_Bool bMouseDown=rVEvt.bMouseDown;
795 	sal_Bool bMouseUp=rVEvt.bMouseUp;
796 	if (bMouseDown) {
797 		if (bMouseLeft) aDragStat.SetMouseDown(sal_True);
798 	} else if (bMouseUp) {
799 		if (bMouseLeft) aDragStat.SetMouseDown(sal_False);
800 	} else { // ansonsten MoueMove
801 		aDragStat.SetMouseDown(bMouseLeft);
802 	}
803 
804 #ifdef MODKEY_NoSnap
805 	SetSnapEnabled(!MODKEY_NoSnap);
806 #endif
807 #ifdef MODKEY_Ortho
808 	SetOrtho(MODKEY_Ortho!=IsOrthoDesired());
809 #endif
810 #ifdef MODKEY_BigOrtho
811 	SetBigOrtho(MODKEY_BigOrtho);
812 #endif
813 #ifdef MODKEY_AngleSnap
814 	SetAngleSnapEnabled(MODKEY_AngleSnap);
815 #endif
816 #ifdef MODKEY_CopyDrag
817 	SetDragWithCopy(MODKEY_CopyDrag);
818 #endif
819 #ifdef MODKEY_Center
820 	SetCreate1stPointAsCenter(MODKEY_Center);
821 	SetResizeAtCenter(MODKEY_Center);
822 	SetCrookAtCenter(MODKEY_Center);
823 #endif
824 	if (bMouseLeft && bMouseDown && rVEvt.bIsTextEdit && (eHit==SDRHIT_UNMARKEDOBJECT || eHit==SDRHIT_NONE)) {
825 		SdrEndTextEdit(); // Danebengeklickt, Ende mit Edit
826 		// pHdl ist dann ungueltig. Sollte aber egal sein, wein pHdl==NULL
827 		// sein muesste (wg. eHit).
828 	}
829 	switch (rVEvt.eEvent) {
830 		case SDREVENT_NONE: bRet=sal_False; break;
831 		case SDREVENT_TEXTEDIT: bRet=sal_False; break; // Events an die OutlinerView werden hier nicht beruecksichtigt
832 		case SDREVENT_MOVACTION: MovAction(aLogicPos); bRet=sal_True; break;
833 		case SDREVENT_ENDACTION: EndAction(); bRet=sal_True; break;
834 		case SDREVENT_BCKACTION: BckAction(); bRet=sal_True; break;
835 		case SDREVENT_BRKACTION: BrkAction(); bRet=sal_True; break;
836 		case SDREVENT_ENDMARK  : EndAction(); bRet=sal_True; break;
837 		case SDREVENT_BRKMARK  : {
838 			BrkAction();
839 			if (!MarkObj(aLogicPos,nHitTolLog,rVEvt.bAddMark)) {
840 				// Kein Obj getroffen. Dann werden zuerst
841 				// - Markierte Klebepunkte deselektiert
842 				// - dann ggf. selektierte Polygonpunkte
843 				// - und ansonsten Objekte
844 				if (!rVEvt.bAddMark) UnmarkAll();
845 			}
846 			bRet=sal_True;
847 		} break;
848 		case SDREVENT_ENDCREATE: { // ggf. MarkObj
849 			SdrCreateCmd eCmd=SDRCREATE_NEXTPOINT;
850 			if (MODKEY_PolyPoly) eCmd=SDRCREATE_NEXTOBJECT;
851 			if (rVEvt.nMouseClicks>1) eCmd=SDRCREATE_FORCEEND;
852 			if (!EndCreateObj(eCmd)) { // Event fuer Create nicht ausgewerten? -> Markieren
853 				if (eHit==SDRHIT_UNMARKEDOBJECT || eHit==SDRHIT_TEXTEDIT) {
854 					MarkObj(rVEvt.pRootObj,rVEvt.pPV);
855 					if (eHit==SDRHIT_TEXTEDIT)
856 					{
857 						sal_Bool bRet2(pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType() &&
858 							SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, (Window*)pActualOutDev, sal_False, (SdrOutliner*)0L));
859 
860 						if(bRet2)
861 						{
862 							MouseEvent aMEvt(pActualOutDev->LogicToPixel(aLogicPos),
863 											 1,rVEvt.nMouseMode,rVEvt.nMouseCode,rVEvt.nMouseCode);
864 
865 							OutlinerView* pOLV=GetTextEditOutlinerView();
866 							if (pOLV!=NULL) {
867 								pOLV->MouseButtonDown(aMEvt); // Event an den Outliner, aber ohne Doppelklick
868 								pOLV->MouseButtonUp(aMEvt); // Event an den Outliner, aber ohne Doppelklick
869 							}
870 						}
871 					}
872 					bRet=sal_True; // Obj markiert und ggf. TextEdit gestartet
873 				} else bRet=sal_False; // Create abgebrochen, sonst nix weiter.
874 			} else bRet=sal_True; // EndCreate mit sal_True returniert
875 		} break;
876 		case SDREVENT_ENDDRAG: {
877 			bRet=EndDragObj(IsDragWithCopy());
878 			ForceMarkedObjToAnotherPage(); // Undo+Klammerung fehlt noch !!!
879 		} break;
880 		case SDREVENT_MARKOBJ: { // + ggf. BegDrag
881 			if (!rVEvt.bAddMark) UnmarkAllObj();
882 			sal_Bool bUnmark=rVEvt.bUnmark;
883 			if (rVEvt.bPrevNextMark) {
884 				bRet=MarkNextObj(aLogicPos,nHitTolLog,rVEvt.bMarkPrev);
885 			} else {
886 				SortMarkedObjects();
887 				sal_uIntPtr nAnz0=GetMarkedObjectCount();
888 				bRet=MarkObj(aLogicPos,nHitTolLog,rVEvt.bAddMark);
889 				SortMarkedObjects();
890 				sal_uIntPtr nAnz1=GetMarkedObjectCount();
891 				bUnmark=nAnz1<nAnz0;
892 			}
893 			if (!bUnmark) {
894 				BegDragObj(aLogicPos,NULL,(SdrHdl*)NULL,nMinMovLog);
895 				bRet=sal_True;
896 			}
897 		} break;
898 		case SDREVENT_MARKPOINT: { // + ggf. BegDrag
899 			if (!rVEvt.bAddMark) UnmarkAllPoints();
900 			if (rVEvt.bPrevNextMark) {
901 				bRet=MarkNextPoint(aLogicPos,rVEvt.bMarkPrev);
902 			} else {
903 				bRet=MarkPoint(*rVEvt.pHdl,rVEvt.bUnmark);
904 			}
905 			if (!rVEvt.bUnmark && !rVEvt.bPrevNextMark) {
906 				BegDragObj(aLogicPos,NULL,rVEvt.pHdl,nMinMovLog);
907 				bRet=sal_True;
908 			}
909 		} break;
910 		case SDREVENT_MARKGLUEPOINT: { // + ggf. BegDrag
911 			if (!rVEvt.bAddMark) UnmarkAllGluePoints();
912 			if (rVEvt.bPrevNextMark) {
913 				bRet=MarkNextGluePoint(aLogicPos,rVEvt.bMarkPrev);
914 			} else {
915 				bRet=MarkGluePoint(rVEvt.pObj,rVEvt.nGlueId,rVEvt.pPV,rVEvt.bUnmark);
916 			}
917 			if (!rVEvt.bUnmark && !rVEvt.bPrevNextMark) {
918 				SdrHdl* pHdl=GetGluePointHdl(rVEvt.pObj,rVEvt.nGlueId);
919 				BegDragObj(aLogicPos,NULL,pHdl,nMinMovLog);
920 				bRet=sal_True;
921 			}
922 		} break;
923 		case SDREVENT_BEGMARK: bRet=BegMark(aLogicPos,rVEvt.bAddMark,rVEvt.bUnmark); break;
924 		case SDREVENT_BEGINSOBJPOINT: bRet = BegInsObjPoint(aLogicPos, MODKEY_PolyPoly); break;
925 		case SDREVENT_ENDINSOBJPOINT: {
926 			SdrCreateCmd eCmd=SDRCREATE_NEXTPOINT;
927 			if (MODKEY_PolyPoly) eCmd=SDRCREATE_NEXTOBJECT;
928 			if (rVEvt.nMouseClicks>1) eCmd=SDRCREATE_FORCEEND;
929 			EndInsObjPoint(eCmd);
930 			bRet=sal_True;
931 		} break;
932 		case SDREVENT_BEGINSGLUEPOINT: bRet=BegInsGluePoint(aLogicPos); break;
933 		case SDREVENT_BEGDRAGHELPLINE: bRet=BegDragHelpLine(rVEvt.nHlplIdx,rVEvt.pPV); break;
934 		case SDREVENT_BEGDRAGOBJ: bRet=BegDragObj(aLogicPos,NULL,rVEvt.pHdl,nMinMovLog); break;
935 		case SDREVENT_BEGCREATEOBJ: {
936 			if (nAktInvent==SdrInventor && nAktIdent==OBJ_CAPTION) {
937 				long nHgt=SdrEngineDefaults::GetFontHeight();
938 				bRet=BegCreateCaptionObj(aLogicPos,Size(5*nHgt,2*nHgt));
939 			} else bRet=BegCreateObj(aLogicPos);
940 		} break;
941 		case SDREVENT_BEGMACROOBJ: bRet=BegMacroObj(aLogicPos,nHitTolLog,rVEvt.pObj,rVEvt.pPV,(Window*)pActualOutDev); break;
942 		case SDREVENT_BEGTEXTEDIT: {
943 			if (!IsObjMarked(rVEvt.pObj)) {
944 				UnmarkAllObj();
945 				MarkObj(rVEvt.pRootObj,rVEvt.pPV);
946 			}
947 
948 			bRet = pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType()&&
949 				 SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, (Window*)pActualOutDev, sal_False, (SdrOutliner*)0L);
950 
951 			if(bRet)
952 			{
953 				MouseEvent aMEvt(pActualOutDev->LogicToPixel(aLogicPos),
954 								 1,rVEvt.nMouseMode,rVEvt.nMouseCode,rVEvt.nMouseCode);
955 				OutlinerView* pOLV=GetTextEditOutlinerView();
956 				if (pOLV!=NULL) pOLV->MouseButtonDown(aMEvt); // Event an den Outliner, aber ohne Doppelklick
957 			}
958 		} break;
959 		default: break;
960 	} // switch
961 	if (bRet && pActualOutDev!=NULL && pActualOutDev->GetOutDevType()==OUTDEV_WINDOW) {
962 		Window* pWin=(Window*)pActualOutDev;
963 		// Maus links gedrueckt?
964 		sal_Bool bLeftDown=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseDown;
965 		// Maus links losgelassen?
966 		sal_Bool bLeftUp=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseUp;
967 		// Maus links gedrueckt oder gehalten?
968 		sal_Bool bLeftDown1=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && !rVEvt.bMouseUp;
969 		pWin->SetPointer(GetPreferedPointer(rVEvt.aLogicPos,pWin,
970 				rVEvt.nMouseCode & (KEY_SHIFT|KEY_MOD1|KEY_MOD2),bLeftDown1));
971 		sal_Bool bAction=IsAction();
972 		if (bLeftDown && bAction) pWin->CaptureMouse();
973 		else if (bLeftUp || (rVEvt.bIsAction && !bAction)) pWin->ReleaseMouse();
974 	}
975 	return bRet;
976 }
977 #include <editeng/outlobj.hxx>
978 
979 Pointer SdrView::GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier, sal_Bool bLeftDown) const
980 {
981 	// Actions
982 	if (IsCreateObj())
983 	{
984 		return pAktCreate->GetCreatePointer();
985 	}
986 	if (mpCurrentSdrDragMethod)
987 	{
988 		if ((IsDraggingPoints() || IsDraggingGluePoints()) && IsMouseHideWhileDraggingPoints())
989 			return Pointer(POINTER_NULL);
990 
991 		return mpCurrentSdrDragMethod->GetSdrDragPointer();
992 	}
993 	if (IsMarkObj() || IsMarkPoints() || IsMarkGluePoints() || IsEncirclement() || IsSetPageOrg()) return Pointer(POINTER_ARROW);
994 	if (IsDragHelpLine()) return GetDraggedHelpLinePointer();
995 	if (IsMacroObj()) {
996 		SdrObjMacroHitRec aHitRec;
997 		aHitRec.aPos=pOut->LogicToPixel(rMousePos);
998 		aHitRec.aDownPos=aMacroDownPos;
999 		aHitRec.nTol=nMacroTol;
1000 		aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
1001 		aHitRec.pPageView=pMacroPV;
1002 		aHitRec.pOut=pMacroWin;
1003 		aHitRec.bDown=bMacroDown;
1004 		return pMacroObj->GetMacroPointer(aHitRec);
1005 	}
1006 	//sal_uInt16 nTol=nHitTolLog;
1007 	// TextEdit, ObjEdit, Macro
1008 	if (IsTextEdit() && (IsTextEditInSelectionMode() || IsTextEditHit(rMousePos,0/*nTol*/)))
1009 	{
1010 		if(!pOut || IsTextEditInSelectionMode())
1011 		{
1012 			if(pTextEditOutliner->IsVertical())
1013 				return Pointer(POINTER_TEXT_VERTICAL);
1014 			else
1015 				return Pointer(POINTER_TEXT);
1016 		}
1017 		// hier muss besser der Outliner was liefern:
1018 		Point aPos(pOut->LogicToPixel(rMousePos));
1019 		Pointer aPointer(pTextEditOutlinerView->GetPointer(aPos));
1020 		if (aPointer==POINTER_ARROW)
1021 		{
1022 			if(pTextEditOutliner->IsVertical())
1023 				aPointer = POINTER_TEXT_VERTICAL;
1024 			else
1025 				aPointer = POINTER_TEXT;
1026 		}
1027 		return aPointer;
1028 	}
1029 
1030 	SdrViewEvent aVEvt;
1031 	aVEvt.nMouseCode=(nModifier&(KEY_SHIFT|KEY_MOD1|KEY_MOD2))|MOUSE_LEFT; // um zu sehen, was bei MouseLeftDown passieren wuerde
1032 	aVEvt.bMouseDown=!bLeftDown; // Was waere wenn ...
1033 	aVEvt.bMouseUp=bLeftDown;    // Was waere wenn ...
1034 	if (pOut!=NULL)
1035 		((SdrView*)this)->SetActualWin(pOut);
1036 	SdrHitKind eHit=PickAnything(rMousePos,aVEvt);
1037 	SdrEventKind eEvent=aVEvt.eEvent;
1038 	switch (eEvent)
1039 	{
1040 		case SDREVENT_BEGCREATEOBJ:
1041 			return aAktCreatePointer;
1042 		case SDREVENT_MARKOBJ:
1043 		case SDREVENT_BEGMARK:
1044 			return Pointer(POINTER_ARROW);
1045 		case SDREVENT_MARKPOINT:
1046 		case SDREVENT_MARKGLUEPOINT:
1047 			return Pointer(POINTER_MOVEPOINT);
1048 		case SDREVENT_BEGINSOBJPOINT:
1049 		case SDREVENT_BEGINSGLUEPOINT:
1050 			return Pointer(POINTER_CROSS);
1051 		case SDREVENT_EXECUTEURL:
1052 			return Pointer(POINTER_REFHAND);
1053 		case SDREVENT_BEGMACROOBJ:
1054 		{
1055 			SdrObjMacroHitRec aHitRec;
1056 			aHitRec.aPos=aVEvt.aLogicPos;
1057 			aHitRec.aDownPos=aHitRec.aPos;
1058 			aHitRec.nTol=nHitTolLog;
1059 			aHitRec.pVisiLayer=&aVEvt.pPV->GetVisibleLayers();
1060 			aHitRec.pPageView=aVEvt.pPV;
1061 			aHitRec.pOut=(OutputDevice*)pOut;
1062 			return aVEvt.pObj->GetMacroPointer(aHitRec);
1063 		}
1064 		default: break;
1065 	} // switch
1066 
1067 	switch(eHit)
1068 	{
1069 		case SDRHIT_CELL:
1070 			return Pointer(POINTER_ARROW);
1071 		case SDRHIT_HELPLINE :
1072 			return aVEvt.pPV->GetHelpLines()[aVEvt.nHlplIdx].GetPointer();
1073 		case SDRHIT_GLUEPOINT:
1074 			return Pointer(POINTER_MOVEPOINT);
1075 		case SDRHIT_TEXTEDIT :
1076 		case SDRHIT_TEXTEDITOBJ:
1077 		{
1078 			SdrTextObj* pText = dynamic_cast< SdrTextObj* >( aVEvt.pObj );
1079 			if(pText && pText->HasText())
1080 			{
1081 				OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject();
1082 				if(pParaObj && pParaObj->IsVertical())
1083 					return Pointer(POINTER_TEXT_VERTICAL);
1084 			}
1085 			return Pointer(POINTER_TEXT);
1086 		}
1087 		default: break;
1088 	}
1089 
1090 	sal_Bool bMarkHit=eHit==SDRHIT_MARKEDOBJECT;
1091 	SdrHdl* pHdl=aVEvt.pHdl;
1092 	// Nun die Pointer fuer Dragging checken
1093 	if (pHdl!=NULL || bMarkHit) {
1094 		SdrHdlKind eHdl= pHdl!=NULL ? pHdl->GetKind() : HDL_MOVE;
1095 		sal_Bool bCorner=pHdl!=NULL && pHdl->IsCornerHdl();
1096 		sal_Bool bVertex=pHdl!=NULL && pHdl->IsVertexHdl();
1097 		sal_Bool bMov=eHdl==HDL_MOVE;
1098 		if (bMov && (eDragMode==SDRDRAG_MOVE || eDragMode==SDRDRAG_RESIZE || bMarkedHitMovesAlways)) {
1099 			if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // weil Doppelklick oder Drag&Drop moeglich
1100 			return Pointer(POINTER_MOVE);
1101 		}
1102 		switch (eDragMode) {
1103 			case SDRDRAG_ROTATE: {
1104 				if ((bCorner || bMov) && !IsRotateAllowed(sal_True))
1105 					return Pointer(POINTER_NOTALLOWED);
1106 
1107 				// Sind 3D-Objekte selektiert?
1108 				sal_Bool b3DObjSelected = sal_False;
1109 #ifndef SVX_LIGHT
1110 				for (sal_uInt32 a=0; !b3DObjSelected && a<GetMarkedObjectCount(); a++) {
1111 					SdrObject* pObj = GetMarkedObjectByIndex(a);
1112 					if(pObj && pObj->ISA(E3dObject))
1113 						b3DObjSelected = sal_True;
1114 				}
1115 #endif
1116 				// Falls es um ein 3D-Objekt geht, muss trotz !IsShearAllowed
1117 				// weitergemacht werden, da es sich um eine Rotation statt um
1118 				// einen Shear handelt
1119 				if (bVertex && !IsShearAllowed() && !b3DObjSelected)
1120 					return Pointer(POINTER_NOTALLOWED);
1121 				if (bMov)
1122 					return Pointer(POINTER_ROTATE);
1123 			} break;
1124 			case SDRDRAG_SHEAR: case SDRDRAG_DISTORT: {
1125 				if (bCorner) {
1126 					if (!IsDistortAllowed(sal_True) && !IsDistortAllowed(sal_False)) return Pointer(POINTER_NOTALLOWED);
1127 					else return Pointer(POINTER_REFHAND);
1128 				}
1129 				if (bVertex && !IsShearAllowed()) return Pointer(POINTER_NOTALLOWED);
1130 				if (bMov) {
1131 					if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // weil Doppelklick oder Drag&Drop moeglich
1132 					return Pointer(POINTER_MOVE);
1133 				}
1134 			} break;
1135 			case SDRDRAG_MIRROR: {
1136 				if (bCorner || bVertex || bMov) {
1137 					SdrHdl* pH1=aHdl.GetHdl(HDL_REF1);
1138 					SdrHdl* pH2=aHdl.GetHdl(HDL_REF2);
1139 					sal_Bool b90=sal_False;
1140 					sal_Bool b45=sal_False;
1141 					Point aDif;
1142 					if (pH1!=NULL && pH2!=NULL) {
1143 						aDif=pH2->GetPos()-pH1->GetPos();
1144 						b90=(aDif.X()==0) || aDif.Y()==0;
1145 						b45=b90 || (Abs(aDif.X())==Abs(aDif.Y()));
1146 					}
1147 					sal_Bool bNo=sal_False;
1148 					if (!IsMirrorAllowed(sal_True,sal_True)) bNo=sal_True; // Spiegeln ueberhaupt nicht erlaubt
1149 					if (!IsMirrorAllowed(sal_False,sal_False) && !b45) bNo=sal_True; // freies Spiegeln nicht erlaubt
1150 					if (!IsMirrorAllowed(sal_True,sal_False) && !b90) bNo=sal_True;  // Spiegeln hor/ver erlaubt
1151 					if (bNo) return Pointer(POINTER_NOTALLOWED);
1152 					if (b90) {
1153 						return Pointer(POINTER_MIRROR);
1154 					}
1155 					return Pointer(POINTER_MIRROR);
1156 				}
1157 			} break;
1158 
1159 			case SDRDRAG_TRANSPARENCE:
1160 			{
1161 				if(!IsTransparenceAllowed())
1162 					return Pointer(POINTER_NOTALLOWED);
1163 
1164 				return Pointer(POINTER_REFHAND);
1165 			}
1166 
1167 			case SDRDRAG_GRADIENT:
1168 			{
1169 				if(!IsGradientAllowed())
1170 					return Pointer(POINTER_NOTALLOWED);
1171 
1172 				return Pointer(POINTER_REFHAND);
1173 			}
1174 
1175 			case SDRDRAG_CROOK: {
1176 				if (bCorner || bVertex || bMov) {
1177 					if (!IsCrookAllowed(sal_True) && !IsCrookAllowed(sal_False)) return Pointer(POINTER_NOTALLOWED);
1178 					return Pointer(POINTER_CROOK);
1179 				}
1180 			}
1181 
1182 			case SDRDRAG_CROP:
1183 			{
1184 				return Pointer(POINTER_CROP);
1185 			}
1186 
1187 			default: {
1188 				if ((bCorner || bVertex) && !IsResizeAllowed(sal_True)) return Pointer(POINTER_NOTALLOWED);
1189 			}
1190 		}
1191 		if (pHdl!=NULL) return pHdl->GetPointer();
1192 		if (bMov) {
1193 			if (!IsMoveAllowed()) return Pointer(POINTER_ARROW); // weil Doppelklick oder Drag&Drop moeglich
1194 			return Pointer(POINTER_MOVE);
1195 		}
1196 	}
1197 	if (eEditMode==SDREDITMODE_CREATE) return aAktCreatePointer;
1198 	return Pointer(POINTER_ARROW);
1199 }
1200 
1201 XubString SdrView::GetStatusText()
1202 {
1203 	XubString aStr;
1204 	XubString aName;
1205 
1206 	aStr.AppendAscii("nix");
1207 
1208 	if (pAktCreate!=NULL)
1209 	{
1210 		aStr=pAktCreate->getSpecialDragComment(aDragStat);
1211 
1212 		if(!aStr.Len())
1213 		{
1214 			pAktCreate->TakeObjNameSingul(aName);
1215 			aStr = ImpGetResStr(STR_ViewCreateObj);
1216 		}
1217 	}
1218 	else if (mpCurrentSdrDragMethod)
1219 	{
1220 		if (bInsPolyPoint || IsInsertGluePoint())
1221 		{
1222 			aStr=aInsPointUndoStr;
1223 		}
1224 		else
1225 		{
1226 			if (aDragStat.IsMinMoved())
1227 			{
1228 				OSL_TRACE("SdrView::GetStatusText(%lx) %lx\n", this, mpCurrentSdrDragMethod);
1229 				mpCurrentSdrDragMethod->TakeSdrDragComment(aStr);
1230 			}
1231 		}
1232 	}
1233 	else if(IsMarkObj())
1234 	{
1235 		if(AreObjectsMarked())
1236 		{
1237 			aStr = ImpGetResStr(STR_ViewMarkMoreObjs);
1238 		}
1239 		else
1240 		{
1241 			aStr = ImpGetResStr(STR_ViewMarkObjs);
1242 		}
1243 	}
1244 	else if(IsMarkPoints())
1245 	{
1246 		if(HasMarkedPoints())
1247 		{
1248 			aStr = ImpGetResStr(STR_ViewMarkMorePoints);
1249 		}
1250 		else
1251 		{
1252 			aStr = ImpGetResStr(STR_ViewMarkPoints);
1253 		}
1254 	} else if (IsMarkGluePoints())
1255 	{
1256 		if(HasMarkedGluePoints())
1257 		{
1258 			aStr = ImpGetResStr(STR_ViewMarkMoreGluePoints);
1259 		}
1260 		else
1261 		{
1262 			aStr = ImpGetResStr(STR_ViewMarkGluePoints);
1263 		}
1264 	}
1265 	else if (IsTextEdit() && pTextEditOutlinerView!=NULL) {
1266 		aStr=ImpGetResStr(STR_ViewTextEdit); // "TextEdit - Zeile y  Spalte x";
1267 		ESelection aSel(pTextEditOutlinerView->GetSelection());
1268 		long nPar=aSel.nEndPara,nLin=0,nCol=aSel.nEndPos;
1269 		if (aSel.nEndPara>0) {
1270 			for (sal_uInt16 nParaNum=0; nParaNum<aSel.nEndPara; nParaNum++) {
1271 				nLin+=pTextEditOutliner->GetLineCount(nParaNum);
1272 			}
1273 		}
1274 		// Noch 'ne kleine Unschoenheit:
1275 		// Am Ende einer Zeile eines mehrzeiligen Absatzes wird die Position
1276 		// der naechsten Zeile des selben Absatzes angezeigt, so es eine solche
1277 		// gibt.
1278 		sal_uInt16 nParaLine=0;
1279 		sal_uIntPtr nParaLineAnz=pTextEditOutliner->GetLineCount(aSel.nEndPara);
1280 		sal_Bool bBrk=sal_False;
1281 		while (!bBrk) {
1282 			sal_uInt16 nLen=pTextEditOutliner->GetLineLen(aSel.nEndPara,nParaLine);
1283 			sal_Bool bLastLine=(nParaLine==nParaLineAnz-1);
1284 			if (nCol>nLen || (!bLastLine && nCol==nLen)) {
1285 				nCol-=nLen;
1286 				nLin++;
1287 				nParaLine++;
1288 			} else bBrk=sal_True;
1289 			if (nLen==0) bBrk=sal_True; // Sicherheitshalber
1290 		}
1291 
1292 		aStr.SearchAndReplaceAscii("%1", UniString::CreateFromInt32(nPar + 1));
1293 		aStr.SearchAndReplaceAscii("%2", UniString::CreateFromInt32(nLin + 1));
1294 		aStr.SearchAndReplaceAscii("%3", UniString::CreateFromInt32(nCol + 1));
1295 
1296 #ifdef DBG_UTIL
1297 		aStr += UniString( RTL_CONSTASCII_USTRINGPARAM( ", Level " ) );
1298 		aStr += UniString::CreateFromInt32( pTextEditOutliner->GetDepth( aSel.nEndPara ) );
1299 #endif
1300 	}
1301 
1302 	if(aStr.EqualsAscii("nix"))
1303 	{
1304 		if (AreObjectsMarked()) {
1305 			ImpTakeDescriptionStr(STR_ViewMarked,aStr);
1306 			if (IsGluePointEditMode()) {
1307 				if (HasMarkedGluePoints()) {
1308 					ImpTakeDescriptionStr(STR_ViewMarked,aStr,0,IMPSDR_GLUEPOINTSDESCRIPTION);
1309 				}
1310 			} else {
1311 				if (HasMarkedPoints()) {
1312 					ImpTakeDescriptionStr(STR_ViewMarked,aStr,0,IMPSDR_POINTSDESCRIPTION);
1313 				}
1314 			}
1315 		} else {
1316 			aStr.Erase();
1317 		}
1318 	}
1319 	else if(aName.Len())
1320 	{
1321 		aStr.SearchAndReplaceAscii("%1", aName);
1322 	}
1323 
1324 	if(aStr.Len())
1325 	{
1326 		// ersten Buchstaben gross schreiben
1327 		String aTmpStr(aStr.Copy(0, 1));
1328 		aTmpStr.ToUpperAscii();
1329 		aStr.Replace(0, 1, aTmpStr);
1330 	}
1331 	return aStr;
1332 }
1333 
1334 SdrViewContext SdrView::GetContext() const
1335 {
1336 	if( IsGluePointEditMode() )
1337 		return SDRCONTEXT_GLUEPOINTEDIT;
1338 
1339 	const sal_uIntPtr nMarkAnz = GetMarkedObjectCount();
1340 
1341 	if( HasMarkablePoints() && !IsFrameHandles() )
1342 	{
1343 		sal_Bool bPath=sal_True;
1344 		for( sal_uIntPtr nMarkNum = 0; nMarkNum < nMarkAnz && bPath; nMarkNum++ )
1345 			if (!GetMarkedObjectByIndex(nMarkNum)->ISA(SdrPathObj))
1346 				bPath=sal_False;
1347 
1348 		if( bPath )
1349 			return SDRCONTEXT_POINTEDIT;
1350 	}
1351 
1352 	if( GetMarkedObjectCount() )
1353 	{
1354 		sal_Bool bGraf = sal_True, bMedia = sal_True, bTable = sal_True;
1355 
1356 		for( sal_uIntPtr nMarkNum = 0; nMarkNum < nMarkAnz && ( bGraf || bMedia ); nMarkNum++ )
1357 		{
1358 			const SdrObject* pMarkObj = GetMarkedObjectByIndex( nMarkNum );
1359 			DBG_ASSERT( pMarkObj, "SdrView::GetContext(), null pointer in mark list!" );
1360 
1361 			if( !pMarkObj )
1362 				continue;
1363 
1364 			if( !pMarkObj->ISA( SdrGrafObj ) )
1365 				bGraf = sal_False;
1366 
1367 			if( !pMarkObj->ISA( SdrMediaObj ) )
1368 				bMedia = sal_False;
1369 
1370 			if( !pMarkObj->ISA( ::sdr::table::SdrTableObj ) )
1371 				bTable = sal_False;
1372 		}
1373 
1374 		if( bGraf )
1375 			return SDRCONTEXT_GRAPHIC;
1376 		else if( bMedia )
1377 			return SDRCONTEXT_MEDIA;
1378 		else if( bTable )
1379 			return SDRCONTEXT_TABLE;
1380 	}
1381 
1382 	return SDRCONTEXT_STANDARD;
1383 }
1384 
1385 void SdrView::MarkAll()
1386 {
1387 	if (IsTextEdit()) {
1388 		GetTextEditOutlinerView()->SetSelection(ESelection(0,0,0xFFFF,0xFFFF));
1389 #ifdef DBG_UTIL
1390 		if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1391 #endif
1392 	} else if (IsGluePointEditMode()) MarkAllGluePoints();
1393 	else if (HasMarkablePoints()) MarkAllPoints();
1394 	else MarkAllObj();
1395 }
1396 
1397 void SdrView::UnmarkAll()
1398 {
1399 	if (IsTextEdit()) {
1400 		ESelection eSel=GetTextEditOutlinerView()->GetSelection();
1401 		eSel.nStartPara=eSel.nEndPara;
1402 		eSel.nStartPos=eSel.nEndPos;
1403 		GetTextEditOutlinerView()->SetSelection(eSel);
1404 #ifdef DBG_UTIL
1405 		if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
1406 #endif
1407 	} else if (HasMarkedGluePoints()) UnmarkAllGluePoints();
1408 	else if (HasMarkedPoints()) UnmarkAllPoints(); // ! Marked statt Markable !
1409 	else UnmarkAllObj();
1410 }
1411 
1412 sal_Bool SdrView::IsAllMarked() const
1413 {
1414 	if (IsTextEdit()) {
1415 		return ImpIsTextEditAllSelected();
1416 	}
1417 	if (IsGluePointEditMode()) {
1418 		sal_uIntPtr nAnz=GetMarkableGluePointCount();
1419 		return nAnz!=0 && nAnz==GetMarkedGluePointCount();
1420 	}
1421 	if (HasMarkedPoints()) {
1422 		sal_uIntPtr nAnz=GetMarkablePointCount();
1423 		return nAnz!=0 && nAnz==GetMarkedPointCount();
1424 	}
1425 	sal_uIntPtr nAnz=GetMarkableObjCount();
1426 	return nAnz!=0 && nAnz == GetMarkedObjectCount();
1427 }
1428 
1429 sal_Bool SdrView::IsMarkPossible() const
1430 {
1431 	if(IsTextEdit())
1432 	{
1433 		return SdrTextObj::HasTextImpl( pTextEditOutliner );
1434 	}
1435 
1436 	if(IsGluePointEditMode())
1437 	{
1438 		return HasMarkableGluePoints();
1439 	}
1440 
1441 	if(HasMarkedPoints())
1442 	{
1443 		return HasMarkablePoints();
1444 	}
1445 
1446 	return HasMarkableObj();
1447 }
1448 
1449 sal_Bool SdrView::IsAllMarkPrevNextPossible() const
1450 {
1451 	if (IsTextEdit()) {
1452 		return sal_False;
1453 	}
1454 	if (IsGluePointEditMode()) {
1455 		return HasMarkableGluePoints();
1456 	}
1457 	if (HasMarkedPoints()) {
1458 		return HasMarkablePoints();
1459 	}
1460 	return HasMarkableObj();
1461 }
1462 
1463 sal_Bool SdrView::MarkNext(sal_Bool bPrev)
1464 {
1465 	if (IsTextEdit()) {
1466 		return sal_False;
1467 	}
1468 	if (IsGluePointEditMode() && HasMarkedGluePoints()) {
1469 		return MarkNextGluePoint(bPrev);
1470 	}
1471 	if (HasMarkedPoints()) {
1472 		return MarkNextPoint(bPrev);
1473 	}
1474 	return MarkNextObj(bPrev);
1475 }
1476 
1477 sal_Bool SdrView::MarkNext(const Point& rPnt, sal_Bool bPrev)
1478 {
1479 	if (IsTextEdit()) {
1480 		return sal_False;
1481 	}
1482 	if (IsGluePointEditMode() && HasMarkedGluePoints()) {
1483 		//return MarkNextGluePoint(rPnt,bPrev); fehlende Implementation !!!
1484 	}
1485 	if (HasMarkedPoints()) {
1486 		//return MarkNextPoint(rPnt,bPrev);     fehlende Implementation !!!
1487 	}
1488 	return MarkNextObj(rPnt,-2,bPrev);
1489 }
1490 
1491 const Rectangle& SdrView::GetMarkedRect() const
1492 {
1493 	if (IsGluePointEditMode() && HasMarkedGluePoints()) {
1494 		return GetMarkedGluePointsRect();
1495 	}
1496 	if (HasMarkedPoints()) {
1497 		return GetMarkedPointsRect();
1498 	}
1499 	return GetMarkedObjRect();
1500 }
1501 
1502 void SdrView::SetMarkedRect(const Rectangle& rRect)
1503 {
1504 	if (IsGluePointEditMode() && HasMarkedGluePoints()) {
1505 		//SetMarkedGluePointsRect(rRect); fehlende Implementation !!!
1506 	} else if (HasMarkedPoints()) {
1507 		//SetMarkedPointsRect(rRect);     fehlende Implementation !!!
1508 	} else SetMarkedObjRect(rRect);
1509 }
1510 
1511 void SdrView::DeleteMarked()
1512 {
1513 	if (IsTextEdit())
1514 	{
1515 		SdrObjEditView::KeyInput(KeyEvent(0,KeyCode(KEYFUNC_DELETE)),pTextEditWin);
1516 	}
1517 	else
1518 	{
1519 		if( mxSelectionController.is() && mxSelectionController->DeleteMarked() )
1520 		{
1521 			// action already performed by current selection controller, do nothing
1522 		}
1523 		else if (IsGluePointEditMode() && HasMarkedGluePoints())
1524 		{
1525 			DeleteMarkedGluePoints();
1526 		}
1527 		else if (GetContext()==SDRCONTEXT_POINTEDIT && HasMarkedPoints())
1528 		{
1529 			DeleteMarkedPoints();
1530 		}
1531 		else
1532 		{
1533 			DeleteMarkedObj();
1534 		}
1535 	}
1536 }
1537 
1538 sal_Bool SdrView::BegMark(const Point& rPnt, sal_Bool bAddMark, sal_Bool bUnmark)
1539 {
1540 	if (bUnmark) bAddMark=sal_True;
1541 	if (IsGluePointEditMode()) {
1542 		if (!bAddMark) UnmarkAllGluePoints();
1543 		return BegMarkGluePoints(rPnt,bUnmark);
1544 	} else if (HasMarkablePoints()) {
1545 		if (!bAddMark) UnmarkAllPoints();
1546 		return BegMarkPoints(rPnt,bUnmark);
1547 	} else {
1548 		if (!bAddMark) UnmarkAllObj();
1549 		return BegMarkObj(rPnt,bUnmark);
1550 	}
1551 }
1552 
1553 sal_Bool SdrView::IsDeleteMarkedPossible() const
1554 {
1555 	if (IsReadOnly()) return sal_False;
1556 	if (IsTextEdit()) return sal_True;
1557 	if (IsGluePointEditMode() && HasMarkedGluePoints()) return sal_True;
1558 	if (HasMarkedPoints()) return sal_True;
1559 	return IsDeleteMarkedObjPossible();
1560 }
1561 
1562 void SdrView::ConfigurationChanged( ::utl::ConfigurationBroadcaster*p, sal_uInt32 nHint)
1563 {
1564 	onAccessibilityOptionsChanged();
1565  	SdrCreateView::ConfigurationChanged(p, nHint);
1566 }
1567 
1568 SvtAccessibilityOptions& SdrView::getAccessibilityOptions()
1569 {
1570 	return maAccessibilityOptions;
1571 }
1572 
1573 /** method is called whenever the global SvtAccessibilityOptions is changed */
1574 void SdrView::onAccessibilityOptionsChanged()
1575 {
1576 }
1577 
1578 void SdrView::SetMasterPagePaintCaching(sal_Bool bOn)
1579 {
1580 	if(mbMasterPagePaintCaching != bOn)
1581 	{
1582 		mbMasterPagePaintCaching = bOn;
1583 
1584 		// reset at all SdrPageWindow's
1585 		SdrPageView* pPageView = GetSdrPageView();
1586 
1587 		if(pPageView)
1588 		{
1589 			for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1590 			{
1591 				SdrPageWindow* pPageWindow = pPageView->GetPageWindow(b);
1592 				DBG_ASSERT(pPageWindow, "SdrView::SetMasterPagePaintCaching: Corrupt SdrPageWindow list (!)");
1593 
1594 				// force deletion of ObjectContact, so at re-display all VOCs
1595 				// will be re-created with updated flag setting
1596 				pPageWindow->ResetObjectContact();
1597 			}
1598 
1599 			// force redraw of this view
1600 			pPageView->InvalidateAllWin();
1601 		}
1602 	}
1603 }
1604 // eof
1605