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