xref: /aoo41x/main/sc/source/ui/inc/funcutl.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_FUNCUTL_HXX
29 #define SC_FUNCUTL_HXX
30 
31 #ifndef _SCRBAR_HXX //autogen
32 #include <vcl/scrbar.hxx>
33 #endif
34 #ifndef _FIXED_HXX //autogen
35 #include <vcl/fixed.hxx>
36 #endif
37 #include <svtools/svmedit.hxx>
38 #include "anyrefdg.hxx"		// formula::RefButton
39 
40 
41 //============================================================================
42 // class ValWnd
43 
44 class ValWnd : public Window
45 {
46 public:
47 			ValWnd( Window* pParent, const ResId& rId );
48 
49 	void	SetValue( const String& rStrVal );
50 
51 protected:
52 	virtual void	Paint( const Rectangle& rRect );
53 
54 private:
55 	String		aStrValue;
56 	Rectangle	aRectOut;
57 };
58 
59 
60 //============================================================================
61 // class ScEditBox
62 
63 class ScEditBox : public Control
64 {
65 private:
66 
67 	MultiLineEdit*	pMEdit;
68 	Link			aSelChangedLink;
69 	Selection		aOldSel;
70 	sal_Bool			bMouseFlag;
71 					DECL_LINK( ChangedHdl, ScEditBox* );
72 
73 protected:
74 
75 	virtual long	PreNotify( NotifyEvent& rNEvt );
76 	virtual void	SelectionChanged();
77 	virtual void	Resize();
78 	virtual void	GetFocus();
79 
80 
81 public:
82 					ScEditBox( Window* pParent, const ResId& rResId );
83 
84 					~ScEditBox();
85 
86 	MultiLineEdit*	GetEdit() {return pMEdit;}
87 
88 	void            SetSelChangedHdl( const Link& rLink ) { aSelChangedLink = rLink; }
89 	const Link&     GetSelChangedHdl() const { return aSelChangedLink; }
90 
91 	void			UpdateOldSel();
92 };
93 
94 
95 
96 //============================================================================
97 // class ArgEdit
98 
99 class ArgEdit : public formula::RefEdit
100 {
101 public:
102 			ArgEdit( Window* pParent, const ResId& rResId );
103 
104 	void	Init( ArgEdit* pPrevEdit, ArgEdit* pNextEdit,
105 				  ScrollBar& rArgSlider, sal_uInt16 nArgCount );
106 
107 protected:
108 	virtual void	KeyInput( const KeyEvent& rKEvt );
109 
110 private:
111 	ArgEdit*	pEdPrev;
112 	ArgEdit*	pEdNext;
113 	ScrollBar*	pSlider;
114 	sal_uInt16		nArgs;
115 };
116 
117 
118 //============================================================================
119 // class ArgInput
120 
121 class ArgInput
122 {
123 private:
124 
125 	Link			aFxClickLink;
126 	Link			aRefClickLink;
127 	Link			aFxFocusLink;
128 	Link			aRefFocusLink;
129 	Link			aEdFocusLink;
130 	Link			aEdModifyLink;
131 
132 	FixedText*		pFtArg;
133 	ImageButton*	pBtnFx;
134 	ArgEdit*		pEdArg;
135 	formula::RefButton*	pRefBtn;
136 
137 	DECL_LINK(	FxBtnClickHdl, ImageButton* );
138 	DECL_LINK(	RefBtnClickHdl,formula::RefButton* );
139 	DECL_LINK(	FxBtnFocusHdl, ImageButton* );
140 	DECL_LINK(	RefBtnFocusHdl,formula::RefButton* );
141 	DECL_LINK(	EdFocusHdl, ArgEdit* );
142 	DECL_LINK(	EdModifyHdl,ArgEdit* );
143 
144 protected:
145 
146 	virtual void	FxClick();
147 	virtual void	RefClick();
148 	virtual void	FxFocus();
149 	virtual void	RefFocus();
150 	virtual void	EdFocus();
151 	virtual void	EdModify();
152 
153 public:
154 
155 	ArgInput();
156 
157 	void		InitArgInput (	FixedText*		pftArg,
158 								ImageButton*	pbtnFx,
159 								ArgEdit*		pedArg,
160 								formula::RefButton*	prefBtn);
161 
162 	void		SetArgName(const String &aArg);
163 	String		GetArgName();
164 	void		SetArgNameFont(const Font&);
165 
166 	void		SetArgVal(const String &aVal);
167 	String		GetArgVal();
168 
169 	void		SetArgSelection	(const Selection& rSel );
170 
171 	ArgEdit*	GetArgEdPtr() {return pEdArg;}
172 
173 
174 	void            SetFxClickHdl( const Link& rLink ) { aFxClickLink = rLink; }
175 	const Link&     GetFxClickHdl() const { return aFxClickLink; }
176 
177 	void            SetRefClickHdl( const Link& rLink ) { aRefClickLink = rLink; }
178 	const Link&     GetRefClickHdl() const { return aRefClickLink; }
179 
180 	void            SetFxFocusHdl( const Link& rLink ) { aFxFocusLink = rLink; }
181 	const Link&     GetFxFocusHdl() const { return aFxFocusLink; }
182 
183 	void            SetRefFocusHdl( const Link& rLink ) { aRefFocusLink = rLink; }
184 	const Link&     GetRefFocusHdl() const { return aRefFocusLink; }
185 
186 	void            SetEdFocusHdl( const Link& rLink ) { aEdFocusLink = rLink; }
187 	const Link&     GetEdFocusHdl() const { return aEdFocusLink; }
188 
189 	void            SetEdModifyHdl( const Link& rLink ) { aEdModifyLink = rLink; }
190 	const Link&     GetEdModifyHdl() const { return aEdModifyLink; }
191 
192 	void Hide();
193 	void Show();
194 
195 };
196 
197 
198 #endif
199