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