Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef FORMS_COMPONENT_FILTER_HXX
30 : : #define FORMS_COMPONENT_FILTER_HXX
31 : :
32 : : #include <com/sun/star/lang/XServiceInfo.hpp>
33 : : #include <com/sun/star/beans/XPropertySet.hpp>
34 : : #include <com/sun/star/lang/XInitialization.hpp>
35 : : #include <com/sun/star/form/XBoundComponent.hpp>
36 : : #include <com/sun/star/util/XNumberFormatter.hpp>
37 : : #include <com/sun/star/awt/XTextComponent.hpp>
38 : : #include <com/sun/star/sdb/SQLContext.hpp>
39 : : #include <toolkit/controls/unocontrol.hxx>
40 : :
41 : : #include <toolkit/helper/listenermultiplexer.hxx>
42 : : #include <cppuhelper/implbase5.hxx>
43 : : #include <comphelper/uno3.hxx>
44 : : #include <comphelper/componentcontext.hxx>
45 : : #include <cppuhelper/implbase4.hxx>
46 : : #include <connectivity/sqlparse.hxx>
47 : : #include <svx/ParseContext.hxx>
48 : :
49 : : #include <boost/unordered_map.hpp>
50 : :
51 : : //.........................................................................
52 : : namespace frm
53 : : {
54 : : //.........................................................................
55 : :
56 : : //=====================================================================
57 : : // OFilterControl
58 : : //=====================================================================
59 : : typedef ::cppu::ImplHelper5 < ::com::sun::star::awt::XTextComponent
60 : : , ::com::sun::star::awt::XFocusListener
61 : : , ::com::sun::star::awt::XItemListener
62 : : , ::com::sun::star::form::XBoundComponent
63 : : , ::com::sun::star::lang::XInitialization
64 : : > OFilterControl_BASE;
65 : :
66 [ # # ][ # # ]: 0 : class OFilterControl :public UnoControl
[ # # ][ # # ]
[ # # ]
67 : : ,public OFilterControl_BASE
68 : : ,public ::svxform::OParseContextClient
69 : : {
70 : : TextListenerMultiplexer m_aTextListeners;
71 : :
72 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xField;
73 : : ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter;
74 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
75 : : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
76 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xMessageParent;
77 : :
78 : : typedef ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > MapString2String;
79 : : MapString2String m_aDisplayItemToValueItem;
80 : :
81 : : ::rtl::OUString m_aText;
82 : : ::connectivity::OSQLParser m_aParser;
83 : : sal_Int16 m_nControlClass; // which kind of control do we use?
84 : : sal_Bool m_bFilterList : 1;
85 : : sal_Bool m_bMultiLine : 1;
86 : : sal_Bool m_bFilterListFilled : 1;
87 : :
88 : : private:
89 : : // OFilterControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
90 : :
91 : : void implInitFilterList();
92 : :
93 : : public:
94 : : OFilterControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
95 : :
96 : 0 : DECLARE_UNO3_AGG_DEFAULTS(OFilterControl,OWeakAggObject);
97 : : ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
98 : :
99 : : virtual ::rtl::OUString GetComponentServiceName();
100 : : 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 );
101 : :
102 : : // ::com::sun::star::lang::XComponent
103 : : virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
104 : :
105 : : // ::com::sun::star::awt::XTextComponent
106 : : virtual void SAL_CALL addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw( ::com::sun::star::uno::RuntimeException );
107 : : virtual void SAL_CALL removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw( ::com::sun::star::uno::RuntimeException );
108 : : virtual void SAL_CALL setText( const ::rtl::OUString& aText ) throw( ::com::sun::star::uno::RuntimeException );
109 : : virtual void SAL_CALL insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw( ::com::sun::star::uno::RuntimeException );
110 : : virtual ::rtl::OUString SAL_CALL getText() throw( ::com::sun::star::uno::RuntimeException );
111 : : virtual ::rtl::OUString SAL_CALL getSelectedText() throw( ::com::sun::star::uno::RuntimeException );
112 : : virtual void SAL_CALL setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw( ::com::sun::star::uno::RuntimeException );
113 : : virtual ::com::sun::star::awt::Selection SAL_CALL getSelection() throw( ::com::sun::star::uno::RuntimeException );
114 : : virtual sal_Bool SAL_CALL isEditable() throw( ::com::sun::star::uno::RuntimeException );
115 : : virtual void SAL_CALL setEditable( sal_Bool bEditable ) throw( ::com::sun::star::uno::RuntimeException );
116 : : virtual void SAL_CALL setMaxTextLen( sal_Int16 nLength ) throw( ::com::sun::star::uno::RuntimeException );
117 : : virtual sal_Int16 SAL_CALL getMaxTextLen() throw( ::com::sun::star::uno::RuntimeException );
118 : :
119 : : // ::com::sun::star::form::XBoundComponent
120 : 0 : virtual void SAL_CALL addUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener > & /*l*/) throw( ::com::sun::star::uno::RuntimeException ) {}
121 : 0 : virtual void SAL_CALL removeUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener > & /*l*/) throw( ::com::sun::star::uno::RuntimeException ) {}
122 : : virtual sal_Bool SAL_CALL commit() throw( ::com::sun::star::uno::RuntimeException );
123 : :
124 : : // ::com::sun::star::lang::XEventListener
125 : : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
126 : :
127 : : // ::com::sun::star::awt::XFocusListener
128 : : virtual void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException );
129 : : virtual void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException );
130 : :
131 : : // ::com::sun::star::awt::XItemListener
132 : : virtual void SAL_CALL itemStateChanged(const ::com::sun::star::awt::ItemEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException );
133 : :
134 : : // ::com::sun::star::util::XInitialization
135 : : 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);
136 : :
137 : : // XServiceInfo
138 : : virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
139 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
140 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
141 : :
142 : : // com::sun::star::lang::XServiceInfo - static version
143 : : static ::rtl::OUString SAL_CALL getImplementationName_Static();
144 : : static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static();
145 : : 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 );
146 : :
147 : : protected:
148 : : virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
149 : : virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
150 : :
151 : : sal_Bool ensureInitialized( );
152 : :
153 : : void displayException( const ::com::sun::star::sdb::SQLContext& _rExcept );
154 : : };
155 : : //.........................................................................
156 : : } // namespace frm
157 : : //.........................................................................
158 : :
159 : : #endif // FORMS_COMPONENT_FILTER_HXX
160 : :
161 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|