[Libreoffice-commits] .: 2 commits - editeng/inc editeng/source sc/source svl/inc svl/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Mar 27 10:04:15 PDT 2012
editeng/inc/editeng/flditem.hxx | 72 +++++++++++++++------------------
editeng/source/items/flditem.cxx | 78 ++++++++++++++++++++----------------
sc/source/filter/excel/xehelper.cxx | 12 ++---
sc/source/filter/inc/xehelper.hxx | 2
svl/inc/svl/zforlist.hxx | 4 +
svl/source/numbers/zforlist.cxx | 12 +++++
6 files changed, 100 insertions(+), 80 deletions(-)
New commits:
commit 1e91520e7af29c390c03d05b39992da5aaf6d1c7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Mar 27 10:57:14 2012 -0400
UniString removal.
diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx
index b54e37c..be874b0 100644
--- a/editeng/inc/editeng/flditem.hxx
+++ b/editeng/inc/editeng/flditem.hxx
@@ -144,8 +144,8 @@ public:
// If eLanguage==LANGUAGE_DONTKNOW the language/country
// used in number formatter initialization is taken.
- String GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
- static String GetFormatted( Date& rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+ rtl::OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
+ static rtl::OUString GetFormatted( Date& rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
virtual SvxFieldData* Clone() const;
virtual int operator==( const SvxFieldData& ) const;
@@ -163,24 +163,24 @@ class EDITENG_DLLPUBLIC SvxURLField : public SvxFieldData
{
private:
SvxURLFormat eFormat;
- XubString aURL; // URL-Address
- XubString aRepresentation; // What is shown
- XubString aTargetFrame; // In what Frame
+ rtl::OUString aURL; // URL-Address
+ rtl::OUString aRepresentation; // What is shown
+ rtl::OUString aTargetFrame; // In what Frame
public:
SV_DECL_PERSIST1( SvxURLField, SvxFieldData, SVX_URLFIELD )
SvxURLField();
- SvxURLField( const XubString& rURL, const XubString& rRepres, SvxURLFormat eFmt = SVXURLFORMAT_URL );
+ SvxURLField( const rtl::OUString& rURL, const rtl::OUString& rRepres, SvxURLFormat eFmt = SVXURLFORMAT_URL );
- const XubString& GetURL() const { return aURL; }
- void SetURL( const XubString& rURL ) { aURL = rURL; }
+ const rtl::OUString& GetURL() const { return aURL; }
+ void SetURL( const rtl::OUString& rURL ) { aURL = rURL; }
- const XubString& GetRepresentation() const { return aRepresentation; }
- void SetRepresentation( const XubString& rRep ) { aRepresentation= rRep; }
+ const rtl::OUString& GetRepresentation() const { return aRepresentation; }
+ void SetRepresentation( const rtl::OUString& rRep ) { aRepresentation= rRep; }
- const XubString& GetTargetFrame() const { return aTargetFrame; }
- void SetTargetFrame( const XubString& rFrm ) { aTargetFrame = rFrm; }
+ const rtl::OUString& GetTargetFrame() const { return aTargetFrame; }
+ void SetTargetFrame( const rtl::OUString& rFrm ) { aTargetFrame = rFrm; }
SvxURLFormat GetFormat() const { return eFormat; }
void SetFormat( SvxURLFormat eFmt ) { eFormat = eFmt; }
@@ -281,8 +281,8 @@ public:
// If eLanguage==LANGUAGE_DONTKNOW the language/country
// used in number formatter initialization is taken.
- String GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
- static String GetFormatted( Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+ rtl::OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
+ static rtl::OUString GetFormatted( Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
virtual SvxFieldData* Clone() const;
virtual int operator==( const SvxFieldData& ) const;
@@ -303,19 +303,19 @@ enum SvxFileFormat { SVXFILEFORMAT_NAME_EXT, // File name with Extension
class EDITENG_DLLPUBLIC SvxExtFileField : public SvxFieldData
{
private:
- XubString aFile;
+ rtl::OUString aFile;
SvxFileType eType;
SvxFileFormat eFormat;
public:
SV_DECL_PERSIST1( SvxExtFileField, SvxFieldData, SVX_EXT_FILEFIELD )
SvxExtFileField();
- SvxExtFileField( const XubString& rString,
+ SvxExtFileField( const rtl::OUString& rString,
SvxFileType eType = SVXFILETYPE_VAR,
SvxFileFormat eFormat = SVXFILEFORMAT_FULLPATH );
- String GetFile() const { return aFile; }
- void SetFile( const XubString& rString ) { aFile = rString; }
+ rtl::OUString GetFile() const { return aFile; }
+ void SetFile( const rtl::OUString& rString ) { aFile = rString; }
SvxFileType GetType() const { return eType; }
void SetType( SvxFileType eTp ) { eType = eTp; }
@@ -323,7 +323,7 @@ public:
SvxFileFormat GetFormat() const { return eFormat; }
void SetFormat( SvxFileFormat eFmt ) { eFormat = eFmt; }
- XubString GetFormatted() const;
+ rtl::OUString GetFormatted() const;
virtual SvxFieldData* Clone() const;
virtual int operator==( const SvxFieldData& ) const;
@@ -340,9 +340,9 @@ enum SvxAuthorFormat { SVXAUTHORFORMAT_FULLNAME, // full name
class EDITENG_DLLPUBLIC SvxAuthorField : public SvxFieldData
{
private:
- XubString aName;
- XubString aFirstName;
- XubString aShortName;
+ rtl::OUString aName;
+ rtl::OUString aFirstName;
+ rtl::OUString aShortName;
SvxAuthorType eType;
SvxAuthorFormat eFormat;
@@ -350,20 +350,20 @@ public:
SV_DECL_PERSIST1( SvxAuthorField, SvxFieldData, SVX_AUTHORFIELD )
SvxAuthorField();
SvxAuthorField(
- const XubString& rFirstName,
- const XubString& rLastName,
- const XubString& rShortName,
+ const rtl::OUString& rFirstName,
+ const rtl::OUString& rLastName,
+ const rtl::OUString& rShortName,
SvxAuthorType eType = SVXAUTHORTYPE_VAR,
SvxAuthorFormat eFormat = SVXAUTHORFORMAT_FULLNAME );
- XubString GetName() const { return aName; }
- void SetName( const XubString& rString ) { aName = rString; }
+ rtl::OUString GetName() const { return aName; }
+ void SetName( const rtl::OUString& rString ) { aName = rString; }
- XubString GetFirstName() const { return aFirstName; }
- void SetFirstName( const XubString& rString ) { aFirstName = rString; }
+ rtl::OUString GetFirstName() const { return aFirstName; }
+ void SetFirstName( const rtl::OUString& rString ) { aFirstName = rString; }
- XubString GetShortName() const { return aShortName; }
- void SetShortName( const XubString& rString ) { aShortName = rString; }
+ rtl::OUString GetShortName() const { return aShortName; }
+ void SetShortName( const rtl::OUString& rString ) { aShortName = rString; }
SvxAuthorType GetType() const { return eType; }
void SetType( SvxAuthorType eTp ) { eType = eTp; }
@@ -371,7 +371,7 @@ public:
SvxAuthorFormat GetFormat() const { return eFormat; }
void SetFormat( SvxAuthorFormat eFmt ) { eFormat = eFmt; }
- XubString GetFormatted() const;
+ rtl::OUString GetFormatted() const;
virtual SvxFieldData* Clone() const;
virtual int operator==( const SvxFieldData& ) const;
@@ -407,7 +407,7 @@ public:
SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, SVX_DATEFIMEFIELD )
SvxDateTimeField() {}
- static String GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+ static rtl::OUString GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
virtual SvxFieldData* Clone() const;
virtual int operator==( const SvxFieldData& ) const;
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 58f6ab1..46153e6 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -261,7 +261,7 @@ void SvxDateField::Save( SvPersistStream & rStm )
// -----------------------------------------------------------------------
-String SvxDateField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const
+rtl::OUString SvxDateField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const
{
Date aDate( Date::EMPTY );
if ( eType == SVXDATETYPE_FIX )
@@ -272,7 +272,7 @@ String SvxDateField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType e
return GetFormatted( aDate, eFormat, rFormatter, eLang );
}
-String SvxDateField::GetFormatted( Date& aDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLang )
+rtl::OUString SvxDateField::GetFormatted( Date& aDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLang )
{
if ( eFormat == SVXDATEFORMAT_SYSTEM )
{
@@ -326,7 +326,7 @@ String SvxDateField::GetFormatted( Date& aDate, SvxDateFormat eFormat, SvNumberF
}
double fDiffDate = aDate - *(rFormatter.GetNullDate());
- String aStr;
+ rtl::OUString aStr;
Color* pColor = NULL;
rFormatter.GetOutputString( fDiffDate, nFormatKey, aStr, &pColor );
return aStr;
@@ -348,7 +348,7 @@ SvxURLField::SvxURLField()
// -----------------------------------------------------------------------
-SvxURLField::SvxURLField( const XubString& rURL, const XubString& rRepres, SvxURLFormat eFmt )
+SvxURLField::SvxURLField( const rtl::OUString& rURL, const rtl::OUString& rRepres, SvxURLFormat eFmt )
: aURL( rURL ), aRepresentation( rRepres )
{
eFormat = eFmt;
@@ -384,16 +384,18 @@ static void write_unicode( SvPersistStream & rStm, const String& rString )
rStm.Write( rString.GetBuffer(), nL*sizeof(sal_Unicode) );
}
-static void read_unicode( SvPersistStream & rStm, String& rString )
+static void read_unicode( SvPersistStream & rStm, rtl::OUString& rString )
{
sal_uInt16 nL = 0;
rStm >> nL;
+ String aStr;
if ( nL )
{
- rString.AllocBuffer( nL );
- rStm.Read( rString.GetBufferAccess(), nL*sizeof(sal_Unicode) );
- rString.ReleaseBufferAccess( nL );
+ aStr.AllocBuffer( nL );
+ rStm.Read( aStr.GetBufferAccess(), nL*sizeof(sal_Unicode) );
+ aStr.ReleaseBufferAccess( nL );
}
+ rString = aStr;
}
void SvxURLField::Load( SvPersistStream & rStm )
@@ -424,8 +426,8 @@ MetaAction* SvxURLField::createBeginComment() const
// #i46618# Adding target URL to metafile comment
return new MetaCommentAction( "FIELD_SEQ_BEGIN",
0,
- reinterpret_cast<const sal_uInt8*>(aURL.GetBuffer()),
- 2*aURL.Len() );
+ reinterpret_cast<const sal_uInt8*>(aURL.getStr()),
+ 2*aURL.getLength() );
}
// =================================================================
@@ -612,7 +614,7 @@ void SvxExtTimeField::Save( SvPersistStream & rStm )
//----------------------------------------------------------------------------
-String SvxExtTimeField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const
+rtl::OUString SvxExtTimeField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const
{
Time aTime( Time::EMPTY );
if ( eType == SVXTIMETYPE_FIX )
@@ -622,7 +624,7 @@ String SvxExtTimeField::GetFormatted( SvNumberFormatter& rFormatter, LanguageTyp
return GetFormatted( aTime, eFormat, rFormatter, eLang );
}
-String SvxExtTimeField::GetFormatted( Time& aTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLang )
+rtl::OUString SvxExtTimeField::GetFormatted( Time& aTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLang )
{
switch( eFormat )
{
@@ -646,10 +648,10 @@ String SvxExtTimeField::GetFormatted( Time& aTime, SvxTimeFormat eFormat, SvNumb
break;
case SVXTIMEFORMAT_12_HMSH:
{ // no builtin format available, try to insert or reuse
- String aFormatCode( RTL_CONSTASCII_USTRINGPARAM( "HH:MM:SS.00 AM/PM" ) );
+ rtl::OUString aFormatCode( RTL_CONSTASCII_USTRINGPARAM( "HH:MM:SS.00 AM/PM" ) );
xub_StrLen nCheckPos;
short nType;
- /*sal_Bool bInserted = */rFormatter.PutandConvertEntry( aFormatCode,
+ rFormatter.PutandConvertEntry( aFormatCode,
nCheckPos, nType, nFormatKey, LANGUAGE_ENGLISH_US, eLang );
DBG_ASSERT( nCheckPos == 0, "SVXTIMEFORMAT_12_HMSH: could not insert format code" );
if ( nCheckPos )
@@ -674,7 +676,7 @@ String SvxExtTimeField::GetFormatted( Time& aTime, SvxTimeFormat eFormat, SvNumb
}
double fFracTime = aTime.GetTimeInDays();
- String aStr;
+ rtl::OUString aStr;
Color* pColor = NULL;
rFormatter.GetOutputString( fFracTime, nFormatKey, aStr, &pColor );
return aStr;
@@ -701,7 +703,7 @@ SvxExtFileField::SvxExtFileField()
//----------------------------------------------------------------------------
-SvxExtFileField::SvxExtFileField( const XubString& rStr, SvxFileType eT, SvxFileFormat eF )
+SvxExtFileField::SvxExtFileField( const rtl::OUString& rStr, SvxFileType eT, SvxFileFormat eF )
{
aFile = rStr;
eType = eT;
@@ -757,9 +759,9 @@ void SvxExtFileField::Save( SvPersistStream & rStm )
//----------------------------------------------------------------------------
-XubString SvxExtFileField::GetFormatted() const
+rtl::OUString SvxExtFileField::GetFormatted() const
{
- XubString aString;
+ rtl::OUString aString;
INetURLObject aURLObj( aFile );
@@ -829,7 +831,7 @@ XubString SvxExtFileField::GetFormatted() const
}
}
- return( aString );
+ return aString;
}
//----------------------------------------------------------------------------
@@ -848,9 +850,9 @@ SvxAuthorField::SvxAuthorField()
//----------------------------------------------------------------------------
-SvxAuthorField::SvxAuthorField( const XubString& rFirstName,
- const XubString& rLastName,
- const XubString& rShortName,
+SvxAuthorField::SvxAuthorField( const rtl::OUString& rFirstName,
+ const rtl::OUString& rLastName,
+ const rtl::OUString& rShortName,
SvxAuthorType eT, SvxAuthorFormat eF )
{
aName = rLastName;
@@ -913,18 +915,20 @@ void SvxAuthorField::Save( SvPersistStream & rStm )
//----------------------------------------------------------------------------
-XubString SvxAuthorField::GetFormatted() const
+rtl::OUString SvxAuthorField::GetFormatted() const
{
- XubString aString;
+ rtl::OUString aString;
switch( eFormat )
{
case SVXAUTHORFORMAT_FULLNAME:
- aString = aFirstName;
- aString += sal_Unicode(' ');
- aString += aName;
+ {
+ rtl::OUStringBuffer aBuf(aFirstName);
+ aBuf.append(sal_Unicode(' '));
+ aBuf.append(aName);
+ aString = aBuf.makeStringAndClear();
+ }
break;
-
case SVXAUTHORFORMAT_NAME:
aString = aName;
break;
@@ -938,7 +942,7 @@ XubString SvxAuthorField::GetFormatted() const
break;
}
- return( aString );
+ return aString;
}
static SvClassManager* pClassMgr=0;
@@ -1027,9 +1031,10 @@ void SvxDateTimeField::Save( SvPersistStream & /*rStm*/ )
{
}
-String SvxDateTimeField::GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage )
+rtl::OUString SvxDateTimeField::GetFormatted(
+ Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage )
{
- String aRet;
+ rtl::OUString aRet;
SvxDateFormat eDateFormat = (SvxDateFormat)(eFormat & 0x0f);
@@ -1042,10 +1047,15 @@ String SvxDateTimeField::GetFormatted( Date& rDate, Time& rTime, int eFormat, Sv
if(eTimeFormat)
{
- if(aRet.Len())
- aRet += sal_Unicode(' ');
+ rtl::OUStringBuffer aBuf(aRet);
+
+ if (!aRet.isEmpty())
+ aBuf.append(sal_Unicode(' '));
+
+ aBuf.append(
+ SvxExtTimeField::GetFormatted(rTime, eTimeFormat, rFormatter, eLanguage));
- aRet += SvxExtTimeField::GetFormatted( rTime, eTimeFormat, rFormatter, eLanguage );
+ aRet = aBuf.makeStringAndClear();
}
return aRet;
diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx
index 9745cda..879a08d 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -283,11 +283,11 @@ void XclExpAddressConverter::ConvertRangeList( XclRangeList& rXclRanges,
namespace {
-String lclGetUrlRepresentation( const SvxURLField& rUrlField )
+rtl::OUString lclGetUrlRepresentation( const SvxURLField& rUrlField )
{
- String aRepr( rUrlField.GetRepresentation() );
+ const rtl::OUString& aRepr = rUrlField.GetRepresentation();
// no representation -> use URL
- return aRepr.Len() ? aRepr : rUrlField.GetURL();
+ return aRepr.isEmpty() ? rUrlField.GetURL() : aRepr;
}
} // namespace
@@ -305,9 +305,9 @@ XclExpHyperlinkHelper::~XclExpHyperlinkHelper()
{
}
-String XclExpHyperlinkHelper::ProcessUrlField( const SvxURLField& rUrlField )
+rtl::OUString XclExpHyperlinkHelper::ProcessUrlField( const SvxURLField& rUrlField )
{
- String aUrlRepr;
+ rtl::OUString aUrlRepr;
if( GetBiff() == EXC_BIFF8 ) // no HLINK records in BIFF2-BIFF7
{
@@ -324,7 +324,7 @@ String XclExpHyperlinkHelper::ProcessUrlField( const SvxURLField& rUrlField )
}
// no hyperlink representation from Excel HLINK record -> use it from text field
- return aUrlRepr.Len() ? aUrlRepr : lclGetUrlRepresentation( rUrlField );
+ return aUrlRepr.isEmpty() ? lclGetUrlRepresentation(rUrlField) : aUrlRepr;
}
bool XclExpHyperlinkHelper::HasLinkRecord() const
diff --git a/sc/source/filter/inc/xehelper.hxx b/sc/source/filter/inc/xehelper.hxx
index 670b348..2d57d9e 100644
--- a/sc/source/filter/inc/xehelper.hxx
+++ b/sc/source/filter/inc/xehelper.hxx
@@ -193,7 +193,7 @@ public:
/** Processes the passed URL field (tries to create a HLINK record).
@return The representation string of the URL field. */
- String ProcessUrlField( const SvxURLField& rUrlField );
+ rtl::OUString ProcessUrlField( const SvxURLField& rUrlField );
/** Returns true, if a single HLINK record has been created. */
bool HasLinkRecord() const;
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 30d1929..1249250 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -411,6 +411,10 @@ public:
short& nType, sal_uInt32& nKey,
LanguageType eLnge, LanguageType eNewLnge );
+ bool PutandConvertEntry( rtl::OUString& rString, xub_StrLen& nCheckPos,
+ short& nType, sal_uInt32& nKey,
+ LanguageType eLnge, LanguageType eNewLnge );
+
/** Same as <method>PutandConvertEntry</method> but the format code string
is considered to be of the System language/country eLnge and is
converted to another System language/country eNewLnge. In this case
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 475551e..5a6848c 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -562,6 +562,18 @@ bool SvNumberFormatter::PutandConvertEntry(String& rString,
return bRes;
}
+bool SvNumberFormatter::PutandConvertEntry(rtl::OUString& rString,
+ xub_StrLen& nCheckPos,
+ short& nType,
+ sal_uInt32& nKey,
+ LanguageType eLnge,
+ LanguageType eNewLnge)
+{
+ String aStr;
+ bool bRet = PutandConvertEntry(aStr, nCheckPos, nType, nKey, eLnge, eNewLnge);
+ rString = aStr;
+ return bRet;
+}
bool SvNumberFormatter::PutandConvertEntrySystem(String& rString,
xub_StrLen& nCheckPos,
commit 685c0f41b9fb02b72471b1de9042c3d20d9a95f4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Mar 27 10:25:30 2012 -0400
We can safely remove this.
There is no definition given anyway, so its use would've caused
a link error.
diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx
index b35cb54..b54e37c 100644
--- a/editeng/inc/editeng/flditem.hxx
+++ b/editeng/inc/editeng/flditem.hxx
@@ -142,9 +142,6 @@ public:
SvxDateFormat GetFormat() const { return eFormat; }
void SetFormat( SvxDateFormat eFmt ) { eFormat = eFmt; }
- // deprecated, to be removed
- String GetFormatted( LanguageType eLanguage, LanguageType eFormat ) const;
- // use this instead
// If eLanguage==LANGUAGE_DONTKNOW the language/country
// used in number formatter initialization is taken.
String GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
@@ -282,9 +279,6 @@ public:
SvxTimeFormat GetFormat() const { return eFormat; }
void SetFormat( SvxTimeFormat eFmt ) { eFormat = eFmt; }
- // deprecated, to be removed
- XubString GetFormatted( LanguageType eLanguage, LanguageType eFormat ) const;
- // use this instead
// If eLanguage==LANGUAGE_DONTKNOW the language/country
// used in number formatter initialization is taken.
String GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
More information about the Libreoffice-commits
mailing list