[PATCH] fdo#38838 Replaced some use of (Uni)String with OUString.

Jean-Noël Rouvignac (via_Code_Review) gerrit at gerrit.libreoffice.org
Sat Mar 2 06:40:51 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2514

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/14/2514/1

fdo#38838 Replaced some use of (Uni)String with OUString.

Change-Id: Iad623c9300919fbae34279268a5a720f978c6434
---
M sd/inc/stlsheet.hxx
M sd/source/core/drawdoc3.cxx
M sd/source/core/stlpool.cxx
M sd/source/core/stlsheet.cxx
M sd/source/ui/func/futempl.cxx
M svl/inc/svl/style.hxx
M svl/source/items/style.cxx
M sw/inc/docstyle.hxx
M sw/inc/swtypes.hxx
M sw/source/core/bastyp/swtypes.cxx
M sw/source/core/fields/fldbas.cxx
M sw/source/ui/app/docstyle.cxx
M tools/source/rc/resmgr.cxx
M vcl/win/source/gdi/salgdi3.cxx
14 files changed, 33 insertions(+), 36 deletions(-)



diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx
index 191bcf9..8476222 100644
--- a/sd/inc/stlsheet.hxx
+++ b/sd/inc/stlsheet.hxx
@@ -61,7 +61,7 @@
     virtual bool        HasParentSupport() const;
     virtual bool        HasClearParentSupport() const;
     virtual bool        SetName( const UniString& );
-    virtual void        SetHelpId( const String& r, sal_uLong nId );
+    virtual void        SetHelpId( const OUString& r, sal_uLong nId );
 
     void        AdjustToFontHeight(SfxItemSet& rSet, sal_Bool bOnlyMissingItems = sal_True);
 
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index ef6a28b..50e22ed 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1451,7 +1451,7 @@
                     else
                     {
                         // create new style
-                        String aHelpFile;
+                        OUString aHelpFile;
                         pMySheet = static_cast<SfxStyleSheet*>( &mxStyleSheetPool->Make(aName, SD_STYLE_FAMILY_MASTERPAGE, pHisSheet->GetMask()) );
                         pMySheet->SetHelpId( aHelpFile, pHisSheet->GetHelpId(aHelpFile) );
                         pMySheet->GetItemSet().ClearItem(0);  // Delete all
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 8fb287f..86c6915 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -193,7 +193,7 @@
     * outline levels
     **************************************************************************/
     String aName(SdResId(STR_LAYOUT_OUTLINE));
-    String aHelpFile;
+    OUString aHelpFile;
 
     SfxStyleSheetBase* pParent = NULL;
     SvxLRSpaceItem aSvxLRSpaceItem( EE_PARA_LRSPACE );
@@ -599,7 +599,7 @@
 
 void SdStyleSheetPool::CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets)
 {
-    String aHelpFile;
+    OUString aHelpFile;
 
     sal_uInt32 nCount = rSourcePool.aStyles.size();
 
@@ -659,7 +659,7 @@
     std::vector<String> aNameList;
     CreateLayoutSheetNames(rLayoutName,aNameList);
 
-    String sEmpty;
+    OUString sEmpty;
     for (std::vector<String>::const_iterator it = aNameList.begin(); it != aNameList.end(); ++it)
     {
         pSheet = Find(*it, SD_STYLE_FAMILY_MASTERPAGE);
@@ -784,7 +784,7 @@
 void SdStyleSheetPool::CreatePseudosIfNecessary()
 {
     String aName;
-    String aHelpFile;
+    OUString aHelpFile;
     SfxStyleSheetBase* pSheet = NULL;
     SfxStyleSheetBase* pParent = NULL;
 
@@ -869,7 +869,7 @@
 
 void SdStyleSheetPool::UpdateStdNames()
 {
-    String aHelpFile;
+    OUString aHelpFile;
     sal_uInt32  nCount = aStyles.size();
     std::vector<SfxStyleSheetBase*> aEraseList;
 
@@ -880,7 +880,7 @@
         if( !pStyle->IsUserDefined() )
         {
             String aOldName     = pStyle->GetName();
-            sal_uLong nHelpId       = pStyle->GetHelpId( aHelpFile );
+            sal_uLong nHelpId   = pStyle->GetHelpId( aHelpFile );
             SfxStyleFamily eFam = pStyle->GetFamily();
 
             sal_Bool bHelpKnown = sal_True;
@@ -972,7 +972,7 @@
 void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet,
                                          Font& rBulletFont )
 {
-    String aHelpFile;
+    OUString aHelpFile;
     sal_uLong nHelpId = pSheet->GetHelpId( aHelpFile );
     SfxItemSet& rSet = pSheet->GetItemSet();
 
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 0854049..52a60e5 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -662,7 +662,7 @@
 
 // --------------------------------------------------------------------
 
-void SdStyleSheet::SetHelpId( const String& r, sal_uLong nId )
+void SdStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
 {
     SfxStyleSheet::SetHelpId( r, nId );
 
@@ -1073,7 +1073,7 @@
 
         if( (pEntry->nWID == EE_PARA_NUMBULLET) && (GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) )
         {
-            String aStr;
+            OUString aStr;
             const sal_uInt32 nTempHelpId = GetHelpId( aStr );
 
             if( (nTempHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nTempHelpId <= HID_PSEUDOSHEET_OUTLINE9) )
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
index 14a6035..d5ee874 100644
--- a/sd/source/ui/func/futempl.cxx
+++ b/sd/source/ui/func/futempl.cxx
@@ -241,7 +241,7 @@
             if ( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
             {
                 SfxStyleSheet* pOldStyleSheet = mpView->GetStyleSheet();
-                String aStr;
+                OUString aStr;
 
                 if( // if the object had no style sheet, allow all
                     !pOldStyleSheet ||
diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx
index 18c0ceb..e1c1b55 100644
--- a/svl/inc/svl/style.hxx
+++ b/svl/inc/svl/style.hxx
@@ -83,8 +83,8 @@
     SfxStyleFamily          nFamily;        // Familie
 
     UniString               aName, aParent, aFollow;
-    rtl::OUString           maDisplayName;
-    String                  aHelpFile;      // Name der Hilfedatei
+    OUString                maDisplayName;
+    OUString                aHelpFile;      // Name der Hilfedatei
     SfxItemSet*             pSet;           // ItemSet
     sal_uInt16              nMask;          // Flags
 
@@ -138,8 +138,8 @@
     virtual sal_Bool IsHidden() const { return bHidden; }
     virtual void SetHidden( sal_Bool bValue );
 
-    virtual sal_uLong GetHelpId( String& rFile );
-    virtual void   SetHelpId( const String& r, sal_uLong nId );
+    virtual sal_uLong GetHelpId( OUString& rFile );
+    virtual void   SetHelpId( const OUString& r, sal_uLong nId );
 
     virtual SfxItemSet& GetItemSet();
     virtual sal_uInt16 GetVersion() const;
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 614bee8..eec3036 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -284,13 +284,13 @@
 
 // Hilfe-Datei und -ID setzen und abfragen
 
-sal_uLong SfxStyleSheetBase::GetHelpId( String& rFile )
+sal_uLong SfxStyleSheetBase::GetHelpId( OUString& rFile )
 {
     rFile = aHelpFile;
     return nHelpId;
 }
 
-void SfxStyleSheetBase::SetHelpId( const String& rFile, sal_uLong nId )
+void SfxStyleSheetBase::SetHelpId( const OUString& rFile, sal_uLong nId )
 {
     aHelpFile = rFile;
     nHelpId = nId;
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index 42d1b92..7932edc 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -114,8 +114,8 @@
     virtual const String&   GetParent() const;
     virtual const String&   GetFollow() const;
 
-    virtual sal_uLong GetHelpId( String& rFile );
-    virtual void SetHelpId( const String& r, sal_uLong nId );
+    virtual sal_uLong GetHelpId( OUString& rFile );
+    virtual void SetHelpId( const OUString& r, sal_uLong nId );
 
     /** Preset the members without physical access.
      Used by StyleSheetPool. */
diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx
index 1ea929e..840adfe 100644
--- a/sw/inc/swtypes.hxx
+++ b/sw/inc/swtypes.hxx
@@ -81,6 +81,7 @@
 
 // Constant strings.
 SW_DLLPUBLIC extern String aEmptyStr;    // ""
+SW_DLLPUBLIC extern OUString aEmptyOUStr;  // remove once aEmptyStr can be changed to OUString
 SW_DLLPUBLIC extern OUString aDotStr;      // '.'
 
 // For inserting of captions (what and where to insert).
diff --git a/sw/source/core/bastyp/swtypes.cxx b/sw/source/core/bastyp/swtypes.cxx
index 97329e9..d4a49a9 100644
--- a/sw/source/core/bastyp/swtypes.cxx
+++ b/sw/source/core/bastyp/swtypes.cxx
@@ -48,6 +48,7 @@
 using namespace com::sun::star;
 
 String aEmptyStr;    // constant string
+OUString aEmptyOUStr;  // remove once aEmptyStr can be changed to OUString
 OUString aDotStr('.'); // constant string
 
 IMPL_FIXEDMEMPOOL_NEWDEL( SwAttrSet )
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 5671cc0..8134348 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -141,11 +141,6 @@
 {
 }
 
-namespace
-{
-    rtl::OUString aEmptyOUStr;
-}
-
 const rtl::OUString& SwFieldType::GetName() const
 {
     return aEmptyOUStr;
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 023faaa..8223936 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -1705,7 +1705,7 @@
             if( pDesc->GetPoolHlpFileId() != UCHAR_MAX )
                 aHelpFile = *rDoc.GetDocPattern( pDesc->GetPoolHlpFileId() );
             else
-                aHelpFile.Erase();
+                aHelpFile = "";
         }
         else if( !bCreate )
             nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
@@ -1733,7 +1733,7 @@
             if( pNumRule->GetPoolHlpFileId() != UCHAR_MAX )
                 aHelpFile = *rDoc.GetDocPattern( pNumRule->GetPoolHlpFileId() );
             else
-                aHelpFile.Erase();
+                aHelpFile = "";
         }
         else if( !bCreate )
             nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
@@ -1778,7 +1778,7 @@
             if( pFmt->GetPoolHlpFileId() != UCHAR_MAX )
                 aHelpFile = *rDoc.GetDocPattern( pFmt->GetPoolHlpFileId() );
             else
-                aHelpFile.Erase();
+                aHelpFile = "";
 
             if( RES_CONDTXTFMTCOLL == pFmt->Which() )
                 _nMask |= SWSTYLEBIT_CONDCOLL;
@@ -1969,13 +1969,13 @@
 }
 
 
-sal_uLong  SwDocStyleSheet::GetHelpId( String& rFile )
+sal_uLong  SwDocStyleSheet::GetHelpId( OUString& rFile )
 {
     sal_uInt16 nId = 0;
     sal_uInt16 nPoolId = 0;
     unsigned char nFileId = UCHAR_MAX;
 
-    rFile = rtl::OUString("swrhlppi.hlp");
+    rFile = "swrhlppi.hlp";
 
     const SwFmt* pTmpFmt = 0;
     switch( nFamily )
@@ -2069,7 +2069,7 @@
 }
 
 
-void  SwDocStyleSheet::SetHelpId( const String& r, sal_uLong nId )
+void  SwDocStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
 {
     sal_uInt8 nFileId = static_cast< sal_uInt8 >(rDoc.SetDocPattern( r ));
     sal_uInt16 nHId = static_cast< sal_uInt16 >(nId); //!! SFX changed over to ULONG arbitrarily!
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index b962bab..a9db0f0 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -1627,7 +1627,7 @@
     if( (rTop.Flags & RC_NOTFOUND) )
     {
         #if OSL_DEBUG_LEVEL > 0
-        aRet = OUString("<resource not found>");
+        aRet = "<resource not found>";
         #endif
     }
     else
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index a410028..0e4f786 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -1457,16 +1457,16 @@
                                    LOGFONTW& rLogFont,
                                    bool /*bTestVerticalAvail*/ )
 {
-    UniString   aName;
+    OUString   aName;
     if ( pFont->mpFontData )
         aName = pFont->mpFontData->GetFamilyName();
     else
         aName = pFont->GetFamilyName().GetToken( 0 );
 
-    UINT nNameLen = aName.Len();
+    UINT nNameLen = aName.getLength();
     if ( nNameLen > (sizeof( rLogFont.lfFaceName )/sizeof( wchar_t ))-1 )
         nNameLen = (sizeof( rLogFont.lfFaceName )/sizeof( wchar_t ))-1;
-    memcpy( rLogFont.lfFaceName, aName.GetBuffer(), nNameLen*sizeof( wchar_t ) );
+    memcpy( rLogFont.lfFaceName, aName.getStr(), nNameLen*sizeof( wchar_t ) );
     rLogFont.lfFaceName[nNameLen] = 0;
 
     if( !pFont->mpFontData )
@@ -1516,7 +1516,7 @@
         if( !bAvailable )
         {
             // restore non-vertical name if not vertical mode isn't available
-            memcpy( &rLogFont.lfFaceName[0], aName.GetBuffer(), nNameLen*sizeof(wchar_t) );
+            memcpy( &rLogFont.lfFaceName[0], aName.getStr(), nNameLen*sizeof(wchar_t) );
             if( nNameLen < LF_FACESIZE )
                 rLogFont.lfFaceName[nNameLen] = '\0';
         }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad623c9300919fbae34279268a5a720f978c6434
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Jean-Noël Rouvignac <jn.rouvignac at gmail.com>



More information about the LibreOffice mailing list