1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AddField.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef RPTUI_ADDFIELDWINDOW_HXX
32 #define RPTUI_ADDFIELDWINDOW_HXX
34 #include <com/sun/star/frame/XDispatch.hpp>
35 #include <com/sun/star/container/XNameAccess.hpp>
36 #include <com/sun/star/sdbc/XConnection.hpp>
37 #include <com/sun/star/frame/XDispatch.hpp>
38 #include <svtools/transfer.hxx>
39 #include <com/sun/star/container/XNameAccess.hpp>
40 #include <com/sun/star/sdbc/XConnection.hpp>
41 #include <svtools/svtreebx.hxx>
42 #include <svtools/transfer.hxx>
43 #include <vcl/floatwin.hxx>
44 #include <comphelper/propmultiplex.hxx>
45 #include <comphelper/containermultiplexer.hxx>
46 #include <vcl/button.hxx>
48 #include <svx/dataaccessdescriptor.hxx>
49 #include "cppuhelper/basemutex.hxx"
50 #include <dbaccess/ToolBoxHelper.hxx>
51 #include <vcl/toolbox.hxx>
52 #include <vcl/fixed.hxx>
54 #include <rtl/ref.hxx>
58 //==================================================================
59 class OAddFieldWindow
;
60 class OAddFieldWindowListBox
;
61 //========================================================================
62 class OAddFieldWindow
:public FloatingWindow
63 , public ::cppu::BaseMutex
64 , public ::comphelper::OPropertyChangeListener
65 , public ::comphelper::OContainerListener
66 , public dbaui::OToolBoxHelper
68 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> m_xHoldAlive
;
69 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xColumns
;
70 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> m_xRowSet
;
74 ::std::auto_ptr
<OAddFieldWindowListBox
> m_pListBox
;
75 FixedLine m_aFixedLine
;
76 FixedText m_aHelpText
;
78 PushButton m_aInsertButton
;
80 ::rtl::OUString m_aCommandName
;
81 ::rtl::OUString m_sFilter
;
82 sal_Int32 m_nCommandType
;
83 sal_Bool m_bEscapeProcessing
;
84 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pChangeListener
;
85 ::rtl::Reference
< comphelper::OContainerListenerAdapter
> m_pContainerListener
;
87 DECL_LINK( OnDoubleClickHdl
, void* );
88 DECL_LINK( OnSelectHdl
, void* );
89 DECL_LINK( OnSortAction
, ToolBox
* );
91 OAddFieldWindow(const OAddFieldWindow
&);
92 void operator =(const OAddFieldWindow
&);
94 OAddFieldWindow(Window
* pParent
95 , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _xRowSet
);
97 virtual ~OAddFieldWindow();
98 virtual void Resize();
99 virtual void GetFocus();
100 virtual long PreNotify( NotifyEvent
& _rNEvt
);
102 inline const ::rtl::OUString
& GetCommand() const { return m_aCommandName
; }
103 inline sal_Int32
GetCommandType() const { return m_nCommandType
; }
104 inline sal_Bool
GetEscapeProcessing() const { return m_bEscapeProcessing
; }
105 inline void SetCreateHdl(const Link
& _aCreateLink
) { m_aCreateLink
= _aCreateLink
; }
107 inline ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> getColumns() const { return m_xColumns
; }
108 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> getConnection() const;
110 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> getSelectedFieldDescriptors();
112 /** will be called when the id of the image list is needed.
116 <TRUE/> when in high contrast mode.
118 virtual ImageList
getImageList(sal_Int16 _eBitmapSet
,sal_Bool _bHiContast
) const;
120 /** will be called when the controls need to be resized.
122 virtual void resizeControls(const Size
& _rDiff
);
124 /// Updates the current field list
127 /** fills the descriptor with the column name, column object, command and command type
129 * \param _pSelected the currently selected
130 * \param _rDescriptor the descriptor will be filled
132 void fillDescriptor(SvLBoxEntry
* _pSelected
,::svx::ODataAccessDescriptor
& _rDescriptor
);
136 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent
& evt
) throw( ::com::sun::star::uno::RuntimeException
);
137 // OContainerListener
138 virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent
& _rEvent
) throw(::com::sun::star::uno::RuntimeException
);
139 virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent
& _rEvent
) throw(::com::sun::star::uno::RuntimeException
);
140 virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent
& _rEvent
) throw(::com::sun::star::uno::RuntimeException
);
142 //==============================================================================
144 //==============================================================================
145 #endif // RPTUI_ADDFIELDWINDOW_HXX