Kaydet (Commit) 08da15ca authored tarafından Jakub Trzebiatowski's avatar Jakub Trzebiatowski Kaydeden (comit) Miklos Vajna

tdf#90855 Improve the 'Insert Bookmark' dialog

implemented:
- display page number
- displaying bookmark text
- goto (button and table doubleclick)
- help
- rename
- selecting multiple bookmarks in TableView or in EditField by ";"
- sorting by any column

Change-Id: I7523dc066380bc360bd484c88a6f4ba45e867320
Reviewed-on: https://gerrit.libreoffice.org/23156Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst d1b8dcd5
This diff is collapsed.
...@@ -21,47 +21,68 @@ ...@@ -21,47 +21,68 @@
#include <svx/stddlg.hxx> #include <svx/stddlg.hxx>
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <ndtxt.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <svtools/simptabl.hxx>
#include <pam.hxx>
#include "swlbox.hxx" #include "swlbox.hxx"
#include "IMark.hxx"
class SwWrtShell; class SwWrtShell;
class SfxRequest; class SfxRequest;
class BookmarkCombo : public SwComboBox class BookmarkTable : public SvSimpleTable
{ {
sal_Int32 GetFirstSelEntryPos() const; SvTreeListEntry* GetRowByBookmarkName(const OUString& sName);
sal_Int32 GetNextSelEntryPos(sal_Int32 nPos) const;
sal_Int32 GetSelEntryPos(sal_Int32 nPos) const;
virtual bool PreNotify(NotifyEvent& rNEvt) override;
public: public:
BookmarkCombo(vcl::Window* pWin, WinBits nStyle); BookmarkTable(SvSimpleTableContainer& rParent);
void InsertBookmark(sw::mark::IMark* pMark);
sal_Int32 GetSelectEntryCount() const; void SelectByName(const OUString& sName);
sal_Int32 GetSelectEntryPos( sal_Int32 nSelIndex = 0 ) const; sw::mark::IMark* GetBookmarkByName(const OUString& sName);
OUString GetNameProposal();
static const OUString aForbiddenChars; static const OUString aForbiddenChars;
static const OUString sDefaultBookmarkName;
static const char cSeparator;
}; };
class SwInsertBookmarkDlg: public SvxStandardDialog class SwInsertBookmarkDlg: public SvxStandardDialog
{ {
VclPtr<BookmarkCombo> m_pBookmarkBox; VclPtr<SvSimpleTableContainer> m_pBookmarksContainer;
VclPtr<OKButton> m_pOkBtn; VclPtr<BookmarkTable> m_pBookmarksBox;
VclPtr<Edit> m_pEditBox;
VclPtr<PushButton> m_pInsertBtn;
VclPtr<PushButton> m_pDeleteBtn; VclPtr<PushButton> m_pDeleteBtn;
VclPtr<PushButton> m_pGotoBtn;
VclPtr<PushButton> m_pRenameBtn;
OUString sRemoveWarning; OUString sRemoveWarning;
SwWrtShell &rSh; SwWrtShell& rSh;
SfxRequest& rReq; SfxRequest& rReq;
std::vector<std::pair<sw::mark::IMark*, OUString>> aTableBookmarks;
DECL_LINK_TYPED(ModifyHdl, Edit&, void); DECL_LINK_TYPED(ModifyHdl, Edit&, void);
DECL_LINK_TYPED(InsertHdl, Button*, void);
DECL_LINK_TYPED(DeleteHdl, Button*, void); DECL_LINK_TYPED(DeleteHdl, Button*, void);
DECL_LINK_TYPED(RenameHdl, Button*, void);
DECL_LINK_TYPED(GotoHdl, Button*, void);
DECL_LINK_TYPED(SelectionChangedHdl, SvTreeListBox*, void);
DECL_LINK_TYPED(DoubleClickHdl, SvTreeListBox*, bool);
// Fill table with bookmarks
void PopulateTable();
/**
* Check if displayed bookmarks are up-to date, if not update them.
* @return True if no update was needed.
*/
bool ValidateBookmarks();
bool HaveBookmarksChanged();
void GotoSelectedBookmark();
virtual void Apply() override; virtual void Apply() override;
public: public:
SwInsertBookmarkDlg(vcl::Window *pParent, SwWrtShell &rSh, SfxRequest& rReq); SwInsertBookmarkDlg(vcl::Window* pParent, SwWrtShell& rSh, SfxRequest& rReq);
virtual ~SwInsertBookmarkDlg(); virtual ~SwInsertBookmarkDlg();
virtual void dispose() override; virtual void dispose() override;
}; };
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 --> <!-- Generated with glade 3.18.3 -->
<interface> <interface>
<requires lib="gtk+" version="3.0"/> <requires lib="gtk+" version="3.0"/>
<object class="GtkDialog" id="InsertBookmarkDialog"> <object class="GtkDialog" id="InsertBookmarkDialog">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes">Insert Bookmark</property> <property name="title" translatable="yes">Bookmark</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child internal-child="action_area"> <child>
<object class="GtkButtonBox" id="dialog-action_area1"> <object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkEntry" id="name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="max_width_chars">0</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">start</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="layout_style">end</property> <property name="spacing">6</property>
<child> <child>
<object class="GtkButton" id="ok"> <object class="GtkButton" id="insert">
<property name="label">gtk-ok</property> <property name="label">Insert</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="can_default">True</property> <property name="can_default">True</property>
<property name="has_default">True</property> <property name="has_default">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="svtlo-SvSimpleTableContainer" id="bookmarks">
<property name="width_request">350</property>
<property name="height_request">250</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkButtonBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child> <child>
<object class="GtkButton" id="cancel"> <object class="GtkButton" id="help">
<property name="label">gtk-cancel</property> <property name="label">gtk-help</property>
<property name="width_request">75</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
...@@ -42,8 +99,35 @@ ...@@ -42,8 +99,35 @@
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">False</property>
<property name="position">1</property> <property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">start</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="rename">
<property name="label" translatable="yes">Rename</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -55,37 +139,53 @@ ...@@ -55,37 +139,53 @@
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">False</property>
<property name="position">2</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="goto">
<property name="label" translatable="yes">Go to</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">False</property>
<property name="pack_type">end</property> <property name="position">2</property>
<property name="position">0</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="swuilo-BookmarkCombo" id="bookmarks"> <object class="GtkButton" id="close">
<property name="width_request">150</property> <property name="label">gtk-close</property>
<property name="height_request">200</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
</object> </object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child> </child>
<action-widgets>
<action-widget response="0">ok</action-widget>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">delete</action-widget>
</action-widgets>
</object> </object>
</interface> </interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment