svx/source/unodraw/unoshtxt.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
New commits: commit d26a532651312a200ed88f43a8e67ee2ce7083b9 Author: Hossein <hoss...@libreoffice.org> AuthorDate: Thu May 5 13:45:36 2022 +0200 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Wed Feb 8 04:45:06 2023 +0000 tdf#148818 Fix missing text in boxes with empty first paragraph Text was lost from the text boxes with empty first paragraph. The problem was happening when there was 2 paragraphs in a text box, in which the first paragraph was completely empty. The regression was introduced in cf2449aac0141711a7610d67f7c50cd108e12443 because of the bad handling of the paragraphs, and only looking at the size of the text of the first paragraph. This is fixed by looking at mpOutliner->GetEditEngine().GetTextLen(i) for all i=1..k where k=min(2,mpOutliner->GetParagraphCount()). I have negated the condition to provide a better explanation of what the condition should be. Change-Id: Id5d8787df5111c734760afdd98a6fbe832047f32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133527 Tested-by: Jenkins Reviewed-by: Hossein <hoss...@libreoffice.org> (cherry picked from commit 759792e40aceb17a621c37ed725d1e998acbd30d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146426 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Aron Budea <aron.bu...@collabora.com> diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index e6d80c17ffe1..a11ca30de502 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -775,14 +775,15 @@ void SvxTextEditSourceImpl::UpdateData() SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( mpObject ); if( pTextObj ) { - if( (mpOutliner->GetParagraphCount() != 1 && mpOutliner->GetParagraphCount() != 2) - || mpOutliner->GetEditEngine().GetTextLen( 0 ) ) + if( (mpOutliner->GetParagraphCount() == 1 && mpOutliner->GetEditEngine().GetTextLen( 0 ) == 0 ) + || (mpOutliner->GetParagraphCount() == 2 && mpOutliner->GetEditEngine().GetTextLen( 0 ) == 0 + && mpOutliner->GetEditEngine().GetTextLen( 1 ) == 0) ) { - pTextObj->NbcSetOutlinerParaObjectForText( mpOutliner->CreateParaObject(), mpText ); + pTextObj->NbcSetOutlinerParaObjectForText( nullptr, mpText ); } else { - pTextObj->NbcSetOutlinerParaObjectForText( nullptr,mpText ); + pTextObj->NbcSetOutlinerParaObjectForText( mpOutliner->CreateParaObject(), mpText ); } }