1*f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f8e07b45SAndrew Rist  * distributed with this work for additional information
6*f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9*f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f8e07b45SAndrew Rist  *
11*f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f8e07b45SAndrew Rist  *
13*f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15*f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18*f8e07b45SAndrew Rist  * under the License.
19*f8e07b45SAndrew Rist  *
20*f8e07b45SAndrew Rist  *************************************************************/
21*f8e07b45SAndrew Rist 
22*f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_SERVICES_CONTENTHANDLERFACTORY_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_SERVICES_CONTENTHANDLERFACTORY_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	my own includes
29cdf0e10cSrcweir //_________________________________________________________________________________________________________________
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <classes/filtercache.hxx>
32cdf0e10cSrcweir #include <macros/generic.hxx>
33cdf0e10cSrcweir #include <macros/debug.hxx>
34cdf0e10cSrcweir #include <macros/xinterface.hxx>
35cdf0e10cSrcweir #include <macros/xtypeprovider.hxx>
36cdf0e10cSrcweir #include <macros/xserviceinfo.hxx>
37cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_
40cdf0e10cSrcweir #include <threadhelp/transactionbase.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #include <general.h>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir //_________________________________________________________________________________________________________________
45cdf0e10cSrcweir //	interface includes
46cdf0e10cSrcweir //_________________________________________________________________________________________________________________
47cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
48cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
49cdf0e10cSrcweir #include <com/sun/star/lang/WrappedTargetException.hpp>
50cdf0e10cSrcweir #include <com/sun/star/lang/IllegalArgumentException.hpp>
51cdf0e10cSrcweir #include <com/sun/star/container/ElementExistException.hpp>
52cdf0e10cSrcweir #include <com/sun/star/container/NoSuchElementException.hpp>
53cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
54cdf0e10cSrcweir #include <com/sun/star/container/NoSuchElementException.hpp>
55cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp>
56cdf0e10cSrcweir #include <com/sun/star/util/XFlushable.hpp>
57cdf0e10cSrcweir 
58cdf0e10cSrcweir //_________________________________________________________________________________________________________________
59cdf0e10cSrcweir //	other includes
60cdf0e10cSrcweir //_________________________________________________________________________________________________________________
61cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
62cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
63cdf0e10cSrcweir 
64cdf0e10cSrcweir //_________________________________________________________________________________________________________________
65cdf0e10cSrcweir //	namespace
66cdf0e10cSrcweir //_________________________________________________________________________________________________________________
67cdf0e10cSrcweir 
68cdf0e10cSrcweir namespace framework{
69cdf0e10cSrcweir 
70cdf0e10cSrcweir //_________________________________________________________________________________________________________________
71cdf0e10cSrcweir //	exported const
72cdf0e10cSrcweir //_________________________________________________________________________________________________________________
73cdf0e10cSrcweir 
74cdf0e10cSrcweir //_________________________________________________________________________________________________________________
75cdf0e10cSrcweir //	exported definitions
76cdf0e10cSrcweir //_________________________________________________________________________________________________________________
77cdf0e10cSrcweir 
78cdf0e10cSrcweir /*-************************************************************************************************************//**
79cdf0e10cSrcweir     @short      factory to create handler-objects
80cdf0e10cSrcweir     @descr      These class can be used to create new handler for specified contents.
81cdf0e10cSrcweir                 We use cached values of our configuration to lay down, which handler match
82cdf0e10cSrcweir                 a given URL or handlername. (use service TypeDetection to do that)
83cdf0e10cSrcweir                 With a detected type name you can search a registered handler and create it with these factory.
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	@implements	XInterface
86cdf0e10cSrcweir 				XTypeProvider
87cdf0e10cSrcweir 				XServiceInfo
88cdf0e10cSrcweir 				XMultiServiceFactory
89cdf0e10cSrcweir 				XNameContainer
90cdf0e10cSrcweir 				XNameReplace
91cdf0e10cSrcweir 				XNameAccess
92cdf0e10cSrcweir 				XElementAccess
93cdf0e10cSrcweir 				XFlushable
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     @base       ThreadHelpBase
96cdf0e10cSrcweir 				OWeakObject
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	@devstatus	ready to use
99cdf0e10cSrcweir 	@threadsafe	yes
100cdf0e10cSrcweir *//*-*************************************************************************************************************/
101cdf0e10cSrcweir 
102cdf0e10cSrcweir class ContentHandlerFactory :   // interfaces
103cdf0e10cSrcweir 						public	css::lang::XTypeProvider			,
104cdf0e10cSrcweir 						public	css::lang::XServiceInfo				,
105cdf0e10cSrcweir 						public	css::lang::XMultiServiceFactory		,
106cdf0e10cSrcweir 						public	css::container::XNameContainer		,		// => XNameReplace => XNameAccess => XElementAccess
107cdf0e10cSrcweir 						public	css::util::XFlushable				,
108cdf0e10cSrcweir 						// base classes
109cdf0e10cSrcweir 						// Order is neccessary for right initialization of it!
110cdf0e10cSrcweir                         private ThreadHelpBase                      ,
111cdf0e10cSrcweir                         private TransactionBase                     ,
112cdf0e10cSrcweir 						public	::cppu::OWeakObject
113cdf0e10cSrcweir {
114cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
115cdf0e10cSrcweir 	//	public methods
116cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	public:
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
121cdf0e10cSrcweir 		//	constructor / destructor
122cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
123cdf0e10cSrcweir                  ContentHandlerFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
124cdf0e10cSrcweir         virtual ~ContentHandlerFactory(                                                                        );
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
127cdf0e10cSrcweir 		//	XInterface, XTypeProvider, XServiceInfo
128cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
129cdf0e10cSrcweir 		DECLARE_XINTERFACE
130cdf0e10cSrcweir 		DECLARE_XTYPEPROVIDER
131cdf0e10cSrcweir 		DECLARE_XSERVICEINFO
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
134cdf0e10cSrcweir 		//	XMultiServiceFactory
135cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
136cdf0e10cSrcweir         virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance             ( const ::rtl::OUString&                        sTypeName   ) throw( css::uno::Exception        ,
137cdf0e10cSrcweir                                                                                                                                                                      css::uno::RuntimeException );
138cdf0e10cSrcweir         virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString&                        sTypeName   ,
139cdf0e10cSrcweir                                                                                                   const css::uno::Sequence< css::uno::Any >&    lArguments  ) throw( css::uno::Exception, css::uno::RuntimeException );
140cdf0e10cSrcweir         virtual css::uno::Sequence< ::rtl::OUString >       SAL_CALL getAvailableServiceNames   (                                                           ) throw( css::uno::RuntimeException );
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
143cdf0e10cSrcweir 		//	XNameContainer
144cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
145cdf0e10cSrcweir         virtual void SAL_CALL insertByName( const ::rtl::OUString&  sHandlerName        ,
146cdf0e10cSrcweir                                             const css::uno::Any&    aHandlerProperties  ) throw( css::lang::IllegalArgumentException     ,
147cdf0e10cSrcweir                                                                                                  css::container::ElementExistException   ,
148cdf0e10cSrcweir                                                                                                  css::lang::WrappedTargetException       ,
149cdf0e10cSrcweir                                                                                                  css::uno::RuntimeException              );
150cdf0e10cSrcweir         virtual void SAL_CALL removeByName( const ::rtl::OUString&  sHandlerName        ) throw( css::container::NoSuchElementException  ,
151cdf0e10cSrcweir                                                                                                  css::lang::WrappedTargetException       ,
152cdf0e10cSrcweir                                                                                                  css::uno::RuntimeException              );
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
155cdf0e10cSrcweir 		//	XNameReplace
156cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
157cdf0e10cSrcweir         virtual void SAL_CALL replaceByName( const ::rtl::OUString& sHandlerName       ,
158cdf0e10cSrcweir                                              const css::uno::Any&   aHandlerProperties ) throw( css::lang::IllegalArgumentException    ,
159cdf0e10cSrcweir                                                                                                 css::container::NoSuchElementException ,
160cdf0e10cSrcweir                                                                                                 css::lang::WrappedTargetException      ,
161cdf0e10cSrcweir                                                                                                 css::uno::RuntimeException             );
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
164cdf0e10cSrcweir 		//	XNameAccess
165cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
166cdf0e10cSrcweir         virtual css::uno::Any                         SAL_CALL getByName      ( const ::rtl::OUString& sName ) throw( css::container::NoSuchElementException ,
167cdf0e10cSrcweir                                                                                                                       css::lang::WrappedTargetException      ,
168cdf0e10cSrcweir                                                                                                                       css::uno::RuntimeException             );
169cdf0e10cSrcweir         virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(                              ) throw( css::uno::RuntimeException             );
170cdf0e10cSrcweir         virtual sal_Bool                              SAL_CALL hasByName      ( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException             );
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
173cdf0e10cSrcweir 		//	XElementAccess
174cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
175cdf0e10cSrcweir         virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException );
176cdf0e10cSrcweir         virtual sal_Bool       SAL_CALL hasElements   () throw( css::uno::RuntimeException );
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
179cdf0e10cSrcweir 		//	XFlushable
180cdf0e10cSrcweir 		//---------------------------------------------------------------------------------------------------------
181cdf0e10cSrcweir         virtual void SAL_CALL flush              (                                                                   ) throw ( css::uno::RuntimeException );
182cdf0e10cSrcweir         virtual void SAL_CALL addFlushListener   ( const css::uno::Reference< css::util::XFlushListener >& xListener ) throw ( css::uno::RuntimeException );
183cdf0e10cSrcweir     	virtual void SAL_CALL removeFlushListener( const css::uno::Reference< css::util::XFlushListener >& xListener ) throw ( css::uno::RuntimeException );
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
186cdf0e10cSrcweir 	//	protected methods
187cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	protected:
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
192cdf0e10cSrcweir 	//	debug methods
193cdf0e10cSrcweir 	//	(should be private everyway!)
194cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 		/*-****************************************************************************************************//**
197cdf0e10cSrcweir 			@short		debug-method to check incoming parameter of some other mehods of this class
198cdf0e10cSrcweir 			@descr		The following methods are used to check parameters for other methods
199cdf0e10cSrcweir 						of this class. The return value is used directly for an ASSERT(...).
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 			@seealso	ASSERTs in implementation!
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 			@param		references to checking variables
204cdf0e10cSrcweir 			@return		sal_False ,on invalid parameter
205cdf0e10cSrcweir 			@return		sal_True  ,otherwise
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 			@onerror	-
208cdf0e10cSrcweir 		*//*-*****************************************************************************************************/
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	#ifdef ENABLE_ASSERTIONS
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 	private:
213cdf0e10cSrcweir 
214cdf0e10cSrcweir         static sal_Bool implcp_ContentHandlerFactory        (   const   css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory            );
215cdf0e10cSrcweir     	static sal_Bool implcp_createInstanceWithArguments	(	const	::rtl::OUString&										sTypeName			,
216cdf0e10cSrcweir 							  									const	css::uno::Sequence< css::uno::Any >&					lArguments			);
217cdf0e10cSrcweir     	static sal_Bool implcp_getByName					(	const	::rtl::OUString&										sName				);
218cdf0e10cSrcweir     	static sal_Bool implcp_hasByName					(	const	::rtl::OUString&										sName				);
219cdf0e10cSrcweir         static sal_Bool implcp_removeByName                 (   const   ::rtl::OUString&                                        sHandlerName        );
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 	#endif	//	#ifdef ENABLE_ASSERTIONS
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
224cdf0e10cSrcweir 	//	private variables
225cdf0e10cSrcweir 	//	(should be private everyway!)
226cdf0e10cSrcweir 	//-------------------------------------------------------------------------------------------------------------
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	private:
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 		css::uno::Reference< css::lang::XMultiServiceFactory >		m_xFactory				;
231cdf0e10cSrcweir         FilterCache                                                 m_aCache                ;
232cdf0e10cSrcweir //		::cppu::OMultiTypeInterfaceContainerHelper					m_aListenerContainer	;
233cdf0e10cSrcweir 
234cdf0e10cSrcweir };      //  class ContentHandlerFactory
235cdf0e10cSrcweir 
236cdf0e10cSrcweir }		//	namespace framework
237cdf0e10cSrcweir 
238cdf0e10cSrcweir #endif  //  #ifndef __FRAMEWORK_SERVICES_CONTENTHANDLERFACTORY_HXX_
239