xref: /aoo42x/main/sw/source/ui/ribbar/drawbase.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 #include <hintids.hxx>
32 #include <tools/list.hxx>
33 #include <svx/svdview.hxx>
34 #include <svx/svdobj.hxx>
35 #include <svl/ptitem.hxx>
36 #include <editeng/sizeitem.hxx>
37 #include <sfx2/request.hxx>
38 #include <sfx2/bindings.hxx>
39 #include <fmtclds.hxx>
40 #include <frmfmt.hxx>
41 #include "cmdid.h"
42 #include "basesh.hxx"
43 #include "view.hxx"
44 #include "wrtsh.hxx"
45 #include "drawbase.hxx"
46 #include "edtwin.hxx"
47 #include "caption.hxx"
48 #include "swundo.hxx"
49 #include <SwRewriter.hxx>
50 #include "comcore.hrc"
51 
52 using namespace ::com::sun::star;
53 
54 extern sal_Bool bNoInterrupt;		// in mainwn.cxx
55 
56 #define MINMOVE ((sal_uInt16)m_pSh->GetOut()->PixelToLogic(Size(m_pSh->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width())
57 
58 
59 /*************************************************************************
60 |*
61 |* Konstruktor
62 |*
63 \************************************************************************/
64 
65 
66 SwDrawBase::SwDrawBase(SwWrtShell* pSwWrtShell, SwEditWin* pWindow, SwView* pSwView) :
67     m_pView(pSwView),
68     m_pSh(pSwWrtShell),
69     m_pWin(pWindow),
70     m_nSlotId(USHRT_MAX),
71     m_bCreateObj(sal_True),
72     m_bInsForm(sal_False)
73 {
74     if ( !m_pSh->HasDrawView() )
75         m_pSh->MakeDrawView();
76 }
77 
78 /*************************************************************************
79 |*
80 |* Destruktor
81 |*
82 \************************************************************************/
83 
84 __EXPORT SwDrawBase::~SwDrawBase()
85 {
86     if (m_pView->GetWrtShellPtr()) // Im view-Dtor koennte die wrtsh bereits geloescht worden sein...
87         m_pSh->GetDrawView()->SetEditMode(sal_True);
88 }
89 
90 /*************************************************************************
91 |*
92 |* MouseButtonDown-event
93 |*
94 \************************************************************************/
95 
96 
97 sal_Bool SwDrawBase::MouseButtonDown(const MouseEvent& rMEvt)
98 {
99 	sal_Bool bReturn = sal_False;
100 
101     SdrView *pSdrView = m_pSh->GetDrawView();
102 
103 	// #i33136#
104 	// pSdrView->SetOrtho(rMEvt.IsShift());
105 	pSdrView->SetOrtho(doConstructOrthogonal() ? !rMEvt.IsShift() : rMEvt.IsShift());
106 	pSdrView->SetAngleSnapEnabled(rMEvt.IsShift());
107 
108 	if (rMEvt.IsMod2())
109 	{
110 		pSdrView->SetCreate1stPointAsCenter(sal_True);
111 		pSdrView->SetResizeAtCenter(sal_True);
112 	}
113 	else
114 	{
115 		pSdrView->SetCreate1stPointAsCenter(sal_False);
116 		pSdrView->SetResizeAtCenter(sal_False);
117 	}
118 
119 	SdrViewEvent aVEvt;
120 	SdrHitKind eHit = pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
121 
122 	// Nur neues Objekt, wenn nicht im Basismode (bzw reinem Selektionsmode)
123     if (rMEvt.IsLeft() && !m_pWin->IsDrawAction())
124 	{
125         if (IsCreateObj() && (eHit == SDRHIT_UNMARKEDOBJECT || eHit == SDRHIT_NONE || m_pSh->IsDrawCreate()))
126 		{
127 			bNoInterrupt = sal_True;
128             m_pWin->CaptureMouse();
129 
130             m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
131 
132             bReturn = m_pSh->BeginCreate( static_cast< sal_uInt16 >(m_pWin->GetSdrDrawMode()), m_aStartPos);
133 
134 			SetDrawPointer();
135 
136 			if ( bReturn )
137                 m_pWin->SetDrawAction(sal_True);
138 		}
139 		else if (!pSdrView->IsAction())
140 		{
141 			/**********************************************************************
142 			* BEZIER-EDITOR
143 			**********************************************************************/
144             m_pWin->CaptureMouse();
145             m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
146             sal_uInt16 nEditMode = m_pWin->GetBezierMode();
147 
148 			if (eHit == SDRHIT_HANDLE && aVEvt.pHdl->GetKind() == HDL_BWGT)
149 			{
150 				/******************************************************************
151 				* Handle draggen
152 				******************************************************************/
153 				bNoInterrupt = sal_True;
154                 bReturn = pSdrView->BegDragObj(m_aStartPos, (OutputDevice*) NULL, aVEvt.pHdl);
155                 m_pWin->SetDrawAction(sal_True);
156 			}
157 			else if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT)
158 			{
159 				/******************************************************************
160 				* Klebepunkt einfuegen
161 				******************************************************************/
162 				bNoInterrupt = sal_True;
163                 bReturn = pSdrView->BegInsObjPoint(m_aStartPos, rMEvt.IsMod1());
164                 m_pWin->SetDrawAction(sal_True);
165 			}
166 			else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1())
167 			{
168 				/******************************************************************
169 				* Klebepunkt selektieren
170 				******************************************************************/
171 				if (!rMEvt.IsShift())
172 					pSdrView->UnmarkAllPoints();
173 
174                 bReturn = pSdrView->BegMarkPoints(m_aStartPos);
175                 m_pWin->SetDrawAction(sal_True);
176 			}
177 			else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2())
178 			{
179 				/******************************************************************
180 				* Objekt verschieben
181 				******************************************************************/
182 				return sal_False;
183 			}
184 			else if (eHit == SDRHIT_HANDLE)
185 			{
186 				/******************************************************************
187 				* Klebepunkt selektieren
188 				******************************************************************/
189 				if (pSdrView->HasMarkablePoints() && (!pSdrView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift()))
190 				{
191 					SdrHdl*	pHdl = NULL;
192 
193 					if (!rMEvt.IsShift())
194 					{
195 						pSdrView->UnmarkAllPoints();
196                         pHdl = pSdrView->PickHandle(m_aStartPos);
197 					}
198 					else
199 					{
200 						if (pSdrView->IsPointMarked(*aVEvt.pHdl))
201 						{
202 							bReturn = pSdrView->UnmarkPoint(*aVEvt.pHdl);
203 							pHdl = NULL;
204 						}
205 						else
206 						{
207                             pHdl = pSdrView->PickHandle(m_aStartPos);
208 						}
209 					}
210 
211 					if (pHdl)
212 					{
213 						bNoInterrupt = sal_True;
214 						pSdrView->MarkPoint(*pHdl);
215 //                      bReturn = pSdrView->BegDragObj(m_aStartPos, (OutputDevice*) NULL, pHdl);
216 //                      m_pWin->SetDrawAction(sal_True);
217 					}
218 				}
219 			}
220 			else
221 			{
222 				/******************************************************************
223 				* Objekt selektieren oder draggen
224 				******************************************************************/
225                 if (m_pSh->IsObjSelectable(m_aStartPos) && eHit == SDRHIT_UNMARKEDOBJECT)
226 				{
227 					if (pSdrView->HasMarkablePoints())
228 						pSdrView->UnmarkAllPoints();
229 
230 					bNoInterrupt = sal_False;
231 					// Drag im edtwin verwenden
232 					return sal_False;
233 				}
234 
235 				bNoInterrupt = sal_True;
236 
237                 if (m_pSh->IsObjSelected())
238 				{
239 					if (!rMEvt.IsShift())
240 					{
241 						if (!pSdrView->HasMarkablePoints())
242 						{
243 							//JP 10.10.2001: Bug 89619 - don't scroll the
244 							//				cursor into the visible area
245                             sal_Bool bUnlockView = !m_pSh->IsViewLocked();
246                             m_pSh->LockView( sal_True ); //lock visible section
247                             m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX)); // Alles deselektieren
248 							if( bUnlockView )
249                                 m_pSh->LockView( sal_False );
250 						}
251 						else
252 							pSdrView->UnmarkAllPoints();
253 					}
254 				}
255                 if (!m_pSh->IsSelFrmMode())
256                     m_pSh->EnterSelFrmMode(NULL);
257 
258                 if( 0 != (bReturn = m_pSh->BeginMark(m_aStartPos)) )
259                     m_pWin->SetDrawAction(sal_True);
260 
261 				SetDrawPointer();
262 			}
263 		}
264 	}
265 	return bReturn;
266 }
267 
268 /*************************************************************************
269 |*
270 |* MouseMove-event
271 |*
272 \************************************************************************/
273 
274 
275 sal_Bool SwDrawBase::MouseMove(const MouseEvent& rMEvt)
276 {
277     SdrView *pSdrView = m_pSh->GetDrawView();
278     Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
279 	sal_Bool bRet = sal_False;
280 
281     if (IsCreateObj() && !m_pWin->IsDrawSelMode() && pSdrView->IsCreateObj())
282 	{
283 		// #i33136#
284 		// pSdrView->SetOrtho(rMEvt.IsShift());
285 		pSdrView->SetOrtho(doConstructOrthogonal() ? !rMEvt.IsShift() : rMEvt.IsShift());
286 		pSdrView->SetAngleSnapEnabled(rMEvt.IsShift());
287 
288         m_pSh->MoveCreate(aPnt);
289 		bRet = sal_True;
290 	}
291 	else if (pSdrView->IsAction() || pSdrView->IsInsObjPoint() || pSdrView->IsMarkPoints())
292 	{
293         m_pSh->MoveMark(aPnt);
294 		bRet = sal_True;
295 	}
296 
297 	return (bRet);
298 }
299 
300 /*************************************************************************
301 |*
302 |* MouseButtonUp-event
303 |*
304 \************************************************************************/
305 
306 
307 sal_Bool SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt)
308 {
309 	sal_Bool bReturn = sal_False;
310 	sal_Bool bCheckShell = sal_False;
311 	sal_Bool bAutoCap = sal_False;
312 
313     Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
314 
315     if (IsCreateObj() && m_pSh->IsDrawCreate() && !m_pWin->IsDrawSelMode())
316 	{
317         const SdrObjKind nDrawMode = m_pWin->GetSdrDrawMode();
318 		//objects with multiple point may end at the start position
319 		sal_Bool bMultiPoint = OBJ_PLIN == nDrawMode ||
320                                 OBJ_PATHLINE == nDrawMode ||
321 								OBJ_FREELINE == nDrawMode;
322         if(rMEvt.IsRight() || (aPnt == m_aStartPos && !bMultiPoint))
323 		{
324             m_pSh->BreakCreate();
325             m_pView->LeaveDrawCreate();
326 		}
327 		else
328 		{
329             if (OBJ_NONE == nDrawMode)
330             {
331                 SwRewriter aRewriter;
332 
333                 aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_FRAME));
334                 m_pSh->StartUndo(UNDO_INSERT, &aRewriter);
335             }
336 
337             m_pSh->EndCreate(SDRCREATE_FORCEEND);
338             if (OBJ_NONE == nDrawMode)   // Textrahmen eingefuegt
339 			{
340                uno::Reference< frame::XDispatchRecorder > xRecorder =
341                     m_pSh->GetView().GetViewFrame()->GetBindings().GetRecorder();
342                 if ( xRecorder.is() )
343                 {
344                     SfxRequest aReq(m_pSh->GetView().GetViewFrame(),FN_INSERT_FRAME);
345                         aReq.AppendItem(SfxUInt16Item( FN_INSERT_FRAME,
346                                 static_cast<sal_uInt16>(FLY_AT_PARA) ));
347                         aReq.AppendItem(SfxPointItem( FN_PARAM_1, m_pSh->GetAnchorObjDiff()));
348                         aReq.AppendItem(SvxSizeItem( FN_PARAM_2, m_pSh->GetObjSize()));
349 					aReq.Done();
350 				}
351                 bAutoCap = sal_True;
352                 if(m_pWin->GetFrmColCount() > 1)
353 				{
354                     SfxItemSet aSet(m_pView->GetPool(),RES_COL,RES_COL);
355 					SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL));
356                     aCol.Init(m_pWin->GetFrmColCount(), aCol.GetGutterWidth(), aCol.GetWishWidth());
357 					aSet.Put(aCol);
358 					// Vorlagen-AutoUpdate
359                     SwFrmFmt* pFmt = m_pSh->GetCurFrmFmt();
360 					if(pFmt && pFmt->IsAutoUpdateFmt())
361                         m_pSh->AutoUpdateFrame(pFmt, aSet);
362 					else
363                         m_pSh->SetFlyFrmAttr( aSet );
364 				}
365 			}
366             if (m_pWin->GetSdrDrawMode() == OBJ_NONE)
367             {
368                 m_pSh->EndUndo();
369             }
370 		}
371 
372 		bReturn = sal_True;
373 
374 		EnterSelectMode(rMEvt);
375 	}
376 	else
377 	{
378         SdrView *pSdrView = m_pSh->GetDrawView();
379 
380 		if (!pSdrView->HasMarkablePoints())
381 		{
382 			/**********************************************************************
383 			* KEIN BEZIER_EDITOR
384 			**********************************************************************/
385             if ((m_pSh->GetDrawView()->IsMarkObj() || m_pSh->GetDrawView()->IsMarkPoints())
386 				 && rMEvt.IsLeft())
387 			{
388                 bReturn = m_pSh->EndMark();
389 
390                 m_pWin->SetDrawAction(sal_False);
391 
392                 if (aPnt == m_aStartPos && m_pSh->IsObjSelectable(aPnt))
393 				{
394                     m_pSh->SelectObj(aPnt, ( rMEvt.IsShift() &&
395                                    m_pSh->IsSelFrmMode()) ? SW_ADD_SELECT : 0);
396 
397                     if (!m_pSh->IsObjSelected())
398 					{
399                         m_pView->LeaveDrawCreate();    // In Selektionsmode wechseln
400 
401                         m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
402 
403                         if (m_pSh->IsSelFrmMode())
404                             m_pSh->LeaveSelFrmMode();
405 					}
406                     m_pView->NoRotate();
407 
408 					bCheckShell = sal_True;	// ggf BezierShell anwerfen
409 				}
410                 else if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction())
411 				{
412                     if (m_pSh->IsObjSelectable(aPnt))
413                         m_pSh->SelectObj(aPnt, ( rMEvt.IsShift() &&
414                             m_pSh->IsSelFrmMode() ) ? SW_ADD_SELECT : 0 );
415 					else
416 					{
417                         m_pView->LeaveDrawCreate();
418                         if (m_pSh->IsSelFrmMode())
419                             m_pSh->LeaveSelFrmMode();
420 					}
421                     m_pView->NoRotate();
422 
423 					bReturn = sal_True;
424 				}
425 			}
426 		}
427 		else
428 		{
429 			/**********************************************************************
430 			* BEZIER_EDITOR
431 			**********************************************************************/
432 			if ( pSdrView->IsAction() )
433 			{
434 				if ( pSdrView->IsInsObjPoint() )
435 					bReturn = pSdrView->EndInsObjPoint(SDRCREATE_FORCEEND);
436 				else if (pSdrView->IsMarkPoints() )
437 					bReturn = pSdrView->EndMarkPoints();
438 				else
439 				{
440 					pSdrView->EndAction();
441 					bReturn = sal_True;
442 				}
443                 m_pWin->SetDrawAction(sal_False);
444 
445                 if (aPnt == m_aStartPos)
446 				{
447                     if (!m_pSh->IsObjSelectable(aPnt))
448                         m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX));
449 					else if (!bReturn)
450 					{
451 						if (!rMEvt.IsShift())
452 							pSdrView->UnmarkAllPoints();
453                         m_pSh->SelectObj(aPnt, (rMEvt.IsShift() &&
454                                        m_pSh->IsSelFrmMode()) ? SW_ADD_SELECT :0);
455 					}
456 
457                     if (!m_pSh->IsObjSelected())
458 					{
459                         m_pView->LeaveDrawCreate();    // In Selektionsmode wechseln
460 
461                         m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
462 
463                         if (m_pSh->IsSelFrmMode())
464                             m_pSh->LeaveSelFrmMode();
465 					}
466                     m_pView->NoRotate();
467 
468 					bCheckShell = sal_True;	// ggf BezierShell anwerfen
469 				}
470 			}
471 
472 			SetDrawPointer();
473 
474             if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction())
475 			{
476                 m_pView->LeaveDrawCreate();
477                 if (m_pSh->IsSelFrmMode())
478                     m_pSh->LeaveSelFrmMode();
479 
480                 m_pView->NoRotate();
481 				bReturn = sal_True;
482 			}
483 		}
484 	}
485 
486 	if (bCheckShell)
487         m_pView->AttrChangedNotify( m_pSh ); // ggf BezierShell anwerfen
488 
489 	//!!!!!!!!!! Achtung Suizid !!!!!!!!!!! Sollte alles mal erneuert werden
490 	if ( bAutoCap )
491         m_pView->AutoCaption(FRAME_CAP);   //Kann derzeit nur FRAME sein, sonst auf
492 										//enums umstellen
493 	return (bReturn);
494 }
495 
496 /*************************************************************************
497 |*
498 |* Function aktivieren
499 |*
500 \************************************************************************/
501 
502 
503 void SwDrawBase::Activate(const sal_uInt16 nSlot)
504 {
505     SetSlotId(nSlot);
506     SdrView *pSdrView = m_pSh->GetDrawView();
507 
508     pSdrView->SetCurrentObj( static_cast< sal_uInt16 >(m_pWin->GetSdrDrawMode()) );
509 	pSdrView->SetEditMode(sal_False);
510 
511 	SetDrawPointer();
512     m_pSh->NoEdit();
513 }
514 
515 /*************************************************************************
516 |*
517 |* Function deaktivieren
518 |*
519 \************************************************************************/
520 
521 
522 void __EXPORT SwDrawBase::Deactivate()
523 {
524     SdrView *pSdrView = m_pSh->GetDrawView();
525 	pSdrView->SetOrtho(sal_False);
526 	pSdrView->SetAngleSnapEnabled(sal_False);
527 
528     if (m_pWin->IsDrawAction() && m_pSh->IsDrawCreate())
529         m_pSh->BreakCreate();
530 
531     m_pWin->SetDrawAction(sal_False);
532 
533     m_pWin->ReleaseMouse();
534 	bNoInterrupt = sal_False;
535 
536 //  if(!m_pSh->IsObjSelected())
537 //      m_pSh->Edit();
538 
539     if(m_pWin->GetApplyTemplate())
540         m_pWin->SetApplyTemplate(SwApplyTemplate());
541     m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
542 }
543 
544 /*************************************************************************
545 |*
546 |* Tastaturereignisse bearbeiten
547 |*
548 |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
549 |* sal_False.
550 |*
551 \************************************************************************/
552 
553 
554 sal_Bool SwDrawBase::KeyInput(const KeyEvent& rKEvt)
555 {
556 	sal_Bool bReturn = sal_False;
557 	sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
558 
559 	switch (nCode)
560 	{
561 		case KEY_ESCAPE:
562 		{
563             if (m_pWin->IsDrawAction())
564 			{
565 				BreakCreate();
566                 m_pView->LeaveDrawCreate();
567 			}
568 
569 			bReturn = sal_True;
570 		}
571 		break;
572 
573 		case KEY_DELETE:
574 		{
575             m_pSh->DelSelectedObj();
576 			bReturn = sal_True;
577 		}
578 		break;
579 
580 		case KEY_UP:
581 		case KEY_DOWN:
582 		case KEY_LEFT:
583 		case KEY_RIGHT:
584 		{
585             SdrView *pSdrView = m_pSh->GetDrawView();
586 
587 			if (!pSdrView->IsTextEdit())
588 			{
589 				long nX = 0;
590 				long nY = 0;
591 
592 				if (nCode == KEY_UP)
593 				{
594 					// Scroll nach oben
595 					nX = 0;
596 					nY =-1;
597 				}
598 				else if (nCode == KEY_DOWN)
599 				{
600 					// Scroll nach unten
601 					nX = 0;
602 					nY = 1;
603 				}
604 				else if (nCode == KEY_LEFT)
605 				{
606 					// Scroll nach links
607 					nX =-1;
608 					nY = 0;
609 				}
610 				else if (nCode == KEY_RIGHT)
611 				{
612 					// Scroll nach rechts
613 					nX = 1;
614 					nY = 0;
615 				}
616 
617 				if (pSdrView->AreObjectsMarked() && rKEvt.GetKeyCode().IsMod2())
618 				{
619 					// Objekte verschieben
620 					nX *= 100;
621 					nY *= 100;
622 					pSdrView->MoveAllMarked(Size(nX, nY));
623 				}
624 
625 				bReturn = sal_True;
626 			}
627 		}
628 		break;
629 	}
630 
631 	return (bReturn);
632 }
633 
634 
635 /*************************************************************************
636 |*
637 |* Tastaturereignisse bearbeiten
638 |*
639 |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
640 |* sal_False.
641 |*
642 \************************************************************************/
643 
644 
645 void SwDrawBase::BreakCreate()
646 {
647     m_pSh->BreakCreate();
648     m_pWin->SetDrawAction(sal_False);
649     m_pWin->ReleaseMouse();
650 
651 	Deactivate();
652 //  m_pView->LeaveDrawCreate();
653 }
654 
655 /*************************************************************************
656 |*
657 |* Mauspointer umschalten
658 |*
659 \************************************************************************/
660 
661 
662 void SwDrawBase::SetDrawPointer()
663 {
664     SdrView *pSdrView = m_pSh->GetDrawView();
665         Point aPnt(m_pWin->OutputToScreenPixel(m_pWin->GetPointerPosPixel()));
666     aPnt = m_pWin->PixelToLogic(m_pWin->ScreenToOutputPixel(aPnt));
667     const Pointer aPointTyp = pSdrView->GetPreferedPointer(aPnt, m_pSh->GetOut());
668 	const Pointer aDrawPt(aPointTyp);
669     m_pWin->SetPointer(aDrawPt);
670 }
671 
672 /*************************************************************************
673 |*
674 |* Ggf in Selektionsmode wechseln
675 |*
676 \************************************************************************/
677 
678 void SwDrawBase::EnterSelectMode(const MouseEvent& rMEvt)
679 {
680     m_pWin->SetDrawAction(sal_False);
681 
682     if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction())
683 	{
684         Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
685 
686         if (m_pSh->IsObjSelectable(aPnt))
687 		{
688             m_pSh->SelectObj(aPnt);
689             if (rMEvt.GetModifier() == KEY_SHIFT || !m_pSh->IsObjSelected())
690 			{
691                 m_pView->LeaveDrawCreate();    // In Selektionsmode wechseln
692 
693                 m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
694 			}
695 		}
696 		else
697 		{
698             m_pView->LeaveDrawCreate();
699             if (m_pSh->IsSelFrmMode())
700                 m_pSh->LeaveSelFrmMode();
701 		}
702         m_pView->NoRotate();
703 	}
704 }
705 /* -----------------------------03.04.2002 10:52------------------------------
706 
707  ---------------------------------------------------------------------------*/
708 void SwDrawBase::CreateDefaultObject()
709 {
710     Point aStartPos = GetDefaultCenterPos();
711     Point aEndPos(aStartPos);
712     aStartPos.X() -= 8 * MM50;
713     aStartPos.Y() -= 4 * MM50;
714     aEndPos.X() += 8 * MM50;
715     aEndPos.Y() += 4 * MM50;
716     Rectangle aRect(aStartPos, aEndPos);
717     m_pSh->CreateDefaultShape( static_cast< sal_uInt16 >(m_pWin->GetSdrDrawMode()), aRect, m_nSlotId);
718 }
719 /* -----------------25.10.2002 14:14-----------------
720  *
721  * --------------------------------------------------*/
722 Point  SwDrawBase::GetDefaultCenterPos()
723 {
724     Size aDocSz(m_pSh->GetDocSize());
725     const SwRect& rVisArea = m_pSh->VisArea();
726     Point aStartPos = rVisArea.Center();
727     if(rVisArea.Width() > aDocSz.Width())
728         aStartPos.X() = aDocSz.Width() / 2 + rVisArea.Left();
729     if(rVisArea.Height() > aDocSz.Height())
730         aStartPos.Y() = aDocSz.Height() / 2 + rVisArea.Top();
731     return aStartPos;
732 }
733 
734 // #i33136#
735 bool SwDrawBase::doConstructOrthogonal() const
736 {
737 	return false;
738 }
739 
740 // eof
741