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_SVX_SOURCE_INC_TABWIN_HXX
20 #define INCLUDED_SVX_SOURCE_INC_TABWIN_HXX
21 
22 #include <sfx2/basedlgs.hxx>
23 #include <sfx2/childwin.hxx>
24 #include <sfx2/ctrlitem.hxx>
25 #include <svx/dbaexchange.hxx>
26 #include <com/sun/star/form/XForm.hpp>
27 
28 #include <comphelper/propmultiplex.hxx>
29 #include <connectivity/dbtools.hxx>
30 
31 class FmFormShell;
32 struct ColumnInfo;
33 
34 class FmFieldWin : public SfxModelessDialogController
35                  , public SfxControllerItem
36                  , public ::comphelper::OPropertyChangeListener
37 {
38     ::osl::Mutex        m_aMutex;
39     std::unique_ptr<weld::TreeView> m_xListBox;
40     std::vector<std::unique_ptr<ColumnInfo>> m_aListBoxData;
41     ::dbtools::SharedConnection
42                        m_aConnection;
43     OUString    m_aDatabaseName,
44                        m_aObjectName;
45     sal_Int32          m_nObjectType;
46 
47     rtl::Reference<comphelper::OPropertyChangeMultiplexer>  m_xChangeListener;
48     rtl::Reference<svx::OColumnTransferable> m_xHelper;
49 
50     void addToList(const css::uno::Reference<css::container::XNameAccess>& i_xColumns);
51 
52     DECL_LINK(RowActivatedHdl, weld::TreeView&, bool);
53     DECL_LINK(DragBeginHdl, bool&, bool);
54 public:
55     FmFieldWin(SfxBindings *pBindings, SfxChildWindow *pMgr, weld::Window* pParent);
56 
57     virtual ~FmFieldWin() override;
58 
59     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
60                               const SfxPoolItem* pState) override;
61 
62     void UpdateContent(FmFormShell const *);
63     void UpdateContent(const css::uno::Reference< css::form::XForm > &);
64     void FillInfo( SfxChildWinInfo& rInfo ) const override;
65 
GetDatabaseName() const66     const OUString& GetDatabaseName() const { return m_aDatabaseName; }
GetConnection() const67     const ::dbtools::SharedConnection& GetConnection() const { return m_aConnection; }
GetObjectName() const68     const OUString& GetObjectName() const { return m_aObjectName; }
GetObjectType() const69     sal_Int32 GetObjectType() const { return m_nObjectType; }
70 
71     bool    createSelectionControls( );
72 
73 protected:
74     // FmXChangeListener
75     virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override;
76 
77 protected:
78     using SfxControllerItem::GetBindings;
79 };
80 
81 
82 class FmFieldWinMgr : public SfxChildWindow
83 {
84 public:
85     FmFieldWinMgr(vcl::Window *pParent, sal_uInt16 nId,
86         SfxBindings *pBindings, SfxChildWinInfo const *pInfo);
87     SFX_DECL_CHILDWINDOW(FmFieldWinMgr);
88 };
89 
90 
91 #endif
92 
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
94