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_FILTERFACTORY_HXX_ 25 #define __FILTER_CONFIG_FILTERFACTORY_HXX_ 26 27 //_______________________________________________ 28 // includes 29 30 #include "basecontainer.hxx" 31 #include "querytokenizer.hxx" 32 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 33 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 34 #include <cppuhelper/implbase1.hxx> 35 36 //_______________________________________________ 37 // namespace 38 39 namespace filter{ 40 namespace config{ 41 42 namespace css = ::com::sun::star; 43 44 //_______________________________________________ 45 // definitions 46 47 //_______________________________________________ 48 49 /** @short implements the service <type scope="com.sun.star.document">FilterFactory</type>. 50 */ 51 class FilterFactory : public ::cppu::ImplInheritanceHelper1< BaseContainer , 52 css::lang::XMultiServiceFactory > 53 { 54 //------------------------------------------- 55 // native interface 56 57 public: 58 59 //--------------------------------------- 60 // ctor/dtor 61 62 /** @short standard ctor to connect this interface wrapper to 63 the global filter cache instance ... 64 65 @param xSMGR 66 reference to the uno service manager, which created this service instance. 67 */ 68 FilterFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); 69 70 //--------------------------------------- 71 72 /** @short standard dtor. 73 */ 74 virtual ~FilterFactory(); 75 76 //------------------------------------------- 77 // uno interface 78 79 public: 80 81 //--------------------------------------- 82 // XMultiServiceFactory 83 84 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(const ::rtl::OUString& sFilter) 85 throw(css::uno::Exception , 86 css::uno::RuntimeException); 87 88 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const ::rtl::OUString& sFilter , 89 const css::uno::Sequence< css::uno::Any >& lArguments) 90 throw(css::uno::Exception , 91 css::uno::RuntimeException); 92 93 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() 94 throw(css::uno::RuntimeException); 95 96 //--------------------------------------- 97 // XContainerQuery 98 99 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByQuery(const ::rtl::OUString& sQuery) 100 throw (css::uno::RuntimeException); 101 102 //------------------------------------------- 103 // internal helper! 104 105 private: 106 107 //--------------------------------------- 108 109 /** @short implement the container string query: "matchByDocumentService=:iflags=:eflags=:..." 110 111 @param lTokens 112 the list of query tokens and its values. 113 114 @return A string list of internal filter names, including 115 all filters, which match this query. 116 */ 117 OUStringList impl_queryMatchByDocumentService(const QueryTokenizer& lTokens) const; 118 119 //--------------------------------------- 120 121 /** TODO document me 122 */ 123 OUStringList impl_getListOfInstalledModules() const; 124 125 //--------------------------------------- 126 127 /** @short implement the container string query: 128 "getSortedFilterList()[:module=<xxx>]:[iflags=<xxx>][:eflags=<xxx>]" 129 130 @param lTokens 131 the list of query tokens and its values. 132 133 @return A string list of internal filter names, including 134 all filters, which match this query. 135 */ 136 OUStringList impl_getSortedFilterList(const QueryTokenizer& lTokens) const; 137 138 //--------------------------------------- 139 140 /** TODO document me 141 */ 142 OUStringList impl_getSortedFilterListForModule(const ::rtl::OUString& sModule, 143 sal_Int32 nIFlags, 144 sal_Int32 nEFlags) const; 145 146 //--------------------------------------- 147 148 /** @short read a specialized and sorted list of filter names from 149 the configuration (matching the specified module) 150 151 @param sModule 152 the module for which the sorted list should be retrieved for. 153 154 @return A string list of internal filter names. 155 Can be empty. 156 */ 157 OUStringList impl_readSortedFilterListFromConfig(const ::rtl::OUString& sModule) const; 158 159 //------------------------------------------- 160 // static uno helper! 161 162 public: 163 164 //--------------------------------------- 165 166 /** @short return the uno implementation name of this class. 167 168 @descr Because this information is used at several places 169 (and mostly an object instance of this class is not possible) 170 its implemented as a static function! 171 172 @return The fix uno implementation name of this class. 173 */ 174 static ::rtl::OUString impl_getImplementationName(); 175 176 //--------------------------------------- 177 178 /** @short return the list of supported uno services of this class. 179 180 @descr Because this information is used at several places 181 (and mostly an object instance of this class is not possible) 182 its implemented as a static function! 183 184 @return The fix list of uno services supported by this class. 185 */ 186 static css::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames(); 187 188 //--------------------------------------- 189 190 /** @short return a new intsnace of this class. 191 192 @descr This method is used by the uno service manager, to create 193 a new instance of this service if needed. 194 195 @param xSMGR 196 reference to the uno service manager, which require 197 this new instance. It should be passed to the new object 198 so it can be used internaly to create own needed uno resources. 199 200 @return The new instance of this service as an uno reference. 201 */ 202 static css::uno::Reference< css::uno::XInterface > impl_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); 203 }; 204 205 } // namespace config 206 } // namespace filter 207 208 #endif // __FILTER_CONFIG_FILTERFACTORY_HXX_ 209