[PATCH] Replace XubString with OUString (vcl/ilstbox)

Christina Roßmanith (via_Code_Review) gerrit at gerrit.libreoffice.org
Tue Mar 12 14:03:18 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2690

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/90/2690/1

Replace XubString with OUString (vcl/ilstbox)

Change-Id: Ia2cefe1649538d411ae858e21a3145ca01fff2ee
---
M vcl/inc/ilstbox.hxx
M vcl/source/control/ilstbox.cxx
2 files changed, 23 insertions(+), 23 deletions(-)



diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index 4c1b700..d2ae81f 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -57,14 +57,14 @@
 
 struct ImplEntryType
 {
-    XubString   maStr;
+    OUString    maStr;
     Image       maImage;
     void*       mpUserData;
-    sal_Bool        mbIsSelected;
+    sal_Bool    mbIsSelected;
     long        mnFlags;
     long        mnHeight;
 
-                ImplEntryType( const XubString& rStr, const Image& rImage ) :
+                ImplEntryType( const OUString& rStr, const Image& rImage ) :
                     maStr( rStr ),
                     maImage( rImage ),
                     mnFlags( 0 ),
@@ -74,7 +74,7 @@
                     mpUserData = NULL;
                 }
 
-                ImplEntryType( const XubString& rStr ) :
+                ImplEntryType( const OUString& rStr ) :
                     maStr( rStr ),
                     mnFlags( 0 ),
                     mnHeight( 0 )
@@ -143,7 +143,7 @@
     sal_uInt16          GetEntryCount() const { return (sal_uInt16)maEntries.size(); }
     sal_Bool            HasImages() const { return mnImages ? sal_True : sal_False; }
 
-    XubString       GetEntryText( sal_uInt16 nPos ) const;
+    OUString        GetEntryText( sal_uInt16 nPos ) const;
 
     sal_Bool            HasEntryImage( sal_uInt16 nPos ) const;
     Image           GetEntryImage( sal_uInt16 nPos ) const;
@@ -157,7 +157,7 @@
     void            SelectEntry( sal_uInt16 nPos, sal_Bool bSelect );
 
     sal_uInt16          GetSelectEntryCount() const;
-    XubString       GetSelectEntry( sal_uInt16 nIndex ) const;
+    OUString        GetSelectEntry( sal_uInt16 nIndex ) const;
     sal_uInt16          GetSelectEntryPos( sal_uInt16 nIndex ) const;
     sal_Bool            IsEntryPosSelected( sal_uInt16 nIndex ) const;
 
@@ -429,9 +429,9 @@
     virtual const Wallpaper& GetDisplayBackground() const;
     virtual Window*     GetPreferredKeyInputWindow();
 
-    sal_uInt16          InsertEntry( sal_uInt16 nPos, const XubString& rStr );
+    sal_uInt16          InsertEntry( sal_uInt16 nPos, const OUString& rStr );
     sal_uInt16          InsertEntry( sal_uInt16 nPos, const Image& rImage );
-    sal_uInt16          InsertEntry( sal_uInt16 nPos, const XubString& rStr, const Image& rImage );
+    sal_uInt16          InsertEntry( sal_uInt16 nPos, const OUString& rStr, const Image& rImage );
     void            RemoveEntry( sal_uInt16 nPos );
     void            SetEntryData( sal_uInt16 nPos, void* pNewData ) { maLBWindow.GetEntryList()->SetEntryData( nPos, pNewData ); }
     void            Clear();
@@ -560,7 +560,7 @@
 private:
 
     sal_uInt16      mnItemPos;  // because of UserDraw I have to know which item I draw
-    XubString       maString;
+    OUString        maString;
     Image           maImage;
 
     Rectangle       maFocusRect;
@@ -588,11 +588,11 @@
     virtual void    LoseFocus();
     virtual long    PreNotify( NotifyEvent& rNEvt );
 
-    sal_uInt16          GetItemPos() const { return mnItemPos; }
+    sal_uInt16      GetItemPos() const { return mnItemPos; }
     void            SetItemPos( sal_uInt16 n ) { mnItemPos = n; }
 
-    const XubString& GetString() const { return maString; }
-    void            SetString( const XubString& rStr ) { maString = rStr; }
+    const OUString& GetString() const { return maString; }
+    void            SetString( const OUString& rStr ) { maString = rStr; }
 
     const Image&    GetImage() const { return maImage; }
     void            SetImage( const Image& rImg ) { maImage = rImg; }
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index e790a43..73e5c5d 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -376,9 +376,9 @@
 
 // -----------------------------------------------------------------------
 
-XubString ImplEntryList::GetEntryText( sal_uInt16 nPos ) const
+OUString ImplEntryList::GetEntryText( sal_uInt16 nPos ) const
 {
-    XubString aEntryText;
+    OUString aEntryText;
     ImplEntryType* pImplEntry = GetEntry( nPos );
     if ( pImplEntry )
         aEntryText = pImplEntry->maStr;
@@ -457,7 +457,7 @@
 
 // -----------------------------------------------------------------------
 
-XubString ImplEntryList::GetSelectEntry( sal_uInt16 nIndex ) const
+OUString ImplEntryList::GetSelectEntry( sal_uInt16 nIndex ) const
 {
     return GetEntryText( GetSelectEntryPos( nIndex ) );
 }
@@ -672,7 +672,7 @@
 void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry )
 {
     ImplEntryMetrics aMetrics;
-    aMetrics.bText = rEntry.maStr.Len() ? sal_True : sal_False;
+    aMetrics.bText = !rEntry.maStr.isEmpty() ? sal_True : sal_False;
     aMetrics.bImage = !!rEntry.maImage;
     aMetrics.nEntryWidth = 0;
     aMetrics.nEntryHeight = 0;
@@ -2268,7 +2268,7 @@
 
 // -----------------------------------------------------------------------
 
-sal_uInt16 ImplListBox::InsertEntry( sal_uInt16 nPos, const XubString& rStr )
+sal_uInt16 ImplListBox::InsertEntry( sal_uInt16 nPos, const OUString& rStr )
 {
     ImplEntryType* pNewEntry = new ImplEntryType( rStr );
     sal_uInt16 nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry );
@@ -2288,7 +2288,7 @@
 
 // -----------------------------------------------------------------------
 
-sal_uInt16 ImplListBox::InsertEntry( sal_uInt16 nPos, const XubString& rStr, const Image& rImage )
+sal_uInt16 ImplListBox::InsertEntry( sal_uInt16 nPos, const OUString& rStr, const Image& rImage )
 {
     ImplEntryType* pNewEntry = new ImplEntryType( rStr, rImage );
     sal_uInt16 nNewPos = maLBWindow.InsertEntry( nPos, pNewEntry );
@@ -2697,14 +2697,14 @@
 
 rtl::OUString ImplListBox::GetMRUEntries( sal_Unicode cSep ) const
 {
-    String aEntries;
+    OUStringBuffer aEntries;
     for ( sal_uInt16 n = 0; n < GetEntryList()->GetMRUCount(); n++ )
     {
-        aEntries += GetEntryList()->GetEntryText( n );
+        aEntries.append(GetEntryList()->GetEntryText( n ));
         if( n < ( GetEntryList()->GetMRUCount() - 1 ) )
-            aEntries += cSep;
+            aEntries.append(cSep);
     }
-    return aEntries;
+    return aEntries.makeStringAndClear();
 }
 
 // =======================================================================
@@ -2920,7 +2920,7 @@
         }
     }
 
-    if( bDrawText && maString.Len() )
+    if( bDrawText && !maString.isEmpty() )
     {
         sal_uInt16 nTextStyle = TEXT_DRAW_VCENTER;
 

-- 
To view, visit https://gerrit.libreoffice.org/2690
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2cefe1649538d411ae858e21a3145ca01fff2ee
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Christina Roßmanith <ChrRossmanith at web.de>



More information about the LibreOffice mailing list