tdf#164434 Correct SvgSymbolNode SVG import
[LibreOffice.git] / xmloff / source / core / DocumentSettingsContext.cxx
blobedd65fc60640f4c1781669237b7e0aa0f44cbc9d
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 "xmlenums.hxx"
53 using namespace com::sun::star;
54 using namespace ::xmloff::token;
56 namespace {
58 class XMLMyList
60 std::vector<beans::PropertyValue> aProps;
61 sal_uInt32 nCount;
63 css::uno::Reference< css::uno::XComponentContext > m_xContext;
65 public:
66 explicit XMLMyList(uno::Reference<uno::XComponentContext> xContext);
68 void push_back(beans::PropertyValue const & aProp) { aProps.push_back(aProp); nCount++; }
69 uno::Sequence<beans::PropertyValue> GetSequence();
70 uno::Reference<container::XNameContainer> GetNameContainer();
71 uno::Reference<container::XIndexContainer> GetIndexContainer();
76 XMLMyList::XMLMyList(uno::Reference<uno::XComponentContext> xContext)
77 : nCount(0),
78 m_xContext(std::move(xContext))
80 assert(m_xContext.is());
83 uno::Sequence<beans::PropertyValue> XMLMyList::GetSequence()
85 uno::Sequence<beans::PropertyValue> aSeq;
86 if(nCount)
88 assert(nCount == aProps.size());
89 aSeq.realloc(nCount);
90 beans::PropertyValue* pProps = aSeq.getArray();
91 for (auto const& prop : aProps)
93 *pProps = prop;
94 ++pProps;
97 return aSeq;
100 uno::Reference<container::XNameContainer> XMLMyList::GetNameContainer()
102 uno::Reference<container::XNameContainer> xNameContainer = document::NamedPropertyValues::create(m_xContext);
103 for (auto const& prop : aProps)
105 xNameContainer->insertByName(prop.Name, prop.Value);
108 return xNameContainer;
111 uno::Reference<container::XIndexContainer> XMLMyList::GetIndexContainer()
113 rtl::Reference< comphelper::IndexedPropertyValuesContainer > xIndexContainer = new comphelper::IndexedPropertyValuesContainer();
114 sal_uInt32 i(0);
115 for (auto const& prop : aProps)
117 xIndexContainer->insertByIndex(i, prop.Value);
118 ++i;
121 return xIndexContainer;
124 namespace {
126 class XMLConfigBaseContext : public SvXMLImportContext
128 protected:
129 XMLMyList maProps;
130 beans::PropertyValue maProp;
131 css::uno::Any& mrAny;
132 XMLConfigBaseContext* mpBaseContext;
133 public:
134 XMLConfigBaseContext(SvXMLImport& rImport,
135 css::uno::Any& rAny,
136 XMLConfigBaseContext* pBaseContext);
138 void AddPropertyValue() { maProps.push_back(maProp); }
141 class XMLConfigItemContext : public SvXMLImportContext
143 OUString msType;
144 css::uno::Any& mrAny;
145 const OUString mrItemName;
146 XMLConfigBaseContext* mpBaseContext;
147 OUStringBuffer maCharBuffer;
149 public:
150 XMLConfigItemContext(SvXMLImport& rImport,
151 const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
152 css::uno::Any& rAny,
153 OUString aItemName,
154 XMLConfigBaseContext* pBaseContext);
156 virtual void SAL_CALL characters( const OUString& rChars ) override;
158 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
160 void ManipulateConfigItem();
163 class XMLConfigItemSetContext : public XMLConfigBaseContext
165 public:
166 XMLConfigItemSetContext(SvXMLImport& rImport,
167 css::uno::Any& rAny,
168 XMLConfigBaseContext* pBaseContext);
170 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
171 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
173 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
176 class XMLConfigItemMapNamedContext : public XMLConfigBaseContext
178 public:
179 XMLConfigItemMapNamedContext(SvXMLImport& rImport,
180 css::uno::Any& rAny,
181 XMLConfigBaseContext* pBaseContext);
183 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
184 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
186 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
189 class XMLConfigItemMapIndexedContext : public XMLConfigBaseContext
191 private:
192 OUString maConfigItemName;
194 public:
195 XMLConfigItemMapIndexedContext(SvXMLImport& rImport,
196 css::uno::Any& rAny,
197 OUString aConfigItemName,
198 XMLConfigBaseContext* pBaseContext);
200 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
201 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
203 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
208 static SvXMLImportContext *CreateSettingsContext(SvXMLImport& rImport, sal_Int32 nElement,
209 const uno::Reference<xml::sax::XFastAttributeList>& xAttrList,
210 beans::PropertyValue& rProp, XMLConfigBaseContext* pBaseContext)
212 SvXMLImportContext *pContext = nullptr;
214 rProp.Name.clear();
215 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
217 if (aIter.getToken() == XML_ELEMENT(CONFIG, XML_NAME))
218 rProp.Name = aIter.toString();
221 if (nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM))
222 pContext = new XMLConfigItemContext(rImport, xAttrList, rProp.Value, rProp.Name, pBaseContext);
223 else if(nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM_SET) ||
224 nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM_MAP_ENTRY) )
225 pContext = new XMLConfigItemSetContext(rImport, rProp.Value, pBaseContext);
226 else if(nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM_MAP_NAMED))
227 pContext = new XMLConfigItemMapNamedContext(rImport, rProp.Value, pBaseContext);
228 else if(nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM_MAP_INDEXED))
229 pContext = new XMLConfigItemMapIndexedContext(rImport, rProp.Value, rProp.Name, pBaseContext);
231 return pContext;
234 XMLDocumentSettingsContext::XMLDocumentSettingsContext(SvXMLImport& rImport)
235 : SvXMLImportContext( rImport )
237 // here are no attributes
240 XMLDocumentSettingsContext::~XMLDocumentSettingsContext()
244 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLDocumentSettingsContext::createFastChildContext(
245 sal_Int32 nElement,
246 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
248 SvXMLImportContext *pContext = nullptr;
249 OUString sName;
251 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
253 if (aIter.getToken() == XML_ELEMENT(CONFIG, XML_NAME))
254 sName = aIter.toString();
257 if (nElement == XML_ELEMENT(CONFIG, XML_CONFIG_ITEM_SET))
259 OUString aLocalConfigName;
260 sal_uInt16 nConfigPrefix =
261 GetImport().GetNamespaceMap().GetKeyByAttrValueQName(
262 sName, &aLocalConfigName );
264 if( XML_NAMESPACE_OOO == nConfigPrefix )
266 if (IsXMLToken(aLocalConfigName, XML_VIEW_SETTINGS))
267 pContext = new XMLConfigItemSetContext(GetImport(),
268 maViewProps, nullptr);
269 else if (IsXMLToken(aLocalConfigName,
270 XML_CONFIGURATION_SETTINGS))
271 pContext = new XMLConfigItemSetContext(GetImport(),
272 maConfigProps, nullptr);
273 else
275 maDocSpecificSettings.push_back( {aLocalConfigName, uno::Any()} );
277 pContext = new XMLConfigItemSetContext(GetImport(),
278 maDocSpecificSettings.back().aSettings, nullptr);
283 return pContext;
286 void XMLDocumentSettingsContext::endFastElement(sal_Int32 )
288 uno::Sequence<beans::PropertyValue> aSeqViewProps;
289 if (maViewProps >>= aSeqViewProps)
291 GetImport().SetViewSettings(aSeqViewProps);
292 sal_Int32 i(aSeqViewProps.getLength() - 1);
293 bool bFound(false);
294 while((i >= 0) && !bFound)
296 if (aSeqViewProps[i].Name == "Views")
298 bFound = true;
299 uno::Reference<container::XIndexAccess> xIndexAccess;
300 if (aSeqViewProps[i].Value >>= xIndexAccess)
302 uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetImport().GetModel(), uno::UNO_QUERY);
303 if (xViewDataSupplier.is())
304 xViewDataSupplier->setViewData(xIndexAccess);
307 else
308 i--;
312 uno::Sequence<beans::PropertyValue> aSeqConfigProps;
313 if ( maConfigProps >>= aSeqConfigProps )
315 if (!comphelper::IsFuzzing() && !officecfg::Office::Common::Save::Document::LoadPrinter::get())
317 auto aSeqConfigPropsRange = asNonConstRange(aSeqConfigProps);
318 sal_Int32 i = aSeqConfigProps.getLength() - 1;
319 int nFound = 0;
321 while ( ( i >= 0 ) && nFound < 2 )
323 OUString sProp( aSeqConfigProps[i].Name );
325 if ( sProp == "PrinterName" )
327 aSeqConfigPropsRange[i].Value <<= OUString();
328 nFound++;
330 else if ( sProp == "PrinterSetup" )
332 uno::Sequence< sal_Int8 > aEmpty;
333 aSeqConfigPropsRange[i].Value <<= aEmpty;
334 nFound++;
337 i--;
341 GetImport().SetConfigurationSettings( aSeqConfigProps );
344 for (auto const& settings : maDocSpecificSettings)
346 uno::Sequence< beans::PropertyValue > aDocSettings;
347 OSL_VERIFY( settings.aSettings >>= aDocSettings );
348 GetImport().SetDocumentSpecificSettings( settings.sGroupName, aDocSettings );
352 XMLConfigBaseContext::XMLConfigBaseContext(SvXMLImport& rImport,
353 css::uno::Any& rTempAny,
354 XMLConfigBaseContext* pTempBaseContext)
355 : SvXMLImportContext( rImport ),
356 maProps( rImport.GetComponentContext() ),
357 mrAny(rTempAny),
358 mpBaseContext(pTempBaseContext)
362 XMLConfigItemSetContext::XMLConfigItemSetContext(SvXMLImport& rImport,
363 css::uno::Any& rAny,
364 XMLConfigBaseContext* pBaseContext)
365 : XMLConfigBaseContext( rImport, rAny, pBaseContext )
367 // here are no attributes
370 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLConfigItemSetContext::createFastChildContext(
371 sal_Int32 nElement,
372 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
374 return CreateSettingsContext(GetImport(), nElement, xAttrList, maProp, this);
377 void XMLConfigItemSetContext::endFastElement(sal_Int32 )
379 mrAny <<= maProps.GetSequence();
380 if (mpBaseContext)
381 mpBaseContext->AddPropertyValue();
384 XMLConfigItemContext::XMLConfigItemContext(SvXMLImport& rImport,
385 const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
386 css::uno::Any& rTempAny,
387 OUString aTempItemName,
388 XMLConfigBaseContext* pTempBaseContext)
389 : SvXMLImportContext(rImport),
390 mrAny(rTempAny),
391 mrItemName(std::move(aTempItemName)),
392 mpBaseContext(pTempBaseContext)
394 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
396 if (aIter.getToken() == XML_ELEMENT(CONFIG, XML_TYPE))
397 msType = aIter.toString();
401 void XMLConfigItemContext::characters( const OUString& rChars )
403 maCharBuffer.append(rChars);
406 void XMLConfigItemContext::endFastElement(sal_Int32 )
408 OUString sValue;
409 uno::Sequence<sal_Int8> aDecoded;
410 if (IsXMLToken(msType, XML_BASE64BINARY))
412 std::u16string_view sChars = o3tl::trim(maCharBuffer);
413 if( !sChars.empty() )
414 ::comphelper::Base64::decodeSomeChars( aDecoded, sChars );
415 maCharBuffer.setLength(0);
417 else
418 sValue = maCharBuffer.makeStringAndClear();
420 if (mpBaseContext)
422 if (IsXMLToken(msType, XML_BOOLEAN))
424 bool bValue(false);
425 if (IsXMLToken(sValue, XML_TRUE))
426 bValue = true;
427 mrAny <<= bValue;
429 else if (IsXMLToken(msType, XML_BYTE))
431 sal_Int32 nValue(0);
432 ::sax::Converter::convertNumber(nValue, sValue);
433 mrAny <<= static_cast<sal_Int8>(nValue);
435 else if (IsXMLToken(msType, XML_SHORT))
437 sal_Int32 nValue(0);
438 ::sax::Converter::convertNumber(nValue, sValue);
439 mrAny <<= static_cast<sal_Int16>(nValue);
441 else if (IsXMLToken(msType, XML_INT))
443 sal_Int32 nValue(0);
444 ::sax::Converter::convertNumber(nValue, sValue);
445 mrAny <<= nValue;
447 else if (IsXMLToken(msType, XML_LONG))
449 sal_Int64 nValue(sValue.toInt64());
450 mrAny <<= nValue;
452 else if (IsXMLToken(msType, XML_DOUBLE))
454 double fValue(0.0);
455 ::sax::Converter::convertDouble(fValue, sValue);
456 mrAny <<= fValue;
458 else if (IsXMLToken(msType, XML_STRING))
460 mrAny <<= sValue;
462 else if (IsXMLToken(msType, XML_DATETIME))
464 util::DateTime aDateTime;
465 if (::sax::Converter::parseDateTime(aDateTime, sValue))
466 mrAny <<= aDateTime;
467 else
468 SAL_WARN("xmloff.core", "XMLConfigItemContext: broken DateTime '" << sValue << "'");
470 else if (IsXMLToken(msType, XML_BASE64BINARY))
472 mrAny <<= aDecoded;
474 else {
475 SAL_INFO("xmloff.core",
476 "XMLConfigItemContext: unknown type: " << msType);
479 ManipulateConfigItem();
481 mpBaseContext->AddPropertyValue();
483 else {
484 assert(false && "no BaseContext");
488 /** There are some instances where there is a mismatch between API and
489 * XML mapping of a setting. In this case, this method allows us to
490 * manipulate the values accordingly. */
491 void XMLConfigItemContext::ManipulateConfigItem()
493 if( mrItemName == "PrinterIndependentLayout" )
495 OUString sValue;
496 mrAny >>= sValue;
498 sal_Int16 nTmp = document::PrinterIndependentLayout::HIGH_RESOLUTION;
500 if( sValue == "enabled" || sValue == "low-resolution" )
502 nTmp = document::PrinterIndependentLayout::LOW_RESOLUTION;
504 else if ( sValue == "disabled" )
506 nTmp = document::PrinterIndependentLayout::DISABLED;
508 // else: default to high_resolution
510 mrAny <<= nTmp;
512 else if( (mrItemName == "ColorTableURL") || (mrItemName == "LineEndTableURL") || (mrItemName == "HatchTableURL")
513 || (mrItemName == "DashTableURL") || (mrItemName == "GradientTableURL") || (mrItemName == "BitmapTableURL") )
517 uno::Reference< uno::XComponentContext > xContext( GetImport().GetComponentContext() );
518 uno::Reference< util::XStringSubstitution > xStringSubstitution( util::PathSubstitution::create(xContext) );
520 OUString aURL;
521 mrAny >>= aURL;
522 aURL = xStringSubstitution->substituteVariables( aURL, false );
523 mrAny <<= aURL;
525 catch( uno::Exception& )
531 XMLConfigItemMapNamedContext::XMLConfigItemMapNamedContext(SvXMLImport& rImport,
532 css::uno::Any& rAny,
533 XMLConfigBaseContext* pBaseContext)
534 : XMLConfigBaseContext(rImport, rAny, pBaseContext)
538 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLConfigItemMapNamedContext::createFastChildContext(
539 sal_Int32 nElement,
540 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
542 return CreateSettingsContext(GetImport(), nElement, xAttrList, maProp, this);
545 void XMLConfigItemMapNamedContext::endFastElement(sal_Int32 )
547 if (mpBaseContext)
549 mrAny <<= maProps.GetNameContainer();
550 mpBaseContext->AddPropertyValue();
552 else {
553 assert(false && "no BaseContext");
557 XMLConfigItemMapIndexedContext::XMLConfigItemMapIndexedContext(SvXMLImport& rImport,
558 css::uno::Any& rAny,
559 OUString aConfigItemName,
560 XMLConfigBaseContext* pBaseContext)
561 : XMLConfigBaseContext(rImport, rAny, pBaseContext),
562 maConfigItemName(std::move( aConfigItemName ))
566 css::uno::Reference< css::xml::sax::XFastContextHandler > XMLConfigItemMapIndexedContext::createFastChildContext(
567 sal_Int32 nElement,
568 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
570 return CreateSettingsContext(GetImport(), nElement, xAttrList, maProp, this);
573 void XMLConfigItemMapIndexedContext::endFastElement(sal_Int32 )
575 if (mpBaseContext)
577 if ( maConfigItemName == "ForbiddenCharacters" )
579 uno::Reference< i18n::XForbiddenCharacters > xForbChars;
581 // get the forbidden characters from the document
582 uno::Reference< lang::XMultiServiceFactory > xFac( GetImport().GetModel(), uno::UNO_QUERY );
583 if( xFac.is() )
585 uno::Reference< beans::XPropertySet > xProps( xFac->createInstance( u"com.sun.star.document.Settings"_ustr ), uno::UNO_QUERY );
586 if( xProps.is() && xProps->getPropertySetInfo()->hasPropertyByName( maConfigItemName ) )
588 xProps->getPropertyValue( maConfigItemName ) >>= xForbChars;
592 if( xForbChars.is() )
595 uno::Reference< container::XIndexAccess > xIndex = maProps.GetIndexContainer();
597 const sal_Int32 nCount = xIndex->getCount();
598 uno::Sequence < beans::PropertyValue > aProps;
599 for (sal_Int32 i = 0; i < nCount; i++)
601 if ((xIndex->getByIndex( i ) >>= aProps) && (aProps.getLength() == XML_FORBIDDEN_CHARACTER_MAX ) )
603 /* FIXME-BCP47: this stupid and counterpart in
604 * xmloff/source/core/SettingsExportHelper.cxx
605 * XMLSettingsExportHelper::exportForbiddenCharacters()
606 * */
608 beans::PropertyValue *pForChar = aProps.getArray();
609 i18n::ForbiddenCharacters aForbid;
610 lang::Locale aLocale;
611 bool bHaveLanguage = false, bHaveCountry = false, bHaveVariant = false,
612 bHaveBegin = false, bHaveEnd = false;
614 for ( sal_Int32 j = 0 ; j < XML_FORBIDDEN_CHARACTER_MAX ; j++ )
616 if (pForChar->Name == "Language")
618 pForChar->Value >>= aLocale.Language;
619 bHaveLanguage = true;
621 else if (pForChar->Name == "Country")
623 pForChar->Value >>= aLocale.Country;
624 bHaveCountry = true;
626 else if (pForChar->Name == "Variant")
628 pForChar->Value >>= aLocale.Variant;
629 bHaveVariant = true;
631 else if (pForChar->Name == "BeginLine")
633 pForChar->Value >>= aForbid.beginLine;
634 bHaveBegin = true;
636 else if (pForChar->Name == "EndLine")
638 pForChar->Value >>= aForbid.endLine;
639 bHaveEnd = true;
641 pForChar++;
644 if ( bHaveLanguage && bHaveCountry && bHaveVariant && bHaveBegin && bHaveEnd )
648 xForbChars->setForbiddenCharacters( aLocale, aForbid );
650 catch (uno::Exception const&)
652 TOOLS_WARN_EXCEPTION("xmloff.core",
653 "Exception while importing forbidden characters");
659 else
661 SAL_WARN("xmloff.core", "could not get the XForbiddenCharacters from document!");
662 mrAny <<= maProps.GetIndexContainer();
665 else if ( maConfigItemName == "Symbols" )
667 uno::Reference< container::XIndexAccess > xIndex = maProps.GetIndexContainer();
669 const sal_Int32 nCount = xIndex->getCount();
670 uno::Sequence < beans::PropertyValue > aProps;
671 uno::Sequence < formula::SymbolDescriptor > aSymbolList ( nCount );
673 formula::SymbolDescriptor *pDescriptor = aSymbolList.getArray();
675 sal_Int16 nNumFullEntries = 0;
677 for ( sal_Int32 i = 0; i < nCount; i++ )
679 if ((xIndex->getByIndex( i ) >>= aProps) && (aProps.getLength() == XML_SYMBOL_DESCRIPTOR_MAX ) )
681 bool bHaveName = false, bHaveExportName = false, bHaveCharSet = false,
682 bHaveFontName = false, bHaveFamily = false, bHavePitch = false,
683 bHaveWeight = false, bHaveItalic = false, bHaveSymbolSet = false,
684 bHaveCharacter = false;
685 beans::PropertyValue *pSymbol = aProps.getArray();
687 for ( sal_Int32 j = 0 ; j < XML_SYMBOL_DESCRIPTOR_MAX ; j++ )
689 if (pSymbol->Name == "Name")
691 pSymbol->Value >>= pDescriptor[nNumFullEntries].sName;
692 bHaveName = true;
694 else if (pSymbol->Name == "ExportName")
696 pSymbol->Value >>= pDescriptor[nNumFullEntries].sExportName;
697 bHaveExportName = true;
699 else if (pSymbol->Name == "FontName")
701 pSymbol->Value >>= pDescriptor[nNumFullEntries].sFontName;
702 bHaveFontName = true;
704 else if (pSymbol->Name == "CharSet")
706 pSymbol->Value >>= pDescriptor[nNumFullEntries].nCharSet;
707 bHaveCharSet = true;
709 else if (pSymbol->Name == "Family")
711 pSymbol->Value >>= pDescriptor[nNumFullEntries].nFamily;
712 bHaveFamily = true;
714 else if (pSymbol->Name == "Pitch")
716 pSymbol->Value >>= pDescriptor[nNumFullEntries].nPitch;
717 bHavePitch = true;
719 else if (pSymbol->Name == "Weight")
721 pSymbol->Value >>= pDescriptor[nNumFullEntries].nWeight;
722 bHaveWeight = true;
724 else if (pSymbol->Name == "Italic")
726 pSymbol->Value >>= pDescriptor[nNumFullEntries].nItalic;
727 bHaveItalic = true;
729 else if (pSymbol->Name == "SymbolSet")
731 pSymbol->Value >>= pDescriptor[nNumFullEntries].sSymbolSet;
732 bHaveSymbolSet = true;
734 else if (pSymbol->Name == "Character")
736 pSymbol->Value >>= pDescriptor[nNumFullEntries].nCharacter;
737 bHaveCharacter = true;
739 pSymbol++;
741 if ( bHaveName && bHaveExportName && bHaveCharSet && bHaveFontName && bHaveCharacter
742 && bHaveFamily && bHavePitch && bHaveWeight && bHaveItalic && bHaveSymbolSet)
743 nNumFullEntries++;
746 aSymbolList.realloc (nNumFullEntries);
747 mrAny <<= aSymbolList;
749 else
751 mrAny <<= maProps.GetIndexContainer();
753 mpBaseContext->AddPropertyValue();
755 else {
756 assert(false && "no BaseContext");
760 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */