LibreOffice Module sw (master)  1
glbltree.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 <o3tl/safeint.hxx>
21 #include <svl/stritem.hxx>
22 #include <sfx2/fcontnr.hxx>
23 #include <sfx2/linkmgr.hxx>
24 #include <sfx2/dispatch.hxx>
25 #include <sfx2/viewfrm.hxx>
26 #include <sfx2/docfile.hxx>
27 #include <sfx2/docfilt.hxx>
28 #include <vcl/commandevent.hxx>
29 #include <vcl/event.hxx>
30 #include <sot/filelist.hxx>
31 #include <svl/eitem.hxx>
32 #include <vcl/graphicfilter.hxx>
33 #include <osl/diagnose.h>
34 
35 #include <sfx2/docinsert.hxx>
36 #include <sfx2/filedlghelper.hxx>
37 
38 #include <wrtsh.hxx>
39 #include <view.hxx>
40 #include <docsh.hxx>
41 #include <edglbldc.hxx>
42 #include <section.hxx>
43 #include <tox.hxx>
44 #include <navipi.hxx>
45 #include <edtwin.hxx>
46 #include <toxmgr.hxx>
47 
48 #include <cmdid.h>
49 #include <helpids.h>
50 #include <strings.hrc>
51 #include <bitmaps.hlst>
52 #include <swabstdlg.hxx>
53 #include <memory>
54 
55 using namespace ::com::sun::star::uno;
56 
57 #define GLOBAL_UPDATE_TIMEOUT 2000
58 
60 
61 namespace {
62 
63 class SwGlobalFrameListener_Impl : public SfxListener
64 {
65  bool bValid;
66 public:
67  explicit SwGlobalFrameListener_Impl(SfxViewFrame& rFrame)
68  : bValid(true)
69  {
70  StartListening(rFrame);
71  }
72 
73  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
74 
75  bool IsValid() const {return bValid;}
76 };
77 
78 }
79 
80 void SwGlobalFrameListener_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
81 {
82  if( rHint.GetId() == SfxHintId::Dying)
83  bValid = false;
84 }
85 
86 namespace {
87 
89 {
90  IDX_STR_UPDATE = 0,
91  IDX_STR_EDIT_CONTENT = 1,
92  IDX_STR_EDIT_INSERT = 2,
93  IDX_STR_INDEX = 3,
94  IDX_STR_FILE = 4,
95  IDX_STR_NEW_FILE = 5,
96  IDX_STR_INSERT_TEXT = 6,
97  IDX_STR_DELETE = 7,
98  IDX_STR_UPDATE_SEL = 8,
99  IDX_STR_UPDATE_INDEX = 9,
100  IDX_STR_UPDATE_LINK = 10,
101  IDX_STR_UPDATE_ALL = 11,
102  IDX_STR_BROKEN_LINK = 12,
103  IDX_STR_EDIT_LINK = 13
104 };
105 
106 }
107 
108 static const char* GLOBAL_CONTEXT_ARY[] =
109 {
110  STR_UPDATE,
111  STR_EDIT_CONTENT,
112  STR_EDIT_INSERT,
113  STR_INDEX,
114  STR_FILE,
115  STR_NEW_FILE,
116  STR_INSERT_TEXT,
117  STR_DELETE,
118  STR_UPDATE_SEL,
119  STR_UPDATE_INDEX,
120  STR_UPDATE_LINK,
121  STR_UPDATE_ALL,
122  STR_BROKEN_LINK,
123  STR_EDIT_LINK
124 };
125 
126 SwGlobalTree::SwGlobalTree(std::unique_ptr<weld::TreeView> xTreeView, SwNavigationPI* pDialog)
127  : m_xTreeView(std::move(xTreeView))
128  , m_aDropTargetHelper(*this)
129  , m_pDialog(pDialog)
130  , m_pActiveShell(nullptr)
131 {
132  m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 30,
133  m_xTreeView->get_text_height() * 14);
134 
138  for (sal_uInt16 i = 0; i < GLOBAL_CONTEXT_COUNT; i++)
139  {
140  m_aContextStrings[i] = SwResId(GLOBAL_CONTEXT_ARY[i]);
141  }
143  Select();
144  m_xTreeView->connect_row_activated(LINK(this, SwGlobalTree, DoubleClickHdl));
145  m_xTreeView->connect_changed(LINK(this, SwGlobalTree, SelectHdl));
146  m_xTreeView->connect_focus_in(LINK(this, SwGlobalTree, FocusInHdl));
147  m_xTreeView->connect_key_press(LINK(this, SwGlobalTree, KeyInputHdl));
148  m_xTreeView->connect_popup_menu(LINK(this, SwGlobalTree, CommandHdl));
149  m_xTreeView->connect_query_tooltip(LINK(this, SwGlobalTree, QueryTooltipHdl));
150 }
151 
153 {
154  m_pSwGlblDocContents.reset();
155  m_pDocInserter.reset();
157 }
158 
160  : DropTargetHelper(rTreeView.get_widget().get_drop_target())
161  , m_rTreeView(rTreeView)
162 {
163 }
164 
166 {
167  sal_Int8 nRet = DND_ACTION_NONE;
168 
170  std::unique_ptr<weld::TreeIter> xDropEntry(rWidget.make_iterator());
171  if (!rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xDropEntry.get(), true))
172  xDropEntry.reset();
173 
174  if (rWidget.get_drag_source() == &rWidget) // internal drag
175  m_rTreeView.MoveSelectionTo(xDropEntry.get());
176  else
177  {
178  TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
179 
180  OUString sFileName;
181  const SwGlblDocContent* pCnt = xDropEntry ?
182  reinterpret_cast<const SwGlblDocContent*>(rWidget.get_id(*xDropEntry).toInt64()) :
183  nullptr;
184  if( aData.HasFormat( SotClipboardFormatId::FILE_LIST ))
185  {
186  nRet = rEvt.mnAction;
187  std::unique_ptr<SwGlblDocContents> pTempContents(new SwGlblDocContents);
188  int nAbsContPos = xDropEntry ?
189  rWidget.get_iter_index_in_parent(*xDropEntry):
190  - 1;
191  size_t nEntryCount = rWidget.n_children();
192 
193  // Get data
194  FileList aFileList;
195  aData.GetFileList( SotClipboardFormatId::FILE_LIST, aFileList );
196  for ( size_t n = aFileList.Count(); n--; )
197  {
198  sFileName = aFileList.GetFile(n);
199  m_rTreeView.InsertRegion(pCnt, &sFileName);
200  // The list of contents must be newly fetched after inserting,
201  // to not work on an old content.
202  if(n)
203  {
205  // If the file was successfully inserted,
206  // then the next content must also be fetched.
207  if(nEntryCount < pTempContents->size())
208  {
209  nEntryCount++;
210  nAbsContPos++;
211  pCnt = (*pTempContents)[ nAbsContPos ].get();
212  }
213  }
214  }
215  }
216  else if( !(sFileName =
217  SwNavigationPI::CreateDropFileName( aData )).isEmpty())
218  {
219  INetURLObject aTemp(sFileName);
220  GraphicDescriptor aDesc(aTemp);
221  if( !aDesc.Detect() ) // accept no graphics
222  {
223  nRet = rEvt.mnAction;
224  m_rTreeView.InsertRegion(pCnt, &sFileName);
225  }
226  }
227  }
228  return nRet;
229 }
230 
232 {
233  // to enable the autoscroll when we're close to the edges
235  rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
236 
237  sal_Int8 nRet = rEvt.mnAction;
238 
239  if (rWidget.get_drag_source() == &rWidget) // internal drag
240  return nRet;
241 
242  if (IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE) ||
243  IsDropFormatSupported( SotClipboardFormatId::STRING) ||
244  IsDropFormatSupported( SotClipboardFormatId::FILE_LIST) ||
245  IsDropFormatSupported( SotClipboardFormatId::SOLK) ||
246  IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK )||
247  IsDropFormatSupported( SotClipboardFormatId::FILECONTENT) ||
248  IsDropFormatSupported( SotClipboardFormatId::FILEGRPDESCRIPTOR) ||
249  IsDropFormatSupported( SotClipboardFormatId::UNIFORMRESOURCELOCATOR) ||
250  IsDropFormatSupported( SotClipboardFormatId::FILENAME))
251  {
252  nRet = DND_ACTION_LINK;
253  }
254 
255  return nRet;
256 }
257 
258 IMPL_LINK(SwGlobalTree, CommandHdl, const CommandEvent&, rCEvt, bool)
259 {
260  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
261  return false;
262 
263  bool bPop = false;
264  if (m_pActiveShell && !m_pActiveShell->GetView().GetDocShell()->IsReadOnly())
265  {
266  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xTreeView.get(), "modules/swriter/ui/mastercontextmenu.ui"));
267  std::unique_ptr<weld::Menu> xPopup = xBuilder->weld_menu("navmenu");
268 
269  const MenuEnableFlags nEnableFlags = GetEnableFlags();
270 
271  xPopup->set_sensitive("updatesel", bool(nEnableFlags & MenuEnableFlags::UpdateSel));
272 
273  xPopup->set_sensitive("editlink", bool(nEnableFlags & MenuEnableFlags::EditLink));
274 
275  //disabling if applicable
276  xPopup->set_sensitive("insertindex", bool(nEnableFlags & MenuEnableFlags::InsertIdx ));
277  xPopup->set_sensitive("insertfile", bool(nEnableFlags & MenuEnableFlags::InsertFile));
278  xPopup->set_sensitive("insertnewfile", bool(nEnableFlags & MenuEnableFlags::InsertFile));
279  xPopup->set_sensitive("inserttext", bool(nEnableFlags & MenuEnableFlags::InsertText));
280 
281  xPopup->set_sensitive("update", bool(nEnableFlags & MenuEnableFlags::Update));
282  xPopup->set_sensitive("insert", bool(nEnableFlags & MenuEnableFlags::InsertIdx));
283  xPopup->set_sensitive("editcontent", bool(nEnableFlags & MenuEnableFlags::Edit));
284  xPopup->set_sensitive("deleteentry", bool(nEnableFlags & MenuEnableFlags::Delete));
285 
286  OString sCommand = xPopup->popup_at_rect(m_xTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
287  if (!sCommand.isEmpty())
288  ExecuteContextMenuAction(sCommand);
289 
290  bPop = true;
291  }
292  return bPop;
293 }
294 
295 void SwGlobalTree::TbxMenuHdl(std::string_view rCommand, weld::Menu& rMenu)
296 {
297  const MenuEnableFlags nEnableFlags = GetEnableFlags();
298  if (rCommand == "insert")
299  {
300  rMenu.set_sensitive("insertindex", bool(nEnableFlags & MenuEnableFlags::InsertIdx));
301  rMenu.set_sensitive("insertfile", bool(nEnableFlags & MenuEnableFlags::InsertFile));
302  rMenu.set_sensitive("insertnewfile", bool(nEnableFlags & MenuEnableFlags::InsertFile));
303  rMenu.set_sensitive("inserttext", bool(nEnableFlags & MenuEnableFlags::InsertText));
304  }
305  else if (rCommand == "update")
306  {
307  rMenu.set_sensitive("updatesel", bool(nEnableFlags & MenuEnableFlags::UpdateSel));
308  }
309 }
310 
312 {
313  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
314  bool bEntry = m_xTreeView->get_selected(xEntry.get());
315 
316  sal_uLong nSelCount = m_xTreeView->count_selected_rows();
317  size_t nEntryCount = m_xTreeView->n_children();
318  std::unique_ptr<weld::TreeIter> xPrevEntry;
319  bool bPrevEntry = false;
320  if (bEntry)
321  {
322  xPrevEntry = m_xTreeView->make_iterator(xEntry.get());
323  bPrevEntry = m_xTreeView->iter_previous(*xPrevEntry);
324  }
325 
327  if(nSelCount == 1 || !nEntryCount)
329  if(nSelCount == 1)
330  {
331  nRet |= MenuEnableFlags::Edit;
332  if (bEntry && reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetType() != GLBLDOC_UNKNOWN &&
333  (!bPrevEntry || reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(*xPrevEntry).toInt64())->GetType() != GLBLDOC_UNKNOWN))
335  if (bEntry && GLBLDOC_SECTION == reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetType())
337  }
338  else if(!nEntryCount)
339  {
341  }
342  if(nEntryCount)
344  if(nSelCount)
346  return nRet;
347 }
348 
349 IMPL_LINK(SwGlobalTree, QueryTooltipHdl, const weld::TreeIter&, rIter, OUString)
350 {
351  OUString sEntry;
352 
353  const SwGlblDocContent* pCont = reinterpret_cast<const SwGlblDocContent*>(m_xTreeView->get_id(rIter).toInt64());
354  if (pCont && GLBLDOC_SECTION == pCont->GetType())
355  {
356  const SwSection* pSect = pCont->GetSection();
357  sEntry = pSect->GetLinkFileName().getToken(0, sfx2::cTokenSeparator);
358  if (!pSect->IsConnectFlag())
359  sEntry = m_aContextStrings[IDX_STR_BROKEN_LINK] + sEntry;
360  }
361 
362  return sEntry;
363 }
364 
366 {
367  Select();
368 }
369 
371 {
372  int nSelCount = m_xTreeView->count_selected_rows();
373  int nSel = m_xTreeView->get_selected_index();
374  int nAbsPos = nSel != -1 ? nSel : 0;
375  SwNavigationPI* pNavi = GetParentWindow();
376  bool bReadonly = !m_pActiveShell ||
378  pNavi->m_xGlobalToolBox->set_item_sensitive("edit", nSelCount == 1 && !bReadonly);
379  pNavi->m_xGlobalToolBox->set_item_sensitive("insert", nSelCount <= 1 && !bReadonly);
380  pNavi->m_xGlobalToolBox->set_item_sensitive("update", m_xTreeView->n_children() > 0 && !bReadonly);
381  pNavi->m_xGlobalToolBox->set_item_sensitive("moveup",
382  nSelCount == 1 && nAbsPos && !bReadonly);
383  pNavi->m_xGlobalToolBox->set_item_sensitive("movedown",
384  nSelCount == 1 && nAbsPos < m_xTreeView->n_children() - 1 && !bReadonly);
385 
386 }
387 
389 {
390  int nSource = m_xTreeView->get_selected_index();
391 
392  int nDest = pDropEntry ? m_xTreeView->get_iter_index_in_parent(*pDropEntry)
393  : m_pSwGlblDocContents->size();
394 
396  *m_pSwGlblDocContents, nSource, nSource + 1, nDest ) &&
397  Update( false ))
398  Display();
399 }
400 
402 {
403  if (Update(false))
404  Display();
405 }
406 
407 IMPL_LINK(SwGlobalTree, KeyInputHdl, const KeyEvent&, rKEvt, bool)
408 {
409  bool bHandled = false;
410  const vcl::KeyCode aCode = rKEvt.GetKeyCode();
411  if (aCode.GetCode() == KEY_RETURN)
412  {
413  switch (aCode.GetModifier())
414  {
415  case KEY_MOD2:
416  // Switch boxes
417  GetParentWindow()->ToggleTree();
418  bHandled = true;
419  break;
420  }
421  }
422  return bHandled;
423 }
424 
425 void SwGlobalTree::Display(bool bOnlyUpdateUserData)
426 {
427  size_t nCount = m_pSwGlblDocContents->size();
428  size_t nChildren = m_xTreeView->n_children();
429  if (bOnlyUpdateUserData && nChildren == m_pSwGlblDocContents->size())
430  {
431  std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
432  bool bEntry = m_xTreeView->get_iter_first(*xEntry);
433  for (size_t i = 0; i < nCount && bEntry; i++)
434  {
435  const SwGlblDocContent* pCont = (*m_pSwGlblDocContents)[i].get();
436  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCont)));
437  m_xTreeView->set_id(*xEntry, sId);
438  if (pCont->GetType() == GLBLDOC_SECTION && !pCont->GetSection()->IsConnectFlag())
439  m_xTreeView->set_font_color(*xEntry, COL_LIGHTRED);
440  else
441  m_xTreeView->set_font_color(*xEntry, COL_AUTO);
442  bEntry = m_xTreeView->iter_next(*xEntry);
443  assert(bEntry || i == nCount - 1);
444  }
445  }
446  else
447  {
448  int nOldSelEntry = m_xTreeView->get_selected_index();
449  OUString sEntryName; // Name of the entry
450  int nSelPos = -1;
451  if (nOldSelEntry != -1)
452  {
453  sEntryName = m_xTreeView->get_text(nOldSelEntry);
454  nSelPos = nOldSelEntry;
455  }
456  m_xTreeView->freeze();
457  m_xTreeView->clear();
459  Update( false );
460 
461  int nSelEntry = -1;
462  for (size_t i = 0; i < nCount; ++i)
463  {
464  const SwGlblDocContent* pCont = (*m_pSwGlblDocContents)[i].get();
465 
466  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCont)));
467  OUString sEntry;
468  OUString aImage;
469  switch (pCont->GetType())
470  {
471  case GLBLDOC_UNKNOWN:
472  sEntry = m_aContextStrings[IDX_STR_INSERT_TEXT];
473  break;
474  case GLBLDOC_TOXBASE:
475  {
476  const SwTOXBase* pBase = pCont->GetTOX();
477  sEntry = pBase->GetTitle();
478  aImage = RID_BMP_NAVI_INDEX;
479  }
480  break;
481  case GLBLDOC_SECTION:
482  {
483  const SwSection* pSect = pCont->GetSection();
484  sEntry = pSect->GetSectionName();
485  aImage = RID_BMP_DROP_REGION;
486  }
487  break;
488  }
489 
490  m_xTreeView->append(sId, sEntry);
491  if (!aImage.isEmpty())
492  m_xTreeView->set_image(i, aImage);
493 
494  if (pCont->GetType() == GLBLDOC_SECTION && !pCont->GetSection()->IsConnectFlag())
495  m_xTreeView->set_font_color(i, COL_LIGHTRED);
496 
497  if (sEntry == sEntryName)
498  nSelEntry = i;
499  }
500  m_xTreeView->thaw();
501  if (nSelEntry != -1)
502  m_xTreeView->select(nSelEntry);
503  else if (nSelPos != -1 && o3tl::make_unsigned(nSelPos) < nCount)
504  m_xTreeView->select(nSelPos);
505  else if (nCount)
506  m_xTreeView->select(0);
507  Select();
508  }
509 }
510 
511 void SwGlobalTree::InsertRegion( const SwGlblDocContent* pCont, const OUString* pFileName )
512 {
513  Sequence< OUString > aFileNames;
514  if ( !pFileName )
515  {
516  SwNavigationPI* pNavi = GetParentWindow();
517  m_pDocInserter.reset(new ::sfx2::DocumentInserter(pNavi->GetFrameWeld(), "swriter", sfx2::DocumentInserter::Mode::InsertMulti));
518  m_pDocInserter->StartExecuteModal( LINK( this, SwGlobalTree, DialogClosedHdl ) );
519  }
520  else if ( !pFileName->isEmpty() )
521  {
522  aFileNames.realloc(1);
523  INetURLObject aFileName;
524  aFileName.SetSmartURL( *pFileName );
525  aFileNames.getArray()[0] = aFileName.GetMainURL( INetURLObject::DecodeMechanism::NONE );
526  InsertRegion( pCont, aFileNames );
527  }
528 }
529 
531 {
532  sal_uInt16 nSlot = 0;
533  switch( pCont->GetType() )
534  {
535  case GLBLDOC_UNKNOWN:
537  break;
538  case GLBLDOC_TOXBASE:
539  {
540  const SwTOXBase* pBase = pCont->GetTOX();
541  if(pBase)
542  nSlot = FN_INSERT_MULTI_TOX;
543  }
544  break;
545  case GLBLDOC_SECTION:
546  {
547  OpenDoc(pCont);
548 
549  nSlot = 0;
550  pCont = nullptr;
551  }
552  break;
553  }
554  if(pCont)
555  GotoContent(pCont);
556  if(nSlot)
557  {
559  if(Update( false ))
560  Display();
561  }
562 }
563 
564 void SwGlobalTree::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry)
565 {
566  bool bUpdateHard = false;
567 
568  int nEntry = m_xTreeView->get_selected_index();
569  SwGlblDocContent* pCont = nEntry != -1 ? reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64()) : nullptr;
570  // If a RequestHelp is called during the dialogue,
571  // then the content gets lost. Because of that a copy
572  // is created in which only the DocPos is set correctly.
573  std::unique_ptr<SwGlblDocContent> pContCopy;
574  if(pCont)
575  pContCopy.reset(new SwGlblDocContent(pCont->GetDocPos()));
577  sal_uInt16 nSlot = 0;
578  if (rSelectedPopupEntry == "updatesel")
579  {
580  // Two passes: first update the areas, then the directories.
581  m_xTreeView->selected_foreach([this](weld::TreeIter& rSelEntry){
582  SwGlblDocContent* pContent = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(rSelEntry).toInt64());
583  if (GLBLDOC_SECTION == pContent->GetType() &&
584  pContent->GetSection()->IsConnected())
585  {
586  const_cast<SwSection*>(pContent->GetSection())->UpdateNow();
587  }
588  return false;
589  });
590  m_xTreeView->selected_foreach([this](weld::TreeIter& rSelEntry){
591  SwGlblDocContent* pContent = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(rSelEntry).toInt64());
592  if (GLBLDOC_TOXBASE == pContent->GetType())
593  m_pActiveShell->UpdateTableOf(*pContent->GetTOX());
594  return false;
595  });
596 
597  bUpdateHard = true;
598  }
599  else if (rSelectedPopupEntry == "updateindex")
600  {
601  nSlot = FN_UPDATE_TOX;
602  bUpdateHard = true;
603  }
604  else if (rSelectedPopupEntry == "updatelinks" || rSelectedPopupEntry == "updateall")
605  {
606  m_pActiveShell->GetLinkManager().UpdateAllLinks(true, false, nullptr);
607  if (rSelectedPopupEntry == "updateall")
608  nSlot = FN_UPDATE_TOX;
609  pCont = nullptr;
610  bUpdateHard = true;
611  }
612  else if (rSelectedPopupEntry == "editcontent")
613  {
614  OSL_ENSURE(pCont, "edit without entry ? " );
615  if (pCont)
616  {
617  EditContent(pCont);
618  }
619  }
620  else if (rSelectedPopupEntry == "editlink")
621  {
622  OSL_ENSURE(pCont, "edit without entry ? " );
623  if (pCont)
624  {
626  pCont->GetSection()->GetSectionName());
627  rDispatch.ExecuteList(FN_EDIT_REGION, SfxCallMode::ASYNCHRON,
628  { &aName });
629  }
630  }
631  else if (rSelectedPopupEntry == "deleteentry")
632  {
633  // If several entries selected, then after each delete the array
634  // must be refilled. So you do not have to remember anything,
635  // deleting begins at the end.
636  std::vector<int> aRows = m_xTreeView->get_selected_rows();
637  std::sort(aRows.begin(), aRows.end());
638 
639  std::unique_ptr<SwGlblDocContents> pTempContents;
641  for (auto iter = aRows.rbegin(); iter != aRows.rend(); ++iter)
642  {
644  pTempContents ? *pTempContents : *m_pSwGlblDocContents,
645  *iter);
646  pTempContents.reset(new SwGlblDocContents);
647  m_pActiveShell->GetGlobalDocContent(*pTempContents);
648  }
649  pTempContents.reset();
651  pCont = nullptr;
652  }
653  else if (rSelectedPopupEntry == "insertindex")
654  {
655  if(pContCopy)
656  {
657  SfxItemSet aSet(
659  svl::Items<
663  RES_COL, RES_COL,
664  SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
665  FN_PARAM_TOX_TYPE, FN_PARAM_TOX_TYPE>{});
666 
668  ScopedVclPtr<AbstractMultiTOXTabDialog> pDlg(pFact->CreateMultiTOXTabDialog(
669  m_xTreeView.get(), aSet,
671  nullptr,
672  true));
673  if(RET_OK == pDlg->Execute())
674  {
675  SwTOXDescription& rDesc = pDlg->GetTOXDescription(
676  pDlg->GetCurrentTOXType());
677  SwTOXMgr aMgr(m_pActiveShell);
678  SwTOXBase* pToInsert = nullptr;
679  if(aMgr.UpdateOrInsertTOX(rDesc, &pToInsert, pDlg->GetOutputItemSet()))
680  m_pActiveShell->InsertGlobalDocContent( *pContCopy, *pToInsert );
681  }
682  pCont = nullptr;
683  }
684  }
685  else if (rSelectedPopupEntry == "insertfile")
686  {
687  m_pDocContent = std::move(pContCopy);
688  InsertRegion( m_pDocContent.get() );
689  pCont = nullptr;
690  }
691  else if (rSelectedPopupEntry == "insertnewfile")
692  {
693  SfxViewFrame* pGlobFrame = m_pActiveShell->GetView().GetViewFrame();
694  SwGlobalFrameListener_Impl aFrameListener(*pGlobFrame);
695 
696  // Creating a new doc
697  SfxStringItem aFactory(SID_NEWDOCDIRECT,
698  SwDocShell::Factory().GetFilterContainer()->GetName());
699 
700  const SfxFrameItem* pItem = static_cast<const SfxFrameItem*>(
701  rDispatch.ExecuteList(SID_NEWDOCDIRECT,
702  SfxCallMode::SYNCHRON, { &aFactory }));
703 
704  // save at
705  SfxFrame* pFrame = pItem ? pItem->GetFrame() : nullptr;
706  SfxViewFrame* pViewFrame = pFrame ? pFrame->GetCurrentViewFrame() : nullptr;
707  if (pViewFrame)
708  {
709  const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(
710  pViewFrame->GetDispatcher()->Execute(
711  SID_SAVEASDOC, SfxCallMode::SYNCHRON ));
712  SfxObjectShell& rObj = *pViewFrame->GetObjectShell();
713  const SfxMedium* pMedium = rObj.GetMedium();
714  OUString sNewFile(pMedium->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri));
715  // Insert the area with the Doc-Name
716  // Bring the own Doc in the foreground
717  if(aFrameListener.IsValid() && !sNewFile.isEmpty())
718  {
719  pGlobFrame->ToTop();
720  // Due to the update the entries are invalid
721  if (nEntry != -1)
722  {
723  Update( false );
724  Display();
725  m_xTreeView->select(nEntry);
726  Select();
727  nEntry = m_xTreeView->get_selected_index();
728  pCont = nEntry != -1 ? reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64()) : nullptr;
729  }
730  else
731  {
732  nEntry = -1;
733  pCont = nullptr;
734  }
735  if(pBool->GetValue())
736  {
737  InsertRegion(pCont, &sNewFile);
738  pViewFrame->ToTop();
739  }
740  else
741  pViewFrame->GetDispatcher()->Execute(SID_CLOSEWIN, SfxCallMode::SYNCHRON);
742  }
743  else
744  {
745  pViewFrame->ToTop();
746  return;
747  }
748  }
749  }
750  else if (rSelectedPopupEntry == "inserttext")
751  {
752  if (pCont)
754  else
755  {
756  m_pActiveShell->SplitNode(); // Empty document
757  m_pActiveShell->Up( false );
758  }
760  }
761  else if (rSelectedPopupEntry == "update")
762  pCont = nullptr;
763 
764  if (pCont)
765  GotoContent(pCont);
766  if (nSlot)
767  rDispatch.Execute(nSlot);
768  if (Update(bUpdateHard))
769  Display();
770 }
771 
773 {
774  if (!m_xTreeView->has_focus() && Update(false))
775  Display();
776 }
777 
779 {
781 
782  switch( pCont->GetType() )
783  {
784  case GLBLDOC_UNKNOWN:
786  break;
787  case GLBLDOC_TOXBASE:
788  {
789  const OUString sName = pCont->GetTOX()->GetTOXName();
790  if (!m_pActiveShell->GotoNextTOXBase(&sName))
792  }
793  break;
794  case GLBLDOC_SECTION:
795  break;
796  }
797 
798 }
799 
801 {
803  m_xTreeView->show();
804 }
805 
807 {
809  m_xTreeView->hide();
810 }
811 
812 void SwGlobalTree::ExecCommand(std::string_view rCmd)
813 {
814  int nEntry = m_xTreeView->get_selected_index();
815  if (nEntry == -1)
816  return;
817  if (rCmd == "edit")
818  {
819  const SwGlblDocContent* pCont = reinterpret_cast<const SwGlblDocContent*>(
820  m_xTreeView->get_id(nEntry).toInt64());
821  EditContent(pCont);
822  }
823  else
824  {
825  if (m_xTreeView->count_selected_rows() == 1)
826  {
827  bool bMove = false;
828  sal_uLong nSource = nEntry;
829  sal_uLong nDest = nSource;
830  if (rCmd == "movedown")
831  {
832  size_t nEntryCount = m_xTreeView->n_children();
833  bMove = nEntryCount > nSource + 1;
834  nDest+= 2;
835  }
836  else if (rCmd == "moveup")
837  {
838  bMove = 0 != nSource;
839  nDest--;
840  }
841  if( bMove && m_pActiveShell->MoveGlobalDocContent(
842  *m_pSwGlblDocContents, nSource, nSource + 1, nDest ) &&
843  Update( false ))
844  Display();
845  }
846  }
847 }
848 
849 bool SwGlobalTree::Update(bool bHard)
850 {
851  SwView* pActView = GetParentWindow()->GetCreateView();
852  bool bRet = false;
853  if (pActView && pActView->GetWrtShellPtr())
854  {
855  const SwWrtShell* pOldShell = m_pActiveShell;
856  m_pActiveShell = pActView->GetWrtShellPtr();
857  if(m_pActiveShell != pOldShell)
858  {
859  m_pSwGlblDocContents.reset();
860  }
862  {
864  bRet = true;
866  }
867  else
868  {
869  bool bCopy = false;
870  std::unique_ptr<SwGlblDocContents> pTempContents(new SwGlblDocContents);
871  m_pActiveShell->GetGlobalDocContent(*pTempContents);
872  size_t nChildren = m_xTreeView->n_children();
873  if (pTempContents->size() != m_pSwGlblDocContents->size() ||
874  pTempContents->size() != nChildren)
875  {
876  bRet = true;
877  bCopy = true;
878  }
879  else
880  {
881  for(size_t i = 0; i < pTempContents->size() && !bCopy; i++)
882  {
883  SwGlblDocContent* pLeft = (*pTempContents)[i].get();
884  SwGlblDocContent* pRight = (*m_pSwGlblDocContents)[i].get();
886  OUString sTemp = m_xTreeView->get_text(i);
887  if (
888  eType != pRight->GetType() ||
889  (
890  eType == GLBLDOC_SECTION &&
891  pLeft->GetSection()->GetSectionName() != sTemp
892  ) ||
893  (
894  eType == GLBLDOC_TOXBASE &&
895  pLeft->GetTOX()->GetTitle() != sTemp
896  )
897  )
898  {
899  bCopy = true;
900  }
901  }
902  }
903  if (bCopy || bHard)
904  {
905  *m_pSwGlblDocContents = std::move( *pTempContents );
906  bRet = true;
907  }
908  }
909  }
910  else
911  {
912  m_xTreeView->clear();
914  m_pSwGlblDocContents->clear();
915  }
916  // FIXME: Implement a test for changes!
917  return bRet;
918 }
919 
921 {
922  const OUString sFileName(pCont->GetSection()->GetLinkFileName().getToken(0,
924  bool bFound = false;
925  const SfxObjectShell* pCurr = SfxObjectShell::GetFirst();
926  while( !bFound && pCurr )
927  {
928  if(pCurr->GetMedium() &&
930  {
931  bFound = true;
933  Application::PostUserEvent(LINK(this, SwGlobalTree, ShowFrameHdl));
934  pCurr = nullptr;
935  }
936  else
937  pCurr = SfxObjectShell::GetNext(*pCurr);
938  }
939  if(!bFound)
940  {
941  SfxStringItem aURL(SID_FILE_NAME, sFileName);
942  SfxBoolItem aReadOnly(SID_DOC_READONLY, false);
943  SfxStringItem aTargetFrameName( SID_TARGETNAME, "_blank" );
944  SfxStringItem aReferer(SID_REFERER, m_pActiveShell->GetView().GetDocShell()->GetTitle());
946  ExecuteList(SID_OPENDOC, SfxCallMode::ASYNCHRON,
947  { &aURL, &aReadOnly, &aReferer, &aTargetFrameName });
948  }
949 }
950 
951 IMPL_LINK_NOARG( SwGlobalTree, DoubleClickHdl, weld::TreeView&, bool)
952 {
953  int nEntry = m_xTreeView->get_cursor_index();
954  SwGlblDocContent* pCont = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64());
955  if (pCont->GetType() == GLBLDOC_SECTION)
956  OpenDoc(pCont);
957  else
958  {
959  GotoContent(pCont);
960  m_pActiveShell->GetView().GetEditWin().GrabFocus();
961  }
962  return false;
963 }
964 
966 {
967  return m_pDialog;
968 }
969 
970 IMPL_STATIC_LINK_NOARG(SwGlobalTree, ShowFrameHdl, void*, void)
971 {
972  SfxViewFrame* pFirst = pShowShell ? SfxViewFrame::GetFirst(pShowShell) : nullptr;
973  if (pFirst)
974  pFirst->ToTop();
976 }
977 
978 void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequence< OUString >& _rFiles )
979 {
980  sal_Int32 nFiles = _rFiles.getLength();
981  if (!nFiles)
982  return;
983 
984  size_t nEntryCount = m_xTreeView->n_children();
985 
986  bool bMove = _pContent == nullptr;
987  const OUString* pFileNames = _rFiles.getConstArray();
989  rSh.StartAction();
990  // after insertion of the first new content the 'pCont' parameter becomes invalid
991  // find the index of the 'anchor' content to always use a current anchor content
992  size_t nAnchorContent = m_pSwGlblDocContents->size() - 1;
993  if (!bMove)
994  {
995  for (size_t nContent = 0; nContent < m_pSwGlblDocContents->size();
996  ++nContent)
997  {
998  if( *_pContent == *(*m_pSwGlblDocContents)[ nContent ] )
999  {
1000  nAnchorContent = nContent;
1001  break;
1002  }
1003  }
1004  }
1005  SwGlblDocContents aTempContents;
1006  for ( sal_Int32 nFile = 0; nFile < nFiles; ++nFile )
1007  {
1008  //update the global document content after each inserted document
1009  rSh.GetGlobalDocContent(aTempContents);
1010  SwGlblDocContent* pAnchorContent = nullptr;
1011  OSL_ENSURE(aTempContents.size() > (nAnchorContent + nFile), "invalid anchor content -> last insertion failed");
1012  if ( aTempContents.size() > (nAnchorContent + nFile) )
1013  pAnchorContent = aTempContents[nAnchorContent + nFile].get();
1014  else
1015  pAnchorContent = aTempContents.back().get();
1016  OUString sFileName(pFileNames[nFile]);
1017  INetURLObject aFileUrl;
1018  aFileUrl.SetSmartURL( sFileName );
1019  OUString sSectionName(aFileUrl.GetLastName(
1021  sal_uInt16 nSectCount = rSh.GetSectionFormatCount();
1022  OUString sTempSectionName(sSectionName);
1023  sal_uInt16 nAddNumber = 0;
1024  sal_uInt16 nCount = 0;
1025  // if applicable: add index if the range name is already in use.
1026  while ( nCount < nSectCount )
1027  {
1028  const SwSectionFormat& rFormat = rSh.GetSectionFormat(nCount);
1029  if ((rFormat.GetSection()->GetSectionName() == sTempSectionName)
1030  && rFormat.IsInNodesArr())
1031  {
1032  nCount = 0;
1033  nAddNumber++;
1034  sTempSectionName = sSectionName + ":" + OUString::number( nAddNumber );
1035  }
1036  else
1037  nCount++;
1038  }
1039 
1040  if ( nAddNumber )
1041  sSectionName = sTempSectionName;
1042 
1043  SwSectionData aSectionData(SectionType::Content, sSectionName);
1044  aSectionData.SetProtectFlag(true);
1045  aSectionData.SetHidden(false);
1046 
1047  aSectionData.SetLinkFileName(sFileName);
1048  aSectionData.SetType(SectionType::FileLink);
1049  aSectionData.SetLinkFilePassword( OUString() );
1050 
1051  rSh.InsertGlobalDocContent( *pAnchorContent, aSectionData );
1052  }
1053  if (bMove)
1054  {
1055  Update( false );
1057  *m_pSwGlblDocContents, nEntryCount, nEntryCount + nFiles, nEntryCount - nFiles );
1058  }
1059  rSh.EndAction();
1060  Update( false );
1061  Display();
1062 
1063 }
1064 
1065 IMPL_LINK( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void )
1066 {
1067  if ( ERRCODE_NONE != _pFileDlg->GetError() )
1068  return;
1069 
1070  SfxMediumList aMedList(m_pDocInserter->CreateMediumList());
1071  if ( aMedList.empty() )
1072  return;
1073 
1074  Sequence< OUString >aFileNames( aMedList.size() );
1075  OUString* pFileNames = aFileNames.getArray();
1076  sal_Int32 nPos = 0;
1077  for (const std::unique_ptr<SfxMedium>& pMed : aMedList)
1078  {
1079  OUString sFileName = pMed->GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE )
1080  + OUStringChar(sfx2::cTokenSeparator)
1081  + pMed->GetFilter()->GetFilterName()
1082  + OUStringChar(sfx2::cTokenSeparator);
1083  pFileNames[nPos++] = sFileName;
1084  }
1085  InsertRegion( m_pDocContent.get(), aFileNames );
1086  m_pDocContent.reset();
1087 }
1088 
1089 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
bool GetValue() const
MenuEnableFlags GetEnableFlags() const
Definition: glbltree.cxx:311
virtual int get_iter_index_in_parent(const TreeIter &rIter) const =0
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
#define FN_UPDATE_TOX
Definition: cmdid.h:503
URL aURL
const Value & back() const
void EditContent(const SwGlblDocContent *pCont)
Definition: glbltree.cxx:530
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
void SplitNode(bool bAutoFormat=false)
Definition: wrtsh1.cxx:988
virtual void set_sensitive(const OString &rIdent, bool bSensitive)=0
#define FN_EDIT_REGION
Definition: cmdid.h:108
void TbxMenuHdl(std::string_view rCommand, weld::Menu &rMenu)
Definition: glbltree.cxx:295
SwNavigationPI * GetParentWindow()
Definition: glbltree.cxx:965
bool MoveGlobalDocContent(const SwGlblDocContents &rArr, size_t nFromPos, size_t nToPos, size_t nNewPos)
Definition: edglbldc.cxx:297
void MoveSelectionTo(const weld::TreeIter *pDropTarget)
Definition: glbltree.cxx:388
OUString GetTitle(sal_uInt16 nMaxLen=0) const
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldRect=nullptr)
Notify the background based on the difference between old and new rectangle.
Definition: frmtool.cxx:3176
sfx2::LinkManager & GetLinkManager()
Definition: editsh.cxx:593
SfxFrame * GetFrame() const
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
signed char sal_Int8
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
SfxDispatcher * GetDispatcher()
sal_uIntPtr sal_uLong
std::unique_ptr< SwGlblDocContents > m_pSwGlblDocContents
Definition: conttree.hxx:296
#define GLOBAL_CONTEXT_COUNT
Definition: swcont.hxx:49
const sal_Unicode cTokenSeparator
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
virtual TreeView * get_drag_source() const =0
sal_Int64 n
static const SfxObjectShell * pShowShell
Definition: conttree.hxx:301
SwGlobalTree & m_rTreeView
Definition: conttree.hxx:277
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition: glbltree.cxx:231
std::unique_ptr< weld::Toolbar > m_xGlobalToolBox
Definition: navipi.hxx:65
bool IsConnected() const
Definition: section.hxx:224
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false)
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
sal_uInt16 GetCode() const
void EnterStdMode()
Definition: select.cxx:551
SwEditWin & GetEditWin()
Definition: view.hxx:416
OUString GetLastName(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString const & GetLinkFileName() const
Definition: section.cxx:547
virtual SfxObjectShell * GetObjectShell() override
virtual short Execute()=0
bool HasFormat(SotClipboardFormatId nFormat) const
SfxHintId GetId() const
const SwWrtShell * GetActiveWrtShell() const
Definition: conttree.hxx:372
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const =0
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
Used by the UI to modify the document model.
Definition: wrtsh.hxx:91
IMPL_STATIC_LINK_NOARG(SwGlobalTree, ShowFrameHdl, void *, void)
Definition: glbltree.cxx:970
#define GLOBAL_UPDATE_TIMEOUT
Definition: glbltree.cxx:57
const SwView & GetView() const
Definition: wrtsh.hxx:429
bool GotoNextTOXBase(const OUString *pName=nullptr)
Definition: move.cxx:684
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
int nCount
bool GotoPrevTOXBase(const OUString *=nullptr)
jump to previous index
Definition: crstrvl.cxx:318
virtual int n_children() const =0
#define DND_ACTION_NONE
static OUString CreateDropFileName(TransferableDataHelper &rData)
Definition: navipi.cxx:881
SwGlobalTreeDropTarget(SwGlobalTree &rTreeView)
Definition: glbltree.cxx:159
virtual OUString get_id(int pos) const =0
SfxViewFrame * GetCurrentViewFrame() const
sal_uInt16 GetModifier() const
size_type size() const
bool Update(bool bHard)
Definition: glbltree.cxx:849
void UpdateTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
Definition: wrtsh2.cxx:328
const SwSectionFormat & GetSectionFormat(size_t nFormat) const
Definition: edsect.cxx:142
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTRED
const char * sName
void GotoContent(const SwGlblDocContent *)
Definition: glbltree.cxx:778
MenuEnableFlags
Definition: conttree.hxx:57
SfxItemPool & GetPool() const
void ExecCommand(std::string_view rCmd)
Definition: glbltree.cxx:812
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:47
DocumentType eType
std::unique_ptr< sfx2::DocumentInserter > m_pDocInserter
Definition: conttree.hxx:299
bool Up(bool bSelect, sal_uInt16 nCount=1, bool bBasicCall=false)
Definition: move.cxx:145
SwNavigationPI * m_pDialog
Definition: conttree.hxx:291
virtual bool get_dest_row_at_pos(const Point &rPos, weld::TreeIter *pResult, bool bDnDMode)=0
int i
const OUString & GetSectionName() const
Definition: section.hxx:168
void DeleteGlobalDocContent(const SwGlblDocContents &rArr, size_t nPos)
Definition: edglbldc.cxx:233
static void SetShowShell(const SfxObjectShell *pSet)
Definition: conttree.hxx:324
void Select()
Definition: glbltree.cxx:370
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
::rtl::Reference< Content > pContent
void ExecuteContextMenuAction(std::string_view rSelectedPopupEntry)
Definition: glbltree.cxx:564
IMPL_LINK_NOARG(SwGlobalTree, SelectHdl, weld::TreeView &, void)
Definition: glbltree.cxx:365
virtual void Start() override
OUString GetFile(size_t nIndex) const
size
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
Display
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
OUString SwResId(const char *pId)
Definition: swmodule.cxx:166
#define DND_ACTION_LINK
size_t Count() const
constexpr sal_uInt16 KEY_MOD2
void SetTimeout(sal_uInt64 nTimeoutMs)
void GrabFocus()
GlobalDocContentType
Definition: edglbldc.hxx:29
const OUString & GetTitle() const
Definition: tox.hxx:719
void GetGlobalDocContent(SwGlblDocContents &rArr) const
Definition: edglbldc.cxx:54
void GotoGlobalDocContent(const SwGlblDocContent &rPos)
Definition: edglbldc.cxx:334
SwDocShell * GetDocShell()
Definition: view.cxx:1126
bool IsReadOnly() const
void InsertRegion(const SwGlblDocContent *_pContent, const css::uno::Sequence< OUString > &_rFiles)
constexpr sal_uInt16 KEY_RETURN
virtual weld::Window * GetFrameWeld() const override
Definition: navipi.cxx:631
void StartAction()
Definition: crsrsh.cxx:226
void HideTree()
Definition: glbltree.cxx:806
SwView * GetCreateView() const
Definition: navipi.cxx:1072
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
const SwTOXBase * GetTOX() const
Definition: edglbldc.hxx:53
size_t GetSectionFormatCount() const
Definition: edsect.cxx:114
AutoTimer m_aUpdateTimer
Definition: conttree.hxx:292
virtual const SfxItemSet * GetOutputItemSet() const =0
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
SwWrtShell * m_pActiveShell
Definition: conttree.hxx:295
void InsertGlobalDocContent(const SwGlblDocContent &rPos, SwSectionData &rNew)
Definition: edglbldc.cxx:131
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:414
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
void Stop()
#define HID_NAVIGATOR_GLOB_TREELIST
Definition: helpids.h:41
#define ERRCODE_NONE
static SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
void UpdateAllLinks(bool bAskUpdate, bool bUpdateGrfLinks, weld::Window *pParentWin)
GlobalDocContentType GetType() const
Query contents.
Definition: edglbldc.hxx:50
OUString aName
void OpenDoc(const SwGlblDocContent *)
Definition: glbltree.cxx:920
RET_OK
bool IsConnectFlag() const
Definition: section.hxx:238
const SwSection * GetSection() const
Definition: edglbldc.hxx:51
bool GetFileList(SotClipboardFormatId nFormat, FileList &rFileList)
const INetURLObject & GetURLObject() const
void Display(bool bOnlyUpdateUserData=false)
Definition: glbltree.cxx:425
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: conttree.hxx:289
void SetInvokeHandler(const Link< Timer *, void > &rLink)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
bool IsDropFormatSupported(SotClipboardFormatId nFormat) const
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: glbltree.cxx:165
IMPL_LINK(SwGlobalTree, CommandHdl, const CommandEvent &, rCEvt, bool)
Definition: glbltree.cxx:258
OUString sId
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
weld::TreeView & get_widget()
Definition: conttree.hxx:349
static SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
#define FN_PARAM_TOX_TYPE
Definition: cmdid.h:809
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
OUString m_aContextStrings[GLOBAL_CONTEXT_COUNT]
Definition: conttree.hxx:293
SwGlobalTree(std::unique_ptr< weld::TreeView > xTreeView, SwNavigationPI *pDialog)
Definition: glbltree.cxx:126
static const char * GLOBAL_CONTEXT_ARY[]
Definition: glbltree.cxx:108
std::unique_ptr< SwGlblDocContent > m_pDocContent
Definition: conttree.hxx:298
SwSection * GetSection() const
Definition: section.cxx:674
bool Detect(bool bExtendedInfo=false)
sal_Int8 mnAction
virtual CurTOXType GetCurrentTOXType() const =0
#define FN_INSERT_MULTI_TOX
Definition: cmdid.h:283
virtual SwTOXDescription & GetTOXDescription(CurTOXType eTOXTypes)=0
GLOBAL_CONTEXT_IDX
Definition: glbltree.cxx:88
void ShowTree()
Definition: glbltree.cxx:800
sal_uLong GetDocPos() const
Definition: edglbldc.hxx:55
Definition: view.hxx:144
sal_uInt16 nPos
bool UpdateOrInsertTOX(const SwTOXDescription &rDesc, SwTOXBase **ppBase, const SfxItemSet *pSet)
Definition: toxmgr.cxx:267
bool SetSmartURL(OUString const &rTheAbsURIRef, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
const OUString & GetTOXName() const
Definition: tox.hxx:485
::std::vector< std::unique_ptr< SfxMedium > > SfxMediumList
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
bool IsInNodesArr() const
Definition: section.cxx:916
SfxMedium * GetMedium() const