LibreOffice Module sc (master)  1
content.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 <sal/config.h>
21 
22 #include <string_view>
23 
24 #include <svx/svditer.hxx>
25 #include <svx/svdobj.hxx>
26 #include <svx/svdview.hxx>
27 #include <sfx2/linkmgr.hxx>
28 #include <sfx2/docfile.hxx>
29 #include <sfx2/viewfrm.hxx>
30 #include <vcl/commandevent.hxx>
31 #include <vcl/svapp.hxx>
32 #include <osl/diagnose.h>
33 #include <tools/urlobj.hxx>
34 #include <sal/log.hxx>
35 #include <unotools/charclass.hxx>
36 
37 #include <content.hxx>
38 #include <navipi.hxx>
39 #include <global.hxx>
40 #include <docsh.hxx>
41 #include <scmod.hxx>
42 #include <rangenam.hxx>
43 #include <dbdata.hxx>
44 #include <tablink.hxx>
45 #include <drwlayer.hxx>
46 #include <transobj.hxx>
47 #include <drwtrans.hxx>
48 #include <lnktrans.hxx>
49 #include <strings.hrc>
50 #include <scresid.hxx>
51 #include <bitmaps.hlst>
52 #include <arealink.hxx>
53 #include <navicfg.hxx>
54 #include <navsett.hxx>
55 #include <postit.hxx>
56 #include <tabvwsh.hxx>
57 #include <drawview.hxx>
58 #include <clipparam.hxx>
59 #include <markdata.hxx>
60 
61 using namespace com::sun::star;
62 
63 // order of the categories in navigator -------------------------------------
64 
66 {
67  ScContentId::ROOT, // ROOT (0) has to be at the front
76 };
77 
78 const std::u16string_view aContentBmps[]=
79 {
80  u"" RID_BMP_CONTENT_TABLE,
81  u"" RID_BMP_CONTENT_RANGENAME,
82  u"" RID_BMP_CONTENT_DBAREA,
83  u"" RID_BMP_CONTENT_GRAPHIC,
84  u"" RID_BMP_CONTENT_OLEOBJECT,
85  u"" RID_BMP_CONTENT_NOTE,
86  u"" RID_BMP_CONTENT_AREALINK,
87  u"" RID_BMP_CONTENT_DRAWING
88 };
89 
91 {
92  ScDocShell* pSh = nullptr;
93  if ( !aManualDoc.isEmpty() )
94  {
95  SfxObjectShell* pObjSh = SfxObjectShell::GetFirst( checkSfxObjectShell<ScDocShell> );
96  while ( pObjSh && !pSh )
97  {
98  if ( pObjSh->GetTitle() == aManualDoc )
99  pSh = dynamic_cast<ScDocShell*>( pObjSh );
100  pObjSh = SfxObjectShell::GetNext( *pObjSh, checkSfxObjectShell<ScDocShell> );
101  }
102  }
103  else
104  {
105  // only current when manual isn't set
106  // (so it's detected when the documents don't exists any longer)
107 
108  SfxViewShell* pViewSh = SfxViewShell::Current();
109  if ( pViewSh )
110  {
111  SfxObjectShell* pObjSh = pViewSh->GetViewFrame()->GetObjectShell();
112  pSh = dynamic_cast<ScDocShell*>( pObjSh );
113  }
114  }
115 
116  return pSh;
117 }
118 
119 // ScContentTree
120 
121 ScContentTree::ScContentTree(std::unique_ptr<weld::TreeView> xTreeView, ScNavigatorDlg* pNavigatorDlg)
122  : m_xTreeView(std::move(xTreeView))
123  , m_xScratchIter(m_xTreeView->make_iterator())
124  , m_xTransferObj(new ScLinkTransferObj)
125  , pParentWindow(pNavigatorDlg)
126  , nRootType(ScContentId::ROOT)
127  , bHiddenDoc(false)
128  , pHiddenDocument(nullptr)
129  , bisInNavigatoeDlg(false)
130  , m_bFreeze(false)
131  , m_nAsyncMouseReleaseId(nullptr)
132 {
133  for (sal_uInt16 i = 0; i <= int(ScContentId::LAST); ++i)
134  pPosList[pTypeList[i]] = i; // inverse for searching
135 
136  m_aRootNodes[ScContentId::ROOT] = nullptr;
137  for (sal_uInt16 i = 1; i < int(ScContentId::LAST); ++i)
138  InitRoot(static_cast<ScContentId>(i));
139 
140  m_xTreeView->connect_row_activated(LINK(this, ScContentTree, ContentDoubleClickHdl));
141  m_xTreeView->connect_mouse_release(LINK(this, ScContentTree, MouseReleaseHdl));
142  m_xTreeView->connect_key_press(LINK(this, ScContentTree, KeyInputHdl));
143  m_xTreeView->connect_popup_menu(LINK(this, ScContentTree, CommandHdl));
144  m_xTreeView->connect_query_tooltip(LINK(this, ScContentTree, QueryTooltipHdl));
145 
147  m_xTreeView->enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
148 
149  m_xTreeView->connect_drag_begin(LINK(this, ScContentTree, DragBeginHdl));
150 
151  m_xTreeView->set_selection_mode( SelectionMode::Single );
152 
153  m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 30,
154  m_xTreeView->get_text_height() * 13);
155 }
156 
158 {
160  {
162  m_nAsyncMouseReleaseId = nullptr;
163  }
164 }
165 
166 static const char* SCSTR_CONTENT_ARY[] =
167 {
168  SCSTR_CONTENT_ROOT,
169  SCSTR_CONTENT_TABLE,
170  SCSTR_CONTENT_RANGENAME,
171  SCSTR_CONTENT_DBAREA,
172  SCSTR_CONTENT_GRAPHIC,
173  SCSTR_CONTENT_OLEOBJECT,
174  SCSTR_CONTENT_NOTE,
175  SCSTR_CONTENT_AREALINK,
176  SCSTR_CONTENT_DRAWING
177 };
178 
180 {
181  if ( nType == ScContentId::ROOT )
182  return;
183 
184  if ( nRootType != ScContentId::ROOT && nRootType != nType ) // hidden ?
185  {
186  m_aRootNodes[nType] = nullptr;
187  return;
188  }
189 
190  auto const aImage(aContentBmps[static_cast<int>(nType) - 1]);
191  OUString aName(ScResId(SCSTR_CONTENT_ARY[static_cast<int>(nType)]));
192  // back to the correct position:
193  sal_uInt16 nPos = nRootType != ScContentId::ROOT ? 0 : pPosList[nType]-1;
194  m_aRootNodes[nType] = m_xTreeView->make_iterator();
195  m_xTreeView->insert(nullptr, nPos, &aName, nullptr, nullptr, nullptr, false, m_aRootNodes[nType].get());
196  m_xTreeView->set_image(*m_aRootNodes[nType], OUString(aImage));
197 }
198 
200 {
201  //There are one method in Control::SetUpdateMode(), and one override method SvTreeListBox::SetUpdateMode(). Here although
202  //SvTreeListBox::SetUpdateMode() is called in refresh method, it only call SvTreeListBox::SetUpdateMode(), not Control::SetUpdateMode().
203  //In m_xTreeView->clear(), Broadcast( LISTACTION_CLEARED ) will be called and finally, it will be trapped into the event yield() loop. And
204  //the InitRoot() method won't be called. Then if a user click or press key to update the navigator tree, crash happens.
205  //So the solution is to disable the UpdateMode of Control, then call Clear(), then recover the update mode
206  bool bWasFrozen = m_bFreeze;
207  if (!bWasFrozen)
208  freeze();
209  m_xTreeView->clear();
210  if (!bWasFrozen)
211  thaw();
212  for (sal_uInt16 i=1; i<=int(ScContentId::LAST); i++)
213  InitRoot(static_cast<ScContentId>(i));
214 }
215 
217 {
218  if (nType == ScContentId::ROOT)
219  ClearAll();
220  else
221  {
222  weld::TreeIter* pParent = m_aRootNodes[nType].get();
223  if (!pParent || m_xTreeView->iter_has_child(*pParent)) // not if no children existing
224  {
225  if (pParent)
226  m_xTreeView->remove(*pParent); // with all children
227  InitRoot( nType ); // if needed insert anew
228  }
229  }
230 }
231 
232 void ScContentTree::InsertContent( ScContentId nType, const OUString& rValue )
233 {
234  weld::TreeIter* pParent = m_aRootNodes[nType].get();
235  if (pParent)
236  {
237  m_xTreeView->insert(pParent, -1, &rValue, nullptr, nullptr, nullptr, false, m_xScratchIter.get());
238  m_xTreeView->set_sensitive(*m_xScratchIter, true);
239  }
240  else
241  {
242  OSL_FAIL("InsertContent without parent");
243  }
244 }
245 
246 void ScContentTree::GetEntryIndexes(ScContentId& rnRootIndex, sal_uLong& rnChildIndex, const weld::TreeIter* pEntry) const
247 {
248  rnRootIndex = ScContentId::ROOT;
249  rnChildIndex = SC_CONTENT_NOCHILD;
250 
251  if( !pEntry )
252  return;
253 
254  std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator(pEntry));
255  if (!m_xTreeView->iter_parent(*xParent))
256  xParent.reset();
257  bool bFound = false;
258  for( int i = 1; !bFound && (i <= int(ScContentId::LAST)); ++i )
259  {
260  ScContentId nRoot = static_cast<ScContentId>(i);
261  if (!m_aRootNodes[nRoot])
262  continue;
263  if (m_xTreeView->iter_compare(*pEntry, *m_aRootNodes[nRoot]) == 0)
264  {
265  rnRootIndex = nRoot;
266  rnChildIndex = ~0UL;
267  bFound = true;
268  }
269  else if (xParent && m_xTreeView->iter_compare(*xParent, *m_aRootNodes[nRoot]) == 0)
270  {
271  rnRootIndex = nRoot;
272 
273  // search the entry in all child entries of the parent
274  sal_uLong nEntry = 0;
275  std::unique_ptr<weld::TreeIter> xIterEntry(m_xTreeView->make_iterator(xParent.get()));
276  bool bIterEntry = m_xTreeView->iter_children(*xIterEntry);
277  while (!bFound && bIterEntry)
278  {
279  if (m_xTreeView->iter_compare(*pEntry, *xIterEntry) == 0)
280  {
281  rnChildIndex = nEntry;
282  bFound = true; // exit the while loop
283  }
284  bIterEntry = m_xTreeView->iter_next_sibling(*xIterEntry);
285  ++nEntry;
286  }
287 
288  bFound = true; // exit the for loop
289  }
290  }
291 }
292 
294 {
295  ScContentId nRoot;
296  sal_uLong nChild;
297  GetEntryIndexes(nRoot, nChild, pEntry);
298  return nChild;
299 }
300 
301 static OUString lcl_GetDBAreaRange( const ScDocument* pDoc, const OUString& rDBName )
302 {
303  OUString aRet;
304  if (pDoc)
305  {
306  ScDBCollection* pDbNames = pDoc->GetDBCollection();
307  const ScDBData* pData = pDbNames->getNamedDBs().findByUpperName(ScGlobal::getCharClassPtr()->uppercase(rDBName));
308  if (pData)
309  {
310  ScRange aRange;
311  pData->GetArea(aRange);
312  aRet = aRange.Format(*pDoc, ScRefFlags::RANGE_ABS_3D);
313  }
314  }
315  return aRet;
316 }
317 
318 IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl, weld::TreeView&, bool)
319 {
321  sal_uLong nChild;
322  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
323  if (!m_xTreeView->get_cursor(xEntry.get()))
324  xEntry.reset();
325  GetEntryIndexes(nType, nChild, xEntry.get());
326 
327  if (xEntry && (nType != ScContentId::ROOT) && (nChild != SC_CONTENT_NOCHILD))
328  {
329  if ( bHiddenDoc )
330  return false;
331 
332  OUString aText(m_xTreeView->get_text(*xEntry));
333 
334  if ( !aManualDoc.isEmpty() )
335  pParentWindow->SetCurrentDoc( aManualDoc );
336 
337  switch( nType )
338  {
339  case ScContentId::TABLE:
340  {
341  // tdf#133159 store current config before changing sheet
342  // plausible that this should be done for all cases, but this
343  // is the known case that needs it
344  StoreNavigatorSettings();
345  pParentWindow->SetCurrentTableStr( aText );
346  }
347  break;
348 
350  pParentWindow->SetCurrentCellStr( aText );
351  break;
352 
353  case ScContentId::DBAREA:
354  {
355  // If the same names of area and DB exists, then
356  // SID_CURRENTCELL takes the area name.
357  // Therefore for DB areas access them directly via address.
358 
359  OUString aRangeStr = lcl_GetDBAreaRange( GetSourceDocument(), aText );
360  if (!aRangeStr.isEmpty())
361  pParentWindow->SetCurrentCellStr( aRangeStr );
362  }
363  break;
364 
368  pParentWindow->SetCurrentObject( aText );
369  break;
370 
371  case ScContentId::NOTE:
372  {
373  ScAddress aPos = GetNotePos( nChild );
374  pParentWindow->SetCurrentTable( aPos.Tab() );
375  pParentWindow->SetCurrentCell( aPos.Col(), aPos.Row() );
376  }
377  break;
378 
380  {
381  const ScAreaLink* pLink = GetLink(nChild);
382  ScDocument* pSrcDoc = GetSourceDocument();
383  if (pLink && pSrcDoc)
384  {
385  const ScRange& aRange = pLink->GetDestArea();
386  OUString aRangeStr(aRange.Format(*pSrcDoc, ScRefFlags::RANGE_ABS_3D, pSrcDoc->GetAddressConvention()));
387  pParentWindow->SetCurrentCellStr( aRangeStr );
388  }
389  }
390  break;
391  default: break;
392  }
393 
394  ScNavigatorDlg::ReleaseFocus(); // set focus into document
395  }
396 
397  return false;
398 }
399 
401 {
403  m_nAsyncMouseReleaseId = Application::PostUserEvent(LINK(this, ScContentTree, AsyncStoreNavigatorSettings));
404 }
405 
406 IMPL_LINK_NOARG(ScContentTree, MouseReleaseHdl, const MouseEvent&, bool)
407 {
408  LaunchAsyncStoreNavigatorSettings();
409  return false;
410 }
411 
412 IMPL_LINK_NOARG(ScContentTree, AsyncStoreNavigatorSettings, void*, void)
413 {
414  m_nAsyncMouseReleaseId = nullptr;
415  StoreNavigatorSettings();
416 }
417 
418 IMPL_LINK(ScContentTree, KeyInputHdl, const KeyEvent&, rKEvt, bool)
419 {
420  bool bUsed = false;
421 
422  const vcl::KeyCode aCode = rKEvt.GetKeyCode();
423  if (aCode.GetCode() == KEY_RETURN)
424  {
425  switch (aCode.GetModifier())
426  {
427  case KEY_MOD1:
428  ToggleRoot(); // toggle root mode (as in Writer)
429  bUsed = true;
430  break;
431  case 0:
432  {
433  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
434  if (!m_xTreeView->get_cursor(xEntry.get()))
435  xEntry.reset();
436  if (xEntry)
437  {
439  sal_uLong nChild;
440  GetEntryIndexes(nType, nChild, xEntry.get());
441 
442  if (nType != ScContentId::ROOT && nChild == SC_CONTENT_NOCHILD)
443  {
444  if (m_xTreeView->get_row_expanded(*xEntry))
445  m_xTreeView->collapse_row(*xEntry);
446  else
447  m_xTreeView->expand_row(*xEntry);
448  }
449  else
450  ContentDoubleClickHdl(*m_xTreeView); // select content as if double clicked
451  }
452 
453  bUsed = true;
454  }
455  break;
456  }
457  }
458  //Make KEY_SPACE has same function as DoubleClick
459  if ( bisInNavigatoeDlg )
460  {
461  if(aCode.GetCode() == KEY_SPACE )
462  {
463  bUsed = true;
465  sal_uLong nChild;
466  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
467  if (!m_xTreeView->get_cursor(xEntry.get()))
468  xEntry.reset();
469  GetEntryIndexes(nType, nChild, xEntry.get());
470 
471  if (xEntry && (nType != ScContentId::ROOT) && (nChild != SC_CONTENT_NOCHILD))
472  {
473  if ( bHiddenDoc )
474  return true;
475  OUString aText(m_xTreeView->get_text(*xEntry));
476  sKeyString = aText;
477  if (!aManualDoc.isEmpty())
478  pParentWindow->SetCurrentDoc( aManualDoc );
479  switch (nType)
480  {
484  {
485  ScDrawView* pScDrawView = nullptr;
486  ScTabViewShell* pScTabViewShell = ScNavigatorDlg::GetTabViewShell();
487  if (pScTabViewShell)
488  pScDrawView = pScTabViewShell->GetViewData().GetScDrawView();
489  if (pScDrawView)
490  {
491  pScDrawView->SelectCurrentViewObject(aText);
492  bool bHasMakredObject = false;
493  weld::TreeIter* pParent = m_aRootNodes[nType].get();
494  std::unique_ptr<weld::TreeIter> xBeginEntry(m_xTreeView->make_iterator(pParent));
495  bool bBeginEntry = false;
496  if (pParent)
497  bBeginEntry = m_xTreeView->iter_children(*xBeginEntry);
498  while (bBeginEntry)
499  {
500  OUString aTempText(m_xTreeView->get_text(*xBeginEntry));
501  if( pScDrawView->GetObjectIsMarked( pScDrawView->GetObjectByName( aTempText ) ) )
502  {
503  bHasMakredObject = true;
504  break;
505  }
506  bBeginEntry = m_xTreeView->iter_next(*xBeginEntry);
507  }
508  if (!bHasMakredObject && pScTabViewShell)
509  pScTabViewShell->SetDrawShell(false);
510  ObjectFresh(nType, xEntry.get());
511  }
512  break;
513  }
514  default:
515  break;
516  }
517  }
518  }
519  }
520 
521  if (!bUsed)
522  {
523  if (aCode.GetCode() == KEY_F5)
524  StoreNavigatorSettings();
525  else
526  LaunchAsyncStoreNavigatorSettings();
527  }
528 
529  return bUsed;
530 }
531 
532 IMPL_LINK(ScContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
533 {
534  bool bDone = false;
535 
536  switch ( rCEvt.GetCommand() )
537  {
538  case CommandEventId::ContextMenu:
539  {
540  // drag-and-drop mode
541  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xTreeView.get(), "modules/scalc/ui/dropmenu.ui"));
542  std::unique_ptr<weld::Menu> xPop(xBuilder->weld_menu("contextmenu"));
543  std::unique_ptr<weld::Menu> xDropMenu(xBuilder->weld_menu("dragmodesubmenu"));
544 
545  switch (pParentWindow->GetDropMode())
546  {
547  case 0:
548  xDropMenu->set_active("hyperlink", true);
549  break;
550  case 1:
551  xDropMenu->set_active("link", true);
552  break;
553  case 2:
554  xDropMenu->set_active("copy", true);
555  break;
556  }
557 
558  // displayed document
559  std::unique_ptr<weld::Menu> xDocMenu(xBuilder->weld_menu("displaymenu"));
560 //TODO aDocMenu->SetMenuFlags( aDocMenu->GetMenuFlags() | MenuFlags::NoAutoMnemonics );
561  sal_uInt16 i=0;
562  OUString sActive;
563  OUString sId;
564  // loaded documents
565  ScDocShell* pCurrentSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() );
567  while ( pSh )
568  {
569  if ( dynamic_cast<const ScDocShell*>( pSh) != nullptr )
570  {
571  OUString aName = pSh->GetTitle();
572  OUString aEntry = aName;
573  if ( pSh == pCurrentSh )
574  aEntry += pParentWindow->aStrActive;
575  else
576  aEntry += pParentWindow->aStrNotActive;
577  ++i;
578  sId = "document" + OUString::number(i);
579  xDocMenu->append_radio(sId, aEntry);
580  if ( !bHiddenDoc && aName == aManualDoc )
581  sActive = sId;
582  }
583  pSh = SfxObjectShell::GetNext( *pSh );
584  }
585  // "active window"
586  ++i;
587  sId = "document" + OUString::number(i);
588  xDocMenu->append_radio(sId, pParentWindow->aStrActiveWin);
589  if (!bHiddenDoc && aManualDoc.isEmpty())
590  sActive = sId;
591  // hidden document
592  if ( !aHiddenTitle.isEmpty() )
593  {
594  OUString aEntry = aHiddenTitle + pParentWindow->aStrHidden;
595  ++i;
596  sId = "document" + OUString::number(i);
597  xDocMenu->append_radio(sId, aEntry);
598  if (bHiddenDoc)
599  sActive = sId;
600  }
601  xDocMenu->set_active(sActive.toUtf8(), true);
602 
603  OString sIdent = xPop->popup_at_rect(m_xTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1)));
604  if (sIdent == "hyperlink")
605  pParentWindow->SetDropMode(0);
606  else if (sIdent == "link")
607  pParentWindow->SetDropMode(1);
608  else if (sIdent == "copy")
609  pParentWindow->SetDropMode(2);
610  else if (sIdent.startsWith("document"))
611  {
612  OUString aName = xDocMenu->get_label(sIdent);
613  SelectDoc(aName);
614  }
615  }
616  break;
617  default: break;
618  }
619 
620  return bDone;
621 }
622 
623 IMPL_LINK(ScContentTree, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUString)
624 {
625  OUString aHelpText;
626 
627  std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator(&rEntry));
628  if (!m_xTreeView->iter_parent(*xParent))
629  xParent.reset();
630 
631  if (!xParent) // Top-Level ?
632  {
633  aHelpText = OUString::number(m_xTreeView->iter_n_children(rEntry)) +
634  " " + m_xTreeView->get_text(rEntry);
635  }
636  else if (m_aRootNodes[ScContentId::NOTE] && m_xTreeView->iter_compare(*xParent, *m_aRootNodes[ScContentId::NOTE]) == 0)
637  {
638  aHelpText = m_xTreeView->get_text(rEntry); // notes as help text
639  }
640  else if (m_aRootNodes[ScContentId::AREALINK] && m_xTreeView->iter_compare(*xParent, *m_aRootNodes[ScContentId::AREALINK]) == 0)
641  {
642  auto nIndex = GetChildIndex(&rEntry);
643  if (nIndex != SC_CONTENT_NOCHILD)
644  {
645  const ScAreaLink* pLink = GetLink(nIndex);
646  if (pLink)
647  {
648  aHelpText = pLink->GetFile(); // source file as help text
649  }
650  }
651  }
652 
653  return aHelpText;
654 }
655 
657 {
658  if (bHiddenDoc)
659  return pHiddenDocument;
660  else
661  {
663  if (pSh)
664  return &pSh->GetDocument();
665 
666  }
667  return nullptr;
668 }
669 
670 //Move along and draw "*" sign .
672 {
673  if (bHiddenDoc && !pHiddenDocument)
674  return; // other document displayed
675 
676  if (!(nType == ScContentId::GRAPHIC || nType == ScContentId::OLEOBJECT || nType == ScContentId::DRAWING))
677  return;
678 
679  auto nOldChildren = m_aRootNodes[nType] ? m_xTreeView->iter_n_children(*m_aRootNodes[nType]) : 0;
680  auto nOldPos = m_xTreeView->vadjustment_get_value();
681 
682  freeze();
683  ClearType( nType );
684  GetDrawNames( nType/*, nId*/ );
685  thaw();
686 
687  auto nNewChildren = m_aRootNodes[nType] ? m_xTreeView->iter_n_children(*m_aRootNodes[nType]) : 0;
688  bool bRestorePos = nOldChildren == nNewChildren;
689 
690  if (!pEntry)
691  ApplyNavigatorSettings(bRestorePos, nOldPos);
692  if (!pEntry)
693  return;
694 
695  weld::TreeIter* pParent = m_aRootNodes[nType].get();
696  std::unique_ptr<weld::TreeIter> xOldEntry;
697  std::unique_ptr<weld::TreeIter> xBeginEntry(m_xTreeView->make_iterator(pParent));
698  bool bBeginEntry = false;
699  if( pParent )
700  bBeginEntry = m_xTreeView->iter_children(*xBeginEntry);
701  while (bBeginEntry)
702  {
703  OUString aTempText(m_xTreeView->get_text(*xBeginEntry));
704  if (aTempText == sKeyString)
705  {
706  xOldEntry = m_xTreeView->make_iterator(xBeginEntry.get());
707  break;
708  }
709  bBeginEntry = m_xTreeView->iter_next(*xBeginEntry);
710  }
711  if (xOldEntry)
712  {
713  m_xTreeView->expand_row(*pParent);
714  m_xTreeView->select(*xOldEntry);
715  m_xTreeView->set_cursor(*xOldEntry);
717  }
718 }
719 
721 {
722  if ( bHiddenDoc && !pHiddenDocument )
723  return; // other document displayed
724 
725  // if nothing has changed the cancel right away (against flicker)
726 
727  if ( nType == ScContentId::NOTE )
728  if (!NoteStringsChanged())
729  return;
730  if ( nType == ScContentId::GRAPHIC )
732  return;
733  if ( nType == ScContentId::OLEOBJECT )
735  return;
736  if ( nType == ScContentId::DRAWING )
738  return;
739 
740  freeze();
741 
742  ClearType( nType );
743 
744  if ( nType == ScContentId::ROOT || nType == ScContentId::TABLE )
745  GetTableNames();
746  if ( nType == ScContentId::ROOT || nType == ScContentId::RANGENAME )
747  GetAreaNames();
748  if ( nType == ScContentId::ROOT || nType == ScContentId::DBAREA )
749  GetDbNames();
750  if ( nType == ScContentId::ROOT || nType == ScContentId::GRAPHIC )
751  GetGraphicNames();
752  if ( nType == ScContentId::ROOT || nType == ScContentId::OLEOBJECT )
753  GetOleNames();
754  if ( nType == ScContentId::ROOT || nType == ScContentId::DRAWING )
755  GetDrawingNames();
756  if ( nType == ScContentId::ROOT || nType == ScContentId::NOTE )
757  GetNoteStrings();
758  if ( nType == ScContentId::ROOT || nType == ScContentId::AREALINK )
759  GetLinkNames();
760 
761  thaw();
762 
764 }
765 
767 {
768  if ( nRootType != ScContentId::ROOT && nRootType != ScContentId::TABLE ) // hidden ?
769  return;
770 
771  ScDocument* pDoc = GetSourceDocument();
772  if (!pDoc)
773  return;
774 
775  OUString aName;
776  SCTAB nCount = pDoc->GetTableCount();
777  for ( SCTAB i=0; i<nCount; i++ )
778  {
779  pDoc->GetName( i, aName );
781  }
782 }
783 
784 namespace {
785 
786 OUString createLocalRangeName(std::u16string_view rName, std::u16string_view rTableName)
787 {
788  return OUString::Concat(rName) + " (" + rTableName + ")";
789 }
790 }
791 
793 {
794  if ( nRootType != ScContentId::ROOT && nRootType != ScContentId::RANGENAME ) // hidden ?
795  return;
796 
797  ScDocument* pDoc = GetSourceDocument();
798  if (!pDoc)
799  return;
800 
801  ScRange aDummy;
802  std::set<OUString> aSet;
803  ScRangeName* pRangeNames = pDoc->GetRangeName();
804  for (const auto& rEntry : *pRangeNames)
805  {
806  if (rEntry.second->IsValidReference(aDummy))
807  aSet.insert(rEntry.second->GetName());
808  }
809  for (SCTAB i = 0; i < pDoc->GetTableCount(); ++i)
810  {
811  ScRangeName* pLocalRangeName = pDoc->GetRangeName(i);
812  if (pLocalRangeName && !pLocalRangeName->empty())
813  {
814  OUString aTableName;
815  pDoc->GetName(i, aTableName);
816  for (const auto& rEntry : *pLocalRangeName)
817  {
818  if (rEntry.second->IsValidReference(aDummy))
819  aSet.insert(createLocalRangeName(rEntry.second->GetName(), aTableName));
820  }
821  }
822  }
823 
824  for (const auto& rItem : aSet)
825  {
827  }
828 }
829 
831 {
832  if ( nRootType != ScContentId::ROOT && nRootType != ScContentId::DBAREA ) // hidden ?
833  return;
834 
835  ScDocument* pDoc = GetSourceDocument();
836  if (!pDoc)
837  return;
838 
839  ScDBCollection* pDbNames = pDoc->GetDBCollection();
840  const ScDBCollection::NamedDBs& rDBs = pDbNames->getNamedDBs();
841  for (const auto& rxDB : rDBs)
842  {
843  const OUString& aStrName = rxDB->GetName();
845  }
846 }
847 
848 bool ScContentTree::IsPartOfType( ScContentId nContentType, sal_uInt16 nObjIdentifier )
849 {
850  bool bRet = false;
851  switch ( nContentType )
852  {
854  bRet = ( nObjIdentifier == OBJ_GRAF );
855  break;
857  bRet = ( nObjIdentifier == OBJ_OLE2 );
858  break;
860  bRet = ( nObjIdentifier != OBJ_GRAF && nObjIdentifier != OBJ_OLE2 ); // everything else
861  break;
862  default:
863  OSL_FAIL("unknown content type");
864  }
865  return bRet;
866 }
867 
869 {
870  if ( nRootType != ScContentId::ROOT && nRootType != nType ) // hidden ?
871  return;
872 
873  ScDocument* pDoc = GetSourceDocument();
874  if (!pDoc)
875  return;
876 
877  // iterate in flat mode for groups
878  SdrIterMode eIter = ( nType == ScContentId::DRAWING ) ? SdrIterMode::Flat : SdrIterMode::DeepNoGroups;
879 
880  ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
881  SfxObjectShell* pShell = pDoc->GetDocumentShell();
882  if (!(pDrawLayer && pShell))
883  return;
884 
885  SCTAB nTabCount = pDoc->GetTableCount();
886  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
887  {
888  SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
889  OSL_ENSURE(pPage,"Page ?");
890  if (pPage)
891  {
892  SdrObjListIter aIter( pPage, eIter );
893  SdrObject* pObject = aIter.Next();
894  while (pObject)
895  {
896  if ( IsPartOfType( nType, pObject->GetObjIdentifier() ) )
897  {
898  OUString aName = ScDrawLayer::GetVisibleName( pObject );
899  if (!aName.isEmpty())
900  {
901  if( bisInNavigatoeDlg )
902  {
903  weld::TreeIter* pParent = m_aRootNodes[nType].get();
904  if (pParent)
905  {
906  m_xTreeView->insert(pParent, -1, &aName, nullptr, nullptr, nullptr, false, m_xScratchIter.get());
907  m_xTreeView->set_sensitive(*m_xScratchIter, true);
908  }//end if parent
909  else
910  SAL_WARN("sc", "InsertContent without parent");
911  }
912  }
913 
914  }
915 
916  pObject = aIter.Next();
917  }
918  }
919  }
920 }
921 
923 {
925 }
926 
928 {
930 }
931 
933 {
935 }
936 
938 {
939  if ( nRootType != ScContentId::ROOT && nRootType != ScContentId::AREALINK ) // hidden ?
940  return;
941 
942  ScDocument* pDoc = GetSourceDocument();
943  if (!pDoc)
944  return;
945 
946  sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
947  OSL_ENSURE(pLinkManager, "no LinkManager on document?");
948  const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
949  sal_uInt16 nCount = rLinks.size();
950  for (sal_uInt16 i=0; i<nCount; i++)
951  {
952  ::sfx2::SvBaseLink* pBase = rLinks[i].get();
953  if (auto pScAreaLink = dynamic_cast<const ScAreaLink*>( pBase))
954  InsertContent( ScContentId::AREALINK, pScAreaLink->GetSource() );
955 
956  // insert in list the names of source areas
957  }
958 }
959 
961 {
962  ScDocument* pDoc = GetSourceDocument();
963  if (!pDoc)
964  return nullptr;
965 
966  sal_uLong nFound = 0;
967  sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
968  OSL_ENSURE(pLinkManager, "no LinkManager on document?");
969  const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
970  sal_uInt16 nCount = rLinks.size();
971  for (sal_uInt16 i=0; i<nCount; i++)
972  {
973  ::sfx2::SvBaseLink* pBase = rLinks[i].get();
974  if (auto pAreaLink = dynamic_cast<const ScAreaLink*>( pBase))
975  {
976  if (nFound == nIndex)
977  return pAreaLink;
978  ++nFound;
979  }
980  }
981 
982  OSL_FAIL("link not found");
983  return nullptr;
984 }
985 
986 static OUString lcl_NoteString( const ScPostIt& rNote )
987 {
988  OUString aText = rNote.GetText();
989  sal_Int32 nAt;
990  while ( (nAt = aText.indexOf( '\n' )) != -1 )
991  aText = aText.replaceAt( nAt, 1, " " );
992  return aText;
993 }
994 
996 {
997  if ( nRootType != ScContentId::ROOT && nRootType != ScContentId::NOTE ) // hidden ?
998  return;
999 
1000  ScDocument* pDoc = GetSourceDocument();
1001  if (!pDoc)
1002  return;
1003 
1004  // loop over cell notes
1005  std::vector<sc::NoteEntry> aEntries;
1006  pDoc->GetAllNoteEntries(aEntries);
1007  for (const auto& rEntry : aEntries)
1009 }
1010 
1012 {
1013  ScDocument* pDoc = GetSourceDocument();
1014  if (!pDoc)
1015  return ScAddress();
1016 
1017  return pDoc->GetNotePosition(nIndex);
1018 }
1019 
1021 {
1022  ScDocument* pDoc = GetSourceDocument();
1023  if (!pDoc)
1024  return false;
1025 
1026  weld::TreeIter* pParent = m_aRootNodes[ScContentId::NOTE].get();
1027  if (!pParent)
1028  return false;
1029 
1030  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator(pParent));
1031  bool bEntry = m_xTreeView->iter_children(*xEntry);
1032 
1033  std::vector<sc::NoteEntry> aEntries;
1034  pDoc->GetAllNoteEntries(aEntries);
1035  for (const auto& rEntry : aEntries)
1036  {
1037  const ScPostIt* pNote = rEntry.mpNote;
1038  if (!bEntry)
1039  return true;
1040 
1041  if (lcl_NoteString(*pNote) != m_xTreeView->get_text(*xEntry))
1042  return true;
1043 
1044  bEntry = m_xTreeView->iter_next_sibling(*xEntry);
1045  }
1046 
1047  return bEntry;
1048 }
1049 
1051 {
1052  ScDocument* pDoc = GetSourceDocument();
1053  if (!pDoc)
1054  return false;
1055 
1056  weld::TreeIter* pParent = m_aRootNodes[nType].get();
1057  if (!pParent)
1058  return false;
1059 
1060  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator(pParent));
1061  bool bEntry = m_xTreeView->iter_children(*xEntry);
1062 
1063  // iterate in flat mode for groups
1064  SdrIterMode eIter = ( nType == ScContentId::DRAWING ) ? SdrIterMode::Flat : SdrIterMode::DeepNoGroups;
1065 
1066  bool bEqual = true;
1067  ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
1068  SfxObjectShell* pShell = pDoc->GetDocumentShell();
1069  if (pDrawLayer && pShell)
1070  {
1071  SCTAB nTabCount = pDoc->GetTableCount();
1072  for (SCTAB nTab=0; nTab<nTabCount && bEqual; nTab++)
1073  {
1074  SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
1075  OSL_ENSURE(pPage,"Page ?");
1076  if (pPage)
1077  {
1078  SdrObjListIter aIter( pPage, eIter );
1079  SdrObject* pObject = aIter.Next();
1080  while (pObject && bEqual)
1081  {
1082  if ( IsPartOfType( nType, pObject->GetObjIdentifier() ) )
1083  {
1084  if ( !bEntry )
1085  bEqual = false;
1086  else
1087  {
1088  if (ScDrawLayer::GetVisibleName(pObject) != m_xTreeView->get_text(*xEntry))
1089  bEqual = false;
1090 
1091  bEntry = m_xTreeView->iter_next_sibling(*xEntry);
1092  }
1093  }
1094  pObject = aIter.Next();
1095  }
1096  }
1097  }
1098  }
1099 
1100  if ( bEntry )
1101  bEqual = false; // anything else
1102 
1103  return !bEqual;
1104 }
1105 
1106 static bool lcl_GetRange( const ScDocument& rDoc, ScContentId nType, const OUString& rName, ScRange& rRange )
1107 {
1108  bool bFound = false;
1109 
1110  if ( nType == ScContentId::RANGENAME )
1111  {
1112  ScRangeName* pList = rDoc.GetRangeName();
1113  if (pList)
1114  {
1115  const ScRangeData* p = pList->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(rName));
1116  if (p && p->IsValidReference(rRange))
1117  bFound = true;
1118  }
1119  }
1120  else if ( nType == ScContentId::DBAREA )
1121  {
1122  ScDBCollection* pList = rDoc.GetDBCollection();
1123  if (pList)
1124  {
1125  const ScDBData* p = pList->getNamedDBs().findByUpperName(ScGlobal::getCharClassPtr()->uppercase(rName));
1126  if (p)
1127  {
1128  SCTAB nTab;
1129  SCCOL nCol1, nCol2;
1130  SCROW nRow1, nRow2;
1131  p->GetArea(nTab, nCol1, nRow1, nCol2, nRow2);
1132  rRange = ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab);
1133  bFound = true;
1134  }
1135  }
1136  }
1137 
1138  return bFound;
1139 }
1140 
1141 static bool lcl_DoDragObject( ScDocShell* pSrcShell, std::u16string_view rName, ScContentId nType, weld::TreeView& rTreeView )
1142 {
1143  bool bDisallow = true;
1144 
1145  ScDocument& rSrcDoc = pSrcShell->GetDocument();
1146  ScDrawLayer* pModel = rSrcDoc.GetDrawLayer();
1147  if (pModel)
1148  {
1149  bool bOle = ( nType == ScContentId::OLEOBJECT );
1150  bool bGraf = ( nType == ScContentId::GRAPHIC );
1151  sal_uInt16 nDrawId = sal::static_int_cast<sal_uInt16>( bOle ? OBJ_OLE2 : ( bGraf ? OBJ_GRAF : OBJ_GRUP ) );
1152  SCTAB nTab = 0;
1153  SdrObject* pObject = pModel->GetNamedObject( rName, nDrawId, nTab );
1154  if (pObject)
1155  {
1156  SdrView aEditView(*pModel);
1157  aEditView.ShowSdrPage(aEditView.GetModel()->GetPage(nTab));
1158  SdrPageView* pPV = aEditView.GetSdrPageView();
1159  aEditView.MarkObj(pObject, pPV);
1160 
1161  // tdf125520 this is a D&D-start potentially with an OLE object. If
1162  // so, we need to do similar as e.g. in ScDrawView::BeginDrag so that
1163  // the temporary SdrModel for transfer does have a GetPersist() so
1164  // that the EmbeddedObjectContainer gets copied. We need no CheckOle
1165  // here, test is simpler.
1166  ScDocShellRef aDragShellRef;
1167  if(OBJ_OLE2 == pObject->GetObjIdentifier())
1168  {
1169  aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately
1170  aDragShellRef->DoInitNew();
1171  }
1172 
1173  ScDrawLayer::SetGlobalDrawPersist(aDragShellRef.get());
1174  std::unique_ptr<SdrModel> pDragModel(aEditView.CreateMarkedObjModel());
1176 
1178  pSrcShell->FillTransferableObjectDescriptor( aObjDesc );
1179  aObjDesc.maDisplayName = pSrcShell->GetMedium()->GetURLObject().GetURLNoPass();
1180  // maSize is set in ScDrawTransferObj ctor
1181 
1182  rtl::Reference<ScDrawTransferObj> pTransferObj = new ScDrawTransferObj( std::move(pDragModel), pSrcShell, aObjDesc );
1183 
1184  pTransferObj->SetDragSourceObj( *pObject, nTab );
1185  pTransferObj->SetDragSourceFlags(ScDragSrc::Navigator);
1186 
1187  SC_MOD()->SetDragObject( nullptr, pTransferObj.get() );
1188 
1189  rtl::Reference<TransferDataContainer> xHelper(pTransferObj);
1190  rTreeView.enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
1191 
1192  bDisallow = false;
1193  }
1194  }
1195 
1196  return bDisallow;
1197 }
1198 
1199 static bool lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, ScDragSrc nFlags, weld::TreeView& rTreeView )
1200 {
1201  bool bDisallow = true;
1202 
1203  ScDocument& rSrcDoc = pSrcShell->GetDocument();
1204  ScMarkData aMark(rSrcDoc.GetSheetLimits());
1205  aMark.SelectTable( rRange.aStart.Tab(), true );
1206  aMark.SetMarkArea( rRange );
1207 
1208  if ( !rSrcDoc.HasSelectedBlockMatrixFragment( rRange.aStart.Col(), rRange.aStart.Row(),
1209  rRange.aEnd.Col(), rRange.aEnd.Row(),
1210  aMark ) )
1211  {
1213  ScClipParam aClipParam(rRange, false);
1214  rSrcDoc.CopyToClip(aClipParam, pClipDoc.get(), &aMark, false, false);
1215  // pClipDoc->ExtendMerge( rRange, sal_True );
1216 
1218  pSrcShell->FillTransferableObjectDescriptor( aObjDesc );
1219  aObjDesc.maDisplayName = pSrcShell->GetMedium()->GetURLObject().GetURLNoPass();
1220  // maSize is set in ScTransferObj ctor
1221 
1222  rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( std::move(pClipDoc), aObjDesc );
1223 
1224  pTransferObj->SetDragSource( pSrcShell, aMark );
1225  pTransferObj->SetDragSourceFlags( nFlags );
1226 
1227  SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D
1228 
1229  rtl::Reference<TransferDataContainer> xHelper(pTransferObj);
1230  rTreeView.enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
1231 
1232  bDisallow = false;
1233  }
1234 
1235  return bDisallow;
1236 }
1237 
1238 IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool)
1239 {
1240  rUnsetDragIcon = true;
1241 
1242  StoreNavigatorSettings();
1243 
1244  bool bDisallow = true;
1245 
1246  std::unique_ptr<ScDocumentLoader> pDocLoader;
1247 
1248  ScModule* pScMod = SC_MOD();
1249 
1251  sal_uLong nChild;
1252 
1253  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
1254  if (!m_xTreeView->get_cursor(xEntry.get()))
1255  xEntry.reset();
1256 
1257  GetEntryIndexes(nType, nChild, xEntry.get());
1258 
1259  if( xEntry &&
1260  (nChild != SC_CONTENT_NOCHILD) &&
1261  (nType != ScContentId::ROOT) &&
1262  (nType != ScContentId::NOTE) &&
1263  (nType != ScContentId::AREALINK) )
1264  {
1265  OUString aText(m_xTreeView->get_text(*xEntry));
1266 
1267  ScDocument* pLocalDoc = nullptr; // for URL drop
1268  OUString aDocName;
1269  if (bHiddenDoc)
1270  aDocName = aHiddenName;
1271  else
1272  {
1273  ScDocShell* pDocSh = GetManualOrCurrent();
1274  if (pDocSh)
1275  {
1276  if (pDocSh->HasName())
1277  aDocName = pDocSh->GetMedium()->GetName();
1278  else
1279  pLocalDoc = &pDocSh->GetDocument(); // drop only in this document
1280  }
1281  }
1282 
1283  bool bDoLinkTrans = false; // use ScLinkTransferObj
1284  OUString aLinkURL; // for ScLinkTransferObj
1285  OUString aLinkText;
1286 
1287  sal_uInt16 nDropMode = pParentWindow->GetDropMode();
1288  switch ( nDropMode )
1289  {
1290  case SC_DROPMODE_URL:
1291  {
1292  OUString aUrl = aDocName + "#" + aText;
1293 
1294  pScMod->SetDragJump( pLocalDoc, aUrl, aText );
1295 
1296  if (!aDocName.isEmpty())
1297  {
1298  // provide URL to outside only if the document has a name
1299  // (without name, only internal D&D via SetDragJump)
1300 
1301  aLinkURL = aUrl;
1302  aLinkText = aText;
1303  }
1304  bDoLinkTrans = true;
1305  }
1306  break;
1307  case SC_DROPMODE_LINK:
1308  {
1309  if ( !aDocName.isEmpty() ) // link only to named documents
1310  {
1311  // for internal D&D, set flag to insert a link
1312 
1313  switch ( nType )
1314  {
1315  case ScContentId::TABLE:
1316  pScMod->SetDragLink( aDocName, aText, EMPTY_OUSTRING );
1317  bDoLinkTrans = true;
1318  break;
1320  case ScContentId::DBAREA:
1321  pScMod->SetDragLink( aDocName, EMPTY_OUSTRING, aText );
1322  bDoLinkTrans = true;
1323  break;
1324 
1325  // other types cannot be linked
1326  default: break;
1327  }
1328  }
1329  }
1330  break;
1331  case SC_DROPMODE_COPY:
1332  {
1333  ScDocShell* pSrcShell = nullptr;
1334  if ( bHiddenDoc )
1335  {
1336  OUString aFilter, aOptions;
1337  OUString aURL = aHiddenName;
1338  pDocLoader.reset(new ScDocumentLoader( aURL, aFilter, aOptions ));
1339  if (!pDocLoader->IsError())
1340  pSrcShell = pDocLoader->GetDocShell();
1341  }
1342  else
1343  pSrcShell = GetManualOrCurrent();
1344 
1345  if ( pSrcShell )
1346  {
1347  ScDocument& rSrcDoc = pSrcShell->GetDocument();
1348  if ( nType == ScContentId::RANGENAME || nType == ScContentId::DBAREA )
1349  {
1350  ScRange aRange;
1351  if ( lcl_GetRange( rSrcDoc, nType, aText, aRange ) )
1352  {
1353  bDisallow = lcl_DoDragCells( pSrcShell, aRange, ScDragSrc::Navigator, *m_xTreeView );
1354  }
1355  }
1356  else if ( nType == ScContentId::TABLE )
1357  {
1358  SCTAB nTab;
1359  if ( rSrcDoc.GetTable( aText, nTab ) )
1360  {
1361  ScRange aRange(0, 0, nTab, rSrcDoc.MaxCol(), rSrcDoc.MaxRow(), nTab);
1362  bDisallow = lcl_DoDragCells( pSrcShell, aRange, (ScDragSrc::Navigator | ScDragSrc::Table), *m_xTreeView );
1363  }
1364  }
1365  else if ( nType == ScContentId::GRAPHIC || nType == ScContentId::OLEOBJECT ||
1366  nType == ScContentId::DRAWING )
1367  {
1368  bDisallow = lcl_DoDragObject( pSrcShell, aText, nType, *m_xTreeView );
1369 
1370  // during ExecuteDrag the navigator can be deleted
1371  // -> don't access member anymore !!!
1372  }
1373  }
1374  }
1375  break;
1376  }
1377 
1378  if (bDoLinkTrans)
1379  {
1380  if (!aLinkURL.isEmpty())
1381  m_xTransferObj->SetLinkURL(aLinkURL, aLinkText);
1382 
1383  rtl::Reference<TransferDataContainer> xHelper(m_xTransferObj);
1384  m_xTreeView->enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
1385 
1386  bDisallow = false;
1387  }
1388  }
1389 
1390  return bDisallow;
1391 }
1392 
1393 void ScContentTree::LoadFile( const OUString& rUrl )
1394 {
1395  OUString aDocName = rUrl;
1396  sal_Int32 nPos = aDocName.indexOf('#');
1397  if ( nPos != -1 )
1398  aDocName = aDocName.copy(0, nPos); // only the name without #...
1399 
1400  OUString aURL = aDocName;
1401  OUString aFilter, aOptions;
1402  ScDocumentLoader aLoader( aURL, aFilter, aOptions );
1403  if ( aLoader.IsError() )
1404  return;
1405 
1406  bHiddenDoc = true;
1407  aHiddenName = aDocName;
1408  aHiddenTitle = aLoader.GetTitle();
1409  pHiddenDocument = aLoader.GetDocument();
1410 
1411  Refresh(); // get content from loaded document
1412 
1413  pHiddenDocument = nullptr;
1414 
1415  pParentWindow->GetDocNames( &aHiddenTitle ); // fill list
1416 
1417  // document is closed again by ScDocumentLoader in dtor
1418 }
1419 
1421 {
1422  if ( nNew != nRootType )
1423  {
1424  nRootType = nNew;
1425  Refresh();
1426 
1427  ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
1428  rCfg.SetRootType( nRootType );
1429  }
1430 }
1431 
1432 void ScContentTree::ToggleRoot() // after selection
1433 {
1435  if ( nRootType == ScContentId::ROOT )
1436  {
1437  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
1438  if (m_xTreeView->get_cursor(xEntry.get()))
1439  {
1440  std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator(xEntry.get()));
1441  if (!m_xTreeView->iter_parent(*xParent))
1442  xParent.reset();
1443 
1444  for (sal_uInt16 i=1; i<=int(ScContentId::LAST); i++)
1445  {
1446  if (!m_aRootNodes[static_cast<ScContentId>(i)])
1447  continue;
1448  if ((m_xTreeView->iter_compare(*xEntry, *m_aRootNodes[static_cast<ScContentId>(i)]) == 0) ||
1449  (xParent && m_xTreeView->iter_compare(*xParent, *m_aRootNodes[static_cast<ScContentId>(i)]) == 0))
1450  {
1451  nNew = static_cast<ScContentId>(i);
1452  }
1453  }
1454  }
1455  }
1456 
1457  SetRootType( nNew );
1458 }
1459 
1461 {
1462  aManualDoc.clear();
1463  bHiddenDoc = false;
1464 
1465  ActiveDocChanged();
1466 }
1467 
1469 {
1470  if ( !bHiddenDoc && aManualDoc.isEmpty() )
1471  Refresh(); // content only if automatic
1472 
1473  // if flag active Listbox must be updated
1474 
1475  OUString aCurrent;
1476  if ( bHiddenDoc )
1477  aCurrent = aHiddenTitle;
1478  else
1479  {
1480  ScDocShell* pSh = GetManualOrCurrent();
1481  if (pSh)
1482  aCurrent = pSh->GetTitle();
1483  else
1484  {
1485  // document is no longer available
1486 
1487  aManualDoc.clear(); // again automatically
1488  Refresh();
1489  pSh = GetManualOrCurrent(); // should be active now
1490  if (pSh)
1491  aCurrent = pSh->GetTitle();
1492  }
1493  }
1494  pParentWindow->GetDocNames( &aCurrent ); // select
1495 }
1496 
1497 void ScContentTree::SetManualDoc(const OUString& rName)
1498 {
1499  aManualDoc = rName;
1500  if (!bHiddenDoc)
1501  {
1502  Refresh();
1503  pParentWindow->GetDocNames( &aManualDoc ); // select
1504  }
1505 }
1506 
1507 void ScContentTree::SelectDoc(const OUString& rName) // rName like shown in Menu/Listbox
1508 {
1509  if ( rName == pParentWindow->aStrActiveWin )
1510  {
1511  ResetManualDoc();
1512  return;
1513  }
1514 
1515  // omit "active" or "inactive"
1516 
1517  OUString aRealName = rName;
1518  sal_Int32 nLen = rName.getLength();
1519  sal_Int32 nActiveStart = nLen - pParentWindow->aStrActive.getLength();
1520  if ( rName.subView( nActiveStart ) == pParentWindow->aStrActive )
1521  aRealName = rName.copy( 0, nActiveStart );
1522  sal_Int32 nNotActiveStart = nLen - pParentWindow->aStrNotActive.getLength();
1523  if ( rName.subView( nNotActiveStart ) == pParentWindow->aStrNotActive )
1524  aRealName = rName.copy( 0, nNotActiveStart );
1525 
1526  bool bLoaded = false;
1527 
1528  // Is it a normally loaded document?
1529 
1531  while ( pSh && !bLoaded )
1532  {
1533  if ( dynamic_cast<const ScDocShell*>( pSh) != nullptr )
1534  if ( pSh->GetTitle() == aRealName )
1535  bLoaded = true;
1536  pSh = SfxObjectShell::GetNext( *pSh );
1537  }
1538 
1539  if (bLoaded)
1540  {
1541  bHiddenDoc = false;
1542  SetManualDoc(aRealName);
1543  }
1544  else if (!aHiddenTitle.isEmpty()) // hidden selected
1545  {
1546  if (!bHiddenDoc)
1548  }
1549  else
1550  {
1551  OSL_FAIL("SelectDoc: not found");
1552  }
1553 }
1554 
1555 void ScContentTree::SelectEntryByName(const ScContentId nRoot, std::u16string_view rName)
1556 {
1557  weld::TreeIter* pParent = m_aRootNodes[nRoot].get();
1558 
1559  if (pParent || !m_xTreeView->iter_has_child(*pParent))
1560  return;
1561 
1562  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator(pParent));
1563  bool bEntry = m_xTreeView->iter_children(*xEntry);
1564 
1565  while (bEntry)
1566  {
1567  if (m_xTreeView->get_text(*xEntry) == rName)
1568  {
1569  m_xTreeView->select(*xEntry);
1570  m_xTreeView->set_cursor(*xEntry);
1571 
1572  // Scroll to the selected item
1573  m_xTreeView->scroll_to_row(*xEntry);
1574 
1576 
1577  return;
1578  }
1579  bEntry = m_xTreeView->iter_next(*xEntry);
1580  }
1581 }
1582 
1583 void ScContentTree::ApplyNavigatorSettings(bool bRestorePos, int nScrollPos)
1584 {
1586  if( !pSettings )
1587  return;
1588 
1589  ScContentId nRootSel = pSettings->GetRootSelected();
1590  auto nChildSel = pSettings->GetChildSelected();
1591 
1592  // tdf#133079 ensure Sheet root is selected if nothing
1593  // else would be
1594  if (nRootSel == ScContentId::ROOT)
1595  {
1596  nRootSel = ScContentId::TABLE;
1597  nChildSel = SC_CONTENT_NOCHILD;
1598  }
1599 
1600  for( int i = 1; i <= int(ScContentId::LAST); ++i )
1601  {
1602  ScContentId nEntry = static_cast<ScContentId>(i);
1603  if( m_aRootNodes[ nEntry ] )
1604  {
1605  // gray or ungray
1606  if (!m_xTreeView->iter_has_child(*m_aRootNodes[nEntry]))
1607  m_xTreeView->set_sensitive(*m_aRootNodes[nEntry], false);
1608  else
1609  m_xTreeView->set_sensitive(*m_aRootNodes[nEntry], true);
1610 
1611  // expand
1612  bool bExp = pSettings->IsExpanded( nEntry );
1613  if (bExp != m_xTreeView->get_row_expanded(*m_aRootNodes[nEntry]))
1614  {
1615  if( bExp )
1616  m_xTreeView->expand_row(*m_aRootNodes[nEntry]);
1617  else
1618  m_xTreeView->collapse_row(*m_aRootNodes[nEntry]);
1619  }
1620 
1621  // select
1622  if( nRootSel == nEntry )
1623  {
1624  if (bRestorePos)
1625  m_xTreeView->vadjustment_set_value(nScrollPos);
1626 
1627  std::unique_ptr<weld::TreeIter> xEntry;
1628  if (bExp && (nChildSel != SC_CONTENT_NOCHILD))
1629  {
1630  xEntry = m_xTreeView->make_iterator(m_aRootNodes[nEntry].get());
1631  if (!m_xTreeView->iter_children(*xEntry) || !m_xTreeView->iter_nth_sibling(*xEntry, nChildSel))
1632  xEntry.reset();
1633  }
1634  m_xTreeView->select(xEntry ? *xEntry : *m_aRootNodes[nEntry]);
1635  m_xTreeView->set_cursor(xEntry ? *xEntry : *m_aRootNodes[nEntry]);
1636  }
1637  }
1638  }
1639 }
1640 
1642 {
1644  {
1646  m_nAsyncMouseReleaseId = nullptr;
1647  }
1648 
1650  if( !pSettings )
1651  return;
1652 
1653  for( int i = 1; i <= int(ScContentId::LAST); ++i )
1654  {
1655  ScContentId nEntry = static_cast<ScContentId>(i);
1656  bool bExp = m_aRootNodes[nEntry] && m_xTreeView->get_row_expanded(*m_aRootNodes[nEntry]);
1657  pSettings->SetExpanded( nEntry, bExp );
1658  }
1659 
1660  std::unique_ptr<weld::TreeIter> xCurEntry(m_xTreeView->make_iterator());
1661  if (!m_xTreeView->get_cursor(xCurEntry.get()))
1662  xCurEntry.reset();
1663 
1664  ScContentId nRoot;
1665  sal_uLong nChild;
1666  GetEntryIndexes(nRoot, nChild, xCurEntry.get());
1667 
1668  pSettings->SetRootSelected( nRoot );
1669  pSettings->SetChildSelected( nChild );
1670 }
1671 
1672 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
bool m_bFreeze
Definition: content.hxx:56
ScContentId GetRootSelected() const
Definition: navsett.hxx:43
URL aURL
sal_Int32 nIndex
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:813
ScAddress GetNotePos(sal_uLong nIndex)
Definition: content.cxx:1011
ScAddress aStart
Definition: address.hxx:499
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:42
constexpr sal_uInt16 KEY_MOD1
#define EMPTY_OUSTRING
Definition: global.hxx:213
bool bisInNavigatoeDlg
Definition: content.hxx:55
SCROW Row() const
Definition: address.hxx:261
OUString GetTitle(sal_uInt16 nMaxLen=0) const
#define DND_ACTION_COPY
const ScAreaLink * GetLink(sal_uLong nIndex)
Definition: content.cxx:960
void SetExpanded(ScContentId nIndex, bool bExpand)
Definition: navsett.hxx:39
std::unique_ptr< ContentProperties > pData
OBJ_GRUP
void GetLinkNames()
Definition: content.cxx:937
const OUString & GetName() const
sal_uIntPtr sal_uLong
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
bool NoteStringsChanged()
Definition: content.cxx:1020
constexpr sal_uInt16 KEY_F5
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
void SetManualDoc(const OUString &rName)
Definition: content.cxx:1497
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false)
SdrObject * GetObjectByName(std::u16string_view rName)
Definition: drawview.cxx:650
bool bHiddenDoc
Definition: content.hxx:51
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
OUString aStrNotActive
Definition: navipi.hxx:113
sal_uInt16 GetCode() const
Contains settings of the navigator listbox.
Definition: navsett.hxx:29
ScAddress aEnd
Definition: address.hxx:500
o3tl::enumarray< ScContentId, sal_uInt16 > pPosList
Definition: content.hxx:60
static SfxObjectShell * Current()
constexpr sal_uInt16 KEY_SPACE
virtual SdrObjKind GetObjIdentifier() const
virtual SfxObjectShell * GetObjectShell() override
void FillTransferableObjectDescriptor(TransferableObjectDescriptor &rDesc) const
EmbeddedObjectRef * pObject
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:494
void GetAreaNames()
Definition: content.cxx:792
void ResetManualDoc()
Definition: content.cxx:1460
void GetDocNames(const OUString *pSelEntry)
Definition: navipi.cxx:839
OUString aManualDoc
Definition: content.hxx:50
sal_uLong GetChildSelected() const
Definition: navsett.hxx:46
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: content.hxx:44
static void SetGlobalDrawPersist(SfxObjectShell *pPersist)
Definition: drwlayer.cxx:2644
void GetOleNames()
Definition: content.cxx:927
OUString GetTitle() const
Definition: tablink.cxx:586
void SetRootType(ScContentId nNew)
Definition: navicfg.cxx:51
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:871
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:313
Additional class containing cell annotation data.
Definition: postit.hxx:159
bool empty() const
Definition: rangenam.cxx:802
int nCount
static SfxViewShell * Current()
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:259
void freeze()
Definition: content.hxx:100
SCTAB Tab() const
Definition: address.hxx:270
sal_uInt16 GetModifier() const
SdrPageView * ShowSdrPage(SdrPage *pPage) override
bool IsExpanded(ScContentId nIndex) const
Definition: navsett.hxx:40
void ApplyNavigatorSettings(bool bRestoreScrollPos=false, int nScrollPos=0)
Applies the navigator settings to the listbox.
Definition: content.cxx:1583
static bool IsPartOfType(ScContentId nContentType, sal_uInt16 nObjIdentifier)
Definition: content.cxx:848
ScDrawView * GetScDrawView()
Definition: viewdata.cxx:3075
ScViewData & GetViewData()
Definition: tabview.hxx:333
OUString aHiddenName
Definition: content.hxx:52
OUString aHiddenTitle
Definition: content.hxx:53
virtual void enable_drag_source(rtl::Reference< TransferDataContainer > &rTransferrable, sal_uInt8 eDNDConstants)=0
void ActiveDocChanged()
Definition: content.cxx:1468
rtl::Reference< ScLinkTransferObj > m_xTransferObj
Definition: content.hxx:46
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
void ClearAll()
Definition: content.cxx:199
void InitRoot(ScContentId nType)
Definition: content.cxx:179
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1057
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:679
void SelectCurrentViewObject(std::u16string_view rName)
Definition: drawview.cxx:681
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:870
ScDocument * GetDocument()
Definition: tablink.cxx:573
T * get() const
void StoreNavigatorSettings()
Stores the current listbox state in the navigator settings.
Definition: content.cxx:1641
ScDragSrc
Definition: viewdata.hxx:91
void GetGraphicNames()
Definition: content.cxx:922
OUString aStrActiveWin
Definition: navipi.hxx:115
virtual std::unique_ptr< SdrModel > CreateMarkedObjModel() const
ScContentId nRootType
Definition: content.hxx:49
const SvBaseLinks & GetLinks() const
void InsertContent(ScContentId nType, const OUString &rValue)
Definition: content.cxx:232
int i
static OUString lcl_GetDBAreaRange(const ScDocument *pDoc, const OUString &rDBName)
Definition: content.cxx:301
static OUString lcl_NoteString(const ScPostIt &rNote)
Definition: content.cxx:986
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:172
ScAddress GetNotePosition(size_t nIndex) const
Definition: document.cxx:6727
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2620
sal_Int16 SCCOL
Definition: types.hxx:21
#define SC_MOD()
Definition: scmod.hxx:249
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:872
SC_DLLPUBLIC OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2212
static ScTabViewShell * GetTabViewShell()
Definition: navipi.cxx:696
OBJ_GRAF
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void SetDrawShell(bool bActive)
Definition: tabvwsh4.cxx:611
float u
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
static const char * SCSTR_CONTENT_ARY[]
Definition: content.cxx:166
OUString GetText() const
Returns the caption text of this note.
Definition: postit.cxx:914
ImplSVEvent * m_nAsyncMouseReleaseId
Definition: content.hxx:58
void GetNoteStrings()
Definition: content.cxx:995
ScDocShell * GetManualOrCurrent()
Definition: content.cxx:90
void ObjectFresh(ScContentId nType, const weld::TreeIter *pEntry=nullptr)
Definition: content.cxx:671
bool HasName() const
IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl, weld::TreeView &, bool)
Definition: content.cxx:318
#define DND_ACTION_LINK
ScContentTree(std::unique_ptr< weld::TreeView > xTreeView, ScNavigatorDlg *pNavigatorDlg)
Definition: content.cxx:121
ScContentId
Definition: content.hxx:34
bool HasSelectedBlockMatrixFragment(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScMarkData &rMark) const
Definition: document.cxx:5452
void SetDragJump(ScDocument *pLocalDoc, const OUString &rTarget, const OUString &rText)
Definition: scmod.cxx:607
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:300
SCCOL Col() const
Definition: address.hxx:266
constexpr sal_uInt16 KEY_RETURN
sal_uLong GetChildIndex(const weld::TreeIter *pEntry) const
Returns the child index of the specified listbox entry.
Definition: content.cxx:293
ScDBData * findByUpperName(const OUString &rName)
Definition: dbdata.cxx:1147
void GetDbNames()
Definition: content.cxx:830
void SetChildSelected(sal_uLong nIndex)
Definition: navsett.hxx:45
bool IsError() const
Definition: tablink.cxx:578
void GetDrawNames(ScContentId nType)
Definition: content.cxx:868
SdrObject * GetNamedObject(std::u16string_view rName, sal_uInt16 nId, SCTAB &rFoundTab) const
Definition: drwlayer.cxx:2161
Stores global named database ranges.
Definition: dbdata.hxx:234
const ScContentId pTypeList[int(ScContentId::LAST)+1]
Definition: content.cxx:65
SdrObject * Next()
sal_Int32 SCROW
Definition: types.hxx:17
IMPL_LINK(ScContentTree, KeyInputHdl, const KeyEvent &, rKEvt, bool)
Definition: content.cxx:418
std::unique_ptr< weld::TreeIter > m_xScratchIter
Definition: content.hxx:45
void GetDrawingNames()
Definition: content.cxx:932
void LaunchAsyncStoreNavigatorSettings()
Definition: content.cxx:400
void Refresh(ScContentId nType=ScContentId::ROOT)
Definition: content.cxx:720
void LoadFile(const OUString &rUrl)
Definition: content.cxx:1393
static bool lcl_GetRange(const ScDocument &rDoc, ScContentId nType, const OUString &rName, ScRange &rRange)
Definition: content.cxx:1106
static ScNavigatorSettings * GetNavigatorSettings()
Definition: navipi.cxx:701
ScNavigatorDlg * pParentWindow
Definition: content.hxx:47
SvBaseLink * pLink
static SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
SdrIterMode
OUString aName
void SelectEntryByName(const ScContentId nRoot, std::u16string_view rName)
Definition: content.cxx:1555
bool DoInitNew(SfxMedium *pMedium=nullptr)
const INetURLObject & GetURLObject() const
static OUString GetVisibleName(const SdrObject *pObj)
Definition: drwlayer.cxx:2135
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
Definition: global.cxx:1009
void * p
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:400
void SetRootType(ScContentId nNew)
Definition: content.cxx:1420
const ScDocument & GetDocument() const
Definition: docsh.hxx:216
static bool lcl_DoDragCells(ScDocShell *pSrcShell, const ScRange &rRange, ScDragSrc nFlags, weld::TreeView &rTreeView)
Definition: content.cxx:1199
void GetEntryIndexes(ScContentId &rnRootIndex, sal_uLong &rnChildIndex, const weld::TreeIter *pEntry) const
Returns the indexes of the specified listbox entry.
Definition: content.cxx:246
SC_DLLPUBLIC bool IsValidReference(ScRange &rRef) const
Definition: rangenam.cxx:382
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:314
SdrPageView * GetSdrPageView() const
const std::u16string_view aContentBmps[]
Definition: content.cxx:78
OUString GetURLNoPass(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
ROOT
void SetRootSelected(ScContentId nIndex)
Definition: navsett.hxx:42
OUString sId
ScDocument * pHiddenDocument
Definition: content.hxx:54
ScXMLEditAttributeMap::Entry const aEntries[]
OUString sKeyString
Definition: content.hxx:57
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1056
#define SAL_WARN(area, stream)
ScDocument * GetSourceDocument()
Definition: content.cxx:656
static SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
static void ReleaseFocus()
Definition: navipi.cxx:65
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
void ClearType(ScContentId nType)
Definition: content.cxx:216
bool DrawNamesChanged(ScContentId nType)
Definition: content.cxx:1050
This struct stores general clipboard parameters associated with a ScDocument instance created in clip...
Definition: clipparam.hxx:30
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
Definition: documen2.cxx:217
void GetTableNames()
Definition: content.cxx:766
OBJ_OLE2
void ToggleRoot()
Definition: content.cxx:1432
SdrModel * GetModel() const
void SelectDoc(const OUString &rName)
Definition: content.cxx:1507
void SetDragLink(const OUString &rDoc, const OUString &rTab, const OUString &rArea)
Definition: scmod.cxx:598
OUString aStrActive
Definition: navipi.hxx:112
o3tl::enumarray< ScContentId, std::unique_ptr< weld::TreeIter > > m_aRootNodes
Definition: content.hxx:48
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:212
SC_DLLPUBLIC bool insert(ScRangeData *p, bool bReuseFreeIndex=true)
Insert object into set.
Definition: rangenam.cxx:807
bool GetObjectIsMarked(const SdrObject *pObject)
Definition: drawview.cxx:794
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
void thaw()
Definition: content.hxx:106
SC_DLLPUBLIC void CopyToClip(const ScClipParam &rClipParam, ScDocument *pClipDoc, const ScMarkData *pMarks, bool bKeepScenarioFlags, bool bIncludeObjects)
Definition: document.cxx:2167
static bool lcl_DoDragObject(ScDocShell *pSrcShell, std::u16string_view rName, ScContentId nType, weld::TreeView &rTreeView)
Definition: content.cxx:1141
const sal_uLong SC_CONTENT_NOCHILD
Definition: content.hxx:40
SC_DLLPUBLIC void GetAllNoteEntries(std::vector< sc::NoteEntry > &rNotes) const
Definition: document.cxx:6791
SfxMedium * GetMedium() const