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