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     std::unique_ptr<weld::TreeIter> m_xScratchIter;
38 
39     DECL_DLLPRIVATE_LINK(RequestingChildrenHdl, const weld::TreeIter&, bool);
40     SAL_DLLPRIVATE void          InitTreeList();
41 
42 public:
43     SwDBTreeList(std::unique_ptr<weld::TreeView> xTreeView);
44     ~SwDBTreeList();
45 
46     OUString GetDBName(OUString& rTableName, OUString& rColumnName, sal_Bool* pbIsTable = nullptr);
47 
48     void    Select( std::u16string_view rDBName, std::u16string_view rTableName,
49                     std::u16string_view rColumnName );
50 
51     void    ShowColumns(bool bShowCol);
52 
53     void    SetWrtShell(SwWrtShell& rSh);
54 
55     void    AddDataSource(const OUString& rSource);
56 
connect_changed(const Link<weld::TreeView &,void> & rLink)57     void connect_changed(const Link<weld::TreeView&, void>& rLink) { m_xTreeView->connect_changed(rLink); }
connect_row_activated(const Link<weld::TreeView &,bool> & rLink)58     void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xTreeView->connect_row_activated(rLink); }
make_iterator(const weld::TreeIter * pOrig=nullptr) const59     std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig = nullptr) const { return m_xTreeView->make_iterator(pOrig); }
get_selected(weld::TreeIter * pIter) const60     bool get_selected(weld::TreeIter* pIter) const { return m_xTreeView->get_selected(pIter); }
iter_parent(weld::TreeIter & rIter) const61     bool iter_parent(weld::TreeIter& rIter) const { return m_xTreeView->iter_parent(rIter); }
get_iter_depth(const weld::TreeIter & rIter) const62     int get_iter_depth(const weld::TreeIter& rIter) const { return m_xTreeView->get_iter_depth(rIter); }
set_size_request(int nWidth,int nHeight)63     void set_size_request(int nWidth, int nHeight) { m_xTreeView->set_size_request(nWidth, nHeight); }
64 };
65 
66 #endif
67 
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
69