fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / framework / inc / classes / filtercache.hxx
blobf194385b06545d6906be7705c4ae4003d7657039
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 /*TODO
21 - late init
22 - order by number!
23 - insert default detector and loader as last ones in hashes ... don't hold it as an extra member!
24 => CheckedIterator will be obsolete!
27 #ifndef INCLUDED_FRAMEWORK_INC_CLASSES_FILTERCACHE_HXX
28 #define INCLUDED_FRAMEWORK_INC_CLASSES_FILTERCACHE_HXX
30 #include <classes/filtercachedata.hxx>
32 #include <threadhelp/transactionbase.hxx>
33 #include <general.h>
34 #include <queries.h>
36 #include <com/sun/star/uno/Reference.hxx>
37 #include <com/sun/star/uno/Sequence.hxx>
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 #include <com/sun/star/registry/XRegistryKey.hpp>
40 #include <com/sun/star/beans/PropertyValue.hpp>
41 #include <com/sun/star/container/ElementExistException.hpp>
42 #include <com/sun/star/container/NoSuchElementException.hpp>
44 #include <rtl/ustring.hxx>
46 #ifdef ENABLE_GENERATEFILTERCACHE
47 #include <rtl/ustrbuf.hxx>
48 #endif
50 namespace framework{
52 /*-************************************************************************************************************
53 @short cache for all filter and type information
54 @descr Frameloader - and filterfactory need some information about our current registered filters and types.
55 For better performance its necessary to cache all needed values.
56 @base TransactionBase
58 @devstatus ready to use
59 @threadsafe yes
60 *//*-*************************************************************************************************************/
62 class FilterCache : private TransactionBase
64 public:
66 // public methods
68 public:
70 // constructor / destructor
72 FilterCache( sal_Int32 nVersion = DEFAULT_FILTERCACHE_VERSION,
73 ConfigItemMode nMode = DEFAULT_FILTERCACHE_MODE );
75 /*-****************************************************************************************************
76 @short standard destructor to delete instance
77 @descr This will clear the cache if last owner release it.
78 *//*-*****************************************************************************************************/
80 virtual ~FilterCache();
82 void flush( DataContainer::ECFGType eType );
84 /*-****************************************************************************************************
85 @short get the current state of the cache
86 @descr Call this methods to get information about the state of the current cache.
87 *//*-*****************************************************************************************************/
89 bool isValidOrRepairable() const;
90 bool hasTypes () const;
91 bool hasFilters () const;
92 bool hasDetectors () const;
93 bool hasLoaders () const;
94 bool hasContentHandlers () const;
96 /*-****************************************************************************************************
97 @short search routines to find items which match given parameter
98 @descr Mostly we search for a type first and get all information about filter, detector and loader
99 services from the other configuration tables which are registered for this type.
100 These operations support a FindFirst/Next mechanism.
101 If you call search...( ... nStartEntry=0 ... ) we search for
102 the first entry. If these return a value different from <empty> you can work with these value.
103 If found value isn't the right one - you can call search method again.
104 DONT'T CHANGE THE VALUE OF "rStartEntry" between two search calls!
105 You can use returned value as parameter for getBy...Name() functions of this implementation too!
107 @attention returned type name is an internal name
108 returned filter name is an internal name
109 returned loader name is an implementation name of a service
110 returned detector name is an implementation name of a service
111 @param "sResult", name of found type, filter, ...
112 @return true, if search was successful,
113 false, otherwise.
115 @onerror We return false.
116 *//*-*****************************************************************************************************/
118 bool searchType ( const OUString& sURL ,
119 const OUString& sMediaType ,
120 const OUString& sClipboardFormat ,
121 CheckedTypeIterator& aStartEntry ,
122 OUString& sResult ) const;
124 bool searchFilterForType ( const OUString& sInternalTypeName ,
125 CheckedStringListIterator& aStartEntry ,
126 OUString& sResult ) const;
128 bool searchDetectorForType ( const OUString& sInternalTypeName ,
129 CheckedStringListIterator& aStartEntry ,
130 OUString& sResult ) const;
132 bool searchLoaderForType ( const OUString& sInternalTypeName ,
133 CheckedStringListIterator& aStartEntry ,
134 OUString& sResult ) const;
136 bool searchContentHandlerForType ( const OUString& sInternalTypeName ,
137 CheckedStringListIterator& aStartEntry ,
138 OUString& sResult ) const;
140 /*-****************************************************************************************************
141 @short get all properties of a cache entry by given name
142 @descr If you need additional information about our internal cache values
143 you can use these methods to get a list of all cached config values
144 and subkeys of specified entry.
145 @param "sName", name of suspected entry in cache
146 @return A structure with valid information if item exists! An empty Any otherwise.
148 @onerror We return an empty Any.
149 *//*-*****************************************************************************************************/
151 css::uno::Sequence< OUString > getAllTypeNames () const;
152 css::uno::Sequence< OUString > getAllFilterNames () const;
153 css::uno::Sequence< OUString > getAllDetectorNames () const; // without default detector!
154 css::uno::Sequence< OUString > getAllLoaderNames () const; // without default loader!
155 css::uno::Sequence< OUString > getAllContentHandlerNames () const;
156 css::uno::Sequence< OUString > getAllDetectorNamesWithDefault () const; // default detector is last one!
157 css::uno::Sequence< OUString > getAllLoaderNamesWithDefault () const; // default loader is last one!
158 OUString getDefaultLoader () const;
160 css::uno::Sequence< css::beans::PropertyValue > getTypeProperties ( const OUString& sName ) const;
161 css::uno::Sequence< css::beans::PropertyValue > getFilterProperties ( const OUString& sName ) const;
162 css::uno::Sequence< css::beans::PropertyValue > getDetectorProperties ( const OUString& sName ) const;
163 css::uno::Sequence< css::beans::PropertyValue > getLoaderProperties ( const OUString& sName ) const;
164 css::uno::Sequence< css::beans::PropertyValue > getContentHandlerProperties ( const OUString& sName ) const;
166 FileType getType ( const OUString& sName ) const;
167 Filter getFilter ( const OUString& sName ) const;
168 Detector getDetector ( const OUString& sName ) const;
169 Loader getLoader ( const OUString& sName ) const;
170 ContentHandler getContentHandler ( const OUString& sName ) const;
172 bool existsType ( const OUString& sName ) const;
173 bool existsFilter ( const OUString& sName ) const;
174 bool existsDetector ( const OUString& sName ) const;
175 bool existsLoader ( const OUString& sName ) const;
176 bool existsContentHandler ( const OUString& sName ) const;
178 /*-****************************************************************************************************
179 @short support special query modes
180 @descr Our owner services need sometimes a special mode to query for subsets of our configuration!
181 They give us a special query string - we return right values.
183 @seealso file queries.h
184 @seealso class FilterFactory
185 @seealso class FrameLoaderFactory
186 @seealso class TypeDetection
188 @param "sName", name of query
189 @return A structure with valid information!
191 @onerror We return an empty result set.
192 *//*-*****************************************************************************************************/
194 css::uno::Any queryFilters( const OUString& sQuery ) const;
196 /*-****************************************************************************************************
197 @short support registration of elements in current configuration
198 @descr Use this methods to add or remove items in our configuration files.
199 We use the globale configuration to do that ... in fat office "share/config/registry/..."!
201 *** structure of type properties **********************************************************
203 PropertyValue.Name PropertyValue.Value Description
204 ---------------------------------------------------------------------------------------
207 *** structure of filter properties ********************************************************
209 PropertyValue.Name PropertyValue.Value Description
210 ---------------------------------------------------------------------------------------
211 "Name" [string] internal name
212 "Type" [string] registered for these type
213 "UIName" [string] localized name for UI (valid for current locale at runtime!)
214 "UINames" [stringlist] assignment of all supported localized names to right locales
215 "DocumentService" [string] uno servicename of document services
216 "FilterService" [string] uno servicename of filter implementation
217 "Flags" [long] describe filter
218 "UserData" [stringlist] additional user data (format not fixed!)
219 "FileFormatVersion" [long] version numbher of supported files
220 "TemplateName" [string] name of template
222 *** structure of detector properties ******************************************************
224 PropertyValue.Name PropertyValue.Value Description
225 ---------------------------------------------------------------------------------------
228 *** structure of loader properties ********************************************************
230 PropertyValue.Name PropertyValue.Value Description
231 ---------------------------------------------------------------------------------------
233 @param "sName" , name of type, filter ...
234 @param "lProperties" , values of new type, filter
235 @return state of operation as bool
237 @onerror We return false then.
238 *//*-*****************************************************************************************************/
240 bool addFilter ( const OUString& sName ,
241 const css::uno::Sequence< css::beans::PropertyValue >& lProperties ,
242 bool bException ) throw(css::container::ElementExistException ,
243 css::registry::InvalidRegistryException);
244 bool replaceFilter( const OUString& sName ,
245 const css::uno::Sequence< css::beans::PropertyValue >& lProperties ,
246 bool bException ) throw(css::container::NoSuchElementException ,
247 css::registry::InvalidRegistryException);
248 bool removeFilter ( const OUString& sName ,
249 bool bException ) throw(css::container::NoSuchElementException ,
250 css::registry::InvalidRegistryException);
252 bool addType ( const OUString& sName ,
253 const css::uno::Sequence< css::beans::PropertyValue >& lProperties ,
254 bool bException ) throw(css::container::ElementExistException ,
255 css::registry::InvalidRegistryException);
256 bool replaceType ( const OUString& sName ,
257 const css::uno::Sequence< css::beans::PropertyValue >& lProperties ,
258 bool bException ) throw(css::container::NoSuchElementException ,
259 css::registry::InvalidRegistryException);
260 bool removeType ( const OUString& sName ,
261 bool bException ) throw(css::container::NoSuchElementException ,
262 css::registry::InvalidRegistryException);
264 bool addDetector ( const OUString& sName ,
265 const css::uno::Sequence< css::beans::PropertyValue >& lProperties ,
266 bool bException ) throw(css::container::ElementExistException ,
267 css::registry::InvalidRegistryException);
268 bool replaceDetector( const OUString& sName ,
269 const css::uno::Sequence< css::beans::PropertyValue >& lProperties ,
270 bool bException ) throw(css::container::NoSuchElementException ,
271 css::registry::InvalidRegistryException);
272 bool removeDetector ( const OUString& sName ,
273 bool bException ) throw(css::container::NoSuchElementException ,
274 css::registry::InvalidRegistryException);
276 bool validateAndRepair();
277 bool validateAndRepairTypes();
278 bool validateAndRepairFilter();
279 bool validateAndRepairDetectors();
280 bool validateAndRepairLoader();
281 bool validateAndRepairHandler();
283 // private variables
285 private:
287 static sal_Int32 m_nRefCount;
288 static DataContainer* m_pData;
289 static sal_Int32 m_nVersion;
290 static sal_Int16 m_nMode;
292 }; // class FilterCache
294 } // namespace framework
296 #endif // INCLUDED_FRAMEWORK_INC_CLASSES_FILTERCACHE_HXX
298 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */