LibreOffice Module sw (master)  1
bookmark.hxx
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 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_BOOKMARK_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_BOOKMARK_HXX
21 
22 #include <sfx2/basedlgs.hxx>
23 #include <vcl/weld.hxx>
24 #include <IMark.hxx>
25 #include "condedit.hxx"
26 
27 class SwWrtShell;
28 class SfxRequest;
29 
31 {
32  std::unique_ptr<weld::TreeView> m_xControl;
33  std::unique_ptr<weld::TreeIter> GetRowByBookmarkName(const OUString& sName);
34 public:
35  BookmarkTable(std::unique_ptr<weld::TreeView> xControl);
36  void InsertBookmark(sw::mark::IMark* pMark);
37  void SelectByName(const OUString& sName);
38  sw::mark::IMark* GetBookmarkByName(const OUString& sName);
39  OUString GetNameProposal() const;
40 
41  void unselect_all() { m_xControl->unselect_all(); }
42  bool has_focus() const { return m_xControl->has_focus(); }
43  std::unique_ptr<weld::TreeIter> get_selected() const;
44  void clear() { m_xControl->clear(); }
45  void remove(const weld::TreeIter& rIter) { m_xControl->remove(rIter); }
46  void select(const weld::TreeIter& rIter) { m_xControl->select(rIter); }
47  void remove_selection() { m_xControl->remove_selection(); }
48  OUString get_id(const weld::TreeIter& rIter) const { return m_xControl->get_id(rIter); }
49  void set_sort_indicator(TriState eState, int nColumn = -1) { m_xControl->set_sort_indicator(eState, nColumn); }
50  void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) { m_xControl->selected_foreach(func); }
51 
52  void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xControl->connect_changed(rLink); }
53  void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xControl->connect_row_activated(rLink); }
54  void connect_column_clicked(const Link<int, void>& rLink) { m_xControl->connect_column_clicked(rLink); }
55  void make_sorted() { m_xControl->make_sorted(); }
56  bool get_sort_order() const { return m_xControl->get_sort_order(); }
57  void set_sort_order(bool bAscending) { m_xControl->set_sort_order(bAscending); }
58  int get_sort_column() const { return m_xControl->get_sort_column(); }
59  void set_sort_column(int nColumn) { m_xControl->set_sort_column(nColumn); }
60 
61  static const OUString aForbiddenChars;
62  static const char cSeparator;
63 };
64 
66 {
68  std::vector<std::pair<sw::mark::IMark*, OUString>> aTableBookmarks;
70  bool m_bSorted;
72 
73  std::unique_ptr<weld::Entry> m_xEditBox;
74  std::unique_ptr<weld::Button> m_xInsertBtn;
75  std::unique_ptr<weld::Button> m_xDeleteBtn;
76  std::unique_ptr<weld::Button> m_xGotoBtn;
77  std::unique_ptr<weld::Button> m_xRenameBtn;
78  std::unique_ptr<weld::CheckButton> m_xHideCB;
79  std::unique_ptr<weld::Label> m_xConditionFT;
80  std::unique_ptr<ConditionEdit> m_xConditionED;
81  std::unique_ptr<BookmarkTable> m_xBookmarksBox;
82  std::unique_ptr<weld::Label> m_xForbiddenChars;
83 
84  DECL_LINK(ModifyHdl, weld::Entry&, void);
85  DECL_LINK(InsertHdl, weld::Button&, void);
86  DECL_LINK(DeleteHdl, weld::Button&, void);
87  DECL_LINK(RenameHdl, weld::Button&, void);
88  DECL_LINK(GotoHdl, weld::Button&, void);
89  DECL_LINK(SelectionChangedHdl, weld::TreeView&, void);
90  DECL_LINK(DoubleClickHdl, weld::TreeView&, bool);
91  DECL_LINK(HeaderBarClick, int, void);
92  DECL_LINK(ChangeHideHdl, weld::ToggleButton&, void);
93 
94  // Fill table with bookmarks
95  void PopulateTable();
100  bool ValidateBookmarks();
101  bool HaveBookmarksChanged();
102  void GotoSelectedBookmark();
103 
104 public:
106  virtual ~SwInsertBookmarkDlg() override;
107 };
108 
109 #endif
110 
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~SwInsertBookmarkDlg() override
Definition: bookmark.cxx:376
SwWrtShell & rSh
Definition: bookmark.hxx:67
std::unique_ptr< weld::TreeView > m_xControl
Definition: bookmark.hxx:32
static const OUString aForbiddenChars
Definition: bookmark.hxx:61
void clear()
Definition: bookmark.hxx:44
std::unique_ptr< weld::Button > m_xInsertBtn
Definition: bookmark.hxx:74
std::unique_ptr< weld::Label > m_xConditionFT
Definition: bookmark.hxx:79
bool has_focus() const
Definition: bookmark.hxx:42
void set_sort_order(bool bAscending)
Definition: bookmark.hxx:57
void selected_foreach(const std::function< bool(weld::TreeIter &)> &func)
Definition: bookmark.hxx:50
void set_sort_column(int nColumn)
Definition: bookmark.hxx:59
bool HaveBookmarksChanged()
Definition: bookmark.cxx:251
std::unique_ptr< weld::Label > m_xForbiddenChars
Definition: bookmark.hxx:82
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
std::unique_ptr< weld::Button > m_xRenameBtn
Definition: bookmark.hxx:77
std::unique_ptr< weld::CheckButton > m_xHideCB
Definition: bookmark.hxx:78
void remove_selection()
Definition: bookmark.hxx:47
std::unique_ptr< weld::TreeIter > GetRowByBookmarkName(const OUString &sName)
Definition: bookmark.cxx:449
sal_Int32 m_nLastBookmarksCount
Definition: bookmark.hxx:69
void connect_changed(const Link< weld::TreeView &, void > &rLink)
Definition: bookmark.hxx:52
std::unique_ptr< ConditionEdit > m_xConditionED
Definition: bookmark.hxx:80
SwInsertBookmarkDlg(weld::Window *pParent, SwWrtShell &rSh)
Definition: bookmark.cxx:294
std::unique_ptr< weld::Button > m_xDeleteBtn
Definition: bookmark.hxx:75
std::unique_ptr< BookmarkTable > m_xBookmarksBox
Definition: bookmark.hxx:81
int get_sort_column() const
Definition: bookmark.hxx:58
static const char cSeparator
Definition: bookmark.hxx:62
OUString GetNameProposal() const
Definition: bookmark.cxx:481
void set_sort_indicator(TriState eState, int nColumn=-1)
Definition: bookmark.hxx:49
bool get_sort_order() const
Definition: bookmark.hxx:56
void select(const weld::TreeIter &rIter)
Definition: bookmark.hxx:46
void make_sorted()
Definition: bookmark.hxx:55
void SelectByName(const OUString &sName)
Definition: bookmark.cxx:473
std::vector< std::pair< sw::mark::IMark *, OUString > > aTableBookmarks
Definition: bookmark.hxx:68
void connect_column_clicked(const Link< int, void > &rLink)
Definition: bookmark.hxx:54
void unselect_all()
Definition: bookmark.hxx:41
BookmarkTable(std::unique_ptr< weld::TreeView > xControl)
Definition: bookmark.cxx:380
void connect_row_activated(const Link< weld::TreeView &, bool > &rLink)
Definition: bookmark.hxx:53
bool ValidateBookmarks()
Check if displayed bookmarks are up-to date, if not update them.
Definition: bookmark.cxx:240
std::unique_ptr< weld::TreeIter > get_selected() const
Definition: bookmark.cxx:393
DECL_LINK(ModifyHdl, weld::Entry &, void)
std::unique_ptr< weld::Entry > m_xEditBox
Definition: bookmark.hxx:73
std::unique_ptr< weld::Button > m_xGotoBtn
Definition: bookmark.hxx:76
sw::mark::IMark * GetBookmarkByName(const OUString &sName)
Definition: bookmark.cxx:464
void GotoSelectedBookmark()
Definition: bookmark.cxx:224
void InsertBookmark(sw::mark::IMark *pMark)
Definition: bookmark.cxx:401
TriState
OUString get_id(const weld::TreeIter &rIter) const
Definition: bookmark.hxx:48