Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <sfx2/bindings.hxx>
21 : #include "view.hxx"
22 : #include "edtwin.hxx"
23 : #include "wrtsh.hxx"
24 : #include "cmdid.h"
25 : #include "drawbase.hxx"
26 : #include "dselect.hxx"
27 :
28 0 : DrawSelection::DrawSelection(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
29 0 : SwDrawBase(pWrtShell, pEditWin, pSwView)
30 : {
31 0 : m_bCreateObj = false;
32 0 : }
33 :
34 : // Process keyboard events
35 :
36 : // If a KeyEvent is processed then the return value is true, otherwise
37 : // false.
38 :
39 0 : bool DrawSelection::KeyInput(const KeyEvent& rKEvt)
40 : {
41 0 : bool bReturn = false;
42 :
43 0 : switch (rKEvt.GetKeyCode().GetCode())
44 : {
45 : case KEY_ESCAPE:
46 : {
47 0 : if (m_pWin->IsDrawAction())
48 : {
49 0 : m_pSh->BreakMark();
50 0 : m_pWin->ReleaseMouse();
51 : }
52 0 : bReturn = true;
53 : }
54 0 : break;
55 : }
56 :
57 0 : if (!bReturn)
58 0 : bReturn = SwDrawBase::KeyInput(rKEvt);
59 :
60 0 : return bReturn;
61 : }
62 :
63 0 : void DrawSelection::Activate(const sal_uInt16 nSlotId)
64 : {
65 0 : m_pWin->SetSdrDrawMode(OBJ_NONE);
66 0 : m_pWin->SetObjectSelect( true );
67 0 : SwDrawBase::Activate(nSlotId);
68 :
69 0 : m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
70 177 : }
71 :
72 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|