LibreOffice Module xmloff (master)  1
xmlimp.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 <config_wasm_strip.h>
21 
22 #include <memory>
23 #include <optional>
24 
25 #include <tools/diagnose_ex.h>
26 #include <sal/log.hxx>
27 #include <com/sun/star/beans/XPropertySetInfo.hpp>
28 #include <tools/urlobj.hxx>
30 #include <vcl/graph.hxx>
32 #include <xmloff/namespacemap.hxx>
33 #include <xmloff/xmluconv.hxx>
34 #include <xmloff/xmlnamespace.hxx>
35 #include <xmloff/xmltoken.hxx>
37 #include <xmloff/xmlictxt.hxx>
38 #include <xmloff/xmlimp.hxx>
39 #include <xmloff/xmlnumfi.hxx>
40 #include <XMLEventImportHelper.hxx>
43 #include <StyleMap.hxx>
45 #include <xmloff/xmlerror.hxx>
46 #include <com/sun/star/container/XNameContainer.hpp>
47 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
49 #include <com/sun/star/io/XOutputStream.hpp>
50 #include <com/sun/star/util/MeasureUnit.hpp>
51 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
52 #include <com/sun/star/frame/XModel.hpp>
53 #include <com/sun/star/document/XBinaryStreamResolver.hpp>
54 #include <com/sun/star/document/XStorageBasedDocument.hpp>
55 #include <com/sun/star/document/XGraphicStorageHandler.hpp>
56 #include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
57 #include <com/sun/star/xml/sax/XLocator.hpp>
58 #include <com/sun/star/xml/sax/FastParser.hpp>
59 #include <com/sun/star/xml/sax/SAXException.hpp>
60 #include <com/sun/star/packages/zip/ZipIOException.hpp>
61 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
62 #include <comphelper/fileformat.h>
65 #include <comphelper/string.hxx>
66 #include <cppuhelper/implbase.hxx>
68 #include <comphelper/extract.hxx>
73 #include <unotools/fontcvt.hxx>
74 #include <fasttokenhandler.hxx>
76 #include <o3tl/string_view.hxx>
77 
78 #include <com/sun/star/rdf/XMetadatable.hpp>
79 #include <com/sun/star/rdf/XRepositorySupplier.hpp>
80 #include <RDFaImportHelper.hxx>
81 
82 using ::com::sun::star::beans::XPropertySetInfo;
83 
84 using namespace ::com::sun::star;
85 using namespace ::com::sun::star::uno;
86 using namespace ::com::sun::star::util;
87 using namespace ::com::sun::star::io;
88 using namespace ::com::sun::star::container;
89 using namespace ::com::sun::star::document;
90 using namespace ::xmloff::token;
91 
93 std::unordered_map< sal_Int32, std::pair< OUString, OUString > > SvXMLImport::aNamespaceMap;
94 std::unordered_map< OUString, OUString > SvXMLImport::aNamespaceURIPrefixMap;
96 
97 namespace {
98 
99 class SvXMLImportEventListener : public cppu::WeakImplHelper< css::lang::XEventListener >
100 {
101 private:
102  SvXMLImport* pImport;
103 
104 public:
105  explicit SvXMLImportEventListener(SvXMLImport* pImport);
106 
107  // XEventListener
108  virtual void SAL_CALL disposing(const lang::EventObject& rEventObject) override;
109 };
110 
111 }
112 
113 SvXMLImportEventListener::SvXMLImportEventListener(SvXMLImport* pTempImport)
114  : pImport(pTempImport)
115 {
116 }
117 
118 // XEventListener
119 void SAL_CALL SvXMLImportEventListener::disposing( const lang::EventObject& )
120 {
121  if (pImport)
122  {
123  pImport->DisposingModel();
124  pImport = nullptr;
125  }
126 }
127 
128 namespace
129 {
130 
131 OUString
132 getBuildIdsProperty(uno::Reference<beans::XPropertySet> const& xImportInfo)
133 {
134  if (xImportInfo.is())
135  {
136  try
137  {
138  Reference< XPropertySetInfo > const xSetInfo(
139  xImportInfo->getPropertySetInfo());
140  if (xSetInfo.is() && xSetInfo->hasPropertyByName("BuildId"))
141  {
142  OUString aBuildId;
143  xImportInfo->getPropertyValue("BuildId") >>= aBuildId;
144  return aBuildId;
145  }
146  }
147  catch (Exception const&)
148  {
149  DBG_UNHANDLED_EXCEPTION("xmloff.core", "exception getting BuildId");
150  }
151  }
152  return OUString();
153 }
154 
155 class DocumentInfo
156 {
157 private:
158  sal_uInt16 mnGeneratorVersion;
159 
160 public:
161  explicit DocumentInfo( const SvXMLImport& rImport )
162  : mnGeneratorVersion( SvXMLImport::ProductVersionUnknown )
163  {
164  OUString const buildIds(
165  getBuildIdsProperty(rImport.getImportInfo()));
166  if (!buildIds.isEmpty())
167  {
168  sal_Int32 const ix = buildIds.indexOf(';');
169  if (-1 != ix)
170  {
171  OUString const loVersion(buildIds.copy(ix + 1));
172  if (!loVersion.isEmpty())
173  {
174  if ('3' == loVersion[0])
175  {
176  mnGeneratorVersion = SvXMLImport::LO_3x;
177  }
178  else if ('4' == loVersion[0])
179  {
180  if (loVersion.getLength() > 1
181  && (loVersion[1] == '0' || loVersion[1] == '1'))
182  {
183  mnGeneratorVersion = SvXMLImport::LO_41x; // 4.0/4.1
184  }
185  else if (loVersion.getLength() > 1 && '2' == loVersion[1])
186  {
187  mnGeneratorVersion = SvXMLImport::LO_42x; // 4.2
188  }
189  else if (loVersion.getLength() > 1 && '3' == loVersion[1])
190  {
191  mnGeneratorVersion = SvXMLImport::LO_43x; // 4.3
192  }
193  else if (loVersion.getLength() > 1 && '4' == loVersion[1])
194  {
195  mnGeneratorVersion = SvXMLImport::LO_44x; // 4.4
196  }
197  }
198  else if ('5' == loVersion[0])
199  {
200  mnGeneratorVersion = SvXMLImport::LO_5x;
201  }
202  else if ('6' == loVersion[0])
203  {
204  if (loVersion.getLength() > 1
205  && (loVersion[1] == '0' || loVersion[1] == '1'
206  || loVersion[1] == '2'))
207  {
208  mnGeneratorVersion = SvXMLImport::LO_6x; // 6.0/6.1/6.2
209  }
210  else
211  {
212  mnGeneratorVersion = SvXMLImport::LO_63x; // 6.3/6.4
213  }
214  }
215  else if ('7' == loVersion[0])
216  {
217  mnGeneratorVersion = SvXMLImport::LO_7x;
218  }
219  else
220  {
221  SAL_INFO("xmloff.core", "unknown LO version: " << loVersion);
222  }
223  return; // ignore buildIds
224  }
225  }
226  }
227  sal_Int32 nUPD, nBuild;
228  if ( !rImport.getBuildIds( nUPD, nBuild ) )
229  return;
230 
231  if ( nUPD >= 640 && nUPD <= 645 )
232  {
233  mnGeneratorVersion = SvXMLImport::OOo_1x;
234  }
235  else if ( nUPD == 680 )
236  {
237  mnGeneratorVersion = SvXMLImport::OOo_2x;
238  }
239  else if ( nUPD == 300 && nBuild <= 9379 )
240  {
241  mnGeneratorVersion = SvXMLImport::OOo_30x;
242  }
243  else if ( nUPD == 310 )
244  {
245  mnGeneratorVersion = SvXMLImport::OOo_31x;
246  }
247  else if ( nUPD == 320 )
248  {
249  mnGeneratorVersion = SvXMLImport::OOo_32x;
250  }
251  else if ( nUPD == 330 )
252  {
253  mnGeneratorVersion = SvXMLImport::OOo_33x;
254  }
255  else if ( nUPD == 340 )
256  {
257  mnGeneratorVersion = SvXMLImport::OOo_34x;
258  }
259  else if (nUPD == 400 || nUPD == 401)
260  {
261  mnGeneratorVersion = SvXMLImport::AOO_40x;
262  }
263  else if (nUPD >= 410)
264  {
265  // effectively this means "latest", see use
266  // in XMLGraphicsDefaultStyle::SetDefaults()!
267  mnGeneratorVersion = SvXMLImport::AOO_4x;
268  }
269  }
270 
271  sal_uInt16 getGeneratorVersion() const
272  {
273  return mnGeneratorVersion;
274  }
275 };
276 
277 }
278 
280 {
281 public:
284 
289 
291  OUString mStreamName;
292 
293  std::optional<OUString> mxODFVersion;
294 
296 
297  std::optional<bool> mbIsMSO;
298 
299  // Boolean, indicating that position attributes
300  // of shapes are given in horizontal left-to-right layout. This is the case
301  // for the OpenOffice.org file format. (#i28749#)
304 
305  const uno::Reference< uno::XComponentContext > mxComponentContext;
307  css::uno::Sequence< OUString > maSupportedServiceNames;
308 
309  uno::Reference< embed::XStorage > mxSourceStorage;
310 
311  std::unique_ptr< xmloff::RDFaImportHelper > mpRDFaHelper;
312 
313  std::unique_ptr< DocumentInfo > mpDocumentInfo;
314 
315  SvXMLImport_Impl( const uno::Reference< uno::XComponentContext >& rxContext,
316  OUString const & theImplementationName,
317  const css::uno::Sequence< OUString > & sSupportedServiceNames = {})
318  : hBatsFontConv( nullptr )
319  , hMathFontConv( nullptr )
320  , mbOwnGraphicResolver( false )
321  , mbOwnEmbeddedResolver( false )
322  , mbIsOOoXML(false)
323  // Convert drawing object positions from OOo file format to OASIS (#i28749#)
324  , mbShapePositionInHoriL2R( false )
325  , mbTextDocInOOoFileFormat( false )
326  , mxComponentContext( rxContext )
327  , implementationName(theImplementationName)
328  , maSupportedServiceNames(sSupportedServiceNames)
329  {
330  SAL_WARN_IF(!mxComponentContext.is(), "xmloff.core", "SvXMLImport: no ComponentContext");
331  if (!mxComponentContext.is()) throw uno::RuntimeException();
332  if (!maSupportedServiceNames.hasElements())
333  maSupportedServiceNames = { "com.sun.star.document.ImportFilter", "com.sun.star.xml.XMLImportFilter" };
334  }
335 
336  sal_uInt16 getGeneratorVersion( const SvXMLImport& rImport )
337  {
338  if (!mpDocumentInfo)
339  {
340  mpDocumentInfo.reset( new DocumentInfo( rImport ) );
341  }
342 
343  return mpDocumentInfo->getGeneratorVersion();
344  }
345 
347 };
348 
350  const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
351 {
352  assert(false);
353  SAL_WARN( "xmloff.core", "CreateFastContext should be overridden, for element " << nElement);
354  return new SvXMLImportContext( *this );
355 }
356 
358 {
360  {
361  // implicit "xml" namespace prefix
373  mxNamespaceMap->Add( "_fo", GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO );
379  mxNamespaceMap->Add( "_svg", GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
385  mxNamespaceMap->Add( "_xforms", GetXMLToken(XML_N_XFORMS_1_0), XML_NAMESPACE_XFORMS );
395 
397  mxNamespaceMap->Add( "_office_libo",
399  }
400 
401  if (mxNumberFormatsSupplier.is())
402  mpNumImport = std::make_unique<SvXMLNumFmtHelper>(mxNumberFormatsSupplier, GetComponentContext());
403 
404  if (mxModel.is() && !mxEventListener.is())
405  {
406  mxEventListener.set(new SvXMLImportEventListener(this));
407  mxModel->addEventListener(mxEventListener);
408  }
409 }
410 
412  const css::uno::Reference< css::uno::XComponentContext >& xContext,
413  OUString const & implementationName,
414  SvXMLImportFlags nImportFlags,
415  const css::uno::Sequence< OUString > & sSupportedServiceNames )
416 : mpImpl( new SvXMLImport_Impl(xContext, implementationName, sSupportedServiceNames) ),
417  mxNamespaceMap( SvXMLNamespaceMap() ),
418 
419  mpUnitConv( new SvXMLUnitConverter( xContext,
420  util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH,
422 
423  mnImportFlags( nImportFlags ),
424  maNamespaceHandler( new SvXMLImportFastNamespaceHandler() ),
425  mbIsFormsSupported( true ),
426  mbIsTableShapeSupported( false ),
427  mbNotifyMacroEventRead( false )
428 {
429  SAL_WARN_IF( !xContext.is(), "xmloff.core", "got no service manager" );
430  InitCtor_();
431  mxParser = xml::sax::FastParser::create( xContext );
434  if ( !bIsNSMapsInitialized )
435  {
437  bIsNSMapsInitialized = true;
438  }
441 }
442 
443 void SvXMLImport::cleanup() noexcept
444 {
445  if (mxEventListener.is() && mxModel.is())
446  mxModel->removeEventListener(mxEventListener);
447  // clear context stacks first in case of parse error because the context
448  // class dtors are full of application logic
449  while (!maContexts.empty())
450  {
451  if (SvXMLStylesContext* pStylesContext = dynamic_cast<SvXMLStylesContext*>(maContexts.top().get()))
452  pStylesContext->dispose();
453  maContexts.pop();
454  }
455  if( mxTextImport )
456  mxTextImport->dispose();
457  mxTextImport.clear(); // XMLRedlineImportHelper needs model
458  DisposingModel();
459 }
460 
462 {
463  cleanup();
464 }
465 
466 bool SvXMLImport::addEmbeddedFont(const css::uno::Reference< css::io::XInputStream >& stream,
467  const OUString& fontName, const char* extra,
468  std::vector<unsigned char> const & key, bool eot)
469 {
472  return mxEmbeddedFontHelper->addEmbeddedFont(stream, fontName, extra, key, eot);
473 }
474 
475 const css::uno::Sequence<sal_Int8>& SvXMLImport::getUnoTunnelId() noexcept
476 {
477  static const comphelper::UnoIdInit theSvXMLImportUnoTunnelId;
478  return theSvXMLImportUnoTunnelId.getSeq();
479 }
480 
481 // XUnoTunnel
482 sal_Int64 SAL_CALL SvXMLImport::getSomething( const uno::Sequence< sal_Int8 >& rId )
483 {
484  return comphelper::getSomethingImpl(rId, this);
485 }
486 
487 namespace
488 {
489  class setFastDocumentHandlerGuard
490  {
491  private:
492  css::uno::Reference<css::xml::sax::XFastParser> mxParser;
493  public:
494  setFastDocumentHandlerGuard(const css::uno::Reference<css::xml::sax::XFastParser>& Parser,
495  const css::uno::Reference<css::xml::sax::XFastDocumentHandler>& Handler)
496  : mxParser(Parser)
497  {
498  mxParser->setFastDocumentHandler(Handler);
499  }
500  //guarantee restoration of null document handler
501  ~setFastDocumentHandlerGuard()
502  {
503  mxParser->setFastDocumentHandler(nullptr);
504  }
505  };
506 }
507 
508 // XFastParser
509 void SAL_CALL SvXMLImport::parseStream( const xml::sax::InputSource& aInputSource )
510 {
511  setFastDocumentHandlerGuard aDocumentHandlerGuard(mxParser, mxFastDocumentHandler.is() ? mxFastDocumentHandler : this);
512  mxParser->parseStream(aInputSource);
513 }
514 
515 void SAL_CALL SvXMLImport::setFastDocumentHandler( const uno::Reference< xml::sax::XFastDocumentHandler >& Handler )
516 {
517  mxFastDocumentHandler = Handler;
518 }
519 
520 void SAL_CALL SvXMLImport::setTokenHandler( const uno::Reference< xml::sax::XFastTokenHandler >& Handler )
521 {
522  mxParser->setTokenHandler( Handler );
523 }
524 
525 void SAL_CALL SvXMLImport::registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken )
526 {
527  mxParser->registerNamespace( NamespaceURL, NamespaceToken );
528 }
529 
530 OUString SAL_CALL SvXMLImport::getNamespaceURL( const OUString& rPrefix )
531 {
532  return mxParser->getNamespaceURL( rPrefix );
533 }
534 
535 void SAL_CALL SvXMLImport::setErrorHandler( const uno::Reference< xml::sax::XErrorHandler >& Handler )
536 {
537  mxParser->setErrorHandler( Handler );
538 }
539 
540 void SAL_CALL SvXMLImport::setEntityResolver( const uno::Reference< xml::sax::XEntityResolver >& Resolver )
541 {
542  mxParser->setEntityResolver( Resolver );
543 }
544 
545 void SAL_CALL SvXMLImport::setLocale( const lang::Locale& rLocale )
546 {
547  mxParser->setLocale( rLocale );
548 }
549 
550 void SAL_CALL SvXMLImport::setNamespaceHandler( const uno::Reference< xml::sax::XFastNamespaceHandler >& Handler)
551 {
552  mxParser->setNamespaceHandler( Handler );
553 }
554 
555 void SAL_CALL SvXMLImport::setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements )
556 {
557  mxParser->setCustomEntityNames( replacements );
558 }
559 
561 {
562  SAL_INFO( "xmloff.core", "{ SvXMLImport::startDocument" );
564  return;
565 
566  Reference< lang::XMultiServiceFactory > xFactory( mxModel, UNO_QUERY );
567  if( !xFactory.is() )
568  return;
569 
570  try
571  {
572  if (!mxGraphicStorageHandler.is())
573  {
574  // #99870# Import... instead of Export...
576  xFactory->createInstance("com.sun.star.document.ImportGraphicStorageHandler"),
577  UNO_QUERY);
578  mpImpl->mbOwnGraphicResolver = mxGraphicStorageHandler.is();
579  }
580 
581  if( !mxEmbeddedResolver.is() )
582  {
583  // #99870# Import... instead of Export...
584  mxEmbeddedResolver.set(
585  xFactory->createInstance("com.sun.star.document.ImportEmbeddedObjectResolver"),
586  UNO_QUERY);
587  mpImpl->mbOwnEmbeddedResolver = mxEmbeddedResolver.is();
588  }
589  }
590  catch( css::uno::Exception& )
591  {
592  }
593 }
594 
596 {
597  SAL_INFO( "xmloff.core", "} SvXMLImport::endDocument" );
598  // #i9518# All the stuff that accesses the document has to be done here, not in the dtor,
599  // because the SvXMLImport dtor might not be called until after the document has been closed.
600 
601  GetTextImport()->MapCrossRefHeadingFieldsHorribly();
602 
603  if (mpImpl->mpRDFaHelper)
604  {
605  const uno::Reference<rdf::XRepositorySupplier> xRS(mxModel,
606  uno::UNO_QUERY);
607  if (xRS.is())
608  {
609  mpImpl->mpRDFaHelper->InsertRDFa( xRS );
610  }
611  }
612 
613  mpNumImport.reset();
614  if (mxImportInfo.is())
615  {
616  uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxImportInfo->getPropertySetInfo();
617  if (xPropertySetInfo.is())
618  {
619  if (bool(mpProgressBarHelper))
620  {
621  OUString sProgressMax(XML_PROGRESSMAX);
622  OUString sProgressCurrent(XML_PROGRESSCURRENT);
623  OUString sRepeat(XML_PROGRESSREPEAT);
624  if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
625  xPropertySetInfo->hasPropertyByName(sProgressCurrent))
626  {
627  sal_Int32 nProgressMax(mpProgressBarHelper->GetReference());
628  sal_Int32 nProgressCurrent(mpProgressBarHelper->GetValue());
629  mxImportInfo->setPropertyValue(sProgressMax, uno::Any(nProgressMax));
630  mxImportInfo->setPropertyValue(sProgressCurrent, uno::Any(nProgressCurrent));
631  }
632  if (xPropertySetInfo->hasPropertyByName(sRepeat))
633  mxImportInfo->setPropertyValue(sRepeat, css::uno::Any(mpProgressBarHelper->GetRepeat()));
634  // pProgressBarHelper is deleted in dtor
635  }
636  OUString sNumberStyles(XML_NUMBERSTYLES);
637  if (mxNumberStyles.is() && xPropertySetInfo->hasPropertyByName(sNumberStyles))
638  {
639  mxImportInfo->setPropertyValue(sNumberStyles, Any(mxNumberStyles));
640  }
641  }
642  }
643 
644  if( mxFontDecls.is() )
645  mxFontDecls->dispose();
646  if( mxStyles.is() )
647  mxStyles->dispose();
648  if( mxAutoStyles.is() )
649  mxAutoStyles->dispose();
650  if( mxMasterStyles.is() )
651  mxMasterStyles->dispose();
652 
653  // possible form-layer related knittings which can only be done when
654  // the whole document exists
655  if ( mxFormImport.is() )
656  mxFormImport->documentDone();
657 
658  // The shape import helper does the z-order sorting in the dtor,
659  // so it must be deleted here, too.
660  mxShapeImport = nullptr;
661 
662  if( mpImpl->mbOwnGraphicResolver )
663  {
665  xComp->dispose();
666  }
667 
668  if( mpImpl->mbOwnEmbeddedResolver )
669  {
671  xComp->dispose();
672  }
673  mpStyleMap.clear();
674 
675  if ( bool( mpXMLErrors ) )
676  {
677  mpXMLErrors->ThrowErrorAsSAXException( XMLERROR_FLAG_SEVERE );
678  }
679 }
680 
681 std::optional<SvXMLNamespaceMap> SvXMLImport::processNSAttributes(
682  std::optional<SvXMLNamespaceMap> & rpNamespaceMap,
683  SvXMLImport *const pImport, // TODO???
684  const uno::Reference< xml::sax::XAttributeList >& xAttrList)
685 {
686  std::optional<SvXMLNamespaceMap> pRewindMap;
687  sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
688  for( sal_Int16 i=0; i < nAttrCount; i++ )
689  {
690  const OUString& rAttrName = xAttrList->getNameByIndex( i );
691  if (pImport && rAttrName == "office:version" && !pImport->mpImpl->mxODFVersion)
692  {
693  pImport->mpImpl->mxODFVersion = xAttrList->getValueByIndex( i );
694 
695  // the ODF version in content.xml and manifest.xml must be the same starting from ODF1.2
696  if (pImport->mpImpl->mStreamName == "content.xml"
697  && !pImport->IsODFVersionConsistent(*pImport->mpImpl->mxODFVersion))
698  {
699  throw xml::sax::SAXException("Inconsistent ODF versions in content.xml and manifest.xml!",
700  uno::Reference< uno::XInterface >(),
701  uno::Any(
702  packages::zip::ZipIOException("Inconsistent ODF versions in content.xml and manifest.xml!" ) ) );
703  }
704  }
705  else if( ( rAttrName.getLength() >= 5 ) &&
706  ( rAttrName.startsWith( GetXMLToken(XML_XMLNS) ) ) &&
707  ( rAttrName.getLength() == 5 || ':' == rAttrName[5] ) )
708  {
709  if( !pRewindMap )
710  {
711  pRewindMap = std::move(rpNamespaceMap);
712  rpNamespaceMap.emplace(*pRewindMap);
713  }
714  const OUString& rAttrValue = xAttrList->getValueByIndex( i );
715 
716  OUString aPrefix( ( rAttrName.getLength() == 5 )
717  ? OUString()
718  : rAttrName.copy( 6 ) );
719  // Add namespace, but only if it is known.
720  sal_uInt16 nKey = rpNamespaceMap->AddIfKnown( aPrefix, rAttrValue );
721  // If namespace is unknown, try to match a name with similar
722  // TC Id and version
723  if( XML_NAMESPACE_UNKNOWN == nKey )
724  {
725  OUString aTestName( rAttrValue );
726  if( SvXMLNamespaceMap::NormalizeURI( aTestName ) )
727  nKey = rpNamespaceMap->AddIfKnown( aPrefix, aTestName );
728  }
729  // If that namespace is not known, too, add it as unknown
730  if( XML_NAMESPACE_UNKNOWN == nKey )
731  rpNamespaceMap->Add( aPrefix, rAttrValue );
732 
733  }
734  }
735  return pRewindMap;
736 }
737 
738 
739 void SAL_CALL SvXMLImport::characters( const OUString& rChars )
740 {
741  maContexts.top()->characters( rChars );
742 }
743 
744 void SAL_CALL SvXMLImport::processingInstruction( const OUString&,
745  const OUString& )
746 {
747 }
748 
749 void SAL_CALL SvXMLImport::setDocumentLocator( const uno::Reference< xml::sax::XLocator >& rLocator )
750 {
751  mxLocator = rLocator;
752 }
753 
754 // XFastContextHandler
755 void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
756  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
757 {
758  SAL_INFO("xmloff.core", "startFastElement " << SvXMLImport::getNameFromToken( Element ));
759  if ( Attribs.is() && !mpImpl->mxODFVersion)
760  {
761  sax_fastparser::FastAttributeList& rAttribList =
763  auto aIter( rAttribList.find( XML_ELEMENT( OFFICE, XML_VERSION ) ) );
764  if( aIter != rAttribList.end() )
765  {
766  mpImpl->mxODFVersion = aIter.toString();
767 
768  // the ODF version in content.xml and manifest.xml must be the same starting from ODF1.2
769  if ( mpImpl->mStreamName == "content.xml" && !IsODFVersionConsistent( *mpImpl->mxODFVersion ) )
770  {
771  throw xml::sax::SAXException("Inconsistent ODF versions in content.xml and manifest.xml!",
772  uno::Reference< uno::XInterface >(),
773  uno::Any(
774  packages::zip::ZipIOException("Inconsistent ODF versions in content.xml and manifest.xml!" ) ) );
775  }
776  }
777  }
778 
779  maNamespaceAttrList->Clear();
780 
781  maNamespaceHandler->addNSDeclAttributes( maNamespaceAttrList );
782  std::optional<SvXMLNamespaceMap> pRewindMap = processNSAttributes(mxNamespaceMap, this, maNamespaceAttrList);
783 
784  SvXMLImportContextRef xContext;
785  const bool bRootContext = maContexts.empty();
786  if (!maContexts.empty())
787  {
788  const SvXMLImportContextRef & pHandler = maContexts.top();
789  SAL_INFO("xmloff.core", "calling createFastChildContext on " << typeid(*pHandler.get()).name());
790  auto tmp = pHandler->createFastChildContext( Element, Attribs );
791  xContext = static_cast<SvXMLImportContext*>(tmp.get());
792  assert((tmp && xContext) || (!tmp && !xContext));
793  }
794  else
795  xContext.set( CreateFastContext( Element, Attribs ) );
796 
797  SAL_INFO_IF(!xContext.is(), "xmloff.core", "No fast context for element " << getNameFromToken(Element));
798  if (bRootContext && !xContext)
799  {
800  OUString aName = getNameFromToken(Element);
802  { aName }, "Root element " + aName + " unknown", Reference<xml::sax::XLocator>() );
803  }
804  if ( !xContext )
805  xContext.set( new SvXMLImportContext( *this ) );
806 
807  // Remember old namespace map.
808  if( pRewindMap )
809  xContext->PutRewindMap(std::move(pRewindMap));
810 
811  // Call a startElement at the new context.
812  xContext->startFastElement( Element, Attribs );
813 
814  // Push context on stack.
815  maContexts.push(xContext);
816 }
817 
818 void SAL_CALL SvXMLImport::startUnknownElement (const OUString & rNamespace, const OUString & rName,
819  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
820 {
821  SAL_INFO("xmloff.core", "startUnknownElement " << rNamespace << " " << rName);
822  SvXMLImportContextRef xContext;
823  const bool bRootContext = maContexts.empty();
824  if (!maContexts.empty())
825  {
826  const SvXMLImportContextRef & pHandler = maContexts.top();
827  SAL_INFO("xmloff.core", "calling createUnknownChildContext on " << typeid(*pHandler.get()).name());
828  auto tmp = pHandler->createUnknownChildContext( rNamespace, rName, Attribs );
829  xContext = static_cast<SvXMLImportContext*>(tmp.get());
830  assert((tmp && xContext) || (!tmp && !xContext));
831  }
832  else
833  xContext.set( CreateFastContext( -1, Attribs ) );
834 
835  SAL_WARN_IF(!xContext.is(), "xmloff.core", "No context for unknown-element " << rNamespace << " " << rName);
836  if (bRootContext && !xContext)
837  {
839  { rName }, "Root element " + rName + " unknown", Reference<xml::sax::XLocator>() );
840  }
841  if (!xContext)
842  {
843  if (!maContexts.empty())
844  // This is pretty weird, but it's what the code did before I simplified it, and some parts of the
845  // code rely on this behaviour e.g. DocumentBuilderContext
846  xContext = maContexts.top();
847  else
848  xContext = new SvXMLImportContext( *this );
849  }
850 
851  xContext->startUnknownElement( rNamespace, rName, Attribs );
852  maContexts.push(xContext);
853 }
854 
855 void SAL_CALL SvXMLImport::endFastElement (sal_Int32 Element)
856 {
857  SAL_INFO("xmloff.core", "endFastElement " << SvXMLImport::getNameFromToken( Element ));
858  if (maContexts.empty())
859  {
860  SAL_WARN("xmloff.core", "SvXMLImport::endFastElement: no context left");
861  assert(false);
862  return;
863  }
864  SvXMLImportContextRef xContext = std::move(maContexts.top());
865  // Get a namespace map to rewind.
866  std::optional<SvXMLNamespaceMap> pRewindMap = xContext->TakeRewindMap();
867  maContexts.pop();
868  xContext->endFastElement( Element );
869  // Rewind a namespace map.
870  if (pRewindMap)
871  mxNamespaceMap = std::move(pRewindMap);
872 }
873 
874 void SAL_CALL SvXMLImport::endUnknownElement (const OUString & rPrefix, const OUString & rLocalName)
875 {
876  SAL_INFO("xmloff.core", "endUnknownElement " << rPrefix << " " << rLocalName);
877  if (maContexts.empty())
878  {
879  SAL_WARN("xmloff.core", "SvXMLImport::endUnknownElement: no context left");
880  assert(false);
881  return;
882  }
883  SvXMLImportContextRef xContext = std::move(maContexts.top());
884  maContexts.pop();
885  xContext->endUnknownElement( rPrefix, rLocalName );
886 }
887 
888 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
890  const uno::Reference< xml::sax::XFastAttributeList > &)
891 {
892  return this;
893 }
894 
895 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
896  SvXMLImport::createUnknownChildContext (const OUString &, const OUString &,
897  const uno::Reference< xml::sax::XFastAttributeList > &)
898 {
899  return this;
900 }
901 
902 void SvXMLImport::SetStatistics(const uno::Sequence< beans::NamedValue> &)
903 {
906 }
907 
908 // XImporter
909 void SAL_CALL SvXMLImport::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc )
910 {
911  mxModel.set( xDoc, UNO_QUERY );
912  if( !mxModel.is() )
913  throw lang::IllegalArgumentException();
914 
915  try
916  {
917  uno::Reference<document::XStorageBasedDocument> const xSBDoc(mxModel, uno::UNO_QUERY);
918  uno::Reference<embed::XStorage> const xStor(xSBDoc.is() ? xSBDoc->getDocumentStorage()
919  : nullptr);
920  if (xStor.is())
921  {
922  mpImpl->mbIsOOoXML =
925  }
926  }
927  catch (uno::Exception const&)
928  {
929  DBG_UNHANDLED_EXCEPTION("xmloff.core");
930  }
931  if (!mxEventListener.is())
932  {
933  mxEventListener.set(new SvXMLImportEventListener(this));
934  mxModel->addEventListener(mxEventListener);
935  }
936 
937  SAL_WARN_IF( bool(mpNumImport), "xmloff.core", "number format import already exists." );
938  mpNumImport.reset();
939 }
940 
941 // XFilter
942 sal_Bool SAL_CALL SvXMLImport::filter( const uno::Sequence< beans::PropertyValue >& )
943 {
944  return false;
945 }
946 
947 void SAL_CALL SvXMLImport::cancel( )
948 {
949 }
950 
951 // XInitialize
952 void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArguments )
953 {
954  for( const auto& rAny : aArguments )
955  {
956  Reference<XInterface> xValue;
957  rAny >>= xValue;
958 
959  uno::Reference<task::XStatusIndicator> xTmpStatusIndicator(
960  xValue, UNO_QUERY );
961  if( xTmpStatusIndicator.is() )
962  mxStatusIndicator = xTmpStatusIndicator;
963 
964  uno::Reference<document::XGraphicStorageHandler> xGraphicStorageHandler(xValue, UNO_QUERY);
965  if (xGraphicStorageHandler.is())
966  mxGraphicStorageHandler = xGraphicStorageHandler;
967 
968  uno::Reference<document::XEmbeddedObjectResolver> xTmpObjectResolver(
969  xValue, UNO_QUERY );
970  if( xTmpObjectResolver.is() )
971  mxEmbeddedResolver = xTmpObjectResolver;
972 
973  uno::Reference<beans::XPropertySet> xTmpPropSet( xValue, UNO_QUERY );
974  if( xTmpPropSet.is() )
975  {
976  mxImportInfo = xTmpPropSet;
977  uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxImportInfo->getPropertySetInfo();
978  if (xPropertySetInfo.is())
979  {
980  OUString sPropName(XML_NUMBERSTYLES);
981  if (xPropertySetInfo->hasPropertyByName(sPropName))
982  {
983  uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
984  aAny >>= mxNumberStyles;
985  }
986 
987  sPropName = "PrivateData";
988  if (xPropertySetInfo->hasPropertyByName(sPropName))
989  {
990  Reference < XInterface > xIfc;
991  uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
992  aAny >>= xIfc;
993 
994  StyleMap *pSMap = comphelper::getFromUnoTunnel<StyleMap>( xIfc );
995  if( pSMap )
996  {
997  mpStyleMap = pSMap;
998  }
999  }
1000  OUString sBaseURI;
1001  sPropName = "BaseURI";
1002  if (xPropertySetInfo->hasPropertyByName(sPropName))
1003  {
1004  uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
1005  aAny >>= sBaseURI;
1006  mpImpl->aBaseURL.SetURL( sBaseURI );
1007  mpImpl->aDocBase.SetURL( sBaseURI );
1008  }
1009  OUString sRelPath;
1010  sPropName = "StreamRelPath";
1011  if( xPropertySetInfo->hasPropertyByName(sPropName) )
1012  {
1013  uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
1014  aAny >>= sRelPath;
1015  }
1016  OUString sName;
1017  sPropName = "StreamName";
1018  if( xPropertySetInfo->hasPropertyByName(sPropName) )
1019  {
1020  uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
1021  aAny >>= sName;
1022  }
1023  if( !sBaseURI.isEmpty() && !sName.isEmpty() )
1024  {
1025  if( !sRelPath.isEmpty() )
1026  mpImpl->aBaseURL.insertName( sRelPath );
1027  mpImpl->aBaseURL.insertName( sName );
1028  }
1029  mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
1030  // Retrieve property <ShapePositionInHoriL2R> (#i28749#)
1031  sPropName = "ShapePositionInHoriL2R";
1032  if( xPropertySetInfo->hasPropertyByName(sPropName) )
1033  {
1034  uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
1035  aAny >>= mpImpl->mbShapePositionInHoriL2R;
1036  }
1037  sPropName = "TextDocInOOoFileFormat";
1038  if( xPropertySetInfo->hasPropertyByName(sPropName) )
1039  {
1040  uno::Any aAny = mxImportInfo->getPropertyValue(sPropName);
1041  aAny >>= mpImpl->mbTextDocInOOoFileFormat;
1042  }
1043 
1044  sPropName = "SourceStorage";
1045  if( xPropertySetInfo->hasPropertyByName(sPropName) )
1046  mxImportInfo->getPropertyValue(sPropName) >>= mpImpl->mxSourceStorage;
1047  }
1048  }
1049  }
1050 
1051  uno::Reference<lang::XInitialization> const xInit(mxParser, uno::UNO_QUERY_THROW);
1052  xInit->initialize( { Any(OUString("IgnoreMissingNSDecl")) });
1053 }
1054 
1055 // XServiceInfo
1057 {
1058  return mpImpl->implementationName;
1059 }
1060 
1061 sal_Bool SAL_CALL SvXMLImport::supportsService( const OUString& rServiceName )
1062 {
1063  return cppu::supportsService(this, rServiceName);
1064 }
1065 
1066 uno::Sequence< OUString > SAL_CALL SvXMLImport::getSupportedServiceNames( )
1067 {
1068  return mpImpl->maSupportedServiceNames;
1069 }
1070 
1072 {
1073  return new XMLTextImportHelper( mxModel, *this );
1074 }
1075 
1077 {
1078  return new XMLShapeImportHelper( *this, mxModel );
1079 }
1080 
1082 {
1083 // WASM_CHART change
1084 // TODO: Instead of importing the ChartModel an alternative may be
1085 // added to convert not to Chart/OLE SdrObejct, but to GraphicObject
1086 // with the Chart visualization. There should be a preview available
1087 // in the imported chart data
1088 #if !ENABLE_WASM_STRIP_CHART
1089  return new SchXMLImportHelper();
1090 #else
1091  return nullptr;
1092 #endif
1093 }
1094 
1096 {
1097  return new ::xmloff::OFormLayerXMLImport(*this);
1098 }
1099 
1100 
1101 // Get or create fill/line/lineend-style-helper
1102 
1103 
1105 {
1106  if( !mxGradientHelper.is() )
1107  {
1108  if( mxModel.is() )
1109  {
1110  Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
1111  if( xServiceFact.is() )
1112  {
1113  try
1114  {
1115  mxGradientHelper.set( xServiceFact->createInstance(
1116  "com.sun.star.drawing.GradientTable" ), UNO_QUERY);
1117  }
1118  catch( lang::ServiceNotRegisteredException& )
1119  {}
1120  }
1121  }
1122  }
1123 
1124  return mxGradientHelper;
1125 }
1126 
1128 {
1129  if( !mxHatchHelper.is() )
1130  {
1131  if( mxModel.is() )
1132  {
1133  Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
1134  if( xServiceFact.is() )
1135  {
1136  try
1137  {
1138  mxHatchHelper.set( xServiceFact->createInstance(
1139  "com.sun.star.drawing.HatchTable" ), UNO_QUERY);
1140  }
1141  catch( lang::ServiceNotRegisteredException& )
1142  {}
1143  }
1144  }
1145  }
1146 
1147  return mxHatchHelper;
1148 }
1149 
1151 {
1152  if( !mxBitmapHelper.is() )
1153  {
1154  if( mxModel.is() )
1155  {
1156  Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
1157  if( xServiceFact.is() )
1158  {
1159  try
1160  {
1161  mxBitmapHelper.set( xServiceFact->createInstance(
1162  "com.sun.star.drawing.BitmapTable" ), UNO_QUERY);
1163  }
1164  catch( lang::ServiceNotRegisteredException& )
1165  {}
1166  }
1167  }
1168  }
1169 
1170  return mxBitmapHelper;
1171 }
1172 
1174 {
1175  if( !mxTransGradientHelper.is() )
1176  {
1177  if( mxModel.is() )
1178  {
1179  Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
1180  if( xServiceFact.is() )
1181  {
1182  try
1183  {
1184  mxTransGradientHelper.set( xServiceFact->createInstance(
1185  "com.sun.star.drawing.TransparencyGradientTable" ), UNO_QUERY);
1186  }
1187  catch( lang::ServiceNotRegisteredException& )
1188  {}
1189  }
1190  }
1191  }
1192 
1193  return mxTransGradientHelper;
1194 }
1195 
1197 {
1198  if( !mxMarkerHelper.is() )
1199  {
1200  if( mxModel.is() )
1201  {
1202  Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
1203  if( xServiceFact.is() )
1204  {
1205  try
1206  {
1207  mxMarkerHelper.set( xServiceFact->createInstance( "com.sun.star.drawing.MarkerTable" ), UNO_QUERY);
1208  }
1209  catch( lang::ServiceNotRegisteredException& )
1210  {}
1211  }
1212  }
1213  }
1214 
1215  return mxMarkerHelper;
1216 }
1217 
1219 {
1220  if( !mxDashHelper.is() && mxModel.is() )
1221  {
1222  Reference< lang::XMultiServiceFactory > xServiceFact( mxModel, UNO_QUERY);
1223  if( xServiceFact.is() )
1224  {
1225  try
1226  {
1227  mxDashHelper.set( xServiceFact->createInstance( "com.sun.star.drawing.DashTable" ), UNO_QUERY);
1228  }
1229  catch( lang::ServiceNotRegisteredException& )
1230  {}
1231  }
1232  }
1233 
1234  return mxDashHelper;
1235 }
1236 
1237 bool SvXMLImport::IsPackageURL( const OUString& rURL ) const
1238 {
1239 
1240  // if, and only if, only parts are imported, then we're in a package
1242  if( (mnImportFlags & nTest) == nTest )
1243  return false;
1244 
1245  // TODO: from this point extract to own static function
1246 
1247  // Some quick tests: Some may rely on the package structure!
1248  sal_Int32 nLen = rURL.getLength();
1249  if( nLen > 0 && '/' == rURL[0] )
1250  // RFC2396 net_path or abs_path
1251  return false;
1252  else if( nLen > 1 && '.' == rURL[0] )
1253  {
1254  if( '.' == rURL[1] )
1255  // ../: We are never going up one level, so we know
1256  // it's not an external URI
1257  return false;
1258  else if( '/' == rURL[1] )
1259  // we are remaining on a level, so it's a package URI
1260  return true;
1261  }
1262 
1263  // Now check for a RFC2396 schema
1264  sal_Int32 nPos = 1;
1265  while( nPos < nLen )
1266  {
1267  switch( rURL[nPos] )
1268  {
1269  case '/':
1270  // a relative path segment
1271  return true;
1272  case ':':
1273  // a schema
1274  return false;
1275  default:
1276  break;
1277  // we don't care about any other characters
1278  }
1279  ++nPos;
1280  }
1281 
1282  return true;
1283 }
1284 
1285 uno::Reference<graphic::XGraphic> SvXMLImport::loadGraphicByURL(OUString const & rURL)
1286 {
1287  uno::Reference<graphic::XGraphic> xGraphic;
1288 
1289  if (mxGraphicStorageHandler.is())
1290  {
1291  if (IsPackageURL(rURL))
1292  {
1293  xGraphic = mxGraphicStorageHandler->loadGraphic(rURL);
1294  }
1295  else
1296  {
1297  OUString const & rAbsoluteURL = GetAbsoluteReference(rURL);
1298  GraphicExternalLink aExternalLink(rAbsoluteURL);
1299  Graphic aGraphic(aExternalLink);
1300  xGraphic = aGraphic.GetXGraphic();
1301  }
1302  }
1303 
1304  return xGraphic;
1305 }
1306 
1307 uno::Reference<graphic::XGraphic> SvXMLImport::loadGraphicFromBase64(uno::Reference<io::XOutputStream> const & rxOutputStream)
1308 {
1309  uno::Reference<graphic::XGraphic> xGraphic;
1310 
1311  if (mxGraphicStorageHandler.is())
1312  {
1313  xGraphic = mxGraphicStorageHandler->loadGraphicFromOutputStream(rxOutputStream);
1314  }
1315 
1316  return xGraphic;
1317 }
1318 
1320 {
1321  Reference< XOutputStream > xOStm;
1322  Reference< document::XBinaryStreamResolver > xStmResolver(mxGraphicStorageHandler, UNO_QUERY);
1323 
1324  if( xStmResolver.is() )
1325  xOStm = xStmResolver->createOutputStream();
1326 
1327  return xOStm;
1328 }
1329 
1331  const OUString& rURL,
1332  std::u16string_view rClassId )
1333 {
1334  OUString sRet;
1335 
1336  if( IsPackageURL( rURL ) )
1337  {
1338  if ( mxEmbeddedResolver.is() )
1339  {
1340  OUString sURL( rURL );
1341  if( !rClassId.empty() )
1342  {
1343  sURL += OUString::Concat("!") + rClassId;
1344  }
1345  sRet = mxEmbeddedResolver->resolveEmbeddedObjectURL( sURL );
1346  }
1347  }
1348  else
1349  sRet = GetAbsoluteReference( rURL );
1350 
1351  return sRet;
1352 }
1353 
1355 {
1356  return mpImpl->mxSourceStorage;
1357 }
1358 
1359 Reference < XOutputStream >
1361 {
1362  Reference < XOutputStream > xOLEStream;
1363 
1364  if( mxEmbeddedResolver.is() )
1365  {
1366  Reference< XNameAccess > xNA( mxEmbeddedResolver, UNO_QUERY );
1367  if( xNA.is() )
1368  {
1369  Any aAny = xNA->getByName( "Obj12345678" );
1370  aAny >>= xOLEStream;
1371  }
1372  }
1373 
1374  return xOLEStream;
1375 }
1376 
1378 {
1379  OUString sRet;
1380 
1381  if( mxEmbeddedResolver.is() )
1382  {
1383  sRet = mxEmbeddedResolver->resolveEmbeddedObjectURL( "Obj12345678" );
1384  }
1385 
1386  return sRet;
1387 }
1388 
1390  const OUString& rName,
1391  const OUString& rDisplayName )
1392 {
1393  if( !mpStyleMap.is() )
1394  {
1395  mpStyleMap = new StyleMap;
1396  if( mxImportInfo.is() )
1397  {
1398  OUString sPrivateData( "PrivateData" );
1399  Reference< beans::XPropertySetInfo > xPropertySetInfo =
1400  mxImportInfo->getPropertySetInfo();
1401  if( xPropertySetInfo.is() &&
1402  xPropertySetInfo->hasPropertyByName(sPrivateData) )
1403  {
1404  Reference < XInterface > xIfc(
1405  static_cast< XUnoTunnel *>( mpStyleMap.get() ) );
1406  mxImportInfo->setPropertyValue( sPrivateData, Any(xIfc) );
1407  }
1408  }
1409  }
1410 
1411  StyleMap::key_type aKey( nFamily, rName );
1412  StyleMap::value_type aValue( aKey, rDisplayName );
1413  ::std::pair<StyleMap::iterator,bool> aRes( mpStyleMap->insert( aValue ) );
1414  SAL_WARN_IF( !aRes.second,
1415  "xmloff.core",
1416  "duplicate style name of family " << static_cast<int>(nFamily) << ": \"" << rName << "\"");
1417 
1418 }
1419 
1421  const OUString& rName ) const
1422 {
1423  OUString sName( rName );
1424  if( mpStyleMap.is() && !rName.isEmpty() )
1425  {
1426  StyleMap::key_type aKey( nFamily, rName );
1427  StyleMap::const_iterator aIter = mpStyleMap->find( aKey );
1428  if( aIter != mpStyleMap->end() )
1429  sName = (*aIter).second;
1430  }
1431  return sName;
1432 }
1433 
1434 void SvXMLImport::SetViewSettings(const css::uno::Sequence<css::beans::PropertyValue>&)
1435 {
1436 }
1437 
1438 void SvXMLImport::SetConfigurationSettings(const css::uno::Sequence<css::beans::PropertyValue>&)
1439 {
1440 }
1441 
1442 void SvXMLImport::SetDocumentSpecificSettings(const OUString&, const uno::Sequence<beans::PropertyValue>&)
1443 {
1444 }
1445 
1447 {
1448  if (!mpProgressBarHelper)
1449  {
1450  mpProgressBarHelper = std::make_unique<ProgressBarHelper>(mxStatusIndicator, false);
1451 
1452  if (mxImportInfo.is())
1453  {
1454  uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxImportInfo->getPropertySetInfo();
1455  if (xPropertySetInfo.is())
1456  {
1457  OUString sProgressRange(XML_PROGRESSRANGE);
1458  OUString sProgressMax(XML_PROGRESSMAX);
1459  OUString sProgressCurrent(XML_PROGRESSCURRENT);
1460  OUString sRepeat(XML_PROGRESSREPEAT);
1461  if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
1462  xPropertySetInfo->hasPropertyByName(sProgressCurrent) &&
1463  xPropertySetInfo->hasPropertyByName(sProgressRange))
1464  {
1465  uno::Any aAny;
1466  sal_Int32 nProgressMax(0);
1467  sal_Int32 nProgressCurrent(0);
1468  sal_Int32 nProgressRange(0);
1469  aAny = mxImportInfo->getPropertyValue(sProgressRange);
1470  if (aAny >>= nProgressRange)
1471  mpProgressBarHelper->SetRange(nProgressRange);
1472  aAny = mxImportInfo->getPropertyValue(sProgressMax);
1473  if (aAny >>= nProgressMax)
1474  mpProgressBarHelper->SetReference(nProgressMax);
1475  aAny = mxImportInfo->getPropertyValue(sProgressCurrent);
1476  if (aAny >>= nProgressCurrent)
1477  mpProgressBarHelper->SetValue(nProgressCurrent);
1478  }
1479  if (xPropertySetInfo->hasPropertyByName(sRepeat))
1480  {
1481  uno::Any aAny = mxImportInfo->getPropertyValue(sRepeat);
1482  if (aAny.getValueType() == cppu::UnoType<bool>::get())
1483  mpProgressBarHelper->SetRepeat(::cppu::any2bool(aAny));
1484  else {
1485  SAL_WARN( "xmloff.core", "why is it no boolean?" );
1486  }
1487  }
1488  }
1489  }
1490  }
1491  return mpProgressBarHelper.get();
1492 }
1493 
1494 void SvXMLImport::AddNumberStyle(sal_Int32 nKey, const OUString& rName)
1495 {
1496  if (!mxNumberStyles.is())
1498  if (mxNumberStyles.is())
1499  {
1500  try
1501  {
1502  mxNumberStyles->insertByName(rName, Any(nKey));
1503  }
1504  catch ( uno::Exception& )
1505  {
1506  DBG_UNHANDLED_EXCEPTION( "xmloff.core", "Numberformat could not be inserted");
1507  }
1508  }
1509  else {
1510  SAL_WARN( "xmloff.core", "not possible to create NameContainer");
1511  }
1512 }
1513 
1515 {
1516  if (!mpEventImportHelper)
1517  {
1518  // construct event helper and register StarBasic handler and standard
1519  // event tables
1520  mpEventImportHelper = std::make_unique<XMLEventImportHelper>();
1521  const OUString& sStarBasic(GetXMLToken(XML_STARBASIC));
1522  mpEventImportHelper->RegisterFactory(sStarBasic,
1523  std::make_unique<XMLStarBasicContextFactory>());
1524  const OUString& sScript(GetXMLToken(XML_SCRIPT));
1525  mpEventImportHelper->RegisterFactory(sScript,
1526  std::make_unique<XMLScriptContextFactory>());
1527  mpEventImportHelper->AddTranslationTable(aStandardEventTable);
1528 
1529  // register StarBasic event handler with capitalized spelling
1530  mpEventImportHelper->RegisterFactory("StarBasic",
1531  std::make_unique<XMLStarBasicContextFactory>());
1532  }
1533 
1534  return *mpEventImportHelper;
1535 }
1536 
1538 {
1539  if (mxFontDecls.is())
1540  mxFontDecls->dispose();
1541  mxFontDecls = pFontDecls;
1542 }
1543 
1545 {
1546  if (mxStyles.is())
1547  mxStyles->dispose();
1548  mxStyles = pStyles;
1549 }
1550 
1552 {
1553  if (pAutoStyles && mxNumberStyles.is())
1554  {
1555  uno::Reference<xml::sax::XFastAttributeList> xAttrList = new sax_fastparser::FastAttributeList(nullptr);
1556  const uno::Sequence<OUString> aStyleNames = mxNumberStyles->getElementNames();
1557  for (const auto& name : aStyleNames)
1558  {
1559  uno::Any aAny(mxNumberStyles->getByName(name));
1560  sal_Int32 nKey(0);
1561  if (aAny >>= nKey)
1562  {
1563  SvXMLStyleContext* pContext = new SvXMLNumFormatContext(
1564  *this, name, xAttrList, nKey,
1565  GetDataStylesImport()->GetLanguageForKey(nKey), *pAutoStyles);
1566  pAutoStyles->AddStyle(*pContext);
1567  }
1568  }
1569  }
1570  if (mxAutoStyles.is())
1571  mxAutoStyles->dispose();
1572  mxAutoStyles = pAutoStyles;
1573  GetTextImport()->SetAutoStyles( pAutoStyles );
1574  GetShapeImport()->SetAutoStylesContext( pAutoStyles );
1575 #if !ENABLE_WASM_STRIP_CHART
1576  GetChartImport()->SetAutoStylesContext( pAutoStyles );
1577 #endif
1578  GetFormImport()->setAutoStyleContext( pAutoStyles );
1579 }
1580 
1582 {
1583  if (mxMasterStyles.is())
1584  mxMasterStyles->dispose();
1585  mxMasterStyles = pMasterStyles;
1586 }
1587 
1589 {
1590  return mxFontDecls.get();
1591 }
1592 
1594 {
1595  return mxStyles.get();
1596 }
1597 
1599 {
1600  return mxAutoStyles.get();
1601 }
1602 
1604 {
1605  return mxFontDecls.get();
1606 }
1607 
1609 {
1610  return mxStyles.get();
1611 }
1612 
1614 {
1615  return mxAutoStyles.get();
1616 }
1617 
1618 OUString SvXMLImport::GetAbsoluteReference(const OUString& rValue) const
1619 {
1620  if( rValue.isEmpty() || rValue[0] == '#' )
1621  return rValue;
1622 
1623  INetURLObject aAbsURL;
1624  if( mpImpl->aBaseURL.GetNewAbsURL( rValue, &aAbsURL ) )
1626  else
1627  return rValue;
1628 }
1629 
1630 bool SvXMLImport::IsODFVersionConsistent( const OUString& aODFVersion )
1631 {
1632  // the check returns false only if the storage version could be retrieved
1633  bool bResult = true;
1634 
1635  if ( !aODFVersion.isEmpty() && aODFVersion.compareTo( ODFVER_012_TEXT ) >= 0 )
1636  {
1637  // check the consistency only for the ODF1.2 and later ( according to content.xml )
1638  // manifest.xml might have no version, it should be checked here and the correct version should be set
1639  try
1640  { // don't use getDocumentStorage(), it's temporary and latest version
1641  uno::Reference<embed::XStorage> const xStor(GetSourceStorage());
1642  if (!xStor.is())
1643  return bResult;
1644  uno::Reference< beans::XPropertySet > xStorProps( xStor, uno::UNO_QUERY_THROW );
1645 
1646  // the check should be done only for OASIS format
1647  if (!IsOOoXML())
1648  {
1649  bool bRepairPackage = false;
1650  try
1651  {
1652  xStorProps->getPropertyValue( "RepairPackage" )
1653  >>= bRepairPackage;
1654  } catch ( uno::Exception& )
1655  {}
1656 
1657  // check only if not in Repair mode
1658  if ( !bRepairPackage )
1659  {
1660  OUString aStorVersion;
1661  xStorProps->getPropertyValue( "Version" )
1662  >>= aStorVersion;
1663 
1664  // if the storage version is set in manifest.xml, it must be the same as in content.xml
1665  // if not, set it explicitly to be used further ( it will work even for readonly storage )
1666  // This workaround is not nice, but I see no other way to handle it, since there are
1667  // ODF1.2 documents without version in manifest.xml
1668  if ( !aStorVersion.isEmpty() )
1669  bResult = aODFVersion == aStorVersion;
1670  else
1671  xStorProps->setPropertyValue( "Version",
1672  uno::Any( aODFVersion ) );
1673 
1674  if ( bResult )
1675  {
1676  bool bInconsistent = false;
1677  xStorProps->getPropertyValue( "IsInconsistent" )
1678  >>= bInconsistent;
1679  bResult = !bInconsistent;
1680  }
1681  }
1682  }
1683  }
1684  catch( uno::Exception& )
1685  {}
1686  }
1687 
1688  return bResult;
1689 }
1690 
1692 {
1693  SAL_WARN_IF( mxNumberFormatsSupplier.is(), "xmloff.core", "number formats supplier already exists!" );
1694  if(mxModel.is())
1696  uno::Reference< util::XNumberFormatsSupplier> (mxModel, uno::UNO_QUERY);
1697 }
1698 
1700 {
1701  SAL_WARN_IF( bool(mpNumImport), "xmloff.core", "data styles import already exists!" );
1702  uno::Reference<util::XNumberFormatsSupplier> xNum =
1704  if ( xNum.is() )
1705  mpNumImport = std::make_unique<SvXMLNumFmtHelper>(xNum, GetComponentContext() );
1706 }
1707 
1709 {
1710  sal_Unicode cNew = c;
1711  if( !mpImpl->hBatsFontConv )
1712  {
1713  mpImpl->hBatsFontConv = CreateFontToSubsFontConverter( u"StarBats",
1714  FontToSubsFontFlags::IMPORT );
1715  SAL_WARN_IF( !mpImpl->hBatsFontConv, "xmloff.core", "Got no symbol font converter" );
1716  }
1717  if( mpImpl->hBatsFontConv )
1718  {
1719  cNew = ConvertFontToSubsFontChar( mpImpl->hBatsFontConv, c );
1720  }
1721 
1722  return cNew;
1723 }
1724 
1726 {
1727  sal_Unicode cNew = c;
1728  if( !mpImpl->hMathFontConv )
1729  {
1730  mpImpl->hMathFontConv = CreateFontToSubsFontConverter( u"StarMath",
1731  FontToSubsFontFlags::IMPORT );
1732  SAL_WARN_IF( !mpImpl->hMathFontConv, "xmloff.core", "Got no symbol font converter" );
1733  }
1734  if( mpImpl->hMathFontConv )
1735  {
1736  cNew = ConvertFontToSubsFontChar( mpImpl->hMathFontConv, c );
1737  }
1738 
1739  return cNew;
1740 }
1741 
1743  sal_Int32 nId,
1744  const Sequence<OUString>& rMsgParams,
1745  const OUString& rExceptionMessage,
1746  const Reference<xml::sax::XLocator>& rLocator )
1747 {
1748  // create error list on demand
1749  if ( !mpXMLErrors )
1750  mpXMLErrors = std::make_unique<XMLErrors>();
1751 
1752  // save error information
1753  // use document locator (if none supplied)
1754  mpXMLErrors->AddRecord( nId, rMsgParams, rExceptionMessage,
1755  rLocator.is() ? rLocator : mxLocator );
1756 }
1757 
1759  sal_Int32 nId,
1760  const Sequence<OUString>& rMsgParams)
1761 {
1762  SetError( nId, rMsgParams, "", nullptr );
1763 }
1764 
1766  sal_Int32 nId,
1767  const OUString& rMsg1)
1768 {
1769  Sequence<OUString> aSeq { rMsg1 };
1770  SetError( nId, aSeq );
1771 }
1772 
1774 {
1775  if( mxFontDecls.is() )
1776  mxFontDecls->dispose();
1777  if( mxStyles.is() )
1778  mxStyles->dispose();
1779  if( mxAutoStyles.is() )
1780  mxAutoStyles->dispose();
1781  if( mxMasterStyles.is() )
1782  mxMasterStyles->dispose();
1783 
1784  mxModel.set(nullptr);
1785  mxEventListener.set(nullptr);
1786 }
1787 
1789 {
1790  return mpImpl->maInterfaceToIdentifierMapper;
1791 }
1792 
1793 uno::Reference< uno::XComponentContext > const &
1795 {
1796  return mpImpl->mxComponentContext;
1797 }
1798 
1799 OUString SvXMLImport::GetBaseURL() const
1800 {
1801  return mpImpl->aBaseURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
1802 }
1803 
1805 {
1806  return mpImpl->aDocBase.GetMainURL( INetURLObject::DecodeMechanism::NONE );
1807 }
1808 
1809 // Convert drawing object positions from OOo file format to OASIS (#i28749#)
1811 {
1812  return mpImpl->mbShapePositionInHoriL2R;
1813 }
1814 
1816 {
1817  return mpImpl->mbTextDocInOOoFileFormat;
1818 }
1819 
1821 {
1822  // dummy method; to be implemented by derived classes supporting XForms
1823 }
1824 
1825 bool SvXMLImport::getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const
1826 {
1827  bool bRet = false;
1828  OUString const aBuildId(getBuildIdsProperty(mxImportInfo));
1829  if (!aBuildId.isEmpty())
1830  {
1831  sal_Int32 nIndex = aBuildId.indexOf('$');
1832  if (nIndex != -1)
1833  {
1834  rUPD = o3tl::toInt32(aBuildId.subView( 0, nIndex ));
1835  sal_Int32 nIndexEnd = aBuildId.indexOf(';', nIndex);
1836  rBuild = (nIndexEnd == -1)
1837  ? o3tl::toInt32(aBuildId.subView(nIndex + 1))
1838  : o3tl::toInt32(aBuildId.subView(nIndex + 1, nIndexEnd - nIndex - 1));
1839  bRet = true;
1840  }
1841  }
1842  return bRet;
1843 }
1844 
1846 {
1847  // --> ORW
1848  return mpImpl->getGeneratorVersion( *this );
1849  // <--
1850 }
1851 
1853  sal_uInt16 const nOOoVersion, sal_uInt16 const nLOVersion)
1854 {
1855  assert( (nLOVersion & LO_flag));
1856  assert(!(nOOoVersion & LO_flag));
1857  const sal_uInt16 nGeneratorVersion(getGeneratorVersion());
1858  return (nGeneratorVersion & LO_flag)
1859  ? nGeneratorVersion < nLOVersion
1860  : nGeneratorVersion < nOOoVersion;
1861 }
1862 
1863 
1865 {
1866  return mpImpl->mxODFVersion ? *mpImpl->mxODFVersion : OUString();
1867 }
1868 
1870 {
1871  return mpImpl->mbIsOOoXML;
1872 }
1873 
1875 {
1876  if (!mpImpl->mbIsMSO.has_value())
1877  {
1878  uno::Reference<document::XDocumentPropertiesSupplier> xSupplier(GetModel(), uno::UNO_QUERY);
1879  if (xSupplier.is())
1880  {
1881  uno::Reference<document::XDocumentProperties> xProps
1882  = xSupplier->getDocumentProperties();
1883  if (xProps.is())
1884  {
1885  mpImpl->mbIsMSO = xProps->getGenerator().startsWith("MicrosoftOffice");
1886  }
1887  }
1888  }
1889 
1890  return mpImpl->mbIsMSO.has_value() ? *mpImpl->mbIsMSO : false;
1891 }
1892 
1893 // xml:id for RDF metadata
1894 void SvXMLImport::SetXmlId(uno::Reference<uno::XInterface> const & i_xIfc,
1895  OUString const & i_rXmlId)
1896 {
1897  if (i_rXmlId.isEmpty())
1898  return;
1899 
1900  try {
1901  const uno::Reference<rdf::XMetadatable> xMeta(i_xIfc,
1902  uno::UNO_QUERY);
1903 //FIXME: not yet
1904  if (xMeta.is()) {
1905  const beans::StringPair mdref( mpImpl->mStreamName, i_rXmlId );
1906  try {
1907  xMeta->setMetadataReference(mdref);
1908  } catch (lang::IllegalArgumentException &) {
1909  // probably duplicate; ignore
1910  SAL_INFO("xmloff.core", "SvXMLImport::SetXmlId: cannot set xml:id");
1911  }
1912  }
1913  } catch (uno::Exception &) {
1914  TOOLS_WARN_EXCEPTION("xmloff.core","SvXMLImport::SetXmlId");
1915  }
1916 }
1917 
1920 {
1921  if (!mpImpl->mpRDFaHelper)
1922  {
1923  mpImpl->mpRDFaHelper.reset( new ::xmloff::RDFaImportHelper(*this) );
1924  }
1925  return *mpImpl->mpRDFaHelper;
1926 }
1927 
1928 void
1929 SvXMLImport::AddRDFa(const uno::Reference<rdf::XMetadatable>& i_xObject,
1930  OUString const & i_rAbout,
1931  OUString const & i_rProperty,
1932  OUString const & i_rContent,
1933  OUString const & i_rDatatype)
1934 {
1935  // N.B.: we only get called if i_xObject had xhtml:about attribute
1936  // (an empty attribute value is valid)
1938  rRDFaHelper.ParseAndAddRDFa(i_xObject,
1939  i_rAbout, i_rProperty, i_rContent, i_rDatatype);
1940 }
1941 
1943 {
1944  if( embeddedFontUrlsKnown.count( url ) != 0 )
1945  return true;
1946  embeddedFontUrlsKnown.insert( url );
1947  return false;
1948 }
1949 
1950 const OUString & SvXMLImport::getNameFromToken( sal_Int32 nToken )
1951 {
1952  return xTokenHandler->getIdentifier( nToken & TOKEN_MASK );
1953 }
1954 
1955 OUString SvXMLImport::getPrefixAndNameFromToken( sal_Int32 nToken )
1956 {
1957  OUString rv;
1958  sal_Int32 nNamespaceToken = ( nToken & NMSP_MASK ) >> NMSP_SHIFT;
1959  auto aIter( aNamespaceMap.find( nNamespaceToken ) );
1960  if( aIter != aNamespaceMap.end() )
1961  rv = (*aIter).second.second + " " + aIter->second.first + ":";
1962  return rv + xTokenHandler->getIdentifier( nToken & TOKEN_MASK );
1963 }
1964 
1965 OUString SvXMLImport::getNamespacePrefixFromToken(sal_Int32 nToken, const SvXMLNamespaceMap* pMap)
1966 {
1967  sal_Int32 nNamespaceToken = ( nToken & NMSP_MASK ) >> NMSP_SHIFT;
1968  auto aIter( aNamespaceMap.find( nNamespaceToken ) );
1969  if( aIter != aNamespaceMap.end() )
1970  {
1971  if (pMap)
1972  {
1973  OUString sRet = pMap->GetPrefixByKey(pMap->GetKeyByName((*aIter).second.second));
1974  if (!sRet.isEmpty())
1975  return sRet;
1976  }
1977  return (*aIter).second.first;
1978  }
1979  else
1980  return OUString();
1981 }
1982 
1983 OUString SvXMLImport::getNamespaceURIFromToken( sal_Int32 nToken )
1984 {
1985  sal_Int32 nNamespaceToken = ( nToken & NMSP_MASK ) >> NMSP_SHIFT;
1986  auto aIter( aNamespaceMap.find( nNamespaceToken ) );
1987  if( aIter != aNamespaceMap.end() )
1988  return (*aIter).second.second;
1989  else
1990  return OUString();
1991 }
1992 
1993 OUString SvXMLImport::getNamespacePrefixFromURI( const OUString& rURI )
1994 {
1995  auto aIter( aNamespaceURIPrefixMap.find(rURI) );
1996  if( aIter != aNamespaceURIPrefixMap.end() )
1997  return (*aIter).second;
1998  else
1999  return OUString();
2000 }
2001 
2002 sal_Int32 SvXMLImport::getTokenFromName( const OUString& rName )
2003 {
2004  Sequence< sal_Int8 > aLocalNameSeq( reinterpret_cast<sal_Int8 const *>(
2005  OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr()), rName.getLength() );
2006  return xTokenHandler->getTokenFromUTF8( aLocalNameSeq );
2007 }
2008 
2010 {
2011  auto mapTokenToNamespace = []( sal_Int32 nToken, sal_Int32 nPrefix, sal_Int32 nNamespace )
2012  {
2013  if ( nToken >= 0 )
2014  {
2015  const OUString& sNamespace = GetXMLToken( static_cast<XMLTokenEnum>( nNamespace ) );
2016  const OUString& sPrefix = GetXMLToken( static_cast<XMLTokenEnum>( nPrefix ) );
2017  assert( aNamespaceMap.find(nToken +1) == aNamespaceMap.end() && "cannot map two namespaces to the same token here");
2018  aNamespaceMap[ nToken + 1 ] = std::make_pair( sPrefix, sNamespace );
2019  aNamespaceURIPrefixMap.emplace( sNamespace, sPrefix );
2020  }
2021  };
2022 
2023  mapTokenToNamespace( XML_NAMESPACE_XML, XML_XML, XML_N_XML ); // implicit "xml" namespace prefix
2024  mapTokenToNamespace( XML_NAMESPACE_OFFICE, XML_NP_OFFICE, XML_N_OFFICE );
2025  mapTokenToNamespace( XML_NAMESPACE_OFFICE_SO52, XML_NP_OFFICE, XML_N_OFFICE_OLD );
2026  mapTokenToNamespace( XML_NAMESPACE_OFFICE_OOO, XML_NP_OFFICE, XML_N_OFFICE_OOO );
2027  mapTokenToNamespace( XML_NAMESPACE_STYLE, XML_NP_STYLE, XML_N_STYLE );
2028  mapTokenToNamespace( XML_NAMESPACE_STYLE_SO52, XML_NP_STYLE, XML_N_STYLE_OLD );
2029  mapTokenToNamespace( XML_NAMESPACE_STYLE_OOO, XML_NP_STYLE, XML_N_STYLE_OOO );
2030  mapTokenToNamespace( XML_NAMESPACE_TEXT, XML_NP_TEXT, XML_N_TEXT );
2031  mapTokenToNamespace( XML_NAMESPACE_TEXT_SO52, XML_NP_TEXT, XML_N_TEXT_OLD );
2032  mapTokenToNamespace( XML_NAMESPACE_TEXT_OOO, XML_NP_TEXT, XML_N_TEXT_OOO );
2033  mapTokenToNamespace( XML_NAMESPACE_TABLE, XML_NP_TABLE, XML_N_TABLE );
2034  mapTokenToNamespace( XML_NAMESPACE_TABLE_SO52, XML_NP_TABLE, XML_N_TABLE_OLD );
2035  mapTokenToNamespace( XML_NAMESPACE_TABLE_OOO, XML_NP_TABLE, XML_N_TABLE_OOO );
2036  mapTokenToNamespace( XML_NAMESPACE_DRAW, XML_NP_DRAW, XML_N_DRAW );
2037  mapTokenToNamespace( XML_NAMESPACE_DRAW_SO52, XML_NP_DRAW, XML_N_DRAW_OLD );
2038  mapTokenToNamespace( XML_NAMESPACE_DRAW_OOO, XML_NP_DRAW, XML_N_DRAW_OOO );
2039  mapTokenToNamespace( XML_NAMESPACE_FO, XML_NP_FO, XML_N_FO );
2040  mapTokenToNamespace( XML_NAMESPACE_FO_SO52, XML_NP_FO, XML_N_FO_OLD );
2041  mapTokenToNamespace( XML_NAMESPACE_FO_COMPAT, XML_NP_FO, XML_N_FO_COMPAT );
2042  mapTokenToNamespace( XML_NAMESPACE_XLINK, XML_NP_XLINK, XML_N_XLINK );
2043  mapTokenToNamespace( XML_NAMESPACE_XLINK_SO52, XML_NP_XLINK, XML_N_XLINK_OLD );
2044  mapTokenToNamespace( XML_NAMESPACE_DC, XML_NP_DC, XML_N_DC );
2045  mapTokenToNamespace( XML_NAMESPACE_META, XML_NP_META, XML_N_META );
2046  mapTokenToNamespace( XML_NAMESPACE_META_SO52, XML_NP_META, XML_N_META_OLD );
2047  mapTokenToNamespace( XML_NAMESPACE_META_OOO, XML_NP_META, XML_N_META_OOO );
2048  mapTokenToNamespace( XML_NAMESPACE_NUMBER, XML_NP_NUMBER, XML_N_NUMBER );
2049  mapTokenToNamespace( XML_NAMESPACE_NUMBER_SO52, XML_NP_NUMBER, XML_N_NUMBER_OLD );
2050  mapTokenToNamespace( XML_NAMESPACE_NUMBER_OOO, XML_NP_NUMBER, XML_N_NUMBER_OOO );
2055  mapTokenToNamespace( XML_NAMESPACE_SVG, XML_NP_SVG, XML_N_SVG );
2056  mapTokenToNamespace( XML_NAMESPACE_SVG_COMPAT, XML_NP_SVG, XML_N_SVG_COMPAT );
2057  mapTokenToNamespace( XML_NAMESPACE_CHART, XML_NP_CHART, XML_N_CHART );
2058  mapTokenToNamespace( XML_NAMESPACE_CHART_SO52, XML_NP_CHART, XML_N_CHART_OLD );
2059  mapTokenToNamespace( XML_NAMESPACE_CHART_OOO, XML_NP_CHART, XML_N_CHART_OOO );
2060  mapTokenToNamespace( XML_NAMESPACE_DR3D, XML_NP_DR3D, XML_N_DR3D );
2061  mapTokenToNamespace( XML_NAMESPACE_DR3D_OOO, XML_NP_DR3D, XML_N_DR3D_OOO );
2062  mapTokenToNamespace( XML_NAMESPACE_MATH, XML_NP_MATH, XML_N_MATH );
2064  mapTokenToNamespace( XML_NAMESPACE_FORM, XML_NP_FORM, XML_N_FORM );
2065  mapTokenToNamespace( XML_NAMESPACE_FORM_OOO, XML_NP_FORM, XML_N_FORM_OOO );
2066  mapTokenToNamespace( XML_NAMESPACE_SCRIPT, XML_NP_SCRIPT, XML_N_SCRIPT );
2067  mapTokenToNamespace( XML_NAMESPACE_SCRIPT_OOO, XML_NP_SCRIPT, XML_N_SCRIPT_OOO );
2069  mapTokenToNamespace( XML_NAMESPACE_CONFIG, XML_NP_CONFIG, XML_N_CONFIG );
2070  mapTokenToNamespace( XML_NAMESPACE_CONFIG_OOO, XML_NP_CONFIG, XML_N_CONFIG_OOO );
2071  mapTokenToNamespace( XML_NAMESPACE_OOO, XML_NP_OOO, XML_N_OOO );
2072  mapTokenToNamespace( XML_NAMESPACE_OOOW, XML_NP_OOOW, XML_N_OOOW );
2073  mapTokenToNamespace( XML_NAMESPACE_OOOC, XML_NP_OOOC, XML_N_OOOC );
2074  mapTokenToNamespace( XML_NAMESPACE_DOM, XML_NP_DOM, XML_N_DOM );
2075  mapTokenToNamespace( XML_NAMESPACE_DB, XML_NP_DB, XML_N_DB );
2076  mapTokenToNamespace( XML_NAMESPACE_DB_OASIS, XML_NP_DB, XML_N_DB_OASIS );
2077  mapTokenToNamespace( XML_NAMESPACE_DLG, XML_NP_DLG, XML_N_DLG );
2078  mapTokenToNamespace( XML_NAMESPACE_XFORMS, XML_NP_XFORMS_1_0, XML_N_XFORMS_1_0 );
2079  mapTokenToNamespace( XML_NAMESPACE_XSD, XML_NP_XSD, XML_N_XSD );
2080  mapTokenToNamespace( XML_NAMESPACE_XSI, XML_NP_XSI, XML_N_XSI );
2081  mapTokenToNamespace( XML_NAMESPACE_SMIL, XML_NP_SMIL, XML_N_SMIL );
2082  mapTokenToNamespace( XML_NAMESPACE_SMIL_SO52, XML_NP_SMIL, XML_N_SMIL_OLD );
2083  mapTokenToNamespace( XML_NAMESPACE_SMIL_COMPAT, XML_NP_SMIL, XML_N_SMIL_COMPAT );
2084  mapTokenToNamespace( XML_NAMESPACE_ANIMATION, XML_NP_ANIMATION, XML_N_ANIMATION );
2086  mapTokenToNamespace( XML_NAMESPACE_REPORT, XML_NP_RPT, XML_N_RPT );
2087  mapTokenToNamespace( XML_NAMESPACE_REPORT_OASIS, XML_NP_RPT, XML_N_RPT_OASIS );
2088  mapTokenToNamespace( XML_NAMESPACE_OF, XML_NP_OF, XML_N_OF );
2089  mapTokenToNamespace( XML_NAMESPACE_XHTML, XML_NP_XHTML, XML_N_XHTML );
2090  mapTokenToNamespace( XML_NAMESPACE_GRDDL, XML_NP_GRDDL, XML_N_GRDDL );
2092  mapTokenToNamespace( XML_NAMESPACE_TABLE_EXT, XML_NP_TABLE_EXT, XML_N_TABLE_EXT );
2093  mapTokenToNamespace( XML_NAMESPACE_CHART_EXT, XML_NP_CHART_EXT, XML_N_CHART_EXT );
2094  mapTokenToNamespace( XML_NAMESPACE_DRAW_EXT, XML_NP_DRAW_EXT, XML_N_DRAW_EXT );
2095  mapTokenToNamespace( XML_NAMESPACE_CALC_EXT, XML_NP_CALC_EXT, XML_N_CALC_EXT );
2096  mapTokenToNamespace( XML_NAMESPACE_LO_EXT, XML_NP_LO_EXT, XML_N_LO_EXT );
2097  mapTokenToNamespace( XML_NAMESPACE_CSS3TEXT, XML_NP_CSS3TEXT, XML_N_CSS3TEXT );
2098  mapTokenToNamespace( XML_NAMESPACE_FIELD, XML_NP_FIELD, XML_N_FIELD );
2099  mapTokenToNamespace( XML_NAMESPACE_FORMX, XML_NP_FORMX, XML_N_FORMX );
2100 }
2101 
2103 {
2104  for( auto const &aNamespaceEntry : aNamespaceMap )
2105  {
2106  // aNamespaceMap = { Token : ( NamespacePrefix, NamespaceURI ) }
2107  registerNamespace( aNamespaceEntry.second.second, aNamespaceEntry.first << NMSP_SHIFT );
2108  }
2109 }
2110 
2112 {
2114  return;
2115 
2117 
2118  mbNotifyMacroEventRead = true;
2119 }
2120 
2122 {
2123 }
2124 
2126 {
2127  for(const auto& aNamespaceDefine : m_aNamespaceDefines)
2128  {
2129  const OUString& rPrefix = aNamespaceDefine.m_aPrefix;
2130  const OUString& rNamespaceURI = aNamespaceDefine.m_aNamespaceURI;
2131  OUString sDecl;
2132  if ( rPrefix.isEmpty() )
2133  sDecl = "xmlns";
2134  else
2135  sDecl = "xmlns:" + rPrefix;
2136  rAttrList->AddAttribute( sDecl, "CDATA", rNamespaceURI );
2137  }
2138  m_aNamespaceDefines.clear();
2139 }
2140 
2141 void SvXMLImportFastNamespaceHandler::registerNamespace( const OUString& rNamespacePrefix, const OUString& rNamespaceURI )
2142 {
2143  // Elements with default namespace parsed by FastParser have namespace prefix.
2144  // A default namespace needs to be registered with the prefix, to maintain the compatibility.
2145  if ( rNamespacePrefix.isEmpty() )
2147  SvXMLImport::getNamespacePrefixFromURI( rNamespaceURI ), rNamespaceURI) );
2148 
2150  rNamespacePrefix, rNamespaceURI) );
2151 }
2152 
2153 OUString SvXMLImportFastNamespaceHandler::getNamespaceURI( const OUString&/* rNamespacePrefix */ )
2154 {
2155  return OUString();
2156 }
2157 
2159 : mrImport( rImport ),
2160  mxFastAttributes( new sax_fastparser::FastAttributeList( SvXMLImport::xTokenHandler.get() ) )
2161 {
2162 }
2163 
2164 void SAL_CALL SvXMLLegacyToFastDocHandler::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc )
2165 {
2166  mrImport->setTargetDocument( xDoc );
2167 }
2168 
2170 {
2171  mrImport->startDocument();
2172 }
2173 
2175 {
2176  mrImport->endDocument();
2177 }
2178 
2179 void SAL_CALL SvXMLLegacyToFastDocHandler::startElement( const OUString& rName,
2180  const uno::Reference< xml::sax::XAttributeList >& xAttrList )
2181 {
2182  sal_uInt16 nDefaultNamespace = XML_NAMESPACE_UNKNOWN;
2183  if (!maDefaultNamespaces.empty())
2184  nDefaultNamespace = maDefaultNamespaces.top();
2185  SvXMLImport::processNSAttributes(mrImport->mxNamespaceMap, mrImport.get(), xAttrList);
2186  OUString aLocalName;
2187  sal_uInt16 nPrefix = mrImport->mxNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
2188  sal_Int32 mnElement = NAMESPACE_TOKEN( nPrefix ) | SvXMLImport::getTokenFromName( aLocalName );
2189  mxFastAttributes->clear();
2190 
2191  sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
2192  for( sal_Int16 i=0; i < nAttrCount; i++ )
2193  {
2194  const OUString& rAttrName = xAttrList->getNameByIndex( i );
2195  const OUString& rAttrValue = xAttrList->getValueByIndex( i );
2196  if (rAttrName == "xmlns")
2197  {
2198  sal_uInt16 nNamespaceKey = mrImport->mxNamespaceMap->GetKeyByName(rAttrValue);
2199  if (nNamespaceKey != XML_NAMESPACE_UNKNOWN)
2200  {
2201  nDefaultNamespace = nNamespaceKey;
2202  continue;
2203  }
2204  assert(false && "unknown namespace");
2205  }
2206  else if (rAttrName.indexOf(":") == -1 && nDefaultNamespace != XML_NAMESPACE_UNKNOWN)
2207  {
2208  auto const nToken = SvXMLImport::getTokenFromName(rAttrName);
2210  {
2211  mxFastAttributes->addUnknown(mrImport->mxNamespaceMap->GetNameByKey(nDefaultNamespace),
2212  OUStringToOString(rAttrName, RTL_TEXTENCODING_UTF8),
2213  OUStringToOString(rAttrValue, RTL_TEXTENCODING_UTF8));
2214  }
2215  else
2216  {
2217  sal_Int32 const nAttr = NAMESPACE_TOKEN(nDefaultNamespace) | nToken;
2218  mxFastAttributes->add(nAttr, OUStringToOString(rAttrValue, RTL_TEXTENCODING_UTF8));
2219  }
2220  continue;
2221  }
2222 
2223  OUString aLocalAttrName;
2224  OUString aNamespace;
2225  // don't add unknown namespaces to the map
2226  sal_uInt16 const nAttrPrefix = mrImport->mxNamespaceMap->GetKeyByQName(
2227  rAttrName, nullptr, &aLocalAttrName, &aNamespace, SvXMLNamespaceMap::QNameMode::AttrValue);
2228  if( XML_NAMESPACE_XMLNS == nAttrPrefix )
2229  continue; // ignore
2230  auto const nToken = SvXMLImport::getTokenFromName(aLocalAttrName);
2231  if (XML_NAMESPACE_UNKNOWN == nAttrPrefix || nToken == xmloff::XML_TOKEN_INVALID)
2232  {
2233  mxFastAttributes->addUnknown(aNamespace,
2234  OUStringToOString(rAttrName, RTL_TEXTENCODING_UTF8),
2235  OUStringToOString(rAttrValue, RTL_TEXTENCODING_UTF8));
2236  }
2237  else
2238  {
2239  sal_Int32 const nAttr = NAMESPACE_TOKEN(nAttrPrefix) | nToken;
2240  mxFastAttributes->add(nAttr, OUStringToOString(rAttrValue, RTL_TEXTENCODING_UTF8));
2241  }
2242  }
2243  mrImport->startFastElement( mnElement, mxFastAttributes );
2244  maDefaultNamespaces.push(nDefaultNamespace);
2245 }
2246 
2247 void SAL_CALL SvXMLLegacyToFastDocHandler::endElement( const OUString& rName )
2248 {
2249  OUString aLocalName;
2250  sal_uInt16 nPrefix = mrImport->mxNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
2251  sal_Int32 mnElement = NAMESPACE_TOKEN( nPrefix ) | SvXMLImport::getTokenFromName(aLocalName);
2252  mrImport->endFastElement( mnElement );
2253  maDefaultNamespaces.pop();
2254 }
2255 
2256 void SAL_CALL SvXMLLegacyToFastDocHandler::characters( const OUString& aChars )
2257 {
2258  mrImport->characters( aChars );
2259 }
2260 
2262 {
2263 }
2264 
2265 void SAL_CALL SvXMLLegacyToFastDocHandler::processingInstruction( const OUString& aTarget,
2266  const OUString& aData)
2267 {
2268  mrImport->processingInstruction( aTarget, aData );
2269 }
2270 
2271 void SAL_CALL SvXMLLegacyToFastDocHandler::setDocumentLocator( const uno::Reference< xml::sax::XLocator >& rLocator )
2272 {
2273  mrImport->setDocumentLocator( rLocator );
2274 }
2275 
2276 
2277 
2278 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
exports com.sun.star.lib. util
const css::uno::Reference< css::container::XNameContainer > & GetBitmapHelper()
Definition: xmlimp.cxx:1150
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
FontToSubsFontConverter hMathFontConv
Definition: xmlimp.cxx:283
FastAttributeIter find(sal_Int32 nToken) const
constexpr OUStringLiteral XML_PROGRESSRANGE
constexpr sal_uInt16 XML_NAMESPACE_MATH
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION_SO52
OUString GetBaseURL() const
Definition: xmlimp.cxx:1799
constexpr sal_uInt16 XML_NAMESPACE_CHART_OOO
static rtl::Reference< xmloff::token::FastTokenHandler > xTokenHandler
Definition: xmlimp.hxx:236
rtl::Reference< SvXMLImport > mrImport
Definition: xmlimp.hxx:155
rtl::Reference< SvXMLStylesContext > mxMasterStyles
Definition: xmlimp.hxx:205
SAL_DLLPRIVATE::xmloff::RDFaImportHelper & GetRDFaImportHelper()
do not dllexport this; only for advanced cases (bookmark-start)
Definition: xmlimp.cxx:1919
virtual void SAL_CALL setErrorHandler(const css::uno::Reference< css::xml::sax::XErrorHandler > &Handler) override
Definition: xmlimp.cxx:535
constexpr sal_uInt16 XML_NAMESPACE_ANIMATION
css::uno::Reference< css::graphic::XGraphic > loadGraphicFromBase64(css::uno::Reference< css::io::XOutputStream > const &rxOutputStream)
Definition: xmlimp.cxx:1307
constexpr sal_uInt16 XML_NAMESPACE_DB_OASIS
sal_Int32 nIndex
OUString implementationName
Definition: xmlimp.cxx:306
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
COMPHELPER_DLLPUBLIC css::uno::Reference< css::container::XNameContainer > NameContainer_createInstance(const css::uno::Type &aType)
virtual void SAL_CALL setFastDocumentHandler(const css::uno::Reference< css::xml::sax::XFastDocumentHandler > &Handler) override
Definition: xmlimp.cxx:515
constexpr sal_uInt16 XML_NAMESPACE_VERSIONS_LIST
void SetStyles(SvXMLStylesContext *pStyles)
Definition: xmlimp.cxx:1544
rtl::Reference< ::xmloff::OFormLayerXMLImport > const & GetFormImport()
Definition: xmlimp.hxx:625
static std::unordered_map< sal_Int32, std::pair< OUString, OUString > > aNamespaceMap
Definition: xmlimp.hxx:237
virtual void SAL_CALL parseStream(const css::xml::sax::InputSource &aInputSource) override
Definition: xmlimp.cxx:509
constexpr sal_uInt16 XML_NAMESPACE_OFFICE_OOO
constexpr sal_uInt16 XML_NAMESPACE_SCRIPT_OOO
constexpr sal_uInt16 XML_NAMESPACE_XFORMS
css::uno::Reference< css::container::XNameContainer > mxTransGradientHelper
Definition: xmlimp.hxx:210
constexpr sal_uInt16 XML_NAMESPACE_CHART
void cleanup() noexcept
Definition: xmlimp.cxx:443
constexpr sal_uInt16 XML_NAMESPACE_DR3D
virtual void SAL_CALL endFastElement(sal_Int32 Element) override
Definition: xmlimp.cxx:855
std::unique_ptr< SvXMLNumFmtHelper > mpNumImport
Definition: xmlimp.hxx:222
rtl::Reference< XMLTextImportHelper > mxTextImport
Definition: xmlimp.hxx:197
void SetRepeat(bool bValue)
constexpr sal_uInt16 XML_NAMESPACE_DRAW_EXT
const css::uno::Reference< css::container::XNameContainer > & GetHatchHelper()
Definition: xmlimp.cxx:1127
SAL_DLLPRIVATE void InitCtor_()
Definition: xmlimp.cxx:357
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:82
constexpr sal_uInt16 XML_NAMESPACE_SCRIPT
constexpr OUStringLiteral XML_PROGRESSCURRENT
constexpr sal_uInt16 XML_NAMESPACE_OOOC
virtual XMLShapeImportHelper * CreateShapeImport()
Definition: xmlimp.cxx:1076
rtl::Reference< XMLFontStylesContext > mxFontDecls
Definition: xmlimp.hxx:202
virtual OUString SAL_CALL getImplementationName() final override
Definition: xmlimp.cxx:1056
virtual void SAL_CALL registerNamespace(const OUString &NamespaceURL, sal_Int32 NamespaceToken) override
Definition: xmlimp.cxx:525
bool mbShapePositionInHoriL2R
Definition: xmlimp.cxx:302
css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator
Definition: xmlimp.hxx:250
static const sal_uInt16 OOo_30x
Definition: xmlimp.hxx:537
#define SAL_INFO_IF(condition, area, stream)
constexpr sal_uInt16 XML_NAMESPACE_FORMX
css::uno::Reference< css::container::XNameContainer > mxNumberStyles
Definition: xmlimp.hxx:213
const css::uno::Reference< css::container::XNameContainer > & GetTransGradientHelper()
Definition: xmlimp.cxx:1173
sal_Unicode ConvStarMathCharToStarSymbol(sal_Unicode c)
Definition: xmlimp.cxx:1725
uno::Reference< embed::XStorage > mxSourceStorage
Definition: xmlimp.cxx:309
constexpr sal_uInt16 XML_NAMESPACE_FO_COMPAT
constexpr sal_uInt16 XML_NAMESPACE_SMIL_SO52
::xmloff::OFormLayerXMLImport * CreateFormImport()
Definition: xmlimp.cxx:1095
constexpr sal_uInt16 XML_NAMESPACE_XLINK
std::unique_ptr< XMLEventImportHelper > mpEventImportHelper
Definition: xmlimp.hxx:224
constexpr sal_uInt16 XML_NAMESPACE_OOO
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) final override
Definition: xmlimp.cxx:1061
std::unique_ptr< ProgressBarHelper > mpProgressBarHelper
Definition: xmlimp.hxx:223
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
css::uno::Reference< css::io::XOutputStream > GetStreamForEmbeddedObjectURLFromBase64() const
Definition: xmlimp.cxx:1360
SvXMLNumFmtHelper * GetDataStylesImport()
Definition: xmlimp.hxx:653
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
virtual XMLTextImportHelper * CreateTextImport()
Definition: xmlimp.cxx:1071
constexpr sal_Int32 NMSP_MASK
Definition: xmlimp.hxx:95
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() final override
Definition: xmlimp.cxx:1066
constexpr sal_uInt16 XML_NAMESPACE_DLG
constexpr OUStringLiteral ODFVER_012_TEXT
constexpr sal_uInt16 XML_NAMESPACE_CSS3TEXT
css::uno::Reference< css::graphic::XGraphic > loadGraphicByURL(OUString const &rURL)
Definition: xmlimp.cxx:1285
constexpr sal_uInt16 XML_NAMESPACE_FO_SO52
bool IsShapePositionInHoriL2R() const
Definition: xmlimp.cxx:1810
constexpr sal_uInt16 XML_NAMESPACE_XLINK_SO52
static const sal_uInt16 AOO_40x
Definition: xmlimp.hxx:543
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
Definition: xmlimp.hxx:601
constexpr sal_uInt16 XML_NAMESPACE_STYLE_OOO
static const sal_uInt16 LO_41x
Definition: xmlimp.hxx:552
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > &xLocator) override
Definition: xmlimp.cxx:749
constexpr sal_uInt16 XML_NAMESPACE_ANIMATION_OOO
rtl::Reference< SchXMLImportHelper > const & GetChartImport()
Definition: xmlimp.hxx:617
std::optional< bool > mbIsMSO
Definition: xmlimp.cxx:297
bool IsOOoXML() const
Definition: xmlimp.cxx:1869
SvXMLImport(const css::uno::Reference< css::uno::XComponentContext > &xContext, OUString const &implementationName, SvXMLImportFlags nImportFlags=SvXMLImportFlags::ALL, const css::uno::Sequence< OUString > &sSupportedServiceNames={})
Definition: xmlimp.cxx:411
constexpr sal_uInt16 XML_NAMESPACE_SMIL_COMPAT
constexpr sal_uInt16 XML_NAMESPACE_DB
constexpr sal_uInt16 XML_NAMESPACE_NUMBER
css::uno::Reference< css::embed::XStorage > const & GetSourceStorage() const
Definition: xmlimp.cxx:1354
constexpr sal_uInt16 XML_NAMESPACE_DOM
OUString GetDocumentBase() const
Definition: xmlimp.cxx:1804
::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper
Definition: xmlimp.cxx:346
void * FontToSubsFontConverter
static const sal_uInt16 LO_43x
Definition: xmlimp.hxx:554
std::set< OUString > embeddedFontUrlsKnown
Definition: xmlimp.hxx:231
static const sal_uInt16 OOo_32x
Definition: xmlimp.hxx:539
constexpr OUStringLiteral XML_PROGRESSMAX
constexpr sal_uInt16 XML_NAMESPACE_NUMBER_OOO
css::uno::Reference< css::container::XNameContainer > mxMarkerHelper
Definition: xmlimp.hxx:211
css::uno::Reference< css::container::XNameContainer > mxHatchHelper
Definition: xmlimp.hxx:208
const uno::Reference< uno::XComponentContext > mxComponentContext
Definition: xmlimp.cxx:305
constexpr sal_uInt16 XML_NAMESPACE_CALC_EXT
void SetFontDecls(XMLFontStylesContext *pFontDecls)
Definition: xmlimp.cxx:1537
const sal_uInt16 XML_NAMESPACE_UNKNOWN
constexpr sal_uInt16 XML_NAMESPACE_XSI
const sal_uInt16 XML_NAMESPACE_XMLNS
XmlStyleFamily
Definition: families.hxx:49
bool mbNotifyMacroEventRead
Definition: xmlimp.hxx:259
sal_uInt16 sal_Unicode
static const sal_uInt16 LO_7x
Definition: xmlimp.hxx:561
static OUString getNamespaceURIFromToken(sal_Int32 nToken)
Definition: xmlimp.cxx:1983
virtual void SAL_CALL setLocale(const css::lang::Locale &rLocale) override
Definition: xmlimp.cxx:545
std::unique_ptr< XMLErrors > mpXMLErrors
Definition: xmlimp.hxx:225
sal_uInt16 getGeneratorVersion() const
this checks the build ID and returns
Definition: xmlimp.cxx:1845
SvXMLLegacyToFastDocHandler(const rtl::Reference< SvXMLImport > &rImport)
Definition: xmlimp.cxx:2158
constexpr sal_uInt16 XML_NAMESPACE_CHART_SO52
constexpr sal_uInt16 XML_NAMESPACE_OFFICE_SO52
static const sal_uInt16 OOo_2x
Definition: xmlimp.hxx:536
virtual void SetConfigurationSettings(const css::uno::Sequence< css::beans::PropertyValue > &aConfigProps)
Definition: xmlimp.cxx:1438
SvXMLImportFlags
Definition: xmlimp.hxx:111
css::uno::Reference< css::frame::XModel > mxModel
Definition: xmlimp.hxx:191
virtual void SAL_CALL endElement(const OUString &aName) override
Definition: xmlimp.cxx:2247
static const sal_uInt16 LO_flag
Definition: xmlimp.hxx:550
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > &xLocator) override
Definition: xmlimp.cxx:2271
std::unique_ptr< xmloff::RDFaImportHelper > mpRDFaHelper
Definition: xmlimp.cxx:311
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept
Definition: xmlimp.cxx:475
static const sal_uInt16 OOo_34x
Definition: xmlimp.hxx:541
virtual OUString SAL_CALL getNamespaceURI(const OUString &rNamespacePrefix) override
Definition: xmlimp.cxx:2153
OUString ResolveEmbeddedObjectURL(const OUString &rURL, std::u16string_view rClassId)
Definition: xmlimp.cxx:1330
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr sal_uInt16 XML_NAMESPACE_FORM
::comphelper::UnoInterfaceToUniqueIdentifierMapper & getInterfaceToIdentifierMapper()
Definition: xmlimp.cxx:1788
constexpr OUStringLiteral sStarBasic
SvXMLImport_Impl(const uno::Reference< uno::XComponentContext > &rxContext, OUString const &theImplementationName, const css::uno::Sequence< OUString > &sSupportedServiceNames={})
Definition: xmlimp.cxx:315
XMLEventImportHelper & GetEventImport()
Definition: xmlimp.cxx:1514
static OUString getPrefixAndNameFromToken(sal_Int32 nToken)
Definition: xmlimp.cxx:1955
static const sal_uInt16 OOo_33x
Definition: xmlimp.hxx:540
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
virtual void SAL_CALL setCustomEntityNames(const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString,::rtl::OUString > > &replacements) override
Definition: xmlimp.cxx:555
static const sal_uInt16 AOO_4x
Definition: xmlimp.hxx:549
css::uno::Reference< css::xml::sax::XFastDocumentHandler > mxFastDocumentHandler
Definition: xmlimp.hxx:235
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: xmlimp.cxx:952
constexpr OUStringLiteral XML_NUMBERSTYLES
Definition: xmlnumfi.hxx:36
css::uno::Reference< css::lang::XEventListener > mxEventListener
Definition: xmlimp.hxx:214
FontToSubsFontConverter hBatsFontConv
Definition: xmlimp.cxx:282
constexpr sal_uInt16 XML_NAMESPACE_DRAW
css::uno::Reference< css::io::XOutputStream > GetStreamForGraphicObjectURLFromBase64() const
Definition: xmlimp.cxx:1319
static std::unordered_map< OUString, OUString > aNamespaceURIPrefixMap
Definition: xmlimp.hxx:238
const char * sName
constexpr sal_uInt16 XML_NAMESPACE_TABLE_SO52
virtual void SetViewSettings(const css::uno::Sequence< css::beans::PropertyValue > &aViewProps)
Definition: xmlimp.cxx:1434
SvXMLStylesContext * GetStyles()
Definition: xmlimp.cxx:1593
sal_Unicode ConvertFontToSubsFontChar(FontToSubsFontConverter hConverter, sal_Unicode cChar)
virtual void SAL_CALL endUnknownElement(const OUString &Namespace, const OUString &Name) override
Definition: xmlimp.cxx:874
constexpr sal_uInt16 XML_NAMESPACE_BLOCKLIST
const css::uno::Sequence< sal_Int8 > & getSeq() const
static const sal_uInt16 LO_63x
Definition: xmlimp.hxx:560
void AddRDFa(const css::uno::Reference< css::rdf::XMetadatable > &i_xObject, OUString const &i_rAbout, OUString const &i_rProperty, OUString const &i_rContent, OUString const &i_rDatatype)
Add a RDFa statement; parameters are XML attribute values.
Definition: xmlimp.cxx:1929
SvXMLImportFlags mnImportFlags
Definition: xmlimp.hxx:230
constexpr sal_uInt16 XML_NAMESPACE_CONFIG
static void initializeNamespaceMaps()
Definition: xmlimp.cxx:2009
constexpr sal_uInt16 XML_NAMESPACE_META_SO52
constexpr sal_uInt16 XML_NAMESPACE_XML
virtual void SAL_CALL characters(const OUString &aChars) override
Definition: xmlimp.cxx:2256
OUString sPrefix
virtual void SAL_CALL startFastElement(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlimp.cxx:755
virtual void SAL_CALL processingInstruction(const OUString &aTarget, const OUString &aData) override
Definition: xmlimp.cxx:2265
std::vector< NamespaceDefine > m_aNamespaceDefines
Definition: xmlimp.hxx:139
#define DBG_UNHANDLED_EXCEPTION(...)
constexpr sal_uInt16 XML_NAMESPACE_SVG
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlimp.cxx:889
constexpr sal_uInt16 XML_NAMESPACE_TABLE_EXT
constexpr sal_uInt16 XML_NAMESPACE_FO
static const sal_uInt16 LO_44x
Definition: xmlimp.hxx:555
int i
bool getBuildIds(sal_Int32 &rUPD, sal_Int32 &rBuild) const
returns the upd and build id (f.e.
Definition: xmlimp.cxx:1825
sal_Unicode ConvStarBatsCharToStarSymbol(sal_Unicode c)
Definition: xmlimp.cxx:1708
static bool NormalizeURI(OUString &rName)
virtual OUString SAL_CALL getNamespaceURL(const OUString &rPrefix) override
Definition: xmlimp.cxx:530
constexpr sal_uInt16 XML_NAMESPACE_TEXT
bool IsPackageURL(const OUString &rURL) const
Definition: xmlimp.cxx:1237
rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler
Definition: xmlimp.hxx:233
constexpr OUStringLiteral XML_PROGRESSREPEAT
virtual void SAL_CALL startDocument() override
Definition: xmlimp.cxx:2169
constexpr sal_uInt16 XML_NAMESPACE_CHART_EXT
static sal_Int32 GetXStorageFormat(const css::uno::Reference< css::embed::XStorage > &xStorage)
rtl::Reference< StyleMap > mpStyleMap
Definition: xmlimp.hxx:226
void SetMasterStyles(SvXMLStylesContext *pMasterStyles)
Definition: xmlimp.cxx:1581
rtl::Reference< SvXMLStylesContext > mxAutoStyles
Definition: xmlimp.hxx:204
css::uno::Reference< css::container::XNameContainer > mxGradientHelper
Definition: xmlimp.hxx:207
rtl::Reference< XMLShapeImportHelper > mxShapeImport
Definition: xmlimp.hxx:198
bool IsTextDocInOOoFileFormat() const
Definition: xmlimp.cxx:1815
std::stack< SvXMLImportContextRef, std::vector< SvXMLImportContextRef > > maContexts
Definition: xmlimp.hxx:221
constexpr size_t NMSP_SHIFT
Definition: xmlimp.hxx:93
static const sal_uInt16 OOo_31x
Definition: xmlimp.hxx:538
constexpr sal_uInt16 XML_NAMESPACE_META_OOO
float u
unsigned char sal_Bool
constexpr sal_uInt16 XML_NAMESPACE_TABLE_OOO
friend class SvXMLImportContext
Definition: xmlimp.hxx:187
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext(const OUString &Namespace, const OUString &Name, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlimp.cxx:896
static OUString getNamespacePrefixFromToken(sal_Int32 nToken, const SvXMLNamespaceMap *pMap)
Definition: xmlimp.cxx:1965
constexpr sal_uInt16 XML_NAMESPACE_GRDDL
ProgressBarHelper * GetProgressBarHelper()
Definition: xmlimp.cxx:1446
constexpr sal_uInt16 XML_NAMESPACE_XHTML
constexpr sal_uInt16 XML_NAMESPACE_XSD
bool mbTextDocInOOoFileFormat
Definition: xmlimp.cxx:303
void CreateDataStylesImport_()
Definition: xmlimp.cxx:1699
virtual void SAL_CALL setTargetDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
Definition: xmlimp.cxx:2164
css::uno::Type const & get()
sal_uInt16 getGeneratorVersion(const SvXMLImport &rImport)
Definition: xmlimp.cxx:336
bool IsMSO() const
Determines if the document was generated by Microsoft Office.
Definition: xmlimp.cxx:1874
static const sal_uInt16 LO_42x
Definition: xmlimp.hxx:553
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
virtual void SAL_CALL processingInstruction(const OUString &aTarget, const OUString &aData) override
Definition: xmlimp.cxx:744
constexpr sal_uInt16 XML_NAMESPACE_DC
virtual void SAL_CALL setNamespaceHandler(const css::uno::Reference< css::xml::sax::XFastNamespaceHandler > &Handler) override
Definition: xmlimp.cxx:550
css::uno::Sequence< OUString > maSupportedServiceNames
Definition: xmlimp.cxx:307
FontToSubsFontConverter CreateFontToSubsFontConverter(std::u16string_view rOrgName, FontToSubsFontFlags nFlags)
bool mbOwnGraphicResolver
Definition: xmlimp.cxx:285
std::stack< sal_uInt16 > maDefaultNamespaces
Definition: xmlimp.hxx:157
allows you to import a element
constexpr sal_uInt16 XML_NAMESPACE_DR3D_OOO
With this class you can import a element containing its data as element o...
css::uno::Reference< css::beans::XPropertySet > mxImportInfo
Definition: xmlimp.hxx:195
css::uno::Reference< css::container::XNameContainer > mxDashHelper
Definition: xmlimp.hxx:212
constexpr sal_uInt16 XML_NAMESPACE_STYLE_SO52
rtl::Reference< comphelper::AttributeList > maNamespaceAttrList
Definition: xmlimp.hxx:234
Helps the XMLEventsImportContext.
void SetXmlId(css::uno::Reference< css::uno::XInterface > const &i_xIfc, OUString const &i_rXmlId)
set the XmlId attribute of given UNO object (for RDF metadata)
Definition: xmlimp.cxx:1894
static const OUString & getNameFromToken(sal_Int32 nToken)
Definition: xmlimp.cxx:1950
virtual void SAL_CALL startElement(const OUString &aName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs) override
Definition: xmlimp.cxx:2179
static const sal_uInt16 LO_3x
Definition: xmlimp.hxx:551
constexpr sal_uInt16 XML_NAMESPACE_SVG_COMPAT
static OUString getNamespacePrefixFromURI(const OUString &rURI)
Definition: xmlimp.cxx:1993
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:45
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
virtual void SAL_CALL startDocument() override
Definition: xmlimp.cxx:560
static const sal_uInt16 LO_6x
: when adding a new value more specific than "6x", grep for all current uses and adapt them!!! ...
Definition: xmlimp.hxx:559
virtual void SAL_CALL cancel() override
Definition: xmlimp.cxx:947
void ParseAndAddRDFa(css::uno::Reference< css::rdf::XMetadatable > const &i_xObject, OUString const &i_rAbout, OUString const &i_rProperty, OUString const &i_rContent, OUString const &i_rDatatype)
Parse and add a RDFa statement; parameters are XML attribute values.
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION
DefTokenId nToken
static bool bIsNSMapsInitialized
Definition: xmlimp.hxx:239
#define XMLERROR_FLAG_SEVERE
Definition: xmlerror.hxx:37
OUString mStreamName
name of stream in package, e.g., "content.xml"
Definition: xmlimp.cxx:291
virtual void SAL_CALL endDocument() override
Definition: xmlimp.cxx:2174
constexpr sal_uInt16 XML_NAMESPACE_TABLE
virtual void SAL_CALL ignorableWhitespace(const OUString &aWhitespaces) override
Definition: xmlimp.cxx:2261
void CreateNumberFormatsSupplier_()
Definition: xmlimp.cxx:1691
static sal_Int32 getTokenFromName(const OUString &sName)
Definition: xmlimp.cxx:2002
css::uno::Reference< css::uno::XComponentContext > const & GetComponentContext() const
Definition: xmlimp.cxx:1794
OUString GetAbsoluteReference(const OUString &rValue) const
Definition: xmlimp.cxx:1618
OUString GetODFVersion() const
Definition: xmlimp.cxx:1864
bool mbOwnEmbeddedResolver
Definition: xmlimp.cxx:286
OUString GetStyleDisplayName(XmlStyleFamily nFamily, const OUString &rName) const
Definition: xmlimp.cxx:1420
#define SAL_WARN_IF(condition, area, stream)
void NotifyMacroEventRead()
Definition: xmlimp.cxx:2111
constexpr OUStringLiteral sScript
virtual void SetDocumentSpecificSettings(const OUString &_rSettingsGroupName, const css::uno::Sequence< css::beans::PropertyValue > &_rSettings)
Definition: xmlimp.cxx:1442
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3511
css::uno::Reference< css::xml::sax::XLocator > mxLocator
Definition: xmlimp.hxx:190
constexpr sal_uInt16 XML_NAMESPACE_SMIL
rtl::Reference< SvXMLStylesContext > mxStyles
Definition: xmlimp.hxx:203
constexpr sal_uInt16 XML_NAMESPACE_REPORT
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
constexpr sal_uInt16 XML_NAMESPACE_CONFIG_OOO
css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier
Definition: xmlimp.hxx:192
Handling of tokens in XML:
void AddNumberStyle(sal_Int32 nKey, const OUString &sName)
Definition: xmlimp.cxx:1494
#define SAL_INFO(area, stream)
OUString aName
const css::uno::Reference< css::container::XNameContainer > & GetMarkerHelper()
Definition: xmlimp.cxx:1196
virtual SvXMLImportContext * CreateFastContext(sal_Int32 Element, const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlimp.cxx:349
virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > &i_rStats)
Definition: xmlimp.cxx:902
static const sal_uInt16 OOo_1x
Definition: xmlimp.hxx:535
OReadImagesDocumentHandler::Image_XML_Namespace nNamespace
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97
FastAttributeIter end() const
const css::uno::Reference< css::frame::XModel > & GetModel() const
Definition: xmlimp.hxx:404
const char * name
constexpr sal_uInt16 XML_NAMESPACE_TEXT_OOO
std::unique_ptr< SvXMLImport_Impl > mpImpl
Definition: xmlimp.hxx:216
void SetError(sal_Int32 nId, const css::uno::Sequence< OUString > &rMsgParams, const OUString &rExceptionMessage, const css::uno::Reference< css::xml::sax::XLocator > &rLocator)
Record an error condition that occurred during import.
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: xmlimp.cxx:482
Sequence< sal_Int8 > aSeq
const css::uno::Reference< css::container::XNameContainer > & GetDashHelper()
Definition: xmlimp.cxx:1218
constexpr sal_uInt16 XML_NAMESPACE_OF
rtl::Reference< ::xmloff::OFormLayerXMLImport > mxFormImport
Definition: xmlimp.hxx:200
std::optional< SvXMLNamespaceMap > mxNamespaceMap
Definition: xmlimp.hxx:218
std::unique_ptr< EmbeddedFontsHelper, o3tl::default_delete< EmbeddedFontsHelper > > mxEmbeddedFontHelper
Definition: xmlimp.hxx:254
constexpr sal_Int32 NAMESPACE_TOKEN(sal_uInt16 prefixToken)
Definition: xmlimp.hxx:99
virtual void initXForms()
Definition: xmlimp.cxx:1820
void SetAutoStyles(SvXMLStylesContext *pAutoStyles)
Definition: xmlimp.cxx:1551
OUString ResolveEmbeddedObjectURLFromBase64()
Definition: xmlimp.cxx:1377
INetURLObject aDocBase
Definition: xmlimp.cxx:288
void AddStyle(SvXMLStyleContext &rNew)
Definition: xmlstyle.cxx:722
constexpr sal_uInt16 XML_NAMESPACE_OFFICE_EXT
void AddStyleDisplayName(XmlStyleFamily nFamily, const OUString &rName, const OUString &rDisplayName)
Definition: xmlimp.cxx:1389
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
sal_uInt16 GetKeyByName(const OUString &rName) const
css::uno::Reference< css::container::XNameContainer > mxBitmapHelper
Definition: xmlimp.hxx:209
ODFSVER_LATEST_EXTENDED
const css::uno::Reference< css::beans::XPropertySet > & getImportInfo() const
Definition: xmlimp.hxx:386
bool IsODFVersionConsistent(const OUString &aODFVersion)
Definition: xmlimp.cxx:1630
static SchXMLImportHelper * CreateChartImport()
Definition: xmlimp.cxx:1081
void SetReference(sal_Int32 nVal)
virtual sal_Bool SAL_CALL filter(const css::uno::Sequence< css::beans::PropertyValue > &aDescriptor) override
Definition: xmlimp.cxx:942
constexpr sal_uInt16 XML_NAMESPACE_NUMBER_SO52
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION_OOO
#define SAL_WARN(area, stream)
Reference< XSingleServiceFactory > xFactory
constexpr sal_Int32 TOKEN_MASK
Definition: xmlimp.hxx:94
constexpr sal_uInt16 XML_NAMESPACE_DRAW_SO52
constexpr sal_uInt16 XML_NAMESPACE_DRAW_OOO
void registerNamespaces()
Definition: xmlimp.cxx:2102
virtual void DisposingModel()
Definition: xmlimp.cxx:1773
XMLFontStylesContext * GetFontDecls()
Definition: xmlimp.cxx:1588
#define XMLERROR_UNKNOWN_ROOT
Definition: xmlerror.hxx:65
css::uno::Reference< css::document::XEmbeddedObjectResolver > mxEmbeddedResolver
Definition: xmlimp.hxx:194
virtual void SAL_CALL setTargetDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
Definition: xmlimp.cxx:909
virtual void SAL_CALL setTokenHandler(const css::uno::Reference< css::xml::sax::XFastTokenHandler > &Handler) override
Definition: xmlimp.cxx:520
bool addEmbeddedFont(const css::uno::Reference< css::io::XInputStream > &stream, const OUString &fontName, const char *extra, std::vector< unsigned char > const &key, bool eot)
Definition: xmlimp.cxx:466
constexpr sal_uInt16 XML_NAMESPACE_META
constexpr sal_uInt16 XML_NAMESPACE_TEXT_SO52
const XMLEventNameTranslation aStandardEventTable[]
a translation table for the events defined in the XEventsSupplier service (implemented in XMLEventExp...
css::uno::Reference< css::document::XGraphicStorageHandler > mxGraphicStorageHandler
Definition: xmlimp.hxx:193
bool isGeneratorVersionOlderThan(sal_uInt16 const nOOoVersion, sal_uInt16 const nLOVersion)
depending on whether the generator version indicates LO, compare against either the given LO or given...
Definition: xmlimp.cxx:1852
COMPHELPER_DLLPUBLIC void notifyMacroEventRead(const css::uno::Reference< css::frame::XModel > &_rxDocument)
const css::uno::Reference< css::container::XNameContainer > & GetGradientHelper()
Definition: xmlimp.cxx:1104
SvXMLStylesContext * GetAutoStyles()
Definition: xmlimp.cxx:1598
constexpr sal_uInt16 XML_NAMESPACE_OOOW
std::unique_ptr< DocumentInfo > mpDocumentInfo
Definition: xmlimp.cxx:313
const OUString & GetPrefixByKey(sal_uInt16 nKey) const
css::uno::Reference< css::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier()
Definition: xmlimp.hxx:645
constexpr sal_uInt16 XML_NAMESPACE_FORM_OOO
constexpr sal_uInt16 XML_NAMESPACE_REPORT_OASIS
static const sal_uInt16 LO_5x
Definition: xmlimp.hxx:556
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION_OASIS
static std::optional< SvXMLNamespaceMap > processNSAttributes(std::optional< SvXMLNamespaceMap > &rpNamespaceMap, SvXMLImport *const pImport, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList)
Definition: xmlimp.cxx:681
void addNSDeclAttributes(rtl::Reference< comphelper::AttributeList > const &rAttrList)
Definition: xmlimp.cxx:2125
virtual ~SvXMLImport() noexcept override
Definition: xmlimp.cxx:461
virtual void SAL_CALL characters(const OUString &aChars) override
Definition: xmlimp.cxx:739
constexpr sal_uInt16 XML_NAMESPACE_STYLE
rtl::Reference< sax_fastparser::FastAttributeList > mxFastAttributes
Definition: xmlimp.hxx:156
INetURLObject aBaseURL
Definition: xmlimp.cxx:287
#define SOFFICE_FILEFORMAT_8
sal_uInt16 nPos
virtual void SAL_CALL endDocument() override
Definition: xmlimp.cxx:595
bool any2bool(const css::uno::Any &rAny)
std::optional< OUString > mxODFVersion
Definition: xmlimp.cxx:293
rtl::Reference< XMLShapeImportHelper > const & GetShapeImport()
Definition: xmlimp.hxx:609
virtual void SAL_CALL startUnknownElement(const OUString &Namespace, const OUString &Name, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlimp.cxx:818
virtual void SAL_CALL registerNamespace(const OUString &rNamespacePrefix, const OUString &rNamespaceURI) override
Definition: xmlimp.cxx:2141
bool m_bDetectedRangeSegmentation false
constexpr sal_uInt16 XML_NAMESPACE_FIELD
bool embeddedFontAlreadyProcessed(const OUString &url)
Returns true if the embedded font document URL has already been processed.
Definition: xmlimp.cxx:1942
css::uno::Reference< css::xml::sax::XFastParser > mxParser
Definition: xmlimp.hxx:232
virtual void SAL_CALL setEntityResolver(const css::uno::Reference< css::xml::sax::XEntityResolver > &Resolver) override
Definition: xmlimp.cxx:540