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