1*31598a22SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*31598a22SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*31598a22SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*31598a22SAndrew Rist * distributed with this work for additional information
6*31598a22SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*31598a22SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*31598a22SAndrew Rist * "License"); you may not use this file except in compliance
9*31598a22SAndrew Rist * with the License. You may obtain a copy of the License at
10*31598a22SAndrew Rist *
11*31598a22SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*31598a22SAndrew Rist *
13*31598a22SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*31598a22SAndrew Rist * software distributed under the License is distributed on an
15*31598a22SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*31598a22SAndrew Rist * KIND, either express or implied. See the License for the
17*31598a22SAndrew Rist * specific language governing permissions and limitations
18*31598a22SAndrew Rist * under the License.
19*31598a22SAndrew Rist *
20*31598a22SAndrew Rist *************************************************************/
21*31598a22SAndrew Rist
22*31598a22SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_basctl.hxx"
26cdf0e10cSrcweir #include <vcl/scrbar.hxx>
27cdf0e10cSrcweir #include <svx/svdview.hxx>
28cdf0e10cSrcweir #include "dlgedfunc.hxx"
29cdf0e10cSrcweir #include "dlged.hxx"
30cdf0e10cSrcweir #include "dlgedview.hxx"
31cdf0e10cSrcweir #include <vcl/seleng.hxx>
32cdf0e10cSrcweir
33cdf0e10cSrcweir
34cdf0e10cSrcweir //----------------------------------------------------------------------------
35cdf0e10cSrcweir
IMPL_LINK_INLINE_START(DlgEdFunc,ScrollTimeout,Timer *,pTimer)36cdf0e10cSrcweir IMPL_LINK_INLINE_START( DlgEdFunc, ScrollTimeout, Timer *, pTimer )
37cdf0e10cSrcweir {
38cdf0e10cSrcweir (void)pTimer;
39cdf0e10cSrcweir Window* pWindow = pParent->GetWindow();
40cdf0e10cSrcweir Point aPos = pWindow->ScreenToOutputPixel( pWindow->GetPointerPosPixel() );
41cdf0e10cSrcweir aPos = pWindow->PixelToLogic( aPos );
42cdf0e10cSrcweir ForceScroll( aPos );
43cdf0e10cSrcweir return 0;
44cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(DlgEdFunc,ScrollTimeout,Timer *,pTimer)45cdf0e10cSrcweir IMPL_LINK_INLINE_END( DlgEdFunc, ScrollTimeout, Timer *, pTimer )
46cdf0e10cSrcweir
47cdf0e10cSrcweir //----------------------------------------------------------------------------
48cdf0e10cSrcweir
49cdf0e10cSrcweir void DlgEdFunc::ForceScroll( const Point& rPos )
50cdf0e10cSrcweir {
51cdf0e10cSrcweir aScrollTimer.Stop();
52cdf0e10cSrcweir
53cdf0e10cSrcweir Window* pWindow = pParent->GetWindow();
54cdf0e10cSrcweir
55cdf0e10cSrcweir static Point aDefPoint;
56cdf0e10cSrcweir Rectangle aOutRect( aDefPoint, pWindow->GetOutputSizePixel() );
57cdf0e10cSrcweir aOutRect = pWindow->PixelToLogic( aOutRect );
58cdf0e10cSrcweir
59cdf0e10cSrcweir ScrollBar* pHScroll = pParent->GetHScroll();
60cdf0e10cSrcweir ScrollBar* pVScroll = pParent->GetVScroll();
61cdf0e10cSrcweir long nDeltaX = pHScroll->GetLineSize();
62cdf0e10cSrcweir long nDeltaY = pVScroll->GetLineSize();
63cdf0e10cSrcweir
64cdf0e10cSrcweir if( !aOutRect.IsInside( rPos ) )
65cdf0e10cSrcweir {
66cdf0e10cSrcweir if( rPos.X() < aOutRect.Left() )
67cdf0e10cSrcweir nDeltaX = -nDeltaX;
68cdf0e10cSrcweir else
69cdf0e10cSrcweir if( rPos.X() <= aOutRect.Right() )
70cdf0e10cSrcweir nDeltaX = 0;
71cdf0e10cSrcweir
72cdf0e10cSrcweir if( rPos.Y() < aOutRect.Top() )
73cdf0e10cSrcweir nDeltaY = -nDeltaY;
74cdf0e10cSrcweir else
75cdf0e10cSrcweir if( rPos.Y() <= aOutRect.Bottom() )
76cdf0e10cSrcweir nDeltaY = 0;
77cdf0e10cSrcweir
78cdf0e10cSrcweir if( nDeltaX )
79cdf0e10cSrcweir pHScroll->SetThumbPos( pHScroll->GetThumbPos() + nDeltaX );
80cdf0e10cSrcweir if( nDeltaY )
81cdf0e10cSrcweir pVScroll->SetThumbPos( pVScroll->GetThumbPos() + nDeltaY );
82cdf0e10cSrcweir
83cdf0e10cSrcweir if( nDeltaX )
84cdf0e10cSrcweir pParent->DoScroll( pHScroll );
85cdf0e10cSrcweir if( nDeltaY )
86cdf0e10cSrcweir pParent->DoScroll( pVScroll );
87cdf0e10cSrcweir }
88cdf0e10cSrcweir
89cdf0e10cSrcweir aScrollTimer.Start();
90cdf0e10cSrcweir }
91cdf0e10cSrcweir
92cdf0e10cSrcweir //----------------------------------------------------------------------------
93cdf0e10cSrcweir
DlgEdFunc(DlgEditor * pParent_)94cdf0e10cSrcweir DlgEdFunc::DlgEdFunc( DlgEditor* pParent_ )
95cdf0e10cSrcweir {
96cdf0e10cSrcweir DlgEdFunc::pParent = pParent_;
97cdf0e10cSrcweir aScrollTimer.SetTimeoutHdl( LINK( this, DlgEdFunc, ScrollTimeout ) );
98cdf0e10cSrcweir aScrollTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL );
99cdf0e10cSrcweir }
100cdf0e10cSrcweir
101cdf0e10cSrcweir //----------------------------------------------------------------------------
102cdf0e10cSrcweir
~DlgEdFunc()103cdf0e10cSrcweir DlgEdFunc::~DlgEdFunc()
104cdf0e10cSrcweir {
105cdf0e10cSrcweir }
106cdf0e10cSrcweir
107cdf0e10cSrcweir //----------------------------------------------------------------------------
108cdf0e10cSrcweir
MouseButtonDown(const MouseEvent &)109cdf0e10cSrcweir sal_Bool DlgEdFunc::MouseButtonDown( const MouseEvent& )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir return sal_True;
112cdf0e10cSrcweir }
113cdf0e10cSrcweir
114cdf0e10cSrcweir //----------------------------------------------------------------------------
115cdf0e10cSrcweir
MouseButtonUp(const MouseEvent &)116cdf0e10cSrcweir sal_Bool DlgEdFunc::MouseButtonUp( const MouseEvent& )
117cdf0e10cSrcweir {
118cdf0e10cSrcweir aScrollTimer.Stop();
119cdf0e10cSrcweir return sal_True;
120cdf0e10cSrcweir }
121cdf0e10cSrcweir
122cdf0e10cSrcweir //----------------------------------------------------------------------------
123cdf0e10cSrcweir
MouseMove(const MouseEvent &)124cdf0e10cSrcweir sal_Bool DlgEdFunc::MouseMove( const MouseEvent& )
125cdf0e10cSrcweir {
126cdf0e10cSrcweir return sal_True;
127cdf0e10cSrcweir }
128cdf0e10cSrcweir
129cdf0e10cSrcweir //----------------------------------------------------------------------------
130cdf0e10cSrcweir
KeyInput(const KeyEvent & rKEvt)131cdf0e10cSrcweir sal_Bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir sal_Bool bReturn = sal_False;
134cdf0e10cSrcweir
135cdf0e10cSrcweir SdrView* pView = pParent->GetView();
136cdf0e10cSrcweir Window* pWindow = pParent->GetWindow();
137cdf0e10cSrcweir
138cdf0e10cSrcweir KeyCode aCode = rKEvt.GetKeyCode();
139cdf0e10cSrcweir sal_uInt16 nCode = aCode.GetCode();
140cdf0e10cSrcweir
141cdf0e10cSrcweir switch ( nCode )
142cdf0e10cSrcweir {
143cdf0e10cSrcweir case KEY_ESCAPE:
144cdf0e10cSrcweir {
145cdf0e10cSrcweir if ( pView->IsAction() )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir pView->BrkAction();
148cdf0e10cSrcweir bReturn = sal_True;
149cdf0e10cSrcweir }
150cdf0e10cSrcweir else if ( pView->AreObjectsMarked() )
151cdf0e10cSrcweir {
152cdf0e10cSrcweir const SdrHdlList& rHdlList = pView->GetHdlList();
153cdf0e10cSrcweir SdrHdl* pHdl = rHdlList.GetFocusHdl();
154cdf0e10cSrcweir if ( pHdl )
155cdf0e10cSrcweir ((SdrHdlList&)rHdlList).ResetFocusHdl();
156cdf0e10cSrcweir else
157cdf0e10cSrcweir pView->UnmarkAll();
158cdf0e10cSrcweir
159cdf0e10cSrcweir bReturn = sal_True;
160cdf0e10cSrcweir }
161cdf0e10cSrcweir }
162cdf0e10cSrcweir break;
163cdf0e10cSrcweir case KEY_TAB:
164cdf0e10cSrcweir {
165cdf0e10cSrcweir if ( !aCode.IsMod1() && !aCode.IsMod2() )
166cdf0e10cSrcweir {
167cdf0e10cSrcweir // mark next object
168cdf0e10cSrcweir if ( !pView->MarkNextObj( !aCode.IsShift() ) )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir // if no next object, mark first/last
171cdf0e10cSrcweir pView->UnmarkAllObj();
172cdf0e10cSrcweir pView->MarkNextObj( !aCode.IsShift() );
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
175cdf0e10cSrcweir if ( pView->AreObjectsMarked() )
176cdf0e10cSrcweir pView->MakeVisible( pView->GetAllMarkedRect(), *pWindow );
177cdf0e10cSrcweir
178cdf0e10cSrcweir bReturn = sal_True;
179cdf0e10cSrcweir }
180cdf0e10cSrcweir else if ( aCode.IsMod1() )
181cdf0e10cSrcweir {
182cdf0e10cSrcweir // selected handle
183cdf0e10cSrcweir const SdrHdlList& rHdlList = pView->GetHdlList();
184cdf0e10cSrcweir ((SdrHdlList&)rHdlList).TravelFocusHdl( !aCode.IsShift() );
185cdf0e10cSrcweir
186cdf0e10cSrcweir // guarantee visibility of focused handle
187cdf0e10cSrcweir SdrHdl* pHdl = rHdlList.GetFocusHdl();
188cdf0e10cSrcweir if ( pHdl )
189cdf0e10cSrcweir {
190cdf0e10cSrcweir Point aHdlPosition( pHdl->GetPos() );
191cdf0e10cSrcweir Rectangle aVisRect( aHdlPosition - Point( 100, 100 ), Size( 200, 200 ) );
192cdf0e10cSrcweir pView->MakeVisible( aVisRect, *pWindow );
193cdf0e10cSrcweir }
194cdf0e10cSrcweir
195cdf0e10cSrcweir bReturn = sal_True;
196cdf0e10cSrcweir }
197cdf0e10cSrcweir }
198cdf0e10cSrcweir break;
199cdf0e10cSrcweir case KEY_UP:
200cdf0e10cSrcweir case KEY_DOWN:
201cdf0e10cSrcweir case KEY_LEFT:
202cdf0e10cSrcweir case KEY_RIGHT:
203cdf0e10cSrcweir {
204cdf0e10cSrcweir long nX = 0;
205cdf0e10cSrcweir long nY = 0;
206cdf0e10cSrcweir
207cdf0e10cSrcweir if ( nCode == KEY_UP )
208cdf0e10cSrcweir {
209cdf0e10cSrcweir // scroll up
210cdf0e10cSrcweir nX = 0;
211cdf0e10cSrcweir nY = -1;
212cdf0e10cSrcweir }
213cdf0e10cSrcweir else if ( nCode == KEY_DOWN )
214cdf0e10cSrcweir {
215cdf0e10cSrcweir // scroll down
216cdf0e10cSrcweir nX = 0;
217cdf0e10cSrcweir nY = 1;
218cdf0e10cSrcweir }
219cdf0e10cSrcweir else if ( nCode == KEY_LEFT )
220cdf0e10cSrcweir {
221cdf0e10cSrcweir // scroll left
222cdf0e10cSrcweir nX = -1;
223cdf0e10cSrcweir nY = 0;
224cdf0e10cSrcweir }
225cdf0e10cSrcweir else if ( nCode == KEY_RIGHT )
226cdf0e10cSrcweir {
227cdf0e10cSrcweir // scroll right
228cdf0e10cSrcweir nX = 1;
229cdf0e10cSrcweir nY = 0;
230cdf0e10cSrcweir }
231cdf0e10cSrcweir
232cdf0e10cSrcweir if ( pView->AreObjectsMarked() && !aCode.IsMod1() )
233cdf0e10cSrcweir {
234cdf0e10cSrcweir if ( aCode.IsMod2() )
235cdf0e10cSrcweir {
236cdf0e10cSrcweir // move in 1 pixel distance
237cdf0e10cSrcweir Size aPixelSize = pWindow ? pWindow->PixelToLogic( Size( 1, 1 ) ) : Size( 100, 100 );
238cdf0e10cSrcweir nX *= aPixelSize.Width();
239cdf0e10cSrcweir nY *= aPixelSize.Height();
240cdf0e10cSrcweir }
241cdf0e10cSrcweir else
242cdf0e10cSrcweir {
243cdf0e10cSrcweir // move in 1 mm distance
244cdf0e10cSrcweir nX *= 100;
245cdf0e10cSrcweir nY *= 100;
246cdf0e10cSrcweir }
247cdf0e10cSrcweir
248cdf0e10cSrcweir const SdrHdlList& rHdlList = pView->GetHdlList();
249cdf0e10cSrcweir SdrHdl* pHdl = rHdlList.GetFocusHdl();
250cdf0e10cSrcweir
251cdf0e10cSrcweir if ( pHdl == 0 )
252cdf0e10cSrcweir {
253cdf0e10cSrcweir // no handle selected
254cdf0e10cSrcweir if ( pView->IsMoveAllowed() )
255cdf0e10cSrcweir {
256cdf0e10cSrcweir // restrict movement to work area
257cdf0e10cSrcweir const Rectangle& rWorkArea = pView->GetWorkArea();
258cdf0e10cSrcweir
259cdf0e10cSrcweir if ( !rWorkArea.IsEmpty() )
260cdf0e10cSrcweir {
261cdf0e10cSrcweir Rectangle aMarkRect( pView->GetMarkedObjRect() );
262cdf0e10cSrcweir aMarkRect.Move( nX, nY );
263cdf0e10cSrcweir
264cdf0e10cSrcweir if ( !rWorkArea.IsInside( aMarkRect ) )
265cdf0e10cSrcweir {
266cdf0e10cSrcweir if ( aMarkRect.Left() < rWorkArea.Left() )
267cdf0e10cSrcweir nX += rWorkArea.Left() - aMarkRect.Left();
268cdf0e10cSrcweir
269cdf0e10cSrcweir if ( aMarkRect.Right() > rWorkArea.Right() )
270cdf0e10cSrcweir nX -= aMarkRect.Right() - rWorkArea.Right();
271cdf0e10cSrcweir
272cdf0e10cSrcweir if ( aMarkRect.Top() < rWorkArea.Top() )
273cdf0e10cSrcweir nY += rWorkArea.Top() - aMarkRect.Top();
274cdf0e10cSrcweir
275cdf0e10cSrcweir if ( aMarkRect.Bottom() > rWorkArea.Bottom() )
276cdf0e10cSrcweir nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
277cdf0e10cSrcweir }
278cdf0e10cSrcweir }
279cdf0e10cSrcweir
280cdf0e10cSrcweir if ( nX != 0 || nY != 0 )
281cdf0e10cSrcweir {
282cdf0e10cSrcweir pView->MoveAllMarked( Size( nX, nY ) );
283cdf0e10cSrcweir pView->MakeVisible( pView->GetAllMarkedRect(), *pWindow );
284cdf0e10cSrcweir }
285cdf0e10cSrcweir }
286cdf0e10cSrcweir }
287cdf0e10cSrcweir else
288cdf0e10cSrcweir {
289cdf0e10cSrcweir // move the handle
290cdf0e10cSrcweir if ( pHdl && ( nX || nY ) )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir Point aStartPoint( pHdl->GetPos() );
293cdf0e10cSrcweir Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) );
294cdf0e10cSrcweir const SdrDragStat& rDragStat = pView->GetDragStat();
295cdf0e10cSrcweir
296cdf0e10cSrcweir // start dragging
297cdf0e10cSrcweir pView->BegDragObj( aStartPoint, 0, pHdl, 0 );
298cdf0e10cSrcweir
299cdf0e10cSrcweir if ( pView->IsDragObj() )
300cdf0e10cSrcweir {
301cdf0e10cSrcweir FASTBOOL bWasNoSnap = rDragStat.IsNoSnap();
302cdf0e10cSrcweir sal_Bool bWasSnapEnabled = pView->IsSnapEnabled();
303cdf0e10cSrcweir
304cdf0e10cSrcweir // switch snapping off
305cdf0e10cSrcweir if ( !bWasNoSnap )
306cdf0e10cSrcweir ((SdrDragStat&)rDragStat).SetNoSnap( sal_True );
307cdf0e10cSrcweir if ( bWasSnapEnabled )
308cdf0e10cSrcweir pView->SetSnapEnabled( sal_False );
309cdf0e10cSrcweir
310cdf0e10cSrcweir pView->MovAction( aEndPoint );
311cdf0e10cSrcweir pView->EndDragObj();
312cdf0e10cSrcweir
313cdf0e10cSrcweir // restore snap
314cdf0e10cSrcweir if ( !bWasNoSnap )
315cdf0e10cSrcweir ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap );
316cdf0e10cSrcweir if ( bWasSnapEnabled )
317cdf0e10cSrcweir pView->SetSnapEnabled( bWasSnapEnabled );
318cdf0e10cSrcweir }
319cdf0e10cSrcweir
320cdf0e10cSrcweir // make moved handle visible
321cdf0e10cSrcweir Rectangle aVisRect( aEndPoint - Point( 100, 100 ), Size( 200, 200 ) );
322cdf0e10cSrcweir pView->MakeVisible( aVisRect, *pWindow );
323cdf0e10cSrcweir }
324cdf0e10cSrcweir }
325cdf0e10cSrcweir }
326cdf0e10cSrcweir else
327cdf0e10cSrcweir {
328cdf0e10cSrcweir // scroll page
329cdf0e10cSrcweir ScrollBar* pScrollBar = ( nX != 0 ) ? pParent->GetHScroll() : pParent->GetVScroll();
330cdf0e10cSrcweir if ( pScrollBar )
331cdf0e10cSrcweir {
332cdf0e10cSrcweir long nRangeMin = pScrollBar->GetRangeMin();
333cdf0e10cSrcweir long nRangeMax = pScrollBar->GetRangeMax();
334cdf0e10cSrcweir long nThumbPos = pScrollBar->GetThumbPos() + ( ( nX != 0 ) ? nX : nY ) * pScrollBar->GetLineSize();
335cdf0e10cSrcweir if ( nThumbPos < nRangeMin )
336cdf0e10cSrcweir nThumbPos = nRangeMin;
337cdf0e10cSrcweir if ( nThumbPos > nRangeMax )
338cdf0e10cSrcweir nThumbPos = nRangeMax;
339cdf0e10cSrcweir pScrollBar->SetThumbPos( nThumbPos );
340cdf0e10cSrcweir pParent->DoScroll( pScrollBar );
341cdf0e10cSrcweir }
342cdf0e10cSrcweir }
343cdf0e10cSrcweir
344cdf0e10cSrcweir bReturn = sal_True;
345cdf0e10cSrcweir }
346cdf0e10cSrcweir break;
347cdf0e10cSrcweir default:
348cdf0e10cSrcweir {
349cdf0e10cSrcweir }
350cdf0e10cSrcweir break;
351cdf0e10cSrcweir }
352cdf0e10cSrcweir
353cdf0e10cSrcweir if ( bReturn )
354cdf0e10cSrcweir pWindow->ReleaseMouse();
355cdf0e10cSrcweir
356cdf0e10cSrcweir return bReturn;
357cdf0e10cSrcweir }
358cdf0e10cSrcweir
359cdf0e10cSrcweir //----------------------------------------------------------------------------
360cdf0e10cSrcweir
DlgEdFuncInsert(DlgEditor * pParent_)361cdf0e10cSrcweir DlgEdFuncInsert::DlgEdFuncInsert( DlgEditor* pParent_ ) :
362cdf0e10cSrcweir DlgEdFunc( pParent_ )
363cdf0e10cSrcweir {
364cdf0e10cSrcweir pParent_->GetView()->SetCreateMode( sal_True );
365cdf0e10cSrcweir }
366cdf0e10cSrcweir
367cdf0e10cSrcweir //----------------------------------------------------------------------------
368cdf0e10cSrcweir
~DlgEdFuncInsert()369cdf0e10cSrcweir DlgEdFuncInsert::~DlgEdFuncInsert()
370cdf0e10cSrcweir {
371cdf0e10cSrcweir pParent->GetView()->SetEditMode( sal_True );
372cdf0e10cSrcweir }
373cdf0e10cSrcweir
374cdf0e10cSrcweir //----------------------------------------------------------------------------
375cdf0e10cSrcweir
MouseButtonDown(const MouseEvent & rMEvt)376cdf0e10cSrcweir sal_Bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt )
377cdf0e10cSrcweir {
378cdf0e10cSrcweir if( !rMEvt.IsLeft() )
379cdf0e10cSrcweir return sal_True;
380cdf0e10cSrcweir
381cdf0e10cSrcweir SdrView* pView = pParent->GetView();
382cdf0e10cSrcweir Window* pWindow= pParent->GetWindow();
383cdf0e10cSrcweir pView->SetActualWin( pWindow );
384cdf0e10cSrcweir
385cdf0e10cSrcweir Point aPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
386cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
387cdf0e10cSrcweir sal_uInt16 nDrgLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
388cdf0e10cSrcweir
389cdf0e10cSrcweir pWindow->CaptureMouse();
390cdf0e10cSrcweir
391cdf0e10cSrcweir if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
392cdf0e10cSrcweir {
393cdf0e10cSrcweir SdrHdl* pHdl = pView->PickHandle(aPos);
394cdf0e10cSrcweir
395cdf0e10cSrcweir // if selected object was hit, drag object
396cdf0e10cSrcweir if ( pHdl!=NULL || pView->IsMarkedHit(aPos, nHitLog) )
397cdf0e10cSrcweir pView->BegDragObj(aPos, (OutputDevice*) NULL, pHdl, nDrgLog);
398cdf0e10cSrcweir else if ( pView->AreObjectsMarked() )
399cdf0e10cSrcweir pView->UnmarkAll();
400cdf0e10cSrcweir
401cdf0e10cSrcweir // if no action, create object
402cdf0e10cSrcweir if ( !pView->IsAction() )
403cdf0e10cSrcweir pView->BegCreateObj(aPos);
404cdf0e10cSrcweir }
405cdf0e10cSrcweir else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 )
406cdf0e10cSrcweir {
407cdf0e10cSrcweir // if object was hit, show property browser
408cdf0e10cSrcweir if ( pView->IsMarkedHit(aPos, nHitLog) && pParent->GetMode() != DLGED_READONLY )
409cdf0e10cSrcweir pParent->ShowProperties();
410cdf0e10cSrcweir }
411cdf0e10cSrcweir
412cdf0e10cSrcweir return sal_True;
413cdf0e10cSrcweir }
414cdf0e10cSrcweir
415cdf0e10cSrcweir //----------------------------------------------------------------------------
416cdf0e10cSrcweir
MouseButtonUp(const MouseEvent & rMEvt)417cdf0e10cSrcweir sal_Bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent& rMEvt )
418cdf0e10cSrcweir {
419cdf0e10cSrcweir DlgEdFunc::MouseButtonUp( rMEvt );
420cdf0e10cSrcweir
421cdf0e10cSrcweir SdrView* pView = pParent->GetView();
422cdf0e10cSrcweir Window* pWindow= pParent->GetWindow();
423cdf0e10cSrcweir pView->SetActualWin( pWindow );
424cdf0e10cSrcweir
425cdf0e10cSrcweir pWindow->ReleaseMouse();
426cdf0e10cSrcweir
427cdf0e10cSrcweir // object creation active?
428cdf0e10cSrcweir if ( pView->IsCreateObj() )
429cdf0e10cSrcweir {
430cdf0e10cSrcweir pView->EndCreateObj(SDRCREATE_FORCEEND);
431cdf0e10cSrcweir
432cdf0e10cSrcweir if ( !pView->AreObjectsMarked() )
433cdf0e10cSrcweir {
434cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
435cdf0e10cSrcweir Point aPos( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
436cdf0e10cSrcweir pView->MarkObj(aPos, nHitLog);
437cdf0e10cSrcweir }
438cdf0e10cSrcweir
439cdf0e10cSrcweir if( pView->AreObjectsMarked() )
440cdf0e10cSrcweir return sal_True;
441cdf0e10cSrcweir else
442cdf0e10cSrcweir return sal_False;
443cdf0e10cSrcweir }
444cdf0e10cSrcweir else
445cdf0e10cSrcweir {
446cdf0e10cSrcweir if ( pView->IsDragObj() )
447cdf0e10cSrcweir pView->EndDragObj( rMEvt.IsMod1() );
448cdf0e10cSrcweir return sal_True;
449cdf0e10cSrcweir }
450cdf0e10cSrcweir }
451cdf0e10cSrcweir
452cdf0e10cSrcweir //----------------------------------------------------------------------------
453cdf0e10cSrcweir
MouseMove(const MouseEvent & rMEvt)454cdf0e10cSrcweir sal_Bool DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt )
455cdf0e10cSrcweir {
456cdf0e10cSrcweir SdrView* pView = pParent->GetView();
457cdf0e10cSrcweir Window* pWindow= pParent->GetWindow();
458cdf0e10cSrcweir pView->SetActualWin( pWindow );
459cdf0e10cSrcweir
460cdf0e10cSrcweir Point aPos( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
461cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
462cdf0e10cSrcweir
463cdf0e10cSrcweir if ( pView->IsAction() )
464cdf0e10cSrcweir {
465cdf0e10cSrcweir ForceScroll(aPos);
466cdf0e10cSrcweir pView->MovAction(aPos);
467cdf0e10cSrcweir }
468cdf0e10cSrcweir
469cdf0e10cSrcweir pWindow->SetPointer( pView->GetPreferedPointer( aPos, pWindow, nHitLog ) );
470cdf0e10cSrcweir
471cdf0e10cSrcweir return sal_True;
472cdf0e10cSrcweir }
473cdf0e10cSrcweir
474cdf0e10cSrcweir //----------------------------------------------------------------------------
475cdf0e10cSrcweir
DlgEdFuncSelect(DlgEditor * pParent_)476cdf0e10cSrcweir DlgEdFuncSelect::DlgEdFuncSelect( DlgEditor* pParent_ ) :
477cdf0e10cSrcweir DlgEdFunc( pParent_ ),
478cdf0e10cSrcweir bMarkAction(sal_False)
479cdf0e10cSrcweir {
480cdf0e10cSrcweir }
481cdf0e10cSrcweir
482cdf0e10cSrcweir //----------------------------------------------------------------------------
483cdf0e10cSrcweir
~DlgEdFuncSelect()484cdf0e10cSrcweir DlgEdFuncSelect::~DlgEdFuncSelect()
485cdf0e10cSrcweir {
486cdf0e10cSrcweir }
487cdf0e10cSrcweir
488cdf0e10cSrcweir //----------------------------------------------------------------------------
489cdf0e10cSrcweir
MouseButtonDown(const MouseEvent & rMEvt)490cdf0e10cSrcweir sal_Bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt )
491cdf0e10cSrcweir {
492cdf0e10cSrcweir // get view from parent
493cdf0e10cSrcweir SdrView* pView = pParent->GetView();
494cdf0e10cSrcweir Window* pWindow = pParent->GetWindow();
495cdf0e10cSrcweir pView->SetActualWin( pWindow );
496cdf0e10cSrcweir
497cdf0e10cSrcweir sal_uInt16 nDrgLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
498cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
499cdf0e10cSrcweir Point aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
500cdf0e10cSrcweir
501cdf0e10cSrcweir if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
502cdf0e10cSrcweir {
503cdf0e10cSrcweir SdrHdl* pHdl = pView->PickHandle(aMDPos);
504cdf0e10cSrcweir SdrObject* pObj;
505cdf0e10cSrcweir SdrPageView* pPV;
506cdf0e10cSrcweir
507cdf0e10cSrcweir // hit selected object?
508cdf0e10cSrcweir if ( pHdl!=NULL || pView->IsMarkedHit(aMDPos, nHitLog) )
509cdf0e10cSrcweir {
510cdf0e10cSrcweir pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
511cdf0e10cSrcweir }
512cdf0e10cSrcweir else
513cdf0e10cSrcweir {
514cdf0e10cSrcweir // if not multi selection, unmark all
515cdf0e10cSrcweir if ( !rMEvt.IsShift() )
516cdf0e10cSrcweir pView->UnmarkAll();
517cdf0e10cSrcweir else
518cdf0e10cSrcweir {
519cdf0e10cSrcweir if( pView->PickObj( aMDPos, nHitLog, pObj, pPV ) )
520cdf0e10cSrcweir {
521cdf0e10cSrcweir //if( pObj->ISA( DlgEdForm ) )
522cdf0e10cSrcweir // pView->UnmarkAll();
523cdf0e10cSrcweir //else
524cdf0e10cSrcweir // pParent->UnmarkDialog();
525cdf0e10cSrcweir }
526cdf0e10cSrcweir }
527cdf0e10cSrcweir
528cdf0e10cSrcweir if ( pView->MarkObj(aMDPos, nHitLog) )
529cdf0e10cSrcweir {
530cdf0e10cSrcweir // drag object
531cdf0e10cSrcweir pHdl=pView->PickHandle(aMDPos);
532cdf0e10cSrcweir pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
533cdf0e10cSrcweir }
534cdf0e10cSrcweir else
535cdf0e10cSrcweir {
536cdf0e10cSrcweir // select object
537cdf0e10cSrcweir pView->BegMarkObj(aMDPos);
538cdf0e10cSrcweir bMarkAction = sal_True;
539cdf0e10cSrcweir }
540cdf0e10cSrcweir }
541cdf0e10cSrcweir }
542cdf0e10cSrcweir else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 )
543cdf0e10cSrcweir {
544cdf0e10cSrcweir // if object was hit, show property browser
545cdf0e10cSrcweir if ( pView->IsMarkedHit(aMDPos, nHitLog) && pParent->GetMode() != DLGED_READONLY )
546cdf0e10cSrcweir pParent->ShowProperties();
547cdf0e10cSrcweir }
548cdf0e10cSrcweir
549cdf0e10cSrcweir return sal_True;
550cdf0e10cSrcweir }
551cdf0e10cSrcweir
552cdf0e10cSrcweir //----------------------------------------------------------------------------
553cdf0e10cSrcweir
MouseButtonUp(const MouseEvent & rMEvt)554cdf0e10cSrcweir sal_Bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& rMEvt )
555cdf0e10cSrcweir {
556cdf0e10cSrcweir DlgEdFunc::MouseButtonUp( rMEvt );
557cdf0e10cSrcweir
558cdf0e10cSrcweir // get view from parent
559cdf0e10cSrcweir SdrView* pView = pParent->GetView();
560cdf0e10cSrcweir Window* pWindow= pParent->GetWindow();
561cdf0e10cSrcweir pView->SetActualWin( pWindow );
562cdf0e10cSrcweir
563cdf0e10cSrcweir Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
564cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
565cdf0e10cSrcweir
566cdf0e10cSrcweir if ( rMEvt.IsLeft() )
567cdf0e10cSrcweir {
568cdf0e10cSrcweir if ( pView->IsDragObj() )
569cdf0e10cSrcweir {
570cdf0e10cSrcweir // object was dragged
571cdf0e10cSrcweir pView->EndDragObj( rMEvt.IsMod1() );
572cdf0e10cSrcweir pView->ForceMarkedToAnotherPage();
573cdf0e10cSrcweir }
574cdf0e10cSrcweir else
575cdf0e10cSrcweir if (pView->IsAction() )
576cdf0e10cSrcweir {
577cdf0e10cSrcweir pView->EndAction();
578cdf0e10cSrcweir //if( bMarkAction )
579cdf0e10cSrcweir //pParent->UnmarkDialog();
580cdf0e10cSrcweir }
581cdf0e10cSrcweir }
582cdf0e10cSrcweir
583cdf0e10cSrcweir // sal_uInt16 nClicks = rMEvt.GetClicks();
584cdf0e10cSrcweir // if (nClicks == 2)
585cdf0e10cSrcweir // {
586cdf0e10cSrcweir // if ( pView->AreObjectsMarked() )
587cdf0e10cSrcweir // {
588cdf0e10cSrcweir // const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
589cdf0e10cSrcweir //
590cdf0e10cSrcweir // if (rMarkList.GetMarkCount() == 1)
591cdf0e10cSrcweir // {
592cdf0e10cSrcweir // SdrMark* pMark = rMarkList.GetMark(0);
593cdf0e10cSrcweir // SdrObject* pObj = pMark->GetMarkedSdrObj();
594cdf0e10cSrcweir //
595cdf0e10cSrcweir // // edit objects here
596cdf0e10cSrcweir // }
597cdf0e10cSrcweir // }
598cdf0e10cSrcweir // }
599cdf0e10cSrcweir
600cdf0e10cSrcweir bMarkAction = sal_False;
601cdf0e10cSrcweir
602cdf0e10cSrcweir pWindow->SetPointer( pView->GetPreferedPointer( aPnt, pWindow, nHitLog ) );
603cdf0e10cSrcweir pWindow->ReleaseMouse();
604cdf0e10cSrcweir
605cdf0e10cSrcweir return sal_True;
606cdf0e10cSrcweir }
607cdf0e10cSrcweir
608cdf0e10cSrcweir //----------------------------------------------------------------------------
609cdf0e10cSrcweir
MouseMove(const MouseEvent & rMEvt)610cdf0e10cSrcweir sal_Bool DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt )
611cdf0e10cSrcweir {
612cdf0e10cSrcweir SdrView* pView = pParent->GetView();
613cdf0e10cSrcweir Window* pWindow= pParent->GetWindow();
614cdf0e10cSrcweir pView->SetActualWin( pWindow );
615cdf0e10cSrcweir
616cdf0e10cSrcweir Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
617cdf0e10cSrcweir sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
618cdf0e10cSrcweir
619cdf0e10cSrcweir if ( pView->IsAction() )
620cdf0e10cSrcweir {
621cdf0e10cSrcweir Point aPix(rMEvt.GetPosPixel());
622cdf0e10cSrcweir Point aPnt_(pWindow->PixelToLogic(aPix));
623cdf0e10cSrcweir
624cdf0e10cSrcweir ForceScroll(aPnt_);
625cdf0e10cSrcweir pView->MovAction(aPnt_);
626cdf0e10cSrcweir }
627cdf0e10cSrcweir
628cdf0e10cSrcweir pWindow->SetPointer( pView->GetPreferedPointer( aPnt, pWindow, nHitLog ) );
629cdf0e10cSrcweir
630cdf0e10cSrcweir return sal_True;
631cdf0e10cSrcweir }
632cdf0e10cSrcweir
633cdf0e10cSrcweir //----------------------------------------------------------------------------
634