xref: /trunk/main/svx/source/inc/tabwin.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3) !
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_TABWIN_HXX
28 #define _SVX_TABWIN_HXX
29 
30 #include <svtools/svtreebx.hxx>
31 #include <vcl/floatwin.hxx>
32 #include <sfx2/basedlgs.hxx>
33 #include <sfx2/childwin.hxx>
34 #include <sfx2/ctrlitem.hxx>
35 #include <com/sun/star/form/XForm.hpp>
36 
37 #include <comphelper/propmultiplex.hxx>
38 #include <svtools/transfer.hxx>
39 #include "svx/dbtoolsclient.hxx"
40 
41 //==================================================================
42 class FmFieldWin;
43 class SAL_DLLPRIVATE FmFieldWinListBox
44                     :public SvTreeListBox
45 {
46     FmFieldWin* pTabWin;
47 
48 protected:
49 //  virtual void Command( const CommandEvent& rEvt );
50 
51 public:
52     FmFieldWinListBox( FmFieldWin* pParent );
53     virtual ~FmFieldWinListBox();
54 
55     sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
56     sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
57 
58 protected:
59     // DragSourceHelper
60     virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
61 
62     // SvLBox
63     virtual sal_Bool DoubleClickHdl();
64 
65     using SvLBox::ExecuteDrop;
66 };
67 
68 //========================================================================
69 class FmFormShell;
70 class SAL_DLLPRIVATE FmFieldWinData
71 {
72 public:
73     FmFieldWinData();
74     ~FmFieldWinData();
75 };
76 
77 //========================================================================
78 class SAL_DLLPRIVATE FmFieldWin :public SfxFloatingWindow
79                     ,public SfxControllerItem
80                     ,public ::comphelper::OPropertyChangeListener
81                     ,public ::svxform::OStaticDataAccessTools
82 {
83     ::osl::Mutex        m_aMutex;
84     FmFieldWinListBox* pListBox;
85     FmFieldWinData*    pData;
86     ::svxform::SharedConnection
87                        m_aConnection;
88     ::rtl::OUString    m_aDatabaseName,
89                        m_aObjectName;
90     sal_Int32          m_nObjectType;
91 
92     ::comphelper::OPropertyChangeMultiplexer*   m_pChangeListener;
93 
94 public:
95     FmFieldWin(SfxBindings *pBindings,
96                SfxChildWindow *pMgr, Window* pParent);
97 
98     virtual ~FmFieldWin();
99     virtual void Resize();
100     virtual sal_Bool Close();
101     virtual void GetFocus();
102     virtual long PreNotify( NotifyEvent& _rNEvt );
103     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
104                               const SfxPoolItem* pState);
105 
106     FmFieldWinData* GetData()  const {return pData;}
107 
108     void UpdateContent(FmFormShell*);
109     void UpdateContent(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > &);
110     void FillInfo( SfxChildWinInfo& rInfo ) const;
111 
112     const ::rtl::OUString&      GetDatabaseName() const { return m_aDatabaseName; }
113     ::svxform::SharedConnection GetConnection() const { return m_aConnection; }
114     const ::rtl::OUString&      GetObjectName() const { return m_aObjectName; }
115     sal_Int32                   GetObjectType() const { return m_nObjectType; }
116 
117     sal_Bool    createSelectionControls( );
118 
119 protected:
120     // FmXChangeListener
121     virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException );
122 
123 protected:
124     inline          SfxBindings&    GetBindings()       { return SfxControllerItem::GetBindings(); }
125     inline  const   SfxBindings&    GetBindings() const { return SfxControllerItem::GetBindings(); }
126 
127     using SfxFloatingWindow::StateChanged;
128 };
129 
130 //========================================================================
131 class SAL_DLLPRIVATE FmFieldWinMgr : public SfxChildWindow
132 {
133 public:
134     FmFieldWinMgr(Window *pParent, sal_uInt16 nId,
135         SfxBindings *pBindings, SfxChildWinInfo *pInfo);
136     SFX_DECL_CHILDWINDOW(FmFieldWinMgr);
137 };
138 
139 
140 #endif
141 
142