summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-03 17:10:10 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-04 15:09:23 -0400
commit0e355da592008257ec02bd68d37ff67b32eaa8c6 (patch)
tree075f148d54df162eee5767c765c78a26531792a6 /editeng
parent35c17477170e9d10b9f9d7edeaf1da660a718df6 (diff)
De-coupled ContentNode from XubString inheritance.
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.cxx77
-rw-r--r--editeng/source/editeng/editdoc.hxx22
-rw-r--r--editeng/source/editeng/editview.cxx2
-rw-r--r--editeng/source/editeng/edtspell.cxx6
-rw-r--r--editeng/source/editeng/impedit2.cxx58
-rw-r--r--editeng/source/editeng/impedit3.cxx20
-rw-r--r--editeng/source/editeng/impedit4.cxx55
7 files changed, 171 insertions, 69 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 373e608297ff..c4449509d92b 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1154,6 +1154,16 @@ void EditPaM::SetNode(ContentNode* p)
pNode = p;
}
+bool EditPaM::IsParaStart() const
+{
+ return nIndex == 0;
+}
+
+bool EditPaM::IsParaEnd() const
+{
+ return nIndex == pNode->Len();
+}
+
sal_Bool EditPaM::DbgIsBuggy( EditDoc& rDoc )
{
if ( !pNode )
@@ -1275,7 +1285,7 @@ ContentNode::ContentNode( SfxItemPool& rPool ) : aContentAttribs( rPool )
}
ContentNode::ContentNode( const XubString& rStr, const ContentAttribs& rContentAttribs ) :
- XubString( rStr ), aContentAttribs( rContentAttribs )
+ maString(rStr), aContentAttribs(rContentAttribs)
{
DBG_CTOR( EE_ContentNode, 0 );
pWrongList = NULL;
@@ -1414,7 +1424,7 @@ void ContentNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew, SfxItemPool
if ( pWrongList )
{
- sal_Bool bSep = ( GetChar( nIndex ) == ' ' ) || IsFeature( nIndex );
+ bool bSep = ( maString.GetChar( nIndex ) == ' ' ) || IsFeature( nIndex );
pWrongList->TextInserted( nIndex, nNew, bSep );
}
@@ -1515,7 +1525,7 @@ void ContentNode::CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool,
{
DBG_ASSERT( pPrevNode, "Copy of attributes to a null pointer?" );
- xub_StrLen nCut = pPrevNode->Len();
+ sal_uInt16 nCut = pPrevNode->Len();
size_t nAttr = 0;
CharAttribList::AttribsType& rPrevAttribs = pPrevNode->GetCharAttribs().GetAttribs();
@@ -1567,7 +1577,7 @@ void ContentNode::AppendAttribs( ContentNode* pNextNode )
{
DBG_ASSERT( pNextNode, "Copy of attributes to a null pointer?" );
- sal_uInt16 nNewStart = Len();
+ sal_uInt16 nNewStart = maString.Len();
#if OSL_DEBUG_LEVEL > 2
OSL_ENSURE( aCharAttribList.DbgCheckAttribs(), "Attribute before AppendAttribs broken" );
@@ -1658,6 +1668,61 @@ void ContentNode::DestroyWrongList()
pWrongList = NULL;
}
+bool ContentNode::IsFeature( sal_uInt16 nPos ) const
+{
+ return maString.GetChar(nPos) == CH_FEATURE;
+}
+
+sal_uInt16 ContentNode::Len() const
+{
+ return maString.Len();
+}
+
+const XubString& ContentNode::GetString() const
+{
+ return maString;
+}
+
+void ContentNode::SetChar(sal_uInt16 nPos, sal_Unicode c)
+{
+ maString.SetChar(nPos, c);
+}
+
+void ContentNode::Insert(const XubString& rStr, sal_uInt16 nPos)
+{
+ maString.Insert(rStr, nPos);
+}
+
+void ContentNode::Append(const XubString& rStr)
+{
+ maString.Append(rStr);
+}
+
+void ContentNode::Erase(sal_uInt16 nPos)
+{
+ maString.Erase(nPos);
+}
+
+void ContentNode::Erase(sal_uInt16 nPos, sal_uInt16 nCount)
+{
+ maString.Erase(nPos, nCount);
+}
+
+XubString ContentNode::Copy(sal_uInt16 nPos) const
+{
+ return maString.Copy(nPos);
+}
+
+XubString ContentNode::Copy(sal_uInt16 nPos, sal_uInt16 nCount) const
+{
+ return maString.Copy(nPos, nCount);
+}
+
+sal_Unicode ContentNode::GetChar(sal_uInt16 nPos) const
+{
+ return maString.GetChar(nPos);
+}
+
void ContentNode::CreateWrongList()
{
DBG_ASSERT( !pWrongList, "WrongList already exist!" );
@@ -2050,7 +2115,7 @@ XubString EditDoc::GetParaAsString(
//!! beware of sub string length of -1 which is also defined as STRING_LEN and
//!! thus would result in adding the whole sub string up to the end of the node !!
if (nEnd > nIndex)
- aStr += XubString( *pNode, nIndex, nEnd - nIndex );
+ aStr += XubString(pNode->GetString(), nIndex, nEnd - nIndex);
if ( pNextFeature )
{
@@ -2240,7 +2305,7 @@ EditPaM EditDoc::ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight )
// First the attributes, otherwise nLen will not be correct!
pLeft->AppendAttribs( pRight );
// then the Text...
- *pLeft += *pRight;
+ pLeft->Append(pRight->GetString());
// the one to the right disappears.
RemoveItemsFromPool(*pRight);
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index bd05ae1fb528..8b70806f768d 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -42,6 +42,7 @@
#include <deque>
#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/noncopyable.hpp>
class ImpEditEngine;
class SvxTabStop;
@@ -262,9 +263,10 @@ public:
// -------------------------------------------------------------------------
// class ContentNode
// -------------------------------------------------------------------------
-class ContentNode : public XubString
+class ContentNode : boost::noncopyable
{
private:
+ XubString maString;
ContentAttribs aContentAttribs;
CharAttribList aCharAttribList;
WrongList* pWrongList;
@@ -298,7 +300,19 @@ public:
void CreateWrongList();
void DestroyWrongList();
- sal_Bool IsFeature( sal_uInt16 nPos ) const { return ( GetChar( nPos ) == CH_FEATURE ); }
+ bool IsFeature( sal_uInt16 nPos ) const;
+
+ sal_uInt16 Len() const;
+ const XubString& GetString() const;
+
+ void SetChar(sal_uInt16 nPos, sal_Unicode c);
+ void Insert(const XubString& rStr, sal_uInt16 nPos);
+ void Append(const XubString& rStr);
+ void Erase(sal_uInt16 nPos);
+ void Erase(sal_uInt16 nPos, sal_uInt16 nCount);
+ XubString Copy(sal_uInt16 nPos) const;
+ XubString Copy(sal_uInt16 nPos, sal_uInt16 nCount) const;
+ sal_Unicode GetChar(sal_uInt16 nPos) const;
};
// -------------------------------------------------------------------------
@@ -323,8 +337,8 @@ public:
sal_uInt16& GetIndex() { return nIndex; }
void SetIndex( sal_uInt16 n ) { nIndex = n; }
- sal_Bool IsParaStart() const { return nIndex == 0; }
- sal_Bool IsParaEnd() const { return nIndex == pNode->Len(); }
+ bool IsParaStart() const;
+ bool IsParaEnd() const;
sal_Bool DbgIsBuggy( EditDoc& rDoc );
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index c35591c015b9..9bf11c007d80 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -941,7 +941,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
ContentNode *pNode = aPaM.GetNode();
if (pNode)
{
- aParaText = *pNode;
+ aParaText = pNode->GetString();
}
else
{
diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index cd73f0d48851..a79443d80798 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -743,7 +743,7 @@ const String* EdtAutoCorrDoc::GetPrevPara( sal_Bool )
n--;
ContentNode* pNode = rNodes[n];
if ( pNode->Len() )
- return pNode;
+ return &pNode->GetString();
}
return NULL;
@@ -764,7 +764,7 @@ sal_Bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_uInt16& rSttPos,
return bRet;
LanguageType eLang = pImpEE->GetLanguage( EditPaM( pCurNode, rSttPos+1 ) );
- const SvxAutocorrWord* pFnd = rACorrect.SearchWordsInList( *pCurNode, rSttPos, nEndPos, *this, eLang );
+ const SvxAutocorrWord* pFnd = rACorrect.SearchWordsInList(pCurNode->GetString(), rSttPos, nEndPos, *this, eLang);
if( pFnd && pFnd->IsTextOnly() )
{
// then replace
@@ -777,7 +777,7 @@ sal_Bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_uInt16& rSttPos,
pImpEE->ImpInsertText( aSel, pFnd->GetLong() );
nCursor = nCursor + pFnd->GetLong().Len();
if( ppPara )
- *ppPara = pCurNode;
+ *ppPara = &pCurNode->GetString();
bRet = sal_True;
}
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index ecb4a89bf12b..56a8b39ca6a4 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1013,7 +1013,7 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM&
if ( !bEmptyLine )
{
- String aLine( *aPaM.GetNode(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart() );
+ String aLine(aPaM.GetNode()->GetString(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart());
const sal_Unicode* pLineString = aLine.GetBuffer();
@@ -1132,7 +1132,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM
sal_Bool bGotoStartOfNextLine = sal_False;
sal_Bool bGotoEndOfPrevLine = sal_False;
- String aLine( *aPaM.GetNode(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart() );
+ String aLine(aPaM.GetNode()->GetString(), pLine->GetStart(), pLine->GetEnd() - pLine->GetStart());
sal_uInt16 nPosInLine = aPaM.GetIndex() - pLine->GetStart();
const sal_Unicode* pLineString = aLine.GetBuffer();
@@ -1243,7 +1243,9 @@ EditPaM ImpEditEngine::CursorLeft( const EditPaM& rPaM, sal_uInt16 nCharacterIte
{
sal_Int32 nCount = 1;
uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- aNewPaM.SetIndex( (sal_uInt16)_xBI->previousCharacters( *aNewPaM.GetNode(), aNewPaM.GetIndex(), GetLocale( aNewPaM ), nCharacterIteratorMode, nCount, nCount ) );
+ aNewPaM.SetIndex(
+ (sal_uInt16)_xBI->previousCharacters(
+ aNewPaM.GetNode()->GetString(), aNewPaM.GetIndex(), GetLocale( aNewPaM ), nCharacterIteratorMode, nCount, nCount));
}
else
{
@@ -1268,7 +1270,9 @@ EditPaM ImpEditEngine::CursorRight( const EditPaM& rPaM, sal_uInt16 nCharacterIt
{
uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
sal_Int32 nCount = 1;
- aNewPaM.SetIndex( (sal_uInt16)_xBI->nextCharacters( *aNewPaM.GetNode(), aNewPaM.GetIndex(), GetLocale( aNewPaM ), nCharacterIteratorMode, nCount, nCount ) );
+ aNewPaM.SetIndex(
+ (sal_uInt16)_xBI->nextCharacters(
+ aNewPaM.GetNode()->GetString(), aNewPaM.GetIndex(), GetLocale( aNewPaM ), nCharacterIteratorMode, nCount, nCount));
}
else
{
@@ -1509,9 +1513,11 @@ EditPaM ImpEditEngine::WordLeft( const EditPaM& rPaM, sal_Int16 nWordType )
lang::Locale aLocale( GetLocale( aTmpPaM ) );
uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- i18n::Boundary aBoundary = _xBI->getWordBoundary( *aNewPaM.GetNode(), nCurrentPos, aLocale, nWordType, sal_True );
+ i18n::Boundary aBoundary =
+ _xBI->getWordBoundary(aNewPaM.GetNode()->GetString(), nCurrentPos, aLocale, nWordType, true);
if ( aBoundary.startPos >= nCurrentPos )
- aBoundary = _xBI->previousWord( *aNewPaM.GetNode(), nCurrentPos, aLocale, nWordType );
+ aBoundary = _xBI->previousWord(
+ aNewPaM.GetNode()->GetString(), nCurrentPos, aLocale, nWordType);
aNewPaM.SetIndex( ( aBoundary.startPos != (-1) ) ? (sal_uInt16)aBoundary.startPos : 0 );
}
@@ -1531,7 +1537,8 @@ EditPaM ImpEditEngine::WordRight( const EditPaM& rPaM, sal_Int16 nWordType )
lang::Locale aLocale( GetLocale( aTmpPaM ) );
uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- i18n::Boundary aBoundary = _xBI->nextWord( *aNewPaM.GetNode(), aNewPaM.GetIndex(), aLocale, nWordType );
+ i18n::Boundary aBoundary = _xBI->nextWord(
+ aNewPaM.GetNode()->GetString(), aNewPaM.GetIndex(), aLocale, nWordType);
aNewPaM.SetIndex( (sal_uInt16)aBoundary.startPos );
}
// not 'else', maybe the index reached nMax now...
@@ -1562,7 +1569,9 @@ EditPaM ImpEditEngine::StartOfWord( const EditPaM& rPaM, sal_Int16 nWordType )
lang::Locale aLocale( GetLocale( aTmpPaM ) );
uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- i18n::Boundary aBoundary = _xBI->getWordBoundary( *rPaM.GetNode(), rPaM.GetIndex(), aLocale, nWordType, sal_True );
+ i18n::Boundary aBoundary = _xBI->getWordBoundary(
+ rPaM.GetNode()->GetString(), rPaM.GetIndex(), aLocale, nWordType, true);
+
aNewPaM.SetIndex( (sal_uInt16)aBoundary.startPos );
return aNewPaM;
}
@@ -1580,7 +1589,9 @@ EditPaM ImpEditEngine::EndOfWord( const EditPaM& rPaM, sal_Int16 nWordType )
lang::Locale aLocale( GetLocale( aTmpPaM ) );
uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- i18n::Boundary aBoundary = _xBI->getWordBoundary( *rPaM.GetNode(), rPaM.GetIndex(), aLocale, nWordType, sal_True );
+ i18n::Boundary aBoundary = _xBI->getWordBoundary(
+ rPaM.GetNode()->GetString(), rPaM.GetIndex(), aLocale, nWordType, true);
+
aNewPaM.SetIndex( (sal_uInt16)aBoundary.endPos );
return aNewPaM;
}
@@ -1599,10 +1610,14 @@ EditSelection ImpEditEngine::SelectWord( const EditSelection& rCurSel, sal_Int16
lang::Locale aLocale( GetLocale( aTmpPaM ) );
uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- sal_Int16 nType = _xBI->getWordType( *aPaM.GetNode(), aPaM.GetIndex(), aLocale );
+ sal_Int16 nType = _xBI->getWordType(
+ aPaM.GetNode()->GetString(), aPaM.GetIndex(), aLocale);
+
if ( nType == i18n::WordType::ANY_WORD )
{
- i18n::Boundary aBoundary = _xBI->getWordBoundary( *aPaM.GetNode(), aPaM.GetIndex(), aLocale, nWordType, sal_True );
+ i18n::Boundary aBoundary = _xBI->getWordBoundary(
+ aPaM.GetNode()->GetString(), aPaM.GetIndex(), aLocale, nWordType, true);
+
// don't select when curser at end of word
if ( ( aBoundary.endPos > aPaM.GetIndex() ) &&
( ( aBoundary.startPos < aPaM.GetIndex() ) || ( bAcceptStartOfWord && ( aBoundary.startPos == aPaM.GetIndex() ) ) ) )
@@ -1621,12 +1636,14 @@ 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);
+ String sParagraph = pNode->GetString();
sParagraph.SearchAndReplaceAll(0x01,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;
- sal_Int32 nEnd = _xBI->endOfSentence( *pNode, rPaM.GetIndex(), GetLocale( rPaM ) );
+ sal_Int32 nEnd = _xBI->endOfSentence(
+ pNode->GetString(), rPaM.GetIndex(), GetLocale(rPaM));
+
EditSelection aNewSel( rCurSel );
OSL_ENSURE(pNode->Len() ? (nStart < pNode->Len()) : (nStart == 0), "sentence start index out of range");
OSL_ENSURE(nEnd <= pNode->Len(), "sentence end index out of range");
@@ -1682,7 +1699,7 @@ void ImpEditEngine::InitScriptTypes( sal_uInt16 nPara )
{
uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- String aText( *pNode );
+ String 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
@@ -1944,7 +1961,7 @@ void ImpEditEngine::InitWritingDirections( sal_uInt16 nPara )
if ( ( bCTL || ( nBidiLevel == 1 /*RTL*/ ) ) && pParaPortion->GetNode()->Len() )
{
- String aText( *pParaPortion->GetNode() );
+ String aText = pParaPortion->GetNode()->GetString();
//
// Bidi functions from icu 2.0
@@ -2557,7 +2574,8 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c,
ContentNode* pNode = aSel.Max().GetNode();
sal_uInt16 nIndex = aSel.Max().GetIndex();
EdtAutoCorrDoc aAuto( this, pNode, nIndex, c );
- pAutoCorrect->AutoCorrect( aAuto, *pNode, nIndex, c, !bOverwrite, pFrameWin );
+ pAutoCorrect->AutoCorrect(
+ aAuto, pNode->GetString(), nIndex, c, !bOverwrite, pFrameWin );
aSel.Max().SetIndex( aAuto.GetCursor() );
// #i78661 since the SvxAutoCorrect object used here is
@@ -3187,7 +3205,7 @@ sal_uInt32 ImpEditEngine::CalcLineWidth( ParaPortion* pPortion, EditLine* pLine,
SeekCursor( pPortion->GetNode(), nPos+1, aTmpFont );
aTmpFont.SetPhysFont( GetRefDevice() );
ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
- nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), *pPortion->GetNode(), nPos, pTextPortion->GetLen(), NULL ).Width();
+ nWidth += aTmpFont.QuickGetTextSize( GetRefDevice(), pPortion->GetNode()->GetString(), nPos, pTextPortion->GetLen(), NULL ).Width();
}
}
break;
@@ -3797,8 +3815,10 @@ sal_uInt16 ImpEditEngine::GetChar(
uno::Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
sal_Int32 nCount = 1;
lang::Locale aLocale = GetLocale( aPaM );
- sal_uInt16 nRight = (sal_uInt16)_xBI->nextCharacters( *pParaPortion->GetNode(), nChar, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount );
- sal_uInt16 nLeft = (sal_uInt16)_xBI->previousCharacters( *pParaPortion->GetNode(), nRight, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount );
+ sal_uInt16 nRight = (sal_uInt16)_xBI->nextCharacters(
+ pParaPortion->GetNode()->GetString(), nChar, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount );
+ sal_uInt16 nLeft = (sal_uInt16)_xBI->previousCharacters(
+ pParaPortion->GetNode()->GetString(), nRight, aLocale, ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, nCount, nCount );
if ( ( nLeft != nChar ) && ( nRight != nChar ) )
{
nChar = ( Abs( nRight - nChar ) < Abs( nLeft - nChar ) ) ? nRight : nLeft;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 4e9c393fa248..a380c08f4b5f 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -646,7 +646,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( !bEmptyNodeWithPolygon && !HasScriptType( nPara, i18n::ScriptType::COMPLEX ) )
{
if ( ( pParaPortion->IsSimpleInvalid() ) && ( nInvalidDiff > 0 ) &&
- ( pNode->Search( CH_FEATURE, nInvalidStart ) > nInvalidEnd ) )
+ ( pNode->GetString().Search( CH_FEATURE, nInvalidStart ) > nInvalidEnd ) )
{
bQuickFormat = sal_True;
}
@@ -1043,7 +1043,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( bCalcCharPositions || !pPortion->HasValidSize() )
{
- pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), *pParaPortion->GetNode(), nTmpPos, pPortion->GetLen(), pBuf );
+ pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), pParaPortion->GetNode()->GetString(), nTmpPos, pPortion->GetLen(), pBuf );
// #i9050# Do Kerning also behind portions...
if ( ( aTmpFont.GetFixKerning() > 0 ) && ( ( nTmpPos + pPortion->GetLen() ) < pNode->Len() ) )
@@ -1118,7 +1118,7 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
if ( nDecPos != STRING_NOTFOUND )
{
nW -= pParaPortion->GetTextPortions()[nTmpPortion]->GetSize().Width();
- nW += aTmpFont.QuickGetTextSize( GetRefDevice(), *pParaPortion->GetNode(), nTmpPos, nDecPos, NULL ).Width();
+ nW += aTmpFont.QuickGetTextSize( GetRefDevice(), pParaPortion->GetNode()->GetString(), nTmpPos, nDecPos, NULL ).Width();
aCurrentTab.bValid = sal_False;
}
}
@@ -1762,7 +1762,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
lang::Locale aLocale = GetLocale( EditPaM( pNode, nMaxBreakPos ) );
Reference < i18n::XBreakIterator > _xBI( ImplGetBreakIterator() );
- OUString aText( *pNode );
+ OUString aText = pNode->GetString();
Reference< XHyphenator > xHyph;
if ( bCanHyphenate )
xHyph = GetHyphenator();
@@ -1776,7 +1776,8 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
aUserOptions.allowPunctuationOutsideMargin = ((const SfxBoolItem&)pNode->GetContentAttribs().GetItem( EE_PARA_HANGINGPUNCTUATION )).GetValue();
aUserOptions.allowHyphenateEnglish = sal_False;
- i18n::LineBreakResults aLBR = _xBI->getLineBreak( *pNode, nMaxBreakPos, aLocale, nMinBreakPos, aHyphOptions, aUserOptions );
+ i18n::LineBreakResults aLBR = _xBI->getLineBreak(
+ pNode->GetString(), nMaxBreakPos, aLocale, nMinBreakPos, aHyphOptions, aUserOptions );
nBreakPos = (sal_uInt16)aLBR.breakIndex;
// BUG in I18N - under special condition (break behind field, #87327#) breakIndex is < nMinBreakPos
@@ -1813,7 +1814,8 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
// into more than two lines ...
if ( !bHangingPunctuation && bCanHyphenate && GetHyphenator().is() )
{
- i18n::Boundary aBoundary = _xBI->getWordBoundary( *pNode, nBreakPos, GetLocale( EditPaM( pNode, nBreakPos ) ), ::com::sun::star::i18n::WordType::DICTIONARY_WORD, sal_True );
+ i18n::Boundary aBoundary = _xBI->getWordBoundary(
+ pNode->GetString(), nBreakPos, GetLocale( EditPaM( pNode, nBreakPos ) ), ::com::sun::star::i18n::WordType::DICTIONARY_WORD, true);
sal_uInt16 nWordStart = nBreakPos;
sal_uInt16 nWordEnd = (sal_uInt16) aBoundary.endPos;
DBG_ASSERT( nWordEnd > nWordStart, "ImpBreakLine: Start >= End?" );
@@ -1822,7 +1824,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
if ( ( nWordEnd >= nMaxBreakPos ) && ( nWordLen > 3 ) )
{
// May happen, because getLineBreak may differ from getWordBoudary with DICTIONARY_WORD
- String aWord( *pNode, nWordStart, nWordLen );
+ String aWord(pNode->GetString(), nWordStart, nWordLen);
sal_uInt16 nMinTrail = nWordEnd-nMaxBreakPos+1; //+1: Before the dickey letter
Reference< XHyphenatedWord > xHyphWord;
if (xHyphenator.is())
@@ -2253,7 +2255,7 @@ sal_uInt16 ImpEditEngine::SplitTextPortion( ParaPortion* pPortion, sal_uInt16 nP
aTmpFont.SetPhysFont( GetRefDevice() );
GetRefDevice()->Push( PUSH_TEXTLANGUAGE );
ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() );
- Size aSz = aTmpFont.QuickGetTextSize( GetRefDevice(), *pPortion->GetNode(), nTxtPortionStart, pTextPortion->GetLen(), NULL );
+ Size aSz = aTmpFont.QuickGetTextSize( GetRefDevice(), pPortion->GetNode()->GetString(), nTxtPortionStart, pTextPortion->GetLen(), NULL );
GetRefDevice()->Pop();
pTextPortion->GetExtraInfos()->nOrgWidth = aSz.Width();
}
@@ -2996,7 +2998,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
if ( pTextPortion->GetKind() == PORTIONKIND_TEXT )
{
- aText = *pPortion->GetNode();
+ aText = pPortion->GetNode()->GetString();
nTextStart = nIndex;
nTextLen = pTextPortion->GetLen();
if (!pLine->GetCharPosArray().empty())
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 63b9402c8ee9..6b17ab7ee079 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2712,8 +2712,9 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
ContentNode* pNode = aEditDoc.GetObject( nNode );
+ const XubString& aNodeStr = pNode->GetString();
xub_StrLen nStartPos = 0;
- xub_StrLen nEndPos = pNode->Len();
+ xub_StrLen nEndPos = aNodeStr.Len();
if ( nNode == nStartNode )
nStartPos = aSel.Min().GetIndex();
if ( nNode == nEndNode ) // can also be == nStart!
@@ -2746,19 +2747,19 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
i18n::Boundary aSttBndry;
i18n::Boundary aEndBndry;
aSttBndry = _xBI->getWordBoundary(
- *pNode, nStartPos,
+ aNodeStr, nStartPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ),
- nWordType, sal_True /*prefer forward direction*/);
+ nWordType, true /*prefer forward direction*/);
aEndBndry = _xBI->getWordBoundary(
- *pNode, nEndPos,
+ aNodeStr, nEndPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ),
- nWordType, sal_False /*prefer backward direction*/);
+ nWordType, false /*prefer backward direction*/);
// prevent backtracking to the previous word if selection is at word boundary
if (aSttBndry.endPos <= nStartPos)
{
aSttBndry = _xBI->nextWord(
- *pNode, aSttBndry.endPos,
+ aNodeStr, aSttBndry.endPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, aSttBndry.endPos + 1 ) ) ),
nWordType);
}
@@ -2766,7 +2767,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
if (aEndBndry.startPos >= nEndPos)
{
aEndBndry = _xBI->previousWord(
- *pNode, aEndBndry.startPos,
+ aNodeStr, aEndBndry.startPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, aEndBndry.startPos + 1 ) ) ),
nWordType);
}
@@ -2779,15 +2780,15 @@ 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( pNode->Copy( nCurrentStart, nLen ) );
+ String aText(aNodeStr.Copy(nCurrentStart, nLen) );
#endif
Sequence< sal_Int32 > aOffsets;
- String aNewText( aTranslitarationWrapper.transliterate( *pNode,
+ String aNewText( aTranslitarationWrapper.transliterate(aNodeStr,
GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ),
nCurrentStart, nLen, &aOffsets ));
- if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
+ if (!aNodeStr.Equals( aNewText, nCurrentStart, nLen ))
{
aChgData.nStart = nCurrentStart;
aChgData.nLen = nLen;
@@ -2801,7 +2802,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
(void) aSelTxt;
#endif
- aCurWordBndry = _xBI->nextWord( *pNode, nCurrentEnd,
+ aCurWordBndry = _xBI->nextWord(aNodeStr, nCurrentEnd,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
nWordType);
}
@@ -2812,18 +2813,18 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
// for 'sentence case' we need to iterate sentence by sentence
sal_Int32 nLastStart = _xBI->beginOfSentence(
- *pNode, nEndPos,
+ aNodeStr, nEndPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ) );
sal_Int32 nLastEnd = _xBI->endOfSentence(
- *pNode, nLastStart,
+ aNodeStr, nLastStart,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ) );
// extend nCurrentStart, nCurrentEnd to the current sentence boundaries
nCurrentStart = _xBI->beginOfSentence(
- *pNode, nStartPos,
+ aNodeStr, nStartPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ) );
nCurrentEnd = _xBI->endOfSentence(
- *pNode, nCurrentStart,
+ aNodeStr, nCurrentStart,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
// prevent backtracking to the previous sentence if selection starts at end of a sentence
@@ -2833,16 +2834,16 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
// are in Asian text with no spaces...)
// Thus to get the real sentence start we should locate the next real word,
// that is one found by DICTIONARY_WORD
- i18n::Boundary aBndry = _xBI->nextWord( *pNode, nCurrentEnd,
+ i18n::Boundary aBndry = _xBI->nextWord( aNodeStr, nCurrentEnd,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
i18n::WordType::DICTIONARY_WORD);
// now get new current sentence boundaries
nCurrentStart = _xBI->beginOfSentence(
- *pNode, aBndry.startPos,
+ aNodeStr, aBndry.startPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) );
nCurrentEnd = _xBI->endOfSentence(
- *pNode, nCurrentStart,
+ aNodeStr, nCurrentStart,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
}
// prevent advancing to the next sentence if selection ends at start of a sentence
@@ -2852,11 +2853,11 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
// are in Asian text with no spaces...)
// Thus to get the real sentence start we should locate the previous real word,
// that is one found by DICTIONARY_WORD
- i18n::Boundary aBndry = _xBI->previousWord( *pNode, nLastStart,
+ i18n::Boundary aBndry = _xBI->previousWord( aNodeStr, nLastStart,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ),
i18n::WordType::DICTIONARY_WORD);
nLastEnd = _xBI->endOfSentence(
- *pNode, aBndry.startPos,
+ aNodeStr, aBndry.startPos,
SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) );
if (nCurrentEnd > nLastEnd)
nCurrentEnd = nLastEnd;
@@ -2867,15 +2868,15 @@ 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( pNode->Copy( nCurrentStart, nLen ) );
+ String aText( aNodeStr.Copy( nCurrentStart, nLen ) );
#endif
Sequence< sal_Int32 > aOffsets;
- String aNewText( aTranslitarationWrapper.transliterate( *pNode,
+ String aNewText( aTranslitarationWrapper.transliterate( aNodeStr,
GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ),
nCurrentStart, nLen, &aOffsets ));
- if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
+ if (!aNodeStr.Equals( aNewText, nCurrentStart, nLen ))
{
aChgData.nStart = nCurrentStart;
aChgData.nLen = nLen;
@@ -2887,12 +2888,12 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
i18n::Boundary aFirstWordBndry;
aFirstWordBndry = _xBI->nextWord(
- *pNode, nCurrentEnd,
+ aNodeStr, nCurrentEnd,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ),
nWordType);
nCurrentStart = aFirstWordBndry.startPos;
nCurrentEnd = _xBI->endOfSentence(
- *pNode, nCurrentStart,
+ aNodeStr, nCurrentStart,
SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) );
}
DBG_ASSERT( nCurrentEnd >= nLastEnd, "failed to reach end of transliteration" );
@@ -2911,9 +2912,9 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
xub_StrLen nLen = nCurrentEnd - nCurrentStart;
Sequence< sal_Int32 > aOffsets;
- String aNewText( aTranslitarationWrapper.transliterate( *pNode, nLanguage, nCurrentStart, nLen, &aOffsets ) );
+ String aNewText( aTranslitarationWrapper.transliterate( aNodeStr, nLanguage, nCurrentStart, nLen, &aOffsets ) );
- if (!pNode->Equals( aNewText, nCurrentStart, nLen ))
+ if (!aNodeStr.Equals( aNewText, nCurrentStart, nLen ))
{
aChgData.nStart = nCurrentStart;
aChgData.nLen = nLen;