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