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