Lines 2712-2732
EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS
Link Here
|
2712 |
// Token LINE_SEP query, |
2712 |
// Token LINE_SEP query, |
2713 |
// since the MAC-Compiler makes something else from \n ! |
2713 |
// since the MAC-Compiler makes something else from \n ! |
2714 |
|
2714 |
|
2715 |
sal_uInt16 nStart = 0; |
2715 |
// fdo#39869 The loop run variable must be capable to hold STRLEN_MAX+1, |
|
|
2716 |
// that with STRING32 would be SAL_MAX_INT32+1 but with 16-bit is 0xFFFF+1 |
2717 |
sal_uInt32 nStart = 0; |
2716 |
while ( nStart < aText.Len() ) |
2718 |
while ( nStart < aText.Len() ) |
2717 |
{ |
2719 |
{ |
2718 |
sal_uInt16 nEnd = aText.Search( LINE_SEP, nStart ); |
2720 |
sal_uInt32 nEnd = aText.Search( LINE_SEP, static_cast<xub_StrLen>(nStart) ); |
2719 |
if ( nEnd == STRING_NOTFOUND ) |
2721 |
if ( nEnd == STRING_NOTFOUND ) |
2720 |
nEnd = aText.Len(); // not dereference! |
2722 |
nEnd = aText.Len(); // not dereference! |
2721 |
|
2723 |
|
2722 |
// Start == End => empty line |
2724 |
// Start == End => empty line |
2723 |
if ( nEnd > nStart ) |
2725 |
if ( nEnd > nStart ) |
2724 |
{ |
2726 |
{ |
2725 |
XubString aLine( aText, nStart, nEnd-nStart ); |
2727 |
XubString aLine( aText, nStart, static_cast<xub_StrLen>(nEnd-nStart) ); |
2726 |
xub_StrLen nChars = aPaM.GetNode()->Len() + aLine.Len(); |
2728 |
xub_StrLen nChars = aPaM.GetNode()->Len() + aLine.Len(); |
2727 |
if ( nChars > MAXCHARSINPARA ) |
2729 |
if ( nChars > MAXCHARSINPARA ) |
2728 |
{ |
2730 |
{ |
2729 |
sal_uInt16 nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len(); |
2731 |
xub_StrLen nMaxNewChars = MAXCHARSINPARA-aPaM.GetNode()->Len(); |
2730 |
nEnd -= ( aLine.Len() - nMaxNewChars ); // Then the characters end up in the next paragraph. |
2732 |
nEnd -= ( aLine.Len() - nMaxNewChars ); // Then the characters end up in the next paragraph. |
2731 |
aLine.Erase( nMaxNewChars ); // Delete the Rest... |
2733 |
aLine.Erase( nMaxNewChars ); // Delete the Rest... |
2732 |
} |
2734 |
} |
Lines 2737-2751
EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rS
Link Here
|
2737 |
aPaM = aEditDoc.InsertText( aPaM, aLine ); |
2739 |
aPaM = aEditDoc.InsertText( aPaM, aLine ); |
2738 |
else |
2740 |
else |
2739 |
{ |
2741 |
{ |
2740 |
sal_uInt16 nStart2 = 0; |
2742 |
sal_uInt32 nStart2 = 0; |
2741 |
while ( nStart2 < aLine.Len() ) |
2743 |
while ( nStart2 < aLine.Len() ) |
2742 |
{ |
2744 |
{ |
2743 |
sal_uInt16 nEnd2 = aLine.Search( '\t', nStart2 ); |
2745 |
sal_uInt32 nEnd2 = aLine.Search( '\t', static_cast<xub_StrLen>(nStart2) ); |
2744 |
if ( nEnd2 == STRING_NOTFOUND ) |
2746 |
if ( nEnd2 == STRING_NOTFOUND ) |
2745 |
nEnd2 = aLine.Len(); // not dereference! |
2747 |
nEnd2 = aLine.Len(); // not dereference! |
2746 |
|
2748 |
|
2747 |
if ( nEnd2 > nStart2 ) |
2749 |
if ( nEnd2 > nStart2 ) |
2748 |
aPaM = aEditDoc.InsertText( aPaM, XubString( aLine, nStart2, nEnd2-nStart2 ) ); |
2750 |
aPaM = aEditDoc.InsertText( aPaM, XubString( aLine, |
|
|
2751 |
static_cast<xub_StrLen>(nStart2), |
2752 |
static_cast<xub_StrLen>(nEnd2-nStart2) ) ); |
2749 |
if ( nEnd2 < aLine.Len() ) |
2753 |
if ( nEnd2 < aLine.Len() ) |
2750 |
{ |
2754 |
{ |
2751 |
aPaM = aEditDoc.InsertFeature( aPaM, aTabItem ); |
2755 |
aPaM = aEditDoc.InsertFeature( aPaM, aTabItem ); |
2752 |
-------------erAck-patch-parts-- |
|
|