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_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  SwGlblDocContents aTempContents;
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 < aTempContents.size())
208  {
209  nEntryCount++;
210  nAbsContPos++;
211  pCnt = aTempContents[ 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  // tdf#127978 - don't URL encode filename for navigator's tooltip
526  aFileNames.getArray()[0]
528  InsertRegion( pCont, aFileNames );
529  }
530 }
531 
533 {
534  sal_uInt16 nSlot = 0;
535  switch( pCont->GetType() )
536  {
537  case GLBLDOC_UNKNOWN:
539  break;
540  case GLBLDOC_TOXBASE:
541  {
542  const SwTOXBase* pBase = pCont->GetTOX();
543  if(pBase)
544  nSlot = FN_INSERT_MULTI_TOX;
545  }
546  break;
547  case GLBLDOC_SECTION:
548  {
549  OpenDoc(pCont);
550 
551  nSlot = 0;
552  pCont = nullptr;
553  }
554  break;
555  }
556  if(pCont)
557  GotoContent(pCont);
558  if(nSlot)
559  {
561  if(Update( false ))
562  Display();
563  }
564 }
565 
566 void SwGlobalTree::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry)
567 {
568  bool bUpdateHard = false;
569 
570  int nEntry = m_xTreeView->get_selected_index();
571  SwGlblDocContent* pCont = nEntry != -1 ? reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64()) : nullptr;
572  // If a RequestHelp is called during the dialogue,
573  // then the content gets lost. Because of that a copy
574  // is created in which only the DocPos is set correctly.
575  std::unique_ptr<SwGlblDocContent> pContCopy;
576  if(pCont)
577  pContCopy.reset(new SwGlblDocContent(pCont->GetDocPos()));
579  sal_uInt16 nSlot = 0;
580  if (rSelectedPopupEntry == "updatesel")
581  {
582  // Two passes: first update the areas, then the directories.
583  m_xTreeView->selected_foreach([this](weld::TreeIter& rSelEntry){
584  SwGlblDocContent* pContent = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(rSelEntry).toInt64());
585  if (GLBLDOC_SECTION == pContent->GetType() &&
586  pContent->GetSection()->IsConnected())
587  {
588  const_cast<SwSection*>(pContent->GetSection())->UpdateNow();
589  }
590  return false;
591  });
592  m_xTreeView->selected_foreach([this](weld::TreeIter& rSelEntry){
593  SwGlblDocContent* pContent = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(rSelEntry).toInt64());
594  if (GLBLDOC_TOXBASE == pContent->GetType())
595  m_pActiveShell->UpdateTableOf(*pContent->GetTOX());
596  return false;
597  });
598 
599  bUpdateHard = true;
600  }
601  else if (rSelectedPopupEntry == "updateindex")
602  {
603  nSlot = FN_UPDATE_TOX;
604  bUpdateHard = true;
605  }
606  else if (rSelectedPopupEntry == "updatelinks" || rSelectedPopupEntry == "updateall")
607  {
608  m_pActiveShell->GetLinkManager().UpdateAllLinks(true, false, nullptr);
609  if (rSelectedPopupEntry == "updateall")
610  nSlot = FN_UPDATE_TOX;
611  pCont = nullptr;
612  bUpdateHard = true;
613  }
614  else if (rSelectedPopupEntry == "editcontent")
615  {
616  OSL_ENSURE(pCont, "edit without entry ? " );
617  if (pCont)
618  {
619  EditContent(pCont);
620  }
621  }
622  else if (rSelectedPopupEntry == "editlink")
623  {
624  OSL_ENSURE(pCont, "edit without entry ? " );
625  if (pCont)
626  {
628  pCont->GetSection()->GetSectionName());
629  rDispatch.ExecuteList(FN_EDIT_REGION, SfxCallMode::ASYNCHRON,
630  { &aName });
631  }
632  }
633  else if (rSelectedPopupEntry == "deleteentry")
634  {
635  // If several entries selected, then after each delete the array
636  // must be refilled. So you do not have to remember anything,
637  // deleting begins at the end.
638  std::vector<int> aRows = m_xTreeView->get_selected_rows();
639  std::sort(aRows.begin(), aRows.end());
640 
641  std::unique_ptr<SwGlblDocContents> pTempContents;
643  for (auto iter = aRows.rbegin(); iter != aRows.rend(); ++iter)
644  {
646  pTempContents ? *pTempContents : *m_pSwGlblDocContents,
647  *iter);
648  pTempContents.reset(new SwGlblDocContents);
649  m_pActiveShell->GetGlobalDocContent(*pTempContents);
650  }
651  pTempContents.reset();
653  pCont = nullptr;
654  }
655  else if (rSelectedPopupEntry == "insertindex")
656  {
657  if(pContCopy)
658  {
659  SfxItemSet aSet(
661  svl::Items<
665  RES_COL, RES_COL,
666  SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
667  FN_PARAM_TOX_TYPE, FN_PARAM_TOX_TYPE>);
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_xTreeView->has_focus() && Update(false))
777  Display();
778 }
779 
781 {
783 
784  switch( pCont->GetType() )
785  {
786  case GLBLDOC_UNKNOWN:
788  break;
789  case GLBLDOC_TOXBASE:
790  {
791  const OUString sName = pCont->GetTOX()->GetTOXName();
792  if (!m_pActiveShell->GotoNextTOXBase(&sName))
794  }
795  break;
796  case GLBLDOC_SECTION:
797  break;
798  }
799 
800 }
801 
803 {
805  m_xTreeView->show();
806 }
807 
809 {
811  m_xTreeView->hide();
812 }
813 
814 void SwGlobalTree::ExecCommand(std::string_view rCmd)
815 {
816  int nEntry = m_xTreeView->get_selected_index();
817  if (nEntry == -1)
818  return;
819  if (rCmd == "edit")
820  {
821  const SwGlblDocContent* pCont = reinterpret_cast<const SwGlblDocContent*>(
822  m_xTreeView->get_id(nEntry).toInt64());
823  EditContent(pCont);
824  }
825  else
826  {
827  if (m_xTreeView->count_selected_rows() == 1)
828  {
829  bool bMove = false;
830  sal_uLong nSource = nEntry;
831  sal_uLong nDest = nSource;
832  if (rCmd == "movedown")
833  {
834  size_t nEntryCount = m_xTreeView->n_children();
835  bMove = nEntryCount > nSource + 1;
836  nDest+= 2;
837  }
838  else if (rCmd == "moveup")
839  {
840  bMove = 0 != nSource;
841  nDest--;
842  }
843  if( bMove && m_pActiveShell->MoveGlobalDocContent(
844  *m_pSwGlblDocContents, nSource, nSource + 1, nDest ) &&
845  Update( false ))
846  Display();
847  }
848  }
849 }
850 
851 bool SwGlobalTree::Update(bool bHard)
852 {
853  SwView* pActView = GetParentWindow()->GetCreateView();
854  bool bRet = false;
855  if (pActView && pActView->GetWrtShellPtr())
856  {
857  const SwWrtShell* pOldShell = m_pActiveShell;
858  m_pActiveShell = pActView->GetWrtShellPtr();
859  if(m_pActiveShell != pOldShell)
860  {
861  m_pSwGlblDocContents.reset();
862  }
864  {
866  bRet = true;
868  }
869  else
870  {
871  bool bCopy = false;
872  SwGlblDocContents aTempContents;
873  m_pActiveShell->GetGlobalDocContent(aTempContents);
874  size_t nChildren = m_xTreeView->n_children();
875  if (aTempContents.size() != m_pSwGlblDocContents->size() ||
876  aTempContents.size() != nChildren)
877  {
878  bRet = true;
879  bCopy = true;
880  }
881  else
882  {
883  for(size_t i = 0; i < aTempContents.size() && !bCopy; i++)
884  {
885  SwGlblDocContent* pLeft = aTempContents[i].get();
886  SwGlblDocContent* pRight = (*m_pSwGlblDocContents)[i].get();
888  OUString sTemp = m_xTreeView->get_text(i);
889  if (
890  eType != pRight->GetType() ||
891  (
892  eType == GLBLDOC_SECTION &&
893  pLeft->GetSection()->GetSectionName() != sTemp
894  ) ||
895  (
896  eType == GLBLDOC_TOXBASE &&
897  pLeft->GetTOX()->GetTitle() != sTemp
898  )
899  )
900  {
901  bCopy = true;
902  }
903  }
904  }
905  if (bCopy || bHard)
906  {
907  *m_pSwGlblDocContents = std::move( aTempContents );
908  bRet = true;
909  }
910  }
911  }
912  else
913  {
914  m_xTreeView->clear();
916  m_pSwGlblDocContents->clear();
917  }
918  // FIXME: Implement a test for changes!
919  return bRet;
920 }
921 
923 {
924  const OUString sFileName(pCont->GetSection()->GetLinkFileName().getToken(0,
926  bool bFound = false;
927  const SfxObjectShell* pCurr = SfxObjectShell::GetFirst();
928  while( !bFound && pCurr )
929  {
930  if(pCurr->GetMedium() &&
932  {
933  bFound = true;
935  Application::PostUserEvent(LINK(this, SwGlobalTree, ShowFrameHdl));
936  pCurr = nullptr;
937  }
938  else
939  pCurr = SfxObjectShell::GetNext(*pCurr);
940  }
941  if(!bFound)
942  {
943  SfxStringItem aURL(SID_FILE_NAME, sFileName);
944  SfxBoolItem aReadOnly(SID_DOC_READONLY, false);
945  SfxStringItem aTargetFrameName( SID_TARGETNAME, "_blank" );
946  SfxStringItem aReferer(SID_REFERER, m_pActiveShell->GetView().GetDocShell()->GetTitle());
948  ExecuteList(SID_OPENDOC, SfxCallMode::ASYNCHRON,
949  { &aURL, &aReadOnly, &aReferer, &aTargetFrameName });
950  }
951 }
952 
953 IMPL_LINK_NOARG( SwGlobalTree, DoubleClickHdl, weld::TreeView&, bool)
954 {
955  int nEntry = m_xTreeView->get_cursor_index();
956  SwGlblDocContent* pCont = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64());
957  if (pCont->GetType() == GLBLDOC_SECTION)
958  OpenDoc(pCont);
959  else
960  {
961  GotoContent(pCont);
962  m_pActiveShell->GetView().GetEditWin().GrabFocus();
963  }
964  return false;
965 }
966 
968 {
969  return m_pDialog;
970 }
971 
972 IMPL_STATIC_LINK_NOARG(SwGlobalTree, ShowFrameHdl, void*, void)
973 {
974  SfxViewFrame* pFirst = pShowShell ? SfxViewFrame::GetFirst(pShowShell) : nullptr;
975  if (pFirst)
976  pFirst->ToTop();
978 }
979 
980 void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequence< OUString >& _rFiles )
981 {
982  sal_Int32 nFiles = _rFiles.getLength();
983  if (!nFiles)
984  return;
985 
986  size_t nEntryCount = m_xTreeView->n_children();
987 
988  bool bMove = _pContent == nullptr;
989  const OUString* pFileNames = _rFiles.getConstArray();
991  rSh.StartAction();
992  // after insertion of the first new content the 'pCont' parameter becomes invalid
993  // find the index of the 'anchor' content to always use a current anchor content
994  size_t nAnchorContent = m_pSwGlblDocContents->size() - 1;
995  if (!bMove)
996  {
997  for (size_t nContent = 0; nContent < m_pSwGlblDocContents->size();
998  ++nContent)
999  {
1000  if( *_pContent == *(*m_pSwGlblDocContents)[ nContent ] )
1001  {
1002  nAnchorContent = nContent;
1003  break;
1004  }
1005  }
1006  }
1007  SwGlblDocContents aTempContents;
1008  for ( sal_Int32 nFile = 0; nFile < nFiles; ++nFile )
1009  {
1010  //update the global document content after each inserted document
1011  rSh.GetGlobalDocContent(aTempContents);
1012  SwGlblDocContent* pAnchorContent = nullptr;
1013  OSL_ENSURE(aTempContents.size() > (nAnchorContent + nFile), "invalid anchor content -> last insertion failed");
1014  if ( aTempContents.size() > (nAnchorContent + nFile) )
1015  pAnchorContent = aTempContents[nAnchorContent + nFile].get();
1016  else
1017  pAnchorContent = aTempContents.back().get();
1018  OUString sFileName(pFileNames[nFile]);
1019  INetURLObject aFileUrl;
1020  aFileUrl.SetSmartURL( sFileName );
1021  OUString sSectionName(aFileUrl.GetLastName(
1023  sal_uInt16 nSectCount = rSh.GetSectionFormatCount();
1024  OUString sTempSectionName(sSectionName);
1025  sal_uInt16 nAddNumber = 0;
1026  sal_uInt16 nCount = 0;
1027  // if applicable: add index if the range name is already in use.
1028  while ( nCount < nSectCount )
1029  {
1030  const SwSectionFormat& rFormat = rSh.GetSectionFormat(nCount);
1031  if ((rFormat.GetSection()->GetSectionName() == sTempSectionName)
1032  && rFormat.IsInNodesArr())
1033  {
1034  nCount = 0;
1035  nAddNumber++;
1036  sTempSectionName = sSectionName + ":" + OUString::number( nAddNumber );
1037  }
1038  else
1039  nCount++;
1040  }
1041 
1042  if ( nAddNumber )
1043  sSectionName = sTempSectionName;
1044 
1045  SwSectionData aSectionData(SectionType::Content, sSectionName);
1046  aSectionData.SetProtectFlag(true);
1047  aSectionData.SetHidden(false);
1048 
1049  aSectionData.SetLinkFileName(sFileName);
1050  aSectionData.SetType(SectionType::FileLink);
1051  aSectionData.SetLinkFilePassword( OUString() );
1052 
1053  rSh.InsertGlobalDocContent( *pAnchorContent, aSectionData );
1054  }
1055  if (bMove)
1056  {
1057  Update( false );
1059  *m_pSwGlblDocContents, nEntryCount, nEntryCount + nFiles, nEntryCount - nFiles );
1060  }
1061  rSh.EndAction();
1062  Update( false );
1063  Display();
1064 
1065 }
1066 
1067 IMPL_LINK( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void )
1068 {
1069  if ( ERRCODE_NONE != _pFileDlg->GetError() )
1070  return;
1071 
1072  SfxMediumList aMedList(m_pDocInserter->CreateMediumList());
1073  if ( aMedList.empty() )
1074  return;
1075 
1076  Sequence< OUString >aFileNames( aMedList.size() );
1077  OUString* pFileNames = aFileNames.getArray();
1078  sal_Int32 nPos = 0;
1079  for (const std::unique_ptr<SfxMedium>& pMed : aMedList)
1080  {
1081  // tdf#127978 - don't URL encode filename for navigator's tooltip
1082  OUString sFileName
1083  = pMed->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::Unambiguous)
1084  + OUStringChar(sfx2::cTokenSeparator)
1085  + pMed->GetFilter()->GetFilterName()
1086  + OUStringChar(sfx2::cTokenSeparator);
1087  pFileNames[nPos++] = sFileName;
1088  }
1089  InsertRegion( m_pDocContent.get(), aFileNames );
1090  m_pDocContent.reset();
1091 }
1092 
1093 /* 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:504
URL aURL
const Value & back() const
void EditContent(const SwGlblDocContent *pCont)
Definition: glbltree.cxx:532
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
void SplitNode(bool bAutoFormat=false)
Definition: wrtsh1.cxx:1022
virtual void set_sensitive(const OString &rIdent, bool bSensitive)=0
#define FN_EDIT_REGION
Definition: cmdid.h:108
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
void TbxMenuHdl(std::string_view rCommand, weld::Menu &rMenu)
Definition: glbltree.cxx:295
SwNavigationPI * GetParentWindow()
Definition: glbltree.cxx:967
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:3197
static constexpr auto Items
const TranslateId GLOBAL_CONTEXT_ARY[]
Definition: glbltree.cxx:108
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:295
#define GLOBAL_CONTEXT_COUNT
Definition: swcont.hxx:50
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:300
SwGlobalTree & m_rTreeView
Definition: conttree.hxx:276
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 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:542
virtual SfxObjectShell * GetObjectShell() override
virtual short Execute()=0
bool HasFormat(SotClipboardFormatId nFormat) const
SfxHintId GetId() const
const SwWrtShell * GetActiveWrtShell() const
Definition: conttree.hxx:370
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:93
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
IMPL_STATIC_LINK_NOARG(SwGlobalTree, ShowFrameHdl, void *, void)
Definition: glbltree.cxx:972
#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
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:851
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:780
MenuEnableFlags
Definition: conttree.hxx:57
SfxItemPool & GetPool() const
void ExecCommand(std::string_view rCmd)
Definition: glbltree.cxx:814
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
DocumentType eType
std::unique_ptr< sfx2::DocumentInserter > m_pDocInserter
Definition: conttree.hxx:298
bool Up(bool bSelect, sal_uInt16 nCount=1, bool bBasicCall=false)
Definition: move.cxx:145
SwNavigationPI * m_pDialog
Definition: conttree.hxx:290
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:323
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)
virtual void Start(bool bStartTimer=true) override
void ExecuteContextMenuAction(std::string_view rSelectedPopupEntry)
Definition: glbltree.cxx:566
IMPL_LINK_NOARG(SwGlobalTree, SelectHdl, weld::TreeView &, void)
Definition: glbltree.cxx:365
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:720
void GetGlobalDocContent(SwGlblDocContents &rArr) const
Definition: edglbldc.cxx:54
void GotoGlobalDocContent(const SwGlblDocContent &rPos)
Definition: edglbldc.cxx:334
SwDocShell * GetDocShell()
Definition: view.cxx:1122
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:227
void HideTree()
Definition: glbltree.cxx:808
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:291
virtual const SfxItemSet * GetOutputItemSet() const =0
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
SwWrtShell * m_pActiveShell
Definition: conttree.hxx:294
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:922
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:288
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
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
weld::TreeView & get_widget()
Definition: conttree.hxx:347
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:810
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:292
SwGlobalTree(std::unique_ptr< weld::TreeView > xTreeView, SwNavigationPI *pDialog)
Definition: glbltree.cxx:126
std::unique_ptr< SwGlblDocContent > m_pDocContent
Definition: conttree.hxx:297
SwSection * GetSection() const
Definition: section.cxx:669
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:802
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:486
::std::vector< std::unique_ptr< SfxMedium > > SfxMediumList
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:244
bool IsInNodesArr() const
Definition: section.cxx:911
OUString sId
SfxMedium * GetMedium() const