LibreOffice Module sc (master)  1
xmlimprt.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 <sal/config.h>
21 #include <sal/log.hxx>
22 #include <osl/diagnose.h>
23 
24 #include <svl/zforlist.hxx>
25 
26 #include <xmloff/namespacemap.hxx>
27 #include <xmloff/xmlnamespace.hxx>
28 #include <xmloff/xmltkmap.hxx>
29 #include <xmloff/xmlictxt.hxx>
30 #include <xmloff/xmlmetai.hxx>
31 #include <sfx2/objsh.hxx>
32 #include <unotools/streamwrap.hxx>
33 #include <xmloff/xmlscripti.hxx>
36 #include <xmloff/xmluconv.hxx>
37 #include <xmloff/numehelp.hxx>
38 #include <xmloff/xmltoken.hxx>
39 #include <xmloff/xmlerror.hxx>
41 
42 #include <svl/languageoptions.hxx>
43 #include <editeng/editstat.hxx>
44 #include <formula/errorcodes.hxx>
45 #include <vcl/svapp.hxx>
46 
47 #include <appluno.hxx>
48 #include "xmlimprt.hxx"
49 #include "importcontext.hxx"
50 #include <document.hxx>
51 #include <docsh.hxx>
52 #include <docuno.hxx>
53 #include "xmlbodyi.hxx"
54 #include "xmlstyli.hxx"
56 
57 #include <compiler.hxx>
58 
59 #include "XMLConverter.hxx"
60 #include "XMLDetectiveContext.hxx"
63 #include <chgviset.hxx>
65 #include <sheetdata.hxx>
66 #include <rangeutl.hxx>
67 #include <formulaparserpool.hxx>
68 #include <externalrefmgr.hxx>
69 #include <editutil.hxx>
70 #include "editattributemap.hxx"
71 #include <documentimport.hxx>
72 #include "pivotsource.hxx"
73 #include <unonames.hxx>
74 #include <numformat.hxx>
75 #include <sizedev.hxx>
76 #include <scdll.hxx>
77 #include "xmlstyle.hxx"
78 
79 #include <comphelper/base64.hxx>
80 #include <comphelper/extract.hxx>
83 
84 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
85 #include <com/sun/star/frame/XModel.hpp>
86 #include <com/sun/star/io/IOException.hpp>
87 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
88 #include <com/sun/star/document/XActionLockable.hpp>
89 #include <com/sun/star/util/MalformedNumberFormatException.hpp>
90 #include <com/sun/star/util/NumberFormat.hpp>
91 #include <com/sun/star/util/XNumberFormatTypes.hpp>
92 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
93 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
94 #include <com/sun/star/sheet/XLabelRanges.hpp>
95 #include <com/sun/star/io/XSeekable.hpp>
96 #include <com/sun/star/beans/XPropertySet.hpp>
97 #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
98 #include <cellsuno.hxx>
99 
100 #include <memory>
101 #include <utility>
102 
103 #define SC_LOCALE "Locale"
104 #define SC_CURRENCYSYMBOL "CurrencySymbol"
105 #define SC_REPEAT_ROW "repeat-row"
106 #define SC_FILTER "filter"
107 #define SC_PRINT_RANGE "print-range"
108 
109 using namespace com::sun::star;
110 using namespace ::xmloff::token;
111 using namespace ::formula;
112 
113 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
115  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
116 {
117  return cppu::acquire(static_cast<cppu::OWeakObject*>(
118  new ScXMLImport(
119  context,
120  "com.sun.star.comp.Calc.XMLOasisImporter",
121  SvXMLImportFlags::ALL,
122  { "com.sun.star.comp.Calc.XMLOasisImporter" } )));
123 }
124 
125 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
127  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
128 {
129  return cppu::acquire(static_cast<cppu::OWeakObject*>(
130  new ScXMLImport(
131  context,
132  "com.sun.star.comp.Calc.XMLOasisMetaImporter",
133  SvXMLImportFlags::META,
134  { "com.sun.star.comp.Calc.XMLOasisMetaImporter" } )));
135 }
136 
137 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
139  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
140 {
141  return cppu::acquire(static_cast<cppu::OWeakObject*>(
142  new ScXMLImport(
143  context,
144  "com.sun.star.comp.Calc.XMLOasisStylesImporter",
145  SvXMLImportFlags::STYLES|SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::MASTERSTYLES|SvXMLImportFlags::FONTDECLS,
146  { "com.sun.star.comp.Calc.XMLOasisStylesImporter" } )));
147 }
148 
149 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
151  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
152 {
153  return cppu::acquire(static_cast<cppu::OWeakObject*>(new ScXMLImport(
154  context,
155  "com.sun.star.comp.Calc.XMLOasisContentImporter",
156  SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::CONTENT|SvXMLImportFlags::SCRIPTS|SvXMLImportFlags::FONTDECLS,
157  uno::Sequence< OUString > { "com.sun.star.comp.Calc.XMLOasisContentImporter" })));
158 }
159 
160 
161 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
163  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
164 {
165  return cppu::acquire(static_cast<cppu::OWeakObject*>(
166  new ScXMLImport(
167  context,
168  "com.sun.star.comp.Calc.XMLOasisSettingsImporter",
169  SvXMLImportFlags::SETTINGS,
170  { "com.sun.star.comp.Calc.XMLOasisSettingsImporter" } )));
171 }
172 
174 {
175  static const SvXMLTokenMapEntry aTableRowCellAttrTokenMap[] =
176  {
194  };
195 
196  if ( !pTableRowCellAttrTokenMap )
197  pTableRowCellAttrTokenMap.reset(new SvXMLTokenMap( aTableRowCellAttrTokenMap ));
198  return *pTableRowCellAttrTokenMap;
199 }
200 
201 namespace {
202 
203 // NB: virtually inherit so we can multiply inherit properly
204 // in ScXMLFlatDocContext_Impl
205 class ScXMLDocContext_Impl : public virtual SvXMLImportContext
206 {
207 protected:
208  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
209 
210 public:
211  ScXMLDocContext_Impl( ScXMLImport& rImport );
212 
213  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
214  createFastChildContext( sal_Int32 nElement,
215  const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override;
216 
217  virtual void SAL_CALL startFastElement (sal_Int32 nElement,
218  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override;
219 
220  virtual void SAL_CALL characters(const OUString & aChars) override;
221 
222  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
223 };
224 
225 }
226 
227 ScXMLDocContext_Impl::ScXMLDocContext_Impl( ScXMLImport& rImport ) :
228 SvXMLImportContext( rImport )
229 {
230 }
231 
232 namespace {
233 
234 // context for flat file xml format
235 class ScXMLFlatDocContext_Impl
236  : public ScXMLDocContext_Impl, public SvXMLMetaDocumentContext
237 {
238 public:
239 
240  ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
241  const uno::Reference<document::XDocumentProperties>& i_xDocProps);
242 
243  virtual void SAL_CALL startFastElement (sal_Int32 nElement,
244  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override;
245 
246  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
247 
248  virtual void SAL_CALL characters( const OUString& aChars ) override;
249 
250  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
251  createFastChildContext( sal_Int32 nElement,
252  const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override;
253 };
254 
255 }
256 
257 ScXMLFlatDocContext_Impl::ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
258  const uno::Reference<document::XDocumentProperties>& i_xDocProps) :
259 SvXMLImportContext(i_rImport),
260 ScXMLDocContext_Impl(i_rImport),
261 SvXMLMetaDocumentContext(i_rImport, i_xDocProps)
262 {
263 }
264 
265 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
266  ScXMLFlatDocContext_Impl::createFastChildContext( sal_Int32 nElement,
267  const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
268 {
269  if ( nElement == XML_ELEMENT( OFFICE, XML_META ) )
270  return SvXMLMetaDocumentContext::createFastChildContext( nElement, xAttrList );
271  else
272  return ScXMLDocContext_Impl::createFastChildContext( nElement, xAttrList );
273 }
274 
275 void SAL_CALL ScXMLFlatDocContext_Impl::startFastElement(sal_Int32 nElement,
276  const uno::Reference< xml::sax::XFastAttributeList > & xAttrList)
277 {
278  SvXMLMetaDocumentContext::startFastElement( nElement, xAttrList );
279 }
280 
281 void SAL_CALL ScXMLFlatDocContext_Impl::endFastElement(sal_Int32 nElement)
282 {
284 }
285 
286 void SAL_CALL ScXMLFlatDocContext_Impl::characters(const OUString& rChars)
287 {
289 }
290 
291 namespace {
292 
293 class ScXMLBodyContext_Impl : public ScXMLImportContext
294 {
295 public:
296  ScXMLBodyContext_Impl( ScXMLImport& rImport );
297 
298  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
299  createFastChildContext( sal_Int32 nElement,
300  const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override;
301 };
302 
303 }
304 
305 ScXMLBodyContext_Impl::ScXMLBodyContext_Impl( ScXMLImport& rImport ) :
306 ScXMLImportContext( rImport )
307 {
308 }
309 
310 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
311  ScXMLBodyContext_Impl::createFastChildContext( sal_Int32 /*nElement*/,
312  const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
313 {
314  sax_fastparser::FastAttributeList *pAttribList =
316  return GetScImport().CreateBodyContext( pAttribList );
317 }
318 
319 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
320  ScXMLDocContext_Impl::createFastChildContext( sal_Int32 nElement,
321  const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/ )
322 {
323  SvXMLImportContext *pContext(nullptr);
324 
325  switch( nElement )
326  {
327  case XML_ELEMENT( OFFICE, XML_BODY ):
328  if (GetScImport().getImportFlags() & SvXMLImportFlags::CONTENT)
329  pContext = new ScXMLBodyContext_Impl( GetScImport() );
330  break;
331  case XML_ELEMENT( OFFICE, XML_SCRIPTS ):
332  if (GetScImport().getImportFlags() & SvXMLImportFlags::SCRIPTS)
333  pContext = GetScImport().CreateScriptContext();
334  break;
335  case XML_ELEMENT( OFFICE, XML_SETTINGS ):
336  if (GetScImport().getImportFlags() & SvXMLImportFlags::SETTINGS)
337  pContext = new XMLDocumentSettingsContext(GetScImport());
338  break;
339  case XML_ELEMENT(OFFICE, XML_STYLES):
340  if (GetScImport().getImportFlags() & SvXMLImportFlags::STYLES)
341  pContext = GetScImport().CreateStylesContext( false);
342  break;
343  case XML_ELEMENT(OFFICE, XML_AUTOMATIC_STYLES):
344  if (GetScImport().getImportFlags() & SvXMLImportFlags::AUTOSTYLES)
345  pContext = GetScImport().CreateStylesContext( true);
346  break;
347  case XML_ELEMENT(OFFICE, XML_FONT_FACE_DECLS):
348  if (GetScImport().getImportFlags() & SvXMLImportFlags::FONTDECLS)
349  pContext = GetScImport().CreateFontDeclsContext();
350  break;
351  case XML_ELEMENT(OFFICE, XML_MASTER_STYLES):
352  if (GetScImport().getImportFlags() & SvXMLImportFlags::MASTERSTYLES)
353  pContext = new ScXMLMasterStylesContext( GetImport() );
354  break;
355  case XML_ELEMENT(OFFICE, XML_META):
356  SAL_INFO("sc", "XML_ELEMENT(OFFICE, XML_META): should not have come here, maybe document is invalid?");
357  break;
358  }
359 
360  return pContext;
361 }
362 
363 void SAL_CALL ScXMLDocContext_Impl::startFastElement(sal_Int32 /*nElement*/,
364  const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/)
365 {
366 }
367 
368 void SAL_CALL ScXMLDocContext_Impl::endFastElement(sal_Int32 /*nElement*/)
369 {
370 }
371 
372 void SAL_CALL ScXMLDocContext_Impl::characters(const OUString &)
373 {
374 }
375 
377 {
378  if( !pTableElemTokenMap )
379  {
380  static const SvXMLTokenMapEntry aTableTokenMap[] =
381  {
402  };
403 
404  pTableElemTokenMap.reset(new SvXMLTokenMap( aTableTokenMap ));
405  } // if( !pTableElemTokenMap )
406 
407  return *pTableElemTokenMap;
408 }
409 
411 {
413  {
414  static const SvXMLTokenMapEntry aTableRowsElemTokenMap[] =
415  {
421  };
422 
423  pTableRowsElemTokenMap.reset(new SvXMLTokenMap( aTableRowsElemTokenMap ));
424  } // if( !pTableRowsElemTokenMap )
425 
426  return *pTableRowsElemTokenMap;
427 }
428 
430 {
431  if( !pTableRowElemTokenMap )
432  {
433  static const SvXMLTokenMapEntry aTableRowTokenMap[] =
434  {
438  };
439 
440  pTableRowElemTokenMap.reset(new SvXMLTokenMap( aTableRowTokenMap ));
441  } // if( !pTableRowElemTokenMap )
442 
443  return *pTableRowElemTokenMap;
444 }
445 
447 {
448  if( !pTableRowAttrTokenMap )
449  {
450  static const SvXMLTokenMapEntry aTableRowAttrTokenMap[] =
451  {
456  // { XML_NAMESPACE_TABLE, XML_USE_OPTIMAL_HEIGHT, XML_TOK_TABLE_ROW_ATTR_USE_OPTIMAL_HEIGHT },
458  };
459 
460  pTableRowAttrTokenMap.reset(new SvXMLTokenMap( aTableRowAttrTokenMap ));
461  } // if( !pTableRowAttrTokenMap )
462 
463  return *pTableRowAttrTokenMap;
464 }
465 
467 {
469  {
470  static const SvXMLTokenMapEntry aTableRowCellTokenMap[] =
471  {
478  };
479 
480  pTableRowCellElemTokenMap.reset(new SvXMLTokenMap( aTableRowCellTokenMap ));
481  } // if( !pTableRowCellElemTokenMap )
482 
484 }
485 
487 {
489  {
490  static const SvXMLTokenMapEntry aTableAnnotationAttrTokenMap[] =
491  {
499  };
500 
501  pTableAnnotationAttrTokenMap.reset(new SvXMLTokenMap( aTableAnnotationAttrTokenMap ));
502  } // if( !pTableAnnotationAttrTokenMap )
503 
505 }
506 
507 
509 {
510  mpPostProcessData = p;
511 }
512 
514 {
515  if (!mpPivotSources)
517 
518  return *mpPivotSources;
519 }
520 
522  const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
523 {
524  SvXMLImportContext *pContext = nullptr;
525 
526  switch( nElement )
527  {
531  pContext = new ScXMLDocContext_Impl( *this );
532  break;
533 
535  pContext = CreateMetaContext(nElement);
536  break;
537 
539  {
540  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
541  GetModel(), uno::UNO_QUERY_THROW);
542  // flat OpenDocument file format
543  pContext = new ScXMLFlatDocContext_Impl( *this,
544  xDPS->getDocumentProperties());
545  break;
546  }
547 
548  }
549 
550  return pContext;
551 }
552 
553 constexpr OUStringLiteral gsNumberFormat(u"" SC_UNONAME_NUMFMT);
554 constexpr OUStringLiteral gsLocale(u"" SC_LOCALE);
555 constexpr OUStringLiteral gsCellStyle(u"" SC_UNONAME_CELLSTYL);
556 
558  const css::uno::Reference< css::uno::XComponentContext >& rContext,
559  OUString const & implementationName, SvXMLImportFlags nImportFlag,
560  const css::uno::Sequence< OUString > & sSupportedServiceNames)
561 : SvXMLImport( rContext, implementationName, nImportFlag, sSupportedServiceNames ),
562  pDoc( nullptr ),
563  mpPostProcessData(nullptr),
564  aTables(*this),
565  sPrevStyleName(),
566  sPrevCurrency(),
567  nSolarMutexLocked(0),
568  nProgressCount(0),
569  nPrevCellType(0),
570  bLoadDoc( true ),
571  bNullDateSetted(false),
572  bSelfImportingXMLSet(false),
573  mbLockSolarMutex(true),
574  mbImportStyles(true),
575  mbHasNewCondFormatData(false)
576 {
578 
584 
585  // #i66550# needed for 'presentation:event-listener' element for URLs in shapes
590 }
591 
593 {
594  // delete pI18NMap;
595  pTableElemTokenMap.reset();
596  pTableRowsElemTokenMap.reset();
597  pTableRowElemTokenMap.reset();
598  pTableRowAttrTokenMap.reset();
602 
605  pStyleNumberFormats.reset();
606  pStylesImportHelper.reset();
607 
608  m_pMyNamedExpressions.reset();
609  pMyLabelRanges.reset();
610  pValidations.reset();
611  pDetectiveOpArray.reset();
612 
613  //call SvXMLImport dtor contents before deleting pSolarMutexGuard
614  cleanup();
615 
616  pSolarMutexGuard.reset();
617 }
618 
619 void ScXMLImport::initialize( const css::uno::Sequence<css::uno::Any>& aArguments )
620 {
621  SvXMLImport::initialize(aArguments);
622 
623  uno::Reference<beans::XPropertySet> xInfoSet = getImportInfo();
624  if (!xInfoSet.is())
625  return;
626 
627  uno::Reference<beans::XPropertySetInfo> xInfoSetInfo = xInfoSet->getPropertySetInfo();
628  if (!xInfoSetInfo.is())
629  return;
630 
631  if (xInfoSetInfo->hasPropertyByName(SC_UNO_ODS_LOCK_SOLAR_MUTEX))
632  xInfoSet->getPropertyValue(SC_UNO_ODS_LOCK_SOLAR_MUTEX) >>= mbLockSolarMutex;
633 
634  if (xInfoSetInfo->hasPropertyByName(SC_UNO_ODS_IMPORT_STYLES))
635  xInfoSet->getPropertyValue(SC_UNO_ODS_IMPORT_STYLES) >>= mbImportStyles;
636 }
637 
639 {
640  XMLFontStylesContext *pFSContext = new XMLFontStylesContext(
641  *this, osl_getThreadTextEncoding());
642  SetFontDecls(pFSContext);
643  SvXMLImportContext* pContext = pFSContext;
644  return pContext;
645 }
646 
648 {
650  *this, bIsAutoStyle);
651 
652  if (bIsAutoStyle)
653  SetAutoStyles(static_cast<SvXMLStylesContext*>(pContext));
654  else
655  SetStyles(static_cast<SvXMLStylesContext*>(pContext));
656 
657  return pContext;
658 }
659 
661 {
662  return new ScXMLBodyContext(*this, rAttrList);
663 }
664 
666  const sal_Int32 /*nElement*/ )
667 {
668  SvXMLImportContext* pContext = nullptr;
669 
670  if (getImportFlags() & SvXMLImportFlags::META)
671  {
672  uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
673  GetModel(), uno::UNO_QUERY_THROW);
674  uno::Reference<document::XDocumentProperties> const xDocProps(
675  (IsStylesOnlyMode()) ? nullptr : xDPS->getDocumentProperties());
676  pContext = new SvXMLMetaDocumentContext(*this, xDocProps);
677  }
678 
679  return pContext;
680 }
681 
683 {
684  SvXMLImportContext* pContext = nullptr;
685 
686  if( !(IsStylesOnlyMode()) )
687  {
688  pContext = new XMLScriptContext( *this, GetModel() );
689  }
690 
691  return pContext;
692 }
693 
694 void ScXMLImport::SetStatistics(const uno::Sequence<beans::NamedValue> & i_rStats)
695 {
696  static const char* s_stats[] =
697  { "TableCount", "CellCount", "ObjectCount", nullptr };
698 
699  SvXMLImport::SetStatistics(i_rStats);
700 
701  sal_uInt32 nCount(0);
702  for (const auto& rStat : i_rStats) {
703  for (const char** pStat = s_stats; *pStat != nullptr; ++pStat) {
704  if (rStat.Name.equalsAscii(*pStat)) {
705  sal_Int32 val = 0;
706  if (rStat.Value >>= val) {
707  nCount += val;
708  } else {
709  OSL_FAIL("ScXMLImport::SetStatistics: invalid entry");
710  }
711  }
712  }
713  }
714 
715  if (nCount)
716  {
719  }
720 }
721 
723 {
724  return *mpDocImport;
725 }
726 
727 sal_Int16 ScXMLImport::GetCellType(const char* rStrValue, const sal_Int32 nStrLength)
728 {
729  sal_Int16 nCellType = util::NumberFormat::UNDEFINED;
730  if (rStrValue != nullptr)
731  {
732  switch (rStrValue[0])
733  {
734  case 'b':
735  if (nStrLength == 7 && !strcmp(rStrValue, "boolean"))
736  nCellType = util::NumberFormat::LOGICAL;
737  break;
738  case 'c':
739  if (nStrLength == 8 && !strcmp(rStrValue, "currency"))
740  nCellType = util::NumberFormat::CURRENCY;
741  break;
742  case 'd':
743  if (nStrLength == 4 && !strcmp(rStrValue, "date"))
744  nCellType = util::NumberFormat::DATETIME;
745  break;
746  case 'f':
747  if (nStrLength == 5 && !strcmp(rStrValue, "float"))
748  nCellType = util::NumberFormat::NUMBER;
749  break;
750  case 'p':
751  if (nStrLength == 10 && !strcmp(rStrValue, "percentage"))
752  nCellType = util::NumberFormat::PERCENT;
753  break;
754  case 's':
755  if (nStrLength == 6 && !strcmp(rStrValue, "string"))
756  nCellType = util::NumberFormat::TEXT;
757  break;
758  case 't':
759  if (nStrLength == 4 && !strcmp(rStrValue, "time"))
760  nCellType = util::NumberFormat::TIME;
761  break;
762  }
763  }
764 
765  return nCellType;
766 }
767 
769 {
770  return new XMLTableShapeImportHelper(*this);
771 }
772 
773 bool ScXMLImport::GetValidation(const OUString& sName, ScMyImportValidation& aValidation)
774 {
775  if (pValidations)
776  {
777  auto aItr = std::find_if(pValidations->begin(), pValidations->end(),
778  [&sName](const ScMyImportValidation& rValidation) { return rValidation.sName == sName; });
779  if (aItr != pValidations->end())
780  {
781  // source position must be set as string,
782  // so sBaseCellAddress no longer has to be converted here
783  aValidation = *aItr;
784  return true;
785  }
786  }
787  return false;
788 }
789 
791 {
792  ::std::unique_ptr<ScMyNamedExpression> p(pNamedExp);
793  SheetNamedExpMap::iterator itr = m_SheetNamedExpressions.find(nTab);
794  if (itr == m_SheetNamedExpressions.end())
795  {
796  // No chain exists for this sheet. Create one.
797  ::std::pair<SheetNamedExpMap::iterator, bool> r =
798  m_SheetNamedExpressions.insert(std::make_pair(nTab, std::make_unique<ScMyNamedExpressions>()));
799  if (!r.second)
800  // insertion failed.
801  return;
802 
803  itr = r.first;
804  }
805  ScMyNamedExpressions& r = *itr->second;
806  r.push_back(std::move(p));
807 }
808 
810 {
813  return pChangeTrackingImportHelper.get();
814 }
815 
817 {
818  GetStyles()->CopyStylesToDoc(true);
819 
820  // if content is going to be loaded with the same import, set bLatinDefaultStyle flag now
821  if ( getImportFlags() & SvXMLImportFlags::CONTENT )
823 }
824 
826 {
827  if (pDoc)
828  {
829  // #i62435# after inserting the styles, check if the default style has a latin-script-only
830  // number format (then, value cells can be pre-initialized with western script type)
831 
832  const ScPatternAttr* pDefPattern = pDoc->GetDefPattern();
833  if (pDefPattern && sc::NumFmtUtil::isLatinScript(*pDefPattern, *pDoc))
834  mpDocImport->setDefaultNumericScript(SvtScriptType::LATIN);
835  }
836 }
837 
838 void ScXMLImport::SetChangeTrackingViewSettings(const css::uno::Sequence<css::beans::PropertyValue>& rChangeProps)
839 {
840  if (!pDoc)
841  return;
842 
843  if (!rChangeProps.hasElements())
844  return;
845 
846  ScXMLImport::MutexGuard aGuard(*this);
847  sal_Int16 nTemp16(0);
848  std::unique_ptr<ScChangeViewSettings> pViewSettings(new ScChangeViewSettings());
849  for (const auto& rChangeProp : rChangeProps)
850  {
851  OUString sName(rChangeProp.Name);
852  if (sName == "ShowChanges")
853  pViewSettings->SetShowChanges(::cppu::any2bool(rChangeProp.Value));
854  else if (sName == "ShowAcceptedChanges")
855  pViewSettings->SetShowAccepted(::cppu::any2bool(rChangeProp.Value));
856  else if (sName == "ShowRejectedChanges")
857  pViewSettings->SetShowRejected(::cppu::any2bool(rChangeProp.Value));
858  else if (sName == "ShowChangesByDatetime")
859  pViewSettings->SetHasDate(::cppu::any2bool(rChangeProp.Value));
860  else if (sName == "ShowChangesByDatetimeMode")
861  {
862  if (rChangeProp.Value >>= nTemp16)
863  pViewSettings->SetTheDateMode(static_cast<SvxRedlinDateMode>(nTemp16));
864  }
865  else if (sName == "ShowChangesByDatetimeFirstDatetime")
866  {
867  util::DateTime aDateTime;
868  if (rChangeProp.Value >>= aDateTime)
869  {
870  pViewSettings->SetTheFirstDateTime(::DateTime(aDateTime));
871  }
872  }
873  else if (sName == "ShowChangesByDatetimeSecondDatetime")
874  {
875  util::DateTime aDateTime;
876  if (rChangeProp.Value >>= aDateTime)
877  {
878  pViewSettings->SetTheLastDateTime(::DateTime(aDateTime));
879  }
880  }
881  else if (sName == "ShowChangesByAuthor")
882  pViewSettings->SetHasAuthor(::cppu::any2bool(rChangeProp.Value));
883  else if (sName == "ShowChangesByAuthorName")
884  {
885  OUString sOUName;
886  if (rChangeProp.Value >>= sOUName)
887  {
888  pViewSettings->SetTheAuthorToShow(sOUName);
889  }
890  }
891  else if (sName == "ShowChangesByComment")
892  pViewSettings->SetHasComment(::cppu::any2bool(rChangeProp.Value));
893  else if (sName == "ShowChangesByCommentText")
894  {
895  OUString sOUComment;
896  if (rChangeProp.Value >>= sOUComment)
897  {
898  pViewSettings->SetTheComment(sOUComment);
899  }
900  }
901  else if (sName == "ShowChangesByRanges")
902  pViewSettings->SetHasRange(::cppu::any2bool(rChangeProp.Value));
903  else if (sName == "ShowChangesByRangesList")
904  {
905  OUString sRanges;
906  if ((rChangeProp.Value >>= sRanges) && !sRanges.isEmpty())
907  {
908  ScRangeList aRangeList;
910  aRangeList, sRanges, *pDoc, FormulaGrammar::CONV_OOO);
911  pViewSettings->SetTheRangeList(aRangeList);
912  }
913  }
914  }
915  pDoc->SetChangeViewSettings(*pViewSettings);
916 }
917 
918 void ScXMLImport::SetViewSettings(const uno::Sequence<beans::PropertyValue>& aViewProps)
919 {
920  sal_Int32 nHeight(0);
921  sal_Int32 nLeft(0);
922  sal_Int32 nTop(0);
923  sal_Int32 nWidth(0);
924  for (const auto& rViewProp : aViewProps)
925  {
926  OUString sName(rViewProp.Name);
927  if (sName == "VisibleAreaHeight")
928  rViewProp.Value >>= nHeight;
929  else if (sName == "VisibleAreaLeft")
930  rViewProp.Value >>= nLeft;
931  else if (sName == "VisibleAreaTop")
932  rViewProp.Value >>= nTop;
933  else if (sName == "VisibleAreaWidth")
934  rViewProp.Value >>= nWidth;
935  else if (sName == "TrackedChangesViewSettings")
936  {
937  uno::Sequence<beans::PropertyValue> aChangeProps;
938  if(rViewProp.Value >>= aChangeProps)
939  SetChangeTrackingViewSettings(aChangeProps);
940  }
941  }
942  if (!(nHeight && nWidth && GetModel().is()))
943  return;
944 
945  ScModelObj* pDocObj(comphelper::getUnoTunnelImplementation<ScModelObj>( GetModel() ));
946  if (!pDocObj)
947  return;
948 
949  SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
950  if (pEmbeddedObj)
951  {
952  tools::Rectangle aRect;
953  aRect.setX( nLeft );
954  aRect.setY( nTop );
955  aRect.setWidth( nWidth );
956  aRect.setHeight( nHeight );
957  pEmbeddedObj->SetVisArea(aRect);
958  }
959 }
960 
961 void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyValue>& aConfigProps)
962 {
963  if (!GetModel().is())
964  return;
965 
966  uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
967  if (!xMultiServiceFactory.is())
968  return;
969 
970  sal_Int32 nCount(aConfigProps.getLength());
971  css::uno::Sequence<css::beans::PropertyValue> aFilteredProps(nCount);
972  sal_Int32 nFilteredPropsLen = 0;
973  for (sal_Int32 i = nCount - 1; i >= 0; --i)
974  {
975  if (aConfigProps[i].Name == "TrackedChangesProtectionKey")
976  {
977  OUString sKey;
978  if (aConfigProps[i].Value >>= sKey)
979  {
980  uno::Sequence<sal_Int8> aPass;
981  ::comphelper::Base64::decode(aPass, sKey);
982  if (aPass.hasElements())
983  {
984  if (pDoc->GetChangeTrack())
985  pDoc->GetChangeTrack()->SetProtection(aPass);
986  else
987  {
988  std::set<OUString> aUsers;
989  std::unique_ptr<ScChangeTrack> pTrack( new ScChangeTrack(*pDoc, aUsers) );
990  pTrack->SetProtection(aPass);
991  pDoc->SetChangeTrack(std::move(pTrack));
992  }
993  }
994  }
995  }
996  // store the following items for later use (after document is loaded)
997  else if ((aConfigProps[i].Name == "VBACompatibilityMode") || (aConfigProps[i].Name == "ScriptConfiguration"))
998  {
999  uno::Reference< beans::XPropertySet > xImportInfo = getImportInfo();
1000  if (xImportInfo.is())
1001  {
1002  uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xImportInfo->getPropertySetInfo();
1003  if (xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName(aConfigProps[i].Name))
1004  xImportInfo->setPropertyValue( aConfigProps[i].Name, aConfigProps[i].Value );
1005  }
1006  }
1007  if (aConfigProps[i].Name != "LinkUpdateMode")
1008  {
1009  aFilteredProps[nFilteredPropsLen++] = aConfigProps[i];
1010  }
1011  }
1012  aFilteredProps.realloc(nFilteredPropsLen);
1013  uno::Reference <uno::XInterface> xInterface = xMultiServiceFactory->createInstance("com.sun.star.comp.SpreadsheetSettings");
1014  uno::Reference <beans::XPropertySet> xProperties(xInterface, uno::UNO_QUERY);
1015  if (xProperties.is())
1016  SvXMLUnitConverter::convertPropertySet(xProperties, aFilteredProps);
1017 }
1018 
1019 sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, const OUString& rCurrency)
1020 {
1021  uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
1022  if (xNumberFormatsSupplier.is())
1023  {
1024  uno::Reference <util::XNumberFormats> xLocalNumberFormats(xNumberFormatsSupplier->getNumberFormats());
1025  if (xLocalNumberFormats.is())
1026  {
1027  OUString sFormatString;
1028  try
1029  {
1030  uno::Reference <beans::XPropertySet> xProperties(xLocalNumberFormats->getByKey(nKey));
1031  if (xProperties.is())
1032  {
1033  lang::Locale aLocale;
1034  if (GetDocument() && (xProperties->getPropertyValue(gsLocale) >>= aLocale))
1035  {
1036  {
1037  ScXMLImport::MutexGuard aGuard(*this);
1039  OUStringBuffer aBuffer(15);
1040  aBuffer.append("#");
1041  aBuffer.append( aLocaleData.getNumThousandSep() );
1042  aBuffer.append("##0");
1043  aBuffer.append( aLocaleData.getNumDecimalSep() );
1044  aBuffer.append("00 [$");
1045  aBuffer.append(rCurrency);
1046  aBuffer.append("]");
1047  sFormatString = aBuffer.makeStringAndClear();
1048  }
1049  sal_Int32 nNewKey = xLocalNumberFormats->queryKey(sFormatString, aLocale, true);
1050  if (nNewKey == -1)
1051  nNewKey = xLocalNumberFormats->addNew(sFormatString, aLocale);
1052  return nNewKey;
1053  }
1054  }
1055  }
1056  catch ( const util::MalformedNumberFormatException& rException )
1057  {
1058  OUString sErrorMessage ="Error in Formatstring " +
1059  sFormatString + " at position " +
1060  OUString::number(rException.CheckPos);
1061  uno::Sequence<OUString> aSeq { sErrorMessage };
1062  uno::Reference<xml::sax::XLocator> xLocator;
1063  SetError(XMLERROR_API | XMLERROR_FLAG_ERROR, aSeq, rException.Message, xLocator);
1064  }
1065  }
1066  }
1067  return nKey;
1068 }
1069 
1070 bool ScXMLImport::IsCurrencySymbol(const sal_Int32 nNumberFormat, const OUString& sCurrentCurrency, const OUString& sBankSymbol)
1071 {
1072  uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
1073  if (xNumberFormatsSupplier.is())
1074  {
1075  uno::Reference <util::XNumberFormats> xLocalNumberFormats(xNumberFormatsSupplier->getNumberFormats());
1076  if (xLocalNumberFormats.is())
1077  {
1078  try
1079  {
1080  uno::Reference <beans::XPropertySet> xNumberPropertySet(xLocalNumberFormats->getByKey(nNumberFormat));
1081  if (xNumberPropertySet.is())
1082  {
1083  OUString sTemp;
1084  if ( xNumberPropertySet->getPropertyValue(SC_CURRENCYSYMBOL) >>= sTemp)
1085  {
1086  if (sCurrentCurrency == sTemp)
1087  return true;
1088  // A release that saved an unknown currency may have
1089  // saved the currency symbol of the number format
1090  // instead of an ISO code bank symbol. In another
1091  // release we may have a match for that. In this case
1092  // sCurrentCurrency is the ISO code obtained through
1093  // XMLNumberFormatAttributesExportHelper::GetCellType()
1094  // and sBankSymbol is the currency symbol.
1095  if (sCurrentCurrency.getLength() == 3 && sBankSymbol == sTemp)
1096  return true;
1097  // #i61657# This may be a legacy currency symbol that changed in the meantime.
1098  if (SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sCurrentCurrency, sBankSymbol) != nullptr)
1099  return true;
1100  // In the rare case that sCurrentCurrency is not the
1101  // currency symbol, but a matching ISO code
1102  // abbreviation instead that was obtained through
1103  // XMLNumberFormatAttributesExportHelper::GetCellType(),
1104  // check with the number format's symbol. This happens,
1105  // for example, in the es_BO locale, where a legacy
1106  // B$,BOB matched B$->BOP, which leads to
1107  // sCurrentCurrency being BOP, and the previous call
1108  // with BOP,BOB didn't find an entry, but B$,BOB will.
1109  return SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sTemp, sBankSymbol) != nullptr;
1110  }
1111  }
1112  }
1113  catch ( uno::Exception& )
1114  {
1115  OSL_FAIL("Numberformat not found");
1116  }
1117  }
1118  }
1119  return false;
1120 }
1121 
1122 void ScXMLImport::SetType(const uno::Reference <beans::XPropertySet>& rProperties,
1123  sal_Int32& rNumberFormat,
1124  const sal_Int16 nCellType,
1125  const OUString& rCurrency)
1126 {
1127  if (!mbImportStyles)
1128  return;
1129 
1130  if ((nCellType == util::NumberFormat::TEXT) || (nCellType == util::NumberFormat::UNDEFINED))
1131  return;
1132 
1133  if (rNumberFormat == -1)
1134  rProperties->getPropertyValue( gsNumberFormat ) >>= rNumberFormat;
1135  OSL_ENSURE(rNumberFormat != -1, "no NumberFormat");
1136  bool bIsStandard;
1137  // sCurrentCurrency may be the ISO code abbreviation if the currency
1138  // symbol matches such, or if no match found the symbol itself!
1139  OUString sCurrentCurrency;
1140  sal_Int32 nCurrentCellType(
1142  rNumberFormat, sCurrentCurrency, bIsStandard) & ~util::NumberFormat::DEFINED);
1143  // If the (numeric) cell type (number, currency, date, time, boolean)
1144  // is different from the format type then for some combinations we may
1145  // have to apply a format, e.g. in case the generator deduced format
1146  // from type and did not apply a format but we don't keep a dedicated
1147  // type internally. Specifically this is necessary if the cell type is
1148  // not number but the format type is (i.e. General). Currency cells
1149  // need extra attention, see calls of ScXMLImport::IsCurrencySymbol()
1150  // and description within there and ScXMLImport::SetCurrencySymbol().
1151  if ((nCellType != nCurrentCellType) &&
1152  (nCellType != util::NumberFormat::NUMBER) &&
1153  (bIsStandard || (nCellType == util::NumberFormat::CURRENCY)))
1154  {
1155  if (!xNumberFormats.is())
1156  {
1157  uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
1158  if (xNumberFormatsSupplier.is())
1159  xNumberFormats.set(xNumberFormatsSupplier->getNumberFormats());
1160  }
1161  if (xNumberFormats.is())
1162  {
1163  try
1164  {
1165  uno::Reference < beans::XPropertySet> xNumberFormatProperties(xNumberFormats->getByKey(rNumberFormat));
1166  if (xNumberFormatProperties.is())
1167  {
1168  if (nCellType != util::NumberFormat::CURRENCY)
1169  {
1170  lang::Locale aLocale;
1171  if ( xNumberFormatProperties->getPropertyValue(gsLocale) >>= aLocale )
1172  {
1173  if (!xNumberFormatTypes.is())
1174  xNumberFormatTypes.set(uno::Reference <util::XNumberFormatTypes>(xNumberFormats, uno::UNO_QUERY));
1175  rProperties->setPropertyValue( gsNumberFormat, uno::makeAny(xNumberFormatTypes->getStandardFormat(nCellType, aLocale)) );
1176  }
1177  }
1178  else if (!rCurrency.isEmpty() && !sCurrentCurrency.isEmpty())
1179  {
1180  if (sCurrentCurrency != rCurrency)
1181  if (!IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency))
1182  rProperties->setPropertyValue( gsNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency)));
1183  }
1184  }
1185  }
1186  catch ( uno::Exception& )
1187  {
1188  OSL_FAIL("Numberformat not found");
1189  }
1190  }
1191  }
1192  else
1193  {
1194  if ((nCellType == util::NumberFormat::CURRENCY) && !rCurrency.isEmpty() && !sCurrentCurrency.isEmpty() &&
1195  sCurrentCurrency != rCurrency && !IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency))
1196  rProperties->setPropertyValue( gsNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency)));
1197  }
1198 }
1199 
1201 {
1202  if (!mbImportStyles)
1203  return;
1204 
1205  if (!sPrevStyleName.isEmpty())
1206  {
1207  uno::Reference <beans::XPropertySet> xProperties (xSheetCellRanges, uno::UNO_QUERY);
1208  if (xProperties.is())
1209  {
1210  XMLTableStylesContext *pStyles(static_cast<XMLTableStylesContext *>(GetAutoStyles()));
1211  XMLTableStyleContext* pStyle = nullptr;
1212  if ( pStyles )
1213  pStyle = const_cast<XMLTableStyleContext*>(static_cast<const XMLTableStyleContext *>(pStyles->FindStyleChildContext(
1214  XmlStyleFamily::TABLE_CELL, sPrevStyleName, true)));
1215  if (pStyle)
1216  {
1217  pStyle->FillPropertySet(xProperties);
1218  // here needs to be the cond format import method
1219  sal_Int32 nNumberFormat(pStyle->GetNumberFormat());
1220  SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
1221 
1222  css::uno::Any aAny = xProperties->getPropertyValue("FormatID");
1223  sal_uInt64 nKey = 0;
1224  if ((aAny >>= nKey) && nKey)
1225  {
1226  ScFormatSaveData* pFormatSaveData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->GetFormatSaveData();
1227  pFormatSaveData->maIDToName.insert(std::pair<sal_uInt64, OUString>(nKey, sPrevStyleName));
1228  }
1229 
1230  // store first cell of first range for each style, once per sheet
1231  uno::Sequence<table::CellRangeAddress> aAddresses(xSheetCellRanges->getRangeAddresses());
1232  pStyle->ApplyCondFormat(aAddresses);
1233  if ( aAddresses.hasElements() )
1234  {
1235  const table::CellRangeAddress& rRange = aAddresses[0];
1236  if ( rRange.Sheet != pStyle->GetLastSheet() )
1237  {
1238  ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->GetSheetSaveData();
1239  pSheetData->AddCellStyle( sPrevStyleName,
1240  ScAddress( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), static_cast<SCTAB>(rRange.Sheet) ) );
1241  pStyle->SetLastSheet(rRange.Sheet);
1242  }
1243  }
1244  }
1245  else
1246  {
1247  xProperties->setPropertyValue(gsCellStyle, uno::makeAny(GetStyleDisplayName( XmlStyleFamily::TABLE_CELL, sPrevStyleName )));
1248  sal_Int32 nNumberFormat(GetStyleNumberFormats()->GetStyleNumberFormat(sPrevStyleName));
1249  bool bInsert(nNumberFormat == -1);
1250  SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
1251  if (bInsert)
1253  }
1254  }
1255  }
1256  if (GetModel().is())
1257  {
1258  uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
1259  if (xMultiServiceFactory.is())
1260  xSheetCellRanges.set(uno::Reference <sheet::XSheetCellRangeContainer>(
1261  xMultiServiceFactory->createInstance("com.sun.star.sheet.SheetCellRanges"),
1262  uno::UNO_QUERY));
1263  }
1264  OSL_ENSURE(xSheetCellRanges.is(), "didn't get SheetCellRanges");
1265 }
1266 
1267 void ScXMLImport::SetStyleToRanges(const ScRangeList& rRanges, const OUString* pStyleName,
1268  const sal_Int16 nCellType, const OUString* pCurrency)
1269 {
1270  if (!mbImportStyles)
1271  return;
1272 
1273  if (sPrevStyleName.isEmpty())
1274  {
1275  nPrevCellType = nCellType;
1276  if (pStyleName)
1277  sPrevStyleName = *pStyleName;
1278  if (pCurrency)
1279  sPrevCurrency = *pCurrency;
1280  else if (!sPrevCurrency.isEmpty())
1281  sPrevCurrency.clear();
1282  }
1283  else if ((nCellType != nPrevCellType) ||
1284  ((pStyleName && *pStyleName != sPrevStyleName) ||
1285  (!pStyleName && !sPrevStyleName.isEmpty())) ||
1286  ((pCurrency && *pCurrency != sPrevCurrency) ||
1287  (!pCurrency && !sPrevCurrency.isEmpty())))
1288  {
1289  SetStyleToRanges();
1290  nPrevCellType = nCellType;
1291  if (pStyleName)
1292  sPrevStyleName = *pStyleName;
1293  else if(!sPrevStyleName.isEmpty())
1294  sPrevStyleName.clear();
1295  if (pCurrency)
1296  sPrevCurrency = *pCurrency;
1297  else if(!sPrevCurrency.isEmpty())
1298  sPrevCurrency.clear();
1299  }
1300 
1301  if (!xSheetCellRanges.is() && GetModel().is())
1302  {
1303  uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
1304  if (xMultiServiceFactory.is())
1305  xSheetCellRanges.set(uno::Reference <sheet::XSheetCellRangeContainer>(xMultiServiceFactory->createInstance("com.sun.star.sheet.SheetCellRanges"), uno::UNO_QUERY));
1306  OSL_ENSURE(xSheetCellRanges.is(), "didn't get SheetCellRanges");
1307 
1308  }
1309  static_cast<ScCellRangesObj*>(xSheetCellRanges.get())->SetNewRanges(rRanges);
1310 }
1311 
1313 {
1314  if (!bNullDateSetted)
1316  OSL_ENSURE(bNullDateSetted, "could not set the null date");
1317  return bNullDateSetted;
1318 }
1319 
1321 {
1325 }
1326 
1328 {
1329  if (!pStyleNumberFormats)
1331  return pStyleNumberFormats.get();
1332 }
1333 
1335 {
1336  SetStyleToRanges();
1337  sPrevStyleName.clear();
1338 }
1339 
1340 // XImporter
1341 void SAL_CALL ScXMLImport::setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc )
1342 {
1343  ScXMLImport::MutexGuard aGuard(*this);
1345 
1346  uno::Reference<frame::XModel> xModel(xDoc, uno::UNO_QUERY);
1347  pDoc = ScXMLConverter::GetScDocument( xModel );
1348  OSL_ENSURE( pDoc, "ScXMLImport::setTargetDocument - no ScDocument!" );
1349  if (!pDoc)
1350  throw lang::IllegalArgumentException();
1351 
1352  mpDocImport.reset(new ScDocumentImport(*pDoc));
1354 
1355  uno::Reference<document::XActionLockable> xActionLockable(xDoc, uno::UNO_QUERY);
1356  if (xActionLockable.is())
1357  xActionLockable->addActionLock();
1358 }
1359 
1360 // css::xml::sax::XDocumentHandler
1362 {
1363  ScXMLImport::MutexGuard aGuard(*this);
1365  if (pDoc && !pDoc->IsImportingXML())
1366  {
1367  comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->BeforeXMLLoading();
1368  bSelfImportingXMLSet = true;
1369  }
1370 
1371  // if content and styles are loaded with separate imports,
1372  // set bLatinDefaultStyle flag at the start of the content import
1373  SvXMLImportFlags nFlags = getImportFlags();
1374  if ( ( nFlags & SvXMLImportFlags::CONTENT ) && !( nFlags & SvXMLImportFlags::STYLES ) )
1376 
1377  if (getImportFlags() & SvXMLImportFlags::CONTENT)
1378  {
1379  if (GetModel().is())
1380  {
1381  // store initial namespaces, to find the ones that were added from the file later
1382  ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->GetSheetSaveData();
1383  const SvXMLNamespaceMap& rNamespaces = GetNamespaceMap();
1384  pSheetData->StoreInitialNamespaces(rNamespaces);
1385  }
1386  }
1387 
1388  uno::Reference< beans::XPropertySet > const xImportInfo( getImportInfo() );
1389  uno::Reference< beans::XPropertySetInfo > const xPropertySetInfo(
1390  xImportInfo.is() ? xImportInfo->getPropertySetInfo() : nullptr);
1391  if (xPropertySetInfo.is())
1392  {
1393  OUString const sOrganizerMode(
1394  "OrganizerMode");
1395  if (xPropertySetInfo->hasPropertyByName(sOrganizerMode))
1396  {
1397  bool bStyleOnly(false);
1398  if (xImportInfo->getPropertyValue(sOrganizerMode) >>= bStyleOnly)
1399  {
1400  bLoadDoc = !bStyleOnly;
1401  }
1402  }
1403  }
1404 
1405  UnlockSolarMutex();
1406 }
1407 
1408 sal_Int32 ScXMLImport::GetRangeType(const OUString& sRangeType)
1409 {
1410  sal_Int32 nRangeType(0);
1411  OUStringBuffer sBuffer;
1412  sal_Int32 i = 0;
1413  while (i <= sRangeType.getLength())
1414  {
1415  if ((i == sRangeType.getLength()) || (sRangeType[i] == ' '))
1416  {
1417  OUString sTemp = sBuffer.makeStringAndClear();
1418  if (sTemp == "repeat-column")
1420  else if (sTemp == SC_REPEAT_ROW)
1421  nRangeType |= sheet::NamedRangeFlag::ROW_HEADER;
1422  else if (sTemp == SC_FILTER)
1423  nRangeType |= sheet::NamedRangeFlag::FILTER_CRITERIA;
1424  else if (sTemp == SC_PRINT_RANGE)
1425  nRangeType |= sheet::NamedRangeFlag::PRINT_AREA;
1426  }
1427  else if (i < sRangeType.getLength())
1428  sBuffer.append(sRangeType[i]);
1429  ++i;
1430  }
1431  return nRangeType;
1432 }
1433 
1435 {
1436  if (!pMyLabelRanges)
1437  return;
1438 
1439  uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), uno::UNO_QUERY);
1440  if (!xPropertySet.is())
1441  return;
1442 
1443  uno::Any aColAny = xPropertySet->getPropertyValue(SC_UNO_COLLABELRNG);
1444  uno::Any aRowAny = xPropertySet->getPropertyValue(SC_UNO_ROWLABELRNG);
1445 
1446  uno::Reference< sheet::XLabelRanges > xColRanges;
1447  uno::Reference< sheet::XLabelRanges > xRowRanges;
1448 
1449  if ( !(( aColAny >>= xColRanges ) && ( aRowAny >>= xRowRanges )) )
1450  return;
1451 
1452  table::CellRangeAddress aLabelRange;
1453  table::CellRangeAddress aDataRange;
1454 
1455  for (const auto& rxLabelRange : *pMyLabelRanges)
1456  {
1457  sal_Int32 nOffset1(0);
1458  sal_Int32 nOffset2(0);
1459  FormulaGrammar::AddressConvention eConv = FormulaGrammar::CONV_OOO;
1460 
1461  assert(pDoc);
1462  if (ScRangeStringConverter::GetRangeFromString( aLabelRange, rxLabelRange->sLabelRangeStr, *pDoc, eConv, nOffset1 ) &&
1463  ScRangeStringConverter::GetRangeFromString( aDataRange, rxLabelRange->sDataRangeStr, *pDoc, eConv, nOffset2 ))
1464  {
1465  if ( rxLabelRange->bColumnOrientation )
1466  xColRanges->addNew( aLabelRange, aDataRange );
1467  else
1468  xRowRanges->addNew( aLabelRange, aDataRange );
1469  }
1470  }
1471 
1472  pMyLabelRanges->clear();
1473 }
1474 
1475 namespace {
1476 
1477 class RangeNameInserter
1478 {
1479  ScDocument& mrDoc;
1480  ScRangeName& mrRangeName;
1481 
1482 public:
1483  RangeNameInserter(ScDocument& rDoc, ScRangeName& rRangeName) :
1484  mrDoc(rDoc), mrRangeName(rRangeName) {}
1485 
1486  void operator() (const std::unique_ptr<ScMyNamedExpression>& p) const
1487  {
1488  using namespace formula;
1489 
1490  const OUString& aType = p->sRangeType;
1491  sal_uInt32 nUnoType = ScXMLImport::GetRangeType(aType);
1492 
1494  if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria;
1495  if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= ScRangeData::Type::PrintArea;
1498 
1499  // Insert a new name.
1500  ScAddress aPos;
1501  sal_Int32 nOffset = 0;
1503  aPos, p->sBaseCellAddress, mrDoc, FormulaGrammar::CONV_OOO, nOffset);
1504 
1505  if (bSuccess)
1506  {
1507  OUString aContent = p->sContent;
1508  if (!p->bIsExpression)
1510 
1511  ScRangeData* pData = new ScRangeData(
1512  mrDoc, p->sName, aContent, aPos, nNewType, p->eGrammar);
1513  mrRangeName.insert(pData);
1514  }
1515  }
1516 };
1517 
1518 }
1519 
1521 {
1522  if (!m_pMyNamedExpressions)
1523  return;
1524 
1525  if (!pDoc)
1526  return;
1527 
1528  // Insert the namedRanges
1529  ScRangeName* pRangeNames = pDoc->GetRangeName();
1530  ::std::for_each(m_pMyNamedExpressions->begin(), m_pMyNamedExpressions->end(), RangeNameInserter(*pDoc, *pRangeNames));
1531 }
1532 
1534 {
1535  if (!pDoc)
1536  return;
1537 
1538  for (auto const& itr : m_SheetNamedExpressions)
1539  {
1540  const SCTAB nTab = itr.first;
1541  ScRangeName* pRangeNames = pDoc->GetRangeName(nTab);
1542  if (!pRangeNames)
1543  continue;
1544 
1545  const ScMyNamedExpressions& rNames = *itr.second;
1546  ::std::for_each(rNames.begin(), rNames.end(), RangeNameInserter(*pDoc, *pRangeNames));
1547  }
1548 }
1549 
1551 {
1552  if (!pDoc)
1553  return;
1554 
1555  ScCalcConfig aCalcConfig = pDoc->GetCalcConfig();
1556 
1557  // Has any string ref syntax been imported?
1558  // If not, we need to take action
1559  if ( !aCalcConfig.mbHasStringRefSyntax )
1560  {
1562  pDoc->SetCalcConfig(aCalcConfig);
1563  }
1564 }
1565 
1567 {
1568  ScXMLImport::MutexGuard aGuard(*this);
1569  if (getImportFlags() & SvXMLImportFlags::CONTENT)
1570  {
1571  if (GetModel().is())
1572  {
1573  mpDocImport->finalize();
1574 
1575  uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetModel(), uno::UNO_QUERY);
1576  if (xViewDataSupplier.is())
1577  {
1578  uno::Reference<container::XIndexAccess> xIndexAccess(xViewDataSupplier->getViewData());
1579  if (xIndexAccess.is() && xIndexAccess->getCount() > 0)
1580  {
1581  uno::Sequence< beans::PropertyValue > aSeq;
1582  if (xIndexAccess->getByIndex(0) >>= aSeq)
1583  {
1584  for (const auto& rProp : std::as_const(aSeq))
1585  {
1586  OUString sName(rProp.Name);
1587  if (sName == SC_ACTIVETABLE)
1588  {
1589  OUString sTabName;
1590  if(rProp.Value >>= sTabName)
1591  {
1592  SCTAB nTab(0);
1593  if (pDoc->GetTable(sTabName, nTab))
1594  {
1595  pDoc->SetVisibleTab(nTab);
1596  break;
1597  }
1598  }
1599  }
1600  }
1601  }
1602  }
1603  }
1604  SetLabelRanges();
1605  SetNamedRanges();
1608  if (mpPivotSources)
1609  // Process pivot table sources after the named ranges have been set.
1610  mpPivotSources->process();
1611  }
1612  GetProgressBarHelper()->End(); // make room for subsequent SfxProgressBars
1613  if (pDoc)
1614  {
1615  pDoc->CompileXML();
1616 
1617  // After CompileXML, links must be completely changed to the new URLs.
1618  // Otherwise, hasExternalFile for API wouldn't work (#i116940#),
1619  // and typing a new formula would create a second link with the same "real" file name.
1620  if (pDoc->HasExternalRefManager())
1622  }
1623 
1624  // If the stream contains cells outside of the current limits, the styles can't be re-created,
1625  // so stream copying is disabled then.
1626  if (pDoc && GetModel().is() && !pDoc->HasRangeOverflow())
1627  {
1628  // set "valid stream" flags after loading (before UpdateRowHeights, so changed formula results
1629  // in UpdateRowHeights can already clear the flags again)
1630  ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->GetSheetSaveData();
1631 
1632  SCTAB nTabCount = pDoc->GetTableCount();
1633  for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
1634  {
1635  pDoc->SetDrawPageSize(nTab);
1636  if (!pSheetData->IsSheetBlocked( nTab ))
1637  pDoc->SetStreamValid( nTab, true );
1638  }
1639  }
1640 
1641  // There are rows with optimal height which need to be updated
1642  if (pDoc && !maRecalcRowRanges.empty())
1643  {
1644  bool bLockHeight = pDoc->IsAdjustHeightLocked();
1645  if (bLockHeight)
1646  {
1648  }
1649 
1650  ScSizeDeviceProvider aProv(static_cast<ScDocShell*>(pDoc->GetDocumentShell()));
1651  ScDocRowHeightUpdater aUpdater(*pDoc, aProv.GetDevice(), aProv.GetPPTX(), aProv.GetPPTY(), &maRecalcRowRanges);
1652  aUpdater.update();
1653 
1654  if (bLockHeight)
1655  {
1657  }
1658  }
1659 
1660  aTables.FixupOLEs();
1661  }
1662  if (GetModel().is())
1663  {
1664  uno::Reference<document::XActionLockable> xActionLockable(GetModel(), uno::UNO_QUERY);
1665  if (xActionLockable.is())
1666  xActionLockable->removeActionLock();
1667  }
1669 
1670  if (pDoc)
1671  {
1672  pDoc->BroadcastUno(SfxHint(SfxHintId::ScClearCache));
1673  }
1674 
1675  if(pDoc && bSelfImportingXMLSet)
1676  comphelper::getUnoTunnelImplementation<ScModelObj>(GetModel())->AfterXMLLoading();
1677 }
1678 
1679 // XEventListener
1681 {
1683  pDoc = nullptr;
1684 }
1685 
1687  mrImport(rImport)
1688 {
1690 }
1691 
1693 {
1694  mrImport.UnlockSolarMutex();
1695 }
1696 
1698 {
1699  // #i62677# When called from DocShell/Wrapper, the SolarMutex is already locked,
1700  // so there's no need to allocate (and later delete) the SolarMutexGuard.
1701  if (!mbLockSolarMutex)
1702  {
1704  return;
1705  }
1706 
1707  if (nSolarMutexLocked == 0)
1708  {
1709  OSL_ENSURE(!pSolarMutexGuard, "Solar Mutex is locked");
1710  pSolarMutexGuard.reset(new SolarMutexGuard());
1711  }
1713 }
1714 
1716 {
1717  if (nSolarMutexLocked > 0)
1718  {
1720  if (nSolarMutexLocked == 0)
1721  {
1722  OSL_ENSURE(pSolarMutexGuard, "Solar Mutex is always unlocked");
1723  pSolarMutexGuard.reset();
1724  }
1725  }
1726 }
1727 
1729 {
1730  sal_Int32 nOffset = -1;
1731  uno::Reference<xml::sax::XLocator> xLocator = GetLocator();
1732  uno::Reference<io::XSeekable> xSeek( xLocator, uno::UNO_QUERY );
1733  if ( xSeek.is() )
1734  nOffset = static_cast<sal_Int32>(xSeek->getPosition());
1735  return nOffset;
1736 }
1737 
1739 {
1740  // #i31130# Overflow is stored in the document, because the ScXMLImport object
1741  // isn't available in ScXMLImportWrapper::ImportFromComponent when using the
1742  // OOo->Oasis transformation.
1743 
1744  if ( pDoc )
1745  pDoc->SetRangeOverflowType( nType );
1746 }
1747 
1749 {
1750  nProgressCount++;
1751  if (nProgressCount > 100)
1752  {
1754  nProgressCount = 0;
1755  }
1756 }
1757 
1759  OUString& rFormula, OUString& rFormulaNmsp, FormulaGrammar::Grammar& reGrammar,
1760  const OUString& rAttrValue, bool bRestrictToExternalNmsp ) const
1761 {
1762  // parse the attribute value, extract namespace ID, literal namespace, and formula string
1763  rFormulaNmsp.clear();
1764  sal_uInt16 nNsId = GetNamespaceMap().GetKeyByQName(rAttrValue, nullptr, &rFormula, &rFormulaNmsp, SvXMLNamespaceMap::QNameMode::AttrValue);
1765 
1766  // check if we have an ODF formula namespace
1767  if( !bRestrictToExternalNmsp ) switch( nNsId )
1768  {
1769  case XML_NAMESPACE_OOOC:
1770  rFormulaNmsp.clear(); // remove namespace string for built-in grammar
1771  reGrammar = FormulaGrammar::GRAM_PODF;
1772  return;
1773  case XML_NAMESPACE_OF:
1774  rFormulaNmsp.clear(); // remove namespace string for built-in grammar
1775  reGrammar = FormulaGrammar::GRAM_ODFF;
1776  return;
1777  }
1778 
1779  /* Find default grammar for formulas without namespace. There may be
1780  documents in the wild that stored no namespace in ODF 1.0/1.1. Use
1781  GRAM_PODF then (old style ODF 1.0/1.1 formulas). The default for ODF
1782  1.2 and later without namespace is GRAM_ODFF (OpenFormula). */
1783  FormulaGrammar::Grammar eDefaultGrammar =
1784  (GetDocument()->GetStorageGrammar() == FormulaGrammar::GRAM_PODF) ?
1785  FormulaGrammar::GRAM_PODF : FormulaGrammar::GRAM_ODFF;
1786 
1787  /* Check if we have no namespace at all. The value XML_NAMESPACE_NONE
1788  indicates that there is no colon. If the first character of the
1789  attribute value is the equality sign, the value XML_NAMESPACE_UNKNOWN
1790  indicates that there is a colon somewhere in the formula string. */
1791  if( (nNsId == XML_NAMESPACE_NONE) || ((nNsId == XML_NAMESPACE_UNKNOWN) && (rAttrValue.toChar() == '=')) )
1792  {
1793  rFormula = rAttrValue; // return entire string as formula
1794  reGrammar = eDefaultGrammar;
1795  return;
1796  }
1797 
1798  /* Check if a namespace URL could be resolved from the attribute value.
1799  Use that namespace only, if the Calc document knows an associated
1800  external formula parser. This prevents that the range operator in
1801  conjunction with defined names is confused as namespaces prefix, e.g.
1802  in the expression 'table:A1' where 'table' is a named reference. */
1803  if( ((nNsId & XML_NAMESPACE_UNKNOWN_FLAG) != 0) && !rFormulaNmsp.isEmpty() &&
1804  GetDocument()->GetFormulaParserPool().hasFormulaParser( rFormulaNmsp ) )
1805  {
1806  reGrammar = FormulaGrammar::GRAM_EXTERNAL;
1807  return;
1808  }
1809 
1810  /* All attempts failed (e.g. no namespace and no leading equality sign, or
1811  an invalid namespace prefix), continue with the entire attribute value. */
1812  rFormula = rAttrValue;
1813  rFormulaNmsp.clear(); // remove any namespace string
1814  reGrammar = eDefaultGrammar;
1815 }
1816 
1818 {
1819  if (!mpComp)
1820  return FormulaError::NONE;
1821 
1822  return mpComp->GetErrorConstant(rStr);
1823 }
1824 
1826 {
1827  if (!mpEditEngine)
1828  {
1830  mpEditEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
1831  mpEditEngine->SetEditTextObjectPool(pDoc->GetEditPool());
1832  mpEditEngine->SetUpdateMode(false);
1833  mpEditEngine->EnableUndo(false);
1834  mpEditEngine->SetControlWord(mpEditEngine->GetControlWord() & ~EEControlBits::ALLOWBIGOBJS);
1835  }
1836  return mpEditEngine.get();
1837 }
1838 
1840 {
1841  if (!mpEditAttrMap)
1843  return *mpEditAttrMap;
1844 }
1845 
1847 {
1848  if (pDoc)
1849  pDoc->SetEmbedFonts(true);
1850 }
1851 
1853 {
1854  if (!pDetectiveOpArray)
1856  return pDetectiveOpArray.get();
1857 }
1858 
1859 extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportFODS(SvStream &rStream)
1860 {
1861  ScDLL::Init();
1862 
1863  SfxObjectShellLock xDocSh(new ScDocShell);
1864  xDocSh->DoInitNew();
1865  uno::Reference<frame::XModel> xModel(xDocSh->GetModel());
1866 
1867  uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
1868  uno::Reference<io::XInputStream> xStream(new ::utl::OSeekableInputStreamWrapper(rStream));
1869  uno::Reference<uno::XInterface> xInterface(xMultiServiceFactory->createInstance("com.sun.star.comp.Writer.XmlFilterAdaptor"), uno::UNO_SET_THROW);
1870 
1871  css::uno::Sequence<OUString> aUserData(7);
1872  aUserData[0] = "com.sun.star.comp.filter.OdfFlatXml";
1873  aUserData[2] = "com.sun.star.comp.Calc.XMLOasisImporter";
1874  aUserData[3] = "com.sun.star.comp.Calc.XMLOasisExporter";
1875  aUserData[6] = "true";
1876  uno::Sequence<beans::PropertyValue> aAdaptorArgs(comphelper::InitPropertySequence(
1877  {
1878  { "UserData", uno::Any(aUserData) },
1879  }));
1880  css::uno::Sequence<uno::Any> aOuterArgs(1);
1881  aOuterArgs[0] <<= aAdaptorArgs;
1882 
1883  uno::Reference<lang::XInitialization> xInit(xInterface, uno::UNO_QUERY_THROW);
1884  xInit->initialize(aOuterArgs);
1885 
1886  uno::Reference<document::XImporter> xImporter(xInterface, uno::UNO_QUERY_THROW);
1887  uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
1888  {
1889  { "InputStream", uno::Any(xStream) },
1890  { "URL", uno::Any(OUString("private:stream")) },
1891  }));
1892  xImporter->setTargetDocument(xModel);
1893 
1894  uno::Reference<document::XFilter> xFilter(xInterface, uno::UNO_QUERY_THROW);
1895  //SetLoading hack because the document properties will be re-initted
1896  //by the xml filter and during the init, while it's considered uninitialized,
1897  //setting a property will inform the document it's modified, which attempts
1898  //to update the properties, which throws cause the properties are uninitialized
1899  xDocSh->SetLoading(SfxLoadedFlags::NONE);
1900  bool ret = xFilter->filter(aArgs);
1901  xDocSh->SetLoading(SfxLoadedFlags::ALL);
1902 
1903  xDocSh->DoClose();
1904 
1905  return ret;
1906 }
1907 
1908 extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportXLSX(SvStream &rStream)
1909 {
1910  ScDLL::Init();
1911 
1912  SfxObjectShellLock xDocSh(new ScDocShell);
1913  xDocSh->DoInitNew();
1914  uno::Reference<frame::XModel> xModel(xDocSh->GetModel());
1915 
1916  uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory());
1917  uno::Reference<io::XInputStream> xStream(new utl::OSeekableInputStreamWrapper(rStream));
1918 
1919  uno::Reference<document::XFilter> xFilter(xMultiServiceFactory->createInstance("com.sun.star.comp.oox.xls.ExcelFilter"), uno::UNO_QUERY_THROW);
1920 
1921  uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW);
1922  uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
1923  {
1924  { "InputStream", uno::makeAny(xStream) },
1925  { "InputMode", uno::makeAny(true) },
1926  }));
1927  xImporter->setTargetDocument(xModel);
1928 
1929  //SetLoading hack because the document properties will be re-initted
1930  //by the xml filter and during the init, while it's considered uninitialized,
1931  //setting a property will inform the document it's modified, which attempts
1932  //to update the properties, which throws cause the properties are uninitialized
1933  xDocSh->SetLoading(SfxLoadedFlags::NONE);
1934  bool ret = false;
1935  try
1936  {
1937  ret = xFilter->filter(aArgs);
1938  }
1939  catch (const css::io::IOException&)
1940  {
1941  }
1942  catch (const css::lang::WrappedTargetRuntimeException&)
1943  {
1944  }
1945  xDocSh->SetLoading(SfxLoadedFlags::ALL);
1946 
1947  xDocSh->DoClose();
1948 
1949  return ret;
1950 }
1951 
1952 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SC_REPEAT_ROW
Definition: xmlimprt.cxx:105
virtual void SetVisArea(const tools::Rectangle &rVisArea)
const SvXMLTokenMap & GetTableAnnotationAttrTokenMap()
Definition: xmlimprt.cxx:486
void SetStringRefSyntaxIfMissing()
Definition: xmlimprt.cxx:1550
css::uno::Reference< css::sheet::XSheetCellRangeContainer > xSheetCellRanges
Definition: xmlimprt.hxx:247
virtual SvXMLImportContext * CreateFastContext(sal_Int32 nElement, const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlimprt.cxx:521
bool HasExternalRefManager() const
Definition: document.hxx:1003
XML_NUMBER_ROWS_REPEATED
XML_TABLE_COLUMN_GROUP
XML_NUMBER_ROWS_SPANNED
double GetPPTY() const
Definition: sizedev.hxx:42
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
XML_VALUE_TYPE
XML_STYLE_NAME
void SetStyles(SvXMLStylesContext *pStyles)
static const NfCurrencyEntry * GetLegacyOnlyCurrencyEntry(const OUString &rSymbol, const OUString &rAbbrev)
XML_DISPLAY
SvXMLImportContext * CreateScriptContext()
Definition: xmlimprt.cxx:682
css::uno::Reference< css::util::XNumberFormatTypes > xNumberFormatTypes
Definition: xmlimprt.hxx:245
ScMyTables aTables
Lift cycle managed elsewhere, no need to delete.
Definition: xmlimprt.hxx:230
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_XMLOasisStylesImporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlimprt.cxx:138
Provide mapping from ODF text formatting styles to EditEngine's, for rich-text cell content import...
static bool GetAddressFromString(ScAddress &rAddress, const OUString &rAddressStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
String to Range core.
Definition: rangeutl.cxx:435
XML_ANNOTATION
#define SC_UNO_ODS_LOCK_SOLAR_MUTEX
Definition: unonames.hxx:700
XML_DOCUMENT_META
sal_Int32 nProgressCount
Definition: xmlimprt.hxx:252
XML_DOCUMENT_STYLES
SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings &rNew)
Definition: documen2.cxx:1109
#define SC_ACTIVETABLE
SAL_DLLPUBLIC_EXPORT bool TestImportFODS(SvStream &rStream)
Definition: xmlimprt.cxx:1859
std::unique_ptr< ContentProperties > pData
ScDocument * pDoc
Definition: xmlimprt.hxx:204
XML_DEFAULT_CELL_STYLE_NAME
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
void SetProtection(const css::uno::Sequence< sal_Int8 > &rPass)
Definition: chgtrack.hxx:1129
Store pivot table data that need to be post-processed at the end of the import.
Definition: pivotsource.hxx:26
constexpr sal_uInt16 XML_NAMESPACE_OOOC
ScDocument * GetDocument()
Definition: xmlimprt.hxx:296
SC_DLLPUBLIC void SetDrawPageSize(SCTAB nTab)
Definition: documen9.cxx:193
XML_DETECTIVE
XML_EVENT_LISTENERS
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
void updateAbsAfterLoad()
Replace the original URL with the real URL that was generated from the relative URL.
constexpr OUStringLiteral PERCENT(u"Percent")
void StoreInitialNamespaces(const SvXMLNamespaceMap &rNamespaces)
Definition: sheetdata.cxx:172
XML_VALUE
Stores data imported from the file that need to be processed at the end of the import process...
static ScDocument * GetScDocument(const css::uno::Reference< css::frame::XModel > &xModel)
SvXMLNamespaceMap & GetNamespaceMap()
std::vector< ScDocRowHeightUpdater::TabRanges > maRecalcRowRanges
Definition: xmlimprt.hxx:232
SvXMLImportContext * CreateFontDeclsContext()
Definition: xmlimprt.cxx:638
std::unique_ptr< SvXMLTokenMap > pTableAnnotationAttrTokenMap
Definition: xmlimprt.hxx:226
SCTAB GetLastSheet() const
Definition: xmlstyli.hxx:105
XML_TABLE_ROW_GROUP
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
const SvXMLTokenMap & GetTableRowCellElemTokenMap()
Definition: xmlimprt.cxx:466
std::unique_ptr< SvXMLTokenMap > pTableRowsElemTokenMap
Definition: xmlimprt.hxx:221
void SetLastSheet(SCTAB nNew)
Definition: xmlstyli.hxx:106
const ScXMLEditAttributeMap & GetEditAttributeMap() const
Definition: xmlimprt.cxx:1839
OUString Name
OUString sPrevCurrency
Definition: xmlimprt.hxx:250
css::uno::Reference< css::frame::XModel > GetModel() const
bool mbLockSolarMutex
Definition: xmlimprt.hxx:257
Accessor class to ScDocument.
std::unique_ptr< ScMyImportValidations > pValidations
Definition: xmlimprt.hxx:238
EEControlBits
OUString sPrevStyleName
Definition: xmlimprt.hxx:249
bool IsAdjustHeightLocked() const
Definition: document.hxx:1535
#define XMLERROR_API
constexpr sal_uInt16 XML_NAMESPACE_CALC_EXT
#define XML_TOKEN_MAP_END
void SetFontDecls(XMLFontStylesContext *pFontDecls)
const sal_uInt16 XML_NAMESPACE_UNKNOWN
Value
SvXMLImportContext * CreateMetaContext(sal_Int32 nElement)
Definition: xmlimprt.cxx:665
rtl::Reference< XMLPropertySetMapper > xRowStylesPropertySetMapper
Definition: xmlimprt.hxx:217
bool SetNullDateOnUnitConverter()
Definition: xmlimprt.cxx:1312
Reference< XInputStream > xStream
XML_X
XML_TABLE_CELL
SvXMLImportFlags
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
void LockSolarMutex()
Definition: xmlimprt.cxx:1697
XML_TABLE_HEADER_COLUMNS
XML_NUMBER_COLUMNS_REPEATED
std::unique_ptr< ScDocumentImport > mpDocImport
Definition: xmlimprt.hxx:205
sc::ImportPostProcessData * mpPostProcessData
Definition: xmlimprt.hxx:228
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
Definition: xmlstyli.cxx:513
int nCount
std::unique_ptr< sc::PivotTableSources > mpPivotSources
Definition: xmlimprt.hxx:208
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:260
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
Definition: documen3.cxx:618
XML_VISIBILITY
bool IsCurrencySymbol(const sal_Int32 nNumberFormat, const OUString &sCurrencySymbol, const OUString &sBankSymbol)
Definition: xmlimprt.cxx:1070
sal_Int32 SetCurrencySymbol(const sal_Int32 nKey, const OUString &rCurrency)
Definition: xmlimprt.cxx:1019
constexpr OUStringLiteral gsCellStyle(u""SC_UNONAME_CELLSTYL)
bool bSelfImportingXMLSet
Definition: xmlimprt.hxx:256
XML_DOCUMENT_SETTINGS
XML_NUMBER_COLUMNS_SPANNED
void FixupOLEs()
Definition: xmlsubti.hxx:77
FormulaError GetFormulaErrorConstant(const OUString &rStr) const
Definition: xmlimprt.cxx:1817
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
ScXMLImport(const ScXMLImport &)=delete
void setX(tools::Long x)
const char * sName
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2392
virtual void SAL_CALL endDocument() override
Definition: xmlimprt.cxx:1566
SvXMLImportContext * CreateStylesContext(bool bAutoStyles)
Definition: xmlimprt.cxx:647
static bool GetRangeFromString(ScRange &rRange, const OUString &rRangeStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
SvXMLStylesContext * GetStyles()
bool bNullDateSetted
Definition: xmlimprt.hxx:255
OutputDevice * GetDevice() const
Definition: sizedev.hxx:40
void InsertStyles()
Definition: xmlimprt.cxx:816
SheetNamedExpMap m_SheetNamedExpressions
Definition: xmlimprt.hxx:235
XML_FORMS
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
std::unique_ptr< SvXMLTokenMap > pTableRowAttrTokenMap
Definition: xmlimprt.hxx:223
bool GetValidation(const OUString &sName, ScMyImportValidation &aValidation)
Definition: xmlimprt.cxx:773
void ApplyCondFormat(const css::uno::Sequence< css::table::CellRangeAddress > &xCellRanges)
Definition: xmlstyli.cxx:469
SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab)
Definition: document.hxx:860
std::unique_ptr< SvXMLTokenMap > pTableRowCellAttrTokenMap
Definition: xmlimprt.hxx:225
void ExamineDefaultStyle()
Definition: xmlimprt.cxx:825
This class exists only to provide GetScImport() to its derived classes.
void Increment(sal_Int32 nInc=1)
const OUString & getNumDecimalSep() const
void setY(tools::Long y)
const SvXMLTokenMap & GetTableRowElemTokenMap()
Definition: xmlimprt.cxx:429
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_XMLOasisSettingsImporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlimprt.cxx:162
constexpr sal_uInt16 XML_NAMESPACE_SVG
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_XMLOasisContentImporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlimprt.cxx:150
const XMLPropertyMapEntry aXMLScTableStylesImportProperties[]
Definition: xmlstyle.cxx:155
bool IsImportingXML() const
Definition: document.hxx:2137
virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > &i_rStats) override
Definition: xmlimprt.cxx:694
XML_TABLE_ROW
sal_Int32 GetNumberFormat()
Definition: xmlstyli.cxx:584
void SetPostProcessData(sc::ImportPostProcessData *p)
Definition: xmlimprt.cxx:508
int i
XML_TABLE_SOURCE
virtual void SetConfigurationSettings(const css::uno::Sequence< css::beans::PropertyValue > &aConfigProps) override
Definition: xmlimprt.cxx:961
void CopyStylesToDoc(bool bOverwrite, bool bFinish=true)
XML_SHAPES
std::unique_ptr< ScXMLEditAttributeMap > mpEditAttrMap
Definition: xmlimprt.hxx:210
std::unique_ptr< SvXMLTokenMap > pTableRowElemTokenMap
Definition: xmlimprt.hxx:222
void CompileXML()
Definition: document.cxx:3970
virtual void SAL_CALL startDocument() override
Definition: xmlimprt.cxx:1361
constexpr sal_uInt16 XML_NAMESPACE_TEXT
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
static void decode(css::uno::Sequence< sal_Int8 > &aPass, const OUString &sBuffer)
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
Definition: scdll.cxx:105
void SetLoading(SfxLoadedFlags nFlags)
std::unique_ptr< ScMyStyleNumberFormats > pStyleNumberFormats
Definition: xmlimprt.hxx:243
SfxObjectShell * GetEmbeddedObject() const
Definition: docuno.cxx:455
void SetStyleToRanges()
Definition: xmlimprt.cxx:1200
const sal_uInt16 XML_NAMESPACE_UNKNOWN_FLAG
XML_CURRENCY
bool HasRangeOverflow() const
Definition: document.hxx:2129
std::unique_ptr< ScCompiler > mpComp
Definition: xmlimprt.hxx:206
ScFormulaParserPool & GetFormulaParserPool() const
Returns the pool containing external formula parsers.
Definition: documen3.cxx:647
static void ConvertCellRangeAddress(OUString &sFormula)
SC_DLLPUBLIC SfxItemPool * GetEnginePool() const
Definition: documen2.cxx:449
#define SC_CURRENCYSYMBOL
Definition: xmlimprt.cxx:104
SC_DLLPUBLIC void UnlockAdjustHeight()
Definition: document.cxx:1815
bool hasFormulaParser(const OUString &rNamespace)
Returns true, if a formula parser is registered for the passed namespace.
std::unique_ptr< ScMyLabelRanges > pMyLabelRanges
Definition: xmlimprt.hxx:237
const XMLPropertyMapEntry aXMLScColumnStylesProperties[]
Definition: xmlstyle.cxx:116
XML_SUB_TABLE
XML_STRING_VALUE
#define SC_UNO_ODS_IMPORT_STYLES
Definition: unonames.hxx:701
sal_uInt32 nSolarMutexLocked
Definition: xmlimprt.hxx:251
XML_CONDITIONAL_FORMATS
bool setNullDate(const css::uno::Reference< css::frame::XModel > &xModel)
ProgressBarHelper * GetProgressBarHelper()
Use this class to manage solar mutex locking instead of calling LockSolarMutex() and UnlockSolarMutex...
Definition: xmlimprt.hxx:392
void BroadcastUno(const SfxHint &rHint)
Definition: documen3.cxx:944
std::unique_ptr< ScMyNamedExpressions > m_pMyNamedExpressions
Definition: xmlimprt.hxx:234
std::unique_ptr< SvXMLTokenMap > pTableElemTokenMap
Definition: xmlimprt.hxx:220
#define SC_LOCALE
Definition: xmlimprt.cxx:103
formula::FormulaGrammar::Grammar GetStorageGrammar() const
Definition: document.hxx:2439
static sal_Int16 GetCellType(const char *rStrValue, const sal_Int32 nStrLength)
Definition: xmlimprt.cxx:727
const SvXMLTokenMap & GetTableRowsElemTokenMap()
Definition: xmlimprt.cxx:410
const sal_uInt16 XML_NAMESPACE_NONE
ScXMLImport & mrImport
Definition: xmlimprt.hxx:398
const SvXMLTokenMap & GetTableElemTokenMap()
Definition: xmlimprt.cxx:376
void cleanup()
void ExtractFormulaNamespaceGrammar(OUString &rFormula, OUString &rFormulaNmsp,::formula::FormulaGrammar::Grammar &reGrammar, const OUString &rAttrValue, bool bRestrictToExternalNmsp=false) const
Extracts the formula string, the formula grammar namespace URL, and a grammar enum value from the pas...
Definition: xmlimprt.cxx:1758
XML_CELL_RANGE_SOURCE
formula::FormulaGrammar::AddressConvention meStringRefAddressSyntax
Definition: calcconfig.hxx:53
::std::list< std::unique_ptr< ScMyNamedExpression > > ScMyNamedExpressions
Definition: xmlimprt.hxx:159
std::map< sal_uInt64, OUString > maIDToName
Definition: sheetdata.hxx:177
XML_AUTHOR
FormulaError
XMLNumberFormatAttributesExportHelper * GetNumberFormatAttributesExportHelper()
Definition: xmlimprt.cxx:1320
std::unique_ptr< ScEditEngineDefaulter > mpEditEngine
Definition: xmlimprt.hxx:207
XML_COVERED_TABLE_CELL
static sal_Int32 GetRangeType(const OUString &sRangeType)
Definition: xmlimprt.cxx:1408
#define SC_PRINT_RANGE
Definition: xmlimprt.cxx:107
std::unique_ptr< XMLNumberFormatAttributesExportHelper > pNumberFormatAttributesExportHelper
Definition: xmlimprt.hxx:242
#define SC_UNONAME_CELLSTYL
Definition: unonames.hxx:97
ScEditEngineDefaulter * GetEditEngine()
Definition: xmlimprt.cxx:1825
void SetRangeOverflowType(ErrCode nType)
Definition: document.hxx:2128
Configuration options for formula interpreter.
Definition: calcconfig.hxx:43
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_XMLOasisImporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlimprt.cxx:114
XML_NUMBER_MATRIX_ROWS_SPANNED
css::uno::Reference< css::util::XNumberFormats > xNumberFormats
Definition: xmlimprt.hxx:244
SvXMLImportContext * CreateBodyContext(const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList)
Definition: xmlimprt.cxx:660
constexpr OUStringLiteral gsLocale(u""SC_LOCALE)
SAL_DLLPUBLIC_EXPORT bool TestImportXLSX(SvStream &rStream)
Definition: xmlimprt.cxx:1908
virtual void SAL_CALL startDocument() override
sal_Int16 nPrevCellType
Definition: xmlimprt.hxx:253
virtual void SetViewSettings(const css::uno::Sequence< css::beans::PropertyValue > &aViewProps) override
Definition: xmlimprt.cxx:918
void SetNamedRanges()
Definition: xmlimprt.cxx:1520
constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
void SetLabelRanges()
Definition: xmlimprt.cxx:1434
XML_NUMBER_MATRIX_COLUMNS_SPANNED
Reference< XMultiServiceFactory > getProcessServiceFactory()
std::unique_ptr< char[]> aBuffer
XML_DOCUMENT
bool IsStylesOnlyMode() const
Definition: xmlimprt.hxx:303
void SetStreamValid(SCTAB nTab, bool bSet, bool bIgnoreLock=false)
Definition: document.cxx:925
constexpr sal_uInt16 XML_NAMESPACE_TABLE
std::unique_ptr< SolarMutexGuard > pSolarMutexGuard
Definition: xmlimprt.hxx:240
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: xmlimprt.cxx:619
#define SC_FILTER
Definition: xmlimprt.cxx:106
void LockAdjustHeight()
Definition: document.hxx:1536
XML_Y
std::unique_ptr< SvXMLTokenMap > pTableRowCellElemTokenMap
Definition: xmlimprt.hxx:224
XML_DOCUMENT_CONTENT
SvXMLImportFlags getImportFlags() const
OUString GetStyleDisplayName(XmlStyleFamily nFamily, const OUString &rName) const
bool mbHasStringRefSyntax
Definition: calcconfig.hxx:56
XML_TABLE_COLUMNS
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
ScMyStyleNumberFormats * GetStyleNumberFormats()
Definition: xmlimprt.cxx:1327
XML_BOOLEAN_VALUE
const SvXMLTokenMap & GetTableRowCellAttrTokenMap()
Definition: xmlimprt.cxx:173
void AddCellStyle(const OUString &rName, const ScAddress &rCellPos)
Definition: sheetdata.cxx:41
void setWidth(tools::Long n)
rtl::Reference< XMLPropertySetMapper > xColumnStylesPropertySetMapper
Definition: xmlimprt.hxx:216
const ScCalcConfig & GetCalcConfig() const
Definition: document.hxx:2523
std::unique_ptr< ScMyStylesImportHelper > pStylesImportHelper
Definition: xmlimprt.hxx:212
void SetEmbedFonts(bool bUse)
Definition: document.hxx:587
rtl::Reference< XMLPropertySetMapper > xTableStylesPropertySetMapper
Definition: xmlimprt.hxx:218
XML_CREATE_DATE
#define SC_UNONAME_NUMFMT
Definition: unonames.hxx:106
SC_DLLPUBLIC void SetChangeTrack(std::unique_ptr< ScChangeTrack > pTrack)
only for import filter, deletes any existing ChangeTrack via EndChangeTracking() and takes ownership ...
Definition: documen2.cxx:272
#define SAL_INFO(area, stream)
const css::uno::Reference< css::xml::sax::XLocator > & GetLocator() const
void UnlockSolarMutex()
Definition: xmlimprt.cxx:1715
bool DoInitNew(SfxMedium *pMedium=nullptr)
#define XMLERROR_FLAG_ERROR
XML_N_PRESENTATION
ScXMLChangeTrackingImportHelper * GetChangeTrackingImportHelper()
Definition: xmlimprt.cxx:809
XML_P
virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > &i_rStats)
const XMLPropertyMapEntry aXMLScRowStylesImportProperties[]
Definition: xmlstyle.cxx:124
std::unique_ptr< ScMyImpDetectiveOpArray > pDetectiveOpArray
Definition: xmlimprt.hxx:239
#define XML_ELEMENT(prefix, name)
sal_uInt16 Add(const OUString &rPrefix, const OUString &rName, sal_uInt16 nKey=XML_NAMESPACE_UNKNOWN)
virtual void DisposingModel() override
Definition: xmlimprt.cxx:1680
const SvXMLUnitConverter & GetMM100UnitConverter() const
const css::uno::Reference< css::frame::XModel > & GetModel() const
void * p
Reference< XComponentContext > getProcessComponentContext()
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:401
void SetValue(sal_Int32 nValue)
static void convertPropertySet(css::uno::Sequence< css::beans::PropertyValue > &rProps, const css::uno::Reference< css::beans::XPropertySet > &aProperties)
void SetError(sal_Int32 nId, const css::uno::Sequence< OUString > &rMsgParams, const OUString &rExceptionMessage, const css::uno::Reference< css::xml::sax::XLocator > &rLocator)
XML_NAMED_EXPRESSIONS
Sequence< sal_Int8 > aSeq
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
Definition: document.cxx:6056
constexpr sal_uInt16 XML_NAMESPACE_OF
#define SC_UNO_COLLABELRNG
Definition: unonames.hxx:41
bool bLoadDoc
Definition: xmlimprt.hxx:254
XML_TABLE_COLUMN
void AddStyleNumberFormat(const OUString &rStyleName, const sal_Int32 nNumberFormat)
XML_TABLE_PROTECTION
const struct statistic s_stats[]
void SetAutoStyles(SvXMLStylesContext *pAutoStyles)
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
Definition: documen2.cxx:444
const SvXMLTokenMap & GetTableRowAttrTokenMap()
Definition: xmlimprt.cxx:446
const XMLPropertyMapEntry aXMLScCellStylesProperties[]
Definition: xmlstyle.cxx:61
ScMyImpDetectiveOpArray * GetDetectiveOpArray()
Definition: xmlimprt.cxx:1852
static bool GetRangeListFromString(ScRangeList &rRangeList, const OUString &rRangeListStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator= ' ', sal_Unicode cQuote= '\'')
Definition: rangeutl.cxx:526
const OUString & getNumThousandSep() const
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
constexpr sal_uInt16 XML_NAMESPACE_OFFICE_EXT
XML_SCENARIO
const css::uno::Reference< css::beans::XPropertySet > & getImportInfo() const
void SetReference(sal_Int32 nVal)
void SetChangeTrackingViewSettings(const css::uno::Sequence< css::beans::PropertyValue > &rChangeProps)
Definition: xmlimprt.cxx:838
XML_NP_PRESENTATION
static bool isLatinScript(const ScPatternAttr &rPat, ScDocument &rDoc)
Check if the attribute pattern has a number format that only produces latin script output...
Definition: numformat.cxx:33
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1058
Reference< XModel > xModel
constexpr OUStringLiteral gsNumberFormat(u""SC_UNONAME_NUMFMT)
bool mbImportStyles
Definition: xmlimprt.hxx:258
XML_CONTENT_VALIDATION_NAME
#define DBG_TESTSOLARMUTEX()
virtual ~ScXMLImport() override
Definition: xmlimprt.cxx:592
virtual void DisposingModel()
if(!pCandidateA->getEnd().equal(pCandidateB->getStart()))
rtl::Reference< XMLPropertyHandlerFactory > xScPropHdlFactory
Definition: xmlimprt.hxx:214
bool IsSheetBlocked(SCTAB nTab) const
Definition: sheetdata.cxx:100
void AddNamedExpression(ScMyNamedExpression *pMyNamedExpression)
Definition: xmlimprt.hxx:325
XML_CREATE_DATE_STRING
virtual void SAL_CALL setTargetDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
rtl::Reference< XMLPropertySetMapper > xCellStylesPropertySetMapper
Definition: xmlimprt.hxx:215
sal_Int32 GetByteOffset() const
Definition: xmlimprt.cxx:1728
#define SC_UNO_ROWLABELRNG
Definition: unonames.hxx:45
XML_DATE_VALUE
void ProgressBarIncrement()
Definition: xmlimprt.cxx:1748
sc::PivotTableSources & GetPivotTableSources()
Definition: xmlimprt.cxx:513
virtual void SAL_CALL characters(const OUString &aChars) override
XML_TABLE_HEADER_ROWS
XML_TIME_VALUE
SvXMLStylesContext * GetAutoStyles()
SC_DLLPUBLIC void SetCalcConfig(const ScCalcConfig &rConfig)
Definition: document10.cxx:200
virtual void SAL_CALL setTargetDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
Definition: xmlimprt.cxx:1341
XML_TABLE_ROWS
css::uno::Reference< css::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier()
void SetType(const css::uno::Reference< css::beans::XPropertySet > &rProperties, sal_Int32 &rNumberFormat, const sal_Int16 nCellType, const OUString &rCurrency)
Definition: xmlimprt.cxx:1122
MutexGuard(ScXMLImport &rImport)
Definition: xmlimprt.cxx:1686
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_XMLOasisMetaImporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlimprt.cxx:126
double GetPPTX() const
Definition: sizedev.hxx:41
SC_DLLPUBLIC bool insert(ScRangeData *p, bool bReuseFreeIndex=true)
Insert object into set.
Definition: rangenam.cxx:810
virtual XMLShapeImportHelper * CreateShapeImport() override
Definition: xmlimprt.cxx:768
ScDocumentImport & GetDoc()
Definition: xmlimprt.cxx:722
void setHeight(tools::Long n)
sal_Int16 SCTAB
Definition: types.hxx:23
sal_uInt16 GetKeyByQName(const OUString &rQName, OUString *pPrefix, OUString *pLocalName, OUString *pNamespace, QNameMode eMode) const
virtual void SAL_CALL endDocument() override
bool any2bool(const css::uno::Any &rAny)
void SetStylesToRangesFinished()
Definition: xmlimprt.cxx:1334
void SetRangeOverflowType(ErrCode nType)
Definition: xmlimprt.cxx:1738
void SetSheetNamedRanges()
Definition: xmlimprt.cxx:1533
virtual void NotifyEmbeddedFontRead() override
Definition: xmlimprt.cxx:1846
XML_FORMULA
std::unique_ptr< ScXMLChangeTrackingImportHelper > pChangeTrackingImportHelper
Definition: xmlimprt.hxx:211