summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2023-03-26 09:59:09 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2023-03-26 10:25:36 +0000
commitf0287aad967761d46cb6903fc0d985a536408176 (patch)
treee741c1c9c96435d6b1cd01f264e9b27028e2ab31 /svx
parent8361cef32d54d2dec32e22c35c6d77ca792ae90a (diff)
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 <momonasmon@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/unoshtxt.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 525ee88abd77..580b3c2f65a0 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -588,7 +588,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());
}
}