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