LibreOffice Module sw (master)  1
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>
23 #include <vcl/weld.hxx>
24 #include <com/sun/star/frame/XModel.hpp>
25 #include <com/sun/star/text/XBookmarksSupplier.hpp>
26 #include <officecfg/Office/Common.hxx>
27 
28 #include <swabstdlg.hxx>
29 #include <swuiexp.hxx>
30 #include <view.hxx>
31 #include <wrtsh.hxx>
32 #include <cmdid.h>
33 #include <bookmark.hxx>
34 #include <docsh.hxx>
35 #include <ndtxt.hxx>
36 #include <strings.hrc>
38 
39 using namespace ::com::sun::star;
40 
41 const char BookmarkTable::cSeparator(';');
42 
43 // callback to modify EditBox
45 {
46  ValidateBookmarks();
47  m_xBookmarksBox->unselect_all();
48  // if a string has been pasted from the clipboard then
49  // there may be illegal characters in the box
50  // sanitization
51  OUString sTmp = m_xEditBox->get_text();
52  OUString sMsg;
53  const sal_Int32 nLen = sTmp.getLength();
54  for (sal_Int32 i = 0; i < BookmarkTable::aForbiddenChars.getLength(); i++)
55  {
56  const sal_Int32 nTmpLen = sTmp.getLength();
57  sTmp = sTmp.replaceAll(OUStringChar(BookmarkTable::aForbiddenChars.getStr()[i]), "");
58  if (sTmp.getLength() != nTmpLen)
59  sMsg += OUStringChar(BookmarkTable::aForbiddenChars.getStr()[i]);
60  }
61  const bool bHasForbiddenChars = sTmp.getLength() != nLen;
62  m_xForbiddenChars->set_visible(bHasForbiddenChars);
63  if (bHasForbiddenChars)
64  m_xEditBox->set_message_type(weld::EntryMessageType::Error);
65  else
66  m_xEditBox->set_message_type(weld::EntryMessageType::Normal);
67 
68  sal_Int32 nSelectedEntries = 0;
69  sal_Int32 nEntries = 0;
70  sal_Int32 nTokenIndex = 0;
71  while (!sTmp.isEmpty() && nTokenIndex >= 0)
72  {
73  OUString aToken = sTmp.getToken(0, BookmarkTable::cSeparator, nTokenIndex);
74  if (m_xBookmarksBox->GetBookmarkByName(aToken))
75  {
76  m_xBookmarksBox->SelectByName(aToken);
77  nSelectedEntries++;
78  }
79  nEntries++;
80  }
81 
82  // allow to add new bookmark only if one name provided and it's not taken
83  m_xInsertBtn->set_sensitive(nEntries == 1 && nSelectedEntries == 0 && !bHasForbiddenChars
84  && !m_bAreProtected);
85 
86  // allow to delete only if all bookmarks are recognized
87  m_xDeleteBtn->set_sensitive(nEntries > 0 && nSelectedEntries == nEntries && !m_bAreProtected);
88  m_xGotoBtn->set_sensitive(nEntries == 1 && nSelectedEntries == 1);
89  m_xRenameBtn->set_sensitive(nEntries == 1 && nSelectedEntries == 1 && !m_bAreProtected);
90 }
91 
92 // callback to delete a text mark
94 {
95  if (!ValidateBookmarks())
96  return;
97 
98  int nSelectedRows(0);
99 
100  m_xBookmarksBox->selected_foreach([this, &nSelectedRows](weld::TreeIter& rEntry) {
101  // remove from model
102  sw::mark::IMark* pBookmark
103  = reinterpret_cast<sw::mark::IMark*>(m_xBookmarksBox->get_id(rEntry).toInt64());
104  OUString sRemoved = pBookmark->GetName();
105  IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
106  pMarkAccess->deleteMark(pMarkAccess->findMark(sRemoved));
107  SfxRequest aReq(rSh.GetView().GetViewFrame(), FN_DELETE_BOOKMARK);
108  aReq.AppendItem(SfxStringItem(FN_DELETE_BOOKMARK, sRemoved));
109  aReq.Done();
110  aTableBookmarks.erase(std::remove(aTableBookmarks.begin(), aTableBookmarks.end(),
111  std::make_pair(pBookmark, sRemoved)),
112  aTableBookmarks.end());
113 
114  ++nSelectedRows;
115 
116  return false;
117  });
118 
119  if (!nSelectedRows)
120  return;
121 
122  // remove from BookmarkTable
123  m_xBookmarksBox->remove_selection();
124 
125  ValidateBookmarks();
126 
127  m_xDeleteBtn->set_sensitive(false);
128  m_xGotoBtn->set_sensitive(false);
129  m_xRenameBtn->set_sensitive(false);
130  m_xInsertBtn->set_sensitive(false);
131 }
132 
133 // callback to a goto button
134 IMPL_LINK_NOARG(SwInsertBookmarkDlg, GotoHdl, weld::Button&, void) { GotoSelectedBookmark(); }
135 
137 {
138  GotoSelectedBookmark();
139  return true;
140 }
141 
143 {
144  if (!ValidateBookmarks())
145  return;
146  // this event should fired only if we change selection by clicking on BookmarkTable entry
147  if (!m_xBookmarksBox->has_focus())
148  return;
149 
150  OUStringBuffer sEditBoxText;
151  int nSelectedRows = 0;
152  m_xBookmarksBox->selected_foreach(
153  [this, &sEditBoxText, &nSelectedRows](weld::TreeIter& rEntry) {
154  sw::mark::IMark* pBookmark
155  = reinterpret_cast<sw::mark::IMark*>(m_xBookmarksBox->get_id(rEntry).toInt64());
156  const OUString& sEntryName = pBookmark->GetName();
157  if (!sEditBoxText.isEmpty())
158  sEditBoxText.append(";");
159  sEditBoxText.append(sEntryName);
160  ++nSelectedRows;
161  return false;
162  });
163  if (nSelectedRows)
164  {
165  m_xInsertBtn->set_sensitive(false);
166  m_xGotoBtn->set_sensitive(nSelectedRows == 1);
167  m_xRenameBtn->set_sensitive(nSelectedRows == 1 && !m_bAreProtected);
168  m_xDeleteBtn->set_sensitive(!m_bAreProtected);
169  m_xEditBox->set_text(sEditBoxText.makeStringAndClear());
170  }
171  else
172  {
173  m_xInsertBtn->set_sensitive(!m_bAreProtected);
174  m_xGotoBtn->set_sensitive(false);
175  m_xRenameBtn->set_sensitive(false);
176  m_xDeleteBtn->set_sensitive(false);
177  }
178 }
179 
181 {
182  if (!ValidateBookmarks())
183  return;
184  auto xSelected = m_xBookmarksBox->get_selected();
185  if (!xSelected)
186  return;
187 
188  sw::mark::IMark* pBookmark
189  = reinterpret_cast<sw::mark::IMark*>(m_xBookmarksBox->get_id(*xSelected).toInt64());
190  uno::Reference<frame::XModel> xModel = rSh.GetView().GetDocShell()->GetBaseModel();
191  uno::Reference<text::XBookmarksSupplier> xBkms(xModel, uno::UNO_QUERY);
192  uno::Reference<container::XNameAccess> xNameAccess = xBkms->getBookmarks();
193  uno::Any aObj = xNameAccess->getByName(pBookmark->GetName());
194  uno::Reference<uno::XInterface> xTmp;
195  aObj >>= xTmp;
196  uno::Reference<container::XNamed> xNamed(xTmp, uno::UNO_QUERY);
199  rFact.CreateSwRenameXNamedDlg(m_xDialog.get(), xNamed, xNameAccess));
201  + OUStringChar(BookmarkTable::cSeparator));
202 
203  if (pDlg->Execute())
204  {
205  ValidateBookmarks();
206  m_xDeleteBtn->set_sensitive(false);
207  m_xGotoBtn->set_sensitive(false);
208  m_xRenameBtn->set_sensitive(false);
209  m_xInsertBtn->set_sensitive(false);
210  }
211 }
212 
213 // callback to an insert button. Inserts a new text mark to the current position.
215 {
216  OUString sBookmark = m_xEditBox->get_text();
217  rSh.SetBookmark2(vcl::KeyCode(), sBookmark, m_xHideCB->get_active(),
218  m_xConditionED->get_text());
219 
220  m_xDialog->response(RET_OK);
221 }
222 
223 IMPL_LINK(SwInsertBookmarkDlg, ChangeHideHdl, weld::Toggleable&, rBox, void)
224 {
225  bool bHide = rBox.get_active();
226  m_xConditionED->set_sensitive(bHide);
227  m_xConditionFT->set_sensitive(bHide);
228 }
229 
231 {
232  if (!ValidateBookmarks())
233  return;
234  // if no entries selected we can't jump anywhere
235  // shouldn't be needed as we disable GoTo button when jump is not possible
236  auto xSelected = m_xBookmarksBox->get_selected();
237  if (!xSelected)
238  return;
239 
240  sw::mark::IMark* pBookmark
241  = reinterpret_cast<sw::mark::IMark*>(m_xBookmarksBox->get_id(*xSelected).toInt64());
242 
243  rSh.EnterStdMode();
244  rSh.GotoMark(pBookmark);
245 }
246 
248 {
249  if (HaveBookmarksChanged())
250  {
251  PopulateTable();
252  m_xEditBox->set_text("");
253  return false;
254  }
255  return true;
256 }
257 
259 {
260  IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
261  if (pMarkAccess->getBookmarksCount() != m_nLastBookmarksCount)
262  return true;
263 
264  std::vector<std::pair<sw::mark::IMark*, OUString>>::const_iterator aListIter
265  = aTableBookmarks.begin();
266  for (IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
267  ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark)
268  {
270  {
271  // more bookmarks then expected
272  if (aListIter == aTableBookmarks.end())
273  return true;
274  if (aListIter->first != *ppBookmark || aListIter->second != (*ppBookmark)->GetName())
275  return true;
276  ++aListIter;
277  }
278  }
279  // less bookmarks then expected
280  return aListIter != aTableBookmarks.end();
281 }
282 
284 {
285  aTableBookmarks.clear();
286  m_xBookmarksBox->clear();
287 
288  IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
289  for (IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
290  ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark)
291  {
293  {
294  m_xBookmarksBox->InsertBookmark(*ppBookmark);
295  aTableBookmarks.emplace_back(*ppBookmark, (*ppBookmark)->GetName());
296  }
297  }
298  m_nLastBookmarksCount = pMarkAccess->getBookmarksCount();
299 }
300 
302  : SfxDialogController(pParent, "modules/swriter/ui/insertbookmark.ui", "InsertBookmarkDialog")
303  , rSh(rS)
304  , m_nLastBookmarksCount(0)
305  , m_bSorted(false)
306  , m_xEditBox(m_xBuilder->weld_entry("name"))
307  , m_xInsertBtn(m_xBuilder->weld_button("insert"))
308  , m_xDeleteBtn(m_xBuilder->weld_button("delete"))
309  , m_xGotoBtn(m_xBuilder->weld_button("goto"))
310  , m_xRenameBtn(m_xBuilder->weld_button("rename"))
311  , m_xHideCB(m_xBuilder->weld_check_button("hide"))
312  , m_xConditionFT(m_xBuilder->weld_label("condlabel"))
313  , m_xConditionED(new ConditionEdit(m_xBuilder->weld_entry("withcond")))
314  , m_xBookmarksBox(new BookmarkTable(m_xBuilder->weld_tree_view("bookmarks")))
315  , m_xForbiddenChars(m_xBuilder->weld_label("lbForbiddenChars"))
316 {
317  m_xBookmarksBox->connect_changed(LINK(this, SwInsertBookmarkDlg, SelectionChangedHdl));
318  m_xBookmarksBox->connect_row_activated(LINK(this, SwInsertBookmarkDlg, DoubleClickHdl));
319  m_xBookmarksBox->connect_column_clicked(LINK(this, SwInsertBookmarkDlg, HeaderBarClick));
320  m_xEditBox->connect_changed(LINK(this, SwInsertBookmarkDlg, ModifyHdl));
321  m_xInsertBtn->connect_clicked(LINK(this, SwInsertBookmarkDlg, InsertHdl));
322  m_xDeleteBtn->connect_clicked(LINK(this, SwInsertBookmarkDlg, DeleteHdl));
323  m_xGotoBtn->connect_clicked(LINK(this, SwInsertBookmarkDlg, GotoHdl));
324  m_xRenameBtn->connect_clicked(LINK(this, SwInsertBookmarkDlg, RenameHdl));
325  m_xHideCB->connect_toggled(LINK(this, SwInsertBookmarkDlg, ChangeHideHdl));
326 
327  m_xDeleteBtn->set_sensitive(false);
328  m_xGotoBtn->set_sensitive(false);
329  m_xRenameBtn->set_sensitive(false);
330 
331  PopulateTable();
332 
333  m_xEditBox->set_text(m_xBookmarksBox->GetNameProposal());
334  m_xEditBox->set_position(-1);
335 
336  m_xForbiddenChars->set_label(SwResId(STR_BOOKMARK_FORBIDDENCHARS) + " "
338  m_xForbiddenChars->set_visible(false);
339 
341  {
342  m_xHideCB->set_visible(false);
343  m_xConditionFT->set_visible(false);
344  m_xConditionED->set_visible(false);
345  }
346 
348 
349  // disabled until "Hide" flag is not checked
350  m_xConditionED->set_sensitive(false);
351  m_xConditionFT->set_sensitive(false);
352 }
353 
354 IMPL_LINK(SwInsertBookmarkDlg, HeaderBarClick, int, nColumn, void)
355 {
356  if (!m_bSorted)
357  {
358  m_xBookmarksBox->make_sorted();
359  m_bSorted = true;
360  }
361 
362  bool bSortAtoZ = m_xBookmarksBox->get_sort_order();
363 
364  //set new arrow positions in headerbar
365  if (nColumn == m_xBookmarksBox->get_sort_column())
366  {
367  bSortAtoZ = !bSortAtoZ;
368  m_xBookmarksBox->set_sort_order(bSortAtoZ);
369  }
370  else
371  {
372  int nOldSortColumn = m_xBookmarksBox->get_sort_column();
373  if (nOldSortColumn != -1)
374  m_xBookmarksBox->set_sort_indicator(TRISTATE_INDET, nOldSortColumn);
375  m_xBookmarksBox->set_sort_column(nColumn);
376  }
377 
378  if (nColumn != -1)
379  {
380  //sort lists
381  m_xBookmarksBox->set_sort_indicator(bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn);
382  }
383 }
384 
386 
387 BookmarkTable::BookmarkTable(std::unique_ptr<weld::TreeView> xControl)
388  : m_xControl(std::move(xControl))
389 {
390  m_xControl->set_size_request(450, 250);
391  std::vector<int> aWidths;
392  aWidths.push_back(40);
393  aWidths.push_back(110);
394  aWidths.push_back(150);
395  aWidths.push_back(60);
396  m_xControl->set_column_fixed_widths(aWidths);
397  m_xControl->set_selection_mode(SelectionMode::Multiple);
398 }
399 
400 std::unique_ptr<weld::TreeIter> BookmarkTable::get_selected() const
401 {
402  std::unique_ptr<weld::TreeIter> xIter(m_xControl->make_iterator());
403  if (!m_xControl->get_selected(xIter.get()))
404  xIter.reset();
405  return xIter;
406 }
407 
409 {
410  sw::mark::IBookmark* pBookmark = dynamic_cast<sw::mark::IBookmark*>(pMark);
411  assert(pBookmark);
412 
413  OUString sBookmarkNodeText = pBookmark->GetMarkStart().nNode.GetNode().GetTextNode()->GetText();
414  sal_Int32 nBookmarkNodeTextPos = pBookmark->GetMarkStart().nContent.GetIndex();
415  sal_Int32 nBookmarkTextLen = 0;
416  bool bPulledAll = false;
417  bool bPulling = false;
418  static const sal_Int32 nMaxTextLen = 50;
419 
420  if (pBookmark->IsExpanded())
421  {
422  nBookmarkTextLen = pBookmark->GetMarkEnd().nContent.GetIndex() - nBookmarkNodeTextPos;
423  }
424  else
425  {
426  if (nBookmarkNodeTextPos == sBookmarkNodeText.getLength()) // no text after bookmark
427  {
428  nBookmarkNodeTextPos = std::max<sal_Int32>(0, nBookmarkNodeTextPos - nMaxTextLen);
429  bPulling = true;
430  if (nBookmarkNodeTextPos == 0)
431  bPulledAll = true;
432  }
433  nBookmarkTextLen = sBookmarkNodeText.getLength() - nBookmarkNodeTextPos;
434  }
435  bool bExceedsLength = nBookmarkTextLen > nMaxTextLen;
436  nBookmarkTextLen = std::min<sal_Int32>(nMaxTextLen, nBookmarkTextLen);
437  sBookmarkNodeText = sBookmarkNodeText.copy(nBookmarkNodeTextPos, nBookmarkTextLen).trim();
438  if (bExceedsLength)
439  sBookmarkNodeText += "...";
440  else if (bPulling && !bPulledAll)
441  sBookmarkNodeText = "..." + sBookmarkNodeText;
442 
443  const OUString& sHideCondition = pBookmark->GetHideCondition();
444  OUString sHidden = SwResId(STR_BOOKMARK_NO);
445  if (pBookmark->IsHidden() || !sHideCondition.isEmpty())
446  sHidden = SwResId(STR_BOOKMARK_YES);
447  OUString sPageNum = OUString::number(SwPaM(pMark->GetMarkStart()).GetPageNum());
448  int nRow = m_xControl->n_children();
449  m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(pMark)), sPageNum);
450  m_xControl->set_text(nRow, pBookmark->GetName(), 1);
451  m_xControl->set_text(nRow, sBookmarkNodeText, 2);
452  m_xControl->set_text(nRow, sHidden, 3);
453  m_xControl->set_text(nRow, sHideCondition, 4);
454 }
455 
456 std::unique_ptr<weld::TreeIter> BookmarkTable::GetRowByBookmarkName(const OUString& sName)
457 {
458  std::unique_ptr<weld::TreeIter> xRet;
459  m_xControl->all_foreach([this, &sName, &xRet](weld::TreeIter& rEntry) {
460  sw::mark::IMark* pBookmark
461  = reinterpret_cast<sw::mark::IMark*>(m_xControl->get_id(rEntry).toInt64());
462  if (pBookmark->GetName() == sName)
463  {
464  xRet = m_xControl->make_iterator(&rEntry);
465  return true;
466  }
467  return false;
468  });
469  return xRet;
470 }
471 
473 {
474  auto xEntry = GetRowByBookmarkName(sName);
475  if (!xEntry)
476  return nullptr;
477 
478  return reinterpret_cast<sw::mark::IMark*>(m_xControl->get_id(*xEntry).toInt64());
479 }
480 
481 void BookmarkTable::SelectByName(const OUString& sName)
482 {
483  auto xEntry = GetRowByBookmarkName(sName);
484  if (!xEntry)
485  return;
486  select(*xEntry);
487 }
488 
490 {
491  OUString sDefaultBookmarkName = SwResId(STR_BOOKMARK_DEF_NAME);
492  sal_Int32 nHighestBookmarkId = 0;
493  for (int i = 0, nCount = m_xControl->n_children(); i < nCount; ++i)
494  {
495  sw::mark::IMark* pBookmark
496  = reinterpret_cast<sw::mark::IMark*>(m_xControl->get_id(i).toInt64());
497  const OUString& sName = pBookmark->GetName();
498  sal_Int32 nIndex = 0;
499  if (sName.getToken(0, ' ', nIndex) == sDefaultBookmarkName)
500  {
501  sal_Int32 nCurrBookmarkId = sName.getToken(0, ' ', nIndex).toInt32();
502  nHighestBookmarkId = std::max<sal_Int32>(nHighestBookmarkId, nCurrBookmarkId);
503  }
504  }
505  return sDefaultBookmarkName + " " + OUString::number(nHighestBookmarkId + 1);
506 }
507 
508 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
virtual void SetForbiddenChars(const OUString &rSet)=0
static constexpr OUStringLiteral aForbiddenChars
Definition: bookmark.hxx:59
virtual ~SwInsertBookmarkDlg() override
Definition: bookmark.cxx:385
sal_Int32 nIndex
virtual const OUString & GetName() const =0
SwWrtShell & rSh
Definition: bookmark.hxx:65
std::unique_ptr< weld::TreeView > m_xControl
Definition: bookmark.hxx:31
const OUString & GetText() const
Definition: ndtxt.hxx:215
Reference< XControl > m_xControl
SwNodeIndex nNode
Definition: pam.hxx:37
virtual sal_Int32 getBookmarksCount() const =0
returns the number of IBookmarks.
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
std::unique_ptr< weld::Button > m_xInsertBtn
Definition: bookmark.hxx:72
std::unique_ptr< weld::Label > m_xConditionFT
Definition: bookmark.hxx:77
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:478
Provides access to the marks of a document.
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2668
SwNode & GetNode() const
Definition: ndindex.hxx:119
void EnterStdMode()
Definition: select.cxx:551
virtual short Execute()=0
TRISTATE_TRUE
bool HaveBookmarksChanged()
Definition: bookmark.cxx:258
std::unique_ptr< weld::Label > m_xForbiddenChars
Definition: bookmark.hxx:80
IMPL_LINK(SwInsertBookmarkDlg, ChangeHideHdl, weld::Toggleable &, rBox, void)
Definition: bookmark.cxx:223
Used by the UI to modify the document model.
Definition: wrtsh.hxx:93
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
virtual const OUString & GetHideCondition() const =0
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
SwIndex nContent
Definition: pam.hxx:38
int nCount
std::unique_ptr< weld::Button > m_xRenameBtn
Definition: bookmark.hxx:75
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2672
std::unique_ptr< weld::CheckButton > m_xHideCB
Definition: bookmark.hxx:76
std::unique_ptr< weld::TreeIter > GetRowByBookmarkName(const OUString &sName)
Definition: bookmark.cxx:456
sal_Int32 m_nLastBookmarksCount
Definition: bookmark.hxx:67
TRISTATE_INDET
const char * sName
std::unique_ptr< ConditionEdit > m_xConditionED
Definition: bookmark.hxx:78
virtual std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark)=0
Deletes a mark.
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
SwInsertBookmarkDlg(weld::Window *pParent, SwWrtShell &rSh)
Definition: bookmark.cxx:301
int i
SwAbstractDialogFactory & GetFactory()
Definition: swuiexp.cxx:26
std::unique_ptr< weld::Button > m_xDeleteBtn
Definition: bookmark.hxx:73
std::unique_ptr< BookmarkTable > m_xBookmarksBox
Definition: bookmark.hxx:79
TRISTATE_FALSE
static const char cSeparator
Definition: bookmark.hxx:60
OUString GetNameProposal() const
Definition: bookmark.cxx:489
IMPL_LINK_NOARG(SwInsertBookmarkDlg, ModifyHdl, weld::Entry &, void)
Definition: bookmark.cxx:44
void select(const weld::TreeIter &rIter)
Definition: bookmark.hxx:44
void SelectByName(const OUString &sName)
Definition: bookmark.cxx:481
std::vector< std::pair< sw::mark::IMark *, OUString > > aTableBookmarks
Definition: bookmark.hxx:66
void GotoMark(const ::sw::mark::IMark *const pMark)
Definition: wrtsh3.cxx:134
BookmarkTable(std::unique_ptr< weld::TreeView > xControl)
Definition: bookmark.cxx:387
bool ValidateBookmarks()
Check if displayed bookmarks are up-to date, if not update them.
Definition: bookmark.cxx:247
std::unique_ptr< weld::TreeIter > get_selected() const
Definition: bookmark.cxx:400
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
sal_Int32 GetIndex() const
Definition: index.hxx:91
RET_OK
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::Entry > m_xEditBox
Definition: bookmark.hxx:71
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual const SwPosition & GetMarkEnd() const =0
std::unique_ptr< weld::Button > m_xGotoBtn
Definition: bookmark.hxx:74
constexpr OUStringLiteral sHidden
virtual VclPtr< AbstractSwRenameXNamedDlg > CreateSwRenameXNamedDlg(weld::Widget *pParent, css::uno::Reference< css::container::XNamed > &xNamed, css::uno::Reference< css::container::XNameAccess > &xNameAccess)=0
void AppendItem(const SfxPoolItem &)
Reference< XModel > xModel
sw::mark::IMark * GetBookmarkByName(const OUString &sName)
Definition: bookmark.cxx:472
virtual const SwPosition & GetMarkStart() const =0
void GotoSelectedBookmark()
Definition: bookmark.cxx:230
void InsertBookmark(sw::mark::IMark *pMark)
Definition: bookmark.cxx:408
virtual bool IsExpanded() const =0
virtual bool IsHidden() const =0
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:850