[Libreoffice-commits] core.git: sw/source

Matteo Casalin matteo.casalin at yahoo.com
Sun Sep 1 07:19:01 PDT 2013


 sw/source/filter/ww8/ww8par.cxx |   29 +++++++++++++++++------------
 sw/source/filter/ww8/ww8par.hxx |    4 ++--
 2 files changed, 19 insertions(+), 14 deletions(-)

New commits:
commit ade517fd88b743d30a82788a91a027ee9e885ec9
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Mon Aug 26 21:44:59 2013 +0200

    String to OUString
    
    Change-Id: I0285d1ad9edaf07be869c5e8325ed693beaee5f2
    Reviewed-on: https://gerrit.libreoffice.org/5730
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 4cb36f6..729ad84 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -24,6 +24,8 @@
 
 #include <unotools/ucbstreamhelper.hxx>
 #include <rtl/random.h>
+#include "rtl/ustring.hxx"
+#include "rtl/ustrbuf.hxx"
 
 #include <sfx2/docinf.hxx>
 #include <sfx2/request.hxx>
@@ -1797,13 +1799,13 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
     if( !pSD )
         return 0;
 
-    String sAuthor;
-    String sInitials;
-    String sName;
+    OUString sAuthor;
+    OUString sInitials;
+    OUString sName;
     if( bVer67 )
     {
         const WW67_ATRD* pDescri = (const WW67_ATRD*)pSD->GetData();
-        const String* pA = GetAnnotationAuthor(SVBT16ToShort(pDescri->ibst));
+        const OUString* pA = GetAnnotationAuthor(SVBT16ToShort(pDescri->ibst));
         if (pA)
             sAuthor = *pA;
         else
@@ -1815,12 +1817,15 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
         const WW8_ATRD* pDescri = (const WW8_ATRD*)pSD->GetData();
 
         {
-            sal_uInt16 nLen = SVBT16ToShort(pDescri->xstUsrInitl[0]);
+            const sal_uInt16 nLen = SVBT16ToShort(pDescri->xstUsrInitl[0]);
+            OUStringBuffer aBuf;
+            aBuf.setLength(nLen);
             for(sal_uInt16 nIdx = 1; nIdx <= nLen; ++nIdx)
-                sInitials += SVBT16ToShort(pDescri->xstUsrInitl[nIdx]);
+                aBuf[nIdx-1] = SVBT16ToShort(pDescri->xstUsrInitl[nIdx]);
+            sInitials = aBuf.makeStringAndClear();
         }
 
-        if (const String* pA = GetAnnotationAuthor(SVBT16ToShort(pDescri->ibst)))
+        if (const OUString* pA = GetAnnotationAuthor(SVBT16ToShort(pDescri->ibst)))
             sAuthor = *pA;
         else
             sAuthor = sInitials;
@@ -5497,12 +5502,12 @@ void SwWW8ImplReader::SetOutLineStyles()
     }
 }
 
-const String* SwWW8ImplReader::GetAnnotationAuthor(sal_uInt16 nIdx)
+const OUString* SwWW8ImplReader::GetAnnotationAuthor(sal_uInt16 nIdx)
 {
     if (!mpAtnNames && pWwFib->lcbGrpStAtnOwners)
     {
         // Determine authors: can be found in the TableStream
-        mpAtnNames = new ::std::vector<String>;
+        mpAtnNames = new ::std::vector<OUString>;
         SvStream& rStrm = *pTableStream;
 
         long nOldPos = rStrm.Tell();
@@ -5515,19 +5520,19 @@ const String* SwWW8ImplReader::GetAnnotationAuthor(sal_uInt16 nIdx)
             {
                 mpAtnNames->push_back(read_uInt8_PascalString(rStrm,
                     RTL_TEXTENCODING_MS_1252));
-                nRead += mpAtnNames->rbegin()->Len() + 1; // Length + sal_uInt8 count
+                nRead += mpAtnNames->rbegin()->getLength() + 1; // Length + sal_uInt8 count
             }
             else
             {
                 mpAtnNames->push_back(read_uInt16_PascalString(rStrm));
                 // Unicode: double the length + sal_uInt16 count
-                nRead += mpAtnNames->rbegin()->Len() * 2 + 2;
+                nRead += (mpAtnNames->rbegin()->getLength() + 1)*2;
             }
         }
         rStrm.Seek( nOldPos );
     }
 
-    const String *pRet = 0;
+    const OUString *pRet = 0;
     if (mpAtnNames && nIdx < mpAtnNames->size())
         pRet = &((*mpAtnNames)[nIdx]);
     return pRet;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index c700971..4613727 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1164,7 +1164,7 @@ private:
 
     SwMSDffManager* pMSDffManager;
 
-    std::vector<String>* mpAtnNames;
+    std::vector<OUString>* mpAtnNames;
     boost::shared_ptr< std::map<sal_uInt32, int> > mpAtnIndexes;
     boost::shared_ptr<WW8PLCFspecial> mpAtnStarts;
     boost::shared_ptr<WW8PLCFspecial> mpAtnEnds;
@@ -1553,7 +1553,7 @@ private:
 
 // spaeter zu ersetzen durch Aufruf in entsprechend erweiterten SvxMSDffManager
 
-    const String* GetAnnotationAuthor(sal_uInt16 nIdx);
+    const OUString* GetAnnotationAuthor(sal_uInt16 nIdx);
     int GetAnnotationIndex(sal_uInt32 nTag);
     WW8_CP GetAnnotationStart(int nIndex);
     WW8_CP GetAnnotationEnd(int nIndex);


More information about the Libreoffice-commits mailing list