xref: /aoo42x/main/sc/source/ui/dbgui/pfiltdlg.cxx (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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 
31 #undef SC_DLLIMPLEMENTATION
32 
33 
34 
35 #ifndef PCH
36 #include <vcl/waitobj.hxx>
37 #endif
38 
39 // INCLUDE ---------------------------------------------------------------
40 
41 #include "viewdata.hxx"
42 #include "document.hxx"
43 #include "uiitems.hxx"
44 #include "global.hxx"
45 #include "dbcolect.hxx"
46 #include "scresid.hxx"
47 
48 #include "sc.hrc"
49 #include "filter.hrc"
50 #include "globstr.hrc"
51 
52 #define _PFILTDLG_CXX
53 #include "pfiltdlg.hxx"
54 #undef _PFILTDLG_CXX
55 #include <svl/zforlist.hxx>
56 
57 //==================================================================
58 
59 ScPivotFilterDlg::ScPivotFilterDlg( Window*				pParent,
60 									const SfxItemSet&	rArgSet,
61 									SCTAB 				nSourceTab )
62 
63 	:	ModalDialog	( pParent, ScResId( RID_SCDLG_PIVOTFILTER ) ),
64 		//
65         aFlCriteria     ( this, ScResId( FL_CRITERIA ) ),
66 		aLbField1		( this, ScResId( LB_FIELD1 ) ),
67 		aLbCond1		( this, ScResId( LB_COND1 ) ),
68 		aEdVal1			( this, ScResId( ED_VAL1 ) ),
69 		aLbConnect1		( this, ScResId( LB_OP1 ) ),
70 		aLbField2		( this, ScResId( LB_FIELD2 ) ),
71 		aLbCond2		( this, ScResId( LB_COND2 ) ),
72 		aEdVal2			( this, ScResId( ED_VAL2 ) ),
73 		aLbConnect2		( this, ScResId( LB_OP2 ) ),
74 		aLbField3		( this, ScResId( LB_FIELD3 ) ),
75 		aLbCond3		( this, ScResId( LB_COND3 ) ),
76 		aEdVal3			( this, ScResId( ED_VAL3 ) ),
77 		aFtConnect		( this, ScResId( FT_OP ) ),
78 		aFtField		( this, ScResId( FT_FIELD ) ),
79 		aFtCond			( this, ScResId( FT_COND ) ),
80 		aFtVal			( this, ScResId( FT_VAL ) ),
81         aFlOptions      ( this, ScResId( FL_OPTIONS ) ),
82 		aBtnCase		( this, ScResId( BTN_CASE ) ),
83 		aBtnRegExp		( this, ScResId( BTN_REGEXP ) ),
84 		aBtnUnique		( this, ScResId( BTN_UNIQUE ) ),
85 		aFtDbAreaLabel	( this, ScResId( FT_DBAREA_LABEL ) ),
86 		aFtDbArea		( this, ScResId( FT_DBAREA ) ),
87 		aBtnOk			( this, ScResId( BTN_OK ) ),
88 		aBtnCancel		( this, ScResId( BTN_CANCEL ) ),
89 		aBtnHelp		( this, ScResId( BTN_HELP ) ),
90 		aBtnMore		( this, ScResId( BTN_MORE ) ),
91 		aStrUndefined	( ScResId( SCSTR_UNDEFINED ) ),
92 		aStrNoName		( ScGlobal::GetRscString(STR_DB_NONAME) ),
93 		aStrNone		( ScResId( SCSTR_NONE ) ),
94 		aStrEmpty		( ScResId( SCSTR_EMPTY ) ),
95 		aStrNotEmpty	( ScResId( SCSTR_NOTEMPTY ) ),
96 		aStrRow			( ScResId( SCSTR_ROW ) ),
97 		aStrColumn		( ScResId( SCSTR_COLUMN ) ),
98 		//
99 		nWhichQuery		( rArgSet.GetPool()->GetWhich( SID_QUERY ) ),
100 		theQueryData	( ((const ScQueryItem&)
101 						   rArgSet.Get( nWhichQuery )).GetQueryData() ),
102 		pOutItem		( NULL ),
103 		pViewData		( NULL ),
104 		pDoc			( NULL ),
105 		nSrcTab			( nSourceTab ),		// ist nicht im QueryParam
106 		nFieldCount		( 0 )
107 {
108 	for (sal_uInt16 i=0; i<=MAXCOL; i++)
109 		pEntryLists[i] = NULL;
110 
111 	Init( rArgSet );
112 	FreeResource();
113 }
114 
115 //------------------------------------------------------------------------
116 
117 __EXPORT ScPivotFilterDlg::~ScPivotFilterDlg()
118 {
119 	for (sal_uInt16 i=0; i<=MAXCOL; i++)
120 		delete pEntryLists[i];
121 
122 	if ( pOutItem )
123 		delete pOutItem;
124 }
125 
126 //------------------------------------------------------------------------
127 
128 void __EXPORT ScPivotFilterDlg::Init( const SfxItemSet& rArgSet )
129 {
130 	const ScQueryItem& rQueryItem = (const ScQueryItem&)
131 									rArgSet.Get( nWhichQuery );
132 
133 	aBtnCase.SetClickHdl	( LINK( this, ScPivotFilterDlg, CheckBoxHdl ) );
134 
135 	aLbField1.SetSelectHdl	( LINK( this, ScPivotFilterDlg, LbSelectHdl ) );
136 	aLbField2.SetSelectHdl	( LINK( this, ScPivotFilterDlg, LbSelectHdl ) );
137 	aLbField3.SetSelectHdl	( LINK( this, ScPivotFilterDlg, LbSelectHdl ) );
138 	aLbConnect1.SetSelectHdl( LINK( this, ScPivotFilterDlg, LbSelectHdl ) );
139 	aLbConnect2.SetSelectHdl( LINK( this, ScPivotFilterDlg, LbSelectHdl ) );
140 
141 	aBtnMore.AddWindow( &aBtnCase );
142 	aBtnMore.AddWindow( &aBtnRegExp );
143 	aBtnMore.AddWindow( &aBtnUnique );
144 	aBtnMore.AddWindow( &aFtDbAreaLabel );
145 	aBtnMore.AddWindow( &aFtDbArea );
146     aBtnMore.AddWindow( &aFlOptions );
147 
148 	aBtnCase	.Check( theQueryData.bCaseSens );
149 	aBtnRegExp	.Check( theQueryData.bRegExp );
150 	aBtnUnique	.Check( !theQueryData.bDuplicate );
151 
152 	pViewData 	= rQueryItem.GetViewData();
153 	pDoc	  	= pViewData ? pViewData->GetDocument() : NULL;
154 
155 	// fuer leichteren Zugriff:
156 	aFieldLbArr	 [0] = &aLbField1;
157 	aFieldLbArr	 [1] = &aLbField2;
158 	aFieldLbArr	 [2] = &aLbField3;
159 	aValueEdArr	 [0] = &aEdVal1;
160 	aValueEdArr	 [1] = &aEdVal2;
161 	aValueEdArr	 [2] = &aEdVal3;
162 	aCondLbArr	 [0] = &aLbCond1;
163 	aCondLbArr	 [1] = &aLbCond2;
164 	aCondLbArr 	 [2] = &aLbCond3;
165 
166 	if ( pViewData && pDoc )
167 	{
168 		String			theAreaStr;
169 		ScRange			theCurArea ( ScAddress( theQueryData.nCol1,
170 												theQueryData.nRow1,
171 												nSrcTab ),
172 									 ScAddress( theQueryData.nCol2,
173 												theQueryData.nRow2,
174 												nSrcTab ) );
175 		ScDBCollection*	pDBColl		= pDoc->GetDBCollection();
176 		String			theDbArea;
177 		String			theDbName	= aStrNoName;
178 
179 		/*
180 		 * Ueberpruefen, ob es sich bei dem uebergebenen
181 		 * Bereich um einen Datenbankbereich handelt:
182 		 */
183 
184 		theCurArea.Format( theAreaStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() );
185 
186 		if ( pDBColl )
187 		{
188 			ScAddress&	rStart	= theCurArea.aStart;
189 			ScAddress&	rEnd	= theCurArea.aEnd;
190 			ScDBData*	pDBData = pDBColl->GetDBAtArea(	rStart.Tab(),
191 														rStart.Col(), rStart.Row(),
192 														rEnd.Col(),   rEnd.Row() );
193 			if ( pDBData )
194 				pDBData->GetName( theDbName );
195 		}
196 
197 		theDbArea.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" ("));
198 		theDbArea += theDbName;
199 		theDbArea += ')';
200 		aFtDbArea.SetText( theDbArea );
201 	}
202 	else
203 	{
204 		aFtDbArea.SetText( EMPTY_STRING );
205 	}
206 
207 	// Feldlisten einlesen und Eintraege selektieren:
208 
209 	FillFieldLists();
210 
211 	for ( SCSIZE i=0; i<3; i++ )
212 	{
213 		if ( theQueryData.GetEntry(i).bDoQuery )
214 		{
215 			ScQueryEntry& rEntry = theQueryData.GetEntry(i);
216 
217             String	aValStr		 = *rEntry.pStr;
218             if (!rEntry.bQueryByString && aValStr == EMPTY_STRING)
219             {
220                 if (rEntry.nVal == SC_EMPTYFIELDS)
221                     aValStr = aStrEmpty;
222                 else if (rEntry.nVal == SC_NONEMPTYFIELDS)
223                     aValStr = aStrNotEmpty;
224             }
225 			sal_uInt16	nCondPos	 = (sal_uInt16)rEntry.eOp;
226 			sal_uInt16	nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) );
227 
228 			aFieldLbArr[i]->SelectEntryPos( nFieldSelPos );
229 			aCondLbArr [i]->SelectEntryPos( nCondPos );
230 			UpdateValueList( static_cast<sal_uInt16>(i+1) );
231 			aValueEdArr[i]->SetText( aValStr );
232             if (aValStr == aStrEmpty || aValStr == aStrNotEmpty)
233                 aCondLbArr[i]->Disable();
234 		}
235 		else
236 		{
237 			aFieldLbArr[i]->SelectEntryPos( 0 ); // "keiner" selektieren
238 			aCondLbArr [i]->SelectEntryPos( 0 ); // "=" selektieren
239 			UpdateValueList( static_cast<sal_uInt16>(i) );
240 			aValueEdArr[i]->SetText( EMPTY_STRING );
241 		}
242 		aValueEdArr[i]->SetModifyHdl( LINK( this, ScPivotFilterDlg, ValModifyHdl ) );
243 	}
244 
245 	// Disable/Enable Logik:
246 
247 	   (aLbField1.GetSelectEntryPos() != 0)
248 	&& (aLbField2.GetSelectEntryPos() != 0)
249 		? aLbConnect1.SelectEntryPos( (sal_uInt16)theQueryData.GetEntry(1).eConnect )
250 		: aLbConnect1.SetNoSelection();
251 
252 	   (aLbField2.GetSelectEntryPos() != 0)
253 	&& (aLbField3.GetSelectEntryPos() != 0)
254 		? aLbConnect2.SelectEntryPos( (sal_uInt16)theQueryData.GetEntry(2).eConnect )
255 		: aLbConnect2.SetNoSelection();
256 
257 	if ( aLbField1.GetSelectEntryPos() == 0 )
258 	{
259 		aLbConnect1.Disable();
260 		aLbField2.Disable();
261 		aLbCond2.Disable();
262 		aEdVal2.Disable();
263 	}
264 	else if ( aLbConnect1.GetSelectEntryCount() == 0 )
265 	{
266 		aLbField2.Disable();
267 		aLbCond2.Disable();
268 		aEdVal2.Disable();
269 	}
270 
271 	if ( aLbField2.GetSelectEntryPos() == 0 )
272 	{
273 		aLbConnect2.Disable();
274 		aLbField3.Disable();
275 		aLbCond3.Disable();
276 		aEdVal3.Disable();
277 	}
278 	else if ( aLbConnect2.GetSelectEntryCount() == 0 )
279 	{
280 		aLbField3.Disable();
281 		aLbCond3.Disable();
282 		aEdVal3.Disable();
283 	}
284 }
285 
286 //------------------------------------------------------------------------
287 
288 void ScPivotFilterDlg::FillFieldLists()
289 {
290 	aLbField1.Clear();
291 	aLbField2.Clear();
292 	aLbField3.Clear();
293 	aLbField1.InsertEntry( aStrNone, 0 );
294 	aLbField2.InsertEntry( aStrNone, 0 );
295 	aLbField3.InsertEntry( aStrNone, 0 );
296 
297 	if ( pDoc )
298 	{
299 		String	aFieldName;
300 		SCTAB	nTab		= nSrcTab;
301 		SCCOL	nFirstCol	= theQueryData.nCol1;
302 		SCROW	nFirstRow	= theQueryData.nRow1;
303 		SCCOL	nMaxCol		= theQueryData.nCol2;
304 		SCCOL	col = 0;
305 		sal_uInt16	i=1;
306 
307 		for ( col=nFirstCol; col<=nMaxCol; col++ )
308 		{
309 			pDoc->GetString( col, nFirstRow, nTab, aFieldName );
310 			if ( aFieldName.Len() == 0 )
311 			{
312 				aFieldName  = aStrColumn;
313 				aFieldName += ' ';
314                 aFieldName += ScColToAlpha( col );
315 			}
316 			aLbField1.InsertEntry( aFieldName, i );
317 			aLbField2.InsertEntry( aFieldName, i );
318 			aLbField3.InsertEntry( aFieldName, i );
319 			i++;
320 		}
321 		nFieldCount = i;
322 	}
323 }
324 
325 //------------------------------------------------------------------------
326 
327 void ScPivotFilterDlg::UpdateValueList( sal_uInt16 nList )
328 {
329 	if ( pDoc && nList>0 && nList<=3 )
330 	{
331 		ComboBox*	pValList		= aValueEdArr[nList-1];
332 		sal_uInt16		nFieldSelPos	= aFieldLbArr[nList-1]->GetSelectEntryPos();
333 		sal_uInt16		nListPos		= 0;
334 		String		aCurValue  		= pValList->GetText();
335 
336 		pValList->Clear();
337 		pValList->InsertEntry( aStrNotEmpty, 0 );
338 		pValList->InsertEntry( aStrEmpty, 1 );
339 		nListPos = 2;
340 
341 		if ( pDoc && nFieldSelPos )
342 		{
343 			SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1;
344 			if (!pEntryLists[nColumn])
345 			{
346 				WaitObject aWaiter( this );
347 
348 				SCTAB	nTab		= nSrcTab;
349 				SCROW	nFirstRow	= theQueryData.nRow1;
350 				SCROW	nLastRow	= theQueryData.nRow2;
351 				nFirstRow++;
352                 bool bHasDates = false;
353 
354 				pEntryLists[nColumn] = new TypedScStrCollection( 128, 128 );
355 				pEntryLists[nColumn]->SetCaseSensitive( aBtnCase.IsChecked() );
356 				pDoc->GetFilterEntriesArea( nColumn, nFirstRow, nLastRow,
357                                             nTab, *pEntryLists[nColumn], bHasDates );
358 			}
359 
360 			TypedScStrCollection* pColl = pEntryLists[nColumn];
361 			sal_uInt16 nValueCount = pColl->GetCount();
362 			if ( nValueCount > 0 )
363 			{
364 				for ( sal_uInt16 i=0; i<nValueCount; i++ )
365 				{
366 					pValList->InsertEntry( (*pColl)[i]->GetString(), nListPos );
367 					nListPos++;
368 				}
369 			}
370 		}
371 		pValList->SetText( aCurValue );
372 	}
373 }
374 
375 //------------------------------------------------------------------------
376 
377 void ScPivotFilterDlg::ClearValueList( sal_uInt16 nList )
378 {
379 	if ( nList>0 && nList<=3 )
380 	{
381 		ComboBox* pValList = aValueEdArr[nList-1];
382 		pValList->Clear();
383 		pValList->InsertEntry( aStrNotEmpty, 0 );
384 		pValList->InsertEntry( aStrEmpty, 1 );
385 		pValList->SetText( EMPTY_STRING );
386 	}
387 }
388 
389 //------------------------------------------------------------------------
390 
391 sal_uInt16 ScPivotFilterDlg::GetFieldSelPos( SCCOL nField )
392 {
393 	if ( nField >= theQueryData.nCol1 && nField <= theQueryData.nCol2 )
394 		return static_cast<sal_uInt16>(nField - theQueryData.nCol1 + 1);
395 	else
396 		return 0;
397 }
398 
399 //------------------------------------------------------------------------
400 
401 const ScQueryItem& ScPivotFilterDlg::GetOutputItem()
402 {
403 	ScQueryParam 	theParam( theQueryData );
404 	sal_uInt16			nConnect1 = aLbConnect1.GetSelectEntryPos();
405 	sal_uInt16 			nConnect2 = aLbConnect2.GetSelectEntryPos();
406 
407 	for ( SCSIZE i=0; i<3; i++ )
408 	{
409 		sal_uInt16 		nField	= aFieldLbArr[i]->GetSelectEntryPos();
410 		ScQueryOp	eOp		= (ScQueryOp)aCondLbArr[i]->GetSelectEntryPos();
411 
412 		sal_Bool bDoThis = (aFieldLbArr[i]->GetSelectEntryPos() != 0);
413 		theParam.GetEntry(i).bDoQuery = bDoThis;
414 
415 		if ( bDoThis )
416 		{
417 			ScQueryEntry& rEntry = theParam.GetEntry(i);
418 
419 			String aStrVal( aValueEdArr[i]->GetText() );
420 
421 			/*
422 			 * Dialog liefert die ausgezeichneten Feldwerte "leer"/"nicht leer"
423 			 * als Konstanten in nVal in Verbindung mit dem Schalter
424 			 * bQueryByString auf FALSE.
425 			 */
426 			if ( aStrVal == aStrEmpty )
427 			{
428 				*rEntry.pStr	= EMPTY_STRING;
429 				rEntry.nVal 	= SC_EMPTYFIELDS;
430 				rEntry.bQueryByString = sal_False;
431 			}
432 			else if ( aStrVal == aStrNotEmpty )
433 			{
434 				*rEntry.pStr	= EMPTY_STRING;
435 				rEntry.nVal		= SC_NONEMPTYFIELDS;
436 				rEntry.bQueryByString = sal_False;
437 			}
438 			else
439 			{
440 				*rEntry.pStr	= aStrVal;
441 				rEntry.nVal		= 0;
442 				rEntry.bQueryByString = sal_True;
443 			}
444 
445             rEntry.nField	= nField ? (theQueryData.nCol1 +
446                     static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0);
447 			rEntry.eOp	  	= eOp;
448 		}
449 	}
450 
451 	theParam.GetEntry(1).eConnect = (nConnect1 != LISTBOX_ENTRY_NOTFOUND)
452 									? (ScQueryConnect)nConnect1
453 									: SC_AND;
454 	theParam.GetEntry(2).eConnect = (nConnect2 != LISTBOX_ENTRY_NOTFOUND)
455 									? (ScQueryConnect)nConnect2
456 									: SC_AND;
457 
458 	theParam.bInplace   = sal_False;
459 	theParam.nDestTab	= 0;	// Woher kommen diese Werte?
460 	theParam.nDestCol	= 0;
461 	theParam.nDestRow	= 0;
462 
463 	theParam.bDuplicate		= !aBtnUnique.IsChecked();
464 	theParam.bCaseSens 		= aBtnCase.IsChecked();
465 	theParam.bRegExp		= aBtnRegExp.IsChecked();
466 
467 	if ( pOutItem ) DELETEZ( pOutItem );
468 	pOutItem = new ScQueryItem( nWhichQuery, &theParam );
469 
470 	return *pOutItem;
471 }
472 
473 //------------------------------------------------------------------------
474 // Handler:
475 //------------------------------------------------------------------------
476 
477 IMPL_LINK( ScPivotFilterDlg, LbSelectHdl, ListBox*, pLb )
478 {
479 	/*
480 	 * Behandlung der Enable/Disable-Logik,
481 	 * abhaengig davon, welche ListBox angefasst wurde:
482 	 */
483 
484 	if ( pLb == &aLbConnect1 )
485 	{
486 		if ( !aLbField2.IsEnabled() )
487 		{
488 			aLbField2.Enable();
489 			aLbCond2.Enable();
490 			aEdVal2.Enable();
491 		}
492 	}
493 	else if ( pLb == &aLbConnect2 )
494 	{
495 		if ( !aLbField3.IsEnabled() )
496 		{
497 			aLbField3.Enable();
498 			aLbCond3.Enable();
499 			aEdVal3.Enable();
500 		}
501 	}
502 	else if ( pLb == &aLbField1 )
503 	{
504 		if ( aLbField1.GetSelectEntryPos() == 0 )
505 		{
506 			aLbConnect1.SetNoSelection();
507 			aLbConnect2.SetNoSelection();
508 			aLbField2.SelectEntryPos( 0 );
509 			aLbField3.SelectEntryPos( 0 );
510 			aLbCond2.SelectEntryPos( 0 );
511 			aLbCond3.SelectEntryPos( 0 );
512 			ClearValueList( 1 );
513 			ClearValueList( 2 );
514 			ClearValueList( 3 );
515 
516 			aLbConnect1.Disable();
517 			aLbConnect2.Disable();
518 			aLbField2.Disable();
519 			aLbField3.Disable();
520 			aLbCond2.Disable();
521 			aLbCond3.Disable();
522 			aEdVal2.Disable();
523 			aEdVal3.Disable();
524 		}
525 		else
526 		{
527 			UpdateValueList( 1 );
528 			if ( !aLbConnect1.IsEnabled() )
529 			{
530 				aLbConnect1.Enable();
531 			}
532 		}
533 	}
534 	else if ( pLb == &aLbField2 )
535 	{
536 		if ( aLbField2.GetSelectEntryPos() == 0 )
537 		{
538 			aLbConnect2.SetNoSelection();
539 			aLbField3.SelectEntryPos( 0 );
540 			aLbCond3.SelectEntryPos( 0 );
541 			ClearValueList( 2 );
542 			ClearValueList( 3 );
543 
544 			aLbConnect2.Disable();
545 			aLbField3.Disable();
546 			aLbCond3.Disable();
547 			aEdVal3.Disable();
548 		}
549 		else
550 		{
551 			UpdateValueList( 2 );
552 			if ( !aLbConnect2.IsEnabled() )
553 			{
554 				aLbConnect2.Enable();
555 			}
556 		}
557 	}
558 	else if ( pLb == &aLbField3 )
559 	{
560 		( aLbField3.GetSelectEntryPos() == 0 )
561 			? ClearValueList( 3 )
562 			: UpdateValueList( 3 );
563 	}
564 
565 	return 0;
566 }
567 
568 //----------------------------------------------------------------------------
569 
570 IMPL_LINK( ScPivotFilterDlg, CheckBoxHdl, CheckBox*, pBox )
571 {
572 	//	bei Gross-/Kleinschreibung die Werte-Listen aktualisieren
573 
574 	if ( pBox == &aBtnCase )					// Wertlisten
575 	{
576 		for (sal_uInt16 i=0; i<=MAXCOL; i++)
577 			DELETEZ( pEntryLists[i] );
578 
579 		String aCurVal1 = aEdVal1.GetText();
580 		String aCurVal2 = aEdVal2.GetText();
581 		String aCurVal3 = aEdVal3.GetText();
582 		UpdateValueList( 1 );
583 		UpdateValueList( 2 );
584 		UpdateValueList( 3 );
585 		aEdVal1.SetText( aCurVal1 );
586 		aEdVal2.SetText( aCurVal2 );
587 		aEdVal3.SetText( aCurVal3 );
588 	}
589 
590 	return 0;
591 }
592 
593 //------------------------------------------------------------------------
594 
595 IMPL_LINK( ScPivotFilterDlg, ValModifyHdl, ComboBox*, pEd )
596 {
597 	if ( pEd )
598 	{
599 		String aStrVal	= pEd->GetText();
600 		ListBox* pLb	= &aLbCond1;
601 
602 			 if ( pEd == &aEdVal2 ) pLb = &aLbCond2;
603 		else if ( pEd == &aEdVal3 )	pLb = &aLbCond3;
604 
605 		// wenn einer der Sonderwerte leer/nicht-leer
606 		// gewaehlt wird, so macht nur der =-Operator Sinn:
607 
608 		if ( aStrEmpty == aStrVal || aStrNotEmpty == aStrVal )
609 		{
610 			pLb->SelectEntry( '=' );
611 			pLb->Disable();
612 		}
613 		else
614 			pLb->Enable();
615 	}
616 
617 	return 0;
618 }
619 
620 
621