LibreOffice Module sc (master) 1
filtdlg.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sfx2/dispatch.hxx>
21#include <sal/log.hxx>
22
23#include <uiitems.hxx>
24#include <reffact.hxx>
25#include <viewdata.hxx>
26#include <document.hxx>
27#include <docsh.hxx>
28#include <scresid.hxx>
29#include <queryentry.hxx>
30
31#include <foptmgr.hxx>
32
33#include <globstr.hrc>
34#include <strings.hrc>
35
36#include <filtdlg.hxx>
37#include <svx/colorwindow.hxx>
38#include <vcl/svapp.hxx>
39#include <vcl/settings.hxx>
40#include <vcl/virdev.hxx>
41#include <vcl/weld.hxx>
42#include <svl/numformat.hxx>
44
45#include <limits>
46
47#define QUERY_ENTRY_COUNT 4
48#define INVALID_HEADER_POS std::numeric_limits<size_t>::max()
49
51 mnHeaderPos(INVALID_HEADER_POS) {}
52
54 const SfxItemSet& rArgSet)
55 : ScAnyRefDlgController(pB, pCW, pParent,
56 "modules/scalc/ui/standardfilterdialog.ui", "StandardFilterDialog")
57 , aStrUndefined(ScResId(SCSTR_UNDEFINED))
58 , aStrNone(ScResId(SCSTR_NONE))
59 , aStrEmpty(ScResId(SCSTR_FILTER_EMPTY))
60 , aStrNotEmpty(ScResId(SCSTR_FILTER_NOTEMPTY))
61 , aStrColumn(ScResId(SCSTR_COLUMN_LETTER))
62 , aStrTextColor(ScResId(SCSTR_FILTER_TEXT_COLOR_COND))
63 , aStrBackgroundColor(ScResId(SCSTR_FILTER_BACKGROUND_COLOR_COND))
64 , nWhichQuery(rArgSet.GetPool()->GetWhich(SID_QUERY))
65 , theQueryData(static_cast<const ScQueryItem&>(rArgSet.Get(nWhichQuery)).GetQueryData())
66 , pViewData(nullptr)
67 , pDoc(nullptr)
68 , nSrcTab(0)
69 , bRefInputMode(false)
70 , m_xLbConnect1(m_xBuilder->weld_combo_box("connect1"))
71 , m_xLbField1(m_xBuilder->weld_combo_box("field1"))
72 , m_xLbCond1(m_xBuilder->weld_combo_box("cond1"))
73 , m_xEdVal1(m_xBuilder->weld_combo_box("val1"))
74 , m_xLbColor1(m_xBuilder->weld_combo_box("color1"))
75 , m_xBtnRemove1(m_xBuilder->weld_button("remove1"))
76 , m_xLbConnect2(m_xBuilder->weld_combo_box("connect2"))
77 , m_xLbField2(m_xBuilder->weld_combo_box("field2"))
78 , m_xLbCond2(m_xBuilder->weld_combo_box("cond2"))
79 , m_xEdVal2(m_xBuilder->weld_combo_box("val2"))
80 , m_xLbColor2(m_xBuilder->weld_combo_box("color2"))
81 , m_xBtnRemove2(m_xBuilder->weld_button("remove2"))
82 , m_xLbConnect3(m_xBuilder->weld_combo_box("connect3"))
83 , m_xLbField3(m_xBuilder->weld_combo_box("field3"))
84 , m_xLbCond3(m_xBuilder->weld_combo_box("cond3"))
85 , m_xEdVal3(m_xBuilder->weld_combo_box("val3"))
86 , m_xLbColor3(m_xBuilder->weld_combo_box("color3"))
87 , m_xBtnRemove3(m_xBuilder->weld_button("remove3"))
88 , m_xLbConnect4(m_xBuilder->weld_combo_box("connect4"))
89 , m_xLbField4(m_xBuilder->weld_combo_box("field4"))
90 , m_xLbCond4(m_xBuilder->weld_combo_box("cond4"))
91 , m_xEdVal4(m_xBuilder->weld_combo_box("val4"))
92 , m_xLbColor4(m_xBuilder->weld_combo_box("color4"))
93 , m_xBtnRemove4(m_xBuilder->weld_button("remove4"))
94 , m_xContents(m_xBuilder->weld_widget("grid"))
95 , m_xScrollBar(m_xBuilder->weld_scrolled_window("scrollbar", true))
96 , m_xExpander(m_xBuilder->weld_expander("more"))
97 , m_xBtnClear(m_xBuilder->weld_button("clear"))
98 , m_xBtnOk(m_xBuilder->weld_button("ok"))
99 , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
100 , m_xBtnCase(m_xBuilder->weld_check_button("case"))
101 , m_xBtnRegExp(m_xBuilder->weld_check_button("regexp"))
102 , m_xBtnHeader(m_xBuilder->weld_check_button("header"))
103 , m_xBtnUnique(m_xBuilder->weld_check_button("unique"))
104 , m_xBtnCopyResult(m_xBuilder->weld_check_button("copyresult"))
105 , m_xLbCopyArea(m_xBuilder->weld_combo_box("lbcopyarea"))
106 , m_xEdCopyArea(new formula::RefEdit(m_xBuilder->weld_entry("edcopyarea")))
107 , m_xRbCopyArea(new formula::RefButton(m_xBuilder->weld_button("rbcopyarea")))
108 , m_xBtnDestPers(m_xBuilder->weld_check_button("destpers"))
109 , m_xFtDbAreaLabel(m_xBuilder->weld_label("dbarealabel"))
110 , m_xFtDbArea(m_xBuilder->weld_label("dbarea"))
111{
112 m_xExpander->connect_expanded(LINK(this, ScFilterDlg, MoreExpandedHdl));
113 m_xEdCopyArea->SetReferences(this, m_xFtDbAreaLabel.get());
114 m_xRbCopyArea->SetReferences(this, m_xEdCopyArea.get());
115
116 assert(m_xLbCond1->find_text(aStrTextColor) != -1);
117 assert(m_xLbCond1->find_text(aStrBackgroundColor) != -1);
118
119 Init( rArgSet );
120
121 // Hack: RefInput control
122 pTimer.reset( new Timer("ScFilterTimer") );
123 pTimer->SetTimeout( 50 ); // Wait 50ms
124 pTimer->SetInvokeHandler( LINK( this, ScFilterDlg, TimeOutHdl ) );
125}
126
128{
129 pOptionsMgr.reset();
130 pOutItem.reset();
131
132 // Hack: RefInput control
133 pTimer->Stop();
134 pTimer.reset();
135}
136
137namespace {
138VirtualDevice* lcl_getColorImage(const Color &rColor)
139{
140 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
141 Size aImageSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
142
144 xDevice->SetOutputSize(aImageSize);
145 const tools::Rectangle aRect(Point(0, 0), aImageSize);
146 if (rColor == COL_NONE_COLOR)
147 {
148 const Color aW(COL_WHITE);
149 const Color aG(0xef, 0xef, 0xef);
150 xDevice->DrawCheckered(aRect.TopLeft(), aRect.GetSize(), 8, aW, aG);
151 xDevice->SetFillColor();
152 }
153 else
154 {
155 xDevice->SetFillColor(rColor);
156 }
157
158 xDevice->DrawRect(aRect);
159
160 return xDevice.get();
161}
162}
163
164void ScFilterDlg::Init( const SfxItemSet& rArgSet )
165{
166 const ScQueryItem& rQueryItem = static_cast<const ScQueryItem&>(
167 rArgSet.Get( nWhichQuery ));
168
169 m_xBtnClear->connect_clicked ( LINK( this, ScFilterDlg, BtnClearHdl ) );
170 m_xBtnOk->connect_clicked ( LINK( this, ScFilterDlg, EndDlgHdl ) );
171 m_xBtnCancel->connect_clicked ( LINK( this, ScFilterDlg, EndDlgHdl ) );
172 m_xBtnHeader->connect_toggled ( LINK( this, ScFilterDlg, CheckBoxHdl ) );
173 m_xBtnCase->connect_toggled ( LINK( this, ScFilterDlg, CheckBoxHdl ) );
174
175 m_xLbField1->connect_changed ( LINK( this, ScFilterDlg, LbSelectHdl ) );
176 m_xLbField2->connect_changed ( LINK( this, ScFilterDlg, LbSelectHdl ) );
177 m_xLbField3->connect_changed ( LINK( this, ScFilterDlg, LbSelectHdl ) );
178 m_xLbField4->connect_changed ( LINK( this, ScFilterDlg, LbSelectHdl ) );
179 m_xLbConnect1->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
180 m_xLbConnect2->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
181 m_xLbConnect3->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
182 m_xLbConnect4->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
183
184 m_xLbField1->append_text("0000000000");
185 m_xLbField1->set_active(0);
186 auto nPrefWidth = m_xLbField1->get_preferred_size().Width();
187 m_xLbField1->clear();
188
189 m_xLbField1->set_size_request(nPrefWidth, -1);
190 m_xLbField2->set_size_request(nPrefWidth, -1);
191 m_xLbField3->set_size_request(nPrefWidth, -1);
192 m_xLbField4->set_size_request(nPrefWidth, -1);
193
194 m_xLbCond1->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
195 m_xLbCond2->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
196 m_xLbCond3->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
197 m_xLbCond4->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
198
199 m_xLbColor1->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
200 m_xLbColor2->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
201 m_xLbColor3->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
202 m_xLbColor4->connect_changed( LINK( this, ScFilterDlg, LbSelectHdl ) );
203
204 m_xBtnRemove1->connect_clicked( LINK( this, ScFilterDlg, BtnRemoveHdl ) );
205 m_xBtnRemove2->connect_clicked( LINK( this, ScFilterDlg, BtnRemoveHdl ) );
206 m_xBtnRemove3->connect_clicked( LINK( this, ScFilterDlg, BtnRemoveHdl ) );
207 m_xBtnRemove4->connect_clicked( LINK( this, ScFilterDlg, BtnRemoveHdl ) );
208
209 pViewData = rQueryItem.GetViewData();
210 pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
211 nSrcTab = pViewData ? pViewData->GetTabNo() : static_cast<SCTAB>(0);
212
213 // for easier access:
215 maFieldLbArr.push_back(m_xLbField1.get());
216 maFieldLbArr.push_back(m_xLbField2.get());
217 maFieldLbArr.push_back(m_xLbField3.get());
218 maFieldLbArr.push_back(m_xLbField4.get());
220 maValueEdArr.push_back(m_xEdVal1.get());
221 maValueEdArr.push_back(m_xEdVal2.get());
222 maValueEdArr.push_back(m_xEdVal3.get());
223 maValueEdArr.push_back(m_xEdVal4.get());
225 maCondLbArr.push_back(m_xLbCond1.get());
226 maCondLbArr.push_back(m_xLbCond2.get());
227 maCondLbArr.push_back(m_xLbCond3.get());
228 maCondLbArr.push_back(m_xLbCond4.get());
230 maConnLbArr.push_back(m_xLbConnect1.get());
231 maConnLbArr.push_back(m_xLbConnect2.get());
232 maConnLbArr.push_back(m_xLbConnect3.get());
233 maConnLbArr.push_back(m_xLbConnect4.get());
235 maColorLbArr.push_back(m_xLbColor1.get());
236 maColorLbArr.push_back(m_xLbColor2.get());
237 maColorLbArr.push_back(m_xLbColor3.get());
238 maColorLbArr.push_back(m_xLbColor4.get());
240 maRemoveBtnArr.push_back(m_xBtnRemove1.get());
241 maRemoveBtnArr.push_back(m_xBtnRemove2.get());
242 maRemoveBtnArr.push_back(m_xBtnRemove3.get());
243 maRemoveBtnArr.push_back(m_xBtnRemove4.get());
244
245 // Option initialization:
247 pViewData,
249 m_xBtnCase.get(),
250 m_xBtnRegExp.get(),
251 m_xBtnHeader.get(),
252 m_xBtnUnique.get(),
253 m_xBtnCopyResult.get(),
254 m_xBtnDestPers.get(),
255 m_xLbCopyArea.get(),
256 m_xEdCopyArea.get(),
257 m_xRbCopyArea.get(),
258 m_xFtDbAreaLabel.get(),
259 m_xFtDbArea.get(),
260 aStrUndefined ) );
261 // Read in field lists and select entries
262
264
265 for (size_t i = 0; i < QUERY_ENTRY_COUNT; ++i)
266 {
267 OUString aValStr;
268 size_t nCondPos = 0;
269 size_t nFieldSelPos = 0;
270
271 maColorLbArr[i]->set_visible(false);
272
274 if ( rEntry.bDoQuery )
275 {
276 nCondPos = static_cast<size_t>(rEntry.eOp);
277 nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) );
278 if (rEntry.IsQueryByEmpty())
279 {
280 aValStr = aStrEmpty;
281 maCondLbArr[i]->set_sensitive(false);
282 }
283 else if (rEntry.IsQueryByNonEmpty())
284 {
285 aValStr = aStrNotEmpty;
286 maCondLbArr[i]->set_sensitive(false);
287 }
288 else if (rEntry.IsQueryByTextColor() || rEntry.IsQueryByBackgroundColor())
289 {
290 nCondPos = maCondLbArr[i]->find_text(
292 maValueEdArr[i]->set_visible(false);
293 maColorLbArr[i]->set_visible(true);
294 maColorLbArr[i]->set_sensitive(true);
295 }
296 else
297 {
298 const ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
299 OUString aQueryStr = rItem.maString.getString();
300 SetValString(aQueryStr, rItem, aValStr);
301 }
302 }
303 else if ( i == 0 )
304 {
305 nFieldSelPos = pViewData ? GetFieldSelPos(pViewData->GetCurX()) : 0;
306 rEntry.nField = nFieldSelPos ? (theQueryData.nCol1 +
307 static_cast<SCCOL>(nFieldSelPos) - 1) : static_cast<SCCOL>(0);
308 rEntry.bDoQuery=true;
309 if (maRefreshExceptQuery.size() < i + 1)
310 maRefreshExceptQuery.resize(i + 1, false);
311 maRefreshExceptQuery[i] = true;
312
313 }
314 maFieldLbArr[i]->set_active( nFieldSelPos );
315 maCondLbArr [i]->set_active( nCondPos );
316 maValueEdArr[i]->set_entry_text( aValStr );
317 maValueEdArr[i]->set_entry_completion(false);
318 maValueEdArr[i]->connect_changed( LINK( this, ScFilterDlg, ValModifyHdl ) );
321 }
322
323 m_xScrollBar->connect_vadjustment_changed( LINK( this, ScFilterDlg, ScrollHdl ) );
324 m_xScrollBar->vadjustment_configure(0, 0, 8, 1, 3, 4);
325 Size aSize(m_xContents->get_preferred_size());
326 m_xContents->set_size_request(aSize.Width(), aSize.Height());
327
328 m_xLbConnect1->hide();
329 // Disable/Enable Logic:
330
331 (m_xLbField1->get_active() != 0)
332 && (m_xLbField2->get_active() != 0)
333 ? m_xLbConnect2->set_active( static_cast<sal_uInt16>(theQueryData.GetEntry(1).eConnect) )
334 : m_xLbConnect2->set_active(-1);
335
336 (m_xLbField2->get_active() != 0)
337 && (m_xLbField3->get_active() != 0)
338 ? m_xLbConnect3->set_active( static_cast<sal_uInt16>(theQueryData.GetEntry(2).eConnect) )
339 : m_xLbConnect3->set_active(-1);
340
341 (m_xLbField3->get_active() != 0)
342 && (m_xLbField4->get_active() != 0)
343 ? m_xLbConnect4->set_active( static_cast<sal_uInt16>(theQueryData.GetEntry(3).eConnect) )
344 : m_xLbConnect4->set_active(-1);
345 if ( m_xLbField1->get_active() == 0 )
346 {
347 m_xLbConnect2->set_sensitive(false);
348 m_xLbField2->set_sensitive(false);
349 m_xLbCond2->set_sensitive(false);
350 m_xEdVal2->set_sensitive(false);
351 m_xLbColor2->set_sensitive(false);
352 m_xBtnRemove2->set_sensitive(false);
353 }
354 else if ( m_xLbConnect2->get_active() == -1 )
355 {
356 m_xLbField2->set_sensitive(false);
357 m_xLbCond2->set_sensitive(false);
358 m_xEdVal2->set_sensitive(false);
359 m_xLbColor2->set_sensitive(false);
360 m_xBtnRemove2->set_sensitive(false);
361 }
362
363 if ( m_xLbField2->get_active() == 0 )
364 {
365 m_xLbConnect3->set_sensitive(false);
366 m_xLbField3->set_sensitive(false);
367 m_xLbCond3->set_sensitive(false);
368 m_xEdVal3->set_sensitive(false);
369 m_xLbColor3->set_sensitive(false);
370 m_xBtnRemove3->set_sensitive(false);
371 }
372 else if ( m_xLbConnect3->get_active() == -1 )
373 {
374 m_xLbField3->set_sensitive(false);
375 m_xLbCond3->set_sensitive(false);
376 m_xEdVal3->set_sensitive(false);
377 m_xLbColor3->set_sensitive(false);
378 m_xBtnRemove3->set_sensitive(false);
379 }
380 if ( m_xLbField3->get_active() == 0 )
381 {
382 m_xLbConnect4->set_sensitive(false);
383 m_xLbField4->set_sensitive(false);
384 m_xLbCond4->set_sensitive(false);
385 m_xEdVal4->set_sensitive(false);
386 m_xLbColor4->set_sensitive(false);
387 m_xBtnRemove4->set_sensitive(false);
388 }
389 else if ( m_xLbConnect4->get_active() == -1 )
390 {
391 m_xLbField4->set_sensitive(false);
392 m_xLbCond4->set_sensitive(false);
393 m_xEdVal4->set_sensitive(false);
394 m_xLbColor4->set_sensitive(false);
395 m_xBtnRemove4->set_sensitive(false);
396 }
397
398 m_xEdVal1->set_entry_width_chars(10);
399 m_xEdVal2->set_entry_width_chars(10);
400 m_xEdVal3->set_entry_width_chars(10);
401 m_xEdVal4->set_entry_width_chars(10);
402
403 if (pDoc != nullptr && pDoc->GetChangeTrack() != nullptr)
404 m_xBtnCopyResult->set_sensitive(false);
405}
406
408{
409 if (pViewData)
411
412 DoClose( ScFilterDlgWrapper::GetChildWindowId() );
413}
414
415// Mouse-selected cell area becomes the new selection and is shown in the
416// reference text box
417
419{
420 if ( bRefInputMode ) // Only possible if in reference edit mode
421 {
422 if ( rRef.aStart != rRef.aEnd )
424 OUString aRefStr(rRef.aStart.Format(ScRefFlags::ADDR_ABS_3D, &rDocP, rDocP.GetAddressConvention()));
425 m_xEdCopyArea->SetRefString( aRefStr );
426 }
427}
428
430{
431 if ( bRefInputMode )
432 {
433 m_xEdCopyArea->GrabFocus();
434 m_xEdCopyArea->GetModifyHdl().Call( *m_xEdCopyArea );
435 }
436 else
437 m_xDialog->grab_focus();
438
439 RefInputDone();
440}
441
443{
444 m_xLbField1->freeze();
445 m_xLbField2->freeze();
446 m_xLbField3->freeze();
447 m_xLbField4->freeze();
448
449 m_xLbField1->clear();
450 m_xLbField2->clear();
451 m_xLbField3->clear();
452 m_xLbField4->clear();
453 m_xLbField1->append_text( aStrNone );
454 m_xLbField2->append_text( aStrNone );
455 m_xLbField3->append_text( aStrNone );
456 m_xLbField4->append_text( aStrNone );
457
458 if ( pDoc )
459 {
460 OUString aFieldName;
461 SCTAB nTab = nSrcTab;
462 SCCOL nFirstCol = theQueryData.nCol1;
463 SCROW nFirstRow = theQueryData.nRow1;
464 SCCOL nMaxCol = theQueryData.nCol2;
465 SCCOL col = 0;
466
467 for ( col=nFirstCol; col<=nMaxCol; col++ )
468 {
469 aFieldName = pDoc->GetString(col, nFirstRow, nTab);
470 if (!m_xBtnHeader->get_active() || aFieldName.isEmpty())
471 {
472 aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, u"%1", ScColToAlpha( col ));
473 }
474 m_xLbField1->append_text( aFieldName );
475 m_xLbField2->append_text( aFieldName );
476 m_xLbField3->append_text( aFieldName );
477 m_xLbField4->append_text( aFieldName );
478 }
479 }
480
481 m_xLbField4->thaw();
482 m_xLbField3->thaw();
483 m_xLbField2->thaw();
484 m_xLbField1->thaw();
485}
486
488{
489 bool bCaseSens = m_xBtnCase->get_active();
490
491 if (pDoc && nList > 0 && nList <= QUERY_ENTRY_COUNT)
492 {
493 weld::ComboBox* pValList = maValueEdArr[nList-1];
494 const sal_Int32 nFieldSelPos = maFieldLbArr[nList-1]->get_active();
495 OUString aCurValue = pValList->get_active_text();
496
497 std::unique_ptr<weld::WaitObject> xWaiter;
498 std::vector<weld::ComboBoxEntry> aEntries;
499 aEntries.emplace_back(aStrNotEmpty);
500 aEntries.emplace_back(aStrEmpty);
501
502 if (nFieldSelPos)
503 {
504 xWaiter.reset(new weld::WaitObject(m_xDialog.get())); // even if only the list box has content
505 SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1;
506 EntryList* pList = nullptr;
507 if (!m_EntryLists.count(nColumn))
508 {
509 size_t nOffset = GetSliderPos();
510 SCTAB nTab = nSrcTab;
511 SCROW nFirstRow = theQueryData.nRow1;
512 SCROW nLastRow = theQueryData.nRow2;
513 if (maHasDates.size() < nOffset+nList)
514 maHasDates.resize(nOffset+nList, false);
515 maHasDates[nOffset+nList-1] = false;
516
517 // first without the first line
518 std::pair<EntryListsMap::iterator, bool> r =
519 m_EntryLists.insert(std::make_pair(nColumn, std::make_unique<EntryList>()));
520 if (!r.second)
521 // insertion failed.
522 return;
523
524 pList = r.first->second.get();
526 nColumn, nFirstRow+1, nLastRow,
527 nTab, bCaseSens, pList->maFilterEntries);
528 maHasDates[nOffset+nList-1] = pList->maFilterEntries.mbHasDates;
529
530 // Entry for the first line
532
534 ScFilterEntries aHdrColl;
536 nColumn, nFirstRow, nFirstRow, nTab, true, aHdrColl );
537 if (!aHdrColl.empty())
538 {
539 // See if the header value is already in the list.
540 std::vector<ScTypedStrData>::iterator itBeg = pList->maFilterEntries.begin(), itEnd = pList->maFilterEntries.end();
541 if (std::none_of(itBeg, itEnd, FindTypedStrData(aHdrColl.front(), bCaseSens)))
542 {
543 // Not in the list. Insert it.
544 pList->maFilterEntries.push_back(aHdrColl.front());
545 if (bCaseSens)
547 else
549
550 // Record its position.
551 itBeg = pList->maFilterEntries.begin();
552 itEnd = pList->maFilterEntries.end();
553 auto it = std::find_if(itBeg, itEnd, FindTypedStrData(aHdrColl.front(), bCaseSens));
554 pList->mnHeaderPos = std::distance(itBeg, it);
555 }
556 }
557 }
558 else
559 pList = m_EntryLists[nColumn].get();
560
561 assert(pList);
562
563 for (const auto& rEntry : pList->maFilterEntries)
564 aEntries.emplace_back(rEntry.GetString());
565 }
566 pValList->insert_vector(aEntries, false);
567 pValList->set_entry_text(aCurValue);
568 }
569
570 UpdateHdrInValueList( nList );
571}
572
574{
576
577 if (!pDoc)
578 return;
579
580 if (nList == 0 || nList > QUERY_ENTRY_COUNT)
581 return;
582
583 size_t nFieldSelPos = maFieldLbArr[nList-1]->get_active();
584 if (!nFieldSelPos)
585 return;
586
587 SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1;
588 if (!m_EntryLists.count(nColumn))
589 {
590 OSL_FAIL("column not yet initialized");
591 return;
592 }
593
594 size_t const nPos = m_EntryLists[nColumn]->mnHeaderPos;
596 return;
597
598 weld::ComboBox* pValList = maValueEdArr[nList-1];
599 int nListPos = nPos + 2; // for "empty" and "non-empty"
600
601 const ScTypedStrData& rHdrEntry = m_EntryLists[nColumn]->maFilterEntries.maStrData[nPos];
602
603 const OUString& aHdrStr = rHdrEntry.GetString();
604 bool bWasThere = nListPos < pValList->get_count() && aHdrStr == pValList->get_text(nListPos);
605 bool bInclude = !m_xBtnHeader->get_active();
606
607 if (bInclude) // Include entry
608 {
609 if (!bWasThere)
610 pValList->insert_text(nListPos, aHdrStr);
611 }
612 else // Omit entry
613 {
614 if (bWasThere)
615 pValList->remove(nListPos);
616 }
617}
618
619void ScFilterDlg::ClearValueList( size_t nList )
620{
621 if (nList > 0 && nList <= QUERY_ENTRY_COUNT)
622 {
623 weld::ComboBox* pValList = maValueEdArr[nList-1];
624 pValList->clear();
625 pValList->append_text( aStrNotEmpty );
626 pValList->append_text( aStrEmpty );
627 pValList->set_entry_text( OUString() );
628 }
629}
630
632{
633 if (!pDoc || nList <= 0 || nList > QUERY_ENTRY_COUNT)
634 return;
635
636 size_t nPos = nList - 1;
638 const sal_Int32 nFieldSelPos = maFieldLbArr[nPos]->get_active();
639 if (!nFieldSelPos)
640 return;
641
642 SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1;
643 EntryList* pList = m_EntryLists[nColumn].get();
644 if (!pList)
645 return;
646
647 std::set<Color> aColors;
648 OUString sSelectedCondition = maCondLbArr[nPos]->get_active_text();
649 if (sSelectedCondition == aStrTextColor)
650 aColors = pList->maFilterEntries.getTextColors();
651 else if (sSelectedCondition == aStrBackgroundColor)
652 aColors = pList->maFilterEntries.getBackgroundColors();
653 else
654 return;
655
656 maColorLbArr[nPos]->clear();
657 for (const auto& rColor : aColors)
658 {
659 OUString sId = rColor.AsRGBHexString();
660 if (rColor == COL_AUTO)
661 {
662 OUString sText = sSelectedCondition == aStrTextColor
663 ? ScResId(SCSTR_FILTER_AUTOMATIC_COLOR)
664 : ScResId(SCSTR_FILTER_NO_FILL);
665 maColorLbArr[nPos]->append(sId, sText);
666 }
667 else
668 {
669 VirtualDevice* pDev = lcl_getColorImage(rColor);
670 maColorLbArr[nPos]->append(sId, OUString(), *pDev);
671 }
672
673 auto aItem = rEntry.GetQueryItem();
674 if (aItem.maColor == rColor
675 && ((sSelectedCondition == aStrTextColor && aItem.meType == ScQueryEntry::ByTextColor)
676 || (sSelectedCondition == aStrBackgroundColor
677 && aItem.meType == ScQueryEntry::ByBackgroundColor)))
678 {
679 maColorLbArr[nPos]->set_active_id(sId);
680 }
681 }
682}
683
685{
686 if ( nField >= theQueryData.nCol1 && nField <= theQueryData.nCol2 )
687 return static_cast<size_t>(nField - theQueryData.nCol1 + 1);
688 else
689 return 0;
690}
691
693{
694 ScAddress theCopyPos;
695 ScQueryParam theParam( theQueryData );
696 bool bCopyPosOk = false;
697
698 if ( m_xBtnCopyResult->get_active() )
699 {
700 ScRefFlags nResult = theCopyPos.Parse(
702 bCopyPosOk = (nResult & ScRefFlags::VALID) == ScRefFlags::VALID;
703 }
704
705 if ( m_xBtnCopyResult->get_active() && bCopyPosOk )
706 {
707 theParam.bInplace = false;
708 theParam.nDestTab = theCopyPos.Tab();
709 theParam.nDestCol = theCopyPos.Col();
710 theParam.nDestRow = theCopyPos.Row();
711 }
712 else
713 {
714 theParam.bInplace = true;
715 theParam.nDestTab = 0;
716 theParam.nDestCol = 0;
717 theParam.nDestRow = 0;
718 }
719
720 theParam.bHasHeader = m_xBtnHeader->get_active();
721 theParam.bByRow = true;
722 theParam.bDuplicate = !m_xBtnUnique->get_active();
723 theParam.bCaseSens = m_xBtnCase->get_active();
725 theParam.bDestPers = m_xBtnDestPers->get_active();
726
727 // only set the three - reset everything else
728
729 pOutItem.reset( new ScQueryItem( nWhichQuery, &theParam ) );
730
731 return pOutItem.get();
732}
733
735{
736 return bRefInputMode;
737}
738
739// Handler:
740
741IMPL_LINK( ScFilterDlg, BtnClearHdl, weld::Button&, rBtn, void )
742{
743 if ( &rBtn != m_xBtnClear.get() )
744 return;
745
746 // scroll to the top
747 m_xScrollBar->vadjustment_set_value(0);
748 size_t nOffset = 0;
749 RefreshEditRow( nOffset);
750
751 // clear all conditions
752 m_xLbConnect1->set_active(-1);
753 m_xLbConnect2->set_active(-1);
754 m_xLbConnect3->set_active(-1);
755 m_xLbConnect4->set_active(-1);
756 m_xLbField1->set_active(0);
757 m_xLbField2->set_active(0);
758 m_xLbField3->set_active(0);
759 m_xLbField4->set_active(0);
760 m_xLbCond1->set_active(0);
761 m_xLbCond2->set_active(0);
762 m_xLbCond3->set_active(0);
763 m_xLbCond4->set_active(0);
764 ClearValueList( 1 );
765 ClearValueList( 2 );
766 ClearValueList( 3 );
767 ClearValueList( 4 );
768
769 // disable fields for second row onward
770 m_xLbConnect2->set_sensitive(false);
771 m_xLbConnect3->set_sensitive(false);
772 m_xLbConnect4->set_sensitive(false);
773 m_xLbField2->set_sensitive(false);
774 m_xLbField3->set_sensitive(false);
775 m_xLbField4->set_sensitive(false);
776 m_xLbCond2->set_sensitive(false);
777 m_xLbCond3->set_sensitive(false);
778 m_xLbCond4->set_sensitive(false);
779 m_xEdVal2->set_sensitive(false);
780 m_xEdVal3->set_sensitive(false);
781 m_xEdVal4->set_sensitive(false);
782 m_xLbColor2->set_sensitive(false);
783 m_xLbColor3->set_sensitive(false);
784 m_xLbColor4->set_sensitive(false);
785 m_xBtnRemove2->set_sensitive(false);
786 m_xBtnRemove3->set_sensitive(false);
787 m_xBtnRemove4->set_sensitive(false);
788
789 // clear query data objects
790 SCSIZE nCount = theQueryData.GetEntryCount();
791 if (maRefreshExceptQuery.size() < nCount + 1)
792 maRefreshExceptQuery.resize(nCount + 1, false);
793 for (SCSIZE i = 0; i < nCount; ++i)
794 {
795 theQueryData.GetEntry(i).bDoQuery = false;
796 maRefreshExceptQuery[i] = false;
797 theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
798 }
799 maRefreshExceptQuery[0] = true;
800}
801
802IMPL_LINK( ScFilterDlg, EndDlgHdl, weld::Button&, rBtn, void )
803{
804 if ( &rBtn == m_xBtnOk.get() )
805 {
806 bool bAreaInputOk = true;
807
808 if ( m_xBtnCopyResult->get_active() )
809 {
810 if ( !pOptionsMgr->VerifyPosStr( m_xEdCopyArea->GetText() ) )
811 {
812 if (!m_xExpander->get_expanded())
813 m_xExpander->set_expanded(true);
814
815 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
816 VclMessageType::Warning, VclButtonsType::Ok,
817 ScResId(STR_INVALID_TABREF)));
818 xBox->run();
819 m_xEdCopyArea->GrabFocus();
820 bAreaInputOk = false;
821 }
822 }
823
824 if ( bAreaInputOk )
825 {
826 SetDispatcherLock( false );
827 SwitchToDocument();
828 GetBindings().GetDispatcher()->ExecuteList(FID_FILTER_OK,
829 SfxCallMode::SLOT | SfxCallMode::RECORD,
830 { GetOutputItem() });
831 response(RET_OK);
832 }
833 }
834 else if ( &rBtn == m_xBtnCancel.get() )
835 {
836 response(RET_CANCEL);
837 }
838}
839
841{
842 if ( m_xExpander->get_expanded() )
843 pTimer->Start();
844 else
845 {
846 pTimer->Stop();
847 bRefInputMode = false;
848 //@BugID 54702 Enable/disable only in Basic class
849 //SFX_APPWINDOW->Disable(FALSE); //! general method in ScAnyRefDlg
850 }
851}
852
853IMPL_LINK( ScFilterDlg, TimeOutHdl, Timer*, _pTimer, void )
854{
855 // Check if RefInputMode is still true every 50ms
856 if (_pTimer == pTimer.get() && m_xDialog->has_toplevel_focus())
857 bRefInputMode = (m_xEdCopyArea->GetWidget()->has_focus() || m_xRbCopyArea->GetWidget()->has_focus());
858
859 if ( m_xExpander->get_expanded() )
860 pTimer->Start();
861}
862
863IMPL_LINK(ScFilterDlg, LbSelectHdl, weld::ComboBox&, rLb, void)
864{
865 /*
866 * Handle enable/disable logic depending on which ListBox was selected
867 */
868 sal_uInt16 nOffset = GetSliderPos();
869
870 if ( &rLb == m_xLbConnect1.get() )
871 {
872 m_xLbField1->set_sensitive(true);
873 m_xLbCond1->set_sensitive(true);
874 m_xEdVal1->set_sensitive(true);
875 m_xBtnRemove1->set_sensitive(true);
876
877 const sal_Int32 nConnect1 = m_xLbConnect1->get_active();
878 size_t nQE = nOffset;
879 theQueryData.GetEntry(nQE).eConnect =static_cast<ScQueryConnect>(nConnect1);
880 if (maRefreshExceptQuery.size() < nQE + 1)
881 maRefreshExceptQuery.resize(nQE + 1, false);
882 maRefreshExceptQuery[nQE] = true;
883 }
884 else if ( &rLb == m_xLbConnect2.get() )
885 {
886 m_xLbField2->set_sensitive(true);
887 m_xLbCond2->set_sensitive(true);
888 m_xEdVal2->set_sensitive(true);
889 m_xBtnRemove2->set_sensitive(true);
890
891 const sal_Int32 nConnect2 = m_xLbConnect2->get_active();
892 size_t nQE = 1+nOffset;
893 theQueryData.GetEntry(nQE).eConnect =static_cast<ScQueryConnect>(nConnect2);
894 if (maRefreshExceptQuery.size() < nQE + 1)
895 maRefreshExceptQuery.resize(nQE + 1, false);
896 maRefreshExceptQuery[nQE]=true;
897 }
898 else if ( &rLb == m_xLbConnect3.get() )
899 {
900 m_xLbField3->set_sensitive(true);
901 m_xLbCond3->set_sensitive(true);
902 m_xEdVal3->set_sensitive(true);
903 m_xBtnRemove3->set_sensitive(true);
904
905 const sal_Int32 nConnect3 = m_xLbConnect3->get_active();
906 size_t nQE = 2 + nOffset;
907 theQueryData.GetEntry(nQE).eConnect = static_cast<ScQueryConnect>(nConnect3);
908 if (maRefreshExceptQuery.size() < nQE + 1)
909 maRefreshExceptQuery.resize(nQE + 1, false);
910 maRefreshExceptQuery[nQE] = true;
911
912 }
913 else if ( &rLb == m_xLbConnect4.get() )
914 {
915 m_xLbField4->set_sensitive(true);
916 m_xLbCond4->set_sensitive(true);
917 m_xEdVal4->set_sensitive(true);
918 m_xLbColor4->set_sensitive(true);
919 m_xBtnRemove4->set_sensitive(true);
920
921 const sal_Int32 nConnect4 = m_xLbConnect4->get_active();
922 size_t nQE = 3 + nOffset;
923 theQueryData.GetEntry(nQE).eConnect = static_cast<ScQueryConnect>(nConnect4);
924 if (maRefreshExceptQuery.size() < nQE + 1)
925 maRefreshExceptQuery.resize(nQE + 1, false);
926 maRefreshExceptQuery[nQE] = true;
927 }
928 else if ( &rLb == m_xLbField1.get() )
929 {
930 if ( m_xLbField1->get_active() == 0 )
931 {
932 m_xLbConnect2->set_active(-1);
933 m_xLbConnect3->set_active(-1);
934 m_xLbConnect4->set_active(-1);
935 m_xLbField2->set_active( 0 );
936 m_xLbField3->set_active( 0 );
937 m_xLbField4->set_active( 0 );
938 m_xLbCond2->set_active( 0 );
939 m_xLbCond3->set_active( 0 );
940 m_xLbCond4->set_active( 0 );
941 ClearValueList( 1 );
942 ClearValueList( 2 );
943 ClearValueList( 3 );
944 ClearValueList( 4 );
945
946 m_xLbConnect2->set_sensitive(false);
947 m_xLbConnect3->set_sensitive(false);
948 m_xLbConnect4->set_sensitive(false);
949 m_xLbField2->set_sensitive(false);
950 m_xLbField3->set_sensitive(false);
951 m_xLbField4->set_sensitive(false);
952 m_xLbCond2->set_sensitive(false);
953 m_xLbCond3->set_sensitive(false);
954 m_xLbCond4->set_sensitive(false);
955 m_xEdVal2->set_sensitive(false);
956 m_xEdVal3->set_sensitive(false);
957 m_xEdVal4->set_sensitive(false);
958 m_xLbColor2->set_sensitive(false);
959 m_xLbColor3->set_sensitive(false);
960 m_xLbColor4->set_sensitive(false);
961 m_xBtnRemove2->set_sensitive(false);
962 m_xBtnRemove3->set_sensitive(false);
963 m_xBtnRemove4->set_sensitive(false);
964 SCSIZE nCount = theQueryData.GetEntryCount();
965 if (maRefreshExceptQuery.size() < nCount + 1)
966 maRefreshExceptQuery.resize(nCount + 1, false);
967 for (SCSIZE i = nOffset; i < nCount; ++i)
968 {
969 theQueryData.GetEntry(i).bDoQuery = false;
970 maRefreshExceptQuery[i] = false;
971 theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
972 }
973 maRefreshExceptQuery[nOffset] = true;
974 }
975 else
976 {
977 UpdateValueList( 1 );
978 UpdateColorList( 1 );
979 if ( !m_xLbConnect2->get_sensitive() )
980 {
981 m_xLbConnect2->set_sensitive(true);
982 }
983 theQueryData.GetEntry(nOffset).bDoQuery = true;
984 const sal_Int32 nField = rLb.get_active();
985 theQueryData.GetEntry(nOffset).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
986 }
987 }
988 else if ( &rLb == m_xLbField2.get() )
989 {
990 if ( m_xLbField2->get_active() == 0 )
991 {
992 m_xLbConnect3->set_active(-1);
993 m_xLbConnect4->set_active(-1);
994 m_xLbField3->set_active( 0 );
995 m_xLbField4->set_active( 0 );
996 m_xLbCond3->set_active( 0 );
997 m_xLbCond4->set_active( 0 );
998 ClearValueList( 2 );
999 ClearValueList( 3 );
1000 ClearValueList( 4 );
1001
1002 m_xLbConnect3->set_sensitive(false);
1003 m_xLbConnect4->set_sensitive(false);
1004 m_xLbField3->set_sensitive(false);
1005 m_xLbField4->set_sensitive(false);
1006 m_xLbCond3->set_sensitive(false);
1007 m_xLbCond4->set_sensitive(false);
1008 m_xEdVal3->set_sensitive(false);
1009 m_xEdVal4->set_sensitive(false);
1010 m_xLbColor3->set_sensitive(false);
1011 m_xLbColor4->set_sensitive(false);
1012 m_xBtnRemove3->set_sensitive(false);
1013 m_xBtnRemove4->set_sensitive(false);
1014
1015 sal_uInt16 nTemp=nOffset+1;
1016 SCSIZE nCount = theQueryData.GetEntryCount();
1017 if (maRefreshExceptQuery.size() < nCount)
1018 maRefreshExceptQuery.resize(nCount, false);
1019 for (SCSIZE i= nTemp; i< nCount; i++)
1020 {
1021 theQueryData.GetEntry(i).bDoQuery = false;
1022 maRefreshExceptQuery[i] = false;
1023 theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
1024 }
1025 maRefreshExceptQuery[nTemp] = true;
1026 }
1027 else
1028 {
1029 UpdateValueList( 2 );
1030 UpdateColorList( 2 );
1031 if ( !m_xLbConnect3->get_sensitive() )
1032 {
1033 m_xLbConnect3->set_sensitive(true);
1034 }
1035 const sal_Int32 nField = rLb.get_active();
1036 sal_uInt16 nQ=1+nOffset;
1037 theQueryData.GetEntry(nQ).bDoQuery = true;
1038 theQueryData.GetEntry(nQ).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
1039 }
1040 }
1041 else if ( &rLb == m_xLbField3.get() )
1042 {
1043 if ( m_xLbField3->get_active() == 0 )
1044 {
1045 m_xLbConnect4->set_active(-1);
1046 m_xLbField4->set_active( 0 );
1047 m_xLbCond4->set_active( 0 );
1048 ClearValueList( 3 );
1049 ClearValueList( 4 );
1050
1051 m_xLbConnect4->set_sensitive(false);
1052 m_xLbField4->set_sensitive(false);
1053 m_xLbCond4->set_sensitive(false);
1054 m_xEdVal4->set_sensitive(false);
1055 m_xLbColor4->set_sensitive(false);
1056 m_xBtnRemove4->set_sensitive(false);
1057
1058 sal_uInt16 nTemp=nOffset+2;
1059 SCSIZE nCount = theQueryData.GetEntryCount();
1060 if (maRefreshExceptQuery.size() < nCount)
1061 maRefreshExceptQuery.resize(nCount, false);
1062 for (SCSIZE i = nTemp; i < nCount; ++i)
1063 {
1064 theQueryData.GetEntry(i).bDoQuery = false;
1065 maRefreshExceptQuery[i] = false;
1066 theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
1067 }
1068 maRefreshExceptQuery[nTemp] = true;
1069 }
1070 else
1071 {
1072 UpdateValueList( 3 );
1073 UpdateColorList( 3 );
1074 if ( !m_xLbConnect4->get_sensitive() )
1075 {
1076 m_xLbConnect4->set_sensitive(true);
1077 }
1078
1079 const sal_Int32 nField = rLb.get_active();
1080 sal_uInt16 nQ=2+nOffset;
1081 theQueryData.GetEntry(nQ).bDoQuery = true;
1082 theQueryData.GetEntry(nQ).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
1083
1084 }
1085 }
1086 else if ( &rLb == m_xLbField4.get() )
1087 {
1088 if ( m_xLbField4->get_active() == 0 )
1089 {
1090 ClearValueList( 4 );
1091 sal_uInt16 nTemp=nOffset+3;
1092 SCSIZE nCount = theQueryData.GetEntryCount();
1093 if (maRefreshExceptQuery.size() < nCount)
1094 maRefreshExceptQuery.resize(nCount, false);
1095 for (SCSIZE i = nTemp; i < nCount; ++i)
1096 {
1097 theQueryData.GetEntry(i).bDoQuery = false;
1098 maRefreshExceptQuery[i] = false;
1099 theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0);
1100 }
1101 maRefreshExceptQuery[nTemp] = true;
1102 }
1103 else
1104 {
1105 UpdateValueList( 4 );
1106 UpdateColorList( 4 );
1107 const sal_Int32 nField = rLb.get_active();
1108 sal_uInt16 nQ=3+nOffset;
1109 theQueryData.GetEntry(nQ).bDoQuery = true;
1110 theQueryData.GetEntry(nQ).nField = theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1 ;
1111 }
1112
1113 }
1114 else if (&rLb == m_xLbCond1.get() || &rLb == m_xLbCond2.get() || &rLb == m_xLbCond3.get()
1115 || &rLb == m_xLbCond4.get())
1116 {
1117 ScQueryOp op;
1118 sal_uInt16 nQ = 0;
1119 bool bEnableColorLb = false;
1120 if (rLb.get_active_text() == aStrTextColor || rLb.get_active_text() == aStrBackgroundColor)
1121 {
1122 bEnableColorLb = true;
1123 op = SC_EQUAL;
1124 }
1125 else
1126 {
1127 op = static_cast<ScQueryOp>(rLb.get_active());
1128 }
1129
1130 if (&rLb == m_xLbCond1.get())
1131 {
1132 nQ = nOffset;
1133 m_xLbColor1->set_visible(bEnableColorLb);
1134 m_xLbColor1->set_sensitive(bEnableColorLb);
1135 m_xEdVal1->set_visible(!bEnableColorLb);
1136 UpdateColorList(1);
1137 }
1138 else if (&rLb == m_xLbCond2.get())
1139 {
1140 nQ = 1 + nOffset;
1141 m_xLbColor2->set_visible(bEnableColorLb);
1142 m_xLbColor2->set_sensitive(bEnableColorLb);
1143 m_xEdVal2->set_visible(!bEnableColorLb);
1144 UpdateColorList(2);
1145 }
1146 else if (&rLb == m_xLbCond3.get())
1147 {
1148 nQ = 2 + nOffset;
1149 m_xLbColor3->set_visible(bEnableColorLb);
1150 m_xLbColor3->set_sensitive(bEnableColorLb);
1151 m_xEdVal3->set_visible(!bEnableColorLb);
1152 UpdateColorList(3);
1153 }
1154 else if (&rLb == m_xLbCond4.get())
1155 {
1156 nQ = 3 + nOffset;
1157 m_xLbColor4->set_visible(bEnableColorLb);
1158 m_xLbColor4->set_sensitive(bEnableColorLb);
1159 m_xEdVal4->set_visible(!bEnableColorLb);
1160 UpdateColorList(4);
1161 }
1162
1163 auto aEntry = theQueryData.GetEntry(nQ);
1164 aEntry.eOp = op;
1165 }
1166 else if (&rLb == m_xLbColor1.get() || &rLb == m_xLbColor2.get() || &rLb == m_xLbColor3.get()
1167 || &rLb == m_xLbColor4.get())
1168 {
1169 sal_uInt16 nQ = 0;
1170 if (&rLb == m_xLbColor1.get())
1171 {
1172 nQ = nOffset;
1173 }
1174 else if (&rLb == m_xLbColor2.get())
1175 {
1176 nQ = 1 + nOffset;
1177 }
1178 else if (&rLb == m_xLbColor3.get())
1179 {
1180 nQ = 2 + nOffset;
1181 }
1182 else if (&rLb == m_xLbColor4.get())
1183 {
1184 nQ = 3 + nOffset;
1185 }
1186
1187 ScQueryEntry& aEntry = theQueryData.GetEntry(nQ);
1188 Color aColor = Color::STRtoRGB(maColorLbArr[nQ]->get_active_id());
1189 if (maCondLbArr[nQ]->get_active_text() == aStrTextColor)
1190 {
1191 aEntry.SetQueryByTextColor(aColor);
1192 }
1193 else if (maCondLbArr[nQ]->get_active_text() == aStrBackgroundColor)
1194 {
1195 aEntry.SetQueryByBackgroundColor(aColor);
1196 }
1197 }
1198}
1199
1200IMPL_LINK( ScFilterDlg, CheckBoxHdl, weld::Toggleable&, rBox, void )
1201{
1202 // Column headers:
1203 // Field list: Columnxx <-> column header string
1204 // Value list: Column header value not applicable.
1205 // Upper/lower case:
1206 // Value list: completely new
1207
1208 if ( &rBox == m_xBtnHeader.get() ) // Field list and value list
1209 {
1210 const sal_Int32 nCurSel1 = m_xLbField1->get_active();
1211 const sal_Int32 nCurSel2 = m_xLbField2->get_active();
1212 const sal_Int32 nCurSel3 = m_xLbField3->get_active();
1213 const sal_Int32 nCurSel4 = m_xLbField4->get_active();
1214 FillFieldLists();
1215 m_xLbField1->set_active( nCurSel1 );
1216 m_xLbField2->set_active( nCurSel2 );
1217 m_xLbField3->set_active( nCurSel3 );
1218 m_xLbField4->set_active( nCurSel4 );
1219
1220 UpdateHdrInValueList( 1 );
1221 UpdateHdrInValueList( 2 );
1222 UpdateHdrInValueList( 3 );
1223 UpdateHdrInValueList( 4 );
1224 }
1225
1226 if ( &rBox != m_xBtnCase.get() ) // Complete value list
1227 return;
1228
1229 m_EntryLists.clear();
1230 UpdateValueList( 1 ); // current text is recorded
1231 UpdateValueList( 2 );
1232 UpdateValueList( 3 );
1233 UpdateValueList( 4 );
1234
1235 UpdateColorList( 1 );
1236 UpdateColorList( 2 );
1237 UpdateColorList( 3 );
1238 UpdateColorList( 4 );
1239}
1240
1241IMPL_LINK( ScFilterDlg, ValModifyHdl, weld::ComboBox&, rEd, void )
1242{
1243 size_t nOffset = GetSliderPos();
1244 size_t i = 0;
1245 size_t nQE = i + nOffset;
1246 OUString aStrVal = rEd.get_active_text();
1247 weld::ComboBox* pLbCond = m_xLbCond1.get();
1248 weld::ComboBox* pLbField = m_xLbField1.get();
1249 if ( &rEd == m_xEdVal2.get() )
1250 {
1251 pLbCond = m_xLbCond2.get();
1252 pLbField = m_xLbField2.get();
1253 i=1;
1254 nQE=i+nOffset;
1255 }
1256 if ( &rEd == m_xEdVal3.get() )
1257 {
1258 pLbCond = m_xLbCond3.get();
1259 pLbField = m_xLbField3.get();
1260 i=2;
1261 nQE=i+nOffset;
1262 }
1263 if ( &rEd == m_xEdVal4.get() )
1264 {
1265 pLbCond = m_xLbCond4.get();
1266 pLbField = m_xLbField4.get();
1267 i=3;
1268 nQE=i+nOffset;
1269 }
1270
1271 if ( aStrEmpty == aStrVal || aStrNotEmpty == aStrVal )
1272 {
1273 pLbCond->set_active_text(OUString('='));
1274 pLbCond->set_sensitive(false);
1275 }
1276 else
1277 pLbCond->set_sensitive(true);
1278
1279 if (maHasDates.size() < nQE + 1)
1280 maHasDates.resize(nQE + 1, false);
1281 if (maRefreshExceptQuery.size() < nQE + 1)
1282 maRefreshExceptQuery.resize(nQE + 1, false);
1283
1284 ScQueryEntry& rEntry = theQueryData.GetEntry( nQE );
1285 ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
1286 bool bDoThis = (pLbField->get_active() != 0);
1287 rEntry.bDoQuery = bDoThis;
1288
1289 if ( !(rEntry.bDoQuery || maRefreshExceptQuery[nQE]) )
1290 return;
1291
1292 bool bByEmptyOrNotByEmpty = false;
1293 if ( aStrEmpty == aStrVal )
1294 {
1295 bByEmptyOrNotByEmpty = true;
1296 rEntry.SetQueryByEmpty();
1297 }
1298 else if ( aStrNotEmpty == aStrVal )
1299 {
1300 bByEmptyOrNotByEmpty = true;
1301 rEntry.SetQueryByNonEmpty();
1302 }
1303 else
1304 {
1305 rItem.maString = pDoc->GetSharedStringPool().intern(aStrVal);
1306 rItem.mfVal = 0.0;
1308 }
1309
1310 const sal_Int32 nField = pLbField->get_active();
1311 rEntry.nField = nField ? (theQueryData.nCol1 +
1312 static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0);
1313
1314 ScQueryOp eOp = static_cast<ScQueryOp>(pLbCond->get_active());
1315 rEntry.eOp = eOp;
1316 if (maHasDates[nQE] && !bByEmptyOrNotByEmpty)
1318}
1319
1320IMPL_LINK( ScFilterDlg, BtnRemoveHdl, weld::Button&, rBtn, void )
1321{
1322 // Calculate the row to delete
1323 sal_uInt16 nOffset = GetSliderPos();
1324 int nButtonIndex = 0;
1325 if ( &rBtn == m_xBtnRemove2.get() )
1326 nButtonIndex = 1;
1327 if ( &rBtn == m_xBtnRemove3.get() )
1328 nButtonIndex = 2;
1329 if ( &rBtn == m_xBtnRemove4.get() )
1330 nButtonIndex = 3;
1331 SCSIZE nRowToDelete = nOffset + nButtonIndex;
1332
1333 // Check that the index is sensible
1334 SCSIZE nCount = theQueryData.GetEntryCount();
1335 if (nRowToDelete >= nCount)
1336 {
1337 SAL_WARN( "sc", "ScFilterDlg::BtnRemoveHdl: could not delete row - invalid index.");
1338 return;
1339 }
1340
1341 // Resize maRefreshExceptQuery
1342 if (maRefreshExceptQuery.size() < nCount + 1)
1343 maRefreshExceptQuery.resize(nCount + 1, false);
1344
1345 // Move all the subsequent rows back one position;
1346 // also find the last row, which we will delete
1347 SCSIZE nRowToClear = nCount-1;
1348 for (SCSIZE i = nRowToDelete; i < nCount-1; ++i)
1349 {
1350 if (theQueryData.GetEntry(i+1).bDoQuery)
1351 {
1352 theQueryData.GetEntry(i) = theQueryData.GetEntry(i+1);
1353 }
1354 else
1355 {
1356 nRowToClear = i;
1357 break;
1358 }
1359 }
1360
1361 // If the next row is being edited, but not confirmed, move it back
1362 // one position
1363 if (nRowToClear < nCount-1 && maRefreshExceptQuery[nRowToClear+1])
1364 {
1365 theQueryData.GetEntry(nRowToClear) = theQueryData.GetEntry(nRowToClear+1);
1366 maRefreshExceptQuery[nRowToClear] = true;
1367 maRefreshExceptQuery[nRowToClear+1] = false;
1368 }
1369 else
1370 {
1371 // Remove the very last one, since everything has moved back
1372 theQueryData.GetEntry(nRowToClear).bDoQuery = false;
1373 theQueryData.GetEntry(nRowToClear).nField = static_cast<SCCOL>(0);
1374 maRefreshExceptQuery[nRowToClear] = false;
1375 }
1376
1377 // Always enable the very first row
1378 if (!theQueryData.GetEntry(0).bDoQuery)
1379 {
1380 maRefreshExceptQuery[0] = true;
1381 }
1382
1383 // Refresh the UI
1384 RefreshEditRow( nOffset );
1385
1386 // Special handling if the very first row was cleared
1387 if (!theQueryData.GetEntry(0).bDoQuery)
1388 {
1389 m_xLbConnect1->set_active(-1);
1390 m_xLbField1->set_active(0);
1391 m_xLbField1->set_sensitive(true);
1392 m_xLbCond1->set_active(0);
1393 m_xLbCond1->set_sensitive(true);
1394 ClearValueList(1);
1395 }
1396}
1397
1399{
1400 SliderMoved();
1401}
1402
1404{
1405 size_t nOffset = GetSliderPos();
1406 RefreshEditRow( nOffset);
1407}
1408
1410{
1411 return static_cast<size_t>(m_xScrollBar->vadjustment_get_value());
1412}
1413
1414void ScFilterDlg::RefreshEditRow( size_t nOffset )
1415{
1416 if (nOffset==0)
1417 maConnLbArr[0]->hide();
1418 else
1419 maConnLbArr[0]->show();
1420
1421 for (size_t i = 0; i < QUERY_ENTRY_COUNT; ++i)
1422 {
1423 OUString aValStr;
1424 size_t nCondPos = 0;
1425 size_t nFieldSelPos = 0;
1426 size_t nQE = i + nOffset;
1427
1428 maColorLbArr[i]->set_visible(false);
1429
1430 if (maRefreshExceptQuery.size() < nQE + 1)
1431 maRefreshExceptQuery.resize(nQE + 1, false);
1432
1433 ScQueryEntry& rEntry = theQueryData.GetEntry( nQE);
1434 if ( rEntry.bDoQuery || maRefreshExceptQuery[nQE] )
1435 {
1436 nCondPos = static_cast<size_t>(rEntry.eOp);
1437 if(rEntry.bDoQuery)
1438 nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) );
1439
1440 const ScQueryEntry::Item& rItem = rEntry.GetQueryItem();
1441 OUString aQueryStr = rItem.maString.getString();
1442 if (rEntry.IsQueryByEmpty())
1443 {
1444 aValStr = aStrEmpty;
1445 maCondLbArr[i]->set_sensitive(false);
1446 }
1447 else if (rEntry.IsQueryByNonEmpty())
1448 {
1449 aValStr = aStrNotEmpty;
1450 maCondLbArr[i]->set_sensitive(false);
1451 }
1452 else if (rEntry.IsQueryByTextColor() || rEntry.IsQueryByBackgroundColor())
1453 {
1454 nCondPos = maCondLbArr[i]->find_text(
1456
1457 maValueEdArr[i]->set_visible(false);
1458 maColorLbArr[i]->set_visible(true);
1459 maColorLbArr[i]->set_sensitive(true);
1460 }
1461 else
1462 {
1463 SetValString(aQueryStr, rItem, aValStr);
1464 maCondLbArr[i]->set_sensitive(true);
1465 }
1466 maFieldLbArr[i]->set_sensitive(true);
1467 maValueEdArr[i]->set_sensitive(true);
1468 maRemoveBtnArr[i]->set_sensitive(true);
1469
1470 if (nOffset==0)
1471 {
1472 if (i<3)
1473 {
1474 if(rEntry.bDoQuery)
1475 maConnLbArr[i+1]->set_sensitive(true);
1476 else
1477 maConnLbArr[i+1]->set_sensitive(false);
1478 size_t nQENext = nQE + 1;
1479 if (maRefreshExceptQuery.size() < nQENext + 1)
1480 maRefreshExceptQuery.resize(nQENext + 1, false);
1481 if (theQueryData.GetEntry(nQENext).bDoQuery || maRefreshExceptQuery[nQENext])
1482 maConnLbArr[i+1]->set_active( static_cast<sal_uInt16>(theQueryData.GetEntry(nQENext).eConnect) );
1483 else
1484 maConnLbArr[i+1]->set_active(-1);
1485 }
1486 }
1487 else
1488 {
1489 if(theQueryData.GetEntry( nQE-1).bDoQuery)
1490 maConnLbArr[i]->set_sensitive(true);
1491 else
1492 maConnLbArr[i]->set_sensitive(false);
1493
1494 if (maRefreshExceptQuery.size() < nQE + 1)
1495 maRefreshExceptQuery.resize(nQE + 1, false);
1496 if(rEntry.bDoQuery || maRefreshExceptQuery[nQE])
1497 maConnLbArr[i]->set_active( static_cast<sal_uInt16>(rEntry.eConnect) );
1498 else
1499 maConnLbArr[i]->set_active(-1);
1500 }
1501
1502 }
1503 else
1504 {
1505 if (nOffset==0)
1506 {
1507 if(i<3)
1508 {
1509 maConnLbArr[i+1]->set_active(-1);
1510 maConnLbArr[i+1]->set_sensitive(false);
1511 }
1512 }
1513 else
1514 {
1515 if(theQueryData.GetEntry( nQE-1).bDoQuery)
1516 maConnLbArr[i]->set_sensitive(true);
1517 else
1518 maConnLbArr[i]->set_sensitive(false);
1519 maConnLbArr[i]->set_active(-1);
1520 }
1521 maFieldLbArr[i]->set_sensitive(false);
1522 maCondLbArr[i]->set_sensitive(false);
1523 maValueEdArr[i]->set_sensitive(false);
1524 maRemoveBtnArr[i]->set_sensitive(false);
1525 }
1526 maFieldLbArr[i]->set_active( nFieldSelPos );
1527 maCondLbArr [i]->set_active( nCondPos );
1528 maValueEdArr[i]->set_entry_text( aValStr );
1529 UpdateValueList(i+1);
1530 UpdateColorList(i+1);
1531 }
1532}
1533
1534void ScFilterDlg::SetValString( const OUString& rQueryStr, const ScQueryEntry::Item& rItem,
1535 OUString& rValStr )
1536{
1537 if (rQueryStr.isEmpty())
1538 {
1539 pDoc = pViewData ? &pViewData->GetDocument() : nullptr;
1540 if (rItem.meType == ScQueryEntry::ByValue)
1541 {
1542 if (pDoc)
1543 {
1544 pDoc->GetFormatTable()->GetInputLineString(rItem.mfVal, 0, rValStr);
1545 }
1546 }
1547 else if (rItem.meType == ScQueryEntry::ByDate)
1548 {
1549 if (pDoc)
1550 {
1551 SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
1552 pFormatter->GetInputLineString(rItem.mfVal,
1553 pFormatter->GetStandardFormat( SvNumFormatType::DATE), rValStr);
1554 }
1555 }
1556 else
1557 {
1558 SAL_WARN( "sc", "ScFilterDlg::SetValString: empty query string, really?");
1559 rValStr = rQueryStr;
1560 }
1561 }
1562 else
1563 {
1564 // XXX NOTE: if not ByString we just assume this has been
1565 // set to a proper string corresponding to the numeric
1566 // value earlier!
1567 rValStr = rQueryStr;
1568 }
1569}
1570
1571/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void ScColToAlpha(OUStringBuffer &rBuf, SCCOL nCol)
append alpha representation of column to buffer
Definition: address.cxx:1884
ScRefFlags
Definition: address.hxx:158
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
Reference< XExecutableDialog > m_xDialog
#define GetWhich(nSlot)
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
static Color STRtoRGB(std::u16string_view colorname)
OUString AsRGBHexString() const
SCTAB Tab() const
Definition: address.hxx:283
SC_DLLPUBLIC void Format(OStringBuffer &r, ScRefFlags nFlags, const ScDocument *pDocument=nullptr, const Details &rDetails=detailsOOOa1) const
Definition: address.cxx:2074
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1537
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
void CancelAutoDBRange()
Definition: docsh5.cxx:368
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:500
SC_DLLPUBLIC void GetFilterEntriesArea(SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bCaseSens, ScFilterEntries &rFilterEntries)
Entries for Filter dialog.
Definition: documen3.cxx:1619
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:461
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
Definition: document.cxx:3544
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2487
std::unique_ptr< formula::RefButton > m_xRbCopyArea
Definition: filtdlg.hxx:144
ScDocument * pDoc
Definition: filtdlg.hxx:82
std::unique_ptr< weld::Label > m_xFtDbAreaLabel
Definition: filtdlg.hxx:146
std::unique_ptr< weld::Expander > m_xExpander
Definition: filtdlg.hxx:131
std::unique_ptr< weld::Label > m_xFtDbArea
Definition: filtdlg.hxx:147
std::unique_ptr< weld::Button > m_xBtnClear
Definition: filtdlg.hxx:133
ScQueryParam theQueryData
Definition: filtdlg.hxx:79
ScViewData * pViewData
Definition: filtdlg.hxx:81
std::unique_ptr< weld::CheckButton > m_xBtnRegExp
Definition: filtdlg.hxx:138
std::unique_ptr< weld::ComboBox > m_xLbField4
Definition: filtdlg.hxx:123
std::unique_ptr< weld::ComboBox > m_xLbCond3
Definition: filtdlg.hxx:117
void UpdateHdrInValueList(size_t nList)
Definition: filtdlg.cxx:573
std::unique_ptr< weld::Button > m_xBtnRemove2
Definition: filtdlg.hxx:113
std::unique_ptr< weld::Button > m_xBtnOk
Definition: filtdlg.hxx:134
std::unique_ptr< ScFilterOptionsMgr > pOptionsMgr
Definition: filtdlg.hxx:76
std::vector< weld::ComboBox * > maValueEdArr
Definition: filtdlg.hxx:85
void Init(const SfxItemSet &rArgSet)
Definition: filtdlg.cxx:164
std::unique_ptr< weld::ComboBox > m_xLbColor4
Definition: filtdlg.hxx:126
virtual ~ScFilterDlg() override
Definition: filtdlg.cxx:127
std::unique_ptr< weld::ComboBox > m_xEdVal4
Definition: filtdlg.hxx:125
std::unique_ptr< weld::CheckButton > m_xBtnCase
Definition: filtdlg.hxx:137
virtual void SetActive() override
Definition: filtdlg.cxx:429
std::unique_ptr< weld::ComboBox > m_xLbColor3
Definition: filtdlg.hxx:119
std::unique_ptr< weld::ComboBox > m_xLbField2
Definition: filtdlg.hxx:109
std::unique_ptr< weld::ComboBox > m_xLbCopyArea
Definition: filtdlg.hxx:142
void SetValString(const OUString &rQueryStr, const ScQueryEntry::Item &rItem, OUString &rValStr)
Definition: filtdlg.cxx:1534
bool bRefInputMode
Definition: filtdlg.hxx:94
std::unique_ptr< weld::CheckButton > m_xBtnHeader
Definition: filtdlg.hxx:139
const OUString aStrNone
Definition: filtdlg.hxx:68
std::unique_ptr< weld::ComboBox > m_xLbConnect4
Definition: filtdlg.hxx:122
virtual bool IsRefInputMode() const override
Definition: filtdlg.cxx:734
std::vector< weld::ComboBox * > maConnLbArr
Definition: filtdlg.hxx:88
std::unique_ptr< weld::ComboBox > m_xLbConnect3
Definition: filtdlg.hxx:115
const OUString aStrEmpty
Definition: filtdlg.hxx:70
void RefreshEditRow(size_t nOffset)
Definition: filtdlg.cxx:1414
std::unique_ptr< weld::ComboBox > m_xLbCond4
Definition: filtdlg.hxx:124
std::unique_ptr< weld::ComboBox > m_xLbConnect2
Definition: filtdlg.hxx:108
std::deque< bool > maRefreshExceptQuery
Definition: filtdlg.hxx:93
EntryListsMap m_EntryLists
Definition: filtdlg.hxx:96
std::vector< weld::Button * > maRemoveBtnArr
Definition: filtdlg.hxx:90
const OUString aStrNotEmpty
Definition: filtdlg.hxx:71
std::unique_ptr< weld::CheckButton > m_xBtnCopyResult
Definition: filtdlg.hxx:141
size_t GetSliderPos() const
Definition: filtdlg.cxx:1409
ScQueryItem * GetOutputItem()
Definition: filtdlg.cxx:692
SCTAB nSrcTab
Definition: filtdlg.hxx:83
virtual void Close() override
Definition: filtdlg.cxx:407
std::unique_ptr< weld::ComboBox > m_xEdVal3
Definition: filtdlg.hxx:118
const OUString aStrBackgroundColor
Definition: filtdlg.hxx:74
std::unique_ptr< weld::Widget > m_xContents
Definition: filtdlg.hxx:129
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: filtdlg.hxx:135
std::unique_ptr< Timer > pTimer
Definition: filtdlg.hxx:99
std::unique_ptr< weld::ComboBox > m_xLbColor1
Definition: filtdlg.hxx:105
std::unique_ptr< weld::ComboBox > m_xLbColor2
Definition: filtdlg.hxx:112
std::unique_ptr< weld::CheckButton > m_xBtnDestPers
Definition: filtdlg.hxx:145
void UpdateColorList(size_t nList)
Definition: filtdlg.cxx:631
std::unique_ptr< weld::Button > m_xBtnRemove1
Definition: filtdlg.hxx:106
const OUString aStrColumn
Definition: filtdlg.hxx:72
std::vector< weld::ComboBox * > maColorLbArr
Definition: filtdlg.hxx:89
std::unique_ptr< ScQueryItem > pOutItem
Definition: filtdlg.hxx:80
const OUString aStrUndefined
Definition: filtdlg.hxx:67
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
Definition: filtdlg.cxx:418
void UpdateValueList(size_t nList)
Definition: filtdlg.cxx:487
std::unique_ptr< formula::RefEdit > m_xEdCopyArea
Definition: filtdlg.hxx:143
std::unique_ptr< weld::ComboBox > m_xEdVal2
Definition: filtdlg.hxx:111
std::unique_ptr< weld::ComboBox > m_xLbField1
Definition: filtdlg.hxx:102
std::vector< weld::ComboBox * > maFieldLbArr
Definition: filtdlg.hxx:86
std::unique_ptr< weld::ComboBox > m_xLbConnect1
Definition: filtdlg.hxx:101
std::unique_ptr< weld::Button > m_xBtnRemove4
Definition: filtdlg.hxx:127
const sal_uInt16 nWhichQuery
Definition: filtdlg.hxx:78
std::unique_ptr< weld::ComboBox > m_xLbCond2
Definition: filtdlg.hxx:110
ScFilterDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, const SfxItemSet &rArgSet)
Definition: filtdlg.cxx:53
std::vector< weld::ComboBox * > maCondLbArr
Definition: filtdlg.hxx:87
std::deque< bool > maHasDates
Definition: filtdlg.hxx:92
const OUString aStrTextColor
Definition: filtdlg.hxx:73
void ClearValueList(size_t nList)
Definition: filtdlg.cxx:619
void SliderMoved()
Definition: filtdlg.cxx:1403
size_t GetFieldSelPos(SCCOL nField)
Definition: filtdlg.cxx:684
std::unique_ptr< weld::ScrolledWindow > m_xScrollBar
Definition: filtdlg.hxx:130
std::unique_ptr< weld::ComboBox > m_xLbField3
Definition: filtdlg.hxx:116
std::unique_ptr< weld::CheckButton > m_xBtnUnique
Definition: filtdlg.hxx:140
std::unique_ptr< weld::ComboBox > m_xEdVal1
Definition: filtdlg.hxx:104
std::unique_ptr< weld::ComboBox > m_xLbCond1
Definition: filtdlg.hxx:103
std::unique_ptr< weld::Button > m_xBtnRemove3
Definition: filtdlg.hxx:120
void FillFieldLists()
Definition: filtdlg.cxx:442
static SC_DLLPUBLIC OUString ReplaceOrAppend(const OUString &rString, std::u16string_view rPlaceholder, const OUString &rReplacement)
Replaces the first occurrence of rPlaceholder in rString with rReplacement, or if rPlaceholder is not...
Definition: global.cxx:1145
ScViewData * GetViewData() const
Definition: uiitems.hxx:162
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
Definition: anyrefdg.cxx:749
virtual void RefInputDone(bool bForced=false) override
Definition: anyrefdg.cxx:779
bool DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:718
const OUString & GetString() const
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
SCCOL GetCurX() const
Definition: viewdata.hxx:401
SfxDispatcher * GetDispatcher() const
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Size & GetListBoxPreviewDefaultPixelSize() const
sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge=LANGUAGE_DONTKNOW)
void GetInputLineString(const double &fOutNumber, sal_uInt32 nFIndex, OUString &rOutString, bool bFiltering=false, bool bForceSystemLocale=false)
reference_type * get() const
const OUString & getString() const
virtual OUString get_active_text() const=0
virtual void clear()=0
virtual void insert_vector(const std::vector< weld::ComboBoxEntry > &rItems, bool bKeepExisting)=0
virtual void set_entry_text(const OUString &rStr)=0
virtual OUString get_text(int pos) const=0
void append_text(const OUString &rStr)
void insert_text(int pos, const OUString &rStr)
virtual void remove(int pos)=0
virtual int get_active() const=0
virtual int get_count() const=0
void set_active_text(const OUString &rStr)
virtual void set_sensitive(bool sensitive)=0
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
virtual SfxBindings & GetBindings() override
float u
ScXMLEditAttributeMap::Entry const aEntries[]
IMPL_LINK(ScFilterDlg, BtnClearHdl, weld::Button &, rBtn, void)
Definition: filtdlg.cxx:741
IMPL_LINK_NOARG(ScFilterDlg, MoreExpandedHdl, weld::Expander &, void)
Definition: filtdlg.cxx:840
#define QUERY_ENTRY_COUNT
Definition: filtdlg.cxx:47
#define INVALID_HEADER_POS
Definition: filtdlg.cxx:48
ScQueryConnect
Definition: global.hxx:853
ScQueryOp
Definition: global.hxx:833
@ SC_EQUAL
Definition: global.hxx:834
sal_uInt16 nPos
#define SAL_WARN(area, stream)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
int i
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
ScFilterEntries maFilterEntries
Definition: filtdlg.hxx:42
std::set< Color > & getTextColors()
std::set< Color > & getBackgroundColors()
ScTypedStrData & front()
void push_back(const ScTypedStrData &r)
bool empty() const
std::vector< ScTypedStrData >::iterator begin()
std::vector< ScTypedStrData >::iterator end()
svl::SharedString maString
Definition: queryentry.hxx:49
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:34
void SetQueryByBackgroundColor(Color color)
Definition: queryentry.cxx:142
SCCOLROW nField
Definition: queryentry.hxx:61
bool IsQueryByNonEmpty() const
Definition: queryentry.cxx:109
const Item & GetQueryItem() const
Definition: queryentry.hxx:85
void SetQueryByNonEmpty()
Definition: queryentry.cxx:99
ScQueryConnect eConnect
Definition: queryentry.hxx:63
bool IsQueryByTextColor() const
Definition: queryentry.cxx:132
void SetQueryByTextColor(Color color)
Definition: queryentry.cxx:121
bool IsQueryByEmpty() const
Definition: queryentry.cxx:87
ScQueryOp eOp
Definition: queryentry.hxx:62
void SetQueryByEmpty()
Definition: queryentry.cxx:77
bool IsQueryByBackgroundColor() const
Definition: queryentry.cxx:153
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
Definition: queryparam.cxx:116
utl::SearchParam::SearchType eSearchType
Definition: queryparam.hxx:43
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
OUString sId
RET_OK
RET_CANCEL