summaryrefslogtreecommitdiff
path: root/reportdesign
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 /reportdesign
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 'reportdesign')
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx1
-rw-r--r--reportdesign/source/ui/misc/UITools.cxx263
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx202
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx3
4 files changed, 217 insertions, 252 deletions
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 6d807911a8fb..6adc5f81bb0e 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -587,7 +587,6 @@ void OReportDefinition::init()
try
{
m_pImpl->m_pReportModel = std::make_shared<OReportModel>(this);
- m_pImpl->m_pReportModel->GetItemPool().FreezeIdRanges();
m_pImpl->m_pReportModel->SetScaleUnit( MapUnit::Map100thMM );
SdrLayerAdmin& rAdmin = m_pImpl->m_pReportModel->GetLayerAdmin();
rAdmin.NewLayer("front", RPT_LAYER_FRONT.get());
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 99b5477788d3..f961c54296d1 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -545,6 +545,107 @@ namespace
}
}
+static ItemInfoPackage& getItemInfoPackageOpenCharDlg()
+{
+ class ItemInfoPackageOpenCharDlg : public ItemInfoPackage
+ {
+ typedef std::array<ItemInfoStatic, ITEMID_WEIGHT_COMPLEX - XATTR_FILL_FIRST + 1> ItemInfoArrayOpenCharDlg;
+ // const ::Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #i121448# Use defined default color
+ // const ::Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color
+ // const basegfx::BGradient aNullGrad;
+ // const XHatch aNullHatch(Color(COL_DEFAULT_SHAPE_STROKE));
+ ItemInfoArrayOpenCharDlg maItemInfos {{
+ // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
+ { XATTR_FILLSTYLE, new XFillStyleItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLCOLOR, new XFillColorItem("", COL_DEFAULT_SHAPE_FILLING), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE },
+ { XATTR_FILLGRADIENT, new XFillGradientItem(basegfx::BGradient()), 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLHATCH, new XFillHatchItem(COL_DEFAULT_SHAPE_STROKE), 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBITMAP, nullptr, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLTRANSPARENCE, new XFillTransparenceItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_GRADIENTSTEPCOUNT, new XGradientStepCountItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_TILE, new XFillBmpTileItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_POS, new XFillBmpPosItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_SIZEX, new XFillBmpSizeXItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_SIZEY, new XFillBmpSizeYItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLFLOATTRANSPARENCE, new XFillFloatTransparenceItem(basegfx::BGradient(), false), 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_SECONDARYFILLCOLOR, new XSecondaryFillColorItem("", COL_DEFAULT_SHAPE_FILLING), 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_SIZELOG, new XFillBmpSizeLogItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_TILEOFFSETX, new XFillBmpTileOffsetXItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_TILEOFFSETY, new XFillBmpTileOffsetYItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_STRETCH, new XFillBmpStretchItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_POSOFFSETX, new XFillBmpPosOffsetXItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_POSOFFSETY, new XFillBmpPosOffsetYItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBACKGROUND, new XFillBackgroundItem, 0, SFX_ITEMINFOFLAG_NONE },
+
+ { ITEMID_FONT, new SvxFontItem(ITEMID_FONT), SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_FONTHEIGHT, new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT), SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_LANGUAGE, new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE), SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_POSTURE, new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE), SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_WEIGHT, new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT), SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_SHADOWED, new SvxShadowedItem(false,ITEMID_SHADOWED), SID_ATTR_CHAR_SHADOWED, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_WORDLINEMODE, new SvxWordLineModeItem(false,ITEMID_WORDLINEMODE), SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_CONTOUR, new SvxContourItem(false,ITEMID_CONTOUR), SID_ATTR_CHAR_CONTOUR, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_CROSSEDOUT, new SvxCrossedOutItem(STRIKEOUT_NONE,ITEMID_CROSSEDOUT), SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_UNDERLINE, new SvxUnderlineItem(LINESTYLE_NONE,ITEMID_UNDERLINE), SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_COLOR, new SvxColorItem(ITEMID_COLOR), SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_KERNING, new SvxKerningItem(0,ITEMID_KERNING), SID_ATTR_CHAR_KERNING, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_CASEMAP, new SvxCaseMapItem(SvxCaseMap::NotMapped,ITEMID_CASEMAP), SID_ATTR_CHAR_CASEMAP, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_ESCAPEMENT, new SvxEscapementItem(ITEMID_ESCAPEMENT), SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEMINFOFLAG_NONE },
+
+ // needs to be a on-demand item created in the callback
+ { ITEMID_FONTLIST, nullptr, SID_ATTR_CHAR_FONTLIST, SFX_ITEMINFOFLAG_NONE },
+
+ { ITEMID_AUTOKERN, new SvxAutoKernItem(false,ITEMID_AUTOKERN), SID_ATTR_CHAR_AUTOKERN, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_COLOR_TABLE, new SvxColorListItem(XColorList::CreateStdColorList(),ITEMID_COLOR_TABLE), SID_COLOR_TABLE, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_BLINK, new SvxBlinkItem(false,ITEMID_BLINK), SID_ATTR_FLASH, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_EMPHASISMARK, new SvxEmphasisMarkItem(FontEmphasisMark::NONE,ITEMID_EMPHASISMARK), SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_TWOLINES, new SvxTwoLinesItem(true,0,0,ITEMID_TWOLINES), SID_ATTR_CHAR_TWO_LINES, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_CHARROTATE, new SvxCharRotateItem(0_deg10,false,ITEMID_CHARROTATE), SID_ATTR_CHAR_ROTATED, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_CHARSCALE_W, new SvxCharScaleWidthItem(100,ITEMID_CHARSCALE_W), SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_CHARRELIEF, new SvxCharReliefItem(FontRelief::NONE,ITEMID_CHARRELIEF), SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_CHARHIDDEN, new SvxCharHiddenItem(false,ITEMID_CHARHIDDEN), SID_ATTR_CHAR_HIDDEN, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_BRUSH, new SvxBrushItem(ITEMID_BRUSH), SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_HORJUSTIFY, new SvxHorJustifyItem(ITEMID_HORJUSTIFY), SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_VERJUSTIFY, new SvxVerJustifyItem(ITEMID_VERJUSTIFY), SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEMINFOFLAG_NONE },
+
+ // Asian
+ { ITEMID_FONT_ASIAN , new SvxFontItem(ITEMID_FONT_ASIAN), SID_ATTR_CHAR_CJK_FONT, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_FONTHEIGHT_ASIAN , new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_ASIAN), SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_LANGUAGE_ASIAN , new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_ASIAN), SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_POSTURE_ASIAN , new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_ASIAN), SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_WEIGHT_ASIAN , new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_ASIAN), SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEMINFOFLAG_NONE },
+
+ // Complex
+ { ITEMID_FONT_COMPLEX , new SvxFontItem(ITEMID_FONT_COMPLEX), SID_ATTR_CHAR_CTL_FONT, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_FONTHEIGHT_COMPLEX , new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_COMPLEX), SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_LANGUAGE_COMPLEX , new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_COMPLEX), SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_POSTURE_COMPLEX , new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_COMPLEX), SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEMINFOFLAG_NONE },
+ { ITEMID_WEIGHT_COMPLEX , new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_COMPLEX), SID_ATTR_CHAR_CTL_WEIGHT, 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;
+
+ if (XATTR_FILLBITMAP == rRetval.getWhich())
+ return *new ItemInfoDynamic(rRetval, new XFillBitmapItem(Graphic()));
+
+ // return in any case
+ return rRetval;
+ }
+ };
+
+ static std::unique_ptr<ItemInfoPackageOpenCharDlg> g_aItemInfoPackageOpenCharDlg;
+ if (!g_aItemInfoPackageOpenCharDlg)
+ g_aItemInfoPackageOpenCharDlg.reset(new ItemInfoPackageOpenCharDlg);
+ return *g_aItemInfoPackageOpenCharDlg;
+}
bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
const uno::Reference< awt::XWindow>& _rxParentWindow, uno::Sequence< beans::NamedValue >& _out_rNewValues )
@@ -555,158 +656,28 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep
_out_rNewValues = uno::Sequence< beans::NamedValue >();
-
// UNO->ItemSet
- static SfxItemInfo aItemInfos[] =
- {
- // _nItemInfoSlotID, _nItemInfoFlags
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLSTYLE
- { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // XATTR_FILLCOLOR
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLGRADIENT
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLHATCH
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBITMAP
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLTRANSPARENCE
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_GRADIENTSTEPCOUNT
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_TILE
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_POS
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_SIZEX
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_SIZEY
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLFLOATTRANSPARENCE
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_SECONDARYFILLCOLOR
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_SIZELOG
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_TILEOFFSETX
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_TILEOFFSETY
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_STRETCH
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_POSOFFSETX
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_POSOFFSETY
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBACKGROUND
-
- { SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_SHADOWED, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_CONTOUR, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_KERNING, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_CASEMAP, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_FONTLIST, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_AUTOKERN, SFX_ITEMINFOFLAG_NONE },
- { SID_COLOR_TABLE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_FLASH, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_TWO_LINES, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_ROTATED, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_HIDDEN, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEMINFOFLAG_NONE },
-
- // Asian
- { SID_ATTR_CHAR_CJK_FONT, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEMINFOFLAG_NONE },
- // Complex
- { SID_ATTR_CHAR_CTL_FONT, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEMINFOFLAG_NONE }
- };
- FontList aFontList(Application::GetDefaultDevice());
- XColorListRef pColorList( XColorList::CreateStdColorList() );
- const ::Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color
- const ::Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #i121448# Use defined default color
- // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] as defaults
- const basegfx::BGradient aNullGrad;
-
- const XHatch aNullHatch(aNullLineCol);
- std::vector<SfxPoolItem*> pDefaults
- {
- new XFillStyleItem,
- new XFillColorItem("", aNullFillCol),
- new XFillGradientItem(aNullGrad),
- new XFillHatchItem(aNullHatch),
- new XFillBitmapItem(Graphic()),
- new XFillTransparenceItem,
- new XGradientStepCountItem,
- new XFillBmpTileItem,
- new XFillBmpPosItem,
- new XFillBmpSizeXItem,
- new XFillBmpSizeYItem,
- new XFillFloatTransparenceItem(aNullGrad, false),
- new XSecondaryFillColorItem("", aNullFillCol),
- new XFillBmpSizeLogItem,
- new XFillBmpTileOffsetXItem,
- new XFillBmpTileOffsetYItem,
- new XFillBmpStretchItem,
- new XFillBmpPosOffsetXItem,
- new XFillBmpPosOffsetYItem,
- new XFillBackgroundItem,
-
- new SvxFontItem(ITEMID_FONT),
- new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT),
- new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE),
- new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE),
- new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT),
-
- new SvxShadowedItem(false,ITEMID_SHADOWED),
- new SvxWordLineModeItem(false,ITEMID_WORDLINEMODE),
- new SvxContourItem(false,ITEMID_CONTOUR),
- new SvxCrossedOutItem(STRIKEOUT_NONE,ITEMID_CROSSEDOUT),
- new SvxUnderlineItem(LINESTYLE_NONE,ITEMID_UNDERLINE),
-
- new SvxColorItem(ITEMID_COLOR),
- new SvxKerningItem(0,ITEMID_KERNING),
- new SvxCaseMapItem(SvxCaseMap::NotMapped,ITEMID_CASEMAP),
- new SvxEscapementItem(ITEMID_ESCAPEMENT),
- new SvxFontListItem(&aFontList,ITEMID_FONTLIST),
- new SvxAutoKernItem(false,ITEMID_AUTOKERN),
- new SvxColorListItem(pColorList,ITEMID_COLOR_TABLE),
- new SvxBlinkItem(false,ITEMID_BLINK),
- new SvxEmphasisMarkItem(FontEmphasisMark::NONE,ITEMID_EMPHASISMARK),
- new SvxTwoLinesItem(true,0,0,ITEMID_TWOLINES),
- new SvxCharRotateItem(0_deg10,false,ITEMID_CHARROTATE),
- new SvxCharScaleWidthItem(100,ITEMID_CHARSCALE_W),
- new SvxCharReliefItem(FontRelief::NONE,ITEMID_CHARRELIEF),
- new SvxCharHiddenItem(false,ITEMID_CHARHIDDEN),
- new SvxBrushItem(ITEMID_BRUSH),
- new SvxHorJustifyItem(ITEMID_HORJUSTIFY),
- new SvxVerJustifyItem(ITEMID_VERJUSTIFY),
-// Asian
- new SvxFontItem(ITEMID_FONT_ASIAN),
- new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_ASIAN),
- new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_ASIAN),
- new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_ASIAN),
- new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_ASIAN),
-// Complex
- new SvxFontItem(ITEMID_FONT_COMPLEX),
- new SvxFontHeightItem(240,100,ITEMID_FONTHEIGHT_COMPLEX),
- new SvxLanguageItem(LANGUAGE_GERMAN,ITEMID_LANGUAGE_COMPLEX),
- new SvxPostureItem(ITALIC_NONE,ITEMID_POSTURE_COMPLEX),
- new SvxWeightItem(WEIGHT_NORMAL,ITEMID_WEIGHT_COMPLEX)
-
- };
-
- OSL_ASSERT( pDefaults.size() == SAL_N_ELEMENTS(aItemInfos) );
-
static const WhichRangesContainer pRanges(svl::Items<
XATTR_FILLSTYLE, XATTR_FILLBACKGROUND,
ITEMID_FONT, ITEMID_WEIGHT_COMPLEX
>);
- rtl::Reference<SfxItemPool> pPool(new SfxItemPool("ReportCharProperties", XATTR_FILL_FIRST,ITEMID_WEIGHT_COMPLEX, aItemInfos, &pDefaults));
+ rtl::Reference<SfxItemPool> pPool(new SfxItemPool("ReportCharProperties"));
// not needed for font height pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why
- pPool->FreezeIdRanges(); // the same
+
+ // here we have to use the callback to create all needed default entries.
+ // this uses local aFontList for temporary SvxFontListItem
+ FontList aFontList(Application::GetDefaultDevice());
+ pPool->registerItemInfoPackage(
+ getItemInfoPackageOpenCharDlg(),
+ [&aFontList](sal_uInt16 nWhich)
+ {
+ SfxPoolItem* pRetval(nullptr);
+ if (ITEMID_FONTLIST == nWhich)
+ pRetval = new SvxFontListItem(&aFontList, ITEMID_FONTLIST);
+ return pRetval;
+ });
+
bool bSuccess = false;
try
{
@@ -733,8 +704,6 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep
}
pPool.clear();
- for (SfxPoolItem* pDefault : pDefaults)
- delete pDefault;
return bSuccess;
}
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index a87a867c1db0..468d078b4a0c 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -2321,101 +2321,95 @@ void OReportController::OnInvalidateClipboard()
InvalidateFeature(SID_PASTE);
}
+static ItemInfoPackage& getItemInfoPackageOpenPageDlg()
+{
+ class ItemInfoPackageOpenPageDlg : public ItemInfoPackage
+ {
+ typedef std::array<ItemInfoStatic, RPTUI_ID_METRIC - RPTUI_ID_LRSPACE + 1> ItemInfoArrayOpenPageDlg;
+ ItemInfoArrayOpenPageDlg maItemInfos {{
+ // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
+ { RPTUI_ID_LRSPACE, new SvxLRSpaceItem(RPTUI_ID_LRSPACE), SID_ATTR_LRSPACE, SFX_ITEMINFOFLAG_NONE },
+ { RPTUI_ID_ULSPACE, new SvxULSpaceItem(RPTUI_ID_ULSPACE), SID_ATTR_ULSPACE, SFX_ITEMINFOFLAG_NONE },
+ { RPTUI_ID_PAGE, new SvxPageItem(RPTUI_ID_PAGE), SID_ATTR_PAGE, SFX_ITEMINFOFLAG_NONE },
+ { RPTUI_ID_SIZE, new SvxSizeItem(RPTUI_ID_SIZE), SID_ATTR_PAGE_SIZE, SFX_ITEMINFOFLAG_NONE },
+ { RPTUI_ID_PAGE_MODE, new SfxUInt16Item(RPTUI_ID_PAGE_MODE,SVX_PAGE_MODE_STANDARD), SID_ENUM_PAGE_MODE, SFX_ITEMINFOFLAG_NONE },
+ { RPTUI_ID_START, new SfxUInt16Item(RPTUI_ID_START,PAPER_A4), SID_PAPER_START, SFX_ITEMINFOFLAG_NONE },
+ { RPTUI_ID_END, new SfxUInt16Item(RPTUI_ID_END,PAPER_E), SID_PAPER_END, SFX_ITEMINFOFLAG_NONE },
+ { RPTUI_ID_BRUSH, new SvxBrushItem(RPTUI_ID_BRUSH), SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLSTYLE, new XFillStyleItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLCOLOR, new XFillColorItem("", COL_DEFAULT_SHAPE_FILLING), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE },
+ { XATTR_FILLGRADIENT, new XFillGradientItem(basegfx::BGradient()), 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLHATCH, new XFillHatchItem(XHatch(COL_DEFAULT_SHAPE_STROKE)), 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBITMAP, nullptr, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLTRANSPARENCE, new XFillTransparenceItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_GRADIENTSTEPCOUNT, new XGradientStepCountItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_TILE, new XFillBmpTileItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_POS, new XFillBmpPosItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_SIZEX, new XFillBmpSizeXItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_SIZEY, new XFillBmpSizeYItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLFLOATTRANSPARENCE, new XFillFloatTransparenceItem(basegfx::BGradient(), false), 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_SECONDARYFILLCOLOR, new XSecondaryFillColorItem("", COL_DEFAULT_SHAPE_FILLING), 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_SIZELOG, new XFillBmpSizeLogItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_TILEOFFSETX, new XFillBmpTileOffsetXItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_TILEOFFSETY, new XFillBmpTileOffsetYItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_STRETCH, new XFillBmpStretchItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_POSOFFSETX, new XFillBmpPosOffsetXItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBMP_POSOFFSETY, new XFillBmpPosOffsetYItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { XATTR_FILLBACKGROUND, new XFillBackgroundItem, 0, SFX_ITEMINFOFLAG_NONE },
+ { RPTUI_ID_METRIC, nullptr, SID_ATTR_METRIC, SFX_ITEMINFOFLAG_NONE },
+ }};
+
+ public:
+ ItemInfoPackageOpenPageDlg()
+ {
+ const MeasurementSystem eSystem(SvtSysLocale().GetLocaleData().getMeasurementSystemEnum());
+ const FieldUnit eUserMetric(MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH);
+ setItemAtItemInfoStatic(
+ new SfxUInt16Item(RPTUI_ID_METRIC,static_cast<sal_uInt16>(eUserMetric)),
+ maItemInfos[RPTUI_ID_METRIC - RPTUI_ID_LRSPACE]);
+ }
+
+ 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;
+
+ if (XATTR_FILLBITMAP == rRetval.getWhich())
+ return *new ItemInfoDynamic(rRetval, new XFillBitmapItem(Graphic()));
+
+ // return in any case
+ return rRetval;
+ }
+ };
+
+ static std::unique_ptr<ItemInfoPackageOpenPageDlg> g_aItemInfoPackageOpenPageDlg;
+ if (!g_aItemInfoPackageOpenPageDlg)
+ g_aItemInfoPackageOpenPageDlg.reset(new ItemInfoPackageOpenPageDlg);
+ return *g_aItemInfoPackageOpenPageDlg;
+}
+
void OReportController::openPageDialog(const uno::Reference<report::XSection>& _xSection)
{
if ( !m_xReportDefinition.is() )
return;
// UNO->ItemSet
- static SfxItemInfo aItemInfos[] =
- {
- // _nItemInfoSlotID, _nItemInfoFlags
- { SID_ATTR_LRSPACE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_ULSPACE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_PAGE, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_PAGE_SIZE, SFX_ITEMINFOFLAG_NONE },
- { SID_ENUM_PAGE_MODE, SFX_ITEMINFOFLAG_NONE },
- { SID_PAPER_START, SFX_ITEMINFOFLAG_NONE },
- { SID_PAPER_END, SFX_ITEMINFOFLAG_NONE },
- { SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_NONE },
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLSTYLE
- { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // XATTR_FILLCOLOR
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLGRADIENT
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLHATCH
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBITMAP
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLTRANSPARENCE
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_GRADIENTSTEPCOUNT
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_TILE
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_POS
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_SIZEX
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_SIZEY
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLFLOATTRANSPARENCE
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_SECONDARYFILLCOLOR
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_SIZELOG
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_TILEOFFSETX
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_TILEOFFSETY
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_STRETCH
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_POSOFFSETX
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBMP_POSOFFSETY
- { 0, SFX_ITEMINFOFLAG_NONE }, // XATTR_FILLBACKGROUND
- { SID_ATTR_METRIC, SFX_ITEMINFOFLAG_NONE }
- };
-
MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
FieldUnit eUserMetric = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH;
- static const WhichRangesContainer pRanges(svl::Items<
- RPTUI_ID_LRSPACE, XATTR_FILL_LAST,
- SID_ATTR_METRIC,SID_ATTR_METRIC
- >);
- rtl::Reference<SfxItemPool> pPool( new SfxItemPool("ReportPageProperties", RPTUI_ID_LRSPACE, RPTUI_ID_METRIC, aItemInfos ) );
-
- const ::Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color
- const ::Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #i121448# Use defined default color
- // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] as defaults
- const basegfx::BGradient aNullGrad;
- const XHatch aNullHatch(aNullLineCol);
-
- std::vector<SfxPoolItem*> pDefaults
- {
- new SvxLRSpaceItem(RPTUI_ID_LRSPACE),
- new SvxULSpaceItem(RPTUI_ID_ULSPACE),
- new SvxPageItem(RPTUI_ID_PAGE),
- new SvxSizeItem(RPTUI_ID_SIZE),
- new SfxUInt16Item(RPTUI_ID_PAGE_MODE,SVX_PAGE_MODE_STANDARD),
- new SfxUInt16Item(RPTUI_ID_START,PAPER_A4),
- new SfxUInt16Item(RPTUI_ID_END,PAPER_E),
- new SvxBrushItem(RPTUI_ID_BRUSH),
- new XFillStyleItem,
- new XFillColorItem("", aNullFillCol),
- new XFillGradientItem(aNullGrad),
- new XFillHatchItem(aNullHatch),
- new XFillBitmapItem(Graphic()),
- new XFillTransparenceItem,
- new XGradientStepCountItem,
- new XFillBmpTileItem,
- new XFillBmpPosItem,
- new XFillBmpSizeXItem,
- new XFillBmpSizeYItem,
- new XFillFloatTransparenceItem(aNullGrad, false),
- new XSecondaryFillColorItem("", aNullFillCol),
- new XFillBmpSizeLogItem,
- new XFillBmpTileOffsetXItem,
- new XFillBmpTileOffsetYItem,
- new XFillBmpStretchItem,
- new XFillBmpPosOffsetXItem,
- new XFillBmpPosOffsetYItem,
- new XFillBackgroundItem,
- new SfxUInt16Item(RPTUI_ID_METRIC,static_cast<sal_uInt16>(eUserMetric))
- };
-
- pPool->SetPoolDefaults(&pDefaults);
-
-
+ rtl::Reference<SfxItemPool> pPool(new SfxItemPool("ReportPageProperties"));
+ pPool->registerItemInfoPackage(getItemInfoPackageOpenPageDlg());
pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why
- pPool->FreezeIdRanges(); // the same
try
{
+ static const WhichRangesContainer pRanges(svl::Items<
+ RPTUI_ID_LRSPACE, XATTR_FILL_LAST,
+ SID_ATTR_METRIC,SID_ATTR_METRIC
+ >);
SfxItemSet aDescriptor(*pPool, pRanges);
// fill it
if ( _xSection.is() )
@@ -2509,10 +2503,6 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _
DBG_UNHANDLED_EXCEPTION("reportdesign");
}
pPool.clear();
-
- for (SfxPoolItem* pDefault : pDefaults)
- delete pDefault;
-
}
@@ -4181,23 +4171,34 @@ OSectionWindow* OReportController::getSectionWindow(const css::uno::Reference< c
return nullptr;
}
+static ItemInfoPackage& getItemInfoPackageOpenZoomDlg()
+{
+ class ItemInfoPackageOpenZoomDlg : public ItemInfoPackage
+ {
+ typedef std::array<ItemInfoStatic, 1> ItemInfoArrayOpenZoomDlg;
+ ItemInfoArrayOpenZoomDlg maItemInfos {{
+ // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
+ { SID_ATTR_ZOOM, new SvxZoomItem, 0, SFX_ITEMINFOFLAG_NONE }
+ }};
+
+ public:
+ virtual size_t size() const override { return maItemInfos.size(); }
+ virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; }
+ };
+
+ static std::unique_ptr<ItemInfoPackageOpenZoomDlg> g_aItemInfoPackageOpenZoomDlg;
+ if (!g_aItemInfoPackageOpenZoomDlg)
+ g_aItemInfoPackageOpenZoomDlg.reset(new ItemInfoPackageOpenZoomDlg);
+ return *g_aItemInfoPackageOpenZoomDlg;
+}
void OReportController::openZoomDialog()
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-
- static SfxItemInfo aItemInfos[] =
- {
- // _nItemInfoSlotID, _nItemInfoFlags
- { SID_ATTR_ZOOM, SFX_ITEMINFOFLAG_NONE }
- };
- std::vector<SfxPoolItem*> pDefaults
- {
- new SvxZoomItem()
- };
- rtl::Reference<SfxItemPool> pPool( new SfxItemPool("ZoomProperties", SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, &pDefaults) );
+ rtl::Reference<SfxItemPool> pPool(new SfxItemPool("ZoomProperties"));
+ pPool->registerItemInfoPackage(getItemInfoPackageOpenZoomDlg());
pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why
- pPool->FreezeIdRanges(); // the same
+
try
{
SfxItemSetFixed<SID_ATTR_ZOOM,SID_ATTR_ZOOM> aDescriptor(*pPool);
@@ -4226,9 +4227,6 @@ void OReportController::openZoomDialog()
DBG_UNHANDLED_EXCEPTION("reportdesign");
}
pPool.clear();
-
- for (SfxPoolItem* pDefault : pDefaults)
- delete pDefault;
}
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index e983c4bc214d..f910c3dbdf99 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -588,8 +588,7 @@ void OReportSection::createDefault(const OUString& _sType,SdrObject* _pObj)
{
auto i = static_cast<sal_uInt32>(std::distance(aObjList.begin(), aIter));
OReportModel aReportModel(nullptr);
- SfxItemPool& rPool = aReportModel.GetItemPool();
- rPool.FreezeIdRanges();
+
if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aReportModel ) )
{
const SdrObject* pSourceObj = aReportModel.GetPage( 0 )->GetObj( 0 );