22#include <document.hxx>
46bool extractFilePath(
const OUString& rUrl, OUString& rPath)
48 const char*
prefix =
"Excel.Sheet.8\3";
49 size_t nPrefixLen = ::std::strlen(prefix);
51 sal_Int32
n = rUrl.getLength();
52 if (n <=
static_cast<sal_Int32
>(nPrefixLen))
71 rPath =
aBuf.makeStringAndClear();
78 mnFileId(0), mbExternal(false)
95 if (!pFileUrl || pFileUrl->isEmpty() || !
GetDocShell())
107 rFirstTab = rLastTab = 0;
128 if (!extractFilePath(*pUrl, aPath))
141 bool bArrayFormula =
false;
145 const bool bRangeNameOrCond = bRangeName || bCondFormat;
147 const bool bRNorSF = bRangeNameOrCond || bSharedFormula;
153 if( nFormulaLen == 0 )
161 std::size_t nEndPos = aIn.
GetRecPos() + nFormulaLen;
163 while( (aIn.
GetRecPos() < nEndPos) && !bError )
178 bArrayFormula =
true;
299 sal_uInt16 nCol, nRow;
318 if( nEptg == 0x02 || nEptg == 0x06 )
372 sal_uInt16 nData(0), nFactor(0);
382 aIn.
Ignore(
static_cast<std::size_t
>(nData) * nFactor);
384 else if( nOpt & 0x10 )
457 DoMulArgs( pFuncInfo->meOpCode, pFuncInfo->mnMaxParamCount );
472 DoMulArgs( pFuncInfo->meOpCode, nParamCount );
486 if (
pName->IsMacro())
501 sal_uInt16 nCol, nRow;
531 sal_uInt16 nRowFirst, nRowLast;
532 sal_uInt16 nColFirst, nColLast;
595 sal_uInt16 nRow, nCol;
612 sal_uInt16 nRowFirst, nRowLast;
613 sal_uInt16 nColFirst, nColLast;
653 OUString aString =
"COMM_EQU_FUNC";
655 aString += OUString::number( nByte );
665 sal_uInt16 nXtiIndex, nNameIdx;
676 if (
pName->GetScRangeData())
684 switch( pExtName->GetType() )
701 pExtName->CreateExtNameData(
GetDoc(), nFileId);
716 OUString aApplic, aTopic;
725 pExtName->CreateDdeData(
GetDoc(), aApplic, aTopic );
779 sal_uInt16 nIxti, nRw, nGrbitCol;
780 SCTAB nTabFirst, nTabLast;
817 if (nTabLast != nTabFirst)
831 if( nTabLast != nTabFirst )
850 sal_uInt16 nIxti, nRw1, nGrbitCol1, nRw2, nGrbitCol2;
851 SCTAB nTabFirst, nTabLast;
930 else if( bArrayFormula )
932 rpTokArray =
nullptr;
956 const bool bRangeName = eFT ==
FT_RangeName || bCondFormat;
958 const bool bRNorSF = bRangeName || bSharedFormula;
963 if( nFormulaLen == 0 )
966 std::size_t nEndPos = aIn.
GetRecPos() + nFormulaLen;
968 while( (aIn.
GetRecPos() < nEndPos) && !bError )
1013 sal_uInt16 nData(0), nFactor(0);
1023 aIn.
Ignore(
static_cast<std::size_t
>(nData) * nFactor);
1061 sal_uInt16 nCol, nRow;
1067 aSRD.
SetFlag3D( bRangeName && !bCondFormat );
1078 sal_uInt16 nRowFirst, nRowLast;
1079 sal_uInt16 nColFirst, nColLast;
1090 rSRef1.
SetFlag3D( bRangeName && !bCondFormat );
1091 rSRef2.
SetFlag3D( bRangeName && !bCondFormat );
1135 sal_uInt16 nRow, nCol;
1152 sal_uInt16 nRowFirst, nRowLast;
1153 sal_uInt16 nColFirst, nColLast;
1196 sal_uInt16 nIxti, nRw, nGrbitCol;
1202 SCTAB nFirstScTab, nLastScTab;
1210 if( nFirstScTab != nLastScTab )
1226 sal_uInt16 nIxti, nRw1, nGrbitCol1, nRw2, nGrbitCol2;
1234 SCTAB nFirstScTab, nLastScTab;
1243 rR2.
SetFlag3D( nFirstScTab != nLastScTab );
1282 aIn.
Seek( nEndPos );
1287 const OUString& rUrl,
const vector<OUString>& rTabNames )
1295 bool bError =
false;
1300 if (nFormulaLen == 0)
1310 sal_uInt16 nTabCount =
static_cast< sal_uInt16
>( rTabNames.size() );
1312 std::size_t nEndPos =
rStrm.GetRecPos() + nFormulaLen;
1314 while( (
rStrm.GetRecPos() < nEndPos) && !bError )
1316 nOp =
rStrm.ReaduInt8();
1326 nByte =
rStrm.ReaduInt8();
1348 sal_uInt16 nExtTab1, nExtTab2, nRow, nGrbitCol;
1349 nExtTab1 =
rStrm.ReaduInt16();
1350 nExtTab2 =
rStrm.ReaduInt16();
1351 nRow =
rStrm.ReaduInt16();
1352 nGrbitCol =
rStrm.ReaduInt16();
1353 if (nExtTab1 >= nTabCount || nExtTab2 >= nTabCount)
1363 OUString aTabName = rTabNames[nExtTab1];
1365 if (nExtTab1 == nExtTab2)
1381 sal_uInt16 nExtTab1, nExtTab2, nRow1, nRow2, nGrbitCol1, nGrbitCol2;
1382 nExtTab1 =
rStrm.ReaduInt16();
1383 nExtTab2 =
rStrm.ReaduInt16();
1384 nRow1 =
rStrm.ReaduInt16();
1385 nRow2 =
rStrm.ReaduInt16();
1386 nGrbitCol1 =
rStrm.ReaduInt16();
1387 nGrbitCol2 =
rStrm.ReaduInt16();
1389 if (nExtTab1 >= nTabCount || nExtTab2 >= nTabCount)
1406 OUString aTabName = rTabNames[nExtTab1];
1413 bError |= !
rStrm.IsValid();
1422 else if(
rStrm.GetRecPos() != nEndPos )
1438 const bool bColRel = ( nC & 0x4000 ) != 0;
1439 const bool bRowRel = ( nC & 0x8000 ) != 0;
1452 nRelCol =
static_cast<sal_Int16
>(256 +
static_cast<int>(nRelCol));
1462 SCROW nRelRow =
static_cast<sal_Int16
>(nRow);
1467 nRelRow = 65536 + nRelRow;
1494 sal_uInt16 nRow1, nRow2, nCol1, nCol2;
1500 std::size_t nEndPos = aIn.
GetRecPos() + nLen;
1668 aIn.
Seek( nEndPos );
bool ValidTab(SCTAB nTab)
virtual void ConvertExternName(std::unique_ptr< ScTokenArray > &rpArray, XclImpStream &rStrm, std::size_t nFormulaLen, const OUString &rUrl, const ::std::vector< OUString > &rTabNames) override
void ExcRelToScRel8(sal_uInt16 nRow, sal_uInt16 nCol, ScSingleRefData &, const bool bName)
virtual void GetAbsRefs(ScRangeList &rRangeList, XclImpStream &rStrm, std::size_t nLen) override
virtual ConvErr Convert(std::unique_ptr< ScTokenArray > &rpTokArray, XclImpStream &rStrm, std::size_t nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT=FT_CellFormula) override
bool HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName &rExtName, ExternalTabInfo &rExtInfo)
const XclImpLinkManager & rLinkMan
virtual ~ExcelToSc8() override
ExcelToSc8(XclImpRoot &rRoot)
static bool IsComplRowRange(const sal_uInt16 nRow1, const sal_uInt16 nRow2)
bool GetExternalFileIdFromXti(sal_uInt16 nIxti, sal_uInt16 &rFileId) const
virtual bool Read3DTabReference(sal_uInt16 nIxti, SCTAB &rFirstTab, SCTAB &rLastTab, ExternalTabInfo &rExtInfo)
void ReadExtensions(const ExtensionTypeVec &rExtensions, XclImpStream &aIn)
::std::vector< ExtensionType > ExtensionTypeVec
XclFunctionProvider maFuncProv
void DoMulArgs(DefTokenId eId, sal_uInt8 nNumArgs)
void SetComplCol(ScComplexRefData &)
static bool IsComplColRange(const sal_uInt16 nCol1, const sal_uInt16 nCol2)
void SetComplRow(ScComplexRefData &)
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
void SetLinkFormulaNeedingCheck(bool bSet)
sal_uInt16 getExternalFileId(const OUString &rFile)
static SC_DLLPUBLIC OUString GetAbsDocName(const OUString &rFileName, const SfxObjectShell *pShell)
void Append(const ScAddress &aSRD, SCTAB nTab)
void push_back(const ScRange &rRange)
sal_uInt64 Seek(sal_uInt64 nPos)
TokenId StoreName(sal_uInt16 nIndex, sal_Int16 nSheet)
TokenId StoreExtName(sal_uInt16 nFileId, const OUString &rName)
TokenId StoreNlf(const ScSingleRefData &rTr)
TokenId StoreExtRef(sal_uInt16 nFileId, const OUString &rTabName, const ScSingleRefData &rRef)
std::unique_ptr< ScTokenArray > GetTokenArray(const ScDocument &rDoc, const TokenId &rId)
const XclFunctionInfo * GetFuncInfoFromXclFunc(sal_uInt16 nXclFunc) const
Returns the function data for an Excel function index, or 0 on error.
Stores contents of an external name.
bool CreateOleData(const ScDocument &rDoc, const OUString &rUrl, sal_uInt16 &rFileId, OUString &rTabName, ScRange &rRange) const
Create OLE link data.
bool GetScTabRange(SCTAB &rnFirstScTab, SCTAB &rnLastScTab, sal_uInt16 nXtiIndex) const
Returns the Calc sheet index range of the specified XTI entry.
bool GetLinkData(OUString &rApplic, OUString &rTopic, sal_uInt16 nXtiIndex) const
Tries to decode the URL of the specified XTI entry to OLE or DDE link components.
const OUString * GetSupbookUrl(sal_uInt16 nXtiIndex) const
bool IsSelfRef(sal_uInt16 nXtiIndex) const
Returns true, if the specified XTI entry contains an internal reference.
OUString GetSupbookTabName(sal_uInt16 nXti, sal_uInt16 nXtiTab) const
const XclImpExtName * GetExternName(sal_uInt16 nXtiIndex, sal_uInt16 nExtName) const
Returns the specified external name or 0 on error.
const XclImpName * GetName(sal_uInt16 nXclNameIdx) const
Returns the defined name specified by its Excel index.
Represents a defined name.
Access to global data from other classes.
XclImpAddressConverter & GetAddressConverter() const
Returns the address converter.
XclImpLinkManager & GetLinkManager() const
Returns the link manager.
ScDocumentImport & GetDocImport()
XclImpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
This class is used to import record oriented streams.
bool IsValid() const
Returns record reading state: false = record overread.
std::size_t GetRecPos() const
Returns the position inside of the whole record content.
void Seek(std::size_t nPos)
Seeks absolute in record content to the specified position.
OUString ReadUniString(sal_uInt16 nChars, sal_uInt8 nFlags)
Reads ext.
void Ignore(std::size_t nBytes)
Seeks forward inside the current record.
void IgnoreUniString(sal_uInt16 nChars, sal_uInt8 nFlags)
Ignores ext.
SfxObjectShell * GetDocShell() const
Returns the object shell of the Calc document.
XclTracer & GetTracer() const
Returns the filter tracer.
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
void TraceFormulaMissingArg()
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
Complex reference (a range) into the sheet.
SC_DLLPUBLIC ScRange toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
void InitRange(const ScRange &rRange)
Single reference (one address) into the sheet.
void SetAbsCol(SCCOL nVal)
void SetAbsTab(SCTAB nVal)
void SetAddress(const ScSheetLimits &rLimits, const ScAddress &rAddr, const ScAddress &rPos)
void InitAddress(const ScAddress &rAdr)
InitAddress: InitFlags and set address.
void SetRowRel(bool bVal)
void SetColDeleted(bool bVal)
void SetRelRow(SCROW nVal)
void SetRelTab(SCTAB nVal)
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
void SetAbsRow(SCROW nVal)
void SetRelCol(SCCOL nVal)
void SetFlag3D(bool bVal)
void InitFlags()
No default ctor, because used in ScRawToken union, set InitFlags!
void SetRowDeleted(bool bVal)
void SetColRel(bool bVal)
void SetTabDeleted(bool bVal)
Represents information for a spreadsheet function for import and export.
A 2D cell range address struct with Excel column and row indexes.
@ xlExtOLE
A DDE link range.
@ xlExtDDE
An add-in function name.
@ xlExtAddIn
An external defined name.
@ xlExtEuroConvert
An OLE object link.
const sal_uInt8 EXC_ERR_NA
const sal_uInt8 EXC_ERR_REF
const sal_uInt8 EXC_ERR_NAME
const sal_uInt8 EXC_ERR_NULL
DDE application-topic delimiter.
const sal_uInt8 EXC_ERR_VALUE
const sal_uInt8 EXC_ERR_DIV0
const sal_uInt8 EXC_ERR_NUM