LibreOffice Module sc (master)  1
xmlwrap.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 <vcl/errinf.hxx>
21 #include <sfx2/docfile.hxx>
22 #include <sfx2/objsh.hxx>
23 #include <sot/storage.hxx>
24 #include <osl/diagnose.h>
25 #include <comphelper/fileformat.h>
28 #include <svx/dialmgr.hxx>
29 #include <svx/strings.hrc>
30 #include <svx/xmlgrhlp.hxx>
31 #include <svtools/sfxecode.hxx>
32 #include <sfx2/frame.hxx>
33 #include <svl/itemset.hxx>
34 #include <svl/stritem.hxx>
35 #include <sfx2/sfxsids.hrc>
36 #include <com/sun/star/container/XChild.hpp>
37 #include <com/sun/star/beans/XPropertySetInfo.hpp>
38 #include <com/sun/star/xml/sax/InputSource.hpp>
39 #include <com/sun/star/xml/sax/Parser.hpp>
40 #include <com/sun/star/xml/sax/XFastParser.hpp>
41 #include <com/sun/star/xml/sax/Writer.hpp>
42 #include <com/sun/star/xml/sax/SAXParseException.hpp>
43 #include <com/sun/star/frame/XModel.hpp>
44 #include <com/sun/star/beans/PropertyAttribute.hpp>
47 #include <com/sun/star/packages/WrongPasswordException.hpp>
48 #include <com/sun/star/packages/zip/ZipIOException.hpp>
49 #include <com/sun/star/embed/ElementModes.hpp>
50 #include <com/sun/star/script/vba/XVBACompatibility.hpp>
51 #include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
52 #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
53 #include <com/sun/star/task/XStatusIndicator.hpp>
54 
57 #include <svx/xmleohlp.hxx>
58 #include <sal/log.hxx>
59 #include <unotools/saveopt.hxx>
60 #include <tools/diagnose_ex.h>
61 
62 #include <document.hxx>
63 #include <xmlwrap.hxx>
64 #include "xmlimprt.hxx"
65 #include "xmlexprt.hxx"
66 #include <globstr.hrc>
67 #include <scresid.hxx>
68 #include <scerrors.hxx>
69 #include "XMLExportSharedData.hxx"
70 #include <docuno.hxx>
71 #include <drwlayer.hxx>
72 #include <sheetdata.hxx>
73 #include "XMLCodeNameProvider.hxx"
74 #include <docsh.hxx>
75 #include <unonames.hxx>
76 
77 using namespace com::sun::star;
78 using namespace css::uno;
79 
80 ScXMLImportWrapper::ScXMLImportWrapper( ScDocShell& rDocSh, SfxMedium* pM, const uno::Reference < embed::XStorage >& xStor ) :
81  mrDocShell(rDocSh),
82  rDoc(rDocSh.GetDocument()),
83  pMedium(pM),
84  xStorage(xStor)
85 {
86  OSL_ENSURE( pMedium || xStorage.is(), "ScXMLImportWrapper: Medium or Storage must be set" );
87 }
88 
89 uno::Reference <task::XStatusIndicator> ScXMLImportWrapper::GetStatusIndicator() const
90 {
91  uno::Reference<task::XStatusIndicator> xStatusIndicator;
92  if (pMedium)
93  {
94  SfxItemSet* pSet = pMedium->GetItemSet();
95  if (pSet)
96  {
97  const SfxUnoAnyItem* pItem = pSet->GetItem<SfxUnoAnyItem>(SID_PROGRESS_STATUSBAR_CONTROL);
98  if (pItem)
99  xStatusIndicator.set(pItem->GetValue(), uno::UNO_QUERY);
100  }
101  }
102  return xStatusIndicator;
103 }
104 
105 ErrCode ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XComponentContext>& xContext,
106  const uno::Reference<frame::XModel>& xModel,
107  xml::sax::InputSource& aParserInput,
108  const OUString& sComponentName, const OUString& sDocName,
109  const uno::Sequence<uno::Any>& aArgs,
110  bool bMustBeSuccessfull)
111 {
112  uno::Reference < io::XStream > xDocStream;
113  if ( !xStorage.is() && pMedium )
115 
116  bool bEncrypted = false;
117  OUString sStream(sDocName);
118  if( xStorage.is() )
119  {
120  try
121  {
122  if ( xStorage->hasByName(sDocName) && xStorage->isStreamElement( sDocName) )
123  xDocStream = xStorage->openStreamElement( sDocName, embed::ElementModes::READ );
124  else
125  return ERRCODE_NONE;
126 
127  aParserInput.aInputStream = xDocStream->getInputStream();
128  uno::Reference < beans::XPropertySet > xSet( xDocStream, uno::UNO_QUERY );
129 
130  uno::Any aAny = xSet->getPropertyValue("Encrypted");
131  aAny >>= bEncrypted;
132  }
133  catch( const packages::WrongPasswordException& )
134  {
136  }
137  catch( const packages::zip::ZipIOException& )
138  {
140  }
141  catch( const uno::Exception& )
142  {
143  return SCERR_IMPORT_UNKNOWN;
144  }
145  }
146  else
147  return SCERR_IMPORT_UNKNOWN;
148 
149  // set Base URL
150  uno::Reference< beans::XPropertySet > xInfoSet;
151  if( aArgs.hasElements() )
152  aArgs.getConstArray()[0] >>= xInfoSet;
153  OSL_ENSURE( xInfoSet.is(), "missing property set" );
154  if( xInfoSet.is() )
155  {
156  xInfoSet->setPropertyValue( "StreamName", uno::makeAny( sStream ) );
157  }
158 
159  ErrCode nReturn = ERRCODE_NONE;
160  rDoc.SetRangeOverflowType(ERRCODE_NONE); // is modified by the importer if limits are exceeded
161 
162  uno::Reference<XInterface> xImportInterface =
163  xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
164  sComponentName, aArgs, xContext );
165  SAL_WARN_IF( !xImportInterface, "sc", "can't get Calc importer " << sComponentName );
166  uno::Reference<document::XImporter> xImporter( xImportInterface, uno::UNO_QUERY );
167  if (xImporter.is())
168  xImporter->setTargetDocument( xModel );
169 
170  ScXMLImport* pImporterImpl = dynamic_cast<ScXMLImport*>(xImporter.get());
171  if (pImporterImpl)
172  pImporterImpl->SetPostProcessData(&maPostProcessData);
173 
174  // connect parser and filter
175  try
176  {
177  // xImportInterface is either ScXMLImport or an XMLTransformer subclass.
178  // ScXMLImport implements XFastParser, but XMLTransformer only implements XExtendedDocumentHandler
179 
180  uno::Reference< xml::sax::XFastParser > xFastParser(xImportInterface, uno::UNO_QUERY);
181  if (xFastParser)
182  xFastParser->parseStream( aParserInput );
183  else
184  {
185  uno::Reference<xml::sax::XParser> xParser = xml::sax::Parser::create(xContext);
186  uno::Reference<css::xml::sax::XDocumentHandler> xDocumentHandler(xImportInterface, uno::UNO_QUERY);
187  xParser->setDocumentHandler( xDocumentHandler );
188  xParser->parseStream( aParserInput );
189  }
190  }
191  catch( const xml::sax::SAXParseException& r )
192  {
193  css::uno::Any ex( cppu::getCaughtException() );
194  // sax parser sends wrapped exceptions,
195  // try to find the original one
196  xml::sax::SAXException aSaxEx = *static_cast<xml::sax::SAXException const *>(&r);
197  bool bTryChild = true;
198 
199  while( bTryChild )
200  {
201  xml::sax::SAXException aTmp;
202  if ( aSaxEx.WrappedException >>= aTmp )
203  aSaxEx = aTmp;
204  else
205  bTryChild = false;
206  }
207 
208  packages::zip::ZipIOException aBrokenPackage;
209  if ( aSaxEx.WrappedException >>= aBrokenPackage )
211  else if( bEncrypted )
212  nReturn = ERRCODE_SFX_WRONGPASSWORD;
213  else
214  {
215  SAL_WARN("sc.filter", "SAX parse exception caught while importing: " << exceptionToString(ex));
216 
217  OUString sErr = OUString::number( r.LineNumber ) +
218  "," +
219  OUString::number( r.ColumnNumber );
220 
221  if( !sDocName.isEmpty() )
222  {
223  nReturn = *new TwoStringErrorInfo(
224  (bMustBeSuccessfull ? SCERR_IMPORT_FILE_ROWCOL
226  sDocName, sErr,
227  DialogMask::ButtonsOk | DialogMask::MessageError );
228  }
229  else
230  {
231  OSL_ENSURE( bMustBeSuccessfull, "Warnings are not supported" );
232  nReturn = *new StringErrorInfo( SCERR_IMPORT_FORMAT_ROWCOL, sErr,
233  DialogMask::ButtonsOk | DialogMask::MessageError );
234  }
235  }
236  }
237  catch( const xml::sax::SAXException& r )
238  {
239  css::uno::Any ex( cppu::getCaughtException() );
240  packages::zip::ZipIOException aBrokenPackage;
241  if ( r.WrappedException >>= aBrokenPackage )
243  else if( bEncrypted )
244  nReturn = ERRCODE_SFX_WRONGPASSWORD;
245  else
246  {
247  SAL_WARN("sc.filter", "SAX exception caught while importing: " << exceptionToString(ex));
248 
249  nReturn = SCERR_IMPORT_FORMAT;
250  }
251  }
252  catch( const packages::zip::ZipIOException& )
253  {
254  TOOLS_WARN_EXCEPTION("sc.filter", "Zip exception caught while importing");
255 
256  nReturn = ERRCODE_IO_BROKENPACKAGE;
257  }
258  catch( const io::IOException& )
259  {
260  TOOLS_WARN_EXCEPTION("sc.filter", "IO exception caught while importing");
261 
262  nReturn = SCERR_IMPORT_OPEN;
263  }
264  catch( const uno::Exception& )
265  {
266  TOOLS_WARN_EXCEPTION("sc.filter", "uno exception caught while importing");
267 
268  nReturn = SCERR_IMPORT_UNKNOWN;
269  }
270 
271  // #i31130# Can't use getImplementation here to get the ScXMLImport from xDocHandler,
272  // because when OOo 1.x files are loaded, xDocHandler is the OOo2OasisTransformer.
273  // So the overflow warning ErrorCode is now stored in the document.
274  // Export works differently, there getImplementation still works.
275 
276  if (rDoc.HasRangeOverflow() && !nReturn)
277  nReturn = rDoc.GetRangeOverflowType();
278 
279  // success!
280  return nReturn;
281 }
282 
284 {
285  uno::Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
286 
287  xml::sax::InputSource aParserInput;
288  if (pMedium)
289  aParserInput.sSystemId = pMedium->GetName();
290 
291  if ( !xStorage.is() && pMedium )
293 
294  // get filter
295  uno::Reference<frame::XModel> xModel = mrDocShell.GetModel();
296 
298  comphelper::PropertyMapEntry const aImportInfoMap[] =
299  {
300  { OUString("ProgressRange"), 0, ::cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
301  { OUString("ProgressMax"), 0, ::cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
302  { OUString("ProgressCurrent"), 0, ::cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
303  { OUString("NumberStyles"), 0, cppu::UnoType<container::XNameAccess>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
304  { OUString("PrivateData"), 0, cppu::UnoType<uno::XInterface>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
305  { OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
306  { OUString("StreamRelPath"), 0, ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
307  { OUString("StreamName"), 0, ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
308  { OUString("BuildId"), 0, ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
309  { OUString("VBACompatibilityMode"), 0, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
310  { OUString("ScriptConfiguration"), 0, cppu::UnoType<container::XNameAccess>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
311  { OUString("OrganizerMode"), 0, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
312  { OUString("SourceStorage"), 0, cppu::UnoType<embed::XStorage>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
313  { OUString(SC_UNO_ODS_LOCK_SOLAR_MUTEX), 0, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
314  { OUString(SC_UNO_ODS_IMPORT_STYLES), 0, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
315  { OUString(), 0, css::uno::Type(), 0, 0 }
316  };
317  uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aImportInfoMap ) ) );
318 
319  // No need to lock solar mutex when calling from the wrapper.
320  xInfoSet->setPropertyValue(SC_UNO_ODS_LOCK_SOLAR_MUTEX, uno::makeAny(false));
321 
322  // ---- get BuildId from parent container if available
323 
324  uno::Reference< container::XChild > xChild( xModel, uno::UNO_QUERY );
325  if( xChild.is() )
326  {
327  uno::Reference< beans::XPropertySet > xParentSet( xChild->getParent(), uno::UNO_QUERY );
328  if( xParentSet.is() )
329  {
330  uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xParentSet->getPropertySetInfo() );
331  OUString sPropName("BuildId" );
332  if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(sPropName) )
333  {
334  xInfoSet->setPropertyValue( sPropName, xParentSet->getPropertyValue(sPropName) );
335  }
336  }
337  }
338 
339  uno::Reference<task::XStatusIndicator> xStatusIndicator = GetStatusIndicator();
340  if (xStatusIndicator.is())
341  {
342  sal_Int32 nProgressRange(1000000);
343  xStatusIndicator->start(SvxResId(RID_SVXSTR_DOC_LOAD), nProgressRange);
344  xInfoSet->setPropertyValue("ProgressRange", uno::makeAny(nProgressRange));
345  }
346 
347  // Set base URI
348  OSL_ENSURE( pMedium, "There is no medium to get MediaDescriptor from!" );
349  OUString aBaseURL = pMedium ? pMedium->GetBaseURL() : OUString();
350  // needed for relative URLs, but in clipboard copy/paste there may be none
351  SAL_INFO_IF(aBaseURL.isEmpty(), "sc.filter", "ScXMLImportWrapper: no base URL");
352  OUString sPropName("BaseURI");
353  xInfoSet->setPropertyValue( sPropName, uno::makeAny( aBaseURL ) );
354 
355  // TODO/LATER: do not do it for embedded links
356  OUString aName;
357  if (SfxObjectCreateMode::EMBEDDED == mrDocShell.GetCreateMode())
358  {
359  if ( pMedium && pMedium->GetItemSet() )
360  {
361  const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>(
362  pMedium->GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) );
363  if ( pDocHierarchItem )
364  aName = pDocHierarchItem->GetValue();
365  }
366  else
367  aName = "dummyObjectName";
368 
369  if( !aName.isEmpty() )
370  {
371  sPropName = "StreamRelPath";
372  xInfoSet->setPropertyValue( sPropName, uno::makeAny( aName ) );
373  }
374  }
375 
376  if (mrDocShell.GetCreateMode() == SfxObjectCreateMode::ORGANIZER)
377  xInfoSet->setPropertyValue("OrganizerMode", uno::makeAny(true));
378 
379  xInfoSet->setPropertyValue( "SourceStorage", uno::Any( xStorage ) );
380 
382 
383  if ((nMode & ImportFlags::Metadata) && bOasis)
384  {
385  // RDF metadata: ODF >= 1.2
386  try
387  {
388  const uno::Reference< rdf::XDocumentMetadataAccess > xDMA(
389  xModel, uno::UNO_QUERY_THROW );
390  const uno::Reference< rdf::XURI > xBaseURI(
391  ::sfx2::createBaseURI( xContext, xModel, aBaseURL, aName ) );
392  uno::Reference<task::XInteractionHandler> xHandler =
394  xDMA->loadMetadataFromStorage( xStorage, xBaseURI, xHandler );
395  }
396  catch ( const lang::WrappedTargetException & e)
397  {
398  ucb::InteractiveAugmentedIOException iaioe;
399  if ( e.TargetException >>= iaioe )
400  {
401  rError = SCERR_IMPORT_UNKNOWN;
402  }
403  else
404  {
406  }
407  }
408  catch ( const uno::Exception &)
409  {
411  }
412  }
413 
414  // #i103539#: always read meta.xml for generator
415  ErrCode nMetaRetval(ERRCODE_NONE);
416  if (nMode & ImportFlags::Metadata)
417  {
418  uno::Sequence<uno::Any> aMetaArgs(1);
419  uno::Any* pMetaArgs = aMetaArgs.getArray();
420  pMetaArgs[0] <<= xInfoSet;
421 
422  SAL_INFO( "sc.filter", "meta import start" );
423 
424  nMetaRetval = ImportFromComponent(
425  xContext, xModel, aParserInput,
426  bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisMetaImporter")
427  : OUString("com.sun.star.comp.Calc.XMLMetaImporter"),
428  "meta.xml", aMetaArgs, false);
429 
430  SAL_INFO( "sc.filter", "meta import end" );
431  }
432 
433  rtl::Reference<SvXMLGraphicHelper> xGraphicHelper;
434  uno::Reference<document::XGraphicStorageHandler> xGraphicStorageHandler;
435 
436  uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
438 
439  if( xStorage.is() )
440  {
441  xGraphicHelper = SvXMLGraphicHelper::Create( xStorage, SvXMLGraphicHelperMode::Read );
442  xGraphicStorageHandler = xGraphicHelper.get();
443 
444  xObjectHelper = SvXMLEmbeddedObjectHelper::Create(xStorage, mrDocShell, SvXMLEmbeddedObjectHelperMode::Read);
445  xObjectResolver = xObjectHelper.get();
446  }
447  uno::Sequence<uno::Any> aStylesArgs(4);
448  uno::Any* pStylesArgs = aStylesArgs.getArray();
449  pStylesArgs[0] <<= xInfoSet;
450  pStylesArgs[1] <<= xGraphicStorageHandler;
451  pStylesArgs[2] <<= xStatusIndicator;
452  pStylesArgs[3] <<= xObjectResolver;
453 
454  ErrCode nSettingsRetval(ERRCODE_NONE);
455  if (nMode & ImportFlags::Settings)
456  {
457  // Settings must be loaded first because of the printer setting,
458  // which is needed in the page styles (paper tray).
459 
460  uno::Sequence<uno::Any> aSettingsArgs(1);
461  uno::Any* pSettingsArgs = aSettingsArgs.getArray();
462  pSettingsArgs[0] <<= xInfoSet;
463 
464  SAL_INFO( "sc.filter", "settings import start" );
465 
466  nSettingsRetval = ImportFromComponent(
467  xContext, xModel, aParserInput,
468  bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisSettingsImporter")
469  : OUString("com.sun.star.comp.Calc.XMLSettingsImporter"),
470  "settings.xml", aSettingsArgs, false);
471 
472  SAL_INFO( "sc.filter", "settings import end" );
473  }
474 
475  ErrCode nStylesRetval(ERRCODE_NONE);
476  if (nMode & ImportFlags::Styles)
477  {
478  SAL_INFO( "sc.filter", "styles import start" );
479 
480  nStylesRetval = ImportFromComponent(xContext, xModel, aParserInput,
481  bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisStylesImporter")
482  : OUString("com.sun.star.comp.Calc.XMLStylesImporter"),
483  "styles.xml",
484  aStylesArgs, true);
485 
486  SAL_INFO( "sc.filter", "styles import end" );
487  }
488 
489  ErrCode nDocRetval(ERRCODE_NONE);
490  if (nMode & ImportFlags::Content)
491  {
492  if (mrDocShell.GetCreateMode() == SfxObjectCreateMode::INTERNAL)
493  // We only need to import content for external link cache document.
494  xInfoSet->setPropertyValue(SC_UNO_ODS_IMPORT_STYLES, uno::makeAny(false));
495 
496  uno::Sequence<uno::Any> aDocArgs(4);
497  uno::Any* pDocArgs = aDocArgs.getArray();
498  pDocArgs[0] <<= xInfoSet;
499  pDocArgs[1] <<= xGraphicStorageHandler;
500  pDocArgs[2] <<= xStatusIndicator;
501  pDocArgs[3] <<= xObjectResolver;
502 
503  SAL_INFO( "sc.filter", "content import start" );
504 
505  nDocRetval = ImportFromComponent(xContext, xModel, aParserInput,
506  bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisContentImporter")
507  : OUString("com.sun.star.comp.Calc.XMLContentImporter"),
508  "content.xml",
509  aDocArgs,
510  true);
511 
512  SAL_INFO( "sc.filter", "content import end" );
513  }
514  if( xGraphicHelper.is() )
515  xGraphicHelper->dispose();
516  xGraphicHelper.clear();
517 
518  if( xObjectHelper.is() )
519  xObjectHelper->dispose();
520  xObjectHelper.clear();
521 
522  if (xStatusIndicator.is())
523  xStatusIndicator->end();
524 
525  bool bRet = false;
526  if (nDocRetval)
527  {
528  rError = nDocRetval;
529  if (nDocRetval == SCWARN_IMPORT_RANGE_OVERFLOW ||
530  nDocRetval == SCWARN_IMPORT_ROW_OVERFLOW ||
531  nDocRetval == SCWARN_IMPORT_COLUMN_OVERFLOW ||
532  nDocRetval == SCWARN_IMPORT_SHEET_OVERFLOW)
533  bRet = true;
534  }
535  else if (nStylesRetval)
536  rError = nStylesRetval;
537  else if (nMetaRetval)
538  rError = nMetaRetval;
539  else if (nSettingsRetval)
540  rError = nSettingsRetval;
541  else
542  bRet = true;
543 
544  // set BuildId on XModel for later OLE object loading
545  if( xInfoSet.is() )
546  {
547  uno::Reference< beans::XPropertySet > xModelSet( xModel, uno::UNO_QUERY );
548  if( xModelSet.is() )
549  {
550  uno::Reference< beans::XPropertySetInfo > xModelSetInfo( xModelSet->getPropertySetInfo() );
551  OUString sBuildPropName("BuildId" );
552  if( xModelSetInfo.is() && xModelSetInfo->hasPropertyByName(sBuildPropName) )
553  {
554  xModelSet->setPropertyValue( sBuildPropName, xInfoSet->getPropertyValue(sBuildPropName) );
555  }
556  }
557 
558  // Set Code Names
559  uno::Any aAny = xInfoSet->getPropertyValue("ScriptConfiguration");
560  uno::Reference <container::XNameAccess> xCodeNameAccess;
561  if( aAny >>= xCodeNameAccess )
562  XMLCodeNameProvider::set( xCodeNameAccess, &rDoc );
563 
564  // VBA compatibility
565  bool bVBACompat = false;
566  if ( (xInfoSet->getPropertyValue("VBACompatibilityMode") >>= bVBACompat) && bVBACompat )
567  {
568  /* Set library container to VBA compatibility mode, this
569  forces loading the Basic project, which in turn creates the
570  VBA Globals object and does all related initialization. */
571  if ( xModelSet.is() ) try
572  {
573  uno::Reference< script::vba::XVBACompatibility > xVBACompat( xModelSet->getPropertyValue(
574  "BasicLibraries" ), uno::UNO_QUERY_THROW );
575  xVBACompat->setVBACompatibilityMode( true );
576  }
577  catch( const uno::Exception& )
578  {
579  }
580  }
581  }
582 
583  // Don't test bStylesRetval and bMetaRetval, because it could be an older file which not contain such streams
584  return bRet;
585 }
586 
587 static bool lcl_HasValidStream(const ScDocument& rDoc)
588 {
589  SfxObjectShell* pObjSh = rDoc.GetDocumentShell();
590  if ( pObjSh->IsDocShared() )
591  return false; // never copy stream from shared file
592 
593  // don't read remote file again
594  // (could instead re-use medium directly in that case)
595  SfxMedium* pSrcMed = rDoc.GetDocumentShell()->GetMedium();
596  if ( !pSrcMed || pSrcMed->IsRemote() )
597  return false;
598 
599  SCTAB nTabCount = rDoc.GetTableCount();
600  for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
601  if (rDoc.IsStreamValid(nTab))
602  return true;
603  return false;
604 }
605 
606 bool ScXMLImportWrapper::ExportToComponent(const uno::Reference<uno::XComponentContext>& xContext,
607  const uno::Reference<frame::XModel>& xModel, const uno::Reference<xml::sax::XWriter>& xWriter,
608  const uno::Sequence<beans::PropertyValue>& aDescriptor, const OUString& sName,
609  const OUString& sMediaType, const OUString& sComponentName,
610  const uno::Sequence<uno::Any>& aArgs, std::unique_ptr<ScMySharedData>& pSharedData)
611 {
612  bool bRet(false);
613  uno::Reference<io::XOutputStream> xOut;
614  uno::Reference<io::XStream> xStream;
615 
616  if ( !xStorage.is() && pMedium )
618 
619  if( xStorage.is() )
620  {
621  // #96807#; trunc stream before use, because it could be an existing stream
622  // and the new content could be shorter than the old content. In this case
623  // would not all be over written by the new content and the xml file
624  // would not be valid.
625  xStream = xStorage->openStreamElement( sName, embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
626  uno::Reference < beans::XPropertySet > xSet( xStream, uno::UNO_QUERY );
627  if (xSet.is())
628  {
629  xSet->setPropertyValue("MediaType", uno::makeAny(sMediaType));
630 
631  // advise storage impl to use common encryption
632  xSet->setPropertyValue( "UseCommonStoragePasswordEncryption", uno::makeAny(true) );
633  }
634 
635  xOut = xStream->getOutputStream();
636  }
637 
638  // set Base URL
639  uno::Reference< beans::XPropertySet > xInfoSet;
640  if( aArgs.hasElements() )
641  aArgs.getConstArray()[0] >>= xInfoSet;
642  OSL_ENSURE( xInfoSet.is(), "missing property set" );
643  if( xInfoSet.is() )
644  {
645  xInfoSet->setPropertyValue( "StreamName", uno::makeAny( sName ) );
646  }
647 
648  xWriter->setOutputStream( xOut );
649 
650  uno::Reference<document::XFilter> xFilter(
651  xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
652  sComponentName , aArgs, xContext ),
653  uno::UNO_QUERY );
654  OSL_ENSURE( xFilter.is(), "can't get exporter" );
655  uno::Reference<document::XExporter> xExporter( xFilter, uno::UNO_QUERY );
656  if (xExporter.is())
657  xExporter->setSourceDocument( xModel );
658 
659  if ( xFilter.is() )
660  {
661  ScXMLExport* pExport = static_cast<ScXMLExport*>(comphelper::getUnoTunnelImplementation<SvXMLExport>(xFilter));
662  pExport->SetSharedData(std::move(pSharedData));
663 
664  // if there are sheets to copy, get the source stream
665  if ( sName == "content.xml" && lcl_HasValidStream(rDoc) && ( pExport->getExportFlags() & SvXMLExportFlags::OASIS ) )
666  {
667  // old stream is still in this file's storage - open read-only
668 
669  // #i106854# use the document's storage directly, without a temporary SfxMedium
670  uno::Reference<embed::XStorage> xTmpStorage = rDoc.GetDocumentShell()->GetStorage();
671  uno::Reference<io::XStream> xSrcStream;
672  uno::Reference<io::XInputStream> xSrcInput;
673 
674  // #i108978# If an embedded object is saved and no events are notified, don't use the stream
675  // because without the ...DONE events, stream positions aren't updated.
676  ScSheetSaveData* pSheetData = comphelper::getUnoTunnelImplementation<ScModelObj>(xModel)->GetSheetSaveData();
677  if (pSheetData && pSheetData->IsInSupportedSave())
678  {
679  try
680  {
681  if (xTmpStorage.is())
682  xSrcStream = xTmpStorage->openStreamElement( sName, embed::ElementModes::READ );
683  if (xSrcStream.is())
684  xSrcInput = xSrcStream->getInputStream();
685  }
686  catch ( const uno::Exception&)
687  {
688  // stream not available (for example, password protected) - save normally (xSrcInput is null)
689  }
690  }
691 
692  pExport->SetSourceStream( xSrcInput );
693  bRet = xFilter->filter( aDescriptor );
694  pExport->SetSourceStream( uno::Reference<io::XInputStream>() );
695 
696  // If there was an error, reset all stream flags, so the next save attempt will use normal saving.
697  // #i110692# For embedded objects, the stream may be unavailable for one save operation (m_pAntiImpl)
698  // and become available again later. But after saving normally once, the stream positions aren't
699  // valid anymore, so the flags also have to be reset if the stream wasn't available.
700  if ( !bRet || !xSrcInput.is() )
701  {
702  SCTAB nTabCount = rDoc.GetTableCount();
703  for (SCTAB nTab=0; nTab<nTabCount; nTab++)
704  rDoc.SetStreamValid(nTab, false);
705  }
706  }
707  else
708  bRet = xFilter->filter( aDescriptor );
709 
710  pSharedData = pExport->ReleaseSharedData();
711  }
712 
713  return bRet;
714 }
715 
716 bool ScXMLImportWrapper::Export(bool bStylesOnly)
717 {
718  // Prevent all broadcasting and repaints and notification of accessibility
719  // during mass creation of captions, which is a major bottleneck and not
720  // needed during Save.
721  ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
722  bool bOldLock = bool();
723  if (pDrawLayer)
724  {
725  bOldLock = pDrawLayer->isLocked();
726  pDrawLayer->setLock(true);
727  }
728 
730 
731  if (pDrawLayer)
732  pDrawLayer->setLock(bOldLock);
733 
734  uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
735 
736  uno::Reference<xml::sax::XWriter> xWriter = xml::sax::Writer::create(xContext);
737 
738  if ( !xStorage.is() && pMedium )
740 
741  OUString sFileName;
742  if (pMedium)
743  sFileName = pMedium->GetName();
745  uno::Sequence<beans::PropertyValue> aDescriptor( comphelper::InitPropertySequence({
746  { "FileName", uno::Any(sFileName) }
747  }));
748 
750  comphelper::PropertyMapEntry const aExportInfoMap[] =
751  {
752  { OUString("ProgressRange"), 0, ::cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
753  { OUString("ProgressMax"), 0, ::cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
754  { OUString("ProgressCurrent"), 0, ::cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
755  { OUString("WrittenNumberStyles"), 0, cppu::UnoType<uno::Sequence<sal_Int32>>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
756  { OUString("UsePrettyPrinting"), 0, ::cppu::UnoType<sal_Bool>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0},
757  { OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
758  { OUString("StreamRelPath"), 0, ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
759  { OUString("StreamName"), 0, ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
760  { OUString("StyleNames"), 0, cppu::UnoType<uno::Sequence<OUString>>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
761  { OUString("StyleFamilies"), 0, cppu::UnoType<uno::Sequence<sal_Int32>>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
762  { OUString("TargetStorage"), 0, cppu::UnoType<embed::XStorage>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
763  { OUString(), 0, css::uno::Type(), 0, 0 }
764  };
765  uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
766 
767  if ( pObjSh && xStorage.is() )
768  {
769  uno::Reference<frame::XModel> xModel(pObjSh->GetModel());
770  uno::Reference<task::XStatusIndicator> xStatusIndicator(GetStatusIndicator());
771  sal_Int32 nProgressRange(1000000);
772  if(xStatusIndicator.is())
773  xStatusIndicator->start(ScResId(STR_SAVE_DOC), nProgressRange);
774  xInfoSet->setPropertyValue("ProgressRange", uno::makeAny(nProgressRange));
775 
776  SvtSaveOptions aSaveOpt;
777  bool bUsePrettyPrinting(aSaveOpt.IsPrettyPrinting());
778  xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(bUsePrettyPrinting));
779 
780  xInfoSet->setPropertyValue( "TargetStorage", uno::Any( xStorage ) );
781 
782  OSL_ENSURE( pMedium, "There is no medium to get MediaDescriptor from!" );
783  OUString aBaseURL = pMedium ? pMedium->GetBaseURL( true ) : OUString();
784  OUString sPropName("BaseURI");
785  xInfoSet->setPropertyValue( sPropName, uno::makeAny( aBaseURL ) );
786 
787  // TODO/LATER: do not do it for embedded links
788  if( SfxObjectCreateMode::EMBEDDED == pObjSh->GetCreateMode() )
789  {
790  OUString aName("dummyObjectName");
791  if ( pMedium && pMedium->GetItemSet() )
792  {
793  const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>(
794  pMedium->GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) );
795  if ( pDocHierarchItem )
796  aName = pDocHierarchItem->GetValue();
797  }
798 
799  if( !aName.isEmpty() )
800  {
801  sPropName = "StreamRelPath";
802  xInfoSet->setPropertyValue( sPropName, uno::makeAny( aName ) );
803  }
804  }
805 
806  OUString sTextMediaType("text/xml");
807  bool bMetaRet(pObjSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED);
808  bool bStylesRet (false);
809  bool bDocRet(false);
810  bool bSettingsRet(false);
811  std::unique_ptr<ScMySharedData> pSharedData;
812 
814 
815  // RDF metadata: ODF >= 1.2
816  if ( !bStylesOnly && bOasis )
817  {
818  const uno::Reference< beans::XPropertySet > xPropSet( xStorage, uno::UNO_QUERY_THROW );
819  try
820  {
821  OUString aVersion;
822  if (( xPropSet->getPropertyValue("Version") >>= aVersion )
823  && aVersion != ODFVER_010_TEXT
824  && aVersion != ODFVER_011_TEXT )
825  {
826  const uno::Reference< rdf::XDocumentMetadataAccess > xDMA(
827  xModel, uno::UNO_QUERY_THROW );
828  xDMA->storeMetadataToStorage( xStorage );
829  }
830  }
831  catch ( const beans::UnknownPropertyException &)
832  {
833  }
834  catch ( const uno::Exception &)
835  {
836  }
837  }
838 
839  // meta export
840  if (!bStylesOnly && !bMetaRet)
841  {
842  uno::Sequence<uno::Any> aMetaArgs(3);
843  uno::Any* pMetaArgs = aMetaArgs.getArray();
844  pMetaArgs[0] <<= xInfoSet;
845  pMetaArgs[1] <<= xWriter;
846  pMetaArgs[2] <<= xStatusIndicator;
847 
848  SAL_INFO( "sc.filter", "meta export start" );
849 
850  bMetaRet = ExportToComponent(xContext, xModel, xWriter, aDescriptor,
851  "meta.xml",
852  sTextMediaType,
853  bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisMetaExporter")
854  : OUString("com.sun.star.comp.Calc.XMLMetaExporter"),
855  aMetaArgs, pSharedData);
856 
857  SAL_INFO( "sc.filter", "meta export end" );
858  }
859 
860  uno::Reference<document::XGraphicStorageHandler> xGraphicStorageHandler;
861  rtl::Reference<SvXMLGraphicHelper> xGraphicHelper;
862 
863  if( xStorage.is() )
864  {
865  xGraphicHelper = SvXMLGraphicHelper::Create( xStorage, SvXMLGraphicHelperMode::Write );
866  xGraphicStorageHandler = xGraphicHelper.get();
867  }
868 
869  auto xObjectHelper = SvXMLEmbeddedObjectHelper::Create(
870  xStorage, *pObjSh, SvXMLEmbeddedObjectHelperMode::Write);
871  uno::Reference<document::XEmbeddedObjectResolver> xObjectResolver(xObjectHelper.get());
872 
873  // styles export
874 
875  {
876  uno::Sequence<uno::Any> aStylesArgs(5);
877  uno::Any* pStylesArgs = aStylesArgs.getArray();
878  pStylesArgs[0] <<= xInfoSet;
879  pStylesArgs[1] <<= xGraphicStorageHandler;
880  pStylesArgs[2] <<= xStatusIndicator;
881  pStylesArgs[3] <<= xWriter;
882  pStylesArgs[4] <<= xObjectResolver;
883 
884  SAL_INFO( "sc.filter", "styles export start" );
885 
886  bStylesRet = ExportToComponent(xContext, xModel, xWriter, aDescriptor,
887  "styles.xml",
888  sTextMediaType,
889  bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisStylesExporter")
890  : OUString("com.sun.star.comp.Calc.XMLStylesExporter"),
891  aStylesArgs, pSharedData);
892 
893  SAL_INFO( "sc.filter", "styles export end" );
894  }
895 
896  // content export
897 
898  if (!bStylesOnly)
899  {
900  uno::Sequence<uno::Any> aDocArgs(5);
901  uno::Any* pDocArgs = aDocArgs.getArray();
902  pDocArgs[0] <<= xInfoSet;
903  pDocArgs[1] <<= xGraphicStorageHandler;
904  pDocArgs[2] <<= xStatusIndicator;
905  pDocArgs[3] <<= xWriter;
906  pDocArgs[4] <<= xObjectResolver;
907 
908  SAL_INFO( "sc.filter", "content export start" );
909 
910  bDocRet = ExportToComponent(xContext, xModel, xWriter, aDescriptor,
911  "content.xml",
912  sTextMediaType,
913  bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisContentExporter")
914  : OUString("com.sun.star.comp.Calc.XMLContentExporter"),
915  aDocArgs, pSharedData);
916 
917  SAL_INFO( "sc.filter", "content export end" );
918  }
919 
920  if( xGraphicHelper )
921  xGraphicHelper->dispose();
922  xGraphicHelper.clear();
923 
924  if( xObjectHelper )
925  xObjectHelper->dispose();
926  xObjectHelper.clear();
927 
928  // settings export
929 
930  if (!bStylesOnly)
931  {
932  uno::Sequence<uno::Any> aSettingsArgs(3);
933  uno::Any* pSettingsArgs = aSettingsArgs.getArray();
934  pSettingsArgs[0] <<= xInfoSet;
935  pSettingsArgs[1] <<= xWriter;
936  pSettingsArgs[2] <<= xStatusIndicator;
937 
938  SAL_INFO( "sc.filter", "settings export start" );
939 
940  bSettingsRet = ExportToComponent(xContext, xModel, xWriter, aDescriptor,
941  "settings.xml",
942  sTextMediaType,
943  bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisSettingsExporter")
944  : OUString("com.sun.star.comp.Calc.XMLSettingsExporter"),
945  aSettingsArgs, pSharedData);
946 
947  SAL_INFO( "sc.filter", "settings export end" );
948  }
949 
950  pSharedData.reset();
951 
952  if (xStatusIndicator.is())
953  xStatusIndicator->end();
954  return bStylesRet && ((!bStylesOnly && bDocRet && bMetaRet && bSettingsRet) || bStylesOnly);
955  }
956 
957  // later: give string descriptor as parameter for doc type
958 
959  return false;
960 }
961 
962 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
char const sStream[]
std::unique_ptr< ScMySharedData > ReleaseSharedData()
Definition: xmlexprt.cxx:5444
static bool lcl_HasValidStream(const ScDocument &rDoc)
Definition: xmlwrap.cxx:587
#define ODFVER_011_TEXT
#define SCERR_IMPORT_FORMAT_ROWCOL
Definition: scerrors.hxx:49
#define SC_UNO_ODS_LOCK_SOLAR_MUTEX
Definition: unonames.hxx:700
bool Import(ImportFlags nMode, ErrCode &rError)
Definition: xmlwrap.cxx:283
sal_Int32 GetVersion() const
#define ERRCODE_SFX_WRONGPASSWORD
const OUString & GetName() const
#define SAL_INFO_IF(condition, area, stream)
void SetSharedData(std::unique_ptr< ScMySharedData > pTemp)
Definition: xmlexprt.cxx:5442
#define SCWARN_IMPORT_RANGE_OVERFLOW
Definition: scerrors.hxx:62
css::uno::Reference< css::frame::XModel > GetModel() const
ImportFlags
Definition: xmlwrap.hxx:45
css::uno::Reference< css::embed::XStorage > const & GetStorage()
Reference< XInputStream > xStream
OUString SvxResId(const char *pId)
Any SAL_CALL getCaughtException()
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:312
bool isLocked() const
static void set(const css::uno::Reference< css::container::XNameAccess > &xNameAccess, ScDocument *pDoc)
bool IsDocShared() const
void SetSourceStream(const css::uno::Reference< css::io::XInputStream > &xNewStream)
Definition: xmlexprt.cxx:433
ErrCode ImportFromComponent(const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel > &xModel, css::xml::sax::InputSource &aParserInput, const OUString &sComponentName, const OUString &sDocName, const css::uno::Sequence< css::uno::Any > &aArgs, bool bMustBeSuccessfull)
Definition: xmlwrap.cxx:105
const css::uno::Any & GetValue() const
sc::ImportPostProcessData maPostProcessData
Definition: xmlwrap.hxx:60
SfxObjectCreateMode GetCreateMode() const
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
css::uno::Reference< css::task::XInteractionHandler > GetInteractionHandler(bool bGetAlways=false)
bool IsStreamValid(SCTAB nTab) const
Definition: document.cxx:915
bool IsPrettyPrinting() const
ScDocument & rDoc
Definition: xmlwrap.hxx:63
#define SCWARN_IMPORT_FEATURES_LOST
Definition: scerrors.hxx:67
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1056
#define SOFFICE_FILEFORMAT_60
#define TOOLS_WARN_EXCEPTION(area, stream)
void SetPostProcessData(sc::ImportPostProcessData *p)
Definition: xmlimprt.cxx:308
css::uno::Reference< css::embed::XStorage > xStorage
Definition: xmlwrap.hxx:65
static rtl::Reference< SvXMLEmbeddedObjectHelper > Create(const css::uno::Reference< css::embed::XStorage > &,::comphelper::IEmbeddedHelper &rDocPersist, SvXMLEmbeddedObjectHelperMode eCreateMode)
COMPHELPER_DLLPUBLIC css::uno::Reference< css::beans::XPropertySet > GenericPropertySet_CreateInstance(PropertySetInfo *pInfo)
const OUString & GetValue() const
bool HasRangeOverflow() const
Definition: document.hxx:2126
OUString ScResId(const char *pId)
Definition: scdll.cxx:89
#define SC_UNO_ODS_IMPORT_STYLES
Definition: unonames.hxx:701
OUString GetBaseURL(bool bForSaving=false)
SfxItemSet * GetItemSet() const
css::uno::Type const & get()
#define SCERR_IMPORT_UNKNOWN
Definition: scerrors.hxx:28
#define SCERR_IMPORT_OPEN
Definition: scerrors.hxx:27
OString exceptionToString(const css::uno::Any &caught)
#define ODFVER_010_TEXT
#define ERRCODE_IO_BROKENPACKAGE
void SetRangeOverflowType(ErrCode nType)
Definition: document.hxx:2125
void CreateAllNoteCaptions()
Ensure that all note objects have an associated sdr object.
Definition: document.cxx:6615
void setLock(bool bLock)
SfxMedium * pMedium
Definition: xmlwrap.hxx:64
void SetStreamValid(SCTAB nTab, bool bSet, bool bIgnoreLock=false)
Definition: document.cxx:923
css::uno::Reference< css::embed::XStorage > GetStorage(bool bCreateTempFile=true)
#define SAL_WARN_IF(condition, area, stream)
#define ERRCODE_NONE
bool IsRemote() const
#define SCWARN_IMPORT_SHEET_OVERFLOW
Definition: scerrors.hxx:65
#define SCWARN_IMPORT_ROW_OVERFLOW
Definition: scerrors.hxx:63
#define SAL_INFO(area, stream)
OUString aName
#define SCWARN_IMPORT_FILE_ROWCOL
Definition: scerrors.hxx:50
SC_DLLPUBLIC const ErrCode & GetRangeOverflowType() const
Definition: document.hxx:2127
Reference< XComponentContext > getProcessComponentContext()
#define SCERR_IMPORT_FORMAT
Definition: scerrors.hxx:34
css::uno::Reference< css::embed::XStorage > GetOutputStorage()
#define SCWARN_IMPORT_COLUMN_OVERFLOW
Definition: scerrors.hxx:64
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1055
#define SAL_WARN(area, stream)
Reference< XModel > xModel
css::uno::Reference< css::task::XStatusIndicator > GetStatusIndicator() const
Definition: xmlwrap.cxx:89
static rtl::Reference< SvXMLGraphicHelper > Create(const css::uno::Reference< css::embed::XStorage > &rXMLStorage, SvXMLGraphicHelperMode eCreateMode)
uno::Reference< rdf::XURI > createBaseURI(uno::Reference< uno::XComponentContext > const &i_xContext, uno::Reference< frame::XModel > const &i_xModel, OUString const &i_rPkgURI, OUString const &i_rSubDocument)
bool ExportToComponent(const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel > &xModel, const css::uno::Reference< css::xml::sax::XWriter > &xWriter, const css::uno::Sequence< css::beans::PropertyValue > &aDescriptor, const OUString &sName, const OUString &sMediaType, const OUString &sComponentName, const css::uno::Sequence< css::uno::Any > &aArgs, std::unique_ptr< ScMySharedData > &pSharedData)
Definition: xmlwrap.cxx:606
bool IsInSupportedSave() const
Definition: sheetdata.hxx:171
ScXMLImportWrapper(ScDocShell &rDocSh, SfxMedium *pM, const css::uno::Reference< css::embed::XStorage > &xStor)
Definition: xmlwrap.cxx:80
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
bool Export(bool bStylesOnly)
Definition: xmlwrap.cxx:716
SvXMLExportFlags getExportFlags() const
ScDocShell & mrDocShell
Definition: xmlwrap.hxx:62
sal_Int16 SCTAB
Definition: types.hxx:23
#define SCERR_IMPORT_FILE_ROWCOL
Definition: scerrors.hxx:48
SfxMedium * GetMedium() const