Move setting of LD_LIBRARY_PATH closer to invocation of cppunittester
[LibreOffice.git] / include / sfx2 / listview.hxx
blobdb3cecd813ff93983fd1a49a497878efdbe704af
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #pragma once
12 #include <vcl/weld.hxx>
14 enum TemplateViewMode
16 eListView,
17 eThumbnailView
19 struct ListViewItem;
21 class ListView
23 public:
24 ListView(std::unique_ptr<weld::TreeView> xTreeView);
25 ~ListView();
27 void AppendItem(const OUString& rId, const OUString& rTitle, const OUString& rSubtitle,
28 const OUString& rPath, bool bDefault);
30 void AppendRow(const OUString& rImage, const OUString& rTitle, const OUString& rSubtitle,
31 const OUString& rApplication, const OUString& rModify, const OUString& rSize,
32 const OUString& rId);
34 void UpdateRow(int nIndex, const OUString& rImage, const OUString& rTitle,
35 const OUString& rSubtitle, const OUString& rApplication, const OUString& rModify,
36 const OUString& rSize, const OUString& rId);
38 void ReloadRows();
40 bool UpdateRows();
42 void sortColumn(const int col);
44 void sort();
46 void clearListView();
48 void ShowListView() { mxTreeView->show(); }
50 void HideListView() { mxTreeView->hide(); }
52 void unselect_all() { mxTreeView->unselect_all(); }
54 void grab_focus() { mxTreeView->grab_focus(); }
56 void rename(const OUString& rId, const OUString& rTitle);
58 void refreshDefaultColumn();
60 protected:
61 sal_uInt16 get_nId(int pos) const;
63 void select_id(const OUString& sId) { mxTreeView->select_id(sId); }
65 int get_selected_index() const { return mxTreeView->get_selected_index(); }
67 std::vector<int> get_selected_rows() const { return mxTreeView->get_selected_rows(); }
69 bool IsListViewVisible() const { return mxTreeView->is_visible(); }
71 OUString get_id(int pos) const { return mxTreeView->get_id(pos); }
73 void set_cursor(int pos) { mxTreeView->set_cursor(pos); }
75 int get_cursor_index() const { return mxTreeView->get_cursor_index(); }
77 sal_uInt16 get_cursor_nId() const { return get_nId(mxTreeView->get_cursor_index()); }
79 void select(int pos) { mxTreeView->select(pos); }
81 int get_index(sal_uInt16 nId) const { return mxTreeView->find_id(OUString::number(nId)); }
83 DECL_LINK(ColumnClickedHdl, const int, void);
85 DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
87 protected:
88 std::unique_ptr<weld::TreeView> mxTreeView;
89 std::vector<std::unique_ptr<ListViewItem>> mListViewItems;
90 int mnSortColumn;
93 struct ListViewItem
95 public:
96 OUString maId;
97 OUString maTitle;
98 OUString maSubtitle;
99 OUString maApplication;
100 OUString maPath;
101 bool mbDefault;
103 /** Last modify time in seconds since 1/1/1970. */
104 sal_uInt32 mnModify;
105 /** Size in bytes of the file. */
106 sal_uInt64 mnSize;
108 OUString maDisplayModify;
109 OUString maDisplaySize;
110 OUString maDisplayPath;
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */