merge the formfield patch from ooo-build
[ooovba.git] / formula / source / ui / dlg / ControlHelper.hxx
blob92f7faadacbc5138897a7c980e3efd2fe8ef7258
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: funcutl.hxx,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
30 #ifndef FORMULA_CONTROL_HELPER_HXX_INCLUDED
31 #define FORMULA_CONTROL_HELPER_HXX_INCLUDED
33 #include "formula/funcutl.hxx"
34 #include <svtools/svmedit.hxx>
35 namespace formula
38 //============================================================================
39 // class ValWnd
40 class ValWnd : public Window
42 public:
43 ValWnd( Window* pParent, const ResId& rId );
45 void SetValue( const String& rStrVal );
47 protected:
48 virtual void Paint( const Rectangle& rRect );
50 private:
51 String aStrValue;
52 Rectangle aRectOut;
55 //============================================================================
56 // class EditBox
57 class EditBox : public Control
59 private:
61 MultiLineEdit* pMEdit;
62 Link aSelChangedLink;
63 Selection aOldSel;
64 BOOL bMouseFlag;
65 DECL_LINK( ChangedHdl, EditBox* );
67 protected:
69 virtual long PreNotify( NotifyEvent& rNEvt );
70 virtual void SelectionChanged();
71 virtual void Resize();
72 virtual void GetFocus();
75 public:
76 EditBox( Window* pParent,
77 WinBits nWinStyle = WB_LEFT | WB_BORDER );
78 EditBox( Window* pParent, const ResId& rResId );
80 virtual ~EditBox();
82 MultiLineEdit* GetEdit() {return pMEdit;}
84 void SetSelChangedHdl( const Link& rLink ) { aSelChangedLink = rLink; }
85 const Link& GetSelChangedHdl() const { return aSelChangedLink; }
87 void UpdateOldSel();
90 //============================================================================
91 // class ArgEdit
93 class ArgEdit : public RefEdit
95 public:
96 ArgEdit( Window* pParent, const ResId& rResId );
98 void Init( ArgEdit* pPrevEdit, ArgEdit* pNextEdit,
99 ScrollBar& rArgSlider, USHORT nArgCount );
101 protected:
102 virtual void KeyInput( const KeyEvent& rKEvt );
104 private:
105 ArgEdit* pEdPrev;
106 ArgEdit* pEdNext;
107 ScrollBar* pSlider;
108 USHORT nArgs;
112 //============================================================================
113 // class ArgInput
115 class ArgInput
117 private:
119 Link aFxClickLink;
120 Link aRefClickLink;
121 Link aFxFocusLink;
122 Link aRefFocusLink;
123 Link aEdFocusLink;
124 Link aEdModifyLink;
126 FixedText* pFtArg;
127 ImageButton* pBtnFx;
128 ArgEdit* pEdArg;
129 RefButton* pRefBtn;
131 DECL_LINK( FxBtnClickHdl, ImageButton* );
132 DECL_LINK( RefBtnClickHdl,RefButton* );
133 DECL_LINK( FxBtnFocusHdl, ImageButton* );
134 DECL_LINK( RefBtnFocusHdl,RefButton* );
135 DECL_LINK( EdFocusHdl, ArgEdit* );
136 DECL_LINK( EdModifyHdl,ArgEdit* );
138 protected:
140 virtual void FxClick();
141 virtual void RefClick();
142 virtual void FxFocus();
143 virtual void RefFocus();
144 virtual void EdFocus();
145 virtual void EdModify();
147 public:
149 ArgInput();
151 void InitArgInput ( FixedText* pftArg,
152 ImageButton* pbtnFx,
153 ArgEdit* pedArg,
154 RefButton* prefBtn);
156 void SetArgName(const String &aArg);
157 String GetArgName();
158 void SetArgNameFont(const Font&);
160 void SetArgVal(const String &aVal);
161 String GetArgVal();
163 void SetArgSelection (const Selection& rSel );
164 void ReplaceSelOfArg (const String& rStr );
166 Selection GetArgSelection();
169 ArgEdit* GetArgEdPtr() {return pEdArg;}
172 void SetFxClickHdl( const Link& rLink ) { aFxClickLink = rLink; }
173 const Link& GetFxClickHdl() const { return aFxClickLink; }
175 void SetRefClickHdl( const Link& rLink ) { aRefClickLink = rLink; }
176 const Link& GetRefClickHdl() const { return aRefClickLink; }
178 void SetFxFocusHdl( const Link& rLink ) { aFxFocusLink = rLink; }
179 const Link& GetFxFocusHdl() const { return aFxFocusLink; }
181 void SetRefFocusHdl( const Link& rLink ) { aRefFocusLink = rLink; }
182 const Link& GetRefFocusHdl() const { return aRefFocusLink; }
184 void SetEdFocusHdl( const Link& rLink ) { aEdFocusLink = rLink; }
185 const Link& GetEdFocusHdl() const { return aEdFocusLink; }
187 void SetEdModifyHdl( const Link& rLink ) { aEdModifyLink = rLink; }
188 const Link& GetEdModifyHdl() const { return aEdModifyLink; }
190 void Hide();
191 void Show();
196 #endif // FORMULA_FORMULA_HELPER_HXX_INCLUDED