[Libreoffice-commits] core.git: Branch 'feature/item_refactor2' - 2 commits - basctl/source cui/source include/item include/sfx2 include/svx item/source item/test sfx2/source svx/Library_svxcore.mk svx/source sw/source
Armin Le Grand (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 10 09:59:39 UTC 2019
basctl/source/basicide/basides1.cxx | 90 ++++++++++-------
basctl/source/basicide/bastype2.cxx | 40 +++----
basctl/source/basicide/moduldl2.cxx | 40 +++----
basctl/source/basicide/moduldlg.cxx | 160 +++++++++++++++----------------
basctl/source/basicide/sbxitem.cxx | 7 +
cui/source/tabpages/swpossizetabpage.cxx | 8 -
include/item/base/ItemBase.hxx | 3
include/sfx2/dispatch.hxx | 8 -
include/svx/item/TransformAnchor.hxx | 39 +++++++
item/source/base/ItemBase.cxx | 16 +--
item/source/simple/CntInt16.cxx | 7 -
item/source/simple/CntOUString.cxx | 6 -
item/test/ItemTest.cxx | 23 +---
sfx2/source/control/dispatch.cxx | 26 +++--
svx/Library_svxcore.mk | 2
svx/source/items/TransformAnchor.cxx | 52 ++++++++++
sw/source/uibase/shells/drwbassh.cxx | 11 +-
17 files changed, 332 insertions(+), 206 deletions(-)
New commits:
commit 520ea875cba4dbb40193d73924131045b76bb363
Author: Armin Le Grand <Armin.Le.Grand at me.com>
AuthorDate: Wed Apr 10 11:56:52 2019 +0200
Commit: Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Wed Apr 10 11:56:52 2019 +0200
WIP: Replaced SID_ATTR_TRANSFORM_ANCHOR with Item
by implementing Item::TransformAnchor and using it
type-safe. This is an example of a direct derive
from an existing (simple) Item (CntInt16) and thus
re-using the same ItemAdministrator.
Slightly adapted implementations and tests
Change-Id: I1a0222f04f59130bb51e29e3871d0bf7766b84ee
diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx
index bb5e518f72ce..33b3adca54e7 100644
--- a/basctl/source/basicide/sbxitem.cxx
+++ b/basctl/source/basicide/sbxitem.cxx
@@ -70,8 +70,13 @@ namespace Item
bool Sbx::operator==(const ItemBase& rCandidate) const
{
- assert(ItemBase::operator==(rCandidate));
+ if(ItemBase::operator==(rCandidate)) // compares ptrs
+ {
+ return true;
+ }
+
const Sbx& rCand(static_cast<const Sbx&>(rCandidate));
+
return (GetDocument() == rCand.GetDocument()
&& GetLibName() == rCand.GetLibName()
&& GetName() == rCand.GetName()
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 2c81c13b124c..e8fc7daba175 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -35,7 +35,7 @@
#include <svx/dialogs.hrc>
// I2TM
-#include <item/simple/CntInt16.hxx>
+#include <svx/item/TransformAnchor.hxx>
// ~I2TM
using namespace ::com::sun::star::text;
@@ -751,7 +751,7 @@ bool SvxSwPosSizeTabPage::FillItemSet( SfxItemSet* rSet)
if(bAnchorChanged)
{
// I2TM
- rSet->slotSet().SetSlot(SID_ATTR_TRANSFORM_ANCHOR, Item::CntInt16::Create(static_cast<sal_Int16>(nAnchor)));
+ rSet->itemSet().SetItem(Item::TransformAnchor::Create(nAnchor));
// ~I2TM
bModified = true;
}
@@ -900,9 +900,9 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet)
RndStdIds nAnchorType = RndStdIds::FLY_AT_PARA;
// I2TM
- if(const auto Slot(rSet->slotSet().GetSlot<const Item::CntInt16>(SID_ATTR_TRANSFORM_ANCHOR)); Slot)
+ if(const auto Item(rSet->itemSet().GetStateAndItem<const Item::TransformAnchor>()); Item.HasItem())
{
- nAnchorType = static_cast<RndStdIds>(Slot->GetValue());
+ nAnchorType = Item.GetItem()->GetAnchorType();
// I2TM
switch(nAnchorType)
{
diff --git a/include/item/base/ItemBase.hxx b/include/item/base/ItemBase.hxx
index 6af2858e8d0a..f356d5edadc1 100644
--- a/include/item/base/ItemBase.hxx
+++ b/include/item/base/ItemBase.hxx
@@ -124,9 +124,6 @@ namespace Item
// to create instances
ItemBase();
- // basic RTTI TypeCheck to secure e.g. operator== and similar
- bool CheckSameType(const ItemBase& rCmp) const;
-
// PutValue/Any interface for automated instance creation from SfxType
// mechanism (UNO API and sfx2 stuff)
friend class ItemControlBlock;
diff --git a/include/svx/item/TransformAnchor.hxx b/include/svx/item/TransformAnchor.hxx
new file mode 100755
index 000000000000..d78c5e2a93c5
--- /dev/null
+++ b/include/svx/item/TransformAnchor.hxx
@@ -0,0 +1,39 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_SVX_ITEM_TRANSFORMANCHOR_HXX
+#define INCLUDED_SVX_ITEM_TRANSFORMANCHOR_HXX
+
+#include <item/simple/CntInt16.hxx>
+#include <svx/swframetypes.hxx>
+
+///////////////////////////////////////////////////////////////////////////////
+
+namespace Item
+{
+ class SVX_DLLPUBLIC TransformAnchor : public CntInt16
+ {
+ public:
+ static ItemControlBlock& GetStaticItemControlBlock();
+ virtual ItemControlBlock& GetItemControlBlock() const override;
+
+ protected:
+ TransformAnchor(RndStdIds nValue = RndStdIds::UNKNOWN);
+
+ public:
+ static std::shared_ptr<const TransformAnchor> Create(RndStdIds nValue);
+ RndStdIds GetAnchorType() const { return static_cast<RndStdIds>(GetValue()); }
+ };
+} // end of namespace Item
+
+///////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_SVX_ITEM_TRANSFORMANCHOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/item/source/base/ItemBase.cxx b/item/source/base/ItemBase.cxx
index 0124841e1c04..08dcc25ab8eb 100644
--- a/item/source/base/ItemBase.cxx
+++ b/item/source/base/ItemBase.cxx
@@ -25,7 +25,8 @@ class SbxItem : public SfxPoolItem
class SfxInt16Item
-> Item::CntInt16
--> SID_ATTR_TRANSFORM_ANCHOR -> need own type to replace in ItemSet ->
+-> SID_ATTR_TRANSFORM_ANCHOR -> need own type to replace in ItemSet -> Item::TransformAnchor
+-> replace using TransformAnchor and ItemSet -> done!
defs from sfx2\sdi\sfxitems.sdi may be a good hint which items to convert first (?)
these are:
@@ -230,11 +231,6 @@ namespace Item
{
}
- bool ItemBase::CheckSameType(const ItemBase& rCmp) const
- {
- return typeid(rCmp) == typeid(*this);
- }
-
void ItemBase::PutValues(const AnyIDArgs& rArgs)
{
for(const auto& arg : rArgs)
@@ -263,8 +259,8 @@ namespace Item
bool ItemBase::operator==(const ItemBase& rCmp) const
{
- // basic implementation compares type, no data available
- return CheckSameType(rCmp);
+ // basic implementation compares pointers, no data available
+ return this == &rCmp;
}
bool ItemBase::operator<(const ItemBase& rCmp) const
@@ -272,7 +268,6 @@ namespace Item
// basic implementation uses addresses of instances to
// deliver a consistent result, but should *not* be used in
// this form - it will not compare any data
- assert(CheckSameType(rCmp));
return this < &rCmp;
}
diff --git a/item/source/simple/CntInt16.cxx b/item/source/simple/CntInt16.cxx
index 14885387a979..a9fd7a0169f1 100644
--- a/item/source/simple/CntInt16.cxx
+++ b/item/source/simple/CntInt16.cxx
@@ -58,13 +58,16 @@ namespace Item
bool CntInt16::operator==(const ItemBase& rCandidate) const
{
- assert(ItemBase::operator==(rCandidate));
+ if(ItemBase::operator==(rCandidate)) // compares ptrs
+ {
+ return true;
+ }
+
return (GetValue() == static_cast<const CntInt16&>(rCandidate).GetValue());
}
bool CntInt16::operator<(const ItemBase& rCandidate) const
{
- assert(ItemBase::operator==(rCandidate));
return static_cast<const CntInt16*>(this)->GetValue() < static_cast<const CntInt16&>(rCandidate).GetValue();
}
diff --git a/item/source/simple/CntOUString.cxx b/item/source/simple/CntOUString.cxx
index bd77b934cb05..9f9eeb75372f 100644
--- a/item/source/simple/CntOUString.cxx
+++ b/item/source/simple/CntOUString.cxx
@@ -58,7 +58,11 @@ namespace Item
bool CntOUString::operator==(const ItemBase& rCandidate) const
{
- assert(ItemBase::operator==(rCandidate));
+ if(ItemBase::operator==(rCandidate)) // compares ptrs
+ {
+ return true;
+ }
+
return (GetValue() == static_cast<const CntOUString&>(rCandidate).GetValue());
}
diff --git a/item/test/ItemTest.cxx b/item/test/ItemTest.cxx
index 46816e7507c5..8c7b839b11c4 100644
--- a/item/test/ItemTest.cxx
+++ b/item/test/ItemTest.cxx
@@ -78,8 +78,13 @@ namespace Item
virtual bool operator==(const ItemBase& rCandidate) const override
{
- assert(ItemBase::operator==(rCandidate));
+ if(ItemBase::operator==(rCandidate)) // compares ptrs
+ {
+ return true;
+ }
+
const MultiValueAB& rCand(static_cast<const MultiValueAB&>(rCandidate));
+
return (GetValueA() == rCand.GetValueA()
&& GetValueB() == rCand.GetValueB());
}
@@ -96,7 +101,6 @@ namespace Item
// virtual bool operator<(const ItemBase& rCandidate) const override
// {
- // assert(ItemBase::operator==(rCandidate));
// return static_cast<const MultiValueAB*>(this)->GetValueA() < static_cast<const MultiValueAB&>(rCandidate).GetValueA()
// && static_cast<const MultiValueAB*>(this)->GetValueB() < static_cast<const MultiValueAB&>(rCandidate).GetValueB();
// }
@@ -159,8 +163,8 @@ namespace Item
virtual bool operator==(const ItemBase& rCandidate) const override
{
- assert(ItemBase::operator==(rCandidate));
const MultiValueABC& rCand(static_cast<const MultiValueABC&>(rCandidate));
+
return (MultiValueAB::operator==(rCandidate)
&& GetValueC() == rCand.GetValueC());
}
@@ -172,7 +176,6 @@ namespace Item
// virtual bool operator<(const ItemBase& rCandidate) const override
// {
- // assert(ItemBase::operator==(rCandidate));
// return MultiValueAB::operator<(rCandidate)
// && static_cast<const MultiValueABC*>(this)->GetValueC() < static_cast<const MultiValueABC&>(rCandidate).GetValueC();
// }
@@ -187,17 +190,17 @@ namespace Item
class MultiValueAB_Alternative : public MultiValueAB
{
public:
- static ItemControlBlock& MultiValueAB_Alternative::GetStaticItemControlBlock()
+ static ItemControlBlock& GetStaticItemControlBlock()
{
static ItemControlBlock aItemControlBlock(
- MultiValueABC::GetStaticItemControlBlock().GetItemAdministrator(),
+ MultiValueAB::GetStaticItemControlBlock().GetItemAdministrator(),
std::shared_ptr<const ItemBase>(new MultiValueAB_Alternative()),
[](){ return new MultiValueAB_Alternative(); });
return aItemControlBlock;
}
- virtual ItemControlBlock& MultiValueAB_Alternative::GetItemControlBlock() const override
+ virtual ItemControlBlock& GetItemControlBlock() const override
{
return MultiValueAB_Alternative::GetStaticItemControlBlock();
}
@@ -219,12 +222,6 @@ namespace Item
MultiValueAB_Alternative::GetStaticItemControlBlock().GetItemAdministrator()->Create(
new MultiValueAB_Alternative(nValueA, nValueB)));
}
-
- virtual bool operator==(const ItemBase& rCandidate) const override
- {
- assert(ItemBase::operator==(rCandidate));
- return (MultiValueAB::operator==(rCandidate));
- }
};
} // end of namespace Item
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 1ca893e5eeab..0d04fbc18590 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -77,6 +77,7 @@ $(eval $(call gb_Library_use_libraries,svxcore,\
utl \
vcl \
xo \
+ item \
))
$(eval $(call gb_Library_use_externals,svxcore,\
@@ -163,6 +164,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/items/e3ditem \
svx/source/items/galleryitem \
svx/source/items/grfitem \
+ svx/source/items/TransformAnchor \
svx/source/sdr/animation/scheduler \
svx/source/sdr/animation/objectanimator \
svx/source/sdr/animation/animationstate \
diff --git a/svx/source/items/TransformAnchor.cxx b/svx/source/items/TransformAnchor.cxx
new file mode 100755
index 000000000000..d10d7d24bcaa
--- /dev/null
+++ b/svx/source/items/TransformAnchor.cxx
@@ -0,0 +1,52 @@
+/* -*- 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 <svx/item/TransformAnchor.hxx>
+#include <item/base/ItemAdministrator.hxx>
+
+///////////////////////////////////////////////////////////////////////////////
+
+namespace Item
+{
+ ItemControlBlock& TransformAnchor::GetStaticItemControlBlock()
+ {
+ static ItemControlBlock aItemControlBlock(
+ CntInt16::GetStaticItemControlBlock().GetItemAdministrator(),
+ std::shared_ptr<const ItemBase>(new TransformAnchor()),
+ [](){ return new TransformAnchor(); });
+
+ return aItemControlBlock;
+ }
+
+ ItemControlBlock& TransformAnchor::GetItemControlBlock() const
+ {
+ return TransformAnchor::GetStaticItemControlBlock();
+ }
+
+ TransformAnchor::TransformAnchor(RndStdIds nValue)
+ : CntInt16(static_cast<sal_Int16>(nValue))
+ {
+ }
+
+ std::shared_ptr<const TransformAnchor> TransformAnchor::Create(RndStdIds nValue)
+ {
+ // use ::Create(...) method with local incarnation, it will handle
+ // - detection of being default (will delete local incarnation)
+ // - detection of reuse (will delete local incarnation)
+ // - detectiomn of new use - will create shared_ptr for local incarnation and buffer
+ return std::static_pointer_cast<const TransformAnchor>(
+ TransformAnchor::GetStaticItemControlBlock().GetItemAdministrator()->Create(
+ new TransformAnchor(nValue)));
+ }
+} // end of namespace Item
+
+///////////////////////////////////////////////////////////////////////////////
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index a354fd3b8c18..b236d48fcc7c 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -63,7 +63,7 @@
#include <fmtfollowtextflow.hxx>
// I2TM
-#include <item/simple/CntInt16.hxx>
+#include <svx/item/TransformAnchor.hxx>
// ~I2TM
using namespace ::com::sun::star;
@@ -218,8 +218,9 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
pSdrView->GetAttributes( aSet );
// I2TM
- aSet.slotSet().SetSlot(SID_ATTR_TRANSFORM_ANCHOR, Item::CntInt16::Create(static_cast<sal_Int16>(nAnchor)));
+ aSet.itemSet().SetItem(Item::TransformAnchor::Create(nAnchor));
// ~I2TM
+
bool bRTL;
bool bVertL2R;
aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT, pSh->IsFrameVertical(true, bRTL, bVertL2R)));
@@ -268,16 +269,16 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq)
bool bSingleSelection = rMarkList.GetMarkCount() == 1;
// I2TM
- if(const auto Slot(pOutSet->slotSet().GetSlot<const Item::CntInt16>(SID_ATTR_TRANSFORM_ANCHOR)); Slot)
+ if(const auto Item(pOutSet->itemSet().GetStateAndItem<const Item::TransformAnchor>()); Item.HasItem())
{
if(!bSingleSelection)
{
- pSh->ChgAnchor(static_cast<RndStdIds>(Slot->GetValue()), false, bPosCorr);
+ pSh->ChgAnchor(Item.GetItem()->GetAnchorType(), false, bPosCorr);
}
else
{
SwFormatAnchor aAnchor(pFrameFormat->GetAnchor());
- aAnchor.SetType(static_cast<RndStdIds>(Slot->GetValue()));
+ aAnchor.SetType(Item.GetItem()->GetAnchorType());
aFrameAttrSet.Put( aAnchor );
}
}
commit 178fa8e1c5d47eb4ec2be7132d7477af62b5fa8d
Author: Armin Le Grand <Armin.Le.Grand at me.com>
AuthorDate: Tue Apr 9 20:33:59 2019 +0200
Commit: Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Tue Apr 9 20:33:59 2019 +0200
WIP: Moved usage of SID_BASICIDE_ARG_SBX completely
to Item::ItemSet and type-dependent usages. The defined
Slot-ID is no longer used - except for *.sdi defs - not
sure if these may be needed.
Adapted SfxDispatcher::ExecuteList to ExecuteList2 and
transporting Item:: incarnations (std::shared_ptr's of them)
Change-Id: I50c062340614793e74103235e1d708df889346d5
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index ceb2d7991b08..36194396bf6c 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -573,63 +573,77 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
{
DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
// I2TM
- const auto aSbxItem = rReq.GetArgs()->slotSet().GetSlot<const basctl::Item::Sbx>(SID_BASICIDE_ARG_SBX);
- const ScriptDocument& aDocument( aSbxItem->GetDocument() );
- const OUString& aLibName( aSbxItem->GetLibName() );
- const OUString& aName( aSbxItem->GetName() );
- if(m_aCurLibName.isEmpty() || (aDocument == m_aCurDocument && aLibName == m_aCurLibName))
+ if(const auto Item(rReq.GetArgs()->itemSet().GetStateAndItem<const basctl::Item::Sbx>()); Item.HasItem())
{
- if(TYPE_MODULE == aSbxItem->GetType())
- {
- FindBasWin(aDocument, aLibName, aName, true);
- }
- else if(TYPE_DIALOG == aSbxItem->GetType())
+ const ScriptDocument& aDocument(Item.GetItem()->GetDocument());
+ const OUString& aLibName(Item.GetItem()->GetLibName());
+ const OUString& aName(Item.GetItem()->GetName());
+
+ if(m_aCurLibName.isEmpty() || (aDocument == m_aCurDocument && aLibName == m_aCurLibName))
{
- FindDlgWin(aDocument, aLibName, aName, true);
+ if(TYPE_MODULE == Item.GetItem()->GetType())
+ {
+ FindBasWin(aDocument, aLibName, aName, true);
+ }
+ else if(TYPE_DIALOG == Item.GetItem()->GetType())
+ {
+ FindDlgWin(aDocument, aLibName, aName, true);
+ }
}
}
+ // ~I2TM
}
break;
case SID_BASICIDE_SBXDELETED:
{
DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
// I2TM
- const auto aSbxItem = rReq.GetArgs()->slotSet().GetSlot<const Item::Sbx>(SID_BASICIDE_ARG_SBX);
- const ScriptDocument& aDocument(aSbxItem->GetDocument());
- VclPtr<BaseWindow> pWin = FindWindow(aDocument, aSbxItem->GetLibName(), aSbxItem->GetName(), aSbxItem->GetType(), true);
- if ( pWin )
- RemoveWindow( pWin, true );
+ if(const auto Item(rReq.GetArgs()->itemSet().GetStateAndItem<const basctl::Item::Sbx>()); Item.HasItem())
+ {
+ const ScriptDocument& aDocument(Item.GetItem()->GetDocument());
+ VclPtr<BaseWindow> pWin = FindWindow(
+ aDocument,
+ Item.GetItem()->GetLibName(),
+ Item.GetItem()->GetName(),
+ Item.GetItem()->GetType(),
+ true);
+ if ( pWin )
+ RemoveWindow( pWin, true );
+ }
+ // ~I2TM
}
break;
case SID_BASICIDE_SHOWSBX:
{
DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
// I2TM
- const auto aSbxItem = rReq.GetArgs()->slotSet().GetSlot<const Item::Sbx>(SID_BASICIDE_ARG_SBX);
- const ScriptDocument& aDocument(aSbxItem->GetDocument());
- const OUString& aLibName(aSbxItem->GetLibName());
- const OUString& aName(aSbxItem->GetName());
+ if(const auto Item(rReq.GetArgs()->itemSet().GetStateAndItem<const basctl::Item::Sbx>()); Item.HasItem())
+ {
+ const ScriptDocument& aDocument(Item.GetItem()->GetDocument());
+ const OUString& aLibName(Item.GetItem()->GetLibName());
+ const OUString& aName(Item.GetItem()->GetName());
- SetCurLib( aDocument, aLibName );
- BaseWindow* pWin = nullptr;
+ SetCurLib( aDocument, aLibName );
+ BaseWindow* pWin = nullptr;
- if(TYPE_DIALOG == aSbxItem->GetType())
- {
- pWin = FindDlgWin( aDocument, aLibName, aName, true );
- }
- else if(TYPE_MODULE == aSbxItem->GetType())
- {
- pWin = FindBasWin( aDocument, aLibName, aName, true );
- }
- else if(TYPE_METHOD == aSbxItem->GetType())
- {
- pWin = FindBasWin( aDocument, aLibName, aName, true );
- static_cast<ModulWindow*>(pWin)->EditMacro(aSbxItem->GetMethodName());
- // static_cast<ModulWindow*>(pWin)->EditMacro( rSbxItem.GetMethodName() );
+ if(TYPE_DIALOG == Item.GetItem()->GetType())
+ {
+ pWin = FindDlgWin( aDocument, aLibName, aName, true );
+ }
+ else if(TYPE_MODULE == Item.GetItem()->GetType())
+ {
+ pWin = FindBasWin( aDocument, aLibName, aName, true );
+ }
+ else if(TYPE_METHOD == Item.GetItem()->GetType())
+ {
+ pWin = FindBasWin( aDocument, aLibName, aName, true );
+ static_cast<ModulWindow*>(pWin)->EditMacro(Item.GetItem()->GetMethodName());
+ }
+ DBG_ASSERT( pWin, "Window was not created!" );
+ SetCurWindow( pWin, true );
+ pTabBar->MakeVisible( pTabBar->GetCurPageId() );
}
- DBG_ASSERT( pWin, "Window was not created!" );
- SetCurWindow( pWin, true );
- pTabBar->MakeVisible( pTabBar->GetCurPageId() );
+ // ~I2TM
}
break;
case SID_BASICIDE_SHOWWINDOW:
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index df63f7861489..d94136d77450 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -854,18 +854,18 @@ bool TreeListBox::OpenCurrent()
if (SfxDispatcher* pDispatcher = GetDispatcher())
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- aDesc.GetDocument(),
- aDesc.GetLibName(),
- aDesc.GetName(),
- aDesc.GetMethodName(),
- ConvertType(aDesc.GetType())));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ aDesc.GetDocument(),
+ aDesc.GetLibName(),
+ aDesc.GetName(),
+ aDesc.GetMethodName(),
+ ConvertType(aDesc.GetType())));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SHOWSBX,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
return true;
}
break;
@@ -1542,18 +1542,18 @@ IMPL_LINK_NOARG(SbTreeListBox, OpenCurrentHdl, weld::TreeView&, void)
if (SfxDispatcher* pDispatcher = GetDispatcher())
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- aDesc.GetDocument(),
- aDesc.GetLibName(),
- aDesc.GetName(),
- aDesc.GetMethodName(),
- ConvertType(aDesc.GetType())));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ aDesc.GetDocument(),
+ aDesc.GetLibName(),
+ aDesc.GetName(),
+ aDesc.GetMethodName(),
+ ConvertType(aDesc.GetType())));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SHOWSBX,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // I2TM
return;
}
break;
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 9fa895f47683..4ca099e40b77 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -1495,18 +1495,18 @@ void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument,
if(SfxDispatcher* pDispatcher = GetDispatcher())
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- rDocument,
- aLibName,
- aModName,
- OUString(),
- TYPE_MODULE));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ rDocument,
+ aLibName,
+ aModName,
+ OUString(),
+ TYPE_MODULE));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SBXINSERTED,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
}
if( pBasicBox )
@@ -1619,18 +1619,18 @@ void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument,
if(SfxDispatcher* pDispatcher = GetDispatcher())
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- rDocument,
- aLibName,
- aModName,
- OUString(),
- TYPE_MODULE));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ rDocument,
+ aLibName,
+ aModName,
+ OUString(),
+ TYPE_MODULE));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SBXINSERTED,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
}
if( pBasicBox )
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index de473d4331e5..c4f9f80748e7 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -121,18 +121,18 @@ bool ExtTreeListBox::EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewT
if (SfxDispatcher* pDispatcher = GetDispatcher())
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- aDocument,
- aLibName,
- rNewText,
- OUString(),
- ConvertType(eType)));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ aDocument,
+ aLibName,
+ rNewText,
+ OUString(),
+ ConvertType(eType)));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SBXRENAMED,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
}
// OV-Bug?!
@@ -365,18 +365,18 @@ TriState ExtTreeListBox::NotifyCopyingMoving( SvTreeListEntry* pTarget, SvTreeLi
if( pDispatcher )
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- rSourceDoc,
- aSourceLibName,
- aSourceName,
- OUString(),
- ConvertType(eType)));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ rSourceDoc,
+ aSourceLibName,
+ aSourceName,
+ OUString(),
+ ConvertType(eType)));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SBXDELETED,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
}
}
@@ -467,18 +467,18 @@ TriState ExtTreeListBox::NotifyCopyingMoving( SvTreeListEntry* pTarget, SvTreeLi
if( pDispatcher )
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- rDestDoc,
- aDestLibName,
- aSourceName,
- OUString(),
- ConvertType(eType)));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ rDestDoc,
+ aDestLibName,
+ aSourceName,
+ OUString(),
+ ConvertType(eType)));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SBXINSERTED,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
}
}
@@ -744,18 +744,18 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton, void )
}
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- aDesc.GetDocument(),
- aDesc.GetLibName(),
- aModName,
- OUString(),
- TreeListBox::ConvertType( aDesc.GetType())));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ aDesc.GetDocument(),
+ aDesc.GetLibName(),
+ aModName,
+ OUString(),
+ TreeListBox::ConvertType( aDesc.GetType())));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SHOWSBX,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
}
}
else // only Lib selected
@@ -882,18 +882,18 @@ void ObjectPage::NewDialog()
if (SfxDispatcher* pDispatcher = GetDispatcher())
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- aDocument,
- aLibName,
- aDlgName,
- OUString(),
- TYPE_DIALOG));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ aDocument,
+ aLibName,
+ aDlgName,
+ OUString(),
+ TYPE_DIALOG));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SBXINSERTED,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
}
LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
SvTreeListEntry* pRootEntry = m_pBasicBox->FindRootEntry( aDocument, eLocation );
@@ -948,18 +948,18 @@ void ObjectPage::DeleteCurrent()
if (SfxDispatcher* pDispatcher = GetDispatcher())
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- aDocument,
- aLibName,
- aName,
- OUString(),
- TreeListBox::ConvertType(eType)));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ aDocument,
+ aLibName,
+ aName,
+ OUString(),
+ TreeListBox::ConvertType(eType)));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SBXDELETED,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
}
try
@@ -1046,18 +1046,18 @@ SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument,
if (SfxDispatcher* pDispatcher = GetDispatcher())
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- rDocument,
- aLibName,
- aModName,
- OUString(),
- TYPE_MODULE));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ rDocument,
+ aLibName,
+ aModName,
+ OUString(),
+ TYPE_MODULE));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SBXINSERTED,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
}
LibraryLocation eLocation = rDocument.getLibraryLocation( aLibName );
SvTreeListEntry* pRootEntry = rBasicBox.FindRootEntry( rDocument, eLocation );
@@ -1152,18 +1152,18 @@ SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument,
if (SfxDispatcher* pDispatcher = GetDispatcher())
{
// I2TM
- ::Item::SlotSet::SharedPtr aSlotSet(::Item::SlotSet::Create());
- aSlotSet->SetSlot(SID_BASICIDE_ARG_SBX, Item::Sbx::Create(
- rDocument,
- aLibName,
- aModName,
- OUString(),
- TYPE_MODULE));
- pDispatcher->ExecuteList(
+ const std::shared_ptr<const ::Item::ItemBase> aSbxItem(
+ Item::Sbx::Create(
+ rDocument,
+ aLibName,
+ aModName,
+ OUString(),
+ TYPE_MODULE));
+ pDispatcher->ExecuteList2(
SID_BASICIDE_SBXINSERTED,
SfxCallMode::SYNCHRON,
- aSlotSet
- );
+ { &aSbxItem });
+ // ~I2TM
}
LibraryLocation eLocation = rDocument.getLibraryLocation( aLibName );
std::unique_ptr<weld::TreeIter> xIter(rBasicBox.make_iterator());
diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx
index e05439727c4a..225d38ada96c 100644
--- a/include/sfx2/dispatch.hxx
+++ b/include/sfx2/dispatch.hxx
@@ -32,7 +32,7 @@
#include <initializer_list>
// I2TM
-#include <item/base/SlotSet.hxx>
+namespace Item { class ItemBase; }
// ~I2TM
class SfxSlotServer;
@@ -120,11 +120,11 @@ public:
std::initializer_list<SfxPoolItem const*> internalargs = std::initializer_list<SfxPoolItem const*>());
// I2TM
- const SfxPoolItem* ExecuteList(
+ const SfxPoolItem* ExecuteList2(
sal_uInt16 nSlot,
SfxCallMode eCall,
- const Item::SlotSet::SharedPtr& rArgs,
- const Item::SlotSet::SharedPtr* pInternalArgs = nullptr);
+ std::initializer_list<const std::shared_ptr<const Item::ItemBase>*> args,
+ std::initializer_list<const std::shared_ptr<const Item::ItemBase>*> internalargs = std::initializer_list<const std::shared_ptr<const Item::ItemBase>*>());
// ~I2TM
const SfxPoolItem* Execute( sal_uInt16 nSlot,
diff --git a/item/source/base/ItemBase.cxx b/item/source/base/ItemBase.cxx
index 1e7ac4d55fc9..0124841e1c04 100644
--- a/item/source/base/ItemBase.cxx
+++ b/item/source/base/ItemBase.cxx
@@ -21,6 +21,11 @@ class SbxItem : public SfxPoolItem
-> basctl::Item::Sbx
-> SID_BASICIDE_ARG_SBX
-> Done!
+-> Now moved to use ::ItemSet and new ExecuteList2, no more SlotSet
+
+class SfxInt16Item
+-> Item::CntInt16
+-> SID_ATTR_TRANSFORM_ANCHOR -> need own type to replace in ItemSet ->
defs from sfx2\sdi\sfxitems.sdi may be a good hint which items to convert first (?)
these are:
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 137216a33f44..413647e65bfc 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1070,13 +1070,13 @@ const SfxPoolItem* SfxDispatcher::ExecuteList(sal_uInt16 nSlot, SfxCallMode eCal
return nullptr;
}
// I2TM
-const SfxPoolItem* SfxDispatcher::ExecuteList(
+const SfxPoolItem* SfxDispatcher::ExecuteList2(
sal_uInt16 nSlot,
SfxCallMode eCall,
- const Item::SlotSet::SharedPtr& rArgs,
- const Item::SlotSet::SharedPtr* pInternalArgs)
+ std::initializer_list<const std::shared_ptr<const Item::ItemBase>*> args,
+ std::initializer_list<const std::shared_ptr<const Item::ItemBase>*> internalargs)
{
- if(IsLocked() || !rArgs || rArgs->empty())
+ if(IsLocked() || 0 == args.size())
{
return nullptr;
}
@@ -1087,20 +1087,32 @@ const SfxPoolItem* SfxDispatcher::ExecuteList(
if(GetShellAndSlot_Impl(nSlot, &pShell, &pSlot, false, true))
{
SfxAllItemSet aSet(pShell->GetPool());
- aSet.slotSet().SetSlots(*rArgs);
+
+ for(const std::shared_ptr<const Item::ItemBase>* arg : args)
+ {
+ assert(arg);
+ aSet.itemSet().SetItem(*arg);
+ }
SfxRequest aReq(nSlot, eCall, aSet);
- if(nullptr != pInternalArgs && *pInternalArgs && !(*pInternalArgs)->empty())
+ if(0 != internalargs.size())
{
SfxAllItemSet aInternalSet(SfxGetpApp()->GetPool());
- aInternalSet.slotSet().SetSlots(**pInternalArgs);
+
+ for(const std::shared_ptr<const Item::ItemBase>* arg : internalargs)
+ {
+ assert(arg);
+ aInternalSet.itemSet().SetItem(*arg);
+ }
+
aReq.SetInternalArgs_Impl(aInternalSet);
}
Execute_(*pShell, *pSlot, aReq, eCall);
return aReq.GetReturnValue();
}
+
return nullptr;
}
// ~I2TM
More information about the Libreoffice-commits
mailing list