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