diff options
Diffstat (limited to 'basic/source/sbx/sbxarray.cxx')
-rw-r--r-- | basic/source/sbx/sbxarray.cxx | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx index d8f16f5891c1..81ad5bf64ada 100644 --- a/basic/source/sbx/sbxarray.cxx +++ b/basic/source/sbx/sbxarray.cxx @@ -24,7 +24,9 @@ #include <basic/sbx.hxx> #include <runtime.hxx> +#include <cstddef> #include <optional> +#include <filefmt.hxx> struct SbxVarEntry { @@ -277,6 +279,7 @@ SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t ) return nullptr; bool bExtSearch = IsSet( SbxFlagBits::ExtSearch ); sal_uInt16 nHash = SbxVariable::MakeHashCode( rName ); + const OUString aNameCI = SbxVariable::NameToCaseInsensitiveName(rName); for (auto& rEntry : mVarEntries) { if (!rEntry.mpVar.is() || !rEntry.mpVar->IsVisible()) @@ -284,9 +287,10 @@ SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t ) // The very secure search works as well, if there is no hashcode! sal_uInt16 nVarHash = rEntry.mpVar->GetHashCode(); + // tdf#148358 - compare the names case-insensitive if ( (!nVarHash || nVarHash == nHash) && (t == SbxClassType::DontCare || rEntry.mpVar->GetClass() == t) - && (rEntry.mpVar->GetName().equalsIgnoreAsciiCase(rName))) + && (rEntry.mpVar->GetName(SbxNameType::CaseInsensitive) == aNameCI)) { p = rEntry.mpVar.get(); p->ResetFlag(SbxFlagBits::ExtFound); @@ -354,7 +358,7 @@ bool SbxArray::LoadData( SvStream& rStrm, sal_uInt16 /*nVer*/ ) return bRes; } -bool SbxArray::StoreData( SvStream& rStrm ) const +std::pair<bool, sal_uInt32> SbxArray::StoreData( SvStream& rStrm ) const { sal_uInt32 nElem = 0; // Which elements are even defined? @@ -364,17 +368,24 @@ bool SbxArray::StoreData( SvStream& rStrm ) const nElem++; } rStrm.WriteUInt16( nElem ); + + sal_uInt32 nVersion = B_IMG_VERSION_12; for( size_t n = 0; n < mVarEntries.size(); n++ ) { const SbxVarEntry& rEntry = mVarEntries[n]; if (rEntry.mpVar.is() && !(rEntry.mpVar->GetFlags() & SbxFlagBits::DontStore)) { rStrm.WriteUInt16( n ); - if (!rEntry.mpVar->Store(rStrm)) - return false; + const auto& [bSuccess, nVersionModule] = rEntry.mpVar->Store(rStrm); + if (!bSuccess) + return { false, 0 }; + else if (nVersionModule > nVersion) + { + nVersion = nVersionModule; + } } } - return true; + return { true, nVersion }; } // #100883 Method to set method directly to parameter array @@ -446,7 +457,7 @@ void SbxDimArray::unoAddDim( sal_Int32 lb, sal_Int32 ub ) bool SbxDimArray::GetDim( sal_Int32 n, sal_Int32& rlb, sal_Int32& rub ) const { - if( n < 1 || n > static_cast<sal_Int32>(m_vDimensions.size()) ) + if( n < 1 || o3tl::make_unsigned(n) > m_vDimensions.size() ) { SetError( ERRCODE_BASIC_OUT_OF_RANGE ); rub = rlb = 0; @@ -556,11 +567,11 @@ bool SbxDimArray::LoadData( SvStream& rStrm, sal_uInt16 nVer ) return SbxArray::LoadData( rStrm, nVer ); } -bool SbxDimArray::StoreData( SvStream& rStrm ) const +std::pair<bool, sal_uInt32> SbxDimArray::StoreData( SvStream& rStrm ) const { assert(m_vDimensions.size() <= sal::static_int_cast<size_t>(std::numeric_limits<sal_Int16>::max())); rStrm.WriteInt16( m_vDimensions.size() ); - for( sal_Int32 i = 1; i <= static_cast<sal_Int32>(m_vDimensions.size()); i++ ) + for( std::size_t i = 1; i <= m_vDimensions.size(); i++ ) { sal_Int32 lb32, ub32; GetDim(i, lb32, ub32); |