Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4259

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/59/4259/1

String=>OUString svtools inetimg

Change-Id: Id986014e3b2897478427a072be582581d3791101
---
M include/svtools/inetimg.hxx
M svtools/source/urlobj/inetimg.cxx
M sw/source/ui/dochdl/swdtflvr.cxx
3 files changed, 45 insertions(+), 46 deletions(-)



diff --git a/include/svtools/inetimg.hxx b/include/svtools/inetimg.hxx
index f28ac2c..ddd40a3 100644
--- a/include/svtools/inetimg.hxx
+++ b/include/svtools/inetimg.hxx
@@ -19,7 +19,6 @@
 #ifndef _INETIMG_HXX
 #define _INETIMG_HXX
 
-#include <tools/string.hxx>
 #include <tools/gen.hxx>
 
 class SvData;
@@ -29,28 +28,28 @@
 
 class INetImage
 {
-    String          aImageURL;
-    String          aTargetURL;
-    String          aTargetFrame;
-    String          aAlternateText;
+    OUString        aImageURL;
+    OUString        aTargetURL;
+    OUString        aTargetFrame;
+    OUString        aAlternateText;
     Size            aSizePixel;
 
 protected:
-    String          CopyExchange() const;
-    void            PasteExchange( const String& rString );
+    OUString        CopyExchange() const;
+    void            PasteExchange( const OUString& rString );
 
-    void            SetImageURL( const String& rS )     { aImageURL = rS; }
-    void            SetTargetURL( const String& rS )    { aTargetURL = rS; }
-    void            SetTargetFrame( const String& rS )  { aTargetFrame = rS; }
-    void            SetAlternateText( const String& rS ){ aAlternateText = rS; }
+    void            SetImageURL( const OUString& rS )     { aImageURL = rS; }
+    void            SetTargetURL( const OUString& rS )    { aTargetURL = rS; }
+    void            SetTargetFrame( const OUString& rS )  { aTargetFrame = rS; }
+    void            SetAlternateText( const OUString& rS ){ aAlternateText = rS; }
     void            SetSizePixel( const Size& rSize )   { aSizePixel = rSize; }
 
 public:
                     INetImage(
-                        const String& rImageURL,
-                        const String& rTargetURL,
-                        const String& rTargetFrame,
-                        const String& rAlternateText,
+                        const OUString& rImageURL,
+                        const OUString& rTargetURL,
+                        const OUString& rTargetFrame,
+                        const OUString& rAlternateText,
                         const Size& rSizePixel )
                     :   aImageURL( rImageURL ),
                         aTargetURL( rTargetURL ),
@@ -61,10 +60,10 @@
                     INetImage()
                     {}
 
-    const String&   GetImageURL() const { return aImageURL; }
-    const String&   GetTargetURL() const { return aTargetURL; }
-    const String&   GetTargetFrame() const { return aTargetFrame; }
-    const String&   GetAlternateText() const { return aAlternateText; }
+    const OUString&   GetImageURL() const { return aImageURL; }
+    const OUString&   GetTargetURL() const { return aTargetURL; }
+    const OUString&   GetTargetFrame() const { return aTargetFrame; }
+    const OUString&   GetAlternateText() const { return aAlternateText; }
     const Size&     GetSizePixel() const { return aSizePixel; }
 
     // Im-/Export
diff --git a/svtools/source/urlobj/inetimg.cxx b/svtools/source/urlobj/inetimg.cxx
index e57c194..c7b2c78 100644
--- a/svtools/source/urlobj/inetimg.cxx
+++ b/svtools/source/urlobj/inetimg.cxx
@@ -23,6 +23,7 @@
 #include <svtools/inetimg.hxx>
 
 #define TOKEN_SEPARATOR '\001'
+#define STR_TOKEN_SEPARATOR "\001"
 
 sal_Bool INetImage::Write( SvStream& rOStm, sal_uLong nFormat ) const
 {
@@ -31,17 +32,14 @@
     {
     case SOT_FORMATSTR_ID_INET_IMAGE:
         {
-            String sString;
-            (sString += aImageURL ) += TOKEN_SEPARATOR;
-            (sString += aTargetURL ) += TOKEN_SEPARATOR;
-            (sString += aTargetFrame ) += TOKEN_SEPARATOR;
-            (sString += aAlternateText ) += TOKEN_SEPARATOR;
-            sString += OUString::number( aSizePixel.Width() );
-            sString += TOKEN_SEPARATOR;
-            sString += OUString::number( aSizePixel.Height() );
+            OUString sString = aImageURL + STR_TOKEN_SEPARATOR +
+                aTargetURL + STR_TOKEN_SEPARATOR +
+                aTargetFrame + STR_TOKEN_SEPARATOR +
+                aAlternateText + STR_TOKEN_SEPARATOR +
+                OUString::number( aSizePixel.Width() ) + STR_TOKEN_SEPARATOR +
+                OUString::number( aSizePixel.Height() );
 
-            OString sOut(OUStringToOString(sString,
-                RTL_TEXTENCODING_UTF8));
+            OString sOut(OUStringToOString(sString, RTL_TEXTENCODING_UTF8));
 
             rOStm.Write(sOut.getStr(), sOut.getLength());
             static const sal_Char aEndChar[2] = { 0 };
@@ -63,17 +61,17 @@
     {
     case SOT_FORMATSTR_ID_INET_IMAGE:
         {
-            String sINetImg = read_zeroTerminated_uInt8s_ToOUString(rIStm, RTL_TEXTENCODING_UTF8);
+            OUString sINetImg = read_zeroTerminated_uInt8s_ToOUString(rIStm, 
RTL_TEXTENCODING_UTF8);
             sal_Int32 nStart = 0;
-            aImageURL = sINetImg.GetToken( 0, TOKEN_SEPARATOR, nStart );
-            aTargetURL = sINetImg.GetToken( 0, TOKEN_SEPARATOR, nStart );
-            aTargetFrame = sINetImg.GetToken( 0, TOKEN_SEPARATOR, nStart );
-            aAlternateText = sINetImg.GetToken( 0, TOKEN_SEPARATOR, nStart );
-            aSizePixel.Width() = sINetImg.GetToken( 0, TOKEN_SEPARATOR,
-                                                    nStart ).ToInt32();
-            aSizePixel.Height() = sINetImg.GetToken( 0, TOKEN_SEPARATOR,
-                                                    nStart ).ToInt32();
-            bRet = 0 != sINetImg.Len();
+            aImageURL = sINetImg.getToken( 0, TOKEN_SEPARATOR, nStart );
+            aTargetURL = sINetImg.getToken( 0, TOKEN_SEPARATOR, nStart );
+            aTargetFrame = sINetImg.getToken( 0, TOKEN_SEPARATOR, nStart );
+            aAlternateText = sINetImg.getToken( 0, TOKEN_SEPARATOR, nStart );
+            aSizePixel.Width() = sINetImg.getToken( 0, TOKEN_SEPARATOR,
+                                                    nStart ).toInt32();
+            aSizePixel.Height() = sINetImg.getToken( 0, TOKEN_SEPARATOR,
+                                                    nStart ).toInt32();
+            bRet = !sINetImg.isEmpty();
         }
         break;
 
@@ -115,17 +113,19 @@
                 rIStm.Seek( nFilePos + nAltOffset );
                 aAlternateText = read_zeroTerminated_uInt8s_ToOUString(rIStm, eSysCSet);
             }
-            else if( aAlternateText.Len() )
-                aAlternateText.Erase();
-
+            else if( !aAlternateText.isEmpty() )
+            {
+                aAlternateText = "";
+            }
             if( nAnchorOffset )
             {
                 rIStm.Seek( nFilePos + nAnchorOffset );
                 aTargetURL = read_zeroTerminated_uInt8s_ToOUString(rIStm, eSysCSet);
             }
-            else if( aTargetURL.Len() )
-                aTargetURL.Erase();
-
+            else if( !aTargetURL.isEmpty() )
+            {
+                aTargetURL = "";
+            }
             bRet = 0 == rIStm.GetError();
         }
         break;
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index 31e0fa6..a58a1e4 100644
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -1880,7 +1880,7 @@
         ( rData.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_IMAGE ) &&
           rData.GetINetImage( SOT_FORMATSTR_ID_NETSCAPE_IMAGE, aINetImg )) )
     {
-        if( aINetImg.GetImageURL().Len() && bInsertGRF )
+        if( !aINetImg.GetImageURL().isEmpty() && bInsertGRF )
         {
             String sURL( aINetImg.GetImageURL() );
             SwTransferable::_CheckForURLOrLNKFile( rData, sURL );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id986014e3b2897478427a072be582581d3791101
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Norbert Thiebaud <nthiebaud@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.