1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: actctrl.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
37 #include <tools/list.hxx>
38 #include "actctrl.hxx"
42 void NumEditAction::Action()
44 aActionLink
.Call( this );
48 long NumEditAction::Notify( NotifyEvent
& rNEvt
)
52 if ( rNEvt
.GetType() == EVENT_KEYINPUT
)
54 const KeyEvent
* pKEvt
= rNEvt
.GetKeyEvent();
55 const KeyCode aKeyCode
= pKEvt
->GetKeyCode();
56 const USHORT nModifier
= aKeyCode
.GetModifier();
57 if( aKeyCode
.GetCode() == KEY_RETURN
&&
66 NumericField::Notify( rNEvt
);
70 /*------------------------------------------------------------------------
71 Beschreibung: KeyInput fuer ShortName - Edits ohne Spaces
72 ------------------------------------------------------------------------*/
74 NoSpaceEdit::NoSpaceEdit( Window
* pParent
, const ResId
& rResId
)
75 : Edit(pParent
, rResId
),
76 sForbiddenChars(String::CreateFromAscii(" "))
80 NoSpaceEdit::~NoSpaceEdit()
84 void NoSpaceEdit::KeyInput(const KeyEvent
& rEvt
)
86 BOOL bCallParent
= TRUE
;
87 if(rEvt
.GetCharCode())
89 String sKey
= rEvt
.GetCharCode();
90 if( STRING_NOTFOUND
!= sForbiddenChars
.Search(sKey
))
96 /* -----------------------------11.02.00 15:28--------------------------------
98 ---------------------------------------------------------------------------*/
99 void NoSpaceEdit::Modify()
101 Selection aSel
= GetSelection();
102 String sTemp
= GetText();
103 for(USHORT i
= 0; i
< sForbiddenChars
.Len(); i
++)
105 sTemp
.EraseAllChars( sForbiddenChars
.GetChar(i
) );
107 USHORT nDiff
= GetText().Len() - sTemp
.Len();
110 aSel
.setMin(aSel
.getMin() - nDiff
);
111 aSel
.setMax(aSel
.getMin());
115 if(GetModifyHdl().IsSet())
116 GetModifyHdl().Call(this);
118 /* -----------------25.06.2003 15:57-----------------
120 --------------------------------------------------*/
121 ReturnActionEdit::~ReturnActionEdit()
124 /* -----------------25.06.2003 15:58-----------------
126 --------------------------------------------------*/
127 void ReturnActionEdit::KeyInput( const KeyEvent
& rEvt
)
129 const KeyCode aKeyCode
= rEvt
.GetKeyCode();
130 const USHORT nModifier
= aKeyCode
.GetModifier();
131 if( aKeyCode
.GetCode() == KEY_RETURN
&&
134 if(aReturnActionLink
.IsSet())
135 aReturnActionLink
.Call(this);
138 Edit::KeyInput(rEvt
);