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