From 717dc8e3575a18e1e18dc446031e6db4e60a873d Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 15 Jul 2021 01:14:15 +0300 Subject: tdf#143315: restore the stylesheet after clearing outliner object Prior to commit c4f615b359be56e88e4fbf9aaaf30affb29d57e2, pObj passed to SvxMSDffManager::ReadObjText was not initializing its properties (no call to AttributeProperties::GetObjectItemSet() happened) until call to CreateParaObject in the end of the function. Then it finally initialized, and called applyDefaultStyleSheetFromSdrModel, which applied the obtained stylesheet to the nodes of the outliner object, and resulted in OutlinerParaObject having correct style name in its ContentInfo structures, which then went into pObj. The mentioned commit added calls to SdrTextObj::GetTextColumns* in SdrOutliner::SetTextObj, called by SdrTextObj::ImpGetDrawOutliner indirectly. These calls initialize the object properties, and the stylesheet gets applied to the SdrOutliner and its empty node early. Then the call to Outliner::Init and Outliner::Clear resulted in the node being destroyed and re-created without stylesheet info. Then in AttributeProperties::GetObjectItemSet called from CreateParaObject, re-initialization does not happen, because the item set exists. When exporting to OOXML, the missing stylesheet required to use pool default value, which led to bullet being exported. The previous behavior relied on fragile and unspecified assumption. Instead, now we call SetStyleSheet after all operations, to make sure that the stylesheet information is present in the final data. Change-Id: I14de9017e4af92a2eaf12b3a0e090b0db7fcc759 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118961 Tested-by: Mike Kaganski Reviewed-by: Mike Kaganski --- filter/source/msfilter/msdffimp.cxx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'filter') diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index f7176c186a77..783609c4ca24 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -3668,6 +3668,9 @@ void SvxMSDffManager::ReadObjText( const OUString& rText, SdrObject* pObj ) rOutliner.Clear(); rOutliner.SetUpdateMode( bOldUpdateMode ); pText->SetOutlinerParaObject( std::move(pNewText) ); + // tdf#143315: restore stylesheet applied to Outliner's nodes when SdrTextObj initializes + // its attributes, but removed by Outliner::Init, which calls Outliner::Clear. + pText->SetStyleSheet(pText->GetStyleSheet(), true); } //static -- cgit