xref: /aoo42x/main/sc/source/ui/drawfunc/fudraw.cxx (revision b3f79822)
1*b3f79822SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b3f79822SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b3f79822SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b3f79822SAndrew Rist  * distributed with this work for additional information
6*b3f79822SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b3f79822SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b3f79822SAndrew Rist  * "License"); you may not use this file except in compliance
9*b3f79822SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b3f79822SAndrew Rist  *
11*b3f79822SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b3f79822SAndrew Rist  *
13*b3f79822SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b3f79822SAndrew Rist  * software distributed under the License is distributed on an
15*b3f79822SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3f79822SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b3f79822SAndrew Rist  * specific language governing permissions and limitations
18*b3f79822SAndrew Rist  * under the License.
19*b3f79822SAndrew Rist  *
20*b3f79822SAndrew Rist  *************************************************************/
21*b3f79822SAndrew Rist 
22*b3f79822SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sc.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //------------------------------------------------------------------------
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <editeng/editeng.hxx>	// EditEngine::IsSimpleCharInput
30cdf0e10cSrcweir #include <editeng/outlobj.hxx>
31cdf0e10cSrcweir #include <svx/svdobj.hxx>
32cdf0e10cSrcweir #include <svx/svdoole2.hxx>
33cdf0e10cSrcweir #include <svx/svdouno.hxx>
34cdf0e10cSrcweir #include <svx/svdocapt.hxx>
35cdf0e10cSrcweir #include <svx/svdpage.hxx>
36cdf0e10cSrcweir #include <svx/svditer.hxx>
37cdf0e10cSrcweir #include <svx/svdundo.hxx>
38cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
39cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include "sc.hrc"
42cdf0e10cSrcweir #include "fudraw.hxx"
43cdf0e10cSrcweir #include "futext.hxx"
44cdf0e10cSrcweir #include "tabvwsh.hxx"
45cdf0e10cSrcweir #include "drwlayer.hxx"
46cdf0e10cSrcweir #include "scresid.hxx"
47cdf0e10cSrcweir #include "userdat.hxx"
48cdf0e10cSrcweir #include "docsh.hxx"
49cdf0e10cSrcweir #include "postit.hxx"
50cdf0e10cSrcweir #include "globstr.hrc"
51cdf0e10cSrcweir #include "drawview.hxx"
52cdf0e10cSrcweir 
53cdf0e10cSrcweir /*************************************************************************
54cdf0e10cSrcweir |*
55cdf0e10cSrcweir |* Basisklasse fuer alle Drawmodul-spezifischen Funktionen
56cdf0e10cSrcweir |*
57cdf0e10cSrcweir \************************************************************************/
58cdf0e10cSrcweir 
59cdf0e10cSrcweir FuDraw::FuDraw(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
60cdf0e10cSrcweir 			   SdrModel* pDoc, SfxRequest& rReq) :
61cdf0e10cSrcweir     FuPoor      (pViewSh, pWin, pViewP, pDoc, rReq),
62cdf0e10cSrcweir 	aNewPointer ( POINTER_ARROW ),
63cdf0e10cSrcweir 	aOldPointer ( POINTER_ARROW )
64cdf0e10cSrcweir {
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir /*************************************************************************
68cdf0e10cSrcweir |*
69cdf0e10cSrcweir |* Destruktor
70cdf0e10cSrcweir |*
71cdf0e10cSrcweir \************************************************************************/
72cdf0e10cSrcweir 
73cdf0e10cSrcweir FuDraw::~FuDraw()
74cdf0e10cSrcweir {
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir /*************************************************************************
78cdf0e10cSrcweir |*
79cdf0e10cSrcweir |* Modifier-Tasten auswerten
80cdf0e10cSrcweir |*
81cdf0e10cSrcweir \************************************************************************/
82cdf0e10cSrcweir 
83cdf0e10cSrcweir void FuDraw::DoModifiers(const MouseEvent& rMEvt)
84cdf0e10cSrcweir {
85cdf0e10cSrcweir 	//	Shift	= Ortho und AngleSnap
86cdf0e10cSrcweir 	//	Control	= Snap (Toggle)
87cdf0e10cSrcweir 	//	Alt		= zentrisch
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	sal_Bool bShift	= rMEvt.IsShift();
90cdf0e10cSrcweir //    sal_Bool bCtrl  = rMEvt.IsMod1();
91cdf0e10cSrcweir 	sal_Bool bAlt	= rMEvt.IsMod2();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir //    ScViewData* pViewData = pViewShell->GetViewData();
94cdf0e10cSrcweir //    const ScViewOptions& rOpt = pViewData->GetOptions();
95cdf0e10cSrcweir //    const ScGridOptions& rGrid = rOpt.GetGridOptions();
96cdf0e10cSrcweir //    sal_Bool bGridOpt = rGrid.GetUseGridSnap();
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	sal_Bool bOrtho		= bShift;
99cdf0e10cSrcweir 	sal_Bool bAngleSnap	= bShift;
100cdf0e10cSrcweir //    sal_Bool bGridSnap  = ( bGridOpt != bCtrl );        // andere Snap's nicht unterstuetzt
101cdf0e10cSrcweir 	sal_Bool bCenter	= bAlt;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	// #i33136#
104cdf0e10cSrcweir 	if(doConstructOrthogonal())
105cdf0e10cSrcweir 	{
106cdf0e10cSrcweir 		bOrtho = !bShift;
107cdf0e10cSrcweir 	}
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	if (pView->IsOrtho() != bOrtho)
110cdf0e10cSrcweir 		pView->SetOrtho(bOrtho);
111cdf0e10cSrcweir 	if (pView->IsAngleSnapEnabled() != bAngleSnap)
112cdf0e10cSrcweir 		pView->SetAngleSnapEnabled(bAngleSnap);
113cdf0e10cSrcweir 
114cdf0e10cSrcweir /*	Control fuer Snap beisst sich beim Verschieben mit "kopieren" !!!
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	if (pView->IsGridSnap() != bGridSnap)
117cdf0e10cSrcweir 		pView->SetGridSnap(bGridSnap);
118cdf0e10cSrcweir 	if (pView->IsSnapEnabled() != bGridSnap)
119cdf0e10cSrcweir 		pView->SetSnapEnabled(bGridSnap);
120cdf0e10cSrcweir */
121cdf0e10cSrcweir 	if (pView->IsCreate1stPointAsCenter() != bCenter)
122cdf0e10cSrcweir 		pView->SetCreate1stPointAsCenter(bCenter);
123cdf0e10cSrcweir 	if (pView->IsResizeAtCenter() != bCenter)
124cdf0e10cSrcweir 		pView->SetResizeAtCenter(bCenter);
125cdf0e10cSrcweir 
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir void FuDraw::ResetModifiers()
129cdf0e10cSrcweir {
130cdf0e10cSrcweir 	ScViewData* pViewData = pViewShell->GetViewData();
131cdf0e10cSrcweir 	const ScViewOptions& rOpt = pViewData->GetOptions();
132cdf0e10cSrcweir 	const ScGridOptions& rGrid = rOpt.GetGridOptions();
133cdf0e10cSrcweir 	sal_Bool bGridOpt = rGrid.GetUseGridSnap();
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 	if (pView->IsOrtho())
136cdf0e10cSrcweir 		pView->SetOrtho(sal_False);
137cdf0e10cSrcweir 	if (pView->IsAngleSnapEnabled())
138cdf0e10cSrcweir 		pView->SetAngleSnapEnabled(sal_False);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	if (pView->IsGridSnap() != bGridOpt)
141cdf0e10cSrcweir 		pView->SetGridSnap(bGridOpt);
142cdf0e10cSrcweir 	if (pView->IsSnapEnabled() != bGridOpt)
143cdf0e10cSrcweir 		pView->SetSnapEnabled(bGridOpt);
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	if (pView->IsCreate1stPointAsCenter())
146cdf0e10cSrcweir 		pView->SetCreate1stPointAsCenter(sal_False);
147cdf0e10cSrcweir 	if (pView->IsResizeAtCenter())
148cdf0e10cSrcweir 		pView->SetResizeAtCenter(sal_False);
149cdf0e10cSrcweir }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir /*************************************************************************
152cdf0e10cSrcweir |*
153cdf0e10cSrcweir |* MouseButtonDown-event
154cdf0e10cSrcweir |*
155cdf0e10cSrcweir \************************************************************************/
156cdf0e10cSrcweir 
157cdf0e10cSrcweir sal_Bool __EXPORT FuDraw::MouseButtonDown(const MouseEvent& rMEvt)
158cdf0e10cSrcweir {
159cdf0e10cSrcweir 	// #95491# remember button state for creation of own MouseEvents
160cdf0e10cSrcweir 	SetMouseButtonCode(rMEvt.GetButtons());
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	DoModifiers( rMEvt );
163cdf0e10cSrcweir 	return sal_False;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir 
166cdf0e10cSrcweir /*************************************************************************
167cdf0e10cSrcweir |*
168cdf0e10cSrcweir |* MouseMove-event
169cdf0e10cSrcweir |*
170cdf0e10cSrcweir \************************************************************************/
171cdf0e10cSrcweir 
172cdf0e10cSrcweir sal_Bool __EXPORT FuDraw::MouseMove(const MouseEvent& rMEvt)
173cdf0e10cSrcweir {
174cdf0e10cSrcweir 	//	#106438# evaluate modifiers only if in a drawing layer action
175cdf0e10cSrcweir 	//	(don't interfere with keyboard shortcut handling)
176cdf0e10cSrcweir 	if (pView->IsAction())
177cdf0e10cSrcweir 		DoModifiers( rMEvt );
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	return sal_False;
180cdf0e10cSrcweir }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir /*************************************************************************
183cdf0e10cSrcweir |*
184cdf0e10cSrcweir |* MouseButtonUp-event
185cdf0e10cSrcweir |*
186cdf0e10cSrcweir \************************************************************************/
187cdf0e10cSrcweir 
188cdf0e10cSrcweir sal_Bool __EXPORT FuDraw::MouseButtonUp(const MouseEvent& rMEvt)
189cdf0e10cSrcweir {
190cdf0e10cSrcweir 	// #95491# remember button state for creation of own MouseEvents
191cdf0e10cSrcweir 	SetMouseButtonCode(rMEvt.GetButtons());
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	ResetModifiers();
194cdf0e10cSrcweir 	return sal_False;
195cdf0e10cSrcweir }
196cdf0e10cSrcweir 
197cdf0e10cSrcweir /*************************************************************************
198cdf0e10cSrcweir |*
199cdf0e10cSrcweir |* Tastaturereignisse bearbeiten
200cdf0e10cSrcweir |*
201cdf0e10cSrcweir |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
202cdf0e10cSrcweir |* FALSE.
203cdf0e10cSrcweir |*
204cdf0e10cSrcweir \************************************************************************/
205cdf0e10cSrcweir 
206cdf0e10cSrcweir sal_Bool lcl_KeyEditMode( SdrObject* pObj, ScTabViewShell* pViewShell, const KeyEvent* pInitialKey )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
209cdf0e10cSrcweir 	if ( pObj && pObj->ISA(SdrTextObj) && !pObj->ISA(SdrUnoObj) )
210cdf0e10cSrcweir 	{
211cdf0e10cSrcweir 		// start text edit - like FuSelection::MouseButtonUp,
212cdf0e10cSrcweir 		// but with bCursorToEnd instead of mouse position
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 		OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
215cdf0e10cSrcweir 		sal_Bool bVertical = ( pOPO && pOPO->IsVertical() );
216cdf0e10cSrcweir 		sal_uInt16 nTextSlotId = bVertical ? SID_DRAW_TEXT_VERTICAL : SID_DRAW_TEXT;
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 		// don't switch shells if text shell is already active
219cdf0e10cSrcweir 		FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
220cdf0e10cSrcweir 		if ( !pPoor || pPoor->GetSlotID() != nTextSlotId )
221cdf0e10cSrcweir 		{
222cdf0e10cSrcweir 			pViewShell->GetViewData()->GetDispatcher().
223cdf0e10cSrcweir 				Execute(nTextSlotId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
224cdf0e10cSrcweir 		}
225cdf0e10cSrcweir 
226cdf0e10cSrcweir 		// get the resulting FuText and set in edit mode
227cdf0e10cSrcweir 		pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
228cdf0e10cSrcweir 		if ( pPoor && pPoor->GetSlotID() == nTextSlotId )	 //	no RTTI
229cdf0e10cSrcweir 		{
230cdf0e10cSrcweir 			FuText* pText = (FuText*)pPoor;
231cdf0e10cSrcweir 			pText->SetInEditMode( pObj, NULL, sal_True, pInitialKey );
232cdf0e10cSrcweir 			//! set cursor to end of text
233cdf0e10cSrcweir 		}
234cdf0e10cSrcweir 		bReturn = sal_True;
235cdf0e10cSrcweir 	}
236cdf0e10cSrcweir 	return bReturn;
237cdf0e10cSrcweir }
238cdf0e10cSrcweir 
239cdf0e10cSrcweir sal_Bool __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt)
240cdf0e10cSrcweir {
241cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
242cdf0e10cSrcweir     ScViewData& rViewData = *pViewShell->GetViewData();
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 	switch ( rKEvt.GetKeyCode().GetCode() )
245cdf0e10cSrcweir 	{
246cdf0e10cSrcweir 		case KEY_ESCAPE:
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 	/* 18.12.95: TextShell beibehalten nicht mehr gewuenscht...
249cdf0e10cSrcweir 	 *
250cdf0e10cSrcweir 	 *			if ( pView->IsAction() )
251cdf0e10cSrcweir 	 *			{
252cdf0e10cSrcweir 	 *				pView->BrkAction();
253cdf0e10cSrcweir 	 *				pWindow->ReleaseMouse();
254cdf0e10cSrcweir 	 *				bReturn = sal_True;
255cdf0e10cSrcweir 	 *			}
256cdf0e10cSrcweir 	 *			else if ( pView->IsTextEdit() )
257cdf0e10cSrcweir 	 *			{
258cdf0e10cSrcweir 	 *				pView->EndTextEdit();
259cdf0e10cSrcweir 	 *				pView->SetCreateMode();
260cdf0e10cSrcweir 	 *				pViewShell->GetScDrawView()->InvalidateDrawTextAttrs();
261cdf0e10cSrcweir 	 *				bReturn = sal_True;
262cdf0e10cSrcweir 	 *			}
263cdf0e10cSrcweir 	 *			else
264cdf0e10cSrcweir 	 */
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 			if ( pViewShell->IsDrawTextShell() || aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT )
267cdf0e10cSrcweir 			{
268cdf0e10cSrcweir 				// in normale Draw-Shell, wenn Objekt selektiert, sonst Zeichnen aus
269cdf0e10cSrcweir 				rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
270cdf0e10cSrcweir 				bReturn = sal_True;
271cdf0e10cSrcweir 			}
272cdf0e10cSrcweir 			else if ( pViewShell->IsDrawSelMode() )
273cdf0e10cSrcweir 			{
274cdf0e10cSrcweir 				pView->UnmarkAll();
275cdf0e10cSrcweir 				rViewData.GetDispatcher().Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
276cdf0e10cSrcweir 				bReturn = sal_True;
277cdf0e10cSrcweir 			}
278cdf0e10cSrcweir 			else if ( pView->AreObjectsMarked() )
279cdf0e10cSrcweir 			{
280cdf0e10cSrcweir 				// #97016# III
281cdf0e10cSrcweir 				SdrHdlList& rHdlList = const_cast< SdrHdlList& >( pView->GetHdlList() );
282cdf0e10cSrcweir                 if( rHdlList.GetFocusHdl() )
283cdf0e10cSrcweir 					rHdlList.ResetFocusHdl();
284cdf0e10cSrcweir 				else
285cdf0e10cSrcweir 					pView->UnmarkAll();
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 				//	Beim Bezier-Editieren ist jetzt wieder das Objekt selektiert
288cdf0e10cSrcweir 				if (!pView->AreObjectsMarked())
289cdf0e10cSrcweir 					pViewShell->SetDrawShell( sal_False );
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 				bReturn = sal_True;
292cdf0e10cSrcweir 			}
293cdf0e10cSrcweir 			break;
294cdf0e10cSrcweir 
295cdf0e10cSrcweir         case KEY_DELETE:					//! ueber Accelerator
296cdf0e10cSrcweir             pView->DeleteMarked();
297cdf0e10cSrcweir             bReturn = sal_True;
298cdf0e10cSrcweir         break;
299cdf0e10cSrcweir 
300cdf0e10cSrcweir 		case KEY_RETURN:
301cdf0e10cSrcweir 		{
302cdf0e10cSrcweir 			if( rKEvt.GetKeyCode().GetModifier() == 0 )
303cdf0e10cSrcweir 			{
304cdf0e10cSrcweir 	            // #98256# activate OLE object on RETURN for selected object
305cdf0e10cSrcweir 				// #98198# put selected text object in edit mode
306cdf0e10cSrcweir 				const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
307cdf0e10cSrcweir 				if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
308cdf0e10cSrcweir 				{
309cdf0e10cSrcweir                     sal_Bool bOle = pViewShell->GetViewFrame()->GetFrame().IsInPlace();
310cdf0e10cSrcweir 	                SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
311cdf0e10cSrcweir 	    			if( pObj && pObj->ISA( SdrOle2Obj ) && !bOle )
312cdf0e10cSrcweir 			        {
313cdf0e10cSrcweir 	                    //HMHpView->HideMarkHdl();
314cdf0e10cSrcweir 	                    pViewShell->ActivateObject( static_cast< SdrOle2Obj* >( pObj ), 0 );
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 						// consumed
317cdf0e10cSrcweir 						bReturn = sal_True;
318cdf0e10cSrcweir 			        }
319cdf0e10cSrcweir 					else if ( lcl_KeyEditMode( pObj, pViewShell, NULL ) )		// start text edit for suitable object
320cdf0e10cSrcweir 						bReturn = sal_True;
321cdf0e10cSrcweir 				}
322cdf0e10cSrcweir 			}
323cdf0e10cSrcweir 		}
324cdf0e10cSrcweir 		break;
325cdf0e10cSrcweir 
326cdf0e10cSrcweir 		case KEY_F2:
327cdf0e10cSrcweir 		{
328cdf0e10cSrcweir 			if( rKEvt.GetKeyCode().GetModifier() == 0 )
329cdf0e10cSrcweir 			{
330cdf0e10cSrcweir 				// #98198# put selected text object in edit mode
331cdf0e10cSrcweir 				// (this is not SID_SETINPUTMODE, but F2 hardcoded, like in Writer)
332cdf0e10cSrcweir 				const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
333cdf0e10cSrcweir 				if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
334cdf0e10cSrcweir 				{
335cdf0e10cSrcweir 	                SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
336cdf0e10cSrcweir 					if ( lcl_KeyEditMode( pObj, pViewShell, NULL ) )			// start text edit for suitable object
337cdf0e10cSrcweir 						bReturn = sal_True;
338cdf0e10cSrcweir 				}
339cdf0e10cSrcweir 			}
340cdf0e10cSrcweir 		}
341cdf0e10cSrcweir 		break;
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 		// #97016#
344cdf0e10cSrcweir 		case KEY_TAB:
345cdf0e10cSrcweir 		{
346cdf0e10cSrcweir 			// in calc do NOT start draw object selection using TAB/SHIFT-TAB when
347cdf0e10cSrcweir 			// there is not yet a object selected
348cdf0e10cSrcweir 			if(pView->AreObjectsMarked())
349cdf0e10cSrcweir 			{
350cdf0e10cSrcweir 				KeyCode aCode = rKEvt.GetKeyCode();
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 				if ( !aCode.IsMod1() && !aCode.IsMod2() )
353cdf0e10cSrcweir 				{
354cdf0e10cSrcweir 					// changeover to the next object
355cdf0e10cSrcweir 					if(!pView->MarkNextObj( !aCode.IsShift() ))
356cdf0e10cSrcweir 					{
357cdf0e10cSrcweir 						// #97016# No next object: go over open end and
358cdf0e10cSrcweir 						// get first from the other side
359cdf0e10cSrcweir 						pView->UnmarkAllObj();
360cdf0e10cSrcweir 						pView->MarkNextObj(!aCode.IsShift());
361cdf0e10cSrcweir 					}
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 					// #97016# II
364cdf0e10cSrcweir 					if(pView->AreObjectsMarked())
365cdf0e10cSrcweir 						pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 					bReturn = sal_True;
368cdf0e10cSrcweir 				}
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 				// #98994# handle Mod1 and Mod2 to get travelling running on different systems
371cdf0e10cSrcweir 				if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
372cdf0e10cSrcweir 				{
373cdf0e10cSrcweir 					// #97016# II do something with a selected handle?
374cdf0e10cSrcweir 					const SdrHdlList& rHdlList = pView->GetHdlList();
375cdf0e10cSrcweir 					sal_Bool bForward(!rKEvt.GetKeyCode().IsShift());
376cdf0e10cSrcweir 
377cdf0e10cSrcweir 					((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
378cdf0e10cSrcweir 
379cdf0e10cSrcweir 					// guarantee visibility of focused handle
380cdf0e10cSrcweir 					SdrHdl* pHdl = rHdlList.GetFocusHdl();
381cdf0e10cSrcweir 
382cdf0e10cSrcweir 					if(pHdl)
383cdf0e10cSrcweir 					{
384cdf0e10cSrcweir 						Point aHdlPosition(pHdl->GetPos());
385cdf0e10cSrcweir 						Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200));
386cdf0e10cSrcweir 						pView->MakeVisible(aVisRect, *pWindow);
387cdf0e10cSrcweir 					}
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 					// consumed
390cdf0e10cSrcweir 					bReturn = sal_True;
391cdf0e10cSrcweir 				}
392cdf0e10cSrcweir 			}
393cdf0e10cSrcweir 		}
394cdf0e10cSrcweir 		break;
395cdf0e10cSrcweir 
396cdf0e10cSrcweir 		// #97016#
397cdf0e10cSrcweir 		case KEY_END:
398cdf0e10cSrcweir 		{
399cdf0e10cSrcweir 			// in calc do NOT select the last draw object when
400cdf0e10cSrcweir 			// there is not yet a object selected
401cdf0e10cSrcweir 			if(pView->AreObjectsMarked())
402cdf0e10cSrcweir 			{
403cdf0e10cSrcweir 				KeyCode aCode = rKEvt.GetKeyCode();
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 				if ( aCode.IsMod1() )
406cdf0e10cSrcweir 				{
407cdf0e10cSrcweir 					// #97016# mark last object
408cdf0e10cSrcweir 					pView->UnmarkAllObj();
409cdf0e10cSrcweir 					pView->MarkNextObj(sal_False);
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 					// #97016# II
412cdf0e10cSrcweir 					if(pView->AreObjectsMarked())
413cdf0e10cSrcweir 						pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 					bReturn = sal_True;
416cdf0e10cSrcweir 				}
417cdf0e10cSrcweir 			}
418cdf0e10cSrcweir 		}
419cdf0e10cSrcweir 		break;
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 		// #97016#
422cdf0e10cSrcweir 		case KEY_HOME:
423cdf0e10cSrcweir 		{
424cdf0e10cSrcweir 			// in calc do NOT select the first draw object when
425cdf0e10cSrcweir 			// there is not yet a object selected
426cdf0e10cSrcweir 			if(pView->AreObjectsMarked())
427cdf0e10cSrcweir 			{
428cdf0e10cSrcweir 				KeyCode aCode = rKEvt.GetKeyCode();
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 				if ( aCode.IsMod1() )
431cdf0e10cSrcweir 				{
432cdf0e10cSrcweir 					// #97016# mark first object
433cdf0e10cSrcweir 					pView->UnmarkAllObj();
434cdf0e10cSrcweir 					pView->MarkNextObj(sal_True);
435cdf0e10cSrcweir 
436cdf0e10cSrcweir 					// #97016# II
437cdf0e10cSrcweir 					if(pView->AreObjectsMarked())
438cdf0e10cSrcweir 						pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 					bReturn = sal_True;
441cdf0e10cSrcweir 				}
442cdf0e10cSrcweir 			}
443cdf0e10cSrcweir 		}
444cdf0e10cSrcweir 		break;
445cdf0e10cSrcweir 
446cdf0e10cSrcweir 		// #97016#
447cdf0e10cSrcweir 		case KEY_UP:
448cdf0e10cSrcweir 		case KEY_DOWN:
449cdf0e10cSrcweir 		case KEY_LEFT:
450cdf0e10cSrcweir 		case KEY_RIGHT:
451cdf0e10cSrcweir 		{
452cdf0e10cSrcweir 			// in calc do cursor travelling of draw objects only when
453cdf0e10cSrcweir 			// there is a object selected yet
454cdf0e10cSrcweir 			if(pView->AreObjectsMarked())
455cdf0e10cSrcweir 			{
456cdf0e10cSrcweir 
457cdf0e10cSrcweir 				const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
458cdf0e10cSrcweir 				if(rMarkList.GetMarkCount() == 1)
459cdf0e10cSrcweir 				{
460cdf0e10cSrcweir                     // disable cursor travelling on note objects as the tail connector position
461cdf0e10cSrcweir                     // must not move.
462cdf0e10cSrcweir 				    SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
463cdf0e10cSrcweir                     if( ScDrawLayer::IsNoteCaption( pObj ) )
464cdf0e10cSrcweir                         break;
465cdf0e10cSrcweir 				}
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 				long nX = 0;
468cdf0e10cSrcweir 				long nY = 0;
469cdf0e10cSrcweir 				sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
470cdf0e10cSrcweir 
471cdf0e10cSrcweir 				if (nCode == KEY_UP)
472cdf0e10cSrcweir 				{
473cdf0e10cSrcweir 					// Scroll nach oben
474cdf0e10cSrcweir 					nX = 0;
475cdf0e10cSrcweir 					nY =-1;
476cdf0e10cSrcweir 				}
477cdf0e10cSrcweir 				else if (nCode == KEY_DOWN)
478cdf0e10cSrcweir 				{
479cdf0e10cSrcweir 					// Scroll nach unten
480cdf0e10cSrcweir 					nX = 0;
481cdf0e10cSrcweir 					nY = 1;
482cdf0e10cSrcweir 				}
483cdf0e10cSrcweir 				else if (nCode == KEY_LEFT)
484cdf0e10cSrcweir 				{
485cdf0e10cSrcweir 					// Scroll nach links
486cdf0e10cSrcweir 					nX =-1;
487cdf0e10cSrcweir 					nY = 0;
488cdf0e10cSrcweir 				}
489cdf0e10cSrcweir 				else if (nCode == KEY_RIGHT)
490cdf0e10cSrcweir 				{
491cdf0e10cSrcweir 					// Scroll nach rechts
492cdf0e10cSrcweir 					nX = 1;
493cdf0e10cSrcweir 					nY = 0;
494cdf0e10cSrcweir 				}
495cdf0e10cSrcweir 
496cdf0e10cSrcweir 				sal_Bool bReadOnly = rViewData.GetDocShell()->IsReadOnly();
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 				if(!rKEvt.GetKeyCode().IsMod1() && !bReadOnly)
499cdf0e10cSrcweir 				{
500cdf0e10cSrcweir 					if(rKEvt.GetKeyCode().IsMod2())
501cdf0e10cSrcweir 					{
502cdf0e10cSrcweir 						// #97016# move in 1 pixel distance
503cdf0e10cSrcweir 						Size aLogicSizeOnePixel = (pWindow) ? pWindow->PixelToLogic(Size(1,1)) : Size(100, 100);
504cdf0e10cSrcweir 						nX *= aLogicSizeOnePixel.Width();
505cdf0e10cSrcweir 						nY *= aLogicSizeOnePixel.Height();
506cdf0e10cSrcweir 					}
507cdf0e10cSrcweir 					else
508cdf0e10cSrcweir 					{
509cdf0e10cSrcweir 						// old, fixed move distance
510cdf0e10cSrcweir 						nX *= 100;
511cdf0e10cSrcweir 						nY *= 100;
512cdf0e10cSrcweir 					}
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 					// is there a movement to do?
515cdf0e10cSrcweir 					if(0 != nX || 0 != nY)
516cdf0e10cSrcweir 					{
517cdf0e10cSrcweir 						// #97016# II
518cdf0e10cSrcweir 						const SdrHdlList& rHdlList = pView->GetHdlList();
519cdf0e10cSrcweir 						SdrHdl* pHdl = rHdlList.GetFocusHdl();
520cdf0e10cSrcweir 
521cdf0e10cSrcweir 						if(0L == pHdl)
522cdf0e10cSrcweir 						{
523cdf0e10cSrcweir 							// #107086# only take action when move is allowed
524cdf0e10cSrcweir 							if(pView->IsMoveAllowed())
525cdf0e10cSrcweir 							{
526cdf0e10cSrcweir 								// #90129# restrict movement to WorkArea
527cdf0e10cSrcweir 								const Rectangle& rWorkArea = pView->GetWorkArea();
528cdf0e10cSrcweir 
529cdf0e10cSrcweir 								if(!rWorkArea.IsEmpty())
530cdf0e10cSrcweir 								{
531cdf0e10cSrcweir 									Rectangle aMarkRect(pView->GetMarkedObjRect());
532cdf0e10cSrcweir 									aMarkRect.Move(nX, nY);
533cdf0e10cSrcweir 
534cdf0e10cSrcweir 									if(!aMarkRect.IsInside(rWorkArea))
535cdf0e10cSrcweir 									{
536cdf0e10cSrcweir 										if(aMarkRect.Left() < rWorkArea.Left())
537cdf0e10cSrcweir 										{
538cdf0e10cSrcweir 											nX += rWorkArea.Left() - aMarkRect.Left();
539cdf0e10cSrcweir 										}
540cdf0e10cSrcweir 
541cdf0e10cSrcweir 										if(aMarkRect.Right() > rWorkArea.Right())
542cdf0e10cSrcweir 										{
543cdf0e10cSrcweir 											nX -= aMarkRect.Right() - rWorkArea.Right();
544cdf0e10cSrcweir 										}
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 										if(aMarkRect.Top() < rWorkArea.Top())
547cdf0e10cSrcweir 										{
548cdf0e10cSrcweir 											nY += rWorkArea.Top() - aMarkRect.Top();
549cdf0e10cSrcweir 										}
550cdf0e10cSrcweir 
551cdf0e10cSrcweir 										if(aMarkRect.Bottom() > rWorkArea.Bottom())
552cdf0e10cSrcweir 										{
553cdf0e10cSrcweir 											nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
554cdf0e10cSrcweir 										}
555cdf0e10cSrcweir 									}
556cdf0e10cSrcweir 								}
557cdf0e10cSrcweir 
558cdf0e10cSrcweir 								// now move the selected draw objects
559cdf0e10cSrcweir 								pView->MoveAllMarked(Size(nX, nY));
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 								// #97016# II
562cdf0e10cSrcweir 								pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
563cdf0e10cSrcweir 
564cdf0e10cSrcweir 								bReturn = sal_True;
565cdf0e10cSrcweir 							}
566cdf0e10cSrcweir 						}
567cdf0e10cSrcweir 						else
568cdf0e10cSrcweir 						{
569cdf0e10cSrcweir 							// move handle with index nHandleIndex
570cdf0e10cSrcweir 							if(pHdl && (nX || nY))
571cdf0e10cSrcweir 							{
572cdf0e10cSrcweir 								// now move the Handle (nX, nY)
573cdf0e10cSrcweir 								Point aStartPoint(pHdl->GetPos());
574cdf0e10cSrcweir 								Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
575cdf0e10cSrcweir 								const SdrDragStat& rDragStat = pView->GetDragStat();
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 								// start dragging
578cdf0e10cSrcweir 								pView->BegDragObj(aStartPoint, 0, pHdl, 0);
579cdf0e10cSrcweir 
580cdf0e10cSrcweir 								if(pView->IsDragObj())
581cdf0e10cSrcweir 								{
582cdf0e10cSrcweir 									FASTBOOL bWasNoSnap = rDragStat.IsNoSnap();
583cdf0e10cSrcweir 									sal_Bool bWasSnapEnabled = pView->IsSnapEnabled();
584cdf0e10cSrcweir 
585cdf0e10cSrcweir 									// switch snapping off
586cdf0e10cSrcweir 									if(!bWasNoSnap)
587cdf0e10cSrcweir 										((SdrDragStat&)rDragStat).SetNoSnap(sal_True);
588cdf0e10cSrcweir 									if(bWasSnapEnabled)
589cdf0e10cSrcweir 										pView->SetSnapEnabled(sal_False);
590cdf0e10cSrcweir 
591cdf0e10cSrcweir 									pView->MovAction(aEndPoint);
592cdf0e10cSrcweir 									pView->EndDragObj();
593cdf0e10cSrcweir 
594cdf0e10cSrcweir 									// restore snap
595cdf0e10cSrcweir 									if(!bWasNoSnap)
596cdf0e10cSrcweir 										((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
597cdf0e10cSrcweir 									if(bWasSnapEnabled)
598cdf0e10cSrcweir 										pView->SetSnapEnabled(bWasSnapEnabled);
599cdf0e10cSrcweir 								}
600cdf0e10cSrcweir 
601cdf0e10cSrcweir 								// make moved handle visible
602cdf0e10cSrcweir 								Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
603cdf0e10cSrcweir 								pView->MakeVisible(aVisRect, *pWindow);
604cdf0e10cSrcweir 
605cdf0e10cSrcweir 								bReturn = sal_True;
606cdf0e10cSrcweir 							}
607cdf0e10cSrcweir 						}
608cdf0e10cSrcweir 					}
609cdf0e10cSrcweir 				}
610cdf0e10cSrcweir 			}
611cdf0e10cSrcweir 		}
612cdf0e10cSrcweir 		break;
613cdf0e10cSrcweir 
614cdf0e10cSrcweir 		// #97016#
615cdf0e10cSrcweir 		case KEY_SPACE:
616cdf0e10cSrcweir 		{
617cdf0e10cSrcweir 			// in calc do only something when draw objects are selected
618cdf0e10cSrcweir 			if(pView->AreObjectsMarked())
619cdf0e10cSrcweir 			{
620cdf0e10cSrcweir 				const SdrHdlList& rHdlList = pView->GetHdlList();
621cdf0e10cSrcweir 				SdrHdl* pHdl = rHdlList.GetFocusHdl();
622cdf0e10cSrcweir 
623cdf0e10cSrcweir 				if(pHdl)
624cdf0e10cSrcweir 				{
625cdf0e10cSrcweir 					if(pHdl->GetKind() == HDL_POLY)
626cdf0e10cSrcweir 					{
627cdf0e10cSrcweir 						// rescue ID of point with focus
628cdf0e10cSrcweir 						sal_uInt32 nPol(pHdl->GetPolyNum());
629cdf0e10cSrcweir 						sal_uInt32 nPnt(pHdl->GetPointNum());
630cdf0e10cSrcweir 
631cdf0e10cSrcweir 						if(pView->IsPointMarked(*pHdl))
632cdf0e10cSrcweir 						{
633cdf0e10cSrcweir 							if(rKEvt.GetKeyCode().IsShift())
634cdf0e10cSrcweir 							{
635cdf0e10cSrcweir 								pView->UnmarkPoint(*pHdl);
636cdf0e10cSrcweir 							}
637cdf0e10cSrcweir 						}
638cdf0e10cSrcweir 						else
639cdf0e10cSrcweir 						{
640cdf0e10cSrcweir 							if(!rKEvt.GetKeyCode().IsShift())
641cdf0e10cSrcweir 							{
642cdf0e10cSrcweir 								pView->UnmarkAllPoints();
643cdf0e10cSrcweir 							}
644cdf0e10cSrcweir 
645cdf0e10cSrcweir 							pView->MarkPoint(*pHdl);
646cdf0e10cSrcweir 						}
647cdf0e10cSrcweir 
648cdf0e10cSrcweir 						if(0L == rHdlList.GetFocusHdl())
649cdf0e10cSrcweir 						{
650cdf0e10cSrcweir 							// restore point with focus
651cdf0e10cSrcweir 							SdrHdl* pNewOne = 0L;
652cdf0e10cSrcweir 
653cdf0e10cSrcweir 							for(sal_uInt32 a(0); !pNewOne && a < rHdlList.GetHdlCount(); a++)
654cdf0e10cSrcweir 							{
655cdf0e10cSrcweir 								SdrHdl* pAct = rHdlList.GetHdl(a);
656cdf0e10cSrcweir 
657cdf0e10cSrcweir 								if(pAct
658cdf0e10cSrcweir 									&& pAct->GetKind() == HDL_POLY
659cdf0e10cSrcweir 									&& pAct->GetPolyNum() == nPol
660cdf0e10cSrcweir 									&& pAct->GetPointNum() == nPnt)
661cdf0e10cSrcweir 								{
662cdf0e10cSrcweir 									pNewOne = pAct;
663cdf0e10cSrcweir 								}
664cdf0e10cSrcweir 							}
665cdf0e10cSrcweir 
666cdf0e10cSrcweir 							if(pNewOne)
667cdf0e10cSrcweir 							{
668cdf0e10cSrcweir 								((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
669cdf0e10cSrcweir 							}
670cdf0e10cSrcweir 						}
671cdf0e10cSrcweir 
672cdf0e10cSrcweir 						bReturn = sal_True;
673cdf0e10cSrcweir 					}
674cdf0e10cSrcweir 				}
675cdf0e10cSrcweir 			}
676cdf0e10cSrcweir 		}
677cdf0e10cSrcweir 		break;
678cdf0e10cSrcweir 	}
679cdf0e10cSrcweir 
680cdf0e10cSrcweir 	if (!bReturn)
681cdf0e10cSrcweir 	{
682cdf0e10cSrcweir 		bReturn = FuPoor::KeyInput(rKEvt);
683cdf0e10cSrcweir 	}
684cdf0e10cSrcweir 
685cdf0e10cSrcweir 	if (!bReturn)
686cdf0e10cSrcweir 	{
687cdf0e10cSrcweir 		// #98198# allow direct typing into a selected text object
688cdf0e10cSrcweir 
689cdf0e10cSrcweir 		const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
690cdf0e10cSrcweir 		if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() && EditEngine::IsSimpleCharInput(rKEvt) )
691cdf0e10cSrcweir 		{
692cdf0e10cSrcweir             SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
693cdf0e10cSrcweir 
694cdf0e10cSrcweir 			// start text edit for suitable object, pass key event to OutlinerView
695cdf0e10cSrcweir 			if ( lcl_KeyEditMode( pObj, pViewShell, &rKEvt ) )
696cdf0e10cSrcweir 				bReturn = sal_True;
697cdf0e10cSrcweir 		}
698cdf0e10cSrcweir 	}
699cdf0e10cSrcweir 
700cdf0e10cSrcweir 	return (bReturn);
701cdf0e10cSrcweir }
702cdf0e10cSrcweir 
703cdf0e10cSrcweir // #97016# II
704cdf0e10cSrcweir void FuDraw::SelectionHasChanged()
705cdf0e10cSrcweir {
706cdf0e10cSrcweir 	const SdrHdlList& rHdlList = pView->GetHdlList();
707cdf0e10cSrcweir 	((SdrHdlList&)rHdlList).ResetFocusHdl();
708cdf0e10cSrcweir }
709cdf0e10cSrcweir 
710cdf0e10cSrcweir /*************************************************************************
711cdf0e10cSrcweir |*
712cdf0e10cSrcweir |* Vor dem Scrollen Selektionsdarstellung ausblenden
713cdf0e10cSrcweir |*
714cdf0e10cSrcweir \************************************************************************/
715cdf0e10cSrcweir 
716cdf0e10cSrcweir void FuDraw::ScrollStart()
717cdf0e10cSrcweir {
718cdf0e10cSrcweir //		HideShownXor in Gridwin
719cdf0e10cSrcweir }
720cdf0e10cSrcweir 
721cdf0e10cSrcweir /*************************************************************************
722cdf0e10cSrcweir |*
723cdf0e10cSrcweir |* Nach dem Scrollen Selektionsdarstellung wieder anzeigen
724cdf0e10cSrcweir |*
725cdf0e10cSrcweir \************************************************************************/
726cdf0e10cSrcweir 
727cdf0e10cSrcweir void FuDraw::ScrollEnd()
728cdf0e10cSrcweir {
729cdf0e10cSrcweir //		ShowShownXor in Gridwin
730cdf0e10cSrcweir }
731cdf0e10cSrcweir 
732cdf0e10cSrcweir /*************************************************************************
733cdf0e10cSrcweir |*
734cdf0e10cSrcweir |* Function aktivieren
735cdf0e10cSrcweir |*
736cdf0e10cSrcweir \************************************************************************/
737cdf0e10cSrcweir 
738cdf0e10cSrcweir void FuDraw::Activate()
739cdf0e10cSrcweir {
740cdf0e10cSrcweir 	FuPoor::Activate();
741cdf0e10cSrcweir }
742cdf0e10cSrcweir 
743cdf0e10cSrcweir /*************************************************************************
744cdf0e10cSrcweir |*
745cdf0e10cSrcweir |* Function deaktivieren
746cdf0e10cSrcweir |*
747cdf0e10cSrcweir \************************************************************************/
748cdf0e10cSrcweir 
749cdf0e10cSrcweir void FuDraw::Deactivate()
750cdf0e10cSrcweir {
751cdf0e10cSrcweir 	FuPoor::Deactivate();
752cdf0e10cSrcweir }
753cdf0e10cSrcweir 
754cdf0e10cSrcweir /*************************************************************************
755cdf0e10cSrcweir |*
756cdf0e10cSrcweir |* Maus-Pointer umschalten
757cdf0e10cSrcweir |*
758cdf0e10cSrcweir \************************************************************************/
759cdf0e10cSrcweir 
760cdf0e10cSrcweir sal_Bool lcl_UrlHit( SdrView* pView, const Point& rPosPixel, Window* pWindow )
761cdf0e10cSrcweir {
762cdf0e10cSrcweir 	SdrViewEvent aVEvt;
763cdf0e10cSrcweir 	MouseEvent aMEvt( rPosPixel, 1, 0, MOUSE_LEFT );
764cdf0e10cSrcweir 	SdrHitKind eHit = pView->PickAnything( aMEvt, SDRMOUSEBUTTONDOWN, aVEvt );
765cdf0e10cSrcweir 
766cdf0e10cSrcweir 	if ( eHit != SDRHIT_NONE && aVEvt.pObj != NULL )
767cdf0e10cSrcweir 	{
768cdf0e10cSrcweir 		if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) && ScDrawLayer::GetHitIMapObject(
769cdf0e10cSrcweir 								aVEvt.pObj, pWindow->PixelToLogic(rPosPixel), *pWindow ) )
770cdf0e10cSrcweir 			return sal_True;
771cdf0e10cSrcweir 
772cdf0e10cSrcweir 		if ( aVEvt.eEvent == SDREVENT_EXECUTEURL )
773cdf0e10cSrcweir 			return sal_True;
774cdf0e10cSrcweir 	}
775cdf0e10cSrcweir 
776cdf0e10cSrcweir 	return sal_False;
777cdf0e10cSrcweir }
778cdf0e10cSrcweir 
779cdf0e10cSrcweir void FuDraw::ForcePointer(const MouseEvent* pMEvt)
780cdf0e10cSrcweir {
781cdf0e10cSrcweir 	if ( !pView->IsAction() )
782cdf0e10cSrcweir 	{
783cdf0e10cSrcweir 		Point aPosPixel = pWindow->GetPointerPosPixel();
784cdf0e10cSrcweir 		sal_Bool bAlt		= pMEvt && pMEvt->IsMod2();
785cdf0e10cSrcweir 		Point aPnt		= pWindow->PixelToLogic( aPosPixel );
786cdf0e10cSrcweir 		SdrHdl* pHdl	= pView->PickHandle(aPnt);
787cdf0e10cSrcweir 		SdrObject* pObj;
788cdf0e10cSrcweir 		SdrPageView* pPV;
789cdf0e10cSrcweir 
790cdf0e10cSrcweir         ScMacroInfo* pInfo = 0;
791cdf0e10cSrcweir         if ( pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER) )
792cdf0e10cSrcweir         {
793cdf0e10cSrcweir             if ( pObj->IsGroupObject() )
794cdf0e10cSrcweir             {
795cdf0e10cSrcweir                 SdrObject* pHit = 0;
796cdf0e10cSrcweir                 if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
797cdf0e10cSrcweir                     pObj = pHit;
798cdf0e10cSrcweir             }
799cdf0e10cSrcweir             pInfo = ScDrawLayer::GetMacroInfo( pObj );
800cdf0e10cSrcweir         }
801cdf0e10cSrcweir 
802cdf0e10cSrcweir 		if ( pView->IsTextEdit() )
803cdf0e10cSrcweir 		{
804cdf0e10cSrcweir 			pViewShell->SetActivePointer(Pointer(POINTER_TEXT));		// kann nicht sein ?
805cdf0e10cSrcweir 		}
806cdf0e10cSrcweir 		else if ( pHdl )
807cdf0e10cSrcweir 		{
808cdf0e10cSrcweir 			pViewShell->SetActivePointer(
809cdf0e10cSrcweir 				pView->GetPreferedPointer( aPnt, pWindow ) );
810cdf0e10cSrcweir 		}
811cdf0e10cSrcweir 		else if ( pView->IsMarkedHit(aPnt) )
812cdf0e10cSrcweir 		{
813cdf0e10cSrcweir 			pViewShell->SetActivePointer( Pointer(POINTER_MOVE) );
814cdf0e10cSrcweir 		}
815cdf0e10cSrcweir 		else if ( !bAlt && ( !pMEvt || !pMEvt->GetButtons() )
816cdf0e10cSrcweir 						&& lcl_UrlHit( pView, aPosPixel, pWindow ) )
817cdf0e10cSrcweir 		{
818cdf0e10cSrcweir 			//	kann mit ALT unterdrueckt werden
819cdf0e10cSrcweir 			pWindow->SetPointer( Pointer( POINTER_REFHAND ) );			// Text-URL / ImageMap
820cdf0e10cSrcweir 		}
821cdf0e10cSrcweir 		else if ( !bAlt && pView->PickObj(aPnt, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
822cdf0e10cSrcweir 		{
823cdf0e10cSrcweir 			//	kann mit ALT unterdrueckt werden
824cdf0e10cSrcweir 			SdrObjMacroHitRec aHitRec;	//! muss da noch irgendwas gesetzt werden ????
825cdf0e10cSrcweir 			pViewShell->SetActivePointer( pObj->GetMacroPointer(aHitRec) );
826cdf0e10cSrcweir 		}
827cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
828cdf0e10cSrcweir         else if ( !bAlt && pInfo && ((pInfo->GetMacro().getLength() > 0) || (pInfo->GetHlink().getLength() > 0)) )
829cdf0e10cSrcweir #else
830cdf0e10cSrcweir         else if ( !bAlt && pInfo && (pInfo->GetMacro().getLength() > 0) )
831cdf0e10cSrcweir #endif
832cdf0e10cSrcweir 			pWindow->SetPointer( Pointer( POINTER_REFHAND ) );
833cdf0e10cSrcweir 		else if ( IsDetectiveHit( aPnt ) )
834cdf0e10cSrcweir 			pViewShell->SetActivePointer( Pointer( POINTER_DETECTIVE ) );
835cdf0e10cSrcweir 		else
836cdf0e10cSrcweir 			pViewShell->SetActivePointer( aNewPointer );			//! in Gridwin?
837cdf0e10cSrcweir 	}
838cdf0e10cSrcweir }
839cdf0e10cSrcweir 
840cdf0e10cSrcweir sal_Bool FuDraw::IsSizingOrMovingNote( const MouseEvent& rMEvt ) const
841cdf0e10cSrcweir {
842cdf0e10cSrcweir     sal_Bool bIsSizingOrMoving = sal_False;
843cdf0e10cSrcweir     if ( rMEvt.IsLeft() )
844cdf0e10cSrcweir     {
845cdf0e10cSrcweir         const SdrMarkList& rNoteMarkList = pView->GetMarkedObjectList();
846cdf0e10cSrcweir         if(rNoteMarkList.GetMarkCount() == 1)
847cdf0e10cSrcweir         {
848cdf0e10cSrcweir             SdrObject* pObj = rNoteMarkList.GetMark( 0 )->GetMarkedSdrObj();
849cdf0e10cSrcweir             if ( ScDrawLayer::IsNoteCaption( pObj ) )
850cdf0e10cSrcweir             {
851cdf0e10cSrcweir                 Point aMPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
852cdf0e10cSrcweir                 bIsSizingOrMoving =
853cdf0e10cSrcweir                     pView->PickHandle( aMPos ) ||      // handles to resize the note
854cdf0e10cSrcweir                     pView->IsTextEditFrameHit( aMPos );         // frame for moving the note
855cdf0e10cSrcweir             }
856cdf0e10cSrcweir         }
857cdf0e10cSrcweir     }
858cdf0e10cSrcweir     return bIsSizingOrMoving;
859cdf0e10cSrcweir }
860