include/svx/sdr/properties/properties.hxx | 3 --- svx/inc/sdr/properties/attributeproperties.hxx | 3 +++ svx/source/sdr/properties/attributeproperties.cxx | 16 ++++++++++++++++ svx/source/sdr/properties/properties.cxx | 15 --------------- 4 files changed, 19 insertions(+), 18 deletions(-)
New commits: commit 93790b70ea663184f758031dc5af311828fe36ad Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Jan 6 22:14:45 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jan 7 11:12:14 2022 +0100 move applyDefaultStyleSheetFromSdrModel from BaseProperties.. to AttributeProperties, since it only applies to AttributeProperties and its sub-classes. Change-Id: I01527f75815659d1cf2a9859888ef04c561633a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128092 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx index 1b74802f0df2..2651530b44ae 100644 --- a/include/svx/sdr/properties/properties.hxx +++ b/include/svx/sdr/properties/properties.hxx @@ -80,9 +80,6 @@ namespace sdr::properties SdrObject& mrObject; protected: - // apply the correct SfyStyleSheet from SdrObject's SdrModel - virtual void applyDefaultStyleSheetFromSdrModel(); - // internal access to SdrObject const SdrObject& GetSdrObject() const; diff --git a/svx/inc/sdr/properties/attributeproperties.hxx b/svx/inc/sdr/properties/attributeproperties.hxx index 1aa45721436c..f542f75e9fc2 100644 --- a/svx/inc/sdr/properties/attributeproperties.hxx +++ b/svx/inc/sdr/properties/attributeproperties.hxx @@ -51,6 +51,9 @@ namespace sdr::properties // react on ItemSet changes virtual void ItemSetChanged(const SfxItemSet*) override; + // apply the correct SfyStyleSheet from SdrObject's SdrModel + virtual void applyDefaultStyleSheetFromSdrModel(); + public: // basic constructor explicit AttributeProperties(SdrObject& rObj); diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index b4624937be09..532e0bc67294 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -523,6 +523,22 @@ namespace sdr::properties } return false; } + + void AttributeProperties::applyDefaultStyleSheetFromSdrModel() + { + SfxStyleSheet* pDefaultStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet()); + + // tdf#118139 Only do this when StyleSheet really differs. It may e.g. + // be the case that nullptr == pDefaultStyleSheet and there is none set yet, + // so indeed no need to set it (needed for some strange old MSWord2003 + // documents with CustomShape-'Group' and added Text-Frames, see task description) + if(pDefaultStyleSheet != GetStyleSheet()) + { + // do not delete hard attributes when setting dsefault Style + SetStyleSheet(pDefaultStyleSheet, true); + } + } + } // end of namespace /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx index 353cdc5ede36..acfb368bc615 100644 --- a/svx/source/sdr/properties/properties.cxx +++ b/svx/source/sdr/properties/properties.cxx @@ -41,21 +41,6 @@ namespace sdr::properties { } - void BaseProperties::applyDefaultStyleSheetFromSdrModel() - { - SfxStyleSheet* pDefaultStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet()); - - // tdf#118139 Only do this when StyleSheet really differs. It may e.g. - // be the case that nullptr == pDefaultStyleSheet and there is none set yet, - // so indeed no need to set it (needed for some strange old MSWord2003 - // documents with CustomShape-'Group' and added Text-Frames, see task description) - if(pDefaultStyleSheet != GetStyleSheet()) - { - // do not delete hard attributes when setting dsefault Style - SetStyleSheet(pDefaultStyleSheet, true); - } - } - const SdrObject& BaseProperties::GetSdrObject() const { return mrObject;