summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2022-05-05 13:45:36 +0200
committerAron Budea <aron.budea@collabora.com>2023-02-14 08:01:19 +0000
commit7dfa3da02c32aacea2992aa3dfcf8cf3301cdd28 (patch)
tree1988ca036ed9f61a20036c6ebb9e107089e14443 /svx
parent24bbb260ce1a6968d757f2fcf66d7ba9b4854dba (diff)
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 <hossein@libreoffice.org> (cherry picked from commit 759792e40aceb17a621c37ed725d1e998acbd30d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146390 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Aron Budea <aron.budea@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/unoshtxt.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 23c772daa1da..d4b6ddddb791 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( std::nullopt, mpText );
}
else
{
- pTextObj->NbcSetOutlinerParaObjectForText( std::nullopt, mpText );
+ pTextObj->NbcSetOutlinerParaObjectForText( mpOutliner->CreateParaObject(), mpText );
}
}