xref: /AOO41X/main/sd/source/ui/func/fuediglu.cxx (revision 0deba7fbda3d9908785c25a443701a293b6f4e71)
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 #include "fuediglu.hxx"
28cdf0e10cSrcweir #include <svl/eitem.hxx>
29cdf0e10cSrcweir #include <svx/dialogs.hrc>
30cdf0e10cSrcweir #include <svx/svdglue.hxx>
31cdf0e10cSrcweir #include <sfx2/request.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include "app.hrc"
35cdf0e10cSrcweir #include "strings.hrc"
36cdf0e10cSrcweir #include "res_bmp.hrc"
37cdf0e10cSrcweir #ifndef SD_WINDOW_SHELL_HXX
38cdf0e10cSrcweir #include "Window.hxx"
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir #include "drawdoc.hxx"
41cdf0e10cSrcweir #ifndef SD_FRAMW_VIEW_HXX
42cdf0e10cSrcweir #include "FrameView.hxx"
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #include "View.hxx"
45cdf0e10cSrcweir #include "ViewShell.hxx"
46cdf0e10cSrcweir #include "ViewShellBase.hxx"
47cdf0e10cSrcweir #include "ToolBarManager.hxx"
48cdf0e10cSrcweir 
49cdf0e10cSrcweir namespace sd {
50cdf0e10cSrcweir 
51cdf0e10cSrcweir TYPEINIT1( FuEditGluePoints, FuDraw );
52cdf0e10cSrcweir 
53cdf0e10cSrcweir /*************************************************************************
54cdf0e10cSrcweir |*
55cdf0e10cSrcweir |* Konstruktor
56cdf0e10cSrcweir |*
57cdf0e10cSrcweir \************************************************************************/
58cdf0e10cSrcweir 
59cdf0e10cSrcweir FuEditGluePoints::FuEditGluePoints (
60cdf0e10cSrcweir     ViewShell* pViewSh,
61cdf0e10cSrcweir     ::sd::Window* pWin,
62cdf0e10cSrcweir     ::sd::View* pView,
63cdf0e10cSrcweir     SdDrawDocument*	pDoc,
64cdf0e10cSrcweir     SfxRequest& rReq)
65cdf0e10cSrcweir     : FuDraw(pViewSh, pWin, pView, pDoc, rReq)
66*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
67*0deba7fbSSteve Yin 	 //Solution: Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point,
68*0deba7fbSSteve Yin 	 //and SHIFT+ENTER key to decide the postion and draw the new insert point
69*0deba7fbSSteve Yin 	 ,bBeginInsertPoint(sal_False),
70*0deba7fbSSteve Yin 	oldPoint(0,0)
71*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
72cdf0e10cSrcweir {
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir FunctionReference FuEditGluePoints::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
76cdf0e10cSrcweir {
77cdf0e10cSrcweir 	FuEditGluePoints* pFunc;
78cdf0e10cSrcweir 	FunctionReference xFunc( pFunc = new FuEditGluePoints( pViewSh, pWin, pView, pDoc, rReq ) );
79cdf0e10cSrcweir 	xFunc->DoExecute(rReq);
80cdf0e10cSrcweir 	pFunc->SetPermanent( bPermanent );
81cdf0e10cSrcweir 	return xFunc;
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir void FuEditGluePoints::DoExecute( SfxRequest& rReq )
85cdf0e10cSrcweir {
86cdf0e10cSrcweir 	FuDraw::DoExecute( rReq );
87cdf0e10cSrcweir 	mpView->SetInsGluePointMode(sal_False);
88cdf0e10cSrcweir     mpViewShell->GetViewShellBase().GetToolBarManager()->AddToolBar(
89cdf0e10cSrcweir         ToolBarManager::TBG_FUNCTION,
90cdf0e10cSrcweir         ToolBarManager::msGluePointsToolBar);
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir /*************************************************************************
94cdf0e10cSrcweir |*
95cdf0e10cSrcweir |* Destruktor
96cdf0e10cSrcweir |*
97cdf0e10cSrcweir \************************************************************************/
98cdf0e10cSrcweir 
99cdf0e10cSrcweir FuEditGluePoints::~FuEditGluePoints()
100cdf0e10cSrcweir {
101cdf0e10cSrcweir 	mpView->BrkAction();
102cdf0e10cSrcweir 	mpView->UnmarkAllGluePoints();
103cdf0e10cSrcweir 	mpView->SetInsGluePointMode(sal_False);
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir /*************************************************************************
107cdf0e10cSrcweir |*
108cdf0e10cSrcweir |* MouseButtonDown-event
109cdf0e10cSrcweir |*
110cdf0e10cSrcweir \************************************************************************/
111cdf0e10cSrcweir 
112cdf0e10cSrcweir sal_Bool FuEditGluePoints::MouseButtonDown(const MouseEvent& rMEvt)
113cdf0e10cSrcweir {
114cdf0e10cSrcweir 	mpView->SetActualWin( mpWindow );
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt);
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	if (mpView->IsAction())
119cdf0e10cSrcweir 	{
120cdf0e10cSrcweir 		if (rMEvt.IsRight())
121cdf0e10cSrcweir 			mpView->BckAction();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 		return sal_True;
124cdf0e10cSrcweir 	}
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	if (rMEvt.IsLeft())
127cdf0e10cSrcweir 	{
128cdf0e10cSrcweir 		bReturn = sal_True;
129cdf0e10cSrcweir 		sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
130cdf0e10cSrcweir 		sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
131cdf0e10cSrcweir 		mpWindow->CaptureMouse();
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 		SdrViewEvent aVEvt;
134cdf0e10cSrcweir 		SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 		if (eHit == SDRHIT_HANDLE)
137cdf0e10cSrcweir 		{
138cdf0e10cSrcweir 			/******************************************************************
139cdf0e10cSrcweir 			* Handle draggen
140cdf0e10cSrcweir 			******************************************************************/
141cdf0e10cSrcweir 			SdrHdl* pHdl = aVEvt.pHdl;
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 			if (mpView->IsGluePointMarked(aVEvt.pObj, aVEvt.nGlueId) && rMEvt.IsShift())
144cdf0e10cSrcweir 			{
145cdf0e10cSrcweir 				mpView->UnmarkGluePoint(aVEvt.pObj, aVEvt.nGlueId, aVEvt.pPV);
146cdf0e10cSrcweir 				pHdl = NULL;
147cdf0e10cSrcweir 			}
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 			if (pHdl)
150cdf0e10cSrcweir 			{
151cdf0e10cSrcweir 				// Handle draggen
152cdf0e10cSrcweir 				mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
153cdf0e10cSrcweir 			}
154cdf0e10cSrcweir 		}
155cdf0e10cSrcweir 		else if (eHit == SDRHIT_MARKEDOBJECT && mpView->IsInsGluePointMode())
156cdf0e10cSrcweir 		{
157cdf0e10cSrcweir 			/******************************************************************
158cdf0e10cSrcweir 			* Klebepunkt einfuegen
159cdf0e10cSrcweir 			******************************************************************/
160cdf0e10cSrcweir 			mpView->BegInsGluePoint(aMDPos);
161cdf0e10cSrcweir 		}
162cdf0e10cSrcweir 		else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1())
163cdf0e10cSrcweir 		{
164cdf0e10cSrcweir 			/******************************************************************
165cdf0e10cSrcweir 			* Klebepunkt selektieren
166cdf0e10cSrcweir 			******************************************************************/
167cdf0e10cSrcweir 			if (!rMEvt.IsShift())
168cdf0e10cSrcweir 				mpView->UnmarkAllGluePoints();
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 			mpView->BegMarkGluePoints(aMDPos);
171cdf0e10cSrcweir 		}
172cdf0e10cSrcweir 		else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2())
173cdf0e10cSrcweir 		{
174cdf0e10cSrcweir 			/******************************************************************
175cdf0e10cSrcweir 			* Objekt verschieben
176cdf0e10cSrcweir 			******************************************************************/
177cdf0e10cSrcweir 			mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, NULL, nDrgLog);
178cdf0e10cSrcweir 		}
179cdf0e10cSrcweir 		else if (eHit == SDRHIT_GLUEPOINT)
180cdf0e10cSrcweir 		{
181cdf0e10cSrcweir 			/******************************************************************
182cdf0e10cSrcweir 			* Klebepunkt selektieren
183cdf0e10cSrcweir 			******************************************************************/
184cdf0e10cSrcweir 			if (!rMEvt.IsShift())
185cdf0e10cSrcweir 				mpView->UnmarkAllGluePoints();
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 			mpView->MarkGluePoint(aVEvt.pObj, aVEvt.nGlueId, aVEvt.pPV);
188cdf0e10cSrcweir 			SdrHdl* pHdl = mpView->GetGluePointHdl(aVEvt.pObj, aVEvt.nGlueId);
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 			if (pHdl)
191cdf0e10cSrcweir 			{
192cdf0e10cSrcweir 				mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
193cdf0e10cSrcweir 			}
194cdf0e10cSrcweir 		}
195cdf0e10cSrcweir 		else
196cdf0e10cSrcweir 		{
197cdf0e10cSrcweir 			/******************************************************************
198cdf0e10cSrcweir 			* Objekt selektieren oder draggen
199cdf0e10cSrcweir 			******************************************************************/
200cdf0e10cSrcweir 			if (!rMEvt.IsShift() && !rMEvt.IsMod2() && eHit == SDRHIT_UNMARKEDOBJECT)
201cdf0e10cSrcweir 			{
202cdf0e10cSrcweir 			   mpView->UnmarkAllObj();
203cdf0e10cSrcweir 			}
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 			sal_Bool bMarked = sal_False;
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 			if (!rMEvt.IsMod1())
208cdf0e10cSrcweir 			{
209cdf0e10cSrcweir 				if (rMEvt.IsMod2())
210cdf0e10cSrcweir 				{
211cdf0e10cSrcweir 					bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift());
212cdf0e10cSrcweir 				}
213cdf0e10cSrcweir 				else
214cdf0e10cSrcweir 				{
215cdf0e10cSrcweir 					bMarked = mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift());
216cdf0e10cSrcweir 				}
217cdf0e10cSrcweir 			}
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 			if (bMarked &&
220cdf0e10cSrcweir 				(!rMEvt.IsShift() || eHit == SDRHIT_MARKEDOBJECT))
221cdf0e10cSrcweir 			{
222cdf0e10cSrcweir 				// Objekt verschieben
223cdf0e10cSrcweir 				mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
224cdf0e10cSrcweir 			}
225cdf0e10cSrcweir 			else if (mpView->AreObjectsMarked())
226cdf0e10cSrcweir 			{
227cdf0e10cSrcweir 				/**************************************************************
228cdf0e10cSrcweir 				* Klebepunkt selektieren
229cdf0e10cSrcweir 				**************************************************************/
230cdf0e10cSrcweir 				if (!rMEvt.IsShift())
231cdf0e10cSrcweir 					mpView->UnmarkAllGluePoints();
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 				mpView->BegMarkGluePoints(aMDPos);
234cdf0e10cSrcweir 			}
235cdf0e10cSrcweir 			else
236cdf0e10cSrcweir 			{
237cdf0e10cSrcweir 				/**************************************************************
238cdf0e10cSrcweir 				* Objekt selektieren
239cdf0e10cSrcweir 				**************************************************************/
240cdf0e10cSrcweir 				mpView->BegMarkObj(aMDPos);
241cdf0e10cSrcweir 			}
242cdf0e10cSrcweir 		}
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 		ForcePointer(&rMEvt);
245cdf0e10cSrcweir 	}
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 	return bReturn;
248cdf0e10cSrcweir }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir /*************************************************************************
251cdf0e10cSrcweir |*
252cdf0e10cSrcweir |* MouseMove-event
253cdf0e10cSrcweir |*
254cdf0e10cSrcweir \************************************************************************/
255cdf0e10cSrcweir 
256cdf0e10cSrcweir sal_Bool FuEditGluePoints::MouseMove(const MouseEvent& rMEvt)
257cdf0e10cSrcweir {
258cdf0e10cSrcweir 	mpView->SetActualWin( mpWindow );
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	FuDraw::MouseMove(rMEvt);
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 	if (mpView->IsAction())
263cdf0e10cSrcweir 	{
264cdf0e10cSrcweir 		Point aPix(rMEvt.GetPosPixel());
265cdf0e10cSrcweir 		Point aPnt( mpWindow->PixelToLogic(aPix) );
266cdf0e10cSrcweir 		ForceScroll(aPix);
267cdf0e10cSrcweir 		mpView->MovAction(aPnt);
268cdf0e10cSrcweir 	}
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 	ForcePointer(&rMEvt);
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 	return sal_True;
273cdf0e10cSrcweir }
274cdf0e10cSrcweir 
275cdf0e10cSrcweir /*************************************************************************
276cdf0e10cSrcweir |*
277cdf0e10cSrcweir |* MouseButtonUp-event
278cdf0e10cSrcweir |*
279cdf0e10cSrcweir \************************************************************************/
280cdf0e10cSrcweir 
281cdf0e10cSrcweir sal_Bool FuEditGluePoints::MouseButtonUp(const MouseEvent& rMEvt)
282cdf0e10cSrcweir {
283cdf0e10cSrcweir 	mpView->SetActualWin( mpWindow );
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 	if (mpView->IsAction())
288cdf0e10cSrcweir 	{
289cdf0e10cSrcweir 		bReturn = sal_True;
290cdf0e10cSrcweir 		mpView->EndAction();
291cdf0e10cSrcweir 	}
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 	FuDraw::MouseButtonUp(rMEvt);
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 	sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
296cdf0e10cSrcweir 	Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 	if (Abs(aMDPos.X() - aPos.X()) < nDrgLog &&
299cdf0e10cSrcweir 		Abs(aMDPos.Y() - aPos.Y()) < nDrgLog &&
300cdf0e10cSrcweir 		!rMEvt.IsShift() && !rMEvt.IsMod2())
301cdf0e10cSrcweir 	{
302cdf0e10cSrcweir 		SdrViewEvent aVEvt;
303cdf0e10cSrcweir 		SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 		if (eHit == SDRHIT_NONE)
306cdf0e10cSrcweir 		{
307cdf0e10cSrcweir 			// Klick auf der Stelle: deselektieren
308cdf0e10cSrcweir 			mpView->UnmarkAllObj();
309cdf0e10cSrcweir 		}
310cdf0e10cSrcweir 	}
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 	mpWindow->ReleaseMouse();
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 	return bReturn;
315cdf0e10cSrcweir }
316cdf0e10cSrcweir 
317cdf0e10cSrcweir /*************************************************************************
318cdf0e10cSrcweir |*
319cdf0e10cSrcweir |* Tastaturereignisse bearbeiten
320cdf0e10cSrcweir |*
321cdf0e10cSrcweir |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
322cdf0e10cSrcweir |* sal_False.
323cdf0e10cSrcweir |*
324cdf0e10cSrcweir \************************************************************************/
325cdf0e10cSrcweir 
326cdf0e10cSrcweir sal_Bool FuEditGluePoints::KeyInput(const KeyEvent& rKEvt)
327cdf0e10cSrcweir {
328cdf0e10cSrcweir 	mpView->SetActualWin( mpWindow );
329cdf0e10cSrcweir 
330*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
331*0deba7fbSSteve Yin 	//Solution: Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point,
332*0deba7fbSSteve Yin 	//and SHIFT+ENTER key to decide the postion and draw the new insert point
333*0deba7fbSSteve Yin 	//sal_Bool bReturn = FuDraw::KeyInput(rKEvt);
334cdf0e10cSrcweir 
335*0deba7fbSSteve Yin 	sal_Bool bReturn = sal_False;
336*0deba7fbSSteve Yin 
337*0deba7fbSSteve Yin 	switch (rKEvt.GetKeyCode().GetCode())
338*0deba7fbSSteve Yin 	{
339*0deba7fbSSteve Yin 		case KEY_UP:
340*0deba7fbSSteve Yin 		case KEY_DOWN:
341*0deba7fbSSteve Yin 		case KEY_LEFT:
342*0deba7fbSSteve Yin 		case KEY_RIGHT:
343*0deba7fbSSteve Yin 		{
344*0deba7fbSSteve Yin 			if(rKEvt.GetKeyCode().IsShift()&& mpView->IsInsGluePointMode() ){
345*0deba7fbSSteve Yin 				long nX = 0;
346*0deba7fbSSteve Yin 				long nY = 0;
347*0deba7fbSSteve Yin 				sal_uInt16  nCode = rKEvt.GetKeyCode().GetCode();
348*0deba7fbSSteve Yin 				if (nCode == KEY_UP)
349*0deba7fbSSteve Yin 				{
350*0deba7fbSSteve Yin 					// Scroll nach oben
351*0deba7fbSSteve Yin 					nX = 0;
352*0deba7fbSSteve Yin 					nY =-1;
353*0deba7fbSSteve Yin 				}
354*0deba7fbSSteve Yin 				else if (nCode == KEY_DOWN)
355*0deba7fbSSteve Yin 				{
356*0deba7fbSSteve Yin 					// Scroll nach unten
357*0deba7fbSSteve Yin 					nX = 0;
358*0deba7fbSSteve Yin 					nY = 1;
359*0deba7fbSSteve Yin 				}
360*0deba7fbSSteve Yin 				else if (nCode == KEY_LEFT)
361*0deba7fbSSteve Yin 				{
362*0deba7fbSSteve Yin 					// Scroll nach links
363*0deba7fbSSteve Yin 					nX =-1;
364*0deba7fbSSteve Yin 					nY = 0;
365*0deba7fbSSteve Yin 				}
366*0deba7fbSSteve Yin 				else if (nCode == KEY_RIGHT)
367*0deba7fbSSteve Yin 				{
368*0deba7fbSSteve Yin 					// Scroll nach rechts
369*0deba7fbSSteve Yin 					nX = 1;
370*0deba7fbSSteve Yin 					nY = 0;
371*0deba7fbSSteve Yin 				}
372*0deba7fbSSteve Yin 				Point centerPoint;
373*0deba7fbSSteve Yin 				Rectangle rect = mpView->GetMarkedObjRect();
374*0deba7fbSSteve Yin 				centerPoint = mpWindow->LogicToPixel(rect.Center());
375*0deba7fbSSteve Yin 				Point aPoint = bBeginInsertPoint? oldPoint:centerPoint;
376*0deba7fbSSteve Yin 				Point ePoint = aPoint + Point(nX,nY);
377*0deba7fbSSteve Yin 				mpWindow->SetPointerPosPixel(ePoint);
378*0deba7fbSSteve Yin 				//simulate mouse move action
379*0deba7fbSSteve Yin 				MouseEvent eMevt(ePoint,1,2,MOUSE_LEFT, 0);
380*0deba7fbSSteve Yin 				MouseMove(eMevt);
381*0deba7fbSSteve Yin 	                     Point aPix(eMevt.GetPosPixel());
382*0deba7fbSSteve Yin 				oldPoint = ePoint;
383*0deba7fbSSteve Yin 				bBeginInsertPoint = sal_True;
384*0deba7fbSSteve Yin 				bReturn = sal_True;
385*0deba7fbSSteve Yin 			}
386*0deba7fbSSteve Yin 		}
387*0deba7fbSSteve Yin 		break;
388*0deba7fbSSteve Yin 		case KEY_RETURN:
389*0deba7fbSSteve Yin 			if(rKEvt.GetKeyCode().IsShift() && mpView->IsInsGluePointMode() )
390*0deba7fbSSteve Yin 			{
391*0deba7fbSSteve Yin 				if(bBeginInsertPoint)
392*0deba7fbSSteve Yin 				{
393*0deba7fbSSteve Yin 					mpWindow->SetPointerPosPixel(oldPoint);
394*0deba7fbSSteve Yin 					//simulate mouse button down action
395*0deba7fbSSteve Yin 					MouseEvent aMevt(oldPoint,1,3,MOUSE_LEFT,KEY_SHIFT);
396*0deba7fbSSteve Yin 					// MT IA2: Not used?
397*0deba7fbSSteve Yin 					// sal_uInt16 ubuttons = aMevt.GetButtons();
398*0deba7fbSSteve Yin 					// sal_uInt16 uMod		= aMevt.GetModifier();
399*0deba7fbSSteve Yin 					MouseButtonDown(aMevt);
400*0deba7fbSSteve Yin 					mpWindow->CaptureMouse();
401*0deba7fbSSteve Yin 					//simulate mouse button up action
402*0deba7fbSSteve Yin 					MouseEvent rMEvt(oldPoint+Point(0,0),1,17, MOUSE_LEFT, KEY_SHIFT);
403*0deba7fbSSteve Yin 					MouseButtonUp(rMEvt);
404*0deba7fbSSteve Yin 					bReturn= sal_True;
405*0deba7fbSSteve Yin 				}
406*0deba7fbSSteve Yin 			}
407*0deba7fbSSteve Yin 			break;
408*0deba7fbSSteve Yin 	}
409*0deba7fbSSteve Yin 	if(!bReturn)
410*0deba7fbSSteve Yin 		bReturn = FuDraw::KeyInput(rKEvt);
411*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
412cdf0e10cSrcweir 	return bReturn;
413cdf0e10cSrcweir }
414cdf0e10cSrcweir 
415*0deba7fbSSteve Yin //IAccessibility2 Implementation 2009-----
416*0deba7fbSSteve Yin  //Solution: Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point,
417*0deba7fbSSteve Yin  //and SHIFT+ENTER key to decide the postion and draw the new insert point
418*0deba7fbSSteve Yin void FuEditGluePoints::ForcePointer(const MouseEvent* pMEvt)
419*0deba7fbSSteve Yin {
420*0deba7fbSSteve Yin 	if(bBeginInsertPoint && pMEvt)
421*0deba7fbSSteve Yin 	{
422*0deba7fbSSteve Yin 		MouseEvent aMEvt(pMEvt->GetPosPixel(), pMEvt->GetClicks(),
423*0deba7fbSSteve Yin 			pMEvt->GetMode(), pMEvt->GetButtons(), pMEvt->GetModifier() & ~KEY_SHIFT);
424*0deba7fbSSteve Yin 		FuDraw::ForcePointer(&aMEvt);
425*0deba7fbSSteve Yin 	}
426*0deba7fbSSteve Yin 	else
427*0deba7fbSSteve Yin 	{
428*0deba7fbSSteve Yin 		FuDraw::ForcePointer(pMEvt);
429*0deba7fbSSteve Yin 	}
430*0deba7fbSSteve Yin }
431*0deba7fbSSteve Yin //-----IAccessibility2 Implementation 2009
432cdf0e10cSrcweir /*************************************************************************
433cdf0e10cSrcweir |*
434cdf0e10cSrcweir |* Command-event
435cdf0e10cSrcweir |*
436cdf0e10cSrcweir \************************************************************************/
437cdf0e10cSrcweir 
438cdf0e10cSrcweir sal_Bool FuEditGluePoints::Command(const CommandEvent& rCEvt)
439cdf0e10cSrcweir {
440cdf0e10cSrcweir 	mpView->SetActualWin( mpWindow );
441cdf0e10cSrcweir 	return FuPoor::Command( rCEvt );
442cdf0e10cSrcweir }
443cdf0e10cSrcweir 
444cdf0e10cSrcweir /*************************************************************************
445cdf0e10cSrcweir |*
446cdf0e10cSrcweir |* Funktion aktivieren
447cdf0e10cSrcweir |*
448cdf0e10cSrcweir \************************************************************************/
449cdf0e10cSrcweir 
450cdf0e10cSrcweir void FuEditGluePoints::Activate()
451cdf0e10cSrcweir {
452cdf0e10cSrcweir 	mpView->SetGluePointEditMode();
453cdf0e10cSrcweir 	FuDraw::Activate();
454cdf0e10cSrcweir }
455cdf0e10cSrcweir 
456cdf0e10cSrcweir /*************************************************************************
457cdf0e10cSrcweir |*
458cdf0e10cSrcweir |* Funktion deaktivieren
459cdf0e10cSrcweir |*
460cdf0e10cSrcweir \************************************************************************/
461cdf0e10cSrcweir 
462cdf0e10cSrcweir void FuEditGluePoints::Deactivate()
463cdf0e10cSrcweir {
464cdf0e10cSrcweir 	mpView->SetGluePointEditMode( sal_False );
465cdf0e10cSrcweir 	FuDraw::Deactivate();
466cdf0e10cSrcweir }
467cdf0e10cSrcweir 
468cdf0e10cSrcweir /*************************************************************************
469cdf0e10cSrcweir |*
470cdf0e10cSrcweir |* Request verarbeiten
471cdf0e10cSrcweir |*
472cdf0e10cSrcweir \************************************************************************/
473cdf0e10cSrcweir 
474cdf0e10cSrcweir void FuEditGluePoints::ReceiveRequest(SfxRequest& rReq)
475cdf0e10cSrcweir {
476cdf0e10cSrcweir 	switch (rReq.GetSlot())
477cdf0e10cSrcweir 	{
478cdf0e10cSrcweir 		case SID_GLUE_INSERT_POINT:
479cdf0e10cSrcweir 		{
480cdf0e10cSrcweir 			mpView->SetInsGluePointMode(!mpView->IsInsGluePointMode());
481cdf0e10cSrcweir 		}
482cdf0e10cSrcweir 		break;
483cdf0e10cSrcweir 
484cdf0e10cSrcweir 		case SID_GLUE_ESCDIR_LEFT:
485cdf0e10cSrcweir 		{
486cdf0e10cSrcweir 			mpView->SetMarkedGluePointsEscDir( SDRESC_LEFT,
487cdf0e10cSrcweir 					!mpView->IsMarkedGluePointsEscDir( SDRESC_LEFT ) );
488cdf0e10cSrcweir 		}
489cdf0e10cSrcweir 		break;
490cdf0e10cSrcweir 
491cdf0e10cSrcweir 		case SID_GLUE_ESCDIR_RIGHT:
492cdf0e10cSrcweir 		{
493cdf0e10cSrcweir 			mpView->SetMarkedGluePointsEscDir( SDRESC_RIGHT,
494cdf0e10cSrcweir 					!mpView->IsMarkedGluePointsEscDir( SDRESC_RIGHT ) );
495cdf0e10cSrcweir 		}
496cdf0e10cSrcweir 		break;
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 		case SID_GLUE_ESCDIR_TOP:
499cdf0e10cSrcweir 		{
500cdf0e10cSrcweir 			mpView->SetMarkedGluePointsEscDir( SDRESC_TOP,
501cdf0e10cSrcweir 					!mpView->IsMarkedGluePointsEscDir( SDRESC_TOP ) );
502cdf0e10cSrcweir 		}
503cdf0e10cSrcweir 		break;
504cdf0e10cSrcweir 
505cdf0e10cSrcweir 		case SID_GLUE_ESCDIR_BOTTOM:
506cdf0e10cSrcweir 		{
507cdf0e10cSrcweir 			mpView->SetMarkedGluePointsEscDir( SDRESC_BOTTOM,
508cdf0e10cSrcweir 					!mpView->IsMarkedGluePointsEscDir( SDRESC_BOTTOM ) );
509cdf0e10cSrcweir 		}
510cdf0e10cSrcweir 		break;
511cdf0e10cSrcweir 
512cdf0e10cSrcweir 		case SID_GLUE_PERCENT:
513cdf0e10cSrcweir 		{
514cdf0e10cSrcweir 			const SfxItemSet* pSet = rReq.GetArgs();
515cdf0e10cSrcweir 			const SfxPoolItem& rItem = pSet->Get(SID_GLUE_PERCENT);
516cdf0e10cSrcweir 			sal_Bool bPercent = ((const SfxBoolItem&) rItem).GetValue();
517cdf0e10cSrcweir 			mpView->SetMarkedGluePointsPercent(bPercent);
518cdf0e10cSrcweir 		}
519cdf0e10cSrcweir 		break;
520cdf0e10cSrcweir 
521cdf0e10cSrcweir 		case SID_GLUE_HORZALIGN_CENTER:
522cdf0e10cSrcweir 		{
523cdf0e10cSrcweir 			mpView->SetMarkedGluePointsAlign(sal_False, SDRHORZALIGN_CENTER);
524cdf0e10cSrcweir 		}
525cdf0e10cSrcweir 		break;
526cdf0e10cSrcweir 
527cdf0e10cSrcweir 		case SID_GLUE_HORZALIGN_LEFT:
528cdf0e10cSrcweir 		{
529cdf0e10cSrcweir 			mpView->SetMarkedGluePointsAlign(sal_False, SDRHORZALIGN_LEFT);
530cdf0e10cSrcweir 		}
531cdf0e10cSrcweir 		break;
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 		case SID_GLUE_HORZALIGN_RIGHT:
534cdf0e10cSrcweir 		{
535cdf0e10cSrcweir 			mpView->SetMarkedGluePointsAlign(sal_False, SDRHORZALIGN_RIGHT);
536cdf0e10cSrcweir 		}
537cdf0e10cSrcweir 		break;
538cdf0e10cSrcweir 
539cdf0e10cSrcweir 		case SID_GLUE_VERTALIGN_CENTER:
540cdf0e10cSrcweir 		{
541cdf0e10cSrcweir 			mpView->SetMarkedGluePointsAlign(sal_True, SDRVERTALIGN_CENTER);
542cdf0e10cSrcweir 		}
543cdf0e10cSrcweir 		break;
544cdf0e10cSrcweir 
545cdf0e10cSrcweir 		case SID_GLUE_VERTALIGN_TOP:
546cdf0e10cSrcweir 		{
547cdf0e10cSrcweir 			mpView->SetMarkedGluePointsAlign(sal_True, SDRVERTALIGN_TOP);
548cdf0e10cSrcweir 		}
549cdf0e10cSrcweir 		break;
550cdf0e10cSrcweir 
551cdf0e10cSrcweir 		case SID_GLUE_VERTALIGN_BOTTOM:
552cdf0e10cSrcweir 		{
553cdf0e10cSrcweir 			mpView->SetMarkedGluePointsAlign(sal_True, SDRVERTALIGN_BOTTOM);
554cdf0e10cSrcweir 		}
555cdf0e10cSrcweir 		break;
556cdf0e10cSrcweir 	}
557cdf0e10cSrcweir 
558cdf0e10cSrcweir 	// Zum Schluss Basisklasse rufen
559cdf0e10cSrcweir 	FuPoor::ReceiveRequest(rReq);
560cdf0e10cSrcweir }
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 
563cdf0e10cSrcweir } // end of namespace sd
564