xref: /aoo41x/main/formula/source/ui/dlg/parawin.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 FORMULA_PARAWIN_HXX
29 #define FORMULA_PARAWIN_HXX
30 
31 #include <svtools/stdctrl.hxx>
32 #include <svtools/svmedit.hxx>
33 #include <vcl/lstbox.hxx>
34 #include <vcl/group.hxx>
35 #include <vcl/tabpage.hxx>
36 #include <vcl/tabctrl.hxx>
37 #include <vcl/scrbar.hxx>
38 
39 #include <vector>
40 #include "formula/funcutl.hxx"
41 #include "ControlHelper.hxx"
42 #include "ModuleHelper.hxx"
43 
44 namespace formula
45 {
46 //============================================================================
47 #define	NOT_FOUND 0xffff
48 //============================================================================
49 class IFunctionDescription;
50 class IControlReferenceHandler;
51 
52 class ParaWin : public TabPage
53 {
54 private:
55         OModuleClient   m_aModuleClient;
56 		Link			aScrollLink;
57 		Link			aFxLink;
58 		Link			aArgModifiedLink;
59 
60         ::std::vector<sal_uInt16>   aVisibleArgMapping;
61 		const IFunctionDescription*	pFuncDesc;
62 		IControlReferenceHandler*	pMyParent;
63 		sal_uInt16			nArgs;      // unsuppressed arguments
64 		Font			aFntBold;
65 		Font			aFntLight;
66 
67 		FixedInfo		aFtEditDesc;
68 		FixedText		aFtArgName;
69 		FixedInfo		aFtArgDesc;
70 
71 		ImageButton		aBtnFx1;
72 		FixedText		aFtArg1;
73 		ArgEdit			aEdArg1;
74 		RefButton		aRefBtn1;
75 
76 		ImageButton		aBtnFx2;
77 		FixedText		aFtArg2;
78 		ArgEdit			aEdArg2;
79 		RefButton		aRefBtn2;
80 
81         ImageButton		aBtnFx3;
82 		FixedText		aFtArg3;
83 		ArgEdit			aEdArg3;
84 		RefButton		aRefBtn3;
85 
86         ImageButton		aBtnFx4;
87 		FixedText		aFtArg4;
88         ArgEdit			aEdArg4;
89 		RefButton		aRefBtn4;
90 
91         ScrollBar		aSlider;
92         String          m_sOptional;
93         String          m_sRequired;
94 		sal_Bool			bRefMode;
95 
96 		sal_uInt16			nEdFocus;
97 		sal_uInt16			nActiveLine;
98 
99 		ArgInput		aArgInput[4];
100 		String			aDefaultString;
101         ::std::vector<String>
102                         aParaArray;
103 
104 		DECL_LINK( ScrollHdl, ScrollBar* );
105 		DECL_LINK( ModifyHdl, ArgInput* );
106 		DECL_LINK( GetEdFocusHdl, ArgInput* );
107 		DECL_LINK( GetFxFocusHdl, ArgInput* );
108 		DECL_LINK( GetFxHdl, ArgInput* );
109 
110 protected:
111 
112 		virtual void	SliderMoved();
113 		virtual void	ArgumentModified();
114 		virtual void	FxClick();
115 
116 		void			InitArgInput( sal_uInt16 nPos, FixedText& rFtArg, ImageButton& rBtnFx,
117 										ArgEdit& rEdArg, RefButton& rRefBtn);
118 
119 		void			DelParaArray();
120 		void			SetArgumentDesc(const String& aText);
121 		void			SetArgumentText(const String& aText);
122 
123 
124 		void			SetArgName		(sal_uInt16 no,const String &aArg);
125 		void			SetArgNameFont	(sal_uInt16 no,const Font&);
126 		void			SetArgVal		(sal_uInt16 no,const String &aArg);
127 
128 		void			HideParaLine(sal_uInt16 no);
129 		void			ShowParaLine(sal_uInt16 no);
130 		void			UpdateArgDesc( sal_uInt16 nArg );
131 		void			UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i );
132 
133 public:
134 						ParaWin(Window* pParent,IControlReferenceHandler* _pDlg,Point aPos);
135 						~ParaWin();
136 
137 		void			SetFunctionDesc(const IFunctionDescription* pFDesc);
138 		void			SetArgumentOffset(sal_uInt16 nOffset);
139 		void	    	SetEditDesc(const String& aText);
140 		void			UpdateParas();
141 		void			ClearAll();
142 
143 		sal_Bool			IsRefMode() {return bRefMode;}
144 		void			SetRefMode(sal_Bool bFlag) {bRefMode=bFlag;}
145 
146 		sal_uInt16	    	GetActiveLine();
147 		void			SetActiveLine(sal_uInt16 no);
148 		RefEdit*		GetActiveEdit();
149 		String			GetActiveArgName();
150 
151 		String			GetArgument(sal_uInt16 no);
152 		void			SetArgument(sal_uInt16 no, const String& aString);
153 		void			SetArgumentFonts(const Font&aBoldFont,const Font&aLightFont);
154 
155 		void			SetEdFocus(sal_uInt16 nEditLine); //Sichtbare Editzeilen
156 		sal_uInt16			GetSliderPos();
157 		void			SetSliderPos(sal_uInt16 nSliderPos);
158 
159 		void            SetScrollHdl( const Link& rLink ) { aScrollLink = rLink; }
160 		const Link&     GetScrollHdl() const { return aScrollLink; }
161 
162 		void            SetArgModifiedHdl( const Link& rLink ) { aArgModifiedLink = rLink; }
163 		const Link&     GetArgModifiedHdl() const { return aArgModifiedLink; }
164 
165 		void            SetFxHdl( const Link& rLink ) { aFxLink = rLink; }
166 		const Link&     GetFxHdl() const { return aFxLink; }
167 };
168 
169 
170 
171 } // formula
172 
173 #endif // FORMULA_PARAWIN_HXX
174 
175