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