xref: /aoo41x/main/formula/source/ui/dlg/parawin.cxx (revision 1b1b70fb)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_formula.hxx"
26 
27 
28 
29 //----------------------------------------------------------------------------
30 
31 #include <svl/zforlist.hxx>
32 #include <svl/stritem.hxx>
33 
34 #include "parawin.hxx"
35 #include "parawin.hrc"
36 #include "helpids.hrc"
37 #include "formula/formdata.hxx"
38 #include "formula/IFunctionDescription.hxx"
39 #include "ModuleHelper.hxx"
40 #include "ForResId.hrc"
41 
42 #define VAR_ARGS 30
43 #define PAIRED_VAR_ARGS (VAR_ARGS + VAR_ARGS)
44 namespace formula
45 {
46 //============================================================================
47 
ParaWin(Window * pParent,IControlReferenceHandler * _pDlg,Point aPos)48 ParaWin::ParaWin(Window* pParent,IControlReferenceHandler* _pDlg,Point aPos):
49 	TabPage			(pParent,ModuleRes(RID_FORMULATAB_PARAMETER)),
50 	pFuncDesc		( NULL ),
51     pMyParent       (_pDlg),
52 	aFtEditDesc 	( this, ModuleRes( FT_EDITDESC ) ),
53 	aFtArgName		( this, ModuleRes( FT_PARNAME ) ),
54 	aFtArgDesc		( this, ModuleRes( FT_PARDESC ) ),
55 
56     aBtnFx1 		( this, ModuleRes( BTN_FX1 ) ),
57 	aFtArg1 		( this, ModuleRes( FT_ARG1 ) ),
58     aEdArg1 		( this, ModuleRes( ED_ARG1 ) ),
59 	aRefBtn1		( this, ModuleRes( RB_ARG1 ) ),
60 
61 	aBtnFx2 		( this, ModuleRes( BTN_FX2 ) ),
62     aFtArg2 		( this, ModuleRes( FT_ARG2 ) ),
63     aEdArg2 		( this, ModuleRes( ED_ARG2 ) ),
64     aRefBtn2		( this, ModuleRes( RB_ARG2 ) ),
65 
66 	aBtnFx3 		( this, ModuleRes( BTN_FX3 ) ),
67     aFtArg3 		( this, ModuleRes( FT_ARG3 ) ),
68     aEdArg3 		( this, ModuleRes( ED_ARG3 ) ),
69 	aRefBtn3		( this, ModuleRes( RB_ARG3 ) ),
70 
71     aBtnFx4 		( this, ModuleRes( BTN_FX4 ) ),
72     aFtArg4 		( this, ModuleRes( FT_ARG4 ) ),
73     aEdArg4 		( this, ModuleRes( ED_ARG4 ) ),
74 	aRefBtn4		( this, ModuleRes( RB_ARG4 ) ),
75 
76 	aSlider 		( this, ModuleRes( WND_SLIDER ) ),
77     m_sOptional     ( ModuleRes( STR_OPTIONAL ) ),
78     m_sRequired     ( ModuleRes( STR_REQUIRED ) ),
79 	bRefMode		(sal_False)
80 {
81     Image aFxHC( ModuleRes( IMG_FX_H ) );
82 	FreeResource();
83 	aDefaultString=aFtEditDesc.GetText();
84 
85 	SetPosPixel(aPos);
86 	nEdFocus=NOT_FOUND;
87 	nActiveLine=0;
88     Size aSize = aSlider.GetSizePixel();
89     aSize.Width() = GetSettings().GetStyleSettings().GetScrollBarSize();
90     aSlider.SetSizePixel( aSize );
91 	aSlider.SetEndScrollHdl( LINK( this, ParaWin, ScrollHdl ) );
92 	aSlider.SetScrollHdl( LINK( this, ParaWin, ScrollHdl ) );
93 
94     aBtnFx1.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
95     aBtnFx2.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
96     aBtnFx3.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
97     aBtnFx4.SetModeImage( aFxHC, BMP_COLOR_HIGHCONTRAST );
98 
99 	InitArgInput( 0, aFtArg1, aBtnFx1, aEdArg1, aRefBtn1);
100 	InitArgInput( 1, aFtArg2, aBtnFx2, aEdArg2, aRefBtn2);
101 	InitArgInput( 2, aFtArg3, aBtnFx3, aEdArg3, aRefBtn3);
102 	InitArgInput( 3, aFtArg4, aBtnFx4, aEdArg4, aRefBtn4);
103 	ClearAll();
104 }
105 
UpdateArgDesc(sal_uInt16 nArg)106 void ParaWin::UpdateArgDesc( sal_uInt16 nArg )
107 {
108 	if (nArg==NOT_FOUND) return;
109 
110 	if ( nArgs > 4 )
111         nArg = sal::static_int_cast<sal_uInt16>( nArg + GetSliderPos() );
112 		//@ nArg += (sal_uInt16)aSlider.GetThumbPos();
113 
114 	if ( (nArgs > 0) && (nArg<nArgs) )
115 	{
116 		String	aArgDesc;
117 		String	aArgName;
118 
119 		SetArgumentDesc( String() );
120 		SetArgumentText( String() );
121 
122 		if ( nArgs < VAR_ARGS )
123 		{
124             sal_uInt16 nRealArg = (aVisibleArgMapping.size() < nArg) ? aVisibleArgMapping[nArg] : nArg;
125 			aArgDesc  = pFuncDesc->getParameterDescription(nRealArg);
126 			aArgName  = pFuncDesc->getParameterName(nRealArg);
127             aArgName += ' ';
128 			aArgName += (pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
129 		}
130 		else if ( nArgs < PAIRED_VAR_ARGS )
131 		{
132 			sal_uInt16 nFix = nArgs - VAR_ARGS;
133 			sal_uInt16 nPos = ( nArg < nFix ? nArg : nFix );
134             sal_uInt16 nRealArg = (nPos < aVisibleArgMapping.size() ?
135                     aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
136 			aArgDesc  = pFuncDesc->getParameterDescription(nRealArg);
137 			aArgName  = pFuncDesc->getParameterName(nRealArg);
138 			if ( nArg >= nFix )
139 				aArgName += String::CreateFromInt32(nArg-nFix+1);
140             aArgName += ' ';
141 
142             aArgName += (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
143 		}
144 		else
145 		{
146 		    sal_uInt16 nFix = nArgs - PAIRED_VAR_ARGS;
147 			sal_uInt16 nPos;
148 			if ( nArg < nFix )
149 			    nPos = nArg;
150 			else
151 			    nPos = nFix + ( (nArg-nFix) % 2);
152             sal_uInt16 nRealArg = (nPos < aVisibleArgMapping.size() ?
153                     aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
154 			aArgDesc  = pFuncDesc->getParameterDescription(nRealArg);
155 			aArgName  = pFuncDesc->getParameterName(nRealArg);
156 			if ( nArg >= nFix )
157 				aArgName += String::CreateFromInt32((nArg-nFix)/2 + 1);
158             aArgName += ' ';
159 
160             aArgName += (nArg > (nFix+1) || pFuncDesc->isParameterOptional(nRealArg)) ? m_sOptional : m_sRequired ;
161 		}
162 
163 		SetArgumentDesc(aArgDesc);
164 		SetArgumentText(aArgName);
165 	}
166 }
167 
UpdateArgInput(sal_uInt16 nOffset,sal_uInt16 i)168 void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i )
169 {
170 	sal_uInt16 nArg = nOffset + i;
171 	if ( nArgs < VAR_ARGS)
172 	{
173 		if(nArg<nArgs)
174 		{
175             sal_uInt16 nRealArg = aVisibleArgMapping[nArg];
176 			SetArgNameFont	(i,(pFuncDesc->isParameterOptional(nRealArg))
177 											? aFntLight : aFntBold );
178 			SetArgName		(i,pFuncDesc->getParameterName(nRealArg));
179 		}
180 	}
181 	else if ( nArgs < PAIRED_VAR_ARGS)
182 	{
183 		sal_uInt16 nFix = nArgs - VAR_ARGS;
184 		sal_uInt16 nPos = ( nArg < nFix ? nArg : nFix );
185         sal_uInt16 nRealArg = (nPos < aVisibleArgMapping.size() ?
186                 aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
187 		SetArgNameFont( i,
188                 (nArg > nFix || pFuncDesc->isParameterOptional(nRealArg)) ?
189                 aFntLight : aFntBold );
190 		if ( nArg >= nFix )
191 		{
192 			String aArgName( pFuncDesc->getParameterName(nRealArg) );
193 			aArgName += String::CreateFromInt32(nArg-nFix+1);
194 			SetArgName( i, aArgName );
195 		}
196 		else
197 			SetArgName( i, pFuncDesc->getParameterName(nRealArg) );
198 	}
199 	else
200 	{
201 	    sal_uInt16 nFix = nArgs - PAIRED_VAR_ARGS;
202 	    sal_uInt16 nPos;
203 			if ( nArg < nFix )
204 			    nPos = nArg;
205 			else
206 			    nPos = nFix + ( (nArg-nFix) % 2);
207         sal_uInt16 nRealArg = (nPos < aVisibleArgMapping.size() ?
208                 aVisibleArgMapping[nPos] : aVisibleArgMapping.back());
209 		SetArgNameFont( i,
210                 (nArg > (nFix+1) || pFuncDesc->isParameterOptional(nRealArg)) ?
211                 aFntLight : aFntBold );
212 		if ( nArg >= nFix )
213 		{
214 			String aArgName( pFuncDesc->getParameterName(nRealArg) );
215 			aArgName += String::CreateFromInt32((nArg-nFix)/2 + 1);
216 			SetArgName( i, aArgName );
217 		}
218 		else
219 			SetArgName( i, pFuncDesc->getParameterName(nRealArg) );
220 	}
221 	if(nArg<nArgs) SetArgVal(i,aParaArray[nArg]);
222 	//@ aArgInput[i].SetArgVal( *(pArgArr[nOffset+i]) );
223 
224 }
225 
~ParaWin()226 ParaWin::~ParaWin()
227 {
228     // #i66422# if the focus changes during destruction of the controls,
229     // don't call the focus handlers
230     Link aEmptyLink;
231     aBtnFx1.SetGetFocusHdl( aEmptyLink );
232     aBtnFx2.SetGetFocusHdl( aEmptyLink );
233     aBtnFx3.SetGetFocusHdl( aEmptyLink );
234     aBtnFx4.SetGetFocusHdl( aEmptyLink );
235 }
236 
GetActiveLine()237 sal_uInt16 ParaWin::GetActiveLine()
238 {
239 	return nActiveLine;
240 }
241 
SetActiveLine(sal_uInt16 no)242 void ParaWin::SetActiveLine(sal_uInt16 no)
243 {
244 	if(no<nArgs)
245 	{
246 		long nOffset = GetSliderPos();
247 		nActiveLine=no;
248 		long nNewEdPos=(long)nActiveLine-nOffset;
249 		if(nNewEdPos<0 || nNewEdPos>3)
250 		{
251 			nOffset+=nNewEdPos;
252 			SetSliderPos((sal_uInt16) nOffset);
253 			nOffset=GetSliderPos();
254 		}
255 		nEdFocus=no-(sal_uInt16)nOffset;
256 		UpdateArgDesc( nEdFocus );
257 	}
258 }
259 
GetActiveEdit()260 RefEdit* ParaWin::GetActiveEdit()
261 {
262 	if(nArgs>0 && nEdFocus!=NOT_FOUND)
263 	{
264 		return aArgInput[nEdFocus].GetArgEdPtr();
265 	}
266 	else
267 	{
268 		return NULL;
269 	}
270 }
271 
272 
GetArgument(sal_uInt16 no)273 String ParaWin::GetArgument(sal_uInt16 no)
274 {
275 	String aStr;
276 	if(no<aParaArray.size())
277 	{
278 		aStr=aParaArray[no];
279 		if(no==nActiveLine && aStr.Len()==0)
280 			aStr+=' ';
281 	}
282 	return aStr;
283 }
284 
GetActiveArgName()285 String	ParaWin::GetActiveArgName()
286 {
287 	String aStr;
288 	if(nArgs>0 && nEdFocus!=NOT_FOUND)
289 	{
290 		aStr=aArgInput[nEdFocus].GetArgName();
291 	}
292 	return aStr;
293 }
294 
295 
SetArgument(sal_uInt16 no,const String & aString)296 void ParaWin::SetArgument(sal_uInt16 no, const String& aString)
297 {
298 	if(no<aParaArray.size())
299 	{
300 		aParaArray[no] = aString;
301 		aParaArray[no].EraseLeadingChars();
302 	}
303 }
304 
DelParaArray()305 void ParaWin::DelParaArray()
306 {
307     ::std::vector<String>().swap(aParaArray);
308 }
309 
SetArgumentFonts(const Font & aBoldFont,const Font & aLightFont)310 void ParaWin::SetArgumentFonts(const Font&aBoldFont,const Font&aLightFont)
311 {
312 	aFntBold=aBoldFont;
313 	aFntLight=aLightFont;
314 }
315 
SetFunctionDesc(const IFunctionDescription * pFDesc)316 void ParaWin::SetFunctionDesc(const IFunctionDescription* pFDesc)
317 {
318 	pFuncDesc=pFDesc;
319 
320 	SetArgumentDesc( String() );
321 	SetArgumentText( String() );
322 	SetEditDesc( String() );
323 	nArgs = 0;
324 	if ( pFuncDesc!=NULL)
325 	{
326 		if ( pFuncDesc->getDescription().getLength() )
327 		{
328 			SetEditDesc(pFuncDesc->getDescription());
329 		}
330 		else
331 		{
332 			SetEditDesc(aDefaultString);
333 		}
334 		nArgs = pFuncDesc->getSuppressedArgumentCount();
335         pFuncDesc->fillVisibleArgumentMapping(aVisibleArgMapping);
336 		aSlider.Hide();
337 		rtl::OString sHelpId = pFuncDesc->getHelpId();
338 		SetHelpId( sHelpId );
339 		aEdArg1.SetHelpId( sHelpId );
340 		aEdArg2.SetHelpId( sHelpId );
341 		aEdArg3.SetHelpId( sHelpId );
342 		aEdArg4.SetHelpId( sHelpId );
343 
344 		//	Unique-IDs muessen gleich bleiben fuer Automatisierung
345 		SetUniqueId( HID_FORMULA_FAP_PAGE );
346 		aEdArg1.SetUniqueId( HID_FORMULA_FAP_EDIT1 );
347 		aEdArg2.SetUniqueId( HID_FORMULA_FAP_EDIT2 );
348 		aEdArg3.SetUniqueId( HID_FORMULA_FAP_EDIT3 );
349 		aEdArg4.SetUniqueId( HID_FORMULA_FAP_EDIT4 );
350 		SetActiveLine(0);
351 	}
352 	else
353 	{
354 		nActiveLine=0;
355 	}
356 
357 }
358 
SetArgumentText(const String & aText)359 void ParaWin::SetArgumentText(const String& aText)
360 {
361 	aFtArgName.SetText(aText);
362 }
363 
SetArgumentDesc(const String & aText)364 void ParaWin::SetArgumentDesc(const String& aText)
365 {
366 	aFtArgDesc.SetText(aText);
367 }
368 
SetEditDesc(const String & aText)369 void ParaWin::SetEditDesc(const String& aText)
370 {
371 	aFtEditDesc.SetText(aText);
372 }
373 
SetArgName(sal_uInt16 no,const String & aText)374 void ParaWin::SetArgName(sal_uInt16 no,const String& aText)
375 {
376 	aArgInput[no].SetArgName(aText);
377 	aArgInput[no].UpdateAccessibleNames();
378 }
379 
SetArgNameFont(sal_uInt16 no,const Font & aFont)380 void ParaWin::SetArgNameFont(sal_uInt16 no,const Font& aFont)
381 {
382 	aArgInput[no].SetArgNameFont(aFont);
383 }
384 
SetArgVal(sal_uInt16 no,const String & aText)385 void ParaWin::SetArgVal(sal_uInt16 no,const String& aText)
386 {
387 	aArgInput[no].SetArgVal(aText);
388 }
389 
HideParaLine(sal_uInt16 no)390 void ParaWin::HideParaLine(sal_uInt16 no)
391 {
392 	aArgInput[no].Hide();
393 }
394 
ShowParaLine(sal_uInt16 no)395 void ParaWin::ShowParaLine(sal_uInt16 no)
396 {
397 	aArgInput[no].Show();
398 }
399 
SetEdFocus(sal_uInt16 no)400 void ParaWin::SetEdFocus(sal_uInt16 no)
401 {
402 	UpdateArgDesc(no);
403 	if(no<4 && no<aParaArray.size())
404 		aArgInput[no].GetArgEdPtr()->GrabFocus();
405 }
406 
407 
InitArgInput(sal_uInt16 nPos,FixedText & rFtArg,ImageButton & rBtnFx,ArgEdit & rEdArg,RefButton & rRefBtn)408 void ParaWin::InitArgInput( sal_uInt16 nPos, FixedText& rFtArg, ImageButton& rBtnFx,
409 						ArgEdit& rEdArg, RefButton& rRefBtn)
410 {
411 
412 	rRefBtn.SetReferences(pMyParent,&rEdArg);
413 	rEdArg.SetRefDialog(pMyParent);
414 
415 	aArgInput[nPos].InitArgInput (&rFtArg,&rBtnFx,&rEdArg,&rRefBtn);
416 
417 	aArgInput[nPos].Hide();
418 
419 	aArgInput[nPos].SetFxClickHdl	( LINK( this, ParaWin, GetFxHdl ) );
420 	aArgInput[nPos].SetFxFocusHdl	( LINK( this, ParaWin, GetFxFocusHdl ) );
421 	aArgInput[nPos].SetEdFocusHdl	( LINK( this, ParaWin, GetEdFocusHdl ) );
422 	aArgInput[nPos].SetEdModifyHdl	( LINK( this, ParaWin, ModifyHdl ) );
423 	aArgInput[nPos].UpdateAccessibleNames();
424 }
425 
ClearAll()426 void ParaWin::ClearAll()
427 {
428 	SetFunctionDesc(NULL);
429 	SetArgumentOffset(0);
430 }
431 
SetArgumentOffset(sal_uInt16 nOffset)432 void ParaWin::SetArgumentOffset(sal_uInt16 nOffset)
433 {
434 	DelParaArray();
435 	aSlider.SetThumbPos(0);
436 
437     aParaArray.resize(nArgs);
438 
439 	if ( nArgs > 0 )
440 	{
441 		for ( int i=0; i<4 && i<nArgs; i++ )
442 		{
443 			String aString;
444 			aArgInput[i].SetArgVal(aString);
445 			aArgInput[i].GetArgEdPtr()->Init(
446 				(i==0)			  	 ? (ArgEdit *)NULL : aArgInput[i-1].GetArgEdPtr(),
447 				(i==3 || i==nArgs-1) ? (ArgEdit *)NULL : aArgInput[i+1].GetArgEdPtr(),
448 									   aSlider, nArgs );
449 		}
450 	}
451 
452 	if ( nArgs < 5 )
453 	{
454 		aSlider.Hide();
455 	}
456 	else
457 	{
458 		//aSlider.SetEndScrollHdl( LINK( this, ScFormulaDlg, ScrollHdl ) );
459 		aSlider.SetPageSize( 4 );
460 		aSlider.SetVisibleSize( 4 );
461 		aSlider.SetLineSize( 1 );
462 		aSlider.SetRange( Range( 0, nArgs ) );
463 		aSlider.SetThumbPos( nOffset );
464 		aSlider.Show();
465 	}
466 
467 	UpdateParas();
468 }
469 
UpdateParas()470 void ParaWin::UpdateParas()
471 {
472 	sal_uInt16 i;
473 	sal_uInt16 nOffset = GetSliderPos();
474 
475 	if ( nArgs > 0 )
476 	{
477 		for ( i=0; (i<nArgs) && (i<4); i++ )
478 		{
479 			UpdateArgInput( nOffset, i );
480 			ShowParaLine(i);
481 		}
482 	}
483 
484 	for ( i=nArgs; i<4; i++ ) HideParaLine(i);
485 }
486 
487 
GetSliderPos()488 sal_uInt16 ParaWin::GetSliderPos()
489 {
490 	return (sal_uInt16) aSlider.GetThumbPos();
491 }
492 
SetSliderPos(sal_uInt16 nSliderPos)493 void ParaWin::SetSliderPos(sal_uInt16 nSliderPos)
494 {
495 	sal_uInt16 nOffset = GetSliderPos();
496 
497 	if(aSlider.IsVisible() && nOffset!=nSliderPos)
498 	{
499 		aSlider.SetThumbPos(nSliderPos);
500         for ( sal_uInt16 i=0; i<4; i++ )
501 		{
502 			UpdateArgInput( nSliderPos, i );
503 		}
504 	}
505 }
506 
SliderMoved()507 void ParaWin::SliderMoved()
508 {
509 	sal_uInt16 nOffset = GetSliderPos();
510 
511     for ( sal_uInt16 i=0; i<4; i++ )
512 	{
513 		UpdateArgInput( nOffset, i );
514 	}
515 	if(nEdFocus!=NOT_FOUND)
516 	{
517 		UpdateArgDesc( nEdFocus );
518 		aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
519 		nActiveLine=nEdFocus+nOffset;
520 		ArgumentModified();
521 		aArgInput[nEdFocus].UpdateAccessibleNames();
522 	}
523 	aScrollLink.Call(this);
524 }
525 
ArgumentModified()526 void ParaWin::ArgumentModified()
527 {
528 	aArgModifiedLink.Call(this);
529 }
530 
FxClick()531 void ParaWin::FxClick()
532 {
533 	aFxLink.Call(this);
534 }
535 
536 
IMPL_LINK(ParaWin,GetFxHdl,ArgInput *,pPtr)537 IMPL_LINK( ParaWin, GetFxHdl, ArgInput*, pPtr )
538 {
539 	sal_uInt16 nOffset = GetSliderPos();
540 	nEdFocus=NOT_FOUND;
541 	for ( sal_uInt16 nPos=0; nPos<5;nPos++)
542 	{
543 		if(pPtr == &aArgInput[nPos])
544 		{
545 			nEdFocus=nPos;
546 			break;
547 		}
548 	}
549 
550 	if(nEdFocus!=NOT_FOUND)
551 	{
552 		aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
553 		nActiveLine=nEdFocus+nOffset;
554 		FxClick();
555 	}
556 	return 0;
557 }
558 
IMPL_LINK(ParaWin,GetFxFocusHdl,ArgInput *,pPtr)559 IMPL_LINK( ParaWin, GetFxFocusHdl, ArgInput*, pPtr )
560 {
561 	sal_uInt16 nOffset = GetSliderPos();
562 	nEdFocus=NOT_FOUND;
563 	for ( sal_uInt16 nPos=0; nPos<5;nPos++)
564 	{
565 		if(pPtr == &aArgInput[nPos])
566 		{
567 			nEdFocus=nPos;
568 			break;
569 		}
570 	}
571 
572 	if(nEdFocus!=NOT_FOUND)
573 	{
574 		aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
575 		UpdateArgDesc( nEdFocus );
576 		nActiveLine=nEdFocus+nOffset;
577 	}
578 	return 0;
579 }
580 
581 
582 
IMPL_LINK(ParaWin,GetEdFocusHdl,ArgInput *,pPtr)583 IMPL_LINK( ParaWin, GetEdFocusHdl, ArgInput*, pPtr )
584 {
585 	sal_uInt16 nOffset = GetSliderPos();
586 	nEdFocus=NOT_FOUND;
587 	for ( sal_uInt16 nPos=0; nPos<5;nPos++)
588 	{
589 		if(pPtr == &aArgInput[nPos])
590 		{
591 			nEdFocus=nPos;
592 			break;
593 		}
594 	}
595 
596 	if(nEdFocus!=NOT_FOUND)
597 	{
598 		aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
599 		UpdateArgDesc( nEdFocus );
600 		nActiveLine=nEdFocus+nOffset;
601 		ArgumentModified();
602 		aArgInput[nEdFocus].UpdateAccessibleNames();
603 	}
604 
605 	return 0;
606 }
607 
608 
IMPL_LINK(ParaWin,ScrollHdl,ScrollBar *,EMPTYARG)609 IMPL_LINK( ParaWin, ScrollHdl, ScrollBar*, EMPTYARG )
610 {
611 	SliderMoved();
612 
613 	return 0;
614 }
615 
IMPL_LINK(ParaWin,ModifyHdl,ArgInput *,pPtr)616 IMPL_LINK( ParaWin, ModifyHdl, ArgInput*, pPtr )
617 {
618 	sal_uInt16 nOffset = GetSliderPos();
619 	nEdFocus=NOT_FOUND;
620 	for ( sal_uInt16 nPos=0; nPos<5;nPos++)
621 	{
622 		if(pPtr == &aArgInput[nPos])
623 		{
624 			nEdFocus=nPos;
625 			break;
626 		}
627 	}
628 	if(nEdFocus!=NOT_FOUND)
629 	{
630 		aParaArray[nEdFocus+nOffset] = aArgInput[nEdFocus].GetArgVal();
631 		UpdateArgDesc( nEdFocus);
632 		nActiveLine=nEdFocus+nOffset;
633 	}
634 
635 	ArgumentModified();
636 	return 0;
637 }
638 
639 
640 
641 } // formula
642