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

Armin Le Grand (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 11 18:32:15 UTC 2019


 basctl/source/basicide/sbxitem.cxx     |    3 ++-
 include/item/base/ItemControlBlock.hxx |   10 +++++++++-
 item/source/base/ItemControlBlock.cxx  |    6 ++++--
 item/source/simple/CntInt16.cxx        |    3 ++-
 item/source/simple/CntOUString.cxx     |    3 ++-
 item/test/ItemTest.cxx                 |   12 ++++++++----
 svx/source/items/TransformAnchor.cxx   |    3 ++-
 7 files changed, 29 insertions(+), 11 deletions(-)

New commits:
commit 54ca9cac1871d269cf608ac1d18441849b7be6c2
Author:     Armin Le Grand <Armin.Le.Grand at me.com>
AuthorDate: Thu Apr 11 20:29:49 2019 +0200
Commit:     Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Thu Apr 11 20:29:49 2019 +0200

    WIP: Added a Name to ItemControlBlock
    
    ...and thus to Item-Implementations. Will be needed
    at some time anyways, currently already in the ressources
    and used to stream out infos or similar.
    
    Change-Id: Ie23d839b9444cd3cbc6403c366629bd7d55de542

diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx
index 1243535c22f4..c33c9477c885 100644
--- a/basctl/source/basicide/sbxitem.cxx
+++ b/basctl/source/basicide/sbxitem.cxx
@@ -31,7 +31,8 @@ namespace Item
         static ::Item::ItemControlBlock aItemControlBlock(
             std::shared_ptr<::Item::ItemAdministrator>(new ::Item::IAdministrator_vector()),
             [](){ return new Sbx(Sbx::GetStaticItemControlBlock()); },
-            [](){ return new Sbx(Sbx::GetStaticItemControlBlock()); });
+            [](){ return new Sbx(Sbx::GetStaticItemControlBlock()); },
+            "Sbx");
 
         return aItemControlBlock;
     }
diff --git a/include/item/base/ItemControlBlock.hxx b/include/item/base/ItemControlBlock.hxx
index d61b8e79d07d..daf5d68a9ffd 100755
--- a/include/item/base/ItemControlBlock.hxx
+++ b/include/item/base/ItemControlBlock.hxx
@@ -37,12 +37,14 @@ namespace Item
         std::shared_ptr<const ItemBase>     m_aDefaultItem;
         std::function<ItemBase*()>          m_aConstructDefaultItem;
         std::function<ItemBase*()>          m_aConstructItem;
+        OUString                            m_aName;
 
     public:
         ItemControlBlock(
             const std::shared_ptr<ItemAdministrator>& rItemAdministrator,
             std::function<ItemBase*()>constructDefaultItem,
-            std::function<ItemBase*()>constructItem);
+            std::function<ItemBase*()>constructItem,
+            const OUString& rName);
         ItemControlBlock();
 
         const std::shared_ptr<ItemAdministrator>& GetItemAdministrator()
@@ -58,7 +60,13 @@ namespace Item
         }
 
         std::shared_ptr<const ItemBase> CreateFromAny(const ItemBase::AnyIDArgs& rArgs);
+
         bool IsDefault(const ItemBase& rItem) const;
+
+        const OUString& GetName() const
+        {
+            return m_aName;
+        }
     };
 } // end of namespace Item
 
diff --git a/item/source/base/ItemControlBlock.cxx b/item/source/base/ItemControlBlock.cxx
index ffd32e7c4a86..16f31efcb0d2 100755
--- a/item/source/base/ItemControlBlock.cxx
+++ b/item/source/base/ItemControlBlock.cxx
@@ -17,11 +17,13 @@ namespace Item
     ItemControlBlock::ItemControlBlock(
         const std::shared_ptr<ItemAdministrator>& rItemAdministrator,
         std::function<ItemBase*()>constructDefaultItem,
-        std::function<ItemBase*()>constructItem)
+        std::function<ItemBase*()>constructItem,
+        const OUString& rName)
     :   m_aItemAdministrator(rItemAdministrator),
         m_aDefaultItem(),
         m_aConstructDefaultItem(constructDefaultItem),
-        m_aConstructItem(constructItem)
+        m_aConstructItem(constructItem),
+        m_aName(rName)
     {
         assert(rItemAdministrator && "nullptr not allowed, an ItemAdministrator *is* required (!)");
     }
diff --git a/item/source/simple/CntInt16.cxx b/item/source/simple/CntInt16.cxx
index 9da54cdf2ae7..493d63bcdc1f 100644
--- a/item/source/simple/CntInt16.cxx
+++ b/item/source/simple/CntInt16.cxx
@@ -21,7 +21,8 @@ namespace Item
         static ItemControlBlock aItemControlBlock(
             std::shared_ptr<ItemAdministrator>(new IAdministrator_set()),
             [](){ return new CntInt16(CntInt16::GetStaticItemControlBlock()); },
-            [](){ return new CntInt16(CntInt16::GetStaticItemControlBlock()); });
+            [](){ return new CntInt16(CntInt16::GetStaticItemControlBlock()); },
+            "CntInt16");
 
         return aItemControlBlock;
     }
diff --git a/item/source/simple/CntOUString.cxx b/item/source/simple/CntOUString.cxx
index 47de99947372..c25e7fb9a116 100644
--- a/item/source/simple/CntOUString.cxx
+++ b/item/source/simple/CntOUString.cxx
@@ -21,7 +21,8 @@ namespace Item
         static ItemControlBlock aItemControlBlock(
             std::shared_ptr<ItemAdministrator>(new IAdministrator_unordered_set()),
             [](){ return new CntOUString(CntOUString::GetStaticItemControlBlock()); },
-            [](){ return new CntOUString(CntOUString::GetStaticItemControlBlock()); });
+            [](){ return new CntOUString(CntOUString::GetStaticItemControlBlock()); },
+            "CntOUString");
 
         return aItemControlBlock;
     }
diff --git a/item/test/ItemTest.cxx b/item/test/ItemTest.cxx
index b5c78cb57de4..77a2938148f8 100644
--- a/item/test/ItemTest.cxx
+++ b/item/test/ItemTest.cxx
@@ -34,7 +34,8 @@ namespace Item
             static ItemControlBlock aItemControlBlock(
                 std::shared_ptr<ItemAdministrator>(new IAdministrator_vector()),
                 [](){ return new MultiValueAB(MultiValueAB::GetStaticItemControlBlock()); },
-                [](){ return new MultiValueAB(MultiValueAB::GetStaticItemControlBlock()); });
+                [](){ return new MultiValueAB(MultiValueAB::GetStaticItemControlBlock()); },
+                "MultiValueAB");
 
             return aItemControlBlock;
         }
@@ -121,7 +122,8 @@ namespace Item
             static ItemControlBlock aItemControlBlock(
                 std::shared_ptr<ItemAdministrator>(new IAdministrator_vector()),
                 [](){ return new MultiValueABC(MultiValueABC::GetStaticItemControlBlock()); },
-                [](){ return new MultiValueABC(MultiValueABC::GetStaticItemControlBlock()); });
+                [](){ return new MultiValueABC(MultiValueABC::GetStaticItemControlBlock()); },
+                "MultiValueABC");
 
             return aItemControlBlock;
         }
@@ -200,7 +202,8 @@ namespace Item
             static ItemControlBlock aItemControlBlock(
                 std::shared_ptr<ItemAdministrator>(new IAdministrator_vector()),
                 [](){ return new MultiValueABD(MultiValueABD::GetStaticItemControlBlock()); },
-                [](){ return new MultiValueABD(MultiValueABD::GetStaticItemControlBlock()); });
+                [](){ return new MultiValueABD(MultiValueABD::GetStaticItemControlBlock()); },
+                "MultiValueABD");
 
             return aItemControlBlock;
         }
@@ -243,7 +246,8 @@ namespace Item
             static ItemControlBlock aItemControlBlock(
                 std::shared_ptr<ItemAdministrator>(new IAdministrator_vector()),
                 [](){ return new MultiValueABCD(MultiValueABCD::GetStaticItemControlBlock()); },
-                [](){ return new MultiValueABCD(MultiValueABCD::GetStaticItemControlBlock()); });
+                [](){ return new MultiValueABCD(MultiValueABCD::GetStaticItemControlBlock()); },
+                "MultiValueABCD");
 
             return aItemControlBlock;
         }
diff --git a/svx/source/items/TransformAnchor.cxx b/svx/source/items/TransformAnchor.cxx
index dfef45fb7981..4dc652523917 100755
--- a/svx/source/items/TransformAnchor.cxx
+++ b/svx/source/items/TransformAnchor.cxx
@@ -20,7 +20,8 @@ namespace Item
         static ItemControlBlock aItemControlBlock(
             CntInt16::GetStaticItemControlBlock().GetItemAdministrator(),
             [](){ return new TransformAnchor(TransformAnchor::GetStaticItemControlBlock()); },
-            [](){ return new TransformAnchor(TransformAnchor::GetStaticItemControlBlock()); });
+            [](){ return new TransformAnchor(TransformAnchor::GetStaticItemControlBlock()); },
+            "TransformAnchor");
 
         return aItemControlBlock;
     }


More information about the Libreoffice-commits mailing list