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