summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-01-06 20:59:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-07 11:11:44 +0100
commit81ccab11ff457786c3877e7b0047d08685493d3c (patch)
tree7804409292816864d8f21fe8d2f1397e7de1fb80 /svx
parent2692dc5f662c74e3df63224ae829fc492503aa1e (diff)
split PageProperties from EmptyProperties
to make it clearer - PageProperties just ignores stuff, but it is not a logic error to set props on it (or so it seems from its comments) Change-Id: Iba3dbcdffae6165a14e9a2d71e4111fbbd29febb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128090 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/sdr/properties/emptyproperties.hxx3
-rw-r--r--svx/inc/sdr/properties/pageproperties.hxx31
-rw-r--r--svx/source/sdr/properties/emptyproperties.cxx13
-rw-r--r--svx/source/sdr/properties/pageproperties.cxx35
4 files changed, 63 insertions, 19 deletions
diff --git a/svx/inc/sdr/properties/emptyproperties.hxx b/svx/inc/sdr/properties/emptyproperties.hxx
index af3b393456eb..b1afcf74a1f6 100644
--- a/svx/inc/sdr/properties/emptyproperties.hxx
+++ b/svx/inc/sdr/properties/emptyproperties.hxx
@@ -30,9 +30,8 @@
namespace sdr::properties
{
- class EmptyProperties : public BaseProperties
+ class EmptyProperties final : public BaseProperties
{
- protected:
// the to be used ItemSet
mutable std::optional<SfxItemSet> mxEmptyItemSet;
diff --git a/svx/inc/sdr/properties/pageproperties.hxx b/svx/inc/sdr/properties/pageproperties.hxx
index 7bd5c213fbc4..7f801d2e99b7 100644
--- a/svx/inc/sdr/properties/pageproperties.hxx
+++ b/svx/inc/sdr/properties/pageproperties.hxx
@@ -20,13 +20,17 @@
#ifndef INCLUDED_SVX_INC_SDR_PROPERTIES_PAGEPROPERTIES_HXX
#define INCLUDED_SVX_INC_SDR_PROPERTIES_PAGEPROPERTIES_HXX
-#include <sdr/properties/emptyproperties.hxx>
-
+#include <svx/sdr/properties/properties.hxx>
+#include <svl/itemset.hxx>
+#include <optional>
namespace sdr::properties
{
- class PageProperties final : public EmptyProperties
+ class PageProperties final : public BaseProperties
{
+ // the to be used ItemSet
+ mutable std::optional<SfxItemSet> mxEmptyItemSet;
+
// create a new object specific itemset with object specific ranges.
virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) override;
@@ -36,6 +40,12 @@ namespace sdr::properties
// Called after ItemChange() is done for all items.
virtual void PostItemChange(const sal_uInt16 nWhich) override;
+ // test changeability for a single item
+ virtual bool AllowItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) const override;
+
+ // react on ItemSet changes
+ virtual void ItemSetChanged(const SfxItemSet*) override;
+
public:
// basic constructor
explicit PageProperties(SdrObject& rObj);
@@ -49,8 +59,6 @@ namespace sdr::properties
// Clone() operator, normally just calls the local copy constructor
virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override;
- // get itemset. Override here to allow creating the empty itemset
- // without asserting
virtual const SfxItemSet& GetObjectItemSet() const override;
// get the installed StyleSheet
@@ -61,6 +69,19 @@ namespace sdr::properties
// clear single item
virtual void ClearObjectItem(const sal_uInt16 nWhich = 0) override;
+
+ // set single item
+ virtual void SetObjectItem(const SfxPoolItem& rItem) override;
+
+ // set single item direct, do not do any notifies or things like that
+ virtual void SetObjectItemDirect(const SfxPoolItem& rItem) override;
+
+ // clear single item direct, do not do any notifies or things like that.
+ // Also supports complete deletion of items when default parameter 0 is used.
+ virtual void ClearObjectItemDirect(const sal_uInt16 nWhich) override;
+
+ // set complete item set
+ virtual void SetObjectItemSet(const SfxItemSet& rSet) override;
};
} // end of namespace sdr::properties
diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx
index ac30ef4d89d2..42af61012a8a 100644
--- a/svx/source/sdr/properties/emptyproperties.cxx
+++ b/svx/source/sdr/properties/emptyproperties.cxx
@@ -27,11 +27,11 @@
namespace sdr::properties
{
// create a new itemset
- SfxItemSet EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
+ SfxItemSet EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool& )
{
// Basic implementation; Basic object has NO attributes
assert(!"EmptyProperties::CreateObjectSpecificItemSet() should never be called");
- return SfxItemSet(rPool);
+ abort();
}
EmptyProperties::EmptyProperties(SdrObject& rObj)
@@ -46,15 +46,8 @@ namespace sdr::properties
const SfxItemSet& EmptyProperties::GetObjectItemSet() const
{
- if(!mxEmptyItemSet)
- {
- mxEmptyItemSet.emplace(const_cast<EmptyProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()));
- }
-
- assert(mxEmptyItemSet);
assert(!"EmptyProperties::GetObjectItemSet() should never be called");
-
- return *mxEmptyItemSet;
+ abort();
}
void EmptyProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
diff --git a/svx/source/sdr/properties/pageproperties.cxx b/svx/source/sdr/properties/pageproperties.cxx
index ed75133f929f..8ae0cda8d2ed 100644
--- a/svx/source/sdr/properties/pageproperties.cxx
+++ b/svx/source/sdr/properties/pageproperties.cxx
@@ -36,12 +36,12 @@ namespace sdr::properties
}
PageProperties::PageProperties(SdrObject& rObj)
- : EmptyProperties(rObj)
+ : BaseProperties(rObj)
{
}
PageProperties::PageProperties(const PageProperties& /*rProps*/, SdrObject& rObj)
- : EmptyProperties(rObj)
+ : BaseProperties(rObj)
{
}
@@ -94,6 +94,37 @@ namespace sdr::properties
{
// simply ignore item clearing on page objects
}
+
+ bool PageProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
+ {
+ assert(!"PageProperties::AllowItemChange() should never be called");
+ return true;
+ }
+
+ void PageProperties::ItemSetChanged(const SfxItemSet* /*pSet*/)
+ {
+ assert(!"PageProperties::ItemSetChanged() should never be called");
+ }
+
+ void PageProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
+ {
+ assert(!"PageProperties::SetObjectItem() should never be called");
+ }
+
+ void PageProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
+ {
+ assert(!"PageProperties::SetObjectItemDirect() should never be called");
+ }
+
+ void PageProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
+ {
+ assert(!"PageProperties::ClearObjectItemDirect() should never be called");
+ }
+
+ void PageProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
+ {
+ assert(!"PageProperties::SetObjectItemSet() should never be called");
+ }
} // end of namespace
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */