xref: /aoo41x/main/sd/source/ui/func/fusel.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_sd.hxx"
30 
31 
32 #include "fusel.hxx"
33 #include <vos/process.hxx>
34 #include <basic/sbstar.hxx>
35 #include <svx/svdpagv.hxx>
36 #include <svx/svdogrp.hxx>
37 #include <svx/polysc3d.hxx>
38 #include "drawview.hxx"
39 #include <svtools/imapobj.hxx>
40 #include <svl/urihelper.hxx>
41 #include <unotools/localfilehelper.hxx>
42 #include <svx/svxids.hrc>
43 #include <svx/xfillit0.hxx>
44 #include <sfx2/app.hxx>
45 #include <sfx2/viewfrm.hxx>
46 #include <svl/aeitem.hxx>
47 #include <svl/stritem.hxx>
48 #include <svl/intitem.hxx>
49 #include <sfx2/dispatch.hxx>
50 #include <tools/urlobj.hxx>
51 #include <sfx2/docfile.hxx>
52 #include <tools/debug.hxx>
53 #include <editeng/eeitem.hxx>
54 #include <editeng/flditem.hxx>
55 
56 #include <svx/svdotable.hxx>
57 
58 #include "app.hrc"
59 #include "strings.hrc"
60 #include "res_bmp.hrc"
61 #include "GraphicDocShell.hxx"
62 #include "app.hxx"
63 #include "DrawDocShell.hxx"
64 #include "stlpool.hxx"
65 #include "anmdef.hxx"
66 #include "anminfo.hxx"
67 #include "fudraw.hxx"
68 #include "ViewShell.hxx"
69 #include "ViewShellBase.hxx"
70 #ifndef SD_FRAMW_VIEW_HXX
71 #include "FrameView.hxx"
72 #endif
73 #include "View.hxx"
74 #ifndef SD_WINDOW_SHELL_HXX
75 #include "Window.hxx"
76 #endif
77 #include "drawdoc.hxx"
78 #include "sdpage.hxx"
79 #include "DrawViewShell.hxx"
80 #include "ToolBarManager.hxx"
81 #include "pgjump.hxx"
82 #include <svx/globl3d.hxx>
83 #include "Client.hxx"
84 
85 #include "slideshow.hxx"
86 
87 // #108981#
88 #include <svx/svdundo.hxx>
89 #include <avmedia/mediawindow.hxx>
90 
91 #include <svx/sdrhittesthelper.hxx>
92 
93 using namespace ::com::sun::star;
94 
95 namespace sd {
96 
97 TYPEINIT1( FuSelection, FuDraw );
98 
99 /*************************************************************************
100 |*
101 |* Konstruktor
102 |*
103 \************************************************************************/
104 
105 FuSelection::FuSelection (
106     ViewShell* pViewSh,
107     ::sd::Window* pWin,
108     ::sd::View* pView,
109     SdDrawDocument* pDoc,
110     SfxRequest& rReq)
111     : FuDraw(pViewSh, pWin, pView, pDoc, rReq),
112       bTempRotation(sal_False),
113       bSelectionChanged(sal_False),
114       bHideAndAnimate(sal_False),
115       pHdl(NULL),
116       bSuppressChangesOfSelection(sal_False),
117       bMirrorSide0(sal_False),
118       nEditMode(SID_BEZIER_MOVE),
119       pWaterCanCandidate(NULL)
120 {
121 }
122 
123 FunctionReference FuSelection::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
124 {
125 	FunctionReference xFunc( new FuSelection( pViewSh, pWin, pView, pDoc, rReq ) );
126 	xFunc->DoExecute(rReq);
127 	return xFunc;
128 }
129 
130 void FuSelection::DoExecute( SfxRequest& rReq )
131 {
132 	FuDraw::DoExecute( rReq );
133 
134     // Objektbar auswaehlen
135     SelectionHasChanged();
136 }
137 
138 /*************************************************************************
139 |*
140 |* Destruktor
141 |*
142 \************************************************************************/
143 
144 FuSelection::~FuSelection()
145 {
146 	mpView->UnmarkAllPoints();
147 	mpView->ResetCreationActive();
148 
149 	if ( mpView->GetDragMode() != SDRDRAG_MOVE )
150 	{
151 		mpView->SetDragMode(SDRDRAG_MOVE);
152 	}
153 }
154 
155 /*************************************************************************
156 |*
157 |* MouseButtonDown-event
158 |*
159 \************************************************************************/
160 
161 sal_Bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
162 {
163     // Hack fuer #?????#
164     bHideAndAnimate = sal_False;
165 
166 	pHdl = NULL;
167 	sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt);
168     sal_Bool bWaterCan = SD_MOD()->GetWaterCan();
169 	const bool bReadOnly = mpDocSh->IsReadOnly();
170 	// When the right mouse button is pressed then only select objects
171 	// (and deselect others) as a preparation for showing the context
172 	// menu.
173 	const bool bSelectionOnly = rMEvt.IsRight();
174 
175 	bMBDown = sal_True;
176     bSelectionChanged = sal_False;
177 
178 	if ( mpView->IsAction() )
179 	{
180 		if ( rMEvt.IsRight() )
181 			mpView->BckAction();
182 		return sal_True;
183 	}
184 
185 	sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
186 	sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
187 
188     // The following code is executed for right clicks as well as for left
189     // clicks in order to modify the selection for the right button as a
190     // preparation for the context menu.  The functions BegMarkObject() and
191     // BegDragObject(), however, are not called for right clicks because a)
192     // it makes no sense and b) to have IsAction() return sal_False when called
193     // from Command() which is a prerequisite for the context menu.
194     if ((rMEvt.IsLeft() || rMEvt.IsRight())
195 		&& !mpView->IsAction()
196 		&& (mpView->IsFrameDragSingles() || !mpView->HasMarkablePoints()))
197     {
198         /******************************************************************
199         * KEIN BEZIER_EDITOR
200         ******************************************************************/
201         mpWindow->CaptureMouse();
202         pHdl = mpView->PickHandle(aMDPos);
203         SdrObject* pObj;
204         SdrPageView* pPV;
205 
206         long nAngle0  = GetAngle(aMDPos - mpView->GetRef1());
207         nAngle0 -= 27000;
208         nAngle0 = NormAngle360(nAngle0);
209         bMirrorSide0 = sal_Bool (nAngle0 < 18000L);
210 
211         if (!pHdl && mpView->Is3DRotationCreationActive())
212         {
213             /******************************************************************
214             * Wenn 3D-Rotationskoerper erstellt werden sollen, jetzt
215             * die Erstellung beenden
216             ******************************************************************/
217             bSuppressChangesOfSelection = sal_True;
218 			if(mpWindow)
219 				mpWindow->EnterWait();
220             mpView->End3DCreation();
221             bSuppressChangesOfSelection = sal_False;
222             mpView->ResetCreationActive();
223 			if(mpWindow)
224 				mpWindow->LeaveWait();
225         }
226 
227 		sal_Bool bTextEdit = sal_False;
228         SdrViewEvent aVEvt;
229 		SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
230 
231 		if ( eHit == SDRHIT_TEXTEDITOBJ && ( mpViewShell->GetFrameView()->IsQuickEdit() || dynamic_cast< sdr::table::SdrTableObj* >( aVEvt.pObj ) != NULL ) )
232 		{
233 			bTextEdit = sal_True;
234 		}
235 
236         if(!bTextEdit
237 			&& !mpDocSh->IsReadOnly()
238 			&& ((mpView->IsMarkedHit(aMDPos, nHitLog) && !rMEvt.IsShift() && !rMEvt.IsMod2()) || pHdl != NULL)
239 			&& (rMEvt.GetClicks() != 2)
240 			)
241         {
242 			if (!pHdl && mpView->Is3DRotationCreationActive())
243 			{
244 				// Wechsel Rotationskoerper -> Selektion
245 				mpView->ResetCreationActive();
246 			}
247 			else if (bWaterCan)
248             {
249                 // Remember the selected object for proper handling in
250                 // MouseButtonUp().
251                 pWaterCanCandidate = pickObject (aMDPos);
252             }
253             else
254 			{
255 				// Handle oder markiertes Objekt getroffen
256 				bFirstMouseMove = sal_True;
257 				aDragTimer.Start();
258 			}
259 
260             if ( ! rMEvt.IsRight())
261                 mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
262 			bReturn = sal_True;
263         }
264         else
265         {
266             if (!rMEvt.IsMod2() && mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO))
267             {
268                 mpView->BegMacroObj(aMDPos, nHitLog, pObj, pPV, mpWindow);
269                 bReturn = sal_True;
270             }
271             else if ( bTextEdit )
272             {
273                 sal_uInt16 nSdrObjKind = aVEvt.pObj->GetObjIdentifier();
274 
275                 if (aVEvt.pObj->GetObjInventor() == SdrInventor &&
276                     (nSdrObjKind == OBJ_TEXT ||
277                      nSdrObjKind == OBJ_TITLETEXT ||
278                      nSdrObjKind == OBJ_OUTLINETEXT ||
279                      !aVEvt.pObj->IsEmptyPresObj()))
280                 {
281                     // Seamless Editing: Verzweigen zur Texteingabe
282 					if (!rMEvt.IsShift())
283 						mpView->UnmarkAll();
284 
285                     SfxUInt16Item aItem(SID_TEXTEDIT, 1);
286                     mpViewShell->GetViewFrame()->GetDispatcher()->
287                     Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON |
288                             SFX_CALLMODE_RECORD, &aItem, 0L);
289 					return bReturn; // VORSICHT, durch den synchronen Slot ist das objekt jetzt geloescht
290                 }
291             }
292 			else if ( !rMEvt.IsMod2() && rMEvt.GetClicks() == 1 &&
293 			          aVEvt.eEvent == SDREVENT_EXECUTEURL )
294 	 		{
295 	            mpWindow->ReleaseMouse();
296                 SfxStringItem aStrItem(SID_FILE_NAME, aVEvt.pURLField->GetURL());
297                 SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
298                 SfxBoolItem aBrowseItem( SID_BROWSE, sal_True );
299                 SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
300 				mpWindow->ReleaseMouse();
301 
302 				if (rMEvt.IsMod1())
303 				{
304 					// Im neuen Frame oeffnen
305                 	pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
306                     		    &aStrItem, &aBrowseItem, &aReferer, 0L);
307 				}
308 				else
309 				{
310 					// Im aktuellen Frame oeffnen
311 					SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
312                 	pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
313                     		    &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
314 				}
315 
316 				bReturn = sal_True;
317 			}
318             else if(!rMEvt.IsMod2()
319 				&& mpViewShell->ISA(DrawViewShell)
320 				)
321             {
322 				if(mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER))
323 				{
324 					// Animate object when not just selecting.
325 					if ( ! bSelectionOnly)
326 						bReturn = AnimateObj(pObj, aMDPos);
327 
328 					if (!bReturn && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene)))
329 					{
330 						if(rMEvt.GetClicks() == 1)
331 						{
332 							// In die Gruppe hineinschauen
333 							if (mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP))
334 								bReturn = AnimateObj(pObj, aMDPos);
335 						}
336 						else if( !bReadOnly && rMEvt.GetClicks() == 2)
337 						{
338 							// Neu: Doppelklick auf selektiertes Gruppenobjekt
339 							// Gruppe betreten
340 							if ( ! bSelectionOnly
341 								&& pObj
342 								&& pObj->GetPage() == pPV->GetPage())
343 								bReturn = pPV->EnterGroup(pObj);
344 						}
345 					}
346 				}
347 
348 				// #i71727# replaced else here with two possibilities, once the original else (!pObj)
349 				// and also ignoring the found object when it's on a masterpage
350 				if(!pObj || (pObj->GetPage() && pObj->GetPage()->IsMasterPage()))
351 				{
352 					if(mpView->IsGroupEntered() && 2 == rMEvt.GetClicks())
353 					{
354 						// New: double click on empty space/on obj on MasterPage, leave group
355 						mpView->LeaveOneGroup();
356 						bReturn = sal_True;
357 					}
358 				}
359 			}
360 
361             if (!bReturn)
362             {
363                 if (bWaterCan)
364                 {
365                     if ( ! (rMEvt.IsShift() || rMEvt.IsMod2()))
366                     {
367                         // Find the object under the current mouse position
368                         // and store it for the MouseButtonUp() method to
369                         // evaluate.
370                         pWaterCanCandidate = pickObject (aMDPos);
371                     }
372                 }
373                 else
374                 {
375                     bReturn = sal_True;
376                     sal_Bool bDeactivateOLE = sal_False;
377 
378                     if ( !rMEvt.IsShift() && !rMEvt.IsMod2() )
379                     {
380                         OSL_ASSERT (mpViewShell->GetViewShell()!=NULL);
381                         Client* pIPClient = static_cast<Client*>(
382                             mpViewShell->GetViewShell()->GetIPClient());
383 
384                         if (pIPClient && pIPClient->IsObjectInPlaceActive())
385                         {
386                             // OLE-Objekt wird im nachfolgenden UnmarkAll() deaktiviert
387                             bDeactivateOLE = sal_True;
388                         }
389 
390                         mpView->UnmarkAll();
391                     }
392 
393                     sal_Bool bMarked = sal_False;
394 
395                     if ( !rMEvt.IsMod1() && !bDeactivateOLE)
396                     {
397                         if ( rMEvt.IsMod2() )
398                         {
399                             bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift() );
400                         }
401                         else
402                         {
403                             sal_Bool bToggle = sal_False;
404 
405                             if (rMEvt.IsShift() && mpView->GetMarkedObjectList().GetMarkCount() > 1)
406                             {
407                                 // Bei Einfachselektion kein Toggle
408                                 bToggle = sal_True;
409                             }
410 
411                             bMarked = mpView->MarkObj(aMDPos, nHitLog, bToggle, sal_False);
412                         }
413                     }
414 
415                     if( !bDeactivateOLE )
416                     {
417                         if ( !bReadOnly &&
418                              bMarked                                                   &&
419                              (!rMEvt.IsShift() || mpView->IsMarkedHit(aMDPos, nHitLog)))
420                         {
421                             /**********************************************************
422                              * Objekt verschieben
423                              **********************************************************/
424                             aDragTimer.Start();
425 
426                             pHdl=mpView->PickHandle(aMDPos);
427                             if ( ! rMEvt.IsRight())
428                                 mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
429                         }
430                         else
431                         {
432                             /**********************************************************
433                              * Objekt selektieren
434                              **********************************************************/
435                             if ( ! rMEvt.IsRight())
436                                 mpView->BegMarkObj(aMDPos);
437                         }
438                     }
439 
440 					if( bMarked && bTempRotation && (nSlotId == SID_OBJECT_ROTATE) && !rMEvt.IsShift() && (rMEvt.GetClicks() != 2) )
441 					{
442 						nSlotId = SID_OBJECT_SELECT;
443 						Activate();
444 					}
445 				}
446             }
447         }
448     }
449     else if ( !bReadOnly
450 			  && (rMEvt.IsLeft() || rMEvt.IsRight())
451 			  && !mpView->IsAction())
452     {
453         /**********************************************************************
454         * BEZIER-EDITOR
455         **********************************************************************/
456         mpWindow->CaptureMouse();
457         SdrViewEvent aVEvt;
458         SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
459 
460         if (eHit == SDRHIT_HANDLE && aVEvt.pHdl->GetKind() == HDL_BWGT)
461         {
462             /******************************************************************
463             * Handle draggen
464             ******************************************************************/
465             if ( ! rMEvt.IsRight())
466                 mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
467         }
468         else if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT)
469         {
470             /******************************************************************
471             * Klebepunkt einfuegen
472             ******************************************************************/
473             mpView->BegInsObjPoint(aMDPos, rMEvt.IsMod1());
474         }
475         else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1())
476         {
477             /******************************************************************
478             * Klebepunkt selektieren
479             ******************************************************************/
480             if (!rMEvt.IsShift())
481                 mpView->UnmarkAllPoints();
482 
483             if ( ! rMEvt.IsRight())
484                 mpView->BegMarkPoints(aMDPos);
485         }
486         else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2())
487         {
488             /******************************************************************
489             * Objekt verschieben
490             ******************************************************************/
491             if ( ! rMEvt.IsRight())
492                 mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, NULL, nDrgLog);
493         }
494         else if (eHit == SDRHIT_HANDLE)
495         {
496             /******************************************************************
497             * Klebepunkt selektieren
498             ******************************************************************/
499             if (!mpView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift())
500             {
501                 if (!rMEvt.IsShift())
502                 {
503                     mpView->UnmarkAllPoints();
504                     pHdl = mpView->PickHandle(aMDPos);
505                 }
506                 else
507                 {
508                     if (mpView->IsPointMarked(*aVEvt.pHdl))
509                     {
510                         mpView->UnmarkPoint(*aVEvt.pHdl);
511                         pHdl = NULL;
512                     }
513                     else
514                     {
515                         pHdl = mpView->PickHandle(aMDPos);
516                     }
517                 }
518 
519                 if (pHdl)
520                 {
521                     mpView->MarkPoint(*pHdl);
522                     if ( ! rMEvt.IsRight())
523                         mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
524                 }
525             }
526 			else
527 			{
528 				// #90239# point IS marked and NO shift is pressed. Start
529 				// dragging of selected point(s)
530 				pHdl = mpView->PickHandle(aMDPos);
531 				if(pHdl)
532                     if ( ! rMEvt.IsRight())
533                         mpView->BegDragObj(aMDPos, (OutputDevice*)NULL, pHdl, nDrgLog);
534 			}
535         }
536         else
537         {
538             /******************************************************************
539             * Objekt selektieren oder draggen
540             ******************************************************************/
541             if (!rMEvt.IsShift() && !rMEvt.IsMod2() && eHit == SDRHIT_UNMARKEDOBJECT)
542             {
543                mpView->UnmarkAllObj();
544             }
545 
546             sal_Bool bMarked = sal_False;
547 
548             if (!rMEvt.IsMod1())
549             {
550                 if (rMEvt.IsMod2())
551                 {
552                     bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift());
553                 }
554                 else
555                 {
556                     bMarked = mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift(), sal_False);
557                 }
558             }
559 
560             if (bMarked &&
561                 (!rMEvt.IsShift() || eHit == SDRHIT_MARKEDOBJECT))
562             {
563                 // Objekt verschieben
564                 if ( ! rMEvt.IsRight())
565                     mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
566             }
567             else if (mpView->AreObjectsMarked())
568             {
569                 /**************************************************************
570                 * Klebepunkt selektieren
571                 **************************************************************/
572                 if (!rMEvt.IsShift())
573                     mpView->UnmarkAllPoints();
574 
575                 if ( ! rMEvt.IsRight())
576                     mpView->BegMarkPoints(aMDPos);
577             }
578             else
579             {
580                 /**************************************************************
581                 * Objekt selektieren
582                 **************************************************************/
583                 if ( ! rMEvt.IsRight())
584                     mpView->BegMarkObj(aMDPos);
585             }
586 
587             ForcePointer(&rMEvt);
588         }
589     }
590 
591 	if (!bIsInDragMode)
592 	{
593 		ForcePointer(&rMEvt);
594 	}
595 
596 	return bReturn;
597 }
598 
599 /*************************************************************************
600 |*
601 |* MouseMove-event
602 |*
603 \************************************************************************/
604 
605 sal_Bool FuSelection::MouseMove(const MouseEvent& rMEvt)
606 {
607 	sal_Bool bReturn = FuDraw::MouseMove(rMEvt);
608 
609     if (aDragTimer.IsActive())
610 	{
611         if(bFirstMouseMove)
612         {
613 			bFirstMouseMove = sal_False;
614         }
615 		else
616         {
617             aDragTimer.Stop();
618         }
619 	}
620 
621     if (mpView->IsAction())
622 	{
623 		Point aPix(rMEvt.GetPosPixel());
624 		Point aPnt(mpWindow->PixelToLogic(aPix));
625 
626 		ForceScroll(aPix);
627 
628         if (mpView->IsInsObjPoint())
629         {
630             mpView->MovInsObjPoint(aPnt);
631         }
632         else
633         {
634             mpView->MovAction(aPnt);
635         }
636     }
637 
638 	ForcePointer(&rMEvt);
639 
640 	return (bReturn);
641 }
642 
643 /*************************************************************************
644 |*
645 |* MouseButtonUp-event
646 |*
647 \************************************************************************/
648 
649 sal_Bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
650 {
651     sal_Bool bReturn = sal_False;
652 	// When the right mouse button is pressed then only select objects
653 	// (and deselect others) as a preparation for showing the context
654 	// menu.
655 	const bool bSelectionOnly = rMEvt.IsRight();
656 
657     if (bHideAndAnimate)
658     {
659         // Animation laeuft noch -> sofort returnieren
660         bHideAndAnimate = sal_False;
661         pHdl = NULL;
662         mpWindow->ReleaseMouse();
663         return(sal_True);
664     }
665 
666 	if (aDragTimer.IsActive() )
667 	{
668 		aDragTimer.Stop();
669 		bIsInDragMode = sal_False;
670 	}
671 
672 	if( !mpView )
673 		return (sal_False);
674 
675     Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
676     sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
677     sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
678 
679     if (mpView->IsFrameDragSingles() || !mpView->HasMarkablePoints())
680     {
681         /**********************************************************************
682         * KEIN BEZIER_EDITOR
683         **********************************************************************/
684         if ( mpView->IsDragObj() )
685         {
686             /******************************************************************
687             * Objekt wurde verschoben
688             ******************************************************************/
689             FrameView* pFrameView = mpViewShell->GetFrameView();
690             sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
691 
692             if (bDragWithCopy)
693             {
694                 bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True);
695             }
696 
697             mpView->SetDragWithCopy(bDragWithCopy);
698             mpView->EndDragObj( mpView->IsDragWithCopy() );
699 
700             mpView->ForceMarkedToAnotherPage();
701 
702             if (!rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() &&
703                 !bSelectionChanged                   &&
704                 Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
705                 Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
706             {
707                 /**************************************************************
708                 * Toggle zw. Selektion und Rotation
709                 **************************************************************/
710                 SdrObject* pSingleObj = NULL;
711                 sal_uLong nMarkCount = mpView->GetMarkedObjectList().GetMarkCount();
712 
713                 if (nMarkCount==1)
714                 {
715                     pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
716                 }
717 
718                 if (nSlotId == SID_OBJECT_SELECT
719 					&& mpView->IsRotateAllowed()
720 
721 					&& (rMEvt.GetClicks() != 2)
722 					&& (mpViewShell->GetFrameView()->IsClickChangeRotation()
723 						|| (pSingleObj
724 							&& pSingleObj->GetObjInventor()==E3dInventor))
725 					&& ! bSelectionOnly)
726 
727                 {
728                     bTempRotation = sal_True;
729                     nSlotId = SID_OBJECT_ROTATE;
730                     Activate();
731                 }
732                 else if (nSlotId == SID_OBJECT_ROTATE)
733                 {
734                     nSlotId = SID_OBJECT_SELECT;
735                     Activate();
736                 }
737             }
738             else if (nSlotId == SID_CONVERT_TO_3D_LATHE)
739             {
740                 if (!pHdl)
741                 {
742                     bSuppressChangesOfSelection = sal_True;
743                     mpView->Start3DCreation();
744                     bSuppressChangesOfSelection = sal_False;
745                 }
746                 else if (pHdl->GetKind() != HDL_MIRX &&
747                          pHdl->GetKind() != HDL_REF1 &&
748                          pHdl->GetKind() != HDL_REF2 && mpView->Is3DRotationCreationActive())
749                 {
750                     /*********************************************************
751                     * Wenn 3D-Rotationskoerper erstellt werden sollen, jetzt
752                     * die Erstellung beenden
753                     **********************************************************/
754                      long nAngle1  = GetAngle(aPnt - mpView->GetRef1());
755                      nAngle1 -= 27000;
756                      nAngle1 = NormAngle360(nAngle1);
757                      sal_Bool bMirrorSide1 = sal_Bool (nAngle1 < 18000L);
758 
759                      if (bMirrorSide0 != bMirrorSide1)
760                      {
761                          bSuppressChangesOfSelection = sal_True;
762 						if(mpWindow)
763 							mpWindow->EnterWait();
764                          mpView->End3DCreation();
765                          bSuppressChangesOfSelection = sal_False;
766                          nSlotId = SID_OBJECT_SELECT;
767 						if(mpWindow)
768 							mpWindow->LeaveWait();
769                          Activate();
770                     }
771                 }
772             }
773         }
774         else if (rMEvt.IsMod1()
775 			&& !rMEvt.IsMod2()
776 			&& Abs(aPnt.X() - aMDPos.X()) < nDrgLog
777 			&& Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
778         {
779             // Gruppe betreten
780             mpView->MarkObj(aPnt, nHitLog, rMEvt.IsShift(), rMEvt.IsMod1());
781         }
782 
783         if (mpView->IsAction() )
784         {
785             mpView->EndAction();
786         }
787 
788         if( SD_MOD()->GetWaterCan() )
789         {
790             if( rMEvt.IsRight() )
791             {
792                 // Bei rechter Maustaste wird im Giesskannenmodus ein Undo ausgefuehrt
793                 mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_UNDO, SFX_CALLMODE_ASYNCHRON );
794             }
795             else if (pWaterCanCandidate != NULL)
796             {
797                 // Is the candiate object still under the mouse?
798                 if (pickObject (aPnt) == pWaterCanCandidate)
799                 {
800                     SdStyleSheetPool* pPool = static_cast<SdStyleSheetPool*>(
801                         mpDocSh->GetStyleSheetPool());
802                     if (pPool != NULL)
803                     {
804                         SfxStyleSheet* pStyleSheet = static_cast<SfxStyleSheet*>(
805                             pPool->GetActualStyleSheet());
806                         if (pStyleSheet != NULL && mpView->IsUndoEnabled() )
807                         {
808 							// #108981#
809 							// Added UNDOs for the WaterCan mode. This was never done in
810 							// the past, thus it was missing all the time.
811 							SdrUndoAction* pUndoAttr = mpDoc->GetSdrUndoFactory().CreateUndoAttrObject(*pWaterCanCandidate, sal_True, sal_True);
812 							mpView->BegUndo(pUndoAttr->GetComment());
813 							mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoGeoObject(*pWaterCanCandidate));
814 							mpView->AddUndo(pUndoAttr);
815 
816 							pWaterCanCandidate->SetStyleSheet (pStyleSheet, sal_False);
817 
818 							// #108981#
819 							mpView->EndUndo();
820                         }
821                     }
822                 }
823             }
824             // else when there has been no object under the mouse when the
825             // button was pressed then nothing happens even when there is
826             // one now.
827         }
828 
829         sal_uInt16 nClicks = rMEvt.GetClicks();
830 
831         if (nClicks == 2 && rMEvt.IsLeft() && bMBDown &&
832             !rMEvt.IsMod1() && !rMEvt.IsShift() )
833         {
834             DoubleClick(rMEvt);
835         }
836 
837         bMBDown = sal_False;
838 
839         ForcePointer(&rMEvt);
840         pHdl = NULL;
841         mpWindow->ReleaseMouse();
842         SdrObject* pSingleObj = NULL;
843         sal_uLong nMarkCount = mpView->GetMarkedObjectList().GetMarkCount();
844 
845         if (nMarkCount==1)
846         {
847             pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
848         }
849 
850         if ( (nSlotId != SID_OBJECT_SELECT && nMarkCount==0)                    ||
851              ( mpView->GetDragMode() == SDRDRAG_CROOK &&
852               !mpView->IsCrookAllowed( mpView->IsCrookNoContortion() ) ) ||
853              ( mpView->GetDragMode() == SDRDRAG_SHEAR &&
854               !mpView->IsShearAllowed() && !mpView->IsDistortAllowed() ) ||
855              ( nSlotId==SID_CONVERT_TO_3D_LATHE && pSingleObj &&
856               (pSingleObj->GetObjInventor() != SdrInventor         ||
857                pSingleObj->GetObjIdentifier() == OBJ_MEASURE) ) )
858         {
859 			bReturn = sal_True;
860 	        ForcePointer(&rMEvt);
861     	    pHdl = NULL;
862         	mpWindow->ReleaseMouse();
863 	        FuDraw::MouseButtonUp(rMEvt);
864 			mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SYNCHRON);
865 			return bReturn; // VORSICHT, durch den synchronen Slot ist das objekt jetzt geloescht
866 		}
867 
868         FuDraw::MouseButtonUp(rMEvt);
869     }
870     else
871     {
872         /**********************************************************************
873         * BEZIER_EDITOR
874         **********************************************************************/
875         if ( mpView->IsAction() )
876         {
877             if ( mpView->IsInsObjPoint() )
878             {
879                 mpView->EndInsObjPoint(SDRCREATE_FORCEEND);
880             }
881             else if ( mpView->IsDragObj() )
882             {
883                 FrameView* pFrameView = mpViewShell->GetFrameView();
884                 sal_Bool bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
885 
886                 if (bDragWithCopy)
887                 {
888                     bDragWithCopy = !mpView->IsPresObjSelected(sal_False, sal_True);
889                 }
890 
891                 mpView->SetDragWithCopy(bDragWithCopy);
892                 mpView->EndDragObj( mpView->IsDragWithCopy() );
893             }
894             else
895             {
896                 mpView->EndAction();
897 
898                 sal_uInt16 nDrgLog2 = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
899                 Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
900 
901                 if (Abs(aMDPos.X() - aPos.X()) < nDrgLog2 &&
902                     Abs(aMDPos.Y() - aPos.Y()) < nDrgLog2 &&
903                     !rMEvt.IsShift() && !rMEvt.IsMod2())
904                 {
905                     SdrViewEvent aVEvt;
906                     SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
907 
908                     if (eHit == SDRHIT_NONE)
909                     {
910                         // Klick auf der Stelle: deselektieren
911                         mpView->UnmarkAllObj();
912                     }
913                 }
914             }
915         }
916         else if (!rMEvt.IsShift() && rMEvt.IsMod1() && !rMEvt.IsMod2() &&
917                  Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
918                  Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
919         {
920             // Gruppe betreten
921             mpView->MarkObj(aPnt, nHitLog, sal_False, rMEvt.IsMod1());
922         }
923 
924 
925         ForcePointer(&rMEvt);
926         pHdl = NULL;
927         mpWindow->ReleaseMouse();
928 
929         FuDraw::MouseButtonUp(rMEvt);
930     }
931 
932 	return (bReturn);
933 }
934 
935 /*************************************************************************
936 |*
937 |* Tastaturereignisse bearbeiten
938 |*
939 |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
940 |* sal_False.
941 |*
942 \************************************************************************/
943 
944 sal_Bool FuSelection::KeyInput(const KeyEvent& rKEvt)
945 {
946 	sal_Bool bReturn = sal_False;
947 
948     switch (rKEvt.GetKeyCode().GetCode())
949 	{
950 		case KEY_ESCAPE:
951 		{
952 			bReturn = FuSelection::cancel();
953         }
954         break;
955     }
956 
957 	if (!bReturn)
958 	{
959 		bReturn = FuDraw::KeyInput(rKEvt);
960 
961 		if(mpView->GetMarkedObjectList().GetMarkCount() == 0)
962 		{
963 	        mpView->ResetCreationActive();
964 
965 			mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
966 		}
967 	}
968 
969 	return(bReturn);
970 
971 }
972 
973 
974 /*************************************************************************
975 |*
976 |* Function aktivieren
977 |*
978 \************************************************************************/
979 
980 void FuSelection::Activate()
981 {
982 	SdrDragMode eMode;
983     mpView->ResetCreationActive();
984 	mpView->SetEditMode(SDREDITMODE_EDIT);
985 
986 	switch( nSlotId )
987 	{
988 		case SID_OBJECT_ROTATE:
989 		{
990 			// (gemapter) Slot wird explizit auf Rotate gesetzt #31052#
991 			if( mpViewShell->ISA(DrawViewShell) )
992 			{
993 				sal_uInt16* pSlotArray =
994                     static_cast<DrawViewShell*>(mpViewShell)->GetSlotArray();
995 				pSlotArray[ 1 ] = SID_OBJECT_ROTATE;
996 			}
997 
998 			eMode = SDRDRAG_ROTATE;
999 
1000 			if ( mpView->GetDragMode() != eMode )
1001 				mpView->SetDragMode(eMode);
1002 		}
1003 		break;
1004 
1005 		case SID_OBJECT_MIRROR:
1006 		{
1007 			eMode = SDRDRAG_MIRROR;
1008 
1009 			if ( mpView->GetDragMode() != eMode )
1010 				mpView->SetDragMode(eMode);
1011 		}
1012 		break;
1013 
1014 		case SID_OBJECT_CROP:
1015 		{
1016 			eMode = SDRDRAG_CROP;
1017 
1018 			if ( mpView->GetDragMode() != eMode )
1019 				mpView->SetDragMode(eMode);
1020 		}
1021 		break;
1022 
1023 		case SID_OBJECT_TRANSPARENCE:
1024 		{
1025 			eMode = SDRDRAG_TRANSPARENCE;
1026 
1027 			if ( mpView->GetDragMode() != eMode )
1028 				mpView->SetDragMode(eMode);
1029 		}
1030 		break;
1031 
1032 		case SID_OBJECT_GRADIENT:
1033 		{
1034 			eMode = SDRDRAG_GRADIENT;
1035 
1036 			if ( mpView->GetDragMode() != eMode )
1037 				mpView->SetDragMode(eMode);
1038 		}
1039 		break;
1040 
1041 		case SID_OBJECT_SHEAR:
1042 		{
1043 			eMode = SDRDRAG_SHEAR;
1044 
1045 			if ( mpView->GetDragMode() != eMode )
1046 				mpView->SetDragMode(eMode);
1047 		}
1048 		break;
1049 
1050 		case SID_OBJECT_CROOK_ROTATE:
1051 		{
1052 			eMode = SDRDRAG_CROOK;
1053 
1054 			if ( mpView->GetDragMode() != eMode )
1055 			{
1056 				mpView->SetDragMode(eMode);
1057 				mpView->SetCrookMode(SDRCROOK_ROTATE);
1058 			}
1059 		}
1060 		break;
1061 
1062 		case SID_OBJECT_CROOK_SLANT:
1063 		{
1064 			eMode = SDRDRAG_CROOK;
1065 
1066 			if ( mpView->GetDragMode() != eMode )
1067 			{
1068 				mpView->SetDragMode(eMode);
1069 				mpView->SetCrookMode(SDRCROOK_SLANT);
1070 			}
1071 		}
1072 		break;
1073 
1074 		case SID_OBJECT_CROOK_STRETCH:
1075 		{
1076 			eMode = SDRDRAG_CROOK;
1077 
1078 			if ( mpView->GetDragMode() != eMode )
1079 			{
1080 				mpView->SetDragMode(eMode);
1081 				mpView->SetCrookMode(SDRCROOK_STRETCH);
1082 			}
1083 		}
1084 		break;
1085 
1086         case SID_CONVERT_TO_3D_LATHE:
1087 		{
1088 			eMode = SDRDRAG_MIRROR;
1089             bSuppressChangesOfSelection = sal_True;
1090 
1091 			if ( mpView->GetDragMode() != eMode )
1092 				mpView->SetDragMode(eMode);
1093 
1094             if (!mpView->Is3DRotationCreationActive())
1095                 mpView->Start3DCreation();
1096 
1097             bSuppressChangesOfSelection = sal_False;
1098         }
1099         break;
1100 
1101 		default:
1102 		{
1103 			eMode = SDRDRAG_MOVE;
1104 
1105 			if ( mpView->GetDragMode() != eMode )
1106 				mpView->SetDragMode(eMode);
1107 		}
1108 		break;
1109 	}
1110 
1111 	if (nSlotId != SID_OBJECT_ROTATE)
1112 	{
1113 		bTempRotation = sal_False;
1114 	}
1115 
1116 	FuDraw::Activate();
1117 }
1118 
1119 
1120 
1121 /*************************************************************************
1122 |*
1123 |* Function deaktivieren
1124 |*
1125 \************************************************************************/
1126 
1127 void FuSelection::Deactivate()
1128 {
1129 	FuDraw::Deactivate();
1130 }
1131 
1132 
1133 /*************************************************************************
1134 |*
1135 |* Selektion hat sich geaendert
1136 |*
1137 \************************************************************************/
1138 
1139 void FuSelection::SelectionHasChanged()
1140 {
1141     bSelectionChanged = sal_True;
1142 
1143     FuDraw::SelectionHasChanged();
1144 
1145     if ((mpView->Is3DRotationCreationActive() && !bSuppressChangesOfSelection))
1146     {
1147         // Wechsel Rotationskoerper -> Selektion
1148         mpView->ResetCreationActive();
1149         nSlotId = SID_OBJECT_SELECT;
1150         Activate();
1151     }
1152 
1153     // Activate the right tool bar for the current context of the view.
1154 	mpViewShell->GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*mpViewShell, *mpView);
1155 }
1156 
1157 
1158 /*************************************************************************
1159 |*
1160 |* Aktuellen Bezier-Editmodus setzen
1161 |*
1162 \************************************************************************/
1163 
1164 void FuSelection::SetEditMode(sal_uInt16 nMode)
1165 {
1166     nEditMode = nMode;
1167 
1168     if (nEditMode == SID_BEZIER_INSERT)
1169     {
1170         mpView->SetInsObjPointMode(sal_True);
1171     }
1172     else
1173     {
1174         mpView->SetInsObjPointMode(sal_False);
1175     }
1176 
1177     ForcePointer();
1178 
1179     SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
1180     rBindings.Invalidate(SID_BEZIER_MOVE);
1181     rBindings.Invalidate(SID_BEZIER_INSERT);
1182 }
1183 
1184 /*************************************************************************
1185 |*
1186 |* Animation oder Interaktion ausfuehren
1187 |*
1188 \************************************************************************/
1189 
1190 sal_Bool FuSelection::AnimateObj(SdrObject* pObj, const Point& rPos)
1191 {
1192 	sal_Bool bAnimated = sal_False;
1193     sal_Bool bClosed = pObj->IsClosedObj();
1194     sal_Bool bFilled = sal_False;
1195 
1196     if (bClosed)
1197     {
1198 	    SfxItemSet aSet(mpDoc->GetPool());
1199 
1200 		aSet.Put(pObj->GetMergedItemSet());
1201 
1202         const XFillStyleItem& rFillStyle = (const XFillStyleItem&) aSet.Get(XATTR_FILLSTYLE);
1203 	    bFilled = rFillStyle.GetValue() != XFILL_NONE;
1204     }
1205 
1206     const SetOfByte* pVisiLayer = &mpView->GetSdrPageView()->GetVisibleLayers();
1207 	sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
1208     const long  n2HitLog = nHitLog * 2;
1209     Point aHitPosR(rPos);
1210     Point aHitPosL(rPos);
1211     Point aHitPosT(rPos);
1212     Point aHitPosB(rPos);
1213 
1214     aHitPosR.X() += n2HitLog;
1215     aHitPosL.X() -= n2HitLog;
1216     aHitPosT.Y() += n2HitLog;
1217     aHitPosB.Y() -= n2HitLog;
1218 
1219     if ( !bClosed                                      ||
1220          !bFilled                                      ||
1221          (SdrObjectPrimitiveHit(*pObj, aHitPosR, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
1222           SdrObjectPrimitiveHit(*pObj, aHitPosL, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
1223           SdrObjectPrimitiveHit(*pObj, aHitPosT, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
1224           SdrObjectPrimitiveHit(*pObj, aHitPosB, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) ) )
1225 	{
1226 		if ( mpDoc->GetIMapInfo( pObj ) )
1227         {
1228 	        const IMapObject* pIMapObj = mpDoc->GetHitIMapObject( pObj, rPos, *mpWindow );
1229 
1230             if ( pIMapObj && pIMapObj->GetURL().Len() )
1231             {
1232 	            // Sprung zu Dokument
1233                 mpWindow->ReleaseMouse();
1234                 SfxStringItem aStrItem(SID_FILE_NAME, pIMapObj->GetURL());
1235                 SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
1236                 SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
1237                 SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
1238                 SfxBoolItem aBrowseItem( SID_BROWSE, sal_True );
1239                 mpWindow->ReleaseMouse();
1240                 pFrame->GetDispatcher()->
1241 	                Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
1242 	                        &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
1243 
1244 	            bAnimated = sal_True;
1245 			}
1246         }
1247         else if (!mpDocSh->ISA(GraphicDocShell)        &&
1248                  mpView->ISA(DrawView)                 &&
1249                  mpDoc->GetAnimationInfo(pObj))
1250         {
1251 	        /**********************************************************
1252 	        * Animations-Objekt in der Mitte getroffen -> Interaktion
1253 	        **********************************************************/
1254 	        SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj);
1255 	        DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>(mpViewShell);
1256 	        mpWindow->ReleaseMouse();
1257 
1258 			switch (pInfo->meClickAction)
1259             {
1260 	            case presentation::ClickAction_BOOKMARK:
1261 	            {
1262 	 	    	    // Sprung zu Bookmark (Seite oder Objekt)
1263 	    	        SfxStringItem aItem(SID_NAVIGATOR_OBJECT, pInfo->GetBookmark());
1264 	                mpViewShell->GetViewFrame()->GetDispatcher()->
1265 	                Execute(SID_NAVIGATOR_OBJECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L);
1266                     bAnimated = sal_True;
1267                 }
1268                 break;
1269 
1270 	            case presentation::ClickAction_DOCUMENT:
1271 	            {
1272                     String sBookmark( pInfo->GetBookmark() );
1273 	                // Sprung zu Dokument
1274 	                if (sBookmark.Len())
1275 	                {
1276 						SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
1277 	                    SfxStringItem aStrItem(SID_FILE_NAME, sBookmark);
1278 	                    SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
1279 	                    SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
1280 	                    SfxBoolItem aBrowseItem( SID_BROWSE, sal_True );
1281 	                    pFrame->GetDispatcher()->
1282 	                    Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
1283 	                            &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
1284 	                }
1285 
1286 	                bAnimated = sal_True;
1287 	            }
1288 	            break;
1289 
1290 	            case presentation::ClickAction_PREVPAGE:
1291 	            {
1292 	                // Sprung zur vorherigen Seite
1293 	                SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_PREVIOUS);
1294 	                mpViewShell->GetViewFrame()->GetDispatcher()->
1295 	                Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
1296 	                        &aItem, 0L);
1297 	                bAnimated = sal_True;
1298 	            }
1299 	            break;
1300 
1301 	            case presentation::ClickAction_NEXTPAGE:
1302 	            {
1303 	                // Sprung zur naechsten Seite
1304 	                SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_NEXT);
1305 	                mpViewShell->GetViewFrame()->GetDispatcher()->
1306 	                Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
1307 	                        &aItem, 0L);
1308 	                bAnimated = sal_True;
1309 	            }
1310 	            break;
1311 
1312 	            case presentation::ClickAction_FIRSTPAGE:
1313 	            {
1314 	                // Sprung zu erster Seite
1315 	                SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_FIRST);
1316 	                mpViewShell->GetViewFrame()->GetDispatcher()->
1317 	                Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
1318 	                        &aItem, 0L);
1319 	                bAnimated = sal_True;
1320 	            }
1321 	            break;
1322 
1323 	            case presentation::ClickAction_LASTPAGE:
1324 	            {
1325 	                // Sprung zu letzter Seite
1326 	                SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_LAST);
1327 	                mpViewShell->GetViewFrame()->GetDispatcher()->
1328 	                Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
1329 	                        &aItem, 0L);
1330 	                bAnimated = sal_True;
1331 	            }
1332 	            break;
1333 
1334 	            case presentation::ClickAction_SOUND:
1335 	            {
1336                         try
1337                         {
1338                             mxPlayer.set( avmedia::MediaWindow::createPlayer( pInfo->GetBookmark()), uno::UNO_QUERY_THROW );
1339                             mxPlayer->start();
1340                         }
1341                         catch( uno::Exception& e )
1342                         {
1343                             (void)e;
1344                         }
1345 	                bAnimated = sal_True;
1346 	            }
1347 	            break;
1348 
1349 	            case presentation::ClickAction_VERB:
1350 	            {
1351 	                // Verb zuweisen
1352 	                mpView->UnmarkAll();
1353 	                mpView->MarkObj(pObj, mpView->GetSdrPageView(), sal_False, sal_False);
1354 	                pDrViewSh->DoVerb((sal_Int16)pInfo->mnVerb);
1355 	                bAnimated = sal_True;
1356 	            }
1357 	            break;
1358 
1359 	            case presentation::ClickAction_PROGRAM:
1360 	            {
1361                    String aBaseURL = GetDocSh()->GetMedium()->GetBaseURL();
1362                    INetURLObject aURL( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), pInfo->GetBookmark(),
1363                                                 URIHelper::GetMaybeFileHdl(), true, false,
1364                                                 INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS ) );
1365 
1366 			       if( INET_PROT_FILE == aURL.GetProtocol() )
1367 				   {
1368 						SfxStringItem aUrl( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) );
1369 						SfxBoolItem aBrowsing( SID_BROWSE, sal_True );
1370 
1371 						SfxViewFrame* pViewFrm = SfxViewFrame::Current();
1372 						if (pViewFrm)
1373 							pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
1374   														SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
1375 														&aUrl,
1376 														&aBrowsing,
1377 														0L );
1378 				   }
1379 
1380                     bAnimated = sal_True;
1381 	            }
1382 	            break;
1383 
1384 	            case presentation::ClickAction_MACRO:
1385 	            {
1386 	                // Execute makro
1387 	                String aMacro = pInfo->GetBookmark();
1388 
1389 					if ( SfxApplication::IsXScriptURL( aMacro ) )
1390 					{
1391 						uno::Any aRet;
1392 						uno::Sequence< sal_Int16 > aOutArgsIndex;
1393 						uno::Sequence< uno::Any > aOutArgs;
1394 						uno::Sequence< uno::Any >* pInArgs =
1395 							new uno::Sequence< uno::Any >(0);
1396 
1397 						ErrCode eErr = mpDocSh->CallXScript( aMacro,
1398 							*pInArgs, aRet, aOutArgsIndex, aOutArgs);
1399 
1400 						// Check the return value from the script
1401 						sal_Bool bTmp = sal_False;
1402 						if ( eErr == ERRCODE_NONE &&
1403 							 aRet.getValueType() == getCppuBooleanType() &&
1404 							 sal_True == ( aRet >>= bTmp ) &&
1405 							 bTmp == sal_True )
1406 						{
1407 							bAnimated = sal_True;
1408 						}
1409 						else
1410 						{
1411 							bAnimated = sal_False;
1412 						}
1413 					}
1414 					else
1415 					{
1416 						// aMacro has got following format:
1417 	                	// "Macroname.Modulname.Libname.Documentname" or
1418 	                	// "Macroname.Modulname.Libname.Applicationsname"
1419 	                	String aMacroName =
1420 							aMacro.GetToken(0, sal_Unicode('.'));
1421 	                	String aModulName =
1422 							 aMacro.GetToken(1, sal_Unicode('.'));
1423 	                	String aLibName   =
1424 							 aMacro.GetToken(2, sal_Unicode('.'));
1425 	                	String aDocName   =
1426 							 aMacro.GetToken(3, sal_Unicode('.'));
1427 
1428 						// In this moment the Call-method only
1429 						// resolves modulename+macroname
1430 	                	String aExecMacro(aModulName);
1431 	                	aExecMacro.Append( sal_Unicode('.') );
1432 	                	aExecMacro.Append( aMacroName );
1433 	                	bAnimated = mpDocSh->GetBasic()->Call(aExecMacro);
1434 	            	}
1435 				}
1436 	            break;
1437 
1438 	            default:
1439 	            {
1440 	                bAnimated = sal_False;
1441 	            }
1442 	            break;
1443 	        }
1444         }
1445 
1446 		if (!bAnimated                               &&
1447 	    	mpView->ISA(DrawView)                 &&
1448 	    	!mpDocSh->ISA(GraphicDocShell)        &&
1449 			SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) &&
1450 	    	mpDoc->GetAnimationInfo(pObj))
1451 		{
1452 	    	/**********************************************************
1453 	    	* Effekt-Objekt in der Mitte getroffen -> Effekt abspielen
1454 	    	**********************************************************/
1455 	    	SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj);
1456 
1457 	    	switch (pInfo->meClickAction)
1458 	    	{
1459 	        	case presentation::ClickAction_VANISH:
1460 	        	case presentation::ClickAction_INVISIBLE:
1461 		        	break;
1462 
1463 	        	default:
1464 	            	bAnimated = sal_False;
1465 	        	break;
1466 	    	}
1467 		}
1468 	}
1469 
1470 	return bAnimated;
1471 }
1472 
1473 
1474 
1475 /** is called when the currenct function should be aborted. <p>
1476 	This is used when a function gets a KEY_ESCAPE but can also
1477 	be called directly.
1478 
1479 	@returns true if a active function was aborted
1480 */
1481 bool FuSelection::cancel()
1482 {
1483     if (mpView->Is3DRotationCreationActive())
1484 	{
1485 		mpView->ResetCreationActive();
1486 		mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
1487 		return true;
1488     }
1489 	else
1490 	{
1491 		return false;
1492 	}
1493 }
1494 
1495 
1496 
1497 
1498 SdrObject* FuSelection::pickObject (const Point& rTestPoint)
1499 {
1500 	SdrObject* pObject = NULL;
1501     SdrPageView* pPageView;
1502 	sal_uInt16 nHitLog = sal_uInt16 (mpWindow->PixelToLogic(Size(HITPIX,0)).Width());
1503 	mpView->PickObj (rTestPoint, nHitLog, pObject, pPageView, SDRSEARCH_PICKMARKABLE);
1504     return pObject;
1505 }
1506 } // end of namespace sd
1507