summaryrefslogtreecommitdiff
path: root/vcl/source/edit
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-08-11 17:00:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-08-12 08:32:59 +0100
commit9dd40c656feda2ccadb07d618a95b9ff63ab61ff (patch)
tree84b5e0e3bd48909413c074d52c4bc08a46cfabce /vcl/source/edit
parent3e9ae4da947cd9c3f75b6e4942f2ba52337df075 (diff)
XubString->OUString
Change-Id: I04c7da143425a9d8cc4fae155ad45a469df953c1
Diffstat (limited to 'vcl/source/edit')
-rw-r--r--vcl/source/edit/textdoc.cxx15
-rw-r--r--vcl/source/edit/textdoc.hxx6
-rw-r--r--vcl/source/edit/texteng.cxx35
-rw-r--r--vcl/source/edit/textund2.hxx8
-rw-r--r--vcl/source/edit/textundo.cxx18
-rw-r--r--vcl/source/edit/textview.cxx6
-rw-r--r--vcl/source/edit/xtextedt.cxx14
7 files changed, 49 insertions, 53 deletions
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index 5ef6cf13dec5..3a2d3499d297 100644
--- a/vcl/source/edit/textdoc.cxx
+++ b/vcl/source/edit/textdoc.cxx
@@ -458,7 +458,7 @@ void TextDoc::DestroyTextNodes()
maTextNodes.clear();
}
-String TextDoc::GetText( const sal_Unicode* pSep ) const
+OUString TextDoc::GetText( const sal_Unicode* pSep ) const
{
sal_uLong nLen = GetTextLen( pSep );
sal_uLong nNodes = maTextNodes.Count();
@@ -483,9 +483,10 @@ String TextDoc::GetText( const sal_Unicode* pSep ) const
return aASCIIText;
}
-XubString TextDoc::GetText( sal_uLong nPara ) const
+OUString TextDoc::GetText( sal_uLong nPara ) const
{
- XubString aText;
+ OUString aText;
+
TextNode* pNode = ( nPara < maTextNodes.Count() ) ? maTextNodes.GetObject( nPara ) : 0;
if ( pNode )
aText = pNode->GetText();
@@ -541,15 +542,15 @@ TextPaM TextDoc::InsertText( const TextPaM& rPaM, sal_Unicode c )
return aPaM;
}
-TextPaM TextDoc::InsertText( const TextPaM& rPaM, const XubString& rStr )
+TextPaM TextDoc::InsertText( const TextPaM& rPaM, const OUString& rStr )
{
- DBG_ASSERT( rStr.Search( 0x0A ) == STRING_NOTFOUND, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
- DBG_ASSERT( rStr.Search( 0x0D ) == STRING_NOTFOUND, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
+ DBG_ASSERT( rStr.indexOf( 0x0A ) == -1, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
+ DBG_ASSERT( rStr.indexOf( 0x0D ) == -1, "TextDoc::InsertText: Zeilentrenner in Absatz nicht erlaubt!" );
TextNode* pNode = maTextNodes.GetObject( rPaM.GetPara() );
pNode->InsertText( rPaM.GetIndex(), rStr );
- TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+rStr.Len() );
+ TextPaM aPaM( rPaM.GetPara(), rPaM.GetIndex()+rStr.getLength() );
return aPaM;
}
diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx
index 85d94dedd6af..bced05ddf613 100644
--- a/vcl/source/edit/textdoc.hxx
+++ b/vcl/source/edit/textdoc.hxx
@@ -116,14 +116,14 @@ public:
TextPaM RemoveChars( const TextPaM& rPaM, sal_uInt16 nChars );
TextPaM InsertText( const TextPaM& rPaM, sal_Unicode c );
- TextPaM InsertText( const TextPaM& rPaM, const String& rStr );
+ TextPaM InsertText( const TextPaM& rPaM, const OUString& rStr );
TextPaM InsertParaBreak( const TextPaM& rPaM, sal_Bool bKeepEndingAttribs );
TextPaM ConnectParagraphs( TextNode* pLeft, TextNode* pRight );
sal_uLong GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel = NULL ) const;
- String GetText( const sal_Unicode* pSep ) const;
- String GetText( sal_uLong nPara ) const;
+ OUString GetText( const sal_Unicode* pSep ) const;
+ OUString GetText( sal_uLong nPara ) const;
void SetLeftMargin( sal_uInt16 n ) { mnLeftMargin = n; }
sal_uInt16 GetLeftMargin() const { return mnLeftMargin; }
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 14c864fab2bb..4974957f4b44 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -492,7 +492,7 @@ void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_uInt16 nChars, SfxUndo
{
// attributes have to be saved for UNDO before RemoveChars!
TextNode* pNode = mpDoc->GetNodes().GetObject( rPaM.GetPara() );
- XubString aStr( pNode->GetText().Copy( rPaM.GetIndex(), nChars ) );
+ OUString aStr( pNode->GetText().Copy( rPaM.GetIndex(), nChars ) );
// check if attributes are being deleted or changed
sal_uInt16 nStart = rPaM.GetIndex();
@@ -707,7 +707,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel,
// the text that needs to be checked is only the one
// before the current cursor position
- OUString aOldText( mpDoc->GetText( aPaM.GetPara() ).Copy(0, nTmpPos) );
+ OUString aOldText( mpDoc->GetText( aPaM.GetPara() ).copy(0, nTmpPos) );
OUString aNewText( aOldText );
if (aCTLOptions.IsCTLSequenceCheckingTypeAndReplace())
{
@@ -770,7 +770,7 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel,
}
-TextPaM TextEngine::ImpInsertText( const TextSelection& rCurSel, const XubString& rStr )
+TextPaM TextEngine::ImpInsertText( const TextSelection& rCurSel, const OUString& rStr )
{
UndoActionStart();
@@ -781,40 +781,35 @@ TextPaM TextEngine::ImpInsertText( const TextSelection& rCurSel, const XubString
else
aPaM = rCurSel.GetEnd();
- XubString aText(convertLineEnd(rStr, LINEEND_LF));
+ OUString aText(convertLineEnd(rStr, LINEEND_LF));
- sal_uInt16 nStart = 0;
- while ( nStart < aText.Len() )
+ sal_Int32 nStart = 0;
+ while ( nStart < aText.getLength() )
{
- sal_uInt16 nEnd = aText.Search( LINE_SEP, nStart );
- if ( nEnd == STRING_NOTFOUND )
- nEnd = aText.Len(); // do not dereference!
+ sal_Int32 nEnd = aText.indexOf( LINE_SEP, nStart );
+ if (nEnd == -1)
+ nEnd = aText.getLength(); // do not dereference!
// Start == End => empty line
if ( nEnd > nStart )
{
sal_uLong nL = aPaM.GetIndex();
nL += ( nEnd-nStart );
- if ( nL > STRING_MAXLEN )
- {
- sal_uInt16 nDiff = (sal_uInt16) (nL-STRING_MAXLEN);
- nEnd = nEnd - nDiff;
- }
- XubString aLine( aText, nStart, nEnd-nStart );
+ OUString aLine(aText.copy(nStart, nEnd-nStart));
if ( IsUndoEnabled() && !IsInUndo() )
InsertUndo( new TextUndoInsertChars( this, aPaM, aLine ) );
TEParaPortion* pPortion = mpTEParaPortions->GetObject( aPaM.GetPara() );
- pPortion->MarkInvalid( aPaM.GetIndex(), aLine.Len() );
- if ( aLine.Search( '\t' ) != STRING_NOTFOUND )
+ pPortion->MarkInvalid( aPaM.GetIndex(), aLine.getLength() );
+ if (aLine.indexOf( '\t' ) != -1)
pPortion->SetNotSimpleInvalid();
aPaM = mpDoc->InsertText( aPaM, aLine );
- ImpCharsInserted( aPaM.GetPara(), aPaM.GetIndex()-aLine.Len(), aLine.Len() );
+ ImpCharsInserted( aPaM.GetPara(), aPaM.GetIndex()-aLine.getLength(), aLine.getLength() );
}
- if ( nEnd < aText.Len() )
+ if ( nEnd < aText.getLength() )
aPaM = ImpInsertParaBreak( aPaM );
nStart = nEnd+1;
@@ -1352,7 +1347,7 @@ void TextEngine::UndoActionStart( sal_uInt16 nId )
if ( IsUndoEnabled() && !IsInUndo() )
{
String aComment;
- GetUndoManager().EnterListAction( aComment, XubString(), nId );
+ GetUndoManager().EnterListAction( aComment, OUString(), nId );
}
}
diff --git a/vcl/source/edit/textund2.hxx b/vcl/source/edit/textund2.hxx
index e8138056ab5c..0678e5923971 100644
--- a/vcl/source/edit/textund2.hxx
+++ b/vcl/source/edit/textund2.hxx
@@ -82,11 +82,11 @@ class TextUndoInsertChars : public TextUndo
{
private:
TextPaM maTextPaM;
- String maText;
+ OUString maText;
public:
TYPEINFO();
- TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const String& rStr );
+ TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const OUString& rStr );
virtual void Undo();
virtual void Redo();
@@ -101,11 +101,11 @@ class TextUndoRemoveChars : public TextUndo
{
private:
TextPaM maTextPaM;
- String maText;
+ OUString maText;
public:
TYPEINFO();
- TextUndoRemoveChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const String& rStr );
+ TextUndoRemoveChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const OUString& rStr );
virtual void Undo();
virtual void Redo();
diff --git a/vcl/source/edit/textundo.cxx b/vcl/source/edit/textundo.cxx
index 324306c5b480..0e218af8a108 100644
--- a/vcl/source/edit/textundo.cxx
+++ b/vcl/source/edit/textundo.cxx
@@ -224,7 +224,7 @@ void TextUndoConnectParas::Redo()
OUString TextUndoConnectParas::GetComment () const
{
- return ResId(STR_TEXTUNDO_CONNECTPARAS, *ImplGetResMgr());
+ return ResId(STR_TEXTUNDO_CONNECTPARAS, *ImplGetResMgr()).toString();
}
TextUndoSplitPara::TextUndoSplitPara( TextEngine* pTextEngine, sal_uLong nPara, sal_uInt16 nPos )
@@ -255,7 +255,7 @@ OUString TextUndoSplitPara::GetComment () const
return ResId(STR_TEXTUNDO_SPLITPARA, *ImplGetResMgr());
}
-TextUndoInsertChars::TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const XubString& rStr )
+TextUndoInsertChars::TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const OUString& rStr )
: TextUndo( pTextEngine ),
maTextPaM( rTextPaM ), maText( rStr )
{
@@ -264,7 +264,7 @@ TextUndoInsertChars::TextUndoInsertChars( TextEngine* pTextEngine, const TextPaM
void TextUndoInsertChars::Undo()
{
TextSelection aSel( maTextPaM, maTextPaM );
- aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.Len();
+ aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.getLength();
TextPaM aPaM = GetTextEngine()->ImpDeleteText( aSel );
SetSelection( aPaM );
}
@@ -274,7 +274,7 @@ void TextUndoInsertChars::Redo()
TextSelection aSel( maTextPaM, maTextPaM );
GetTextEngine()->ImpInsertText( aSel, maText );
TextPaM aNewPaM( maTextPaM );
- aNewPaM.GetIndex() = aNewPaM.GetIndex() + maText.Len();
+ aNewPaM.GetIndex() = aNewPaM.GetIndex() + maText.getLength();
SetSelection( TextSelection( aSel.GetStart(), aNewPaM ) );
}
@@ -288,7 +288,7 @@ bool TextUndoInsertChars::Merge( SfxUndoAction* pNextAction )
if ( maTextPaM.GetPara() != pNext->maTextPaM.GetPara() )
return false;
- if ( ( maTextPaM.GetIndex() + maText.Len() ) == pNext->maTextPaM.GetIndex() )
+ if ( ( maTextPaM.GetIndex() + maText.getLength() ) == pNext->maTextPaM.GetIndex() )
{
maText += pNext->maText;
return true;
@@ -301,10 +301,10 @@ OUString TextUndoInsertChars::GetComment () const
// multiple lines?
OUString sText(maText);
Shorten(sText);
- return OUString(ResId(STR_TEXTUNDO_INSERTCHARS, *ImplGetResMgr())).replaceAll("$1", sText);
+ return ResId(STR_TEXTUNDO_INSERTCHARS, *ImplGetResMgr()).toString().replaceAll("$1", sText);
}
-TextUndoRemoveChars::TextUndoRemoveChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const XubString& rStr )
+TextUndoRemoveChars::TextUndoRemoveChars( TextEngine* pTextEngine, const TextPaM& rTextPaM, const OUString& rStr )
: TextUndo( pTextEngine ),
maTextPaM( rTextPaM ), maText( rStr )
{
@@ -314,14 +314,14 @@ void TextUndoRemoveChars::Undo()
{
TextSelection aSel( maTextPaM, maTextPaM );
GetTextEngine()->ImpInsertText( aSel, maText );
- aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.Len();
+ aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.getLength();
SetSelection( aSel );
}
void TextUndoRemoveChars::Redo()
{
TextSelection aSel( maTextPaM, maTextPaM );
- aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.Len();
+ aSel.GetEnd().GetIndex() = aSel.GetEnd().GetIndex() + maText.getLength();
TextPaM aPaM = GetTextEngine()->ImpDeleteText( aSel );
SetSelection( aPaM );
}
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 1c6df893cb37..7a083b86e49a 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -950,8 +950,8 @@ void TextView::Command( const CommandEvent& rCEvt )
if ( mpImpl->mpTextEngine->mpIMEInfos->bWasCursorOverwrite )
{
- sal_uInt16 nOldIMETextLen = mpImpl->mpTextEngine->mpIMEInfos->nLen;
- sal_uInt16 nNewIMETextLen = pData->GetText().Len();
+ sal_Int32 nOldIMETextLen = mpImpl->mpTextEngine->mpIMEInfos->nLen;
+ sal_Int32 nNewIMETextLen = pData->GetText().getLength();
if ( ( nOldIMETextLen > nNewIMETextLen ) &&
( nNewIMETextLen < mpImpl->mpTextEngine->mpIMEInfos->aOldTextAfterStartPos.Len() ) )
@@ -981,7 +981,7 @@ void TextView::Command( const CommandEvent& rCEvt )
if ( pData->GetTextAttr() )
{
- mpImpl->mpTextEngine->mpIMEInfos->CopyAttribs( pData->GetTextAttr(), pData->GetText().Len() );
+ mpImpl->mpTextEngine->mpIMEInfos->CopyAttribs( pData->GetTextAttr(), pData->GetText().getLength() );
mpImpl->mpTextEngine->mpIMEInfos->bCursor = pData->IsCursorVisible();
}
else
diff --git a/vcl/source/edit/xtextedt.cxx b/vcl/source/edit/xtextedt.cxx
index 3cc021f7a20a..c47dd1607aad 100644
--- a/vcl/source/edit/xtextedt.cxx
+++ b/vcl/source/edit/xtextedt.cxx
@@ -56,12 +56,12 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const
sal_uInt16 nLevel = 1;
while ( nLevel && ( nPara < nParas ) )
{
- XubString aStr = GetText( nPara );
- while ( nCur < aStr.Len() )
+ OUString aStr = GetText( nPara );
+ while ( nCur < aStr.getLength() )
{
- if ( aStr.GetChar( nCur ) == nSC )
+ if ( aStr[nCur] == nSC )
nLevel++;
- else if ( aStr.GetChar( nCur ) == nEC )
+ else if ( aStr[nCur] == nEC )
{
nLevel--;
if ( !nLevel )
@@ -94,16 +94,16 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const
{
if ( GetTextLen( nPara ) )
{
- XubString aStr = GetText( nPara );
+ OUString aStr = GetText( nPara );
while ( nCur )
{
- if ( aStr.GetChar( nCur ) == nSC )
+ if ( aStr[nCur] == nSC )
{
nLevel--;
if ( !nLevel )
break; // while nCur...
}
- else if ( aStr.GetChar( nCur ) == nEC )
+ else if ( aStr[nCur] == nEC )
nLevel++;
nCur--;