From c9eb7eefd19ee5d9ecf5c6d4c2d701f169847a07 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 5 Aug 2013 09:59:55 +0200 Subject: covnert vcl/texteng.hxx from String to OUString Change-Id: Iaa2dca415b30cae436173df27058c9d3e3755efd --- .../source/extended/textwindowaccessibility.cxx | 18 +++---- include/vcl/texteng.hxx | 54 ++++++++++----------- sw/source/ui/dbui/mmaddressblockpage.cxx | 2 +- vcl/source/edit/texteng.cxx | 56 +++++++++++----------- vcl/source/edit/xtextedt.cxx | 2 +- 5 files changed, 66 insertions(+), 66 deletions(-) diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index d332ede47186..171204a76e20 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -910,7 +910,7 @@ void Document::retrieveParagraphSelection(ParagraphImpl const * pParagraph, : static_cast< ::sal_Int32 >( aMinPaM.GetIndex() ); // XXX numeric overflow *pEnd = nNumber < aMaxPaM.GetPara() - ? static_cast< ::sal_Int32 >( m_rEngine.GetText(static_cast< ::sal_uLong >(nNumber)).Len() ) + ? static_cast< ::sal_Int32 >( m_rEngine.GetText(static_cast< ::sal_uLong >(nNumber)).getLength() ) : static_cast< ::sal_Int32 >( aMaxPaM.GetIndex() ); // XXX numeric overflow (3x) @@ -943,7 +943,7 @@ Document::retrieveCharacterBounds(ParagraphImpl const * pParagraph, ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock()); ::osl::MutexGuard aInternalGuard(GetMutex()); ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); - sal_Int32 nLength = m_rEngine.GetText(nNumber).Len(); + sal_Int32 nLength = m_rEngine.GetText(nNumber).getLength(); // XXX numeric overflow if (nIndex < 0 || nIndex > nLength) throw css::lang::IndexOutOfBoundsException( @@ -1011,7 +1011,7 @@ Document::retrieveCharacterAttributes( ::osl::MutexGuard aInternalGuard(GetMutex()); ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); // XXX numeric overflow - if (nIndex < 0 || nIndex >= m_rEngine.GetText(nNumber).Len()) + if (nIndex < 0 || nIndex >= m_rEngine.GetText(nNumber).getLength()) throw css::lang::IndexOutOfBoundsException( "textwindowaccessibility.cxx:" " Document::retrieveCharacterAttributes", @@ -1139,7 +1139,7 @@ Document::retrieveRunAttributes( ::osl::MutexGuard aInternalGuard( GetMutex() ); ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() ); // XXX numeric overflow - if ( Index < 0 || Index >= m_rEngine.GetText(nNumber).Len() ) + if ( Index < 0 || Index >= m_rEngine.GetText(nNumber).getLength() ) throw css::lang::IndexOutOfBoundsException( "textwindowaccessibility.cxx:" " Document::retrieveRunAttributes", @@ -1174,7 +1174,7 @@ void Document::changeParagraphText(ParagraphImpl * pParagraph, ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); // XXX numeric overflow if (nBegin < 0 || nBegin > nEnd - || nEnd > m_rEngine.GetText(nNumber).Len()) + || nEnd > m_rEngine.GetText(nNumber).getLength()) throw css::lang::IndexOutOfBoundsException( "textwindowaccessibility.cxx:" " Document::changeParagraphText", @@ -1194,7 +1194,7 @@ void Document::copyParagraphText(ParagraphImpl const * pParagraph, ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); // XXX numeric overflow if (nBegin < 0 || nBegin > nEnd - || nEnd > m_rEngine.GetText(nNumber).Len()) + || nEnd > m_rEngine.GetText(nNumber).getLength()) throw css::lang::IndexOutOfBoundsException( "textwindowaccessibility.cxx:" " Document::copyParagraphText", @@ -1217,7 +1217,7 @@ void Document::changeParagraphAttributes( ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); // XXX numeric overflow if (nBegin < 0 || nBegin > nEnd - || nEnd > m_rEngine.GetText(nNumber).Len()) + || nEnd > m_rEngine.GetText(nNumber).getLength()) throw css::lang::IndexOutOfBoundsException( "textwindowaccessibility.cxx:" " Document::changeParagraphAttributes", @@ -1251,7 +1251,7 @@ void Document::changeParagraphSelection(ParagraphImpl * pParagraph, ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber()); // XXX numeric overflow if (nBegin < 0 || nBegin > nEnd - || nEnd > m_rEngine.GetText(nNumber).Len()) + || nEnd > m_rEngine.GetText(nNumber).getLength()) throw css::lang::IndexOutOfBoundsException( "textwindowaccessibility.cxx:" " Document::changeParagraphSelection", @@ -1275,7 +1275,7 @@ Document::retrieveParagraphLineBoundary( ParagraphImpl const * pParagraph, { ::osl::MutexGuard aInternalGuard( GetMutex() ); ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() ); - if ( nIndex < 0 || nIndex > m_rEngine.GetText( nNumber ).Len() ) + if ( nIndex < 0 || nIndex > m_rEngine.GetText( nNumber ).getLength() ) throw css::lang::IndexOutOfBoundsException( "textwindowaccessibility.cxx:" " Document::retrieveParagraphLineBoundary", diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx index d2146d3301d1..f449670c3030 100644 --- a/include/vcl/texteng.hxx +++ b/include/vcl/texteng.hxx @@ -224,10 +224,10 @@ public: ~TextEngine(); void SetText( const OUString& rStr ); - String GetText( LineEnd aSeparator = LINEEND_LF ) const; - String GetText( const TextSelection& rSel, LineEnd aSeparator = LINEEND_LF ) const; - String GetTextLines( LineEnd aSeparator = LINEEND_LF ) const; - void ReplaceText(const TextSelection& rSel, const String& rText); + OUString GetText( LineEnd aSeparator = LINEEND_LF ) const; + OUString GetText( const TextSelection& rSel, LineEnd aSeparator = LINEEND_LF ) const; + OUString GetTextLines( LineEnd aSeparator = LINEEND_LF ) const; + void ReplaceText(const TextSelection& rSel, const OUString& rText); sal_uLong GetTextLen( LineEnd aSeparator = LINEEND_LF ) const; sal_uLong GetTextLen( const TextSelection& rSel, LineEnd aSeparator = LINEEND_LF ) const; @@ -238,12 +238,12 @@ public: sal_uInt16 GetDefTab() const; void SetLeftMargin( sal_uInt16 n ); - sal_uInt16 GetLeftMargin() const; + sal_uInt16 GetLeftMargin() const; void SetUpdateMode( sal_Bool bUpdate ); - sal_Bool GetUpdateMode() const { return mbUpdate; } + sal_Bool GetUpdateMode() const { return mbUpdate; } - sal_uInt16 GetViewCount() const; + sal_uInt16 GetViewCount() const; TextView* GetView( sal_uInt16 nView ) const; void InsertView( TextView* pTextView ); void RemoveView( TextView* pTextView ); @@ -251,25 +251,25 @@ public: void SetActiveView( TextView* pView ); void SetMaxTextLen( sal_uLong nLen ); - sal_uLong GetMaxTextLen() const { return mnMaxTextLen; } + sal_uLong GetMaxTextLen() const { return mnMaxTextLen; } void SetMaxTextWidth( sal_uLong nWidth ); - sal_uLong GetMaxTextWidth() const { return mnMaxTextWidth; } + sal_uLong GetMaxTextWidth() const { return mnMaxTextWidth; } - sal_uLong GetTextHeight() const; - sal_uLong CalcTextWidth(); - sal_uInt16 GetCharHeight() const { return mnCharHeight; } + sal_uLong GetTextHeight() const; + sal_uLong CalcTextWidth(); + sal_uInt16 GetCharHeight() const { return mnCharHeight; } - sal_uLong GetParagraphCount() const; - String GetText( sal_uLong nParagraph ) const; - sal_uInt16 GetTextLen( sal_uLong nParagraph ) const; - sal_uLong GetTextHeight( sal_uLong nParagraph ) const; + sal_uLong GetParagraphCount() const; + OUString GetText( sal_uLong nParagraph ) const; + sal_uInt16 GetTextLen( sal_uLong nParagraph ) const; + sal_uLong GetTextHeight( sal_uLong nParagraph ) const; - sal_uInt16 GetLineCount( sal_uLong nParagraph ) const; - sal_uInt16 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const; + sal_uInt16 GetLineCount( sal_uLong nParagraph ) const; + sal_uInt16 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const; void SetRightToLeft( sal_Bool bR2L ); - sal_Bool IsRightToLeft() const { return mbRightToLeft; } + sal_Bool IsRightToLeft() const { return mbRightToLeft; } sal_Bool HasUndoManager() const { return mpUndoManager ? sal_True : sal_False; } ::svl::IUndoManager& @@ -282,20 +282,20 @@ public: void ResetUndo(); void EnableUndo( sal_Bool bEnable ); - sal_Bool IsUndoEnabled() { return mbUndoEnabled; } + sal_Bool IsUndoEnabled() { return mbUndoEnabled; } void SetModified( sal_Bool bModified ) { mbModified = bModified; } - sal_Bool IsModified() const { return mbModified; } + sal_Bool IsModified() const { return mbModified; } - sal_Bool Read( SvStream& rInput, const TextSelection* pSel = NULL ); + sal_Bool Read( SvStream& rInput, const TextSelection* pSel = NULL ); - sal_Bool Write( SvStream& rOutput, const TextSelection* pSel = NULL, sal_Bool bHTML = sal_False ); + sal_Bool Write( SvStream& rOutput, const TextSelection* pSel = NULL, sal_Bool bHTML = sal_False ); TextPaM GetPaM( const Point& rDocPos, sal_Bool bSmart = sal_True ); Rectangle PaMtoEditCursor( const TextPaM& rPaM, sal_Bool bSpecial = sal_False ); - String GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord = 0 ); + OUString GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord = 0 ); - sal_Bool HasAttrib( sal_uInt16 nWhich ) const; + sal_Bool HasAttrib( sal_uInt16 nWhich ) const; const TextAttrib* FindAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const; const TextCharAttrib* FindCharAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const; @@ -313,8 +313,8 @@ public: ::com::sun::star::lang::Locale GetLocale(); ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > GetBreakIterator(); - static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent ); - static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent ); + static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent ); + static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent ); }; #endif // _TEXTENG_HXX diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index a060bc023922..600e069dc928 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -1450,7 +1450,7 @@ void AddressMultiLineEdit::SetText( const OUString& rStr ) if(m_pParentDialog->m_eType == SwCustomizeAddressBlockDialog::ADDRESSBLOCK_NEW || m_pParentDialog->m_eType == SwCustomizeAddressBlockDialog::ADDRESSBLOCK_EDIT) { - xub_StrLen nLastLen = pTextEngine->GetText(nParaCount - 1).Len(); + sal_Int32 nLastLen = pTextEngine->GetText(nParaCount - 1).getLength(); if(nLastLen) { TextPaM aPaM(nParaCount ? nParaCount - 1 : 0, nLastLen); diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 4974957f4b44..d0294e592704 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -251,19 +251,19 @@ static inline const sal_Unicode* static_getLineEndText( LineEnd aLineEnd ) return pRet; } -void TextEngine::ReplaceText(const TextSelection& rSel, const String& rText) +void TextEngine::ReplaceText(const TextSelection& rSel, const OUString& rText) { ImpInsertText( rSel, rText ); } -String TextEngine::GetText( LineEnd aSeparator ) const +OUString TextEngine::GetText( LineEnd aSeparator ) const { return mpDoc->GetText( static_getLineEndText( aSeparator ) ); } -String TextEngine::GetTextLines( LineEnd aSeparator ) const +OUString TextEngine::GetTextLines( LineEnd aSeparator ) const { - String aText; + OUString aText; sal_uLong nParas = mpTEParaPortions->Count(); const sal_Unicode* pSep = static_getLineEndText( aSeparator ); for ( sal_uLong nP = 0; nP < nParas; nP++ ) @@ -282,7 +282,7 @@ String TextEngine::GetTextLines( LineEnd aSeparator ) const return aText; } -String TextEngine::GetText( sal_uLong nPara ) const +OUString TextEngine::GetText( sal_uLong nPara ) const { return mpDoc->GetText( nPara ); } @@ -385,7 +385,7 @@ void TextEngine::ImpInitDoc() delete mpTEParaPortions; mpTEParaPortions = new TEParaPortions; - TextNode* pNode = new TextNode( String() ); + TextNode* pNode = new TextNode( OUString() ); mpDoc->GetNodes().Insert( pNode, 0 ); TEParaPortion* pIniPortion = new TEParaPortion( pNode ); @@ -397,9 +397,9 @@ void TextEngine::ImpInitDoc() ImpParagraphInserted( 0 ); } -String TextEngine::GetText( const TextSelection& rSel, LineEnd aSeparator ) const +OUString TextEngine::GetText( const TextSelection& rSel, LineEnd aSeparator ) const { - String aText; + OUString aText; if ( !rSel.HasRange() ) return aText; @@ -723,12 +723,12 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel, pOldTxt[nChgPos] == pNewTxt[nChgPos] ) ++nChgPos; - String aChgText( aNewText.copy( nChgPos ) ); + OUString aChgText( aNewText.copy( nChgPos ) ); // select text from first pos to be changed to current pos TextSelection aSel( TextPaM( aPaM.GetPara(), (sal_uInt16) nChgPos ), aPaM ); - if (aChgText.Len()) + if (!aChgText.isEmpty()) // ImpInsertText implicitly handles undo... return ImpInsertText( aSel, aChgText ); else @@ -1346,7 +1346,7 @@ void TextEngine::UndoActionStart( sal_uInt16 nId ) { if ( IsUndoEnabled() && !IsInUndo() ) { - String aComment; + OUString aComment; GetUndoManager().EnterListAction( aComment, OUString(), nId ); } } @@ -2476,9 +2476,9 @@ sal_Bool TextEngine::CreateLines( sal_uLong nPara ) return nOldLineCount != pTEParaPortion->GetLines().size(); } -String TextEngine::GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord ) +OUString TextEngine::GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord ) { - String aWord; + OUString aWord; if ( rCursorPos.GetPara() < mpDoc->GetNodes().Count() ) { TextSelection aSel( rCursorPos ); @@ -2569,19 +2569,19 @@ sal_Bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, sal_Bo if ( nPara == aSel.GetEnd().GetPara() ) nEndPos = aSel.GetEnd().GetIndex(); - String aText; + OUStringBuffer aText; if ( !bHTML ) { - aText = pNode->GetText().Copy( nStartPos, nEndPos-nStartPos ); + aText = OUString( pNode->GetText().Copy( nStartPos, nEndPos-nStartPos ) ); } else { - aText.AssignAscii( "

" ); + aText = "

"; if ( nStartPos == nEndPos ) { // Empty lines will be removed by Writer - aText.AppendAscii( "
" ); + aText.append( "
" ); } else { @@ -2593,28 +2593,28 @@ sal_Bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, sal_Bo nTmpEnd = pAttr ? pAttr->GetStart() : nEndPos; // Text before Attribute - aText += pNode->GetText().Copy( nTmpStart, nTmpEnd-nTmpStart ); + aText.append( OUString( pNode->GetText().Copy( nTmpStart, nTmpEnd-nTmpStart ) ) ); if ( pAttr ) { nTmpEnd = std::min( pAttr->GetEnd(), nEndPos ); // e.g. Morgenpost - aText.AppendAscii( "GetAttr() ).GetURL(); - aText.AppendAscii( "\">" ); + aText.append( "GetAttr() ).GetURL() ); + aText.append( "\">" ); nTmpStart = pAttr->GetStart(); - aText += pNode->GetText().Copy( nTmpStart, nTmpEnd-nTmpStart ); - aText.AppendAscii( "" ); + aText.append( pNode->GetText().Copy( nTmpStart, nTmpEnd-nTmpStart ) ); + aText.append( "" ); nTmpStart = pAttr->GetEnd(); } } while ( nTmpEnd < nEndPos ); } - aText.AppendAscii( "

" ); + aText.append( "

" ); } - rOutput.WriteLine(OUStringToOString(aText, + rOutput.WriteLine(OUStringToOString(aText.makeStringAndClear(), rOutput.GetStreamCharSet())); } @@ -2945,16 +2945,16 @@ void TextEngine::ImpInitWritingDirections( sal_uLong nPara ) if ( pParaPortion->GetNode()->GetText().Len() ) { const UBiDiLevel nBidiLevel = IsRightToLeft() ? 1 /*RTL*/ : 0 /*LTR*/; - String aText( pParaPortion->GetNode()->GetText() ); + OUString aText( pParaPortion->GetNode()->GetText() ); // // Bidi functions from icu 2.0 // UErrorCode nError = U_ZERO_ERROR; - UBiDi* pBidi = ubidi_openSized( aText.Len(), 0, &nError ); + UBiDi* pBidi = ubidi_openSized( aText.getLength(), 0, &nError ); nError = U_ZERO_ERROR; - ubidi_setPara( pBidi, reinterpret_cast(aText.GetBuffer()), aText.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW + ubidi_setPara( pBidi, reinterpret_cast(aText.getStr()), aText.getLength(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW nError = U_ZERO_ERROR; long nCount = ubidi_countRuns( pBidi, &nError ); diff --git a/vcl/source/edit/xtextedt.cxx b/vcl/source/edit/xtextedt.cxx index c47dd1607aad..97149a304ad2 100644 --- a/vcl/source/edit/xtextedt.cxx +++ b/vcl/source/edit/xtextedt.cxx @@ -43,7 +43,7 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const sal_uLong nParas = GetParagraphCount(); if ( ( nPara < nParas ) && ( nPos < GetTextLen( nPara ) ) ) { - sal_uInt16 nMatchChar = maGroupChars.Search( GetText( rCursor.GetPara() ).GetChar( nPos ) ); + sal_uInt16 nMatchChar = maGroupChars.Search( GetText( rCursor.GetPara() )[ nPos ] ); if ( nMatchChar != STRING_NOTFOUND ) { if ( ( nMatchChar % 2 ) == 0 ) -- cgit v1.2.3