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 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_DBTREE_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_DBTREE_HXX
21 
22 #include <memory>
23 #include <vcl/weld.hxx>
24 
25 #include <swdllapi.h>
26 
27 class SwDBTreeList_Impl;
28 class SwWrtShell;
29 
30 class SW_DLLPUBLIC SwDBTreeList
31 {
32     bool            bInitialized;
33     bool            bShowColumns;
34 
35     rtl::Reference<SwDBTreeList_Impl> pImpl;
36     std::unique_ptr<weld::TreeView> m_xTreeView;
37 
38     DECL_DLLPRIVATE_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool);
39     SAL_DLLPRIVATE void          InitTreeList();
40 
41 public:
42     SwDBTreeList(std::unique_ptr<weld::TreeView> xTreeView);
43     ~SwDBTreeList();
44 
45     OUString GetDBName(OUString& rTableName, OUString& rColumnName, sal_Bool* pbIsTable = nullptr);
46 
47     void    Select( const OUString& rDBName, const OUString& rTableName,
48                     const OUString& rColumnName );
49 
50     void    ShowColumns(bool bShowCol);
51 
52     void    SetWrtShell(SwWrtShell& rSh);
53 
54     void    AddDataSource(const OUString& rSource);
55 
connect_changed(const Link<weld::TreeView &,void> & rLink)56     void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xTreeView->connect_changed(rLink); }
connect_row_activated(const Link<weld::TreeView &,bool> & rLink)57     void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xTreeView->connect_row_activated(rLink); }
make_iterator(const weld::TreeIter * pOrig=nullptr) const58     std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig = nullptr) const { return m_xTreeView->make_iterator(pOrig); }
get_selected(weld::TreeIter * pIter) const59     bool get_selected(weld::TreeIter* pIter) const { return m_xTreeView->get_selected(pIter); }
iter_parent(weld::TreeIter & rIter) const60     bool iter_parent(weld::TreeIter& rIter) const { return m_xTreeView->iter_parent(rIter); }
get_iter_depth(const weld::TreeIter & rIter) const61     int get_iter_depth(const weld::TreeIter& rIter) const { return m_xTreeView->get_iter_depth(rIter); }
set_size_request(int nWidth,int nHeight)62     void set_size_request(int nWidth, int nHeight) { m_xTreeView->set_size_request(nWidth, nHeight); }
63 };
64 
65 #endif
66 
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
68