Version 24.2.2.2, tag libreoffice-24.2.2.2
[LibreOffice.git] / xmloff / source / core / DocumentSettingsContext.cxx
blob9886ac935eb18f1844cb17bb36a70bcdfb9ff634
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 #include <sal/config.h>
22 #include <o3tl/string_view.hxx>
23 #include <officecfg/Office/Common.hxx>
24 #include <sax/tools/converter.hxx>
26 #include <com/sun/star/util/PathSubstitution.hpp>
27 #include <com/sun/star/util/XStringSubstitution.hpp>
28 #include <utility>
29 #include <xmloff/DocumentSettingsContext.hxx>
30 #include <xmloff/xmlimp.hxx>
31 #include <xmloff/xmltoken.hxx>
32 #include <xmloff/xmlnamespace.hxx>
33 #include <xmloff/namespacemap.hxx>
34 #include <comphelper/base64.hxx>
36 #include <vector>
37 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
38 #include <com/sun/star/container/XIndexContainer.hpp>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <com/sun/star/formula/SymbolDescriptor.hpp>
41 #include <com/sun/star/frame/XModel.hpp>
42 #include <com/sun/star/util/DateTime.hpp>
43 #include <com/sun/star/document/XViewDataSupplier.hpp>
44 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
45 #include <com/sun/star/document/NamedPropertyValues.hpp>
46 #include <com/sun/star/beans/XPropertySet.hpp>
47 #include <comphelper/indexedpropertyvalues.hxx>
48 #include <sal/log.hxx>
49 #include <osl/diagnose.h>
50 #include <comphelper/diagnose_ex.hxx>
51 #include <unotools/configmgr.hxx>
52 #include "xmlenums.hxx"
54 using namespace com::sun::star;
55 using namespace ::xmloff::token;
57 namespace {
59 class XMLMyList
61 std::vector<beans::PropertyValue> aProps;
62 sal_uInt32 nCount;
64 css::uno::Reference< css::uno::XComponentContext > m_xContext;
66 public:
67 explicit XMLMyList(uno::Reference<uno::XComponentContext> xContext);
69 void push_back(beans::PropertyValue const & aProp) { aProps.push_back(aProp); nCount++; }
70 uno::Sequence<beans::PropertyValue> GetSequence();
71 uno::Reference<container::XNameContainer> GetNameContainer();
72 uno::Reference<container::XIndexContainer> GetIndexContainer();
77 XMLMyList::XMLMyList(uno::Reference<uno::XComponentContext> xContext)
78 : nCount(0),
79 m_xContext(std::move(xContext))
81 assert(m_xContext.is());
84 uno::Sequence<beans::PropertyValue> XMLMyList::GetSequence()
86 uno::Sequence<beans::PropertyValue> aSeq;
87 if(nCount)
89 assert(nCount == aProps.size());
90 aSeq.realloc(nCount);
91 beans::PropertyValue* pProps = aSeq.getArray();
92 for (auto const& prop : aProps)
94 *pProps = prop;
95 ++pProps;
98 return aSeq;
101 uno::Reference<container::XNameContainer> XMLMyList::GetNameContainer()
103 uno::Reference<container::XNameContainer> xNameContainer = document::NamedPropertyValues::create(m_xContext);
104 for (auto const& prop : aProps)
106 xNameContainer->insertByName(prop.Name, prop.Value);
109 return xNameContainer;
112 uno::Reference<container::XIndexContainer> XMLMyList::GetIndexContainer()
114 rtl::Reference< comphelper::IndexedPropertyValuesContainer > xIndexContainer = new comphelper::IndexedPropertyValuesContainer();
115 sal_uInt32 i(0);
116 for (auto const& prop : aProps)
118 xIndexContainer->insertByIndex(i, prop.Value);
119 ++i;
122 return xIndexContainer;
125 namespace {
127 class XMLConfigBaseContext : public SvXMLImportContext
129 protected:
130 XMLMyList maProps;
131 beans::PropertyValue maProp;
132 css::uno::Any& mrAny;
133 XMLConfigBaseContext* mpBaseContext;
134 public:
135 XMLConfigBaseContext(SvXMLImport& rImport,
136 css::uno::Any& rAny,
137 XMLConfigBaseContext* pBaseContext);
139 void AddPropertyValue() { maProps.push_back(maProp); }
142 class XMLConfigItemContext : public SvXMLImportContext
144 OUString msType;
145 css::uno::Any& mrAny;
146 const OUString mrItemName;
147 XMLConfigBaseContext* mpBaseContext;
148 OUStringBuffer maCharBuffer;
150 public:
151 XMLConfigItemContext(SvXMLImport& rImport,
152 const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
153 css::uno::Any& rAny,
154 OUString aItemName,
155 XMLConfigBaseContext* pBaseContext);
157 virtual void SAL_CALL characters( const OUString& rChars ) override;
159 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
161 void ManipulateConfigItem();
164 class XMLConfigItemSetContext : public XMLConfigBaseContext
166 public:
167 XMLConfigItemSetContext(SvXMLImport& rImport,
168 css::uno::Any& rAny,
169 XMLConfigBaseContext* pBaseContext);
171 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
172 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
174 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
177 class XMLConfigItemMapNamedContext : public XMLConfigBaseContext
179 public:
180 XMLConfigItemMapNamedContext(SvXMLImport& rImport,
181 css::uno::Any& rAny,
182 XMLConfigBaseContext* pBaseContext);
184 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
185 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
187 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
190 class XMLConfigItemMapIndexedContext : public XMLConfigBaseContext
192 private:
193 OUString maConfigItemName;
195 public:
196 XMLConfigItemMapIndexedContext(SvXMLImport& rImport,
197 css::uno::Any& rAny,
198 OUString aConfigItemName,
199 XMLConfigBaseContext* pBaseContext);
201 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
202 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
204 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
209 static SvXMLImportContext *CreateSettingsContext(SvXMLImport& rImport, sal_Int32 nElement,
210 const uno::Reference<xml::sax::XFastAttributeList>& xAttrList,
211 beans::PropertyValue& rProp, XMLConfigBaseContext* pBaseContext)
213 SvXMLImportContext *pContext = nullptr;
215 rProp.Name.clear();
216 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
218 if (aIter.getToken() == XML_ELEMENT(CONFIG, XML_NAME))
219 rProp.Name = aIter.toString();
222 if (nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM))
223 pContext = new XMLConfigItemContext(rImport, xAttrList, rProp.Value, rProp.Name, pBaseContext);
224 else if(nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM_SET) ||
225 nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM_MAP_ENTRY) )
226 pContext = new XMLConfigItemSetContext(rImport, rProp.Value, pBaseContext);
227 else if(nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM_MAP_NAMED))
228 pContext = new XMLConfigItemMapNamedContext(rImport, rProp.Value, pBaseContext);
229 else if(nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM_MAP_INDEXED))
230 pContext = new XMLConfigItemMapIndexedContext(rImport, rProp.Value, rProp.Name, pBaseContext);
232 return pContext;
235 XMLDocumentSettingsContext::XMLDocumentSettingsContext(SvXMLImport& rImport)
236 : SvXMLImportContext( rImport )
238 // here are no attributes
241 XMLDocumentSettingsContext::~XMLDocumentSettingsContext()
245 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLDocumentSettingsContext::createFastChildContext(
246 sal_Int32 nElement,
247 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
249 SvXMLImportContext *pContext = nullptr;
250 OUString sName;
252 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
254 if (aIter.getToken() == XML_ELEMENT(CONFIG, XML_NAME))
255 sName = aIter.toString();
258 if (nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM_SET))
260 OUString aLocalConfigName;
261 sal_uInt16 nConfigPrefix =
262 GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
263 sName, &aLocalConfigName );
265 if( XML_NAMESPACE_OOO == nConfigPrefix )
267 if (IsXMLToken(aLocalConfigName, XML_VIEW_SETTINGS))
268 pContext = new XMLConfigItemSetContext(GetImport(),
269 maViewProps, nullptr);
270 else if (IsXMLToken(aLocalConfigName,
271 XML_CONFIGURATION_SETTINGS))
272 pContext = new XMLConfigItemSetContext(GetImport(),
273 maConfigProps, nullptr);
274 else
276 maDocSpecificSettings.push_back( {aLocalConfigName, uno::Any()} );
278 pContext = new XMLConfigItemSetContext(GetImport(),
279 maDocSpecificSettings.back().aSettings, nullptr);
284 return pContext;
287 void XMLDocumentSettingsContext::endFastElement(sal_Int32 )
289 uno::Sequence<beans::PropertyValue> aSeqViewProps;
290 if (maViewProps >>= aSeqViewProps)
292 GetImport().SetViewSettings(aSeqViewProps);
293 sal_Int32 i(aSeqViewProps.getLength() - 1);
294 bool bFound(false);
295 while((i >= 0) && !bFound)
297 if (aSeqViewProps[i].Name == "Views")
299 bFound = true;
300 uno::Reference<container::XIndexAccess> xIndexAccess;
301 if (aSeqViewProps[i].Value >>= xIndexAccess)
303 uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetImport().GetModel(), uno::UNO_QUERY);
304 if (xViewDataSupplier.is())
305 xViewDataSupplier->setViewData(xIndexAccess);
308 else
309 i--;
313 uno::Sequence<beans::PropertyValue> aSeqConfigProps;
314 if ( maConfigProps >>= aSeqConfigProps )
316 if (!utl::ConfigManager::IsFuzzing() && !officecfg::Office::Common::Save::Document::LoadPrinter::get())
318 auto aSeqConfigPropsRange = asNonConstRange(aSeqConfigProps);
319 sal_Int32 i = aSeqConfigProps.getLength() - 1;
320 int nFound = 0;
322 while ( ( i >= 0 ) && nFound < 2 )
324 OUString sProp( aSeqConfigProps[i].Name );
326 if ( sProp == "PrinterName" )
328 aSeqConfigPropsRange[i].Value <<= OUString();
329 nFound++;
331 else if ( sProp == "PrinterSetup" )
333 uno::Sequence< sal_Int8 > aEmpty;
334 aSeqConfigPropsRange[i].Value <<= aEmpty;
335 nFound++;
338 i--;
342 GetImport().SetConfigurationSettings( aSeqConfigProps );
345 for (auto const& settings : maDocSpecificSettings)
347 uno::Sequence< beans::PropertyValue > aDocSettings;
348 OSL_VERIFY( settings.aSettings >>= aDocSettings );
349 GetImport().SetDocumentSpecificSettings( settings.sGroupName, aDocSettings );
353 XMLConfigBaseContext::XMLConfigBaseContext(SvXMLImport& rImport,
354 css::uno::Any& rTempAny,
355 XMLConfigBaseContext* pTempBaseContext)
356 : SvXMLImportContext( rImport ),
357 maProps( rImport.GetComponentContext() ),
358 mrAny(rTempAny),
359 mpBaseContext(pTempBaseContext)
363 XMLConfigItemSetContext::XMLConfigItemSetContext(SvXMLImport& rImport,
364 css::uno::Any& rAny,
365 XMLConfigBaseContext* pBaseContext)
366 : XMLConfigBaseContext( rImport, rAny, pBaseContext )
368 // here are no attributes
371 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLConfigItemSetContext::createFastChildContext(
372 sal_Int32 nElement,
373 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
375 return CreateSettingsContext(GetImport(), nElement, xAttrList, maProp, this);
378 void XMLConfigItemSetContext::endFastElement(sal_Int32 )
380 mrAny <<= maProps.GetSequence();
381 if (mpBaseContext)
382 mpBaseContext->AddPropertyValue();
385 XMLConfigItemContext::XMLConfigItemContext(SvXMLImport& rImport,
386 const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
387 css::uno::Any& rTempAny,
388 OUString aTempItemName,
389 XMLConfigBaseContext* pTempBaseContext)
390 : SvXMLImportContext(rImport),
391 mrAny(rTempAny),
392 mrItemName(std::move(aTempItemName)),
393 mpBaseContext(pTempBaseContext)
395 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
397 if (aIter.getToken() == XML_ELEMENT(CONFIG, XML_TYPE))
398 msType = aIter.toString();
402 void XMLConfigItemContext::characters( const OUString& rChars )
404 maCharBuffer.append(rChars);
407 void XMLConfigItemContext::endFastElement(sal_Int32 )
409 OUString sValue;
410 uno::Sequence<sal_Int8> aDecoded;
411 if (IsXMLToken(msType, XML_BASE64BINARY))
413 std::u16string_view sChars = o3tl::trim(maCharBuffer);
414 if( !sChars.empty() )
415 ::comphelper::Base64::decodeSomeChars( aDecoded, sChars );
416 maCharBuffer.setLength(0);
418 else
419 sValue = maCharBuffer.makeStringAndClear();
421 if (mpBaseContext)
423 if (IsXMLToken(msType, XML_BOOLEAN))
425 bool bValue(false);
426 if (IsXMLToken(sValue, XML_TRUE))
427 bValue = true;
428 mrAny <<= bValue;
430 else if (IsXMLToken(msType, XML_BYTE))
432 sal_Int32 nValue(0);
433 ::sax::Converter::convertNumber(nValue, sValue);
434 mrAny <<= static_cast<sal_Int8>(nValue);
436 else if (IsXMLToken(msType, XML_SHORT))
438 sal_Int32 nValue(0);
439 ::sax::Converter::convertNumber(nValue, sValue);
440 mrAny <<= static_cast<sal_Int16>(nValue);
442 else if (IsXMLToken(msType, XML_INT))
444 sal_Int32 nValue(0);
445 ::sax::Converter::convertNumber(nValue, sValue);
446 mrAny <<= nValue;
448 else if (IsXMLToken(msType, XML_LONG))
450 sal_Int64 nValue(sValue.toInt64());
451 mrAny <<= nValue;
453 else if (IsXMLToken(msType, XML_DOUBLE))
455 double fValue(0.0);
456 ::sax::Converter::convertDouble(fValue, sValue);
457 mrAny <<= fValue;
459 else if (IsXMLToken(msType, XML_STRING))
461 mrAny <<= sValue;
463 else if (IsXMLToken(msType, XML_DATETIME))
465 util::DateTime aDateTime;
466 if (::sax::Converter::parseDateTime(aDateTime, sValue))
467 mrAny <<= aDateTime;
468 else
469 SAL_WARN("xmloff.core", "XMLConfigItemContext: broken DateTime '" << sValue << "'");
471 else if (IsXMLToken(msType, XML_BASE64BINARY))
473 mrAny <<= aDecoded;
475 else {
476 SAL_INFO("xmloff.core",
477 "XMLConfigItemContext: unknown type: " << msType);
480 ManipulateConfigItem();
482 mpBaseContext->AddPropertyValue();
484 else {
485 assert(false && "no BaseContext");
489 /** There are some instances where there is a mismatch between API and
490 * XML mapping of a setting. In this case, this method allows us to
491 * manipulate the values accordingly. */
492 void XMLConfigItemContext::ManipulateConfigItem()
494 if( mrItemName == "PrinterIndependentLayout" )
496 OUString sValue;
497 mrAny >>= sValue;
499 sal_Int16 nTmp = document::PrinterIndependentLayout::HIGH_RESOLUTION;
501 if( sValue == "enabled" || sValue == "low-resolution" )
503 nTmp = document::PrinterIndependentLayout::LOW_RESOLUTION;
505 else if ( sValue == "disabled" )
507 nTmp = document::PrinterIndependentLayout::DISABLED;
509 // else: default to high_resolution
511 mrAny <<= nTmp;
513 else if( (mrItemName == "ColorTableURL") || (mrItemName == "LineEndTableURL") || (mrItemName == "HatchTableURL")
514 || (mrItemName == "DashTableURL") || (mrItemName == "GradientTableURL") || (mrItemName == "BitmapTableURL") )
518 uno::Reference< uno::XComponentContext > xContext( GetImport().GetComponentContext() );
519 uno::Reference< util::XStringSubstitution > xStringSubstitution( util::PathSubstitution::create(xContext) );
521 OUString aURL;
522 mrAny >>= aURL;
523 aURL = xStringSubstitution->substituteVariables( aURL, false );
524 mrAny <<= aURL;
526 catch( uno::Exception& )
532 XMLConfigItemMapNamedContext::XMLConfigItemMapNamedContext(SvXMLImport& rImport,
533 css::uno::Any& rAny,
534 XMLConfigBaseContext* pBaseContext)
535 : XMLConfigBaseContext(rImport, rAny, pBaseContext)
539 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLConfigItemMapNamedContext::createFastChildContext(
540 sal_Int32 nElement,
541 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
543 return CreateSettingsContext(GetImport(), nElement, xAttrList, maProp, this);
546 void XMLConfigItemMapNamedContext::endFastElement(sal_Int32 )
548 if (mpBaseContext)
550 mrAny <<= maProps.GetNameContainer();
551 mpBaseContext->AddPropertyValue();
553 else {
554 assert(false && "no BaseContext");
558 XMLConfigItemMapIndexedContext::XMLConfigItemMapIndexedContext(SvXMLImport& rImport,
559 css::uno::Any& rAny,
560 OUString aConfigItemName,
561 XMLConfigBaseContext* pBaseContext)
562 : XMLConfigBaseContext(rImport, rAny, pBaseContext),
563 maConfigItemName(std::move( aConfigItemName ))
567 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLConfigItemMapIndexedContext::createFastChildContext(
568 sal_Int32 nElement,
569 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
571 return CreateSettingsContext(GetImport(), nElement, xAttrList, maProp, this);
574 void XMLConfigItemMapIndexedContext::endFastElement(sal_Int32 )
576 if (mpBaseContext)
578 if ( maConfigItemName == "ForbiddenCharacters" )
580 uno::Reference< i18n::XForbiddenCharacters > xForbChars;
582 // get the forbidden characters from the document
583 uno::Reference< lang::XMultiServiceFactory > xFac( GetImport().GetModel(), uno::UNO_QUERY );
584 if( xFac.is() )
586 uno::Reference< beans::XPropertySet > xProps( xFac->createInstance( "com.sun.star.document.Settings" ), uno::UNO_QUERY );
587 if( xProps.is() && xProps->getPropertySetInfo()->hasPropertyByName( maConfigItemName ) )
589 xProps->getPropertyValue( maConfigItemName ) >>= xForbChars;
593 if( xForbChars.is() )
596 uno::Reference< container::XIndexAccess > xIndex = maProps.GetIndexContainer();
598 const sal_Int32 nCount = xIndex->getCount();
599 uno::Sequence < beans::PropertyValue > aProps;
600 for (sal_Int32 i = 0; i < nCount; i++)
602 if ((xIndex->getByIndex( i ) >>= aProps) && (aProps.getLength() == XML_FORBIDDEN_CHARACTER_MAX ) )
604 /* FIXME-BCP47: this stupid and counterpart in
605 * xmloff/source/core/SettingsExportHelper.cxx
606 * XMLSettingsExportHelper::exportForbiddenCharacters()
607 * */
609 beans::PropertyValue *pForChar = aProps.getArray();
610 i18n::ForbiddenCharacters aForbid;
611 lang::Locale aLocale;
612 bool bHaveLanguage = false, bHaveCountry = false, bHaveVariant = false,
613 bHaveBegin = false, bHaveEnd = false;
615 for ( sal_Int32 j = 0 ; j < XML_FORBIDDEN_CHARACTER_MAX ; j++ )
617 if (pForChar->Name == "Language")
619 pForChar->Value >>= aLocale.Language;
620 bHaveLanguage = true;
622 else if (pForChar->Name == "Country")
624 pForChar->Value >>= aLocale.Country;
625 bHaveCountry = true;
627 else if (pForChar->Name == "Variant")
629 pForChar->Value >>= aLocale.Variant;
630 bHaveVariant = true;
632 else if (pForChar->Name == "BeginLine")
634 pForChar->Value >>= aForbid.beginLine;
635 bHaveBegin = true;
637 else if (pForChar->Name == "EndLine")
639 pForChar->Value >>= aForbid.endLine;
640 bHaveEnd = true;
642 pForChar++;
645 if ( bHaveLanguage && bHaveCountry && bHaveVariant && bHaveBegin && bHaveEnd )
649 xForbChars->setForbiddenCharacters( aLocale, aForbid );
651 catch (uno::Exception const&)
653 TOOLS_WARN_EXCEPTION("xmloff.core",
654 "Exception while importing forbidden characters");
660 else
662 SAL_WARN("xmloff.core", "could not get the XForbiddenCharacters from document!");
663 mrAny <<= maProps.GetIndexContainer();
666 else if ( maConfigItemName == "Symbols" )
668 uno::Reference< container::XIndexAccess > xIndex = maProps.GetIndexContainer();
670 const sal_Int32 nCount = xIndex->getCount();
671 uno::Sequence < beans::PropertyValue > aProps;
672 uno::Sequence < formula::SymbolDescriptor > aSymbolList ( nCount );
674 formula::SymbolDescriptor *pDescriptor = aSymbolList.getArray();
676 sal_Int16 nNumFullEntries = 0;
678 for ( sal_Int32 i = 0; i < nCount; i++ )
680 if ((xIndex->getByIndex( i ) >>= aProps) && (aProps.getLength() == XML_SYMBOL_DESCRIPTOR_MAX ) )
682 bool bHaveName = false, bHaveExportName = false, bHaveCharSet = false,
683 bHaveFontName = false, bHaveFamily = false, bHavePitch = false,
684 bHaveWeight = false, bHaveItalic = false, bHaveSymbolSet = false,
685 bHaveCharacter = false;
686 beans::PropertyValue *pSymbol = aProps.getArray();
688 for ( sal_Int32 j = 0 ; j < XML_SYMBOL_DESCRIPTOR_MAX ; j++ )
690 if (pSymbol->Name == "Name")
692 pSymbol->Value >>= pDescriptor[nNumFullEntries].sName;
693 bHaveName = true;
695 else if (pSymbol->Name == "ExportName")
697 pSymbol->Value >>= pDescriptor[nNumFullEntries].sExportName;
698 bHaveExportName = true;
700 else if (pSymbol->Name == "FontName")
702 pSymbol->Value >>= pDescriptor[nNumFullEntries].sFontName;
703 bHaveFontName = true;
705 else if (pSymbol->Name == "CharSet")
707 pSymbol->Value >>= pDescriptor[nNumFullEntries].nCharSet;
708 bHaveCharSet = true;
710 else if (pSymbol->Name == "Family")
712 pSymbol->Value >>= pDescriptor[nNumFullEntries].nFamily;
713 bHaveFamily = true;
715 else if (pSymbol->Name == "Pitch")
717 pSymbol->Value >>= pDescriptor[nNumFullEntries].nPitch;
718 bHavePitch = true;
720 else if (pSymbol->Name == "Weight")
722 pSymbol->Value >>= pDescriptor[nNumFullEntries].nWeight;
723 bHaveWeight = true;
725 else if (pSymbol->Name == "Italic")
727 pSymbol->Value >>= pDescriptor[nNumFullEntries].nItalic;
728 bHaveItalic = true;
730 else if (pSymbol->Name == "SymbolSet")
732 pSymbol->Value >>= pDescriptor[nNumFullEntries].sSymbolSet;
733 bHaveSymbolSet = true;
735 else if (pSymbol->Name == "Character")
737 pSymbol->Value >>= pDescriptor[nNumFullEntries].nCharacter;
738 bHaveCharacter = true;
740 pSymbol++;
742 if ( bHaveName && bHaveExportName && bHaveCharSet && bHaveFontName && bHaveCharacter
743 && bHaveFamily && bHavePitch && bHaveWeight && bHaveItalic && bHaveSymbolSet)
744 nNumFullEntries++;
747 aSymbolList.realloc (nNumFullEntries);
748 mrAny <<= aSymbolList;
750 else
752 mrAny <<= maProps.GetIndexContainer();
754 mpBaseContext->AddPropertyValue();
756 else {
757 assert(false && "no BaseContext");
761 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */