vcl/generic/print/genpspgraphics.cxx |   14 ++++++++------
 vcl/inc/generic/genpspgraphics.h     |    2 +-
 vcl/inc/salgdi.hxx                   |    8 ++------
 vcl/source/gdi/outdev3.cxx           |   11 ++++++++---
 vcl/source/gdi/salgdilayout.cxx      |    2 +-
 5 files changed, 20 insertions(+), 17 deletions(-)

New commits:
commit bc1af14a145f62afb58d6b63e10605d6230073cd
Author: Chr. Rossmanith <[email protected]>
Date:   Sun Mar 24 09:53:00 2013 +0100

    Use OUString and sal_Int32 in filterText()
    
    Change-Id: I31437125b51b07be490de3d979e193fad9750f51
    Reviewed-on: https://gerrit.libreoffice.org/2956
    Reviewed-by: Chris Sherlock <[email protected]>
    Reviewed-by: Eike Rathke <[email protected]>
    Reviewed-by: Fridrich Strba <[email protected]>
    Tested-by: Fridrich Strba <[email protected]>

diff --git a/vcl/generic/print/genpspgraphics.cxx 
b/vcl/generic/print/genpspgraphics.cxx
index ec48150..eb6a529 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1235,12 +1235,13 @@ void GenPspGraphics::AnnounceFonts( ImplDevFontList* 
pFontList, const psp::FastP
     pFontList->Add( pFD );
 }
 
-bool GenPspGraphics::filterText( const rtl::OUString& rOrig, rtl::OUString& 
rNewText, xub_StrLen nIndex, xub_StrLen& rLen, xub_StrLen& rCutStart, 
xub_StrLen& rCutStop )
+bool GenPspGraphics::filterText( const rtl::OUString& rOrig, rtl::OUString& 
rNewText, sal_Int32 nIndex, sal_Int32& rLen, sal_Int32& rCutStart, sal_Int32& 
rCutStop )
 {
     if( ! m_pPhoneNr )
         return false;
 
-    rCutStop = rCutStart = STRING_NOTFOUND;
+    rNewText = rOrig;
+    rCutStop = rCutStart = -1;
 
 #define FAX_PHONE_TOKEN          "@@#"
 #define FAX_PHONE_TOKEN_LENGTH   3
@@ -1260,7 +1261,7 @@ bool GenPspGraphics::filterText( const rtl::OUString& 
rOrig, rtl::OUString& rNew
         {
             nStart = nPos;
             m_bPhoneCollectionActive = true;
-            m_aPhoneCollection = rtl::OUString();
+            m_aPhoneCollection = "";
             bRet = true;
             bStarted = true;
         }
@@ -1286,13 +1287,13 @@ bool GenPspGraphics::filterText( const rtl::OUString& 
rOrig, rtl::OUString& rNew
             aPhoneNr.append( m_aPhoneCollection );
             aPhoneNr.append( "</Fax#>" );
             *m_pPhoneNr = aPhoneNr.makeStringAndClear();
-            m_aPhoneCollection = rtl::OUString();
+            m_aPhoneCollection = "";
         }
     }
     if( m_aPhoneCollection.getLength() > 1024 )
     {
         m_bPhoneCollectionActive = false;
-        m_aPhoneCollection = rtl::OUString();
+        m_aPhoneCollection = "";
         bRet = false;
     }
 
@@ -1301,7 +1302,8 @@ bool GenPspGraphics::filterText( const rtl::OUString& 
rOrig, rtl::OUString& rNew
         rLen -= nStop - nStart;
         rCutStart = nStart+nIndex;
         rCutStop = nStop+nIndex;
-        rNewText = ( rCutStart ? rOrig.copy( 0, rCutStart ) : rtl::OUString() 
) + rOrig.copy( rCutStop );
+        if (rCutStart != rCutStop)
+            rNewText = ( rCutStart ? rOrig.copy( 0, rCutStart ) : 
rtl::OUString() ) + rOrig.copy( rCutStop );
     }
 
     return bRet && m_bSwallowFaxNo;
diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h
index 99a2f35..36c0e60 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -175,7 +175,7 @@ public:
     virtual void            invert( sal_uIntPtr nPoints, const SalPoint* 
pPtAry, SalInvert nFlags );
 
     virtual sal_Bool            drawEPS( long nX, long nY, long nWidth, long 
nHeight, void* pPtr, sal_uIntPtr nSize );
-    virtual bool            filterText( const rtl::OUString& rOrigText, 
rtl::OUString& rNewText, xub_StrLen nIndex, xub_StrLen& rLen, xub_StrLen& 
rCutStart, xub_StrLen& rCutStop );
+    virtual bool            filterText( const rtl::OUString& rOrigText, 
rtl::OUString& rNewText, sal_Int32 nIndex, sal_Int32& rLen, sal_Int32& 
rCutStart, sal_Int32& rCutStop );
 
     virtual bool            drawAlphaBitmap( const SalTwoRect&,
                                              const SalBitmap& rSourceBitmap,
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index ac2d036..21d7380 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -346,12 +346,8 @@ public:
         true: a substitution has taken place and rNewText rLen, rCutStart and 
rCutStop have been filled accordingly
         false: no substitution has taken place, rNewText, rLen, rCutStart, 
rCutStop remain unchanged
      */
-    virtual bool            filterText( const rtl::OUString& rOrigText,
-                                        rtl::OUString& rNewText,
-                                        xub_StrLen nIndex,
-                                        xub_StrLen& rLen,
-                                        xub_StrLen& rCutStart,
-                                        xub_StrLen& rCutStop );
+    virtual bool            filterText( const rtl::OUString& rOrigText, 
rtl::OUString& rNewText,
+                                        sal_Int32 nIndex, sal_Int32& rLen, 
sal_Int32& rCutStart, sal_Int32& rCutStop );
 
     virtual bool            supportsOperation( OutDevSupportType ) const = 0;
 
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 565fcae..a2e2e1b 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -5809,9 +5809,14 @@ SalLayout* OutputDevice::ImplLayout( const String& 
rOrigStr,
     // filter out special markers
     if( bFilter )
     {
-        xub_StrLen nCutStart, nCutStop, nOrgLen = nLen;
-        rtl::OUString aTmpStr(aStr);
-        bool bFiltered = mpGraphics->filterText( rOrigStr, aTmpStr, nMinIndex, 
nLen, nCutStart, nCutStop );
+        sal_Int32 nCutStart, nCutStop, nOrgLen = nLen;
+        OUString aTmpStr(aStr);
+        OUString aTmpOrigStr(rOrigStr); // only needed until rOrigStr is 
OUString
+        sal_Int32 nMinIndex2=nMinIndex; // ditto
+        sal_Int32 nLen2=nLen;           // ditto
+        bool bFiltered = mpGraphics->filterText( aTmpOrigStr, aTmpStr, 
nMinIndex2, nLen2, nCutStart, nCutStop );
+        nLen = nLen2;           // ditto
+        nMinIndex = nMinIndex2; // ditto
         aStr = aTmpStr;
         if( !nLen )
             return NULL;
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index bb1c55d..5b6ec44 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -752,7 +752,7 @@ bool SalGraphics::DrawAlphaRect( long nX, long nY, long 
nWidth, long nHeight,
     return drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency );
 }
 
-bool SalGraphics::filterText( const rtl::OUString&, rtl::OUString&, 
xub_StrLen, xub_StrLen&, xub_StrLen&, xub_StrLen& )
+bool SalGraphics::filterText( const rtl::OUString&, rtl::OUString&, sal_Int32, 
sal_Int32&, sal_Int32&, sal_Int32& )
 {
     return false;
 }
_______________________________________________
Libreoffice-commits mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to