summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2024-02-09 11:13:58 +0100
committerArmin Le Grand <Armin.Le.Grand@me.com>2024-02-12 10:35:33 +0100
commitca3c6d468f68af1506bf4e56b47655e5d56306a8 (patch)
tree27da565a170606c4ea54ea07aa0dbb21eba3fe60 /extensions
parent207501b8385818a5d413b9f4001e0d24aaa4f2a9 (diff)
ITEM: ItemPool Rework (I)
Driving forward the Item reworks I now take the ItemPool in focus: It now does not hold any items anymore and should be renamed to something like ItemInfoProvider/ItemHelper, since it's main purpose is to provide the Defaults for the Item functionality. There is that SfxItemInfo, only a struct and bundling SlotID and ItemFlags. There are also the DefaultItems, just handled as ptrs in an array. It is/was always error-prone to keep these in sync. Remember that it's also necessary for the order to not only being sorted but being increments of one with no gaps allowed in the WhichIDs to which the Items are bound. I now bundled that to a new class ItemInfo that joins WhichID, SlotID, ItemFlags and the default Item. This is a pure virtual base class, it comes in three derivations: (1) ItemInfoStatic: This is supposed to be global static and hosts the Item in a std::unique_ptr to ensure cleanup. It is designed to be constructed once during runtime and being shared globally. It allows the ItemPtr to be nullptr to mark as non-static (if initial static is not possible for some reason) but still offers the needed data. Most cases (95%+) are of that case. The contained Item is owned by that instance. The flag isStaticDefault() is set at the Item. (2) ItemInfoDynamic: This is supposed to be used for cases where the Item cannot be static: Mainly for SfxSetItem (that needs a Pool itself in the contained SfxItemSet, so lifetime is bound to that Pool), but other cases showed up in the transition. These instances live while the Pool lives and get destructed when the Pool goes down. Also uses std::unique_ptr for the Item instance for as much automated cleanup as possible, the contained Item is owned by that instance, the instance by the Pool. The flag isDynamicDefault() is set at the Item. (3) ItemInfoUser: This is used for UserDefaults that can be set for every ItemInfo entry to 'overshadow' the default from the 'outside'. It uses a regular Item and the central access methods implCreateItemEntry/ implCleanupItemEntry to manage the Item instance, thus works like a SfxPoolItemHolder. The Item instance can be globally shared and re-used even when the Pool goes down. Instances belong to the Pool and are cleaned up when the Pool goes down. This Item does not need any further flag to be set. The ItemInfos are organized using a class called ItemInfoPackage: This bundles groups of ItemInfoStatic to functional instances. There are derivations/ implementations of this e.g. for Writer ItemPool bundling all the needed defaults for Writer, similar for draw/impress, Calc and other usages. These ItemInfoPackage can be 'registered' at an ItemPool using it's method registerItemInfoPackage. This does all the needed stuff to setup that group of ItemInfos at the Pool (It even sets internal vars First/LastWhich, that info can just be derived from the buildup ItemInfo Ptrs). The ItemInfoPackage has methods 'size()' and 'getItemInfo(index) to allow looping over it and deliver the infos the Pool needs. The (forced, pure virtual) overloads of getItemInfo in the specific implementations check for the ItemPtr being nullptr and create a exclusive incarnation of ItemInfoDynamic for the Pool if needed, returning that. The Pool owns the ItemInfoDynamic incarnations and uses the ItemInfoStatic directly. On shutdown it cleans up the ItemInfoDynamic as needed. The ItemInfoUser is used by the Pool when a UserDefault is set/used: for SetUserDefaultItem, GetUserDefaultItem, ResetUserDefaultItem. It is not held in a 2nd list, but directly in the list of ItemInfo'ptrs: To keep track of this an unordered_map is used that helds the original ItemInfo associated with the WhichID. That way no two lookups (as before) are needed to get the current Pool's default for any WhichID. The derivations of ItemInfoPackage are encapsulated and just allow access to an ItemInfoPackage& with a single method as return value. All use a static local instance of a std::array<ItemInfoStatic, FIXED_SIZE> which constructs all ItemInfoStatic and the static Item instances - if already possible. Sometimes it is necessary to overload the constructor to set some static instances for Items later than the lib init. These are also just marked with nullptr as Item instance. Some need to overload getItemInfo to complete instances of ItemInfoStatic, if needed, or create and deliver instances of ItemInfoDynamic. The registerItemInfoPackage also offers a optional lambda callback: there were two cases where local data from the Pool was needed to incarnate the item - just add that to the call to registerItemInfoPackage if needed, see examples in the adapted code. For the re-use of Items this means that now in SfxItemSet/SfxPoolItemHolder *true* static Items can and will be used without RefCount directly and globally. This is also the case for dynamic Items, with the exception of differing Pools for SfxSetItems which cannot be done. Future: That design is already prepared to allow solving that Pool-chaining problem: currently there are master/sub-pools and all accesses have to traverse that structure before even doing anything. For the future the idea is more to 'compose' a Pool by registering ItemInfoPackages, e.g. for Writer pool you may start with SfxItemPool, register the writer-specific ItemInfoPackage, then the one for DrawingLayer (if needed) and the one for EditEngine. It should also be possible to get to smaller granularities of that packages. Ideas for new ones will emerge. We might also think about composing Pools which can e.g. run Writer and Chart, so allowing to use Chart *without* OLE stuff in Writer - just ideas... More changes: - Adapted all stuff, cleaned up old stuff/ definitions - Removed FreezeIdRanges, that can be done once per Pool on-demand (and cannot be forgotten to be called) - Merged XOutdevItemPool with SdrItemPool and offered a ItemInfoPackage which joins both needed sets of Items - All the cleanup hassle with Pools and defaults cleaned up - Adapted all access methods of the pool to use that new stuff. Pool chaining currently stays, but I use a central method 'getTargetPool' instead of recursive calling to get the correct Pool for the action Change-Id: I2b8d3d4c3cc80b1d0d0b3c0f4bd90d7656b4bab7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163157 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/propctrlr/controlfontdialog.cxx7
-rw-r--r--extensions/source/propctrlr/controlfontdialog.hxx3
-rw-r--r--extensions/source/propctrlr/fontdialog.cxx136
-rw-r--r--extensions/source/propctrlr/fontdialog.hxx4
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx5
5 files changed, 74 insertions, 81 deletions
diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx
index 9c3eddf4d1e2..3887190752d3 100644
--- a/extensions/source/propctrlr/controlfontdialog.cxx
+++ b/extensions/source/propctrlr/controlfontdialog.cxx
@@ -36,8 +36,7 @@ namespace pcr
using namespace ::com::sun::star::beans;
OControlFontDialog::OControlFontDialog(const Reference< XComponentContext >& _rxContext )
- :OGenericUnoDialog( _rxContext )
- ,m_pItemPoolDefaults(nullptr)
+ : OGenericUnoDialog( _rxContext )
{
registerProperty(PROPERTY_INTROSPECTEDOBJECT, static_cast<sal_Int32>(OwnPropertyId::INTROSPECTEDOBJECT),
PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT,
@@ -53,7 +52,7 @@ namespace pcr
if (m_xDialog)
{
destroyDialog();
- ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults);
+ ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool);
}
}
}
@@ -112,7 +111,7 @@ namespace pcr
std::unique_ptr<weld::DialogController> OControlFontDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
{
- ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults);
+ ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool);
OSL_ENSURE(m_xControlModel.is(), "OControlFontDialog::createDialog: no introspectee set!");
if (m_xControlModel.is())
diff --git a/extensions/source/propctrlr/controlfontdialog.hxx b/extensions/source/propctrlr/controlfontdialog.hxx
index 8dc52010273f..63bbae359de6 100644
--- a/extensions/source/propctrlr/controlfontdialog.hxx
+++ b/extensions/source/propctrlr/controlfontdialog.hxx
@@ -24,7 +24,6 @@
class SfxItemSet;
class SfxItemPool;
-class SfxPoolItem;
namespace pcr
{
@@ -45,8 +44,6 @@ namespace pcr
std::unique_ptr<SfxItemSet> m_pFontItems; // item set for the dialog
rtl::Reference<SfxItemPool> m_pItemPool; // item pool for the item set for the dialog
- std::vector<SfxPoolItem*>*
- m_pItemPoolDefaults; // pool defaults
public:
explicit OControlFontDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx
index 9a7078a869ab..17401748f67a 100644
--- a/extensions/source/propctrlr/fontdialog.cxx
+++ b/extensions/source/propctrlr/fontdialog.cxx
@@ -492,78 +492,82 @@ namespace pcr
}
}
- void ControlCharacterDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
+ static ItemInfoPackage& getItemInfoPackageCntChrDlg()
{
- // just to be sure...
- _rpSet = nullptr;
- _rpPool = nullptr;
- _rpDefaults = nullptr;
-
- // create and initialize the defaults
- _rpDefaults = new std::vector<SfxPoolItem*>(FontItemIds::CFID_LAST_ITEM_ID - FontItemIds::CFID_FIRST_ITEM_ID + 1);
-
- vcl::Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont();
-
- SfxPoolItem** pCounter = _rpDefaults->data(); // want to modify this without affecting the out param _rppDefaults
- *pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamilyType(), aDefaultVCLFont.GetFamilyName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), FontItemIds::CFID_FONT);
- *pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetFontHeight(), 100, FontItemIds::CFID_HEIGHT);
- *pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), FontItemIds::CFID_WEIGHT);
- *pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), FontItemIds::CFID_POSTURE);
- *pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), FontItemIds::CFID_LANGUAGE);
- *pCounter++ = new SvxUnderlineItem(aDefaultVCLFont.GetUnderline(), FontItemIds::CFID_UNDERLINE);
- *pCounter++ = new SvxCrossedOutItem(aDefaultVCLFont.GetStrikeout(), FontItemIds::CFID_STRIKEOUT);
- *pCounter++ = new SvxWordLineModeItem(aDefaultVCLFont.IsWordLineMode(), FontItemIds::CFID_WORDLINEMODE);
- *pCounter++ = new SvxColorItem(aDefaultVCLFont.GetColor(), FontItemIds::CFID_CHARCOLOR);
- *pCounter++ = new SvxCharReliefItem(aDefaultVCLFont.GetRelief(), FontItemIds::CFID_RELIEF);
- *pCounter++ = new SvxEmphasisMarkItem(aDefaultVCLFont.GetEmphasisMark(), FontItemIds::CFID_EMPHASIS);
-
- *pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamilyType(), aDefaultVCLFont.GetFamilyName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), FontItemIds::CFID_CJK_FONT);
- *pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetFontHeight(), 100, FontItemIds::CFID_CJK_HEIGHT);
- *pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), FontItemIds::CFID_CJK_WEIGHT);
- *pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), FontItemIds::CFID_CJK_POSTURE);
- *pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), FontItemIds::CFID_CJK_LANGUAGE);
-
- *pCounter++ = new SvxCaseMapItem(SvxCaseMap::NotMapped, FontItemIds::CFID_CASEMAP);
- *pCounter++ = new SvxContourItem(false, FontItemIds::CFID_CONTOUR);
- *pCounter++ = new SvxShadowedItem(false, FontItemIds::CFID_SHADOWED);
-
- *pCounter++ = new SvxFontListItem (new FontList(Application::GetDefaultDevice()), FontItemIds::CFID_FONTLIST);
-
- // create the pool
- static SfxItemInfo const aItemInfos[FontItemIds::CFID_LAST_ITEM_ID - FontItemIds::CFID_FIRST_ITEM_ID + 1] =
+ class ItemInfoPackageCntChrDlg : public ItemInfoPackage
{
- // _nItemInfoSlotID, _nItemInfoFlags
- { SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_FONT
- { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_HEIGHT
- { SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_WEIGHT
- { SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_POSTURE
- { SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_LANGUAGE
- { SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_UNDERLINE
- { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_STRIKEOUT
- { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_WORDLINEMODE
- { SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_CHARCOLOR
- { SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_RELIEF
- { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_EMPHASIS
- { 0, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_CJK_FONT
- { 0, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_CJK_HEIGHT
- { 0, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_CJK_WEIGHT
- { 0, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_CJK_POSTURE
- { 0, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_CJK_LANGUAGE
- { 0, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_CASEMAP
- { 0, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_CONTOUR
- { 0, SFX_ITEMINFOFLAG_NONE }, // FontItemIds::CFID_SHADOWED
- { SID_ATTR_CHAR_FONTLIST, SFX_ITEMINFOFLAG_NONE } // FontItemIds::CFID_FONTLIST
+ vcl::Font maDefaultVCLFont{Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont()};
+ typedef std::array<ItemInfoStatic, FontItemIds::CFID_LAST_ITEM_ID - FontItemIds::CFID_FIRST_ITEM_ID + 1> ItemInfoArrayCntChrDlg;
+ ItemInfoArrayCntChrDlg maItemInfos {{
+ // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
+ { FontItemIds::CFID_FONT, new SvxFontItem(maDefaultVCLFont.GetFamilyType(), maDefaultVCLFont.GetFamilyName(), maDefaultVCLFont.GetStyleName(), maDefaultVCLFont.GetPitch(), maDefaultVCLFont.GetCharSet(), FontItemIds::CFID_FONT), SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_HEIGHT, new SvxFontHeightItem(maDefaultVCLFont.GetFontHeight(), 100, FontItemIds::CFID_HEIGHT), SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_WEIGHT, new SvxWeightItem(maDefaultVCLFont.GetWeight(), FontItemIds::CFID_WEIGHT), SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_POSTURE, new SvxPostureItem(maDefaultVCLFont.GetItalic(), FontItemIds::CFID_POSTURE), SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_LANGUAGE, new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), FontItemIds::CFID_LANGUAGE), SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_UNDERLINE, new SvxUnderlineItem(maDefaultVCLFont.GetUnderline(), FontItemIds::CFID_UNDERLINE), SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_STRIKEOUT, new SvxCrossedOutItem(maDefaultVCLFont.GetStrikeout(), FontItemIds::CFID_STRIKEOUT), SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_WORDLINEMODE, new SvxWordLineModeItem(maDefaultVCLFont.IsWordLineMode(), FontItemIds::CFID_WORDLINEMODE), SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_CHARCOLOR, new SvxColorItem(maDefaultVCLFont.GetColor(), FontItemIds::CFID_CHARCOLOR), SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_RELIEF, new SvxCharReliefItem(maDefaultVCLFont.GetRelief(), FontItemIds::CFID_RELIEF), SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_EMPHASIS, new SvxEmphasisMarkItem(maDefaultVCLFont.GetEmphasisMark(), FontItemIds::CFID_EMPHASIS), SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_CJK_FONT, new SvxFontItem(maDefaultVCLFont.GetFamilyType(), maDefaultVCLFont.GetFamilyName(), maDefaultVCLFont.GetStyleName(), maDefaultVCLFont.GetPitch(), maDefaultVCLFont.GetCharSet(), FontItemIds::CFID_CJK_FONT), 0, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_CJK_HEIGHT, new SvxFontHeightItem(maDefaultVCLFont.GetFontHeight(), 100, FontItemIds::CFID_CJK_HEIGHT), 0, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_CJK_WEIGHT, new SvxWeightItem(maDefaultVCLFont.GetWeight(), FontItemIds::CFID_CJK_WEIGHT), 0, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_CJK_POSTURE, new SvxPostureItem(maDefaultVCLFont.GetItalic(), FontItemIds::CFID_CJK_POSTURE), 0, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_CJK_LANGUAGE, new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), FontItemIds::CFID_CJK_LANGUAGE), 0, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_CASEMAP, new SvxCaseMapItem(SvxCaseMap::NotMapped, FontItemIds::CFID_CASEMAP), 0, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_CONTOUR, new SvxContourItem(false, FontItemIds::CFID_CONTOUR), 0, SFX_ITEMINFOFLAG_NONE },
+ { FontItemIds::CFID_SHADOWED, new SvxShadowedItem(false, FontItemIds::CFID_SHADOWED), 0, SFX_ITEMINFOFLAG_NONE },
+
+ // SvxFontListItem has to be DynamicDefault. It is pool-dependent in the sense
+ // that it cannot/should not exist. Additionally SvxFontListItem has NO destructor
+ // and does not delete the contained/set FontList - this is done 'handish' in
+ // ControlCharacterDialog::destroyItemSet, see below...
+ { FontItemIds::CFID_FONTLIST, nullptr, SID_ATTR_CHAR_FONTLIST, SFX_ITEMINFOFLAG_NONE }
+ }};
+
+ public:
+ virtual size_t size() const override { return maItemInfos.size(); }
+ virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override
+ {
+ const ItemInfo& rRetval(maItemInfos[nIndex]);
+
+ // return immediately if we have the static entry and Item
+ if (nullptr != rRetval.getItem())
+ return rRetval;
+
+ // check for dynamic ItemInfo creation, needed here for FontList.
+ // this will be deleted when the Pool where it gets used goes down,
+ // thus may happen multiple times. ownership will be at the pool.
+ if (FontItemIds::CFID_FONTLIST == rRetval.getWhich())
+ return *new ItemInfoDynamic(
+ rRetval,
+ new SvxFontListItem(new FontList(Application::GetDefaultDevice()), FontItemIds::CFID_FONTLIST));
+
+ return rRetval;
+ }
};
- _rpPool = new SfxItemPool("PCRControlFontItemPool", FontItemIds::CFID_FIRST_ITEM_ID, FontItemIds::CFID_LAST_ITEM_ID,
- aItemInfos, _rpDefaults);
- _rpPool->FreezeIdRanges();
+ static std::unique_ptr<ItemInfoPackageCntChrDlg> g_aItemInfoPackageCntChrDlg;
+ if (!g_aItemInfoPackageCntChrDlg)
+ g_aItemInfoPackageCntChrDlg.reset(new ItemInfoPackageCntChrDlg);
+ return *g_aItemInfoPackageCntChrDlg;
+ }
+
+ void ControlCharacterDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool)
+ {
+ // just to be sure...
+ _rpSet = nullptr;
+ _rpPool = nullptr;
+ _rpPool = new SfxItemPool("PCRControlFontItemPool");
+ _rpPool->registerItemInfoPackage(getItemInfoPackageCntChrDlg());
// and, finally, the set
_rpSet.reset(new SfxItemSet(*_rpPool));
}
- void ControlCharacterDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults)
+ void ControlCharacterDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool)
{
// from the pool, get and remember the font list (needs to be deleted)
const SvxFontListItem& rFontListItem = static_cast<const SvxFontListItem&>(_rpPool->GetUserOrPoolDefaultItem(FontItemIds::CFID_FONTLIST));
@@ -573,14 +577,8 @@ namespace pcr
_rpSet.reset();
// delete the pool
- _rpPool->ReleasePoolDefaults(true);
- // the "true" means delete the items, too
_rpPool = nullptr;
- // reset the defaults ptr
- _rpDefaults = nullptr;
- // no need to explicitly delete the defaults, this has been done by the ReleaseDefaults
-
delete pFontList;
}
diff --git a/extensions/source/propctrlr/fontdialog.hxx b/extensions/source/propctrlr/fontdialog.hxx
index a5946719674c..de184df5e841 100644
--- a/extensions/source/propctrlr/fontdialog.hxx
+++ b/extensions/source/propctrlr/fontdialog.hxx
@@ -36,10 +36,10 @@ namespace pcr
virtual ~ControlCharacterDialog() override;
/// creates an item set to be used with this dialog
- static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults);
+ static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool);
/// destroys an item previously created with <method>createItemSet</method>
- static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults);
+ static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool);
/// fills the given item set with values obtained from the given property set
static void translatePropertiesToItems(
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 40514f8016dd..9527da83298f 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2834,8 +2834,7 @@ namespace pcr
// create an item set for use with the dialog
std::unique_ptr<SfxItemSet> pSet;
rtl::Reference<SfxItemPool> pPool;
- std::vector<SfxPoolItem*>* pDefaults = nullptr;
- ControlCharacterDialog::createItemSet(pSet, pPool, pDefaults);
+ ControlCharacterDialog::createItemSet(pSet, pPool);
ControlCharacterDialog::translatePropertiesToItems(m_xComponent, pSet.get());
{ // do this in an own block. The dialog needs to be destroyed before we call
@@ -2855,7 +2854,7 @@ namespace pcr
}
}
- ControlCharacterDialog::destroyItemSet(pSet, pPool, pDefaults);
+ ControlCharacterDialog::destroyItemSet(pSet, pPool);
return bSuccess;
}