LibreOffice Module dbaccess (master) 1
dbtreelistbox.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#pragma once
20
22#include <vcl/transfer.hxx>
23#include <vcl/timer.hxx>
24#include <vcl/weld.hxx>
25
26#include <memory>
27
28namespace dbaui
29{
31 {
32 public:
33 virtual bool includeEntry(const void* pUserData) const = 0;
34
35 protected:
37 };
38
39 class IControlActionListener;
40 class IContextMenuProvider;
41
42 class TreeListBox;
43
44 class TreeListBoxDropTarget : public DropTargetHelper
45 {
46 private:
48
49 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
50 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
51
52 public:
54 };
55
57 {
58 protected:
59 std::unique_ptr<weld::TreeView> m_xTreeView;
61
62 std::unique_ptr<weld::TreeIter> m_xDragedEntry;
65
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);
71
72 private:
73 Timer m_aTimer; // is needed for table updates
75
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
80
81 DECL_LINK(OnTimeOut, Timer*, void);
82
83 protected:
86
87 virtual bool DoChildKeyInput(const KeyEvent& rKEvt);
88
89 public:
90 TreeListBox(std::unique_ptr<weld::TreeView> xTreeView, bool bSQLType);
91 virtual ~TreeListBox();
92
93 std::unique_ptr<weld::TreeIter> GetEntryPosByName(std::u16string_view rName,
94 const weld::TreeIter* pStart = nullptr,
95 const IEntryFilter* pFilter = nullptr) const;
96
97 std::unique_ptr<weld::TreeIter> GetRootLevelParent(const weld::TreeIter* pEntry) const;
98
100 void setContextMenuProvider(IContextMenuProvider* pContextMenuProvider) { m_pContextMenuProvider = pContextMenuProvider; }
101
103 const weld::TreeView& GetWidget() const { return *m_xTreeView; }
104
106
109
114 };
115
117 , public TreeListBox
118 {
119 private:
120 std::unique_ptr<weld::Label> m_xStatusBar;
121 public:
123 virtual void dispose() override;
125 virtual ~InterimDBTreeListBox() override;
126 void show_container() { m_xContainer->show(); }
127 protected:
128 virtual bool DoChildKeyInput(const KeyEvent& rKEvt) override;
129 };
130
132 {
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();
140
141 weld::TreeView& GetWidget() { return m_xTreeListBox->GetWidget(); }
142 const weld::TreeView& GetWidget() const { return m_xTreeListBox->GetWidget(); }
143
145
146 void hide() { m_xContainer->hide(); }
147 void show() { m_xContainer->show(); }
148 bool get_visible() const { return m_xContainer->get_visible(); }
149 };
150
151 class DBTreeView final : public DBTreeViewBase
152 {
153 public:
154 DBTreeView(weld::Container* pContainer, bool bSQLType);
155 };
156
157 class DBTableTreeView final : public DBTreeViewBase
158 {
159 public:
160 DBTableTreeView(weld::Container* pContainer);
161 };
162}
163
164/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Container > m_xContainer
DBTableTreeView(weld::Container *pContainer)
Definition: tabletree.cxx:699
std::unique_ptr< weld::Container > m_xContainer
const weld::TreeView & GetWidget() const
TreeListBox & getListBox() const
std::unique_ptr< weld::Builder > m_xBuilder
DBTreeViewBase(weld::Container *pContainer)
weld::TreeView & GetWidget()
std::unique_ptr< TreeListBox > m_xTreeListBox
DBTreeView(weld::Container *pContainer, bool bSQLType)
virtual bool includeEntry(const void *pUserData) const =0
virtual bool DoChildKeyInput(const KeyEvent &rKEvt) override
virtual ~InterimDBTreeListBox() override
std::unique_ptr< weld::Label > m_xStatusBar
virtual void dispose() override
InterimDBTreeListBox(vcl::Window *pParent)
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
TreeListBoxDropTarget(TreeListBox &rTreeView)
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
DECL_LINK(OnTimeOut, Timer *, void)
sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt)
DECL_LINK(DragBeginHdl, bool &, bool)
std::unique_ptr< weld::TreeIter > GetEntryPosByName(std::u16string_view rName, const weld::TreeIter *pStart=nullptr, const IEntryFilter *pFilter=nullptr) const
DECL_LINK(SelectHdl, weld::TreeView &, void)
std::unique_ptr< weld::TreeIter > GetRootLevelParent(const weld::TreeIter *pEntry) const
std::unique_ptr< weld::TreeIter > m_xDragedEntry
DECL_LINK(QueryTooltipHdl, const weld::TreeIter &, OUString)
void setControlActionListener(IControlActionListener *pListener)
Link< LinkParamNone *, void > m_aDeleteHandler
const weld::TreeView & GetWidget() const
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
virtual bool DoChildKeyInput(const KeyEvent &rKEvt)
void setDeleteHandler(const Link< LinkParamNone *, void > &_rHdl)
DECL_LINK(KeyInputHdl, const KeyEvent &, bool)
void setPasteHandler(const Link< LinkParamNone *, void > &_rHdl)
TreeListBoxDropTarget m_aDropTargetHelper
IControlActionListener * m_pActionListener
Link< LinkParamNone *, void > m_aPasteHandler
DECL_LINK(CommandHdl, const CommandEvent &, bool)
weld::TreeView & GetWidget()
Link< LinkParamNone *, void > m_aSelChangeHdl
rtl::Reference< TransferDataContainer > m_xHelper
void setCopyHandler(const Link< LinkParamNone *, void > &_rHdl)
TransferDataContainer & GetDataTransfer()
Link< LinkParamNone *, void > m_aCopyHandler
std::unique_ptr< weld::TreeView > m_xTreeView
TreeListBox(std::unique_ptr< weld::TreeView > xTreeView, bool bSQLType)
IContextMenuProvider * m_pContextMenuProvider
void SetSelChangeHdl(const Link< LinkParamNone *, void > &_rHdl)
void setContextMenuProvider(IContextMenuProvider *pContextMenuProvider)
signed char sal_Int8