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