[PATCH] Replace (Byte)String with O(U)String in sw

Christina Rossmanith ChrRossmanith at web.de
Sat Oct 1 10:48:07 PDT 2011


---
 sw/source/core/access/acccontext.cxx |   16 ++++++----------
 sw/source/core/access/accmap.cxx     |    6 +++---
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 47398be..ae77b95 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -54,6 +54,7 @@
 #include <acccontext.hxx>
 #include <svx/AccessibleShape.hxx>
 #include <comphelper/accessibleeventnotifier.hxx>
+#include <comphelper/string.hxx>
 #include <PostItMgr.hxx>
 
 using namespace sw::access;
@@ -1398,27 +1399,22 @@ OUString SwAccessibleContext::GetResource( sal_uInt16 nResId,
                                            const OUString *pArg1,
                                            const OUString *pArg2 )
 {
-    String sStr;
+    OUString sStr;
     {
         SolarMutexGuard aGuard;
-
-        sStr = SW_RES( nResId );
+        sStr = ResId::toString( SW_RES( nResId ) );
     }
 
     if( pArg1 )
     {
-        sStr.SearchAndReplace( String::CreateFromAscii(
-                                    RTL_CONSTASCII_STRINGPARAM( "$(ARG1)" )),
-                               String( *pArg1 ) );
+        sStr = comphelper::string::replace( sStr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$(ARG1)") ), *pArg1 );
     }
     if( pArg2 )
     {
-        sStr.SearchAndReplace( String::CreateFromAscii(
-                                    RTL_CONSTASCII_STRINGPARAM( "$(ARG2)" )),
-                               String( *pArg2 ) );
+        sStr = comphelper::string::replace( sStr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$(ARG2)") ), *pArg2 );
     }
 
-    return OUString( sStr );
+    return sStr;
 }
 
 void SwAccessibleContext::RemoveFrmFromAccessibleMap()
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 1dc2c8c..f25d480 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -185,9 +185,9 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/,
         {
             (void)r;
 #if OSL_DEBUG_LEVEL > 1
-            ByteString aError( "Runtime exception caught while notifying shape.:\n" );
-            aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
-            OSL_FAIL( aError.GetBuffer() );
+            rtl::OString aError( "Runtime exception caught while notifying shape.:\n" );
+            aError += ::rtl::OUStringToOString( rtl::OUString( r.Message), RTL_TEXTENCODING_UTF8 );
+            OSL_FAIL( aError.getStr() );
 #endif
         }
     }
-- 
1.7.4.1


--------------070403000503020109050907--


More information about the LibreOffice mailing list