LibreOffice Module sc (master)  1
validate.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 #ifdef SC_DLLIMPLEMENTATION
21 #undef SC_DLLIMPLEMENTATION
22 #endif
23 
24 #include <com/sun/star/sheet/TableValidationVisibility.hpp>
25 #include <comphelper/string.hxx>
26 #include <svl/stritem.hxx>
27 #include <svl/eitem.hxx>
28 #include <svl/intitem.hxx>
29 #include <sfx2/app.hxx>
30 #include <o3tl/string_view.hxx>
31 
32 #include <scresid.hxx>
33 #include <strings.hrc>
34 
35 #include <stringutil.hxx>
36 #include <validat.hxx>
37 #include <validate.hxx>
38 #include <compiler.hxx>
39 #include <formula/opcode.hxx>
40 
41 // cell range picker
42 #include <tabvwsh.hxx>
43 #include <sfx2/viewfrm.hxx>
44 #include <sfx2/childwin.hxx>
45 #include <reffact.hxx>
46 #include <comphelper/lok.hxx>
47 
48 
49 #define IS_MOBILE (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone())
50 
51 /* Position indexes for "Allow" list box.
52  They do not map directly to ScValidationMode and can safely be modified to
53  change the order of the list box entries. */
54 #define SC_VALIDDLG_ALLOW_ANY 0
55 #define SC_VALIDDLG_ALLOW_WHOLE 1
56 #define SC_VALIDDLG_ALLOW_DECIMAL 2
57 #define SC_VALIDDLG_ALLOW_DATE 3
58 #define SC_VALIDDLG_ALLOW_TIME 4
59 #define SC_VALIDDLG_ALLOW_RANGE 5
60 #define SC_VALIDDLG_ALLOW_LIST 6
61 #define SC_VALIDDLG_ALLOW_TEXTLEN 7
62 #define SC_VALIDDLG_ALLOW_CUSTOM 8
63 
64 /* Position indexes for "Data" list box.
65  They do not map directly to ScConditionMode and can safely be modified to
66  change the order of the list box entries. */
67 #define SC_VALIDDLG_DATA_EQUAL 0
68 #define SC_VALIDDLG_DATA_LESS 1
69 #define SC_VALIDDLG_DATA_GREATER 2
70 #define SC_VALIDDLG_DATA_EQLESS 3
71 #define SC_VALIDDLG_DATA_EQGREATER 4
72 #define SC_VALIDDLG_DATA_NOTEQUAL 5
73 #define SC_VALIDDLG_DATA_VALIDRANGE 6
74 #define SC_VALIDDLG_DATA_INVALIDRANGE 7
75 #define SC_VALIDDLG_DATA_DIRECT 8
76 
77 namespace ValidListType = css::sheet::TableValidationVisibility;
78 
80  FID_VALID_LISTTYPE, FID_VALID_LISTTYPE,
81  FID_VALID_MODE, FID_VALID_ERRTEXT
82 >);
83 
85  ScTabViewShell *pTabViewSh)
86  : ScValidationDlgBase(pParent,
87  "modules/scalc/ui/validationdialog.ui", "ValidationDialog", pArgSet, nullptr)
88  , m_pTabVwSh(pTabViewSh)
89  , m_sValuePageId("criteria")
90  , m_bOwnRefHdlr(false)
91  , m_bRefInputting(false)
92  , m_xHBox(m_xBuilder->weld_container("refinputbox"))
93 {
95  AddTabPage("inputhelp", ScTPValidationHelp::Create, nullptr);
96  AddTabPage("erroralert", ScTPValidationError::Create, nullptr);
97 
98  if (IS_MOBILE)
99  {
100  m_xBuilder->weld_button("cancel")->hide();
101  m_xBuilder->weld_button("help")->hide();
102  }
103 }
104 
105 void ScValidationDlg::EndDialog(int nResponse)
106 {
107  // tdf#137215 ensure original modality of true is restored before dialog loop ends
108  if (m_bOwnRefHdlr)
109  RemoveRefDlg(true);
111 }
112 
114 {
115  if (m_bOwnRefHdlr)
116  RemoveRefDlg(false);
117 }
118 
119 void ScTPValidationValue::SetReferenceHdl( const ScRange&rRange , const ScDocument& rDoc )
120 {
121  if ( rRange.aStart != rRange.aEnd )
122  if ( ScValidationDlg *pValidationDlg = GetValidationDlg() )
123  if( m_pRefEdit )
124  pValidationDlg->RefInputStart( m_pRefEdit );
125 
126  if ( m_pRefEdit )
127  {
128  OUString aStr(rRange.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
129  m_pRefEdit->SetRefString( aStr );
130  }
131 }
132 
134 {
135  if ( m_pRefEdit ) m_pRefEdit->GrabFocus();
136 
137  if ( ScValidationDlg *pValidationDlg = GetValidationDlg() )
138  if( m_pRefEdit )
139  {
140  pValidationDlg->RefInputDone();
141  }
142 }
143 
145 {
146  ScValidationDlg *pValidationDlg = GetValidationDlg();
147  if (!pValidationDlg)
148  return;
149 
150  weld::Container* pNewParent = pValidationDlg->get_refinput_shrink_parent();
151  if (pEdit == m_pRefEdit && pNewParent != m_pRefEditParent)
152  {
153  m_xRefGrid->move(m_pRefEdit->GetWidget(), pNewParent);
154  m_pRefEditParent = pNewParent;
155  }
156 
157  if (pNewParent != m_pBtnRefParent)
158  {
159  // if Edit SetParent but button not, the tab order will be
160  // incorrect, so move button anyway, and restore
161  // parent later in order to restore the tab order. But
162  // hide it if it's moved but unwanted.
163  m_xRefGrid->move(m_xBtnRef->GetWidget(), pNewParent);
164  m_xBtnRef->GetWidget()->set_visible(pButton == m_xBtnRef.get());
165  m_pBtnRefParent = pNewParent;
166  }
167 
168  pNewParent->show();
169 }
170 
172 {
173  if (ScValidationDlg *pValidationDlg = GetValidationDlg())
174  {
175  weld::Container* pOldParent = pValidationDlg->get_refinput_shrink_parent();
176 
177  if (m_pRefEdit && m_pRefEditParent != m_xRefGrid.get())
178  {
179  pOldParent->move(m_pRefEdit->GetWidget(), m_xRefGrid.get());
181  }
182 
183  if (m_pBtnRefParent != m_xRefGrid.get())
184  {
185  pOldParent->move(m_xBtnRef->GetWidget(), m_xRefGrid.get());
186  m_xBtnRef->GetWidget()->show();
187  m_pBtnRefParent = m_xRefGrid.get();
188  }
189 
190  pOldParent->hide();
191  ScViewData& rViewData = pValidationDlg->GetTabViewShell()->GetViewData();
192  SCTAB nCurTab = rViewData.GetTabNo();
193  SCTAB nRefTab = rViewData.GetRefTabNo();
194  // If RefInput switched to a different sheet from the data sheet,
195  // switch back: fdo#53920
196  if ( nCurTab != nRefTab )
197  {
198  rViewData.GetViewShell()->SetTabNo( nRefTab );
199  }
200  }
201 
204 }
205 
206 namespace {
207 
209 sal_uInt16 lclGetPosFromValMode( ScValidationMode eValMode )
210 {
211  sal_uInt16 nLbPos = SC_VALIDDLG_ALLOW_ANY;
212  switch( eValMode )
213  {
214  case SC_VALID_ANY: nLbPos = SC_VALIDDLG_ALLOW_ANY; break;
215  case SC_VALID_WHOLE: nLbPos = SC_VALIDDLG_ALLOW_WHOLE; break;
216  case SC_VALID_DECIMAL: nLbPos = SC_VALIDDLG_ALLOW_DECIMAL; break;
217  case SC_VALID_DATE: nLbPos = SC_VALIDDLG_ALLOW_DATE; break;
218  case SC_VALID_TIME: nLbPos = SC_VALIDDLG_ALLOW_TIME; break;
219  case SC_VALID_TEXTLEN: nLbPos = SC_VALIDDLG_ALLOW_TEXTLEN; break;
220  case SC_VALID_LIST: nLbPos = SC_VALIDDLG_ALLOW_RANGE; break;
221  case SC_VALID_CUSTOM: nLbPos = SC_VALIDDLG_ALLOW_CUSTOM; break;
222  default: OSL_FAIL( "lclGetPosFromValMode - unknown validity mode" );
223  }
224  return nLbPos;
225 }
226 
228 ScValidationMode lclGetValModeFromPos( sal_uInt16 nLbPos )
229 {
230  ScValidationMode eValMode = SC_VALID_ANY;
231  switch( nLbPos )
232  {
233  case SC_VALIDDLG_ALLOW_ANY: eValMode = SC_VALID_ANY; break;
234  case SC_VALIDDLG_ALLOW_WHOLE: eValMode = SC_VALID_WHOLE; break;
235  case SC_VALIDDLG_ALLOW_DECIMAL: eValMode = SC_VALID_DECIMAL; break;
236  case SC_VALIDDLG_ALLOW_DATE: eValMode = SC_VALID_DATE; break;
237  case SC_VALIDDLG_ALLOW_TIME: eValMode = SC_VALID_TIME; break;
238  case SC_VALIDDLG_ALLOW_RANGE: eValMode = SC_VALID_LIST; break;
239  case SC_VALIDDLG_ALLOW_LIST: eValMode = SC_VALID_LIST; break;
240  case SC_VALIDDLG_ALLOW_TEXTLEN: eValMode = SC_VALID_TEXTLEN; break;
241  case SC_VALIDDLG_ALLOW_CUSTOM: eValMode = SC_VALID_CUSTOM; break;
242  default: OSL_FAIL( "lclGetValModeFromPos - invalid list box position" );
243  }
244  return eValMode;
245 }
246 
248 sal_uInt16 lclGetPosFromCondMode( ScConditionMode eCondMode )
249 {
250  sal_uInt16 nLbPos = SC_VALIDDLG_DATA_EQUAL;
251  switch( eCondMode )
252  {
253  case ScConditionMode::NONE: // may occur in old XML files after Excel import
254  case ScConditionMode::Equal: nLbPos = SC_VALIDDLG_DATA_EQUAL; break;
255  case ScConditionMode::Less: nLbPos = SC_VALIDDLG_DATA_LESS; break;
257  case ScConditionMode::EqLess: nLbPos = SC_VALIDDLG_DATA_EQLESS; break;
262  case ScConditionMode::Direct: nLbPos = SC_VALIDDLG_DATA_DIRECT; break;
263  default: OSL_FAIL( "lclGetPosFromCondMode - unknown condition mode" );
264  }
265  return nLbPos;
266 }
267 
269 ScConditionMode lclGetCondModeFromPos( sal_uInt16 nLbPos )
270 {
272  switch( nLbPos )
273  {
274  case SC_VALIDDLG_DATA_EQUAL: eCondMode = ScConditionMode::Equal; break;
275  case SC_VALIDDLG_DATA_LESS: eCondMode = ScConditionMode::Less; break;
276  case SC_VALIDDLG_DATA_GREATER: eCondMode = ScConditionMode::Greater; break;
277  case SC_VALIDDLG_DATA_EQLESS: eCondMode = ScConditionMode::EqLess; break;
279  case SC_VALIDDLG_DATA_NOTEQUAL: eCondMode = ScConditionMode::NotEqual; break;
280  case SC_VALIDDLG_DATA_VALIDRANGE: eCondMode = ScConditionMode::Between; break;
282  case SC_VALIDDLG_DATA_DIRECT: eCondMode = ScConditionMode::Direct; break;
283  default: OSL_FAIL( "lclGetCondModeFromPos - invalid list box position" );
284  }
285  return eCondMode;
286 }
287 
292 void lclGetFormulaFromStringList( OUString& rFmlaStr, std::u16string_view rStringList, sal_Unicode cFmlaSep )
293 {
294  rFmlaStr.clear();
295  if (!rStringList.empty())
296  {
297  sal_Int32 nIdx {0};
298  do
299  {
300  OUString aToken {o3tl::getToken(rStringList, 0, '\n', nIdx )};
301  ScGlobal::AddQuotes( aToken, '"' );
302  rFmlaStr = ScGlobal::addToken(rFmlaStr, aToken, cFmlaSep);
303  }
304  while (nIdx>0);
305  }
306  if( rFmlaStr.isEmpty() )
307  rFmlaStr = "\"\"";
308 }
309 
315 bool lclGetStringListFromFormula( OUString& rStringList, const OUString& rFmlaStr, sal_Unicode cFmlaSep )
316 {
317  static const OUStringLiteral aQuotes( u"\"\"" );
318 
319  rStringList.clear();
320  bool bIsStringList = !rFmlaStr.isEmpty();
321  bool bTokenAdded = false;
322 
323  for ( sal_Int32 nStringIx = 0; bIsStringList && nStringIx>=0; )
324  {
325  OUString aToken( ScStringUtil::GetQuotedToken(rFmlaStr, 0, aQuotes, cFmlaSep, nStringIx ) );
326  aToken = comphelper::string::strip(aToken, ' ');
327  if( !aToken.isEmpty() ) // ignore empty tokens, i.e. "a";;"b"
328  {
329  bIsStringList = ScGlobal::IsQuoted( aToken, '"' );
330  if( bIsStringList )
331  {
332  ScGlobal::EraseQuotes( aToken, '"' );
333  rStringList = ScGlobal::addToken(rStringList, aToken, '\n', 1, bTokenAdded);
334  bTokenAdded = true;
335  }
336  }
337  }
338 
339  return bIsStringList;
340 }
341 
342 } // namespace
343 
345  : SfxTabPage(pPage, pController, "modules/scalc/ui/validationcriteriapage.ui",
346  "ValidationCriteriaPage", &rArgSet)
347  , maStrMin(ScResId(SCSTR_VALID_MINIMUM))
348  , maStrMax(ScResId(SCSTR_VALID_MAXIMUM))
349  , maStrValue(ScResId(SCSTR_VALID_VALUE))
350  , maStrFormula(ScResId(SCSTR_VALID_FORMULA))
351  , maStrRange(ScResId(SCSTR_VALID_RANGE))
352  , maStrList(ScResId(SCSTR_VALID_LIST))
353  , m_pRefEdit(nullptr)
354  , m_xLbAllow(m_xBuilder->weld_combo_box("allow"))
355  , m_xCbAllow(m_xBuilder->weld_check_button("allowempty"))
356  , m_xCbShow(m_xBuilder->weld_check_button("showlist"))
357  , m_xCbSort(m_xBuilder->weld_check_button("sortascend"))
358  , m_xFtValue(m_xBuilder->weld_label("valueft"))
359  , m_xLbValue(m_xBuilder->weld_combo_box("data"))
360  , m_xFtMin(m_xBuilder->weld_label("minft"))
361  , m_xMinGrid(m_xBuilder->weld_widget("mingrid"))
362  , m_xEdMin(new formula::RefEdit(m_xBuilder->weld_entry("min")))
363  , m_xEdList(m_xBuilder->weld_text_view("minlist"))
364  , m_xFtMax(m_xBuilder->weld_label("maxft"))
365  , m_xEdMax(new formula::RefEdit(m_xBuilder->weld_entry("max")))
366  , m_xFtHint(m_xBuilder->weld_label("hintft"))
367  , m_xBtnRef(new formula::RefButton(m_xBuilder->weld_button("validref")))
368  , m_xRefGrid(m_xBuilder->weld_container("refgrid"))
369  , m_pRefEditParent(m_xRefGrid.get())
370  , m_pBtnRefParent(m_xRefGrid.get())
371 {
372  m_xEdMin->SetReferences(nullptr, m_xFtMin.get());
373 
374  Size aSize(m_xEdList->get_approximate_digit_width() * 40,
375  m_xEdList->get_height_rows(10));
376  m_xEdList->set_size_request(aSize.Width(), aSize.Height());
377  m_xEdMax->SetReferences(nullptr, m_xFtMax.get());
378 
379  m_xBtnRef->SetClickHdl(LINK(this, ScTPValidationValue, ClickHdl));
380 
381  //lock in the max size initial config
382  aSize = m_xContainer->get_preferred_size();
383  m_xContainer->set_size_request(aSize.Width(), aSize.Height());
384 
385  Init();
386 
387  // list separator in formulas
388  OUString aListSep = ::ScCompiler::GetNativeSymbol( ocSep );
389  OSL_ENSURE( aListSep.getLength() == 1, "ScTPValidationValue::ScTPValidationValue - list separator error" );
390  mcFmlaSep = aListSep.getLength() ? aListSep[0] : ';';
391  m_xBtnRef->GetWidget()->hide(); // cell range picker
392 }
393 
395 {
396  m_xEdMin.reset();
397  m_xEdMax.reset();
398  m_xBtnRef.reset();
399 }
400 
402 {
403  m_xLbAllow->connect_changed( LINK( this, ScTPValidationValue, SelectHdl ) );
404  m_xLbValue->connect_changed( LINK( this, ScTPValidationValue, SelectHdl ) );
405  m_xCbShow->connect_toggled( LINK( this, ScTPValidationValue, CheckHdl ) );
406 
407  // cell range picker
408  m_xEdMin->SetGetFocusHdl( LINK( this, ScTPValidationValue, EditSetFocusHdl ) );
409  m_xEdMin->SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillEditFocusHdl ) );
410  m_xEdMax->SetGetFocusHdl( LINK( this, ScTPValidationValue, EditSetFocusHdl ) );
411  m_xEdMax->SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillEditFocusHdl ) );
412  m_xBtnRef->SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillButtonFocusHdl ) );
413 
414  m_xLbAllow->set_active( SC_VALIDDLG_ALLOW_ANY );
415  m_xLbValue->set_active( SC_VALIDDLG_DATA_EQUAL );
416 
417  SelectHdl( *m_xLbAllow );
418  CheckHdl( *m_xCbShow );
419 }
420 
421 std::unique_ptr<SfxTabPage> ScTPValidationValue::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rArgSet)
422 {
423  return std::make_unique<ScTPValidationValue>(pPage, pController, *rArgSet);
424 }
425 
427 {
428  sal_uInt16 nLbPos = SC_VALIDDLG_ALLOW_ANY;
429  if( const SfxUInt16Item* pItem = rArgSet->GetItemIfSet( FID_VALID_MODE ) )
430  nLbPos = lclGetPosFromValMode( static_cast< ScValidationMode >( pItem->GetValue() ) );
431  m_xLbAllow->set_active( nLbPos );
432 
433  nLbPos = SC_VALIDDLG_DATA_EQUAL;
434  if( const SfxUInt16Item* pItem = rArgSet->GetItemIfSet( FID_VALID_CONDMODE ) )
435  nLbPos = lclGetPosFromCondMode( static_cast< ScConditionMode >( pItem->GetValue() ) );
436  m_xLbValue->set_active( nLbPos );
437 
438  // *** check boxes ***
439  bool bCheck = true;
440  if( const SfxBoolItem* pItem = rArgSet->GetItemIfSet( FID_VALID_BLANK ) )
441  bCheck = pItem->GetValue();
442  m_xCbAllow->set_active( bCheck );
443 
444  sal_Int32 nListType = ValidListType::UNSORTED;
445  if( const SfxInt16Item* pItem = rArgSet->GetItemIfSet( FID_VALID_LISTTYPE ) )
446  nListType = pItem->GetValue();
447  m_xCbShow->set_active( nListType != ValidListType::INVISIBLE );
448  m_xCbSort->set_active( nListType == ValidListType::SORTEDASCENDING );
449 
450  // *** formulas ***
451  OUString aFmlaStr;
452  if ( const SfxStringItem* pItem = rArgSet->GetItemIfSet( FID_VALID_VALUE1 ) )
453  aFmlaStr = pItem->GetValue();
454  SetFirstFormula( aFmlaStr );
455 
456  aFmlaStr.clear();
457  if ( const SfxStringItem* pItem = rArgSet->GetItemIfSet( FID_VALID_VALUE2 ) )
458  aFmlaStr = pItem->GetValue();
459  SetSecondFormula( aFmlaStr );
460 
461  SelectHdl( *m_xLbAllow );
462  CheckHdl( *m_xCbShow );
463 }
464 
466 {
467  sal_Int16 nListType = m_xCbShow->get_active() ?
468  (m_xCbSort->get_active() ? ValidListType::SORTEDASCENDING : ValidListType::UNSORTED) :
469  ValidListType::INVISIBLE;
470 
471  const sal_Int32 nLbPos = m_xLbAllow->get_active();
472  bool bCustom = (nLbPos == SC_VALIDDLG_ALLOW_CUSTOM);
473  ScConditionMode eCondMode = bCustom ?
474  ScConditionMode::Direct : lclGetCondModeFromPos( m_xLbValue->get_active() );
475 
476  rArgSet->Put( SfxUInt16Item( FID_VALID_MODE, sal::static_int_cast<sal_uInt16>(
477  lclGetValModeFromPos( nLbPos ) ) ) );
478  rArgSet->Put( SfxUInt16Item( FID_VALID_CONDMODE, sal::static_int_cast<sal_uInt16>( eCondMode ) ) );
479  rArgSet->Put( SfxStringItem( FID_VALID_VALUE1, GetFirstFormula() ) );
480  rArgSet->Put( SfxStringItem( FID_VALID_VALUE2, GetSecondFormula() ) );
481  rArgSet->Put( SfxBoolItem( FID_VALID_BLANK, m_xCbAllow->get_active() ) );
482  rArgSet->Put( SfxInt16Item( FID_VALID_LISTTYPE, nListType ) );
483  return true;
484 }
485 
487 {
488  OUString aFmlaStr;
489  if( m_xLbAllow->get_active() == SC_VALIDDLG_ALLOW_LIST )
490  lclGetFormulaFromStringList( aFmlaStr, m_xEdList->get_text(), mcFmlaSep );
491  else
492  aFmlaStr = m_xEdMin->GetText();
493  return aFmlaStr;
494 }
495 
497 {
498  return m_xEdMax->GetText();
499 }
500 
501 void ScTPValidationValue::SetFirstFormula( const OUString& rFmlaStr )
502 {
503  // try if formula is a string list, validation mode must already be set
504  OUString aStringList;
505  if( (m_xLbAllow->get_active() == SC_VALIDDLG_ALLOW_RANGE) &&
506  lclGetStringListFromFormula( aStringList, rFmlaStr, mcFmlaSep ) )
507  {
508  m_xEdList->set_text( aStringList );
509  m_xEdMin->SetText( OUString() );
510  // change validation mode to string list
511  m_xLbAllow->set_active( SC_VALIDDLG_ALLOW_LIST );
512  }
513  else
514  {
515  m_xEdMin->SetText( rFmlaStr );
516  m_xEdList->set_text( OUString() );
517  }
518 }
519 
520 void ScTPValidationValue::SetSecondFormula( const OUString& rFmlaStr )
521 {
522  m_xEdMax->SetText( rFmlaStr );
523 }
524 
526 {
527  return dynamic_cast<ScValidationDlg*>(GetDialogController());
528 }
529 
531 {
532  ScValidationDlg *pValidationDlg = GetValidationDlg();
533  if( !pValidationDlg )
534  return;
535 
536  if( !pValidationDlg->SetupRefDlg() )
537  return;
538 
539  pValidationDlg->SetHandler( this );
540  pValidationDlg->SetSetRefHdl( static_cast<ScRefHandlerHelper::PFUNCSETREFHDLTYPE>( &ScTPValidationValue::SetReferenceHdl ) );
541  pValidationDlg->SetSetActHdl( static_cast<ScRefHandlerHelper::PCOMMONHDLTYPE>( &ScTPValidationValue::SetActiveHdl ) );
542  pValidationDlg->SetRefInputStartPreHdl( static_cast<ScRefHandlerHelper::PINPUTSTARTDLTYPE>( &ScTPValidationValue::RefInputStartPreHdl ) );
543  pValidationDlg->SetRefInputDonePostHdl( static_cast<ScRefHandlerHelper::PCOMMONHDLTYPE>( &ScTPValidationValue::RefInputDonePostHdl ) );
544 
545  weld::Label* pLabel = nullptr;
546 
547  if (m_xEdMax->GetWidget()->get_visible())
548  {
549  m_pRefEdit = m_xEdMax.get();
550  pLabel = m_xFtMax.get();
551  }
552  else if (m_xEdMin->GetWidget()->get_visible())
553  {
554  m_pRefEdit = m_xEdMin.get();
555  pLabel = m_xFtMin.get();
556  }
557 
560 
561  if( m_pRefEdit )
562  m_pRefEdit->SetReferences( pValidationDlg, pLabel );
563 
564  m_xBtnRef->SetReferences( pValidationDlg, m_pRefEdit );
565 }
566 
567 void ScTPValidationValue::RemoveRefDlg(bool bRestoreModal)
568 {
569  ScValidationDlg *pValidationDlg = GetValidationDlg();
570  if( !pValidationDlg )
571  return;
572 
573  if( !pValidationDlg->RemoveRefDlg(bRestoreModal) )
574  return;
575 
576  pValidationDlg->SetHandler( nullptr );
577  pValidationDlg->SetSetRefHdl( nullptr );
578  pValidationDlg->SetSetActHdl( nullptr );
579  pValidationDlg->SetRefInputStartPreHdl( nullptr );
580  pValidationDlg->SetRefInputDonePostHdl( nullptr );
581 
582  if( m_pRefEdit )
583  m_pRefEdit->SetReferences( nullptr, nullptr );
584  m_pRefEdit = nullptr;
585 
586  m_xBtnRef->SetReferences( nullptr, nullptr );
587 }
588 
590 {
591  const sal_Int32 nPos = m_xLbAllow->get_active();
592 
593  if ( nPos == SC_VALIDDLG_ALLOW_RANGE )
594  {
595  SetupRefDlg();
596  }
597 }
598 
599 IMPL_LINK( ScTPValidationValue, KillEditFocusHdl, formula::RefEdit&, rWnd, void )
600 {
601  if (&rWnd != m_pRefEdit)
602  return;
603  if( ScValidationDlg *pValidationDlg = GetValidationDlg() )
604  {
605  if (pValidationDlg->IsChildFocus() && !pValidationDlg->IsRefInputting())
606  {
607  if( ( !m_pRefEdit || !m_pRefEdit->GetWidget()->has_focus()) && !m_xBtnRef->GetWidget()->has_focus() )
608  {
609  RemoveRefDlg(true);
610  }
611  }
612  }
613 }
614 
615 IMPL_LINK( ScTPValidationValue, KillButtonFocusHdl, formula::RefButton&, rWnd, void )
616 {
617  if( &rWnd != m_xBtnRef.get())
618  return;
619  if( ScValidationDlg *pValidationDlg = GetValidationDlg() )
620  if (pValidationDlg->IsChildFocus() && !pValidationDlg->IsRefInputting())
621  if( ( !m_pRefEdit || !m_pRefEdit->GetWidget()->has_focus()) && !m_xBtnRef->GetWidget()->has_focus() )
622  {
623  RemoveRefDlg(true);
624  }
625 }
626 
628 {
629  const sal_Int32 nLbPos = m_xLbAllow->get_active();
630  bool bEnable = (nLbPos != SC_VALIDDLG_ALLOW_ANY);
631  bool bRange = (nLbPos == SC_VALIDDLG_ALLOW_RANGE);
632  bool bList = (nLbPos == SC_VALIDDLG_ALLOW_LIST);
633  bool bCustom = (nLbPos == SC_VALIDDLG_ALLOW_CUSTOM);
634 
635  m_xCbAllow->set_sensitive( bEnable ); // Empty cell
636  m_xFtValue->set_sensitive( bEnable );
637  m_xLbValue->set_sensitive( bEnable );
638  m_xFtMin->set_sensitive( bEnable );
639  m_xEdMin->GetWidget()->set_sensitive( bEnable );
640  m_xEdList->set_sensitive( bEnable );
641  m_xFtMax->set_sensitive( bEnable );
642  m_xEdMax->GetWidget()->set_sensitive( bEnable );
643 
644  bool bShowMax = false;
645 
646  if( bRange )
647  m_xFtMin->set_label( maStrRange );
648  else if( bList )
649  m_xFtMin->set_label( maStrList );
650  else if( bCustom )
651  m_xFtMin->set_label( maStrFormula );
652  else
653  {
654  switch( m_xLbValue->get_active() )
655  {
657  case SC_VALIDDLG_DATA_NOTEQUAL: m_xFtMin->set_label( maStrValue ); break;
658 
660  case SC_VALIDDLG_DATA_EQLESS: m_xFtMin->set_label( maStrMax ); break;
661 
663  case SC_VALIDDLG_DATA_INVALIDRANGE: bShowMax = true;
664  [[fallthrough]];
666  case SC_VALIDDLG_DATA_EQGREATER: m_xFtMin->set_label( maStrMin ); break;
667 
668  default:
669  OSL_FAIL( "ScTPValidationValue::SelectHdl - unknown condition mode" );
670  }
671  }
672 
673  m_xCbShow->set_visible( bRange || bList );
674  m_xCbSort->set_visible( bRange || bList );
675  m_xFtValue->set_visible( !bRange && !bList && !bCustom);
676  m_xLbValue->set_visible( !bRange && !bList && !bCustom );
677  m_xEdMin->GetWidget()->set_visible( !bList );
678  m_xEdList->set_visible( bList );
679  m_xMinGrid->set_vexpand( bList );
680  m_xFtMax->set_visible( bShowMax );
681  m_xEdMax->GetWidget()->set_visible( bShowMax );
682  m_xFtHint->set_visible( bRange );
683  m_xBtnRef->GetWidget()->set_visible( bRange ); // cell range picker
684 }
685 
687 {
688  m_xCbSort->set_sensitive( m_xCbShow->get_active() );
689 }
690 
691 // Input Help Page
692 
694  : SfxTabPage(pPage, pController, IS_MOBILE ? OUString("modules/scalc/ui/validationhelptabpage-mobile.ui")
695  : OUString("modules/scalc/ui/validationhelptabpage.ui"), "ValidationHelpTabPage", &rArgSet)
696  , m_xTsbHelp(m_xBuilder->weld_check_button("tsbhelp"))
697  , m_xEdtTitle(m_xBuilder->weld_entry("title"))
698  , m_xEdInputHelp(m_xBuilder->weld_text_view("inputhelp"))
699 {
700  m_xEdInputHelp->set_size_request(m_xEdInputHelp->get_approximate_digit_width() * 40, m_xEdInputHelp->get_height_rows(13));
701 }
702 
704 {
705 }
706 
707 std::unique_ptr<SfxTabPage> ScTPValidationHelp::Create(weld::Container* pPage, weld::DialogController* pController,
708  const SfxItemSet* rArgSet)
709 {
710  return std::make_unique<ScTPValidationHelp>(pPage, pController, *rArgSet);
711 }
712 
713 void ScTPValidationHelp::Reset( const SfxItemSet* rArgSet )
714 {
715  if ( const SfxBoolItem* pItem = rArgSet->GetItemIfSet( FID_VALID_SHOWHELP ) )
716  m_xTsbHelp->set_state( pItem->GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
717  else
718  m_xTsbHelp->set_state( TRISTATE_FALSE );
719 
720  if ( const SfxStringItem* pItem = rArgSet->GetItemIfSet( FID_VALID_HELPTITLE ) )
721  m_xEdtTitle->set_text( pItem->GetValue() );
722  else
723  m_xEdtTitle->set_text( OUString() );
724 
725  if ( const SfxStringItem* pItem = rArgSet->GetItemIfSet( FID_VALID_HELPTEXT ) )
726  m_xEdInputHelp->set_text( pItem->GetValue() );
727  else
728  m_xEdInputHelp->set_text( OUString() );
729 }
730 
732 {
733  rArgSet->Put( SfxBoolItem( FID_VALID_SHOWHELP, m_xTsbHelp->get_state() == TRISTATE_TRUE ) );
734  rArgSet->Put( SfxStringItem( FID_VALID_HELPTITLE, m_xEdtTitle->get_text() ) );
735  rArgSet->Put( SfxStringItem( FID_VALID_HELPTEXT, m_xEdInputHelp->get_text() ) );
736 
737  return true;
738 }
739 
740 // Error Alert Page
741 
743  const SfxItemSet& rArgSet)
744 
745  : SfxTabPage ( pPage, pController,
746  IS_MOBILE ? OUString("modules/scalc/ui/erroralerttabpage-mobile.ui")
747  : OUString("modules/scalc/ui/erroralerttabpage.ui"), "ErrorAlertTabPage",
748  &rArgSet )
749  , m_xTsbShow(m_xBuilder->weld_check_button("tsbshow"))
750  , m_xLbAction(m_xBuilder->weld_combo_box("actionCB"))
751  , m_xBtnSearch(m_xBuilder->weld_button("browseBtn"))
752  , m_xEdtTitle(m_xBuilder->weld_entry("erroralert_title"))
753  , m_xFtError(m_xBuilder->weld_label("errormsg_label"))
754  , m_xEdError(m_xBuilder->weld_text_view("errorMsg"))
755 {
756  m_xEdError->set_size_request(m_xEdError->get_approximate_digit_width() * 40, m_xEdError->get_height_rows(12));
757  Init();
758 }
759 
761 {
762 }
763 
765 {
766  m_xLbAction->connect_changed(LINK(this, ScTPValidationError, SelectActionHdl));
767  m_xBtnSearch->connect_clicked(LINK( this, ScTPValidationError, ClickSearchHdl));
768 
769  m_xLbAction->set_active(0);
770 
771  SelectActionHdl(*m_xLbAction);
772 }
773 
774 std::unique_ptr<SfxTabPage> ScTPValidationError::Create(weld::Container* pPage, weld::DialogController* pController,
775  const SfxItemSet* rArgSet)
776 {
777  return std::make_unique<ScTPValidationError>(pPage, pController, *rArgSet);
778 }
779 
781 {
782  if ( const SfxBoolItem* pItem = rArgSet->GetItemIfSet( FID_VALID_SHOWERR ) )
783  m_xTsbShow->set_state( pItem->GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
784  else
785  m_xTsbShow->set_state( TRISTATE_TRUE ); // check by default
786 
787  if ( const SfxUInt16Item* pItem = rArgSet->GetItemIfSet( FID_VALID_ERRSTYLE ) )
788  m_xLbAction->set_active( pItem->GetValue() );
789  else
790  m_xLbAction->set_active( 0 );
791 
792  if ( const SfxStringItem* pItem = rArgSet->GetItemIfSet( FID_VALID_ERRTITLE ) )
793  m_xEdtTitle->set_text( pItem->GetValue() );
794  else
795  m_xEdtTitle->set_text( OUString() );
796 
797  if ( const SfxStringItem* pItem = rArgSet->GetItemIfSet( FID_VALID_ERRTEXT ) )
798  m_xEdError->set_text( pItem->GetValue() );
799  else
800  m_xEdError->set_text( OUString() );
801 
802  SelectActionHdl(*m_xLbAction);
803 }
804 
806 {
807  rArgSet->Put( SfxBoolItem( FID_VALID_SHOWERR, m_xTsbShow->get_state() == TRISTATE_TRUE ) );
808  rArgSet->Put( SfxUInt16Item( FID_VALID_ERRSTYLE, m_xLbAction->get_active() ) );
809  rArgSet->Put( SfxStringItem( FID_VALID_ERRTITLE, m_xEdtTitle->get_text() ) );
810  rArgSet->Put( SfxStringItem( FID_VALID_ERRTEXT, m_xEdError->get_text() ) );
811 
812  return true;
813 }
814 
816 {
817  ScValidErrorStyle eStyle = static_cast<ScValidErrorStyle>(m_xLbAction->get_active());
818  bool bMacro = ( eStyle == SC_VALERR_MACRO );
819 
820  m_xBtnSearch->set_sensitive( bMacro );
821  m_xFtError->set_sensitive( !bMacro );
822  m_xEdError->set_sensitive( !bMacro );
823 }
824 
826 {
827  // Use static SfxApplication method to bring up selector dialog for
828  // choosing a script
829  OUString aScriptURL = SfxApplication::ChooseScript(GetFrameWeld());
830 
831  if ( !aScriptURL.isEmpty() )
832  {
833  m_xEdtTitle->set_text( aScriptURL );
834  }
835 }
836 
838 {
839  ScTabViewShell *pTabViewShell = GetTabViewShell();
840 
841  if( !pTabViewShell ) return false;
842 
843  sal_uInt16 nId = SLOTID;
844  SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
845  SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
846 
847  if (pWnd && pWnd->GetController().get() != this) pWnd = nullptr;
848 
849  SC_MOD()->SetRefDialog( nId, pWnd == nullptr );
850 
851  return true;
852 }
853 
855 {
856  ScTabViewShell *pTabViewShell = GetTabViewShell();
857 
858  if( !pTabViewShell ) return false;
859 
860  sal_uInt16 nId = SLOTID;
861  SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
862  if ( pViewFrm->GetChildWindow( nId ) )
863  {
864  DoClose( nId );
865  }
866  return true;
867 }
868 
870 {
871  if ( m_bOwnRefHdlr ) return false;
872  if( EnterRefMode() )
873  {
874  SetModal( false );
875  m_bOwnRefHdlr = true;
876  return EnterRefStatus();
877  }
878 
879  return false;
880 }
881 
882 bool ScValidationDlg::RemoveRefDlg( bool bRestoreModal /* = true */ )
883 {
884  bool bVisLock = false;
885  bool bFreeWindowLock = false;
886 
887  ScTabViewShell *pTabVwSh = GetTabViewShell();
888 
889  if( !pTabVwSh ) return false;
890 
891  if ( SfxChildWindow* pWnd = pTabVwSh->GetViewFrame()->GetChildWindow( SID_VALIDITY_REFERENCE ) )
892  {
893  bVisLock = static_cast<ScValidityRefChildWin*>(pWnd)->LockVisible( true );
894  bFreeWindowLock = static_cast<ScValidityRefChildWin*>(pWnd)->LockFreeWindow( true );
895  }
896 
897  if ( !m_bOwnRefHdlr ) return false;
898  if( LeaveRefStatus() && LeaveRefMode() )
899  {
900  m_bOwnRefHdlr = false;
901 
902  if( bRestoreModal )
903  {
904  SetModal( true );
905  }
906  }
907 
908  if ( SfxChildWindow* pWnd = pTabVwSh->GetViewFrame()->GetChildWindow( SID_VALIDITY_REFERENCE ) )
909  {
910  static_cast<ScValidityRefChildWin*>(pWnd)->LockVisible( bVisLock );
911  static_cast<ScValidityRefChildWin*>(pWnd)->LockFreeWindow( bFreeWindowLock );
912  }
913 
914  return true;
915 }
916 
918 {
919  SetupRefDlg();
920 }
921 
923 {
924  return m_xDialog->has_toplevel_focus();
925 }
926 
927 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
std::shared_ptr< SfxDialogController > & GetController()
SfxViewFrame * GetViewFrame() const
OString m_sValuePageId
Definition: validate.hxx:153
ScAddress aStart
Definition: address.hxx:497
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxChildWindow * GetChildWindow(sal_uInt16)
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
#define SC_VALIDDLG_DATA_LESS
Definition: validate.cxx:68
std::unique_ptr< weld::CheckButton > m_xCbSort
Show selection list in cell.
Definition: validate.hxx:119
ScTPValidationError(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: validate.cxx:742
static constexpr auto Items
#define SC_VALIDDLG_ALLOW_ANY
Definition: validate.cxx:54
std::unique_ptr< weld::TextView > m_xEdError
Definition: validate.hxx:258
void SetRefInputDonePostHdl(void(ScRefHandlerCaller::*pNewHdl)())
Definition: validate.hxx:68
virtual void hide()=0
ScValidErrorStyle
Definition: validat.hxx:50
OUString GetFirstFormula() const
Definition: validate.cxx:486
IMPL_LINK_NOARG(ScTPValidationValue, EditSetFocusHdl, formula::RefEdit &, void)
Definition: validate.cxx:589
sal_Int16 nId
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
ScValidationDlg * GetValidationDlg()
Definition: validate.cxx:525
std::unique_ptr< weld::Label > m_xFtMin
Definition: validate.hxx:122
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
void SetFirstFormula(const OUString &rFmlaStr)
Definition: validate.cxx:501
void SetHandler(ScRefHandlerCaller *pNewHandler)
Definition: validate.hxx:63
ScAddress aEnd
Definition: address.hxx:498
#define SC_VALIDDLG_DATA_NOTEQUAL
Definition: validate.cxx:72
std::unique_ptr< weld::Container > m_xRefGrid
Definition: validate.hxx:130
weld::Container * get_refinput_shrink_parent()
Definition: validate.hxx:194
sal_Unicode mcFmlaSep
Definition: validate.hxx:107
#define SC_VALIDDLG_ALLOW_DECIMAL
Definition: validate.cxx:56
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: validate.cxx:805
TRISTATE_TRUE
std::unique_ptr< weld::Entry > m_xEdtTitle
Definition: validate.hxx:238
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:494
static const WhichRangesContainer pValueRanges
Definition: validate.hxx:78
std::unique_ptr< weld::TextView > m_xEdList
Definition: validate.hxx:125
#define SC_VALIDDLG_DATA_INVALIDRANGE
Definition: validate.cxx:74
bool EnterRefStatus()
Definition: validate.cxx:837
#define SC_VALIDDLG_ALLOW_TEXTLEN
Definition: validate.cxx:61
#define SC_VALIDDLG_ALLOW_LIST
Definition: validate.cxx:60
void SetSetActHdl(PCOMMONHDLTYPE pNewHdl)
Definition: validate.hxx:58
#define SC_VALIDDLG_DATA_EQUAL
Definition: validate.cxx:67
sal_uInt16 sal_Unicode
Reference< XNameAccess > m_xContainer
virtual void EndDialog(int nResponse) override
Definition: validate.cxx:105
The tab page "Criteria" from the Validation dialog.
Definition: validate.hxx:76
bool EnterRefMode()
Definition: anyrefdg.cxx:592
static SC_DLLPUBLIC void EraseQuotes(OUString &rString, sal_Unicode cQuote, bool bUnescapeEmbedded=true)
Erases the character cQuote from rString, if it exists at beginning AND end.
Definition: global.cxx:693
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: validate.cxx:780
virtual void show()=0
#define SC_VALIDDLG_DATA_DIRECT
Definition: validate.cxx:75
#define IS_MOBILE
Definition: validate.cxx:49
std::unique_ptr< weld::ComboBox > m_xLbValue
Definition: validate.hxx:121
std::unique_ptr< weld::Entry > m_xEdtTitle
Definition: validate.hxx:256
ScConditionMode
Definition: conditio.hxx:59
#define SC_VALIDDLG_ALLOW_TIME
Definition: validate.cxx:58
#define SC_VALIDDLG_ALLOW_RANGE
Definition: validate.cxx:59
#define SC_VALIDDLG_DATA_GREATER
Definition: validate.cxx:69
ScValidationMode
Definition: validat.hxx:38
#define SC_VALIDDLG_ALLOW_DATE
Definition: validate.cxx:57
void RefInputStartPreHdl(formula::RefEdit *pEdit, const formula::RefButton *pButton)
Definition: validate.cxx:144
ocSep
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
static OUString ChooseScript(weld::Window *pParent)
std::unique_ptr< weld::ComboBox > m_xLbAllow
Definition: validate.hxx:116
#define SC_VALIDDLG_ALLOW_CUSTOM
Definition: validate.cxx:62
void SetRefString(const OUString &rStr)
#define SC_VALIDDLG_DATA_EQLESS
Definition: validate.cxx:70
std::unique_ptr< weld::TextView > m_xEdInputHelp
Definition: validate.hxx:239
void SetRefInputStartPreHdl(PINPUTSTARTDLTYPE pNewHdl)
Definition: validate.hxx:67
static const OUString & GetNativeSymbol(OpCode eOp)
bool LeaveRefStatus()
Definition: validate.cxx:854
std::unique_ptr< weld::CheckButton > m_xTsbHelp
Definition: validate.hxx:237
The "Validity" tab dialog.
Definition: validate.hxx:146
formula::RefEdit * m_pRefEdit
Definition: validate.hxx:114
virtual bool has_focus() const =0
void RefInputDonePostHdl()
Definition: validate.cxx:171
#define SC_MOD()
Definition: scmod.hxx:249
#define SC_VALIDDLG_DATA_EQGREATER
Definition: validate.cxx:71
TRISTATE_FALSE
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2170
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: validate.cxx:707
SC_DLLPUBLIC void SetTabNo(SCTAB nTab, bool bNew=false, bool bExtendSelection=false, bool bSameTabButMoved=false)
Definition: tabview3.cxx:1800
ScTabViewShell * GetTabViewShell()
Definition: validate.hxx:169
virtual ~ScTPValidationHelp() override
Definition: validate.cxx:703
virtual ~ScValidationDlg() override
Definition: validate.cxx:113
virtual ~ScTPValidationError() override
Definition: validate.cxx:760
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: validate.cxx:731
virtual void move(weld::Widget *pWidget, weld::Container *pNewParent)=0
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: validate.cxx:421
std::unique_ptr< weld::ComboBox > m_xLbAction
Definition: validate.hxx:254
void SetModal(bool bModal)
Definition: validate.hxx:177
weld::Entry * GetWidget() const
bool RemoveRefDlg(bool bRestoreModal)
Definition: validate.cxx:882
#define SC_VALIDDLG_ALLOW_WHOLE
Definition: validate.cxx:55
std::unique_ptr< formula::RefEdit > m_xEdMin
Definition: validate.hxx:124
OUString GetSecondFormula() const
Definition: validate.cxx:496
std::unique_ptr< weld::CheckButton > m_xCbAllow
Definition: validate.hxx:117
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
ScTPValidationValue(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: validate.cxx:344
static SC_DLLPUBLIC OUString addToken(std::u16string_view rTokenList, std::u16string_view rToken, sal_Unicode cSep, sal_Int32 nSepCount=1, bool bForceSep=false)
Adds the string rToken to rTokenList, using a list separator character.
Definition: global.cxx:665
ScTPValidationHelp(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: validate.cxx:693
#define SC_VALIDDLG_DATA_VALIDRANGE
Definition: validate.cxx:73
void RemoveRefDlg(bool bRestoreModal)
Definition: validate.cxx:567
weld::Container * m_pBtnRefParent
Definition: validate.hxx:133
std::unique_ptr< weld::CheckButton > m_xTsbShow
Definition: validate.hxx:253
OString strip(const OString &rIn, char c)
static OUString SC_DLLPUBLIC GetQuotedToken(const OUString &rIn, sal_Int32 nToken, const OUString &rQuotedPairs, sal_Unicode cTok, sal_Int32 &rIndex)
Definition: stringutil.cxx:347
void SetSetRefHdl(PFUNCSETREFHDLTYPE pNewHdl)
Definition: validate.hxx:53
void AddTabPage(const OString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
Reference< XExecutableDialog > m_xDialog
virtual void EndDialog(int nResponse)
SfxOkDialogController * GetDialogController() const
virtual ~ScTPValidationValue() override
Definition: validate.cxx:394
std::unique_ptr< weld::Label > m_xFtMax
Entries for explicit list.
Definition: validate.hxx:126
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: validate.cxx:465
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: validate.cxx:426
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: validate.cxx:713
void SetReferenceHdl(const ScRange &, const ScDocument &)
Definition: validate.cxx:119
ScValidationDlg(weld::Window *pParent, const SfxItemSet *pArgSet, ScTabViewShell *pTabViewSh)
Definition: validate.cxx:84
const std::u16string_view aStringList[]
Definition: vbadialog.cxx:31
std::unique_ptr< weld::CheckButton > m_xCbShow
Allow blank cells.
Definition: validate.hxx:118
SCTAB GetRefTabNo() const
Definition: viewdata.hxx:392
bool IsChildFocus() const
Definition: validate.cxx:922
std::unique_ptr< weld::Button > m_xBtnSearch
Definition: validate.hxx:255
std::unique_ptr< formula::RefEdit > m_xEdMax
Definition: validate.hxx:127
weld::Container * m_pRefEditParent
Definition: validate.hxx:132
static SC_DLLPUBLIC bool IsQuoted(const OUString &rString, sal_Unicode cQuote)
Returns true, if the first and last character of the string is cQuote.
Definition: global.cxx:675
bool LeaveRefMode()
Definition: anyrefdg.cxx:655
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: validate.cxx:774
bool DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:718
std::unique_ptr< formula::RefButton > m_xBtnRef
Hint text for cell range validity.
Definition: validate.hxx:129
void SetReferences(IControlReferenceHandler *pDlg, weld::Label *pLabelWidget)
bool SetupRefDlg()
Definition: validate.cxx:869
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
static SC_DLLPUBLIC void AddQuotes(OUString &rString, sal_Unicode cQuote, bool bEscapeEmbedded=true)
Inserts the character cQuote at beginning and end of rString.
Definition: global.cxx:680
aStr
IMPL_LINK(ScTPValidationValue, KillEditFocusHdl, formula::RefEdit &, rWnd, void)
Definition: validate.cxx:599
void SetSecondFormula(const OUString &rFmlaStr)
Definition: validate.cxx:520
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
bool m_bDetectedRangeSegmentation false