xref: /trunk/main/sw/source/ui/ribbar/dselect.cxx (revision efeef26f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 
28 #include <sfx2/bindings.hxx>
29 #include "view.hxx"
30 #include "edtwin.hxx"
31 #include "wrtsh.hxx"
32 #include "cmdid.h"
33 #include "drawbase.hxx"
34 #include "dselect.hxx"
35 
36 extern sal_Bool bNoInterrupt;		// in mainwn.cxx
37 
38 /*************************************************************************
39 |*
40 |* Konstruktor
41 |*
42 \************************************************************************/
43 
DrawSelection(SwWrtShell * pWrtShell,SwEditWin * pEditWin,SwView * pSwView)44 DrawSelection::DrawSelection(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
45 				SwDrawBase(pWrtShell, pEditWin, pSwView)
46 {
47     m_bCreateObj = sal_False;
48 }
49 
50 /*************************************************************************
51 |*
52 |* Tastaturereignisse bearbeiten
53 |*
54 |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
55 |* sal_False.
56 |*
57 \************************************************************************/
58 
KeyInput(const KeyEvent & rKEvt)59 sal_Bool DrawSelection::KeyInput(const KeyEvent& rKEvt)
60 {
61 	sal_Bool bReturn = sal_False;
62 
63 	switch (rKEvt.GetKeyCode().GetCode())
64 	{
65 		case KEY_ESCAPE:
66 		{
67             if (m_pWin->IsDrawAction())
68 			{
69                 m_pSh->BreakMark();
70                 m_pWin->ReleaseMouse();
71 			}
72 			bReturn = sal_True;
73 		}
74 		break;
75 	}
76 
77 	if (!bReturn)
78 		bReturn = SwDrawBase::KeyInput(rKEvt);
79 
80 	return (bReturn);
81 }
82 
83 /*************************************************************************
84 |*
85 |* Function aktivieren
86 |*
87 \************************************************************************/
88 
Activate(const sal_uInt16 nSlotId)89 void DrawSelection::Activate(const sal_uInt16 nSlotId)
90 {
91     m_pWin->SetSdrDrawMode(OBJ_NONE);
92     m_pWin->SetObjectSelect( sal_True );
93 	SwDrawBase::Activate(nSlotId);
94 
95     m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
96 }
97 
98 
99