android: Update app icon to new startcenter icon
[LibreOffice.git] / dbaccess / source / ui / inc / dbtreelistbox.hxx
blob7682841a23acc594a7468008df1b76746b00d47a
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include <vcl/InterimItemWindow.hxx>
22 #include <vcl/transfer.hxx>
23 #include <vcl/timer.hxx>
24 #include <vcl/weld.hxx>
26 #include <memory>
28 namespace dbaui
30 class IEntryFilter
32 public:
33 virtual bool includeEntry(const void* pUserData) const = 0;
35 protected:
36 ~IEntryFilter() {}
39 class IControlActionListener;
40 class IContextMenuProvider;
42 class TreeListBox;
44 class TreeListBoxDropTarget : public DropTargetHelper
46 private:
47 TreeListBox& m_rTreeView;
49 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
50 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
52 public:
53 TreeListBoxDropTarget(TreeListBox& rTreeView);
56 class TreeListBox
58 protected:
59 std::unique_ptr<weld::TreeView> m_xTreeView;
60 TreeListBoxDropTarget m_aDropTargetHelper;
62 std::unique_ptr<weld::TreeIter> m_xDragedEntry;
63 IControlActionListener* m_pActionListener;
64 IContextMenuProvider* m_pContextMenuProvider;
66 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
67 DECL_LINK(SelectHdl, weld::TreeView&, void);
68 DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
69 DECL_LINK(CommandHdl, const CommandEvent&, bool);
70 DECL_LINK(DragBeginHdl, bool&, bool);
72 private:
73 Timer m_aTimer; // is needed for table updates
74 rtl::Reference<TransferDataContainer> m_xHelper;
76 Link<LinkParamNone*,void> m_aSelChangeHdl; // handler to be called (asynchronously) when the selection changes in any way
77 Link<LinkParamNone*,void> m_aCopyHandler; // called when someone press CTRL+C
78 Link<LinkParamNone*,void> m_aPasteHandler; // called when someone press CTRL+V
79 Link<LinkParamNone*,void> m_aDeleteHandler; // called when someone press DELETE Key
81 DECL_LINK(OnTimeOut, Timer*, void);
83 protected:
84 void implStopSelectionTimer();
85 void implStartSelectionTimer();
87 virtual bool DoChildKeyInput(const KeyEvent& rKEvt);
89 public:
90 TreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bSQLType);
91 virtual ~TreeListBox();
93 std::unique_ptr<weld::TreeIter> GetEntryPosByName(std::u16string_view rName,
94 const weld::TreeIter* pStart = nullptr,
95 const IEntryFilter* pFilter = nullptr) const;
97 std::unique_ptr<weld::TreeIter> GetRootLevelParent(const weld::TreeIter* pEntry) const;
99 void setControlActionListener(IControlActionListener* pListener) { m_pActionListener = pListener; }
100 void setContextMenuProvider(IContextMenuProvider* pContextMenuProvider) { m_pContextMenuProvider = pContextMenuProvider; }
102 weld::TreeView& GetWidget() { return *m_xTreeView; }
103 const weld::TreeView& GetWidget() const { return *m_xTreeView; }
105 TransferDataContainer& GetDataTransfer() { return *m_xHelper; }
107 sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt);
108 sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt);
110 void SetSelChangeHdl( const Link<LinkParamNone*,void>& _rHdl ) { m_aSelChangeHdl = _rHdl; }
111 void setCopyHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aCopyHandler = _rHdl; }
112 void setPasteHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aPasteHandler = _rHdl; }
113 void setDeleteHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aDeleteHandler = _rHdl; }
116 class InterimDBTreeListBox : public InterimItemWindow
117 , public TreeListBox
119 private:
120 std::unique_ptr<weld::Label> m_xStatusBar;
121 public:
122 InterimDBTreeListBox(vcl::Window* pParent);
123 virtual void dispose() override;
124 weld::Label& GetStatusBar() { return *m_xStatusBar; }
125 virtual ~InterimDBTreeListBox() override;
126 void show_container() { m_xContainer->show(); }
127 protected:
128 virtual bool DoChildKeyInput(const KeyEvent& rKEvt) override;
131 class DBTreeViewBase
133 protected:
134 std::unique_ptr<weld::Builder> m_xBuilder;
135 std::unique_ptr<weld::Container> m_xContainer;
136 std::unique_ptr<TreeListBox> m_xTreeListBox;
137 public:
138 DBTreeViewBase(weld::Container* pContainer);
139 virtual ~DBTreeViewBase();
141 weld::TreeView& GetWidget() { return m_xTreeListBox->GetWidget(); }
142 const weld::TreeView& GetWidget() const { return m_xTreeListBox->GetWidget(); }
144 TreeListBox& getListBox() const { return *m_xTreeListBox; }
146 void hide() { m_xContainer->hide(); }
147 void show() { m_xContainer->show(); }
148 bool get_visible() const { return m_xContainer->get_visible(); }
151 class DBTreeView final : public DBTreeViewBase
153 public:
154 DBTreeView(weld::Container* pContainer, bool bSQLType);
157 class DBTableTreeView final : public DBTreeViewBase
159 public:
160 DBTableTreeView(weld::Container* pContainer);
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */