1*9e0fc027SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*9e0fc027SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*9e0fc027SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*9e0fc027SAndrew Rist * distributed with this work for additional information
6*9e0fc027SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*9e0fc027SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*9e0fc027SAndrew Rist * "License"); you may not use this file except in compliance
9*9e0fc027SAndrew Rist * with the License. You may obtain a copy of the License at
10*9e0fc027SAndrew Rist *
11*9e0fc027SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*9e0fc027SAndrew Rist *
13*9e0fc027SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*9e0fc027SAndrew Rist * software distributed under the License is distributed on an
15*9e0fc027SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9e0fc027SAndrew Rist * KIND, either express or implied. See the License for the
17*9e0fc027SAndrew Rist * specific language governing permissions and limitations
18*9e0fc027SAndrew Rist * under the License.
19*9e0fc027SAndrew Rist *
20*9e0fc027SAndrew Rist *************************************************************/
21*9e0fc027SAndrew Rist
22*9e0fc027SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_filter.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "cacheitem.hxx"
28cdf0e10cSrcweir #include "macros.hxx"
29cdf0e10cSrcweir #include "constant.hxx"
30cdf0e10cSrcweir
31cdf0e10cSrcweir //_______________________________________________
32cdf0e10cSrcweir // includes
33cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
34cdf0e10cSrcweir
35cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_Hpp_
36cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir
39cdf0e10cSrcweir //_______________________________________________
40cdf0e10cSrcweir // namespace
41cdf0e10cSrcweir
42cdf0e10cSrcweir namespace filter{
43cdf0e10cSrcweir namespace config{
44cdf0e10cSrcweir
45cdf0e10cSrcweir namespace css = ::com::sun::star;
46cdf0e10cSrcweir
47cdf0e10cSrcweir //_______________________________________________
48cdf0e10cSrcweir // definitions
49cdf0e10cSrcweir
50cdf0e10cSrcweir /*-----------------------------------------------
51cdf0e10cSrcweir 04.11.2003 09:27
52cdf0e10cSrcweir -----------------------------------------------*/
CacheItem()53cdf0e10cSrcweir CacheItem::CacheItem()
54cdf0e10cSrcweir : SequenceAsHashMap()
55cdf0e10cSrcweir {
56cdf0e10cSrcweir }
57cdf0e10cSrcweir
58cdf0e10cSrcweir /*-----------------------------------------------
59cdf0e10cSrcweir 26.06.2003 11:37
60cdf0e10cSrcweir -----------------------------------------------*/
update(const CacheItem & rUpdateItem)61cdf0e10cSrcweir void CacheItem::update(const CacheItem& rUpdateItem)
62cdf0e10cSrcweir {
63cdf0e10cSrcweir for(const_iterator pItUpdate = rUpdateItem.begin();
64cdf0e10cSrcweir pItUpdate != rUpdateItem.end() ;
65cdf0e10cSrcweir ++pItUpdate )
66cdf0e10cSrcweir {
67cdf0e10cSrcweir iterator pItThis = this->find(pItUpdate->first);
68cdf0e10cSrcweir if (pItThis == this->end())
69cdf0e10cSrcweir (*this)[pItUpdate->first] = pItUpdate->second; // add new prop
70cdf0e10cSrcweir else
71cdf0e10cSrcweir pItThis->second = pItUpdate->second; // change value of existing prop
72cdf0e10cSrcweir }
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
75cdf0e10cSrcweir /*-----------------------------------------------
76cdf0e10cSrcweir 26.11.2003 13:27
77cdf0e10cSrcweir -----------------------------------------------*/
validateUINames(const::rtl::OUString & sActLocale)78cdf0e10cSrcweir void CacheItem::validateUINames(const ::rtl::OUString& sActLocale)
79cdf0e10cSrcweir {
80cdf0e10cSrcweir if (!sActLocale.getLength())
81cdf0e10cSrcweir return;
82cdf0e10cSrcweir
83cdf0e10cSrcweir // 1) check UINames first
84cdf0e10cSrcweir const_iterator pUINames = find(PROPNAME_UINAMES);
85cdf0e10cSrcweir const_iterator pUIName = find(PROPNAME_UINAME );
86cdf0e10cSrcweir
87cdf0e10cSrcweir ::comphelper::SequenceAsHashMap lUINames;
88cdf0e10cSrcweir if (pUINames != end())
89cdf0e10cSrcweir lUINames << pUINames->second;
90cdf0e10cSrcweir
91cdf0e10cSrcweir ::rtl::OUString sUIName;
92cdf0e10cSrcweir if (pUIName != end())
93cdf0e10cSrcweir pUIName->second >>= sUIName;
94cdf0e10cSrcweir
95cdf0e10cSrcweir if (sUIName.getLength())
96cdf0e10cSrcweir {
97cdf0e10cSrcweir // 1a) set UIName inside list of UINames for current locale
98cdf0e10cSrcweir lUINames[sActLocale] <<= sUIName;
99cdf0e10cSrcweir }
100cdf0e10cSrcweir else if (lUINames.size()>0)
101cdf0e10cSrcweir {
102cdf0e10cSrcweir // 1b) or get it from this list, if it not exist!
103cdf0e10cSrcweir lUINames[sActLocale] >>= sUIName;
104cdf0e10cSrcweir }
105cdf0e10cSrcweir
106cdf0e10cSrcweir (*this)[PROPNAME_UINAMES] <<= lUINames.getAsConstPropertyValueList();
107cdf0e10cSrcweir (*this)[PROPNAME_UINAME ] <<= sUIName;
108cdf0e10cSrcweir }
109cdf0e10cSrcweir
110cdf0e10cSrcweir /*-----------------------------------------------
111cdf0e10cSrcweir 12.01.2004 13:32
112cdf0e10cSrcweir -----------------------------------------------*/
getAsPackedPropertyValueList()113cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > CacheItem::getAsPackedPropertyValueList()
114cdf0e10cSrcweir {
115cdf0e10cSrcweir sal_Int32 c = (sal_Int32)size();
116cdf0e10cSrcweir sal_Int32 i = 0;
117cdf0e10cSrcweir
118cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > lList(c);
119cdf0e10cSrcweir css::beans::PropertyValue* pList = lList.getArray();
120cdf0e10cSrcweir
121cdf0e10cSrcweir for (const_iterator pProp = begin();
122cdf0e10cSrcweir pProp != end() ;
123cdf0e10cSrcweir ++pProp )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir const ::rtl::OUString& rName = pProp->first;
126cdf0e10cSrcweir const css::uno::Any& rValue = pProp->second;
127cdf0e10cSrcweir
128cdf0e10cSrcweir if (!rValue.hasValue())
129cdf0e10cSrcweir continue;
130cdf0e10cSrcweir
131cdf0e10cSrcweir pList[i].Name = rName ;
132cdf0e10cSrcweir pList[i].Value = rValue;
133cdf0e10cSrcweir ++i;
134cdf0e10cSrcweir }
135cdf0e10cSrcweir lList.realloc(i);
136cdf0e10cSrcweir
137cdf0e10cSrcweir return lList;
138cdf0e10cSrcweir }
139cdf0e10cSrcweir
140cdf0e10cSrcweir /*-----------------------------------------------
141cdf0e10cSrcweir 17.07.2003 08:27
142cdf0e10cSrcweir -----------------------------------------------*/
isSubSet(const css::uno::Any & aSubSet,const css::uno::Any & aSet)143cdf0e10cSrcweir sal_Bool isSubSet(const css::uno::Any& aSubSet,
144cdf0e10cSrcweir const css::uno::Any& aSet )
145cdf0e10cSrcweir {
146cdf0e10cSrcweir css::uno::Type aT1 = aSubSet.getValueType();
147cdf0e10cSrcweir css::uno::Type aT2 = aSet.getValueType();
148cdf0e10cSrcweir
149cdf0e10cSrcweir if (!aT1.equals(aT2))
150cdf0e10cSrcweir {
151cdf0e10cSrcweir _FILTER_CONFIG_LOG_("isSubSet() ... types of any values are different => return FALSE\n")
152cdf0e10cSrcweir return sal_False;
153cdf0e10cSrcweir }
154cdf0e10cSrcweir
155cdf0e10cSrcweir css::uno::TypeClass aTypeClass = aT1.getTypeClass();
156cdf0e10cSrcweir switch(aTypeClass)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir //---------------------------------------
159cdf0e10cSrcweir case css::uno::TypeClass_BOOLEAN :
160cdf0e10cSrcweir case css::uno::TypeClass_BYTE :
161cdf0e10cSrcweir case css::uno::TypeClass_SHORT :
162cdf0e10cSrcweir case css::uno::TypeClass_UNSIGNED_SHORT :
163cdf0e10cSrcweir case css::uno::TypeClass_LONG :
164cdf0e10cSrcweir case css::uno::TypeClass_UNSIGNED_LONG :
165cdf0e10cSrcweir case css::uno::TypeClass_HYPER :
166cdf0e10cSrcweir case css::uno::TypeClass_UNSIGNED_HYPER :
167cdf0e10cSrcweir case css::uno::TypeClass_FLOAT :
168cdf0e10cSrcweir case css::uno::TypeClass_DOUBLE :
169cdf0e10cSrcweir {
170cdf0e10cSrcweir sal_Bool bIs = (aSubSet == aSet);
171cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for atomic types => return %s\n", bIs ? "TRUE" : "FALSE")
172cdf0e10cSrcweir return bIs;
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
175cdf0e10cSrcweir //---------------------------------------
176cdf0e10cSrcweir case css::uno::TypeClass_STRING :
177cdf0e10cSrcweir {
178cdf0e10cSrcweir ::rtl::OUString v1;
179cdf0e10cSrcweir ::rtl::OUString v2;
180cdf0e10cSrcweir
181cdf0e10cSrcweir if (
182cdf0e10cSrcweir (aSubSet >>= v1) &&
183cdf0e10cSrcweir (aSet >>= v2)
184cdf0e10cSrcweir )
185cdf0e10cSrcweir {
186cdf0e10cSrcweir sal_Bool bIs = (v1.equals(v2));
187cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for string types => return %s\n", bIs ? "TRUE" : "FALSE")
188cdf0e10cSrcweir return bIs;
189cdf0e10cSrcweir }
190cdf0e10cSrcweir }
191cdf0e10cSrcweir break;
192cdf0e10cSrcweir
193cdf0e10cSrcweir //---------------------------------------
194cdf0e10cSrcweir case css::uno::TypeClass_ANY :
195cdf0e10cSrcweir {
196cdf0e10cSrcweir css::uno::Any v1;
197cdf0e10cSrcweir css::uno::Any v2;
198cdf0e10cSrcweir
199cdf0e10cSrcweir if (
200cdf0e10cSrcweir (aSubSet >>= v1) &&
201cdf0e10cSrcweir (aSet >>= v2)
202cdf0e10cSrcweir )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir sal_Bool bIs = (isSubSet(v1, v2));
205cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for packed any types => return %s\n", bIs ? "TRUE" : "FALSE")
206cdf0e10cSrcweir return bIs;
207cdf0e10cSrcweir }
208cdf0e10cSrcweir }
209cdf0e10cSrcweir break;
210cdf0e10cSrcweir
211cdf0e10cSrcweir //---------------------------------------
212cdf0e10cSrcweir case css::uno::TypeClass_STRUCT :
213cdf0e10cSrcweir {
214cdf0e10cSrcweir css::beans::PropertyValue p1;
215cdf0e10cSrcweir css::beans::PropertyValue p2;
216cdf0e10cSrcweir
217cdf0e10cSrcweir if (
218cdf0e10cSrcweir (aSubSet >>= p1) &&
219cdf0e10cSrcweir (aSet >>= p2)
220cdf0e10cSrcweir )
221cdf0e10cSrcweir {
222cdf0e10cSrcweir sal_Bool bIs = (
223cdf0e10cSrcweir (p1.Name.equals(p2.Name) ) &&
224cdf0e10cSrcweir (isSubSet(p1.Value, p2.Value))
225cdf0e10cSrcweir );
226cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for structured types [PropertyValue] => return %s\n", bIs ? "TRUE" : "FALSE")
227cdf0e10cSrcweir return bIs;
228cdf0e10cSrcweir }
229cdf0e10cSrcweir
230cdf0e10cSrcweir css::beans::NamedValue n1;
231cdf0e10cSrcweir css::beans::NamedValue n2;
232cdf0e10cSrcweir
233cdf0e10cSrcweir if (
234cdf0e10cSrcweir (aSubSet >>= n1) &&
235cdf0e10cSrcweir (aSet >>= n2)
236cdf0e10cSrcweir )
237cdf0e10cSrcweir {
238cdf0e10cSrcweir sal_Bool bIs = (
239cdf0e10cSrcweir (n1.Name.equals(n2.Name) ) &&
240cdf0e10cSrcweir (isSubSet(n1.Value, n2.Value))
241cdf0e10cSrcweir );
242cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for structured types [NamedValue] => return %s\n", bIs ? "TRUE" : "FALSE")
243cdf0e10cSrcweir return bIs;
244cdf0e10cSrcweir }
245cdf0e10cSrcweir }
246cdf0e10cSrcweir break;
247cdf0e10cSrcweir
248cdf0e10cSrcweir //---------------------------------------
249cdf0e10cSrcweir case css::uno::TypeClass_SEQUENCE :
250cdf0e10cSrcweir {
251cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > uno_s1;
252cdf0e10cSrcweir css::uno::Sequence< ::rtl::OUString > uno_s2;
253cdf0e10cSrcweir
254cdf0e10cSrcweir if (
255cdf0e10cSrcweir (aSubSet >>= uno_s1) &&
256cdf0e10cSrcweir (aSet >>= uno_s2)
257cdf0e10cSrcweir )
258cdf0e10cSrcweir {
259cdf0e10cSrcweir OUStringList stl_s1(uno_s1);
260cdf0e10cSrcweir OUStringList stl_s2(uno_s2);
261cdf0e10cSrcweir
262cdf0e10cSrcweir for (OUStringList::const_iterator it1 = stl_s1.begin();
263cdf0e10cSrcweir it1 != stl_s1.end() ;
264cdf0e10cSrcweir ++it1 )
265cdf0e10cSrcweir {
266cdf0e10cSrcweir if (::std::find(stl_s2.begin(), stl_s2.end(), *it1) == stl_s2.end())
267cdf0e10cSrcweir {
268cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [OUString] ... dont found \"%s\" => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(*it1))
269cdf0e10cSrcweir return sal_False;
270cdf0e10cSrcweir }
271cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [OUString] ... found \"%s\" => continue loop\n", _FILTER_CONFIG_TO_ASCII_(*it1))
272cdf0e10cSrcweir }
273cdf0e10cSrcweir _FILTER_CONFIG_LOG_("isSubSet() ... check for list types [OUString] => return TRUE\n")
274cdf0e10cSrcweir return sal_True;
275cdf0e10cSrcweir }
276cdf0e10cSrcweir
277cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > uno_p1;
278cdf0e10cSrcweir css::uno::Sequence< css::beans::PropertyValue > uno_p2;
279cdf0e10cSrcweir
280cdf0e10cSrcweir if (
281cdf0e10cSrcweir (aSubSet >>= uno_p1) &&
282cdf0e10cSrcweir (aSet >>= uno_p2)
283cdf0e10cSrcweir )
284cdf0e10cSrcweir {
285cdf0e10cSrcweir ::comphelper::SequenceAsHashMap stl_p1(uno_p1);
286cdf0e10cSrcweir ::comphelper::SequenceAsHashMap stl_p2(uno_p2);
287cdf0e10cSrcweir
288cdf0e10cSrcweir for (::comphelper::SequenceAsHashMap::const_iterator it1 = stl_p1.begin();
289cdf0e10cSrcweir it1 != stl_p1.end() ;
290cdf0e10cSrcweir ++it1 )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_p2.find(it1->first);
293cdf0e10cSrcweir if (it2 == stl_p2.end())
294cdf0e10cSrcweir {
295cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [PropertyValue] ... dont found \"%s\" => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
296cdf0e10cSrcweir return sal_False;
297cdf0e10cSrcweir }
298cdf0e10cSrcweir if (!isSubSet(it1->second, it2->second))
299cdf0e10cSrcweir {
300cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [PropertyValue] ... found \"%s\" but has different value => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
301cdf0e10cSrcweir return sal_False;
302cdf0e10cSrcweir }
303cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [PropertyValue] ... found \"%s\" with right value => continue loop\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
304cdf0e10cSrcweir }
305cdf0e10cSrcweir _FILTER_CONFIG_LOG_("isSubSet() ... check for list types [PropertyValue] => return TRUE\n")
306cdf0e10cSrcweir return sal_True;
307cdf0e10cSrcweir }
308cdf0e10cSrcweir
309cdf0e10cSrcweir css::uno::Sequence< css::beans::NamedValue > uno_n1;
310cdf0e10cSrcweir css::uno::Sequence< css::beans::NamedValue > uno_n2;
311cdf0e10cSrcweir
312cdf0e10cSrcweir if (
313cdf0e10cSrcweir (aSubSet >>= uno_n1) &&
314cdf0e10cSrcweir (aSet >>= uno_n2)
315cdf0e10cSrcweir )
316cdf0e10cSrcweir {
317cdf0e10cSrcweir ::comphelper::SequenceAsHashMap stl_n1(uno_n1);
318cdf0e10cSrcweir ::comphelper::SequenceAsHashMap stl_n2(uno_n2);
319cdf0e10cSrcweir
320cdf0e10cSrcweir for (::comphelper::SequenceAsHashMap::const_iterator it1 = stl_n1.begin();
321cdf0e10cSrcweir it1 != stl_n1.end() ;
322cdf0e10cSrcweir ++it1 )
323cdf0e10cSrcweir {
324cdf0e10cSrcweir ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_n2.find(it1->first);
325cdf0e10cSrcweir if (it2 == stl_n2.end())
326cdf0e10cSrcweir {
327cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [NamedValue] ... dont found \"%s\" => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
328cdf0e10cSrcweir return sal_False;
329cdf0e10cSrcweir }
330cdf0e10cSrcweir if (!isSubSet(it1->second, it2->second))
331cdf0e10cSrcweir {
332cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [NamedValue] ... found \"%s\" but has different value => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
333cdf0e10cSrcweir return sal_False;
334cdf0e10cSrcweir }
335cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("isSubSet() ... check for list types [NamedValue] ... found \"%s\" with right value => continue loop\n", _FILTER_CONFIG_TO_ASCII_(it1->first))
336cdf0e10cSrcweir }
337cdf0e10cSrcweir _FILTER_CONFIG_LOG_("isSubSet() ... check for list types [NamedValue] => return TRUE\n")
338cdf0e10cSrcweir return sal_True;
339cdf0e10cSrcweir }
340cdf0e10cSrcweir }
341cdf0e10cSrcweir break;
342cdf0e10cSrcweir /*
343cdf0e10cSrcweir case css::uno::TypeClass_CHAR :
344cdf0e10cSrcweir case css::uno::TypeClass_VOID :
345cdf0e10cSrcweir case css::uno::TypeClass_TYPE :
346cdf0e10cSrcweir case css::uno::TypeClass_ENUM :
347cdf0e10cSrcweir case css::uno::TypeClass_TYPEDEF :
348cdf0e10cSrcweir case css::uno::TypeClass_UNION :
349cdf0e10cSrcweir case css::uno::TypeClass_EXCEPTION :
350cdf0e10cSrcweir case css::uno::TypeClass_ARRAY :
351cdf0e10cSrcweir case css::uno::TypeClass_INTERFACE :
352cdf0e10cSrcweir case css::uno::TypeClass_SERVICE :
353cdf0e10cSrcweir case css::uno::TypeClass_MODULE :
354cdf0e10cSrcweir case css::uno::TypeClass_INTERFACE_METHOD :
355cdf0e10cSrcweir case css::uno::TypeClass_INTERFACE_ATTRIBUTE :
356cdf0e10cSrcweir case css::uno::TypeClass_UNKNOWN :
357cdf0e10cSrcweir case css::uno::TypeClass_PROPERTY :
358cdf0e10cSrcweir case css::uno::TypeClass_CONSTANT :
359cdf0e10cSrcweir case css::uno::TypeClass_CONSTANTS :
360cdf0e10cSrcweir case css::uno::TypeClass_SINGLETON :
361cdf0e10cSrcweir */
362cdf0e10cSrcweir default: break;
363cdf0e10cSrcweir }
364cdf0e10cSrcweir
365cdf0e10cSrcweir OSL_ENSURE(sal_False, "isSubSet() ... this point should not be reached!");
366cdf0e10cSrcweir return sal_False;
367cdf0e10cSrcweir }
368cdf0e10cSrcweir
369cdf0e10cSrcweir /*-----------------------------------------------
370cdf0e10cSrcweir 14.07.2003 10:24
371cdf0e10cSrcweir -----------------------------------------------*/
haveProps(const CacheItem & lProps) const372cdf0e10cSrcweir sal_Bool CacheItem::haveProps(const CacheItem& lProps) const
373cdf0e10cSrcweir {
374cdf0e10cSrcweir for (const_iterator pIt = lProps.begin();
375cdf0e10cSrcweir pIt != lProps.end() ;
376cdf0e10cSrcweir ++pIt )
377cdf0e10cSrcweir {
378cdf0e10cSrcweir // i) one required property does not exist at this item => return false
379cdf0e10cSrcweir const_iterator pItThis = this->find(pIt->first);
380cdf0e10cSrcweir if (pItThis == this->end())
381cdf0e10cSrcweir {
382cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("CacheItem::haveProps() ... dont found \"%s\" => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(pIt->first))
383cdf0e10cSrcweir return sal_False;
384cdf0e10cSrcweir }
385cdf0e10cSrcweir
386cdf0e10cSrcweir // ii) one item does not have the right value => return false
387cdf0e10cSrcweir if (!isSubSet(pIt->second, pItThis->second))
388cdf0e10cSrcweir {
389cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("CacheItem::haveProps() ... item \"%s\" has different value => return FALSE\n", _FILTER_CONFIG_TO_ASCII_(pIt->first))
390cdf0e10cSrcweir return sal_False;
391cdf0e10cSrcweir }
392cdf0e10cSrcweir }
393cdf0e10cSrcweir
394cdf0e10cSrcweir // this method was not breaked before =>
395cdf0e10cSrcweir // the given property set seems to match with our
396cdf0e10cSrcweir // own properties in its minimum => return TRUE
397cdf0e10cSrcweir _FILTER_CONFIG_LOG_("CacheItem::haveProps() ... => return TRUE\n")
398cdf0e10cSrcweir return sal_True;
399cdf0e10cSrcweir }
400cdf0e10cSrcweir
401cdf0e10cSrcweir /*-----------------------------------------------
402cdf0e10cSrcweir 14.07.2003 10:43
403cdf0e10cSrcweir -----------------------------------------------*/
dontHaveProps(const CacheItem & lProps) const404cdf0e10cSrcweir sal_Bool CacheItem::dontHaveProps(const CacheItem& lProps) const
405cdf0e10cSrcweir {
406cdf0e10cSrcweir for (const_iterator pIt = lProps.begin();
407cdf0e10cSrcweir pIt != lProps.end() ;
408cdf0e10cSrcweir ++pIt )
409cdf0e10cSrcweir {
410cdf0e10cSrcweir // i) one item does not exists in general
411cdf0e10cSrcweir // => continue with next one, because
412cdf0e10cSrcweir // "excluding" means ... "dont have it".
413cdf0e10cSrcweir // And "not exists" match to "dont have it".
414cdf0e10cSrcweir const_iterator pItThis = this->find(pIt->first);
415cdf0e10cSrcweir if (pItThis == this->end())
416cdf0e10cSrcweir {
417cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("CacheItem::dontHaveProps() ... not found \"%s\" => continue loop!\n", _FILTER_CONFIG_TO_ASCII_(pIt->first))
418cdf0e10cSrcweir continue;
419cdf0e10cSrcweir }
420cdf0e10cSrcweir
421cdf0e10cSrcweir // ii) one item have the right value => return false
422cdf0e10cSrcweir // because this item has the requested property ...
423cdf0e10cSrcweir // But we checked for "dont have it" here.
424cdf0e10cSrcweir if (isSubSet(pIt->second, pItThis->second))
425cdf0e10cSrcweir {
426cdf0e10cSrcweir _FILTER_CONFIG_LOG_1_("CacheItem::dontHaveProps() ... item \"%s\" has same value => return FALSE!\n", _FILTER_CONFIG_TO_ASCII_(pIt->first))
427cdf0e10cSrcweir return sal_False;
428cdf0e10cSrcweir }
429cdf0e10cSrcweir }
430cdf0e10cSrcweir
431cdf0e10cSrcweir // this method was not breaked before =>
432cdf0e10cSrcweir // That means: this item has no matching property
433cdf0e10cSrcweir // of the given set. It "dont have" it ... => return true.
434cdf0e10cSrcweir _FILTER_CONFIG_LOG_("CacheItem::dontHaveProps() ... => return TRUE\n")
435cdf0e10cSrcweir return sal_True;
436cdf0e10cSrcweir }
437cdf0e10cSrcweir
438cdf0e10cSrcweir } // namespace config
439cdf0e10cSrcweir } // namespace filter
440