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 __FILTER_CONFIG_CONTENTHANDLERFACTORY_HXX_
25 #define __FILTER_CONFIG_CONTENTHANDLERFACTORY_HXX_
26 
27 //_______________________________________________
28 // includes
29 
30 #include "basecontainer.hxx"
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
33 #include <cppuhelper/implbase1.hxx>
34 
35 //_______________________________________________
36 // namespace
37 
38 namespace filter{
39     namespace config{
40 
41 namespace css = ::com::sun::star;
42 
43 //_______________________________________________
44 // definitions
45 
46 //_______________________________________________
47 
48 /** @short      implements the service <type scope="com.sun.star.document">ContentHandlerFactory</type>.
49  */
50 class ContentHandlerFactory : public ::cppu::ImplInheritanceHelper1< BaseContainer                   ,
51                                                                      css::lang::XMultiServiceFactory >
52 {
53     //-------------------------------------------
54     // native interface
55 
56     public:
57 
58         //---------------------------------------
59         // ctor/dtor
60 
61         /** @short  standard ctor to connect this interface wrapper to
62                     the global filter cache instance ...
63 
64             @param  xSMGR
65                     reference to the uno service manager, which created this service instance.
66          */
67         ContentHandlerFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
68 
69         //---------------------------------------
70 
71         /** @short  standard dtor.
72          */
73         virtual ~ContentHandlerFactory();
74 
75     //-------------------------------------------
76     // uno interface
77 
78     public:
79 
80         //---------------------------------------
81         // XMultiServiceFactory
82 
83         virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const ::rtl::OUString& sHandler)
84             throw(css::uno::Exception       ,
85                   css::uno::RuntimeException);
86 
87         virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const ::rtl::OUString&                     sHandler  ,
88                                                                                                  const css::uno::Sequence< css::uno::Any >& lArguments)
89             throw(css::uno::Exception       ,
90                   css::uno::RuntimeException);
91 
92         virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames()
93             throw(css::uno::RuntimeException);
94 
95     //-------------------------------------------
96     // static uno helper!
97 
98     public:
99 
100         //---------------------------------------
101 
102         /** @short  return the uno implementation name of this class.
103 
104             @descr  Because this information is used at several places
105                     (and mostly an object instance of this class is not possible)
106                     its implemented as a static function!
107 
108             @return The fix uno implementation name of this class.
109          */
110         static ::rtl::OUString impl_getImplementationName();
111 
112         //---------------------------------------
113 
114         /** @short  return the list of supported uno services of this class.
115 
116             @descr  Because this information is used at several places
117                     (and mostly an object instance of this class is not possible)
118                     its implemented as a static function!
119 
120             @return The fix list of uno services supported by this class.
121          */
122         static css::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames();
123 
124         //---------------------------------------
125 
126         /** @short  return a new intsnace of this class.
127 
128             @descr  This method is used by the uno service manager, to create
129                     a new instance of this service if needed.
130 
131             @param  xSMGR
132                     reference to the uno service manager, which require
133                     this new instance. It should be passed to the new object
134                     so it can be used internaly to create own needed uno resources.
135 
136             @return The new instance of this service as an uno reference.
137          */
138         static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
139 };
140 
141     } // namespace config
142 } // namespace filter
143 
144 #endif // __FILTER_CONFIG_CONTENTHANDLERFACTORY_HXX_
145