[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - basctl/source include/item include/svl item/Library_item.mk item/source item/test sfx2/source svl/source svx/source

Armin Le Grand (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 12 16:23:05 UTC 2019


 basctl/source/basicide/sbxitem.cxx     |    2 
 include/item/base/ItemControlBlock.hxx |    2 
 include/item/base/ItemSet.hxx          |  115 ++++++++-------------------------
 include/item/base/SlotSet.hxx          |   89 -------------------------
 include/svl/itemset.hxx                |    4 -
 item/Library_item.mk                   |    1 
 item/source/base/ItemControlBlock.cxx  |    4 -
 item/source/base/ItemSet.cxx           |  100 ++++++++++++++++++++++++++++
 item/source/base/SlotSet.cxx           |   56 ----------------
 item/source/simple/CntInt16.cxx        |    2 
 item/source/simple/CntOUString.cxx     |    2 
 item/test/ItemTest.cxx                 |    8 +-
 sfx2/source/appl/appuno.cxx            |   20 +++++
 sfx2/source/control/dispatch.cxx       |    4 -
 svl/source/items/itemset.cxx           |   12 ---
 svx/source/items/TransformAnchor.cxx   |    4 -
 16 files changed, 163 insertions(+), 262 deletions(-)

New commits:
commit 0d81dd6c99fac78210208c244babaa7d6218337e
Author:     Armin Le Grand <Armin.Le.Grand at me.com>
AuthorDate: Fri Apr 12 18:14:51 2019 +0200
Commit:     Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Fri Apr 12 18:14:51 2019 +0200

    WIP: Three changes:
    
    ItemControlBlock: Made ConstructDefaultItem optional. If given,
    a explicit default to be created can be defined, else the
    ConstructItem will be used to construct the default item.
    
    ItemSet: Optimized to make the template methods as small as
    possible due to tese being expanded by each type when compiled.
    Also allowed me to move static fallback items completely
    to *.cxx file.
    
    SlotSet: Completely removed for now. The strategy is to solely
    use ItemSet - under the vost that for each Item a type has to
    be defined (by derivation). Something like SlotSet may also be
    used in the future if a combination of the new Items and identifier
    is needed for some reason. In principle, everyone is able to use
    and handle ::BaseItem shared_ptr's as wanted - keep them in an
    array or whetever. In principle there is no need for specialized
    classes handling these - ::ItemSet is only for convenience and to
    have a transition point
    
    Change-Id: Ic6bfa9598a560acde22a124f6e3c893a595f9ac9

diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx
index c33c9477c885..e4d7e0b5e84a 100644
--- a/basctl/source/basicide/sbxitem.cxx
+++ b/basctl/source/basicide/sbxitem.cxx
@@ -30,7 +30,7 @@ namespace Item
     {
         static ::Item::ItemControlBlock aItemControlBlock(
             std::shared_ptr<::Item::ItemAdministrator>(new ::Item::IAdministrator_vector()),
-            [](){ return new Sbx(Sbx::GetStaticItemControlBlock()); },
+            nullptr,
             [](){ return new Sbx(Sbx::GetStaticItemControlBlock()); },
             "Sbx");
 
diff --git a/include/item/base/ItemControlBlock.hxx b/include/item/base/ItemControlBlock.hxx
index daf5d68a9ffd..5f658e8c4b07 100755
--- a/include/item/base/ItemControlBlock.hxx
+++ b/include/item/base/ItemControlBlock.hxx
@@ -30,6 +30,8 @@ namespace Item
     class ItemAdministrator;
     class ItemBase;
 
+    // The ConstructDefaultItem may be zero, instead the
+    // ConstructItem lambda will be used
     class ITEM_DLLPUBLIC ItemControlBlock
     {
     private:
diff --git a/include/item/base/ItemSet.hxx b/include/item/base/ItemSet.hxx
index 142fe53d4467..b5a19316f7e0 100644
--- a/include/item/base/ItemSet.hxx
+++ b/include/item/base/ItemSet.hxx
@@ -212,26 +212,6 @@ namespace Item
         };
 
     private:
-        // helper class for an ImplInvalidateItem - placeholder for InvaidateState
-        // SfxItemState::DONTCARE -> IsInvalidItem -> pItem == INVALID_POOL_ITEM -> reinterpret_cast<SfxPoolItem*>(-1)
-        class ImplInvalidateItem : public ItemBase
-        {
-        private:
-            ItemControlBlock m_aItemControlBlock;
-        public:
-            ImplInvalidateItem() : ItemBase(m_aItemControlBlock), m_aItemControlBlock() {}
-        };
-
-        // helper class for a ImplDisableItem - placeholder for InvaidateState
-        // SfxItemState::DISABLED -> IsVoidItem() -> instance of SfxVoidItem, virtual bool IsVoidItem()
-        class ImplDisableItem : public ItemBase
-        {
-        private:
-            ItemControlBlock m_aItemControlBlock;
-        public:
-            ImplDisableItem() : ItemBase(m_aItemControlBlock), m_aItemControlBlock() {}
-        };
-
         // the Parent of this ItemSet
         SharedPtr m_aParent;
 
@@ -242,21 +222,13 @@ namespace Item
         // the items as content
         std::unordered_map<size_t, std::shared_ptr<const ItemBase>> m_aItems;
 
-        // single global static instance for helper class ImplInvalidateItem
-        static const std::shared_ptr<const ItemBase>& getInvalidateItem()
-        {
-            static std::shared_ptr<const ItemBase> aImplInvalidateItem(new ImplInvalidateItem());
-
-            return aImplInvalidateItem;
-        }
-
-        // single global static instance for helper class ImplDisableItem
-        static const std::shared_ptr<const ItemBase>& getDisableItem()
-        {
-            static std::shared_ptr<const ItemBase> aImplDisableItem(new ImplDisableItem());
-
-            return aImplDisableItem;
-        }
+        // helpers for reduction of template member implementations,
+        // all based on typeid(<type>).hash_code()
+        const ItemBase* implGetStateAndItem(size_t hash_code, IState& rIState, bool bSearchParent) const;
+        void implInvalidateItem(size_t hash_code);
+        void implDisableItem(size_t hash_code);
+        void implGetDefault(std::shared_ptr<const ItemBase>& rRetval) const;
+        bool implClearItem(size_t hash_code);
 
     protected:
         // constructor - protected BY DEFAULT - do NOT CHANGE (!)
@@ -278,19 +250,23 @@ namespace Item
         static SharedPtr Create(const ModelSpecificItemValues::SharedPtr& rModelSpecificIValues);
 
         const ModelSpecificItemValues::SharedPtr& GetModelSpecificIValues() const;
+        void SetItem(const std::shared_ptr<const ItemBase>& rItem);
+        void SetItems(const ItemSet& rSource, bool bDontCareToDefault = true);
+
+        // from here are all the type-specific template methods,
+        // as reduced as possible due to these being unfolded from
+        // the compiler for each class.
+        // reduction uses local immp methods wherever possible, based
+        // on the fetched TypeID
 
         template< typename TItem > void InvalidateItem()
         {
-            const size_t hash_code(typeid(TItem).hash_code());
-
-            m_aItems[hash_code] = getInvalidateItem();
+            implInvalidateItem(typeid(TItem).hash_code());
         }
 
         template< typename TItem > void DisableItem()
         {
-            const size_t hash_code(typeid(TItem).hash_code());
-
-            m_aItems[hash_code] = getDisableItem();
+            implDisableItem(typeid(TItem).hash_code());
         }
 
         template< typename TItem > std::shared_ptr<const TItem> GetDefault() const
@@ -299,64 +275,35 @@ namespace Item
             std::shared_ptr<const ItemBase> aRetval(TItem::GetStaticItemControlBlock().GetDefaultItem());
             assert(aRetval && "empty std::shared_ptr<const ItemBase> not allowed for default (!)");
 
-            if(m_aModelSpecificIValues)
-            {
-                // may use model-specific default, get from helper
-                // helper *will* fallback to ItemBase default
-                aRetval = m_aModelSpecificIValues->GetDefault(aRetval);
-            }
+            // maybe overridden by model-specific default
+            implGetDefault(aRetval);
 
             return std::static_pointer_cast<const TItem>(aRetval);
         }
 
-        void SetItem(const std::shared_ptr<const ItemBase>& rItem);
-
         template< typename TItem > StateAndItem<TItem> GetStateAndItem(bool bSearchParent = true) const
         {
-            const size_t hash_code(typeid(TItem).hash_code());
-            const auto aRetval(m_aItems.find(hash_code));
+            IState aIState(IState::DEFAULT);
+            const ItemBase* pItem(implGetStateAndItem(typeid(TItem).hash_code(), aIState, bSearchParent));
 
-            if(aRetval != m_aItems.end()) // && aRetval->second)
+            // SfxItemState::DEFAULT
+            if(IState::DEFAULT == aIState)
             {
-                assert(aRetval->second && "empty std::shared_ptr<const ItemBase> set in ItemSet (!)");
-
-                if(aRetval->second.get() == getInvalidateItem().get())
-                {
-                    // SfxItemState::DONTCARE
-                    return StateAndItem<TItem>(IState::DONTCARE, std::shared_ptr<TItem>());
-                }
-
-                if(aRetval->second.get() == getDisableItem().get())
-                {
-                    // SfxItemState::DISABLED
-                    return StateAndItem<TItem>(IState::DISABLED, std::shared_ptr<TItem>());
-                }
-
-                // SfxItemState::SET
-                return StateAndItem<TItem>(IState::SET, std::static_pointer_cast<TItem>(aRetval->second));
-            }
-
-            // not set
-            if(bSearchParent && m_aParent)
-            {
-                // continue searching in parent
-                return m_aParent->GetStateAndItem<TItem>(true);
-            }
-            else
-            {
-                // SfxItemState::DEFAULT
                 return StateAndItem<TItem>(IState::DEFAULT, GetDefault<TItem>());
             }
+
+            // SfxItemState::DONTCARE or SfxItemState::DISABLED
+            // or SfxItemState::SET when not nullptr
+            return StateAndItem<TItem>(aIState,
+                nullptr == pItem
+                    ? std::shared_ptr<TItem>()
+                    : std::static_pointer_cast<TItem>(pItem->shared_from_this()));
         }
 
         template< typename TItem > bool ClearItem()
         {
-            const size_t hash_code(typeid(TItem).hash_code());
-
-            return (0 != m_aItems.erase(hash_code));
+            return implClearItem(typeid(TItem).hash_code());
         }
-
-        void SetItems(const ItemSet& rSource, bool bDontCareToDefault = true);
     };
 } // end of namespace Item
 
diff --git a/include/item/base/SlotSet.hxx b/include/item/base/SlotSet.hxx
deleted file mode 100755
index 74a144e677a8..000000000000
--- a/include/item/base/SlotSet.hxx
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_ITEM_BASE_SLOTSET_HXX
-#define INCLUDED_ITEM_BASE_SLOTSET_HXX
-
-#include <cassert>
-#include <item/base/ModelSpecificItemValues.hxx>
-//#include <item/base/ItemControlBlock.hxx>
-
-///////////////////////////////////////////////////////////////////////////////
-
-namespace Item
-{
-    class ITEM_DLLPUBLIC SlotSet : public std::enable_shared_from_this<SlotSet>
-    {
-    public:
-        // SharedPtr typedef to be used handling instances of this type
-        typedef std::shared_ptr<SlotSet> SharedPtr;
-        typedef size_t SlotID;
-
-    private:
-        // the slots as content
-        std::unordered_map<SlotID, std::shared_ptr<const ItemBase>> m_aSlots;
-
-    protected:
-        // constructor - protected BY DEFAULT - do NOT CHANGE (!)
-        // Use ::Create(...) method instead
-        SlotSet();
-
-    public:
-        virtual ~SlotSet();
-
-        bool empty() const
-        {
-            return m_aSlots.empty();
-        }
-
-        // noncopyable
-        SlotSet(const SlotSet&) = delete;
-        SlotSet& operator=(const SlotSet&) = delete;
-
-        // SharedPtr-construtcor
-        static SharedPtr Create();
-
-        void SetSlot(SlotID aSlotID, const std::shared_ptr<const ItemBase>& rItem);
-        void SetSlots(const SlotSet& rSlotSet);
-
-        template< typename TargetType > const std::shared_ptr<const TargetType> GetSlot(SlotID aSlotID) const
-        {
-            const auto aRetval(m_aSlots.find(aSlotID));
-
-            if(aRetval != m_aSlots.end()) // && aRetval->second)
-            {
-                assert(aRetval->second && "empty std::shared_ptr<const ItemBase> set in SlotSet (!)");
-                assert(typeid(*aRetval->second) == typeid(TargetType) && "wrong std::shared_ptr<const ItemBase> type in SlotSet (!)");
-
-                return std::static_pointer_cast<TargetType>(aRetval->second);
-            }
-
-            return std::static_pointer_cast<const TargetType>(TargetType::GetStaticItemControlBlock().GetDefaultItem());
-        }
-
-        bool ClearSlot(SlotID aSlotID);
-        void ClearAllSlots();
-    };
-} // end of namespace Item
-
-///////////////////////////////////////////////////////////////////////////////
-
-#endif // INCLUDED_ITEM_BASE_SLOTSET_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx
index 0f435f8e22cf..453b571e0d41 100644
--- a/include/svl/itemset.hxx
+++ b/include/svl/itemset.hxx
@@ -33,7 +33,6 @@
 
 // I2TM
 #include <item/base/ItemSet.hxx>
-#include <item/base/SlotSet.hxx>
 // ~I2TM
 
 class SfxItemPool;
@@ -237,12 +236,9 @@ public:
     // I2TM Transfer phase:
 private:
     Item::ItemSet::SharedPtr        m_aItemSetSharedPtr;
-    Item::SlotSet::SharedPtr        m_aSlotSetSharedPtr;
 public:
     // - deliver Item::ItemSet for this SfxItemSet
     Item::ItemSet& itemSet() const;
-    // - deliver Item::SlotSet for this SfxItemSet
-    Item::SlotSet& slotSet() const;
     // ~I2TM
 };
 
diff --git a/item/Library_item.mk b/item/Library_item.mk
index f59247140a1f..523567e8e72c 100644
--- a/item/Library_item.mk
+++ b/item/Library_item.mk
@@ -35,7 +35,6 @@ $(eval $(call gb_Library_add_exception_objects,item,\
     item/source/base/ItemAdministrator \
     item/source/base/ModelSpecificItemValues \
     item/source/base/ItemSet \
-    item/source/base/SlotSet \
     item/source/base/ItemControlBlock \
     item/source/simple/CntInt16 \
     item/source/simple/CntOUString \
diff --git a/item/source/base/ItemControlBlock.cxx b/item/source/base/ItemControlBlock.cxx
index 16f31efcb0d2..1e194f901177 100755
--- a/item/source/base/ItemControlBlock.cxx
+++ b/item/source/base/ItemControlBlock.cxx
@@ -26,6 +26,7 @@ namespace Item
         m_aName(rName)
     {
         assert(rItemAdministrator && "nullptr not allowed, an ItemAdministrator *is* required (!)");
+        assert(constructItem != nullptr && "nullptr not allowed, a Item-Constructor *is* required (!)");
     }
 
     ItemControlBlock::ItemControlBlock()
@@ -40,7 +41,8 @@ namespace Item
     {
         if(!m_aDefaultItem)
         {
-            const_cast<ItemControlBlock*>(this)->m_aDefaultItem.reset(m_aConstructDefaultItem());
+            const_cast<ItemControlBlock*>(this)->m_aDefaultItem.reset(
+                nullptr != m_aConstructDefaultItem ? m_aConstructDefaultItem() : m_aConstructItem());
         }
 
         return m_aDefaultItem;
diff --git a/item/source/base/ItemSet.cxx b/item/source/base/ItemSet.cxx
index 7a8a58b2dabd..65c73fbdad35 100644
--- a/item/source/base/ItemSet.cxx
+++ b/item/source/base/ItemSet.cxx
@@ -14,6 +14,106 @@
 
 namespace Item
 {
+    // single global static instance for helper class ImplInvalidateItem
+    static const std::shared_ptr<const ItemBase>& getInvalidateItem()
+    {
+        // helper class for an ImplInvalidateItem - placeholder for InvaidateState
+        // SfxItemState::DONTCARE -> IsInvalidItem -> pItem == INVALID_POOL_ITEM -> reinterpret_cast<SfxPoolItem*>(-1)
+        class ImplInvalidateItem : public ItemBase
+        {
+        private:
+            ItemControlBlock m_aItemControlBlock;
+        public:
+            ImplInvalidateItem() : ItemBase(m_aItemControlBlock), m_aItemControlBlock() {}
+        };
+
+        static std::shared_ptr<const ItemBase> aImplInvalidateItem(new ImplInvalidateItem());
+
+        return aImplInvalidateItem;
+    }
+
+    // single global static instance for helper class ImplDisableItem
+    static const std::shared_ptr<const ItemBase>& getDisableItem()
+    {
+        // helper class for a ImplDisableItem - placeholder for InvaidateState
+        // SfxItemState::DISABLED -> IsVoidItem() -> instance of SfxVoidItem, virtual bool IsVoidItem()
+        class ImplDisableItem : public ItemBase
+        {
+        private:
+            ItemControlBlock m_aItemControlBlock;
+        public:
+            ImplDisableItem() : ItemBase(m_aItemControlBlock), m_aItemControlBlock() {}
+        };
+
+        static std::shared_ptr<const ItemBase> aImplDisableItem(new ImplDisableItem());
+
+        return aImplDisableItem;
+    }
+
+    const ItemBase* ItemSet::implGetStateAndItem(size_t hash_code, IState& rIState, bool bSearchParent) const
+    {
+        const auto aRetval(m_aItems.find(hash_code));
+
+        if(aRetval != m_aItems.end()) // && aRetval->second)
+        {
+            assert(aRetval->second && "empty std::shared_ptr<const ItemBase> set in ItemSet (!)");
+
+            if(aRetval->second.get() == getInvalidateItem().get())
+            {
+                // SfxItemState::DONTCARE
+                rIState = IState::DONTCARE;
+                return nullptr;
+            }
+
+            if(aRetval->second.get() == getDisableItem().get())
+            {
+                // SfxItemState::DISABLED
+                rIState = IState::DISABLED;
+                return nullptr;
+            }
+
+            // SfxItemState::SET
+            rIState = IState::SET;
+            return aRetval->second.get();
+        }
+
+        // not set
+        if(bSearchParent && m_aParent)
+        {
+            // continue searching in parent
+            return m_aParent->implGetStateAndItem(hash_code, rIState, bSearchParent);
+        }
+
+        // SfxItemState::DEFAULT
+        // already handed in as default - no need to set explicitely // rIState = IState::DEFAULT;
+        return nullptr;
+    }
+
+    void ItemSet::implInvalidateItem(size_t hash_code)
+    {
+        m_aItems[hash_code] = getInvalidateItem();
+    }
+
+    void ItemSet::implDisableItem(size_t hash_code)
+    {
+        m_aItems[hash_code] = getDisableItem();
+    }
+
+    void ItemSet::implGetDefault(std::shared_ptr<const ItemBase>& rRetval) const
+    {
+        if(m_aModelSpecificIValues)
+        {
+            // may use model-specific default, get from helper
+            // helper *will* fallback to ItemBase default
+            rRetval = m_aModelSpecificIValues->GetDefault(rRetval);
+        }
+    }
+
+    bool ItemSet::implClearItem(size_t hash_code)
+    {
+        return (0 != m_aItems.erase(hash_code));
+    }
+
     ItemSet::ItemSet(const ModelSpecificItemValues::SharedPtr& rModelSpecificIValues)
     :   std::enable_shared_from_this<ItemSet>(),
         m_aParent(),
diff --git a/item/source/base/SlotSet.cxx b/item/source/base/SlotSet.cxx
deleted file mode 100755
index 1783caba9baf..000000000000
--- a/item/source/base/SlotSet.cxx
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <cassert>
-#include <item/base/SlotSet.hxx>
-
-///////////////////////////////////////////////////////////////////////////////
-
-namespace Item
-{
-    SlotSet::SlotSet()
-    :   std::enable_shared_from_this<SlotSet>(),
-        m_aSlots()
-    {
-    }
-
-    SlotSet::~SlotSet()
-    {
-    }
-
-    SlotSet::SharedPtr SlotSet::Create()
-    {
-        return SlotSet::SharedPtr(new SlotSet());
-    }
-
-    void SlotSet::SetSlot(SlotID aSlotID, const std::shared_ptr<const ItemBase>& rItem)
-    {
-        assert(rItem && "empty std::shared_ptr<const ItemBase> not allowed - and should be unable to be created (!)");
-        m_aSlots[aSlotID] = rItem;
-    }
-
-    void SlotSet::SetSlots(const SlotSet& rSlotSet)
-    {
-        m_aSlots.insert(rSlotSet.m_aSlots.begin(), rSlotSet.m_aSlots.end());
-    }
-
-    bool SlotSet::ClearSlot(SlotID aSlotID)
-    {
-        return (0 != m_aSlots.erase(aSlotID));
-    }
-
-    void SlotSet::ClearAllSlots()
-    {
-        m_aSlots.clear();
-    }
-} // end of namespace Item
-
-///////////////////////////////////////////////////////////////////////////////
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/item/source/simple/CntInt16.cxx b/item/source/simple/CntInt16.cxx
index 493d63bcdc1f..f300e318cefc 100644
--- a/item/source/simple/CntInt16.cxx
+++ b/item/source/simple/CntInt16.cxx
@@ -20,7 +20,7 @@ namespace Item
     {
         static ItemControlBlock aItemControlBlock(
             std::shared_ptr<ItemAdministrator>(new IAdministrator_set()),
-            [](){ return new CntInt16(CntInt16::GetStaticItemControlBlock()); },
+            nullptr,
             [](){ return new CntInt16(CntInt16::GetStaticItemControlBlock()); },
             "CntInt16");
 
diff --git a/item/source/simple/CntOUString.cxx b/item/source/simple/CntOUString.cxx
index c25e7fb9a116..1f9e5c52e10c 100644
--- a/item/source/simple/CntOUString.cxx
+++ b/item/source/simple/CntOUString.cxx
@@ -20,7 +20,7 @@ namespace Item
     {
         static ItemControlBlock aItemControlBlock(
             std::shared_ptr<ItemAdministrator>(new IAdministrator_unordered_set()),
-            [](){ return new CntOUString(CntOUString::GetStaticItemControlBlock()); },
+            nullptr,
             [](){ return new CntOUString(CntOUString::GetStaticItemControlBlock()); },
             "CntOUString");
 
diff --git a/item/test/ItemTest.cxx b/item/test/ItemTest.cxx
index 77a2938148f8..5cc0de4ce341 100644
--- a/item/test/ItemTest.cxx
+++ b/item/test/ItemTest.cxx
@@ -33,7 +33,7 @@ namespace Item
         {
             static ItemControlBlock aItemControlBlock(
                 std::shared_ptr<ItemAdministrator>(new IAdministrator_vector()),
-                [](){ return new MultiValueAB(MultiValueAB::GetStaticItemControlBlock()); },
+                nullptr,
                 [](){ return new MultiValueAB(MultiValueAB::GetStaticItemControlBlock()); },
                 "MultiValueAB");
 
@@ -121,7 +121,7 @@ namespace Item
         {
             static ItemControlBlock aItemControlBlock(
                 std::shared_ptr<ItemAdministrator>(new IAdministrator_vector()),
-                [](){ return new MultiValueABC(MultiValueABC::GetStaticItemControlBlock()); },
+                nullptr,
                 [](){ return new MultiValueABC(MultiValueABC::GetStaticItemControlBlock()); },
                 "MultiValueABC");
 
@@ -201,7 +201,7 @@ namespace Item
         {
             static ItemControlBlock aItemControlBlock(
                 std::shared_ptr<ItemAdministrator>(new IAdministrator_vector()),
-                [](){ return new MultiValueABD(MultiValueABD::GetStaticItemControlBlock()); },
+                nullptr,
                 [](){ return new MultiValueABD(MultiValueABD::GetStaticItemControlBlock()); },
                 "MultiValueABD");
 
@@ -245,7 +245,7 @@ namespace Item
         {
             static ItemControlBlock aItemControlBlock(
                 std::shared_ptr<ItemAdministrator>(new IAdministrator_vector()),
-                [](){ return new MultiValueABCD(MultiValueABCD::GetStaticItemControlBlock()); },
+                nullptr,
                 [](){ return new MultiValueABCD(MultiValueABCD::GetStaticItemControlBlock()); },
                 "MultiValueABCD");
 
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 2fc973fe0a78..dd31555c1a05 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -243,7 +243,19 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert
                 std::shared_ptr<const Item::ItemBase> aSlotItem(pType->CreateSlotItem(aArgs));
                 if(aSlotItem)
                 {
-                    rSet.slotSet().SetSlot(nWhich, aSlotItem);
+                    // I2TM To make this work, a correct typed Item
+                    // has to be defined in the corresponding *.sdi file, e.g.
+                    // for SID_BASICIDE_ARG_SBX this is
+                    //  (basctl::Item::Sbx Sbx SID_BASICIDE_ARG_SBX)
+                    // in sfx2\sdi\sfx.sdi. When all Items shall be added to
+                    // an Item::ItemSet in the long run, for each to-be-separated
+                    // Item an own Type will have to be implemented. This is the
+                    // cost for having a pure type-based Item-System.
+                    // Currently only the basctl::Item::Sbx is changed, so for
+                    // now will be safe to use Item::ItemSet
+                    //
+                    // rSet.slotSet().SetSlot(nWhich, aSlotItem);
+                    rSet.itemSet().SetItem(aSlotItem);
                 }
                 else
                 {
@@ -328,7 +340,11 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert
                     std::shared_ptr<const Item::ItemBase> aSlotItem(pType->CreateSlotItem(aArgs));
                     if(aSlotItem)
                     {
-                        rSet.slotSet().SetSlot(nWhich, aSlotItem);
+                        // I2TM See comment for this line above for
+                        // important more info (!)
+                        //
+                        // rSet.slotSet().SetSlot(nWhich, aSlotItem);
+                        rSet.itemSet().SetItem(aSlotItem);
                     }
                     else
                     {
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 413647e65bfc..711c6edc8923 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -74,10 +74,6 @@
 #include <slotserv.hxx>
 #include <workwin.hxx>
 
-// I2TM
-#include <item/base/SlotSet.hxx>
-// ~I2TM
-
 typedef std::vector<SfxShell*> SfxShellStack_Impl;
 
 struct SfxToDo_Impl
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index a01ed32d583e..d3f1ea2e9a16 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -185,7 +185,6 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet )
     , m_nCount( rASet.m_nCount )
 // I2TM copy shared ptrs - no clone
     , m_aItemSetSharedPtr(rASet.m_aItemSetSharedPtr)
-    , m_aSlotSetSharedPtr(rASet.m_aSlotSetSharedPtr)
 // ~I2TM
 {
     // Calculate the attribute count
@@ -544,7 +543,6 @@ bool SfxItemSet::Put( const SfxItemSet& rSet, bool bInvalidAsDefault )
 
 // I2TM
     itemSet().SetItems(rSet.itemSet(), bInvalidAsDefault);
-    slotSet().SetSlots(rSet.slotSet());
 // ~I2TM
 
     return bRet;
@@ -1496,16 +1494,6 @@ Item::ItemSet& SfxItemSet::itemSet() const
 
     return *m_aItemSetSharedPtr;
 }
-
-Item::SlotSet& SfxItemSet::slotSet() const
-{
-    if(!m_aSlotSetSharedPtr)
-    {
-        const_cast<SfxItemSet*>(this)->m_aSlotSetSharedPtr = Item::SlotSet::Create();
-    }
-
-    return *m_aSlotSetSharedPtr;
-}
 // ~I2TM
 
 // ----------------------------------------------- class SfxAllItemSet
diff --git a/svx/source/items/TransformAnchor.cxx b/svx/source/items/TransformAnchor.cxx
index 4dc652523917..12cade78b1c9 100755
--- a/svx/source/items/TransformAnchor.cxx
+++ b/svx/source/items/TransformAnchor.cxx
@@ -18,8 +18,8 @@ namespace Item
     ItemControlBlock& TransformAnchor::GetStaticItemControlBlock()
     {
         static ItemControlBlock aItemControlBlock(
-            CntInt16::GetStaticItemControlBlock().GetItemAdministrator(),
-            [](){ return new TransformAnchor(TransformAnchor::GetStaticItemControlBlock()); },
+            std::shared_ptr<ItemAdministrator>(new IAdministrator_set()),
+            nullptr,
             [](){ return new TransformAnchor(TransformAnchor::GetStaticItemControlBlock()); },
             "TransformAnchor");
 


More information about the Libreoffice-commits mailing list