1*2d785d7eSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2d785d7eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2d785d7eSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2d785d7eSAndrew Rist * distributed with this work for additional information 6*2d785d7eSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2d785d7eSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2d785d7eSAndrew Rist * "License"); you may not use this file except in compliance 9*2d785d7eSAndrew Rist * with the License. You may obtain a copy of the License at 10*2d785d7eSAndrew Rist * 11*2d785d7eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2d785d7eSAndrew Rist * 13*2d785d7eSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2d785d7eSAndrew Rist * software distributed under the License is distributed on an 15*2d785d7eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2d785d7eSAndrew Rist * KIND, either express or implied. See the License for the 17*2d785d7eSAndrew Rist * specific language governing permissions and limitations 18*2d785d7eSAndrew Rist * under the License. 19*2d785d7eSAndrew Rist * 20*2d785d7eSAndrew Rist *************************************************************/ 21*2d785d7eSAndrew Rist 22*2d785d7eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef FORMS_COMPONENT_FILTER_HXX 25cdf0e10cSrcweir #define FORMS_COMPONENT_FILTER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 28cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 29cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 30cdf0e10cSrcweir #include <com/sun/star/form/XBoundComponent.hpp> 31cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatter.hpp> 32cdf0e10cSrcweir #include <com/sun/star/awt/XTextComponent.hpp> 33cdf0e10cSrcweir #include <com/sun/star/sdb/SQLContext.hpp> 34cdf0e10cSrcweir #include <toolkit/controls/unocontrol.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <toolkit/helper/listenermultiplexer.hxx> 37cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx> 38cdf0e10cSrcweir #include <comphelper/uno3.hxx> 39cdf0e10cSrcweir #include <comphelper/componentcontext.hxx> 40cdf0e10cSrcweir #include <cppuhelper/implbase4.hxx> 41cdf0e10cSrcweir #include <connectivity/sqlparse.hxx> 42cdf0e10cSrcweir #include <svx/ParseContext.hxx> 43cdf0e10cSrcweir 44cdf0e10cSrcweir #include <hash_map> 45cdf0e10cSrcweir 46cdf0e10cSrcweir //......................................................................... 47cdf0e10cSrcweir namespace frm 48cdf0e10cSrcweir { 49cdf0e10cSrcweir //......................................................................... 50cdf0e10cSrcweir 51cdf0e10cSrcweir //===================================================================== 52cdf0e10cSrcweir // OFilterControl 53cdf0e10cSrcweir //===================================================================== 54cdf0e10cSrcweir typedef ::cppu::ImplHelper5 < ::com::sun::star::awt::XTextComponent 55cdf0e10cSrcweir , ::com::sun::star::awt::XFocusListener 56cdf0e10cSrcweir , ::com::sun::star::awt::XItemListener 57cdf0e10cSrcweir , ::com::sun::star::form::XBoundComponent 58cdf0e10cSrcweir , ::com::sun::star::lang::XInitialization 59cdf0e10cSrcweir > OFilterControl_BASE; 60cdf0e10cSrcweir 61cdf0e10cSrcweir class OFilterControl :public UnoControl 62cdf0e10cSrcweir ,public OFilterControl_BASE 63cdf0e10cSrcweir ,public ::svxform::OParseContextClient 64cdf0e10cSrcweir { 65cdf0e10cSrcweir TextListenerMultiplexer m_aTextListeners; 66cdf0e10cSrcweir 67cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xField; 68cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; 69cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; 70cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; 71cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xMessageParent; 72cdf0e10cSrcweir 73cdf0e10cSrcweir typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > MapString2String; 74cdf0e10cSrcweir MapString2String m_aDisplayItemToValueItem; 75cdf0e10cSrcweir 76cdf0e10cSrcweir ::rtl::OUString m_aText; 77cdf0e10cSrcweir ::connectivity::OSQLParser m_aParser; 78cdf0e10cSrcweir sal_Int16 m_nControlClass; // which kind of control do we use? 79cdf0e10cSrcweir sal_Bool m_bFilterList : 1; 80cdf0e10cSrcweir sal_Bool m_bMultiLine : 1; 81cdf0e10cSrcweir sal_Bool m_bFilterListFilled : 1; 82cdf0e10cSrcweir 83cdf0e10cSrcweir private: 84cdf0e10cSrcweir // OFilterControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); 85cdf0e10cSrcweir 86cdf0e10cSrcweir void implInitFilterList(); 87cdf0e10cSrcweir 88cdf0e10cSrcweir public: 89cdf0e10cSrcweir OFilterControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); 90cdf0e10cSrcweir 91cdf0e10cSrcweir DECLARE_UNO3_AGG_DEFAULTS(OFilterControl,OWeakAggObject); 92cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); 93cdf0e10cSrcweir 94cdf0e10cSrcweir virtual ::rtl::OUString GetComponentServiceName(); 95cdf0e10cSrcweir virtual void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw( ::com::sun::star::uno::RuntimeException ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir // ::com::sun::star::lang::XComponent 98cdf0e10cSrcweir virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir // ::com::sun::star::awt::XTextComponent 101cdf0e10cSrcweir virtual void SAL_CALL addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); 102cdf0e10cSrcweir virtual void SAL_CALL removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); 103cdf0e10cSrcweir virtual void SAL_CALL setText( const ::rtl::OUString& aText ) throw( ::com::sun::star::uno::RuntimeException ); 104cdf0e10cSrcweir virtual void SAL_CALL insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw( ::com::sun::star::uno::RuntimeException ); 105cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getText() throw( ::com::sun::star::uno::RuntimeException ); 106cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getSelectedText() throw( ::com::sun::star::uno::RuntimeException ); 107cdf0e10cSrcweir virtual void SAL_CALL setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw( ::com::sun::star::uno::RuntimeException ); 108cdf0e10cSrcweir virtual ::com::sun::star::awt::Selection SAL_CALL getSelection() throw( ::com::sun::star::uno::RuntimeException ); 109cdf0e10cSrcweir virtual sal_Bool SAL_CALL isEditable() throw( ::com::sun::star::uno::RuntimeException ); 110cdf0e10cSrcweir virtual void SAL_CALL setEditable( sal_Bool bEditable ) throw( ::com::sun::star::uno::RuntimeException ); 111cdf0e10cSrcweir virtual void SAL_CALL setMaxTextLen( sal_Int16 nLength ) throw( ::com::sun::star::uno::RuntimeException ); 112cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getMaxTextLen() throw( ::com::sun::star::uno::RuntimeException ); 113cdf0e10cSrcweir 114cdf0e10cSrcweir // ::com::sun::star::form::XBoundComponent addUpdateListener(const::com::sun::star::uno::Reference<::com::sun::star::form::XUpdateListener> &)115cdf0e10cSrcweir virtual void SAL_CALL addUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener > & /*l*/) throw( ::com::sun::star::uno::RuntimeException ) {} removeUpdateListener(const::com::sun::star::uno::Reference<::com::sun::star::form::XUpdateListener> &)116cdf0e10cSrcweir virtual void SAL_CALL removeUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener > & /*l*/) throw( ::com::sun::star::uno::RuntimeException ) {} 117cdf0e10cSrcweir virtual sal_Bool SAL_CALL commit() throw( ::com::sun::star::uno::RuntimeException ); 118cdf0e10cSrcweir 119cdf0e10cSrcweir // ::com::sun::star::lang::XEventListener 120cdf0e10cSrcweir virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); 121cdf0e10cSrcweir 122cdf0e10cSrcweir // ::com::sun::star::awt::XFocusListener 123cdf0e10cSrcweir virtual void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException ); 124cdf0e10cSrcweir virtual void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir // ::com::sun::star::awt::XItemListener 127cdf0e10cSrcweir virtual void SAL_CALL itemStateChanged(const ::com::sun::star::awt::ItemEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); 128cdf0e10cSrcweir 129cdf0e10cSrcweir // ::com::sun::star::util::XInitialization 130cdf0e10cSrcweir virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 131cdf0e10cSrcweir 132cdf0e10cSrcweir // XServiceInfo 133cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 134cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 135cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 136cdf0e10cSrcweir 137cdf0e10cSrcweir // com::sun::star::lang::XServiceInfo - static version 138cdf0e10cSrcweir static ::rtl::OUString SAL_CALL getImplementationName_Static(); 139cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(); 140cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); 141cdf0e10cSrcweir 142cdf0e10cSrcweir protected: 143cdf0e10cSrcweir virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc ); 144cdf0e10cSrcweir virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); 145cdf0e10cSrcweir 146cdf0e10cSrcweir sal_Bool ensureInitialized( ); 147cdf0e10cSrcweir 148cdf0e10cSrcweir void displayException( const ::com::sun::star::sdb::SQLContext& _rExcept ); 149cdf0e10cSrcweir }; 150cdf0e10cSrcweir //......................................................................... 151cdf0e10cSrcweir } // namespace frm 152cdf0e10cSrcweir //......................................................................... 153cdf0e10cSrcweir 154cdf0e10cSrcweir #endif // FORMS_COMPONENT_FILTER_HXX 155