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