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/3417

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/17/3417/1

Convert SwDrawTextInfo.pText from XubString to OUString

Change-Id: Ie567feb315a018a1f5bd794a4d12435865e67ec4
---
M sw/source/core/inc/drawfont.hxx
M sw/source/core/text/txtfly.cxx
M sw/source/core/txtnode/fntcache.cxx
M sw/source/core/txtnode/fntcap.cxx
M sw/source/core/txtnode/swfont.cxx
5 files changed, 46 insertions(+), 46 deletions(-)



diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx
index a577fa0..204a1a7 100644
--- a/sw/source/core/inc/drawfont.hxx
+++ b/sw/source/core/inc/drawfont.hxx
@@ -22,6 +22,7 @@
 
 #include <tools/solar.h>
 #include <tools/string.hxx>
+#include <tools/debug.hxx>
 
 class SwTxtFrm;
 class OutputDevice;
@@ -42,7 +43,7 @@
     ViewShell* pSh;
     const SwScriptInfo* pScriptInfo;
     const Point* pPos;
-    const XubString* pText;
+    const OUString* pText;
     const SwWrongList* pWrong;
     const SwWrongList* pGrammarCheck;
     const SwWrongList* pSmartTags;
@@ -103,7 +104,7 @@
 #endif
 
     SwDrawTextInfo( ViewShell *pS, OutputDevice &rO, const SwScriptInfo* pSI,
-                    const XubString &rSt, xub_StrLen nI, xub_StrLen nL,
+                    const OUString &rSt, xub_StrLen nI, xub_StrLen nL,
                     sal_uInt16 nW = 0, sal_Bool bB = sal_False )
     {
         pFrm = NULL;
@@ -202,7 +203,7 @@
         return pHyphPos;
     }
 
-    const XubString &GetText() const
+    const OUString &GetText() const
     {
         return *pText;
     }
@@ -415,7 +416,7 @@
 #endif
     }
 
-    void SetText( const XubString &rNew )
+    void SetText( const OUString &rNew )
     {
         pText = &rNew;
     }
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index e38086a..3735e52 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -482,7 +482,7 @@
     SwRect aRect( rInf.GetPos(), rInf.GetSize() );
     if( rInf.GetSpace() )
     {
-        xub_StrLen nTmpLen = STRING_LEN == rInf.GetLen() ? rInf.GetText().Len() :
+        xub_StrLen nTmpLen = STRING_LEN == rInf.GetLen() ? rInf.GetText().getLength() :
                                                       rInf.GetLen();
         if( rInf.GetSpace() > 0 )
         {
@@ -490,7 +490,7 @@
             const xub_StrLen nEndPos = rInf.GetIdx() + nTmpLen;
             for( xub_StrLen nPos = rInf.GetIdx(); nPos < nEndPos; ++nPos )
             {
-                if( CH_BLANK == rInf.GetText().GetChar( nPos ) )
+                if( CH_BLANK == rInf.GetText()[ nPos ] )
                     ++nSpaceCnt;
             }
             if( nSpaceCnt )
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 40369b0..84d18b9 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -219,7 +219,7 @@
    const long nTmpSpaceAdd = rData.rInf.GetSpace() / SPACING_PRECISION_FACTOR;
 
    if ( nEnd < rData.nCnt
-       && CH_BLANK == rData.rInf.GetText().GetChar( rData.rInf.GetIdx() + nEnd ) )
+       && CH_BLANK == rData.rInf.GetText()[ rData.rInf.GetIdx() + nEnd ] )
    {
        if( nEnd + 1 == rData.nCnt )
            nBlank -= nTmpSpaceAdd;
@@ -933,7 +933,7 @@
         pTmpFont->SetColor( aOldColor );
 
     if ( STRING_LEN == rInf.GetLen() )
-        rInf.SetLen( rInf.GetText().Len() );
+        rInf.SetLen( rInf.GetText().getLength() );
 
 
     //
@@ -974,7 +974,7 @@
             long nNextFix;
 
             // punctuation characters are not centered
-            sal_Unicode cChar = rInf.GetText().GetChar( rInf.GetIdx() );
+            sal_Unicode cChar = rInf.GetText()[ rInf.GetIdx() ];
             sal_uInt8 nType = lcl_WhichPunctuation( cChar );
             switch ( nType )
             {
@@ -997,7 +997,7 @@
                 nNextFix += nWidthPerChar;
 
                 // punctuation characters are not centered
-                cChar = rInf.GetText().GetChar( rInf.GetIdx() + j );
+                cChar = rInf.GetText()[ rInf.GetIdx() + j ];
                 nType = lcl_WhichPunctuation( cChar );
                 switch ( nType )
                 {
@@ -1099,14 +1099,14 @@
                     {
                         for( xub_StrLen i = 0; i < rInf.GetLen(); i++, nKernSum += rInf.GetKern() )
                         {
-                            if ( CH_BLANK == rInf.GetText().GetChar(rInf.GetIdx()+i) )
+                            if ( CH_BLANK == rInf.GetText()[ rInf.GetIdx()+i ] )
                                 nKernSum += nSpaceAdd;
                             pKernArray[i] += nKernSum;
                         }
                         ///With through/uderstr. Grouped style requires a blank at the end
                         ///of a text edition special measures:
                         if( bPaintBlank && rInf.GetLen() && (CH_BLANK ==
-                            rInf.GetText().GetChar( rInf.GetIdx() + rInf.GetLen() - 1) ) )
+                            rInf.GetText()[ rInf.GetIdx() + rInf.GetLen() - 1 ] ) )
                         {
                             ///If it concerns a singular, underlined space acts,
                             ///we must spend two:
@@ -1137,7 +1137,7 @@
                         long nSpaceSum = 0;
                         for( i = 0; i < rInf.GetLen(); i++ )
                         {
-                            if( CH_BLANK == rInf.GetText().GetChar( rInf.GetIdx() + i) )
+                            if( CH_BLANK == rInf.GetText()[ rInf.GetIdx() + i ] )
                             {
                                 nSpaceSum += nSpaceAdd;
                                 if( j < i)
@@ -1310,7 +1310,7 @@
                 for( xub_StrLen i = 0; i < rInf.GetLen(); i++,
                      nKernSum += rInf.GetKern() )
                 {
-                    if ( CH_BLANK == rInf.GetText().GetChar(rInf.GetIdx()+i) )
+                    if ( CH_BLANK == rInf.GetText()[ rInf.GetIdx()+i ] )
                         nKernSum += nSpaceAdd;
                     pKernArray[i] += nKernSum;
                 }
@@ -1318,7 +1318,7 @@
                 // In case of underlined/strike-through justified text
                 // a blank at the end requires special handling:
                 if( bPaintBlank && rInf.GetLen() && ( CH_BLANK ==
-                    rInf.GetText().GetChar( rInf.GetIdx()+rInf.GetLen()-1 ) ) )
+                    rInf.GetText()[ rInf.GetIdx()+rInf.GetLen()-1 ] ) )
                 {
                     // If it is a single underlined space, output 2 spaces:
                     if( 1 == rInf.GetLen() )
@@ -1346,7 +1346,7 @@
                 xub_StrLen i;
                 for( i = 0; i < rInf.GetLen(); i++ )
                 {
-                    if( CH_BLANK == rInf.GetText().GetChar( rInf.GetIdx()+i ) )
+                    if( CH_BLANK == rInf.GetText()[ rInf.GetIdx()+i ] )
                     {
                         nKernSum += nSpaceAdd;
                         if( j < i )
@@ -1401,8 +1401,8 @@
 
     else
     {
-        const String* pStr = &rInf.GetText();
-        String aStr;
+        const OUString* pStr = &rInf.GetText();
+        OUString aStr;
         sal_Bool bBullet = rInf.GetBullet();
         if( bSymbol )
             bBullet = sal_False;
@@ -1523,25 +1523,25 @@
                 --nCopyStart;
 
             xub_StrLen nCopyLen = rInf.GetLen();
-            if ( nCopyStart + nCopyLen < rInf.GetText().Len() )
+            if ( nCopyStart + nCopyLen < rInf.GetText().getLength() )
                 ++nCopyLen;
 
-            aStr = rInf.GetText().Copy( nCopyStart, nCopyLen );
+            aStr = rInf.GetText().copy( nCopyStart, nCopyLen );
             pStr = &aStr;
 
-            for( xub_StrLen i = 0; i < aStr.Len(); ++i )
-                if( CH_BLANK == aStr.GetChar( i ) )
-                    aStr.SetChar( i, CH_BULLET );
+            for( sal_Int32 i = 0; i < aStr.getLength(); ++i )
+                if( CH_BLANK == aStr[ i ] )
+                    aStr = aStr.replaceAt(i, 1, OUString(CH_BULLET));
         }
 
-        xub_StrLen nCnt = rInf.GetText().Len();
+        xub_StrLen nCnt = rInf.GetText().getLength();
         if ( nCnt < rInf.GetIdx() )
             nCnt = 0;
         else
             nCnt = nCnt - rInf.GetIdx();
         nCnt = Min( nCnt, rInf.GetLen() );
         long nKernSum = rInf.GetKern();
-        sal_Unicode cChPrev = rInf.GetText().GetChar( rInf.GetIdx() );
+        sal_Unicode cChPrev = rInf.GetText()[ rInf.GetIdx() ];
 
         // In case of a single underlined space in justified text,
         // have to output 2 spaces:
@@ -1594,7 +1594,7 @@
                 nSpaceSum = nHalfSpace;
             for ( xub_StrLen i=1; i<nCnt; ++i,nKernSum += rInf.GetKern() )
             {
-                nCh = rInf.GetText().GetChar( rInf.GetIdx() + i );
+                nCh = rInf.GetText()[ rInf.GetIdx() + i ];
 
                 OSL_ENSURE( pScrArray, "Where is the screen array?" );
                 long nScr;
@@ -1770,7 +1770,7 @@
 {
     Size aTxtSize;
     const xub_StrLen nLn = ( STRING_LEN != rInf.GetLen() ) ? rInf.GetLen() :
-                           rInf.GetText().Len();
+                           rInf.GetText().getLength();
 
     // be sure to have the correct layout mode at the printer
     if ( pPrinter )
@@ -1897,13 +1897,13 @@
             rInf.GetOut().GetTextArray( rInf.GetText(), pScrArray,
                                         rInf.GetIdx(), rInf.GetLen() );
             nScrPos = pScrArray[ 0 ];
-            xub_StrLen nCnt = rInf.GetText().Len();
+            xub_StrLen nCnt = rInf.GetText().getLength();
             if ( nCnt < rInf.GetIdx() )
                 nCnt=0;
             else
                 nCnt = nCnt - rInf.GetIdx();
             nCnt = Min (nCnt, nLn);
-            sal_Unicode nChPrev = rInf.GetText().GetChar( rInf.GetIdx() );
+            sal_Unicode nChPrev = rInf.GetText()[ rInf.GetIdx() ];
 
             sal_Unicode nCh;
 
@@ -1915,7 +1915,7 @@
             const sal_uInt16 nDiv = nMul+1;
             for( xub_StrLen i=1; i<nCnt; i++ )
             {
-                nCh = rInf.GetText().GetChar( rInf.GetIdx() + i );
+                nCh = rInf.GetText()[ rInf.GetIdx() + i ];
                 long nScr;
                 nScr = pScrArray[ i ] - pScrArray[ i - 1 ];
                 if ( nCh == CH_BLANK )
@@ -2143,7 +2143,7 @@
 
     while ( ( nRight < long( rInf.GetOfst() ) ) && ( nIdx < nEnd ) )
     {
-        if ( nSpaceAdd && CH_BLANK == rInf.GetText().GetChar( nIdx ) )
+        if ( nSpaceAdd && CH_BLANK == rInf.GetText()[ nIdx ] )
             nSpaceSum += nSpaceAdd;
 
         // go to next character (cell).
@@ -2322,7 +2322,7 @@
     sal_uInt16 nTxtBreak = 0;
     long nKern = 0;
 
-    sal_uInt16 nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
+    sal_uInt16 nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().getLength()
                                                : rInf.GetLen() );
 
     if ( rInf.GetFrm() && nLn && rInf.SnapToGrid() &&
@@ -2395,8 +2395,8 @@
     {
         nKern = CheckKerning();
 
-        const XubString* pTmpText;
-        XubString aTmpText;
+        const OUString* pTmpText;
+        OUString aTmpText;
         xub_StrLen nTmpIdx;
         xub_StrLen nTmpLen;
         bool bTextReplaced = false;
@@ -2426,14 +2426,13 @@
                     // In this case, the beginning of aTmpText is wrong.
                     XubString aSnippetTmp( aSnippet, 0, 1 );
                     aSnippetTmp = aSub[nActual].CalcCaseMap( aSnippetTmp );
-                    aTmpText.Erase( 0, aSnippetTmp.Len() );
-                    aTmpText.Insert( aSnippet.GetChar( 0 ), 0 );
+                    aTmpText = aTmpText.replaceAt( 0, aSnippetTmp.Len(), 
OUString(aSnippet.GetChar( 0 )) );
                 }
             }
 
             pTmpText = &aTmpText;
             nTmpIdx = 0;
-            nTmpLen = aTmpText.Len();
+            nTmpLen = aTmpText.getLength();
             bTextReplaced = true;
         }
 
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 00ed43e..f99916c 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -535,7 +535,7 @@
     // hochgezogen in SwFont: const Point aPos( CalcPos(rPos) );
 
     if( rInf.GetLen() == STRING_LEN )
-        rInf.SetLen( rInf.GetText().Len() );
+        rInf.SetLen( rInf.GetText().getLength() );
 
     const Point& rOldPos = rInf.GetPos();
     const sal_uInt16 nCapWidth = (sal_uInt16)( GetCapitalSize( rInf ).Width() );
@@ -559,8 +559,8 @@
     Size aPartSize;
     long nKana = 0;
     const XubString aTxt( CalcCaseMap( rDo.GetInf().GetText() ) );
-    xub_StrLen nMaxPos = Min( sal_uInt16(rDo.GetInf().GetText().Len()
-                            - rDo.GetInf().GetIdx()), rDo.GetInf().GetLen() );
+    xub_StrLen nMaxPos = Min( sal_uInt16(rDo.GetInf().GetText().getLength() - 
rDo.GetInf().GetIdx()),
+                             rDo.GetInf().GetLen() );
     rDo.GetInf().SetLen( nMaxPos );
 
     const XubString& rOldText = rDo.GetInf().GetText();
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 54fe4ce..ea9dd55 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -733,7 +733,7 @@
     SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
 
     Size aTxtSize;
-    xub_StrLen nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
+    xub_StrLen nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().getLength()
                                                    : rInf.GetLen() );
     rInf.SetLen( nLn );
     if( IsCapital() && nLn )
@@ -793,7 +793,7 @@
         }
     }
 
-    if (1==rInf.GetLen() && CH_TXT_ATR_FIELDSTART==rInf.GetText().GetChar(rInf.GetIdx()))
+    if (1==rInf.GetLen() && CH_TXT_ATR_FIELDSTART==rInf.GetText()[rInf.GetIdx()])
     {
         xub_StrLen nOldIdx(rInf.GetIdx());
         xub_StrLen nOldLen(rInf.GetLen());
@@ -805,7 +805,7 @@
         rInf.SetIdx( nOldIdx );
         rInf.SetLen( nOldLen );
     }
-    else if (1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetText().GetChar(rInf.GetIdx()))
+    else if (1==rInf.GetLen() && CH_TXT_ATR_FIELDEND==rInf.GetText()[ rInf.GetIdx() ])
     {
         xub_StrLen nOldIdx(rInf.GetIdx());
         xub_StrLen nOldLen(rInf.GetLen());
@@ -828,7 +828,7 @@
 void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey )
 {
     rInf.SetGreyWave( bGrey );
-    xub_StrLen nLn = rInf.GetText().Len();
+    xub_StrLen nLn = rInf.GetText().getLength();
     if( !rInf.GetLen() || !nLn )
         return;
     if( STRING_LEN == rInf.GetLen() )
@@ -960,7 +960,7 @@
 
 void SwSubFont::_DrawStretchText( SwDrawTextInfo &rInf )
 {
-    if( !rInf.GetLen() || !rInf.GetText().Len() )
+    if( !rInf.GetLen() || !rInf.GetText().getLength() )
         return;
 
     FontUnderline nOldUnder = UNDERLINE_NONE;
@@ -1050,7 +1050,7 @@
 
     SwDigitModeModifier aDigitModeModifier( rInf.GetOut(), rInf.GetFont()->GetLanguage() );
 
-    xub_StrLen nLn = rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
+    xub_StrLen nLn = rInf.GetLen() == STRING_LEN ? rInf.GetText().getLength()
                                                  : rInf.GetLen();
     rInf.SetLen( nLn );
     xub_StrLen nCrsr = 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie567feb315a018a1f5bd794a4d12435865e67ec4
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Noel Grandin <noelgrandin@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.