From d169dd267998ec503a855f7f5232a725596b7d30 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 10 Sep 2013 11:33:00 +0200 Subject: convert editeng/source/editeng/*.cxx from String to OUString Change-Id: I4063b427f050de0a179e6436fb647614bacd704c --- editeng/source/editeng/editdbg.cxx | 2 +- editeng/source/editeng/editdoc.cxx | 10 ++-- editeng/source/editeng/editeng.cxx | 14 ++--- editeng/source/editeng/editobj.cxx | 2 +- editeng/source/editeng/editview.cxx | 40 ++++++------- editeng/source/editeng/edtspell.cxx | 8 +-- editeng/source/editeng/eehtml.cxx | 27 +++++---- editeng/source/editeng/eertfpar.cxx | 26 ++++----- editeng/source/editeng/impedit.cxx | 10 ++-- editeng/source/editeng/impedit2.cxx | 110 ++++++++++++++++++------------------ editeng/source/editeng/impedit4.cxx | 56 +++++++++--------- editeng/source/editeng/textconv.cxx | 10 ++-- 12 files changed, 156 insertions(+), 159 deletions(-) (limited to 'editeng') diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 4006918917f7..d2506990dadf 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -474,7 +474,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, sal_Bool bInfoBox ) } fclose( fp ); if ( bInfoBox ) - InfoBox(0, String( RTL_CONSTASCII_USTRINGPARAM( "D:\\DEBUG.LOG !" ) ) ).Execute(); + InfoBox(0, OUString( "D:\\DEBUG.LOG !" ) ).Execute(); } #if OSL_DEBUG_LEVEL > 2 diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 0a5e5a59c7b6..19f01867acf0 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2113,12 +2113,12 @@ OUString EditDoc::GetText( LineEnd eEnd ) const sal_Int32 nLastNode = nNodes-1; for ( sal_Int32 nNode = 0; nNode < nNodes; nNode++ ) { - String aTmp( GetParaAsString( GetObject(nNode) ) ); - memcpy( pCur, aTmp.GetBuffer(), aTmp.Len()*sizeof(sal_Unicode) ); - pCur += aTmp.Len(); + OUString aTmp( GetParaAsString( GetObject(nNode) ) ); + memcpy( pCur, aTmp.getStr(), aTmp.getLength() * sizeof(sal_Unicode) ); + pCur += aTmp.getLength(); if ( nSepSize && ( nNode != nLastNode ) ) { - memcpy( pCur, aSep.getStr(), nSepSize*sizeof(sal_Unicode ) ); + memcpy( pCur, aSep.getStr(), nSepSize * sizeof(sal_Unicode ) ); pCur += nSepSize; } } @@ -3042,7 +3042,7 @@ SvxColorItem* SvxColorList::GetObject( size_t nIndex ) } EditEngineItemPool::EditEngineItemPool( sal_Bool bPersistenRefCounts ) - : SfxItemPool( String( "EditEngineItemPool", RTL_TEXTENCODING_ASCII_US ), EE_ITEMS_START, EE_ITEMS_END, + : SfxItemPool( OUString( "EditEngineItemPool" ), EE_ITEMS_START, EE_ITEMS_END, aItemInfos, 0, bPersistenRefCounts ) { SetVersionMap( 1, 3999, 4015, aV1Map ); diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index d45347c3054b..8e8e15f91574 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1307,7 +1307,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie EditPaM aStart( pImpEditEngine->WordLeft( aCurSel.Max() ) ); aCurSel = pImpEditEngine->InsertText( EditSelection( aStart, aCurSel.Max() ), aAutoText ); - pImpEditEngine->SetAutoCompleteText( String(), sal_True ); + pImpEditEngine->SetAutoCompleteText( OUString(), sal_True ); } } pImpEditEngine->UndoActionEnd( EDITUNDO_INSERT ); @@ -1362,10 +1362,10 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie ( pImpEditEngine->aWordDelimiters.indexOf( aCurSel.Max().GetNode()->GetChar( nIndex ) ) != -1 ) ) { EditPaM aStart( pImpEditEngine->WordLeft( aCurSel.Max() ) ); - String aWord = pImpEditEngine->GetSelected( EditSelection( aStart, aCurSel.Max() ) ); - if ( aWord.Len() >= 3 ) + OUString aWord = pImpEditEngine->GetSelected( EditSelection( aStart, aCurSel.Max() ) ); + if ( aWord.getLength() >= 3 ) { - String aComplete; + OUString aComplete; LanguageType eLang = pImpEditEngine->GetLanguage( EditPaM( aStart.GetNode(), aStart.GetIndex()+1)); LanguageTag aLanguageTag( eLang); @@ -1394,7 +1394,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie } } - if ( !aComplete.Len() ) + if ( aComplete.isEmpty() ) { xItem = pImpEditEngine->xLocaleDataWrapper->getDefaultCalendarMonths(); sal_Int32 nMonthCount = xItem.getLength(); @@ -1410,7 +1410,7 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie } } - if( aComplete.Len() && ( ( aWord.Len() + 1 ) < aComplete.Len() ) ) + if( !aComplete.isEmpty() && ( ( aWord.getLength() + 1 ) < aComplete.getLength() ) ) { pImpEditEngine->SetAutoCompleteText( aComplete, sal_False ); Point aPos = pImpEditEngine->PaMtoEditCursor( aCurSel.Max() ).TopLeft(); @@ -2482,7 +2482,7 @@ void EditEngine::RemoveFields( sal_Bool bKeepFieldText, TypeId aType ) { DBG_ASSERT( dynamic_cast(rAttr.GetItem()), "no field item..." ); EditSelection aSel( EditPaM(pNode, rAttr.GetStart()), EditPaM(pNode, rAttr.GetEnd()) ); - String aFieldText = static_cast(rAttr).GetFieldValue(); + OUString aFieldText = static_cast(rAttr).GetFieldValue(); pImpEditEngine->ImpInsertText( aSel, aFieldText ); } } diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 5099309e750c..8e35a576f0e0 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -1106,7 +1106,7 @@ void EditTextObjectImpl::StoreData( SvStream& rOStream ) const || ( bSymbolPara && ( rFontItem.GetCharSet() != RTL_TEXTENCODING_SYMBOL ) ) ) { // Not correctly converted - String aPart( rC.GetText(), rAttr.GetStart(), rAttr.GetEnd() - rAttr.GetStart() ); + OUString aPart = rC.GetText().copy( rAttr.GetStart(), rAttr.GetEnd() - rAttr.GetStart() ); OString aNew(OUStringToOString(aPart, rFontItem.GetCharSet())); aBuffer.remove(rAttr.GetStart(), rAttr.GetEnd() - rAttr.GetStart()); aBuffer.insert(rAttr.GetStart(), aNew); diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 3819cda2334d..8f331c80d209 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -873,7 +873,7 @@ static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) // aTmp = lcl_Win_GetShortPathName( aTmp ); #endif Graphic aGraphic; - const String aFilterName( IMP_PNG ); + const OUString aFilterName( IMP_PNG ); if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) ) { aRes = Image( aGraphic.GetBitmapEx() ); @@ -903,7 +903,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) aPaM2.GetIndex()++; // Are there any replace suggestions? - String aSelected( GetSelected() ); + OUString aSelected( GetSelected() ); // // restrict the maximal number of suggestions displayed // in the context menu. @@ -931,7 +931,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) LanguageType nGuessLangPara = LANGUAGE_NONE; if (xSpellAlt.is() && xLangGuesser.is()) { - String aParaText; + OUString aParaText; ContentNode *pNode = aPaM.GetNode(); if (pNode) { @@ -954,12 +954,12 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) nGuessLangPara = nGuessLangWord; aPopupMenu.InsertSeparator(); - String aTmpWord( SvtLanguageTable::GetLanguageString( nGuessLangWord ) ); - String aTmpPara( SvtLanguageTable::GetLanguageString( nGuessLangPara ) ); - String aWordStr( EE_RESSTR( RID_STR_WORD ) ); - aWordStr.SearchAndReplace( String( "%x" ), aTmpWord ); - String aParaStr( EE_RESSTR( RID_STR_PARAGRAPH ) ); - aParaStr.SearchAndReplace( String( "%x" ), aTmpPara ); + OUString aTmpWord( SvtLanguageTable::GetLanguageString( nGuessLangWord ) ); + OUString aTmpPara( SvtLanguageTable::GetLanguageString( nGuessLangPara ) ); + OUString aWordStr( EE_RESSTR( RID_STR_WORD ) ); + aWordStr = aWordStr.replaceFirst( "%x", aTmpWord ); + OUString aParaStr( EE_RESSTR( RID_STR_PARAGRAPH ) ); + aParaStr = aParaStr.replaceFirst( "%x", aTmpPara ); aPopupMenu.InsertItem( MN_WORDLANGUAGE, aWordStr ); aPopupMenu.SetHelpId( MN_WORDLANGUAGE, HID_EDITENG_SPELLER_WORDLANGUAGE ); aPopupMenu.InsertItem( MN_PARALANGUAGE, aParaStr ); @@ -983,7 +983,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) { for ( sal_uInt16 nW = 0; nW < nWords; nW++ ) { - String aAlternate( pAlt[nW] ); + OUString aAlternate( pAlt[nW] ); aPopupMenu.InsertItem( MN_ALTSTART+nW, aAlternate, 0, OString(), nW ); pAutoMenu->InsertItem( MN_AUTOSTART+nW, aAlternate, 0, OString(), nW ); } @@ -1058,7 +1058,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) sal_uInt16 nId = aPopupMenu.Execute( pImpEditView->GetWindow(), aTempRect, POPUPMENU_NOMOUSEUPCLOSE ); if ( nId == MN_IGNORE ) { - String aWord = pImpEditView->SpellIgnoreOrAddWord( sal_False ); + OUString aWord = pImpEditView->SpellIgnoreOrAddWord( sal_False ); if ( pCallBack ) { SpellCallbackInfo aInf( SPELLCMD_IGNOREWORD, aWord ); @@ -1109,13 +1109,13 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) } else { - SpellCallbackInfo aInf( SPELLCMD_STARTSPELLDLG, String() ); + SpellCallbackInfo aInf( SPELLCMD_STARTSPELLDLG, OUString() ); pCallBack->Call( &aInf ); } } else if ( nId >= MN_DICTSTART || nId == MN_INSERT_SINGLE ) { - String aDicName; + OUString aDicName; if (nId >= MN_DICTSTART) aDicName = pInsertMenu->GetItemText(nId); else @@ -1126,7 +1126,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) xDic = xDicList->getDictionaryByName( aDicName ); if (xDic.is()) - xDic->add( aSelected, sal_False, String() ); + xDic->add( aSelected, sal_False, OUString() ); // save modified user-dictionary if it is persistent Reference< frame::XStorable > xSavDic( xDic, UNO_QUERY ); if (xSavDic.is()) @@ -1145,7 +1145,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) else if ( nId >= MN_AUTOSTART ) { DBG_ASSERT(nId - MN_AUTOSTART < aAlt.getLength(), "index out of range"); - String aWord = pAlt[nId - MN_AUTOSTART]; + OUString aWord = pAlt[nId - MN_AUTOSTART]; SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); if ( pAutoCorrect ) pAutoCorrect->PutText( aSelected, aWord, PIMPEE->GetLanguage( aPaM2 ) ); @@ -1154,7 +1154,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) else if ( nId >= MN_ALTSTART ) // Replace { DBG_ASSERT(nId - MN_ALTSTART < aAlt.getLength(), "index out of range"); - String aWord = pAlt[nId - MN_ALTSTART]; + OUString aWord = pAlt[nId - MN_ALTSTART]; InsertText( aWord ); } else @@ -1448,13 +1448,13 @@ Selection EditView::GetSurroundingTextSelection() const { EditSelection aSel( pImpEditView->GetEditSelection() ); aSel.Adjust( PIMPE->GetEditDoc() ); - String aStr = PIMPE->GetSelected(aSel); + OUString aStr = PIMPE->GetSelected(aSel); // Stop reconversion if the selected text includes a line break. - if ( aStr.Search( 0x0A ) == STRING_NOTFOUND ) - return Selection( 0, aSelection.nEndPos - aSelection.nStartPos ); + if ( aStr.indexOf( 0x0A ) == -1 ) + return Selection( 0, aSelection.nEndPos - aSelection.nStartPos ); else - return Selection( 0, 0 ); + return Selection( 0, 0 ); } else { diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index dc429803984d..4ac315753fab 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -166,7 +166,7 @@ void EditSpellWrapper::ChangeWord( const OUString& rNewWord, // If there is a dot Punkt after the word, this dot will be stripped away. // If '"' => PreStripped. - String aNewWord( rNewWord ); + OUString aNewWord( rNewWord ); pEditView->InsertText( aNewWord ); CheckSpellTo(); } @@ -677,7 +677,7 @@ sal_Bool EdtAutoCorrDoc::SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, { // Turn the Text into a command field ... EditSelection aSel( EditPaM( pCurNode, nStt ), EditPaM( pCurNode, nEnd ) ); - String aText = mpEditEngine->GetSelected(aSel); + OUString aText = mpEditEngine->GetSelected(aSel); aSel = mpEditEngine->DeleteSelection(aSel); SAL_WARN_IF(nCursor < nEnd, "editeng", "Cursor in the heart of the action?!"); @@ -735,10 +735,10 @@ sal_Bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_uInt16& rSttPos, // shortcut in Auto bAllowUndoAction = false; // Not anymore ... - String aShort( pCurNode->Copy( rSttPos, nEndPos - rSttPos ) ); + OUString aShort( pCurNode->Copy( rSttPos, nEndPos - rSttPos ) ); bool bRet = false; - if( !aShort.Len() ) + if( aShort.isEmpty() ) return bRet; LanguageType eLang = mpEditEngine->GetLanguage( EditPaM( pCurNode, rSttPos+1 ) ); diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index 6b6f35d0cf9a..7106ee45c858 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -169,7 +169,7 @@ void EditHTMLParser::NextToken( int nToken ) { if ( bInPara ) { - ImpInsertText( String( RTL_CONSTASCII_USTRINGPARAM( " " ) ) ); + ImpInsertText( OUString( " " ) ); } } break; @@ -189,10 +189,10 @@ void EditHTMLParser::NextToken( int nToken ) if ( !bInPara ) StartPara( false ); - String aText = aToken; - if ( aText.Len() && ( aText.GetChar( 0 ) == ' ' ) + OUString aText = aToken; + if ( !aText.isEmpty() && ( aText[ 0 ] == ' ' ) && ThrowAwayBlank() && !IsReadPRE() ) - aText.Erase( 0, 1 ); + aText = aText.copy( 1 ); if ( pCurAnchor ) { @@ -203,12 +203,11 @@ void EditHTMLParser::NextToken( int nToken ) // Only written until HTML with 319? if ( IsReadPRE() ) { - sal_uInt16 nTabPos = aText.Search( '\t', 0 ); - while ( nTabPos != STRING_NOTFOUND ) + sal_Int32 nTabPos = aText.indexOf( '\t'); + while ( nTabPos != -1 ) { - aText.Erase( nTabPos, 1 ); - aText.Insert( String( RTL_CONSTASCII_USTRINGPARAM( " " ) ), nTabPos ); - nTabPos = aText.Search( '\t', nTabPos+8 ); + aText = aText.replaceAt( nTabPos, 1, " " ); + nTabPos = aText.indexOf( '\t', nTabPos+8 ); } } ImpInsertText( aText ); @@ -669,7 +668,7 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel ) void EditHTMLParser::ImpInsertText( const OUString& rText ) { - String aText( rText ); + OUString aText( rText ); if (mpEditEngine->IsImportHandlerSet()) { ImportInfo aImportInfo(HTMLIMP_INSERTTEXT, this, mpEditEngine->CreateESelection(aCurSel)); @@ -769,7 +768,7 @@ void EditHTMLParser::AnchorStart() if ( !pCurAnchor ) { const HTMLOptions& aOptions = GetOptions(); - String aRef; + OUString aRef; for ( size_t i = 0, n = aOptions.size(); i < n; ++i ) { @@ -782,10 +781,10 @@ void EditHTMLParser::AnchorStart() } } - if ( aRef.Len() ) + if ( !aRef.isEmpty() ) { - String aURL = aRef; - if ( aURL.Len() && ( aURL.GetChar( 0 ) != '#' ) ) + OUString aURL = aRef; + if ( !aURL.isEmpty() && ( aURL[ 0 ] != '#' ) ) { INetURLObject aTargetURL; INetURLObject aRootURL( aBaseURL ); diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index e5989b9818f1..9e2e26503b0b 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -235,7 +235,7 @@ void EditRTFParser::UnknownAttrToken( int nToken, SfxItemSet* ) void EditRTFParser::InsertText() { - String aText( aToken ); + OUString aText( aToken ); if (mpEditEngine->IsImportHandlerSet()) { ImportInfo aImportInfo(RTFIMP_INSERTTEXT, this, mpEditEngine->CreateESelection(aCurSel)); @@ -439,8 +439,8 @@ SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle ) if ( pStyle ) return pStyle; - String aName( pRTFStyle->sName ); - String aParent; + OUString aName( pRTFStyle->sName ); + OUString aParent; if ( pRTFStyle->nBasedOn ) { SvxRTFStyleTbl::iterator it = GetStyleTbl().find( pRTFStyle->nBasedOn ); @@ -458,7 +458,7 @@ SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle ) ConvertAndPutItems( pStyle->GetItemSet(), pRTFStyle->aAttrSet ); // 2) As long as Parent is not in the pool, also create this ... - if ( aParent.Len() && ( aParent != aName ) ) + if ( !aParent.isEmpty() && ( aParent != aName ) ) { SfxStyleSheet* pS = (SfxStyleSheet*)mpEditEngine->GetStyleSheetPool()->Find( aParent, SFX_STYLE_FAMILY_ALL ); if ( !pS ) @@ -502,8 +502,8 @@ void EditRTFParser::ReadField() int _nOpenBrakets = 1; // the first was already detected earlier sal_Bool bFldInst = sal_False; sal_Bool bFldRslt = sal_False; - String aFldInst; - String aFldRslt; + OUString aFldInst; + OUString aFldRslt; while( _nOpenBrakets && IsParserWorking() ) { @@ -542,17 +542,17 @@ void EditRTFParser::ReadField() break; } } - if ( aFldInst.Len() ) + if ( !aFldInst.isEmpty() ) { - String aHyperLinkMarker( RTL_CONSTASCII_USTRINGPARAM( "HYPERLINK " ) ); - if ( aFldInst.CompareIgnoreCaseToAscii( aHyperLinkMarker, aHyperLinkMarker.Len() ) == COMPARE_EQUAL ) + OUString aHyperLinkMarker( "HYPERLINK " ); + if ( aFldInst.startsWithIgnoreAsciiCase( aHyperLinkMarker ) ) { - aFldInst.Erase( 0, aHyperLinkMarker.Len() ); + aFldInst = aFldInst.copy( aHyperLinkMarker.getLength() ); aFldInst = comphelper::string::strip(aFldInst, ' '); - aFldInst.Erase( 0, 1 ); // " - aFldInst.Erase( aFldInst.Len()-1, 1 ); // " + // strip start and end quotes + aFldInst = aFldInst.copy( 1, aFldInst.getLength()-2 ); - if ( !aFldRslt.Len() ) + if ( aFldRslt.isEmpty() ) aFldRslt = aFldInst; SvxFieldItem aField( SvxURLField( aFldInst, aFldRslt, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD ); diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 6b610a452e27..0b33f13e5e71 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1128,7 +1128,7 @@ OUString ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd ) { Reference< XDictionary > xDic( SvxGetIgnoreAllList(), UNO_QUERY ); if (xDic.is()) - xDic->add( aWord, sal_False, String() ); + xDic->add( aWord, sal_False, OUString() ); } EditDoc& rDoc = pEditEngine->GetEditDoc(); sal_Int32 nNodes = rDoc.Count(); @@ -1304,8 +1304,8 @@ void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::dat uno::Any aData = xDataObj->getTransferData( aFlavor ); OUString aTmpText; aData >>= aTmpText; - String aText(convertLineEnd(aTmpText, LINEEND_LF)); - aText.SearchAndReplaceAll( LINE_SEP, ' ' ); + OUString aText(convertLineEnd(aTmpText, LINEEND_LF)); + aText = aText.replaceAll( OUString(LINE_SEP), " " ); aSel = pEditEngine->InsertText(aSel, aText); } catch( ... ) @@ -1317,7 +1317,7 @@ void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::dat else { aSel = pEditEngine->InsertText( - xDataObj, String(), aSel.Min(), + xDataObj, OUString(), aSel.Min(), bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial()); } @@ -1728,7 +1728,7 @@ void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDro pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos); EditSelection aNewSel = pEditEngine->InsertText( - xDataObj, String(), aPaM, pEditEngine->GetInternalEditStatus().AllowPasteSpecial()); + xDataObj, OUString(), aPaM, pEditEngine->GetInternalEditStatus().AllowPasteSpecial()); aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() ); pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 46c3b6146f53..d3482191d0d4 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -271,7 +271,7 @@ OUString ImpEditEngine::GetSelected( const EditSelection& rSel, const LineEnd eE if ( !rSel.HasRange() ) return aText; - String aSep = EditDoc::GetSepStr( eEnd ); + OUString aSep = EditDoc::GetSepStr( eEnd ); EditSelection aSel( rSel ); aSel.Adjust( aEditDoc ); @@ -309,7 +309,7 @@ sal_Bool ImpEditEngine::MouseButtonDown( const MouseEvent& rMEvt, EditView* pVie SetActiveView( pView ); if (!GetAutoCompleteText().isEmpty()) - SetAutoCompleteText( String(), sal_True ); + SetAutoCompleteText( OUString(), sal_True ); GetSelEngine().SelMouseButtonDown( rMEvt ); // Special treatment @@ -353,10 +353,10 @@ void ImpEditEngine::Command( const CommandEvent& rCEvt, EditView* pView ) pView->DeleteSelected(); delete mpIMEInfos; EditPaM aPaM = pView->GetImpEditView()->GetEditSelection().Max(); - String aOldTextAfterStartPos = aPaM.GetNode()->Copy( aPaM.GetIndex() ); - sal_uInt16 nMax = aOldTextAfterStartPos.Search( CH_FEATURE ); - if ( nMax != STRING_NOTFOUND ) // don't overwrite features! - aOldTextAfterStartPos.Erase( nMax ); + OUString aOldTextAfterStartPos = aPaM.GetNode()->Copy( aPaM.GetIndex() ); + sal_Int32 nMax = aOldTextAfterStartPos.indexOf( CH_FEATURE ); + if ( nMax != -1 ) // don't overwrite features! + aOldTextAfterStartPos = aOldTextAfterStartPos.copy( 0, nMax ); mpIMEInfos = new ImplIMEInfos( aPaM, aOldTextAfterStartPos ); mpIMEInfos->bWasCursorOverwrite = !pView->IsInsertMode(); UndoActionStart( EDITUNDO_INSERT ); @@ -929,17 +929,17 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM& if ( !bEmptyLine ) { - String aLine(aPaM.GetNode()->GetString(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart()); + OUString aLine = aPaM.GetNode()->GetString().copy(pLine->GetStart(), pLine->GetEnd() - pLine->GetStart()); - const sal_Unicode* pLineString = aLine.GetBuffer(); + const sal_Unicode* pLineString = aLine.getStr(); UErrorCode nError = U_ZERO_ERROR; - UBiDi* pBidi = ubidi_openSized( aLine.Len(), 0, &nError ); + UBiDi* pBidi = ubidi_openSized( aLine.getLength(), 0, &nError ); const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/; - ubidi_setPara( pBidi, reinterpret_cast(pLineString), aLine.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW + ubidi_setPara( pBidi, reinterpret_cast(pLineString), aLine.getLength(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW - sal_uInt16 nVisPos = bStart ? 0 : aLine.Len()-1; + sal_uInt16 nVisPos = bStart ? 0 : aLine.getLength()-1; sal_uInt16 nLogPos = (sal_uInt16)ubidi_getLogicalIndex( pBidi, nVisPos, &nError ); ubidi_close( pBidi ); @@ -1048,20 +1048,20 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM sal_Bool bGotoStartOfNextLine = sal_False; sal_Bool bGotoEndOfPrevLine = sal_False; - String aLine(aPaM.GetNode()->GetString(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart()); + OUString aLine = aPaM.GetNode()->GetString().copy(pLine->GetStart(), pLine->GetEnd() - pLine->GetStart()); sal_uInt16 nPosInLine = aPaM.GetIndex() - pLine->GetStart(); - const sal_Unicode* pLineString = aLine.GetBuffer(); + const sal_Unicode* pLineString = aLine.getStr(); UErrorCode nError = U_ZERO_ERROR; - UBiDi* pBidi = ubidi_openSized( aLine.Len(), 0, &nError ); + UBiDi* pBidi = ubidi_openSized( aLine.getLength(), 0, &nError ); const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/; - ubidi_setPara( pBidi, reinterpret_cast(pLineString), aLine.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW + ubidi_setPara( pBidi, reinterpret_cast(pLineString), aLine.getLength(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW if ( !pEditView->IsInsertMode() ) { - sal_Bool bEndOfLine = nPosInLine == aLine.Len(); + sal_Bool bEndOfLine = nPosInLine == aLine.getLength(); sal_uInt16 nVisPos = (sal_uInt16)ubidi_getVisualIndex( pBidi, !bEndOfLine ? nPosInLine : nPosInLine-1, &nError ); if ( bVisualToLeft ) { @@ -1071,7 +1071,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM } else { - bGotoStartOfNextLine = nVisPos == (aLine.Len() - 1); + bGotoStartOfNextLine = nVisPos == (aLine.getLength() - 1); if ( !bEndOfLine ) nVisPos++; } @@ -1109,7 +1109,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM } bGotoEndOfPrevLine = nVisPos < 0; - bGotoStartOfNextLine = nVisPos >= aLine.Len(); + bGotoStartOfNextLine = nVisPos >= aLine.getLength(); if ( !bGotoEndOfPrevLine && !bGotoStartOfNextLine ) { @@ -1553,8 +1553,8 @@ EditSelection ImpEditEngine::SelectSentence( const EditSelection& rCurSel ) const EditPaM& rPaM = rCurSel.Min(); const ContentNode* pNode = rPaM.GetNode(); // #i50710# line breaks are marked with 0x01 - the break iterator prefers 0x0a for that - String sParagraph = pNode->GetString(); - sParagraph.SearchAndReplaceAll(0x01,0x0a); + OUString sParagraph = pNode->GetString(); + sParagraph = sParagraph.replaceAll(OUString(0x01), OUString(0x0a)); //return Null if search starts at the beginning of the string sal_Int32 nStart = rPaM.GetIndex() ? _xBI->beginOfSentence( sParagraph, rPaM.GetIndex(), GetLocale( rPaM ) ) : 0; @@ -1590,11 +1590,11 @@ sal_Bool ImpEditEngine::IsInputSequenceCheckingRequired( sal_Unicode nChar, cons return bIsSequenceChecking; } -static bool lcl_HasStrongLTR ( const String& rTxt, xub_StrLen nStart, xub_StrLen nEnd ) +static bool lcl_HasStrongLTR ( const OUString& rTxt, xub_StrLen nStart, xub_StrLen nEnd ) { for ( xub_StrLen nCharIdx = nStart; nCharIdx < nEnd; ++nCharIdx ) { - const UCharDirection nCharDir = u_charDirection ( rTxt.GetChar ( nCharIdx )); + const UCharDirection nCharDir = u_charDirection ( rTxt[ nCharIdx ]); if ( nCharDir == U_LEFT_TO_RIGHT || nCharDir == U_LEFT_TO_RIGHT_EMBEDDING || nCharDir == U_LEFT_TO_RIGHT_OVERRIDE ) @@ -1616,7 +1616,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) { uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() ); - String aText = pNode->GetString(); + OUString aText = pNode->GetString(); // To handle fields put the character from the field in the string, // because endOfScript( ... ) will skip the CH_FEATURE, because this is WEAK @@ -1626,7 +1626,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) OUString aFldText = static_cast(pField)->GetFieldValue(); if ( !aFldText.isEmpty() ) { - aText.SetChar( pField->GetStart(), aFldText.getStr()[0] ); + aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(0,1) ); short nFldScriptType = _xBI->getScriptType( aFldText, 0 ); for ( sal_uInt16 nCharInField = 1; nCharInField < aFldText.getLength(); nCharInField++ ) @@ -1637,14 +1637,14 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) if ( nFldScriptType == i18n::ScriptType::WEAK ) { nFldScriptType = nTmpType; - aText.SetChar( pField->GetStart(), aFldText.getStr()[nCharInField] ); + aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(nCharInField,1) ); } // ... but if the first one is LATIN, and there are CJK or CTL chars too, // we prefer that ScripType because we need an other font. if ( ( nTmpType == i18n::ScriptType::ASIAN ) || ( nTmpType == i18n::ScriptType::COMPLEX ) ) { - aText.SetChar( pField->GetStart(), aFldText.getStr()[nCharInField] ); + aText = aText.replaceAt( pField->GetStart(), 1, aFldText.copy(nCharInField,1) ); break; } } @@ -1894,16 +1894,16 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara ) if ( ( bCTL || ( nBidiLevel == 1 /*RTL*/ ) ) && pParaPortion->GetNode()->Len() ) { - String aText = pParaPortion->GetNode()->GetString(); + OUString aText = pParaPortion->GetNode()->GetString(); // // 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; size_t nCount = ubidi_countRuns( pBidi, &nError ); @@ -2539,7 +2539,7 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, sal_Unicode c, sal_uInt16 nIndex = aSel.Max().GetIndex(); EdtAutoCorrDoc aAuto(pEditEngine, pNode, nIndex, c); // FIXME: this _must_ be called with reference to the actual node text! - String const& rNodeString(pNode->GetString()); + OUString const& rNodeString(pNode->GetString()); pAutoCorrect->DoAutoCorrect( aAuto, rNodeString, nIndex, c, !bOverwrite, pFrameWin ); aSel.Max().SetIndex( aAuto.GetCursor() ); @@ -2613,12 +2613,12 @@ EditPaM ImpEditEngine::InsertText( const EditSelection& 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 EditSelection aSel( EditPaM( aPaM.GetNode(), (sal_uInt16) nChgPos ), aPaM ); - if (aChgText.Len()) + if (!aChgText.isEmpty()) return InsertText( aSel, aChgText ); // implicitly handles undo else return aPaM; @@ -2676,7 +2676,7 @@ EditPaM ImpEditEngine::ImpInsertText(const EditSelection& aCurSel, const OUStrin if ( GetStatus().DoOnlineSpelling() ) aCurWord = SelectWord( aCurPaM, i18n::WordType::DICTIONARY_WORD ); - XubString aText(convertLineEnd(rStr, LINEEND_LF)); + OUString aText(convertLineEnd(rStr, LINEEND_LF)); SfxVoidItem aTabItem( EE_FEATURE_TAB ); // Converts to linesep = \n @@ -2685,43 +2685,41 @@ EditPaM ImpEditEngine::ImpInsertText(const EditSelection& aCurSel, const OUStrin // fdo#39869 The loop run variable must be capable to hold STRLEN_MAX+1, // that with STRING32 would be SAL_MAX_INT32+1 but with 16-bit is 0xFFFF+1 - sal_uInt32 nStart = 0; - while ( nStart < aText.Len() ) + sal_Int32 nStart = 0; + while ( nStart < aText.getLength() ) { - sal_uInt32 nEnd = aText.Search( LINE_SEP, static_cast(nStart) ); - if ( nEnd == STRING_NOTFOUND ) - nEnd = aText.Len(); // not dereference! + sal_Int32 nEnd = aText.indexOf( LINE_SEP, nStart ); + if ( nEnd == -1 ) + nEnd = aText.getLength(); // not dereference! // Start == End => empty line if ( nEnd > nStart ) { - XubString aLine( aText, nStart, static_cast(nEnd-nStart) ); - xub_StrLen nChars = aPaM.GetNode()->Len() + aLine.Len(); + OUString aLine = aText.copy( nStart, nEnd-nStart ); + xub_StrLen nChars = aPaM.GetNode()->Len() + aLine.getLength(); if ( nChars > MAXCHARSINPARA ) { xub_StrLen nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len(); - nEnd -= ( aLine.Len() - nMaxNewChars ); // Then the characters end up in the next paragraph. - aLine.Erase( nMaxNewChars ); // Delete the Rest... + nEnd -= ( aLine.getLength() - nMaxNewChars ); // Then the characters end up in the next paragraph. + aLine = aLine.copy( 0, nMaxNewChars ); // Delete the Rest... } if ( IsUndoEnabled() && !IsInUndo() ) InsertUndo(new EditUndoInsertChars(pEditEngine, CreateEPaM(aPaM), aLine)); // Tabs ? - if ( aLine.Search( '\t' ) == STRING_NOTFOUND ) + if ( aLine.indexOf( '\t' ) == -1 ) aPaM = aEditDoc.InsertText( aPaM, aLine ); else { - sal_uInt32 nStart2 = 0; - while ( nStart2 < aLine.Len() ) + sal_Int32 nStart2 = 0; + while ( nStart2 < aLine.getLength() ) { - sal_uInt32 nEnd2 = aLine.Search( '\t', static_cast(nStart2) ); - if ( nEnd2 == STRING_NOTFOUND ) - nEnd2 = aLine.Len(); // not dereference! + sal_Int32 nEnd2 = aLine.indexOf( "\t", nStart2 ); + if ( nEnd2 == -1 ) + nEnd2 = aLine.getLength(); // not dereference! if ( nEnd2 > nStart2 ) - aPaM = aEditDoc.InsertText( aPaM, XubString( aLine, - static_cast(nStart2), - static_cast(nEnd2-nStart2) ) ); - if ( nEnd2 < aLine.Len() ) + aPaM = aEditDoc.InsertText( aPaM, aLine.copy( nStart2, nEnd2-nStart2 ) ); + if ( nEnd2 < aLine.getLength() ) { aPaM = aEditDoc.InsertFeature( aPaM, aTabItem ); } @@ -2738,12 +2736,12 @@ EditPaM ImpEditEngine::ImpInsertText(const EditSelection& aCurSel, const OUStrin if (pWrongs && !pWrongs->empty()) pWrongs->ClearWrongs( aCurWord.Min().GetIndex(), aPaM.GetIndex(), aPaM.GetNode() ); // ... and mark both words as 'to be checked again' - pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.Len() ); + pPortion->MarkInvalid( aCurWord.Min().GetIndex(), aLine.getLength() ); } else - pPortion->MarkInvalid( aCurPaM.GetIndex(), aLine.Len() ); + pPortion->MarkInvalid( aCurPaM.GetIndex(), aLine.getLength() ); } - if ( nEnd < aText.Len() ) + if ( nEnd < aText.getLength() ) aPaM = ImpInsertParaBreak( aPaM ); nStart = nEnd+1; @@ -3477,7 +3475,7 @@ uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable( if ( pFld && pFld->ISA( SvxURLField ) ) { // Office-Bookmark - String aURL( ((const SvxURLField*)pFld)->GetURL() ); + OUString aURL( ((const SvxURLField*)pFld)->GetURL() ); pDataObj->GetURL() = aURL; } } diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 42340d8dd1d1..4d4b41d9ee03 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -153,7 +153,7 @@ EditPaM ImpEditEngine::ReadXML( SvStream& rInput, EditSelection aSel ) EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel ) { #if (OSL_DEBUG_LEVEL > 2) && !defined( UNX ) - SvFileStream aRTFOut( String( RTL_CONSTASCII_USTRINGPARAM ( "d:\\rtf_in.rtf" ) ), STREAM_WRITE ); + SvFileStream aRTFOut( OUString( "d:\\rtf_in.rtf" ), STREAM_WRITE ); aRTFOut << rInput; aRTFOut.Close(); rInput.Seek( 0 ); @@ -690,7 +690,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) #if (OSL_DEBUG_LEVEL > 2) && !defined( UNX ) { - SvFileStream aStream( String( RTL_CONSTASCII_USTRINGPARAM ( "d:\\rtf_out.rtf" ) ), STREAM_WRITE|STREAM_TRUNC ); + SvFileStream aStream( OUString( "d:\\rtf_out.rtf" ), STREAM_WRITE|STREAM_TRUNC ); sal_uLong nP = rOutput.Tell(); rOutput.Seek( 0 ); aStream << rOutput; @@ -1685,7 +1685,7 @@ void ImpEditEngine::ImpConvert( OUString &rConvTxt, LanguageType &rConvTxtLang, // looks for next convertible text portion to be passed on to the wrapper - String aRes; + OUString aRes; LanguageType nResLang = LANGUAGE_NONE; /* ContentNode* pLastNode = */ aEditDoc.GetObject( aEditDoc.Count()-1 ); @@ -1693,9 +1693,9 @@ void ImpEditEngine::ImpConvert( OUString &rConvTxt, LanguageType &rConvTxtLang, EditPaM aPos( CreateEditPaM( pConvInfo->aConvContinue ) ); EditSelection aCurSel = EditSelection( aPos, aPos ); - String aWord; + OUString aWord; - while (!aRes.Len()) + while (aRes.isEmpty()) { // empty paragraph found that needs to have language and font set? if (bAllowImplicitChangesForNotConvertibleText && @@ -1825,11 +1825,11 @@ void ImpEditEngine::ImpConvert( OUString &rConvTxt, LanguageType &rConvTxtLang, aWord = GetSelected( aCurSel ); - if ( aWord.Len() > 0 /* && bLangOk */) + if ( !aWord.isEmpty() /* && bLangOk */) aRes = aWord; // move to next word/paragraph if necessary - if ( !aRes.Len() ) + if ( aRes.isEmpty() ) aCurSel = WordRight( aCurSel.Min(), ::com::sun::star::i18n::WordType::DICTIONARY_WORD ); pConvInfo->aConvContinue = CreateEPaM( aCurSel.Max() ); @@ -1854,7 +1854,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView ) EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); aCurSel.Min() = aCurSel.Max(); - String aWord; + OUString aWord; Reference< XSpellAlternatives > xSpellAlt; Sequence< PropertyValue > aEmptySeq; while (!xSpellAlt.is()) @@ -1882,17 +1882,17 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView ) // If afterwards a dot, this must be handed over! // If an abbreviation ... - if ( aWord.Len() && ( aCurSel.Max().GetIndex() < aCurSel.Max().GetNode()->Len() ) ) + if ( !aWord.isEmpty() && ( aCurSel.Max().GetIndex() < aCurSel.Max().GetNode()->Len() ) ) { sal_Unicode cNext = aCurSel.Max().GetNode()->GetChar( aCurSel.Max().GetIndex() ); if ( cNext == '.' ) { aCurSel.Max().GetIndex()++; - aWord += cNext; + aWord += OUString(cNext); } } - if ( aWord.Len() > 0 ) + if ( !aWord.isEmpty() ) { LanguageType eLang = GetLanguage( aCurSel.Max() ); SvxSpellWrapper::CheckSpellLang( xSpeller, eLang ); @@ -1924,7 +1924,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& r aEditDoc.GetObject( (aEditDoc.Count()-1) ); EditSelection aCurSel( rSelection.Min() ); - String aWord; + OUString aWord; Reference< XSpellAlternatives > xSpellAlt; Sequence< PropertyValue > aEmptySeq; while (!xSpellAlt.is()) @@ -1941,17 +1941,17 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& r // If afterwards a dot, this must be handed over! // If an abbreviation ... - if ( aWord.Len() && ( aCurSel.Max().GetIndex() < aCurSel.Max().GetNode()->Len() ) ) + if ( !aWord.isEmpty() && ( aCurSel.Max().GetIndex() < aCurSel.Max().GetNode()->Len() ) ) { sal_Unicode cNext = aCurSel.Max().GetNode()->GetChar( aCurSel.Max().GetIndex() ); if ( cNext == '.' ) { aCurSel.Max().GetIndex()++; - aWord += cNext; + aWord += OUString(cNext); } } - if ( aWord.Len() > 0 ) + if ( !aWord.isEmpty() ) xSpellAlt = xSpeller->spell( aWord, GetLanguage( aCurSel.Max() ), aEmptySeq ); if ( !xSpellAlt.is() ) @@ -2463,7 +2463,7 @@ EESpellState ImpEditEngine::HasSpellErrors() ContentNode* pLastNode = aEditDoc.GetObject( aEditDoc.Count() - 1 ); EditSelection aCurSel( aEditDoc.GetStartPaM() ); - String aWord; + OUString aWord; Reference< XSpellAlternatives > xSpellAlt; Sequence< PropertyValue > aEmptySeq; while ( !xSpellAlt.is() ) @@ -2476,7 +2476,7 @@ EESpellState ImpEditEngine::HasSpellErrors() aCurSel = SelectWord( aCurSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD ); aWord = GetSelected( aCurSel ); - if ( aWord.Len() > 0 ) + if ( !aWord.isEmpty() ) { LanguageType eLang = GetLanguage( aCurSel.Max() ); SvxSpellWrapper::CheckSpellLang( xSpeller, eLang ); @@ -2498,7 +2498,7 @@ EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView ) EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() ); if ( !aCurSel.HasRange() ) aCurSel = SelectWord( aCurSel, ::com::sun::star::i18n::WordType::DICTIONARY_WORD ); - String aWord( GetSelected( aCurSel ) ); + OUString aWord( GetSelected( aCurSel ) ); Reference< XThesaurus > xThes( SvxGetThesaurus() ); if (!xThes.is()) @@ -2716,10 +2716,10 @@ namespace { struct eeTransliterationChgData { - sal_uInt16 nStart; + sal_uInt16 nStart; xub_StrLen nLen; EditSelection aSelection; - String aNewText; + OUString aNewText; uno::Sequence< sal_Int32 > aOffsets; }; } @@ -2819,11 +2819,11 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, sal_Int32 nLen = nCurrentEnd - nCurrentStart; DBG_ASSERT( nLen > 0, "invalid word length of 0" ); #if OSL_DEBUG_LEVEL > 1 - String aText(aNodeStr.Copy(nCurrentStart, nLen) ); + OUString aText(aNodeStr.copy(nCurrentStart, nLen) ); #endif Sequence< sal_Int32 > aOffsets; - String aNewText( aTranslitarationWrapper.transliterate(aNodeStr, + OUString aNewText( aTranslitarationWrapper.transliterate(aNodeStr, GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ), nCurrentStart, nLen, &aOffsets )); @@ -2837,7 +2837,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, aChanges.push_back( aChgData ); } #if OSL_DEBUG_LEVEL > 1 - String aSelTxt ( GetSelected( aChgData.aSelection ) ); + OUString aSelTxt ( GetSelected( aChgData.aSelection ) ); (void) aSelTxt; #endif @@ -2907,11 +2907,11 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, sal_Int32 nLen = nCurrentEnd - nCurrentStart; DBG_ASSERT( nLen > 0, "invalid word length of 0" ); #if OSL_DEBUG_LEVEL > 1 - String aText( aNodeStr.Copy( nCurrentStart, nLen ) ); + OUString aText( aNodeStr.copy( nCurrentStart, nLen ) ); #endif Sequence< sal_Int32 > aOffsets; - String aNewText( aTranslitarationWrapper.transliterate( aNodeStr, + OUString aNewText( aTranslitarationWrapper.transliterate( aNodeStr, GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ), nCurrentStart, nLen, &aOffsets )); @@ -2951,7 +2951,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, xub_StrLen nLen = nCurrentEnd - nCurrentStart; Sequence< sal_Int32 > aOffsets; - String aNewText( aTranslitarationWrapper.transliterate( aNodeStr, nLanguage, nCurrentStart, nLen, &aOffsets ) ); + OUString aNewText( aTranslitarationWrapper.transliterate( aNodeStr, nLanguage, nCurrentStart, nLen, &aOffsets ) ); if (!aNodeStr.Equals( aNewText, nCurrentStart, nLen )) { @@ -3003,7 +3003,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, eeTransliterationChgData& rData = aChanges[ aChanges.size() - 1 - i ]; bChanges = sal_True; - if (rData.nLen != rData.aNewText.Len()) + if (rData.nLen != rData.aNewText.getLength()) bLenChanged = sal_True; // Change text without loosing the attributes @@ -3018,7 +3018,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, ParaPortion* pParaPortion = GetParaPortions()[nSelNode]; pParaPortion->MarkSelectionInvalid( rData.nStart, std::max< sal_uInt16 >( rData.nStart + rData.nLen, - rData.nStart + rData.aNewText.Len() ) ); + rData.nStart + rData.aNewText.getLength() ) ); } } } diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index 4e132e26b69e..00ba1e6c4cd0 100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -492,9 +492,9 @@ void TextConvWrapper::ChangeText( const OUString &rNewText, nChgLen = nIndex - nChgPos; nConvChgLen = nPos - nConvChgPos; #ifdef DEBUG - String aInOrig( rOrigText.copy( nChgPos, nChgLen ) ); + OUString aInOrig( rOrigText.copy( nChgPos, nChgLen ) ); #endif - String aInNew( rNewText.copy( nConvChgPos, nConvChgLen ) ); + OUString aInNew( rNewText.copy( nConvChgPos, nConvChgLen ) ); // set selection to sub string to be replaced in original text ESelection aSel( *pESelection ); @@ -503,7 +503,7 @@ void TextConvWrapper::ChangeText( const OUString &rNewText, aSel.nEndPos = nChgInNodeStartIndex + nChgLen; m_pEditView->SetSelection( aSel ); #ifdef DEBUG - String aSelTxt1( m_pEditView->GetSelected() ); + OUString aSelTxt1( m_pEditView->GetSelected() ); #endif // replace selected sub string with the corresponding @@ -551,12 +551,12 @@ void TextConvWrapper::ChangeText_impl( const OUString &rNewText, bool bKeepAttri SfxItemSet aSet( m_pEditView->GetAttribs() ); #ifdef DEBUG - String aSelTxt1( m_pEditView->GetSelected() ); + OUString aSelTxt1( m_pEditView->GetSelected() ); #endif // replace old text and select new text m_pEditView->InsertText( rNewText, sal_True ); #ifdef DEBUG - String aSelTxt2( m_pEditView->GetSelected() ); + OUString aSelTxt2( m_pEditView->GetSelected() ); #endif // since 'SetAttribs' below function like merging with the attributes -- cgit