summaryrefslogtreecommitdiffstats
path: root/basic/source/sbx/sbxvar.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/sbx/sbxvar.cxx')
-rw-r--r--basic/source/sbx/sbxvar.cxx43
1 files changed, 30 insertions, 13 deletions
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 8fb11bf9f2a2..cc57a804bc61 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -30,8 +30,12 @@
#include <sbunoobj.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
+#include <global.hxx>
+#include <unotools/transliterationwrapper.hxx>
#include <com/sun/star/uno/XInterface.hpp>
+#include <utility>
+#include <filefmt.hxx>
using namespace com::sun::star::uno;
// SbxVariable
@@ -179,10 +183,17 @@ void SbxVariable::SetParameters( SbxArray* p )
// Name of the variables
+// static
+OUString SbxVariable::NameToCaseInsensitiveName(const OUString& rName)
+{
+ return SbGlobal::GetTransliteration().transliterate(rName, 0, rName.getLength());
+}
+
void SbxVariable::SetName( const OUString& rName )
{
maName = rName;
nHash = MakeHashCode( rName );
+ maNameCI.clear();
}
const OUString& SbxVariable::GetName( SbxNameType t ) const
@@ -192,6 +203,12 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
{
return maName;
}
+ if (t == SbxNameType::CaseInsensitive)
+ {
+ if (maNameCI.isEmpty() && !maName.isEmpty())
+ maNameCI = NameToCaseInsensitiveName(maName);
+ return maNameCI;
+ }
// Request parameter-information (not for objects)
const_cast<SbxVariable*>(this)->GetInfo();
// Append nothing, if it is a simple property (no empty brackets)
@@ -499,7 +516,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
return true;
}
-bool SbxVariable::StoreData( SvStream& rStrm ) const
+std::pair<bool, sal_uInt32> SbxVariable::StoreData( SvStream& rStrm ) const
{
rStrm.WriteUChar( 0xFF ); // Marker
bool bValStore;
@@ -516,16 +533,16 @@ bool SbxVariable::StoreData( SvStream& rStrm ) const
// So that the method will not be executed in any case!
// CAST, to avoid const!
pThis->SetFlag( SbxFlagBits::NoBroadcast );
- bValStore = SbxValue::StoreData( rStrm );
+ bValStore = SbxValue::StoreData( rStrm ).first;
pThis->ResetFlag( SbxFlagBits::NoBroadcast );
}
else
{
- bValStore = SbxValue::StoreData( rStrm );
+ bValStore = SbxValue::StoreData( rStrm ).first;
}
if( !bValStore )
{
- return false;
+ return { false, 0 };
}
write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, maName,
RTL_TEXTENCODING_ASCII_US);
@@ -539,7 +556,7 @@ bool SbxVariable::StoreData( SvStream& rStrm ) const
{
rStrm.WriteUChar( 0 );
}
- return true;
+ return { true, B_IMG_VERSION_12 };
}
// SbxInfo
@@ -548,26 +565,26 @@ SbxInfo::SbxInfo()
: nHelpId(0)
{}
-SbxInfo::SbxInfo( const OUString& r, sal_uInt32 n )
- : aHelpFile( r ), nHelpId( n )
+SbxInfo::SbxInfo( OUString a, sal_uInt32 n )
+ : aHelpFile(std::move( a )), nHelpId( n )
{}
void SbxVariable::Dump( SvStream& rStrm, bool bFill )
{
OString aBNameStr(OUStringToOString(GetName( SbxNameType::ShortTypes ), RTL_TEXTENCODING_ASCII_US));
- rStrm.WriteCharPtr( "Variable( " )
- .WriteOString( OString::number(reinterpret_cast<sal_Int64>(this)) ).WriteCharPtr( "==" )
+ rStrm.WriteOString( "Variable( " )
+ .WriteOString( OString::number(reinterpret_cast<sal_IntPtr>(this)) ).WriteOString( "==" )
.WriteOString( aBNameStr );
OString aBParentNameStr(OUStringToOString(GetParent()->GetName(), RTL_TEXTENCODING_ASCII_US));
if ( GetParent() )
{
- rStrm.WriteCharPtr( " in parent '" ).WriteOString( aBParentNameStr ).WriteCharPtr( "'" );
+ rStrm.WriteOString( " in parent '" ).WriteOString( aBParentNameStr ).WriteOString( "'" );
}
else
{
- rStrm.WriteCharPtr( " no parent" );
+ rStrm.WriteOString( " no parent" );
}
- rStrm.WriteCharPtr( " ) " );
+ rStrm.WriteOString( " ) " );
// output also the object at object-vars
if ( GetValues_Impl().eType == SbxOBJECT &&
@@ -575,7 +592,7 @@ void SbxVariable::Dump( SvStream& rStrm, bool bFill )
GetValues_Impl().pObj != this &&
GetValues_Impl().pObj != GetParent() )
{
- rStrm.WriteCharPtr( " contains " );
+ rStrm.WriteOString( " contains " );
static_cast<SbxObject*>(GetValues_Impl().pObj)->Dump( rStrm, bFill );
}
else