LibreOffice Module sfx2 (master) 1
listview.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
10#pragma once
11
12#include <vcl/weld.hxx>
13
15{
18};
21struct ListViewItem;
22
24{
25public:
26 ListView(std::unique_ptr<weld::TreeView> xTreeView);
27 ~ListView();
28
29 void AppendItem(const OUString& rId, const OUString& rTitle, const OUString& rSubtitle,
30 const OUString& rPath, bool bDefault);
31
32 void AppendRow(const OUString& rImage, const OUString& rTitle, const OUString& rSubtitle,
33 const OUString& rApplication, const OUString& rModify, const OUString& rSize,
34 const OUString& rId);
35
36 void UpdateRow(int nIndex, const OUString& rImage, const OUString& rTitle,
37 const OUString& rSubtitle, const OUString& rApplication, const OUString& rModify,
38 const OUString& rSize, const OUString& rId);
39
40 void ReloadRows();
41
42 bool UpdateRows();
43
44 void sortColumn(const int col);
45
46 void sort();
47
48 void clearListView();
49
50 void ShowListView() { mxTreeView->show(); }
51
52 void HideListView() { mxTreeView->hide(); }
53
54 void unselect_all() { mxTreeView->unselect_all(); }
55
56 void grab_focus() { mxTreeView->grab_focus(); }
57
58 void rename(const OUString& rId, const OUString& rTitle);
59
61
62protected:
63 sal_uInt16 get_nId(int pos) const;
64
65 void select_id(const OUString& sId) { mxTreeView->select_id(sId); }
66
67 int get_selected_index() const { return mxTreeView->get_selected_index(); }
68
69 std::vector<int> get_selected_rows() const { return mxTreeView->get_selected_rows(); }
70
71 bool IsListViewVisible() const { return mxTreeView->is_visible(); }
72
73 OUString get_id(int pos) const { return mxTreeView->get_id(pos); }
74
75 void set_cursor(int pos) { mxTreeView->set_cursor(pos); }
76
77 int get_cursor_index() const { return mxTreeView->get_cursor_index(); }
78
79 sal_uInt16 get_cursor_nId() const { return get_nId(mxTreeView->get_cursor_index()); }
80
81 void select(int pos) { mxTreeView->select(pos); }
82
83 int get_index(sal_uInt16 nId) const { return mxTreeView->find_id(OUString::number(nId)); }
84
85 DECL_LINK(ColumnClickedHdl, const int, void);
86
87 DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
88
89protected:
90 std::unique_ptr<weld::TreeView> mxTreeView;
91 std::vector<std::unique_ptr<ListViewItem>> mListViewItems;
93};
94
96{
97public:
98 OUString maId;
99 OUString maTitle;
100 OUString maSubtitle;
102 OUString maPath;
104
106 sal_uInt32 mnModify;
108 sal_uInt64 mnSize;
109
113};
114
115/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void rename(const OUString &rId, const OUString &rTitle)
Definition: listview.cxx:272
void UpdateRow(int nIndex, const OUString &rImage, const OUString &rTitle, const OUString &rSubtitle, const OUString &rApplication, const OUString &rModify, const OUString &rSize, const OUString &rId)
Definition: listview.cxx:113
std::vector< std::unique_ptr< ListViewItem > > mListViewItems
Definition: listview.hxx:91
void select(int pos)
Definition: listview.hxx:81
sal_uInt16 get_cursor_nId() const
Definition: listview.hxx:79
ListView(std::unique_ptr< weld::TreeView > xTreeView)
Definition: listview.cxx:47
int get_selected_index() const
Definition: listview.hxx:67
void ShowListView()
Definition: listview.hxx:50
void ReloadRows()
Definition: listview.cxx:126
OUString get_id(int pos) const
Definition: listview.hxx:73
int mnSortColumn
Definition: listview.hxx:92
bool IsListViewVisible() const
Definition: listview.hxx:71
int get_index(sal_uInt16 nId) const
Definition: listview.hxx:83
void grab_focus()
Definition: listview.hxx:56
void AppendItem(const OUString &rId, const OUString &rTitle, const OUString &rSubtitle, const OUString &rPath, bool bDefault)
Definition: listview.cxx:69
DECL_LINK(QueryTooltipHdl, const weld::TreeIter &, OUString)
void unselect_all()
Definition: listview.hxx:54
bool UpdateRows()
Definition: listview.cxx:146
std::unique_ptr< weld::TreeView > mxTreeView
Definition: listview.hxx:90
void AppendRow(const OUString &rImage, const OUString &rTitle, const OUString &rSubtitle, const OUString &rApplication, const OUString &rModify, const OUString &rSize, const OUString &rId)
Definition: listview.cxx:98
int get_cursor_index() const
Definition: listview.hxx:77
void clearListView()
Definition: listview.cxx:283
void sort()
Definition: listview.cxx:254
void refreshDefaultColumn()
Definition: listview.cxx:256
std::vector< int > get_selected_rows() const
Definition: listview.hxx:69
sal_uInt16 get_nId(int pos) const
Definition: listview.cxx:300
void HideListView()
Definition: listview.hxx:52
DECL_LINK(ColumnClickedHdl, const int, void)
void select_id(const OUString &sId)
Definition: listview.hxx:65
~ListView()
Definition: listview.cxx:67
void sortColumn(const int col)
Definition: listview.cxx:185
void set_cursor(int pos)
Definition: listview.hxx:75
sal_Int32 nIndex
TemplateViewMode
Definition: listview.hxx:15
@ eThumbnailView
Definition: listview.hxx:17
@ eListView
Definition: listview.hxx:16
RttiCompleteObjectLocator col
sal_Int16 nId
OUString maId
Definition: listview.hxx:98
OUString maDisplayModify
Definition: listview.hxx:110
OUString maApplication
Definition: listview.hxx:101
OUString maPath
Definition: listview.hxx:102
bool mbDefault
Definition: listview.hxx:103
sal_uInt32 mnModify
Last modify time in seconds since 1/1/1970.
Definition: listview.hxx:106
OUString maDisplaySize
Definition: listview.hxx:111
OUString maTitle
Definition: listview.hxx:99
OUString maSubtitle
Definition: listview.hxx:100
OUString maDisplayPath
Definition: listview.hxx:112
sal_uInt64 mnSize
Size in bytes of the file.
Definition: listview.hxx:108
OUString sId
size_t pos