diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-11 10:30:47 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-11 11:15:41 +0100 |
commit | f2734389f517c1f99eee2346ae9d2104cc7de842 (patch) | |
tree | f6af0ac5cb81ac625a63f72c3dd7d37eaa1f8947 /svtools | |
parent | 7d044841e88d2413c19715a290b3d7a2ba6d099d (diff) |
XubString->OUString
Change-Id: I15f229010254a51ee485479e8fb751375f288da8
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/ctrltool.hxx | 64 | ||||
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 10 | ||||
-rw-r--r-- | svtools/source/control/ctrltool.cxx | 70 |
3 files changed, 72 insertions, 72 deletions
diff --git a/svtools/inc/svtools/ctrltool.hxx b/svtools/inc/svtools/ctrltool.hxx index f7c4cc59abab..837c29d94753 100644 --- a/svtools/inc/svtools/ctrltool.hxx +++ b/svtools/inc/svtools/ctrltool.hxx @@ -32,7 +32,7 @@ #include <boost/ptr_container/ptr_vector.hpp> #include "svtools/svtdllapi.h" - +#include <rtl/ustring.hxx> #include <sal/types.h> #include <vcl/metric.hxx> @@ -147,27 +147,27 @@ von der FontList, sollte deshalb das Array nicht mehr referenziert werden. class SVT_DLLPUBLIC FontList { private: - XubString maMapBoth; - XubString maMapPrinterOnly; - XubString maMapScreenOnly; - XubString maMapSizeNotAvailable; - XubString maMapStyleNotAvailable; - XubString maMapNotAvailable; - XubString maLight; - XubString maLightItalic; - XubString maNormal; - XubString maNormalItalic; - XubString maBold; - XubString maBoldItalic; - XubString maBlack; - XubString maBlackItalic; + OUString maMapBoth; + OUString maMapPrinterOnly; + OUString maMapScreenOnly; + OUString maMapSizeNotAvailable; + OUString maMapStyleNotAvailable; + OUString maMapNotAvailable; + OUString maLight; + OUString maLightItalic; + OUString maNormal; + OUString maNormalItalic; + OUString maBold; + OUString maBoldItalic; + OUString maBlack; + OUString maBlackItalic; long* mpSizeAry; OutputDevice* mpDev; OutputDevice* mpDev2; boost::ptr_vector<ImplFontListNameInfo> maEntries; #ifdef CTRLTOOL_CXX - SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const XubString& rSearchName, sal_uLong* pIndex ) const; - SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( const XubString& rStr ) const; + SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const OUString& rSearchName, sal_uLong* pIndex ) const; + SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( const OUString& rStr ) const; SVT_DLLPRIVATE void ImplInsertFonts( OutputDevice* pDev, sal_Bool bAll, sal_Bool bInsertData ); #endif @@ -183,25 +183,27 @@ public: OutputDevice* GetDevice() const { return mpDev; } OutputDevice* GetDevice2() const { return mpDev2; } - const XubString& GetNormalStr() const { return maNormal; } - const XubString& GetItalicStr() const { return maNormalItalic; } - const XubString& GetBoldStr() const { return maBold; } - const XubString& GetBoldItalicStr() const { return maBoldItalic; } - const XubString& GetStyleName( FontWeight eWeight, FontItalic eItalic ) const; - XubString GetStyleName( const FontInfo& rInfo ) const; + const OUString& GetNormalStr() const { return maNormal; } + const OUString& GetItalicStr() const { return maNormalItalic; } + const OUString& GetBoldStr() const { return maBold; } + const OUString& GetBoldItalicStr() const { return maBoldItalic; } + const OUString& GetStyleName( FontWeight eWeight, FontItalic eItalic ) const; + OUString GetStyleName( const FontInfo& rInfo ) const; - FontInfo Get( const XubString& rName, - const XubString& rStyleName ) const; - FontInfo Get( const XubString& rName, + FontInfo Get( const OUString& rName, + const OUString& rStyleName ) const; + FontInfo Get( const OUString& rName, FontWeight eWeight, FontItalic eItalic ) const; - sal_Bool IsAvailable( const XubString& rName ) const; - sal_uInt16 GetFontNameCount() const - { return (sal_uInt16)maEntries.size(); } + sal_Bool IsAvailable( const OUString& rName ) const; + sal_uInt16 GetFontNameCount() const + { + return (sal_uInt16)maEntries.size(); + } const FontInfo& GetFontName( sal_uInt16 nFont ) const; - sal_uInt16 GetFontNameType( sal_uInt16 nFont ) const; - sal_Handle GetFirstFontInfo( const XubString& rName ) const; + sal_uInt16 GetFontNameType( sal_uInt16 nFont ) const; + sal_Handle GetFirstFontInfo( const OUString& rName ) const; sal_Handle GetNextFontInfo( sal_Handle hFontInfo ) const; const FontInfo& GetFontInfo( sal_Handle hFontInfo ) const; diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index fc99145c8163..26b284d55ce0 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1598,7 +1598,7 @@ void FontStyleBox::Fill( const XubString& rName, const FontList* pList ) sal_Handle hFontInfo = pList->GetFirstFontInfo( rName ); if ( hFontInfo ) { - XubString aStyleText; + OUString aStyleText; FontWeight eLastWeight = WEIGHT_DONTKNOW; FontItalic eLastItalic = ITALIC_NONE; FontWidth eLastWidth = WIDTH_DONTKNOW; @@ -1657,11 +1657,11 @@ void FontStyleBox::Fill( const XubString& rName, const FontList* pList ) { // If we have two names for the same attributes // we prefer the translated standard names - const XubString& rAttrStyleText = pList->GetStyleName( eWeight, eItalic ); - if ( rAttrStyleText != aStyleText ) + const OUString& rAttrStyleText = pList->GetStyleName( eWeight, eItalic ); + if (rAttrStyleText != aStyleText) { - XubString aTempStyleText = pList->GetStyleName( aInfo ); - if ( rAttrStyleText == aTempStyleText ) + OUString aTempStyleText = pList->GetStyleName( aInfo ); + if (rAttrStyleText == aTempStyleText) aStyleText = rAttrStyleText; bInsert = GetEntryPos( aStyleText ) == LISTBOX_ENTRY_NOTFOUND; } diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 25b68786465d..44da6fccfc1b 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -175,14 +175,13 @@ static void ImplMakeSearchStringFromName( XubString& rStr ) // ----------------------------------------------------------------------- -ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLong* pIndex ) const +ImplFontListNameInfo* FontList::ImplFind(const OUString& rSearchName, sal_uLong* pIndex) const { // Wenn kein Eintrag in der Liste oder der Eintrag groesser ist als // der Letzte, dann hinten dranhaengen. Wir vergleichen erst mit dem // letzten Eintrag, da die Liste von VCL auch sortiert zurueckkommt // und somit die Wahrscheinlichkeit das hinten angehaengt werden muss // sehr gross ist. - StringCompare eComp; sal_uLong nCnt = maEntries.size(); if ( !nCnt ) { @@ -193,14 +192,14 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon else { const ImplFontListNameInfo* pCmpData = &maEntries[nCnt-1]; - eComp = rSearchName.CompareTo( pCmpData->maSearchName ); - if ( eComp == COMPARE_GREATER ) + sal_Int32 nComp = rSearchName.compareTo( pCmpData->maSearchName ); + if (nComp > 0) { if ( pIndex ) *pIndex = ULONG_MAX; return NULL; } - else if ( eComp == COMPARE_EQUAL ) + else if (nComp == 0) return const_cast<ImplFontListNameInfo*>(pCmpData); } @@ -215,8 +214,8 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon { nMid = (nLow + nHigh) / 2; pCompareData = &maEntries[nMid]; - eComp = rSearchName.CompareTo( pCompareData->maSearchName ); - if ( eComp == COMPARE_LESS ) + sal_Int32 nComp = rSearchName.compareTo(pCompareData->maSearchName); + if (nComp < 0) { if ( !nMid ) break; @@ -224,7 +223,7 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon } else { - if ( eComp == COMPARE_GREATER ) + if (nComp > 0) nLow = nMid + 1; else { @@ -237,8 +236,8 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon if ( pIndex ) { - eComp = rSearchName.CompareTo( pCompareData->maSearchName ); - if ( eComp == COMPARE_GREATER ) + sal_Int32 nComp = rSearchName.compareTo(pCompareData->maSearchName); + if (nComp > 0) *pIndex = (nMid+1); else *pIndex = nMid; @@ -249,7 +248,7 @@ ImplFontListNameInfo* FontList::ImplFind( const XubString& rSearchName, sal_uLon // ----------------------------------------------------------------------- -ImplFontListNameInfo* FontList::ImplFindByName( const XubString& rStr ) const +ImplFontListNameInfo* FontList::ImplFindByName(const OUString& rStr) const { XubString aSearchName = rStr; ImplMakeSearchStringFromName( aSearchName ); @@ -425,7 +424,7 @@ FontList* FontList::Clone() const // ----------------------------------------------------------------------- -const XubString& FontList::GetStyleName( FontWeight eWeight, FontItalic eItalic ) const +const OUString& FontList::GetStyleName(FontWeight eWeight, FontItalic eItalic) const { if ( eWeight > WEIGHT_BOLD ) { @@ -466,41 +465,40 @@ const XubString& FontList::GetStyleName( FontWeight eWeight, FontItalic eItalic // ----------------------------------------------------------------------- -XubString FontList::GetStyleName( const FontInfo& rInfo ) const +OUString FontList::GetStyleName(const FontInfo& rInfo) const { - XubString aStyleName = rInfo.GetStyleName(); - FontWeight eWeight = rInfo.GetWeight(); - FontItalic eItalic = rInfo.GetItalic(); + OUString aStyleName = rInfo.GetStyleName(); + FontWeight eWeight = rInfo.GetWeight(); + FontItalic eItalic = rInfo.GetItalic(); // Nur wenn kein StyleName gesetzt ist, geben wir einen syntetischen // Namen zurueck - if ( !aStyleName.Len() ) - aStyleName = GetStyleName( eWeight, eItalic ); + if (aStyleName.isEmpty()) + aStyleName = GetStyleName(eWeight, eItalic); else { // Translate StyleName to localized name - XubString aCompareStyleName = aStyleName; - aCompareStyleName.ToLowerAscii(); + OUString aCompareStyleName = aStyleName.toAsciiLowerCase(); aCompareStyleName = comphelper::string::remove(aCompareStyleName, ' '); - if ( aCompareStyleName.EqualsAscii( "bold" ) ) + if (aCompareStyleName == "bold") aStyleName = maBold; - else if ( aCompareStyleName.EqualsAscii( "bolditalic" ) ) + else if (aCompareStyleName == "bolditalic") aStyleName = maBoldItalic; - else if ( aCompareStyleName.EqualsAscii( "italic" ) ) + else if (aCompareStyleName == "italic") aStyleName = maNormalItalic; - else if ( aCompareStyleName.EqualsAscii( "standard" ) ) + else if (aCompareStyleName == "standard") aStyleName = maNormal; - else if ( aCompareStyleName.EqualsAscii( "regular" ) ) + else if (aCompareStyleName == "regular") aStyleName = maNormal; - else if ( aCompareStyleName.EqualsAscii( "medium" ) ) + else if (aCompareStyleName == "medium") aStyleName = maNormal; - else if ( aCompareStyleName.EqualsAscii( "light" ) ) + else if (aCompareStyleName == "light") aStyleName = maLight; - else if ( aCompareStyleName.EqualsAscii( "lightitalic" ) ) + else if (aCompareStyleName == "lightitalic") aStyleName = maLightItalic; - else if ( aCompareStyleName.EqualsAscii( "black" ) ) + else if (aCompareStyleName == "black") aStyleName = maBlack; - else if ( aCompareStyleName.EqualsAscii( "blackitalic" ) ) + else if (aCompareStyleName == "blackitalic") aStyleName = maBlackItalic; // fix up StyleName, because the PS Printer driver from @@ -544,7 +542,7 @@ namespace } } -FontInfo FontList::Get( const XubString& rName, const XubString& rStyleName ) const +FontInfo FontList::Get(const OUString& rName, const OUString& rStyleName) const { ImplFontListNameInfo* pData = ImplFindByName( rName ); ImplFontListFontInfo* pFontInfo = NULL; @@ -556,7 +554,7 @@ FontInfo FontList::Get( const XubString& rName, const XubString& rStyleName ) co pSearchInfo = pData->mpFirst; while ( pSearchInfo ) { - if ( rStyleName.EqualsIgnoreCaseAscii( GetStyleName( *pSearchInfo ) ) ) + if (rStyleName.equalsIgnoreAsciiCase(GetStyleName(*pSearchInfo))) { pFontInfo = pSearchInfo; break; @@ -628,8 +626,8 @@ FontInfo FontList::Get( const XubString& rName, const XubString& rStyleName ) co // ----------------------------------------------------------------------- -FontInfo FontList::Get( const XubString& rName, - FontWeight eWeight, FontItalic eItalic ) const +FontInfo FontList::Get(const OUString& rName, + FontWeight eWeight, FontItalic eItalic) const { ImplFontListNameInfo* pData = ImplFindByName( rName ); ImplFontListFontInfo* pFontInfo = NULL; @@ -667,7 +665,7 @@ FontInfo FontList::Get( const XubString& rName, // ----------------------------------------------------------------------- -sal_Bool FontList::IsAvailable( const XubString& rName ) const +sal_Bool FontList::IsAvailable(const OUString& rName) const { return (ImplFindByName( rName ) != 0); } @@ -692,7 +690,7 @@ sal_uInt16 FontList::GetFontNameType( sal_uInt16 nFont ) const // ----------------------------------------------------------------------- -sal_Handle FontList::GetFirstFontInfo( const XubString& rName ) const +sal_Handle FontList::GetFirstFontInfo(const OUString& rName) const { ImplFontListNameInfo* pData = ImplFindByName( rName ); if ( !pData ) |