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: Filter.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 FORMS_COMPONENT_FILTER_HXX
32 #define FORMS_COMPONENT_FILTER_HXX
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/lang/XInitialization.hpp>
37 #include <com/sun/star/form/XBoundComponent.hpp>
38 #include <com/sun/star/util/XNumberFormatter.hpp>
39 #include <com/sun/star/awt/XTextComponent.hpp>
40 #include <com/sun/star/sdb/SQLContext.hpp>
41 #include <toolkit/controls/unocontrol.hxx>
43 #ifndef _TOOLKIT_AWT_LISTENERMULTIPLEXER_HXX_
44 #include <toolkit/helper/listenermultiplexer.hxx>
46 #include <cppuhelper/implbase5.hxx>
47 #include <comphelper/uno3.hxx>
48 #include <cppuhelper/implbase4.hxx>
49 #include <connectivity/sqlparse.hxx>
50 #include <svx/ParseContext.hxx>
54 //.........................................................................
57 //.........................................................................
59 //=====================================================================
61 //=====================================================================
62 typedef ::cppu::ImplHelper5
< ::com::sun::star::awt::XTextComponent
63 , ::com::sun::star::awt::XFocusListener
64 , ::com::sun::star::awt::XItemListener
65 , ::com::sun::star::form::XBoundComponent
66 , ::com::sun::star::lang::XInitialization
67 > OFilterControl_BASE
;
69 class OFilterControl
:public UnoControl
70 ,public OFilterControl_BASE
71 ,public ::svxform::OParseContextClient
73 TextListenerMultiplexer m_aTextListeners
;
75 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xORB
;
76 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> m_xField
;
77 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
> m_xFormatter
;
78 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> m_xConnection
;
79 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDatabaseMetaData
> m_xMetaData
;
80 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> m_xMessageParent
;
82 ::rtl::OUString m_aText
;
83 ::connectivity::OSQLParser m_aParser
;
84 sal_Int16 m_nControlClass
; // which kind of control do we use?
85 sal_Bool m_bFilterList
: 1;
86 sal_Bool m_bMultiLine
: 1;
87 sal_Bool m_bFilterListFilled
: 1;
90 // OFilterControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
92 void implInitFilterList();
95 OFilterControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
);
97 DECLARE_UNO3_AGG_DEFAULTS(OFilterControl
,OWeakAggObject
);
98 ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& rType
) throw(::com::sun::star::uno::RuntimeException
);
100 virtual ::rtl::OUString
GetComponentServiceName();
101 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
);
103 // ::com::sun::star::lang::XComponent
104 virtual void SAL_CALL
dispose(void) throw( ::com::sun::star::uno::RuntimeException
);
106 // ::com::sun::star::awt::XTextComponent
107 virtual void SAL_CALL
addTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw( ::com::sun::star::uno::RuntimeException
);
108 virtual void SAL_CALL
removeTextListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTextListener
> & l
) throw( ::com::sun::star::uno::RuntimeException
);
109 virtual void SAL_CALL
setText( const ::rtl::OUString
& aText
) throw( ::com::sun::star::uno::RuntimeException
);
110 virtual void SAL_CALL
insertText( const ::com::sun::star::awt::Selection
& rSel
, const ::rtl::OUString
& aText
) throw( ::com::sun::star::uno::RuntimeException
);
111 virtual ::rtl::OUString SAL_CALL
getText() throw( ::com::sun::star::uno::RuntimeException
);
112 virtual ::rtl::OUString SAL_CALL
getSelectedText() throw( ::com::sun::star::uno::RuntimeException
);
113 virtual void SAL_CALL
setSelection( const ::com::sun::star::awt::Selection
& aSelection
) throw( ::com::sun::star::uno::RuntimeException
);
114 virtual ::com::sun::star::awt::Selection SAL_CALL
getSelection() throw( ::com::sun::star::uno::RuntimeException
);
115 virtual sal_Bool SAL_CALL
isEditable() throw( ::com::sun::star::uno::RuntimeException
);
116 virtual void SAL_CALL
setEditable( sal_Bool bEditable
) throw( ::com::sun::star::uno::RuntimeException
);
117 virtual void SAL_CALL
setMaxTextLen( sal_Int16 nLength
) throw( ::com::sun::star::uno::RuntimeException
);
118 virtual sal_Int16 SAL_CALL
getMaxTextLen() throw( ::com::sun::star::uno::RuntimeException
);
120 // ::com::sun::star::form::XBoundComponent
121 virtual void SAL_CALL
addUpdateListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XUpdateListener
> & /*l*/) throw( ::com::sun::star::uno::RuntimeException
) {}
122 virtual void SAL_CALL
removeUpdateListener(const ::com::sun::star::uno::Reference
< ::com::sun::star::form::XUpdateListener
> & /*l*/) throw( ::com::sun::star::uno::RuntimeException
) {}
123 virtual sal_Bool SAL_CALL
commit() throw( ::com::sun::star::uno::RuntimeException
);
125 // ::com::sun::star::lang::XEventListener
126 virtual void SAL_CALL
disposing(const ::com::sun::star::lang::EventObject
& Source
) throw( ::com::sun::star::uno::RuntimeException
);
128 // ::com::sun::star::awt::XFocusListener
129 virtual void SAL_CALL
focusGained(const ::com::sun::star::awt::FocusEvent
& e
) throw( ::com::sun::star::uno::RuntimeException
);
130 virtual void SAL_CALL
focusLost(const ::com::sun::star::awt::FocusEvent
& e
) throw( ::com::sun::star::uno::RuntimeException
);
132 // ::com::sun::star::awt::XItemListener
133 virtual void SAL_CALL
itemStateChanged(const ::com::sun::star::awt::ItemEvent
& rEvent
) throw( ::com::sun::star::uno::RuntimeException
);
135 // ::com::sun::star::util::XInitialization
136 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
);
139 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
);
140 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
141 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
);
143 // com::sun::star::lang::XServiceInfo - static version
144 static ::rtl::OUString SAL_CALL
getImplementationName_Static();
145 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames_Static();
146 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
);
149 virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor
& rDesc
);
150 virtual void ImplSetPeerProperty( const ::rtl::OUString
& rPropName
, const ::com::sun::star::uno::Any
& rVal
);
152 sal_Bool
ensureInitialized( );
154 void displayException( const ::com::sun::star::sdb::SQLContext
& _rExcept
);
156 //.........................................................................
158 //.........................................................................
160 #endif // FORMS_COMPONENT_FILTER_HXX