Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #undef SC_DLLIMPLEMENTATION
31 : :
32 : :
33 : :
34 : : #include <vcl/waitobj.hxx>
35 : :
36 : : #include "viewdata.hxx"
37 : : #include "document.hxx"
38 : : #include "uiitems.hxx"
39 : : #include "global.hxx"
40 : : #include "globalnames.hxx"
41 : : #include "dbdata.hxx"
42 : : #include "scresid.hxx"
43 : : #include "queryentry.hxx"
44 : : #include "typedstrdata.hxx"
45 : :
46 : : #include "sc.hrc"
47 : : #include "filter.hrc"
48 : : #include "globstr.hrc"
49 : :
50 : : #define _PFILTDLG_CXX
51 : : #include "pfiltdlg.hxx"
52 : : #undef _PFILTDLG_CXX
53 : : #include <svl/zforlist.hxx>
54 : :
55 : : //==================================================================
56 : :
57 : 0 : ScPivotFilterDlg::ScPivotFilterDlg( Window* pParent,
58 : : const SfxItemSet& rArgSet,
59 : : SCTAB nSourceTab )
60 : :
61 : : : ModalDialog ( pParent, ScResId( RID_SCDLG_PIVOTFILTER ) ),
62 : : //
63 : : aFlCriteria ( this, ScResId( FL_CRITERIA ) ),
64 : : aLbField1 ( this, ScResId( LB_FIELD1 ) ),
65 : : aLbCond1 ( this, ScResId( LB_COND1 ) ),
66 : : aEdVal1 ( this, ScResId( ED_VAL1 ) ),
67 : : aLbConnect1 ( this, ScResId( LB_OP1 ) ),
68 : : aLbField2 ( this, ScResId( LB_FIELD2 ) ),
69 : : aLbCond2 ( this, ScResId( LB_COND2 ) ),
70 : : aEdVal2 ( this, ScResId( ED_VAL2 ) ),
71 : : aLbConnect2 ( this, ScResId( LB_OP2 ) ),
72 : : aLbField3 ( this, ScResId( LB_FIELD3 ) ),
73 : : aLbCond3 ( this, ScResId( LB_COND3 ) ),
74 : : aEdVal3 ( this, ScResId( ED_VAL3 ) ),
75 : : aFtConnect ( this, ScResId( FT_OP ) ),
76 : : aFtField ( this, ScResId( FT_FIELD ) ),
77 : : aFtCond ( this, ScResId( FT_COND ) ),
78 : : aFtVal ( this, ScResId( FT_VAL ) ),
79 : : aFlOptions ( this, ScResId( FL_OPTIONS ) ),
80 : : aBtnCase ( this, ScResId( BTN_CASE ) ),
81 : : aBtnRegExp ( this, ScResId( BTN_REGEXP ) ),
82 : : aBtnUnique ( this, ScResId( BTN_UNIQUE ) ),
83 : : aFtDbAreaLabel ( this, ScResId( FT_DBAREA_LABEL ) ),
84 : : aFtDbArea ( this, ScResId( FT_DBAREA ) ),
85 : : aBtnOk ( this, ScResId( BTN_OK ) ),
86 : : aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
87 : : aBtnHelp ( this, ScResId( BTN_HELP ) ),
88 : : aBtnMore ( this, ScResId( BTN_MORE ) ),
89 : : aStrUndefined ( SC_RESSTR(SCSTR_UNDEFINED) ),
90 : : aStrNone ( SC_RESSTR(SCSTR_NONE) ),
91 : : aStrEmpty ( SC_RESSTR(SCSTR_FILTER_EMPTY) ),
92 : : aStrNotEmpty ( SC_RESSTR(SCSTR_FILTER_NOTEMPTY) ),
93 : : aStrRow ( SC_RESSTR(SCSTR_ROW) ),
94 : : aStrColumn ( SC_RESSTR(SCSTR_COLUMN) ),
95 : : //
96 : 0 : nWhichQuery ( rArgSet.GetPool()->GetWhich( SID_QUERY ) ),
97 : : theQueryData ( ((const ScQueryItem&)
98 : 0 : rArgSet.Get( nWhichQuery )).GetQueryData() ),
99 : : pOutItem ( NULL ),
100 : : pViewData ( NULL ),
101 : : pDoc ( NULL ),
102 : : nSrcTab ( nSourceTab ), // ist nicht im QueryParam
103 : 0 : nFieldCount ( 0 )
104 : : {
105 : 0 : for (sal_uInt16 i=0; i<=MAXCOL; i++)
106 : 0 : pEntryLists[i] = NULL;
107 : :
108 : 0 : Init( rArgSet );
109 : 0 : FreeResource();
110 : 0 : }
111 : :
112 : : //------------------------------------------------------------------------
113 : :
114 : 0 : ScPivotFilterDlg::~ScPivotFilterDlg()
115 : : {
116 : 0 : for (sal_uInt16 i=0; i<=MAXCOL; i++)
117 : 0 : delete pEntryLists[i];
118 : :
119 : 0 : if ( pOutItem )
120 : 0 : delete pOutItem;
121 : 0 : }
122 : :
123 : : //------------------------------------------------------------------------
124 : :
125 : 0 : void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet )
126 : : {
127 : : const ScQueryItem& rQueryItem = (const ScQueryItem&)
128 : 0 : rArgSet.Get( nWhichQuery );
129 : :
130 : 0 : aBtnCase.SetClickHdl ( LINK( this, ScPivotFilterDlg, CheckBoxHdl ) );
131 : :
132 : 0 : aLbField1.SetSelectHdl ( LINK( this, ScPivotFilterDlg, LbSelectHdl ) );
133 : 0 : aLbField2.SetSelectHdl ( LINK( this, ScPivotFilterDlg, LbSelectHdl ) );
134 : 0 : aLbField3.SetSelectHdl ( LINK( this, ScPivotFilterDlg, LbSelectHdl ) );
135 : 0 : aLbConnect1.SetSelectHdl( LINK( this, ScPivotFilterDlg, LbSelectHdl ) );
136 : 0 : aLbConnect2.SetSelectHdl( LINK( this, ScPivotFilterDlg, LbSelectHdl ) );
137 : :
138 : 0 : aBtnMore.AddWindow( &aBtnCase );
139 : 0 : aBtnMore.AddWindow( &aBtnRegExp );
140 : 0 : aBtnMore.AddWindow( &aBtnUnique );
141 : 0 : aBtnMore.AddWindow( &aFtDbAreaLabel );
142 : 0 : aBtnMore.AddWindow( &aFtDbArea );
143 : 0 : aBtnMore.AddWindow( &aFlOptions );
144 : :
145 : 0 : aBtnCase .Check( theQueryData.bCaseSens );
146 : 0 : aBtnRegExp .Check( theQueryData.bRegExp );
147 : 0 : aBtnUnique .Check( !theQueryData.bDuplicate );
148 : :
149 : 0 : pViewData = rQueryItem.GetViewData();
150 : 0 : pDoc = pViewData ? pViewData->GetDocument() : NULL;
151 : :
152 : : // fuer leichteren Zugriff:
153 : 0 : aFieldLbArr [0] = &aLbField1;
154 : 0 : aFieldLbArr [1] = &aLbField2;
155 : 0 : aFieldLbArr [2] = &aLbField3;
156 : 0 : aValueEdArr [0] = &aEdVal1;
157 : 0 : aValueEdArr [1] = &aEdVal2;
158 : 0 : aValueEdArr [2] = &aEdVal3;
159 : 0 : aCondLbArr [0] = &aLbCond1;
160 : 0 : aCondLbArr [1] = &aLbCond2;
161 : 0 : aCondLbArr [2] = &aLbCond3;
162 : :
163 : 0 : if ( pViewData && pDoc )
164 : : {
165 : 0 : rtl::OUString theAreaStr;
166 : : ScRange theCurArea ( ScAddress( theQueryData.nCol1,
167 : : theQueryData.nRow1,
168 : : nSrcTab ),
169 : : ScAddress( theQueryData.nCol2,
170 : : theQueryData.nRow2,
171 : 0 : nSrcTab ) );
172 : 0 : ScDBCollection* pDBColl = pDoc->GetDBCollection();
173 : 0 : ::rtl::OUString theDbName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(STR_DB_LOCAL_NONAME));
174 : :
175 : : /*
176 : : * Ueberpruefen, ob es sich bei dem uebergebenen
177 : : * Bereich um einen Datenbankbereich handelt:
178 : : */
179 : :
180 : 0 : theCurArea.Format( theAreaStr, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() );
181 : :
182 : 0 : if ( pDBColl )
183 : : {
184 : 0 : ScAddress& rStart = theCurArea.aStart;
185 : 0 : ScAddress& rEnd = theCurArea.aEnd;
186 : 0 : ScDBData* pDBData = pDBColl->GetDBAtArea( rStart.Tab(),
187 : 0 : rStart.Col(), rStart.Row(),
188 : 0 : rEnd.Col(), rEnd.Row() );
189 : 0 : if ( pDBData )
190 : 0 : theDbName = pDBData->GetName();
191 : : }
192 : :
193 : 0 : ::rtl::OUStringBuffer aBuf;
194 : 0 : aBuf.appendAscii(" (");
195 : 0 : aBuf.append(theDbName);
196 : 0 : aBuf.append(sal_Unicode(')'));
197 : 0 : aFtDbArea.SetText(aBuf.makeStringAndClear());
198 : : }
199 : : else
200 : : {
201 : 0 : aFtDbArea.SetText( EMPTY_STRING );
202 : : }
203 : :
204 : : // Feldlisten einlesen und Eintraege selektieren:
205 : :
206 : 0 : FillFieldLists();
207 : :
208 : 0 : for ( SCSIZE i=0; i<3; i++ )
209 : : {
210 : 0 : if ( theQueryData.GetEntry(i).bDoQuery )
211 : : {
212 : 0 : const ScQueryEntry& rEntry = theQueryData.GetEntry(i);
213 : 0 : const ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
214 : 0 : rtl::OUString aValStr = rItem.maString;
215 : 0 : if (rEntry.IsQueryByEmpty())
216 : 0 : aValStr = aStrEmpty;
217 : 0 : else if (rEntry.IsQueryByNonEmpty())
218 : 0 : aValStr = aStrNotEmpty;
219 : 0 : sal_uInt16 nCondPos = (sal_uInt16)rEntry.eOp;
220 : 0 : sal_uInt16 nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) );
221 : :
222 : 0 : aFieldLbArr[i]->SelectEntryPos( nFieldSelPos );
223 : 0 : aCondLbArr [i]->SelectEntryPos( nCondPos );
224 : 0 : UpdateValueList( static_cast<sal_uInt16>(i+1) );
225 : 0 : aValueEdArr[i]->SetText( aValStr );
226 : 0 : if (aValStr.equals(aStrEmpty) || aValStr.equals(aStrNotEmpty))
227 : 0 : aCondLbArr[i]->Disable();
228 : : }
229 : : else
230 : : {
231 : 0 : aFieldLbArr[i]->SelectEntryPos( 0 ); // "keiner" selektieren
232 : 0 : aCondLbArr [i]->SelectEntryPos( 0 ); // "=" selektieren
233 : 0 : UpdateValueList( static_cast<sal_uInt16>(i) );
234 : 0 : aValueEdArr[i]->SetText( EMPTY_STRING );
235 : : }
236 : 0 : aValueEdArr[i]->SetModifyHdl( LINK( this, ScPivotFilterDlg, ValModifyHdl ) );
237 : : }
238 : :
239 : : // Disable/Enable Logik:
240 : :
241 : 0 : (aLbField1.GetSelectEntryPos() != 0)
242 : 0 : && (aLbField2.GetSelectEntryPos() != 0)
243 : 0 : ? aLbConnect1.SelectEntryPos( (sal_uInt16)theQueryData.GetEntry(1).eConnect )
244 : 0 : : aLbConnect1.SetNoSelection();
245 : :
246 : 0 : (aLbField2.GetSelectEntryPos() != 0)
247 : 0 : && (aLbField3.GetSelectEntryPos() != 0)
248 : 0 : ? aLbConnect2.SelectEntryPos( (sal_uInt16)theQueryData.GetEntry(2).eConnect )
249 : 0 : : aLbConnect2.SetNoSelection();
250 : :
251 : 0 : if ( aLbField1.GetSelectEntryPos() == 0 )
252 : : {
253 : 0 : aLbConnect1.Disable();
254 : 0 : aLbField2.Disable();
255 : 0 : aLbCond2.Disable();
256 : 0 : aEdVal2.Disable();
257 : : }
258 : 0 : else if ( aLbConnect1.GetSelectEntryCount() == 0 )
259 : : {
260 : 0 : aLbField2.Disable();
261 : 0 : aLbCond2.Disable();
262 : 0 : aEdVal2.Disable();
263 : : }
264 : :
265 : 0 : if ( aLbField2.GetSelectEntryPos() == 0 )
266 : : {
267 : 0 : aLbConnect2.Disable();
268 : 0 : aLbField3.Disable();
269 : 0 : aLbCond3.Disable();
270 : 0 : aEdVal3.Disable();
271 : : }
272 : 0 : else if ( aLbConnect2.GetSelectEntryCount() == 0 )
273 : : {
274 : 0 : aLbField3.Disable();
275 : 0 : aLbCond3.Disable();
276 : 0 : aEdVal3.Disable();
277 : : }
278 : 0 : }
279 : :
280 : : //------------------------------------------------------------------------
281 : :
282 : 0 : void ScPivotFilterDlg::FillFieldLists()
283 : : {
284 : 0 : aLbField1.Clear();
285 : 0 : aLbField2.Clear();
286 : 0 : aLbField3.Clear();
287 : 0 : aLbField1.InsertEntry( aStrNone, 0 );
288 : 0 : aLbField2.InsertEntry( aStrNone, 0 );
289 : 0 : aLbField3.InsertEntry( aStrNone, 0 );
290 : :
291 : 0 : if ( pDoc )
292 : : {
293 : 0 : rtl::OUString aFieldName;
294 : 0 : SCTAB nTab = nSrcTab;
295 : 0 : SCCOL nFirstCol = theQueryData.nCol1;
296 : 0 : SCROW nFirstRow = theQueryData.nRow1;
297 : 0 : SCCOL nMaxCol = theQueryData.nCol2;
298 : 0 : SCCOL col = 0;
299 : 0 : sal_uInt16 i=1;
300 : :
301 : 0 : for ( col=nFirstCol; col<=nMaxCol; col++ )
302 : : {
303 : 0 : pDoc->GetString( col, nFirstRow, nTab, aFieldName );
304 : 0 : if ( aFieldName.isEmpty() )
305 : : {
306 : 0 : rtl::OUStringBuffer aBuf;
307 : 0 : aBuf.append(aStrColumn);
308 : 0 : aFieldName = aBuf.makeStringAndClear().replaceAll("%1", ScColToAlpha( col ));
309 : : }
310 : 0 : aLbField1.InsertEntry( aFieldName, i );
311 : 0 : aLbField2.InsertEntry( aFieldName, i );
312 : 0 : aLbField3.InsertEntry( aFieldName, i );
313 : 0 : i++;
314 : : }
315 : 0 : nFieldCount = i;
316 : : }
317 : 0 : }
318 : :
319 : : //------------------------------------------------------------------------
320 : :
321 : 0 : void ScPivotFilterDlg::UpdateValueList( sal_uInt16 nList )
322 : : {
323 : 0 : if ( pDoc && nList>0 && nList<=3 )
324 : : {
325 : 0 : ComboBox* pValList = aValueEdArr[nList-1];
326 : 0 : sal_uInt16 nFieldSelPos = aFieldLbArr[nList-1]->GetSelectEntryPos();
327 : 0 : sal_uInt16 nListPos = 0;
328 : 0 : rtl::OUString aCurValue = pValList->GetText();
329 : :
330 : 0 : pValList->Clear();
331 : 0 : pValList->InsertEntry( aStrNotEmpty, 0 );
332 : 0 : pValList->InsertEntry( aStrEmpty, 1 );
333 : 0 : nListPos = 2;
334 : :
335 : 0 : if ( pDoc && nFieldSelPos )
336 : : {
337 : 0 : SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1;
338 : 0 : if (!pEntryLists[nColumn])
339 : : {
340 : 0 : WaitObject aWaiter( this );
341 : :
342 : 0 : SCTAB nTab = nSrcTab;
343 : 0 : SCROW nFirstRow = theQueryData.nRow1;
344 : 0 : SCROW nLastRow = theQueryData.nRow2;
345 : 0 : nFirstRow++;
346 : 0 : bool bHasDates = false;
347 : 0 : bool bCaseSens = aBtnCase.IsChecked();
348 : 0 : pEntryLists[nColumn] = new std::vector<ScTypedStrData>;
349 : : pDoc->GetFilterEntriesArea(
350 : 0 : nColumn, nFirstRow, nLastRow, nTab, bCaseSens, *pEntryLists[nColumn], bHasDates);
351 : : }
352 : :
353 : 0 : std::vector<ScTypedStrData>* pColl = pEntryLists[nColumn];
354 : 0 : std::vector<ScTypedStrData>::const_iterator it = pColl->begin(), itEnd = pColl->end();
355 : 0 : for (; it != itEnd; ++it)
356 : : {
357 : 0 : pValList->InsertEntry(it->GetString(), nListPos);
358 : 0 : nListPos++;
359 : : }
360 : : }
361 : 0 : pValList->SetText( aCurValue );
362 : : }
363 : 0 : }
364 : :
365 : : //------------------------------------------------------------------------
366 : :
367 : 0 : void ScPivotFilterDlg::ClearValueList( sal_uInt16 nList )
368 : : {
369 : 0 : if ( nList>0 && nList<=3 )
370 : : {
371 : 0 : ComboBox* pValList = aValueEdArr[nList-1];
372 : 0 : pValList->Clear();
373 : 0 : pValList->InsertEntry( aStrNotEmpty, 0 );
374 : 0 : pValList->InsertEntry( aStrEmpty, 1 );
375 : 0 : pValList->SetText( EMPTY_STRING );
376 : : }
377 : 0 : }
378 : :
379 : : //------------------------------------------------------------------------
380 : :
381 : 0 : sal_uInt16 ScPivotFilterDlg::GetFieldSelPos( SCCOL nField )
382 : : {
383 : 0 : if ( nField >= theQueryData.nCol1 && nField <= theQueryData.nCol2 )
384 : 0 : return static_cast<sal_uInt16>(nField - theQueryData.nCol1 + 1);
385 : : else
386 : 0 : return 0;
387 : : }
388 : :
389 : : //------------------------------------------------------------------------
390 : :
391 : 0 : const ScQueryItem& ScPivotFilterDlg::GetOutputItem()
392 : : {
393 : 0 : ScQueryParam theParam( theQueryData );
394 : 0 : sal_uInt16 nConnect1 = aLbConnect1.GetSelectEntryPos();
395 : 0 : sal_uInt16 nConnect2 = aLbConnect2.GetSelectEntryPos();
396 : :
397 : 0 : for ( SCSIZE i=0; i<3; i++ )
398 : : {
399 : 0 : sal_uInt16 nField = aFieldLbArr[i]->GetSelectEntryPos();
400 : 0 : ScQueryOp eOp = (ScQueryOp)aCondLbArr[i]->GetSelectEntryPos();
401 : :
402 : 0 : sal_Bool bDoThis = (aFieldLbArr[i]->GetSelectEntryPos() != 0);
403 : 0 : theParam.GetEntry(i).bDoQuery = bDoThis;
404 : :
405 : 0 : if ( bDoThis )
406 : : {
407 : 0 : ScQueryEntry& rEntry = theParam.GetEntry(i);
408 : 0 : ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
409 : :
410 : 0 : rtl::OUString aStrVal = aValueEdArr[i]->GetText();
411 : :
412 : : /*
413 : : * Dialog liefert die ausgezeichneten Feldwerte "leer"/"nicht leer"
414 : : * als Konstanten in nVal in Verbindung mit dem Schalter
415 : : * bQueryByString auf FALSE.
416 : : */
417 : 0 : if ( aStrVal.equals(aStrEmpty) )
418 : : {
419 : : OSL_ASSERT(eOp == SC_EQUAL);
420 : 0 : rEntry.SetQueryByEmpty();
421 : : }
422 : 0 : else if ( aStrVal.equals(aStrNotEmpty) )
423 : : {
424 : : OSL_ASSERT(eOp == SC_EQUAL);
425 : 0 : rEntry.SetQueryByNonEmpty();
426 : : }
427 : : else
428 : : {
429 : 0 : rItem.maString = aStrVal;
430 : 0 : rItem.mfVal = 0.0;
431 : 0 : rItem.meType = ScQueryEntry::ByString;
432 : : }
433 : :
434 : : rEntry.nField = nField ? (theQueryData.nCol1 +
435 : 0 : static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0);
436 : 0 : rEntry.eOp = eOp;
437 : : }
438 : : }
439 : :
440 : 0 : theParam.GetEntry(1).eConnect = (nConnect1 != LISTBOX_ENTRY_NOTFOUND)
441 : : ? (ScQueryConnect)nConnect1
442 : 0 : : SC_AND;
443 : 0 : theParam.GetEntry(2).eConnect = (nConnect2 != LISTBOX_ENTRY_NOTFOUND)
444 : : ? (ScQueryConnect)nConnect2
445 : 0 : : SC_AND;
446 : :
447 : 0 : theParam.bInplace = false;
448 : 0 : theParam.nDestTab = 0; // Woher kommen diese Werte?
449 : 0 : theParam.nDestCol = 0;
450 : 0 : theParam.nDestRow = 0;
451 : :
452 : 0 : theParam.bDuplicate = !aBtnUnique.IsChecked();
453 : 0 : theParam.bCaseSens = aBtnCase.IsChecked();
454 : 0 : theParam.bRegExp = aBtnRegExp.IsChecked();
455 : :
456 : 0 : if ( pOutItem ) DELETEZ( pOutItem );
457 : 0 : pOutItem = new ScQueryItem( nWhichQuery, &theParam );
458 : :
459 : 0 : return *pOutItem;
460 : : }
461 : :
462 : : //------------------------------------------------------------------------
463 : : // Handler:
464 : : //------------------------------------------------------------------------
465 : :
466 : 0 : IMPL_LINK( ScPivotFilterDlg, LbSelectHdl, ListBox*, pLb )
467 : : {
468 : : /*
469 : : * Behandlung der Enable/Disable-Logik,
470 : : * abhaengig davon, welche ListBox angefasst wurde:
471 : : */
472 : :
473 : 0 : if ( pLb == &aLbConnect1 )
474 : : {
475 : 0 : if ( !aLbField2.IsEnabled() )
476 : : {
477 : 0 : aLbField2.Enable();
478 : 0 : aLbCond2.Enable();
479 : 0 : aEdVal2.Enable();
480 : : }
481 : : }
482 : 0 : else if ( pLb == &aLbConnect2 )
483 : : {
484 : 0 : if ( !aLbField3.IsEnabled() )
485 : : {
486 : 0 : aLbField3.Enable();
487 : 0 : aLbCond3.Enable();
488 : 0 : aEdVal3.Enable();
489 : : }
490 : : }
491 : 0 : else if ( pLb == &aLbField1 )
492 : : {
493 : 0 : if ( aLbField1.GetSelectEntryPos() == 0 )
494 : : {
495 : 0 : aLbConnect1.SetNoSelection();
496 : 0 : aLbConnect2.SetNoSelection();
497 : 0 : aLbField2.SelectEntryPos( 0 );
498 : 0 : aLbField3.SelectEntryPos( 0 );
499 : 0 : aLbCond2.SelectEntryPos( 0 );
500 : 0 : aLbCond3.SelectEntryPos( 0 );
501 : 0 : ClearValueList( 1 );
502 : 0 : ClearValueList( 2 );
503 : 0 : ClearValueList( 3 );
504 : :
505 : 0 : aLbConnect1.Disable();
506 : 0 : aLbConnect2.Disable();
507 : 0 : aLbField2.Disable();
508 : 0 : aLbField3.Disable();
509 : 0 : aLbCond2.Disable();
510 : 0 : aLbCond3.Disable();
511 : 0 : aEdVal2.Disable();
512 : 0 : aEdVal3.Disable();
513 : : }
514 : : else
515 : : {
516 : 0 : UpdateValueList( 1 );
517 : 0 : if ( !aLbConnect1.IsEnabled() )
518 : : {
519 : 0 : aLbConnect1.Enable();
520 : : }
521 : : }
522 : : }
523 : 0 : else if ( pLb == &aLbField2 )
524 : : {
525 : 0 : if ( aLbField2.GetSelectEntryPos() == 0 )
526 : : {
527 : 0 : aLbConnect2.SetNoSelection();
528 : 0 : aLbField3.SelectEntryPos( 0 );
529 : 0 : aLbCond3.SelectEntryPos( 0 );
530 : 0 : ClearValueList( 2 );
531 : 0 : ClearValueList( 3 );
532 : :
533 : 0 : aLbConnect2.Disable();
534 : 0 : aLbField3.Disable();
535 : 0 : aLbCond3.Disable();
536 : 0 : aEdVal3.Disable();
537 : : }
538 : : else
539 : : {
540 : 0 : UpdateValueList( 2 );
541 : 0 : if ( !aLbConnect2.IsEnabled() )
542 : : {
543 : 0 : aLbConnect2.Enable();
544 : : }
545 : : }
546 : : }
547 : 0 : else if ( pLb == &aLbField3 )
548 : : {
549 : 0 : ( aLbField3.GetSelectEntryPos() == 0 )
550 : 0 : ? ClearValueList( 3 )
551 : 0 : : UpdateValueList( 3 );
552 : : }
553 : :
554 : 0 : return 0;
555 : : }
556 : :
557 : : //----------------------------------------------------------------------------
558 : :
559 : 0 : IMPL_LINK( ScPivotFilterDlg, CheckBoxHdl, CheckBox*, pBox )
560 : : {
561 : : // bei Gross-/Kleinschreibung die Werte-Listen aktualisieren
562 : :
563 : 0 : if ( pBox == &aBtnCase ) // Wertlisten
564 : : {
565 : 0 : for (sal_uInt16 i=0; i<=MAXCOL; i++)
566 : 0 : DELETEZ( pEntryLists[i] );
567 : :
568 : 0 : rtl::OUString aCurVal1 = aEdVal1.GetText();
569 : 0 : rtl::OUString aCurVal2 = aEdVal2.GetText();
570 : 0 : rtl::OUString aCurVal3 = aEdVal3.GetText();
571 : 0 : UpdateValueList( 1 );
572 : 0 : UpdateValueList( 2 );
573 : 0 : UpdateValueList( 3 );
574 : 0 : aEdVal1.SetText( aCurVal1 );
575 : 0 : aEdVal2.SetText( aCurVal2 );
576 : 0 : aEdVal3.SetText( aCurVal3 );
577 : : }
578 : :
579 : 0 : return 0;
580 : : }
581 : :
582 : : //------------------------------------------------------------------------
583 : :
584 : 0 : IMPL_LINK( ScPivotFilterDlg, ValModifyHdl, ComboBox*, pEd )
585 : : {
586 : 0 : if ( pEd )
587 : : {
588 : 0 : rtl::OUString aStrVal = pEd->GetText();
589 : 0 : ListBox* pLb = &aLbCond1;
590 : :
591 : 0 : if ( pEd == &aEdVal2 ) pLb = &aLbCond2;
592 : 0 : else if ( pEd == &aEdVal3 ) pLb = &aLbCond3;
593 : :
594 : : // wenn einer der Sonderwerte leer/nicht-leer
595 : : // gewaehlt wird, so macht nur der =-Operator Sinn:
596 : :
597 : 0 : if ( aStrEmpty.equals(aStrVal) || aStrNotEmpty.equals(aStrVal) )
598 : : {
599 : 0 : pLb->SelectEntry(rtl::OUString('='));
600 : 0 : pLb->Disable();
601 : : }
602 : : else
603 : 0 : pLb->Enable();
604 : : }
605 : :
606 : 0 : return 0;
607 : : }
608 : :
609 : :
610 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|