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