diff options
author | László Németh <nemeth@numbertext.org> | 2019-04-10 10:34:31 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-04-10 17:12:18 +0200 |
commit | 9d63c7035a86bb3a355433b567d2d8cd53d582fa (patch) | |
tree | b0cb3f9e578aecd95971bf6591162d206c4e31a4 /sc/source/filter/excel | |
parent | a1700d52a47184ee07b91b461a846dc5435f0022 (diff) |
tdf#115159 XLSX export: don't duplicate print titles
In FindBuiltInNameIdx(), check the duplication by
using the exported symbol of the ranges, instead
of the (in the case of whole rows) always different
XclTokenArray data.
Change-Id: Iba439d765bbbfaf5379113548f3d86d1c984e71c
Reviewed-on: https://gerrit.libreoffice.org/70507
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc/source/filter/excel')
-rw-r--r-- | sc/source/filter/excel/xename.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 625578743f80..c0db80cbafba 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -70,8 +70,8 @@ public: @return The built-in name index or EXC_BUILTIN_UNKNOWN for user-defined names. */ sal_Unicode GetBuiltInName() const { return mcBuiltIn; } - /** Returns the token array for this defined name. */ - const XclTokenArrayRef& GetTokenArray() const { return mxTokArr; } + /** Returns the symbol value for this defined name. */ + const OUString& GetSymbol() const { return msSymbol; } /** Returns true, if this is a document-global defined name. */ bool IsGlobal() const { return mnXclTab == EXC_NAME_GLOBAL; } @@ -157,7 +157,7 @@ private: /** Returns the index of an existing built-in NAME record with the passed definition, otherwise 0. */ sal_uInt16 FindBuiltInNameIdx( const OUString& rName, - const XclTokenArray& rTokArr ) const; + const OUString& sSymbol ) const; /** Returns an unused name for the passed name. */ OUString GetUnusedName( const OUString& rName ) const; @@ -525,7 +525,7 @@ sal_uInt16 XclExpNameManagerImpl::FindNamedExp( SCTAB nTab, OUString sName ) } sal_uInt16 XclExpNameManagerImpl::FindBuiltInNameIdx( - const OUString& rName, const XclTokenArray& rTokArr ) const + const OUString& rName, const OUString& sSymbol ) const { /* Get built-in index from the name. Special case: the database range 'unnamed' will be mapped to Excel's built-in '_FilterDatabase' name. */ @@ -537,11 +537,9 @@ sal_uInt16 XclExpNameManagerImpl::FindBuiltInNameIdx( for( size_t nPos = 0; nPos < mnFirstUserIdx; ++nPos ) { XclExpNameRef xName = maNameList.GetRecord( nPos ); - if( xName->GetBuiltInName() == cBuiltIn ) + if( xName->GetBuiltInName() == cBuiltIn && xName->GetSymbol() == sSymbol ) { - XclTokenArrayRef xTokArr = xName->GetTokenArray(); - if( xTokArr && (*xTokArr == rTokArr) ) - return static_cast< sal_uInt16 >( nPos + 1 ); + return static_cast< sal_uInt16 >( nPos + 1 ); } } } @@ -628,7 +626,7 @@ sal_uInt16 XclExpNameManagerImpl::CreateName( SCTAB nTab, const ScRangeData& rRa cannot be done earlier. If a built-in name is found, the created NAME record for this name and all following records in the list must be deleted, otherwise they may contain wrong name list indexes. */ - sal_uInt16 nBuiltInIdx = FindBuiltInNameIdx( rName, *xTokArr ); + sal_uInt16 nBuiltInIdx = FindBuiltInNameIdx( rName, sSymbol ); if( nBuiltInIdx != 0 ) { // delete the new NAME records |