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 
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_aUpdateTimer("SwGlobalTree m_aUpdateTimer")
131  , m_pActiveShell(nullptr)
132 {
133  m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 30,
134  m_xTreeView->get_text_height() * 14);
135 
139  for (sal_uInt16 i = 0; i < GLOBAL_CONTEXT_COUNT; i++)
140  {
141  m_aContextStrings[i] = SwResId(GLOBAL_CONTEXT_ARY[i]);
142  }
144  Select();
145  m_xTreeView->connect_row_activated(LINK(this, SwGlobalTree, DoubleClickHdl));
146  m_xTreeView->connect_changed(LINK(this, SwGlobalTree, SelectHdl));
147  m_xTreeView->connect_focus_in(LINK(this, SwGlobalTree, FocusInHdl));
148  m_xTreeView->connect_key_press(LINK(this, SwGlobalTree, KeyInputHdl));
149  m_xTreeView->connect_popup_menu(LINK(this, SwGlobalTree, CommandHdl));
150  m_xTreeView->connect_query_tooltip(LINK(this, SwGlobalTree, QueryTooltipHdl));
151 }
152 
154 {
155  m_pSwGlblDocContents.reset();
156  m_pDocInserter.reset();
158 }
159 
161  : DropTargetHelper(rTreeView.get_widget().get_drop_target())
162  , m_rTreeView(rTreeView)
163 {
164 }
165 
167 {
168  sal_Int8 nRet = DND_ACTION_NONE;
169 
171  std::unique_ptr<weld::TreeIter> xDropEntry(rWidget.make_iterator());
172  if (!rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xDropEntry.get(), true))
173  xDropEntry.reset();
174 
175  if (rWidget.get_drag_source() == &rWidget) // internal drag
176  m_rTreeView.MoveSelectionTo(xDropEntry.get());
177  else
178  {
179  TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
180 
181  OUString sFileName;
182  const SwGlblDocContent* pCnt = xDropEntry ?
183  reinterpret_cast<const SwGlblDocContent*>(rWidget.get_id(*xDropEntry).toInt64()) :
184  nullptr;
185  if( aData.HasFormat( SotClipboardFormatId::FILE_LIST ))
186  {
187  nRet = rEvt.mnAction;
188  SwGlblDocContents aTempContents;
189  int nAbsContPos = xDropEntry ?
190  rWidget.get_iter_index_in_parent(*xDropEntry):
191  - 1;
192  size_t nEntryCount = rWidget.n_children();
193 
194  // Get data
195  FileList aFileList;
196  aData.GetFileList( SotClipboardFormatId::FILE_LIST, aFileList );
197  for ( size_t n = aFileList.Count(); n--; )
198  {
199  sFileName = aFileList.GetFile(n);
200  m_rTreeView.InsertRegion(pCnt, &sFileName);
201  // The list of contents must be newly fetched after inserting,
202  // to not work on an old content.
203  if(n)
204  {
206  // If the file was successfully inserted,
207  // then the next content must also be fetched.
208  if(nEntryCount < aTempContents.size())
209  {
210  nEntryCount++;
211  nAbsContPos++;
212  pCnt = aTempContents[ nAbsContPos ].get();
213  }
214  }
215  }
216  }
217  else if( !(sFileName =
218  SwNavigationPI::CreateDropFileName( aData )).isEmpty())
219  {
220  INetURLObject aTemp(sFileName);
221  GraphicDescriptor aDesc(aTemp);
222  if( !aDesc.Detect() ) // accept no graphics
223  {
224  nRet = rEvt.mnAction;
225  m_rTreeView.InsertRegion(pCnt, &sFileName);
226  }
227  }
228  }
229  return nRet;
230 }
231 
233 {
234  // to enable the autoscroll when we're close to the edges
236  rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true);
237 
238  sal_Int8 nRet = rEvt.mnAction;
239 
240  if (rWidget.get_drag_source() == &rWidget) // internal drag
241  return nRet;
242 
243  if (IsDropFormatSupported( SotClipboardFormatId::SIMPLE_FILE) ||
244  IsDropFormatSupported( SotClipboardFormatId::STRING) ||
245  IsDropFormatSupported( SotClipboardFormatId::FILE_LIST) ||
246  IsDropFormatSupported( SotClipboardFormatId::SOLK) ||
247  IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK )||
248  IsDropFormatSupported( SotClipboardFormatId::FILECONTENT) ||
249  IsDropFormatSupported( SotClipboardFormatId::FILEGRPDESCRIPTOR) ||
250  IsDropFormatSupported( SotClipboardFormatId::UNIFORMRESOURCELOCATOR) ||
251  IsDropFormatSupported( SotClipboardFormatId::FILENAME))
252  {
253  nRet = DND_ACTION_LINK;
254  }
255 
256  return nRet;
257 }
258 
259 IMPL_LINK(SwGlobalTree, CommandHdl, const CommandEvent&, rCEvt, bool)
260 {
261  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
262  return false;
263 
264  bool bPop = false;
265  if (m_pActiveShell && !m_pActiveShell->GetView().GetDocShell()->IsReadOnly())
266  {
267  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xTreeView.get(), "modules/swriter/ui/mastercontextmenu.ui"));
268  std::unique_ptr<weld::Menu> xPopup = xBuilder->weld_menu("navmenu");
269 
270  const MenuEnableFlags nEnableFlags = GetEnableFlags();
271 
272  xPopup->set_sensitive("updatesel", bool(nEnableFlags & MenuEnableFlags::UpdateSel));
273 
274  xPopup->set_sensitive("editlink", bool(nEnableFlags & MenuEnableFlags::EditLink));
275 
276  //disabling if applicable
277  xPopup->set_sensitive("insertindex", bool(nEnableFlags & MenuEnableFlags::InsertIdx ));
278  xPopup->set_sensitive("insertfile", bool(nEnableFlags & MenuEnableFlags::InsertFile));
279  xPopup->set_sensitive("insertnewfile", bool(nEnableFlags & MenuEnableFlags::InsertFile));
280  xPopup->set_sensitive("inserttext", bool(nEnableFlags & MenuEnableFlags::InsertText));
281 
282  xPopup->set_sensitive("update", bool(nEnableFlags & MenuEnableFlags::Update));
283  xPopup->set_sensitive("insert", bool(nEnableFlags & MenuEnableFlags::InsertIdx));
284  xPopup->set_sensitive("editcontent", bool(nEnableFlags & MenuEnableFlags::Edit));
285  xPopup->set_sensitive("deleteentry", bool(nEnableFlags & MenuEnableFlags::Delete));
286 
287  OString sCommand = xPopup->popup_at_rect(m_xTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
288  if (!sCommand.isEmpty())
289  ExecuteContextMenuAction(sCommand);
290 
291  bPop = true;
292  }
293  return bPop;
294 }
295 
296 void SwGlobalTree::TbxMenuHdl(std::string_view rCommand, weld::Menu& rMenu)
297 {
298  const MenuEnableFlags nEnableFlags = GetEnableFlags();
299  if (rCommand == "insert")
300  {
301  rMenu.set_sensitive("insertindex", bool(nEnableFlags & MenuEnableFlags::InsertIdx));
302  rMenu.set_sensitive("insertfile", bool(nEnableFlags & MenuEnableFlags::InsertFile));
303  rMenu.set_sensitive("insertnewfile", bool(nEnableFlags & MenuEnableFlags::InsertFile));
304  rMenu.set_sensitive("inserttext", bool(nEnableFlags & MenuEnableFlags::InsertText));
305  }
306  else if (rCommand == "update")
307  {
308  rMenu.set_sensitive("updatesel", bool(nEnableFlags & MenuEnableFlags::UpdateSel));
309  }
310 }
311 
313 {
314  std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
315  bool bEntry = m_xTreeView->get_selected(xEntry.get());
316 
317  sal_uLong nSelCount = m_xTreeView->count_selected_rows();
318  size_t nEntryCount = m_xTreeView->n_children();
319  std::unique_ptr<weld::TreeIter> xPrevEntry;
320  bool bPrevEntry = false;
321  if (bEntry)
322  {
323  xPrevEntry = m_xTreeView->make_iterator(xEntry.get());
324  bPrevEntry = m_xTreeView->iter_previous(*xPrevEntry);
325  }
326 
328  if(nSelCount == 1 || !nEntryCount)
330  if(nSelCount == 1)
331  {
332  nRet |= MenuEnableFlags::Edit;
333  if (bEntry && reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetType() != GLBLDOC_UNKNOWN &&
334  (!bPrevEntry || reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(*xPrevEntry).toInt64())->GetType() != GLBLDOC_UNKNOWN))
336  if (bEntry && GLBLDOC_SECTION == reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetType())
338  }
339  else if(!nEntryCount)
340  {
342  }
343  if(nEntryCount)
345  if(nSelCount)
347  return nRet;
348 }
349 
350 IMPL_LINK(SwGlobalTree, QueryTooltipHdl, const weld::TreeIter&, rIter, OUString)
351 {
352  OUString sEntry;
353 
354  const SwGlblDocContent* pCont = reinterpret_cast<const SwGlblDocContent*>(m_xTreeView->get_id(rIter).toInt64());
355  if (pCont && GLBLDOC_SECTION == pCont->GetType())
356  {
357  const SwSection* pSect = pCont->GetSection();
358  sEntry = pSect->GetLinkFileName().getToken(0, sfx2::cTokenSeparator);
359  if (!pSect->IsConnectFlag())
360  sEntry = m_aContextStrings[IDX_STR_BROKEN_LINK] + sEntry;
361  }
362 
363  return sEntry;
364 }
365 
367 {
368  Select();
369 }
370 
372 {
373  int nSelCount = m_xTreeView->count_selected_rows();
374  int nSel = m_xTreeView->get_selected_index();
375  int nAbsPos = nSel != -1 ? nSel : 0;
376  SwNavigationPI* pNavi = GetParentWindow();
377  bool bReadonly = !m_pActiveShell ||
379  pNavi->m_xGlobalToolBox->set_item_sensitive("edit", nSelCount == 1 && !bReadonly);
380  pNavi->m_xGlobalToolBox->set_item_sensitive("insert", nSelCount <= 1 && !bReadonly);
381  pNavi->m_xGlobalToolBox->set_item_sensitive("update", m_xTreeView->n_children() > 0 && !bReadonly);
382  pNavi->m_xGlobalToolBox->set_item_sensitive("moveup",
383  nSelCount == 1 && nAbsPos && !bReadonly);
384  pNavi->m_xGlobalToolBox->set_item_sensitive("movedown",
385  nSelCount == 1 && nAbsPos < m_xTreeView->n_children() - 1 && !bReadonly);
386 
387 }
388 
390 {
391  int nSource = m_xTreeView->get_selected_index();
392 
393  int nDest = pDropEntry ? m_xTreeView->get_iter_index_in_parent(*pDropEntry)
394  : m_pSwGlblDocContents->size();
395 
397  *m_pSwGlblDocContents, nSource, nSource + 1, nDest ) &&
398  Update( false ))
399  Display();
400 }
401 
403 {
404  if (Update(false))
405  Display();
406 }
407 
408 IMPL_LINK(SwGlobalTree, KeyInputHdl, const KeyEvent&, rKEvt, bool)
409 {
410  bool bHandled = false;
411  const vcl::KeyCode aCode = rKEvt.GetKeyCode();
412  if (aCode.GetCode() == KEY_RETURN)
413  {
414  switch (aCode.GetModifier())
415  {
416  case KEY_MOD2:
417  // Switch boxes
418  GetParentWindow()->ToggleTree();
419  bHandled = true;
420  break;
421  }
422  }
423  return bHandled;
424 }
425 
426 void SwGlobalTree::Display(bool bOnlyUpdateUserData)
427 {
428  size_t nCount = m_pSwGlblDocContents->size();
429  size_t nChildren = m_xTreeView->n_children();
430  if (bOnlyUpdateUserData && nChildren == m_pSwGlblDocContents->size())
431  {
432  std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
433  bool bEntry = m_xTreeView->get_iter_first(*xEntry);
434  for (size_t i = 0; i < nCount && bEntry; i++)
435  {
436  const SwGlblDocContent* pCont = (*m_pSwGlblDocContents)[i].get();
437  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCont)));
438  m_xTreeView->set_id(*xEntry, sId);
439  if (pCont->GetType() == GLBLDOC_SECTION && !pCont->GetSection()->IsConnectFlag())
440  m_xTreeView->set_font_color(*xEntry, COL_LIGHTRED);
441  else
442  m_xTreeView->set_font_color(*xEntry, COL_AUTO);
443  bEntry = m_xTreeView->iter_next(*xEntry);
444  assert(bEntry || i == nCount - 1);
445  }
446  }
447  else
448  {
449  int nOldSelEntry = m_xTreeView->get_selected_index();
450  OUString sEntryName; // Name of the entry
451  int nSelPos = -1;
452  if (nOldSelEntry != -1)
453  {
454  sEntryName = m_xTreeView->get_text(nOldSelEntry);
455  nSelPos = nOldSelEntry;
456  }
457  m_xTreeView->freeze();
458  m_xTreeView->clear();
460  Update( false );
461 
462  int nSelEntry = -1;
463  for (size_t i = 0; i < nCount; ++i)
464  {
465  const SwGlblDocContent* pCont = (*m_pSwGlblDocContents)[i].get();
466 
467  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCont)));
468  OUString sEntry;
469  OUString aImage;
470  switch (pCont->GetType())
471  {
472  case GLBLDOC_UNKNOWN:
473  sEntry = m_aContextStrings[IDX_STR_INSERT_TEXT];
474  break;
475  case GLBLDOC_TOXBASE:
476  {
477  const SwTOXBase* pBase = pCont->GetTOX();
478  sEntry = pBase->GetTitle();
479  aImage = RID_BMP_NAVI_INDEX;
480  }
481  break;
482  case GLBLDOC_SECTION:
483  {
484  const SwSection* pSect = pCont->GetSection();
485  sEntry = pSect->GetSectionName();
486  aImage = RID_BMP_DROP_REGION;
487  }
488  break;
489  }
490 
491  m_xTreeView->append(sId, sEntry);
492  if (!aImage.isEmpty())
493  m_xTreeView->set_image(i, aImage);
494 
495  if (pCont->GetType() == GLBLDOC_SECTION && !pCont->GetSection()->IsConnectFlag())
496  m_xTreeView->set_font_color(i, COL_LIGHTRED);
497 
498  if (sEntry == sEntryName)
499  nSelEntry = i;
500  }
501  m_xTreeView->thaw();
502  if (nSelEntry != -1)
503  m_xTreeView->select(nSelEntry);
504  else if (nSelPos != -1 && o3tl::make_unsigned(nSelPos) < nCount)
505  m_xTreeView->select(nSelPos);
506  else if (nCount)
507  m_xTreeView->select(0);
508  Select();
509  }
510 }
511 
512 void SwGlobalTree::InsertRegion( const SwGlblDocContent* pCont, const OUString* pFileName )
513 {
514  Sequence< OUString > aFileNames;
515  if ( !pFileName )
516  {
517  SwNavigationPI* pNavi = GetParentWindow();
518  m_pDocInserter.reset(new ::sfx2::DocumentInserter(pNavi->GetFrameWeld(), "swriter", sfx2::DocumentInserter::Mode::InsertMulti));
519  m_pDocInserter->StartExecuteModal( LINK( this, SwGlobalTree, DialogClosedHdl ) );
520  }
521  else if ( !pFileName->isEmpty() )
522  {
523  aFileNames.realloc(1);
524  INetURLObject aFileName;
525  aFileName.SetSmartURL( *pFileName );
526  // tdf#127978 - don't URL encode filename for navigator's tooltip
527  aFileNames.getArray()[0]
529  InsertRegion( pCont, aFileNames );
530  }
531 }
532 
534 {
535  sal_uInt16 nSlot = 0;
536  switch( pCont->GetType() )
537  {
538  case GLBLDOC_UNKNOWN:
540  break;
541  case GLBLDOC_TOXBASE:
542  {
543  const SwTOXBase* pBase = pCont->GetTOX();
544  if(pBase)
545  nSlot = FN_INSERT_MULTI_TOX;
546  }
547  break;
548  case GLBLDOC_SECTION:
549  {
550  OpenDoc(pCont);
551 
552  nSlot = 0;
553  pCont = nullptr;
554  }
555  break;
556  }
557  if(pCont)
558  GotoContent(pCont);
559  if(nSlot)
560  {
562  if(Update( false ))
563  Display();
564  }
565 }
566 
567 void SwGlobalTree::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry)
568 {
569  bool bUpdateHard = false;
570 
571  int nEntry = m_xTreeView->get_selected_index();
572  SwGlblDocContent* pCont = nEntry != -1 ? reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64()) : nullptr;
573  // If a RequestHelp is called during the dialogue,
574  // then the content gets lost. Because of that a copy
575  // is created in which only the DocPos is set correctly.
576  std::unique_ptr<SwGlblDocContent> pContCopy;
577  if(pCont)
578  pContCopy.reset(new SwGlblDocContent(pCont->GetDocPos()));
580  sal_uInt16 nSlot = 0;
581  if (rSelectedPopupEntry == "updatesel")
582  {
583  // Two passes: first update the areas, then the directories.
584  m_xTreeView->selected_foreach([this](weld::TreeIter& rSelEntry){
585  SwGlblDocContent* pContent = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(rSelEntry).toInt64());
586  if (GLBLDOC_SECTION == pContent->GetType() &&
587  pContent->GetSection()->IsConnected())
588  {
589  const_cast<SwSection*>(pContent->GetSection())->UpdateNow();
590  }
591  return false;
592  });
593  m_xTreeView->selected_foreach([this](weld::TreeIter& rSelEntry){
594  SwGlblDocContent* pContent = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(rSelEntry).toInt64());
595  if (GLBLDOC_TOXBASE == pContent->GetType())
596  m_pActiveShell->UpdateTableOf(*pContent->GetTOX());
597  return false;
598  });
599 
600  bUpdateHard = true;
601  }
602  else if (rSelectedPopupEntry == "updateindex")
603  {
604  nSlot = FN_UPDATE_TOX;
605  bUpdateHard = true;
606  }
607  else if (rSelectedPopupEntry == "updatelinks" || rSelectedPopupEntry == "updateall")
608  {
609  m_pActiveShell->GetLinkManager().UpdateAllLinks(true, false, nullptr);
610  if (rSelectedPopupEntry == "updateall")
611  nSlot = FN_UPDATE_TOX;
612  pCont = nullptr;
613  bUpdateHard = true;
614  }
615  else if (rSelectedPopupEntry == "editcontent")
616  {
617  OSL_ENSURE(pCont, "edit without entry ? " );
618  if (pCont)
619  {
620  EditContent(pCont);
621  }
622  }
623  else if (rSelectedPopupEntry == "editlink")
624  {
625  OSL_ENSURE(pCont, "edit without entry ? " );
626  if (pCont)
627  {
629  pCont->GetSection()->GetSectionName());
630  rDispatch.ExecuteList(FN_EDIT_REGION, SfxCallMode::ASYNCHRON,
631  { &aName });
632  }
633  }
634  else if (rSelectedPopupEntry == "deleteentry")
635  {
636  // If several entries selected, then after each delete the array
637  // must be refilled. So you do not have to remember anything,
638  // deleting begins at the end.
639  std::vector<int> aRows = m_xTreeView->get_selected_rows();
640  std::sort(aRows.begin(), aRows.end());
641 
642  std::unique_ptr<SwGlblDocContents> pTempContents;
644  for (auto iter = aRows.rbegin(); iter != aRows.rend(); ++iter)
645  {
647  pTempContents ? *pTempContents : *m_pSwGlblDocContents,
648  *iter);
649  pTempContents.reset(new SwGlblDocContents);
650  m_pActiveShell->GetGlobalDocContent(*pTempContents);
651  }
652  pTempContents.reset();
654  pCont = nullptr;
655  }
656  else if (rSelectedPopupEntry == "insertindex")
657  {
658  if(pContCopy)
659  {
664  RES_COL, RES_COL,
665  SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
666  FN_PARAM_TOX_TYPE, FN_PARAM_TOX_TYPE>
667  aSet( m_pActiveShell->GetView().GetPool() );
668 
670  ScopedVclPtr<AbstractMultiTOXTabDialog> pDlg(pFact->CreateMultiTOXTabDialog(
671  m_xTreeView.get(), aSet,
673  nullptr,
674  true));
675  if(RET_OK == pDlg->Execute())
676  {
677  SwTOXDescription& rDesc = pDlg->GetTOXDescription(
678  pDlg->GetCurrentTOXType());
679  SwTOXMgr aMgr(m_pActiveShell);
680  SwTOXBase* pToInsert = nullptr;
681  if(aMgr.UpdateOrInsertTOX(rDesc, &pToInsert, pDlg->GetOutputItemSet()))
682  m_pActiveShell->InsertGlobalDocContent( *pContCopy, *pToInsert );
683  }
684  pCont = nullptr;
685  }
686  }
687  else if (rSelectedPopupEntry == "insertfile")
688  {
689  m_pDocContent = std::move(pContCopy);
690  InsertRegion( m_pDocContent.get() );
691  pCont = nullptr;
692  }
693  else if (rSelectedPopupEntry == "insertnewfile")
694  {
695  SfxViewFrame* pGlobFrame = m_pActiveShell->GetView().GetViewFrame();
696  SwGlobalFrameListener_Impl aFrameListener(*pGlobFrame);
697 
698  // Creating a new doc
699  SfxStringItem aFactory(SID_NEWDOCDIRECT,
700  SwDocShell::Factory().GetFilterContainer()->GetName());
701 
702  const SfxFrameItem* pItem = static_cast<const SfxFrameItem*>(
703  rDispatch.ExecuteList(SID_NEWDOCDIRECT,
704  SfxCallMode::SYNCHRON, { &aFactory }));
705 
706  // save at
707  SfxFrame* pFrame = pItem ? pItem->GetFrame() : nullptr;
708  SfxViewFrame* pViewFrame = pFrame ? pFrame->GetCurrentViewFrame() : nullptr;
709  if (pViewFrame)
710  {
711  const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(
712  pViewFrame->GetDispatcher()->Execute(
713  SID_SAVEASDOC, SfxCallMode::SYNCHRON ));
714  SfxObjectShell& rObj = *pViewFrame->GetObjectShell();
715  const SfxMedium* pMedium = rObj.GetMedium();
716  OUString sNewFile(pMedium->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri));
717  // Insert the area with the Doc-Name
718  // Bring the own Doc in the foreground
719  if(aFrameListener.IsValid() && !sNewFile.isEmpty())
720  {
721  pGlobFrame->ToTop();
722  // Due to the update the entries are invalid
723  if (nEntry != -1)
724  {
725  Update( false );
726  Display();
727  m_xTreeView->select(nEntry);
728  Select();
729  nEntry = m_xTreeView->get_selected_index();
730  pCont = nEntry != -1 ? reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64()) : nullptr;
731  }
732  else
733  {
734  nEntry = -1;
735  pCont = nullptr;
736  }
737  if(pBool->GetValue())
738  {
739  InsertRegion(pCont, &sNewFile);
740  pViewFrame->ToTop();
741  }
742  else
743  pViewFrame->GetDispatcher()->Execute(SID_CLOSEWIN, SfxCallMode::SYNCHRON);
744  }
745  else
746  {
747  pViewFrame->ToTop();
748  return;
749  }
750  }
751  }
752  else if (rSelectedPopupEntry == "inserttext")
753  {
754  if (pCont)
756  else
757  {
758  m_pActiveShell->SplitNode(); // Empty document
759  m_pActiveShell->Up( false );
760  }
762  }
763  else if (rSelectedPopupEntry == "update")
764  pCont = nullptr;
765 
766  if (pCont)
767  GotoContent(pCont);
768  if (nSlot)
769  rDispatch.Execute(nSlot);
770  if (Update(bUpdateHard))
771  Display();
772 }
773 
775 {
776  if (m_pActiveShell && m_pActiveShell->GetView().GetEditWin().HasFocus())
777  {
778  if (Update(false))
779  Display();
780  UpdateTracking();
781  }
782 }
783 
785 {
786  if (!m_pActiveShell)
787  return;
788 
789  // track section at cursor position in document
790  m_xTreeView->unselect_all();
791 
792  const SwSection* pActiveShellCurrSection = m_pActiveShell->GetCurrSection();
793  if (pActiveShellCurrSection)
794  {
795  const SwSection* pSection = pActiveShellCurrSection;
796  while (SwSection* pParent = pSection->GetParent())
797  pSection = pParent;
798  m_xTreeView->select_text(pSection->GetSectionName());
799  }
800 }
801 
803 {
805 
806  switch( pCont->GetType() )
807  {
808  case GLBLDOC_UNKNOWN:
810  break;
811  case GLBLDOC_TOXBASE:
812  {
813  const OUString sName = pCont->GetTOX()->GetTOXName();
814  if (!m_pActiveShell->GotoNextTOXBase(&sName))
816  }
817  break;
818  case GLBLDOC_SECTION:
819  break;
820  }
821 
822 }
823 
825 {
827  m_xTreeView->show();
828  UpdateTracking();
829 }
830 
832 {
834  m_xTreeView->hide();
835 }
836 
837 void SwGlobalTree::ExecCommand(std::string_view rCmd)
838 {
839  int nEntry = m_xTreeView->get_selected_index();
840  if (nEntry == -1)
841  return;
842  if (rCmd == "edit")
843  {
844  const SwGlblDocContent* pCont = reinterpret_cast<const SwGlblDocContent*>(
845  m_xTreeView->get_id(nEntry).toInt64());
846  EditContent(pCont);
847  }
848  else
849  {
850  if (m_xTreeView->count_selected_rows() == 1)
851  {
852  bool bMove = false;
853  sal_uLong nSource = nEntry;
854  sal_uLong nDest = nSource;
855  if (rCmd == "movedown")
856  {
857  size_t nEntryCount = m_xTreeView->n_children();
858  bMove = nEntryCount > nSource + 1;
859  nDest+= 2;
860  }
861  else if (rCmd == "moveup")
862  {
863  bMove = 0 != nSource;
864  nDest--;
865  }
866  if( bMove && m_pActiveShell->MoveGlobalDocContent(
867  *m_pSwGlblDocContents, nSource, nSource + 1, nDest ) &&
868  Update( false ))
869  Display();
870  }
871  }
872 }
873 
874 bool SwGlobalTree::Update(bool bHard)
875 {
876  SwView* pActView = GetParentWindow()->GetCreateView();
877  bool bRet = false;
878  if (pActView && pActView->GetWrtShellPtr())
879  {
880  SwWrtShell* pOldShell = m_pActiveShell;
881  m_pActiveShell = pActView->GetWrtShellPtr();
882  if(m_pActiveShell != pOldShell)
883  {
884  if (pOldShell)
885  EndListening(*pOldShell->GetView().GetDocShell());
887  m_pSwGlblDocContents.reset();
888  }
890  {
892  bRet = true;
894  }
895  else
896  {
897  bool bCopy = false;
898  SwGlblDocContents aTempContents;
899  m_pActiveShell->GetGlobalDocContent(aTempContents);
900  size_t nChildren = m_xTreeView->n_children();
901  if (aTempContents.size() != m_pSwGlblDocContents->size() ||
902  aTempContents.size() != nChildren)
903  {
904  bRet = true;
905  bCopy = true;
906  }
907  else
908  {
909  for(size_t i = 0; i < aTempContents.size() && !bCopy; i++)
910  {
911  SwGlblDocContent* pLeft = aTempContents[i].get();
912  SwGlblDocContent* pRight = (*m_pSwGlblDocContents)[i].get();
914  OUString sTemp = m_xTreeView->get_text(i);
915  if (
916  eType != pRight->GetType() ||
917  (
918  eType == GLBLDOC_SECTION &&
919  pLeft->GetSection()->GetSectionName() != sTemp
920  ) ||
921  (
922  eType == GLBLDOC_TOXBASE &&
923  pLeft->GetTOX()->GetTitle() != sTemp
924  )
925  )
926  {
927  bCopy = true;
928  }
929  }
930  }
931  if (bCopy || bHard)
932  {
933  *m_pSwGlblDocContents = std::move( aTempContents );
934  bRet = true;
935  }
936  }
937  }
938  else
939  {
940  m_xTreeView->clear();
942  m_pSwGlblDocContents->clear();
943  }
944  // FIXME: Implement a test for changes!
945  return bRet;
946 }
947 
949 {
950  const OUString sFileName(pCont->GetSection()->GetLinkFileName().getToken(0,
952  bool bFound = false;
953  const SfxObjectShell* pCurr = SfxObjectShell::GetFirst();
954  while( !bFound && pCurr )
955  {
956  if(pCurr->GetMedium() &&
958  {
959  bFound = true;
961  Application::PostUserEvent(LINK(this, SwGlobalTree, ShowFrameHdl));
962  pCurr = nullptr;
963  }
964  else
965  pCurr = SfxObjectShell::GetNext(*pCurr);
966  }
967  if(!bFound)
968  {
969  SfxStringItem aURL(SID_FILE_NAME, sFileName);
970  SfxBoolItem aReadOnly(SID_DOC_READONLY, false);
971  SfxStringItem aTargetFrameName( SID_TARGETNAME, "_blank" );
972  SfxStringItem aReferer(SID_REFERER, m_pActiveShell->GetView().GetDocShell()->GetTitle());
974  ExecuteList(SID_OPENDOC, SfxCallMode::ASYNCHRON,
975  { &aURL, &aReadOnly, &aReferer, &aTargetFrameName });
976  }
977 }
978 
979 IMPL_LINK_NOARG( SwGlobalTree, DoubleClickHdl, weld::TreeView&, bool)
980 {
981  int nEntry = m_xTreeView->get_cursor_index();
982  SwGlblDocContent* pCont = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64());
983  if (pCont->GetType() == GLBLDOC_SECTION)
984  OpenDoc(pCont);
985  else
986  {
987  GotoContent(pCont);
988  m_pActiveShell->GetView().GetEditWin().GrabFocus();
989  }
990  return false;
991 }
992 
994 {
995  return m_pDialog;
996 }
997 
998 IMPL_STATIC_LINK_NOARG(SwGlobalTree, ShowFrameHdl, void*, void)
999 {
1000  SfxViewFrame* pFirst = pShowShell ? SfxViewFrame::GetFirst(pShowShell) : nullptr;
1001  if (pFirst)
1002  pFirst->ToTop();
1003  SwGlobalTree::SetShowShell(nullptr);
1004 }
1005 
1006 void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequence< OUString >& _rFiles )
1007 {
1008  sal_Int32 nFiles = _rFiles.getLength();
1009  if (!nFiles)
1010  return;
1011 
1012  size_t nEntryCount = m_xTreeView->n_children();
1013 
1014  bool bMove = _pContent == nullptr;
1015  const OUString* pFileNames = _rFiles.getConstArray();
1017  rSh.StartAction();
1018  // after insertion of the first new content the 'pCont' parameter becomes invalid
1019  // find the index of the 'anchor' content to always use a current anchor content
1020  size_t nAnchorContent = m_pSwGlblDocContents->size() - 1;
1021  if (!bMove)
1022  {
1023  for (size_t nContent = 0; nContent < m_pSwGlblDocContents->size();
1024  ++nContent)
1025  {
1026  if( *_pContent == *(*m_pSwGlblDocContents)[ nContent ] )
1027  {
1028  nAnchorContent = nContent;
1029  break;
1030  }
1031  }
1032  }
1033  SwGlblDocContents aTempContents;
1034  for ( sal_Int32 nFile = 0; nFile < nFiles; ++nFile )
1035  {
1036  //update the global document content after each inserted document
1037  rSh.GetGlobalDocContent(aTempContents);
1038  SwGlblDocContent* pAnchorContent = nullptr;
1039  OSL_ENSURE(aTempContents.size() > (nAnchorContent + nFile), "invalid anchor content -> last insertion failed");
1040  if ( aTempContents.size() > (nAnchorContent + nFile) )
1041  pAnchorContent = aTempContents[nAnchorContent + nFile].get();
1042  else
1043  pAnchorContent = aTempContents.back().get();
1044  OUString sFileName(pFileNames[nFile]);
1045  INetURLObject aFileUrl;
1046  aFileUrl.SetSmartURL( sFileName );
1047  OUString sSectionName(aFileUrl.GetLastName(
1049  sal_uInt16 nSectCount = rSh.GetSectionFormatCount();
1050  OUString sTempSectionName(sSectionName);
1051  sal_uInt16 nAddNumber = 0;
1052  sal_uInt16 nCount = 0;
1053  // if applicable: add index if the range name is already in use.
1054  while ( nCount < nSectCount )
1055  {
1056  const SwSectionFormat& rFormat = rSh.GetSectionFormat(nCount);
1057  if ((rFormat.GetSection()->GetSectionName() == sTempSectionName)
1058  && rFormat.IsInNodesArr())
1059  {
1060  nCount = 0;
1061  nAddNumber++;
1062  sTempSectionName = sSectionName + ":" + OUString::number( nAddNumber );
1063  }
1064  else
1065  nCount++;
1066  }
1067 
1068  if ( nAddNumber )
1069  sSectionName = sTempSectionName;
1070 
1071  SwSectionData aSectionData(SectionType::Content, sSectionName);
1072  aSectionData.SetProtectFlag(true);
1073  aSectionData.SetHidden(false);
1074 
1075  aSectionData.SetLinkFileName(sFileName);
1076  aSectionData.SetType(SectionType::FileLink);
1077  aSectionData.SetLinkFilePassword( OUString() );
1078 
1079  rSh.InsertGlobalDocContent( *pAnchorContent, aSectionData );
1080  }
1081  if (bMove)
1082  {
1083  Update( false );
1085  *m_pSwGlblDocContents, nEntryCount, nEntryCount + nFiles, nEntryCount - nFiles );
1086  }
1087  rSh.EndAction();
1088  Update( false );
1089  Display();
1090 
1091 }
1092 
1093 IMPL_LINK( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void )
1094 {
1095  if ( ERRCODE_NONE != _pFileDlg->GetError() )
1096  return;
1097 
1098  SfxMediumList aMedList(m_pDocInserter->CreateMediumList());
1099  if ( aMedList.empty() )
1100  return;
1101 
1102  Sequence< OUString >aFileNames( aMedList.size() );
1103  OUString* pFileNames = aFileNames.getArray();
1104  sal_Int32 nPos = 0;
1105  for (const std::unique_ptr<SfxMedium>& pMed : aMedList)
1106  {
1107  // tdf#127978 - don't URL encode filename for navigator's tooltip
1108  OUString sFileName
1109  = pMed->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::Unambiguous)
1110  + OUStringChar(sfx2::cTokenSeparator)
1111  + pMed->GetFilter()->GetFilterName()
1112  + OUStringChar(sfx2::cTokenSeparator);
1113  pFileNames[nPos++] = sFileName;
1114  }
1115  InsertRegion( m_pDocContent.get(), aFileNames );
1116  m_pDocContent.reset();
1117 }
1118 
1120 {
1121  SfxListener::Notify(rBC, rHint);
1122  if (rHint.GetId() == SfxHintId::SwNavigatorUpdateTracking)
1123  UpdateTracking();
1124 }
1125 
1126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxViewFrame * GetViewFrame() const
bool GetValue() const
MenuEnableFlags GetEnableFlags() const
Definition: glbltree.cxx:312
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:504
URL aURL
const Value & back() const
void EditContent(const SwGlblDocContent *pCont)
Definition: glbltree.cxx:533
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
void SplitNode(bool bAutoFormat=false)
Definition: wrtsh1.cxx:1124
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:296
SwNavigationPI * GetParentWindow()
Definition: glbltree.cxx:993
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:389
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:3210
const TranslateId GLOBAL_CONTEXT_ARY[]
Definition: glbltree.cxx:108
sfx2::LinkManager & GetLinkManager()
Definition: editsh.cxx:594
SfxFrame * GetFrame() const
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
static OUString CreateDropFileName(const TransferableDataHelper &rData)
Definition: navipi.cxx:914
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:326
#define GLOBAL_CONTEXT_COUNT
Definition: swcont.hxx:51
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:331
SwGlobalTree & m_rTreeView
Definition: conttree.hxx:307
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
Definition: glbltree.cxx:232
std::unique_ptr< weld::Toolbar > m_xGlobalToolBox
Definition: navipi.hxx:65
bool IsConnected() const
Definition: section.hxx:224
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
SwSection * GetParent() const
Definition: section.hxx:346
OUString const & GetLinkFileName() const
Definition: section.cxx:542
virtual SfxObjectShell * GetObjectShell() override
virtual short Execute()=0
virtual void Notify(SfxBroadcaster &rBC, SfxHint const &rHint) override
Definition: glbltree.cxx:1119
bool HasFormat(SotClipboardFormatId nFormat) const
SfxHintId GetId() const
const SwWrtShell * GetActiveWrtShell() const
Definition: conttree.hxx:401
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const =0
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
const SwSection * GetCurrSection() const
Definition: edsect.cxx:71
Used by the UI to modify the document model.
Definition: wrtsh.hxx:93
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
IMPL_STATIC_LINK_NOARG(SwGlobalTree, ShowFrameHdl, void *, void)
Definition: glbltree.cxx:998
#define GLOBAL_UPDATE_TIMEOUT
Definition: glbltree.cxx:57
const SwView & GetView() const
Definition: wrtsh.hxx:431
bool GotoNextTOXBase(const OUString *pName=nullptr)
Definition: move.cxx:684
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
bool GetFileList(SotClipboardFormatId nFormat, FileList &rFileList) const
SwGlobalTreeDropTarget(SwGlobalTree &rTreeView)
Definition: glbltree.cxx:160
virtual OUString get_id(int pos) const =0
SfxViewFrame * GetCurrentViewFrame() const
sal_uInt16 GetModifier() const
virtual OUString GetName() const override
size_type size() const
bool Update(bool bHard)
Definition: glbltree.cxx:874
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:802
MenuEnableFlags
Definition: conttree.hxx:57
SfxItemPool & GetPool() const
void ExecCommand(std::string_view rCmd)
Definition: glbltree.cxx:837
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
DocumentType eType
std::unique_ptr< sfx2::DocumentInserter > m_pDocInserter
Definition: conttree.hxx:329
bool Up(bool bSelect, sal_uInt16 nCount=1, bool bBasicCall=false)
Definition: move.cxx:145
SwNavigationPI * m_pDialog
Definition: conttree.hxx:321
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:354
void Select()
Definition: glbltree.cxx:371
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
virtual void Start(bool bStartTimer=true) override
void ExecuteContextMenuAction(std::string_view rSelectedPopupEntry)
Definition: glbltree.cxx:567
IMPL_LINK_NOARG(SwGlobalTree, SelectHdl, weld::TreeView &, void)
Definition: glbltree.cxx:366
OUString GetFile(size_t nIndex) const
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
Display
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
#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:704
void GetGlobalDocContent(SwGlblDocContents &rArr) const
Definition: edglbldc.cxx:54
void GotoGlobalDocContent(const SwGlblDocContent &rPos)
Definition: edglbldc.cxx:334
SwDocShell * GetDocShell()
Definition: view.cxx:1131
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:667
void StartAction()
Definition: crsrsh.cxx:226
void HideTree()
Definition: glbltree.cxx:831
SwView * GetCreateView() const
Definition: navipi.cxx:1105
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:322
virtual const SfxItemSet * GetOutputItemSet() const =0
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
SwWrtShell * m_pActiveShell
Definition: conttree.hxx:325
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:948
RET_OK
bool IsConnectFlag() const
Definition: section.hxx:238
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
const SwSection * GetSection() const
Definition: edglbldc.hxx:51
const INetURLObject & GetURLObject() const
void Display(bool bOnlyUpdateUserData=false)
Definition: glbltree.cxx:426
std::unique_ptr< weld::TreeView > m_xTreeView
Definition: conttree.hxx:319
void SetInvokeHandler(const Link< Timer *, void > &rLink)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
bool IsDropFormatSupported(SotClipboardFormatId nFormat) const
SwNodeOffset GetDocPos() const
Definition: edglbldc.hxx:55
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: glbltree.cxx:166
IMPL_LINK(SwGlobalTree, CommandHdl, const CommandEvent &, rCEvt, bool)
Definition: glbltree.cxx:259
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
weld::TreeView & get_widget()
Definition: conttree.hxx:378
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:811
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:323
SwGlobalTree(std::unique_ptr< weld::TreeView > xTreeView, SwNavigationPI *pDialog)
Definition: glbltree.cxx:126
std::unique_ptr< SwGlblDocContent > m_pDocContent
Definition: conttree.hxx:328
SwSection * GetSection() const
Definition: section.cxx:669
bool Detect(bool bExtendedInfo=false)
sal_Int8 mnAction
virtual CurTOXType GetCurrentTOXType() const =0
void UpdateTracking()
Definition: glbltree.cxx:784
#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:824
Definition: view.hxx:144
sal_uInt16 nPos
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
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:481
::std::vector< std::unique_ptr< SfxMedium > > SfxMediumList
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
bool IsInNodesArr() const
Definition: section.cxx:911
OUString sId
SfxMedium * GetMedium() const