1*9ee13d13SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9ee13d13SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9ee13d13SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9ee13d13SAndrew Rist  * distributed with this work for additional information
6*9ee13d13SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9ee13d13SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9ee13d13SAndrew Rist  * "License"); you may not use this file except in compliance
9*9ee13d13SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9ee13d13SAndrew Rist  *
11*9ee13d13SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9ee13d13SAndrew Rist  *
13*9ee13d13SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9ee13d13SAndrew Rist  * software distributed under the License is distributed on an
15*9ee13d13SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9ee13d13SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9ee13d13SAndrew Rist  * specific language governing permissions and limitations
18*9ee13d13SAndrew Rist  * under the License.
19*9ee13d13SAndrew Rist  *
20*9ee13d13SAndrew Rist  *************************************************************/
21*9ee13d13SAndrew Rist 
22*9ee13d13SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef RPTUI_ADDFIELDWINDOW_HXX
25cdf0e10cSrcweir #define RPTUI_ADDFIELDWINDOW_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp>
28cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
29cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp>
30cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp>
31cdf0e10cSrcweir #include <svtools/transfer.hxx>
32cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
33cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp>
34cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
35cdf0e10cSrcweir #include <svtools/transfer.hxx>
36cdf0e10cSrcweir #include <vcl/floatwin.hxx>
37cdf0e10cSrcweir #include <comphelper/propmultiplex.hxx>
38cdf0e10cSrcweir #include <comphelper/containermultiplexer.hxx>
39cdf0e10cSrcweir #include <vcl/button.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <svx/dataaccessdescriptor.hxx>
42cdf0e10cSrcweir #include "cppuhelper/basemutex.hxx"
43cdf0e10cSrcweir #include <dbaccess/ToolBoxHelper.hxx>
44cdf0e10cSrcweir #include <vcl/toolbox.hxx>
45cdf0e10cSrcweir #include <vcl/fixed.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include <rtl/ref.hxx>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir namespace rptui
50cdf0e10cSrcweir {
51cdf0e10cSrcweir //==================================================================
52cdf0e10cSrcweir class OAddFieldWindow;
53cdf0e10cSrcweir class OAddFieldWindowListBox;
54cdf0e10cSrcweir //========================================================================
55cdf0e10cSrcweir class  OAddFieldWindow	:public FloatingWindow
56cdf0e10cSrcweir                     ,	public ::cppu::BaseMutex
57cdf0e10cSrcweir 					,   public ::comphelper::OPropertyChangeListener
58cdf0e10cSrcweir                     ,   public ::comphelper::OContainerListener
59cdf0e10cSrcweir                     ,   public dbaui::OToolBoxHelper
60cdf0e10cSrcweir {
61cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>       m_xHoldAlive;
62cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns;
63cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   m_xRowSet;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     ToolBox                                                                     m_aActions;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     ::std::auto_ptr<OAddFieldWindowListBox> 	                                m_pListBox;
68cdf0e10cSrcweir     FixedLine                                                                   m_aFixedLine;
69cdf0e10cSrcweir     FixedText                                                                   m_aHelpText;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     PushButton                                                                  m_aInsertButton;
72cdf0e10cSrcweir     Link                                                                        m_aCreateLink;
73cdf0e10cSrcweir 	::rtl::OUString								                                m_aCommandName;
74cdf0e10cSrcweir     ::rtl::OUString                                                             m_sFilter;
75cdf0e10cSrcweir 	sal_Int32									                                m_nCommandType;
76cdf0e10cSrcweir     sal_Bool                                                                    m_bEscapeProcessing;
77cdf0e10cSrcweir     ::rtl::Reference< comphelper::OPropertyChangeMultiplexer>	                m_pChangeListener;
78cdf0e10cSrcweir     ::rtl::Reference< comphelper::OContainerListenerAdapter>                    m_pContainerListener;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     DECL_LINK( OnDoubleClickHdl, void* );
81cdf0e10cSrcweir     DECL_LINK( OnSelectHdl,      void* );
82cdf0e10cSrcweir     DECL_LINK( OnSortAction,     ToolBox* );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     OAddFieldWindow(const OAddFieldWindow&);
85cdf0e10cSrcweir     void operator =(const OAddFieldWindow&);
86cdf0e10cSrcweir public:
87cdf0e10cSrcweir 	OAddFieldWindow(Window* pParent
88cdf0e10cSrcweir                     , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xRowSet);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	virtual ~OAddFieldWindow();
91cdf0e10cSrcweir 	virtual void Resize();
92cdf0e10cSrcweir 	virtual void GetFocus();
93cdf0e10cSrcweir 	virtual long PreNotify( NotifyEvent& _rNEvt );
94cdf0e10cSrcweir 
GetCommand() const95cdf0e10cSrcweir 	inline const ::rtl::OUString&	    GetCommand()            const { return m_aCommandName; }
GetCommandType() const96cdf0e10cSrcweir 	inline sal_Int32				    GetCommandType()        const { return m_nCommandType; }
GetEscapeProcessing() const97cdf0e10cSrcweir     inline sal_Bool                     GetEscapeProcessing()   const { return m_bEscapeProcessing; }
SetCreateHdl(const Link & _aCreateLink)98cdf0e10cSrcweir     inline void SetCreateHdl(const Link& _aCreateLink) { m_aCreateLink = _aCreateLink; }
99cdf0e10cSrcweir 
getColumns() const100cdf0e10cSrcweir     inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>  getColumns() const { return m_xColumns; }
101cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>              getConnection() const;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     /** will be called when the id of the image list is needed.
106cdf0e10cSrcweir         @param  _eBitmapSet
107cdf0e10cSrcweir             <svtools/imgdef.hxx>
108cdf0e10cSrcweir         @param  _bHiContast
109cdf0e10cSrcweir             <TRUE/> when in high contrast mode.
110cdf0e10cSrcweir     */
111cdf0e10cSrcweir     virtual ImageList getImageList(sal_Int16 _eBitmapSet,sal_Bool _bHiContast) const;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     /** will be called when the controls need to be resized.
114cdf0e10cSrcweir     */
115cdf0e10cSrcweir     virtual void resizeControls(const Size& _rDiff);
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     /// Updates the current field list
118cdf0e10cSrcweir     void Update();
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     /** fills the descriptor with the column name, column object, command and command type
121cdf0e10cSrcweir     *
122cdf0e10cSrcweir     * \param _pSelected the currently selected
123cdf0e10cSrcweir     * \param _rDescriptor the descriptor will be filled
124cdf0e10cSrcweir     */
125cdf0e10cSrcweir     void fillDescriptor(SvLBoxEntry* _pSelected,::svx::ODataAccessDescriptor& _rDescriptor);
126cdf0e10cSrcweir 
127cdf0e10cSrcweir private:
128cdf0e10cSrcweir 	// FmXChangeListener
129cdf0e10cSrcweir 	virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException );
130cdf0e10cSrcweir     // OContainerListener
131cdf0e10cSrcweir     virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
132cdf0e10cSrcweir 	virtual void _elementRemoved( const  ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
133cdf0e10cSrcweir 	virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
134cdf0e10cSrcweir };
135cdf0e10cSrcweir //==============================================================================
136cdf0e10cSrcweir } // rptui
137cdf0e10cSrcweir //==============================================================================
138cdf0e10cSrcweir #endif // RPTUI_ADDFIELDWINDOW_HXX
139cdf0e10cSrcweir 
140