summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2024-06-17 11:16:19 +0200
committerHossein <hossein@libreoffice.org>2024-07-01 11:23:28 +0200
commit830ba03622b89992b1aef6fb8bf25680a68d5fdf (patch)
tree65c7c2cecdc91dcd18f75ff1caf7730a853f22a6
parent7b428b160780c1a60a947ecc99b148456d9f4eea (diff)
Fix unwanted code behavior change in sc/
While changing the code to use std::optional instead of bool, some unwanted code behavior changes were introduced in this commit: commit fbe8071e4f6be57d3e372d69a4c7cc4d37a83eb9 Date: Sat Oct 15 14:20:31 2022 +0200 refactor functions: return optional instead of bool Part of those unwanted changes are fixed in this commit: commit 243e811abc441ec7f55e1395f23343dfa6f7c812 Date: Wed Jun 5 10:14:49 2024 +0100 cid#1603200 Uninitialized scalar variable cid#1603199 Uninitialized scalar variable This commit undoes changes in the above (second) commit, and tries to fix the problems by making the code look closer to what it was before the first commit. Change-Id: I47d692a5cf46abad582d7f162e2180e6c26b7e5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169037 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
-rw-r--r--sc/source/filter/excel/xeformula.cxx52
-rw-r--r--sc/source/filter/excel/xelink.cxx149
-rw-r--r--sc/source/filter/inc/xelink.hxx18
3 files changed, 106 insertions, 113 deletions
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index 16bd88715d54..162f8f2968b7 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -452,13 +452,6 @@ private:
void AppendExt( double fData );
void AppendExt( const OUString& rString );
- std::optional<std::pair<sal_uInt16, sal_uInt16>> InsertDde(const OUString& rApplic, const OUString& rTopic, const OUString& rItem)
- {
- if (!mxData->mpLinkMgr)
- return {};
- return mxData->mpLinkMgr->InsertDde(rApplic, rTopic, rItem);
- }
-
private:
typedef std::map< XclFormulaType, XclExpCompConfig > XclExpCompConfigMap;
typedef std::shared_ptr< XclExpCompData > XclExpCompDataRef;
@@ -1299,14 +1292,15 @@ void XclExpFmlaCompImpl::ProcessDdeLink( const XclExpScToken& rTokData )
if( mxData->mbOk ) mxData->mbOk = !aApplic.isEmpty() && !aTopic.isEmpty() && !aItem.isEmpty();
if( mxData->mbOk )
{
- const auto oResult = InsertDde(aApplic, aTopic, aItem);
-
- if ( oResult ) {
- AppendNameXToken( oResult->first, oResult->second, rTokData.mnSpaces );
- }
- else {
- AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces );
+ if ( mxData->mpLinkMgr )
+ {
+ if( const auto& rResult = mxData->mpLinkMgr->InsertDde( aApplic, aTopic, aItem ) )
+ AppendNameXToken( rResult->mnSupbook, rResult->mnSBTab, rTokData.mnSpaces );
+ else
+ AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces );
}
+ else
+ AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces );
}
}
@@ -2225,12 +2219,12 @@ void XclExpFmlaCompImpl::ProcessExternalName( const XclExpScToken& rTokData )
}
// insert the new external name and create the tNameX token
- if (const OUString* pFile = rExtRefMgr.getExternalFileName( nFileId )) {
-
-
- const auto oResult = mxData->mpLinkMgr->InsertExtName( *pFile, aName, xArray );
- if( oResult ) {
- AppendNameXToken( oResult->first, oResult->second, rTokData.mnSpaces );
+ const OUString* pFile = rExtRefMgr.getExternalFileName( nFileId );
+ if ( pFile )
+ {
+ if ( const auto& rResult = mxData->mpLinkMgr->InsertExtName( *pFile, aName, xArray ) )
+ {
+ AppendNameXToken( rResult->mnSupbook, rResult->mnSBTab, rTokData.mnSpaces );
return;
}
}
@@ -2441,10 +2435,9 @@ void XclExpFmlaCompImpl::AppendAddInCallToken( const XclExpExtFuncData& rExtFunc
OUString aXclFuncName;
if( mxData->mpLinkMgr && ScGlobal::GetAddInCollection()->GetExcelName( rExtFuncData.maFuncName, GetUILanguage(), aXclFuncName ) )
{
- const auto oResult = mxData->mpLinkMgr->InsertAddIn( aXclFuncName );
- if (oResult)
+ if ( const auto& rResult = mxData->mpLinkMgr->InsertAddIn( aXclFuncName ) )
{
- AppendNameXToken(oResult->first, oResult->second);
+ AppendNameXToken( rResult->mnSupbook, rResult->mnSBTab );
return;
}
}
@@ -2455,14 +2448,13 @@ void XclExpFmlaCompImpl::AppendEuroToolCallToken( const XclExpExtFuncData& rExtF
{
if ( mxData->mpLinkMgr )
{
- const auto oResult = mxData->mpLinkMgr->InsertEuroTool( rExtFuncData.maFuncName );
- if ( oResult )
- {
- AppendNameXToken( oResult->first, oResult->second );
- return;
- }
+ if( const auto& rResult = mxData->mpLinkMgr->InsertEuroTool( rExtFuncData.maFuncName ) )
+ AppendNameXToken( rResult->mnSupbook, rResult->mnSBTab );
+ else
+ AppendMacroCallToken( rExtFuncData );
}
- AppendMacroCallToken( rExtFuncData );
+ else
+ AppendMacroCallToken( rExtFuncData );
}
void XclExpFmlaCompImpl::AppendOperatorTokenId( sal_uInt8 nTokenId, const XclExpOperandListRef& rxOperands, sal_uInt8 nSpaces )
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 47217e2d775c..db68b16770c2 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -413,23 +413,21 @@ public:
void StoreCellRange( sal_uInt16 nFileId, const OUString& rTabName, const ScRange& rRange );
/** Finds or inserts an EXTERNNAME record for an add-in function name.
- * @return an optional pair, containing [rnSupbook, rnExtName]
+ * @return an optional struct, containing [mnSupbook, mnExtName]
rnSupbook Returns the index of the SUPBOOK record which contains the DDE link.
rnExtName Returns the 1-based EXTERNNAME record index.
*/
- std::optional<std::pair<sal_uInt16, sal_uInt16>> InsertAddIn(const OUString& rName);
+ std::optional<XclExpSBIndex> InsertAddIn(const OUString& rName);
/** InsertEuroTool */
- std::optional<std::pair<sal_uInt16, sal_uInt16>> InsertEuroTool(const OUString& rName);
+ std::optional<XclExpSBIndex> InsertEuroTool(const OUString& rName);
/** Finds or inserts an EXTERNNAME record for DDE links.
- * @return an optional pair, containing [rnSupbook, rnExtName]
+ * @return an optional struct, containing [mnSupbook, mnExtName]
* rnSupbook Returns the index of the SUPBOOK record which contains the DDE link.
rnExtName Returns the 1-based EXTERNNAME record index.
*/
- std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertDde(const OUString& rApplic, const OUString& rTopic, const OUString& rItem);
+ std::optional<XclExpSBIndex> InsertDde(const OUString& rApplic, const OUString& rTopic, const OUString& rItem);
- std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertExtName(const OUString& rUrl, const OUString& rName,
+ std::optional<XclExpSBIndex> InsertExtName(const OUString& rUrl, const OUString& rName,
const ScExternalRefCache::TokenArrayRef& rArray);
XclExpXti GetXti( sal_uInt16 nFileId, const OUString& rTabName, sal_uInt16 nXclTabSpan,
@@ -444,14 +442,6 @@ public:
/** Whether we need to write externalReferences or not. */
bool HasExternalReferences() const;
- struct XclExpSBIndex
- {
- sal_uInt16 mnSupbook; /// SUPBOOK index for an Excel sheet.
- sal_uInt16 mnSBTab; /// Sheet name index in SUPBOOK for an Excel sheet.
- void Set( sal_uInt16 nSupbook, sal_uInt16 nSBTab )
- { mnSupbook = nSupbook; mnSBTab = nSBTab; }
- };
-
private:
typedef XclExpRecordList< XclExpSupbook > XclExpSupbookList;
typedef XclExpSupbookList::RecordRefType XclExpSupbookRef;
@@ -508,17 +498,15 @@ public:
virtual void StoreCellRange( sal_uInt16 nFileId, const OUString& rTabName, const ScRange& rRange ) = 0;
/** Derived classes find or insert an EXTERNNAME record for an add-in function name. */
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>> InsertAddIn(const OUString& rName) = 0;
+ virtual std::optional<XclExpSBIndex> InsertAddIn(const OUString& rName) = 0;
/** InsertEuroTool */
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>> InsertEuroTool(const OUString& rName)
+ virtual std::optional<XclExpSBIndex> InsertEuroTool(const OUString& rName)
= 0;
/** Derived classes find or insert an EXTERNNAME record for DDE links. */
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertDde(const OUString& rApplic, const OUString& rTopic, const OUString& rItem) = 0;
+ virtual std::optional<XclExpSBIndex> InsertDde(const OUString& rApplic, const OUString& rTopic, const OUString& rItem) = 0;
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertExtName(const OUString& rUrl, const OUString& rName,
+ virtual std::optional<XclExpSBIndex> InsertExtName(const OUString& rUrl, const OUString& rName,
const ScExternalRefCache::TokenArrayRef& rArray)
= 0;
@@ -555,18 +543,14 @@ public:
virtual void StoreCell( sal_uInt16 nFileId, const OUString& rTabName, const ScAddress& rPos ) override;
virtual void StoreCellRange( sal_uInt16 nFileId, const OUString& rTabName, const ScRange& rRange ) override;
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertAddIn(const OUString& rName) override;
+ virtual std::optional<XclExpSBIndex> InsertAddIn(const OUString& rName) override;
/** InsertEuroTool */
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertEuroTool(const OUString& rName) override;
+ virtual std::optional<XclExpSBIndex> InsertEuroTool(const OUString& rName) override;
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertDde(const OUString& rApplic, const OUString& rTopic, const OUString& rItem) override;
+ virtual std::optional<XclExpSBIndex> InsertDde(const OUString& rApplic, const OUString& rTopic, const OUString& rItem) override;
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertExtName(const OUString& rUrl, const OUString& rName,
+ virtual std::optional<XclExpSBIndex> InsertExtName(const OUString& rUrl, const OUString& rName,
const ScExternalRefCache::TokenArrayRef& rArray) override;
virtual void Save( XclExpStream& rStrm ) override;
@@ -622,17 +606,13 @@ public:
virtual void StoreCell( sal_uInt16 nFileId, const OUString& rTabName, const ScAddress& rPos ) override;
virtual void StoreCellRange( sal_uInt16 nFileId, const OUString& rTabName, const ScRange& rRange ) override;
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertAddIn(const OUString& rName) override;
+ virtual std::optional<XclExpSBIndex> InsertAddIn(const OUString& rName) override;
/** InsertEuroTool */
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertEuroTool(const OUString& rName) override;
+ virtual std::optional<XclExpSBIndex> InsertEuroTool(const OUString& rName) override;
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertDde(const OUString& rApplic, const OUString& rTopic, const OUString& rItem) override;
+ virtual std::optional<XclExpSBIndex> InsertDde(const OUString& rApplic, const OUString& rTopic, const OUString& rItem) override;
- virtual std::optional<std::pair<sal_uInt16, sal_uInt16>>
- InsertExtName(const OUString& rUrl, const OUString& rName,
+ virtual std::optional<XclExpSBIndex> InsertExtName(const OUString& rUrl, const OUString& rName,
const ScExternalRefCache::TokenArrayRef& rArray) override;
virtual void Save( XclExpStream& rStrm ) override;
@@ -1856,7 +1836,7 @@ public:
explicit FindSBIndexEntry(sal_uInt16 nSupbookId, sal_uInt16 nTabId) :
mnSupbookId(nSupbookId), mnTabId(nTabId) {}
- bool operator()(const XclExpSupbookBuffer::XclExpSBIndex& r) const
+ bool operator()(const XclExpSBIndex& r) const
{
return mnSupbookId == r.mnSupbook && mnTabId == r.mnSBTab;
}
@@ -1965,7 +1945,7 @@ void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const OUString& rT
}
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpSupbookBuffer::InsertAddIn(const OUString& rName )
+std::optional<XclExpSBIndex> XclExpSupbookBuffer::InsertAddIn(const OUString& rName )
{
XclExpSupbookRef xSupbook;
if( mnAddInSB == SAL_MAX_UINT16 )
@@ -1977,57 +1957,57 @@ std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpSupbookBuffer::InsertAddI
xSupbook = maSupbookList.GetRecord( mnAddInSB );
OSL_ENSURE( xSupbook, "XclExpSupbookBuffer::InsertAddin - missing add-in supbook" );
- auto nExtName = xSupbook->InsertAddIn( rName );
+ sal_uInt16 nExtName = xSupbook->InsertAddIn( rName );
if( nExtName > 0)
{
- return std::make_pair(mnAddInSB, nExtName);
+ return XclExpSBIndex( mnAddInSB, nExtName );
}
return {};
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpSupbookBuffer::InsertEuroTool( const OUString& rName )
+std::optional<XclExpSBIndex> XclExpSupbookBuffer::InsertEuroTool( const OUString& rName )
{
XclExpSupbookRef xSupbook;
OUString aUrl( u"\001\010EUROTOOL.XLA"_ustr );
auto nSupbookId = GetSupbookUrl(xSupbook, aUrl);
- if (!nSupbookId)
+ if ( !nSupbookId )
{
xSupbook = new XclExpSupbook( GetRoot(), aUrl, XclSupbookType::Eurotool );
- nSupbookId = Append(xSupbook);
+ nSupbookId = Append( xSupbook );
}
auto nExtName = xSupbook->InsertEuroTool( rName );
if( nExtName > 0)
{
- return std::make_pair(*nSupbookId, nExtName);
+ return XclExpSBIndex( *nSupbookId, nExtName );
}
return {};
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpSupbookBuffer::InsertDde(
+std::optional<XclExpSBIndex> XclExpSupbookBuffer::InsertDde(
const OUString& rApplic, const OUString& rTopic, const OUString& rItem )
{
XclExpSupbookRef xSupbook;
- auto nSupbookDde = GetSupbookDde( xSupbook, rApplic, rTopic );
- if (!nSupbookDde)
+ auto nSupbook = GetSupbookDde( xSupbook, rApplic, rTopic );
+ if( !nSupbook )
{
xSupbook = new XclExpSupbook( GetRoot(), rApplic, rTopic );
- nSupbookDde = Append(xSupbook);
+ nSupbook = Append( xSupbook );
}
auto nExtName = xSupbook->InsertDde( rItem );
if (nExtName > 0)
{
- return std::make_pair(*nSupbookDde, nExtName);
+ return XclExpSBIndex(*nSupbook, nExtName);
}
return {};
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpSupbookBuffer::InsertExtName( const OUString& rUrl,
+std::optional<XclExpSBIndex> XclExpSupbookBuffer::InsertExtName( const OUString& rUrl,
const OUString& rName, const ScExternalRefCache::TokenArrayRef& rArray )
{
XclExpSupbookRef xSupbook;
auto nSupbookId = GetSupbookUrl(xSupbook, rUrl);
- if (!nSupbookId)
+ if ( !nSupbookId )
{
xSupbook = new XclExpSupbook(GetRoot(), rUrl);
nSupbookId = Append(xSupbook);
@@ -2036,7 +2016,7 @@ std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpSupbookBuffer::InsertExtN
auto nExtName = xSupbook->InsertExtName(rName, rArray);
if (nExtName > 0)
{
- return std::make_pair(*nSupbookId, nExtName);
+ return XclExpSBIndex( *nSupbookId, nExtName );
}
return {};
}
@@ -2262,7 +2242,7 @@ void XclExpLinkManagerImpl5::StoreCellRange( sal_uInt16 /*nFileId*/, const OUStr
// not implemented
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManagerImpl5::InsertAddIn( const OUString& rName )
+std::optional<XclExpSBIndex> XclExpLinkManagerImpl5::InsertAddIn( const OUString& rName )
{
sal_uInt16 nExtSheet, nExtName;
XclExpExtSheetRef xExtSheet = FindInternal( nExtSheet, EXC_EXTSH_ADDIN );
@@ -2271,25 +2251,25 @@ std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManagerImpl5::InsertA
nExtName = xExtSheet->InsertAddIn( rName );
if(nExtName > 0)
{
- return std::make_pair(nExtSheet, nExtName);
+ return XclExpSBIndex( nExtSheet, nExtName );
}
}
return {};
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManagerImpl5::InsertEuroTool( const OUString& /*rName*/ )
+std::optional<XclExpSBIndex> XclExpLinkManagerImpl5::InsertEuroTool( const OUString& /*rName*/ )
{
return {};
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManagerImpl5::InsertDde(
+std::optional<XclExpSBIndex> XclExpLinkManagerImpl5::InsertDde(
const OUString& /*rApplic*/, const OUString& /*rTopic*/, const OUString& /*rItem*/ )
{
// not implemented
return {};
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManagerImpl5::InsertExtName( const OUString& /*rUrl*/,
+std::optional<XclExpSBIndex> XclExpLinkManagerImpl5::InsertExtName( const OUString& /*rUrl*/,
const OUString& /*rName*/, const ScExternalRefCache::TokenArrayRef& /*rArray*/ )
{
// not implemented
@@ -2461,37 +2441,48 @@ void XclExpLinkManagerImpl8::StoreCellRange( sal_uInt16 nFileId, const OUString&
maSBBuffer.StoreCellRange(nFileId, rTabName, rRange);
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManagerImpl8::InsertAddIn( const OUString& rName )
+std::optional<XclExpSBIndex> XclExpLinkManagerImpl8::InsertAddIn( const OUString& rName )
{
- const auto& rResult = maSBBuffer.InsertAddIn(rName);
- if (rResult)
- return std::make_pair(InsertXti( XclExpXti( rResult->first, EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ), rResult->second);
+ const auto & rResult = maSBBuffer.InsertAddIn( rName );
+ if( rResult )
+ {
+ return XclExpSBIndex(InsertXti( XclExpXti( rResult->mnSupbook, EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ), rResult->mnSBTab);
+ }
return {};
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManagerImpl8::InsertEuroTool( const OUString& rName )
+std::optional<XclExpSBIndex> XclExpLinkManagerImpl8::InsertEuroTool( const OUString& rName )
{
- const auto& rResult = maSBBuffer.InsertEuroTool(rName);
- if (rResult)
- return std::make_pair(InsertXti( XclExpXti( rResult->first, EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ), rResult->second);
+ const auto & rResult = maSBBuffer.InsertEuroTool( rName );
+ if( rResult )
+ {
+ return XclExpSBIndex(InsertXti( XclExpXti( rResult->mnSupbook, EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ),
+ rResult->mnSBTab);
+ }
return {};
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManagerImpl8::InsertDde(
+std::optional<XclExpSBIndex> XclExpLinkManagerImpl8::InsertDde(
const OUString& rApplic, const OUString& rTopic, const OUString& rItem )
{
- const auto& rResult = maSBBuffer.InsertDde(rApplic, rTopic, rItem);
- if (rResult)
- return std::make_pair(InsertXti( XclExpXti( rResult->first, EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ), rResult->second);
+ const auto & rResult = maSBBuffer.InsertDde( rApplic, rTopic, rItem );
+ if( rResult )
+ {
+ return XclExpSBIndex(InsertXti( XclExpXti( rResult->mnSupbook, EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ),
+ rResult->mnSBTab);
+ }
return {};
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManagerImpl8::InsertExtName( const OUString& rUrl, const OUString& rName,
+std::optional<XclExpSBIndex> XclExpLinkManagerImpl8::InsertExtName( const OUString& rUrl, const OUString& rName,
const ScExternalRefCache::TokenArrayRef& rArray )
{
- const auto& rResult = maSBBuffer.InsertExtName(rUrl, rName, rArray);
- if (rResult)
- return std::make_pair(InsertXti( XclExpXti( rResult->first, EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ), rResult->second);
+ const auto & rResult = maSBBuffer.InsertExtName( rUrl, rName, rArray );
+ if( rResult )
+ {
+ return XclExpSBIndex(InsertXti( XclExpXti( rResult->mnSupbook, EXC_TAB_EXTERNAL, EXC_TAB_EXTERNAL ) ),
+ rResult->mnSBTab);
+ }
return {};
}
@@ -2611,23 +2602,23 @@ void XclExpLinkManager::StoreCellRange( sal_uInt16 nFileId, const OUString& rTab
mxImpl->StoreCellRange(nFileId, rTabName, rRange);
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManager::InsertAddIn( const OUString& rName )
+std::optional<XclExpSBIndex> XclExpLinkManager::InsertAddIn( const OUString& rName )
{
return mxImpl->InsertAddIn( rName );
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManager::InsertEuroTool( const OUString& rName )
+std::optional<XclExpSBIndex> XclExpLinkManager::InsertEuroTool( const OUString& rName )
{
return mxImpl->InsertEuroTool( rName );
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManager::InsertDde(
+std::optional<XclExpSBIndex> XclExpLinkManager::InsertDde(
const OUString& rApplic, const OUString& rTopic, const OUString& rItem )
{
return mxImpl->InsertDde( rApplic, rTopic, rItem );
}
-std::optional<std::pair<sal_uInt16, sal_uInt16>> XclExpLinkManager::InsertExtName( const OUString& rUrl, const OUString& rName,
+std::optional<XclExpSBIndex> XclExpLinkManager::InsertExtName( const OUString& rUrl, const OUString& rName,
const ScExternalRefCache::TokenArrayRef& rArray )
{
return mxImpl->InsertExtName( rUrl, rName, rArray);
diff --git a/sc/source/filter/inc/xelink.hxx b/sc/source/filter/inc/xelink.hxx
index d71a732e4dcd..a4bef778b991 100644
--- a/sc/source/filter/inc/xelink.hxx
+++ b/sc/source/filter/inc/xelink.hxx
@@ -55,6 +55,16 @@ namespace o3tl {
template<> struct typed_flags<ExcTabBufFlags> : is_typed_flags<ExcTabBufFlags, 0x73> {};
}
+struct XclExpSBIndex
+{
+ sal_uInt16 mnSupbook; /// SUPBOOK index for an Excel sheet.
+ sal_uInt16 mnSBTab; /// Sheet name index in SUPBOOK for an Excel sheet.
+ void Set( sal_uInt16 nSupbook, sal_uInt16 nSBTab )
+ { mnSupbook = nSupbook; mnSBTab = nSBTab; }
+ XclExpSBIndex( sal_uInt16 nSupbook, sal_uInt16 nSBTab ) : mnSupbook(nSupbook), mnSBTab(nSBTab) {}
+ XclExpSBIndex() {}
+};
+
/** Stores the correct Excel sheet index for each Calc sheet.
@descr The class knows all sheets which will not exported
(i.e. external link sheets, scenario sheets). */
@@ -189,17 +199,17 @@ public:
rnExtName Returns the 1-based EXTERNNAME record index.
sc/source/filter/inc/xelink.hxx
@return [rnExtSheet, rnExtName] as an optional pair. If empty, it's not supported in current BIFF.*/
- std::optional<std::pair<sal_uInt16, sal_uInt16>> InsertAddIn(const OUString& rName);
+ std::optional<XclExpSBIndex> InsertAddIn(const OUString& rName);
/** InsertEuroTool */
- std::optional<std::pair<sal_uInt16, sal_uInt16>> InsertEuroTool(const OUString& rName);
+ std::optional<XclExpSBIndex> InsertEuroTool(const OUString& rName);
/** Finds or inserts an EXTERNNAME record for DDE links.
rnExtSheet Returns the index of the EXTSHEET structure for the DDE link.
rnExtName Returns the 1-based EXTERNNAME record index.
@return [rnExtSheet, rnExtName] as an optional pair. If empty, it's not supported in current BIFF. */
- std::optional<std::pair<sal_uInt16, sal_uInt16>>
+ std::optional<XclExpSBIndex>
InsertDde(const OUString& rApplic, const OUString& rTopic, const OUString& rItem);
- std::optional<std::pair<sal_uInt16, sal_uInt16>>
+ std::optional<XclExpSBIndex>
InsertExtName(const OUString& rUrl, const OUString& rName,
const ScExternalRefCache::TokenArrayRef& rArray);