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