summaryrefslogtreecommitdiff
path: root/sw/source/ui/ribbar/drawbase.cxx
blob: 4710570f456d48c48ee183403a0a39c635c25aeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
/*************************************************************************
 *
 *  $RCSfile: drawbase.cxx,v $
 *
 *  $Revision: 1.1.1.1 $
 *
 *  last change: $Author: hr $ $Date: 2000-09-18 17:14:46 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/
#ifdef PRECOMPILED
#include "ui_pch.hxx"
#endif

#pragma hdrstop
#include <hintids.hxx>
#ifndef _UIPARAM_HXX
#include <uiparam.hxx>
#endif

#ifndef _LIST_HXX //autogen
#include <tools/list.hxx>
#endif
#ifndef _SVDVIEW_HXX //autogen
#include <svx/svdview.hxx>
#endif
#ifndef _SVDOBJ_HXX //autogen
#include <svx/svdobj.hxx>
#endif
#ifndef _SFXPTITEM_HXX //autogen
#include <svtools/ptitem.hxx>
#endif
#ifndef _SVX_SIZEITEM_HXX //autogen
#include <svx/sizeitem.hxx>
#endif
#ifndef _SFXREQUEST_HXX //autogen
#include <sfx2/request.hxx>
#endif
#ifndef _SFX_BINDINGS_HXX //autogen
#include <sfx2/bindings.hxx>
#endif
#ifndef _FMTCLDS_HXX
#include <fmtclds.hxx>
#endif
#ifndef _FRMFMT_HXX //autogen
#include <frmfmt.hxx>
#endif
#ifndef _SFXVIEWFRM_HXX
#include <sfx2/viewfrm.hxx>
#endif

#include "cmdid.h"
#include "basesh.hxx"
#include "view.hxx"
#include "wrtsh.hxx"
#include "drawbase.hxx"
#include "edtwin.hxx"
#include "caption.hxx"
#include "swundo.hxx"

extern BOOL bNoInterrupt;       // in mainwn.cxx

#define MINMOVE ((USHORT)pSh->GetOut()->PixelToLogic(Size(pSh->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width())


/*************************************************************************
|*
|* Konstruktor
|*
\************************************************************************/


SwDrawBase::SwDrawBase(SwWrtShell* pSwWrtShell, SwEditWin* pWindow, SwView* pSwView) :
    pSh(pSwWrtShell),
    pWin(pWindow),
    pView(pSwView),
    bInsForm(FALSE),
    bCreateObj(TRUE)
{
    if ( !pSh->HasDrawView() )
        pSh->MakeDrawView();
}

/*************************************************************************
|*
|* Destruktor
|*
\************************************************************************/

__EXPORT SwDrawBase::~SwDrawBase()
{
    if (pView->GetWrtShellPtr())    // Im view-Dtor koennte die wrtsh bereits geloescht worden sein...
        pSh->GetDrawView()->SetEditMode(TRUE);
}

/*************************************************************************
|*
|* MouseButtonDown-event
|*
\************************************************************************/


BOOL SwDrawBase::MouseButtonDown(const MouseEvent& rMEvt)
{
    BOOL bReturn = FALSE;

    SdrView *pSdrView = pSh->GetDrawView();

    pSdrView->SetOrtho(rMEvt.IsShift());
    pSdrView->SetAngleSnapEnabled(rMEvt.IsShift());

    if (rMEvt.IsMod2())
    {
        pSdrView->SetCreate1stPointAsCenter(TRUE);
        pSdrView->SetResizeAtCenter(TRUE);
    }
    else
    {
        pSdrView->SetCreate1stPointAsCenter(FALSE);
        pSdrView->SetResizeAtCenter(FALSE);
    }

    SdrViewEvent aVEvt;
    SdrHitKind eHit = pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);

    // Nur neues Objekt, wenn nicht im Basismode (bzw reinem Selektionsmode)
    if (rMEvt.IsLeft() && !pWin->IsDrawAction())
    {
        if (IsCreateObj() && (eHit == SDRHIT_UNMARKEDOBJECT || eHit == SDRHIT_NONE || pSh->IsDrawCreate()))
        {
            bNoInterrupt = TRUE;
            pWin->CaptureMouse();

            aStartPos = pWin->PixelToLogic(rMEvt.GetPosPixel());

            bReturn = pSh->BeginCreate(pWin->GetDrawMode(), aStartPos);

            SetDrawPointer();

            if ( bReturn )
                pWin->SetDrawAction(TRUE);
        }
        else if (!pSdrView->IsAction())
        {
            /**********************************************************************
            * BEZIER-EDITOR
            **********************************************************************/
            pWin->CaptureMouse();
            aStartPos = pWin->PixelToLogic(rMEvt.GetPosPixel());
            UINT16 nEditMode = pWin->GetBezierMode();

            if (eHit == SDRHIT_HANDLE && aVEvt.pHdl->GetKind() == HDL_BWGT)
            {
                /******************************************************************
                * Handle draggen
                ******************************************************************/
                bNoInterrupt = TRUE;
                bReturn = pSdrView->BegDragObj(aStartPos, (OutputDevice*) NULL, aVEvt.pHdl);
                pWin->SetDrawAction(TRUE);
            }
            else if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT)
            {
                /******************************************************************
                * Klebepunkt einfuegen
                ******************************************************************/
                bNoInterrupt = TRUE;
                bReturn = pSdrView->BegInsObjPoint(aStartPos, rMEvt.IsMod1(), NULL, 0);
                pWin->SetDrawAction(TRUE);
            }
            else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1())
            {
                /******************************************************************
                * Klebepunkt selektieren
                ******************************************************************/
                if (!rMEvt.IsShift())
                    pSdrView->UnmarkAllPoints();

                bReturn = pSdrView->BegMarkPoints(aStartPos, (OutputDevice*) NULL);
                pWin->SetDrawAction(TRUE);
            }
            else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2())
            {
                /******************************************************************
                * Objekt verschieben
                ******************************************************************/
                return FALSE;
            }
            else if (eHit == SDRHIT_HANDLE)
            {
                /******************************************************************
                * Klebepunkt selektieren
                ******************************************************************/
                if (pSdrView->HasMarkablePoints() && (!pSdrView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift()))
                {
                    SdrHdl* pHdl = NULL;

                    if (!rMEvt.IsShift())
                    {
                        pSdrView->UnmarkAllPoints();
                        pHdl = pSdrView->HitHandle(aStartPos, *pWin);
                    }
                    else
                    {
                        if (pSdrView->IsPointMarked(*aVEvt.pHdl))
                        {
                            bReturn = pSdrView->UnmarkPoint(*aVEvt.pHdl);
                            pHdl = NULL;
                        }
                        else
                        {
                            pHdl = pSdrView->HitHandle(aStartPos, *pWin);
                        }
                    }

                    if (pHdl)
                    {
                        bNoInterrupt = TRUE;
                        pSdrView->MarkPoint(*pHdl);
//                      bReturn = pSdrView->BegDragObj(aStartPos, (OutputDevice*) NULL, pHdl);
//                      pWin->SetDrawAction(TRUE);
                    }
                }
            }
            else
            {
                /******************************************************************
                * Objekt selektieren oder draggen
                ******************************************************************/
                if (pSh->IsObjSelectable(aStartPos) && eHit == SDRHIT_UNMARKEDOBJECT)
                {
                    if (pSdrView->HasMarkablePoints())
                        pSdrView->UnmarkAllPoints();

                    bNoInterrupt = FALSE;
                    // Drag im edtwin verwenden
                    return FALSE;
                }

                bNoInterrupt = TRUE;

                if (pSh->IsObjSelected())
                {
                    if (!rMEvt.IsShift())
                    {
                        if (!pSdrView->HasMarkablePoints())
                            pSh->SelectObj(Point(LONG_MAX, LONG_MAX));  // Alles deselektieren
                        else
                            pSdrView->UnmarkAllPoints();
                    }
                }
                BOOL bMarked = FALSE;

                if (!pSh->IsSelFrmMode())
                    pSh->EnterSelFrmMode(NULL);

                if ((bReturn = pSh->BeginMark(aStartPos)) == TRUE)
                        pWin->SetDrawAction(TRUE);

                SetDrawPointer();
            }
        }
    }
    return bReturn;
}

/*************************************************************************
|*
|* MouseMove-event
|*
\************************************************************************/


BOOL SwDrawBase::MouseMove(const MouseEvent& rMEvt)
{
    SdrView *pSdrView = pSh->GetDrawView();
    Point aPnt(pWin->PixelToLogic(rMEvt.GetPosPixel()));
    BOOL bRet = FALSE;

    if (IsCreateObj() && !pWin->IsDrawSelMode() && pSdrView->IsCreateObj())
    {
        pSdrView->SetOrtho(rMEvt.IsShift());
        pSdrView->SetAngleSnapEnabled(rMEvt.IsShift());

        pSh->MoveCreate(aPnt);
        bRet = TRUE;
    }
    else if (pSdrView->IsAction() || pSdrView->IsInsObjPoint() || pSdrView->IsMarkPoints())
    {
        pSh->MoveMark(aPnt);
        bRet = TRUE;
    }

    return (bRet);
}

/*************************************************************************
|*
|* MouseButtonUp-event
|*
\************************************************************************/


BOOL SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt)
{
    BOOL bReturn = FALSE;
    BOOL bCheckShell = FALSE;
    BOOL bAutoCap = FALSE;

    Point aPnt(pWin->PixelToLogic(rMEvt.GetPosPixel()));

    if (IsCreateObj() && pSh->IsDrawCreate() && !pWin->IsDrawSelMode())
    {
        if (aPnt == aStartPos || rMEvt.IsRight())
        {
            pSh->BreakCreate();
            pView->LeaveDrawCreate();
        }
        else
        {
            if (pWin->GetDrawMode() == OBJ_NONE)
                pSh->StartUndo(UNDO_INSERT);

            pSh->EndCreate(SDRCREATE_FORCEEND);
            if (pWin->GetDrawMode() == OBJ_NONE)    // Textrahmen eingefuegt
            {
                bAutoCap = TRUE;
                if(pWin->GetFrmColCount() > 1)
                {
                    SfxItemSet aSet(pView->GetPool(),RES_COL,RES_COL);
                    SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL));
                    aCol.Init(pWin->GetFrmColCount(), aCol.GetGutterWidth(), aCol.GetWishWidth());
                    aSet.Put(aCol);
                    // Vorlagen-AutoUpdate
                    SwFrmFmt* pFmt = pSh->GetCurFrmFmt();
                    if(pFmt && pFmt->IsAutoUpdateFmt())
                        pSh->AutoUpdateFrame(pFmt, aSet);
                    else
                        pSh->SetFlyFrmAttr( aSet );
                }
            }
            if (pWin->GetDrawMode() == OBJ_NONE)
                pSh->EndUndo(UNDO_INSERT);
        }

        bReturn = TRUE;

        EnterSelectMode(rMEvt);
    }
    else
    {
        SdrView *pSdrView = pSh->GetDrawView();

        if (!pSdrView->HasMarkablePoints())
        {
            /**********************************************************************
            * KEIN BEZIER_EDITOR
            **********************************************************************/
            if ((pSh->GetDrawView()->IsMarkObj() || pSh->GetDrawView()->IsMarkPoints())
                 && rMEvt.IsLeft())
            {
                bReturn = pSh->EndMark();

                pWin->SetDrawAction(FALSE);

                if (aPnt == aStartPos && pSh->IsObjSelectable(aPnt))
                {
                    pSh->SelectObj(aPnt, rMEvt.IsShift() && pSh->IsSelFrmMode());

                    if (!pSh->IsObjSelected())
                    {
                        pView->LeaveDrawCreate();   // In Selektionsmode wechseln

                        pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);

                        if (pSh->IsSelFrmMode())
                            pSh->LeaveSelFrmMode();
                    }
                    pView->NoRotate();

                    bCheckShell = TRUE; // ggf BezierShell anwerfen
                }
                else if (!pSh->IsObjSelected() && !pWin->IsDrawAction())
                {
                    if (pSh->IsObjSelectable(aPnt))
                        pSh->SelectObj(aPnt, rMEvt.IsShift() && pSh->IsSelFrmMode());
                    else
                    {
                        pView->LeaveDrawCreate();
                        if (pSh->IsSelFrmMode())
                            pSh->LeaveSelFrmMode();
                    }
                    pView->NoRotate();

                    bReturn = TRUE;
                }
            }
        }
        else
        {
            /**********************************************************************
            * BEZIER_EDITOR
            **********************************************************************/
            if ( pSdrView->IsAction() )
            {
                if ( pSdrView->IsInsObjPoint() )
                    bReturn = pSdrView->EndInsObjPoint(SDRCREATE_FORCEEND);
                else if (pSdrView->IsMarkPoints() )
                    bReturn = pSdrView->EndMarkPoints();
                else
                {
                    pSdrView->EndAction();
                    bReturn = TRUE;
                }
                pWin->SetDrawAction(FALSE);

                if (aPnt == aStartPos)
                {
                    if (!pSh->IsObjSelectable(aPnt))
                        pSh->SelectObj(Point(LONG_MAX, LONG_MAX));
                    else if (!bReturn)
                    {
                        if (!rMEvt.IsShift())
                            pSdrView->UnmarkAllPoints();
                        pSh->SelectObj(aPnt, rMEvt.IsShift() && pSh->IsSelFrmMode());
                    }

                    if (!pSh->IsObjSelected())
                    {
                        pView->LeaveDrawCreate();   // In Selektionsmode wechseln

                        pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);

                        if (pSh->IsSelFrmMode())
                            pSh->LeaveSelFrmMode();
                    }
                    pView->NoRotate();

                    bCheckShell = TRUE; // ggf BezierShell anwerfen
                }
            }

            SetDrawPointer();

            if (!pSh->IsObjSelected() && !pWin->IsDrawAction())
            {
                pView->LeaveDrawCreate();
                if (pSh->IsSelFrmMode())
                    pSh->LeaveSelFrmMode();

                pView->NoRotate();
                bReturn = TRUE;
            }
        }
    }

    if (bCheckShell)
        pView->AttrChangedNotify( pSh );    // ggf BezierShell anwerfen

    //!!!!!!!!!! Achtung Suizid !!!!!!!!!!! Sollte alles mal erneuert werden
    if ( bAutoCap )
        pView->AutoCaption(FRAME_CAP);  //Kann derzeit nur FRAME sein, sonst auf
                                        //enums umstellen
    return (bReturn);
}

/*************************************************************************
|*
|* Function aktivieren
|*
\************************************************************************/


void SwDrawBase::Activate(const USHORT nSlotId)
{
    SdrView *pSdrView = pSh->GetDrawView();

    pSdrView->SetCurrentObj(pWin->GetDrawMode());
    pSdrView->SetEditMode(FALSE);

    SetDrawPointer();
    pSh->NoEdit();
}

/*************************************************************************
|*
|* Function deaktivieren
|*
\************************************************************************/


void __EXPORT SwDrawBase::Deactivate()
{
    SdrView *pSdrView = pSh->GetDrawView();
    pSdrView->SetOrtho(FALSE);
    pSdrView->SetAngleSnapEnabled(FALSE);

    if (pWin->IsDrawAction() && pSh->IsDrawCreate())
        pSh->BreakCreate();

    pWin->SetDrawAction(FALSE);

    pWin->ReleaseMouse();
    bNoInterrupt = FALSE;

//  if(!pSh->IsObjSelected())
//      pSh->Edit();

    if(pWin->GetApplyTemplate())
        pWin->SetApplyTemplate(SwApplyTemplate());
    pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
}

/*************************************************************************
|*
|* Tastaturereignisse bearbeiten
|*
|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
|* FALSE.
|*
\************************************************************************/


BOOL SwDrawBase::KeyInput(const KeyEvent& rKEvt)
{
    BOOL bReturn = FALSE;
    USHORT nCode = rKEvt.GetKeyCode().GetCode();

    switch (nCode)
    {
        case KEY_ESCAPE:
        {
            if (pWin->IsDrawAction())
            {
                BreakCreate();
                pView->LeaveDrawCreate();
            }

            bReturn = TRUE;
        }
        break;

        case KEY_DELETE:
        {
            pSh->DelSelectedObj();
            bReturn = TRUE;
        }
        break;

        case KEY_UP:
        case KEY_DOWN:
        case KEY_LEFT:
        case KEY_RIGHT:
        {
            SdrView *pSdrView = pSh->GetDrawView();

            if (!pSdrView->IsTextEdit())
            {
                long nX = 0;
                long nY = 0;

                if (nCode == KEY_UP)
                {
                    // Scroll nach oben
                    nX = 0;
                    nY =-1;
                }
                else if (nCode == KEY_DOWN)
                {
                    // Scroll nach unten
                    nX = 0;
                    nY = 1;
                }
                else if (nCode == KEY_LEFT)
                {
                    // Scroll nach links
                    nX =-1;
                    nY = 0;
                }
                else if (nCode == KEY_RIGHT)
                {
                    // Scroll nach rechts
                    nX = 1;
                    nY = 0;
                }

                if (pSdrView->HasMarkedObj() && rKEvt.GetKeyCode().IsMod2())
                {
                    // Objekte verschieben
                    nX *= 100;
                    nY *= 100;
                    pSdrView->MoveAllMarked(Size(nX, nY));
                }

                bReturn = TRUE;
            }
        }
        break;
    }

    return (bReturn);
}


/*************************************************************************
|*
|* Tastaturereignisse bearbeiten
|*
|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
|* FALSE.
|*
\************************************************************************/


void SwDrawBase::BreakCreate()
{
    pSh->BreakCreate();
    pWin->SetDrawAction(FALSE);
    pWin->ReleaseMouse();

    Deactivate();
//  pView->LeaveDrawCreate();
}

/*************************************************************************
|*
|* Mauspointer umschalten
|*
\************************************************************************/


void SwDrawBase::SetDrawPointer()
{
    SdrView *pSdrView = pSh->GetDrawView();
#ifdef VCL
        Point aPnt(pWin->OutputToScreenPixel(pWin->GetPointerPosPixel()));
#else
        Point aPnt = Pointer::GetPosPixel();
#endif
    aPnt = pWin->PixelToLogic(pWin->ScreenToOutputPixel(aPnt));
    const Pointer aPointTyp = pSdrView->GetPreferedPointer(aPnt, pSh->GetOut());
    const Pointer aDrawPt(aPointTyp);
    pWin->SetPointer(aDrawPt);
}

/*************************************************************************
|*
|* Ggf in Selektionsmode wechseln
|*
\************************************************************************/

void SwDrawBase::EnterSelectMode(const MouseEvent& rMEvt)
{
    pWin->SetDrawAction(FALSE);

    if (!pSh->IsObjSelected() && !pWin->IsDrawAction())
    {
        Point aPnt(pWin->PixelToLogic(rMEvt.GetPosPixel()));

        if (pSh->IsObjSelectable(aPnt))
        {
            pSh->SelectObj(aPnt);
            if (rMEvt.GetModifier() == KEY_SHIFT || !pSh->IsObjSelected())
            {
                pView->LeaveDrawCreate();   // In Selektionsmode wechseln

                pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
            }
        }
        else
        {
            pView->LeaveDrawCreate();
            if (pSh->IsSelFrmMode())
                pSh->LeaveSelFrmMode();
        }
        pView->NoRotate();
    }
}

/*************************************************************************

      $Log: not supported by cvs2svn $
      Revision 1.80  2000/09/18 16:06:01  willem.vandorp
      OpenOffice header added.

      Revision 1.79  2000/09/07 15:59:27  os
      change: SFX_DISPATCHER/SFX_BINDINGS removed

      Revision 1.78  2000/05/10 11:54:15  os
      Basic API removed

      Revision 1.77  1999/05/27 11:04:40  OS
      Einf?gen/Bearbeiten von Spalten ueberarbeitet


      Rev 1.76   27 May 1999 13:04:40   OS
   Einf?gen/Bearbeiten von Spalten ueberarbeitet

      Rev 1.75   11 Mar 1999 11:31:22   MA
   #63192# mit Suizid fertig werden

      Rev 1.74   16 Nov 1998 17:18:52   OM
   #58158# Beschriftung fuer weiter OLE-Objekte

      Rev 1.73   06 Nov 1998 17:05:04   OM
   #58158# Automatische Beschriftung

      Rev 1.72   09 Sep 1998 12:14:46   OM
   #56223# Kein GPF bei Klick in Seitenrand

      Rev 1.71   22 Jul 1998 16:06:00   TJ
   add: header wg. int comp. error

      Rev 1.70   09 Jun 1998 15:34:00   OM
   VC-Controls entfernt

      Rev 1.69   11 Mar 1998 17:12:08   OM
   DB-FormShell

      Rev 1.68   28 Nov 1997 20:16:46   MA
   includes

      Rev 1.67   24 Nov 1997 14:54:00   MA
   includes

      Rev 1.66   18 Sep 1997 13:59:46   OS
   Pointer::GetPosPixel fuer VCL ersetzt

      Rev 1.65   12 Sep 1997 10:36:42   OS
   ITEMID_* definiert

      Rev 1.64   04 Sep 1997 17:14:02   MA
   includes

      Rev 1.63   01 Sep 1997 13:14:38   OS
   DLL-Umstellung

      Rev 1.62   13 Aug 1997 12:19:54   OM
   #42383# Selektion von Punkten im Konstruktionsmode

      Rev 1.61   13 Aug 1997 12:18:56   OM
   #42383# Selektion von Punkten im Konstruktionsmode

      Rev 1.60   09 Aug 1997 13:33:42   OS
   paraitem/frmitems/textitem aufgeteilt

      Rev 1.59   30 Jul 1997 18:40:48   HJS
   includes

      Rev 1.58   07 Apr 1997 13:40:24   MH
   chg: header

      Rev 1.57   20 Mar 1997 11:33:46   OM
   Insert und CreateMode merken

      Rev 1.56   24 Feb 1997 16:51:46   OS
   ::Deactivate: Template-Pointer gfs. abschalten

      Rev 1.55   04 Feb 1997 15:20:32   OM
   Bugs in Selektionsmodi behoben

      Rev 1.54   31 Jan 1997 10:58:26   OM
   Statusupdate

      Rev 1.53   30 Jan 1997 11:48:10   OM
   Freihandzeichnen

      Rev 1.52   29 Jan 1997 11:22:08   OM
   Freihandzeichnen

      Rev 1.51   23 Jan 1997 16:07:06   OM
   Neuer Polygon Zeichenmode

      Rev 1.50   22 Jan 1997 11:19:48   OM
   Neue Shells: DrawBaseShell und DrawControlShell

      Rev 1.49   16 Jan 1997 12:35:58   OM
   Neuer Objekttyp: Bezier

      Rev 1.48   13 Jan 1997 15:50:18   OM
   Bezier-Punkte loeschen

      Rev 1.47   08 Jan 1997 12:44:26   OM
   Aenderungen fuer Bezier-Shell

      Rev 1.46   27 Nov 1996 17:26:22   OM
   Neu: SetAngleSnap

      Rev 1.45   28 Aug 1996 13:39:30   OS
   includes

      Rev 1.44   14 Aug 1996 15:05:28   OM
   Zentrisch konstruieren

      Rev 1.43   14 Aug 1996 11:31:00   JP
   svdraw.hxx entfernt

      Rev 1.42   09 Aug 1996 14:33:20   OM
   #29784# GPF im Dtor behoben

      Rev 1.41   07 Mar 1996 14:27:30   HJS
   2 defines zu viel

      Rev 1.40   24 Jan 1996 15:19:58   OM
   #24663# Haenger bei Polygon im Rastermode behoben

      Rev 1.39   14 Jan 1996 17:59:08   OS
   recording Rahmen einfuegen: Position von GetAnchorObjDiff() holen

      Rev 1.38   17 Dec 1995 17:28:18   OS
   Rahmen einfuegen wird jetzt an der Textshell recorded

      Rev 1.37   30 Nov 1995 13:59:52   MA
   opt: SV304, keine Pruefung vor SetPointer

      Rev 1.36   24 Nov 1995 16:58:04   OM
   PCH->PRECOMPILED

      Rev 1.35   23 Nov 1995 14:29:00   MA
   chg: GetObjAnchorDiff(), GetObjAbsPos()

*************************************************************************/