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