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 : #ifndef INCLUDED_SW_SOURCE_UI_INC_ACTCTRL_HXX
20 : #define INCLUDED_SW_SOURCE_UI_INC_ACTCTRL_HXX
21 :
22 : #include <vcl/field.hxx>
23 : #include "swdllapi.h"
24 :
25 : /*--------------------------------------------------------------------
26 : Description: numerical input
27 : --------------------------------------------------------------------*/
28 0 : class SW_DLLPUBLIC NumEditAction: public NumericField
29 : {
30 : Link aActionLink;
31 :
32 : protected:
33 : virtual void Action();
34 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
35 : public:
36 0 : NumEditAction( Window* pParent, const ResId& rResId ) :
37 0 : NumericField(pParent, rResId) {}
38 :
39 0 : void SetActionHdl( const Link& rLink ) { aActionLink = rLink;}
40 : const Link& GetActionHdl() const { return aActionLink; }
41 : };
42 :
43 : /* --------------------------------------------------
44 : * Edit that doesn't accept spaces
45 : * --------------------------------------------------*/
46 : class SW_DLLPUBLIC NoSpaceEdit : public Edit
47 : {
48 : OUString sForbiddenChars;
49 : protected:
50 : virtual void KeyInput( const KeyEvent& ) SAL_OVERRIDE;
51 : virtual void Modify() SAL_OVERRIDE;
52 :
53 : public:
54 : NoSpaceEdit( Window* pParent );
55 : virtual ~NoSpaceEdit();
56 0 : void SetForbiddenChars(const OUString& rSet){sForbiddenChars = rSet;}
57 0 : const OUString& GetForbiddenChars(){return sForbiddenChars;}
58 : };
59 :
60 : /* --------------------------------------------------
61 : * No space and no full stop
62 : * --------------------------------------------------*/
63 0 : class TableNameEdit : public NoSpaceEdit
64 : {
65 : public:
66 0 : TableNameEdit(Window* pWin)
67 0 : : NoSpaceEdit(pWin)
68 : {
69 0 : SetForbiddenChars(OUString(" .<>"));
70 0 : }
71 : };
72 :
73 : /* --------------------------------------------------
74 : call a link when KEY_RETURN is pressed
75 : --------------------------------------------------*/
76 0 : class SW_DLLPUBLIC ReturnActionEdit : public Edit
77 : {
78 : Link aReturnActionLink;
79 : public:
80 0 : ReturnActionEdit(Window* pParent, WinBits nStyle)
81 0 : : Edit(pParent, nStyle)
82 : {
83 0 : }
84 : virtual void KeyInput( const KeyEvent& ) SAL_OVERRIDE;
85 :
86 0 : void SetReturnActionLink(const Link& rLink)
87 0 : { aReturnActionLink = rLink;}
88 : };
89 :
90 : #endif
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|