From bc1af14a145f62afb58d6b63e10605d6230073cd Mon Sep 17 00:00:00 2001 From: "Chr. Rossmanith" Date: Sun, 24 Mar 2013 09:53:00 +0100 Subject: Use OUString and sal_Int32 in filterText() Change-Id: I31437125b51b07be490de3d979e193fad9750f51 Reviewed-on: https://gerrit.libreoffice.org/2956 Reviewed-by: Chris Sherlock Reviewed-by: Eike Rathke Reviewed-by: Fridrich Strba Tested-by: Fridrich Strba --- vcl/generic/print/genpspgraphics.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'vcl/generic') diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx index ec48150aceb2..eb6a52929a29 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( "" ); *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; -- cgit