From 511595e3bc2e557ab7a8c57db8f4b4943665edfd Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 11 Oct 2013 15:00:21 +0200 Subject: convert sw/source/ui/vba/*.cxx from String to OUString Change-Id: I47b1ba2c8d6443cfadeb303881353f150c420662 --- sw/source/ui/vba/vbaaddins.cxx | 2 +- sw/source/ui/vba/vbafield.cxx | 56 ++++++++++++++++++------------------- sw/source/ui/vba/vbaselection.cxx | 6 ++-- sw/source/ui/vba/vbatablehelper.cxx | 10 +++---- sw/source/ui/vba/vbatemplate.cxx | 12 ++++---- 5 files changed, 43 insertions(+), 43 deletions(-) (limited to 'sw') diff --git a/sw/source/ui/vba/vbaaddins.cxx b/sw/source/ui/vba/vbaaddins.cxx index de2de86614dc..6956f9384d0a 100644 --- a/sw/source/ui/vba/vbaaddins.cxx +++ b/sw/source/ui/vba/vbaaddins.cxx @@ -35,7 +35,7 @@ static uno::Reference< container::XIndexAccess > lcl_getAddinCollection( const u uno::Reference xSFA(ucb::SimpleFileAccess::create(xContext)); SvtPathOptions aPathOpt; // FIXME: temporary the STARTUP path is located in $OO/basic3.1/program/addin - String aAddinPath = aPathOpt.GetAddinPath(); + OUString aAddinPath = aPathOpt.GetAddinPath(); OSL_TRACE("lcl_getAddinCollection: %s", OUStringToOString( aAddinPath, RTL_TEXTENCODING_UTF8 ).getStr() ); if( xSFA->isFolder( aAddinPath ) ) { diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx index 33bdebf643f3..2a903040d95b 100644 --- a/sw/source/ui/vba/vbafield.cxx +++ b/sw/source/ui/vba/vbafield.cxx @@ -73,11 +73,11 @@ SwVbaField::getServiceNames() class SwVbaReadFieldParams { private: - String aData; + OUString aData; xub_StrLen nLen, nFnd, nNext, nSavPtr; - String aFieldName; + OUString aFieldName; public: - SwVbaReadFieldParams( const String& rData ); + SwVbaReadFieldParams( const OUString& rData ); ~SwVbaReadFieldParams(); long SkipToNextToken(); @@ -85,22 +85,22 @@ public: xub_StrLen FindNextStringPiece( xub_StrLen _nStart = STRING_NOTFOUND ); - String GetResult() const; - String GetFieldName()const { return aFieldName; } + OUString GetResult() const; + OUString GetFieldName()const { return aFieldName; } }; -SwVbaReadFieldParams::SwVbaReadFieldParams( const String& _rData ) - : aData( _rData ), nLen( _rData.Len() ), nNext( 0 ) +SwVbaReadFieldParams::SwVbaReadFieldParams( const OUString& _rData ) + : aData( _rData ), nLen( _rData.getLength() ), nNext( 0 ) { // First search for an opening parenthesis or a space or a quotation mark // or a backslash, so that the field command // (thus INCLUDEPICTURE or ...) is ignored. - while( (nLen > nNext) && (aData.GetChar( nNext ) == ' ') ) + while( (nLen > nNext) && (aData[ nNext ] == ' ') ) ++nNext; sal_Unicode c; while( nLen > nNext - && (c = aData.GetChar( nNext )) != ' ' + && (c = aData[ nNext ]) != ' ' && c != '"' && c != '\\' && c != 132 @@ -109,7 +109,7 @@ SwVbaReadFieldParams::SwVbaReadFieldParams( const String& _rData ) nFnd = nNext; nSavPtr = nNext; - aFieldName = aData.Copy( 0, nFnd ); + aFieldName = aData.copy( 0, nFnd ); } SwVbaReadFieldParams::~SwVbaReadFieldParams() @@ -117,11 +117,11 @@ SwVbaReadFieldParams::~SwVbaReadFieldParams() } -String SwVbaReadFieldParams::GetResult() const +OUString SwVbaReadFieldParams::GetResult() const { return (STRING_NOTFOUND == nFnd) - ? aEmptyStr - : aData.Copy( nFnd, (nSavPtr - nFnd) ); + ? OUString() + : aData.copy( nFnd, (nSavPtr - nFnd) ); } // ret: -2: NOT a '\' parameter but normal Text @@ -135,9 +135,9 @@ long SwVbaReadFieldParams::SkipToNextToken() { nSavPtr = nNext; - if ('\\' == aData.GetChar(nFnd) && '\\' != aData.GetChar(nFnd + 1)) + if ('\\' == aData[nFnd] && '\\' != aData[nFnd + 1]) { - nRet = aData.GetChar(++nFnd); + nRet = aData[++nFnd]; nNext = ++nFnd; // and set behind } else @@ -146,8 +146,8 @@ long SwVbaReadFieldParams::SkipToNextToken() if ( (STRING_NOTFOUND != nSavPtr ) && ( - ('"' == aData.GetChar(nSavPtr - 1)) || - (0x201d == aData.GetChar(nSavPtr - 1)) + ('"' == aData[nSavPtr - 1]) || + (0x201d == aData[nSavPtr - 1]) ) ) { @@ -173,32 +173,32 @@ xub_StrLen SwVbaReadFieldParams::FindNextStringPiece(const xub_StrLen nStart) nNext = STRING_NOTFOUND; // Default for not found - while( (nLen > n) && (aData.GetChar( n ) == ' ') ) + while( (nLen > n) && (aData[ n ] == ' ') ) ++n; if( nLen == n ) return STRING_NOTFOUND; // String End reached! - if( (aData.GetChar( n ) == '"') // quotation marks are in front of parenthesis? - || (aData.GetChar( n ) == 0x201c) - || (aData.GetChar( n ) == 132) ) + if( (aData[ n ] == '"') // quotation marks are in front of parenthesis? + || (aData[ n ] == 0x201c) + || (aData[ n ] == 132) ) { n++; // ignore quotation marks n2 = n; // From here search for the end while( (nLen > n2) - && (aData.GetChar( n2 ) != '"') - && (aData.GetChar( n2 ) != 0x201d) - && (aData.GetChar( n2 ) != 147) ) + && (aData[ n2 ] != '"') + && (aData[ n2 ] != 0x201d) + && (aData[ n2 ] != 147) ) n2++; // Search for the end of the parenthesis } else // no quotation marks { n2 = n; // from here search for the end - while( (nLen > n2) && (aData.GetChar( n2 ) != ' ') ) // Search for the end of the parenthesis + while( (nLen > n2) && (aData[ n2 ] != ' ') ) // Search for the end of the parenthesis { - if( aData.GetChar( n2 ) == '\\' ) + if( aData[ n2 ] == '\\' ) { - if( aData.GetChar( n2+1 ) == '\\' ) + if( aData[ n2+1 ] == '\\' ) n2 += 2; // double-backslash -> OK else { @@ -213,7 +213,7 @@ xub_StrLen SwVbaReadFieldParams::FindNextStringPiece(const xub_StrLen nStart) } if( nLen > n2 ) { - if(aData.GetChar( n2 ) != ' ') n2++; + if(aData[ n2 ] != ' ') n2++; nNext = n2; } return n; diff --git a/sw/source/ui/vba/vbaselection.cxx b/sw/source/ui/vba/vbaselection.cxx index 0bcc9aee8fed..fc30b2479ea3 100644 --- a/sw/source/ui/vba/vbaselection.cxx +++ b/sw/source/ui/vba/vbaselection.cxx @@ -988,11 +988,11 @@ void SwVbaSelection::GetSelectedCellRange( OUString& sTLName, OUString& sBRName uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY ); if( xTextTableCursor.is() ) { - String sRange( xTextTableCursor->getRangeName() ); + OUString sRange( xTextTableCursor->getRangeName() ); if( comphelper::string::getTokenCount(sRange, ':') > 0 ) { - sTLName = sRange.GetToken(0, ':'); - sBRName = sRange.GetToken(1, ':'); + sTLName = sRange.getToken(0, ':'); + sBRName = sRange.getToken(1, ':'); } } if( sTLName.isEmpty() ) diff --git a/sw/source/ui/vba/vbatablehelper.cxx b/sw/source/ui/vba/vbatablehelper.cxx index 81c640ea6842..6b06b6a3fa8f 100644 --- a/sw/source/ui/vba/vbatablehelper.cxx +++ b/sw/source/ui/vba/vbatablehelper.cxx @@ -75,7 +75,7 @@ sal_Int32 SwVbaTableHelper::getTabColumnsMaxCount( ) throw (uno::RuntimeExceptio sal_Int32 SwVbaTableHelper::getTabRowIndex( const OUString& CellName ) throw (uno::RuntimeException) { sal_Int32 nRet = 0; - String sCellName(CellName); + OUString sCellName(CellName); SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName ); if( !pBox ) throw uno::RuntimeException(); @@ -90,7 +90,7 @@ sal_Int32 SwVbaTableHelper::getTabRowIndex( const OUString& CellName ) throw (un sal_Int32 SwVbaTableHelper::getTabColIndex( const OUString& CellName ) throw (uno::RuntimeException) { sal_Int32 nRet = 0; - String sCellName(CellName); + OUString sCellName(CellName); const SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName ); if( !pBox ) throw uno::RuntimeException(); @@ -104,13 +104,13 @@ OUString SwVbaTableHelper::getColumnStr( sal_Int32 nCol ) const sal_Int32 coDiff = 52; // 'A'-'Z' 'a' - 'z' sal_Int32 nCalc = 0; - String sRet; + OUString sRet; do{ nCalc = nCol % coDiff; if( nCalc >= 26 ) - sRet.Insert( sal_Unicode('a' - 26 + nCalc ), 0 ); + sRet = OUString( sal_Unicode('a' - 26 + nCalc ) ) + sRet; else - sRet.Insert( sal_Unicode('A' + nCalc ), 0 ); + sRet = OUString( sal_Unicode('A' + nCalc ) ) + sRet; if( 0 == ( nCol = nCol - nCalc ) ) break; diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx index 18f5be8e8d1f..fda87419b30c 100644 --- a/sw/source/ui/vba/vbatemplate.cxx +++ b/sw/source/ui/vba/vbatemplate.cxx @@ -29,17 +29,17 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; -static String lcl_CheckGroupName( const String& rGroupName ) +static OUString lcl_CheckGroupName( const OUString& rGroupName ) { - String sRet; + OUString sRet; //group name should contain only A-Z and a-z and spaces - for( xub_StrLen i = 0; i < rGroupName.Len(); i++ ) + for( xub_StrLen i = 0; i < rGroupName.getLength(); i++ ) { - sal_Unicode cChar = rGroupName.GetChar(i); + sal_Unicode cChar = rGroupName[i]; if (comphelper::string::isalnumAscii(cChar) || cChar == '_' || cChar == 0x20) { - sRet += cChar; + sRet += OUString(cChar); } } return comphelper::string::strip(sRet, ' '); @@ -96,7 +96,7 @@ SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeExcep { sGroup = sName.copy( 0, sName.lastIndexOf( sal_Unicode('.') ) ); } - String sNewGroup = lcl_CheckGroupName( sGroup ); + OUString sNewGroup = lcl_CheckGroupName( sGroup ); uno::Reference< container::XIndexAccess > xGroup; if( xAutoTextContainer->hasByName( sNewGroup ) ) -- cgit