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