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