xref: /aoo42x/main/xmloff/source/draw/ximpstyl.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmloff.hxx"
30 
31 
32 #include "ximpstyl.hxx"
33 #include <xmloff/XMLShapeStyleContext.hxx>
34 #include "xmloff/xmlnmspe.hxx"
35 #include <xmloff/xmltoken.hxx>
36 #include <xmloff/xmluconv.hxx>
37 #include "ximpnote.hxx"
38 #include <tools/debug.hxx>
39 
40 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
41 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
42 #include <com/sun/star/presentation/XPresentationPage.hpp>
43 #include <com/sun/star/drawing/XDrawPages.hpp>
44 #include <com/sun/star/container/XNamed.hpp>
45 #include <com/sun/star/beans/XPropertySet.hpp>
46 #include <com/sun/star/beans/XPropertyState.hpp>
47 #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
48 #include <comphelper/namecontainer.hxx>
49 #include <xmloff/xmlprcon.hxx>
50 #include <xmloff/families.hxx>
51 #include <com/sun/star/container/XNameContainer.hpp>
52 #include <svl/zforlist.hxx>
53 #include "PropertySetMerger.hxx"
54 #include "sdpropls.hxx"
55 #include "layerimp.hxx"
56 #include <xmloff/XMLGraphicsDefaultStyle.hxx>
57 #include "XMLNumberStylesImport.hxx"
58 #include "xmloff/xmlerror.hxx"
59 
60 using ::rtl::OUString;
61 using ::rtl::OUStringBuffer;
62 
63 using namespace ::com::sun::star;
64 using namespace ::com::sun::star::uno;
65 using namespace ::com::sun::star::xml::sax;
66 using namespace ::xmloff::token;
67 
68 //////////////////////////////////////////////////////////////////////////////
69 
70 class SdXMLDrawingPagePropertySetContext : public SvXMLPropertySetContext
71 {
72 public:
73 
74 	TYPEINFO();
75 
76 	SdXMLDrawingPagePropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
77 				const ::rtl::OUString& rLName,
78 				 const ::com::sun::star::uno::Reference<
79 				 		::com::sun::star::xml::sax::XAttributeList >& xAttrList,
80 				 ::std::vector< XMLPropertyState > &rProps,
81 				 const UniReference < SvXMLImportPropertyMapper > &rMap );
82 
83 	virtual ~SdXMLDrawingPagePropertySetContext();
84 
85     using SvXMLPropertySetContext::CreateChildContext;
86 	virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
87 								   const ::rtl::OUString& rLocalName,
88 								   const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList,
89 								   ::std::vector< XMLPropertyState > &rProperties,
90 								   const XMLPropertyState& rProp);
91 };
92 
93 TYPEINIT1( SdXMLDrawingPagePropertySetContext, SvXMLPropertySetContext );
94 
95 SdXMLDrawingPagePropertySetContext::SdXMLDrawingPagePropertySetContext(
96 				 SvXMLImport& rImport, sal_uInt16 nPrfx,
97 				 const OUString& rLName,
98 				 const uno::Reference< xml::sax::XAttributeList > & xAttrList,
99 				 ::std::vector< XMLPropertyState > &rProps,
100 				 const UniReference < SvXMLImportPropertyMapper > &rMap ) :
101 	SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList,
102 							 XML_TYPE_PROP_DRAWING_PAGE, rProps, rMap )
103 {
104 }
105 
106 SdXMLDrawingPagePropertySetContext::~SdXMLDrawingPagePropertySetContext()
107 {
108 }
109 
110 SvXMLImportContext *SdXMLDrawingPagePropertySetContext::CreateChildContext(
111 				   sal_uInt16 p_nPrefix,
112 				   const OUString& rLocalName,
113 				   const uno::Reference< xml::sax::XAttributeList > & xAttrList,
114 				   ::std::vector< XMLPropertyState > &rProperties,
115 				   const XMLPropertyState& rProp )
116 {
117 	SvXMLImportContext *pContext = 0;
118 
119 	switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
120 	{
121 	case CTF_PAGE_SOUND_URL:
122 	{
123 		const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
124 		for(sal_Int16 i=0; i < nAttrCount; i++)
125 		{
126 			OUString aLocalName;
127 			sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(xAttrList->getNameByIndex(i), &aLocalName);
128 
129 			if( (nPrefix == XML_NAMESPACE_XLINK) && IsXMLToken( aLocalName, XML_HREF ) )
130 			{
131 				uno::Any aAny( GetImport().GetAbsoluteReference( xAttrList->getValueByIndex(i) ) );
132 				XMLPropertyState aPropState( rProp.mnIndex, aAny );
133 				rProperties.push_back( aPropState );
134 			}
135 		}
136 		break;
137 	}
138 	}
139 
140 	if( !pContext )
141 		pContext = SvXMLPropertySetContext::CreateChildContext( p_nPrefix, rLocalName,
142 															xAttrList,
143 															rProperties, rProp );
144 
145 	return pContext;
146 }
147 
148 //////////////////////////////////////////////////////////////////////////////
149 
150 class SdXMLDrawingPageStyleContext : public XMLPropStyleContext
151 {
152 public:
153 	TYPEINFO();
154 
155 	SdXMLDrawingPageStyleContext(
156 		SvXMLImport& rImport,
157 		sal_uInt16 nPrfx,
158 		const rtl::OUString& rLName,
159 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
160 		SvXMLStylesContext& rStyles,
161 		sal_uInt16 nFamily = XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID);
162 	virtual ~SdXMLDrawingPageStyleContext();
163 
164 	SvXMLImportContext * CreateChildContext(
165 		sal_uInt16 nPrefix,
166 		const ::rtl::OUString& rLocalName,
167 		const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
168 
169 	virtual void Finish( sal_Bool bOverwrite );
170 
171     // #i35918#
172 	virtual void FillPropertySet(
173 			const ::com::sun::star::uno::Reference<
174 				::com::sun::star::beans::XPropertySet > & rPropSet );
175 };
176 
177 TYPEINIT1( SdXMLDrawingPageStyleContext, XMLPropStyleContext );
178 
179 SdXMLDrawingPageStyleContext::SdXMLDrawingPageStyleContext(
180 	SvXMLImport& rImport,
181 	sal_uInt16 nPrfx,
182 	const OUString& rLName,
183 	const uno::Reference< xml::sax::XAttributeList >& xAttrList,
184 	SvXMLStylesContext& rStyles,
185 	sal_uInt16 nFamily)
186 :	XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily )
187 {
188 }
189 
190 SdXMLDrawingPageStyleContext::~SdXMLDrawingPageStyleContext()
191 {
192 }
193 
194 SvXMLImportContext *SdXMLDrawingPageStyleContext::CreateChildContext(
195 		sal_uInt16 nPrefix,
196 		const OUString& rLocalName,
197 		const uno::Reference< xml::sax::XAttributeList > & xAttrList )
198 {
199 	SvXMLImportContext *pContext = 0;
200 
201 	if( XML_NAMESPACE_STYLE == nPrefix &&
202 		IsXMLToken( rLocalName, XML_DRAWING_PAGE_PROPERTIES ) )
203 	{
204 		UniReference < SvXMLImportPropertyMapper > xImpPrMap =
205 			GetStyles()->GetImportPropertyMapper( GetFamily() );
206 		if( xImpPrMap.is() )
207 			pContext = new SdXMLDrawingPagePropertySetContext( GetImport(), nPrefix,
208 													rLocalName, xAttrList,
209 													GetProperties(),
210 													xImpPrMap );
211 	}
212 
213 	if( !pContext )
214 		pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName,
215 														  xAttrList );
216 
217 	return pContext;
218 }
219 
220 void SdXMLDrawingPageStyleContext::Finish( sal_Bool bOverwrite )
221 {
222 	XMLPropStyleContext::Finish( bOverwrite );
223 
224 	::std::vector< XMLPropertyState > &rProperties = GetProperties();
225 
226 	const UniReference< XMLPropertySetMapper >& rImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() )->getPropertySetMapper();
227 
228 	::std::vector< XMLPropertyState >::iterator property = rProperties.begin();
229 	for(; property != rProperties.end(); property++)
230 	{
231 		if( property->mnIndex == -1 )
232 			continue;
233 
234 		sal_Int16 nContextID = rImpPrMap->GetEntryContextId(property->mnIndex);
235 		switch( nContextID )
236 		{
237 			case CTF_DATE_TIME_FORMAT:
238 			{
239 				OUString sStyleName;
240 				(*property).maValue >>= sStyleName;
241 
242 				sal_Int32 nStyle = 0;
243 
244 				SdXMLNumberFormatImportContext* pSdNumStyle =
245 					PTR_CAST( SdXMLNumberFormatImportContext,
246 						GetStyles()->FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, sStyleName, sal_True ) );
247 
248 				if( pSdNumStyle )
249 					nStyle = pSdNumStyle->GetDrawKey();
250 
251 				(*property).maValue <<= nStyle;
252 			}
253 			break;
254 		}
255 	}
256 
257 }
258 
259 // #i35918#
260 void SdXMLDrawingPageStyleContext::FillPropertySet(
261     const Reference< beans::XPropertySet > & rPropSet )
262 {
263 	const sal_uInt16 MAX_SPECIAL_DRAW_STYLES = 7;
264 	struct _ContextID_Index_Pair aContextIDs[MAX_SPECIAL_DRAW_STYLES+1] =
265 	{
266 		{ CTF_DASHNAME , -1 },
267 		{ CTF_LINESTARTNAME , -1 },
268 		{ CTF_LINEENDNAME , -1 },
269 		{ CTF_FILLGRADIENTNAME, -1 },
270 		{ CTF_FILLTRANSNAME , -1 },
271 		{ CTF_FILLHATCHNAME , -1 },
272 		{ CTF_FILLBITMAPNAME , -1 },
273 		{ -1, -1 }
274 	};
275 	static sal_uInt16 aFamilies[MAX_SPECIAL_DRAW_STYLES] =
276 	{
277 		XML_STYLE_FAMILY_SD_STROKE_DASH_ID,
278 		XML_STYLE_FAMILY_SD_MARKER_ID,
279 		XML_STYLE_FAMILY_SD_MARKER_ID,
280 		XML_STYLE_FAMILY_SD_GRADIENT_ID,
281 		XML_STYLE_FAMILY_SD_GRADIENT_ID,
282 		XML_STYLE_FAMILY_SD_HATCH_ID,
283 		XML_STYLE_FAMILY_SD_FILL_IMAGE_ID
284 	};
285 
286 	UniReference < SvXMLImportPropertyMapper > xImpPrMap =
287 		GetStyles()->GetImportPropertyMapper( GetFamily() );
288 	DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
289     if( xImpPrMap.is() )
290 		xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs );
291 
292     Reference< beans::XPropertySetInfo > xInfo;
293 	for( sal_uInt16 i=0; i<MAX_SPECIAL_DRAW_STYLES; i++ )
294 	{
295 		sal_Int32 nIndex = aContextIDs[i].nIndex;
296 		if( nIndex != -1 )
297 		{
298 			struct XMLPropertyState& rState = GetProperties()[nIndex];
299 			OUString sStyleName;
300 			rState.maValue >>= sStyleName;
301 			sStyleName = GetImport().GetStyleDisplayName( aFamilies[i],
302 														  sStyleName );
303 			// get property set mapper
304 			UniReference<XMLPropertySetMapper> rPropMapper =
305 										xImpPrMap->getPropertySetMapper();
306 
307 			// set property
308 			const OUString& rPropertyName =
309 					rPropMapper->GetEntryAPIName(rState.mnIndex);
310 			if( !xInfo.is() )
311 				xInfo = rPropSet->getPropertySetInfo();
312 			if ( xInfo->hasPropertyByName( rPropertyName ) )
313 			{
314 				rPropSet->setPropertyValue( rPropertyName, Any( sStyleName ) );
315 			}
316 		}
317 	}
318 }
319 
320 //////////////////////////////////////////////////////////////////////////////
321 
322 TYPEINIT1( SdXMLPageMasterStyleContext, SvXMLStyleContext );
323 
324 SdXMLPageMasterStyleContext::SdXMLPageMasterStyleContext(
325 	SdXMLImport& rImport,
326 	sal_uInt16 nPrfx,
327 	const OUString& rLName,
328 	const uno::Reference< xml::sax::XAttributeList>& xAttrList)
329 :	SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERSTYLECONEXT_ID),
330 	mnBorderBottom( 0L ),
331 	mnBorderLeft( 0L ),
332 	mnBorderRight( 0L ),
333 	mnBorderTop( 0L ),
334 	mnWidth( 0L ),
335 	mnHeight( 0L ),
336 	meOrientation(GetSdImport().IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
337 {
338 	// set family to something special at SvXMLStyleContext
339 	// for differences in search-methods
340 
341 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
342 	for(sal_Int16 i=0; i < nAttrCount; i++)
343 	{
344 		OUString sAttrName = xAttrList->getNameByIndex(i);
345 		OUString aLocalName;
346 		sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
347 		OUString sValue = xAttrList->getValueByIndex(i);
348 		const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPageMasterStyleAttrTokenMap();
349 
350 		switch(rAttrTokenMap.Get(nPrefix, aLocalName))
351 		{
352 			case XML_TOK_PAGEMASTERSTYLE_MARGIN_TOP:
353 			{
354 				GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderTop, sValue);
355 				break;
356 			}
357 			case XML_TOK_PAGEMASTERSTYLE_MARGIN_BOTTOM:
358 			{
359 				GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderBottom, sValue);
360 				break;
361 			}
362 			case XML_TOK_PAGEMASTERSTYLE_MARGIN_LEFT:
363 			{
364 				GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderLeft, sValue);
365 				break;
366 			}
367 			case XML_TOK_PAGEMASTERSTYLE_MARGIN_RIGHT:
368 			{
369 				GetSdImport().GetMM100UnitConverter().convertMeasure(mnBorderRight, sValue);
370 				break;
371 			}
372 			case XML_TOK_PAGEMASTERSTYLE_PAGE_WIDTH:
373 			{
374 				GetSdImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue);
375 				break;
376 			}
377 			case XML_TOK_PAGEMASTERSTYLE_PAGE_HEIGHT:
378 			{
379 				GetSdImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue);
380 				break;
381 			}
382 			case XML_TOK_PAGEMASTERSTYLE_PAGE_ORIENTATION:
383 			{
384 				if( IsXMLToken( sValue, XML_PORTRAIT ) )
385 					meOrientation = view::PaperOrientation_PORTRAIT;
386 				else
387 					meOrientation = view::PaperOrientation_LANDSCAPE;
388 				break;
389 			}
390 		}
391 	}
392 }
393 
394 //////////////////////////////////////////////////////////////////////////////
395 
396 SdXMLPageMasterStyleContext::~SdXMLPageMasterStyleContext()
397 {
398 }
399 
400 //////////////////////////////////////////////////////////////////////////////
401 //////////////////////////////////////////////////////////////////////////////
402 
403 TYPEINIT1( SdXMLPageMasterContext, SvXMLStyleContext );
404 
405 SdXMLPageMasterContext::SdXMLPageMasterContext(
406 	SdXMLImport& rImport,
407 	sal_uInt16 nPrfx,
408 	const OUString& rLName,
409 	const uno::Reference< xml::sax::XAttributeList>& xAttrList)
410 :	SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID),
411 	mpPageMasterStyle( 0L )
412 {
413 	// set family to something special at SvXMLStyleContext
414 	// for differences in search-methods
415 
416 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
417 	for(sal_Int16 i=0; i < nAttrCount; i++)
418 	{
419 		OUString sAttrName = xAttrList->getNameByIndex(i);
420 		OUString aLocalName;
421 		sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
422 		OUString sValue = xAttrList->getValueByIndex(i);
423 		const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPageMasterAttrTokenMap();
424 
425 		switch(rAttrTokenMap.Get(nPrefix, aLocalName))
426 		{
427 			case XML_TOK_PAGEMASTER_NAME:
428 			{
429 				msName = sValue;
430 				break;
431 			}
432 		}
433 	}
434 }
435 
436 //////////////////////////////////////////////////////////////////////////////
437 
438 SdXMLPageMasterContext::~SdXMLPageMasterContext()
439 {
440 	// release remembered contexts, they are no longer needed
441 	if(mpPageMasterStyle)
442 	{
443 		mpPageMasterStyle->ReleaseRef();
444 		mpPageMasterStyle = 0L;
445 	}
446 }
447 
448 //////////////////////////////////////////////////////////////////////////////
449 
450 SvXMLImportContext *SdXMLPageMasterContext::CreateChildContext(
451 	sal_uInt16 nPrefix,
452 	const OUString& rLocalName,
453 	const uno::Reference< xml::sax::XAttributeList >& xAttrList )
454 {
455 	SvXMLImportContext* pContext = 0;
456 
457 	if(nPrefix == XML_NAMESPACE_STYLE && IsXMLToken( rLocalName, XML_PAGE_LAYOUT_PROPERTIES) )
458 	{
459 		pContext = new SdXMLPageMasterStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
460 
461 		// remember SdXMLPresentationPlaceholderContext for later evaluation
462 		if(pContext)
463 		{
464 			pContext->AddRef();
465 			DBG_ASSERT(!mpPageMasterStyle, "PageMasterStyle is set, there seem to be two of them (!)");
466 			mpPageMasterStyle = (SdXMLPageMasterStyleContext*)pContext;
467 		}
468 	}
469 
470 	// call base class
471 	if(!pContext)
472 		pContext = SvXMLStyleContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
473 
474 	return pContext;
475 }
476 
477 //////////////////////////////////////////////////////////////////////////////
478 //////////////////////////////////////////////////////////////////////////////
479 
480 TYPEINIT1( SdXMLPresentationPageLayoutContext, SvXMLStyleContext );
481 
482 SdXMLPresentationPageLayoutContext::SdXMLPresentationPageLayoutContext(
483 	SdXMLImport& rImport,
484 	sal_uInt16 nPrfx,
485 	const OUString& rLName,
486 	const uno::Reference< xml::sax::XAttributeList >& xAttrList)
487 :	SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList, XML_STYLE_FAMILY_SD_PRESENTATIONPAGELAYOUT_ID),
488 	mnTypeId( 20 ) // AUTOLAYOUT_NONE
489 {
490 	// set family to somethiong special at SvXMLStyleContext
491 	// for differences in search-methods
492 
493 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
494 	for( sal_Int16 i=0; i < nAttrCount; i++ )
495 	{
496 		const OUString& rAttrName = xAttrList->getNameByIndex( i );
497 		OUString aLocalName;
498 		sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,	&aLocalName );
499 
500 		if(nPrefix == XML_NAMESPACE_STYLE && IsXMLToken( aLocalName, XML_NAME ) )
501 		{
502 			msName = xAttrList->getValueByIndex( i );
503 		}
504 	}
505 }
506 
507 SdXMLPresentationPageLayoutContext::~SdXMLPresentationPageLayoutContext()
508 {
509 }
510 
511 SvXMLImportContext *SdXMLPresentationPageLayoutContext::CreateChildContext(
512 	sal_uInt16 nPrefix,
513 	const OUString& rLocalName,
514 	const uno::Reference< xml::sax::XAttributeList >& xAttrList )
515 {
516 	SvXMLImportContext* pContext = 0;
517 
518 	if(nPrefix == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_PLACEHOLDER ) )
519 	{
520 		// presentation:placeholder inside style:presentation-page-layout context
521 		pContext = new SdXMLPresentationPlaceholderContext(
522 			GetSdImport(), nPrefix, rLocalName, xAttrList);
523 
524 		// remember SdXMLPresentationPlaceholderContext for later evaluation
525 		if(pContext)
526 		{
527 			pContext->AddRef();
528 			maList.Insert((SdXMLPresentationPlaceholderContext*)pContext, LIST_APPEND);
529 		}
530 	}
531 
532 	// call base class
533 	if(!pContext)
534 		pContext = SvXMLStyleContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
535 
536 	return pContext;
537 }
538 
539 void SdXMLPresentationPageLayoutContext::EndElement()
540 {
541 	// build presentation page layout type here
542 	// calc mnTpeId due to content of maList
543 	// at the moment only use number of types used there
544 	if(maList.Count())
545 	{
546 		SdXMLPresentationPlaceholderContext* pObj0 = maList.GetObject(0);
547 		if(pObj0->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("handout"))))
548 		{
549 			switch( maList.Count() )
550 			{
551 			case 1:
552 				mnTypeId = 22; // AUTOLAYOUT_HANDOUT1
553 				break;
554 			case 2:
555 				mnTypeId = 23; // AUTOLAYOUT_HANDOUT2
556 				break;
557 			case 3:
558 				mnTypeId = 24; // AUTOLAYOUT_HANDOUT3
559 				break;
560 			case 4:
561 				mnTypeId = 25; // AUTOLAYOUT_HANDOUT4
562 				break;
563 			case 9:
564 				mnTypeId = 31; // AUTOLAYOUT_HANDOUT9
565 				break;
566 			default:
567 				mnTypeId = 26; // AUTOLAYOUT_HANDOUT6
568 			}
569 		}
570 		else
571 		{
572 			switch(maList.Count())
573 			{
574 				case 1:
575 				{
576                     if(pObj0->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("title"))))
577 					{
578     					mnTypeId = 19; // AUTOLAYOUT_ONLY_TITLE
579                     }
580                     else
581                     {
582                         mnTypeId = 32; // AUTOLAYOUT_ONLY_TEXT
583                     }
584 					break;
585 				}
586 				case 2:
587 				{
588 					SdXMLPresentationPlaceholderContext* pObj1 = maList.GetObject(1);
589 
590 					if(pObj1->GetName().equals(
591 						OUString(RTL_CONSTASCII_USTRINGPARAM("subtitle"))))
592 					{
593 						mnTypeId = 0; // AUTOLAYOUT_TITLE
594 					}
595 					else if(pObj1->GetName().equals(
596 						OUString(RTL_CONSTASCII_USTRINGPARAM("outline"))))
597 					{
598 						mnTypeId = 1; // AUTOLAYOUT_ENUM
599 					}
600 					else if(pObj1->GetName().equals(
601 						OUString(RTL_CONSTASCII_USTRINGPARAM("chart"))))
602 					{
603 						mnTypeId = 2; // AUTOLAYOUT_CHART
604 					}
605 					else if(pObj1->GetName().equals(
606 						OUString(RTL_CONSTASCII_USTRINGPARAM("table"))))
607 					{
608 						mnTypeId = 8; // AUTOLAYOUT_TAB
609 					}
610 					else if(pObj1->GetName().equals(
611 						OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
612 					{
613 						mnTypeId = 11; // AUTOLAYOUT_OBJ
614 					}
615 					else if(pObj1->GetName().equals(
616 						OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline"))))
617 					{
618 						if(pObj0->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_title"))))
619 						{
620 							// AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
621 							mnTypeId = 28;
622 						}
623 						else
624 						{
625 							// AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
626 							mnTypeId = 29;
627 						}
628 					}
629 					else
630 					{
631 						mnTypeId = 21; // AUTOLAYOUT_NOTES
632 					}
633 					break;
634 				}
635 				case 3:
636 				{
637 					SdXMLPresentationPlaceholderContext* pObj1 = maList.GetObject(1);
638 					SdXMLPresentationPlaceholderContext* pObj2 = maList.GetObject(2);
639 
640 					if(pObj1->GetName().equals(
641 						OUString(RTL_CONSTASCII_USTRINGPARAM("outline"))))
642 					{
643 						if(pObj2->GetName().equals(
644 							OUString(RTL_CONSTASCII_USTRINGPARAM("outline"))))
645 						{
646 							mnTypeId = 3; // AUTOLAYOUT_2TEXT
647 						}
648 						else if(pObj2->GetName().equals(
649 							OUString(RTL_CONSTASCII_USTRINGPARAM("chart"))))
650 						{
651 							mnTypeId = 4; // AUTOLAYOUT_TEXTCHART
652 						}
653 						else if(pObj2->GetName().equals(
654 							OUString(RTL_CONSTASCII_USTRINGPARAM("graphic"))))
655 						{
656 							mnTypeId = 6; // AUTOLAYOUT_TEXTCLIP
657 						}
658 						else
659 						{
660 							if(pObj1->GetX() < pObj2->GetX())
661 							{
662 								mnTypeId = 10; // AUTOLAYOUT_TEXTOBJ -> outline left, object right
663 							}
664 							else
665 							{
666 								mnTypeId = 17; // AUTOLAYOUT_TEXTOVEROBJ -> outline top, object right
667 							}
668 						}
669 					}
670 					else if(pObj1->GetName().equals(
671 						OUString(RTL_CONSTASCII_USTRINGPARAM("chart"))))
672 					{
673 						mnTypeId = 7; // AUTOLAYOUT_CHARTTEXT
674 					}
675 					else if(pObj1->GetName().equals(
676 						OUString(RTL_CONSTASCII_USTRINGPARAM("graphic"))))
677 					{
678 						if(pObj2->GetName().equals(OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline"))))
679 						{
680 							// AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
681 							mnTypeId = 30;
682 						}
683 						else
684 						{
685 							mnTypeId = 9; // AUTOLAYOUT_CLIPTEXT
686 						}
687 					}
688 					else if(pObj1->GetName().equals(
689 						OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline"))))
690 					{
691 						// AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
692 						mnTypeId = 27;
693 					}
694 					else
695 					{
696 						if(pObj1->GetX() < pObj2->GetX())
697 						{
698 							mnTypeId = 13; // AUTOLAYOUT_OBJTEXT -> left, right
699 						}
700 						else
701 						{
702 							mnTypeId = 14; // AUTOLAYOUT_OBJOVERTEXT -> top, bottom
703 						}
704 					}
705 					break;
706 				}
707 				case 4:
708 				{
709 					SdXMLPresentationPlaceholderContext* pObj1 = maList.GetObject(1);
710 					SdXMLPresentationPlaceholderContext* pObj2 = maList.GetObject(2);
711 
712 					if(pObj1->GetName().equals(
713 						OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
714 					{
715 						if(pObj1->GetX() < pObj2->GetX())
716 						{
717 							mnTypeId = 16; // AUTOLAYOUT_2OBJOVERTEXT
718 						}
719 						else
720 						{
721 							mnTypeId = 15; // AUTOLAYOUT_2OBJTEXT
722 						}
723 					}
724 					else
725 					{
726 						mnTypeId = 12; // AUTOLAYOUT_TEXT2OBJ
727 					}
728 					break;
729 				}
730 				case 5:
731 				{
732 					SdXMLPresentationPlaceholderContext* pObj1 = maList.GetObject(1);
733 
734 					if(pObj1->GetName().equals(
735 						OUString(RTL_CONSTASCII_USTRINGPARAM("object"))))
736 					{
737 						mnTypeId = 18; // AUTOLAYOUT_4OBJ
738 					}
739 					else
740 					{
741 						mnTypeId = 33; // AUTOLAYOUT_4CLIPART
742 					}
743  					break;
744 
745 				}
746                 case 7:
747                 {
748                     mnTypeId = 33; // AUTOLAYOUT_6CLIPART
749 					break;
750                 }
751                 default:
752                 {
753                     mnTypeId = 20; // AUTOLAYOUT_NONE
754                     break;
755                 }
756 			}
757 		}
758 
759 		// release remembered contexts, they are no longer needed
760 		while(maList.Count())
761 			maList.Remove(maList.Count() - 1)->ReleaseRef();
762 	}
763 }
764 
765 //////////////////////////////////////////////////////////////////////////////
766 //////////////////////////////////////////////////////////////////////////////
767 
768 SdXMLPresentationPlaceholderContext::SdXMLPresentationPlaceholderContext(
769 	SdXMLImport& rImport,
770 	sal_uInt16 nPrfx, const
771 	OUString& rLName,
772 	const uno::Reference< xml::sax::XAttributeList>& xAttrList)
773 :	SvXMLImportContext( rImport, nPrfx, rLName),
774 	mnX(0L),
775 	mnY(0L),
776 	mnWidth(1L),
777 	mnHeight(1L)
778 {
779 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
780 	for(sal_Int16 i=0; i < nAttrCount; i++)
781 	{
782 		OUString sAttrName = xAttrList->getNameByIndex(i);
783 		OUString aLocalName;
784 		sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName(sAttrName, &aLocalName);
785 		OUString sValue = xAttrList->getValueByIndex(i);
786 		const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetPresentationPlaceholderAttrTokenMap();
787 
788 		switch(rAttrTokenMap.Get(nPrefix, aLocalName))
789 		{
790 			case XML_TOK_PRESENTATIONPLACEHOLDER_OBJECTNAME:
791 			{
792 				msName = sValue;
793 				break;
794 			}
795 			case XML_TOK_PRESENTATIONPLACEHOLDER_X:
796 			{
797 				GetSdImport().GetMM100UnitConverter().convertMeasure(mnX, sValue);
798 				break;
799 			}
800 			case XML_TOK_PRESENTATIONPLACEHOLDER_Y:
801 			{
802 				GetSdImport().GetMM100UnitConverter().convertMeasure(mnY, sValue);
803 				break;
804 			}
805 			case XML_TOK_PRESENTATIONPLACEHOLDER_WIDTH:
806 			{
807 				GetSdImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue);
808 				break;
809 			}
810 			case XML_TOK_PRESENTATIONPLACEHOLDER_HEIGHT:
811 			{
812 				GetSdImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue);
813 				break;
814 			}
815 		}
816 	}
817 }
818 
819 //////////////////////////////////////////////////////////////////////////////
820 
821 SdXMLPresentationPlaceholderContext::~SdXMLPresentationPlaceholderContext()
822 {
823 }
824 
825 //////////////////////////////////////////////////////////////////////////////
826 //////////////////////////////////////////////////////////////////////////////
827 
828 TYPEINIT1( SdXMLMasterPageContext, SdXMLGenericPageContext );
829 
830 SdXMLMasterPageContext::SdXMLMasterPageContext(
831 	SdXMLImport& rImport,
832 	sal_uInt16 nPrfx,
833 	const OUString& rLName,
834 	const uno::Reference< xml::sax::XAttributeList>& xAttrList,
835 	uno::Reference< drawing::XShapes >& rShapes)
836 :	SdXMLGenericPageContext( rImport, nPrfx, rLName, xAttrList, rShapes )
837 {
838 	const sal_Bool bHandoutMaster = IsXMLToken( rLName, XML_HANDOUT_MASTER );
839 
840 	const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
841 	for(sal_Int16 i=0; i < nAttrCount; i++)
842 	{
843 		OUString sAttrName = xAttrList->getNameByIndex( i );
844 		OUString aLocalName;
845 		sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
846 		OUString sValue = xAttrList->getValueByIndex( i );
847 		const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
848 
849 		switch(rAttrTokenMap.Get(nPrefix, aLocalName))
850 		{
851 			case XML_TOK_MASTERPAGE_NAME:
852 			{
853 				msName = sValue;
854 				break;
855 			}
856 			case XML_TOK_MASTERPAGE_DISPLAY_NAME:
857 			{
858 				msDisplayName = sValue;
859 				break;
860 			}
861 			case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
862 			{
863 				msPageMasterName = sValue;
864 				break;
865 			}
866 			case XML_TOK_MASTERPAGE_STYLE_NAME:
867 			{
868 				msStyleName = sValue;
869 				break;
870 			}
871 			case XML_TOK_MASTERPAGE_PAGE_LAYOUT_NAME:
872 			{
873 				maPageLayoutName = sValue;
874 				break;
875 			}
876 			case XML_TOK_MASTERPAGE_USE_HEADER_NAME:
877 			{
878 				maUseHeaderDeclName =  sValue;
879 				break;
880 			}
881 			case XML_TOK_MASTERPAGE_USE_FOOTER_NAME:
882 			{
883 				maUseFooterDeclName =  sValue;
884 				break;
885 			}
886 			case XML_TOK_MASTERPAGE_USE_DATE_TIME_NAME:
887 			{
888 				maUseDateTimeDeclName =  sValue;
889 				break;
890 			}
891 		}
892 	}
893 
894 	if( !msDisplayName.getLength() )
895 		msDisplayName = msName;
896 	else if( msDisplayName != msName )
897 		GetImport().AddStyleDisplayName( XML_STYLE_FAMILY_MASTER_PAGE, msName, msDisplayName );
898 
899 	GetImport().GetShapeImport()->startPage( GetLocalShapesContext() );
900 
901 	// set page name?
902 	if(!bHandoutMaster && msDisplayName.getLength() && GetLocalShapesContext().is())
903 	{
904 		uno::Reference < container::XNamed > xNamed(GetLocalShapesContext(), uno::UNO_QUERY);
905 		if(xNamed.is())
906 			xNamed->setName(msDisplayName);
907 	}
908 
909 	// set page-master?
910 	if(msPageMasterName.getLength())
911 	{
912 		SetPageMaster( msPageMasterName );
913 	}
914 
915 	SetStyle( msStyleName );
916 
917 	SetLayout();
918 
919 	DeleteAllShapes();
920 }
921 
922 //////////////////////////////////////////////////////////////////////////////
923 
924 SdXMLMasterPageContext::~SdXMLMasterPageContext()
925 {
926 }
927 
928 //////////////////////////////////////////////////////////////////////////////
929 
930 void SdXMLMasterPageContext::EndElement()
931 {
932 	// set styles on master-page
933 	if(msName.getLength() && GetSdImport().GetShapeImport()->GetStylesContext())
934 	{
935 		SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetStylesContext();
936 		if( pContext && pContext->ISA( SvXMLStyleContext ) )
937 			((SdXMLStylesContext*)pContext)->SetMasterPageStyles(*this);
938 	}
939 
940 	SdXMLGenericPageContext::EndElement();
941 	GetImport().GetShapeImport()->endPage(GetLocalShapesContext());
942 }
943 
944 //////////////////////////////////////////////////////////////////////////////
945 
946 SvXMLImportContext* SdXMLMasterPageContext::CreateChildContext(
947 	sal_uInt16 nPrefix,
948 	const OUString& rLocalName,
949 	const uno::Reference< xml::sax::XAttributeList>& xAttrList )
950 {
951 	SvXMLImportContext* pContext = 0;
952 	const SvXMLTokenMap& rTokenMap = GetSdImport().GetMasterPageElemTokenMap();
953 
954 	// some special objects inside style:masterpage context
955 	switch(rTokenMap.Get(nPrefix, rLocalName))
956 	{
957 		case XML_TOK_MASTERPAGE_STYLE:
958 		{
959 			if(GetSdImport().GetShapeImport()->GetStylesContext())
960 			{
961 				// style:style inside master-page context -> presentation style
962 				XMLShapeStyleContext* pNew = new XMLShapeStyleContext(
963 					GetSdImport(), nPrefix, rLocalName, xAttrList,
964 					*GetSdImport().GetShapeImport()->GetStylesContext(),
965 					XML_STYLE_FAMILY_SD_PRESENTATION_ID);
966 
967 				// add this style to the outer StylesContext class for later processing
968 				if(pNew)
969 				{
970 					pContext = pNew;
971 					GetSdImport().GetShapeImport()->GetStylesContext()->AddStyle(*pNew);
972 				}
973 			}
974 			break;
975 		}
976 		case XML_TOK_MASTERPAGE_NOTES:
977 		{
978 			if( GetSdImport().IsImpress() )
979 			{
980 				// get notes page
981 				uno::Reference< presentation::XPresentationPage > xPresPage(GetLocalShapesContext(), uno::UNO_QUERY);
982 				if(xPresPage.is())
983 				{
984 					uno::Reference< drawing::XDrawPage > xNotesDrawPage(xPresPage->getNotesPage(), uno::UNO_QUERY);
985 					if(xNotesDrawPage.is())
986 					{
987 						uno::Reference< drawing::XShapes > xNewShapes(xNotesDrawPage, uno::UNO_QUERY);
988 						if(xNewShapes.is())
989 						{
990 							// presentation:notes inside master-page context
991 							pContext = new SdXMLNotesContext( GetSdImport(), nPrefix, rLocalName, xAttrList, xNewShapes);
992 						}
993 					}
994 				}
995 			}
996 		}
997 	}
998 
999 	// call base class
1000 	if(!pContext)
1001 		pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
1002 
1003 	return pContext;
1004 }
1005 
1006 //////////////////////////////////////////////////////////////////////////////
1007 //////////////////////////////////////////////////////////////////////////////
1008 
1009 TYPEINIT1( SdXMLStylesContext, SvXMLStyleContext );
1010 
1011 SdXMLStylesContext::SdXMLStylesContext(
1012 	SdXMLImport& rImport,
1013 	sal_uInt16 nPrfx,
1014 	const OUString& rLName,
1015 	const uno::Reference< xml::sax::XAttributeList >& xAttrList,
1016 	sal_Bool bIsAutoStyle)
1017 :	SvXMLStylesContext(rImport, nPrfx, rLName, xAttrList),
1018 	mbIsAutoStyle(bIsAutoStyle)
1019 {
1020 	// #110680#
1021 	// Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
1022 	Reference< lang::XMultiServiceFactory > xMSF = rImport.getServiceFactory();
1023 
1024 	mpNumFormatter = new SvNumberFormatter( xMSF, LANGUAGE_SYSTEM );
1025 
1026 	// #110680#
1027 	// mpNumFmtHelper = new SvXMLNumFmtHelper( mpNumFormatter );
1028 	mpNumFmtHelper = new SvXMLNumFmtHelper( mpNumFormatter, xMSF );
1029 }
1030 
1031 //////////////////////////////////////////////////////////////////////////////
1032 
1033 SdXMLStylesContext::~SdXMLStylesContext()
1034 {
1035 	delete mpNumFmtHelper;
1036 	delete mpNumFormatter;
1037 }
1038 
1039 //////////////////////////////////////////////////////////////////////////////
1040 
1041 SvXMLStyleContext* SdXMLStylesContext::CreateStyleChildContext(
1042 	sal_uInt16 nPrefix,
1043 	const OUString& rLocalName,
1044 	const uno::Reference< xml::sax::XAttributeList >& xAttrList)
1045 {
1046 	SvXMLStyleContext* pContext = 0;
1047 	const SvXMLTokenMap& rStyleTokenMap = GetSdImport().GetStylesElemTokenMap();
1048 
1049 	switch(rStyleTokenMap.Get(nPrefix, rLocalName))
1050 	{
1051 		case XML_TOK_STYLES_PAGE_MASTER:
1052 		{
1053 			// style:page-master inside office:styles context
1054 			pContext = new SdXMLPageMasterContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
1055 			break;
1056 		}
1057 		case XML_TOK_STYLES_PRESENTATION_PAGE_LAYOUT:
1058 		{
1059 			// style:presentation-page-layout inside office:styles context
1060 			pContext = new SdXMLPresentationPageLayoutContext(GetSdImport(), nPrefix, rLocalName, xAttrList);
1061 			break;
1062 		}
1063 	}
1064 
1065 	if(!pContext)
1066 	{
1067 		const SvXMLTokenMap& rTokenMap = mpNumFmtHelper->GetStylesElemTokenMap();
1068 		sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
1069 		switch (nToken)
1070 		{
1071 			case XML_TOK_STYLES_DATE_STYLE:
1072 			case XML_TOK_STYLES_TIME_STYLE:
1073 				// number:date-style or number:time-style
1074 				pContext = new SdXMLNumberFormatImportContext( GetSdImport(), nPrefix, rLocalName, mpNumFmtHelper->getData(), nToken, xAttrList, *this );
1075 				break;
1076 
1077 			case XML_TOK_STYLES_NUMBER_STYLE:
1078 			case XML_TOK_STYLES_CURRENCY_STYLE:
1079 			case XML_TOK_STYLES_PERCENTAGE_STYLE:
1080 			case XML_TOK_STYLES_BOOLEAN_STYLE:
1081 			case XML_TOK_STYLES_TEXT_STYLE:
1082 				pContext = new SvXMLNumFormatContext( GetSdImport(), nPrefix, rLocalName,
1083 														mpNumFmtHelper->getData(), nToken, xAttrList, *this );
1084 				break;
1085 		}
1086 	}
1087 
1088 	if(!pContext && nPrefix == XML_NAMESPACE_PRESENTATION )
1089 	{
1090 		if( IsXMLToken( rLocalName, XML_HEADER_DECL ) ||
1091 			IsXMLToken( rLocalName, XML_FOOTER_DECL ) ||
1092 			IsXMLToken( rLocalName, XML_DATE_TIME_DECL ) )
1093 		{
1094 			pContext = new SdXMLHeaderFooterDeclContext( GetImport(), nPrefix, rLocalName, xAttrList );
1095 		}
1096 	}
1097 
1098 	if(!pContext && (nPrefix == XML_NAMESPACE_TABLE) && IsXMLToken( rLocalName, XML_TABLE_TEMPLATE ) )
1099 	{
1100 		pContext = GetImport().GetShapeImport()->GetShapeTableImport()->CreateTableTemplateContext(nPrefix, rLocalName, xAttrList );
1101 	}
1102 
1103 	// call base class
1104 	if(!pContext)
1105 		pContext = SvXMLStylesContext::CreateStyleChildContext(nPrefix, rLocalName, xAttrList);
1106 
1107 	return pContext;
1108 }
1109 
1110 //////////////////////////////////////////////////////////////////////////////
1111 
1112 SvXMLStyleContext* SdXMLStylesContext::CreateStyleStyleChildContext(
1113 	sal_uInt16 nFamily,
1114 	sal_uInt16 nPrefix,
1115 	const OUString& rLocalName,
1116 	const uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList)
1117 {
1118 	SvXMLStyleContext* pContext = 0;
1119 
1120 	switch( nFamily )
1121 	{
1122 	case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
1123 		pContext = new SdXMLDrawingPageStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList, *this );
1124 		break;
1125 	case XML_STYLE_FAMILY_TABLE_CELL:
1126 	case XML_STYLE_FAMILY_TABLE_COLUMN:
1127 	case XML_STYLE_FAMILY_TABLE_ROW:
1128 		pContext = new XMLShapeStyleContext( GetSdImport(), nPrefix, rLocalName, xAttrList, *this, nFamily );
1129 		break;
1130 	}
1131 
1132 	// call base class
1133 	if(!pContext)
1134 		pContext = SvXMLStylesContext::CreateStyleStyleChildContext(nFamily, nPrefix, rLocalName, xAttrList);
1135 
1136 	return pContext;
1137 }
1138 
1139 //////////////////////////////////////////////////////////////////////////////
1140 
1141 SvXMLStyleContext* SdXMLStylesContext::CreateDefaultStyleStyleChildContext(
1142 	sal_uInt16 nFamily,
1143 	sal_uInt16 nPrefix,
1144 	const OUString& rLocalName,
1145 	const Reference< XAttributeList > & xAttrList )
1146 {
1147 	SvXMLStyleContext* pContext = 0;
1148 
1149 	switch( nFamily )
1150 	{
1151 	case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
1152 		pContext = new XMLGraphicsDefaultStyle(GetSdImport(), nPrefix, rLocalName, xAttrList, *this );
1153 		break;
1154 	}
1155 
1156 	// call base class
1157 	if(!pContext)
1158 		pContext = SvXMLStylesContext::CreateDefaultStyleStyleChildContext(nFamily, nPrefix, rLocalName, xAttrList);
1159 
1160 	return pContext;
1161 }
1162 
1163 //////////////////////////////////////////////////////////////////////////////
1164 
1165 sal_uInt16 SdXMLStylesContext::GetFamily( const OUString& rFamily ) const
1166 {
1167 //	if(rFamily.getLength())
1168 //	{
1169 //		if(rFamily.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME))))
1170 //			return XML_STYLE_FAMILY_SD_GRAPHICS_ID;
1171 //
1172 //		if(rFamily.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME))))
1173 //			return XML_STYLE_FAMILY_SD_PRESENTATION_ID;
1174 //
1175 //		if(rFamily.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_POOL_NAME))))
1176 //			return XML_STYLE_FAMILY_SD_POOL_ID;
1177 //
1178 //		if(rFamily.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME))))
1179 //			return XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID;
1180 //	}
1181 
1182 	// call base class
1183 	return SvXMLStylesContext::GetFamily(rFamily);
1184 }
1185 
1186 //////////////////////////////////////////////////////////////////////////////
1187 
1188 UniReference< SvXMLImportPropertyMapper > SdXMLStylesContext::GetImportPropertyMapper(
1189 	sal_uInt16 nFamily) const
1190 {
1191 	UniReference < SvXMLImportPropertyMapper > xMapper;
1192 
1193 //	if(XML_STYLE_FAMILY_SD_GRAPHICS_ID == nFamily
1194 //		|| XML_STYLE_FAMILY_SD_PRESENTATION_ID == nFamily
1195 //		|| XML_STYLE_FAMILY_SD_POOL_ID == nFamily)
1196 //	{
1197 //		if(!xPropImpPropMapper.is())
1198 //		{
1199 //			UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport();
1200 //			((SdXMLStylesContext*)this)->xPropImpPropMapper =
1201 //				new SvXMLImportPropertyMapper(aImpHelper->GetPropertySetMapper());
1202 //		}
1203 //		xMapper = xPropImpPropMapper;
1204 //		return xMapper;
1205 //	}
1206 
1207 	switch( nFamily )
1208 	{
1209 	case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
1210 	{
1211 		if(!xPresImpPropMapper.is())
1212 		{
1213 			UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport();
1214 			((SdXMLStylesContext*)this)->xPresImpPropMapper =
1215 				aImpHelper->GetPresPagePropsMapper();
1216 		}
1217 		xMapper = xPresImpPropMapper;
1218 		break;
1219 	}
1220 
1221 	case XML_STYLE_FAMILY_TABLE_COLUMN:
1222 	case XML_STYLE_FAMILY_TABLE_ROW:
1223 	case XML_STYLE_FAMILY_TABLE_CELL:
1224 	{
1225 		const rtl::Reference< XMLTableImport >& xTableImport( const_cast< SvXMLImport& >( GetImport() ).GetShapeImport()->GetShapeTableImport() );
1226 
1227 		switch( nFamily )
1228 		{
1229 		case XML_STYLE_FAMILY_TABLE_COLUMN: xMapper = xTableImport->GetColumnImportPropertySetMapper().get(); break;
1230 		case XML_STYLE_FAMILY_TABLE_ROW: xMapper = xTableImport->GetRowImportPropertySetMapper().get(); break;
1231 		case XML_STYLE_FAMILY_TABLE_CELL: xMapper = xTableImport->GetCellImportPropertySetMapper().get(); break;
1232 		}
1233 		break;
1234 	}
1235 	}
1236 
1237 	// call base class
1238 	if( !xMapper.is() )
1239 		xMapper = SvXMLStylesContext::GetImportPropertyMapper(nFamily);
1240 	return xMapper;
1241 }
1242 
1243 //////////////////////////////////////////////////////////////////////////////
1244 // Process all style and object info
1245 //
1246 void SdXMLStylesContext::EndElement()
1247 {
1248 	if(mbIsAutoStyle)
1249 	{
1250 		// AutoStyles for text import
1251 		GetImport().GetTextImport()->SetAutoStyles( this );
1252 
1253 		// AutoStyles for chart
1254 		GetImport().GetChartImport()->SetAutoStylesContext( this );
1255 
1256 		// AutoStyles for forms
1257 		GetImport().GetFormImport()->setAutoStyleContext( this );
1258 
1259 		// associate AutoStyles with styles in preparation to setting Styles on shapes
1260 		for(sal_uInt32 a(0L); a < GetStyleCount(); a++)
1261 		{
1262 			const SvXMLStyleContext* pStyle = GetStyle(a);
1263 			if(pStyle && pStyle->ISA(XMLShapeStyleContext))
1264 			{
1265 				XMLShapeStyleContext* pDocStyle = (XMLShapeStyleContext*)pStyle;
1266 //				pDocStyle->Filter();
1267 
1268 				SvXMLStylesContext* pStylesContext = GetSdImport().GetShapeImport()->GetStylesContext();
1269 				if( pStylesContext )
1270 				{
1271                     pStyle = pStylesContext->FindStyleChildContext(pStyle->GetFamily(), pStyle->GetParentName());
1272 
1273 					if(pStyle && pStyle->ISA(XMLShapeStyleContext))
1274 					{
1275 						XMLShapeStyleContext* pParentStyle = (XMLShapeStyleContext*)pStyle;
1276 						if(pParentStyle->GetStyle().is())
1277 						{
1278 							pDocStyle->SetStyle(pParentStyle->GetStyle());
1279 						}
1280 					}
1281 				}
1282 			}
1283 		}
1284 
1285 		FinishStyles( false );
1286 	}
1287 	else
1288 	{
1289 		// Process styles list
1290 		ImpSetGraphicStyles();
1291 		ImpSetCellStyles();
1292 		GetImport().GetShapeImport()->GetShapeTableImport()->finishStyles();
1293 
1294 		// put style infos in the info set for other components ( content import f.e. )
1295 		uno::Reference< beans::XPropertySet > xInfoSet( GetImport().getImportInfo() );
1296 		if( xInfoSet.is() )
1297 		{
1298 			uno::Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
1299 
1300 			if( xInfoSetInfo->hasPropertyByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayouts" ) ) ) )
1301 				xInfoSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayouts" ) ), uno::makeAny( getPageLayouts() ) );
1302 		}
1303 
1304 	}
1305 }
1306 
1307 //////////////////////////////////////////////////////////////////////////////
1308 // set master-page styles (all with family="presentation" and a special
1309 // prefix) on given master-page.
1310 //
1311 void SdXMLStylesContext::SetMasterPageStyles(SdXMLMasterPageContext& rMaster) const
1312 {
1313 	UniString sPrefix(rMaster.GetDisplayName(), (sal_uInt16)rMaster.GetDisplayName().getLength());
1314 	sPrefix += sal_Unicode('-');
1315 
1316 	if(GetSdImport().GetLocalDocStyleFamilies().is() && GetSdImport().GetLocalDocStyleFamilies()->hasByName(rMaster.GetDisplayName())) try
1317 	{
1318 		uno::Reference< container::XNameAccess > xMasterPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(rMaster.GetDisplayName()), UNO_QUERY_THROW );
1319 		ImpSetGraphicStyles(xMasterPageStyles, XML_STYLE_FAMILY_SD_PRESENTATION_ID, sPrefix);
1320 	}
1321 	catch( uno::Exception& )
1322 	{
1323 		DBG_ERROR( "xmloff::SdXMLStylesContext::SetMasterPageStyles(), exception caught!" );
1324 	}
1325 }
1326 
1327 //////////////////////////////////////////////////////////////////////////////
1328 // Process styles list:
1329 // set graphic styles (all with family="graphics"). Remember xStyle at list element.
1330 //
1331 void SdXMLStylesContext::ImpSetGraphicStyles() const
1332 {
1333 	if(GetSdImport().GetLocalDocStyleFamilies().is()) try
1334 	{
1335 		const OUString sGraphicStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")));
1336 		uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sGraphicStyleName), uno::UNO_QUERY_THROW );
1337 
1338 		UniString aPrefix;
1339 		ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_SD_GRAPHICS_ID, aPrefix);
1340 	}
1341 	catch( uno::Exception& )
1342 	{
1343 		DBG_ERROR( "xmloff::SdXMLStylesContext::ImpSetGraphicStyles(), exception caught!" );
1344 	}
1345 }
1346 
1347 void SdXMLStylesContext::ImpSetCellStyles() const
1348 {
1349 	if(GetSdImport().GetLocalDocStyleFamilies().is()) try
1350 	{
1351 		const OUString sCellStyleName(OUString(RTL_CONSTASCII_USTRINGPARAM("cell")));
1352 		uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sCellStyleName), uno::UNO_QUERY_THROW );
1353 
1354 		UniString aPrefix;
1355 		ImpSetGraphicStyles(xGraphicPageStyles, XML_STYLE_FAMILY_TABLE_CELL, aPrefix);
1356 	}
1357 	catch( uno::Exception& )
1358 	{
1359 		DBG_ERROR( "xmloff::SdXMLStylesContext::ImpSetCellStyles(), exception caught!" );
1360 	}
1361 }
1362 
1363 //////////////////////////////////////////////////////////////////////////////
1364 // help function used by ImpSetGraphicStyles() and ImpSetMasterPageStyles()
1365 //
1366 void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAccess >& xPageStyles,  sal_uInt16 nFamily,  const UniString& rPrefix) const
1367 {
1368 	xub_StrLen nPrefLen(rPrefix.Len());
1369 
1370 	sal_uInt32 a;
1371 
1372 	// set defaults
1373 	for( a = 0; a < GetStyleCount(); a++)
1374 	{
1375 		const SvXMLStyleContext* pStyle = GetStyle(a);
1376 
1377 		if(nFamily == pStyle->GetFamily() && pStyle->IsDefaultStyle())
1378 		{
1379 			((SvXMLStyleContext*)pStyle)->SetDefaults();
1380 		}
1381 	}
1382 
1383 	// create all styles and set properties
1384 	for( a = 0; a < GetStyleCount(); a++)
1385 	{
1386 		try
1387 		{
1388 			const SvXMLStyleContext* pStyle = GetStyle(a);
1389 			if(nFamily == pStyle->GetFamily() && !pStyle->IsDefaultStyle())
1390 			{
1391 				OUString aStyleName(pStyle->GetDisplayName());
1392 				if( nPrefLen )
1393 				{
1394 					sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( sal_Unicode('-') ) + 1;
1395 					if( (nPrefLen != nStylePrefLen) ||  (aStyleName.compareTo( rPrefix, nPrefLen ) != 0) )
1396 						continue;
1397 
1398 					aStyleName = aStyleName.copy( nPrefLen );
1399 				}
1400 
1401 				uno::Reference< style::XStyle > xStyle;
1402 				if(xPageStyles->hasByName(aStyleName))
1403 				{
1404 					xPageStyles->getByName(aStyleName) >>= xStyle;
1405 
1406 					// set properties of existing styles to default
1407 					uno::Reference< beans::XPropertySet > xPropSet( xStyle, uno::UNO_QUERY );
1408 					uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
1409 					if( xPropSet.is() )
1410 						xPropSetInfo = xPropSet->getPropertySetInfo();
1411 
1412 					uno::Reference< beans::XPropertyState > xPropState( xStyle, uno::UNO_QUERY );
1413 
1414 					if( xPropState.is() )
1415 					{
1416 						UniReference < XMLPropertySetMapper > xPrMap;
1417 						UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetImportPropertyMapper( nFamily );
1418 						DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
1419 						if( xImpPrMap.is() )
1420 							xPrMap = xImpPrMap->getPropertySetMapper();
1421 						if( xPrMap.is() )
1422 						{
1423 							const sal_Int32 nCount = xPrMap->GetEntryCount();
1424 							for( sal_Int32 i = 0; i < nCount; i++ )
1425 							{
1426 								const OUString& rName = xPrMap->GetEntryAPIName( i );
1427 								if( xPropSetInfo->hasPropertyByName( rName ) && beans::PropertyState_DIRECT_VALUE == xPropState->getPropertyState( rName ) )
1428 								{
1429 									xPropState->setPropertyToDefault( rName );
1430 								}
1431 							}
1432 						}
1433 					}
1434 				}
1435 				else
1436 				{
1437 					// graphics style does not exist, create and add it
1438 					uno::Reference< lang::XSingleServiceFactory > xServiceFact(xPageStyles, uno::UNO_QUERY);
1439 					if(xServiceFact.is())
1440 					{
1441 						uno::Reference< style::XStyle > xNewStyle( xServiceFact->createInstance(), uno::UNO_QUERY);
1442 
1443 						if(xNewStyle.is())
1444 						{
1445 							// remember style
1446 							xStyle = xNewStyle;
1447 
1448 							// add new style to graphics style pool
1449 							uno::Reference< container::XNameContainer > xInsertContainer(xPageStyles, uno::UNO_QUERY);
1450 							if(xInsertContainer.is())
1451 								xInsertContainer->insertByName(aStyleName, uno::Any( xStyle ) );
1452 						}
1453 					}
1454 				}
1455 
1456 				if(xStyle.is())
1457 				{
1458 					// set properties at style
1459 					XMLPropStyleContext* pPropStyle = dynamic_cast< XMLPropStyleContext* >( const_cast< SvXMLStyleContext* >( pStyle ) );
1460 					uno::Reference< beans::XPropertySet > xPropSet(xStyle, uno::UNO_QUERY);
1461 
1462 					if(xPropSet.is() && pPropStyle)
1463 					{
1464 						pPropStyle->FillPropertySet(xPropSet);
1465 						pPropStyle->SetStyle(xStyle);
1466 					}
1467 				}
1468 			}
1469 		}
1470 		catch( Exception& e)
1471 		{
1472 			uno::Sequence<OUString> aSeq(0);
1473 			const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
1474 		}
1475 	}
1476 
1477 	// now set parents for all styles (when necessary)
1478 	for(a = 0L; a < GetStyleCount(); a++)
1479 	{
1480 		const SvXMLStyleContext* pStyle = GetStyle(a);
1481 
1482 		if(pStyle && pStyle->GetName().getLength() && (nFamily == pStyle->GetFamily())) try
1483 		{
1484 			OUString aStyleName(pStyle->GetDisplayName());
1485 			if( nPrefLen )
1486 			{
1487 				sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( sal_Unicode('-') ) + 1;
1488 				if( (nPrefLen != nStylePrefLen) ||  (aStyleName.compareTo( rPrefix, nPrefLen ) != 0) )
1489 					continue;
1490 
1491 				aStyleName = aStyleName.copy( nPrefLen );
1492 			}
1493 
1494 			uno::Reference< style::XStyle > xStyle( xPageStyles->getByName(aStyleName), UNO_QUERY );
1495 			if(xStyle.is())
1496 			{
1497 				// set parent style name
1498                 ::rtl::OUString sParentStyleDisplayName( const_cast< SvXMLImport& >( GetImport() ).GetStyleDisplayName( pStyle->GetFamily(), pStyle->GetParentName() ) );
1499 				if( nPrefLen )
1500 				{
1501 					sal_Int32 nStylePrefLen = sParentStyleDisplayName.lastIndexOf( sal_Unicode('-') ) + 1;
1502 					if( (nPrefLen != nStylePrefLen) || (sParentStyleDisplayName.compareTo( rPrefix, nPrefLen ) != 0) )
1503 						continue;
1504 
1505 					sParentStyleDisplayName = sParentStyleDisplayName.copy( nPrefLen );
1506 				}
1507 				xStyle->setParentStyle( sParentStyleDisplayName );
1508 			}
1509 		}
1510 		catch( Exception& e )
1511 		{
1512 			uno::Sequence<OUString> aSeq(0);
1513 			const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
1514 		}
1515 	}
1516 }
1517 
1518 ////////////////////////////////////////////////////////////////////////////////
1519 // helper function to create the uno component that hold the mappings from
1520 // xml auto layout name to internal autolayout id
1521 
1522 uno::Reference< container::XNameAccess > SdXMLStylesContext::getPageLayouts() const
1523 {
1524 	uno::Reference< container::XNameContainer > xLayouts( comphelper::NameContainer_createInstance( ::getCppuType((const sal_Int32*)0)) );
1525 
1526 	for(sal_uInt32 a(0L); a < GetStyleCount(); a++)
1527 	{
1528 		const SvXMLStyleContext* pStyle = GetStyle(a);
1529 		if(pStyle && pStyle->ISA(SdXMLPresentationPageLayoutContext))
1530 		{
1531 			xLayouts->insertByName( pStyle->GetName(), uno::makeAny(
1532 			(sal_Int32)((SdXMLPresentationPageLayoutContext*)pStyle)->GetTypeId() ) );
1533 		}
1534 	}
1535 
1536 	return uno::Reference< container::XNameAccess >::query( xLayouts );
1537 }
1538 
1539 ////////////////////////////////////////////////////////////////////////////////
1540 ////////////////////////////////////////////////////////////////////////////////
1541 //
1542 TYPEINIT1( SdXMLMasterStylesContext, SvXMLImportContext );
1543 
1544 SdXMLMasterStylesContext::SdXMLMasterStylesContext(
1545 	SdXMLImport& rImport,
1546 	sal_uInt16 nPrfx,
1547 	const rtl::OUString& rLName)
1548 :	SvXMLImportContext( rImport, nPrfx, rLName)
1549 {
1550 }
1551 
1552 SdXMLMasterStylesContext::~SdXMLMasterStylesContext()
1553 {
1554 	while(maMasterPageList.Count())
1555 		maMasterPageList.Remove(maMasterPageList.Count() - 1)->ReleaseRef();
1556 }
1557 
1558 SvXMLImportContext* SdXMLMasterStylesContext::CreateChildContext(
1559 	sal_uInt16 nPrefix,
1560 	const rtl::OUString& rLocalName,
1561 	const uno::Reference< xml::sax::XAttributeList >& xAttrList)
1562 {
1563 	SvXMLImportContext* pContext = 0;
1564 
1565 	if(nPrefix == XML_NAMESPACE_STYLE
1566        && IsXMLToken( rLocalName, XML_MASTER_PAGE ) )
1567 	{
1568 		// style:masterpage inside office:styles context
1569 		uno::Reference< drawing::XDrawPage > xNewMasterPage;
1570 		uno::Reference< drawing::XDrawPages > xMasterPages(GetSdImport().GetLocalMasterPages(), uno::UNO_QUERY);
1571 
1572 		if( xMasterPages.is() )
1573 		{
1574 			if(GetSdImport().GetNewMasterPageCount() + 1 > xMasterPages->getCount())
1575 			{
1576 				// new page, create and insert
1577 				xNewMasterPage = xMasterPages->insertNewByIndex(xMasterPages->getCount());
1578 			}
1579 			else
1580 			{
1581 				// existing page, use it
1582 				xMasterPages->getByIndex(GetSdImport().GetNewMasterPageCount()) >>= xNewMasterPage;
1583 			}
1584 
1585 			// increment global import page counter
1586 			GetSdImport().IncrementNewMasterPageCount();
1587 
1588 			if(xNewMasterPage.is())
1589 			{
1590 				uno::Reference< drawing::XShapes > xNewShapes(xNewMasterPage, uno::UNO_QUERY);
1591 				if(xNewShapes.is() && GetSdImport().GetShapeImport()->GetStylesContext())
1592 				{
1593 					pContext = new SdXMLMasterPageContext(GetSdImport(),
1594 						nPrefix, rLocalName, xAttrList, xNewShapes);
1595 
1596 					if(pContext)
1597 					{
1598 						pContext->AddRef();
1599 						maMasterPageList.Insert((SdXMLMasterPageContext*)pContext, LIST_APPEND);
1600 					}
1601 				}
1602 			}
1603 		}
1604 	}
1605 	else	if(nPrefix == XML_NAMESPACE_STYLE
1606 		&& IsXMLToken( rLocalName, XML_HANDOUT_MASTER ) )
1607 	{
1608 		uno::Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetSdImport().GetModel(), uno::UNO_QUERY );
1609 		if( xHandoutSupp.is() )
1610 		{
1611 			uno::Reference< drawing::XShapes > xHandoutPage( xHandoutSupp->getHandoutMasterPage(), uno::UNO_QUERY );
1612 			if(xHandoutPage.is() && GetSdImport().GetShapeImport()->GetStylesContext())
1613 			{
1614 				pContext = new SdXMLMasterPageContext(GetSdImport(),
1615 					nPrefix, rLocalName, xAttrList, xHandoutPage);
1616 			}
1617 		}
1618 	}
1619 	else if( (nPrefix == XML_NAMESPACE_DRAW )&& IsXMLToken( rLocalName, XML_LAYER_SET ) )
1620 	{
1621 		pContext = new SdXMLLayerSetContext( GetImport(), nPrefix, rLocalName, xAttrList );
1622 	}
1623 
1624 	// call base class
1625 	if(!pContext)
1626 		pContext = SvXMLImportContext::CreateChildContext(nPrefix, rLocalName, xAttrList);
1627 
1628 	return pContext;
1629 }
1630 
1631 ///////////////////////////////////////////////////////////////////////
1632 
1633 SdXMLHeaderFooterDeclContext::SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
1634 		const ::rtl::OUString& rLName,
1635 		const ::com::sun::star::uno::Reference<	::com::sun::star::xml::sax::XAttributeList >& xAttrList )
1636 : SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList )
1637 {
1638 	const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
1639 	for(sal_Int16 i=0; i < nAttrCount; i++)
1640 	{
1641 		OUString aLocalName;
1642 		const OUString aValue( xAttrList->getValueByIndex(i) );
1643 		sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(xAttrList->getNameByIndex(i), &aLocalName);
1644 
1645 		if( nPrefix == XML_NAMESPACE_PRESENTATION )
1646 		{
1647 			if( IsXMLToken( aLocalName, XML_NAME ) )
1648 			{
1649 				maStrName = aValue;
1650 			}
1651 			else if( IsXMLToken( aLocalName, XML_SOURCE ) )
1652 			{
1653 				mbFixed = IsXMLToken( aValue, XML_FIXED );
1654 			}
1655 		}
1656 		else if( nPrefix == XML_NAMESPACE_STYLE )
1657 		{
1658 			if( IsXMLToken( aLocalName, XML_DATA_STYLE_NAME ) )
1659 			{
1660 				maStrDateTimeFormat = aValue;
1661 			}
1662 		}
1663 	}
1664 }
1665 
1666 sal_Bool SdXMLHeaderFooterDeclContext::IsTransient() const
1667 {
1668 	return sal_True;
1669 }
1670 
1671 void SdXMLHeaderFooterDeclContext::EndElement()
1672 {
1673 	SdXMLImport& rImport = *dynamic_cast< SdXMLImport* >( &GetImport() );
1674 	if( IsXMLToken( GetLocalName(), XML_HEADER_DECL ) )
1675 	{
1676 		rImport.AddHeaderDecl( maStrName, maStrText );
1677 	}
1678 	else if( IsXMLToken( GetLocalName(), XML_FOOTER_DECL ) )
1679 	{
1680 		rImport.AddFooterDecl( maStrName, maStrText );
1681 	}
1682 	else if( IsXMLToken( GetLocalName(), XML_DATE_TIME_DECL ) )
1683 	{
1684 		rImport.AddDateTimeDecl( maStrName, maStrText, mbFixed, maStrDateTimeFormat );
1685 	}
1686 }
1687 
1688 void SdXMLHeaderFooterDeclContext::Characters( const ::rtl::OUString& rChars )
1689 {
1690 	maStrText += rChars;
1691 }
1692 
1693