diff options
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 5 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 1 | ||||
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 13 |
3 files changed, 15 insertions, 4 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index cae8822cd48e..84b2f39df32d 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1666,7 +1666,7 @@ bool EditEngine::IsInSelectionMode() const pImpEditEngine->GetSelEngine().IsInSelection() ); } -void EditEngine::InsertParagraph( sal_Int32 nPara, const EditTextObject& rTxtObj ) +void EditEngine::InsertParagraph( sal_Int32 nPara, const EditTextObject& rTxtObj, bool bAppend ) { if ( nPara > GetParagraphCount() ) { @@ -1683,6 +1683,9 @@ void EditEngine::InsertParagraph( sal_Int32 nPara, const EditTextObject& rTxtObj pImpEditEngine->RemoveCharAttribs( nPara ); pImpEditEngine->InsertText( rTxtObj, EditSelection( aPaM, aPaM ) ); + if ( bAppend && nPara ) + pImpEditEngine->ConnectContents( nPara-1, /*bBackwards=*/false ); + pImpEditEngine->UndoActionEnd(); pImpEditEngine->FormatAndUpdate(); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 976a94ea2f1a..99603db06493 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -3921,7 +3921,6 @@ EditPaM ImpEditEngine::ConnectContents( sal_Int32 nLeftNode, bool bBackward ) ContentNode* pRightNode = aEditDoc.GetObject( nLeftNode+1 ); DBG_ASSERT( pLeftNode, "Invalid left node in ConnectContents "); DBG_ASSERT( pRightNode, "Invalid right node in ConnectContents "); - DBG_ASSERT( IsInUndo(), "ConnectContent only for Undo()!" ); return ImpConnectParagraphs( pLeftNode, pRightNode, bBackward ); } diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 2d757fb23c9d..320dc6958355 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -602,7 +602,7 @@ void Outliner::SetText( const OutlinerParaObject& rPObj ) DBG_ASSERT( pEditEngine->GetParagraphCount()==rPObj.Count(),"SetText failed"); } -void Outliner::AddText( const OutlinerParaObject& rPObj ) +void Outliner::AddText( const OutlinerParaObject& rPObj, bool bAppend ) { bool bUpdate = pEditEngine->GetUpdateMode(); @@ -615,16 +615,25 @@ void Outliner::AddText( const OutlinerParaObject& rPObj ) pParaList->Clear(); pEditEngine->SetText(rPObj.GetTextObject()); nPara = 0; + bAppend = false; } else { nPara = pParaList->GetParagraphCount(); - pEditEngine->InsertParagraph( EE_PARA_APPEND, rPObj.GetTextObject() ); + pEditEngine->InsertParagraph( EE_PARA_APPEND, rPObj.GetTextObject(), bAppend ); } bFirstParaIsEmpty = false; for( sal_Int32 n = 0; n < rPObj.Count(); n++ ) { + if ( n == 0 && bAppend ) + { + // This first "paragraph" was just appended to an existing (incomplete) paragraph. + // Since no new paragraph will be added, the assumed increase-by-1 also won't happen. + --nPara; + continue; + } + Paragraph* pPara = new Paragraph( rPObj.GetParagraphData(n) ); pParaList->Append(std::unique_ptr<Paragraph>(pPara)); sal_Int32 nP = nPara+n; |