20#include <officecfg/Office/Common.hxx>
21#include <rtl/random.h>
25#include <sfx2/sfxsids.hrc>
46#include <document.hxx>
49#include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
50#include <com/sun/star/lang/XMultiServiceFactory.hpp>
58 XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, true )
61 ? officecfg::Office::Common::Save::URL::Internet::get()
62 : officecfg::Office::Common::Save::URL::FileSystem::get();
72 mrExpData( rExpRootData )
78 OSL_ENSURE(
mrExpData.
mxTabInfo,
"XclExpRoot::GetTabInfo - missing object (wrong BIFF?)" );
84 OSL_ENSURE(
mrExpData.
mxAddrConv,
"XclExpRoot::GetAddressConverter - missing object (wrong BIFF?)" );
90 OSL_ENSURE(
mrExpData.
mxFmlaComp,
"XclExpRoot::GetFormulaCompiler - missing object (wrong BIFF?)" );
96 OSL_ENSURE(
mrExpData.
mxProgress,
"XclExpRoot::GetProgressBar - missing object (wrong BIFF?)" );
102 OSL_ENSURE(
mrExpData.
mxSst,
"XclExpRoot::GetSst - missing object (wrong BIFF?)" );
108 OSL_ENSURE(
mrExpData.
mxPalette,
"XclExpRoot::GetPalette - missing object (wrong BIFF?)" );
114 OSL_ENSURE(
mrExpData.
mxFontBfr,
"XclExpRoot::GetFontBuffer - missing object (wrong BIFF?)" );
120 OSL_ENSURE(
mrExpData.
mxNumFmtBfr,
"XclExpRoot::GetNumFmtBuffer - missing object (wrong BIFF?)" );
126 OSL_ENSURE(
mrExpData.
mxXFBfr,
"XclExpRoot::GetXFBuffer - missing object (wrong BIFF?)" );
138 OSL_ENSURE(
GetLocalLinkMgrRef(),
"XclExpRoot::GetLocalLinkManager - missing object (wrong BIFF?)" );
144 OSL_ENSURE(
mrExpData.
mxNameMgr,
"XclExpRoot::GetNameManager - missing object (wrong BIFF?)" );
150 OSL_ENSURE(
mrExpData.
mxObjMgr,
"XclExpRoot::GetObjectManager - missing object (wrong BIFF?)" );
156 OSL_ENSURE(
mrExpData.
mxFilterMgr,
"XclExpRoot::GetFilterManager - missing object (wrong BIFF?)" );
162 OSL_ENSURE(
mrExpData.
mxDxfs,
"XclExpRoot::GetDxfs - missing object ( wrong BIFF?)" );
168 OSL_ENSURE(
mrExpData.
mxPTableMgr,
"XclExpRoot::GetPivotTableManager - missing object (wrong BIFF?)" );
235 SAL_WARN(
"sc",
"XclExpRoot::InitializeGlobals - no object shell");
238 uno::Reference< lang::XComponent > xComponent = pShell->
GetModel();
239 if (!xComponent.is())
241 SAL_WARN(
"sc",
"XclExpRoot::InitializeGlobals - no component");
244 uno::Reference< lang::XMultiServiceFactory > xModelFactory( xComponent, uno::UNO_QUERY);
250 uno::Sequence< const sheet::FormulaOpCodeMapEntry > aOpCodeMapping;
251 if (!(aAny >>= aOpCodeMapping))
253 SAL_WARN(
"sc",
"XclExpRoot::InitializeGlobals - no OpCodeMap");
296 OSL_ENSURE( xRec,
"XclExpRoot::CreateRecord - unknown record ID or missing object" );
313 uno::Sequence< beans::NamedValue > aEncryptionData;
315 if ( !aPass.empty() && aPass.size() < 16 )
319 rtl_random_getBytes( aRandomPool, pnDocId, 16 );
321 rtl_random_destroyPool( aRandomPool );
323 sal_uInt16 pnPasswd[16] = {};
324 for(
size_t nChar = 0; nChar < aPass.size(); ++nChar )
325 pnPasswd[nChar] = aPass[nChar];
328 aCodec.
InitKey( pnPasswd, pnDocId );
332 return aEncryptionData;
337 uno::Sequence< beans::NamedValue > aEncryptionData;
339 if ( pEncryptionDataItem )
340 pEncryptionDataItem->
GetValue() >>= aEncryptionData;
345 if ( pPasswordItem && !pPasswordItem->
GetValue().isEmpty() )
349 return aEncryptionData;
const OUString & GetValue() const
virtual bool isProtected() const override
bool isOptionEnabled(Option eOption) const
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
SC_DLLPUBLIC ScDocProtection * GetDocProtection() const
SfxObjectShell * GetDocumentShell() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
SfxItemSet & GetItemSet() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
const css::uno::Any & GetValue() const
Provides functions to convert Calc cell addresses to Excel cell addresses.
Stores the data of all fonts used in the document.
Stores all data for internal/external references (the link table).
Manager that stores all internal defined names (NAME records) of the document.
void Initialize()
Creates NAME records for built-in and user defined names.
Stores all number formats used in the document.
Stores all used colors in the document.
void Finalize()
Reduces the color list to the maximum count of the current BIFF version.
The main class for pivot table export.
The main progress bar for the export filter.
void Initialize()
Initializes all segments and sub progress bars.
XclExpTablesManager & GetTablesManager()
XclExpLinkManager & GetGlobalLinkManager() const
Returns the global link manager for defined names.
XclExpFontBuffer & GetFontBuffer() const
Returns the font buffer.
XclExpPivotTableManager & GetPivotTableManager() const
Returns the pivot table manager.
void InitializeConvert()
Is called when export filter starts to create the Excel document (all BIFF versions).
XclExpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
XclExpFormulaCompiler & GetFormulaCompiler() const
Returns the formula compiler to produce formula token arrays.
void InitializeTable(SCTAB nScTab)
Is called when export filter starts to create data for a single sheet (all BIFF versions).
XclExpObjectManager & GetObjectManager() const
Returns the drawing object manager.
XclExpDxfs & GetDxfs() const
Returns the differential formatting list.
XclExpAddressConverter & GetAddressConverter() const
Returns the address converter.
css::uno::Sequence< css::beans::NamedValue > GetEncryptionData() const
void InitializeGlobals()
Is called when export filter starts to create the workbook global data (>=BIFF5).
XclExpNumFmtBuffer & GetNumFmtBuffer() const
Returns the number format buffer.
static css::uno::Sequence< css::beans::NamedValue > GenerateDefaultEncryptionData()
XclExpSst & GetSst() const
Returns the shared string table.
bool IsDocumentEncrypted() const
static css::uno::Sequence< css::beans::NamedValue > GenerateEncryptionData(std::u16string_view aPass)
XclExpRootData & mrExpData
XclExpLinkManager & GetLocalLinkManager() const
Returns the local link manager for the current sheet.
XclExpXmlPivotTableManager & GetXmlPivotTableManager()
XclExpTabInfo & GetTabInfo() const
Returns the buffer for Calc->Excel sheet index conversion.
XclExpRecordRef CreateRecord(sal_uInt16 nRecId) const
Returns the reference to a record (or record list) representing a root object.
XclExpPalette & GetPalette() const
Returns the color buffer.
XclExpRoot(XclExpRootData &rExpRootData)
XclExpXFBuffer & GetXFBuffer() const
Returns the cell formatting attributes buffer.
void InitializeSave()
Is called before export filter starts to write the records to the stream.
XclExpProgressBar & GetProgressBar() const
Returns the export progress bar.
XclExpRootData::XclExpLinkMgrRef const & GetLocalLinkMgrRef() const
Returns the local or global link manager, depending on current context.
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
XclExpFilterManager & GetFilterManager() const
Returns the filter manager.
Provides export of the SST (shared string table) record.
Stores the correct Excel sheet index for each Calc sheet.
Stores all data for database ranges (tables in Excel speak).
Stores all XF records (cell formats and cell styles) in the document.
void Finalize()
Reduces the XF record list to the maximum allowed number of records.
void Initialize()
Inserts predefined built-in styles and user-defined styles.
Access to global data for a filter object (imported or exported document) from other classes.
XclOutput GetOutput() const
Returns the current output format of the importer/exporter.
static OUString GetDefaultPassword()
Returns the default password used for stream encryption.
SfxMedium & GetMedium() const
Returns the medium to import from.
bool IsInGlobals() const
Returns the current Calc sheet index.
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
void SetCurrScTab(SCTAB nScTab)
Sets the current Calc sheet index.
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
virtual css::uno::Sequence< css::beans::NamedValue > GetEncryptionData()
virtual void InitKey(const sal_uInt16 pPassData[16], const sal_uInt8 pDocId[16]) override
Provides access to API op-codes for all available formula tokens and to function info structs for all...
css::uno::Sequence< css::sheet::FormulaOpCodeMapEntry > getOoxParserMap() const
Returns the op-code map that is used by the OOXML formula parser.
#define SAL_WARN(area, stream)
Stores global buffers and data needed for Excel export filter.
XclExpTabInfoRef mxTabInfo
ScCompiler::OpCodeMapPtr mxOpCodeMap
XclExpDxfsRef mxDxfs
All pivot tables and pivot caches.
XclExpLinkMgrRef mxLocLinkMgr
Global link manager for defined names.
OStringBuffer maStringBuf
true = Store URLs relative.
XclExpLinkMgrRef mxGlobLinkMgr
Internal defined names.
bool mbRelUrl
mapping between op-codes and names
XclExpProgressRef mxProgress
The formula compiler.
XclExpObjectMgrRef mxObjMgr
Local link manager for a sheet.
XclExpFilterMgrRef mxFilterMgr
All drawing objects.
XclExpNumFmtBfrRef mxNumFmtBfr
All fonts in the file.
XclExpRootData(XclBiff eBiff, SfxMedium &rMedium, const tools::SvRef< SotStorage > &xRootStrg, ScDocument &rDoc, rtl_TextEncoding eTextEnc)
buffer to avoid massive OUString allocations
XclExpFmlaCompRef mxFmlaComp
The address converter.
XclExpNameMgrRef mxNameMgr
All XF records in the file.
XclExpXFBfrRef mxXFBfr
All number formats in the file.
std::shared_ptr< XclExpTablesManager > mxTablesMgr
XclExpSstRef mxSst
The export progress bar.
XclExpPaletteRef mxPalette
The shared string table.
XclExpPTableMgrRef mxPTableMgr
Manager for filtered areas in all sheets.
virtual ~XclExpRootData() override
std::shared_ptr< XclExpXmlPivotTableManager > mxXmlPTableMgr
All delta formatting entries.
XclExpAddrConvRef mxAddrConv
Calc->Excel sheet index conversion.
XclExpFontBfrRef mxFontBfr
The color buffer.
Stores global buffers and data needed elsewhere in the Excel filters.
SfxMedium & mrMedium
Current Output format.
const sal_uInt16 EXC_ID_FONTLIST
const sal_uInt16 EXC_ID_XFLIST
For internal use only.
const sal_uInt16 EXC_ID_FORMATLIST
For internal use only.
const sal_uInt16 EXC_ID_DXFS
For internal use only.
const SCTAB SCTAB_GLOBAL
An invalid Calc sheet index, for common use.
XclBiff
An enumeration for all Excel file format types (BIFF types).
@ EXC_BIFF8
MS Excel 5.0, MS Excel 7.0 (95)
@ EXC_OUTPUT_XML_2007
MS Excel binary .xls.
const sal_uInt16 EXC_ID_SST
const sal_uInt16 EXC_ID_EXTERNSHEET
const sal_uInt16 EXC_ID_NAME
const sal_uInt16 EXC_ID_PALETTE