22#include <com/sun/star/sheet/XExternalSheetCache.hpp>
25#include <oox/token/namespaces.hxx>
26#include <oox/token/tokens.hxx>
27#include <osl/diagnose.h>
41 , mxSheetCache(rxSheetCache)
44 OSL_ENSURE(
mxSheetCache.is(),
"ExternalSheetDataContext::ExternalSheetDataContext - missing sheet cache" );
49 switch( getCurrentElement() )
51 case XLS_TOKEN( sheetData ):
52 if( nElement == XLS_TOKEN( row ) )
return this;
54 case XLS_TOKEN( row ):
55 if( nElement == XLS_TOKEN( cell ) ) {
importCell( rAttribs );
return this; }
57 case XLS_TOKEN( cell ):
58 if( nElement == XLS_TOKEN(
v ) )
return this;
66 if( !isCurrentElement( XLS_TOKEN(
v ) ) )
87 switch( getCurrentElement() )
125 double fValue = (
rStrm.readuInt8() == 0) ? 0.0 : 1.0;
159 const OUString& rFragmentPath,
ExternalLink& rExtLink ) :
161 mrExtLink( rExtLink ),
168 switch( getCurrentElement() )
171 if( nElement == XLS_TOKEN( externalLink ) )
return this;
174 case XLS_TOKEN( externalLink ):
183 case XLS_TOKEN( externalBook ):
186 case XLS_TOKEN( sheetNames ):
187 case XLS_TOKEN( definedNames ):
188 case XLS_TOKEN( sheetDataSet ):
return this;
192 case XLS_TOKEN( sheetNames ):
195 case XLS_TOKEN( definedNames ):
198 case XLS_TOKEN( sheetDataSet ):
203 case XLS_TOKEN( ddeLink ):
204 if( nElement == XLS_TOKEN( ddeItems ) )
return this;
206 case XLS_TOKEN( ddeItems ):
207 if( nElement == XLS_TOKEN( ddeItem ) )
213 case XLS_TOKEN( ddeItem ):
214 if( nElement == XLS_TOKEN(
values ) )
221 if( nElement == XLS_TOKEN(
value ) )
227 case XLS_TOKEN(
value ):
228 if( nElement == XLS_TOKEN( val ) )
return this;
231 case XLS_TOKEN( oleLink ):
232 if( nElement == XLS_TOKEN( oleItems ) )
return this;
234 case XLS_TOKEN( oleItems ):
243 if( isCurrentElement( XLS_TOKEN( val ) ) )
273 switch( getCurrentElement() )
324 static const RecordInfo spRecInfos[] =
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
std::optional< OUString > getString(sal_Int32 nAttrToken) const
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
static double calcDoubleFromError(sal_uInt8 nErrorCode)
Converts the passed BIFF error to a double containing the respective Calc error code.
static OUString readString(SequenceInputStream &rStrm, bool b32BitLen=true)
Reads a BIFF12 string with leading 16-bit or 32-bit length field.
virtual void onCharacters(const OUString &rChars) override
ExternalLinkFragment(const WorkbookHelper &rHelper, const OUString &rFragmentPath, ExternalLink &rExtLink)
virtual const ::oox::core::RecordInfo * getRecordInfos() const override
virtual void onEndElement() override
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
virtual ::oox::core::ContextHandlerRef onCreateRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
ExternalNameRef mxExtName
::oox::core::ContextHandlerRef createSheetDataContext(sal_Int32 nSheetId)
ExternalLinkType getLinkType() const
Returns the type of this external link.
void importExtSheetNames(SequenceInputStream &rStrm)
Imports the EXTSHEETNAMES record containing the sheet names in an externally linked document.
void importDefinedName(const AttributeList &rAttribs)
Imports the definedName element describing an external name.
void importDdeLink(const AttributeList &rAttribs)
Imports the ddeLink element describing a DDE link.
void importSheetName(const AttributeList &rAttribs)
Imports the sheetName element containing the sheet name in an externally linked document.
ExternalNameRef importExternalName(SequenceInputStream &rStrm)
Imports the EXTERNALNAME record describing an external name.
void importOleLink(const ::oox::core::Relations &rRelations, const AttributeList &rAttribs)
Imports the oleLink element describing an OLE link.
void importExternalBook(const ::oox::core::Relations &rRelations, const AttributeList &rAttribs)
Imports the externalBook element describing an externally linked document.
ExternalNameRef importOleItem(const AttributeList &rAttribs)
Imports the oleItem element describing an object of an OLE link.
ExternalNameRef importDdeItem(const AttributeList &rAttribs)
Imports the ddeItem element describing an item of a DDE link.
css::uno::Reference< css::sheet::XExternalSheetCache > getSheetCache(sal_Int32 nTabId) const
Returns the sheet cache of the external sheet with the passed index.
This class implements importing the sheetData element in external sheets.
void setCellValue(const css::uno::Any &rValue)
Sets the passed cell value to the current position in the sheet cache.
void importExtCellBool(SequenceInputStream &rStrm)
Imports the EXTCELL_BOOL from the passed stream.
void importExtCellBlank(SequenceInputStream &rStrm)
Imports the EXTCELL_BLANK from the passed stream.
void importExtCellDouble(SequenceInputStream &rStrm)
Imports the EXTCELL_DOUBLE from the passed stream.
sal_Int32 mnCurrType
Position of current cell.
void importExtCellError(SequenceInputStream &rStrm)
Imports the EXTCELL_ERROR from the passed stream.
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
void importCell(const AttributeList &rAttribs)
Imports cell settings from a c element.
virtual void onCharacters(const OUString &rChars) override
css::uno::Reference< css::sheet::XExternalSheetCache > mxSheetCache
ExternalSheetDataContext(WorkbookFragmentBase &rFragment, const css::uno::Reference< css::sheet::XExternalSheetCache > &rxSheetCache)
virtual ::oox::core::ContextHandlerRef onCreateRecordContext(sal_Int32 nRecId, SequenceInputStream &rStrm) override
void importExtCellString(SequenceInputStream &rStrm)
Imports the EXTCELL_STRING from the passed stream.
ScAddress maCurrPos
The sheet cache used to store external cell values.
Context handler derived from the WorkbookHelper helper class.
Fragment handler derived from the WorkbookHelper helper class.
Helper class to provide access to global workbook data.
AddressConverter & getAddressConverter() const
Returns the converter for string to cell address/range conversion.
UnitConverter & getUnitConverter() const
Returns the measurement unit converter.
const sal_Int32 XML_ROOT_CONTEXT
const sal_Int32 BIFF12_ID_EXTCELL_BLANK
const sal_Int32 BIFF12_ID_EXTCELL_STRING
const sal_Int32 BIFF12_ID_DDEITEMVALUES
const sal_Int32 BIFF12_ID_DDEITEM_ERROR
const sal_Int32 BIFF12_ID_EXTSHEETDATA
const sal_Int32 BIFF12_ID_EXTERNALNAMEFLAGS
const sal_uInt8 BIFF_ERR_NA
const sal_Int32 BIFF12_ID_DDEITEM_BOOL
const sal_Int32 BIFF12_ID_EXTERNALBOOK
const sal_Int32 BIFF12_ID_EXTCELL_DOUBLE
@ External
Link refers to the current sheet.
const sal_Int32 BIFF12_ID_EXTERNALNAME
const sal_Int32 BIFF12_ID_EXTROW
const sal_Int32 BIFF12_ID_DDEITEM_STRING
const sal_Int32 BIFF12_ID_EXTCELL_ERROR
const sal_Int32 BIFF12_ID_DDEITEM_DOUBLE
const sal_Int32 BIFF12_ID_EXTSHEETNAMES
const sal_Int32 BIFF12_ID_EXTCELL_BOOL
std::vector< char * > values