include/svx/sdr/properties/defaultproperties.hxx |   27 +++++++++-----
 include/svx/sdr/properties/properties.hxx        |   21 -----------
 svx/inc/sdr/properties/emptyproperties.hxx       |   18 ---------
 svx/inc/sdr/properties/pageproperties.hxx        |   32 ++++++++++-------
 svx/source/sdr/properties/emptyproperties.cxx    |   38 --------------------
 svx/source/sdr/properties/pageproperties.cxx     |   42 ++++++++++++-----------
 6 files changed, 60 insertions(+), 118 deletions(-)

New commits:
commit c52aa97b988aeeb16d1eb21262889f565b8a72a3
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Thu Jan 6 21:19:51 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jan 7 11:11:59 2022 +0100

    move some methods BaseProperties->DefaultProperties
    
    These methods are part of the implementation of DefaultProperties,
    so they do not belong in a superclass
    
    Change-Id: I553f5d5b771aa0a408a8ade25f009cc56f829c72
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128091
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svx/sdr/properties/defaultproperties.hxx 
b/include/svx/sdr/properties/defaultproperties.hxx
index b7e5d706aff1..38cb31c1710f 100644
--- a/include/svx/sdr/properties/defaultproperties.hxx
+++ b/include/svx/sdr/properties/defaultproperties.hxx
@@ -39,20 +39,27 @@ namespace sdr::properties
             // the to be used ItemSet
             mutable std::optional<SfxItemSet> mxItemSet;
 
-            // create a new itemset
-            virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& rPool) 
override;
+            // create a new object specific itemset with object specific 
ranges.
+            virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool);
 
-            // test changeability for a single item
-            virtual bool AllowItemChange(const sal_uInt16 nWhich, const 
SfxPoolItem* pNewItem = nullptr) const override;
+            // Test changeability for a single item. If an implementation 
wants to prevent
+            // changing an item it should override this method.
+            virtual bool AllowItemChange(const sal_uInt16 nWhich, const 
SfxPoolItem* pNewItem = nullptr) const;
 
-            // Do the ItemChange, may do special handling
-            virtual void ItemChange(const sal_uInt16 nWhich, const 
SfxPoolItem* pNewItem = nullptr) override;
+            // Do the internal ItemChange. If only nWhich is given, the item 
needs to be cleared.
+            // Also needs to handle if nWhich and pNewItem is 0, which means 
to clear all items.
+            virtual void ItemChange(const sal_uInt16 nWhich, const 
SfxPoolItem* pNewItem = nullptr);
 
-            // Called after ItemChange() is done for all items.
-            virtual void PostItemChange(const sal_uInt16 nWhich) override;
+            // Called after ItemChange() is done for all items. Allows local 
reactions on
+            // specific item changes
+            virtual void PostItemChange(const sal_uInt16 nWhich);
 
-            // react on ItemSet changes
-            virtual void ItemSetChanged(const SfxItemSet*) override;
+            // Internally react on ItemSet changes. The given ItemSet contains 
all changed items, the new ones.
+            virtual void ItemSetChanged(const SfxItemSet*);
+
+            // Subclasses need to return true if they want the 
ItemSetChanged() callback to actually have a non-zero pointer.
+            // We do this because creating the temporary item set is expensive 
and seldom used.
+            virtual bool WantItemSetInItemSetChanged() const { return false; }
 
             // check if SfxItemSet exists
             bool HasSfxItemSet() const { return bool(mxItemSet); }
diff --git a/include/svx/sdr/properties/properties.hxx 
b/include/svx/sdr/properties/properties.hxx
index f27aa5d39d3e..1b74802f0df2 100644
--- a/include/svx/sdr/properties/properties.hxx
+++ b/include/svx/sdr/properties/properties.hxx
@@ -83,32 +83,11 @@ namespace sdr::properties
             // apply the correct SfyStyleSheet from SdrObject's SdrModel
             virtual void applyDefaultStyleSheetFromSdrModel();
 
-            // create a new object specific itemset with object specific 
ranges.
-            virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool& pPool) 
= 0;
-
             // internal access to SdrObject
             const SdrObject& GetSdrObject() const;
 
             SdrObject& GetSdrObject();
 
-            // Test changeability for a single item. If an implementation 
wants to prevent
-            // changing an item it should override this method.
-            virtual bool AllowItemChange(const sal_uInt16 nWhich, const 
SfxPoolItem* pNewItem = nullptr) const = 0;
-
-            // Do the internal ItemChange. If only nWhich is given, the item 
needs to be cleared.
-            // Also needs to handle if nWhich and pNewItem is 0, which means 
to clear all items.
-            virtual void ItemChange(const sal_uInt16 nWhich, const 
SfxPoolItem* pNewItem = nullptr) = 0;
-
-            // Called after ItemChange() is done for all items. Allows local 
reactions on
-            // specific item changes
-            virtual void PostItemChange(const sal_uInt16 nWhich) = 0;
-
-            // Internally react on ItemSet changes. The given ItemSet contains 
all changed items, the new ones.
-            virtual void ItemSetChanged(const SfxItemSet*) = 0;
-            // Subclasses need to return true if they want the 
ItemSetChanged() callback to actually have a non-zero pointer.
-            // We do this because creating the temporary item set is expensive 
and seldom used.
-            virtual bool WantItemSetInItemSetChanged() const { return false; }
-
         public:
             // basic constructor, used from SdrObject.
             explicit BaseProperties(SdrObject& rObj);
diff --git a/svx/inc/sdr/properties/emptyproperties.hxx 
b/svx/inc/sdr/properties/emptyproperties.hxx
index b1afcf74a1f6..89deec42f3bd 100644
--- a/svx/inc/sdr/properties/emptyproperties.hxx
+++ b/svx/inc/sdr/properties/emptyproperties.hxx
@@ -35,21 +35,6 @@ namespace sdr::properties
             // the to be used ItemSet
             mutable std::optional<SfxItemSet> mxEmptyItemSet;
 
-            // 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;
-
         public:
             // basic constructor
             explicit EmptyProperties(SdrObject& rObj);
diff --git a/svx/inc/sdr/properties/pageproperties.hxx 
b/svx/inc/sdr/properties/pageproperties.hxx
index 7f801d2e99b7..5473c692812d 100644
--- a/svx/inc/sdr/properties/pageproperties.hxx
+++ b/svx/inc/sdr/properties/pageproperties.hxx
@@ -31,21 +31,6 @@ namespace sdr::properties
             // 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;
-
-            // 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;
-
-            // 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);
diff --git a/svx/source/sdr/properties/emptyproperties.cxx 
b/svx/source/sdr/properties/emptyproperties.cxx
index 42af61012a8a..d8e13d47a410 100644
--- a/svx/source/sdr/properties/emptyproperties.cxx
+++ b/svx/source/sdr/properties/emptyproperties.cxx
@@ -26,14 +26,6 @@
 
 namespace sdr::properties
 {
-        // create a new itemset
-        SfxItemSet EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool& )
-        {
-            // Basic implementation; Basic object has NO attributes
-            assert(!"EmptyProperties::CreateObjectSpecificItemSet() should 
never be called");
-            abort();
-        }
-
         EmptyProperties::EmptyProperties(SdrObject& rObj)
         :   BaseProperties(rObj)
         {
@@ -75,27 +67,6 @@ namespace sdr::properties
             assert(!"EmptyProperties::SetObjectItemSet() should never be 
called");
         }
 
-        void EmptyProperties::ItemSetChanged(const SfxItemSet* /*pSet*/)
-        {
-            assert(!"EmptyProperties::ItemSetChanged() should never be 
called");
-        }
-
-        bool EmptyProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, 
const SfxPoolItem* /*pNewItem*/) const
-        {
-            assert(!"EmptyProperties::AllowItemChange() should never be 
called");
-            return true;
-        }
-
-        void EmptyProperties::ItemChange(const sal_uInt16 /*nWhich*/, const 
SfxPoolItem* /*pNewItem*/)
-        {
-            assert(!"EmptyProperties::ItemChange() should never be called");
-        }
-
-        void EmptyProperties::PostItemChange(const sal_uInt16 /*nWhich*/)
-        {
-            assert(!"EmptyProperties::PostItemChange() should never be 
called");
-        }
-
         void EmptyProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, 
bool /*bDontRemoveHardAttr*/)
         {
             assert(!"EmptyProperties::SetStyleSheet() should never be called");
diff --git a/svx/source/sdr/properties/pageproperties.cxx 
b/svx/source/sdr/properties/pageproperties.cxx
index 8ae0cda8d2ed..63d35f4a75a7 100644
--- a/svx/source/sdr/properties/pageproperties.cxx
+++ b/svx/source/sdr/properties/pageproperties.cxx
@@ -28,13 +28,6 @@
 
 namespace sdr::properties
 {
-        // create a new itemset
-        SfxItemSet PageProperties::CreateObjectSpecificItemSet(SfxItemPool& 
rPool)
-        {
-            // override to legally return a valid ItemSet
-            return SfxItemSet(rPool);
-        }
-
         PageProperties::PageProperties(SdrObject& rObj)
         :   BaseProperties(rObj)
         {
@@ -60,7 +53,7 @@ namespace sdr::properties
         {
             if(!mxEmptyItemSet)
             {
-                
mxEmptyItemSet.emplace(const_cast<PageProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool()));
+                mxEmptyItemSet.emplace(GetSdrObject().GetObjectItemPool());
             }
 
             DBG_ASSERT(mxEmptyItemSet, "Could not create an SfxItemSet(!)");
@@ -68,11 +61,6 @@ namespace sdr::properties
             return *mxEmptyItemSet;
         }
 
-        void PageProperties::ItemChange(const sal_uInt16 /*nWhich*/, const 
SfxPoolItem* /*pNewItem*/)
-        {
-            // #86481# simply ignore item setting on page objects
-        }
-
         SfxStyleSheet* PageProperties::GetStyleSheet() const
         {
             // override to legally return a 0L pointer here
@@ -84,28 +72,11 @@ namespace sdr::properties
             // override to legally ignore the StyleSheet here
         }
 
-        void PageProperties::PostItemChange(const sal_uInt16 nWhich )
-        {
-            if( (nWhich == XATTR_FILLSTYLE) && mxEmptyItemSet )
-                CleanupFillProperties(*mxEmptyItemSet);
-        }
-
         void PageProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
         {
             // 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");
commit 81ccab11ff457786c3877e7b0047d08685493d3c
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Thu Jan 6 20:59:08 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jan 7 11:11:44 2022 +0100

    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.gran...@collabora.co.uk>

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: */

Reply via email to