Line data Source code
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 <svtools/treelistbox.hxx>
23 : #include <vcl/floatwin.hxx>
24 : #include <sfx2/basedlgs.hxx>
25 : #include <sfx2/childwin.hxx>
26 : #include <sfx2/ctrlitem.hxx>
27 : #include <com/sun/star/form/XForm.hpp>
28 :
29 : #include <comphelper/propmultiplex.hxx>
30 : #include <svtools/transfer.hxx>
31 : #include <connectivity/dbtools.hxx>
32 :
33 :
34 : class FmFieldWin;
35 : class FmFieldWinListBox
36 : :public SvTreeListBox
37 : {
38 : VclPtr<FmFieldWin> pTabWin;
39 :
40 : protected:
41 : // virtual void Command( const CommandEvent& rEvt );
42 :
43 : public:
44 : FmFieldWinListBox( FmFieldWin* pParent );
45 : virtual ~FmFieldWinListBox();
46 : virtual void dispose() SAL_OVERRIDE;
47 :
48 : sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
49 : sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
50 :
51 : protected:
52 : // DragSourceHelper
53 : virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
54 :
55 : // SvTreeListBox
56 : virtual bool DoubleClickHdl() SAL_OVERRIDE;
57 :
58 : using SvTreeListBox::ExecuteDrop;
59 : };
60 :
61 :
62 : class FmFormShell;
63 : class FmFieldWinData
64 : {
65 : public:
66 : FmFieldWinData();
67 : ~FmFieldWinData();
68 : };
69 :
70 :
71 : class FmFieldWin :public SfxFloatingWindow
72 : ,public SfxControllerItem
73 : ,public ::comphelper::OPropertyChangeListener
74 : {
75 : ::osl::Mutex m_aMutex;
76 : VclPtr<FmFieldWinListBox> pListBox;
77 : FmFieldWinData* pData;
78 : ::dbtools::SharedConnection
79 : m_aConnection;
80 : OUString m_aDatabaseName,
81 : m_aObjectName;
82 : sal_Int32 m_nObjectType;
83 :
84 : ::comphelper::OPropertyChangeMultiplexer* m_pChangeListener;
85 :
86 : public:
87 : FmFieldWin(SfxBindings *pBindings,
88 : SfxChildWindow *pMgr, vcl::Window* pParent);
89 :
90 : virtual ~FmFieldWin();
91 : virtual void dispose() SAL_OVERRIDE;
92 : virtual void Resize() SAL_OVERRIDE;
93 : virtual bool Close() SAL_OVERRIDE;
94 : virtual void GetFocus() SAL_OVERRIDE;
95 : virtual bool PreNotify( NotifyEvent& _rNEvt ) SAL_OVERRIDE;
96 : virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
97 : const SfxPoolItem* pState) SAL_OVERRIDE;
98 :
99 : FmFieldWinData* GetData() const {return pData;}
100 :
101 : void UpdateContent(FmFormShell*);
102 : void UpdateContent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > &);
103 : void FillInfo( SfxChildWinInfo& rInfo ) const SAL_OVERRIDE;
104 :
105 0 : const OUString& GetDatabaseName() const { return m_aDatabaseName; }
106 0 : ::dbtools::SharedConnection GetConnection() const { return m_aConnection; }
107 0 : const OUString& GetObjectName() const { return m_aObjectName; }
108 0 : sal_Int32 GetObjectType() const { return m_nObjectType; }
109 :
110 : bool createSelectionControls( );
111 :
112 : protected:
113 : // FmXChangeListener
114 : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException ) SAL_OVERRIDE;
115 :
116 : protected:
117 0 : inline SfxBindings& GetBindings() { return SfxControllerItem::GetBindings(); }
118 : inline const SfxBindings& GetBindings() const { return SfxControllerItem::GetBindings(); }
119 :
120 : using SfxFloatingWindow::StateChanged;
121 : };
122 :
123 :
124 0 : class FmFieldWinMgr : public SfxChildWindow
125 : {
126 : public:
127 : FmFieldWinMgr(vcl::Window *pParent, sal_uInt16 nId,
128 : SfxBindings *pBindings, SfxChildWinInfo *pInfo);
129 : SFX_DECL_CHILDWINDOW(FmFieldWinMgr);
130 : };
131 :
132 :
133 : #endif
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|