LibreOffice Module xmloff (master)  1
sdxmlimp.cxx
Go to the documentation of this file.
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 <osl/thread.h>
21 #include <sal/log.hxx>
23 #include <comphelper/sequence.hxx>
24 
25 #include <xmloff/xmlscripti.hxx>
26 #include "sdxmlimp_impl.hxx"
27 #include "ximpbody.hxx"
28 
29 #include <xmloff/xmlmetai.hxx>
30 #include "ximpstyl.hxx"
31 #include <xmloff/xmlnamespace.hxx>
32 #include <xmloff/xmltoken.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>
43 
45 
46 #include <com/sun/star/document/XDocumentProperties.hpp>
47 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
48 
49 using namespace ::com::sun::star;
50 using namespace ::xmloff::token;
51 
52 namespace {
53 
54 class SdXMLBodyContext_Impl : public SvXMLImportContext
55 {
56  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
57 
58 public:
59 
60  SdXMLBodyContext_Impl( SdXMLImport& rImport );
61 
62  virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
63  const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override {}
64 
65  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
66  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
67 };
68 
69 }
70 
71 SdXMLBodyContext_Impl::SdXMLBodyContext_Impl( SdXMLImport& rImport ) :
72  SvXMLImportContext( rImport )
73 {
74 }
75 
76 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLBodyContext_Impl::createFastChildContext(
77  sal_Int32 /*nElement*/,
78  const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/ )
79 {
80  return new SdXMLBodyContext(GetSdImport());
81 }
82 
83 namespace {
84 
85 // NB: virtually inherit so we can multiply inherit properly
86 // in SdXMLFlatDocContext_Impl
87 class SdXMLDocContext_Impl : public virtual SvXMLImportContext
88 {
89 protected:
90  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
91 
92 public:
93  SdXMLDocContext_Impl( SdXMLImport& rImport );
94 
95  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
96  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
97 
98  virtual void SAL_CALL characters( const OUString& /*aChars*/ ) override {}
99 
100  virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
101  const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/ ) override {}
102 
103  virtual void SAL_CALL endFastElement( sal_Int32 /*nElement*/ ) override {}
104 };
105 
106 }
107 
108 SdXMLDocContext_Impl::SdXMLDocContext_Impl(
109  SdXMLImport& rImport )
110 : SvXMLImportContext(rImport)
111 {
112 }
113 
114 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SdXMLDocContext_Impl::createFastChildContext(
115  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
116 {
117  switch (nElement)
118  {
119  case XML_ELEMENT(OFFICE, XML_SCRIPTS):
120  {
121  if( GetImport().getImportFlags() & SvXMLImportFlags::SCRIPTS )
122  {
123  // office:script inside office:document
124  return new XMLScriptContext( GetSdImport(), GetSdImport().GetModel() );
125  }
126  break;
127  }
128  case XML_ELEMENT(OFFICE, XML_MASTER_STYLES):
129  {
130  if( GetImport().getImportFlags() & SvXMLImportFlags::MASTERSTYLES )
131  {
132  // office:master-styles inside office:document
133  return GetSdImport().CreateMasterStylesContext();
134  }
135  break;
136  }
137  case XML_ELEMENT(OFFICE, XML_BODY):
138  {
139  if( GetImport().getImportFlags() & SvXMLImportFlags::CONTENT )
140  {
141  // office:body inside office:document
142  return new SdXMLBodyContext_Impl(GetSdImport());
143  }
144  break;
145  }
146  case XML_ELEMENT(OFFICE, XML_SETTINGS):
147  {
148  if( GetImport().getImportFlags() & SvXMLImportFlags::SETTINGS )
149  {
150  return new XMLDocumentSettingsContext(GetImport());
151  }
152  break;
153  }
154  case XML_ELEMENT(OFFICE, XML_STYLES):
155  {
156  if( GetImport().getImportFlags() & SvXMLImportFlags::STYLES )
157  {
158  // office:styles inside office:document
159  return GetSdImport().CreateStylesContext();
160  }
161  break;
162  }
163  case XML_ELEMENT(OFFICE, XML_AUTOMATIC_STYLES):
164  {
165  if( GetImport().getImportFlags() & SvXMLImportFlags::AUTOSTYLES )
166  {
167  // office:automatic-styles inside office:document
168  return GetSdImport().CreateAutoStylesContext();
169  }
170  break;
171  }
172  case XML_ELEMENT(OFFICE, XML_FONT_FACE_DECLS):
173  {
174  return GetSdImport().CreateFontDeclsContext();
175  break;
176  }
177  case XML_ELEMENT(OFFICE, XML_META):
178  {
179  SAL_INFO("xmloff.draw", "XML_ELEMENT(OFFICE, XML_META): should not have come here, maybe document is invalid?");
180  break;
181  }
182  }
183  return nullptr;
184 }
185 
186 namespace {
187 
188 // context for flat file xml format
189 class SdXMLFlatDocContext_Impl
190  : public SdXMLDocContext_Impl, public SvXMLMetaDocumentContext
191 {
192 public:
193  SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport,
194  const uno::Reference<document::XDocumentProperties>& i_xDocProps );
195 
196  virtual void SAL_CALL startFastElement( sal_Int32 nElement,
197  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
198 
199  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
200 
201  virtual void SAL_CALL characters( const OUString& aChars ) override;
202 
203  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
204  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
205 };
206 
207 }
208 
209 SdXMLFlatDocContext_Impl::SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport,
210  const uno::Reference<document::XDocumentProperties>& i_xDocProps) :
211  SvXMLImportContext(i_rImport),
212  SdXMLDocContext_Impl(i_rImport),
213  SvXMLMetaDocumentContext(i_rImport, i_xDocProps)
214 {
215 }
216 
217 void SAL_CALL SdXMLFlatDocContext_Impl::startFastElement( sal_Int32 nElement,
218  const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
219 {
220  SvXMLMetaDocumentContext::startFastElement(nElement, xAttrList);
221 }
222 
223 void SAL_CALL SdXMLFlatDocContext_Impl::endFastElement( sal_Int32 nElement )
224 {
226 }
227 
228 void SAL_CALL SdXMLFlatDocContext_Impl::characters( const OUString& rChars )
229 {
231 }
232 
233 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SdXMLFlatDocContext_Impl::createFastChildContext(
234  sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
235 {
236  // behave like meta base class iff we encounter office:meta
237  if ( nElement == XML_ELEMENT( OFFICE, XML_META ) ) {
239  nElement, xAttrList );
240  } else {
241  return SdXMLDocContext_Impl::createFastChildContext(
242  nElement, xAttrList );
243  }
244 }
245 
246 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
248  uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
249 {
250  return cppu::acquire(
251  new SdXMLImport(pCtx, "XMLImpressImportOasis", false, SvXMLImportFlags::ALL));
252 }
253 
254 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
256  uno::Sequence<uno::Any> const& /*rSeq*/)
257 {
258  return cppu::acquire(new SdXMLImport(pCtx, "XMLDrawImportOasis", true, SvXMLImportFlags::ALL));
259 }
260 
261 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
263  uno::Sequence<uno::Any> const& /*rSeq*/)
264 {
265  return cppu::acquire(new SdXMLImport(pCtx, "XMLDrawStylesImportOasis", true,
268 }
269 
270 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
272  uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
273 {
274  return cppu::acquire(new SdXMLImport(pCtx, "XMLDrawContentImportOasis", true,
278 }
279 
280 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
282  uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
283 {
284  return cppu::acquire(
285  new SdXMLImport(pCtx, "XMLDrawMetaImportOasis", true, SvXMLImportFlags::META));
286 }
287 
288 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
290  uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
291 {
292  return cppu::acquire(
293  new SdXMLImport(pCtx, "XMLDrawSettingsImportOasis", true, SvXMLImportFlags::SETTINGS));
294 }
295 
296 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
298  uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
299 {
300  return cppu::acquire(new SdXMLImport(pCtx, "XMLImpressStylesImportOasis", false,
303 }
304 
305 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
307  uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
308 {
309  return cppu::acquire(new SdXMLImport(pCtx, "XMLImpressContentImportOasis", false,
313 }
314 
315 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
317  uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
318 {
319  return cppu::acquire(
320  new SdXMLImport(pCtx, "XMLImpressMetaImportOasis", false, SvXMLImportFlags::META));
321 }
322 
323 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
325  uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
326 {
327  return cppu::acquire(
328  new SdXMLImport(pCtx, "XMLImpressSettingsImportOasis", false, SvXMLImportFlags::SETTINGS));
329 }
330 
332  const css::uno::Reference< css::uno::XComponentContext >& xContext,
333  OUString const & implementationName,
334  bool bIsDraw, SvXMLImportFlags nImportFlags )
335 : SvXMLImport( xContext, implementationName, nImportFlags ),
336  mnNewPageCount(0),
337  mnNewMasterPageCount(0),
338  mbIsDraw(bIsDraw),
339  mbLoadDoc(true),
340  mbPreview(false)
341 {
342  // add namespaces
347 
352 }
353 
354 // XImporter
355 void SAL_CALL SdXMLImport::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc )
356 {
358 
359  uno::Reference< lang::XServiceInfo > xDocServices( GetModel(), uno::UNO_QUERY );
360  if( !xDocServices.is() )
361  throw lang::IllegalArgumentException();
362 
363  mbIsDraw = !xDocServices->supportsService("com.sun.star.presentation.PresentationDocument");
364 
365  // prepare access to styles
366  uno::Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), uno::UNO_QUERY );
367  if(xFamSup.is())
368  mxDocStyleFamilies = xFamSup->getStyleFamilies();
369 
370  // prepare access to master pages
371  uno::Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), uno::UNO_QUERY);
372  if(xMasterPagesSupplier.is())
373  mxDocMasterPages = xMasterPagesSupplier->getMasterPages();
374 
375  // prepare access to draw pages
376  uno::Reference <drawing::XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), uno::UNO_QUERY);
377  if(!xDrawPagesSupplier.is())
378  throw lang::IllegalArgumentException();
379 
380  mxDocDrawPages = xDrawPagesSupplier->getDrawPages();
381  if(!mxDocDrawPages.is())
382  throw lang::IllegalArgumentException();
383 
384  if( mxDocDrawPages.is() && mxDocDrawPages->getCount() > 0 )
385  {
386  uno::Reference< form::XFormsSupplier > xFormsSupp;
387  mxDocDrawPages->getByIndex(0) >>= xFormsSupp;
388  mbIsFormsSupported = xFormsSupp.is();
389  }
390 
391  // #88546# enable progress bar increments, SdXMLImport is only used for
392  // draw/impress import
393  GetShapeImport()->enableHandleProgressBar();
394 
395  uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
396  if( xFac.is() )
397  {
398  uno::Sequence< OUString > sSNS( xFac->getAvailableServiceNames() );
399  if (comphelper::findValue(sSNS, "com.sun.star.drawing.TableShape") != -1)
401  }
402 }
403 
404 // XInitialization
405 void SAL_CALL SdXMLImport::initialize( const uno::Sequence< uno::Any >& aArguments )
406 {
407  SvXMLImport::initialize( aArguments );
408 
409  uno::Reference< beans::XPropertySet > xInfoSet( getImportInfo() );
410  if( !xInfoSet.is() )
411  return;
412 
413  uno::Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
414 
415  if( xInfoSetInfo->hasPropertyByName( gsPageLayouts ) )
416  xInfoSet->getPropertyValue( gsPageLayouts ) >>= mxPageLayouts;
417 
418  if( xInfoSetInfo->hasPropertyByName( gsPreview ) )
419  xInfoSet->getPropertyValue( gsPreview ) >>= mbPreview;
420 
421  OUString const sOrganizerMode(
422  "OrganizerMode");
423  if (xInfoSetInfo->hasPropertyByName(sOrganizerMode))
424  {
425  bool bStyleOnly(false);
426  if (xInfoSet->getPropertyValue(sOrganizerMode) >>= bStyleOnly)
427  {
428  mbLoadDoc = !bStyleOnly;
429  }
430  }
431 }
432 
434  const uno::Reference< xml::sax::XFastAttributeList >& xAttrList )
435 {
436  SvXMLImportContext* pContext = nullptr;
437 
438  switch (nElement)
439  {
443  pContext = new SdXMLDocContext_Impl(*this);
444  break;
446  pContext = CreateMetaContext(nElement, xAttrList);
447  break;
449  {
450  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
451  GetModel(), uno::UNO_QUERY_THROW);
452  // flat OpenDocument file format
453  pContext = new SdXMLFlatDocContext_Impl( *this, xDPS->getDocumentProperties());
454  }
455  break;
456  }
457  return pContext;
458 }
459 
461  const uno::Reference<xml::sax::XFastAttributeList>&)
462 {
463  SvXMLImportContext* pContext = nullptr;
464 
466  {
467  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
468  GetModel(), uno::UNO_QUERY_THROW);
469  uno::Reference<document::XDocumentProperties> const xDocProps(
470  !mbLoadDoc ? nullptr : xDPS->getDocumentProperties());
471  pContext = new SvXMLMetaDocumentContext(*this, xDocProps);
472  }
473 
474  return pContext;
475 }
476 
478 {
479  if(GetShapeImport()->GetStylesContext())
480  return GetShapeImport()->GetStylesContext();
481 
482  GetShapeImport()->SetStylesContext(new SdXMLStylesContext(
483  *this, false));
484 
485  return GetShapeImport()->GetStylesContext();
486 }
487 
489 {
490  if(GetShapeImport()->GetAutoStylesContext())
491  return GetShapeImport()->GetAutoStylesContext();
492 
493  GetShapeImport()->SetAutoStylesContext(new SdXMLStylesContext(
494  *this, true));
495 
496  return GetShapeImport()->GetAutoStylesContext();
497 }
498 
500 {
501  if (!mxMasterStylesContext.is())
503  return mxMasterStylesContext.get();
504 }
505 
507 {
508  XMLFontStylesContext *pFSContext =
509  new XMLFontStylesContext( *this, osl_getThreadTextEncoding() );
510  SetFontDecls( pFSContext );
511  return pFSContext;
512 }
513 
514 void SdXMLImport::SetViewSettings(const css::uno::Sequence<css::beans::PropertyValue>& aViewProps)
515 {
516  uno::Reference< beans::XPropertySet > xPropSet( GetModel(), uno::UNO_QUERY );
517  if( !xPropSet.is() )
518  return;
519 
520  awt::Rectangle aVisArea( 0,0, 28000, 21000 );
521 
522  for( const auto& rViewProp : aViewProps )
523  {
524  const OUString& rName = rViewProp.Name;
525  const uno::Any rValue = rViewProp.Value;
526 
527  if ( rName == "VisibleAreaTop" )
528  {
529  rValue >>= aVisArea.Y;
530  }
531  else if ( rName == "VisibleAreaLeft" )
532  {
533  rValue >>= aVisArea.X;
534  }
535  else if ( rName == "VisibleAreaWidth" )
536  {
537  rValue >>= aVisArea.Width;
538  }
539  else if ( rName == "VisibleAreaHeight" )
540  {
541  rValue >>= aVisArea.Height;
542  }
543  }
544 
545  try
546  {
547  xPropSet->setPropertyValue("VisibleArea", uno::makeAny( aVisArea ) );
548  }
549  catch(const css::uno::Exception&)
550  {
551 /* #i79978# since old documents may contain invalid view settings, this is nothing to worry the user about.
552  uno::Sequence<OUString> aSeq(0);
553  SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL );
554 */
555  }
556 }
557 
558 void SdXMLImport::SetConfigurationSettings(const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps)
559 {
560  uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
561  if( !xFac.is() )
562  return;
563 
564  uno::Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY );
565  if( !xProps.is() )
566  return;
567 
568  uno::Reference< beans::XPropertySetInfo > xInfo( xProps->getPropertySetInfo() );
569  if( !xInfo.is() )
570  return;
571 
572  const uno::Sequence<beans::PropertyValue>* pValues = &aConfigProps;
573 
575  pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get());
576  uno::Sequence<beans::PropertyValue> aFiltered;
577  if( pFilter )
578  {
579  aFiltered = pFilter->filterStreamsFromStorage( GetDocumentBase(), GetSourceStorage(), aConfigProps );
580  pValues = &aFiltered;
581  }
582 
583  for( const auto& rValue : *pValues )
584  {
585  try
586  {
587  const OUString& rProperty = rValue.Name;
588  if( xInfo->hasPropertyByName( rProperty ) )
589  xProps->setPropertyValue( rProperty, rValue.Value );
590  }
591  catch(const uno::Exception&)
592  {
593  SAL_INFO("xmloff.draw", "#SdXMLImport::SetConfigurationSettings: Exception!" );
594  }
595  }
596 }
597 
598 // #80365# override this method to read and use the hint value from the
599 // written meta information. If no info is found, guess 10 draw objects
600 //void SdXMLImport::SetStatisticAttributes(const uno::Reference<xml::sax::XAttributeList>& xAttrList)
602  const uno::Sequence<beans::NamedValue> & i_rStats)
603 {
604  static const char* s_stats[] =
605  { "ObjectCount", nullptr };
606 
607  SvXMLImport::SetStatistics(i_rStats);
608 
609  sal_uInt32 nCount(10);
610  for (const auto& rStat : i_rStats) {
611  for (const char** pStat = s_stats; *pStat != nullptr; ++pStat) {
612  if (rStat.Name.equalsAscii(*pStat)) {
613  sal_Int32 val = 0;
614  if (rStat.Value >>= val) {
615  nCount = val;
616  } else {
617  SAL_WARN("xmloff.draw", "SdXMLImport::SetStatistics: invalid entry");
618  }
619  }
620  }
621  }
622 
623  if(nCount)
624  {
627  }
628 }
629 
630 void SdXMLImport::AddHeaderDecl( const OUString& rName, const OUString& rText )
631 {
632  if( !rName.isEmpty() && !rText.isEmpty() )
633  maHeaderDeclsMap[rName] = rText;
634 }
635 
636 void SdXMLImport::AddFooterDecl( const OUString& rName, const OUString& rText )
637 {
638  if( !rName.isEmpty() && !rText.isEmpty() )
639  maFooterDeclsMap[rName] = rText;
640 }
641 
642 void SdXMLImport::AddDateTimeDecl( const OUString& rName, const OUString& rText, bool bFixed, const OUString& rDateTimeFormat )
643 {
644  if( !rName.isEmpty() && (!rText.isEmpty() || !bFixed) )
645  {
647  aDecl.maStrText = rText;
648  aDecl.mbFixed = bFixed;
649  aDecl.maStrDateTimeFormat = rDateTimeFormat;
650  maDateTimeDeclsMap[rName] = aDecl;
651  }
652 }
653 
654 OUString SdXMLImport::GetHeaderDecl( const OUString& rName ) const
655 {
656  OUString aRet;
657  HeaderFooterDeclMap::const_iterator aIter( maHeaderDeclsMap.find( rName ) );
658  if( aIter != maHeaderDeclsMap.end() )
659  aRet = (*aIter).second;
660 
661  return aRet;
662 }
663 
664 OUString SdXMLImport::GetFooterDecl( const OUString& rName ) const
665 {
666  OUString aRet;
667  HeaderFooterDeclMap::const_iterator aIter( maFooterDeclsMap.find( rName ) );
668  if( aIter != maFooterDeclsMap.end() )
669  aRet = (*aIter).second;
670 
671  return aRet;
672 }
673 
674 OUString SdXMLImport::GetDateTimeDecl( const OUString& rName, bool& rbFixed, OUString& rDateTimeFormat )
675 {
677 
678  DateTimeDeclMap::const_iterator aIter( maDateTimeDeclsMap.find( rName ) );
679  if( aIter != maDateTimeDeclsMap.end() )
680  aDecl = (*aIter).second;
681 
682  rbFixed = aDecl.mbFixed;
683  rDateTimeFormat = aDecl.maStrDateTimeFormat;
684  return aDecl.maStrText;
685 }
686 
688 {
689  uno::Reference< lang::XMultiServiceFactory > xFac( GetModel(), uno::UNO_QUERY );
690  if( xFac.is() )
691  {
692  uno::Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY );
693  if( xProps.is() )
694  xProps->setPropertyValue("EmbedFonts", uno::makeAny( true ) );
695  }
696 }
697 
698 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool mbIsFormsSupported
Definition: xmlimp.hxx:250
void AddFooterDecl(const OUString &rName, const OUString &rText)
Definition: sdxmlimp.cxx:636
static constexpr OUStringLiteral gsPreview
virtual SvXMLImportContext * CreateFastContext(sal_Int32 nElement, const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: sdxmlimp.cxx:433
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Impress_XMLOasisContentImporter_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
Definition: sdxmlimp.cxx:306
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlmetai.cxx:208
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
virtual void SAL_CALL startFastElement(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlictxt.cxx:71
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:62
css::uno::Reference< css::container::XIndexAccess > mxDocMasterPages
virtual void SetViewSettings(const css::uno::Sequence< css::beans::PropertyValue > &aViewProps) override
Definition: sdxmlimp.cxx:514
SvXMLNamespaceMap & GetNamespaceMap()
Definition: xmlimp.hxx:394
virtual void SAL_CALL setTargetDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
Definition: sdxmlimp.cxx:355
css::uno::Reference< css::embed::XStorage > const & GetSourceStorage() const
Definition: xmlimp.cxx:1403
OUString GetDocumentBase() const
Definition: xmlimp.cxx:1868
void SetFontDecls(XMLFontStylesContext *pFontDecls)
Definition: xmlimp.cxx:1586
css::uno::Any const & rValue
Definition: ImageStyle.hxx:38
SvXMLImportFlags
Definition: xmlimp.hxx:108
OUString GetHeaderDecl(const OUString &rName) const
Definition: sdxmlimp.cxx:654
css::uno::Reference< css::container::XNameAccess > mxPageLayouts
int nCount
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: xmlimp.cxx:1008
virtual css::uno::Sequence< css::beans::PropertyValue > filterStreamsFromStorage(OUString const &referer, const css::uno::Reference< css::embed::XStorage > &xStorage, const css::uno::Sequence< css::beans::PropertyValue > &aConfigProps)=0
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Impress_XMLOasisStylesImporter_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
Definition: sdxmlimp.cxx:297
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Draw_XMLOasisContentImporter_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
Definition: sdxmlimp.cxx:271
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlmetai.cxx:231
HeaderFooterDeclMap maFooterDeclsMap
SvXMLImportContext * CreateMetaContext(const sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: sdxmlimp.cxx:460
bool mbIsTableShapeSupported
Definition: xmlimp.hxx:251
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Draw_XMLOasisImporter_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
Definition: sdxmlimp.cxx:255
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Draw_XMLOasisMetaImporter_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
Definition: sdxmlimp.cxx:281
SvXMLStylesContext * CreateAutoStylesContext()
Definition: sdxmlimp.cxx:488
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlmetai.cxx:200
SvXMLImportContext * CreateFontDeclsContext()
Definition: sdxmlimp.cxx:506
HeaderFooterDeclMap maHeaderDeclsMap
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Draw_XMLOasisSettingsImporter_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
Definition: sdxmlimp.cxx:289
rtl::Reference< SdXMLMasterStylesContext > mxMasterStylesContext
ProgressBarHelper * GetProgressBarHelper()
Definition: xmlimp.cxx:1495
void AddDateTimeDecl(const OUString &rName, const OUString &rText, bool bFixed, const OUString &rDateTimeFormat)
Definition: sdxmlimp.cxx:642
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: sdxmlimp.cxx:405
void AddHeaderDecl(const OUString &rName, const OUString &rText)
Definition: sdxmlimp.cxx:630
SvXMLImportContext * CreateMasterStylesContext()
Definition: sdxmlimp.cxx:499
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
virtual void SetConfigurationSettings(const css::uno::Sequence< css::beans::PropertyValue > &aConfigProps) override
Definition: sdxmlimp.cxx:558
SvXMLStylesContext * CreateStylesContext()
Definition: sdxmlimp.cxx:477
css::uno::Reference< css::container::XNameAccess > mxDocStyleFamilies
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Impress_XMLOasisSettingsImporter_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
Definition: sdxmlimp.cxx:324
const PropertyValue * pValues
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
Definition: xmlictxt.cxx:114
OUString GetFooterDecl(const OUString &rName) const
Definition: sdxmlimp.cxx:664
SvXMLImportFlags getImportFlags() const
Definition: xmlimp.hxx:452
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3378
constexpr sal_uInt16 XML_NAMESPACE_SMIL
OUString GetDateTimeDecl(const OUString &rName, bool &rbFixed, OUString &rDateTimeFormat)
Definition: sdxmlimp.cxx:674
Handling of tokens in XML:
static constexpr OUStringLiteral gsPageLayouts
#define SAL_INFO(area, stream)
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlictxt.cxx:128
virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > &i_rStats)
Definition: xmlimp.cxx:958
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:94
sal_uInt16 Add(const OUString &rPrefix, const OUString &rName, sal_uInt16 nKey=XML_NAMESPACE_UNKNOWN)
const css::uno::Reference< css::frame::XModel > & GetModel() const
Definition: xmlimp.hxx:400
virtual void NotifyEmbeddedFontRead() override
Definition: sdxmlimp.cxx:687
void SetValue(sal_Int32 nValue)
css::uno::Reference< css::container::XIndexAccess > mxDocDrawPages
const struct statistic s_stats[]
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Impress_XMLOasisImporter_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
Definition: sdxmlimp.cxx:247
const css::uno::Reference< css::beans::XPropertySet > & getImportInfo() const
Definition: xmlimp.hxx:382
void SetReference(sal_Int32 nVal)
handles the top-level office:document-meta element of meta.xml documents
Definition: xmlmetai.hxx:35
virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > &i_rStats) override
Definition: sdxmlimp.cxx:601
#define SAL_WARN(area, stream)
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Impress_XMLOasisMetaImporter_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
Definition: sdxmlimp.cxx:316
virtual void SAL_CALL setTargetDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
Definition: xmlimp.cxx:965
virtual void SAL_CALL characters(const OUString &aChars) override
Definition: xmlmetai.cxx:227
virtual void SAL_CALL characters(const OUString &aChars) override
Definition: xmlictxt.cxx:142
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_comp_Draw_XMLOasisStylesImporter_get_implementation(uno::XComponentContext *pCtx, uno::Sequence< uno::Any > const &)
Definition: sdxmlimp.cxx:262
SdXMLImport(const css::uno::Reference< css::uno::XComponentContext > &xContext, OUString const &implementationName, bool bIsDraw, SvXMLImportFlags nImportFlags)
Definition: sdxmlimp.cxx:331
DateTimeDeclMap maDateTimeDeclsMap
rtl::Reference< XMLShapeImportHelper > const & GetShapeImport()
Definition: xmlimp.hxx:600