1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <osl/thread.h>
21 #include <sal/log.hxx>
22 #include <comphelper/processfactory.hxx>
23 #include <comphelper/sequence.hxx>
25 #include <xmloff/xmlscripti.hxx>
26 #include "sdxmlimp_impl.hxx"
27 #include "ximpbody.hxx"
29 #include <xmloff/xmlmetai.hxx>
30 #include "ximpstyl.hxx"
31 #include <xmloff/xmlnamespace.hxx>
32 #include <xmloff/xmltoken.hxx>
33 #include <xmloff/DocumentSettingsContext.hxx>
34 #include <com/sun/star/awt/Rectangle.hpp>
35 #include <com/sun/star/form/XFormsSupplier.hpp>
36 #include <com/sun/star/frame/XModel.hpp>
37 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
39 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
40 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
41 #include <xmloff/settingsstore.hxx>
42 #include <xmloff/ProgressBarHelper.hxx>
44 #include <xmloff/XMLFontStylesContext.hxx>
46 #include <com/sun/star/document/XDocumentProperties.hpp>
47 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
49 using namespace ::com::sun::star
;
50 using namespace ::xmloff::token
;
54 class SdXMLBodyContext_Impl
: public SvXMLImportContext
56 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
60 SdXMLBodyContext_Impl( SdXMLImport
& rImport
);
62 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
63 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
68 SdXMLBodyContext_Impl::SdXMLBodyContext_Impl( SdXMLImport
& rImport
) :
69 SvXMLImportContext( rImport
)
73 css::uno::Reference
< css::xml::sax::XFastContextHandler
> SdXMLBodyContext_Impl::createFastChildContext(
74 sal_Int32
/*nElement*/,
75 const uno::Reference
< xml::sax::XFastAttributeList
> & /*xAttrList*/ )
77 return new SdXMLBodyContext(GetSdImport());
82 // NB: virtually inherit so we can multiply inherit properly
83 // in SdXMLFlatDocContext_Impl
84 class SdXMLDocContext_Impl
: public virtual SvXMLImportContext
87 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
90 SdXMLDocContext_Impl( SdXMLImport
& rImport
);
92 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
93 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
98 SdXMLDocContext_Impl::SdXMLDocContext_Impl(
99 SdXMLImport
& rImport
)
100 : SvXMLImportContext(rImport
)
104 uno::Reference
< xml::sax::XFastContextHandler
> SAL_CALL
SdXMLDocContext_Impl::createFastChildContext(
105 sal_Int32 nElement
, const uno::Reference
< xml::sax::XFastAttributeList
>& /*xAttrList*/ )
109 case XML_ELEMENT(OFFICE
, XML_SCRIPTS
):
111 if( GetImport().getImportFlags() & SvXMLImportFlags::SCRIPTS
)
113 // office:script inside office:document
114 return new XMLScriptContext( GetSdImport(), GetSdImport().GetModel() );
118 case XML_ELEMENT(OFFICE
, XML_MASTER_STYLES
):
120 if( GetImport().getImportFlags() & SvXMLImportFlags::MASTERSTYLES
)
122 // office:master-styles inside office:document
123 return GetSdImport().CreateMasterStylesContext();
127 case XML_ELEMENT(OFFICE
, XML_BODY
):
129 if( GetImport().getImportFlags() & SvXMLImportFlags::CONTENT
)
131 // office:body inside office:document
132 return new SdXMLBodyContext_Impl(GetSdImport());
136 case XML_ELEMENT(OFFICE
, XML_SETTINGS
):
138 if( GetImport().getImportFlags() & SvXMLImportFlags::SETTINGS
)
140 return new XMLDocumentSettingsContext(GetImport());
144 case XML_ELEMENT(OFFICE
, XML_STYLES
):
146 if( GetImport().getImportFlags() & SvXMLImportFlags::STYLES
)
148 // office:styles inside office:document
149 return GetSdImport().CreateStylesContext();
153 case XML_ELEMENT(OFFICE
, XML_AUTOMATIC_STYLES
):
155 if( GetImport().getImportFlags() & SvXMLImportFlags::AUTOSTYLES
)
157 // office:automatic-styles inside office:document
158 return GetSdImport().CreateAutoStylesContext();
162 case XML_ELEMENT(OFFICE
, XML_FONT_FACE_DECLS
):
164 return GetSdImport().CreateFontDeclsContext();
166 case XML_ELEMENT(OFFICE
, XML_META
):
168 SAL_INFO("xmloff.draw", "XML_ELEMENT(OFFICE, XML_META): should not have come here, maybe document is invalid?");
177 // context for flat file xml format
178 class SdXMLFlatDocContext_Impl
179 : public SdXMLDocContext_Impl
, public SvXMLMetaDocumentContext
182 SdXMLFlatDocContext_Impl( SdXMLImport
& i_rImport
,
183 const uno::Reference
<document::XDocumentProperties
>& i_xDocProps
);
185 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
186 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
191 SdXMLFlatDocContext_Impl::SdXMLFlatDocContext_Impl( SdXMLImport
& i_rImport
,
192 const uno::Reference
<document::XDocumentProperties
>& i_xDocProps
) :
193 SvXMLImportContext(i_rImport
),
194 SdXMLDocContext_Impl(i_rImport
),
195 SvXMLMetaDocumentContext(i_rImport
, i_xDocProps
)
199 uno::Reference
< xml::sax::XFastContextHandler
> SAL_CALL
SdXMLFlatDocContext_Impl::createFastChildContext(
200 sal_Int32 nElement
, const uno::Reference
< xml::sax::XFastAttributeList
>& xAttrList
)
202 // behave like meta base class iff we encounter office:meta
203 if ( nElement
== XML_ELEMENT( OFFICE
, XML_META
) ) {
204 return SvXMLMetaDocumentContext::createFastChildContext(
205 nElement
, xAttrList
);
207 return SdXMLDocContext_Impl::createFastChildContext(
208 nElement
, xAttrList
);
212 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
213 com_sun_star_comp_Impress_XMLOasisImporter_get_implementation(
214 uno::XComponentContext
* pCtx
, uno::Sequence
<uno::Any
> const& /*rSeq*/)
216 return cppu::acquire(
217 new SdXMLImport(pCtx
, "XMLImpressImportOasis", false, SvXMLImportFlags::ALL
));
220 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
221 com_sun_star_comp_Draw_XMLOasisImporter_get_implementation(uno::XComponentContext
* pCtx
,
222 uno::Sequence
<uno::Any
> const& /*rSeq*/)
224 return cppu::acquire(new SdXMLImport(pCtx
, "XMLDrawImportOasis", true, SvXMLImportFlags::ALL
));
227 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
228 com_sun_star_comp_Draw_XMLOasisStylesImporter_get_implementation(uno::XComponentContext
* pCtx
,
229 uno::Sequence
<uno::Any
> const& /*rSeq*/)
231 return cppu::acquire(new SdXMLImport(pCtx
, "XMLDrawStylesImportOasis", true,
232 SvXMLImportFlags::STYLES
| SvXMLImportFlags::AUTOSTYLES
233 | SvXMLImportFlags::MASTERSTYLES
));
236 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
237 com_sun_star_comp_Draw_XMLOasisContentImporter_get_implementation(
238 uno::XComponentContext
* pCtx
, uno::Sequence
<uno::Any
> const& /*rSeq*/)
240 return cppu::acquire(new SdXMLImport(pCtx
, "XMLDrawContentImportOasis", true,
241 SvXMLImportFlags::AUTOSTYLES
| SvXMLImportFlags::CONTENT
242 | SvXMLImportFlags::SCRIPTS
243 | SvXMLImportFlags::FONTDECLS
));
246 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
247 com_sun_star_comp_Draw_XMLOasisMetaImporter_get_implementation(
248 uno::XComponentContext
* pCtx
, uno::Sequence
<uno::Any
> const& /*rSeq*/)
250 return cppu::acquire(
251 new SdXMLImport(pCtx
, "XMLDrawMetaImportOasis", true, SvXMLImportFlags::META
));
254 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
255 com_sun_star_comp_Draw_XMLOasisSettingsImporter_get_implementation(
256 uno::XComponentContext
* pCtx
, uno::Sequence
<uno::Any
> const& /*rSeq*/)
258 return cppu::acquire(
259 new SdXMLImport(pCtx
, "XMLDrawSettingsImportOasis", true, SvXMLImportFlags::SETTINGS
));
262 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
263 com_sun_star_comp_Impress_XMLOasisStylesImporter_get_implementation(
264 uno::XComponentContext
* pCtx
, uno::Sequence
<uno::Any
> const& /*rSeq*/)
266 return cppu::acquire(new SdXMLImport(pCtx
, "XMLImpressStylesImportOasis", false,
267 SvXMLImportFlags::STYLES
| SvXMLImportFlags::AUTOSTYLES
268 | SvXMLImportFlags::MASTERSTYLES
));
271 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
272 com_sun_star_comp_Impress_XMLOasisContentImporter_get_implementation(
273 uno::XComponentContext
* pCtx
, uno::Sequence
<uno::Any
> const& /*rSeq*/)
275 return cppu::acquire(new SdXMLImport(pCtx
, "XMLImpressContentImportOasis", false,
276 SvXMLImportFlags::AUTOSTYLES
| SvXMLImportFlags::CONTENT
277 | SvXMLImportFlags::SCRIPTS
278 | SvXMLImportFlags::FONTDECLS
));
281 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
282 com_sun_star_comp_Impress_XMLOasisMetaImporter_get_implementation(
283 uno::XComponentContext
* pCtx
, uno::Sequence
<uno::Any
> const& /*rSeq*/)
285 return cppu::acquire(
286 new SdXMLImport(pCtx
, "XMLImpressMetaImportOasis", false, SvXMLImportFlags::META
));
289 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
290 com_sun_star_comp_Impress_XMLOasisSettingsImporter_get_implementation(
291 uno::XComponentContext
* pCtx
, uno::Sequence
<uno::Any
> const& /*rSeq*/)
293 return cppu::acquire(
294 new SdXMLImport(pCtx
, "XMLImpressSettingsImportOasis", false, SvXMLImportFlags::SETTINGS
));
297 SdXMLImport::SdXMLImport(
298 const css::uno::Reference
< css::uno::XComponentContext
>& xContext
,
299 OUString
const & implementationName
,
300 bool bIsDraw
, SvXMLImportFlags nImportFlags
)
301 : SvXMLImport( xContext
, implementationName
, nImportFlags
),
303 mnNewMasterPageCount(0),
309 GetNamespaceMap().Add(
310 GetXMLToken(XML_NP_PRESENTATION
),
311 GetXMLToken(XML_N_PRESENTATION
),
312 XML_NAMESPACE_PRESENTATION
);
314 GetNamespaceMap().Add(
315 GetXMLToken(XML_NP_SMIL
),
316 GetXMLToken(XML_N_SMIL_COMPAT
),
321 void SAL_CALL
SdXMLImport::setTargetDocument( const uno::Reference
< lang::XComponent
>& xDoc
)
323 SvXMLImport::setTargetDocument( xDoc
);
325 uno::Reference
< lang::XServiceInfo
> xDocServices( GetModel(), uno::UNO_QUERY
);
326 if( !xDocServices
.is() )
327 throw lang::IllegalArgumentException();
329 mbIsDraw
= !xDocServices
->supportsService("com.sun.star.presentation.PresentationDocument");
331 // prepare access to styles
332 uno::Reference
< style::XStyleFamiliesSupplier
> xFamSup( GetModel(), uno::UNO_QUERY
);
334 mxDocStyleFamilies
= xFamSup
->getStyleFamilies();
339 // prepare access to master pages
340 uno::Reference
< drawing::XMasterPagesSupplier
> xMasterPagesSupplier(GetModel(), uno::UNO_QUERY
);
341 if(xMasterPagesSupplier
.is())
342 mxDocMasterPages
= xMasterPagesSupplier
->getMasterPages();
344 // prepare access to draw pages
345 uno::Reference
<drawing::XDrawPagesSupplier
> xDrawPagesSupplier(GetModel(), uno::UNO_QUERY
);
346 if(!xDrawPagesSupplier
.is())
347 throw lang::IllegalArgumentException();
349 mxDocDrawPages
= xDrawPagesSupplier
->getDrawPages();
350 if(!mxDocDrawPages
.is())
351 throw lang::IllegalArgumentException();
353 if( mxDocDrawPages
.is() && mxDocDrawPages
->getCount() > 0 )
355 uno::Reference
< form::XFormsSupplier
> xFormsSupp
;
356 mxDocDrawPages
->getByIndex(0) >>= xFormsSupp
;
357 mbIsFormsSupported
= xFormsSupp
.is();
360 // #88546# enable progress bar increments, SdXMLImport is only used for
361 // draw/impress import
362 GetShapeImport()->enableHandleProgressBar();
364 uno::Reference
< lang::XMultiServiceFactory
> xFac( GetModel(), uno::UNO_QUERY
);
367 uno::Sequence
< OUString
> sSNS( xFac
->getAvailableServiceNames() );
368 if (comphelper::findValue(sSNS
, "com.sun.star.drawing.TableShape") != -1)
369 mbIsTableShapeSupported
= true;
374 void SAL_CALL
SdXMLImport::initialize( const uno::Sequence
< uno::Any
>& aArguments
)
376 SvXMLImport::initialize( aArguments
);
378 static constexpr OUString
sOrganizerMode(u
"OrganizerMode"_ustr
);
379 bool bStyleOnly(false);
381 css::beans::PropertyValue aPropValue
;
382 if (aArguments
.hasElements() && (aArguments
[0] >>= aPropValue
) && aPropValue
.Name
== sOrganizerMode
)
384 aPropValue
.Value
>>= bStyleOnly
;
385 mbLoadDoc
= !bStyleOnly
;
388 uno::Reference
< beans::XPropertySet
> xInfoSet( getImportInfo() );
392 uno::Reference
< beans::XPropertySetInfo
> xInfoSetInfo( xInfoSet
->getPropertySetInfo() );
394 if( xInfoSetInfo
->hasPropertyByName( gsPageLayouts
) )
395 xInfoSet
->getPropertyValue( gsPageLayouts
) >>= mxPageLayouts
;
397 if( xInfoSetInfo
->hasPropertyByName( gsPreview
) )
398 xInfoSet
->getPropertyValue( gsPreview
) >>= mbPreview
;
400 if (xInfoSetInfo
->hasPropertyByName(sOrganizerMode
))
402 if (xInfoSet
->getPropertyValue(sOrganizerMode
) >>= bStyleOnly
)
404 mbLoadDoc
= !bStyleOnly
;
409 SvXMLImportContext
*SdXMLImport::CreateFastContext( sal_Int32 nElement
,
410 const uno::Reference
< xml::sax::XFastAttributeList
>& xAttrList
)
412 SvXMLImportContext
* pContext
= nullptr;
416 case XML_ELEMENT( OFFICE
, XML_DOCUMENT_STYLES
):
417 case XML_ELEMENT( OFFICE
, XML_DOCUMENT_CONTENT
):
418 case XML_ELEMENT( OFFICE
, XML_DOCUMENT_SETTINGS
):
419 pContext
= new SdXMLDocContext_Impl(*this);
421 case XML_ELEMENT( OFFICE
, XML_DOCUMENT_META
):
422 pContext
= CreateMetaContext(nElement
, xAttrList
);
424 case XML_ELEMENT( OFFICE
, XML_DOCUMENT
):
426 uno::Reference
<document::XDocumentPropertiesSupplier
> xDPS(
427 GetModel(), uno::UNO_QUERY_THROW
);
428 // flat OpenDocument file format
429 pContext
= new SdXMLFlatDocContext_Impl( *this, xDPS
->getDocumentProperties());
432 case XML_ELEMENT( OFFICE
, XML_STYLES
):
433 // internal xml file for built in styles
435 pContext
= CreateStylesContext();
441 SvXMLImportContext
*SdXMLImport::CreateMetaContext(const sal_Int32
/*nElement*/,
442 const uno::Reference
<xml::sax::XFastAttributeList
>&)
444 SvXMLImportContext
* pContext
= nullptr;
446 if (getImportFlags() & SvXMLImportFlags::META
)
448 uno::Reference
<document::XDocumentPropertiesSupplier
> xDPS(
449 GetModel(), uno::UNO_QUERY_THROW
);
450 uno::Reference
<document::XDocumentProperties
> const xDocProps(
451 !mbLoadDoc
? nullptr : xDPS
->getDocumentProperties());
452 pContext
= new SvXMLMetaDocumentContext(*this, xDocProps
);
458 SvXMLStylesContext
*SdXMLImport::CreateStylesContext()
460 if(GetShapeImport()->GetStylesContext())
461 return GetShapeImport()->GetStylesContext();
463 GetShapeImport()->SetStylesContext(new SdXMLStylesContext(
466 return GetShapeImport()->GetStylesContext();
469 SvXMLStylesContext
*SdXMLImport::CreateAutoStylesContext()
471 if(GetShapeImport()->GetAutoStylesContext())
472 return GetShapeImport()->GetAutoStylesContext();
474 GetShapeImport()->SetAutoStylesContext(new SdXMLStylesContext(
477 return GetShapeImport()->GetAutoStylesContext();
480 SvXMLImportContext
* SdXMLImport::CreateMasterStylesContext()
482 if (!mxMasterStylesContext
.is())
483 mxMasterStylesContext
.set(new SdXMLMasterStylesContext(*this));
484 return mxMasterStylesContext
.get();
487 SvXMLImportContext
*SdXMLImport::CreateFontDeclsContext()
489 XMLFontStylesContext
*pFSContext
=
490 new XMLFontStylesContext( *this, osl_getThreadTextEncoding() );
491 SetFontDecls( pFSContext
);
495 void SdXMLImport::SetViewSettings(const css::uno::Sequence
<css::beans::PropertyValue
>& aViewProps
)
497 uno::Reference
< beans::XPropertySet
> xPropSet( GetModel(), uno::UNO_QUERY
);
501 awt::Rectangle
aVisArea( 0,0, 28000, 21000 );
503 for( const auto& rViewProp
: aViewProps
)
505 const OUString
& rName
= rViewProp
.Name
;
506 const uno::Any rValue
= rViewProp
.Value
;
508 if ( rName
== "VisibleAreaTop" )
510 rValue
>>= aVisArea
.Y
;
512 else if ( rName
== "VisibleAreaLeft" )
514 rValue
>>= aVisArea
.X
;
516 else if ( rName
== "VisibleAreaWidth" )
518 rValue
>>= aVisArea
.Width
;
520 else if ( rName
== "VisibleAreaHeight" )
522 rValue
>>= aVisArea
.Height
;
528 xPropSet
->setPropertyValue("VisibleArea", uno::Any( aVisArea
) );
530 catch(const css::uno::Exception
&)
532 /* #i79978# since old documents may contain invalid view settings, this is nothing to worry the user about.
533 SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, {}, e.Message, NULL );
538 void SdXMLImport::SetConfigurationSettings(const css::uno::Sequence
<css::beans::PropertyValue
>& aConfigProps
)
540 uno::Reference
< lang::XMultiServiceFactory
> xFac( GetModel(), uno::UNO_QUERY
);
544 uno::Reference
< beans::XPropertySet
> xProps( xFac
->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY
);
548 uno::Reference
< beans::XPropertySetInfo
> xInfo( xProps
->getPropertySetInfo() );
552 const uno::Sequence
<beans::PropertyValue
>* pValues
= &aConfigProps
;
554 DocumentSettingsSerializer
*pFilter
;
555 pFilter
= dynamic_cast<DocumentSettingsSerializer
*>(xProps
.get());
556 uno::Sequence
<beans::PropertyValue
> aFiltered
;
559 aFiltered
= pFilter
->filterStreamsFromStorage( GetDocumentBase(), GetSourceStorage(), aConfigProps
);
560 pValues
= &aFiltered
;
563 for( const auto& rValue
: *pValues
)
567 const OUString
& rProperty
= rValue
.Name
;
568 if( xInfo
->hasPropertyByName( rProperty
) )
569 xProps
->setPropertyValue( rProperty
, rValue
.Value
);
571 catch(const uno::Exception
&)
573 SAL_INFO("xmloff.draw", "#SdXMLImport::SetConfigurationSettings: Exception!" );
578 // #80365# override this method to read and use the hint value from the
579 // written meta information. If no info is found, guess 10 draw objects
580 //void SdXMLImport::SetStatisticAttributes(const uno::Reference<xml::sax::XAttributeList>& xAttrList)
581 void SdXMLImport::SetStatistics(
582 const uno::Sequence
<beans::NamedValue
> & i_rStats
)
584 static const char* s_stats
[] =
585 { "ObjectCount", nullptr };
587 SvXMLImport::SetStatistics(i_rStats
);
589 sal_uInt32
nCount(10);
590 for (const auto& rStat
: i_rStats
) {
591 for (const char** pStat
= s_stats
; *pStat
!= nullptr; ++pStat
) {
592 if (rStat
.Name
.equalsAscii(*pStat
)) {
594 if (rStat
.Value
>>= val
) {
597 SAL_WARN("xmloff.draw", "SdXMLImport::SetStatistics: invalid entry");
605 GetProgressBarHelper()->SetReference(nCount
);
606 GetProgressBarHelper()->SetValue(0);
610 void SdXMLImport::AddHeaderDecl( const OUString
& rName
, const OUString
& rText
)
612 if( !rName
.isEmpty() && !rText
.isEmpty() )
613 maHeaderDeclsMap
[rName
] = rText
;
616 void SdXMLImport::AddFooterDecl( const OUString
& rName
, const OUString
& rText
)
618 if( !rName
.isEmpty() && !rText
.isEmpty() )
619 maFooterDeclsMap
[rName
] = rText
;
622 void SdXMLImport::AddDateTimeDecl( const OUString
& rName
, const OUString
& rText
, bool bFixed
, const OUString
& rDateTimeFormat
)
624 if( !rName
.isEmpty() && (!rText
.isEmpty() || !bFixed
) )
626 DateTimeDeclContextImpl aDecl
;
627 aDecl
.maStrText
= rText
;
628 aDecl
.mbFixed
= bFixed
;
629 aDecl
.maStrDateTimeFormat
= rDateTimeFormat
;
630 maDateTimeDeclsMap
[rName
] = aDecl
;
634 OUString
SdXMLImport::GetHeaderDecl( const OUString
& rName
) const
637 HeaderFooterDeclMap::const_iterator
aIter( maHeaderDeclsMap
.find( rName
) );
638 if( aIter
!= maHeaderDeclsMap
.end() )
639 aRet
= (*aIter
).second
;
644 OUString
SdXMLImport::GetFooterDecl( const OUString
& rName
) const
647 HeaderFooterDeclMap::const_iterator
aIter( maFooterDeclsMap
.find( rName
) );
648 if( aIter
!= maFooterDeclsMap
.end() )
649 aRet
= (*aIter
).second
;
654 OUString
SdXMLImport::GetDateTimeDecl( const OUString
& rName
, bool& rbFixed
, OUString
& rDateTimeFormat
)
656 DateTimeDeclContextImpl aDecl
;
658 DateTimeDeclMap::const_iterator
aIter( maDateTimeDeclsMap
.find( rName
) );
659 if( aIter
!= maDateTimeDeclsMap
.end() )
660 aDecl
= (*aIter
).second
;
662 rbFixed
= aDecl
.mbFixed
;
663 rDateTimeFormat
= aDecl
.maStrDateTimeFormat
;
664 return aDecl
.maStrText
;
667 void SdXMLImport::NotifyContainsEmbeddedFont()
669 uno::Reference
< lang::XMultiServiceFactory
> xFac( GetModel(), uno::UNO_QUERY
);
672 uno::Reference
< beans::XPropertySet
> xProps( xFac
->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY
);
674 xProps
->setPropertyValue("EmbedFonts", uno::Any( true ) );
678 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */