xref: /aoo41x/main/formula/source/ui/dlg/parawin.hxx (revision 5116778e)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef FORMULA_PARAWIN_HXX
25 #define FORMULA_PARAWIN_HXX
26 
27 #include <svtools/stdctrl.hxx>
28 #include <svtools/svmedit.hxx>
29 #include <vcl/lstbox.hxx>
30 #include <vcl/group.hxx>
31 #include <vcl/tabpage.hxx>
32 #include <vcl/tabctrl.hxx>
33 #include <vcl/scrbar.hxx>
34 
35 #include <vector>
36 #include "formula/funcutl.hxx"
37 #include "ControlHelper.hxx"
38 #include "ModuleHelper.hxx"
39 
40 namespace formula
41 {
42 //============================================================================
43 #define	NOT_FOUND 0xffff
44 //============================================================================
45 class IFunctionDescription;
46 class IControlReferenceHandler;
47 
48 class ParaWin : public TabPage
49 {
50 private:
51         OModuleClient   m_aModuleClient;
52 		Link			aScrollLink;
53 		Link			aFxLink;
54 		Link			aArgModifiedLink;
55 
56         ::std::vector<sal_uInt16>   aVisibleArgMapping;
57 		const IFunctionDescription*	pFuncDesc;
58 		IControlReferenceHandler*	pMyParent;
59 		sal_uInt16			nArgs;      // unsuppressed arguments
60 		Font			aFntBold;
61 		Font			aFntLight;
62 
63 		FixedInfo		aFtEditDesc;
64 		FixedText		aFtArgName;
65 		FixedInfo		aFtArgDesc;
66 
67 		ImageButton		aBtnFx1;
68 		FixedText		aFtArg1;
69 		ArgEdit			aEdArg1;
70 		RefButton		aRefBtn1;
71 
72 		ImageButton		aBtnFx2;
73 		FixedText		aFtArg2;
74 		ArgEdit			aEdArg2;
75 		RefButton		aRefBtn2;
76 
77         ImageButton		aBtnFx3;
78 		FixedText		aFtArg3;
79 		ArgEdit			aEdArg3;
80 		RefButton		aRefBtn3;
81 
82         ImageButton		aBtnFx4;
83 		FixedText		aFtArg4;
84         ArgEdit			aEdArg4;
85 		RefButton		aRefBtn4;
86 
87         ScrollBar		aSlider;
88         String          m_sOptional;
89         String          m_sRequired;
90 		sal_Bool			bRefMode;
91 
92 		sal_uInt16			nEdFocus;
93 		sal_uInt16			nActiveLine;
94 
95 		ArgInput		aArgInput[4];
96 		String			aDefaultString;
97         ::std::vector<String>
98                         aParaArray;
99 
100 		DECL_LINK( ScrollHdl, ScrollBar* );
101 		DECL_LINK( ModifyHdl, ArgInput* );
102 		DECL_LINK( GetEdFocusHdl, ArgInput* );
103 		DECL_LINK( GetFxFocusHdl, ArgInput* );
104 		DECL_LINK( GetFxHdl, ArgInput* );
105 
106 protected:
107 
108 		virtual void	SliderMoved();
109 		virtual void	ArgumentModified();
110 		virtual void	FxClick();
111 
112 		void			InitArgInput( sal_uInt16 nPos, FixedText& rFtArg, ImageButton& rBtnFx,
113 										ArgEdit& rEdArg, RefButton& rRefBtn);
114 
115 		void			DelParaArray();
116 		void			SetArgumentDesc(const String& aText);
117 		void			SetArgumentText(const String& aText);
118 
119 
120 		void			SetArgName		(sal_uInt16 no,const String &aArg);
121 		void			SetArgNameFont	(sal_uInt16 no,const Font&);
122 		void			SetArgVal		(sal_uInt16 no,const String &aArg);
123 
124 		void			HideParaLine(sal_uInt16 no);
125 		void			ShowParaLine(sal_uInt16 no);
126 		void			UpdateArgDesc( sal_uInt16 nArg );
127 		void			UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i );
128 
129 public:
130 						ParaWin(Window* pParent,IControlReferenceHandler* _pDlg,Point aPos);
131 						~ParaWin();
132 
133 		void			SetFunctionDesc(const IFunctionDescription* pFDesc);
134 		void			SetArgumentOffset(sal_uInt16 nOffset);
135 		void	    	SetEditDesc(const String& aText);
136 		void			UpdateParas();
137 		void			ClearAll();
138 
IsRefMode()139 		sal_Bool			IsRefMode() {return bRefMode;}
SetRefMode(sal_Bool bFlag)140 		void			SetRefMode(sal_Bool bFlag) {bRefMode=bFlag;}
141 
142 		sal_uInt16	    	GetActiveLine();
143 		void			SetActiveLine(sal_uInt16 no);
144 		RefEdit*		GetActiveEdit();
145 		String			GetActiveArgName();
146 
147 		String			GetArgument(sal_uInt16 no);
148 		void			SetArgument(sal_uInt16 no, const String& aString);
149 		void			SetArgumentFonts(const Font&aBoldFont,const Font&aLightFont);
150 
151 		void			SetEdFocus(sal_uInt16 nEditLine); //Sichtbare Editzeilen
152 		sal_uInt16			GetSliderPos();
153 		void			SetSliderPos(sal_uInt16 nSliderPos);
154 
SetScrollHdl(const Link & rLink)155 		void            SetScrollHdl( const Link& rLink ) { aScrollLink = rLink; }
GetScrollHdl() const156 		const Link&     GetScrollHdl() const { return aScrollLink; }
157 
SetArgModifiedHdl(const Link & rLink)158 		void            SetArgModifiedHdl( const Link& rLink ) { aArgModifiedLink = rLink; }
GetArgModifiedHdl() const159 		const Link&     GetArgModifiedHdl() const { return aArgModifiedLink; }
160 
SetFxHdl(const Link & rLink)161 		void            SetFxHdl( const Link& rLink ) { aFxLink = rLink; }
GetFxHdl() const162 		const Link&     GetFxHdl() const { return aFxLink; }
163 };
164 
165 
166 
167 } // formula
168 
169 #endif // FORMULA_PARAWIN_HXX
170 
171