convert editeng/source/uno/*.cxx from String to OUString

Change-Id: If709d2ce0aea90133b2b243bb9ecb77d64ca065b
This commit is contained in:
Noel Grandin
2013-09-10 09:51:45 +02:00
parent 94be56921f
commit eaef61939b
3 changed files with 21 additions and 22 deletions

View File

@@ -472,7 +472,7 @@ OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
::std::swap( aStartIndex, aEndIndex ); ::std::swap( aStartIndex, aEndIndex );
} }
String sStr = mrTextForwarder->GetText( MakeEESelection(aStartIndex, aEndIndex) ); OUString sStr = mrTextForwarder->GetText( MakeEESelection(aStartIndex, aEndIndex) );
// trim field text, if necessary // trim field text, if necessary
if( aStartIndex.InField() ) if( aStartIndex.InField() )
@@ -481,15 +481,15 @@ OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
aStartIndex.GetFieldOffset() <= USHRT_MAX, aStartIndex.GetFieldOffset() <= USHRT_MAX,
"SvxAccessibleTextIndex::GetText: index value overflow"); "SvxAccessibleTextIndex::GetText: index value overflow");
sStr.Erase(0, static_cast< sal_uInt16 > (aStartIndex.GetFieldOffset()) ); sStr = sStr.copy( aStartIndex.GetFieldOffset() );
} }
if( aEndIndex.InField() && aEndIndex.GetFieldOffset() ) if( aEndIndex.InField() && aEndIndex.GetFieldOffset() )
{ {
DBG_ASSERT(sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) >= 0 && DBG_ASSERT(sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) >= 0 &&
sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) <= USHRT_MAX, sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) <= USHRT_MAX,
"SvxAccessibleTextIndex::GetText: index value overflow"); "SvxAccessibleTextIndex::GetText: index value overflow");
sStr = sStr.Copy(0, static_cast< sal_uInt16 > (sStr.Len() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset())) ); sStr = sStr.copy(0, sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) );
} }
EBulletInfo aBulletInfo1 = GetBulletInfo( aStartIndex.GetParagraph() ); EBulletInfo aBulletInfo1 = GetBulletInfo( aStartIndex.GetParagraph() );
@@ -498,13 +498,13 @@ OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
if( aStartIndex.InBullet() ) if( aStartIndex.InBullet() )
{ {
// prepend leading bullet // prepend leading bullet
String sBullet = aBulletInfo1.aText; OUString sBullet = aBulletInfo1.aText;
DBG_ASSERT(aStartIndex.GetBulletOffset() >= 0 && DBG_ASSERT(aStartIndex.GetBulletOffset() >= 0 &&
aStartIndex.GetBulletOffset() <= USHRT_MAX, aStartIndex.GetBulletOffset() <= USHRT_MAX,
"SvxAccessibleTextIndex::GetText: index value overflow"); "SvxAccessibleTextIndex::GetText: index value overflow");
sBullet.Erase(0, static_cast< sal_uInt16 > (aStartIndex.GetBulletOffset()) ); sBullet = sBullet.copy( aStartIndex.GetBulletOffset() );
sBullet += sStr; sBullet += sStr;
sStr = sBullet; sStr = sBullet;
@@ -515,26 +515,25 @@ OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
// append trailing bullet // append trailing bullet
sStr += aBulletInfo2.aText; sStr += aBulletInfo2.aText;
DBG_ASSERT(sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 && DBG_ASSERT(sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX, sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
"SvxAccessibleTextIndex::GetText: index value overflow"); "SvxAccessibleTextIndex::GetText: index value overflow");
sStr = sStr.Copy(0, static_cast< sal_uInt16 > (sStr.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) ); sStr = sStr.copy(0, sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) );
} }
else if( aStartIndex.GetParagraph() != aEndIndex.GetParagraph() && else if( aStartIndex.GetParagraph() != aEndIndex.GetParagraph() &&
HaveTextBullet( aEndIndex.GetParagraph() ) ) HaveTextBullet( aEndIndex.GetParagraph() ) )
{ {
String sBullet = aBulletInfo2.aText; OUString sBullet = aBulletInfo2.aText;
DBG_ASSERT(sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 && DBG_ASSERT(sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX, sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
"SvxAccessibleTextIndex::GetText: index value overflow"); "SvxAccessibleTextIndex::GetText: index value overflow");
sBullet = sBullet.Copy(0, static_cast< sal_uInt16 > (sBullet.Len() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset())) ); sBullet = sBullet.copy(0, sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) );
// insert bullet // insert bullet
sStr.Insert( sBullet, sStr = sStr.replaceAt( GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex(), 0, sBullet );
static_cast< sal_uInt16 > (GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex()) );
} }
return sStr; return sStr;

View File

@@ -448,9 +448,9 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
case text::textfield::Type::AUTHOR: case text::textfield::Type::AUTHOR:
{ {
OUString aContent; OUString aContent;
String aFirstName; OUString aFirstName;
String aLastName; OUString aLastName;
String aEmpty; OUString aEmpty;
// do we have CurrentPresentation given? // do we have CurrentPresentation given?
// mimic behaviour of writer, which means: // mimic behaviour of writer, which means:

View File

@@ -392,7 +392,7 @@ void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString)
{ {
CheckSelection( maSelection, pForwarder ); CheckSelection( maSelection, pForwarder );
String aConverted(convertLineEnd(aString, LINEEND_LF)); // Simply count the number of line endings OUString aConverted(convertLineEnd(aString, LINEEND_LF)); // Simply count the number of line endings
pForwarder->QuickInsertText( aConverted, maSelection ); pForwarder->QuickInsertText( aConverted, maSelection );
mpEditSource->UpdateData(); mpEditSource->UpdateData();
@@ -402,7 +402,7 @@ void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString)
//! on QuickInsertText... //! on QuickInsertText...
CollapseToStart(); CollapseToStart();
sal_uInt16 nLen = aConverted.Len(); sal_uInt16 nLen = aConverted.getLength();
if (nLen) if (nLen)
GoRight( nLen, sal_True ); GoRight( nLen, sal_True );
} }
@@ -1891,7 +1891,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text
if( bAbsorb ) if( bAbsorb )
{ {
const String aEmpty; const OUString aEmpty;
pForwarder->QuickInsertText( aEmpty, aRange ); pForwarder->QuickInsertText( aEmpty, aRange );
aRange.nEndPos = aRange.nStartPos; aRange.nEndPos = aRange.nStartPos;