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