LibreOffice Module sc (master) 1
excel.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 <sfx2/docfile.hxx>
21#include <sfx2/frame.hxx>
22#include <sfx2/sfxsids.hrc>
23#include <sot/storage.hxx>
24#include <sot/exchange.hxx>
25#include <svl/intitem.hxx>
27#include <tools/globname.hxx>
28#include <com/sun/star/document/UpdateDocMode.hpp>
29#include <com/sun/star/packages/XPackageEncryption.hpp>
30#include <com/sun/star/ucb/ContentCreationException.hpp>
31#include <com/sun/star/uno/XComponentContext.hpp>
35#include <osl/diagnose.h>
36#include <filter.hxx>
37#include <document.hxx>
38#include <xistream.hxx>
39#include <xltools.hxx>
40#include <docoptio.hxx>
43
44#include <docsh.hxx>
45#include <scerrors.hxx>
46#include <imp_op.hxx>
47#include <excimp8.hxx>
48#include <exp_op.hxx>
49#include <scdll.hxx>
50
51#include <memory>
52
53using namespace css;
54
55static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHashMap& aStreamsData, std::u16string_view sPrefix)
56{
57 SvStorageInfoList aElements;
58 pStorage->FillInfoList(&aElements);
59 for (const auto & aElement : aElements)
60 {
61 OUString sStreamFullName = sPrefix.size() ? OUString::Concat(sPrefix) + "/" + aElement.GetName() : aElement.GetName();
62 if (aElement.IsStorage())
63 {
64 tools::SvRef<SotStorage> xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL);
65 lcl_getListOfStreams(xSubStorage.get(), aStreamsData, sStreamFullName);
66 }
67 else
68 {
69 // Read stream
70 tools::SvRef<SotStorageStream> rStream = pStorage->OpenSotStream(aElement.GetName(), StreamMode::READ | StreamMode::SHARE_DENYALL);
71 if (rStream.is())
72 {
73 sal_Int32 nStreamSize = rStream->GetSize();
74 uno::Sequence< sal_Int8 > oData;
75 oData.realloc(nStreamSize);
76 sal_Int32 nReadBytes = rStream->ReadBytes(oData.getArray(), nStreamSize);
77 if (nStreamSize == nReadBytes)
78 aStreamsData[sStreamFullName] <<= oData;
79 }
80 }
81 }
82}
83
84static tools::SvRef<SotStorage> lcl_DRMDecrypt(const SfxMedium& rMedium, const tools::SvRef<SotStorage>& rStorage, std::shared_ptr<SvStream>& rNewStorageStrm)
85{
86 tools::SvRef<SotStorage> aNewStorage;
87
88 // We have DRM encrypted storage. We should try to decrypt it first, if we can
89 uno::Sequence< uno::Any > aArguments;
90 uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
91 uno::Reference< packages::XPackageEncryption > xPackageEncryption(
92 xComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext(
93 "com.sun.star.comp.oox.crypto.DRMDataSpace", aArguments, xComponentContext), uno::UNO_QUERY);
94
95 if (!xPackageEncryption.is())
96 {
97 // We do not know how to decrypt this
98 return aNewStorage;
99 }
100
102 lcl_getListOfStreams(rStorage.get(), aStreamsData, u"");
103
104 try {
105 uno::Sequence<beans::NamedValue> aStreams = aStreamsData.getAsConstNamedValueList();
106 if (!xPackageEncryption->readEncryptionInfo(aStreams))
107 {
108 // We failed with decryption
109 return aNewStorage;
110 }
111
112 tools::SvRef<SotStorageStream> rContentStream = rStorage->OpenSotStream("\011DRMContent", StreamMode::READ | StreamMode::SHARE_DENYALL);
113 if (!rContentStream.is())
114 {
115 return aNewStorage;
116 }
117
118 rNewStorageStrm = std::make_shared<SvMemoryStream>();
119
120 uno::Reference<io::XInputStream > xInputStream(new utl::OSeekableInputStreamWrapper(rContentStream.get(), false));
121 uno::Reference<io::XOutputStream > xDecryptedStream(new utl::OSeekableOutputStreamWrapper(*rNewStorageStrm));
122
123 if (!xPackageEncryption->decrypt(xInputStream, xDecryptedStream))
124 {
125 // We failed with decryption
126 return aNewStorage;
127 }
128
129 rNewStorageStrm->Seek(0);
130
131 // Further reading is done from new document
132 aNewStorage = new SotStorage(*rNewStorageStrm);
133
134 // Set the media descriptor data
135 uno::Sequence<beans::NamedValue> aEncryptionData = xPackageEncryption->createEncryptionData("");
136 rMedium.GetItemSet().Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, uno::Any(aEncryptionData)));
137 }
138 catch (const std::exception&)
139 {
140 return aNewStorage;
141 }
142
143 return aNewStorage;
144}
145
147{
148 // check the passed Calc document
149 OSL_ENSURE( pDocument, "::ScImportExcel - no document" );
150 if( !pDocument ) return SCERR_IMPORT_INTERNAL; // should not happen
151
152 /* Import all BIFF versions regardless on eFormat, needed for import of
153 external cells (file type detection returns Excel4.0). */
154 if( (eFormat != EIF_AUTO) && (eFormat != EIF_BIFF_LE4) && (eFormat != EIF_BIFF5) && (eFormat != EIF_BIFF8) )
155 {
156 OSL_FAIL( "::ScImportExcel - wrong file format specification" );
157 return SCERR_IMPORT_FORMAT;
158 }
159
160 // check the input stream from medium
161 SvStream* pMedStrm = rMedium.GetInStream();
162 OSL_ENSURE( pMedStrm, "::ScImportExcel - medium without input stream" );
163 if( !pMedStrm ) return SCERR_IMPORT_OPEN; // should not happen
164
165 SvStream* pBookStrm = nullptr; // The "Book"/"Workbook" stream containing main data.
166 XclBiff eBiff = EXC_BIFF_UNKNOWN; // The BIFF version of the main stream.
167
168 // try to open an OLE storage
169 tools::SvRef<SotStorage> xRootStrg;
171 std::shared_ptr<SvStream> aNewStorageStrm;
172 if( SotStorage::IsStorageFile( pMedStrm ) )
173 {
174 xRootStrg = new SotStorage( pMedStrm, false );
175 if( xRootStrg->GetError() )
176 xRootStrg = nullptr;
177 }
178
179 // try to open "Book" or "Workbook" stream in OLE storage
180 if( xRootStrg.is() )
181 {
182 // Check if there is DRM encryption in storage
183 tools::SvRef<SotStorageStream> xDRMStrm = ScfTools::OpenStorageStreamRead(xRootStrg, "\011DRMContent");
184 if (xDRMStrm.is())
185 {
186 xRootStrg = lcl_DRMDecrypt(rMedium, xRootStrg, aNewStorageStrm);
187 }
188
189 // try to open the "Book" stream
191 XclBiff eBookBiff = xBookStrm.is() ? XclImpStream::DetectBiffVersion( *xBookStrm ) : EXC_BIFF_UNKNOWN;
192
193 // try to open the "Workbook" stream
195 XclBiff eWorkbookBiff = xWorkbookStrm.is() ? XclImpStream::DetectBiffVersion( *xWorkbookStrm ) : EXC_BIFF_UNKNOWN;
196
197 // decide which stream to use
198 if( (eWorkbookBiff != EXC_BIFF_UNKNOWN) && ((eBookBiff == EXC_BIFF_UNKNOWN) || (eWorkbookBiff > eBookBiff)) )
199 {
200 /* Only "Workbook" stream exists; or both streams exist,
201 and "Workbook" has higher BIFF version than "Book" stream. */
202 xStrgStrm = xWorkbookStrm;
203 eBiff = eWorkbookBiff;
204 }
205 else if( eBookBiff != EXC_BIFF_UNKNOWN )
206 {
207 /* Only "Book" stream exists; or both streams exist,
208 and "Book" has higher BIFF version than "Workbook" stream. */
209 xStrgStrm = xBookStrm;
210 eBiff = eBookBiff;
211 }
212
213 pBookStrm = xStrgStrm.get();
214 }
215
216 // no "Book" or "Workbook" stream found, try plain input stream from medium (even for BIFF5+)
217 if( !pBookStrm )
218 {
219 eBiff = XclImpStream::DetectBiffVersion( *pMedStrm );
220 if( eBiff != EXC_BIFF_UNKNOWN )
221 pBookStrm = pMedStrm;
222 }
223
224 // try to import the file
226 if( pBookStrm )
227 {
228 pBookStrm->SetBufferSize( 0x8000 ); // still needed?
229
230 XclImpRootData aImpData(
231 eBiff, rMedium, xRootStrg, *pDocument,
233 std::unique_ptr< ImportExcel > xFilter;
234 switch( eBiff )
235 {
236 case EXC_BIFF2:
237 case EXC_BIFF3:
238 case EXC_BIFF4:
239 case EXC_BIFF5:
240 xFilter.reset( new ImportExcel( aImpData, *pBookStrm ) );
241 break;
242 case EXC_BIFF8:
243 xFilter.reset( new ImportExcel8( aImpData, *pBookStrm ) );
244 break;
245 default: DBG_ERROR_BIFF();
246 }
247
248 eRet = xFilter ? xFilter->Read() : SCERR_IMPORT_INTERNAL;
249 }
250
251 return eRet;
252}
253
254static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument,
255 SvStream* pMedStrm, bool bBiff8, rtl_TextEncoding eNach )
256{
257 uno::Reference< packages::XPackageEncryption > xPackageEncryption;
258 uno::Sequence< beans::NamedValue > aEncryptionData;
259 const SfxUnoAnyItem* pEncryptionDataItem = rMedium.GetItemSet().GetItem(SID_ENCRYPTIONDATA, false);
260 SvStream* pOriginalMediaStrm = pMedStrm;
261 std::shared_ptr<SvStream> pMediaStrm;
262 if (pEncryptionDataItem && (pEncryptionDataItem->GetValue() >>= aEncryptionData))
263 {
264 ::comphelper::SequenceAsHashMap aHashData(aEncryptionData);
265 OUString sCryptoType = aHashData.getUnpackedValueOrDefault("CryptoType", OUString());
266
267 if (sCryptoType.getLength())
268 {
269 uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
270 uno::Sequence<uno::Any> aArguments{
271 uno::Any(beans::NamedValue("Binary", uno::Any(true))) };
272 xPackageEncryption.set(
273 xComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext(
274 "com.sun.star.comp.oox.crypto." + sCryptoType, aArguments, xComponentContext), uno::UNO_QUERY);
275
276 if (xPackageEncryption.is())
277 {
278 // We have an encryptor. Export document into memory stream and encrypt it later
279 pMediaStrm = std::make_shared<SvMemoryStream>();
280 pMedStrm = pMediaStrm.get();
281
282 // Temp removal of EncryptionData to avoid password protection triggering
283 rMedium.GetItemSet().ClearItem(SID_ENCRYPTIONDATA);
284 }
285 }
286 }
287
288 // try to open an OLE storage
289 tools::SvRef<SotStorage> xRootStrg = new SotStorage( pMedStrm, false );
290 if( xRootStrg->GetError() ) return SCERR_IMPORT_OPEN;
291
292 // create BIFF dependent strings
293 OUString aStrmName, aClipName, aClassName;
294 if( bBiff8 )
295 {
296 aStrmName = EXC_STREAM_WORKBOOK;
297 aClipName = "Biff8";
298 aClassName = "Microsoft Excel 97-Tabelle";
299 }
300 else
301 {
302 aStrmName = EXC_STREAM_BOOK;
303 aClipName = "Biff5";
304 aClassName = "Microsoft Excel 5.0-Tabelle";
305 }
306
307 // open the "Book"/"Workbook" stream
308 tools::SvRef<SotStorageStream> xStrgStrm = ScfTools::OpenStorageStreamWrite( xRootStrg, aStrmName );
309 if( !xStrgStrm.is() || xStrgStrm->GetError() ) return SCERR_IMPORT_OPEN;
310
311 xStrgStrm->SetBufferSize( 0x8000 ); // still needed?
312
314 XclExpRootData aExpData( bBiff8 ? EXC_BIFF8 : EXC_BIFF5, rMedium, xRootStrg, *pDocument, eNach );
315 if ( bBiff8 )
316 {
317 ExportBiff8 aFilter( aExpData, *xStrgStrm );
318 eRet = aFilter.Write();
319 }
320 else
321 {
322 ExportBiff5 aFilter( aExpData, *xStrgStrm );
323 eRet = aFilter.Write();
324 }
325
326 if( eRet == SCWARN_IMPORT_RANGE_OVERFLOW )
328
331 xRootStrg->SetClass( aGlobName, nClip, aClassName );
332
333 xStrgStrm->Commit();
334 xRootStrg->Commit();
335
336 if (xPackageEncryption.is())
337 {
338 // Perform DRM encryption
339 pMedStrm->Seek(0);
340
341 xPackageEncryption->setupEncryption(aEncryptionData);
342
343 uno::Reference<io::XInputStream > xInputStream(new utl::OSeekableInputStreamWrapper(pMedStrm, false));
344 uno::Sequence<beans::NamedValue> aStreams = xPackageEncryption->encrypt(xInputStream);
345
346 tools::SvRef<SotStorage> xEncryptedRootStrg = new SotStorage(pOriginalMediaStrm, false);
347 for (const beans::NamedValue & aStreamData : std::as_const(aStreams))
348 {
349 // To avoid long paths split and open substorages recursively
350 // Splitting paths manually, since comphelper::string::split is trimming special characters like \0x01, \0x09
351 tools::SvRef<SotStorage> pStorage = xEncryptedRootStrg.get();
352 OUString sFileName;
353 sal_Int32 idx = 0;
354 do
355 {
356 OUString sPathElem = aStreamData.Name.getToken(0, L'/', idx);
357 if (!sPathElem.isEmpty())
358 {
359 if (idx < 0)
360 {
361 sFileName = sPathElem;
362 }
363 else
364 {
365 pStorage = pStorage->OpenSotStorage(sPathElem);
366 }
367 }
368 } while (pStorage && idx >= 0);
369
370 if (!pStorage)
371 {
372 eRet = ERRCODE_IO_GENERAL;
373 break;
374 }
375
376 tools::SvRef<SotStorageStream> pStream = pStorage->OpenSotStream(sFileName);
377 if (!pStream)
378 {
379 eRet = ERRCODE_IO_GENERAL;
380 break;
381 }
382 uno::Sequence<sal_Int8> aStreamContent;
383 aStreamData.Value >>= aStreamContent;
384 size_t nBytesWritten = pStream->WriteBytes(aStreamContent.getConstArray(), aStreamContent.getLength());
385 if (nBytesWritten != static_cast<size_t>(aStreamContent.getLength()))
386 {
388 break;
389 }
390 }
391 xEncryptedRootStrg->Commit();
392
393 // Restore encryption data
394 rMedium.GetItemSet().Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, uno::Any(aEncryptionData)));
395 }
396
397 return eRet;
398}
399
401 ExportFormatExcel eFormat, rtl_TextEncoding eNach )
402{
403 if( eFormat != ExpBiff5 && eFormat != ExpBiff8 )
404 return SCERR_IMPORT_NI;
405
406 // check the passed Calc document
407 OSL_ENSURE( pDocument, "::ScExportExcel5 - no document" );
408 if( !pDocument ) return SCERR_IMPORT_INTERNAL; // should not happen
409
410 // check the output stream from medium
411 SvStream* pMedStrm = rMedium.GetOutStream();
412 OSL_ENSURE( pMedStrm, "::ScExportExcel5 - medium without output stream" );
413 if( !pMedStrm ) return SCERR_IMPORT_OPEN; // should not happen
414
415 ErrCode eRet = lcl_ExportExcelBiff(rMedium, pDocument, pMedStrm, eFormat == ExpBiff8, eNach);
416 return eRet;
417}
418
419extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportCalcRTF(SvStream &rStream)
420{
421 ScDLL::Init();
423 ScDocOptions aDocOpt = aDocument.GetDocOptions();
424 aDocOpt.SetLookUpColRowNames(false);
425 aDocument.SetDocOptions(aDocOpt);
426 aDocument.MakeTable(0);
427 aDocument.EnableExecuteLink(false);
428 aDocument.SetInsertingFromOtherDoc(true);
429 ScRange aRange;
430
431 bool bRet;
432
433 try
434 {
435 bRet = ScFormatFilter::Get().ScImportRTF(rStream, OUString(), &aDocument, aRange) == ERRCODE_NONE;
436 }
437 catch (const std::range_error&)
438 {
439 return false;
440 }
441
442 return bRet;
443}
444
445extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportXLS(SvStream& rStream)
446{
447 ScDLL::Init();
448 SfxMedium aMedium;
449 css::uno::Reference<css::io::XInputStream> xStm(new utl::OInputStreamWrapper(rStream));
450 aMedium.GetItemSet().Put(SfxUnoAnyItem(SID_INPUTSTREAM, css::uno::Any(xStm)));
451 aMedium.GetItemSet().Put(SfxUInt16Item(SID_UPDATEDOCMODE, css::document::UpdateDocMode::NO_UPDATE));
452
453 ScDocShellRef xDocShell = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT |
454 SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
455 SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
456
457 xDocShell->DoInitNew();
458 xDocShell->SetInitialLinkUpdate(&aMedium);
459
460 ScDocument& rDoc = xDocShell->GetDocument();
461
462 ScDocOptions aDocOpt = rDoc.GetDocOptions();
463 aDocOpt.SetLookUpColRowNames(false);
464 rDoc.SetDocOptions(aDocOpt);
465 rDoc.MakeTable(0);
466 rDoc.EnableExecuteLink(false);
467 rDoc.SetInsertingFromOtherDoc(true);
468 rDoc.InitDrawLayer(xDocShell.get());
469 bool bRet(false);
470 try
471 {
472 bRet = ScFormatFilter::Get().ScImportExcel(aMedium, &rDoc, EIF_AUTO) == ERRCODE_NONE;
473 }
474 catch (const css::ucb::ContentCreationException&)
475 {
476 }
477 catch (const std::out_of_range&)
478 {
479 }
480 xDocShell->DoClose();
481 xDocShell.clear();
482 return bRet;
483}
484
485extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDIF(SvStream &rStream)
486{
487 ScDLL::Init();
489 ScDocOptions aDocOpt = aDocument.GetDocOptions();
490 aDocOpt.SetLookUpColRowNames(false);
491 aDocument.SetDocOptions(aDocOpt);
492 aDocument.MakeTable(0);
493 aDocument.EnableExecuteLink(false);
494 aDocument.SetInsertingFromOtherDoc(true);
495 return ScFormatFilter::Get().ScImportDif(rStream, &aDocument, ScAddress(0, 0, 0), RTL_TEXTENCODING_IBM_850) == ERRCODE_NONE;
496}
497
498/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScriptDocument aDocument
ErrCode Write() override
Definition: expop2.cxx:70
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
Definition: scdll.cxx:100
void SetLookUpColRowNames(bool bVal)
Definition: docoptio.hxx:52
SC_DLLPUBLIC void InitDrawLayer(SfxObjectShell *pDocShell=nullptr)
Definition: documen9.cxx:105
SC_DLLPUBLIC void SetDocOptions(const ScDocOptions &rOpt)
Definition: documen3.cxx:1942
void EnableExecuteLink(bool bVal)
Definition: document.hxx:1603
SC_DLLPUBLIC void MakeTable(SCTAB nTab, bool _bNeedsNameCheck=true)
Definition: document.cxx:171
void SetInsertingFromOtherDoc(bool bVal)
Definition: document.hxx:2223
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1936
virtual ErrCode ScExportExcel5(SfxMedium &, ScDocument *, ExportFormatExcel eFormat, rtl_TextEncoding eDest) override
Definition: excel.cxx:400
virtual ErrCode ScImportExcel(SfxMedium &, ScDocument *, const EXCIMPFORMAT) override
Definition: excel.cxx:146
virtual ErrCode ScImportRTF(SvStream &, const OUString &rBaseURL, ScDocument *, ScRange &rRange)=0
virtual ErrCode ScImportDif(SvStream &, ScDocument *, const ScAddress &rInsPos, const rtl_TextEncoding eSrc)=0
virtual ErrCode ScImportExcel(SfxMedium &, ScDocument *, const EXCIMPFORMAT)=0
static SC_DLLPUBLIC ScFormatFilterPlugin & Get()
Definition: impex.cxx:2684
static tools::SvRef< SotStorageStream > OpenStorageStreamRead(tools::SvRef< SotStorage > const &xStrg, const OUString &rStrmName)
Tries to open an existing stream with the specified name in the passed storage (read-only).
Definition: ftools.cxx:181
static tools::SvRef< SotStorageStream > OpenStorageStreamWrite(tools::SvRef< SotStorage > const &xStrg, const OUString &rStrmName)
Creates and opens a stream with the specified name in the passed storage (read/write).
Definition: ftools.cxx:189
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SfxItemSet & GetItemSet() const
SvStream * GetOutStream()
SvStream * GetInStream()
const css::uno::Any & GetValue() const
static SotClipboardFormatId RegisterFormatName(const OUString &rName)
void FillInfoList(SvStorageInfoList *) const
tools::SvRef< SotStorageStream > OpenSotStream(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE)
static bool IsStorageFile(OUString const &rFileName)
SotStorage * OpenSotStorage(const OUString &rEleName, StreamMode=StreamMode::STD_READWRITE, bool transacted=true)
void SetBufferSize(sal_uInt16 m_nBufSize)
sal_uInt64 Seek(sal_uInt64 nPos)
static XclBiff DetectBiffVersion(SvStream &rStrm)
Detects the BIFF version of the passed workbook stream.
Definition: xistream.cxx:387
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
css::uno::Sequence< css::beans::NamedValue > getAsConstNamedValueList() const
#define MSO_EXCEL5_CLASSID
T * get() const
bool is() const
UNOTOOLS_DLLPUBLIC OUString utl_getLocaleForGlobalDefaultEncoding()
float u
#define ERRCODE_IO_GENERAL
#define ERRCODE_IO_CANTWRITE
#define ERRCODE_NONE
SAL_DLLPUBLIC_EXPORT bool TestImportDIF(SvStream &rStream)
Definition: excel.cxx:485
SAL_DLLPUBLIC_EXPORT bool TestImportXLS(SvStream &rStream)
Definition: excel.cxx:445
static tools::SvRef< SotStorage > lcl_DRMDecrypt(const SfxMedium &rMedium, const tools::SvRef< SotStorage > &rStorage, std::shared_ptr< SvStream > &rNewStorageStrm)
Definition: excel.cxx:84
static void lcl_getListOfStreams(SotStorage *pStorage, comphelper::SequenceAsHashMap &aStreamsData, std::u16string_view sPrefix)
Definition: excel.cxx:55
SAL_DLLPUBLIC_EXPORT bool TestImportCalcRTF(SvStream &rStream)
Definition: excel.cxx:419
static ErrCode lcl_ExportExcelBiff(SfxMedium &rMedium, ScDocument *pDocument, SvStream *pMedStrm, bool bBiff8, rtl_TextEncoding eNach)
Definition: excel.cxx:254
ExportFormatExcel
Definition: filter.hxx:42
@ ExpBiff8
Definition: filter.hxx:42
@ ExpBiff5
Definition: filter.hxx:42
EXCIMPFORMAT
Definition: filter.hxx:39
@ EIF_BIFF8
Definition: filter.hxx:39
@ EIF_BIFF_LE4
Definition: filter.hxx:39
@ EIF_AUTO
Definition: filter.hxx:39
@ EIF_BIFF5
Definition: filter.hxx:39
SotClipboardFormatId
OUString sPrefix
const sal_uInt16 idx[]
Sequence< PropertyValue > aArguments
Reference< XComponentContext > getProcessComponentContext()
#define SCERR_IMPORT_FORMAT
Definition: scerrors.hxx:33
#define SCWARN_IMPORT_RANGE_OVERFLOW
Definition: scerrors.hxx:61
#define SCERR_IMPORT_OPEN
Definition: scerrors.hxx:26
#define SCERR_IMPORT_INTERNAL
Definition: scerrors.hxx:42
#define SCWARN_EXPORT_MAXROW
Definition: scerrors.hxx:72
#define SCERR_IMPORT_UNKNOWN_BIFF
Definition: scerrors.hxx:37
#define SCERR_IMPORT_NI
Definition: scerrors.hxx:35
std::vector< SvStorageInfo > SvStorageInfoList
Stores global buffers and data needed for Excel export filter.
Definition: xeroot.hxx:60
Stores global buffers and data needed for Excel import filter.
Definition: xiroot.hxx:64
UNOTOOLS_DLLPUBLIC rtl_TextEncoding utl_getWinTextEncodingFromLangStr(const OUString &sLanguage, bool bOEM=false)
constexpr OUStringLiteral EXC_STREAM_WORKBOOK
Definition: xlconst.hxx:83
constexpr OUStringLiteral EXC_STREAM_BOOK
Definition: xlconst.hxx:82
XclBiff
An enumeration for all Excel file format types (BIFF types).
Definition: xlconst.hxx:30
@ EXC_BIFF5
MS Excel 4.0.
Definition: xlconst.hxx:34
@ EXC_BIFF4
MS Excel 3.0.
Definition: xlconst.hxx:33
@ EXC_BIFF_UNKNOWN
MS Excel 8.0 (97), 9.0 (2000), 10.0 (XP), 11.0 (2003)
Definition: xlconst.hxx:36
@ EXC_BIFF2
Definition: xlconst.hxx:31
@ EXC_BIFF8
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:35
@ EXC_BIFF3
MS Excel 2.1.
Definition: xlconst.hxx:32
#define DBG_ERROR_BIFF()
Definition: xltools.hxx:33