bump product version to 4.1.6.2
[LibreOffice.git] / filter / source / config / cache / filtercache.hxx
blob7305c488a477a013002bba199cef69dbc9f1fce9
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 #ifndef __FILTER_CONFIG_FILTERCACHE_HXX_
21 #define __FILTER_CONFIG_FILTERCACHE_HXX_
23 #include "cacheitem.hxx"
24 #include <com/sun/star/uno/Exception.hpp>
25 #include <com/sun/star/util/URL.hpp>
26 #include <com/sun/star/uno/XInterface.hpp>
27 #include <com/sun/star/container/XNameAccess.hpp>
28 #include <com/sun/star/container/XNameContainer.hpp>
29 #include <com/sun/star/container/XNameReplace.hpp>
30 #include <com/sun/star/util/ChangesEvent.hpp>
31 #include <com/sun/star/uno/Reference.h>
32 #include <com/sun/star/uno/Any.h>
33 #include <rtl/ref.hxx>
34 #include <rtl/ustring.hxx>
37 namespace filter{
38 namespace config{
40 class CacheUpdateListener;
43 //_______________________________________________
45 /** @short implements a cache, which contains all
46 elements of our filter and type detection
47 configuration.
49 @descr The cache itself is threadsafe implemented.
50 Because it should be used as a singleton only.
51 To do so please use reference mechanism as wrapper
52 around this FilterCache class.
54 @attention Because we use a trick to get a full initialized
55 mutex lock during initialization time (means during
56 the constructor runs), the base class FilterCacheLock
57 must be the first of all declared one!
58 Further we make it public. So any user of this class
59 can lock us from outside too.
61 class FilterCache : public BaseLock
63 //-------------------------------------------
64 // public types
66 public:
68 //---------------------------------------
70 /** @short identify the type of a container item.
72 @descr Because the cache interface is a generic one
73 every group of container items must be specified.
75 enum EItemType
77 E_TYPE ,
78 E_FILTER ,
79 E_FRAMELOADER ,
80 E_CONTENTHANDLER,
81 E_DETECTSERVICE
84 //---------------------------------------
86 /** @short indicates, which items already exists inside this cache
87 and which not.
89 @descr This cache supports a 2-step load mechanism.
90 First only types (and only some special properties of every type!)
91 but no filters/frame loaders/content handlers will be readed.
92 That should be enough to work with this cache e.g. for loading
93 the first document. After this first document was loaded successfully,
94 a special "load-on-demand-thread" will be started to fill this cache
95 with ALL other information, which was not readed before.
96 Thats the second step. All operations on top of this cache will be
97 blocked then.
99 enum EFillState
101 E_CONTAINS_NOTHING = 0,
102 E_CONTAINS_STANDARD = 1,
103 E_CONTAINS_TYPES = 2,
104 E_CONTAINS_FILTERS = 4,
105 E_CONTAINS_DETECTSERVICES = 8,
106 E_CONTAINS_FRAMELOADERS = 16,
107 E_CONTAINS_CONTENTHANDLERS = 32,
108 E_CONTAINS_ALL = 63 // must be a combination of all excepting E_CONTAINS_NOTHING! Please update if items will be added or removed ...
111 //-------------------------------------------
112 // private types
114 private:
116 //---------------------------------------
117 /** @short regulate, which properties of a configured item
118 will be readed.
120 @descr To perform reading of all configuration items,
121 only standard properties will be handled. At a second
122 step all optional properties will be read and added to
123 our internal structures. Of course the combination of
124 both options can be used too, to get all properties
125 at the same time.
127 enum EReadOption
129 E_READ_NOTHING = 0,
130 E_READ_STANDARD = 1,
131 E_READ_UPDATE = 2,
132 E_READ_ALL = 3
135 //---------------------------------------
136 /** @short indicates the state of a configuration set item.
138 @descr Inside method flush we check:
139 <ul>
140 <li>if the item exists inside config layer but not inside our cache => REMOVED</li>
141 <li>if the item exists inside config layer and inside our cache => CHANGED</li>
142 <li>if the item does not exists inside config layer but inside our cache => ADDED.</li>
143 </ul>
145 enum EItemFlushState
147 /// indicates an unchanged item (can occur e.g. if an item was added and(!) removed before it was flushed ...
148 E_ITEM_UNCHANGED = 0,
149 /// indicates an item, which exists inside config layer but not inside our own cache
150 E_ITEM_REMOVED = 1,
151 /// indicates an item, which exists inside config layer and inside our own cache
152 E_ITEM_CHANGED = 2,
153 /// indicates an item, which does not exists inside config layer but inside our own cache
154 E_ITEM_ADDED = 3
157 //---------------------------------------
158 /** TODO document me */
159 enum EConfigProvider
161 E_PROVIDER_TYPES = 0,
162 E_PROVIDER_FILTERS = 1,
163 E_PROVIDER_OTHERS = 2,
164 E_PROVIDER_OLD = 3
167 //-------------------------------------------
168 // member
170 private:
172 //---------------------------------------
173 /** @short holds the used configuration provider alive, which
174 provides access to the list of types. */
175 mutable css::uno::Reference< css::uno::XInterface > m_xConfigTypes;
177 //---------------------------------------
178 /** @short holds the used configuration provider alive, which
179 provides access to the list of filters. */
180 mutable css::uno::Reference< css::uno::XInterface > m_xConfigFilters;
182 //---------------------------------------
183 /** @short holds the used configuration provider alive, which
184 provides access to the list of other values needed
185 by our type detection framework. */
186 mutable css::uno::Reference< css::uno::XInterface > m_xConfigOthers;
188 //---------------------------------------
189 /** @short contains all loaded types with its properties. */
190 mutable CacheItemList m_lTypes;
192 //---------------------------------------
193 /** @short contains all well known detect service with its properties. */
194 mutable CacheItemList m_lDetectServices;
196 //---------------------------------------
197 /** @short contains all loaded filters with its properties. */
198 mutable CacheItemList m_lFilters;
200 //---------------------------------------
201 /** @short contains all loaded frame loader with its properties. */
202 mutable CacheItemList m_lFrameLoaders;
204 //---------------------------------------
205 /** @short contains all loaded content handler with its properties. */
206 mutable CacheItemList m_lContentHandlers;
208 //---------------------------------------
209 /** @short optimize mapping of URL extensions to a type representation,
210 by using extensions as key and a list of internal
211 type names as value. */
212 mutable CacheItemRegistration m_lExtensions2Types;
214 //---------------------------------------
215 /** @short optimize mapping of URL pattern to a type representation,
216 by using patterns as key and a list of internal
217 type names as value. */
218 mutable CacheItemRegistration m_lURLPattern2Types;
220 //---------------------------------------
221 /** @short contains the current locale of the office and will be
222 used to work with localized configuration values. */
223 OUString m_sActLocale;
225 //---------------------------------------
226 /** TODO */
227 OUString m_sFormatName;
229 //---------------------------------------
230 /** TODO */
231 OUString m_sFormatVersion;
233 //---------------------------------------
234 /** @short contains status, which cache items/properties
235 was already loaded from the underlying configuration.
237 @descr This information can be used to detect missing
238 information and load it on demand.
240 @see EFillState
241 @see load()
243 EFillState m_eFillState;
245 //---------------------------------------
246 /** TODO document me ... */
247 OUStringList m_lChangedTypes;
248 OUStringList m_lChangedFilters;
249 OUStringList m_lChangedDetectServices;
250 OUStringList m_lChangedFrameLoaders;
251 OUStringList m_lChangedContentHandlers;
253 //---------------------------------------
254 /// readonly acccess to the module configuration of OOo
255 css::uno::Reference< css::container::XNameAccess > m_xModuleCfg;
257 rtl::Reference< CacheUpdateListener > m_xTypesChglisteners;
258 rtl::Reference< CacheUpdateListener > m_xFiltersChgListener;
260 //-------------------------------------------
261 // interface
263 public:
265 //---------------------------------------
266 // ctor/dtor
268 /** @short standard ctor
270 @descr Its not allowed to do anything here ...
271 especialy is forbidden to start operations,
272 which needs a FilterCache instance too!
273 Why? Because thie FilterCache instance will be
274 used as a singleton! And if during this ctor any
275 action related to this FilterCache singleton is
276 started ... a race will be the result.
278 The first method after construction of a new
279 singleton reference should be "load()". There
280 a special fill state of this cache can be forced.
282 FilterCache();
284 //---------------------------------------
286 /** @short standard dtor.
288 virtual ~FilterCache();
290 //---------------------------------------
292 /** @short creates a copy of this container.
294 @descr Such copy can be used then to modify items (add/change/remove)
295 without the risk to damage the original container.
296 After its changed data was flushed to the configuration it can be
297 removed.
299 The original container will get these new data automaticly
300 because it listen for changes on the internal used configuration layer.
301 If the new data are needed immediately inside the original container,
302 the method takeOver() can be used to copy all changes back.
303 The may be following notifications of the configuration will be superflous then.
304 But they cant be stopped ...
306 All internal structures will be copied here. But the internal used
307 configuration (update) access wont be copied. The cloned instance contains
308 a different one.
310 @note The cloned instance is created on the heap. The user of this instance
311 has to remove it later.
313 virtual FilterCache* clone() const;
315 //---------------------------------------
317 /** @short copy the cache content or rClone back to this instance.
319 virtual void takeOver(const FilterCache& rClone);
321 //---------------------------------------
323 /** @short force special fill state of this cache.
325 @descr This method check if all requested items/properties already
326 exists. Only missing information will be readed.
327 Otherwise this method does nothing!
329 This method must be called from every user of this cache
330 everytimes it need a filled cache. Normaly we load
331 only standard information into this cache on startup.
332 After a few seconds we start a special thread, which
333 may fill this cache completely. But if somehwere outside
334 need a filled cache before ... it can run into trouble,
335 if this "load-on-demand" thread does not finished its work before.
336 This method "load(xxx)" synchronize such load-on-demand requests.
338 Of course it would be possible to supress this special load thread
339 in general and start it manualy inside this load() request.
340 The outside code decide then, if and when this cache will be filled
341 with all available information ...
343 @param bByThread
344 indicates using of this method by our global "load-on-demand-thread".
345 Its an implementation detail! We use it to check, if this "load()"
346 request was forced e.g. by one of our derived service container (which need
347 it to full fill its own operations) or if it was forced by our own
348 "load-on-demand-thread", which tries to optimize our startup performance
349 and start this load() only in case the office startup was already finished!
351 @throw An exception if the cache could not be filled realy
352 or seems to be invalid afterwards. But there is no reaction
353 at all if this method does nothing inside, because the cache
354 is already full filled!
356 virtual void load(EFillState eRequired ,
357 sal_Bool bByThread = sal_False)
358 throw(css::uno::Exception);
360 //---------------------------------------
362 /** @short return the current fill state of this cache.
364 @descr This information can be used e.g. to start
365 a search on top of this cache with a minimum on
366 information ... and do it again, if some other
367 cache items seems to be available after calling of "loadAll()"
368 on this cache and first search does not had any valid results.
370 @return sal_True if the required fill state exists for this cache; FALSE
371 otherwise.
373 virtual sal_Bool isFillState(EFillState eRequired) const
374 throw(css::uno::Exception);
376 //---------------------------------------
378 /** @short return a list of key names for items, which match
379 the specified criteria.
381 @descr The returned key names can be used at another method "getItem()"
382 of this cache to get further information about this item.
384 @attention Please note: because this cache can be used inside multithreaded
385 environments, such returned key name can point to an already removed
386 item! Please be aware of some "NoSuchElementExceptions" if you try to
387 call any other method of this cache in relation to this key name.
389 @param eType
390 specify the sub container of this cache, which should be used for
391 searching. see also EItemType.
393 @param lIProps
394 specify the property set, which must exist at the searched items
395 as minimum.
397 @param lEProps
398 specify the property set, which must not(!) exist at the searched items
399 as minimum.
401 @return [OUStringList]
402 a list of key names, which identify items of the queried sub container.
403 May be an empty list.
405 @throw [css::uno::Exception]
406 if some input parameter are wrong or the cache itself is not valid
407 any longer, because any operation before damage it.
409 virtual OUStringList getMatchingItemsByProps( EItemType eType ,
410 const CacheItem& lIProps ,
411 const CacheItem& lEProps = CacheItem()) const
412 throw(css::uno::Exception);
414 //---------------------------------------
416 /** @short indicates if the requested sub container
417 contains some items.
419 @descr We dont provide any information about the count
420 of such items. Because we dont implement any index
421 based interface! The information "we have items or not"
422 must be enough for the outside code ... till somewhere
423 give us a good reason. :-)
425 @param eType
426 specify the sub container of this cache, which should be used.
427 see also EItemType.
429 @return [sal_Bool]
430 True, if the requested sub container contains some items;
431 False otherwise.
433 @throw [css::uno::Exception]
434 if some input parameter are wrong or the cache itself is not valid
435 any longer, because any operation before damage it.
437 virtual sal_Bool hasItems(EItemType eType) const
438 throw(css::uno::Exception);
440 //---------------------------------------
442 /** @short return a list of all key names, which represent
443 an item inside the specified sub container.
445 @attention Please note: because this cache can be used inside multithreaded
446 environments, such returned key names can point to some already removed
447 items! Please be aware of some "NoSuchElementExceptions" if you try to
448 call any other method of this cache in relation to this key names.
450 @param eType
451 specify the sub container of this cache, which should be used for
452 searching. see also EItemType.
454 @return [OUStringList]
455 a list of key names, which can be used to access the item properties
456 using some other methods of this cache.
458 @throw [css::uno::Exception]
459 if some input parameter are wrong or the cache itself is not valid
460 any longer, because any operation before damage it.
462 virtual OUStringList getItemNames(EItemType eType) const
463 throw(css::uno::Exception);
465 //---------------------------------------
467 /** @short check if the required item exist inside this container.
469 @attention This method exists to supports some UNO container interfaces
470 only. (e.g. XNameAccess.hasByName()). But inside multithreaded
471 environments there is no guarantee, that this item still exists, if
472 its realy requested e.g. by calling getItem()!
473 Be aware of some NoSuchElementExistExceptions ...
475 @param eType
476 specify the sub container of this cache, which should be used.
477 see also EItemType.
479 @param sItem
480 the key name of the requested item inside the pecified sub container.
482 @throw [css::uno::Exception]
483 if some input parameter are wrong or the cache itself is not valid
484 any longer, because any operation before damage it.
486 virtual sal_Bool hasItem( EItemType eType,
487 const OUString& sItem)
488 throw(css::uno::Exception);
490 //---------------------------------------
492 /** @short return an item, which match the specified type and name.
494 @descr Because this cache can be used inside multithreaded environments
495 the caller must be aware of some exceptions - especialy a "NoSuchElementExcepotion".
496 May another thread already removed the required item before ...
498 @param eType
499 specify the sub container of this cache, which should be used for
500 searching. see also EItemType.
502 @param sItem
503 specify the requested item by its key name.
505 @return [CacheItem]
506 the required item if it could be located ...
507 But we throw an exception if the required item does not exist!
509 @throw [css::container::NoSuchElementException]
510 if the required item does not still exist.
512 @throw [css::uno::Exception]
513 if some input parameter are wrong or the cache itself is not valid
514 any longer, because any operation before damage it.
516 virtual CacheItem getItem( EItemType eType,
517 const OUString& sItem)
518 throw(css::uno::Exception);
520 //---------------------------------------
522 /** TODO document me ...
524 virtual void removeItem( EItemType eType,
525 const OUString& sItem)
526 throw(css::uno::Exception);
528 //---------------------------------------
530 /** TODO document me ...
532 virtual void setItem( EItemType eType ,
533 const OUString& sItem ,
534 const CacheItem& aValue)
535 throw(css::uno::Exception);
537 //---------------------------------------
539 /** TODO document me ...
541 virtual void refreshItem( EItemType eType,
542 const OUString& sItem)
543 throw(css::uno::Exception);
545 //---------------------------------------
547 /** @short add some implicit properties to the given
548 cache item reference.
550 @descr Such properties can e.g. finalized or mandatory.
551 They are not persistent and not realy part of e.g. a
552 filter not. But they are attributes of a configuration
553 entry and can influence our container interface.
555 @attention These properties are not part of the normal CacheItem
556 returned by the method getItem(). Because getItem() is
557 used internaly too but these specialized properties
558 are needed at our container services only. So these
559 function sets are different to allow different handling.
561 @param eType
562 specify the sub container of this cache, which should be used for
563 searching. see also EItemType.
565 @param sItem
566 specify the requested item by its key name.
568 @param rItem
569 contains already the normal properties of this item,
570 and will be used as out parameter to add the implicit
571 attributes there.
573 @throw [css::uno::Exception]
574 if an internal error occurred.
575 Note: If the item is missing inside the underlying configuration
576 no exception will be thrown. In such case the item is marked as
577 finalized/mandatory automaticly
578 Reason: May be the item cames from the old configuration package and
579 was not migrated to the new one. So we cant provide write access
580 to such items ...
582 virtual void addStatePropsToItem( EItemType eType,
583 const OUString& sItem,
584 CacheItem& rItem)
585 throw(css::uno::Exception);
587 //---------------------------------------
589 /** TODO document me
591 virtual void removeStatePropsFromItem(CacheItem& aValue)
592 throw(css::uno::Exception);
594 //---------------------------------------
596 /** @short force writing of all changes (which was made after
597 last flush was called) back to the configuration.
599 @descr TODO
601 @throw [css::uno::Exception]
602 if the cache itself is not valid
603 any longer, because any operation before damage it.
605 virtual void flush()
606 throw(css::uno::Exception);
608 //---------------------------------------
610 /** @short supports a flat type detection for given URL.
612 @descr Because such detection works on our optimized internal
613 structures (e.g. mapping from extensions/pattern to type names),
614 it should be made inside this cache.
616 @param aURL
617 URL of the content, which type should be detected.
618 Its already parsed and splitted into its different parts,
619 like e.g.: main, jump marks etcpp.
621 @param rFlatTypes
622 used as [out] parameter to add all types, which match to the given
623 URL. Further an information is added for every type. It indicates, how
624 this type is related to the specified URL (means e.g. if it matches
625 by extension or URLPattern ...).
627 @attention Please note: because this cache can be used inside multithreaded
628 environments, such returned key names can point to some already removed
629 items! Please be aware of some "NoSuchElementExceptions" if you try to
630 call any other method of this cache in relation to this key names.
632 @throw [css::uno::Exception]
633 if the cache itself is not valid
634 any longer, because any operation before damage it.
636 virtual void detectFlatForURL(const css::util::URL& aURL ,
637 FlatDetection& rFlatTypes) const
638 throw(css::uno::Exception);
640 //-------------------------------------------
641 // private helper
643 private:
645 //---------------------------------------
647 /** @short return a reference to one of our internal
648 sub container, which contains items of the
649 requested type.
651 @param eType
652 specify, which sub container is needed outside.
654 @return [CacheItemList&]
655 a reference(!) to the right sub container member.
657 @throw [css::uno::Exception]
658 if the required list does not exist.
660 const CacheItemList& impl_getItemList(EItemType eType) const;
662 CacheItemList& impl_getItemList(EItemType eType);
664 //---------------------------------------
666 /** @short return a valid configuration update access
667 to the underlying configuration package, which
668 is fix for this cache.
670 @descr It checks first, if the internal member m_xConfig already
671 points to an open update access. If not - it opens a new one.
672 Doing so this method can be called everytimes a configuration
673 access is needed.
675 @param eProvider
676 specify the needed configuration provider.
677 see EConfigProvider for further information ...
679 @attention If a configuration access was opened successfully
680 all neccessary listener connections will be established
681 too. So this cache will be informed about outside updates.
683 css::uno::Reference< css::uno::XInterface > impl_openConfig(EConfigProvider eProvide)
684 throw(css::uno::Exception);
686 //---------------------------------------
688 /** @short tries to open the requested configuration root
689 using the specified modi.
691 @param sRoot
692 specify the configuration root, which should be opened.
694 @param bReadOnly
695 enable/disable write access on the returned configuration
696 object.
698 @param bLocalesMode
699 enable/disable special handling of localized configuratiom
700 items by the returned configuration object.
702 @return A valid reference, if the configuration access could be opened
703 and initialized within the requested modes successfully;
704 a NULL reference otherwise.
706 css::uno::Reference< css::uno::XInterface > impl_createConfigAccess(const OUString& sRoot ,
707 sal_Bool bReadOnly ,
708 sal_Bool bLocalesMode);
710 //---------------------------------------
712 /** @short reads the specified configuration key
713 and return its value.
715 @descr The specified key must be an absolute configuration path,
716 which can be splitted into its package and relative path tokens.
718 @attention Because this function might opens a new configuration
719 read access for reading one key value only, it should
720 be used in rare cases only. Its an easy way ... but an
721 expensive one.
723 @param sDirectKey
724 the absolute configuration path, which should be readed.
726 @return [css::uno::Any]
727 the value of the requested key.
728 Can be empty if an internal error occurred or if the requested
729 key does not exists!
731 css::uno::Any impl_getDirectCFGValue(const OUString& sDirectKey);
733 //---------------------------------------
735 /** @short load the underlying configuration into this cache.
737 @descr Which items should be readed can be regulate by the
738 parameter eRequiredState. That provides the possibility
739 to load standard values on startup only and update this
740 cache later on demand with all available information.
742 @param eRequiredState
743 indicates, which fill state this cache should have afterwards.
745 void impl_load(EFillState eRequiredState)
746 throw(css::uno::Exception);
748 //---------------------------------------
750 /** @short validate the whole cache and create
751 structures for optimized items access.
753 @descr Wrong cache items will be removed automaticly.
754 Wrong dependencies will be corrected automaticly.
755 If something could not be repaired - an exception
756 is thrown.
757 Further some optmized structures will be created.
758 E.g.: a hash to map extensions to her types.
760 @attention There is no exception, if the cache could be repaired
761 but contained wrong elements before!
763 @throw [css::uno::Exception]
764 if cache is invalid and could not be repaired.
766 void impl_validateAndOptimize()
767 throw(css::uno::Exception);
769 //---------------------------------------
771 /** @short register the specified item for the given type.
773 @descr Because detect services, frame loader or content handler
774 are not listed inside the xml configuration as separated
775 items (they are properties of any type entry!), this method update
776 the internal lists of such items. Thats neccessary to have
777 it accessible for our container interfaces of detect, frame loader
778 and content handler services.
780 @param pList
781 points to a CacheItemList of this filter cache, where
782 this item registration should be updated or added.
784 @param sItem
785 specify the detect service, frame loader or content handler,
786 which should be registered for the given type.
788 @param sType
789 contains the internal type name, where the item should be registered for.
791 @throw [css::uno::Exception]
792 If registration failed by any reason.
793 That does not include double registrations!
795 void impl_resolveItem4TypeRegistration( CacheItemList* pList,
796 const OUString& sItem,
797 const OUString& sType)
798 throw(css::uno::Exception);
800 //-------------------------------------------
801 // static helper
803 private:
805 //---------------------------------------
807 /** @short read the specified config set into the cache.
809 @descr This method provides the following mechanism for reading:
810 a) read only standard properties of set items
811 b) read anything
812 c) read only optional properties and update already existing
813 items of the specified cache
815 @param xConfig
816 API which provides access to the required configuration set.
818 @param eType
819 specify the type of config item, which must be interpreted.
820 Of course this information can be used to locate the right set
821 at the given xConfig API object.
823 @param eOption
824 regulate reading of standard/optional or all properties.
826 @param pCache
827 points to the cache member, which should be filled or updated.
829 @throw [css::uno::Exception]
830 if an unrecoverable error occurs inside this operation.
832 void impl_loadSet(const css::uno::Reference< css::container::XNameAccess >& xConfig,
833 EItemType eType ,
834 EReadOption eOption,
835 CacheItemList* pCache )
836 throw(css::uno::Exception);
838 //---------------------------------------
840 /** @short read the specified container item from the given configuration set.
842 @descr Its not added to any internal structures here. That must be done
843 outside this method.
845 @param xSet
846 provides access to the configuration set, which includes all items.
848 @param eType
849 specify, which container item type must be readed.
851 @param sItem
852 means the internal name, which can be used to address the item
853 properties relative to the given configuration set.
855 @param eOption
856 regulate, which properties of the requested item should be read.
857 See defintion of EReadOption for further information.
859 @throw [css::uno::Exception]
860 if an unrecoverable error occurs inside this operation.
862 CacheItem impl_loadItem(const css::uno::Reference< css::container::XNameAccess >& xSet ,
863 EItemType eType ,
864 const OUString& sItem ,
865 EReadOption eOption)
866 throw(css::uno::Exception);
868 //---------------------------------------
870 /** @short try to load the requested item on demand from the underlying configuration
871 layer.
873 @descr The outside code has to be shure, that the item does not already exists
874 inside this cachse. Otherwise it will be loaded twice. This method
875 doesnt check such constellations!
877 @param eType
878 specify the type of config item, which must be interpreted.
879 Of course this information can be used to locate the right set
880 at the given xConfig API object.
882 @param sItem
883 the set node name of the requested item.
885 @return An iterator, which points directly to the new cached item.
886 Is a valid iterator if no exception occurred here!
887 But to improve robustness - it should be checked :-)
889 @throw [css::container::NoSuchElementException]
890 if the item does not exists inside the configuration layer too!
892 @throw [css::uno::Exception]
893 if an unrecoverable error occurs inside this operation.
895 CacheItemList::iterator impl_loadItemOnDemand( EItemType eType,
896 const OUString& sItem)
897 throw(css::uno::Exception);
899 //---------------------------------------
901 /** TODO */
902 void impl_saveItem(const css::uno::Reference< css::container::XNameReplace >& xSet ,
903 EItemType eType ,
904 const CacheItem& aValue)
905 throw(css::uno::Exception);
907 //---------------------------------------
909 /** TODO */
910 void impl_addItem2FlushList( EItemType eType,
911 const OUString& sItem)
912 throw(css::uno::Exception);
915 //---------------------------------------
917 /** TODO */
918 void impl_flushByList(const css::uno::Reference< css::container::XNameAccess >& xSet ,
919 EItemType eType ,
920 const CacheItemList& rCache,
921 const OUStringList& lItems)
922 throw(css::uno::Exception);
924 //---------------------------------------
926 /** @short specify, which save operation is neccessary for the specified item.
928 @desrc If an item of this cache will be added/removed or modified it will
929 be changed inside memory only first. But we save its name inside a special
930 list of changed items. If at least the method flush() is called, we use
931 this list to check if the item was changed/added or removed. This method
932 checks the exist state of the requested item inside our own cache
933 and inside the underlying configuration layer to find out, if the item
934 must be removed/added or modified inside the configuratuion layer.
936 @param xSet
937 points directly to the configuration set, where the item should resist
938 (if it exists!).
940 @param rList
941 points to our internal cache list, where the item should resist
942 (if it exists!).
944 @param sItem
945 the internal name of the item, which should be checked.
947 @return An enum value of type EItemFlushState, which indicates the needed
948 API operation for updating the underlying configuration layer.
950 @throws An exception if anything failed inside this operation.
951 e.g. the given configuration set was not open.
953 EItemFlushState impl_specifyFlushOperation(const css::uno::Reference< css::container::XNameAccess >& xSet ,
954 const CacheItemList& rList,
955 const OUString& sItem)
956 throw(css::uno::Exception);
958 //---------------------------------------
960 /** TODO */
961 void impl_readPatchUINames(const css::uno::Reference< css::container::XNameAccess >& xNode,
962 CacheItem& rItem)
963 throw(css::uno::Exception);
965 //---------------------------------------
967 /** TODO */
968 void impl_savePatchUINames(const css::uno::Reference< css::container::XNameReplace >& xNode,
969 const CacheItem& rItem)
970 throw(css::uno::Exception);
972 //---------------------------------------
974 /** TODO */
975 void impl_readOldFormat()
976 throw(css::uno::Exception);
978 //---------------------------------------
980 /** TODO */
981 CacheItem impl_readOldItem(const css::uno::Reference< css::container::XNameAccess >& xSet ,
982 EItemType eType,
983 const OUString& sItem)
984 throw(css::uno::Exception);
986 //---------------------------------------
988 /** TODO */
989 void impl_interpretDataVal4Type(const OUString& sValue,
990 sal_Int32 nProp ,
991 CacheItem& rItem );
993 //---------------------------------------
995 /** TODO */
996 void impl_interpretDataVal4Filter(const OUString& sValue,
997 sal_Int32 nProp ,
998 CacheItem& rItem );
1000 //---------------------------------------
1002 /** TODO */
1003 OUStringList impl_tokenizeString(const OUString& sData ,
1004 sal_Unicode cSeparator);
1006 //---------------------------------------
1008 #if OSL_DEBUG_LEVEL > 0
1009 /** TODO */
1010 OUString impl_searchFrameLoaderForType(const OUString& sType) const;
1011 OUString impl_searchContentHandlerForType(const OUString& sType) const;
1012 #endif
1014 //---------------------------------------
1015 /** @short check if the specified OOo module is installed.
1017 @param sModule
1018 the long name of the module (e.g. "com.sun.star.text.TextDocument").
1020 @return sal_True if the requested module is installed; sal_False otherwise.
1022 sal_Bool impl_isModuleInstalled(const OUString& sModule);
1024 //---------------------------------------
1026 /** @short convert a list of flag names to its int representation.
1028 @param lNames
1029 the list of flag names.
1031 @return [sal_Int32]
1032 the converted flag field.
1034 static sal_Int32 impl_convertFlagNames2FlagField(const css::uno::Sequence< OUString >& lNames);
1036 //---------------------------------------
1038 /** @short convert a flag field value to its list representation of flag names.
1040 @param nFlags
1041 the flag field value
1043 @return [seq< string >]
1044 the converted flag name list.
1046 static css::uno::Sequence< OUString > impl_convertFlagField2FlagNames(sal_Int32 nFlags);
1049 } // namespace config
1050 } // namespace filter
1052 #endif // __FILTER_CONFIG_FILTERCACHE_HXX_
1054 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */