LibreOffice Module sw (master) 1
ui/misc/bookmark.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 <rtl/ustrbuf.hxx>
21#include <sfx2/request.hxx>
22#include <svl/stritem.hxx>
24#include <vcl/weld.hxx>
25#include <o3tl/string_view.hxx>
26#include <com/sun/star/frame/XModel.hpp>
27#include <com/sun/star/text/XBookmarksSupplier.hpp>
28#include <officecfg/Office/Common.hxx>
29
30#include <swabstdlg.hxx>
31#include <swuiexp.hxx>
32#include <view.hxx>
33#include <wrtsh.hxx>
34#include <cmdid.h>
35#include <bookmark.hxx>
36#include <docsh.hxx>
37#include <ndtxt.hxx>
38#include <strings.hrc>
40
41using namespace ::com::sun::star;
42
43const char BookmarkTable::s_cSeparator(';');
44
45// callback to modify EditBox
47{
48 ValidateBookmarks();
49 m_xBookmarksBox->unselect_all();
50 // if a string has been pasted from the clipboard then
51 // there may be illegal characters in the box
52 // sanitization
53 OUString sTmp = m_xEditBox->get_text();
54 OUString sMsg;
55 const sal_Int32 nLen = sTmp.getLength();
56 for (sal_Int32 i = 0; i < BookmarkTable::aForbiddenChars.getLength(); i++)
57 {
58 const sal_Int32 nTmpLen = sTmp.getLength();
59 sTmp = sTmp.replaceAll(OUStringChar(BookmarkTable::aForbiddenChars.getStr()[i]), "");
60 if (sTmp.getLength() != nTmpLen)
61 sMsg += OUStringChar(BookmarkTable::aForbiddenChars.getStr()[i]);
62 }
63 const bool bHasForbiddenChars = sTmp.getLength() != nLen;
64 m_xForbiddenChars->set_visible(bHasForbiddenChars);
65 if (bHasForbiddenChars)
66 m_xEditBox->set_message_type(weld::EntryMessageType::Error);
67 else
68 m_xEditBox->set_message_type(weld::EntryMessageType::Normal);
69
70 sal_Int32 nSelectedEntries = 0;
71 sal_Int32 nEntries = 0;
72 sal_Int32 nTokenIndex = 0;
73 while (!sTmp.isEmpty() && nTokenIndex >= 0)
74 {
75 OUString aToken = sTmp.getToken(0, BookmarkTable::s_cSeparator, nTokenIndex);
76 if (m_xBookmarksBox->GetBookmarkByName(aToken))
77 {
78 m_xBookmarksBox->SelectByName(aToken);
79 nSelectedEntries++;
80 }
81 nEntries++;
82 }
83
84 // allow to add new bookmark only if one name provided and it's not taken
85 m_xInsertBtn->set_sensitive(nEntries == 1 && nSelectedEntries == 0 && !bHasForbiddenChars
86 && !m_bAreProtected);
87
88 // allow to delete only if all bookmarks are recognized
89 m_xDeleteBtn->set_sensitive(nEntries > 0 && nSelectedEntries == nEntries && !m_bAreProtected);
90 m_xGotoBtn->set_sensitive(nEntries == 1 && nSelectedEntries == 1);
91 m_xEditTextBtn->set_sensitive(nEntries == 1 && nSelectedEntries == 1);
92 m_xRenameBtn->set_sensitive(nEntries == 1 && nSelectedEntries == 1 && !m_bAreProtected);
93}
94
95// callback to delete a text mark
97{
98 if (!ValidateBookmarks())
99 return;
100
101 int nSelectedRows(0);
102
103 m_xBookmarksBox->selected_foreach([this, &nSelectedRows](weld::TreeIter& rEntry) {
104 // remove from model
105 sw::mark::IMark* pBookmark
106 = weld::fromId<sw::mark::IMark*>(m_xBookmarksBox->get_id(rEntry));
107 OUString sRemoved = pBookmark->GetName();
108 IDocumentMarkAccess* const pMarkAccess = m_rSh.getIDocumentMarkAccess();
109 pMarkAccess->deleteMark(pMarkAccess->findMark(sRemoved), false);
110 SfxRequest aReq(m_rSh.GetView().GetViewFrame(), FN_DELETE_BOOKMARK);
111 aReq.AppendItem(SfxStringItem(FN_DELETE_BOOKMARK, sRemoved));
112 aReq.Done();
113 m_aTableBookmarks.erase(std::remove(m_aTableBookmarks.begin(), m_aTableBookmarks.end(),
114 std::make_pair(pBookmark, sRemoved)),
115 m_aTableBookmarks.end());
116
117 ++nSelectedRows;
118
119 return false;
120 });
121
122 if (!nSelectedRows)
123 return;
124
125 // remove from BookmarkTable
126 m_xBookmarksBox->remove_selection();
127
128 ValidateBookmarks();
129
130 m_xDeleteBtn->set_sensitive(false);
131 m_xGotoBtn->set_sensitive(false);
132 m_xEditTextBtn->set_sensitive(false);
133 m_xRenameBtn->set_sensitive(false);
134 m_xInsertBtn->set_sensitive(false);
135}
136
137// callback to a goto button
138IMPL_LINK_NOARG(SwInsertBookmarkDlg, GotoHdl, weld::Button&, void) { GotoSelectedBookmark(); }
139
141{
142 GotoSelectedBookmark();
143 return true;
144}
145
147{
148 if (!ValidateBookmarks())
149 return;
150 // this event should fired only if we change selection by clicking on BookmarkTable entry
151 if (!m_xBookmarksBox->has_focus())
152 return;
153
154 SelectionChanged();
155}
156
158{
159 OUStringBuffer sEditBoxText;
160 int nSelectedRows = 0;
161 m_xBookmarksBox->selected_foreach(
162 [this, &sEditBoxText, &nSelectedRows](weld::TreeIter& rEntry) {
163 sw::mark::IMark* pBookmark
164 = weld::fromId<sw::mark::IMark*>(m_xBookmarksBox->get_id(rEntry));
165 const OUString& sEntryName = pBookmark->GetName();
166 if (!sEditBoxText.isEmpty())
167 sEditBoxText.append(";");
168 sEditBoxText.append(sEntryName);
169 ++nSelectedRows;
170 return false;
171 });
172 if (nSelectedRows)
173 {
174 m_xInsertBtn->set_sensitive(false);
175 m_xGotoBtn->set_sensitive(nSelectedRows == 1);
176 m_xEditTextBtn->set_sensitive(nSelectedRows == 1);
177 m_xRenameBtn->set_sensitive(nSelectedRows == 1 && !m_bAreProtected);
178 m_xDeleteBtn->set_sensitive(!m_bAreProtected);
179 m_xEditBox->set_text(sEditBoxText.makeStringAndClear());
180 }
181 else
182 {
183 m_xInsertBtn->set_sensitive(!m_bAreProtected);
184 m_xGotoBtn->set_sensitive(false);
185 m_xEditTextBtn->set_sensitive(false);
186 m_xRenameBtn->set_sensitive(false);
187 m_xDeleteBtn->set_sensitive(false);
188 }
189}
190
192{
193 if (!ValidateBookmarks())
194 return;
195 auto pSelected = m_xBookmarksBox->get_selected();
196 if (!pSelected)
197 return;
198
199 m_xBookmarksBox->start_editing(*pSelected);
200}
201
203{
204 if (!ValidateBookmarks())
205 return;
206 auto xSelected = m_xBookmarksBox->get_selected();
207 if (!xSelected)
208 return;
209
210 sw::mark::IMark* pBookmark
211 = weld::fromId<sw::mark::IMark*>(m_xBookmarksBox->get_id(*xSelected));
212 uno::Reference<frame::XModel> xModel = m_rSh.GetView().GetDocShell()->GetBaseModel();
213 uno::Reference<text::XBookmarksSupplier> xBkms(xModel, uno::UNO_QUERY);
214 uno::Reference<container::XNameAccess> xNameAccess = xBkms->getBookmarks();
215 uno::Any aObj = xNameAccess->getByName(pBookmark->GetName());
216 uno::Reference<uno::XInterface> xTmp;
217 aObj >>= xTmp;
218 uno::Reference<container::XNamed> xNamed(xTmp, uno::UNO_QUERY);
221 rFact.CreateSwRenameXNamedDlg(m_xDialog.get(), xNamed, xNameAccess));
222 pDlg->SetForbiddenChars(BookmarkTable::aForbiddenChars
223 + OUStringChar(BookmarkTable::s_cSeparator));
224
225 if (pDlg->Execute())
226 {
227 ValidateBookmarks();
228 m_xDeleteBtn->set_sensitive(false);
229 m_xGotoBtn->set_sensitive(false);
230 m_xEditTextBtn->set_sensitive(false);
231 m_xRenameBtn->set_sensitive(false);
232 m_xInsertBtn->set_sensitive(false);
233 }
234}
235
236// callback to an insert button. Inserts a new text mark to the current position.
238{
239 OUString sBookmark = m_xEditBox->get_text();
240 m_rSh.SetBookmark2(vcl::KeyCode(), sBookmark, m_xHideCB->get_active(),
241 m_xConditionED->get_text());
242
243 m_xDialog->response(RET_OK);
244}
245
246IMPL_LINK(SwInsertBookmarkDlg, ChangeHideHdl, weld::Toggleable&, rBox, void)
247{
248 bool bHide = rBox.get_active();
249 m_xConditionED->set_sensitive(bHide);
250 m_xConditionFT->set_sensitive(bHide);
251}
252
253IMPL_LINK(SwInsertBookmarkDlg, EditingHdl, weld::TreeIter const&, rIter, bool)
254{
255 sw::mark::IMark const* const pBookmark(
256 weld::fromId<sw::mark::IMark*>(m_xBookmarksBox->get_id(rIter)));
257 assert(pBookmark);
258 return pBookmark->IsExpanded()
259 && pBookmark->GetMarkPos().GetNode() == pBookmark->GetOtherMarkPos().GetNode()
260 && !m_xBookmarksBox->get_text(rIter).endsWith(u"…");
261}
262
263IMPL_LINK(SwInsertBookmarkDlg, EditedHdl, weld::TreeView::iter_string const&, rIterString, bool)
264{
265 sw::mark::IMark const* const pBookmark(
266 weld::fromId<sw::mark::IMark*>(m_xBookmarksBox->get_id(rIterString.first)));
267 assert(pBookmark);
268 bool bRet(false);
269 if (pBookmark->GetMarkPos() != pBookmark->GetOtherMarkPos())
270 {
271 if (pBookmark->GetMarkPos().GetNode() != pBookmark->GetOtherMarkPos().GetNode())
272 {
273 return false; // don't allow editing if it spans multiple nodes
274 }
275 m_rSh.Push();
276 m_rSh.GotoMark(pBookmark);
277 // GetSelText only works for 1 paragraph, but it's checked above
278 if (m_rSh.GetSelText() != rIterString.second)
279 {
280 bRet = m_rSh.Replace(rIterString.second, false);
281 }
283 }
284 else if (pBookmark->IsExpanded() && !rIterString.second.isEmpty())
285 { // SwEditShell::Replace does nothing for empty selection
286 m_rSh.Insert(rIterString.second);
287 bRet = true;
288 }
289 return bRet;
290}
291
293{
294 if (!ValidateBookmarks())
295 return;
296 // if no entries selected we can't jump anywhere
297 // shouldn't be needed as we disable GoTo button when jump is not possible
298 auto xSelected = m_xBookmarksBox->get_selected();
299 if (!xSelected)
300 return;
301
302 sw::mark::IMark* pBookmark
303 = weld::fromId<sw::mark::IMark*>(m_xBookmarksBox->get_id(*xSelected));
304
306 m_rSh.GotoMark(pBookmark);
307}
308
310{
312 {
314 m_xEditBox->set_text("");
315 return false;
316 }
317 return true;
318}
319
321{
322 IDocumentMarkAccess* const pMarkAccess = m_rSh.getIDocumentMarkAccess();
323 if (pMarkAccess->getBookmarksCount() != m_nLastBookmarksCount)
324 return true;
325
326 std::vector<std::pair<sw::mark::IMark*, OUString>>::const_iterator aListIter
327 = m_aTableBookmarks.begin();
328 for (IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
329 ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark)
330 {
332 {
333 // more bookmarks then expected
334 if (aListIter == m_aTableBookmarks.end())
335 return true;
336 if (aListIter->first != *ppBookmark || aListIter->second != (*ppBookmark)->GetName())
337 return true;
338 ++aListIter;
339 }
340 }
341 // less bookmarks then expected
342 return aListIter != m_aTableBookmarks.end();
343}
344
346{
347 m_aTableBookmarks.clear();
348 m_xBookmarksBox->clear();
349
350 IDocumentMarkAccess* const pMarkAccess = m_rSh.getIDocumentMarkAccess();
351 for (IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
352 ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark)
353 {
355 {
356 m_xBookmarksBox->InsertBookmark(m_rSh, *ppBookmark);
357 m_aTableBookmarks.emplace_back(*ppBookmark, (*ppBookmark)->GetName());
358 }
359 }
361}
362
364 OUString const* const pSelected)
365 : SfxDialogController(pParent, "modules/swriter/ui/insertbookmark.ui", "InsertBookmarkDialog")
366 , m_rSh(rS)
367 , m_nLastBookmarksCount(0)
368 , m_bSorted(false)
369 , m_xEditBox(m_xBuilder->weld_entry("name"))
370 , m_xInsertBtn(m_xBuilder->weld_button("insert"))
371 , m_xDeleteBtn(m_xBuilder->weld_button("delete"))
372 , m_xGotoBtn(m_xBuilder->weld_button("goto"))
373 , m_xEditTextBtn(m_xBuilder->weld_button("edittext"))
374 , m_xRenameBtn(m_xBuilder->weld_button("rename"))
375 , m_xHideCB(m_xBuilder->weld_check_button("hide"))
376 , m_xConditionFT(m_xBuilder->weld_label("condlabel"))
377 , m_xConditionED(new ConditionEdit(m_xBuilder->weld_entry("withcond")))
378 , m_xBookmarksBox(new BookmarkTable(m_xBuilder->weld_tree_view("bookmarks")))
379 , m_xForbiddenChars(m_xBuilder->weld_label("lbForbiddenChars"))
380{
381 m_xBookmarksBox->connect_changed(LINK(this, SwInsertBookmarkDlg, SelectionChangedHdl));
382 m_xBookmarksBox->connect_row_activated(LINK(this, SwInsertBookmarkDlg, DoubleClickHdl));
383 m_xBookmarksBox->connect_column_clicked(LINK(this, SwInsertBookmarkDlg, HeaderBarClick));
384 m_xBookmarksBox->connect_editing(LINK(this, SwInsertBookmarkDlg, EditingHdl),
385 LINK(this, SwInsertBookmarkDlg, EditedHdl));
386 m_xEditBox->connect_changed(LINK(this, SwInsertBookmarkDlg, ModifyHdl));
387 m_xInsertBtn->connect_clicked(LINK(this, SwInsertBookmarkDlg, InsertHdl));
388 m_xDeleteBtn->connect_clicked(LINK(this, SwInsertBookmarkDlg, DeleteHdl));
389 m_xGotoBtn->connect_clicked(LINK(this, SwInsertBookmarkDlg, GotoHdl));
390 m_xEditTextBtn->connect_clicked(LINK(this, SwInsertBookmarkDlg, EditTextHdl));
391 m_xRenameBtn->connect_clicked(LINK(this, SwInsertBookmarkDlg, RenameHdl));
392 m_xHideCB->connect_toggled(LINK(this, SwInsertBookmarkDlg, ChangeHideHdl));
393
394 m_xDeleteBtn->set_sensitive(false);
395 m_xGotoBtn->set_sensitive(false);
396 m_xEditTextBtn->set_sensitive(false);
397 m_xRenameBtn->set_sensitive(false);
398
399 // select 3rd column, otherwise it'll pick 1st one
400 m_xBookmarksBox->set_column_editables({ false, false, true, false, false });
401
403
404 m_xEditBox->set_text(m_xBookmarksBox->GetNameProposal());
405 m_xEditBox->set_position(-1);
406
407 m_xForbiddenChars->set_label(SwResId(STR_BOOKMARK_FORBIDDENCHARS) + " "
409 m_xForbiddenChars->set_visible(false);
410
412 {
413 m_xHideCB->set_visible(false);
414 m_xConditionFT->set_visible(false);
415 m_xConditionED->set_visible(false);
416 }
417
419
420 // disabled until "Hide" flag is not checked
421 m_xConditionED->set_sensitive(false);
422 m_xConditionFT->set_sensitive(false);
423
424 // restore dialog size
425 SvtViewOptions aDlgOpt(EViewType::Dialog, "BookmarkDialog");
426 if (aDlgOpt.Exists())
427 m_xDialog->set_window_state(aDlgOpt.GetWindowState());
428
429 if (pSelected)
430 {
431 if (m_xBookmarksBox->SelectByName(*pSelected))
432 {
434 // which is better, focus on a button or focus on the table row?
435 // as long as editing doesn't work via the TreeView with VCL
436 // widgets, better on button.
437 m_xEditTextBtn->grab_focus();
438 }
439 }
440}
441
443{
444 // tdf#146261 - Remember size of bookmark dialog
445 SvtViewOptions aDlgOpt(EViewType::Dialog, "BookmarkDialog");
446 OUString sWindowState = m_xDialog->get_window_state(vcl::WindowDataMask::PosSize);
447 aDlgOpt.SetWindowState(sWindowState);
448}
449
450IMPL_LINK(SwInsertBookmarkDlg, HeaderBarClick, int, nColumn, void)
451{
452 if (!m_bSorted)
453 {
454 m_xBookmarksBox->make_sorted();
455 m_bSorted = true;
456 }
457
458 bool bSortAtoZ = m_xBookmarksBox->get_sort_order();
459
460 //set new arrow positions in headerbar
461 if (nColumn == m_xBookmarksBox->get_sort_column())
462 {
463 bSortAtoZ = !bSortAtoZ;
464 m_xBookmarksBox->set_sort_order(bSortAtoZ);
465 }
466 else
467 {
468 int nOldSortColumn = m_xBookmarksBox->get_sort_column();
469 if (nOldSortColumn != -1)
470 m_xBookmarksBox->set_sort_indicator(TRISTATE_INDET, nOldSortColumn);
471 m_xBookmarksBox->set_sort_column(nColumn);
472 }
473
474 if (nColumn != -1)
475 {
476 //sort lists
477 m_xBookmarksBox->set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn);
478 }
479}
480
481BookmarkTable::BookmarkTable(std::unique_ptr<weld::TreeView> xControl)
482 : m_xControl(std::move(xControl))
483{
484 m_xControl->set_size_request(-1, m_xControl->get_height_rows(8));
485 m_xControl->set_column_fixed_widths({ 40, 110, 150, 160 });
486 m_xControl->set_selection_mode(SelectionMode::Multiple);
487}
488
489std::unique_ptr<weld::TreeIter> BookmarkTable::get_selected() const
490{
491 std::unique_ptr<weld::TreeIter> xIter(m_xControl->make_iterator());
492 if (!m_xControl->get_selected(xIter.get()))
493 xIter.reset();
494 return xIter;
495}
496
498{
499 sw::mark::IBookmark* pBookmark = dynamic_cast<sw::mark::IBookmark*>(pMark);
500 assert(pBookmark);
501
502 OUString sBookmarkNodeText;
503 static const sal_Int32 nMaxTextLen = 50;
504
505 if (pBookmark->IsExpanded())
506 {
507 rSh.Push();
508 rSh.GotoMark(pBookmark);
509 rSh.GetSelectedText(sBookmarkNodeText, ParaBreakType::ToBlank);
511 }
512 if (nMaxTextLen < sBookmarkNodeText.getLength())
513 {
514 sBookmarkNodeText = sBookmarkNodeText.subView(0, nMaxTextLen);
515 ;
516 sBookmarkNodeText += u"…";
517 }
518
519 const OUString& sHideCondition = pBookmark->GetHideCondition();
520 const OUString& sName = pBookmark->GetName();
521 OUString sHidden
522 = (pBookmark->IsHidden() || !sHideCondition.isEmpty() ||
523 // tdf#150955 add "hidden" status to the imported OOXML _Toc and _Ref bookmarks
524 // to allow separating custom bookmarks by sorting based on their Hidden status.
525 // Note: this "hidden" means here only that these bookmarks haven't got
526 // visible bookmark formatting aids (gray I-shape or brackets), otherwise
527 // their anchor are still visible.
528 sName.startsWith("_Toc") || sName.startsWith("_Ref"))
529 ? SwResId(STR_BOOKMARK_YES)
530 : SwResId(STR_BOOKMARK_NO);
531
532 OUString sPageNum = OUString::number(SwPaM(pMark->GetMarkStart()).GetPageNum());
533 int nRow = m_xControl->n_children();
534 m_xControl->append(weld::toId(pMark), sPageNum);
535 m_xControl->set_text(nRow, sName, 1);
536 m_xControl->set_text(nRow, sBookmarkNodeText, 2);
537 m_xControl->set_text(nRow, sHidden, 3);
538 m_xControl->set_text(nRow, sHideCondition, 4);
539}
540
541std::unique_ptr<weld::TreeIter> BookmarkTable::GetRowByBookmarkName(const OUString& sName)
542{
543 std::unique_ptr<weld::TreeIter> xRet;
544 m_xControl->all_foreach([this, &sName, &xRet](weld::TreeIter& rEntry) {
545 sw::mark::IMark* pBookmark = weld::fromId<sw::mark::IMark*>(m_xControl->get_id(rEntry));
546 if (pBookmark->GetName() == sName)
547 {
548 xRet = m_xControl->make_iterator(&rEntry);
549 return true;
550 }
551 return false;
552 });
553 return xRet;
554}
555
557{
558 auto xEntry = GetRowByBookmarkName(sName);
559 if (!xEntry)
560 return nullptr;
561
562 return weld::fromId<sw::mark::IMark*>(m_xControl->get_id(*xEntry));
563}
564
565bool BookmarkTable::SelectByName(const OUString& sName)
566{
567 auto xEntry = GetRowByBookmarkName(sName);
568 if (!xEntry)
569 return false;
570 select(*xEntry);
571 return true;
572}
573
575{
576 OUString sDefaultBookmarkName = SwResId(STR_BOOKMARK_DEF_NAME);
577 sal_Int32 nHighestBookmarkId = 0;
578 for (int i = 0, nCount = m_xControl->n_children(); i < nCount; ++i)
579 {
580 sw::mark::IMark* pBookmark = weld::fromId<sw::mark::IMark*>(m_xControl->get_id(i));
581 const OUString& sName = pBookmark->GetName();
582 sal_Int32 nIndex = 0;
583 if (o3tl::getToken(sName, 0, ' ', nIndex) == sDefaultBookmarkName)
584 {
585 sal_Int32 nCurrBookmarkId = o3tl::toInt32(o3tl::getToken(sName, 0, ' ', nIndex));
586 nHighestBookmarkId = std::max<sal_Int32>(nHighestBookmarkId, nCurrBookmarkId);
587 }
588 }
589 return sDefaultBookmarkName + " " + OUString::number(nHighestBookmarkId + 1);
590}
591
592/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sHidden
Reference< XExecutableDialog > m_xDialog
void InsertBookmark(SwWrtShell &rSh, sw::mark::IMark *pMark)
OUString GetNameProposal() const
static constexpr OUStringLiteral aForbiddenChars
void select(const weld::TreeIter &rIter)
bool SelectByName(const OUString &sName)
static const char s_cSeparator
std::unique_ptr< weld::TreeIter > GetRowByBookmarkName(const OUString &sName)
BookmarkTable(std::unique_ptr< weld::TreeView > xControl)
sw::mark::IMark * GetBookmarkByName(const OUString &sName)
std::unique_ptr< weld::TreeIter > get_selected() const
std::unique_ptr< weld::TreeView > m_xControl
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
virtual std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark, bool isMoveNodes)=0
Deletes a mark.
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:502
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
virtual sal_Int32 getBookmarksCount() const =0
returns the number of IBookmarks.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
void AppendItem(const SfxPoolItem &)
void Done(bool bRemove=false)
void SetWindowState(const OUString &sState)
OUString GetWindowState() const
bool Exists() const
virtual VclPtr< AbstractSwRenameXNamedDlg > CreateSwRenameXNamedDlg(weld::Widget *pParent, css::uno::Reference< css::container::XNamed > &xNamed, css::uno::Reference< css::container::XNameAccess > &xNameAccess)=0
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2550
void GetSelectedText(OUString &rBuf, ParaBreakType nHndlParaBreak=ParaBreakType::ToBlank)
Query text within selection.
Definition: edglss.cxx:249
std::unique_ptr< weld::Button > m_xEditTextBtn
std::unique_ptr< weld::Label > m_xForbiddenChars
std::vector< std::pair< sw::mark::IMark *, OUString > > m_aTableBookmarks
std::unique_ptr< weld::Button > m_xRenameBtn
std::unique_ptr< weld::Button > m_xDeleteBtn
virtual ~SwInsertBookmarkDlg() override
std::unique_ptr< ConditionEdit > m_xConditionED
SwInsertBookmarkDlg(weld::Window *pParent, SwWrtShell &rSh, OUString const *pSelected)
bool ValidateBookmarks()
Check if displayed bookmarks are up-to date, if not update them.
std::unique_ptr< weld::CheckButton > m_xHideCB
std::unique_ptr< weld::Button > m_xGotoBtn
std::unique_ptr< weld::Entry > m_xEditBox
std::unique_ptr< BookmarkTable > m_xBookmarksBox
std::unique_ptr< weld::Button > m_xInsertBtn
std::unique_ptr< weld::Label > m_xConditionFT
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
sal_uInt16 GetPageNum(bool bAtPoint=true, const Point *pLayPos=nullptr)
Get number of page which contains cursor.
Definition: pam.cxx:700
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2817
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2821
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void GotoMark(const ::sw::mark::IMark *const pMark)
Definition: wrtsh3.cxx:272
void EnterStdMode()
Definition: select.cxx:560
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2047
virtual const OUString & GetHideCondition() const =0
virtual bool IsHidden() const =0
virtual const SwPosition & GetOtherMarkPos() const =0
virtual bool IsExpanded() const =0
virtual const SwPosition & GetMarkStart() const =0
virtual const OUString & GetName() const =0
virtual const SwPosition & GetMarkPos() const =0
std::pair< const TreeIter &, OUString > iter_string
int nCount
float u
OUString sName
TRISTATE_FALSE
TRISTATE_INDET
TRISTATE_TRUE
sal_Int32 nIndex
int i
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SwAbstractDialogFactory & GetFactory()
Definition: swuiexp.cxx:26
OUString toId(const void *pValue)
SwNode & GetNode() const
Definition: pam.hxx:81
Reference< XModel > xModel
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
IMPL_LINK_NOARG(SwInsertBookmarkDlg, ModifyHdl, weld::Entry &, void)
IMPL_LINK(SwInsertBookmarkDlg, ChangeHideHdl, weld::Toggleable &, rBox, void)
RET_OK
Reference< XControl > m_xControl