20 #include <rtl/random.h>
24 #include <sfx2/sfxsids.hrc>
45 #include <document.hxx>
48 #include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
49 #include <com/sun/star/frame/XModel.hpp>
50 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
58 XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, true )
71 mrExpData( rExpRootData )
77 OSL_ENSURE(
mrExpData.
mxTabInfo,
"XclExpRoot::GetTabInfo - missing object (wrong BIFF?)" );
83 OSL_ENSURE(
mrExpData.
mxAddrConv,
"XclExpRoot::GetAddressConverter - missing object (wrong BIFF?)" );
89 OSL_ENSURE(
mrExpData.
mxFmlaComp,
"XclExpRoot::GetFormulaCompiler - missing object (wrong BIFF?)" );
95 OSL_ENSURE(
mrExpData.
mxProgress,
"XclExpRoot::GetProgressBar - missing object (wrong BIFF?)" );
101 OSL_ENSURE(
mrExpData.
mxSst,
"XclExpRoot::GetSst - missing object (wrong BIFF?)" );
107 OSL_ENSURE(
mrExpData.
mxPalette,
"XclExpRoot::GetPalette - missing object (wrong BIFF?)" );
113 OSL_ENSURE(
mrExpData.
mxFontBfr,
"XclExpRoot::GetFontBuffer - missing object (wrong BIFF?)" );
119 OSL_ENSURE(
mrExpData.
mxNumFmtBfr,
"XclExpRoot::GetNumFmtBuffer - missing object (wrong BIFF?)" );
125 OSL_ENSURE(
mrExpData.
mxXFBfr,
"XclExpRoot::GetXFBuffer - missing object (wrong BIFF?)" );
137 OSL_ENSURE(
GetLocalLinkMgrRef(),
"XclExpRoot::GetLocalLinkManager - missing object (wrong BIFF?)" );
143 OSL_ENSURE(
mrExpData.
mxNameMgr,
"XclExpRoot::GetNameManager - missing object (wrong BIFF?)" );
149 OSL_ENSURE(
mrExpData.
mxObjMgr,
"XclExpRoot::GetObjectManager - missing object (wrong BIFF?)" );
155 OSL_ENSURE(
mrExpData.
mxFilterMgr,
"XclExpRoot::GetFilterManager - missing object (wrong BIFF?)" );
161 OSL_ENSURE(
mrExpData.
mxDxfs,
"XclExpRoot::GetDxfs - missing object ( wrong BIFF?)" );
167 OSL_ENSURE(
mrExpData.
mxPTableMgr,
"XclExpRoot::GetPivotTableManager - missing object (wrong BIFF?)" );
234 SAL_WARN(
"sc",
"XclExpRoot::InitializeGlobals - no object shell");
237 uno::Reference< lang::XComponent > xComponent = pShell->
GetModel();
238 if (!xComponent.is())
240 SAL_WARN(
"sc",
"XclExpRoot::InitializeGlobals - no component");
243 uno::Reference< lang::XMultiServiceFactory > xModelFactory( xComponent, uno::UNO_QUERY);
249 uno::Sequence< const sheet::FormulaOpCodeMapEntry > aOpCodeMapping;
250 if (!(aAny >>= aOpCodeMapping))
252 SAL_WARN(
"sc",
"XclExpRoot::InitializeGlobals - no OpCodeMap");
294 OSL_ENSURE( xRec,
"XclExpRoot::CreateRecord - unknown record ID or missing object" );
311 uno::Sequence< beans::NamedValue > aEncryptionData;
313 if ( !aPass.isEmpty() && aPass.getLength() < 16 )
317 rtl_random_getBytes( aRandomPool, pnDocId, 16 );
319 rtl_random_destroyPool( aRandomPool );
321 sal_uInt16 pnPasswd[16] = {};
322 for( sal_Int32 nChar = 0; nChar < aPass.getLength(); ++nChar )
323 pnPasswd[nChar] = aPass[nChar];
326 aCodec.
InitKey( pnPasswd, pnDocId );
330 return aEncryptionData;
335 uno::Sequence< beans::NamedValue > aEncryptionData;
337 if ( pEncryptionDataItem )
338 pEncryptionDataItem->
GetValue() >>= aEncryptionData;
343 if ( pPasswordItem && !pPasswordItem->
GetValue().isEmpty() )
347 return aEncryptionData;
XclExpFilterManager & GetFilterManager() const
Returns the filter manager.
Stores all XF records (cell formats and cell styles) in the document.
XclExpObjectMgrRef mxObjMgr
Local link manager for a sheet.
static OUString GetDefaultPassword()
Returns the default password used for stream encryption.
XclBiff
An enumeration for all Excel file format types (BIFF types).
Stores global buffers and data needed for Excel export filter.
bool IsSaveRelFSys() const
void InitializeGlobals()
Is called when export filter starts to create the workbook global data (>=BIFF5). ...
The main progress bar for the export filter.
std::shared_ptr< XclExpXmlPivotTableManager > mxXmlPTableMgr
All delta formatting entries.
void InitializeConvert()
Is called when export filter starts to create the Excel document (all BIFF versions).
XclExpRoot(XclExpRootData &rExpRootData)
XclExpAddrConvRef mxAddrConv
Calc->Excel sheet index conversion.
virtual void InitKey(const sal_uInt16 pPassData[16], const sal_uInt8 pDocId[16]) override
void Initialize()
Initializes all segments and sub progress bars.
XclExpLinkManager & GetLocalLinkManager() const
Returns the local link manager for the current sheet.
OStringBuffer maStringBuf
true = Store URLs relative.
const sal_uInt16 EXC_ID_NAME
XclExpPivotTableManager & GetPivotTableManager() const
Returns the pivot table manager.
virtual bool isProtected() const override
XclExpFormulaCompiler & GetFormulaCompiler() const
Returns the formula compiler to produce formula token arrays.
static css::uno::Sequence< css::beans::NamedValue > GenerateEncryptionData(const OUString &aPass)
Stores global buffers and data needed elsewhere in the Excel filters.
XclExpNameMgrRef mxNameMgr
All XF records in the file.
XclExpProgressBar & GetProgressBar() const
Returns the export progress bar.
const sal_uInt16 EXC_ID_DXFS
For internal use only.
css::uno::Reference< css::frame::XModel > GetModel() const
SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
static css::uno::Sequence< css::beans::NamedValue > GenerateDefaultEncryptionData()
XclExpXFBfrRef mxXFBfr
All number formats in the file.
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
XclExpRootData(XclBiff eBiff, SfxMedium &rMedium, const tools::SvRef< SotStorage > &xRootStrg, ScDocument &rDoc, rtl_TextEncoding eTextEnc)
buffer to avoid massive OUString allocations
const css::uno::Any & GetValue() const
Stores all number formats used in the document.
virtual css::uno::Sequence< css::beans::NamedValue > GetEncryptionData()
const SCTAB SCTAB_GLOBAL
An invalid Calc sheet index, for common use.
XclExpFontBfrRef mxFontBfr
The color buffer.
XclExpDxfs & GetDxfs() const
Returns the differential formatting list.
const sal_uInt16 EXC_ID_EXTERNSHEET
Provides access to API op-codes for all available formula tokens and to function info structs for all...
XclExpLinkManager & GetGlobalLinkManager() const
Returns the global link manager for defined names.
css::uno::Sequence< css::sheet::FormulaOpCodeMapEntry > getOoxParserMap() const
Returns the op-code map that is used by the OOXML formula parser.
SC_DLLPUBLIC ScDocProtection * GetDocProtection() const
XclExpRootData & mrExpData
MS Excel 5.0, MS Excel 7.0 (95)
XclOutput GetOutput() const
Returns the current output format of the importer/exporter.
XclExpRootData::XclExpLinkMgrRef const & GetLocalLinkMgrRef() const
Returns the local or global link manager, depending on current context.
XclExpAddressConverter & GetAddressConverter() const
Returns the address converter.
const sal_uInt16 EXC_ID_FONTLIST
Manager that stores all internal defined names (NAME records) of the document.
XclExpFilterMgrRef mxFilterMgr
All drawing objects.
XclExpXmlPivotTableManager & GetXmlPivotTableManager()
XclExpPalette & GetPalette() const
Returns the color buffer.
void Finalize()
Reduces the XF record list to the maximum allowed number of records.
The main class for pivot table export.
XclExpNumFmtBuffer & GetNumFmtBuffer() const
Returns the number format buffer.
const OUString & GetValue() const
Stores all used colors in the document.
Stores the correct Excel sheet index for each Calc sheet.
SfxItemSet * GetItemSet() const
XclExpTablesManager & GetTablesManager()
XclExpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
XclExpTabInfo & GetTabInfo() const
Returns the buffer for Calc->Excel sheet index conversion.
bool mbRelUrl
mapping between op-codes and names
bool IsSaveRelINet() const
XclExpRecordRef CreateRecord(sal_uInt16 nRecId) const
Returns the reference to a record (or record list) representing a root object.
void InitializeSave()
Is called before export filter starts to write the records to the stream.
void Finalize()
Reduces the color list to the maximum count of the current BIFF version.
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
XclExpSst & GetSst() const
Returns the shared string table.
const sal_uInt16 EXC_ID_XFLIST
For internal use only.
Stores all data for database ranges (tables in Excel speak).
const sal_uInt16 EXC_ID_SST
void SetCurrScTab(SCTAB nScTab)
Sets the current Calc sheet index.
SfxMedium & mrMedium
Current Output format.
Provides functions to convert Calc cell addresses to Excel cell addresses.
XclExpNumFmtBfrRef mxNumFmtBfr
All fonts in the file.
void Initialize()
Inserts predefined built-in styles and user-defined styles.
XclExpDxfsRef mxDxfs
All pivot tables and pivot caches.
std::shared_ptr< XclExpTablesManager > mxTablesMgr
const sal_uInt16 EXC_ID_PALETTE
Stores all data for internal/external references (the link table).
XclExpSstRef mxSst
The export progress bar.
XclExpPTableMgrRef mxPTableMgr
Manager for filtered areas in all sheets.
Stores the data of all fonts used in the document.
css::uno::Sequence< css::beans::NamedValue > GetEncryptionData() const
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.
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
void Initialize()
Creates NAME records for built-in and user defined names.
const sal_uInt16 EXC_ID_FORMATLIST
For internal use only.
bool IsDocumentEncrypted() const
XclExpPaletteRef mxPalette
The shared string table.
SfxObjectShell * GetDocumentShell() const
#define SAL_WARN(area, stream)
XclExpTabInfoRef mxTabInfo
XclExpLinkMgrRef mxGlobLinkMgr
Internal defined names.
virtual ~XclExpRootData() override
XclExpProgressRef mxProgress
The formula compiler.
bool isOptionEnabled(Option eOption) const
XclExpFmlaCompRef mxFmlaComp
The address converter.
bool IsInGlobals() const
Returns the current Calc sheet index.
XclExpXFBuffer & GetXFBuffer() const
Returns the cell formatting attributes buffer.
XclExpFontBuffer & GetFontBuffer() const
Returns the font buffer.
Provides export of the SST (shared string table) record.
Access to global data for a filter object (imported or exported document) from other classes...
SfxMedium & GetMedium() const
Returns the medium to import from.
ScCompiler::OpCodeMapPtr mxOpCodeMap
XclExpLinkMgrRef mxLocLinkMgr
Global link manager for defined names.