svx/source/unodraw/unoshtxt.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit 18ad97d122fbaf7f120502fa73cea773dfe38455 Author: Maxim Monastirsky <momonas...@gmail.com> AuthorDate: Sun Mar 26 09:59:09 2023 +0300 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Apr 20 21:21:32 2023 +0200 tdf#154882: svx: don't overwrite the first cell's style i.e. new Draw document, change the char formatting in the default drawing style (e.g. font size), insert a table and fill its cells with text. Save and reload. After reload the first cell inherits the formatting of the default DS, instead of its assigned cell style. But dragging the table around shows the correct formatting in the dragging overlay, and it's also correct when copy & pasting the table. This is caused by the order of things at import, as a table is created initially with a single cell at least, and it gets its cell style assignment too early. There is also similar code to what is changed here in SdrTextObj:: BegTextEdit, and it's rightfully overridden by SdrTableObj. This appears to be a regression from 4-0, but I'm not sure which commit and what exactly changed there. Change-Id: Id096c7b5f330d6abd8f5b01c96448a9d8aac8001 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149616 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonas...@gmail.com> (cherry picked from commit f0287aad967761d46cb6903fc0d985a536408176) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150716 Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index 168212aaa159..2743ccbaf6ee 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -592,7 +592,10 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() // its empty, so we have to force the outliner to initialise itself mpOutliner->SetText( "", mpOutliner->GetParagraph( 0 ) ); - if(mpObject->GetStyleSheet()) + auto pCell = dynamic_cast<sdr::table::Cell*>(mpText); + if (pCell && pCell->GetStyleSheet()) + mpOutliner->SetStyleSheet( 0, pCell->GetStyleSheet()); + else if (mpObject->GetStyleSheet()) mpOutliner->SetStyleSheet( 0, mpObject->GetStyleSheet()); } }