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  , bIsInNavigatorDlg(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 
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::getCharClass().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, and realize
459  //multi-selection.
460  if ( bIsInNavigatorDlg )
461  {
462  if(aCode.GetCode() == KEY_SPACE )
463  {
464  bUsed = true;
466  sal_uLong nChild;
467  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
468  if (!m_xTreeView->get_cursor(xEntry.get()))
469  xEntry.reset();
470  GetEntryIndexes(nType, nChild, xEntry.get());
471 
472  if (xEntry && (nType != ScContentId::ROOT) && (nChild != SC_CONTENT_NOCHILD))
473  {
474  if ( bHiddenDoc )
475  return true;
476  OUString aText(m_xTreeView->get_text(*xEntry));
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  }
511  break;
512  }
513  default:
514  break;
515  }
516  }
517  }
518  }
519 
520  if (!bUsed)
521  {
522  if (aCode.GetCode() == KEY_F5)
523  StoreNavigatorSettings();
524  else
525  LaunchAsyncStoreNavigatorSettings();
526  }
527 
528  return bUsed;
529 }
530 
531 IMPL_LINK(ScContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
532 {
533  bool bDone = false;
534 
535  switch ( rCEvt.GetCommand() )
536  {
537  case CommandEventId::ContextMenu:
538  {
539  // drag-and-drop mode
540  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xTreeView.get(), "modules/scalc/ui/dropmenu.ui"));
541  std::unique_ptr<weld::Menu> xPop(xBuilder->weld_menu("contextmenu"));
542  std::unique_ptr<weld::Menu> xDropMenu(xBuilder->weld_menu("dragmodesubmenu"));
543 
544  switch (pParentWindow->GetDropMode())
545  {
546  case 0:
547  xDropMenu->set_active("hyperlink", true);
548  break;
549  case 1:
550  xDropMenu->set_active("link", true);
551  break;
552  case 2:
553  xDropMenu->set_active("copy", true);
554  break;
555  }
556 
557  // displayed document
558  std::unique_ptr<weld::Menu> xDocMenu(xBuilder->weld_menu("displaymenu"));
559 //TODO aDocMenu->SetMenuFlags( aDocMenu->GetMenuFlags() | MenuFlags::NoAutoMnemonics );
560  sal_uInt16 i=0;
561  OUString sActive;
562  OUString sId;
563  // loaded documents
564  ScDocShell* pCurrentSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() );
566  while ( pSh )
567  {
568  if ( dynamic_cast<const ScDocShell*>( pSh) != nullptr )
569  {
570  OUString aName = pSh->GetTitle();
571  OUString aEntry = aName;
572  if ( pSh == pCurrentSh )
573  aEntry += pParentWindow->aStrActive;
574  else
575  aEntry += pParentWindow->aStrNotActive;
576  ++i;
577  sId = "document" + OUString::number(i);
578  xDocMenu->append_radio(sId, aEntry);
579  if ( !bHiddenDoc && aName == aManualDoc )
580  sActive = sId;
581  }
582  pSh = SfxObjectShell::GetNext( *pSh );
583  }
584  // "active window"
585  ++i;
586  sId = "document" + OUString::number(i);
587  xDocMenu->append_radio(sId, pParentWindow->aStrActiveWin);
588  if (!bHiddenDoc && aManualDoc.isEmpty())
589  sActive = sId;
590  // hidden document
591  if ( !aHiddenTitle.isEmpty() )
592  {
593  OUString aEntry = aHiddenTitle + pParentWindow->aStrHidden;
594  ++i;
595  sId = "document" + OUString::number(i);
596  xDocMenu->append_radio(sId, aEntry);
597  if (bHiddenDoc)
598  sActive = sId;
599  }
600  xDocMenu->set_active(sActive.toUtf8(), true);
601 
602  OString sIdent = xPop->popup_at_rect(m_xTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1, 1)));
603  if (sIdent == "hyperlink")
604  pParentWindow->SetDropMode(0);
605  else if (sIdent == "link")
606  pParentWindow->SetDropMode(1);
607  else if (sIdent == "copy")
608  pParentWindow->SetDropMode(2);
609  else if (sIdent.startsWith("document"))
610  {
611  OUString aName = xDocMenu->get_label(sIdent);
612  SelectDoc(aName);
613  }
614  }
615  break;
616  default: break;
617  }
618 
619  return bDone;
620 }
621 
622 IMPL_LINK(ScContentTree, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUString)
623 {
624  OUString aHelpText;
625 
626  std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator(&rEntry));
627  if (!m_xTreeView->iter_parent(*xParent))
628  xParent.reset();
629 
630  if (!xParent) // Top-Level ?
631  {
632  aHelpText = OUString::number(m_xTreeView->iter_n_children(rEntry)) +
633  " " + m_xTreeView->get_text(rEntry);
634  }
635  else if (m_aRootNodes[ScContentId::NOTE] && m_xTreeView->iter_compare(*xParent, *m_aRootNodes[ScContentId::NOTE]) == 0)
636  {
637  aHelpText = m_xTreeView->get_text(rEntry); // notes as help text
638  }
639  else if (m_aRootNodes[ScContentId::AREALINK] && m_xTreeView->iter_compare(*xParent, *m_aRootNodes[ScContentId::AREALINK]) == 0)
640  {
641  auto nIndex = GetChildIndex(&rEntry);
642  if (nIndex != SC_CONTENT_NOCHILD)
643  {
644  const ScAreaLink* pLink = GetLink(nIndex);
645  if (pLink)
646  {
647  aHelpText = pLink->GetFile(); // source file as help text
648  }
649  }
650  }
651 
652  return aHelpText;
653 }
654 
656 {
657  if (bHiddenDoc)
658  return pHiddenDocument;
659  else
660  {
662  if (pSh)
663  return &pSh->GetDocument();
664 
665  }
666  return nullptr;
667 }
668 
670 {
671  if ( bHiddenDoc && !pHiddenDocument )
672  return; // other document displayed
673 
674  // if nothing has changed the cancel right away (against flicker)
675 
676  if ( nType == ScContentId::NOTE )
677  if (!NoteStringsChanged())
678  return;
679  if ( nType == ScContentId::GRAPHIC )
681  return;
682  if ( nType == ScContentId::OLEOBJECT )
684  return;
685  if ( nType == ScContentId::DRAWING )
687  return;
688 
689  freeze();
690 
691  ClearType( nType );
692 
693  if ( nType == ScContentId::ROOT || nType == ScContentId::TABLE )
694  GetTableNames();
695  if ( nType == ScContentId::ROOT || nType == ScContentId::RANGENAME )
696  GetAreaNames();
697  if ( nType == ScContentId::ROOT || nType == ScContentId::DBAREA )
698  GetDbNames();
699  if ( nType == ScContentId::ROOT || nType == ScContentId::GRAPHIC )
700  GetGraphicNames();
701  if ( nType == ScContentId::ROOT || nType == ScContentId::OLEOBJECT )
702  GetOleNames();
703  if ( nType == ScContentId::ROOT || nType == ScContentId::DRAWING )
704  GetDrawingNames();
705  if ( nType == ScContentId::ROOT || nType == ScContentId::NOTE )
706  GetNoteStrings();
707  if ( nType == ScContentId::ROOT || nType == ScContentId::AREALINK )
708  GetLinkNames();
709 
710  thaw();
711 
713 }
714 
716 {
717  if ( nRootType != ScContentId::ROOT && nRootType != ScContentId::TABLE ) // hidden ?
718  return;
719 
720  ScDocument* pDoc = GetSourceDocument();
721  if (!pDoc)
722  return;
723 
724  OUString aName;
725  SCTAB nCount = pDoc->GetTableCount();
726  for ( SCTAB i=0; i<nCount; i++ )
727  {
728  pDoc->GetName( i, aName );
730  }
731 }
732 
733 namespace {
734 
735 OUString createLocalRangeName(std::u16string_view rName, std::u16string_view rTableName)
736 {
737  return OUString::Concat(rName) + " (" + rTableName + ")";
738 }
739 }
740 
742 {
743  if ( nRootType != ScContentId::ROOT && nRootType != ScContentId::RANGENAME ) // hidden ?
744  return;
745 
746  ScDocument* pDoc = GetSourceDocument();
747  if (!pDoc)
748  return;
749 
750  ScRange aDummy;
751  std::set<OUString> aSet;
752  ScRangeName* pRangeNames = pDoc->GetRangeName();
753  for (const auto& rEntry : *pRangeNames)
754  {
755  if (rEntry.second->IsValidReference(aDummy))
756  aSet.insert(rEntry.second->GetName());
757  }
758  for (SCTAB i = 0; i < pDoc->GetTableCount(); ++i)
759  {
760  ScRangeName* pLocalRangeName = pDoc->GetRangeName(i);
761  if (pLocalRangeName && !pLocalRangeName->empty())
762  {
763  OUString aTableName;
764  pDoc->GetName(i, aTableName);
765  for (const auto& rEntry : *pLocalRangeName)
766  {
767  if (rEntry.second->IsValidReference(aDummy))
768  aSet.insert(createLocalRangeName(rEntry.second->GetName(), aTableName));
769  }
770  }
771  }
772 
773  for (const auto& rItem : aSet)
774  {
776  }
777 }
778 
780 {
781  if ( nRootType != ScContentId::ROOT && nRootType != ScContentId::DBAREA ) // hidden ?
782  return;
783 
784  ScDocument* pDoc = GetSourceDocument();
785  if (!pDoc)
786  return;
787 
788  ScDBCollection* pDbNames = pDoc->GetDBCollection();
789  const ScDBCollection::NamedDBs& rDBs = pDbNames->getNamedDBs();
790  for (const auto& rxDB : rDBs)
791  {
792  const OUString& aStrName = rxDB->GetName();
794  }
795 }
796 
797 bool ScContentTree::IsPartOfType( ScContentId nContentType, sal_uInt16 nObjIdentifier )
798 {
799  bool bRet = false;
800  switch ( nContentType )
801  {
803  bRet = ( nObjIdentifier == OBJ_GRAF );
804  break;
806  bRet = ( nObjIdentifier == OBJ_OLE2 );
807  break;
809  bRet = ( nObjIdentifier != OBJ_GRAF && nObjIdentifier != OBJ_OLE2 ); // everything else
810  break;
811  default:
812  OSL_FAIL("unknown content type");
813  }
814  return bRet;
815 }
816 
817 constexpr int MAX_TREE_NODES = 1000;
818 
820 {
821  if (!bIsInNavigatorDlg)
822  return;
823 
824  if ( nRootType != ScContentId::ROOT && nRootType != nType ) // hidden ?
825  return;
826 
827  ScDocument* pDoc = GetSourceDocument();
828  if (!pDoc)
829  return;
830 
831  ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
832  if (!pDrawLayer)
833  return;
834 
835  SfxObjectShell* pShell = pDoc->GetDocumentShell();
836  if (!pShell)
837  return;
838 
839  // iterate in flat mode for groups
840  SdrIterMode eIter = ( nType == ScContentId::DRAWING ) ? SdrIterMode::Flat : SdrIterMode::DeepNoGroups;
841 
842  std::vector<OUString> aNames;
843  SCTAB nTabCount = pDoc->GetTableCount();
844  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
845  {
846  SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
847  OSL_ENSURE(pPage,"Page ?");
848  if (!pPage)
849  continue;
850  SdrObjListIter aIter(pPage, eIter);
851  SdrObject* pObject = aIter.Next();
852  while (pObject)
853  {
854  if (IsPartOfType(nType, pObject->GetObjIdentifier()))
855  {
856  OUString aName = ScDrawLayer::GetVisibleName(pObject);
857  if (!aName.isEmpty())
858  aNames.push_back(aName);
859  if (aNames.size() > MAX_TREE_NODES)
860  {
861  SAL_WARN("sc", "too many tree nodes, ignoring the rest");
862  break;
863  }
864  }
865  pObject = aIter.Next();
866  }
867  }
868 
869  weld::TreeIter* pParent = m_aRootNodes[nType].get();
870  assert(pParent && "InsertContent without parent");
871  // insert all of these in one go under pParent
872  m_xTreeView->bulk_insert_for_each(aNames.size(), [this, &aNames](weld::TreeIter& rIter, int nIndex) {
873  m_xTreeView->set_text(rIter, aNames[nIndex], 0);
874  m_xTreeView->set_sensitive(rIter, true);
875  }, pParent);
876 }
877 
879 {
881 }
882 
884 {
886 }
887 
889 {
891 }
892 
894 {
895  if ( nRootType != ScContentId::ROOT && nRootType != ScContentId::AREALINK ) // hidden ?
896  return;
897 
898  ScDocument* pDoc = GetSourceDocument();
899  if (!pDoc)
900  return;
901 
902  sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
903  OSL_ENSURE(pLinkManager, "no LinkManager on document?");
904  const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
905  sal_uInt16 nCount = rLinks.size();
906  for (sal_uInt16 i=0; i<nCount; i++)
907  {
908  ::sfx2::SvBaseLink* pBase = rLinks[i].get();
909  if (auto pScAreaLink = dynamic_cast<const ScAreaLink*>( pBase))
910  InsertContent( ScContentId::AREALINK, pScAreaLink->GetSource() );
911 
912  // insert in list the names of source areas
913  }
914 }
915 
917 {
918  ScDocument* pDoc = GetSourceDocument();
919  if (!pDoc)
920  return nullptr;
921 
922  sal_uLong nFound = 0;
923  sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager();
924  OSL_ENSURE(pLinkManager, "no LinkManager on document?");
925  const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
926  sal_uInt16 nCount = rLinks.size();
927  for (sal_uInt16 i=0; i<nCount; i++)
928  {
929  ::sfx2::SvBaseLink* pBase = rLinks[i].get();
930  if (auto pAreaLink = dynamic_cast<const ScAreaLink*>( pBase))
931  {
932  if (nFound == nIndex)
933  return pAreaLink;
934  ++nFound;
935  }
936  }
937 
938  OSL_FAIL("link not found");
939  return nullptr;
940 }
941 
942 static OUString lcl_NoteString( const ScPostIt& rNote )
943 {
944  OUString aText = rNote.GetText();
945  sal_Int32 nAt;
946  while ( (nAt = aText.indexOf( '\n' )) != -1 )
947  aText = aText.replaceAt( nAt, 1, " " );
948  return aText;
949 }
950 
952 {
953  if ( nRootType != ScContentId::ROOT && nRootType != ScContentId::NOTE ) // hidden ?
954  return;
955 
956  ScDocument* pDoc = GetSourceDocument();
957  if (!pDoc)
958  return;
959 
960  // loop over cell notes
961  std::vector<sc::NoteEntry> aEntries;
962  pDoc->GetAllNoteEntries(aEntries);
964  for (const auto& rEntry : aEntries)
965  {
966  OUString aValue = lcl_NoteString(*rEntry.mpNote);
967  m_xTreeView->insert(pParent, -1, &aValue, nullptr, nullptr, nullptr, false, m_xScratchIter.get());
968  m_xTreeView->set_sensitive(*m_xScratchIter, true);
969  }
970 }
971 
973 {
974  ScDocument* pDoc = GetSourceDocument();
975  if (!pDoc)
976  return ScAddress();
977 
978  return pDoc->GetNotePosition(nIndex);
979 }
980 
982 {
983  ScDocument* pDoc = GetSourceDocument();
984  if (!pDoc)
985  return false;
986 
988  if (!pParent)
989  return false;
990 
991  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator(pParent));
992  bool bEntry = m_xTreeView->iter_children(*xEntry);
993 
994  std::vector<sc::NoteEntry> aEntries;
995  pDoc->GetAllNoteEntries(aEntries);
996  for (const auto& rEntry : aEntries)
997  {
998  const ScPostIt* pNote = rEntry.mpNote;
999  if (!bEntry)
1000  return true;
1001 
1002  if (lcl_NoteString(*pNote) != m_xTreeView->get_text(*xEntry))
1003  return true;
1004 
1005  bEntry = m_xTreeView->iter_next_sibling(*xEntry);
1006  }
1007 
1008  return bEntry;
1009 }
1010 
1012 {
1013  ScDocument* pDoc = GetSourceDocument();
1014  if (!pDoc)
1015  return false;
1016 
1017  weld::TreeIter* pParent = m_aRootNodes[nType].get();
1018  if (!pParent)
1019  return false;
1020 
1021  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator(pParent));
1022  bool bEntry = m_xTreeView->iter_children(*xEntry);
1023 
1024  // iterate in flat mode for groups
1025  SdrIterMode eIter = ( nType == ScContentId::DRAWING ) ? SdrIterMode::Flat : SdrIterMode::DeepNoGroups;
1026 
1027  bool bEqual = true;
1028  ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
1029  SfxObjectShell* pShell = pDoc->GetDocumentShell();
1030  if (pDrawLayer && pShell)
1031  {
1032  SCTAB nTabCount = pDoc->GetTableCount();
1033  for (SCTAB nTab=0; nTab<nTabCount && bEqual; nTab++)
1034  {
1035  SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
1036  OSL_ENSURE(pPage,"Page ?");
1037  if (pPage)
1038  {
1039  SdrObjListIter aIter( pPage, eIter );
1040  SdrObject* pObject = aIter.Next();
1041  while (pObject && bEqual)
1042  {
1043  if ( IsPartOfType( nType, pObject->GetObjIdentifier() ) )
1044  {
1045  if ( !bEntry )
1046  bEqual = false;
1047  else
1048  {
1049  if (ScDrawLayer::GetVisibleName(pObject) != m_xTreeView->get_text(*xEntry))
1050  bEqual = false;
1051 
1052  bEntry = m_xTreeView->iter_next_sibling(*xEntry);
1053  }
1054  }
1055  pObject = aIter.Next();
1056  }
1057  }
1058  }
1059  }
1060 
1061  if ( bEntry )
1062  bEqual = false; // anything else
1063 
1064  return !bEqual;
1065 }
1066 
1067 static bool lcl_GetRange( const ScDocument& rDoc, ScContentId nType, const OUString& rName, ScRange& rRange )
1068 {
1069  bool bFound = false;
1070 
1071  if ( nType == ScContentId::RANGENAME )
1072  {
1073  ScRangeName* pList = rDoc.GetRangeName();
1074  if (pList)
1075  {
1076  const ScRangeData* p = pList->findByUpperName(ScGlobal::getCharClass().uppercase(rName));
1077  if (p && p->IsValidReference(rRange))
1078  bFound = true;
1079  }
1080  }
1081  else if ( nType == ScContentId::DBAREA )
1082  {
1083  ScDBCollection* pList = rDoc.GetDBCollection();
1084  if (pList)
1085  {
1086  const ScDBData* p = pList->getNamedDBs().findByUpperName(ScGlobal::getCharClass().uppercase(rName));
1087  if (p)
1088  {
1089  SCTAB nTab;
1090  SCCOL nCol1, nCol2;
1091  SCROW nRow1, nRow2;
1092  p->GetArea(nTab, nCol1, nRow1, nCol2, nRow2);
1093  rRange = ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab);
1094  bFound = true;
1095  }
1096  }
1097  }
1098 
1099  return bFound;
1100 }
1101 
1102 static bool lcl_DoDragObject( ScDocShell* pSrcShell, std::u16string_view rName, ScContentId nType, weld::TreeView& rTreeView )
1103 {
1104  bool bDisallow = true;
1105 
1106  ScDocument& rSrcDoc = pSrcShell->GetDocument();
1107  ScDrawLayer* pModel = rSrcDoc.GetDrawLayer();
1108  if (pModel)
1109  {
1110  bool bOle = ( nType == ScContentId::OLEOBJECT );
1111  bool bGraf = ( nType == ScContentId::GRAPHIC );
1112  sal_uInt16 nDrawId = sal::static_int_cast<sal_uInt16>( bOle ? OBJ_OLE2 : ( bGraf ? OBJ_GRAF : OBJ_GRUP ) );
1113  SCTAB nTab = 0;
1114  SdrObject* pObject = pModel->GetNamedObject( rName, nDrawId, nTab );
1115  if (pObject)
1116  {
1117  SdrView aEditView(*pModel);
1118  aEditView.ShowSdrPage(aEditView.GetModel()->GetPage(nTab));
1119  SdrPageView* pPV = aEditView.GetSdrPageView();
1120  aEditView.MarkObj(pObject, pPV);
1121 
1122  // tdf125520 this is a D&D-start potentially with an OLE object. If
1123  // so, we need to do similar as e.g. in ScDrawView::BeginDrag so that
1124  // the temporary SdrModel for transfer does have a GetPersist() so
1125  // that the EmbeddedObjectContainer gets copied. We need no CheckOle
1126  // here, test is simpler.
1127  ScDocShellRef aDragShellRef;
1128  if(OBJ_OLE2 == pObject->GetObjIdentifier())
1129  {
1130  aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately
1131  aDragShellRef->DoInitNew();
1132  }
1133 
1134  ScDrawLayer::SetGlobalDrawPersist(aDragShellRef.get());
1135  std::unique_ptr<SdrModel> pDragModel(aEditView.CreateMarkedObjModel());
1137 
1139  pSrcShell->FillTransferableObjectDescriptor( aObjDesc );
1140  aObjDesc.maDisplayName = pSrcShell->GetMedium()->GetURLObject().GetURLNoPass();
1141  // maSize is set in ScDrawTransferObj ctor
1142 
1143  rtl::Reference<ScDrawTransferObj> pTransferObj = new ScDrawTransferObj( std::move(pDragModel), pSrcShell, aObjDesc );
1144 
1145  pTransferObj->SetDragSourceObj( *pObject, nTab );
1146  pTransferObj->SetDragSourceFlags(ScDragSrc::Navigator);
1147 
1148  SC_MOD()->SetDragObject( nullptr, pTransferObj.get() );
1149 
1150  rtl::Reference<TransferDataContainer> xHelper(pTransferObj);
1151  rTreeView.enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
1152 
1153  bDisallow = false;
1154  }
1155  }
1156 
1157  return bDisallow;
1158 }
1159 
1160 static bool lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, ScDragSrc nFlags, weld::TreeView& rTreeView )
1161 {
1162  bool bDisallow = true;
1163 
1164  ScDocument& rSrcDoc = pSrcShell->GetDocument();
1165  ScMarkData aMark(rSrcDoc.GetSheetLimits());
1166  aMark.SelectTable( rRange.aStart.Tab(), true );
1167  aMark.SetMarkArea( rRange );
1168 
1169  if ( !rSrcDoc.HasSelectedBlockMatrixFragment( rRange.aStart.Col(), rRange.aStart.Row(),
1170  rRange.aEnd.Col(), rRange.aEnd.Row(),
1171  aMark ) )
1172  {
1174  ScClipParam aClipParam(rRange, false);
1175  rSrcDoc.CopyToClip(aClipParam, pClipDoc.get(), &aMark, false, false);
1176  // pClipDoc->ExtendMerge( rRange, sal_True );
1177 
1179  pSrcShell->FillTransferableObjectDescriptor( aObjDesc );
1180  aObjDesc.maDisplayName = pSrcShell->GetMedium()->GetURLObject().GetURLNoPass();
1181  // maSize is set in ScTransferObj ctor
1182 
1183  rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( std::move(pClipDoc), aObjDesc );
1184 
1185  pTransferObj->SetDragSource( pSrcShell, aMark );
1186  pTransferObj->SetDragSourceFlags( nFlags );
1187 
1188  SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D
1189 
1190  rtl::Reference<TransferDataContainer> xHelper(pTransferObj);
1191  rTreeView.enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
1192 
1193  bDisallow = false;
1194  }
1195 
1196  return bDisallow;
1197 }
1198 
1199 IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool)
1200 {
1201  rUnsetDragIcon = true;
1202 
1203  StoreNavigatorSettings();
1204 
1205  bool bDisallow = true;
1206 
1207  std::unique_ptr<ScDocumentLoader> pDocLoader;
1208 
1209  ScModule* pScMod = SC_MOD();
1210 
1212  sal_uLong nChild;
1213 
1214  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
1215  if (!m_xTreeView->get_cursor(xEntry.get()))
1216  xEntry.reset();
1217 
1218  GetEntryIndexes(nType, nChild, xEntry.get());
1219 
1220  if( xEntry &&
1221  (nChild != SC_CONTENT_NOCHILD) &&
1222  (nType != ScContentId::ROOT) &&
1223  (nType != ScContentId::NOTE) &&
1224  (nType != ScContentId::AREALINK) )
1225  {
1226  OUString aText(m_xTreeView->get_text(*xEntry));
1227 
1228  ScDocument* pLocalDoc = nullptr; // for URL drop
1229  OUString aDocName;
1230  if (bHiddenDoc)
1231  aDocName = aHiddenName;
1232  else
1233  {
1234  ScDocShell* pDocSh = GetManualOrCurrent();
1235  if (pDocSh)
1236  {
1237  if (pDocSh->HasName())
1238  aDocName = pDocSh->GetMedium()->GetName();
1239  else
1240  pLocalDoc = &pDocSh->GetDocument(); // drop only in this document
1241  }
1242  }
1243 
1244  bool bDoLinkTrans = false; // use ScLinkTransferObj
1245  OUString aLinkURL; // for ScLinkTransferObj
1246  OUString aLinkText;
1247 
1248  sal_uInt16 nDropMode = pParentWindow->GetDropMode();
1249  switch ( nDropMode )
1250  {
1251  case SC_DROPMODE_URL:
1252  {
1253  OUString aUrl = aDocName + "#" + aText;
1254 
1255  pScMod->SetDragJump( pLocalDoc, aUrl, aText );
1256 
1257  if (!aDocName.isEmpty())
1258  {
1259  // provide URL to outside only if the document has a name
1260  // (without name, only internal D&D via SetDragJump)
1261 
1262  aLinkURL = aUrl;
1263  aLinkText = aText;
1264  }
1265  bDoLinkTrans = true;
1266  }
1267  break;
1268  case SC_DROPMODE_LINK:
1269  {
1270  if ( !aDocName.isEmpty() ) // link only to named documents
1271  {
1272  // for internal D&D, set flag to insert a link
1273 
1274  switch ( nType )
1275  {
1276  case ScContentId::TABLE:
1277  pScMod->SetDragLink( aDocName, aText, EMPTY_OUSTRING );
1278  bDoLinkTrans = true;
1279  break;
1281  case ScContentId::DBAREA:
1282  pScMod->SetDragLink( aDocName, EMPTY_OUSTRING, aText );
1283  bDoLinkTrans = true;
1284  break;
1285 
1286  // other types cannot be linked
1287  default: break;
1288  }
1289  }
1290  }
1291  break;
1292  case SC_DROPMODE_COPY:
1293  {
1294  ScDocShell* pSrcShell = nullptr;
1295  if ( bHiddenDoc )
1296  {
1297  OUString aFilter, aOptions;
1298  OUString aURL = aHiddenName;
1299  pDocLoader.reset(new ScDocumentLoader( aURL, aFilter, aOptions ));
1300  if (!pDocLoader->IsError())
1301  pSrcShell = pDocLoader->GetDocShell();
1302  }
1303  else
1304  pSrcShell = GetManualOrCurrent();
1305 
1306  if ( pSrcShell )
1307  {
1308  ScDocument& rSrcDoc = pSrcShell->GetDocument();
1309  if ( nType == ScContentId::RANGENAME || nType == ScContentId::DBAREA )
1310  {
1311  ScRange aRange;
1312  if ( lcl_GetRange( rSrcDoc, nType, aText, aRange ) )
1313  {
1314  bDisallow = lcl_DoDragCells( pSrcShell, aRange, ScDragSrc::Navigator, *m_xTreeView );
1315  }
1316  }
1317  else if ( nType == ScContentId::TABLE )
1318  {
1319  SCTAB nTab;
1320  if ( rSrcDoc.GetTable( aText, nTab ) )
1321  {
1322  ScRange aRange(0, 0, nTab, rSrcDoc.MaxCol(), rSrcDoc.MaxRow(), nTab);
1323  bDisallow = lcl_DoDragCells( pSrcShell, aRange, (ScDragSrc::Navigator | ScDragSrc::Table), *m_xTreeView );
1324  }
1325  }
1326  else if ( nType == ScContentId::GRAPHIC || nType == ScContentId::OLEOBJECT ||
1327  nType == ScContentId::DRAWING )
1328  {
1329  bDisallow = lcl_DoDragObject( pSrcShell, aText, nType, *m_xTreeView );
1330 
1331  // during ExecuteDrag the navigator can be deleted
1332  // -> don't access member anymore !!!
1333  }
1334  }
1335  }
1336  break;
1337  }
1338 
1339  if (bDoLinkTrans)
1340  {
1341  if (!aLinkURL.isEmpty())
1342  m_xTransferObj->SetLinkURL(aLinkURL, aLinkText);
1343 
1344  rtl::Reference<TransferDataContainer> xHelper(m_xTransferObj);
1345  m_xTreeView->enable_drag_source(xHelper, DND_ACTION_COPY | DND_ACTION_LINK);
1346 
1347  bDisallow = false;
1348  }
1349  }
1350 
1351  return bDisallow;
1352 }
1353 
1354 void ScContentTree::LoadFile( const OUString& rUrl )
1355 {
1356  OUString aDocName = rUrl;
1357  sal_Int32 nPos = aDocName.indexOf('#');
1358  if ( nPos != -1 )
1359  aDocName = aDocName.copy(0, nPos); // only the name without #...
1360 
1361  OUString aURL = aDocName;
1362  OUString aFilter, aOptions;
1363  ScDocumentLoader aLoader( aURL, aFilter, aOptions );
1364  if ( aLoader.IsError() )
1365  return;
1366 
1367  bHiddenDoc = true;
1368  aHiddenName = aDocName;
1369  aHiddenTitle = aLoader.GetTitle();
1370  pHiddenDocument = aLoader.GetDocument();
1371 
1372  Refresh(); // get content from loaded document
1373 
1374  pHiddenDocument = nullptr;
1375 
1376  pParentWindow->GetDocNames( &aHiddenTitle ); // fill list
1377 
1378  // document is closed again by ScDocumentLoader in dtor
1379 }
1380 
1382 {
1383  if ( nNew != nRootType )
1384  {
1385  nRootType = nNew;
1386  Refresh();
1387 
1388  ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg();
1389  rCfg.SetRootType( nRootType );
1390  }
1391 }
1392 
1393 void ScContentTree::ToggleRoot() // after selection
1394 {
1396  if ( nRootType == ScContentId::ROOT )
1397  {
1398  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
1399  if (m_xTreeView->get_cursor(xEntry.get()))
1400  {
1401  std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator(xEntry.get()));
1402  if (!m_xTreeView->iter_parent(*xParent))
1403  xParent.reset();
1404 
1405  for (sal_uInt16 i=1; i<=int(ScContentId::LAST); i++)
1406  {
1407  if (!m_aRootNodes[static_cast<ScContentId>(i)])
1408  continue;
1409  if ((m_xTreeView->iter_compare(*xEntry, *m_aRootNodes[static_cast<ScContentId>(i)]) == 0) ||
1410  (xParent && m_xTreeView->iter_compare(*xParent, *m_aRootNodes[static_cast<ScContentId>(i)]) == 0))
1411  {
1412  nNew = static_cast<ScContentId>(i);
1413  }
1414  }
1415  }
1416  }
1417 
1418  SetRootType( nNew );
1419 }
1420 
1422 {
1423  aManualDoc.clear();
1424  bHiddenDoc = false;
1425 
1426  ActiveDocChanged();
1427 }
1428 
1430 {
1431  bool bRefreshed = false;
1432 
1433  if ( !bHiddenDoc && aManualDoc.isEmpty() )
1434  {
1435  Refresh(); // content only if automatic
1436  bRefreshed = true;
1437  }
1438 
1439  // if flag active Listbox must be updated
1440 
1441  OUString aCurrent;
1442  if ( bHiddenDoc )
1443  aCurrent = aHiddenTitle;
1444  else
1445  {
1446  ScDocShell* pSh = GetManualOrCurrent();
1447  if (pSh)
1448  aCurrent = pSh->GetTitle();
1449  else
1450  {
1451  // document is no longer available
1452 
1453  aManualDoc.clear(); // again automatically
1454  Refresh();
1455  bRefreshed = true;
1456  pSh = GetManualOrCurrent(); // should be active now
1457  if (pSh)
1458  aCurrent = pSh->GetTitle();
1459  }
1460  }
1461  pParentWindow->GetDocNames( &aCurrent ); // select
1462 
1463  return bRefreshed;
1464 }
1465 
1466 void ScContentTree::SetManualDoc(const OUString& rName)
1467 {
1468  aManualDoc = rName;
1469  if (!bHiddenDoc)
1470  {
1471  Refresh();
1472  pParentWindow->GetDocNames( &aManualDoc ); // select
1473  }
1474 }
1475 
1476 void ScContentTree::SelectDoc(const OUString& rName) // rName like shown in Menu/Listbox
1477 {
1478  if ( rName == pParentWindow->aStrActiveWin )
1479  {
1480  ResetManualDoc();
1481  return;
1482  }
1483 
1484  // omit "active" or "inactive"
1485 
1486  OUString aRealName = rName;
1487  sal_Int32 nLen = rName.getLength();
1488  sal_Int32 nActiveStart = nLen - pParentWindow->aStrActive.getLength();
1489  if ( rName.subView( nActiveStart ) == pParentWindow->aStrActive )
1490  aRealName = rName.copy( 0, nActiveStart );
1491  sal_Int32 nNotActiveStart = nLen - pParentWindow->aStrNotActive.getLength();
1492  if ( rName.subView( nNotActiveStart ) == pParentWindow->aStrNotActive )
1493  aRealName = rName.copy( 0, nNotActiveStart );
1494 
1495  bool bLoaded = false;
1496 
1497  // Is it a normally loaded document?
1498 
1500  while ( pSh && !bLoaded )
1501  {
1502  if ( dynamic_cast<const ScDocShell*>( pSh) != nullptr )
1503  if ( pSh->GetTitle() == aRealName )
1504  bLoaded = true;
1505  pSh = SfxObjectShell::GetNext( *pSh );
1506  }
1507 
1508  if (bLoaded)
1509  {
1510  bHiddenDoc = false;
1511  SetManualDoc(aRealName);
1512  }
1513  else if (!aHiddenTitle.isEmpty()) // hidden selected
1514  {
1515  if (!bHiddenDoc)
1517  }
1518  else
1519  {
1520  OSL_FAIL("SelectDoc: not found");
1521  }
1522 }
1523 
1524 void ScContentTree::SelectEntryByName(const ScContentId nRoot, std::u16string_view rName)
1525 {
1526  weld::TreeIter* pParent = m_aRootNodes[nRoot].get();
1527 
1528  if (pParent || !m_xTreeView->iter_has_child(*pParent))
1529  return;
1530 
1531  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator(pParent));
1532  bool bEntry = m_xTreeView->iter_children(*xEntry);
1533 
1534  while (bEntry)
1535  {
1536  if (m_xTreeView->get_text(*xEntry) == rName)
1537  {
1538  m_xTreeView->select(*xEntry);
1539  m_xTreeView->set_cursor(*xEntry);
1540 
1541  // Scroll to the selected item
1542  m_xTreeView->scroll_to_row(*xEntry);
1543 
1545 
1546  return;
1547  }
1548  bEntry = m_xTreeView->iter_next(*xEntry);
1549  }
1550 }
1551 
1552 void ScContentTree::ApplyNavigatorSettings(bool bRestorePos, int nScrollPos)
1553 {
1555  if( !pSettings )
1556  return;
1557 
1558  ScContentId nRootSel = pSettings->GetRootSelected();
1559  auto nChildSel = pSettings->GetChildSelected();
1560 
1561  // tdf#133079 ensure Sheet root is selected if nothing
1562  // else would be
1563  if (nRootSel == ScContentId::ROOT)
1564  {
1565  nRootSel = ScContentId::TABLE;
1566  nChildSel = SC_CONTENT_NOCHILD;
1567  }
1568 
1569  for( int i = 1; i <= int(ScContentId::LAST); ++i )
1570  {
1571  ScContentId nEntry = static_cast<ScContentId>(i);
1572  if( m_aRootNodes[ nEntry ] )
1573  {
1574  // gray or ungray
1575  if (!m_xTreeView->iter_has_child(*m_aRootNodes[nEntry]))
1576  m_xTreeView->set_sensitive(*m_aRootNodes[nEntry], false);
1577  else
1578  m_xTreeView->set_sensitive(*m_aRootNodes[nEntry], true);
1579 
1580  // expand
1581  bool bExp = pSettings->IsExpanded( nEntry );
1582  if (bExp != m_xTreeView->get_row_expanded(*m_aRootNodes[nEntry]))
1583  {
1584  if( bExp )
1585  m_xTreeView->expand_row(*m_aRootNodes[nEntry]);
1586  else
1587  m_xTreeView->collapse_row(*m_aRootNodes[nEntry]);
1588  }
1589 
1590  // select
1591  if( nRootSel == nEntry )
1592  {
1593  if (bRestorePos)
1594  m_xTreeView->vadjustment_set_value(nScrollPos);
1595 
1596  std::unique_ptr<weld::TreeIter> xEntry;
1597  if (bExp && (nChildSel != SC_CONTENT_NOCHILD))
1598  {
1599  xEntry = m_xTreeView->make_iterator(m_aRootNodes[nEntry].get());
1600  if (!m_xTreeView->iter_children(*xEntry) || !m_xTreeView->iter_nth_sibling(*xEntry, nChildSel))
1601  xEntry.reset();
1602  }
1603  m_xTreeView->select(xEntry ? *xEntry : *m_aRootNodes[nEntry]);
1604  m_xTreeView->set_cursor(xEntry ? *xEntry : *m_aRootNodes[nEntry]);
1605  }
1606  }
1607  }
1608 }
1609 
1611 {
1613  {
1615  m_nAsyncMouseReleaseId = nullptr;
1616  }
1617 
1619  if( !pSettings )
1620  return;
1621 
1622  for( int i = 1; i <= int(ScContentId::LAST); ++i )
1623  {
1624  ScContentId nEntry = static_cast<ScContentId>(i);
1625  bool bExp = m_aRootNodes[nEntry] && m_xTreeView->get_row_expanded(*m_aRootNodes[nEntry]);
1626  pSettings->SetExpanded( nEntry, bExp );
1627  }
1628 
1629  std::unique_ptr<weld::TreeIter> xCurEntry(m_xTreeView->make_iterator());
1630  if (!m_xTreeView->get_cursor(xCurEntry.get()))
1631  xCurEntry.reset();
1632 
1633  ScContentId nRoot;
1634  sal_uLong nChild;
1635  GetEntryIndexes(nRoot, nChild, xCurEntry.get());
1636 
1637  pSettings->SetRootSelected( nRoot );
1638  pSettings->SetChildSelected( nChild );
1639 }
1640 
1641 /* 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:814
ScAddress GetNotePos(sal_uLong nIndex)
Definition: content.cxx:972
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
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
constexpr sal_uInt16 KEY_MOD1
#define EMPTY_OUSTRING
Definition: global.hxx:214
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:89
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:916
void SetExpanded(ScContentId nIndex, bool bExpand)
Definition: navsett.hxx:39
std::unique_ptr< ContentProperties > pData
OBJ_GRUP
void GetLinkNames()
Definition: content.cxx:893
const OUString & GetName() const
sal_uIntPtr sal_uLong
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
bool NoteStringsChanged()
Definition: content.cxx:981
constexpr sal_uInt16 KEY_F5
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
void SetManualDoc(const OUString &rName)
Definition: content.cxx:1466
SdrObject * GetObjectByName(std::u16string_view rName)
Definition: drawview.cxx:652
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:59
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:741
void ResetManualDoc()
Definition: content.cxx:1421
void GetDocNames(const OUString *pSelEntry)
Definition: navipi.cxx:845
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
const TranslateId SCSTR_CONTENT_ARY[]
Definition: content.cxx:166
static void SetGlobalDrawPersist(SfxObjectShell *pPersist)
Definition: drwlayer.cxx:2648
void GetOleNames()
Definition: content.cxx:883
OUString GetTitle() const
Definition: tablink.cxx:586
void SetRootType(ScContentId nNew)
Definition: navicfg.cxx:51
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:872
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
Additional class containing cell annotation data.
Definition: postit.hxx:159
bool empty() const
Definition: rangenam.cxx:809
int nCount
static SfxViewShell * Current()
constexpr int MAX_TREE_NODES
Definition: content.cxx:817
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:260
void freeze()
Definition: content.hxx:99
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:1552
static bool IsPartOfType(ScContentId nContentType, sal_uInt16 nObjIdentifier)
Definition: content.cxx:797
ScDrawView * GetScDrawView()
Definition: viewdata.cxx:3136
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
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:1058
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:681
void SelectCurrentViewObject(std::u16string_view rName)
Definition: drawview.cxx:683
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:871
ScDocument * GetDocument()
Definition: tablink.cxx:573
T * get() const
void StoreNavigatorSettings()
Stores the current listbox state in the navigator settings.
Definition: content.cxx:1610
ScDragSrc
Definition: viewdata.hxx:91
void GetGraphicNames()
Definition: content.cxx:878
OUString aStrActiveWin
Definition: navipi.hxx:115
virtual std::unique_ptr< SdrModel > CreateMarkedObjModel() const
ScContentId nRootType
Definition: content.hxx:49
const SvBaseLinks & GetLinks() const
bool ActiveDocChanged()
Definition: content.cxx:1429
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:942
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:171
ScAddress GetNotePosition(size_t nIndex) const
Definition: document.cxx:6722
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2622
sal_Int16 SCCOL
Definition: types.hxx:21
#define SC_MOD()
Definition: scmod.hxx:250
static SC_DLLPUBLIC const CharClass & getCharClass()
Definition: global.cxx:1016
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:873
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:698
OBJ_GRAF
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void SetDrawShell(bool bActive)
Definition: tabvwsh4.cxx:611
float u
OUString GetText() const
Returns the caption text of this note.
Definition: postit.cxx:914
ImplSVEvent * m_nAsyncMouseReleaseId
Definition: content.hxx:57
void GetNoteStrings()
Definition: content.cxx:951
ScDocShell * GetManualOrCurrent()
Definition: content.cxx:90
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:5433
void SetDragJump(ScDocument *pLocalDoc, const OUString &rTarget, const OUString &rText)
Definition: scmod.cxx:606
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:300
SCCOL Col() const
Definition: address.hxx:266
bool bIsInNavigatorDlg
Definition: content.hxx:55
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:1142
void GetDbNames()
Definition: content.cxx:779
void SetChildSelected(sal_uLong nIndex)
Definition: navsett.hxx:45
bool IsError() const
Definition: tablink.cxx:578
void GetDrawNames(ScContentId nType)
Definition: content.cxx:819
SdrObject * GetNamedObject(std::u16string_view rName, sal_uInt16 nId, SCTAB &rFoundTab) const
Definition: drwlayer.cxx:2165
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:888
void LaunchAsyncStoreNavigatorSettings()
Definition: content.cxx:400
void Refresh(ScContentId nType=ScContentId::ROOT)
Definition: content.cxx:669
void LoadFile(const OUString &rUrl)
Definition: content.cxx:1354
static bool lcl_GetRange(const ScDocument &rDoc, ScContentId nType, const OUString &rName, ScRange &rRange)
Definition: content.cxx:1067
static ScNavigatorSettings * GetNavigatorSettings()
Definition: navipi.cxx:703
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:1524
bool DoInitNew(SfxMedium *pMedium=nullptr)
const INetURLObject & GetURLObject() const
static OUString GetVisibleName(const SdrObject *pObj)
Definition: drwlayer.cxx:2139
void * p
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
void SetRootType(ScContentId nNew)
Definition: content.cxx:1381
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:1160
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:384
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:315
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
ScDocument * pHiddenDocument
Definition: content.hxx:54
ScXMLEditAttributeMap::Entry const aEntries[]
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1057
#define SAL_WARN(area, stream)
ScDocument * GetSourceDocument()
Definition: content.cxx:655
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:1011
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:218
void GetTableNames()
Definition: content.cxx:715
OBJ_OLE2
void ToggleRoot()
Definition: content.cxx:1393
SdrModel * GetModel() const
void SelectDoc(const OUString &rName)
Definition: content.cxx:1476
void SetDragLink(const OUString &rDoc, const OUString &rTab, const OUString &rArea)
Definition: scmod.cxx:597
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:213
SC_DLLPUBLIC bool insert(ScRangeData *p, bool bReuseFreeIndex=true)
Insert object into set.
Definition: rangenam.cxx:814
bool GetObjectIsMarked(const SdrObject *pObject)
Definition: drawview.cxx:796
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:22
void thaw()
Definition: content.hxx:105
SC_DLLPUBLIC void CopyToClip(const ScClipParam &rClipParam, ScDocument *pClipDoc, const ScMarkData *pMarks, bool bKeepScenarioFlags, bool bIncludeObjects)
Definition: document.cxx:2149
static bool lcl_DoDragObject(ScDocShell *pSrcShell, std::u16string_view rName, ScContentId nType, weld::TreeView &rTreeView)
Definition: content.cxx:1102
const sal_uLong SC_CONTENT_NOCHILD
Definition: content.hxx:40
SC_DLLPUBLIC void GetAllNoteEntries(std::vector< sc::NoteEntry > &rNotes) const
Definition: document.cxx:6786
OUString sId
SfxMedium * GetMedium() const