Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "sal/config.h"
30 : :
31 : : #include <officecfg/Office/Common.hxx>
32 : : #include <sax/tools/converter.hxx>
33 : :
34 : : #include <com/sun/star/util/PathSubstitution.hpp>
35 : : #include <com/sun/star/util/XStringSubstitution.hpp>
36 : : #include <xmloff/DocumentSettingsContext.hxx>
37 : : #include <xmloff/xmlimp.hxx>
38 : : #include <xmloff/xmltoken.hxx>
39 : : #include "xmloff/xmlnmspe.hxx"
40 : : #include <xmloff/nmspmap.hxx>
41 : : #include <xmloff/xmluconv.hxx>
42 : : #include <tools/debug.hxx>
43 : : #include <comphelper/componentcontext.hxx>
44 : :
45 : : #include <list>
46 : : #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
47 : : #include <com/sun/star/container/XIndexContainer.hpp>
48 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
49 : : #include <com/sun/star/formula/SymbolDescriptor.hpp>
50 : : #include <com/sun/star/util/DateTime.hpp>
51 : : #include <com/sun/star/document/XViewDataSupplier.hpp>
52 : : #include <com/sun/star/document/PrinterIndependentLayout.hpp>
53 : : #include <rtl/ustrbuf.hxx>
54 : : #include <xmlenums.hxx>
55 : :
56 : : using namespace com::sun::star;
57 : : using namespace ::xmloff::token;
58 : :
59 : : class XMLMyList
60 : : {
61 : : std::list<beans::PropertyValue> aProps;
62 : : sal_uInt32 nCount;
63 : :
64 : : // #110680#
65 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
66 : :
67 : : public:
68 : : // #110680#
69 : : XMLMyList(const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory);
70 : : ~XMLMyList();
71 : :
72 : 14124 : void push_back(beans::PropertyValue& aProp) { aProps.push_back(aProp); nCount++; }
73 : : uno::Sequence<beans::PropertyValue> GetSequence();
74 : : uno::Reference<container::XNameContainer> GetNameContainer();
75 : : uno::Reference<container::XIndexContainer> GetIndexContainer();
76 : : };
77 : :
78 : : // #110680#
79 : 933 : XMLMyList::XMLMyList(const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory)
80 : : : nCount(0),
81 : 933 : mxServiceFactory(xServiceFactory)
82 : : {
83 : : DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
84 : 933 : }
85 : :
86 : : // #110680#
87 : 933 : XMLMyList::~XMLMyList()
88 : : {
89 : 933 : }
90 : :
91 : 671 : uno::Sequence<beans::PropertyValue> XMLMyList::GetSequence()
92 : : {
93 : 671 : uno::Sequence<beans::PropertyValue> aSeq;
94 [ + - ]: 671 : if(nCount)
95 : : {
96 : : DBG_ASSERT(nCount == aProps.size(), "wrong count of PropertyValue");
97 [ + - ]: 671 : aSeq.realloc(nCount);
98 [ + - ]: 671 : beans::PropertyValue* pProps = aSeq.getArray();
99 : 671 : std::list<beans::PropertyValue>::iterator aItr = aProps.begin();
100 [ + + ]: 14458 : while (aItr != aProps.end())
101 : : {
102 : 13787 : *pProps = *aItr;
103 : 13787 : ++pProps;
104 : 13787 : ++aItr;
105 : : }
106 : : }
107 : 671 : return aSeq;
108 : : }
109 : :
110 : 93 : uno::Reference<container::XNameContainer> XMLMyList::GetNameContainer()
111 : : {
112 : 93 : uno::Reference<container::XNameContainer> xNameContainer;
113 : :
114 : : // #110680#
115 : :
116 [ + - ]: 93 : if( mxServiceFactory.is() )
117 : : {
118 [ + - ]: 93 : rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.NamedPropertyValues"));
119 [ + - ][ + - ]: 93 : xNameContainer = uno::Reference<container::XNameContainer>(mxServiceFactory->createInstance(sName), uno::UNO_QUERY);
[ + - ][ + - ]
120 [ + - ]: 93 : if (xNameContainer.is())
121 : : {
122 : 93 : std::list<beans::PropertyValue>::iterator aItr = aProps.begin();
123 [ + + ]: 258 : while (aItr != aProps.end())
124 : : {
125 [ + - ][ + - ]: 165 : xNameContainer->insertByName(aItr->Name, aItr->Value);
126 : 165 : ++aItr;
127 : : }
128 : 93 : }
129 : : }
130 : 93 : return xNameContainer;
131 : : }
132 : :
133 : 169 : uno::Reference<container::XIndexContainer> XMLMyList::GetIndexContainer()
134 : : {
135 : 169 : uno::Reference<container::XIndexContainer> xIndexContainer;
136 : : // #110680#
137 : :
138 [ + - ]: 169 : if( mxServiceFactory.is() )
139 : : {
140 [ + - ]: 169 : rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues"));
141 [ + - ][ + - ]: 169 : xIndexContainer = uno::Reference<container::XIndexContainer>(mxServiceFactory->createInstance(sName), uno::UNO_QUERY);
[ + - ][ + - ]
142 [ + - ]: 169 : if (xIndexContainer.is())
143 : : {
144 : 169 : std::list<beans::PropertyValue>::iterator aItr = aProps.begin();
145 : 169 : sal_uInt32 i(0);
146 [ + + ]: 341 : while (aItr != aProps.end())
147 : : {
148 [ + - ][ + - ]: 172 : xIndexContainer->insertByIndex(i, aItr->Value);
149 : 172 : ++aItr;
150 : 172 : ++i;
151 : : }
152 : 169 : }
153 : : }
154 : 169 : return xIndexContainer;
155 : : }
156 : :
157 : : //=============================================================================
158 : :
159 : : class XMLConfigBaseContext : public SvXMLImportContext
160 : : {
161 : : protected:
162 : : XMLMyList maProps;
163 : : beans::PropertyValue maProp;
164 : : com::sun::star::uno::Any& mrAny;
165 : : XMLConfigBaseContext* mpBaseContext;
166 : : public:
167 : : XMLConfigBaseContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
168 : : com::sun::star::uno::Any& rAny,
169 : : XMLConfigBaseContext* pBaseContext);
170 : : virtual ~XMLConfigBaseContext();
171 : :
172 : 14124 : void AddPropertyValue() { maProps.push_back(maProp); }
173 : : };
174 : :
175 : : //=============================================================================
176 : :
177 : : class XMLConfigItemContext : public SvXMLImportContext
178 : : {
179 : : rtl::OUString msType;
180 : : rtl::OUString msValue;
181 : : uno::Sequence<sal_Int8> maDecoded;
182 : : com::sun::star::uno::Any& mrAny;
183 : : const rtl::OUString mrItemName;
184 : : XMLConfigBaseContext* mpBaseContext;
185 : :
186 : : public:
187 : : XMLConfigItemContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
188 : : const ::com::sun::star::uno::Reference<
189 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
190 : : com::sun::star::uno::Any& rAny,
191 : : const rtl::OUString& rItemName,
192 : : XMLConfigBaseContext* pBaseContext);
193 : : virtual ~XMLConfigItemContext();
194 : :
195 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
196 : : const rtl::OUString& rLocalName,
197 : : const ::com::sun::star::uno::Reference<
198 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
199 : : virtual void Characters( const ::rtl::OUString& rChars );
200 : :
201 : : virtual void EndElement();
202 : :
203 : : virtual void ManipulateConfigItem();
204 : : };
205 : :
206 : : //=============================================================================
207 : :
208 : : class XMLConfigItemSetContext : public XMLConfigBaseContext
209 : : {
210 : : public:
211 : : XMLConfigItemSetContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
212 : : const ::com::sun::star::uno::Reference<
213 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
214 : : com::sun::star::uno::Any& rAny,
215 : : XMLConfigBaseContext* pBaseContext);
216 : : virtual ~XMLConfigItemSetContext();
217 : :
218 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
219 : : const rtl::OUString& rLocalName,
220 : : const ::com::sun::star::uno::Reference<
221 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
222 : :
223 : : virtual void EndElement();
224 : : };
225 : :
226 : : //=============================================================================
227 : :
228 : : class XMLConfigItemMapNamedContext : public XMLConfigBaseContext
229 : : {
230 : : public:
231 : : XMLConfigItemMapNamedContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
232 : : const ::com::sun::star::uno::Reference<
233 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
234 : : com::sun::star::uno::Any& rAny,
235 : : XMLConfigBaseContext* pBaseContext);
236 : : virtual ~XMLConfigItemMapNamedContext();
237 : :
238 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
239 : : const rtl::OUString& rLocalName,
240 : : const ::com::sun::star::uno::Reference<
241 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
242 : :
243 : : virtual void EndElement();
244 : : };
245 : :
246 : : //=============================================================================
247 : :
248 : : class XMLConfigItemMapIndexedContext : public XMLConfigBaseContext
249 : : {
250 : : private:
251 : : rtl::OUString maConfigItemName;
252 : :
253 : : public:
254 : : XMLConfigItemMapIndexedContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
255 : : const rtl::OUString& rLName,
256 : : const ::com::sun::star::uno::Reference<
257 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
258 : : com::sun::star::uno::Any& rAny,
259 : : const rtl::OUString& rConfigItemName,
260 : : XMLConfigBaseContext* pBaseContext);
261 : : virtual ~XMLConfigItemMapIndexedContext();
262 : :
263 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
264 : : const rtl::OUString& rLocalName,
265 : : const ::com::sun::star::uno::Reference<
266 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
267 : :
268 : : virtual void EndElement();
269 : : };
270 : :
271 : : //=============================================================================
272 : :
273 : 14124 : SvXMLImportContext *CreateSettingsContext(SvXMLImport& rImport, sal_uInt16 p_nPrefix,
274 : : const rtl::OUString& rLocalName,
275 : : const uno::Reference<xml::sax::XAttributeList>& xAttrList,
276 : : beans::PropertyValue& rProp, XMLConfigBaseContext* pBaseContext)
277 : : {
278 : 14124 : SvXMLImportContext *pContext = 0;
279 : :
280 : 14124 : rProp.Name = rtl::OUString();
281 [ + - ]: 14124 : sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
282 [ + + ]: 41601 : for( sal_Int16 i=0; i < nAttrCount; i++ )
283 : : {
284 [ + - ][ + - ]: 27477 : rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
285 : 27477 : rtl::OUString aLocalName;
286 : 27477 : sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(
287 [ + - ]: 27477 : sAttrName, &aLocalName );
288 [ + - ][ + - ]: 27477 : rtl::OUString sValue = xAttrList->getValueByIndex( i );
289 : :
290 [ + - ]: 27477 : if (nPrefix == XML_NAMESPACE_CONFIG)
291 : : {
292 [ + - ][ + + ]: 27477 : if (IsXMLToken(aLocalName, XML_NAME))
293 : 13952 : rProp.Name = sValue;
294 : : }
295 : 27477 : }
296 : :
297 [ + - ]: 14124 : if (p_nPrefix == XML_NAMESPACE_CONFIG)
298 : : {
299 [ + + ]: 14124 : if (IsXMLToken(rLocalName, XML_CONFIG_ITEM))
300 [ + - ]: 13525 : pContext = new XMLConfigItemContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, rProp.Name, pBaseContext);
301 [ + - + + ]: 1198 : else if((IsXMLToken(rLocalName, XML_CONFIG_ITEM_SET)) ||
[ + + ]
302 : 599 : (IsXMLToken(rLocalName, XML_CONFIG_ITEM_MAP_ENTRY)) )
303 [ + - ]: 337 : pContext = new XMLConfigItemSetContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, pBaseContext);
304 [ + + ]: 262 : else if(IsXMLToken(rLocalName, XML_CONFIG_ITEM_MAP_NAMED))
305 [ + - ]: 93 : pContext = new XMLConfigItemMapNamedContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, pBaseContext);
306 [ + - ]: 169 : else if(IsXMLToken(rLocalName, XML_CONFIG_ITEM_MAP_INDEXED))
307 [ + - ]: 169 : pContext = new XMLConfigItemMapIndexedContext(rImport, p_nPrefix, rLocalName, xAttrList, rProp.Value, rProp.Name, pBaseContext);
308 : : }
309 : :
310 [ - + ]: 14124 : if( !pContext )
311 [ # # ]: 0 : pContext = new SvXMLImportContext( rImport, p_nPrefix, rLocalName );
312 : :
313 : 14124 : return pContext;
314 : : }
315 : :
316 : : //=============================================================================
317 : : namespace
318 : : {
319 : 0 : struct SettingsGroup
320 : : {
321 : : ::rtl::OUString sGroupName;
322 : : uno::Any aSettings;
323 : :
324 : : SettingsGroup()
325 : : :sGroupName()
326 : : ,aSettings()
327 : : {
328 : : }
329 : :
330 : 0 : SettingsGroup( const ::rtl::OUString& _rGroupName, const uno::Any& _rSettings )
331 : : :sGroupName( _rGroupName )
332 : 0 : ,aSettings( _rSettings )
333 : : {
334 : 0 : }
335 : : };
336 : : }
337 : :
338 [ + - ]: 334 : struct XMLDocumentSettingsContext_Data
339 : : {
340 : : com::sun::star::uno::Any aViewProps;
341 : : com::sun::star::uno::Any aConfigProps;
342 : : ::std::list< SettingsGroup > aDocSpecificSettings;
343 : : };
344 : :
345 : : //=============================================================================
346 : :
347 : 167 : XMLDocumentSettingsContext::XMLDocumentSettingsContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
348 : : const uno::Reference<xml::sax::XAttributeList>& )
349 : : : SvXMLImportContext( rImport, nPrfx, rLName )
350 [ + - ][ + - ]: 167 : , m_pData( new XMLDocumentSettingsContext_Data )
351 : : {
352 : : // here are no attributes
353 : 167 : }
354 : :
355 : 167 : XMLDocumentSettingsContext::~XMLDocumentSettingsContext()
356 : : {
357 [ - + ]: 334 : }
358 : :
359 : 334 : SvXMLImportContext *XMLDocumentSettingsContext::CreateChildContext( sal_uInt16 p_nPrefix,
360 : : const rtl::OUString& rLocalName,
361 : : const ::com::sun::star::uno::Reference<
362 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
363 : : {
364 : 334 : SvXMLImportContext *pContext = 0;
365 : 334 : rtl::OUString sName;
366 : :
367 [ + - ][ + - ]: 334 : sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
[ + - ]
368 [ + + ]: 668 : for( sal_Int16 i=0; i < nAttrCount; i++ )
369 : : {
370 [ + - ][ + - ]: 334 : rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
371 : 334 : rtl::OUString aLocalName;
372 : 334 : sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
373 [ + - ]: 334 : sAttrName, &aLocalName );
374 [ + - ][ + - ]: 334 : rtl::OUString sValue = xAttrList->getValueByIndex( i );
375 : :
376 [ + - ]: 334 : if (nPrefix == XML_NAMESPACE_CONFIG)
377 : : {
378 [ + - ][ + - ]: 334 : if (IsXMLToken(aLocalName, XML_NAME))
379 : 334 : sName = sValue;
380 : : }
381 : 334 : }
382 : :
383 [ + - ]: 334 : if (p_nPrefix == XML_NAMESPACE_CONFIG)
384 : : {
385 [ + - ][ + - ]: 334 : if (IsXMLToken(rLocalName, XML_CONFIG_ITEM_SET))
386 : : {
387 : 334 : ::rtl::OUString aLocalConfigName;
388 : : sal_uInt16 nConfigPrefix =
389 : 334 : GetImport().GetNamespaceMap().GetKeyByAttrName(
390 [ + - ]: 334 : sName, &aLocalConfigName );
391 : :
392 [ + - ]: 334 : if( XML_NAMESPACE_OOO == nConfigPrefix )
393 : : {
394 [ + - ][ + + ]: 334 : if (IsXMLToken(aLocalConfigName, XML_VIEW_SETTINGS))
395 : 167 : pContext = new XMLConfigItemSetContext(GetImport(),
396 : : p_nPrefix, rLocalName, xAttrList,
397 [ + - ][ + - ]: 167 : m_pData->aViewProps, NULL);
398 [ + - ]: 167 : else if (IsXMLToken(aLocalConfigName,
399 [ + - ]: 167 : XML_CONFIGURATION_SETTINGS))
400 : 167 : pContext = new XMLConfigItemSetContext(GetImport(),
401 : : p_nPrefix, rLocalName, xAttrList,
402 [ + - ][ + - ]: 167 : m_pData->aConfigProps, NULL);
403 : : else
404 : : {
405 [ # # ]: 0 : m_pData->aDocSpecificSettings.push_back( SettingsGroup( aLocalConfigName, uno::Any() ) );
406 : :
407 : : ::std::list< SettingsGroup >::reverse_iterator settingsPos =
408 : 0 : m_pData->aDocSpecificSettings.rbegin();
409 : :
410 : 0 : pContext = new XMLConfigItemSetContext(GetImport(),
411 : : p_nPrefix, rLocalName, xAttrList,
412 [ # # ][ # # ]: 0 : settingsPos->aSettings, NULL);
[ # # ]
413 : : }
414 : 334 : }
415 : : }
416 : : }
417 : :
418 [ - + ]: 334 : if( !pContext )
419 [ # # ][ # # ]: 0 : pContext = new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName );
420 : :
421 : 334 : return pContext;
422 : : }
423 : :
424 : 167 : void XMLDocumentSettingsContext::EndElement()
425 : : {
426 [ + - ]: 167 : uno::Sequence<beans::PropertyValue> aSeqViewProps;
427 [ + - ][ + - ]: 167 : if (m_pData->aViewProps >>= aSeqViewProps)
428 : : {
429 [ + - ]: 167 : GetImport().SetViewSettings(aSeqViewProps);
430 : 167 : sal_Int32 i(aSeqViewProps.getLength() - 1);
431 : 167 : sal_Bool bFound(sal_False);
432 [ + + ][ + + ]: 374 : while((i >= 0) && !bFound)
[ + + ]
433 : : {
434 [ + - ][ + + ]: 207 : if (aSeqViewProps[i].Name.compareToAscii("Views") == 0)
435 : : {
436 : 159 : bFound = sal_True;
437 : 159 : uno::Reference<container::XIndexAccess> xIndexAccess;
438 [ + - ][ + - ]: 159 : if (aSeqViewProps[i].Value >>= xIndexAccess)
[ + - ]
439 : : {
440 [ + - ]: 159 : uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetImport().GetModel(), uno::UNO_QUERY);
441 [ + - ]: 159 : if (xViewDataSupplier.is())
442 [ + - ][ + - ]: 159 : xViewDataSupplier->setViewData(xIndexAccess);
443 : 159 : }
444 : : }
445 : : else
446 : 48 : i--;
447 : : }
448 : : }
449 : :
450 [ + - ]: 167 : uno::Sequence<beans::PropertyValue> aSeqConfigProps;
451 [ + - ][ + - ]: 167 : if ( m_pData->aConfigProps >>= aSeqConfigProps )
452 : : {
453 [ - + ]: 167 : if (!officecfg::Office::Common::Save::Document::LoadPrinter::get())
454 : : {
455 : 0 : sal_Int32 i = aSeqConfigProps.getLength() - 1;
456 : 0 : int nFound = 0;
457 : :
458 [ # # ][ # # ]: 0 : while ( ( i >= 0 ) && nFound < 2 )
[ # # ]
459 : : {
460 [ # # ]: 0 : rtl::OUString sProp( aSeqConfigProps[i].Name );
461 : :
462 [ # # ]: 0 : if ( sProp.compareToAscii("PrinterName") == 0 )
463 : : {
464 : 0 : rtl::OUString sEmpty;
465 [ # # ][ # # ]: 0 : aSeqConfigProps[i].Value = uno::makeAny( sEmpty );
466 : 0 : nFound++;
467 : : }
468 [ # # ]: 0 : else if ( sProp.compareToAscii("PrinterSetup") == 0 )
469 : : {
470 [ # # ]: 0 : uno::Sequence< sal_Int8 > aEmpty;
471 [ # # ][ # # ]: 0 : aSeqConfigProps[i].Value = uno::makeAny( aEmpty );
472 [ # # ]: 0 : nFound++;
473 : : }
474 : :
475 : 0 : i--;
476 : 0 : }
477 : : }
478 : :
479 [ + - ]: 167 : GetImport().SetConfigurationSettings( aSeqConfigProps );
480 : : }
481 : :
482 [ - + ]: 334 : for ( ::std::list< SettingsGroup >::const_iterator settings = m_pData->aDocSpecificSettings.begin();
483 : 167 : settings != m_pData->aDocSpecificSettings.end();
484 : : ++settings
485 : : )
486 : : {
487 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aDocSettings;
488 [ # # ]: 0 : OSL_VERIFY( settings->aSettings >>= aDocSettings );
489 [ # # ]: 0 : GetImport().SetDocumentSpecificSettings( settings->sGroupName, aDocSettings );
490 [ # # ][ + - ]: 167 : }
[ + - ]
491 : 167 : }
492 : :
493 : : //=============================================================================
494 : :
495 : 933 : XMLConfigBaseContext::XMLConfigBaseContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
496 : : const rtl::OUString& rLName, com::sun::star::uno::Any& rTempAny,
497 : : XMLConfigBaseContext* pTempBaseContext)
498 : : : SvXMLImportContext( rImport, nPrfx, rLName ),
499 : : // #110680#
500 : : maProps(rImport.getServiceFactory()),
501 : : maProp(),
502 : : mrAny(rTempAny),
503 [ + - ][ + - ]: 933 : mpBaseContext(pTempBaseContext)
504 : : {
505 : 933 : }
506 : :
507 [ + - ]: 933 : XMLConfigBaseContext::~XMLConfigBaseContext()
508 : : {
509 [ - + ]: 933 : }
510 : :
511 : : //=============================================================================
512 : :
513 : 671 : XMLConfigItemSetContext::XMLConfigItemSetContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
514 : : const rtl::OUString& rLName,
515 : : const ::com::sun::star::uno::Reference<
516 : : ::com::sun::star::xml::sax::XAttributeList>&,
517 : : com::sun::star::uno::Any& rAny,
518 : : XMLConfigBaseContext* pBaseContext)
519 : 671 : : XMLConfigBaseContext( rImport, nPrfx, rLName, rAny, pBaseContext )
520 : : {
521 : : // here are no attributes
522 : 671 : }
523 : :
524 : 671 : XMLConfigItemSetContext::~XMLConfigItemSetContext()
525 : : {
526 [ - + ]: 1342 : }
527 : :
528 : 13787 : SvXMLImportContext *XMLConfigItemSetContext::CreateChildContext( sal_uInt16 nPrefix,
529 : : const rtl::OUString& rLocalName,
530 : : const ::com::sun::star::uno::Reference<
531 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
532 : : {
533 : 13787 : return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this);
534 : : }
535 : :
536 : 671 : void XMLConfigItemSetContext::EndElement()
537 : : {
538 [ + - ]: 671 : mrAny <<= maProps.GetSequence();
539 [ + + ]: 671 : if (mpBaseContext)
540 : 337 : mpBaseContext->AddPropertyValue();
541 : 671 : }
542 : :
543 : : //=============================================================================
544 : :
545 : 13525 : XMLConfigItemContext::XMLConfigItemContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
546 : : const ::com::sun::star::uno::Reference<
547 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
548 : : com::sun::star::uno::Any& rTempAny,
549 : : const rtl::OUString& rTempItemName,
550 : : XMLConfigBaseContext* pTempBaseContext)
551 : : : SvXMLImportContext(rImport, nPrfx, rLName),
552 : : mrAny(rTempAny),
553 : : mrItemName(rTempItemName),
554 [ + - ]: 13525 : mpBaseContext(pTempBaseContext)
555 : : {
556 [ + - ][ + - ]: 13525 : sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
[ + - ]
557 [ + + ]: 40575 : for( sal_Int16 i=0; i < nAttrCount; i++ )
558 : : {
559 [ + - ][ + - ]: 27050 : rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
560 : 27050 : rtl::OUString aLocalName;
561 : 27050 : sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
562 [ + - ]: 27050 : sAttrName, &aLocalName );
563 [ + - ][ + - ]: 27050 : rtl::OUString sValue = xAttrList->getValueByIndex( i );
564 : :
565 [ + - ]: 27050 : if (nPrefix == XML_NAMESPACE_CONFIG)
566 : : {
567 [ + - ][ + + ]: 27050 : if (IsXMLToken(aLocalName, XML_TYPE))
568 : 13525 : msType = sValue;
569 : : }
570 : 27050 : }
571 : 13525 : }
572 : :
573 [ + - ]: 13525 : XMLConfigItemContext::~XMLConfigItemContext()
574 : : {
575 [ - + ]: 27050 : }
576 : :
577 : 0 : SvXMLImportContext *XMLConfigItemContext::CreateChildContext( sal_uInt16 nPrefix,
578 : : const rtl::OUString& rLocalName,
579 : : const ::com::sun::star::uno::Reference<
580 : : ::com::sun::star::xml::sax::XAttributeList>& )
581 : : {
582 [ # # ]: 0 : SvXMLImportContext* pContext = new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
583 : 0 : return pContext;
584 : : }
585 : :
586 : 12946 : void XMLConfigItemContext::Characters( const ::rtl::OUString& rChars )
587 : : {
588 [ + + ]: 12946 : if (IsXMLToken(msType, XML_BASE64BINARY))
589 : : {
590 : 44 : rtl::OUString sTrimmedChars( rChars.trim() );
591 [ + - ]: 44 : if( !sTrimmedChars.isEmpty() )
592 : : {
593 : 44 : rtl::OUString sChars;
594 [ - + ]: 44 : if( !msValue.isEmpty() )
595 : : {
596 : 0 : sChars = msValue;
597 : 0 : sChars += sTrimmedChars;
598 : 0 : msValue = rtl::OUString();
599 : : }
600 : : else
601 : : {
602 : 44 : sChars = sTrimmedChars;
603 : : }
604 [ + - ]: 44 : uno::Sequence<sal_Int8> aBuffer((sChars.getLength() / 4) * 3 );
605 : : sal_Int32 const nCharsDecoded =
606 [ + - ]: 44 : ::sax::Converter::decodeBase64SomeChars( aBuffer, sChars );
607 : 44 : sal_uInt32 nStartPos(maDecoded.getLength());
608 : 44 : sal_uInt32 nCount(aBuffer.getLength());
609 [ + - ]: 44 : maDecoded.realloc(nStartPos + nCount);
610 [ + - ]: 44 : sal_Int8* pDecoded = maDecoded.getArray();
611 [ + - ]: 44 : sal_Int8* pBuffer = aBuffer.getArray();
612 [ + + ]: 11649 : for (sal_uInt32 i = 0; i < nCount; i++, pBuffer++)
613 : 11605 : pDecoded[nStartPos + i] = *pBuffer;
614 [ - + ]: 44 : if( nCharsDecoded != sChars.getLength() )
615 [ + - ]: 44 : msValue = sChars.copy( nCharsDecoded );
616 : 44 : }
617 : : }
618 : : else
619 : 12902 : msValue += rChars;
620 : 12946 : }
621 : :
622 : :
623 : 13525 : void XMLConfigItemContext::EndElement()
624 : : {
625 [ + - ]: 13525 : if (mpBaseContext)
626 : : {
627 [ + + ]: 13525 : if (IsXMLToken(msType, XML_BOOLEAN))
628 : : {
629 : 6899 : sal_Bool bValue(sal_False);
630 [ + - ][ + + ]: 6899 : if (IsXMLToken(msValue, XML_TRUE))
631 : 3554 : bValue = sal_True;
632 [ + - ]: 6899 : mrAny <<= bValue;
633 : : }
634 [ - + ]: 6626 : else if (IsXMLToken(msType, XML_BYTE))
635 : : {
636 : 0 : sal_Int32 nValue(0);
637 [ # # ]: 0 : ::sax::Converter::convertNumber(nValue, msValue);
638 [ # # ]: 0 : mrAny <<= static_cast<sal_Int8>(nValue);
639 : : }
640 [ + + ]: 6626 : else if (IsXMLToken(msType, XML_SHORT))
641 : : {
642 : 1340 : sal_Int32 nValue(0);
643 [ + - ]: 1340 : ::sax::Converter::convertNumber(nValue, msValue);
644 [ + - ]: 1340 : mrAny <<= static_cast<sal_Int16>(nValue);
645 : : }
646 [ + + ]: 5286 : else if (IsXMLToken(msType, XML_INT))
647 : : {
648 : 3794 : sal_Int32 nValue(0);
649 [ + - ]: 3794 : ::sax::Converter::convertNumber(nValue, msValue);
650 [ + - ]: 3794 : mrAny <<= nValue;
651 : : }
652 [ + + ]: 1492 : else if (IsXMLToken(msType, XML_LONG))
653 : : {
654 : 416 : sal_Int64 nValue(msValue.toInt64());
655 [ + - ]: 416 : mrAny <<= nValue;
656 : : }
657 [ - + ]: 1076 : else if (IsXMLToken(msType, XML_DOUBLE))
658 : : {
659 : 0 : double fValue(0.0);
660 [ # # ]: 0 : ::sax::Converter::convertDouble(fValue, msValue);
661 [ # # ]: 0 : mrAny <<= fValue;
662 : : }
663 [ + + ]: 1076 : else if (IsXMLToken(msType, XML_STRING))
664 : : {
665 : 813 : mrAny <<= msValue;
666 : : }
667 [ - + ]: 263 : else if (IsXMLToken(msType, XML_DATETIME))
668 : : {
669 : 0 : util::DateTime aDateTime;
670 [ # # ]: 0 : ::sax::Converter::convertDateTime(aDateTime, msValue);
671 [ # # ]: 0 : mrAny <<= aDateTime;
672 : : }
673 [ + - ]: 263 : else if (IsXMLToken(msType, XML_BASE64BINARY))
674 : : {
675 : 263 : mrAny <<= maDecoded;
676 : : }
677 : : else {
678 : : OSL_FAIL("wrong type");
679 : : }
680 : :
681 : 13525 : ManipulateConfigItem();
682 : :
683 : 13525 : mpBaseContext->AddPropertyValue();
684 : : }
685 : : else {
686 : : OSL_FAIL("no BaseContext");
687 : : }
688 : 13525 : }
689 : :
690 : : /** There are some instances where there is a mismatch between API and
691 : : * XML mapping of a setting. In this case, this method allows us to
692 : : * manipulate the values accordingly. */
693 : 13525 : void XMLConfigItemContext::ManipulateConfigItem()
694 : : {
695 [ + + ]: 13525 : if( mrItemName.equalsAsciiL(
696 : 13525 : RTL_CONSTASCII_STRINGPARAM( "PrinterIndependentLayout" ) ) )
697 : : {
698 : 74 : rtl::OUString sValue;
699 : 74 : mrAny >>= sValue;
700 : :
701 : 74 : sal_Int16 nTmp = document::PrinterIndependentLayout::HIGH_RESOLUTION;
702 : :
703 [ + + ]: 148 : if( sValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("enabled")) ||
[ + - + + ]
704 : 74 : sValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("low-resolution")) )
705 : : {
706 : 11 : nTmp = document::PrinterIndependentLayout::LOW_RESOLUTION;
707 : : }
708 [ + + ]: 63 : else if ( sValue == "disabled" )
709 : : {
710 : 5 : nTmp = document::PrinterIndependentLayout::DISABLED;
711 : : }
712 : : // else: default to high_resolution
713 : :
714 [ + - ]: 74 : mrAny <<= nTmp;
715 : : }
716 [ + + ][ + + ]: 53672 : else if( (mrItemName == "ColorTableURL") || (mrItemName == "LineEndTableURL") || (mrItemName == "HatchTableURL")
[ + + + +
+ + + + ]
[ + + ]
717 : 40221 : || (mrItemName == "DashTableURL") || (mrItemName == "GradientTableURL") || (mrItemName == "BitmapTableURL") )
718 : : {
719 [ + - ]: 66 : if( GetImport().getServiceFactory().is() ) try
720 : : {
721 [ + - ][ + - ]: 66 : uno::Reference< uno::XComponentContext > xContext( comphelper::ComponentContext(GetImport().getServiceFactory()).getUNOContext() );
[ + - ][ + - ]
722 [ + - ]: 66 : uno::Reference< util::XStringSubstitution > xStringSubsitution( util::PathSubstitution::create(xContext) );
723 : :
724 : 66 : rtl::OUString aURL;
725 : 66 : mrAny >>= aURL;
726 [ + - ][ + - ]: 66 : aURL = xStringSubsitution->substituteVariables( aURL, sal_False );
727 [ # # ][ + - ]: 66 : mrAny <<= aURL;
728 : : }
729 : 0 : catch( uno::Exception& )
730 : : {
731 : : }
732 : : }
733 : 13525 : }
734 : :
735 : :
736 : : //=============================================================================
737 : :
738 : 93 : XMLConfigItemMapNamedContext::XMLConfigItemMapNamedContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
739 : : const ::com::sun::star::uno::Reference<
740 : : ::com::sun::star::xml::sax::XAttributeList>&,
741 : : com::sun::star::uno::Any& rAny,
742 : : XMLConfigBaseContext* pBaseContext)
743 : 93 : : XMLConfigBaseContext(rImport, nPrfx, rLName, rAny, pBaseContext)
744 : : {
745 : 93 : }
746 : :
747 : 93 : XMLConfigItemMapNamedContext::~XMLConfigItemMapNamedContext()
748 : : {
749 [ - + ]: 186 : }
750 : :
751 : 165 : SvXMLImportContext *XMLConfigItemMapNamedContext::CreateChildContext( sal_uInt16 nPrefix,
752 : : const rtl::OUString& rLocalName,
753 : : const ::com::sun::star::uno::Reference<
754 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
755 : : {
756 : 165 : return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this);
757 : : }
758 : :
759 : 93 : void XMLConfigItemMapNamedContext::EndElement()
760 : : {
761 [ + - ]: 93 : if (mpBaseContext)
762 : : {
763 [ + - ]: 93 : mrAny <<= maProps.GetNameContainer();
764 : 93 : mpBaseContext->AddPropertyValue();
765 : : }
766 : : else {
767 : : OSL_FAIL("no BaseContext");
768 : : }
769 : 93 : }
770 : :
771 : : //=============================================================================
772 : :
773 : 169 : XMLConfigItemMapIndexedContext::XMLConfigItemMapIndexedContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
774 : : const rtl::OUString& rLName,
775 : : const ::com::sun::star::uno::Reference<
776 : : ::com::sun::star::xml::sax::XAttributeList>&,
777 : : com::sun::star::uno::Any& rAny,
778 : : const ::rtl::OUString& rConfigItemName,
779 : : XMLConfigBaseContext* pBaseContext)
780 : : : XMLConfigBaseContext(rImport, nPrfx, rLName, rAny, pBaseContext),
781 : 169 : maConfigItemName( rConfigItemName )
782 : : {
783 : 169 : }
784 : :
785 : 169 : XMLConfigItemMapIndexedContext::~XMLConfigItemMapIndexedContext()
786 : : {
787 [ - + ]: 338 : }
788 : :
789 : 172 : SvXMLImportContext *XMLConfigItemMapIndexedContext::CreateChildContext( sal_uInt16 nPrefix,
790 : : const rtl::OUString& rLocalName,
791 : : const ::com::sun::star::uno::Reference<
792 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
793 : : {
794 : 172 : return CreateSettingsContext(GetImport(), nPrefix, rLocalName, xAttrList, maProp, this);
795 : : }
796 : :
797 : 169 : void XMLConfigItemMapIndexedContext::EndElement()
798 : : {
799 [ + - ]: 169 : if (mpBaseContext)
800 : : {
801 [ + + ]: 169 : if ( maConfigItemName == "ForbiddenCharacters" )
802 : : {
803 : 10 : uno::Reference< i18n::XForbiddenCharacters > xForbChars;
804 : :
805 : : // get the forbidden characters from the document
806 [ + - ]: 10 : uno::Reference< lang::XMultiServiceFactory > xFac( GetImport().GetModel(), uno::UNO_QUERY );
807 [ + - ]: 10 : if( xFac.is() )
808 : : {
809 [ + - ][ + - ]: 10 : uno::Reference< beans::XPropertySet > xProps( xFac->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), uno::UNO_QUERY );
[ + - ][ + - ]
810 [ + - ][ + - ]: 10 : if( xProps.is() && xProps->getPropertySetInfo()->hasPropertyByName( maConfigItemName ) )
[ + - ][ + - ]
[ + - ][ + - ]
[ + - # # ]
[ + - ]
811 : : {
812 [ + - ][ + - ]: 10 : xProps->getPropertyValue( maConfigItemName ) >>= xForbChars;
[ + - ]
813 : 10 : }
814 : : }
815 : :
816 [ + - ]: 10 : if( xForbChars.is() )
817 : : {
818 : :
819 [ + - ][ + - ]: 10 : uno::Reference< container::XIndexAccess > xIndex( maProps.GetIndexContainer(), uno::UNO_QUERY );
820 : :
821 [ + - ][ + - ]: 10 : const sal_Int32 nCount = xIndex->getCount();
822 [ + - ]: 10 : uno::Sequence < beans::PropertyValue > aProps;
823 [ + + ]: 23 : for (sal_Int32 i = 0; i < nCount; i++)
824 : : {
825 [ + - ][ + - ]: 13 : if ((xIndex->getByIndex( i ) >>= aProps) && (aProps.getLength() == XML_FORBIDDEN_CHARACTER_MAX ) )
[ + - ][ + - ]
[ + - ][ + - ]
[ + - # #
# # ]
826 : : {
827 [ + - ]: 13 : beans::PropertyValue *pForChar = aProps.getArray();
828 : 13 : i18n::ForbiddenCharacters aForbid;
829 : 13 : lang::Locale aLocale;
830 [ + - ]: 13 : const rtl::OUString sLanguage ( RTL_CONSTASCII_USTRINGPARAM ( "Language" ) );
831 [ + - ]: 13 : const rtl::OUString sCountry ( RTL_CONSTASCII_USTRINGPARAM ( "Country" ) );
832 [ + - ]: 13 : const rtl::OUString sVariant ( RTL_CONSTASCII_USTRINGPARAM ( "Variant" ) );
833 [ + - ]: 13 : const rtl::OUString sBeginLine ( RTL_CONSTASCII_USTRINGPARAM ( "BeginLine" ) );
834 [ + - ]: 13 : const rtl::OUString sEndLine ( RTL_CONSTASCII_USTRINGPARAM ( "EndLine" ) );
835 : 13 : sal_Bool bHaveLanguage = sal_False, bHaveCountry = sal_False, bHaveVariant = sal_False,
836 : 13 : bHaveBegin = sal_False, bHaveEnd = sal_False;
837 : :
838 [ + + ]: 78 : for ( sal_Int32 j = 0 ; j < XML_FORBIDDEN_CHARACTER_MAX ; j++ )
839 : : {
840 [ + + ]: 65 : if (pForChar->Name.equals (sLanguage ) )
841 : : {
842 : 13 : pForChar->Value >>= aLocale.Language;
843 : 13 : bHaveLanguage = sal_True;
844 : : }
845 [ + + ]: 52 : else if (pForChar->Name.equals (sCountry ) )
846 : : {
847 : 13 : pForChar->Value >>= aLocale.Country;
848 : 13 : bHaveCountry = sal_True;
849 : : }
850 [ + + ]: 39 : else if (pForChar->Name.equals (sVariant ) )
851 : : {
852 : 13 : pForChar->Value >>= aLocale.Variant;
853 : 13 : bHaveVariant = sal_True;
854 : : }
855 [ + + ]: 26 : else if (pForChar->Name.equals (sBeginLine ) )
856 : : {
857 : 13 : pForChar->Value >>= aForbid.beginLine;
858 : 13 : bHaveBegin = sal_True;
859 : : }
860 [ + - ]: 13 : else if (pForChar->Name.equals (sEndLine ) )
861 : : {
862 : 13 : pForChar->Value >>= aForbid.endLine;
863 : 13 : bHaveEnd = sal_True;
864 : : }
865 : 65 : pForChar++;
866 : : }
867 : :
868 [ + - ][ + - ]: 13 : if ( bHaveLanguage && bHaveCountry && bHaveVariant && bHaveBegin && bHaveEnd )
[ + - ][ + - ]
[ + - ]
869 : : {
870 : : try
871 : : {
872 [ + - ][ + - ]: 13 : xForbChars->setForbiddenCharacters( aLocale, aForbid );
873 : : }
874 [ # # ]: 0 : catch( uno::Exception& )
875 : : {
876 : : OSL_FAIL( "Exception while importing forbidden characters" );
877 : : }
878 : 13 : }
879 : : }
880 [ + - ]: 10 : }
881 : : }
882 : : else
883 : : {
884 : : OSL_FAIL( "could not get the XForbiddenCharacters from document!" );
885 [ # # ][ # # ]: 0 : mrAny <<= maProps.GetIndexContainer();
886 : 10 : }
887 : : }
888 [ - + ]: 159 : else if ( maConfigItemName == "Symbols" )
889 : : {
890 [ # # ][ # # ]: 0 : uno::Reference< container::XIndexAccess > xIndex( maProps.GetIndexContainer(), uno::UNO_QUERY );
891 : :
892 [ # # ][ # # ]: 0 : const sal_Int32 nCount = xIndex->getCount();
893 [ # # ]: 0 : uno::Sequence < beans::PropertyValue > aProps;
894 [ # # ]: 0 : uno::Sequence < formula::SymbolDescriptor > aSymbolList ( nCount );
895 : :
896 [ # # ]: 0 : formula::SymbolDescriptor *pDescriptor = aSymbolList.getArray();
897 : :
898 [ # # ]: 0 : const rtl::OUString sName ( RTL_CONSTASCII_USTRINGPARAM ( "Name" ) );
899 [ # # ]: 0 : const rtl::OUString sExportName ( RTL_CONSTASCII_USTRINGPARAM ( "ExportName" ) );
900 [ # # ]: 0 : const rtl::OUString sFontName ( RTL_CONSTASCII_USTRINGPARAM ( "FontName" ) );
901 [ # # ]: 0 : const rtl::OUString sSymbolSet ( RTL_CONSTASCII_USTRINGPARAM ( "SymbolSet" ) );
902 [ # # ]: 0 : const rtl::OUString sCharacter ( RTL_CONSTASCII_USTRINGPARAM ( "Character" ) );
903 [ # # ]: 0 : const rtl::OUString sCharSet ( RTL_CONSTASCII_USTRINGPARAM ( "CharSet" ) );
904 [ # # ]: 0 : const rtl::OUString sFamily ( RTL_CONSTASCII_USTRINGPARAM ( "Family" ) );
905 [ # # ]: 0 : const rtl::OUString sPitch ( RTL_CONSTASCII_USTRINGPARAM ( "Pitch" ) );
906 [ # # ]: 0 : const rtl::OUString sWeight ( RTL_CONSTASCII_USTRINGPARAM ( "Weight" ) );
907 [ # # ]: 0 : const rtl::OUString sItalic ( RTL_CONSTASCII_USTRINGPARAM ( "Italic" ) );
908 : 0 : sal_Int16 nNumFullEntries = 0;
909 : :
910 [ # # ]: 0 : for ( sal_Int32 i = 0; i < nCount; i++ )
911 : : {
912 [ # # ][ # # ]: 0 : if ((xIndex->getByIndex( i ) >>= aProps) && (aProps.getLength() == XML_SYMBOL_DESCRIPTOR_MAX ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
913 : : {
914 : 0 : sal_Bool bHaveName = sal_False, bHaveExportName = sal_False, bHaveCharSet = sal_False,
915 : 0 : bHaveFontName = sal_False, bHaveFamily = sal_False, bHavePitch = sal_False,
916 : 0 : bHaveWeight = sal_False, bHaveItalic = sal_False, bHaveSymbolSet = sal_False,
917 : 0 : bHaveCharacter = sal_False;
918 [ # # ]: 0 : beans::PropertyValue *pSymbol = aProps.getArray();
919 : :
920 [ # # ]: 0 : for ( sal_Int32 j = 0 ; j < XML_SYMBOL_DESCRIPTOR_MAX ; j++ )
921 : : {
922 [ # # ]: 0 : if (pSymbol->Name.equals ( sName ) )
923 : : {
924 : 0 : pSymbol->Value >>= pDescriptor[nNumFullEntries].sName;
925 : 0 : bHaveName = sal_True;
926 : : }
927 [ # # ]: 0 : else if (pSymbol->Name.equals (sExportName ) )
928 : : {
929 : 0 : pSymbol->Value >>= pDescriptor[nNumFullEntries].sExportName;
930 : 0 : bHaveExportName = sal_True;
931 : : }
932 [ # # ]: 0 : else if (pSymbol->Name.equals (sFontName ) )
933 : : {
934 : 0 : pSymbol->Value >>= pDescriptor[nNumFullEntries].sFontName;
935 : 0 : bHaveFontName = sal_True;
936 : : }
937 [ # # ]: 0 : else if (pSymbol->Name.equals (sCharSet ) )
938 : : {
939 : 0 : pSymbol->Value >>= pDescriptor[nNumFullEntries].nCharSet;
940 : 0 : bHaveCharSet = sal_True;
941 : : }
942 [ # # ]: 0 : else if (pSymbol->Name.equals (sFamily ) )
943 : : {
944 : 0 : pSymbol->Value >>= pDescriptor[nNumFullEntries].nFamily;
945 : 0 : bHaveFamily = sal_True;
946 : : }
947 [ # # ]: 0 : else if (pSymbol->Name.equals (sPitch ) )
948 : : {
949 : 0 : pSymbol->Value >>= pDescriptor[nNumFullEntries].nPitch;
950 : 0 : bHavePitch = sal_True;
951 : : }
952 [ # # ]: 0 : else if (pSymbol->Name.equals (sWeight ) )
953 : : {
954 : 0 : pSymbol->Value >>= pDescriptor[nNumFullEntries].nWeight;
955 : 0 : bHaveWeight = sal_True;
956 : : }
957 [ # # ]: 0 : else if (pSymbol->Name.equals (sItalic ) )
958 : : {
959 : 0 : pSymbol->Value >>= pDescriptor[nNumFullEntries].nItalic;
960 : 0 : bHaveItalic = sal_True;
961 : : }
962 [ # # ]: 0 : else if (pSymbol->Name.equals (sSymbolSet ) )
963 : : {
964 : 0 : pSymbol->Value >>= pDescriptor[nNumFullEntries].sSymbolSet;
965 : 0 : bHaveSymbolSet = sal_True;
966 : : }
967 [ # # ]: 0 : else if (pSymbol->Name.equals (sCharacter ) )
968 : : {
969 : 0 : pSymbol->Value >>= pDescriptor[nNumFullEntries].nCharacter;
970 : 0 : bHaveCharacter = sal_True;
971 : : }
972 : 0 : pSymbol++;
973 : : }
974 [ # # ][ # # ]: 0 : if ( bHaveName && bHaveExportName && bHaveCharSet && bHaveFontName && bHaveCharacter
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
975 : : && bHaveFamily && bHavePitch && bHaveWeight && bHaveItalic && bHaveSymbolSet)
976 : 0 : nNumFullEntries++;
977 : : }
978 : : }
979 [ # # ]: 0 : aSymbolList.realloc (nNumFullEntries);
980 [ # # ][ # # ]: 0 : mrAny <<= aSymbolList;
[ # # ]
981 : : }
982 : : else
983 : : {
984 [ + - ]: 159 : mrAny <<= maProps.GetIndexContainer();
985 : : }
986 : 169 : mpBaseContext->AddPropertyValue();
987 : : }
988 : : else {
989 : : OSL_FAIL("no BaseContext");
990 : : }
991 : 169 : }
992 : :
993 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|