include/svx/sdr/properties/properties.hxx | 4 - svx/inc/sdr/properties/groupproperties.hxx | 28 ++---------- svx/source/sdr/properties/groupproperties.cxx | 57 ++++---------------------- 3 files changed, 18 insertions(+), 71 deletions(-)
New commits: commit b2bd92f4a59b2ef3e98bc4eaba3ef750562ca10e Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Jan 7 08:17:31 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jan 7 15:38:08 2022 +0100 fix hierarchy in comment Change-Id: Ieaf94ce6ce524c4c017cbe1bb82fa75bd5f7e801 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128094 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 2651530b44ae..cf9f491099ed 100644 --- a/include/svx/sdr/properties/properties.hxx +++ b/include/svx/sdr/properties/properties.hxx @@ -66,9 +66,9 @@ namespace sdr::properties // OleProperties // CellProperties // TableProperties -// GroupProperties +// GroupProperties // EmptyProperties -// PageProperties +// PageProperties namespace sdr::properties { commit c037ff2a2d1c83eb8fc0595e335dd8174b9062fc Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Jan 7 07:54:00 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jan 7 15:37:53 2022 +0100 make GroupProperties extend BaseProperties it doesn't need any of the logic in DefaultProperties Change-Id: I75d56a29f1edf2819c22a1fd69df464948544aaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128093 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/svx/inc/sdr/properties/groupproperties.hxx b/svx/inc/sdr/properties/groupproperties.hxx index 1496a24c3eab..bfb2a8374129 100644 --- a/svx/inc/sdr/properties/groupproperties.hxx +++ b/svx/inc/sdr/properties/groupproperties.hxx @@ -20,28 +20,16 @@ #ifndef INCLUDED_SVX_INC_SDR_PROPERTIES_GROUPPROPERTIES_HXX #define INCLUDED_SVX_INC_SDR_PROPERTIES_GROUPPROPERTIES_HXX -#include <svx/sdr/properties/defaultproperties.hxx> - +#include <svx/sdr/properties/properties.hxx> +#include <svl/itemset.hxx> +#include <optional> namespace sdr::properties { - class GroupProperties final : public DefaultProperties + class GroupProperties final : public BaseProperties { - // create a new itemset - virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) override; - - // test changeability for a single item - virtual bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) const override; - - // Do the ItemChange, may do special handling - virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; - - // Called after ItemChange() is done for all items. - virtual void PostItemChange(const sal_uInt16 nWhich) override; - - // react on ItemSet changes - virtual void ItemSetChanged(const SfxItemSet*) override; - + // the to be used ItemSet + mutable std::optional<SfxItemSet> mxItemSet; public: // basic constructor explicit GroupProperties(SdrObject& rObj); @@ -96,10 +84,6 @@ namespace sdr::properties // get the local StyleSheet virtual SfxStyleSheet* GetStyleSheet() const override; - // force default attributes for a specific object type, called from - // DefaultProperties::GetObjectItemSet() if a new ItemSet is created - virtual void ForceDefaultAttributes() override; - // force all attributes which come from styles to hard attributes // to be able to live without the style. virtual void ForceStyleToHardAttributes() override; diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx index dd66e8891d9c..f2dc5b9388cb 100644 --- a/svx/source/sdr/properties/groupproperties.cxx +++ b/svx/source/sdr/properties/groupproperties.cxx @@ -20,31 +20,25 @@ #include <sal/config.h> #include <sdr/properties/groupproperties.hxx> +#include <sdr/properties/itemsettools.hxx> #include <svl/itemset.hxx> #include <svl/whiter.hxx> #include <svx/svdogrp.hxx> #include <svx/svdpage.hxx> +#include <svx/svdtrans.hxx> +#include <svx/svdmodel.hxx> #include <osl/diagnose.h> namespace sdr::properties { - // create a new itemset - SfxItemSet GroupProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) - { - // Groups have in principle no ItemSet. To support methods like - // GetMergedItemSet() the local one is used. Thus, all items in the pool - // may be used and a pool itemset is created. - return SfxItemSet(rPool); - } - GroupProperties::GroupProperties(SdrObject& rObj) - : DefaultProperties(rObj) + : BaseProperties(rObj) { } - GroupProperties::GroupProperties(const GroupProperties& rProps, SdrObject& rObj) - : DefaultProperties(rProps, rObj) + GroupProperties::GroupProperties(const GroupProperties& , SdrObject& rObj) + : BaseProperties(rObj) { } @@ -54,28 +48,24 @@ namespace sdr::properties std::unique_ptr<BaseProperties> GroupProperties::Clone(SdrObject& rObj) const { - return std::unique_ptr<BaseProperties>(new GroupProperties(*this, rObj)); + return std::unique_ptr<BaseProperties>(new GroupProperties(rObj)); } const SfxItemSet& GroupProperties::GetObjectItemSet() const { assert(!"GroupProperties::GetObjectItemSet() should never be called"); - return DefaultProperties::GetObjectItemSet(); + abort(); } const SfxItemSet& GroupProperties::GetMergedItemSet() const { // prepare ItemSet if(mxItemSet) - { // clear local itemset for merge mxItemSet->ClearItem(); - } - else - { + else if(!mxItemSet) // force local itemset - DefaultProperties::GetObjectItemSet(); - } + mxItemSet.emplace(GetSdrObject().GetObjectItemPool()); // collect all ItemSets in mpItemSet const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList()); @@ -128,7 +118,6 @@ namespace sdr::properties // Do not call parent here. Group objects do not have local ItemSets // where items need to be set. - // DefaultProperties::SetMergedItemSet(rSet, bClearAllItems); } void GroupProperties::SetObjectItem(const SfxPoolItem& /*rItem*/) @@ -193,27 +182,6 @@ namespace sdr::properties assert(!"GroupProperties::SetObjectItemSet() should never be called"); } - void GroupProperties::ItemSetChanged(const SfxItemSet* /*pSet*/) - { - assert(!"GroupProperties::ItemSetChanged() should never be called"); - } - - bool GroupProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const - { - assert(!"GroupProperties::AllowItemChange() should never be called"); - return false; - } - - void GroupProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) - { - assert(!"GroupProperties::ItemChange() should never be called"); - } - - void GroupProperties::PostItemChange(const sal_uInt16 /*nWhich*/) - { - assert(!"GroupProperties::PostItemChange() should never be called"); - } - SfxStyleSheet* GroupProperties::GetStyleSheet() const { SfxStyleSheet* pRetval = nullptr; @@ -255,11 +223,6 @@ namespace sdr::properties } } - void GroupProperties::ForceDefaultAttributes() - { - // nothing to do here, groups have no items and thus no default items, too. - } - void GroupProperties::ForceStyleToHardAttributes() { const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList());