summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2022-05-05 13:45:36 +0200
committerAron Budea <aron.budea@collabora.com>2023-02-08 04:45:06 +0000
commitd26a532651312a200ed88f43a8e67ee2ce7083b9 (patch)
tree1a25331f201039588c8445bfb9b8f1e8c1e2e6e7
parente3d413f46c4b4c8a044ef487711be961fbcdbc6f (diff)
tdf#148818 Fix missing text in boxes with empty first paragraphdistro/collabora/co-2021
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/+/146426 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Aron Budea <aron.budea@collabora.com>
-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 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 );
}
}