LibreOffice Module sc (master)  1
dbnamdlg.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <memory>
21 #include <sal/config.h>
22 
23 #include <cassert>
24 
25 #include <comphelper/string.hxx>
26 #include <unotools/charclass.hxx>
27 #include <vcl/svapp.hxx>
28 #include <vcl/weld.hxx>
29 #include <o3tl/string_view.hxx>
30 
31 #include <reffact.hxx>
32 #include <document.hxx>
33 #include <globstr.hrc>
34 #include <scresid.hxx>
35 #include <rangenam.hxx>
36 #include <globalnames.hxx>
37 #include <dbnamdlg.hxx>
38 #include <dbdocfun.hxx>
39 
40 namespace {
41 
42 class DBSaveData;
43 
44 }
45 
46 static std::unique_ptr<DBSaveData> xSaveObj;
47 
48 namespace
49 {
50  void ERRORBOX(weld::Window* pParent, const OUString& rString)
51  {
52  std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
53  VclMessageType::Warning, VclButtonsType::Ok,
54  rString));
55  xBox->run();
56  }
57 
58 
59 class DBSaveData
60 {
61 public:
62  DBSaveData( formula::RefEdit& rEd, weld::CheckButton& rHdr, weld::CheckButton& rTot, weld::CheckButton& rSize, weld::CheckButton& rFmt,
63  weld::CheckButton& rStrip, ScRange& rArea )
64  : rEdAssign(rEd)
65  , rBtnHeader(rHdr)
66  , rBtnTotals(rTot)
67  , rBtnSize(rSize)
68  , rBtnFormat(rFmt)
69  , rBtnStrip(rStrip)
70  , rCurArea(rArea)
71  , bHeader(false)
72  , bTotals(false)
73  , bSize(false)
74  , bFormat(false)
75  , bStrip(false)
76  , bDirty(false)
77  {
78  }
79  void Save();
80  void Restore();
81 
82 private:
83  formula::RefEdit& rEdAssign;
84  weld::CheckButton& rBtnHeader;
85  weld::CheckButton& rBtnTotals;
86  weld::CheckButton& rBtnSize;
87  weld::CheckButton& rBtnFormat;
88  weld::CheckButton& rBtnStrip;
89  ScRange& rCurArea;
90  OUString aStr;
91  ScRange aArea;
92  bool bHeader:1;
93  bool bTotals:1;
94  bool bSize:1;
95  bool bFormat:1;
96  bool bStrip:1;
97  bool bDirty:1;
98 };
99 
100 }
101 
102 void DBSaveData::Save()
103 {
104  aArea = rCurArea;
105  aStr = rEdAssign.GetText();
106  bHeader = rBtnHeader.get_active();
107  bTotals = rBtnTotals.get_active();
108  bSize = rBtnSize.get_active();
109  bFormat = rBtnFormat.get_active();
110  bStrip = rBtnStrip.get_active();
111  bDirty = true;
112 }
113 
114 void DBSaveData::Restore()
115 {
116  if ( bDirty )
117  {
118  rCurArea = aArea;
119  rEdAssign.SetText( aStr );
120  rBtnHeader.set_active ( bHeader );
121  rBtnTotals.set_active ( bTotals );
122  rBtnSize.set_active ( bSize );
123  rBtnFormat.set_active ( bFormat );
124  rBtnStrip.set_active ( bStrip );
125  bDirty = false;
126  }
127 }
128 
129 
131  ScViewData& rViewData)
132  : ScAnyRefDlgController(pB, pCW, pParent,
133  "modules/scalc/ui/definedatabaserangedialog.ui", "DefineDatabaseRangeDialog")
134  , m_rViewData(rViewData)
135  , rDoc(rViewData.GetDocument())
136  , bRefInputMode(false)
137  , aAddrDetails(rDoc.GetAddressConvention(), 0, 0)
138  , aLocalDbCol(*(rDoc.GetDBCollection()))
139  , m_xEdName(m_xBuilder->weld_entry_tree_view("entrygrid", "entry", "entry-list"))
140  , m_xAssignFrame(m_xBuilder->weld_frame("RangeFrame"))
141  , m_xEdAssign(new formula::RefEdit(m_xBuilder->weld_entry("assign")))
142  , m_xRbAssign(new formula::RefButton(m_xBuilder->weld_button("assignrb")))
143  , m_xOptions(m_xBuilder->weld_widget("Options"))
144  , m_xBtnHeader(m_xBuilder->weld_check_button("ContainsColumnLabels"))
145  , m_xBtnTotals(m_xBuilder->weld_check_button("ContainsTotalsRow"))
146  , m_xBtnDoSize(m_xBuilder->weld_check_button("InsertOrDeleteCells"))
147  , m_xBtnKeepFmt(m_xBuilder->weld_check_button("KeepFormatting"))
148  , m_xBtnStripData(m_xBuilder->weld_check_button("DontSaveImportedData"))
149  , m_xFTSource(m_xBuilder->weld_label("Source"))
150  , m_xFTOperations(m_xBuilder->weld_label("Operations"))
151  , m_xBtnOk(m_xBuilder->weld_button("ok"))
152  , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
153  , m_xBtnAdd(m_xBuilder->weld_button("add"))
154  , m_xBtnRemove(m_xBuilder->weld_button("delete"))
155  , m_xModifyPB(m_xBuilder->weld_button("modify"))
156  , m_xInvalidFT(m_xBuilder->weld_label("invalid"))
157  , m_xFrameLabel(m_xAssignFrame->weld_label_widget())
158  , m_xExpander(m_xBuilder->weld_expander("more"))
159 {
160  m_xEdName->set_height_request_by_rows(4);
161  m_xEdAssign->SetReferences(this, m_xFrameLabel.get());
162  m_xRbAssign->SetReferences(this, m_xEdAssign.get());
163  aStrAdd = m_xBtnAdd->get_label();
164  aStrModify = m_xModifyPB->get_label();
165  aStrInvalid = m_xInvalidFT->get_label();
166 
167  // so that the strings in the resource can stay with fixed texts:
168  aStrSource = m_xFTSource->get_label();
169  aStrOperations = m_xFTOperations->get_label();
170 
171  xSaveObj.reset(new DBSaveData( *m_xEdAssign, *m_xBtnHeader, *m_xBtnTotals,
173  Init();
174 }
175 
177 {
178  xSaveObj.reset();
179 }
180 
182 {
183  m_xBtnHeader->set_active(true); // Default: with column headers
184  m_xBtnTotals->set_active( false ); // Default: without totals row
185  m_xBtnDoSize->set_active(true);
186  m_xBtnKeepFmt->set_active(true);
187 
188  m_xBtnOk->connect_clicked ( LINK( this, ScDbNameDlg, OkBtnHdl ) );
189  m_xBtnCancel->connect_clicked ( LINK( this, ScDbNameDlg, CancelBtnHdl ) );
190  m_xBtnAdd->connect_clicked ( LINK( this, ScDbNameDlg, AddBtnHdl ) );
191  m_xBtnRemove->connect_clicked ( LINK( this, ScDbNameDlg, RemoveBtnHdl ) );
192  m_xEdName->connect_changed( LINK( this, ScDbNameDlg, NameModifyHdl ) );
193  m_xEdAssign->SetModifyHdl ( LINK( this, ScDbNameDlg, AssModifyHdl ) );
194  UpdateNames();
195 
196  OUString theAreaStr;
197 
198  SCCOL nStartCol = 0;
199  SCROW nStartRow = 0;
200  SCTAB nStartTab = 0;
201  SCCOL nEndCol = 0;
202  SCROW nEndRow = 0;
203  SCTAB nEndTab = 0;
204 
205  ScDBCollection* pDBColl = rDoc.GetDBCollection();
206 
207  m_rViewData.GetSimpleArea( nStartCol, nStartRow, nStartTab,
208  nEndCol, nEndRow, nEndTab );
209 
210  theCurArea = ScRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab);
211 
213 
214  if ( pDBColl )
215  {
216  // determine if the defined DB area has been marked:
217  ScDBData* pDBData = pDBColl->GetDBAtCursor( nStartCol, nStartRow, nStartTab, ScDBDataPortion::TOP_LEFT );
218  if ( pDBData )
219  {
220  ScAddress& rStart = theCurArea.aStart;
221  ScAddress& rEnd = theCurArea.aEnd;
222  SCCOL nCol1;
223  SCCOL nCol2;
224  SCROW nRow1;
225  SCROW nRow2;
226  SCTAB nTab;
227 
228  pDBData->GetArea( nTab, nCol1, nRow1, nCol2, nRow2 );
229 
230  if ( (rStart.Tab() == nTab)
231  && (rStart.Col() == nCol1) && (rStart.Row() == nRow1)
232  && (rEnd.Col() == nCol2) && (rEnd.Row() == nRow2 ) )
233  {
234  OUString aDBName = pDBData->GetName();
235  if ( aDBName != STR_DB_LOCAL_NONAME )
236  m_xEdName->set_entry_text(aDBName);
237 
238  m_xBtnHeader->set_active( pDBData->HasHeader() );
239  m_xBtnTotals->set_active( pDBData->HasTotals() );
240  m_xBtnDoSize->set_active( pDBData->IsDoSize() );
241  m_xBtnKeepFmt->set_active( pDBData->IsKeepFmt() );
242  m_xBtnStripData->set_active( pDBData->IsStripData() );
243  SetInfoStrings( pDBData );
244  }
245  }
246  }
247 
248  m_xEdAssign->SetText( theAreaStr );
249  m_xEdName->grab_focus();
250  bSaved = true;
251  xSaveObj->Save();
252  NameModifyHdl( *m_xEdName );
253  bInvalid = false;
254 }
255 
256 void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData )
257 {
258  OUStringBuffer aBuf;
259  aBuf.append(aStrSource);
260  if (pDBData)
261  {
262  aBuf.append(' ');
263  aBuf.append(pDBData->GetSourceString());
264  }
265  m_xFTSource->set_label(aBuf.makeStringAndClear());
266 
267  aBuf.append(aStrOperations);
268  if (pDBData)
269  {
270  aBuf.append(' ');
271  aBuf.append(pDBData->GetOperations());
272  }
273  m_xFTOperations->set_label(aBuf.makeStringAndClear());
274 }
275 
276 // Transfer of a table area selected with the mouse, which is then displayed
277 // as a new selection in the reference window.
278 
279 void ScDbNameDlg::SetReference( const ScRange& rRef, ScDocument& rDocP )
280 {
281  if (!m_xEdAssign->GetWidget()->get_sensitive())
282  return;
283 
284  if ( rRef.aStart != rRef.aEnd )
285  RefInputStart(m_xEdAssign.get());
286 
287  theCurArea = rRef;
288 
289  OUString aRefStr(theCurArea.Format(rDocP, ScRefFlags::RANGE_ABS_3D, aAddrDetails));
290  m_xEdAssign->SetRefString( aRefStr );
291  m_xOptions->set_sensitive(true);
292  m_xBtnAdd->set_sensitive(true);
293  bSaved = true;
294  xSaveObj->Save();
295 }
296 
298 {
299  DoClose( ScDbNameDlgWrapper::GetChildWindowId() );
300 }
301 
303 {
304  m_xEdAssign->GrabFocus();
305 
306  // No NameModifyHdl, because otherwise areas can not be changed
307  // (the old content would be displayed again after the reference selection is pulled)
308  // (the selected DB name has not changed either)
309 
310  RefInputDone();
311 }
312 
314 {
315  typedef ScDBCollection::NamedDBs DBsType;
316 
317  const DBsType& rDBs = aLocalDbCol.getNamedDBs();
318 
319  m_xEdName->freeze();
320 
321  m_xEdName->clear();
322  m_xEdAssign->SetText( OUString() );
323 
324  if (!rDBs.empty())
325  {
326  for (const auto& rxDB : rDBs)
327  m_xEdName->append_text(rxDB->GetName());
328  }
329  else
330  {
331  m_xBtnAdd->set_label( aStrAdd );
332  m_xBtnAdd->set_sensitive(false);
333  m_xBtnRemove->set_sensitive(false);
334  }
335 
336  m_xEdName->thaw();
337 }
338 
339 void ScDbNameDlg::UpdateDBData( const OUString& rStrName )
340 {
341 
343 
344  if ( pData )
345  {
346  SCCOL nColStart = 0;
347  SCROW nRowStart = 0;
348  SCCOL nColEnd = 0;
349  SCROW nRowEnd = 0;
350  SCTAB nTab = 0;
351 
352  pData->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd );
353  theCurArea = ScRange( ScAddress( nColStart, nRowStart, nTab ),
354  ScAddress( nColEnd, nRowEnd, nTab ) );
356  m_xEdAssign->SetText( theArea );
357  m_xBtnAdd->set_label( aStrModify );
358  m_xBtnHeader->set_active( pData->HasHeader() );
359  m_xBtnTotals->set_active( pData->HasTotals() );
360  m_xBtnDoSize->set_active( pData->IsDoSize() );
361  m_xBtnKeepFmt->set_active( pData->IsKeepFmt() );
362  m_xBtnStripData->set_active( pData->IsStripData() );
363  SetInfoStrings( pData );
364  }
365 
366  m_xBtnAdd->set_label( aStrModify );
367  m_xBtnAdd->set_sensitive(true);
368  m_xBtnRemove->set_sensitive(true);
369  m_xOptions->set_sensitive(true);
370 }
371 
373 {
374  return bRefInputMode;
375 }
376 
377 // Handler:
378 
380 {
381  bInvalid = false;
382  AddBtnHdl(*m_xBtnAdd);
383 
384  // Pass the changes and the remove list to the view: both are
385  // transferred as a reference only, so that no dead memory can
386  // be created at this point:
387  if (!bInvalid)
388  {
389  ScDBDocFunc aFunc(*m_rViewData.GetDocShell());
390  aFunc.ModifyAllDBData(aLocalDbCol, aRemoveList);
391  response(RET_OK);
392  }
393 }
394 
396 {
397  response(RET_CANCEL);
398 }
399 
401 {
402  OUString aNewName = comphelper::string::strip(m_xEdName->get_active_text(), ' ');
403  OUString aNewArea = m_xEdAssign->GetText();
404 
405  if ( aNewName.isEmpty() || aNewArea.isEmpty() )
406  return;
407 
409  && aNewName != STR_DB_LOCAL_NONAME)
410  {
411  // because editing can be done now, parsing is needed first
412  ScRange aTmpRange;
413  OUString aText = m_xEdAssign->GetText();
414  if ( aTmpRange.ParseAny( aText, rDoc, aAddrDetails ) & ScRefFlags::VALID )
415  {
416  theCurArea = aTmpRange;
417  ScAddress aStart = theCurArea.aStart;
418  ScAddress aEnd = theCurArea.aEnd;
419 
420  ScDBData* pOldEntry = aLocalDbCol.getNamedDBs().findByUpperName(ScGlobal::getCharClass().uppercase(aNewName));
421  if (pOldEntry)
422  {
423  // modify area
424 
425  pOldEntry->MoveTo( aStart.Tab(), aStart.Col(), aStart.Row(),
426  aEnd.Col(), aEnd.Row() );
427  pOldEntry->SetByRow( true );
428  pOldEntry->SetHeader( m_xBtnHeader->get_active() );
429  pOldEntry->SetTotals( m_xBtnTotals->get_active() );
430  pOldEntry->SetDoSize( m_xBtnDoSize->get_active() );
431  pOldEntry->SetKeepFmt( m_xBtnKeepFmt->get_active() );
432  pOldEntry->SetStripData( m_xBtnStripData->get_active() );
433  }
434  else
435  {
436  // insert new area
437 
438  std::unique_ptr<ScDBData> pNewEntry(new ScDBData( aNewName, aStart.Tab(),
439  aStart.Col(), aStart.Row(),
440  aEnd.Col(), aEnd.Row(),
441  true, m_xBtnHeader->get_active(),
442  m_xBtnTotals->get_active() ));
443  pNewEntry->SetDoSize( m_xBtnDoSize->get_active() );
444  pNewEntry->SetKeepFmt( m_xBtnKeepFmt->get_active() );
445  pNewEntry->SetStripData( m_xBtnStripData->get_active() );
446 
447  bool ins = aLocalDbCol.getNamedDBs().insert(std::move(pNewEntry));
448  assert(ins); (void)ins;
449  }
450 
451  UpdateNames();
452 
453  m_xEdName->set_entry_text( OUString() );
454  m_xEdName->grab_focus();
455  m_xBtnAdd->set_label( aStrAdd );
456  m_xBtnAdd->set_sensitive(false);
457  m_xBtnRemove->set_sensitive(false);
458  m_xEdAssign->SetText( OUString() );
459  m_xBtnHeader->set_active(true); // Default: with column headers
460  m_xBtnTotals->set_active( false ); // Default: without totals row
461  m_xBtnDoSize->set_active( false );
462  m_xBtnKeepFmt->set_active( false );
463  m_xBtnStripData->set_active( false );
464  SetInfoStrings( nullptr ); // empty
465  theCurArea = ScRange();
466  bSaved = true;
467  xSaveObj->Save();
468  NameModifyHdl( *m_xEdName );
469  }
470  else
471  {
472  ERRORBOX(m_xDialog.get(), aStrInvalid);
473  m_xEdAssign->SelectAll();
474  m_xEdAssign->GrabFocus();
475  bInvalid = true;
476  }
477  }
478  else
479  {
480  ERRORBOX(m_xDialog.get(), ScResId(STR_INVALIDNAME));
481  m_xEdName->select_entry_region(0, -1);
482  m_xEdName->grab_focus();
483  bInvalid = true;
484  }
485 }
486 
487 namespace {
488 
489 class FindByName
490 {
491  const OUString& mrName;
492 public:
493  explicit FindByName(const OUString& rName) : mrName(rName) {}
494  bool operator() (std::unique_ptr<ScDBData> const& p) const
495  {
496  return p->GetName() == mrName;
497  }
498 };
499 
500 }
501 
503 {
504  OUString aStrEntry = m_xEdName->get_active_text();
505  ScDBCollection::NamedDBs& rDBs = aLocalDbCol.getNamedDBs();
507  ::std::find_if(rDBs.begin(), rDBs.end(), FindByName(aStrEntry));
508 
509  if (itr == rDBs.end())
510  return;
511 
512  OUString aStrDelMsg = ScResId( STR_QUERY_DELENTRY );
513  OUString sMsg{ o3tl::getToken(aStrDelMsg, 0, '#') + aStrEntry + o3tl::getToken(aStrDelMsg, 1, '#') };
514  std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(m_xDialog.get(),
515  VclMessageType::Question, VclButtonsType::YesNo,
516  sMsg));
517  xQueryBox->set_default_response(RET_YES);
518  if (RET_YES != xQueryBox->run())
519  return;
520 
521  SCTAB nTab;
522  SCCOL nColStart, nColEnd;
523  SCROW nRowStart, nRowEnd;
524  (*itr)->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd );
525  aRemoveList.emplace_back( ScAddress( nColStart, nRowStart, nTab ),
526  ScAddress( nColEnd, nRowEnd, nTab ) );
527 
528  rDBs.erase(itr);
529 
530  UpdateNames();
531 
532  m_xEdName->set_entry_text( OUString() );
533  m_xEdName->grab_focus();
534  m_xBtnAdd->set_label( aStrAdd );
535  m_xBtnAdd->set_sensitive(false);
536  m_xBtnRemove->set_sensitive(false);
537  m_xEdAssign->SetText( OUString() );
538  theCurArea = ScRange();
539  m_xBtnHeader->set_active(true); // Default: with column headers
540  m_xBtnTotals->set_active( false ); // Default: without totals row
541  m_xBtnDoSize->set_active( false );
542  m_xBtnKeepFmt->set_active( false );
543  m_xBtnStripData->set_active( false );
544  SetInfoStrings( nullptr ); // empty
545  bSaved=false;
546  xSaveObj->Restore();
547  NameModifyHdl( *m_xEdName );
548 }
549 
551 {
552  OUString theName = m_xEdName->get_active_text();
553  bool bNameFound = m_xEdName->find_text(theName) != -1;
554 
555  if ( theName.isEmpty() )
556  {
557  if (m_xBtnAdd->get_label() != aStrAdd)
558  m_xBtnAdd->set_label( aStrAdd );
559  m_xBtnAdd->set_sensitive(false);
560  m_xBtnRemove->set_sensitive(false);
561  m_xAssignFrame->set_sensitive(false);
562  m_xOptions->set_sensitive(false);
563  //bSaved=sal_False;
564  //xSaveObj->Restore();
565  //@BugID 54702 enable/disable in the base class only
566  //SFX_APPWINDOW->Disable(sal_False); //! general method in ScAnyRefDlg
567  bRefInputMode = false;
568  }
569  else
570  {
571  if ( bNameFound )
572  {
573  if (m_xBtnAdd->get_label() != aStrModify)
574  m_xBtnAdd->set_label( aStrModify );
575 
576  if(!bSaved)
577  {
578  bSaved = true;
579  xSaveObj->Save();
580  }
581  UpdateDBData( theName );
582  }
583  else
584  {
585  if (m_xBtnAdd->get_label() != aStrAdd)
586  m_xBtnAdd->set_label( aStrAdd );
587 
588  bSaved=false;
589  xSaveObj->Restore();
590 
591  if ( !m_xEdAssign->GetText().isEmpty() )
592  {
593  m_xBtnAdd->set_sensitive(true);
594  m_xOptions->set_sensitive(true);
595  }
596  else
597  {
598  m_xBtnAdd->set_sensitive(false);
599  m_xOptions->set_sensitive(false);
600  }
601  m_xBtnRemove->set_sensitive(false);
602  }
603 
604  m_xAssignFrame->set_sensitive(true);
605 
606  //@BugID 54702 enable/disable in the base class only
607  //SFX_APPWINDOW->set_sensitive(true);
608  bRefInputMode = true;
609  }
610 }
611 
613 {
614  // parse here for Save(), etc.
615 
616  ScRange aTmpRange;
617  OUString aText = m_xEdAssign->GetText();
618  if ( aTmpRange.ParseAny( aText, rDoc, aAddrDetails ) & ScRefFlags::VALID )
619  theCurArea = aTmpRange;
620 
621  if (!aText.isEmpty() && !m_xEdName->get_active_text().isEmpty())
622  {
623  m_xBtnAdd->set_sensitive(true);
624  m_xBtnHeader->set_sensitive(true);
625  m_xBtnTotals->set_sensitive(true);
626  m_xBtnDoSize->set_sensitive(true);
627  m_xBtnKeepFmt->set_sensitive(true);
628  m_xBtnStripData->set_sensitive(true);
629  m_xFTSource->set_sensitive(true);
630  m_xFTOperations->set_sensitive(true);
631  }
632  else
633  {
634  m_xBtnAdd->set_sensitive(false);
635  m_xBtnHeader->set_sensitive(false);
636  m_xBtnTotals->set_sensitive(false);
637  m_xBtnDoSize->set_sensitive(false);
638  m_xBtnKeepFmt->set_sensitive(false);
639  m_xBtnStripData->set_sensitive(false);
640  m_xFTSource->set_sensitive(false);
641  m_xFTOperations->set_sensitive(false);
642  }
643 }
644 
645 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScRefFlags ParseAny(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
Definition: address.cxx:1733
std::unique_ptr< weld::CheckButton > m_xBtnKeepFmt
Definition: dbnamdlg.hxx:72
std::unique_ptr< weld::Button > m_xBtnAdd
Definition: dbnamdlg.hxx:79
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:825
ScAddress aStart
Definition: address.hxx:497
std::unique_ptr< weld::Widget > m_xOptions
Definition: dbnamdlg.hxx:68
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
virtual void Close() override
Definition: dbnamdlg.cxx:297
SCROW Row() const
Definition: address.hxx:274
virtual bool IsRefInputMode() const override
Definition: dbnamdlg.cxx:372
bool HasHeader() const
Definition: dbdata.hxx:130
std::unique_ptr< sal_Int32[]> pData
OUString GetSourceString() const
Definition: dbdata.cxx:258
static std::unique_ptr< DBSaveData > xSaveObj
Definition: dbnamdlg.cxx:46
void SetInfoStrings(const ScDBData *pDBData)
Definition: dbnamdlg.cxx:256
ScRange theCurArea
Definition: dbnamdlg.hxx:59
std::unique_ptr< weld::CheckButton > m_xBtnTotals
Definition: dbnamdlg.hxx:70
void SetDoSize(bool bSet)
Definition: dbdata.hxx:137
bool bRefInputMode
Definition: dbnamdlg.hxx:55
aBuf
ScAddress::Details aAddrDetails
Definition: dbnamdlg.hxx:56
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
ScAddress aEnd
Definition: address.hxx:498
std::unique_ptr< formula::RefEdit > m_xEdAssign
Definition: dbnamdlg.hxx:65
OUString aStrAdd
Definition: dbnamdlg.hxx:46
void SetKeepFmt(bool bSet)
Definition: dbdata.hxx:139
RET_CANCEL
bool IsDoSize() const
Definition: dbdata.hxx:136
OUString aStrOperations
Definition: dbnamdlg.hxx:51
std::unique_ptr< weld::Button > m_xBtnRemove
Definition: dbnamdlg.hxx:80
ScViewData & m_rViewData
Definition: dbnamdlg.hxx:53
RET_YES
void Init()
Definition: dbnamdlg.cxx:181
void MoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL nUpdateCol=-1)
Definition: dbdata.cxx:344
iterator erase(const iterator &itr)
Definition: dbdata.cxx:1238
SCTAB Tab() const
Definition: address.hxx:283
std::unique_ptr< weld::CheckButton > m_xBtnHeader
Definition: dbnamdlg.hxx:69
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: dbnamdlg.hxx:78
void UpdateDBData(const OUString &rStrName)
Definition: dbnamdlg.cxx:339
std::unique_ptr< weld::Label > m_xFTOperations
Definition: dbnamdlg.hxx:75
void UpdateNames()
Definition: dbnamdlg.cxx:313
sal_Int16 SCCOL
Definition: types.hxx:21
static SC_DLLPUBLIC const CharClass & getCharClass()
Definition: global.cxx:1024
OUString aStrInvalid
Definition: dbnamdlg.hxx:48
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2170
bool bSaved
Definition: dbnamdlg.hxx:43
DBsType::iterator iterator
Definition: dbdata.hxx:249
static SC_DLLPUBLIC IsNameValidType IsNameValid(const OUString &rName, const ScDocument &rDoc)
Definition: rangenam.cxx:468
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1181
const OUString & GetName() const
Definition: dbdata.hxx:121
virtual void RefInputDone(bool bForced=false) override
Definition: anyrefdg.cxx:779
bool IsKeepFmt() const
Definition: dbdata.hxx:138
const ScDocument & rDoc
Definition: dbnamdlg.hxx:54
constexpr OUStringLiteral STR_DB_LOCAL_NONAME
Definition: globalnames.hxx:14
OUString GetOperations() const
Definition: dbdata.cxx:270
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:300
void SetHeader(bool bHasH)
Definition: dbdata.hxx:131
bool IsStripData() const
Definition: dbdata.hxx:140
std::unique_ptr< formula::RefButton > m_xRbAssign
Definition: dbnamdlg.hxx:66
SCCOL Col() const
Definition: address.hxx:279
std::unique_ptr< weld::Button > m_xModifyPB
Definition: dbnamdlg.hxx:82
void SetByRow(bool bByR)
Definition: dbdata.hxx:129
ScDBData * findByUpperName(const OUString &rName)
Definition: dbdata.cxx:1196
void SetStripData(bool bSet)
Definition: dbdata.hxx:141
top left cell of area
ScDBCollection aLocalDbCol
Definition: dbnamdlg.hxx:58
Stores global named database ranges.
Definition: dbdata.hxx:234
sal_Int32 SCROW
Definition: types.hxx:17
std::unique_ptr< weld::Label > m_xFTSource
Definition: dbnamdlg.hxx:74
virtual void SetActive() override
Definition: dbnamdlg.cxx:302
std::unique_ptr< weld::Label > m_xInvalidFT
Definition: dbnamdlg.hxx:83
ScDbNameDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScViewData &rViewData)
Definition: dbnamdlg.cxx:130
RET_OK
OString strip(const OString &rIn, char c)
std::unique_ptr< weld::CheckButton > m_xBtnStripData
Definition: dbnamdlg.hxx:73
void ModifyAllDBData(const ScDBCollection &rNewColl, const std::vector< ScRange > &rDelAreaList)
Definition: dbdocfun.cxx:245
Reference< XExecutableDialog > m_xDialog
const ScDBData * GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
Definition: dbdata.cxx:1358
void SetTotals(bool bTotals)
Definition: dbdata.hxx:133
virtual ~ScDbNameDlg() override
Definition: dbnamdlg.cxx:176
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:316
std::unique_ptr< weld::EntryTreeView > m_xEdName
Definition: dbnamdlg.hxx:62
std::unique_ptr< weld::Label > m_xFrameLabel
Definition: dbnamdlg.hxx:85
IMPL_LINK_NOARG(ScDbNameDlg, OkBtnHdl, weld::Button &, void)
Definition: dbnamdlg.cxx:379
std::unique_ptr< weld::Button > m_xBtnOk
Definition: dbnamdlg.hxx:77
OUString aStrModify
Definition: dbnamdlg.hxx:47
std::unique_ptr< weld::CheckButton > m_xBtnDoSize
Definition: dbnamdlg.hxx:71
bool bInvalid
Definition: dbnamdlg.hxx:44
OUString aStrSource
Definition: dbnamdlg.hxx:50
bool DoClose(sal_uInt16 nId)
Definition: anyrefdg.cxx:718
aStr
bool HasTotals() const
Definition: dbdata.hxx:132
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
sal_Int16 SCTAB
Definition: types.hxx:22
virtual void SetReference(const ScRange &rRef, ScDocument &rDoc) override
Definition: dbnamdlg.cxx:279
virtual void RefInputStart(formula::RefEdit *pEdit, formula::RefButton *pButton=nullptr) override
Definition: anyrefdg.cxx:749
bool m_bDetectedRangeSegmentation false
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo