Kaydet (Commit) 0b8f1e21 authored tarafından Noel Grandin's avatar Noel Grandin

convert sfx2/source/doc/oleprops.hxx from String to OUString

Change-Id: Ib61bed6ae4ebc42dd5174350fed37d1df1ff73af
üst 01b33edc
......@@ -60,7 +60,7 @@ sal_uInt32 SFX2_DLLPUBLIC LoadOlePropertySet(
if( xGlobSect.get() )
{
// set supported properties
String aStrValue;
OUString aStrValue;
util::DateTime aDateTime;
if( xGlobSect->GetStringValue( aStrValue, PROPID_TITLE ) )
......@@ -103,7 +103,7 @@ sal_uInt32 SFX2_DLLPUBLIC LoadOlePropertySet(
if( xGlobSect->GetStringValue( aStrValue, PROPID_REVNUMBER ) )
{
sal_Int16 nRevision = static_cast< sal_Int16 >( aStrValue.ToInt32() );
sal_Int16 nRevision = static_cast< sal_Int16 >( aStrValue.toInt32() );
if ( nRevision > 0 )
i_xDocProps->setEditingCycles( nRevision );
}
......@@ -172,7 +172,7 @@ sal_uInt32 SFX2_DLLPUBLIC LoadOlePropertySet(
{
try
{
String aStrValue;
OUString aStrValue;
if ( xBuiltin->GetStringValue( aStrValue, PROPID_MANAGER ) )
xWriterProps->setManager( aStrValue );
if ( xBuiltin->GetStringValue( aStrValue, PROPID_CATEGORY ) )
......
......@@ -285,12 +285,12 @@ void SfxOleTextEncoding::SetCodePage( sal_uInt16 nCodePage )
// ----------------------------------------------------------------------------
String SfxOleStringHelper::LoadString8( SvStream& rStrm ) const
OUString SfxOleStringHelper::LoadString8( SvStream& rStrm ) const
{
return IsUnicode() ? ImplLoadString16( rStrm ) : ImplLoadString8( rStrm );
}
void SfxOleStringHelper::SaveString8( SvStream& rStrm, const String& rValue ) const
void SfxOleStringHelper::SaveString8( SvStream& rStrm, const OUString& rValue ) const
{
if( IsUnicode() )
ImplSaveString16( rStrm, rValue );
......@@ -298,19 +298,19 @@ void SfxOleStringHelper::SaveString8( SvStream& rStrm, const String& rValue ) co
ImplSaveString8( rStrm, rValue );
}
String SfxOleStringHelper::LoadString16( SvStream& rStrm ) const
OUString SfxOleStringHelper::LoadString16( SvStream& rStrm ) const
{
return ImplLoadString16( rStrm );
}
void SfxOleStringHelper::SaveString16( SvStream& rStrm, const String& rValue ) const
void SfxOleStringHelper::SaveString16( SvStream& rStrm, const OUString& rValue ) const
{
ImplSaveString16( rStrm, rValue );
}
String SfxOleStringHelper::ImplLoadString8( SvStream& rStrm ) const
OUString SfxOleStringHelper::ImplLoadString8( SvStream& rStrm ) const
{
String aValue;
OUString aValue;
// read size field (signed 32-bit)
sal_Int32 nSize(0);
rStrm >> nSize;
......@@ -330,9 +330,9 @@ String SfxOleStringHelper::ImplLoadString8( SvStream& rStrm ) const
return aValue;
}
String SfxOleStringHelper::ImplLoadString16( SvStream& rStrm ) const
OUString SfxOleStringHelper::ImplLoadString16( SvStream& rStrm ) const
{
String aValue;
OUString aValue;
// read size field (signed 32-bit), may be buffer size or character count
sal_Int32 nSize(0);
rStrm >> nSize;
......@@ -359,7 +359,7 @@ String SfxOleStringHelper::ImplLoadString16( SvStream& rStrm ) const
return aValue;
}
void SfxOleStringHelper::ImplSaveString8( SvStream& rStrm, const String& rValue ) const
void SfxOleStringHelper::ImplSaveString8( SvStream& rStrm, const OUString& rValue ) const
{
// encode to byte string
OString aEncoded(OUStringToOString(rValue, GetTextEncoding()));
......@@ -371,14 +371,14 @@ void SfxOleStringHelper::ImplSaveString8( SvStream& rStrm, const String& rValue
rStrm << sal_uInt8( 0 );
}
void SfxOleStringHelper::ImplSaveString16( SvStream& rStrm, const String& rValue ) const
void SfxOleStringHelper::ImplSaveString16( SvStream& rStrm, const OUString& rValue ) const
{
// write size field (including trailing NUL character)
sal_Int32 nSize = static_cast< sal_Int32 >( rValue.Len() + 1 );
sal_Int32 nSize = static_cast< sal_Int32 >( rValue.getLength() + 1 );
rStrm << nSize;
// write character array with trailing NUL character
for( xub_StrLen nIdx = 0; nIdx < rValue.Len(); ++nIdx )
rStrm << static_cast< sal_uInt16 >( rValue.GetChar( nIdx ) );
for( sal_Int32 nIdx = 0; nIdx < rValue.getLength(); ++nIdx )
rStrm << static_cast< sal_uInt16 >( rValue[ nIdx ] );
rStrm << sal_uInt16( 0 );
// stream is always padded to 32-bit boundary, add 2 bytes on odd character count
if( (nSize & 1) == 1 )
......@@ -727,13 +727,13 @@ SfxOleDictionaryProperty::SfxOleDictionaryProperty( const SfxOleTextEncoding& rT
{
}
const String& SfxOleDictionaryProperty::GetPropertyName( sal_Int32 nPropId ) const
OUString SfxOleDictionaryProperty::GetPropertyName( sal_Int32 nPropId ) const
{
SfxOlePropNameMap::const_iterator aIt = maPropNameMap.find( nPropId );
return (aIt == maPropNameMap.end()) ? String::EmptyString() : aIt->second;
return (aIt == maPropNameMap.end()) ? OUString("") : aIt->second;
}
void SfxOleDictionaryProperty::SetPropertyName( sal_Int32 nPropId, const String& rPropName )
void SfxOleDictionaryProperty::SetPropertyName( sal_Int32 nPropId, const OUString& rPropName )
{
maPropNameMap[ nPropId ] = rPropName;
// dictionary property contains number of pairs in property type field
......@@ -814,7 +814,7 @@ bool SfxOleSection::GetBoolValue( bool& rbValue, sal_Int32 nPropId ) const
return pProp != 0;
}
bool SfxOleSection::GetStringValue( String& rValue, sal_Int32 nPropId ) const
bool SfxOleSection::GetStringValue( OUString& rValue, sal_Int32 nPropId ) const
{
SfxOlePropertyRef xProp = GetProperty( nPropId );
const SfxOleStringPropertyBase* pProp =
......@@ -875,9 +875,9 @@ void SfxOleSection::SetBoolValue( sal_Int32 nPropId, bool bValue )
SetProperty( SfxOlePropertyRef( new SfxOleBoolProperty( nPropId, bValue ) ) );
}
bool SfxOleSection::SetStringValue( sal_Int32 nPropId, const String& rValue, bool bSkipEmpty )
bool SfxOleSection::SetStringValue( sal_Int32 nPropId, const OUString& rValue, bool bSkipEmpty )
{
bool bInserted = !bSkipEmpty || (rValue.Len() > 0);
bool bInserted = !bSkipEmpty || !rValue.isEmpty();
if( bInserted )
SetProperty( SfxOlePropertyRef( new SfxOleString8Property( nPropId, maCodePageProp, rValue ) ) );
return bInserted;
......@@ -930,7 +930,7 @@ Any SfxOleSection::GetAnyValue( sal_Int32 nPropId ) const
sal_Int32 nInt32 = 0;
double fDouble = 0.0;
bool bBool = false;
String aString;
OUString aString;
::com::sun::star::util::DateTime aApiDateTime;
::com::sun::star::util::Date aApiDate;
......@@ -941,7 +941,7 @@ Any SfxOleSection::GetAnyValue( sal_Int32 nPropId ) const
else if( GetBoolValue( bBool, nPropId ) )
::comphelper::setBOOL( aValue, bBool ? sal_True : sal_False );
else if( GetStringValue( aString, nPropId ) )
aValue <<= OUString( aString );
aValue <<= aString;
else if( GetFileTimeValue( aApiDateTime, nPropId ) )
{
aValue <<= aApiDateTime;
......@@ -979,12 +979,12 @@ bool SfxOleSection::SetAnyValue( sal_Int32 nPropId, const Any& rValue )
return bInserted;
}
const String& SfxOleSection::GetPropertyName( sal_Int32 nPropId ) const
OUString SfxOleSection::GetPropertyName( sal_Int32 nPropId ) const
{
return maDictProp.GetPropertyName( nPropId );
}
void SfxOleSection::SetPropertyName( sal_Int32 nPropId, const String& rPropName )
void SfxOleSection::SetPropertyName( sal_Int32 nPropId, const OUString& rPropName )
{
maDictProp.SetPropertyName( nPropId, rPropName );
}
......@@ -1154,7 +1154,7 @@ void SfxOleSection::SaveProperty( SvStream& rStrm, SfxOlePropertyBase& rProp, sa
// ----------------------------------------------------------------------------
ErrCode SfxOlePropertySet::LoadPropertySet( SotStorage* pStrg, const String& rStrmName )
ErrCode SfxOlePropertySet::LoadPropertySet( SotStorage* pStrg, const OUString& rStrmName )
{
if( pStrg )
{
......@@ -1172,7 +1172,7 @@ ErrCode SfxOlePropertySet::LoadPropertySet( SotStorage* pStrg, const String& rSt
return GetError();
}
ErrCode SfxOlePropertySet::SavePropertySet( SotStorage* pStrg, const String& rStrmName )
ErrCode SfxOlePropertySet::SavePropertySet( SotStorage* pStrg, const OUString& rStrmName )
{
if( pStrg )
{
......
......@@ -144,20 +144,20 @@ public:
SfxOleTextEncoding( eTextEnc ) {}
/** Loads a string from the passed stream with current encoding (maybe Unicode). */
String LoadString8( SvStream& rStrm ) const;
OUString LoadString8( SvStream& rStrm ) const;
/** Saves a string to the passed stream with current encoding (maybe Unicode). */
void SaveString8( SvStream& rStrm, const String& rValue ) const;
void SaveString8( SvStream& rStrm, const OUString& rValue ) const;
/** Loads a Unicode string from the passed stream, ignores own encoding. */
String LoadString16( SvStream& rStrm ) const;
OUString LoadString16( SvStream& rStrm ) const;
/** Saves a Unicode string to the passed stream, ignores own encoding. */
void SaveString16( SvStream& rStrm, const String& rValue ) const;
void SaveString16( SvStream& rStrm, const OUString& rValue ) const;
private:
String ImplLoadString8( SvStream& rStrm ) const;
String ImplLoadString16( SvStream& rStrm ) const;
void ImplSaveString8( SvStream& rStrm, const String& rValue ) const;
void ImplSaveString16( SvStream& rStrm, const String& rValue ) const;
OUString ImplLoadString8( SvStream& rStrm ) const;
OUString ImplLoadString16( SvStream& rStrm ) const;
void ImplSaveString8( SvStream& rStrm, const OUString& rValue ) const;
void ImplSaveString16( SvStream& rStrm, const OUString& rValue ) const;
};
// ============================================================================
......@@ -251,16 +251,16 @@ public:
inline void SetNameCount( sal_Int32 nNameCount ) { SetPropType( nNameCount ); }
/** Returns the custom name for the passed property ID, or an empty string, if name not found. */
const String& GetPropertyName( sal_Int32 nPropId ) const;
OUString GetPropertyName( sal_Int32 nPropId ) const;
/** Sets a custom name for the passed property ID. */
void SetPropertyName( sal_Int32 nPropId, const String& rPropName );
void SetPropertyName( sal_Int32 nPropId, const OUString& rPropName );
private:
virtual void ImplLoad( SvStream& rStrm );
virtual void ImplSave( SvStream& rStrm );
private:
typedef ::std::map< sal_Int32, String > SfxOlePropNameMap;
typedef ::std::map< sal_Int32, OUString > SfxOlePropNameMap;
SfxOlePropNameMap maPropNameMap;
};
......@@ -288,7 +288,7 @@ public:
bool GetBoolValue( bool& rbValue, sal_Int32 nPropId ) const;
/** Returns the value of a string property with the passed ID in rValue.
@return true = Property found, rValue is valid; false = Property not found. */
bool GetStringValue( String& rValue, sal_Int32 nPropId ) const;
bool GetStringValue( OUString& rValue, sal_Int32 nPropId ) const;
/** Returns the value of a time stamp property with the passed ID in rValue.
@return true = Property found, rValue is valid; false = Property not found. */
bool GetFileTimeValue( ::com::sun::star::util::DateTime& rValue, sal_Int32 nPropId ) const;
......@@ -306,7 +306,7 @@ public:
void SetBoolValue( sal_Int32 nPropId, bool bValue );
/** Inserts a string property with the passed value.
@return true = Property inserted; false = String was empty, property not inserted. */
bool SetStringValue( sal_Int32 nPropId, const String& rValue, bool bSkipEmpty = true );
bool SetStringValue( sal_Int32 nPropId, const OUString& rValue, bool bSkipEmpty = true );
/** Inserts a time stamp property with the passed value. */
void SetFileTimeValue( sal_Int32 nPropId, const ::com::sun::star::util::DateTime& rValue );
/** Inserts a date property with the passed value. */
......@@ -325,9 +325,9 @@ public:
bool SetAnyValue( sal_Int32 nPropId, const com::sun::star::uno::Any& rValue );
/** Returns the custom name for the passed property ID, or an empty string, if name not found. */
const String& GetPropertyName( sal_Int32 nPropId ) const;
OUString GetPropertyName( sal_Int32 nPropId ) const;
/** Sets a custom name for the passed property ID. */
void SetPropertyName( sal_Int32 nPropId, const String& rPropName );
void SetPropertyName( sal_Int32 nPropId, const OUString& rPropName );
/** Returns the identifiers of all existing properties in the passed vector. */
void GetPropertyIds( ::std::vector< sal_Int32 >& rPropIds ) const;
......@@ -371,9 +371,9 @@ public:
inline explicit SfxOlePropertySet() {}
/** Loads this object from the passed storage. */
ErrCode LoadPropertySet( SotStorage* pStrg, const String& rStrmName );
ErrCode LoadPropertySet( SotStorage* pStrg, const OUString& rStrmName );
/** Saves this object to the passed storage. */
ErrCode SavePropertySet( SotStorage* pStrg, const String& rStrmName );
ErrCode SavePropertySet( SotStorage* pStrg, const OUString& rStrmName );
/** Returns the specified section, or an empty reference, if nothing found. */
SfxOleSectionRef GetSection( SfxOleSectionType eSection ) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment