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