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 28 #ifndef RPTUI_ADDFIELDWINDOW_HXX 29 #define RPTUI_ADDFIELDWINDOW_HXX 30 31 #include <com/sun/star/frame/XDispatch.hpp> 32 #include <com/sun/star/container/XNameAccess.hpp> 33 #include <com/sun/star/sdbc/XConnection.hpp> 34 #include <com/sun/star/frame/XDispatch.hpp> 35 #include <svtools/transfer.hxx> 36 #include <com/sun/star/container/XNameAccess.hpp> 37 #include <com/sun/star/sdbc/XConnection.hpp> 38 #include <svtools/svtreebx.hxx> 39 #include <svtools/transfer.hxx> 40 #include <vcl/floatwin.hxx> 41 #include <comphelper/propmultiplex.hxx> 42 #include <comphelper/containermultiplexer.hxx> 43 #include <vcl/button.hxx> 44 45 #include <svx/dataaccessdescriptor.hxx> 46 #include "cppuhelper/basemutex.hxx" 47 #include <dbaccess/ToolBoxHelper.hxx> 48 #include <vcl/toolbox.hxx> 49 #include <vcl/fixed.hxx> 50 51 #include <rtl/ref.hxx> 52 53 namespace rptui 54 { 55 //================================================================== 56 class OAddFieldWindow; 57 class OAddFieldWindowListBox; 58 //======================================================================== 59 class OAddFieldWindow :public FloatingWindow 60 , public ::cppu::BaseMutex 61 , public ::comphelper::OPropertyChangeListener 62 , public ::comphelper::OContainerListener 63 , public dbaui::OToolBoxHelper 64 { 65 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> m_xHoldAlive; 66 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns; 67 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xRowSet; 68 69 ToolBox m_aActions; 70 71 ::std::auto_ptr<OAddFieldWindowListBox> m_pListBox; 72 FixedLine m_aFixedLine; 73 FixedText m_aHelpText; 74 75 PushButton m_aInsertButton; 76 Link m_aCreateLink; 77 ::rtl::OUString m_aCommandName; 78 ::rtl::OUString m_sFilter; 79 sal_Int32 m_nCommandType; 80 sal_Bool m_bEscapeProcessing; 81 ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pChangeListener; 82 ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener; 83 84 DECL_LINK( OnDoubleClickHdl, void* ); 85 DECL_LINK( OnSelectHdl, void* ); 86 DECL_LINK( OnSortAction, ToolBox* ); 87 88 OAddFieldWindow(const OAddFieldWindow&); 89 void operator =(const OAddFieldWindow&); 90 public: 91 OAddFieldWindow(Window* pParent 92 , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xRowSet); 93 94 virtual ~OAddFieldWindow(); 95 virtual void Resize(); 96 virtual void GetFocus(); 97 virtual long PreNotify( NotifyEvent& _rNEvt ); 98 99 inline const ::rtl::OUString& GetCommand() const { return m_aCommandName; } 100 inline sal_Int32 GetCommandType() const { return m_nCommandType; } 101 inline sal_Bool GetEscapeProcessing() const { return m_bEscapeProcessing; } 102 inline void SetCreateHdl(const Link& _aCreateLink) { m_aCreateLink = _aCreateLink; } 103 104 inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getColumns() const { return m_xColumns; } 105 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const; 106 107 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors(); 108 109 /** will be called when the id of the image list is needed. 110 @param _eBitmapSet 111 <svtools/imgdef.hxx> 112 @param _bHiContast 113 <TRUE/> when in high contrast mode. 114 */ 115 virtual ImageList getImageList(sal_Int16 _eBitmapSet,sal_Bool _bHiContast) const; 116 117 /** will be called when the controls need to be resized. 118 */ 119 virtual void resizeControls(const Size& _rDiff); 120 121 /// Updates the current field list 122 void Update(); 123 124 /** fills the descriptor with the column name, column object, command and command type 125 * 126 * \param _pSelected the currently selected 127 * \param _rDescriptor the descriptor will be filled 128 */ 129 void fillDescriptor(SvLBoxEntry* _pSelected,::svx::ODataAccessDescriptor& _rDescriptor); 130 131 private: 132 // FmXChangeListener 133 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException ); 134 // OContainerListener 135 virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException); 136 virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException); 137 virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException); 138 }; 139 //============================================================================== 140 } // rptui 141 //============================================================================== 142 #endif // RPTUI_ADDFIELDWINDOW_HXX 143 144