svx/source/unodraw/unoshtxt.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit f0287aad967761d46cb6903fc0d985a536408176
Author:     Maxim Monastirsky <momonas...@gmail.com>
AuthorDate: Sun Mar 26 09:59:09 2023 +0300
Commit:     Maxim Monastirsky <momonas...@gmail.com>
CommitDate: Sun Mar 26 10:25:36 2023 +0000

    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>

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());
             }
         }

Reply via email to