22 #include <document.hxx>
46 bool 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 )
424 aStack <<
aPool.
Store( static_cast<double>(nUINT16) );
457 DoMulArgs( pFuncInfo->meOpCode, pFuncInfo->mnMaxParamCount );
472 DoMulArgs( pFuncInfo->meOpCode, nParamCount );
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;
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 )
1348 sal_uInt16 nExtTab1, nExtTab2, nRow, nGrbitCol;
1353 if (nExtTab1 >= nTabCount || nExtTab2 >= nTabCount)
1363 OUString aTabName = rTabNames[nExtTab1];
1365 if (nExtTab1 == nExtTab2)
1381 sal_uInt16 nExtTab1, nExtTab2, nRow1, nRow2, nGrbitCol1, nGrbitCol2;
1389 if (nExtTab1 >= nTabCount || nExtTab2 >= nTabCount)
1406 OUString aTabName = rTabNames[nExtTab1];
1433 rStrm.
Seek(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));
1457 rSRD.
SetAbsCol(static_cast<SCCOL>(nCol));
1462 SCROW nRelRow =
static_cast<sal_Int16
>(nRow);
1467 nRelRow = 65536 + nRelRow;
1472 rSRD.
SetAbsRow(std::min( static_cast<SCROW>(nRow),
GetDoc().MaxRow()));
1494 sal_uInt16 nRow1, nRow2, nCol1, nCol2;
1500 std::size_t nEndPos = aIn.
GetRecPos() + nLen;
1668 aIn.
Seek( nEndPos );
const sal_uInt8 EXC_ERR_NULL
DDE application-topic delimiter.
virtual void ConvertExternName(std::unique_ptr< ScTokenArray > &rpArray, XclImpStream &rStrm, std::size_t nFormulaLen, const OUString &rUrl, const ::std::vector< OUString > &rTabNames) override
const XclFunctionInfo * GetFuncInfoFromXclFunc(sal_uInt16 nXclFunc) const
Returns the function data for an Excel function index, or 0 on error.
ScDocumentImport & GetDocImport()
void Seek(std::size_t nPos)
Seeks absolute in record content to the specified position.
bool GetExternalFileIdFromXti(sal_uInt16 nIxti, sal_uInt16 &rFileId) const
const sal_uInt8 EXC_ERR_NA
std::size_t GetRecPos() const
Returns the position inside of the whole record content.
SC_DLLPUBLIC ScRange toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
Single reference (one address) into the sheet.
ScAddress toAbs(const ScSheetLimits &rLimits, const ScAddress &rPos) const
void SetRelCol(SCCOL nVal)
virtual ~ExcelToSc8() override
TokenId StoreExtName(sal_uInt16 nFileId, const OUString &rName)
static bool IsComplColRange(const sal_uInt16 nCol1, const sal_uInt16 nCol2)
::std::vector< ExtensionType > ExtensionTypeVec
void SetRelTab(SCTAB nVal)
bool IsValid() const
Returns record reading state: false = record overread.
void SetAbsRow(SCROW nVal)
sal_uInt16 getExternalFileId(const OUString &rFile)
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
void SetRowRel(bool bVal)
const XclImpName * GetName(sal_uInt16 nXclNameIdx) const
Returns the defined name specified by its Excel index.
static bool IsComplRowRange(const sal_uInt16 nRow1, const sal_uInt16 nRow2)
void SetRowDeleted(bool bVal)
void SetComplCol(ScComplexRefData &)
const sal_uInt8 EXC_ERR_NUM
virtual bool Read3DTabReference(sal_uInt16 nIxti, SCTAB &rFirstTab, SCTAB &rLastTab, ExternalTabInfo &rExtInfo)
bool GetScTabRange(SCTAB &rnFirstScTab, SCTAB &rnLastScTab, sal_uInt16 nXtiIndex) const
Returns the Calc sheet index range of the specified XTI entry.
SC_DLLPUBLIC ScExternalRefManager * GetExternalRefManager() const
void push_back(const ScRange &rRange)
void SetColDeleted(bool bVal)
TokenId StoreNlf(const ScSingleRefData &rTr)
const sal_uInt8 EXC_ERR_REF
void SetRelRow(SCROW nVal)
static SC_DLLPUBLIC OUString GetAbsDocName(const OUString &rFileName, const SfxObjectShell *pShell)
void TraceFormulaMissingArg()
Represents information for a spreadsheet function for import and export.
const sal_uInt8 EXC_ERR_VALUE
void SetFlag3D(bool bVal)
Stores contents of an external name.
void InitAddress(const ScAddress &rAdr)
InitAddress: InitFlags and set address.
void IgnoreUniString(sal_uInt16 nChars, sal_uInt8 nFlags)
Ignores ext.
void SetAbsCol(SCCOL nVal)
XclImpAddressConverter & GetAddressConverter() const
Returns the address converter.
const OUString & GetXclName() const
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
void SetLinkFormulaNeedingCheck(bool bSet)
const XclImpLinkManager & rLinkMan
XclImpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
void SetComplRow(ScComplexRefData &)
void SetAbsTab(SCTAB nVal)
TokenId StoreName(sal_uInt16 nIndex, sal_Int16 nSheet)
XclTracer & GetTracer() const
Returns the filter tracer.
const XclImpExtName * GetExternName(sal_uInt16 nXtiIndex, sal_uInt16 nExtName) const
Returns the specified external name or 0 on error.
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
std::unique_ptr< ScTokenArray > GetTokenArray(const ScDocument &rDoc, const TokenId &rId)
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. ...
void ExcRelToScRel8(sal_uInt16 nRow, sal_uInt16 nCol, ScSingleRefData &, const bool bName)
XclImpLinkManager & GetLinkManager() const
Returns the link manager.
OUString ReadUniString(sal_uInt16 nChars, sal_uInt8 nFlags)
Reads ext.
bool HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName &rExtName, ExternalTabInfo &rExtInfo)
void DoMulArgs(DefTokenId eId, sal_uInt8 nNumArgs)
bool CreateOleData(const ScDocument &rDoc, const OUString &rUrl, sal_uInt16 &rFileId, OUString &rTabName, ScRange &rRange) const
Create OLE link data.
virtual void GetAbsRefs(ScRangeList &rRangeList, XclImpStream &rStrm, std::size_t nLen) override
void Ignore(std::size_t nBytes)
Seeks forward inside the current record.
const sal_uInt8 EXC_ERR_NAME
void InitFlags()
No default ctor, because used in ScRawToken union, set InitFlags!
void InitRange(const ScRange &rRange)
const sal_uInt8 EXC_ERR_DIV0
void Append(const ScAddress &aSRD, SCTAB nTab)
void ReadExtensions(const ExtensionTypeVec &rExtensions, XclImpStream &aIn)
void SetAddress(const ScSheetLimits &rLimits, const ScAddress &rAddr, const ScAddress &rPos)
bool ConvertRange(ScRange &rScRange, const XclRange &rXclRange, SCTAB nScTab1, SCTAB nScTab2, bool bWarn)
Converts the passed Excel cell range to a Calc cell range.
TokenId StoreExtRef(sal_uInt16 nFileId, const OUString &rTabName, const ScSingleRefData &rRef)
virtual ConvErr Convert(std::unique_ptr< ScTokenArray > &rpTokArray, XclImpStream &rStrm, std::size_t nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT=FT_CellFormula) override
const OUString * GetSupbookUrl(sal_uInt16 nXtiIndex) const
Complex reference (a range) into the sheet.
SfxObjectShell * GetDocShell() const
Returns the object shell of the Calc document.
This class is used to import record oriented streams.
void SetTabDeleted(bool bVal)
bool IsSelfRef(sal_uInt16 nXtiIndex) const
Returns true, if the specified XTI entry contains an internal reference.
const ScRangeData * GetScRangeData() const
Access to global data from other classes.
void SetColRel(bool bVal)
ExcelToSc8(XclImpRoot &rRoot)
Represents a defined name.
bool ValidTab(SCTAB nTab)
XclFunctionProvider maFuncProv
OUString GetSupbookTabName(sal_uInt16 nXti, sal_uInt16 nXtiTab) const
A 2D cell range address struct with Excel column and row indexes.
An external defined name.
bool m_bDetectedRangeSegmentation false