diff options
77 files changed, 2127 insertions, 2750 deletions
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 1aa9ca380416..26d15e908761 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -203,7 +203,6 @@ DlgEditor::DlgEditor ( ,mnPaintGuard(0) ,m_xDocument( xModel ) { - pDlgEdModel->GetItemPool().FreezeIdRanges(); pDlgEdView.reset(new DlgEdView(*pDlgEdModel, *rWindow_.GetOutDev(), *this)); pDlgEdModel->SetScaleUnit( MapUnit::Map100thMM ); diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx index 0b3df1aa22ad..3fd4435d75b7 100644 --- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx +++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx @@ -147,7 +147,6 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co std::unique_ptr<SdrModel> pModel( new SdrModel()); - pModel->GetItemPool().FreezeIdRanges(); rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false ); pPage->SetSize(Size(1000,1000)); pModel->InsertPage( pPage.get(), 0 ); diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index 1446059a0223..5a678ad7e594 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -115,8 +115,6 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj ) if ( aObjList[ i ].equalsIgnoreAsciiCase( m_aCustomShapeType ) ) { FmFormModel aModel; - SfxItemPool& rPool(aModel.GetItemPool()); - rPool.FreezeIdRanges(); if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aModel ) ) { diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 8b198028baf7..e11e46ba2b8d 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -47,173 +47,167 @@ namespace chart { -ChartItemPool::ChartItemPool(): - SfxItemPool( "ChartItemPool" , SCHATTR_START, SCHATTR_END, nullptr, nullptr ), - pItemInfos(new SfxItemInfo[SCHATTR_END - SCHATTR_START + 1]) +static ItemInfoPackage& getItemInfoPackageChart() { - /************************************************************************** - * PoolDefaults - **************************************************************************/ - std::vector<SfxPoolItem*>* ppPoolDefaults = new std::vector<SfxPoolItem*>(SCHATTR_END - SCHATTR_START + 1); - std::vector<SfxPoolItem*>& rPoolDefaults = *ppPoolDefaults; - rPoolDefaults[SCHATTR_DATADESCR_SHOW_NUMBER - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_NUMBER); - rPoolDefaults[SCHATTR_DATADESCR_SHOW_PERCENTAGE- SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_PERCENTAGE); - rPoolDefaults[SCHATTR_DATADESCR_SHOW_CATEGORY - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_CATEGORY); - rPoolDefaults[SCHATTR_DATADESCR_SHOW_SYMBOL - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_SYMBOL); - rPoolDefaults[SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME); - rPoolDefaults[SCHATTR_DATADESCR_WRAP_TEXT - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_WRAP_TEXT); - rPoolDefaults[SCHATTR_DATADESCR_SEPARATOR - SCHATTR_START] = new SfxStringItem(SCHATTR_DATADESCR_SEPARATOR," "); - rPoolDefaults[SCHATTR_DATADESCR_PLACEMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_DATADESCR_PLACEMENT,0); - rPoolDefaults[SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, std::vector < sal_Int32 >() ); - rPoolDefaults[SCHATTR_DATADESCR_NO_PERCENTVALUE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE); - rPoolDefaults[SCHATTR_DATADESCR_CUSTOM_LEADER_LINES - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, true); - rPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_VALUE - SCHATTR_START] = new SfxUInt32Item(SCHATTR_PERCENT_NUMBERFORMAT_VALUE, 0); - rPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_SOURCE - SCHATTR_START] = new SfxBoolItem(SCHATTR_PERCENT_NUMBERFORMAT_SOURCE); - - //legend - rPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START] = new SfxInt32Item(SCHATTR_LEGEND_POS, sal_Int32(css::chart2::LegendPosition_LINE_END) ); - rPoolDefaults[SCHATTR_LEGEND_SHOW - SCHATTR_START] = new SfxBoolItem(SCHATTR_LEGEND_SHOW, true); - rPoolDefaults[SCHATTR_LEGEND_NO_OVERLAY - SCHATTR_START] = new SfxBoolItem(SCHATTR_LEGEND_NO_OVERLAY, true); - - //text - rPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START] = new SdrAngleItem(SCHATTR_TEXT_DEGREES, 0_deg100); - rPoolDefaults[SCHATTR_TEXT_STACKED - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_STACKED,false); - - //statistic - rPoolDefaults[SCHATTR_STAT_AVERAGE - SCHATTR_START] = new SfxBoolItem (SCHATTR_STAT_AVERAGE); - rPoolDefaults[SCHATTR_STAT_KIND_ERROR - SCHATTR_START] = new SvxChartKindErrorItem (SvxChartKindError::NONE, SCHATTR_STAT_KIND_ERROR); - rPoolDefaults[SCHATTR_STAT_PERCENT - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_PERCENT); - rPoolDefaults[SCHATTR_STAT_BIGERROR - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_BIGERROR); - rPoolDefaults[SCHATTR_STAT_CONSTPLUS - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTPLUS); - rPoolDefaults[SCHATTR_STAT_CONSTMINUS - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTMINUS); - rPoolDefaults[SCHATTR_STAT_INDICATE - SCHATTR_START] = new SvxChartIndicateItem (SvxChartIndicate::NONE, SCHATTR_STAT_INDICATE); - rPoolDefaults[SCHATTR_STAT_RANGE_POS - SCHATTR_START] = new SfxStringItem (SCHATTR_STAT_RANGE_POS, OUString()); - rPoolDefaults[SCHATTR_STAT_RANGE_NEG - SCHATTR_START] = new SfxStringItem (SCHATTR_STAT_RANGE_NEG, OUString()); - rPoolDefaults[SCHATTR_STAT_ERRORBAR_TYPE - SCHATTR_START] = new SfxBoolItem(SCHATTR_STAT_ERRORBAR_TYPE, true); - - rPoolDefaults[SCHATTR_STYLE_DEEP - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_DEEP, false); - rPoolDefaults[SCHATTR_STYLE_3D - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_3D, false); - rPoolDefaults[SCHATTR_STYLE_VERTICAL - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_VERTICAL, false); - rPoolDefaults[SCHATTR_STYLE_BASETYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_STYLE_BASETYPE, 0); - rPoolDefaults[SCHATTR_STYLE_LINES - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_LINES, false); - rPoolDefaults[SCHATTR_STYLE_PERCENT - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_PERCENT, false); - rPoolDefaults[SCHATTR_STYLE_STACKED - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_STACKED, false); - rPoolDefaults[SCHATTR_STYLE_SPLINES - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SPLINES, 0); //Bug: was Bool! test ->Fileformat (touches only 5's) - rPoolDefaults[SCHATTR_STYLE_SYMBOL - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SYMBOL, 0); - rPoolDefaults[SCHATTR_STYLE_SHAPE - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SHAPE, 0); - - rPoolDefaults[SCHATTR_AXIS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS,2); //2 = Y-Axis!!! - - //axis scale - rPoolDefaults[SCHATTR_AXISTYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXISTYPE, CHART_AXIS_REALNUMBER); - rPoolDefaults[SCHATTR_AXIS_REVERSE - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_REVERSE,false); - rPoolDefaults[SCHATTR_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MIN); - rPoolDefaults[SCHATTR_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MIN); - rPoolDefaults[SCHATTR_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MAX); - rPoolDefaults[SCHATTR_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MAX); - rPoolDefaults[SCHATTR_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN); - rPoolDefaults[SCHATTR_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_MAIN); - rPoolDefaults[SCHATTR_AXIS_MAIN_TIME_UNIT - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT,2); - rPoolDefaults[SCHATTR_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP); - rPoolDefaults[SCHATTR_AXIS_STEP_HELP - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_STEP_HELP,0); - rPoolDefaults[SCHATTR_AXIS_HELP_TIME_UNIT - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_HELP_TIME_UNIT,2); - rPoolDefaults[SCHATTR_AXIS_AUTO_TIME_RESOLUTION - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION); - rPoolDefaults[SCHATTR_AXIS_TIME_RESOLUTION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION,2); - rPoolDefaults[SCHATTR_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LOGARITHM); - rPoolDefaults[SCHATTR_AXIS_AUTO_DATEAXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS); - rPoolDefaults[SCHATTR_AXIS_ALLOW_DATEAXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_ALLOW_DATEAXIS); - rPoolDefaults[SCHATTR_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN); - rPoolDefaults[SCHATTR_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_ORIGIN); - - //axis position - rPoolDefaults[SCHATTR_AXIS_TICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_TICKS,CHAXIS_MARK_OUTER); - rPoolDefaults[SCHATTR_AXIS_HELPTICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_HELPTICKS,0); - rPoolDefaults[SCHATTR_AXIS_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_POSITION,0); - rPoolDefaults[SCHATTR_AXIS_POSITION_VALUE - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_POSITION_VALUE); - rPoolDefaults[SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT,0); - rPoolDefaults[SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION,false); - rPoolDefaults[SCHATTR_AXIS_LABEL_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_LABEL_POSITION,0); - rPoolDefaults[SCHATTR_AXIS_MARK_POSITION - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_MARK_POSITION,0); - - //axis label - rPoolDefaults[SCHATTR_AXIS_SHOWDESCR - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,false); - rPoolDefaults[SCHATTR_AXIS_LABEL_ORDER - SCHATTR_START] = new SvxChartTextOrderItem(SvxChartTextOrder::SideBySide, SCHATTR_AXIS_LABEL_ORDER); - rPoolDefaults[SCHATTR_AXIS_LABEL_OVERLAP - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LABEL_OVERLAP,false); - rPoolDefaults[SCHATTR_AXIS_LABEL_BREAK - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LABEL_BREAK, false ); - - rPoolDefaults[SCHATTR_SYMBOL_BRUSH - SCHATTR_START] = new SvxBrushItem(SCHATTR_SYMBOL_BRUSH); - rPoolDefaults[SCHATTR_STOCK_VOLUME - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_VOLUME,false); - rPoolDefaults[SCHATTR_STOCK_UPDOWN - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_UPDOWN,false); - rPoolDefaults[SCHATTR_SYMBOL_SIZE - SCHATTR_START] = new SvxSizeItem(SCHATTR_SYMBOL_SIZE,Size(0,0)); - rPoolDefaults[SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY - SCHATTR_START] = new SfxBoolItem(SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, false); - - // new for New Chart - rPoolDefaults[SCHATTR_BAR_OVERLAP - SCHATTR_START] = new SfxInt32Item(SCHATTR_BAR_OVERLAP,0); - rPoolDefaults[SCHATTR_BAR_GAPWIDTH - SCHATTR_START] = new SfxInt32Item(SCHATTR_BAR_GAPWIDTH,0); - rPoolDefaults[SCHATTR_BAR_CONNECT - SCHATTR_START] = new SfxBoolItem(SCHATTR_BAR_CONNECT, false); - rPoolDefaults[SCHATTR_NUM_OF_LINES_FOR_BAR - SCHATTR_START] = new SfxInt32Item( SCHATTR_NUM_OF_LINES_FOR_BAR, 0 ); - rPoolDefaults[SCHATTR_SPLINE_ORDER - SCHATTR_START] = new SfxInt32Item( SCHATTR_SPLINE_ORDER, 3 ); - rPoolDefaults[SCHATTR_SPLINE_RESOLUTION - SCHATTR_START] = new SfxInt32Item( SCHATTR_SPLINE_RESOLUTION, 20 ); - rPoolDefaults[SCHATTR_GROUP_BARS_PER_AXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, false); - rPoolDefaults[SCHATTR_STARTING_ANGLE - SCHATTR_START] = new SdrAngleItem( SCHATTR_STARTING_ANGLE, 9000_deg100 ); - rPoolDefaults[SCHATTR_CLOCKWISE - SCHATTR_START] = new SfxBoolItem( SCHATTR_CLOCKWISE, false ); - - rPoolDefaults[SCHATTR_MISSING_VALUE_TREATMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT, 0); - rPoolDefaults[SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, std::vector < sal_Int32 >() ); - rPoolDefaults[SCHATTR_INCLUDE_HIDDEN_CELLS - SCHATTR_START] = new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, true); - rPoolDefaults[SCHATTR_HIDE_LEGEND_ENTRY - SCHATTR_START] = new SfxBoolItem(SCHATTR_HIDE_LEGEND_ENTRY, false); - - rPoolDefaults[SCHATTR_AXIS_FOR_ALL_SERIES - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_FOR_ALL_SERIES, 0); - - rPoolDefaults[SCHATTR_REGRESSION_TYPE - SCHATTR_START] = new SvxChartRegressItem (SvxChartRegress::NONE, SCHATTR_REGRESSION_TYPE); - rPoolDefaults[SCHATTR_REGRESSION_SHOW_EQUATION - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SHOW_EQUATION, false); - rPoolDefaults[SCHATTR_REGRESSION_SHOW_COEFF - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SHOW_COEFF, false); - rPoolDefaults[SCHATTR_REGRESSION_DEGREE - SCHATTR_START] = new SfxInt32Item(SCHATTR_REGRESSION_DEGREE, 2); - rPoolDefaults[SCHATTR_REGRESSION_PERIOD - SCHATTR_START] = new SfxInt32Item(SCHATTR_REGRESSION_PERIOD, 2); - rPoolDefaults[SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD); - rPoolDefaults[SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD); - rPoolDefaults[SCHATTR_REGRESSION_SET_INTERCEPT - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SET_INTERCEPT, false); - rPoolDefaults[SCHATTR_REGRESSION_INTERCEPT_VALUE - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_REGRESSION_INTERCEPT_VALUE); - rPoolDefaults[SCHATTR_REGRESSION_CURVE_NAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_CURVE_NAME, OUString()); - rPoolDefaults[SCHATTR_REGRESSION_XNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_XNAME, "x"); - rPoolDefaults[SCHATTR_REGRESSION_YNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_YNAME, "f(x)"); - rPoolDefaults[SCHATTR_REGRESSION_MOVING_TYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_REGRESSION_MOVING_TYPE, css::chart2::MovingAverageType::Prior); - - rPoolDefaults[SCHATTR_DATA_TABLE_HORIZONTAL_BORDER - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false); - rPoolDefaults[SCHATTR_DATA_TABLE_VERTICAL_BORDER - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false); - rPoolDefaults[SCHATTR_DATA_TABLE_OUTLINE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATA_TABLE_OUTLINE, false); - rPoolDefaults[SCHATTR_DATA_TABLE_KEYS - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, false); - - /************************************************************************** - * ItemInfos - **************************************************************************/ - const sal_uInt16 nMax = SCHATTR_END - SCHATTR_START + 1; - for( sal_uInt16 i = 0; i < nMax; i++ ) + class ItemInfoPackageChart : public ItemInfoPackage { - // _nItemInfoSlotID, _nItemInfoFlags - pItemInfos[i]._nItemInfoSlotID = 0; - pItemInfos[i]._nItemInfoFlags = SFX_ITEMINFOFLAG_NONE; - } - - // slot ids differing from which ids - pItemInfos[SCHATTR_SYMBOL_BRUSH - SCHATTR_START]._nItemInfoSlotID = SID_ATTR_BRUSH; - pItemInfos[SCHATTR_STYLE_SYMBOL - SCHATTR_START]._nItemInfoSlotID = SID_ATTR_SYMBOLTYPE; - pItemInfos[SCHATTR_SYMBOL_SIZE - SCHATTR_START]._nItemInfoSlotID = SID_ATTR_SYMBOLSIZE; - - SetPoolDefaults(ppPoolDefaults); - SetItemInfos(pItemInfos.get()); + typedef std::array<ItemInfoStatic, SCHATTR_END - SCHATTR_START + 1> ItemInfoArrayChart; + ItemInfoArrayChart maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { SCHATTR_DATADESCR_SHOW_NUMBER, new SfxBoolItem(SCHATTR_DATADESCR_SHOW_NUMBER), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATADESCR_SHOW_PERCENTAGE, new SfxBoolItem(SCHATTR_DATADESCR_SHOW_PERCENTAGE), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATADESCR_SHOW_CATEGORY, new SfxBoolItem(SCHATTR_DATADESCR_SHOW_CATEGORY), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATADESCR_SHOW_SYMBOL, new SfxBoolItem(SCHATTR_DATADESCR_SHOW_SYMBOL), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATADESCR_WRAP_TEXT, new SfxBoolItem(SCHATTR_DATADESCR_WRAP_TEXT), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATADESCR_SEPARATOR, new SfxStringItem(SCHATTR_DATADESCR_SEPARATOR," "), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATADESCR_PLACEMENT, new SfxInt32Item(SCHATTR_DATADESCR_PLACEMENT,0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, std::vector < sal_Int32 >() ), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATADESCR_NO_PERCENTVALUE, new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, new SfxBoolItem(SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, true), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_PERCENT_NUMBERFORMAT_VALUE, new SfxUInt32Item(SCHATTR_PERCENT_NUMBERFORMAT_VALUE, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, new SfxBoolItem(SCHATTR_PERCENT_NUMBERFORMAT_SOURCE), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME, new SfxBoolItem(SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME), 0, SFX_ITEMINFOFLAG_NONE }, + + //legend + { SCHATTR_LEGEND_POS, new SfxInt32Item(SCHATTR_LEGEND_POS, sal_Int32(css::chart2::LegendPosition_LINE_END) ), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_LEGEND_SHOW, new SfxBoolItem(SCHATTR_LEGEND_SHOW, true), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_LEGEND_NO_OVERLAY, new SfxBoolItem(SCHATTR_LEGEND_NO_OVERLAY, true), 0, SFX_ITEMINFOFLAG_NONE }, + + //text + { SCHATTR_TEXT_DEGREES, new SdrAngleItem(SCHATTR_TEXT_DEGREES, 0_deg100), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_TEXT_STACKED, new SfxBoolItem(SCHATTR_TEXT_STACKED,false), 0, SFX_ITEMINFOFLAG_NONE }, + + //statistic + { SCHATTR_STAT_AVERAGE, new SfxBoolItem (SCHATTR_STAT_AVERAGE), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STAT_KIND_ERROR, new SvxChartKindErrorItem (SvxChartKindError::NONE, SCHATTR_STAT_KIND_ERROR), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STAT_PERCENT, new SvxDoubleItem (0.0, SCHATTR_STAT_PERCENT), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STAT_BIGERROR, new SvxDoubleItem (0.0, SCHATTR_STAT_BIGERROR), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STAT_CONSTPLUS, new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTPLUS), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STAT_CONSTMINUS, new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTMINUS), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STAT_INDICATE, new SvxChartIndicateItem (SvxChartIndicate::NONE, SCHATTR_STAT_INDICATE), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STAT_RANGE_POS, new SfxStringItem (SCHATTR_STAT_RANGE_POS, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STAT_RANGE_NEG, new SfxStringItem (SCHATTR_STAT_RANGE_NEG, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STAT_ERRORBAR_TYPE, new SfxBoolItem(SCHATTR_STAT_ERRORBAR_TYPE, true), 0, SFX_ITEMINFOFLAG_NONE }, + + { SCHATTR_STYLE_DEEP, new SfxBoolItem (SCHATTR_STYLE_DEEP, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STYLE_3D, new SfxBoolItem (SCHATTR_STYLE_3D, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STYLE_VERTICAL, new SfxBoolItem (SCHATTR_STYLE_VERTICAL, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STYLE_BASETYPE, new SfxInt32Item(SCHATTR_STYLE_BASETYPE, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STYLE_LINES, new SfxBoolItem (SCHATTR_STYLE_LINES, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STYLE_PERCENT, new SfxBoolItem (SCHATTR_STYLE_PERCENT, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STYLE_STACKED, new SfxBoolItem (SCHATTR_STYLE_STACKED, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STYLE_SPLINES, new SfxInt32Item (SCHATTR_STYLE_SPLINES, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STYLE_SYMBOL, new SfxInt32Item (SCHATTR_STYLE_SYMBOL, 0), SID_ATTR_SYMBOLTYPE, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STYLE_SHAPE, new SfxInt32Item (SCHATTR_STYLE_SHAPE, 0), 0, SFX_ITEMINFOFLAG_NONE }, + + { SCHATTR_AXIS, new SfxInt32Item(SCHATTR_AXIS,2), 0, SFX_ITEMINFOFLAG_NONE }, + + //axis scale + { SCHATTR_AXISTYPE, new SfxInt32Item(SCHATTR_AXISTYPE, CHART_AXIS_REALNUMBER), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_REVERSE, new SfxBoolItem(SCHATTR_AXIS_REVERSE,false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_AUTO_MIN, new SfxBoolItem(SCHATTR_AXIS_AUTO_MIN), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_MIN, new SvxDoubleItem(0.0, SCHATTR_AXIS_MIN), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_AUTO_MAX, new SfxBoolItem(SCHATTR_AXIS_AUTO_MAX), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_MAX, new SvxDoubleItem(0.0, SCHATTR_AXIS_MAX), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_AUTO_STEP_MAIN, new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_STEP_MAIN, new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_MAIN), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_MAIN_TIME_UNIT, new SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT,2), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_AUTO_STEP_HELP, new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_STEP_HELP, new SfxInt32Item(SCHATTR_AXIS_STEP_HELP,0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_HELP_TIME_UNIT, new SfxInt32Item(SCHATTR_AXIS_HELP_TIME_UNIT,2), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_AUTO_TIME_RESOLUTION, new SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_TIME_RESOLUTION, new SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION,2), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_LOGARITHM, new SfxBoolItem(SCHATTR_AXIS_LOGARITHM), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_AUTO_DATEAXIS, new SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_ALLOW_DATEAXIS, new SfxBoolItem(SCHATTR_AXIS_ALLOW_DATEAXIS), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_AUTO_ORIGIN, new SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_ORIGIN, new SvxDoubleItem(0.0, SCHATTR_AXIS_ORIGIN), 0, SFX_ITEMINFOFLAG_NONE }, + + //axis position + { SCHATTR_AXIS_TICKS, new SfxInt32Item(SCHATTR_AXIS_TICKS,CHAXIS_MARK_OUTER), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_HELPTICKS, new SfxInt32Item(SCHATTR_AXIS_HELPTICKS,0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_POSITION, new SfxInt32Item(SCHATTR_AXIS_POSITION,0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_POSITION_VALUE, new SvxDoubleItem(0.0, SCHATTR_AXIS_POSITION_VALUE), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, new SfxUInt32Item(SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT,0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION, new SfxBoolItem(SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION,false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_LABEL_POSITION, new SfxInt32Item(SCHATTR_AXIS_LABEL_POSITION,0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_MARK_POSITION, new SfxInt32Item(SCHATTR_AXIS_MARK_POSITION,0), 0, SFX_ITEMINFOFLAG_NONE }, + + //axis label + { SCHATTR_AXIS_SHOWDESCR, new SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_LABEL_ORDER, new SvxChartTextOrderItem(SvxChartTextOrder::SideBySide, SCHATTR_AXIS_LABEL_ORDER), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_LABEL_OVERLAP, new SfxBoolItem(SCHATTR_AXIS_LABEL_OVERLAP,false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AXIS_LABEL_BREAK, new SfxBoolItem(SCHATTR_AXIS_LABEL_BREAK, false ), 0, SFX_ITEMINFOFLAG_NONE }, + + { SCHATTR_SYMBOL_BRUSH, new SvxBrushItem(SCHATTR_SYMBOL_BRUSH), SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STOCK_VOLUME, new SfxBoolItem(SCHATTR_STOCK_VOLUME,false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STOCK_UPDOWN, new SfxBoolItem(SCHATTR_STOCK_UPDOWN,false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_SYMBOL_SIZE, new SvxSizeItem(SCHATTR_SYMBOL_SIZE,Size(0,0)), SID_ATTR_SYMBOLSIZE, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, new SfxBoolItem(SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, false), 0, SFX_ITEMINFOFLAG_NONE }, + + // new for New Chart + { SCHATTR_BAR_OVERLAP, new SfxInt32Item(SCHATTR_BAR_OVERLAP,0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_BAR_GAPWIDTH, new SfxInt32Item(SCHATTR_BAR_GAPWIDTH,0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_BAR_CONNECT, new SfxBoolItem(SCHATTR_BAR_CONNECT, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_NUM_OF_LINES_FOR_BAR, new SfxInt32Item( SCHATTR_NUM_OF_LINES_FOR_BAR, 0 ), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_SPLINE_ORDER, new SfxInt32Item( SCHATTR_SPLINE_ORDER, 3 ), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_SPLINE_RESOLUTION, new SfxInt32Item( SCHATTR_SPLINE_RESOLUTION, 20 ), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_GROUP_BARS_PER_AXIS, new SfxBoolItem(SCHATTR_GROUP_BARS_PER_AXIS, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_STARTING_ANGLE, new SdrAngleItem( SCHATTR_STARTING_ANGLE, 9000_deg100 ), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_CLOCKWISE, new SfxBoolItem( SCHATTR_CLOCKWISE, false ), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_MISSING_VALUE_TREATMENT, new SfxInt32Item(SCHATTR_MISSING_VALUE_TREATMENT, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, new SfxIntegerListItem(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, std::vector < sal_Int32 >() ), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_INCLUDE_HIDDEN_CELLS, new SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, true), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_HIDE_LEGEND_ENTRY, new SfxBoolItem(SCHATTR_HIDE_LEGEND_ENTRY, false), 0, SFX_ITEMINFOFLAG_NONE }, + + { SCHATTR_AXIS_FOR_ALL_SERIES, new SfxInt32Item(SCHATTR_AXIS_FOR_ALL_SERIES, 0), 0, SFX_ITEMINFOFLAG_NONE }, + + { SCHATTR_REGRESSION_TYPE, new SvxChartRegressItem (SvxChartRegress::NONE, SCHATTR_REGRESSION_TYPE), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_SHOW_EQUATION, new SfxBoolItem(SCHATTR_REGRESSION_SHOW_EQUATION, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_SHOW_COEFF, new SfxBoolItem(SCHATTR_REGRESSION_SHOW_COEFF, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_DEGREE, new SfxInt32Item(SCHATTR_REGRESSION_DEGREE, 2), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_PERIOD, new SfxInt32Item(SCHATTR_REGRESSION_PERIOD, 2), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD, new SvxDoubleItem(0.0, SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD, new SvxDoubleItem(0.0, SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_SET_INTERCEPT, new SfxBoolItem(SCHATTR_REGRESSION_SET_INTERCEPT, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_INTERCEPT_VALUE, new SvxDoubleItem(0.0, SCHATTR_REGRESSION_INTERCEPT_VALUE), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_CURVE_NAME, new SfxStringItem(SCHATTR_REGRESSION_CURVE_NAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_XNAME, new SfxStringItem(SCHATTR_REGRESSION_XNAME, "x"), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_YNAME, new SfxStringItem(SCHATTR_REGRESSION_YNAME, "f(x)"), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_REGRESSION_MOVING_TYPE, new SfxInt32Item(SCHATTR_REGRESSION_MOVING_TYPE, css::chart2::MovingAverageType::Prior), 0, SFX_ITEMINFOFLAG_NONE }, + + { SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, new SfxBoolItem(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATA_TABLE_VERTICAL_BORDER, new SfxBoolItem(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATA_TABLE_OUTLINE, new SfxBoolItem(SCHATTR_DATA_TABLE_OUTLINE, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SCHATTR_DATA_TABLE_KEYS, new SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, false), 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<ItemInfoPackageChart> g_aItemInfoPackageChart; + if (!g_aItemInfoPackageChart) + g_aItemInfoPackageChart.reset(new ItemInfoPackageChart); + return *g_aItemInfoPackageChart; } -ChartItemPool::ChartItemPool(const ChartItemPool& rPool): - SfxItemPool(rPool) +ChartItemPool::ChartItemPool() +: SfxItemPool("ChartItemPool") +{ + registerItemInfoPackage(getItemInfoPackageChart()); +} + +ChartItemPool::ChartItemPool(const ChartItemPool& rPool) +: SfxItemPool(rPool) { } ChartItemPool::~ChartItemPool() { - Delete(); - // release and delete static pool default items - ReleasePoolDefaults(true); + sendShutdownHint(); } rtl::Reference<SfxItemPool> ChartItemPool::Clone() const diff --git a/chart2/source/view/main/ChartItemPool.hxx b/chart2/source/view/main/ChartItemPool.hxx index 74a7ab1ebb29..558ab3c6e2fc 100644 --- a/chart2/source/view/main/ChartItemPool.hxx +++ b/chart2/source/view/main/ChartItemPool.hxx @@ -26,9 +26,6 @@ namespace chart { class ChartItemPool : public SfxItemPool { -private: - std::unique_ptr<SfxItemInfo[]> pItemInfos; - public: ChartItemPool(); ChartItemPool(const ChartItemPool& rPool); diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index a8cfa60d0875..71cd8d699cf7 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -57,7 +57,6 @@ DrawModelWrapper::DrawModelWrapper() // append chart pool to end of pool chain pMasterPool->GetLastPoolInChain()->SetSecondaryPool(m_xChartItemPool.get()); - pMasterPool->FreezeIdRanges(); SetTextDefaults(); //this factory needs to be created before first use of 3D scenes once upon an office runtime diff --git a/cui/qa/unit/cui-dialogs-test.cxx b/cui/qa/unit/cui-dialogs-test.cxx index a6f0b01d1edb..88a1d9b09464 100644 --- a/cui/qa/unit/cui-dialogs-test.cxx +++ b/cui/qa/unit/cui-dialogs-test.cxx @@ -50,7 +50,6 @@ void CuiDialogsTest::initialize() { mpFact = SvxAbstractDialogFactory::Create(); mxModel.reset(new SdrModel(nullptr, nullptr, true)); - mxModel->GetItemPool().FreezeIdRanges(); mxAttr.reset(new SfxItemSet(mxModel->GetItemPool())); } diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 37fe8ef913b0..384488deacbb 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -818,7 +818,6 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs ) std::unique_ptr<SdrModel> pModel( new SdrModel(nullptr, nullptr, true)); - pModel->GetItemPool().FreezeIdRanges(); rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false ); pPage->SetSize(Size(1000,1000)); pModel->InsertPage( pPage.get(), 0 ); @@ -1446,7 +1445,6 @@ IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::Toggleable&, void) pVDev->SetMapMode(MapMode(MapUnit::Map100thMM)); std::unique_ptr<SdrModel> pModel( new SdrModel(nullptr, nullptr, true)); - pModel->GetItemPool().FreezeIdRanges(); // Page rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false ); pPage->SetSize(Size(1000,1000)); diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index b1191b53f9a7..ee503f575e95 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -264,171 +264,133 @@ void ODbAdminDialog::clearPassword() m_pImpl->clearPassword(); } -void ODbAdminDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection) +static ItemInfoPackage& getItemInfoPackageAdminDlg() { - // just to be sure... - _rpSet = nullptr; - _rpPool = nullptr; - _rpDefaults = nullptr; - - static constexpr OUString sFilterAll( u"%"_ustr ); - // create and initialize the defaults - _rpDefaults = new std::vector<SfxPoolItem*>(DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1); - SfxPoolItem** pCounter = _rpDefaults->data(); // want to modify this without affecting the out param _rppDefaults - *pCounter++ = new SfxStringItem(DSID_NAME, OUString()); - *pCounter++ = new SfxStringItem(DSID_ORIGINALNAME, OUString()); - *pCounter++ = new SfxStringItem(DSID_CONNECTURL, OUString()); - *pCounter++ = new OStringListItem(DSID_TABLEFILTER, Sequence< OUString >{sFilterAll}); - *pCounter++ = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, _pTypeCollection); - *pCounter++ = new SfxBoolItem(DSID_INVALID_SELECTION, false); - *pCounter++ = new SfxBoolItem(DSID_READONLY, false); - *pCounter++ = new SfxStringItem(DSID_USER, OUString()); - *pCounter++ = new SfxStringItem(DSID_PASSWORD, OUString()); - *pCounter++ = new SfxStringItem(DSID_ADDITIONALOPTIONS, OUString()); - *pCounter++ = new SfxStringItem(DSID_CHARSET, OUString()); - *pCounter++ = new SfxBoolItem(DSID_PASSWORDREQUIRED, false); - *pCounter++ = new SfxBoolItem(DSID_SHOWDELETEDROWS, false); - *pCounter++ = new SfxBoolItem(DSID_ALLOWLONGTABLENAMES, false); - *pCounter++ = new SfxStringItem(DSID_JDBCDRIVERCLASS, OUString()); - *pCounter++ = new SfxStringItem(DSID_FIELDDELIMITER, OUString(',')); - *pCounter++ = new SfxStringItem(DSID_TEXTDELIMITER, OUString('"')); - *pCounter++ = new SfxStringItem(DSID_DECIMALDELIMITER, OUString('.')); - *pCounter++ = new SfxStringItem(DSID_THOUSANDSDELIMITER, OUString()); - *pCounter++ = new SfxStringItem(DSID_TEXTFILEEXTENSION, "txt"); - *pCounter++ = new SfxBoolItem(DSID_TEXTFILEHEADER, true); - *pCounter++ = new SfxBoolItem(DSID_PARAMETERNAMESUBST, false); - *pCounter++ = new SfxInt32Item(DSID_CONN_PORTNUMBER, 8100); - *pCounter++ = new SfxBoolItem(DSID_SUPPRESSVERSIONCL, false); - *pCounter++ = new SfxBoolItem(DSID_CONN_SHUTSERVICE, false); - *pCounter++ = new SfxInt32Item(DSID_CONN_DATAINC, 20); - *pCounter++ = new SfxInt32Item(DSID_CONN_CACHESIZE, 20); - *pCounter++ = new SfxStringItem(DSID_CONN_CTRLUSER, OUString()); - *pCounter++ = new SfxStringItem(DSID_CONN_CTRLPWD, OUString()); - *pCounter++ = new SfxBoolItem(DSID_USECATALOG, false); - *pCounter++ = new SfxStringItem(DSID_CONN_HOSTNAME, OUString()); - *pCounter++ = new SfxStringItem(DSID_CONN_LDAP_BASEDN, OUString()); - *pCounter++ = new SfxInt32Item(DSID_CONN_LDAP_PORTNUMBER, 389); - *pCounter++ = new SfxInt32Item(DSID_CONN_LDAP_ROWCOUNT, 100); - *pCounter++ = new SfxBoolItem(DSID_SQL92CHECK, false); - *pCounter++ = new SfxStringItem(DSID_AUTOINCREMENTVALUE, OUString()); - *pCounter++ = new SfxStringItem(DSID_AUTORETRIEVEVALUE, OUString()); - *pCounter++ = new SfxBoolItem(DSID_AUTORETRIEVEENABLED, false); - *pCounter++ = new SfxBoolItem(DSID_APPEND_TABLE_ALIAS, false); - *pCounter++ = new SfxInt32Item(DSID_MYSQL_PORTNUMBER, 3306); - *pCounter++ = new SfxBoolItem(DSID_IGNOREDRIVER_PRIV, true); - *pCounter++ = new SfxInt32Item(DSID_BOOLEANCOMPARISON, 0); - *pCounter++ = new SfxInt32Item(DSID_ORACLE_PORTNUMBER, 1521); - *pCounter++ = new SfxBoolItem(DSID_ENABLEOUTERJOIN, true); - *pCounter++ = new SfxBoolItem(DSID_CATALOG, true); - *pCounter++ = new SfxBoolItem(DSID_SCHEMA, true); - *pCounter++ = new SfxBoolItem(DSID_INDEXAPPENDIX, true); - *pCounter++ = new SfxBoolItem(DSID_CONN_LDAP_USESSL, false); - *pCounter++ = new SfxStringItem(DSID_DOCUMENT_URL, OUString()); - *pCounter++ = new SfxBoolItem(DSID_DOSLINEENDS, false); - *pCounter++ = new SfxStringItem(DSID_DATABASENAME, OUString()); - *pCounter++ = new SfxBoolItem(DSID_AS_BEFORE_CORRNAME, false); - *pCounter++ = new SfxBoolItem(DSID_CHECK_REQUIRED_FIELDS, true); - *pCounter++ = new SfxBoolItem(DSID_IGNORECURRENCY, false); - *pCounter++ = new SfxStringItem(DSID_CONN_SOCKET, OUString()); - *pCounter++ = new SfxBoolItem(DSID_ESCAPE_DATETIME, true); - *pCounter++ = new SfxStringItem(DSID_NAMED_PIPE, OUString()); - *pCounter++ = new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT ); - *pCounter++ = new SfxInt32Item(DSID_MAX_ROW_SCAN, 100); - *pCounter++ = new SfxBoolItem( DSID_RESPECTRESULTSETTYPE,false ); - *pCounter++ = new SfxInt32Item(DSID_POSTGRES_PORTNUMBER, 5432); - - // create the pool - static SfxItemInfo const aItemInfos[DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1] = + class ItemInfoPackageAdminDlg : public ItemInfoPackage { - // _nItemInfoSlotID, _nItemInfoFlags - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, - {0, SFX_ITEMINFOFLAG_NONE }, + typedef std::array<ItemInfoStatic, DSID_LAST_ITEM_ID - DSID_FIRST_ITEM_ID + 1> ItemInfoArrayAdminDlg; + ItemInfoArrayAdminDlg maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { DSID_NAME, new SfxStringItem(DSID_NAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_ORIGINALNAME, new SfxStringItem(DSID_ORIGINALNAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONNECTURL, new SfxStringItem(DSID_CONNECTURL, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + + // gets added in costructor below once for LO runtime as static default + { DSID_TABLEFILTER, nullptr, 0, SFX_ITEMINFOFLAG_NONE }, + + // gets added by callback for each new Pool as dynamic default + { DSID_TYPECOLLECTION, nullptr, 0, SFX_ITEMINFOFLAG_NONE }, + + { DSID_INVALID_SELECTION, new SfxBoolItem(DSID_INVALID_SELECTION, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_READONLY, new SfxBoolItem(DSID_READONLY, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_USER, new SfxStringItem(DSID_USER, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_PASSWORD, new SfxStringItem(DSID_PASSWORD, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_ADDITIONALOPTIONS, new SfxStringItem(DSID_ADDITIONALOPTIONS, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CHARSET, new SfxStringItem(DSID_CHARSET, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_PASSWORDREQUIRED, new SfxBoolItem(DSID_PASSWORDREQUIRED, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_SHOWDELETEDROWS, new SfxBoolItem(DSID_SHOWDELETEDROWS, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_ALLOWLONGTABLENAMES, new SfxBoolItem(DSID_ALLOWLONGTABLENAMES, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_JDBCDRIVERCLASS, new SfxStringItem(DSID_JDBCDRIVERCLASS, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_FIELDDELIMITER, new SfxStringItem(DSID_FIELDDELIMITER, OUString(',')), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_TEXTDELIMITER, new SfxStringItem(DSID_TEXTDELIMITER, OUString('"')), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_DECIMALDELIMITER, new SfxStringItem(DSID_DECIMALDELIMITER, OUString('.')), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_THOUSANDSDELIMITER, new SfxStringItem(DSID_THOUSANDSDELIMITER, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_TEXTFILEEXTENSION, new SfxStringItem(DSID_TEXTFILEEXTENSION, "txt"), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_TEXTFILEHEADER, new SfxBoolItem(DSID_TEXTFILEHEADER, true), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_PARAMETERNAMESUBST, new SfxBoolItem(DSID_PARAMETERNAMESUBST, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_PORTNUMBER, new SfxInt32Item(DSID_CONN_PORTNUMBER, 8100), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_SUPPRESSVERSIONCL, new SfxBoolItem(DSID_SUPPRESSVERSIONCL, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_SHUTSERVICE, new SfxBoolItem(DSID_CONN_SHUTSERVICE, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_DATAINC, new SfxInt32Item(DSID_CONN_DATAINC, 20), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_CACHESIZE, new SfxInt32Item(DSID_CONN_CACHESIZE, 20), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_CTRLUSER, new SfxStringItem(DSID_CONN_CTRLUSER, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_CTRLPWD, new SfxStringItem(DSID_CONN_CTRLPWD, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_USECATALOG, new SfxBoolItem(DSID_USECATALOG, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_HOSTNAME, new SfxStringItem(DSID_CONN_HOSTNAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_LDAP_BASEDN, new SfxStringItem(DSID_CONN_LDAP_BASEDN, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_LDAP_PORTNUMBER, new SfxInt32Item(DSID_CONN_LDAP_PORTNUMBER, 389), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_LDAP_ROWCOUNT, new SfxInt32Item(DSID_CONN_LDAP_ROWCOUNT, 100), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_SQL92CHECK, new SfxBoolItem(DSID_SQL92CHECK, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_AUTOINCREMENTVALUE, new SfxStringItem(DSID_AUTOINCREMENTVALUE, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_AUTORETRIEVEVALUE, new SfxStringItem(DSID_AUTORETRIEVEVALUE, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_AUTORETRIEVEENABLED, new SfxBoolItem(DSID_AUTORETRIEVEENABLED, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_APPEND_TABLE_ALIAS, new SfxBoolItem(DSID_APPEND_TABLE_ALIAS, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_MYSQL_PORTNUMBER, new SfxInt32Item(DSID_MYSQL_PORTNUMBER, 3306), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_IGNOREDRIVER_PRIV, new SfxBoolItem(DSID_IGNOREDRIVER_PRIV, true), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_BOOLEANCOMPARISON, new SfxInt32Item(DSID_BOOLEANCOMPARISON, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_ORACLE_PORTNUMBER, new SfxInt32Item(DSID_ORACLE_PORTNUMBER, 1521), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_ENABLEOUTERJOIN, new SfxBoolItem(DSID_ENABLEOUTERJOIN, true), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CATALOG, new SfxBoolItem(DSID_CATALOG, true), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_SCHEMA, new SfxBoolItem(DSID_SCHEMA, true), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_INDEXAPPENDIX, new SfxBoolItem(DSID_INDEXAPPENDIX, true), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_LDAP_USESSL, new SfxBoolItem(DSID_CONN_LDAP_USESSL, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_DOCUMENT_URL, new SfxStringItem(DSID_DOCUMENT_URL, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_DOSLINEENDS, new SfxBoolItem(DSID_DOSLINEENDS, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_DATABASENAME, new SfxStringItem(DSID_DATABASENAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_AS_BEFORE_CORRNAME, new SfxBoolItem(DSID_AS_BEFORE_CORRNAME, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CHECK_REQUIRED_FIELDS, new SfxBoolItem(DSID_CHECK_REQUIRED_FIELDS, true), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_IGNORECURRENCY, new SfxBoolItem(DSID_IGNORECURRENCY, false), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_CONN_SOCKET, new SfxStringItem(DSID_CONN_SOCKET, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_ESCAPE_DATETIME, new SfxBoolItem(DSID_ESCAPE_DATETIME, true), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_NAMED_PIPE, new SfxStringItem(DSID_NAMED_PIPE, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_PRIMARY_KEY_SUPPORT, new OptionalBoolItem( DSID_PRIMARY_KEY_SUPPORT ), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_MAX_ROW_SCAN, new SfxInt32Item(DSID_MAX_ROW_SCAN, 100), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_RESPECTRESULTSETTYPE, new SfxBoolItem( DSID_RESPECTRESULTSETTYPE,false ), 0, SFX_ITEMINFOFLAG_NONE }, + { DSID_POSTGRES_PORTNUMBER, new SfxInt32Item(DSID_POSTGRES_PORTNUMBER, 5432), 0, SFX_ITEMINFOFLAG_NONE } + }}; + + public: + ItemInfoPackageAdminDlg() + { + static constexpr OUString sFilterAll( u"%"_ustr ); + setItemAtItemInfoStatic( + new OStringListItem(DSID_TABLEFILTER, Sequence< OUString >{sFilterAll}), + maItemInfos[DSID_TABLEFILTER - DSID_FIRST_ITEM_ID]); + } + + virtual size_t size() const override { return maItemInfos.size(); } + virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; } }; - OSL_ENSURE(std::size(aItemInfos) == sal_uInt16(DSID_LAST_ITEM_ID),"Invalid Ids!"); - _rpPool = new SfxItemPool("DSAItemPool", DSID_FIRST_ITEM_ID, DSID_LAST_ITEM_ID, - aItemInfos, _rpDefaults); - _rpPool->FreezeIdRanges(); + static std::unique_ptr<ItemInfoPackageAdminDlg> g_aItemInfoPackageAdminDlg; + if (!g_aItemInfoPackageAdminDlg) + g_aItemInfoPackageAdminDlg.reset(new ItemInfoPackageAdminDlg); + return *g_aItemInfoPackageAdminDlg; +} + +void ODbAdminDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, ::dbaccess::ODsnTypeCollection* _pTypeCollection) +{ + // just to be sure... + _rpSet = nullptr; + _rpPool = nullptr; + _rpPool = new SfxItemPool("DSAItemPool"); + + // here we have to use the callback to create all needed default entries since + // the DSID_TYPECOLLECTION needs the local given _pTypeCollection. Thus this will + // be a ItemInfoDynamic created by SfxItemPool::registerItemInfoPackage. That + // (and the contained Item) will be owned by the Pool and cleaned up when it goes + // down (see SfxItemPool::cleanupItemInfos()) + _rpPool->registerItemInfoPackage( + getItemInfoPackageAdminDlg(), + [&_pTypeCollection](sal_uInt16 nWhich) + { + SfxPoolItem* pRetval(nullptr); + if (DSID_TYPECOLLECTION == nWhich) + pRetval = new DbuTypeCollectionItem(DSID_TYPECOLLECTION, _pTypeCollection); + return pRetval; + }); // and, finally, the set _rpSet.reset(new SfxItemSet(*_rpPool)); } -void ODbAdminDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults) +void ODbAdminDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool) { // _first_ delete the set (referring the pool) _rpSet.reset(); // delete the pool - if (_rpPool) - { - _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 + _rpPool = nullptr; } } // namespace dbaui diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx index 53222a6afca2..ac56418ab71c 100644 --- a/dbaccess/source/ui/inc/dbadmin.hxx +++ b/dbaccess/source/ui/inc/dbadmin.hxx @@ -63,10 +63,10 @@ public: @param _pTypeCollection pointer to an <type>ODatasourceMap</type>. May be NULL, in this case the pool will not contain a typecollection default. */ - static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults, ::dbaccess::ODsnTypeCollection* _pTypeCollection); + static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, ::dbaccess::ODsnTypeCollection* _pTypeCollection); /** destroy and item set / item pool / pool defaults previously created by <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); /** selects the DataSource @param _rName diff --git a/dbaccess/source/ui/inc/unoadmin.hxx b/dbaccess/source/ui/inc/unoadmin.hxx index 944dccf87ae6..a1d6de4e8a0f 100644 --- a/dbaccess/source/ui/inc/unoadmin.hxx +++ b/dbaccess/source/ui/inc/unoadmin.hxx @@ -25,7 +25,6 @@ class SfxItemSet; class SfxItemPool; -class SfxPoolItem; namespace dbaui { @@ -38,8 +37,6 @@ class ODatabaseAdministrationDialog protected: std::unique_ptr<SfxItemSet> m_pDatasourceItems; // 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 std::unique_ptr<::dbaccess::ODsnTypeCollection> m_pCollection; // datasource type collection diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index a6474645b374..2a9747c01e5a 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -751,6 +751,29 @@ void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol, } } +static ItemInfoPackage& getItemInfoPackageColumnFormatDialog() +{ + class ItemInfoPackageColumnFormatDialog : public ItemInfoPackage + { + typedef std::array<ItemInfoStatic, SBA_ATTR_ALIGN_HOR_JUSTIFY - SBA_DEF_RANGEFORMAT + 1> ItemInfoArrayColumnFormatDialog; + ItemInfoArrayColumnFormatDialog maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { SBA_DEF_RANGEFORMAT, new SfxRangeItem(SBA_DEF_RANGEFORMAT, SBA_DEF_FMTVALUE, SBA_ATTR_ALIGN_HOR_JUSTIFY), 0, SFX_ITEMINFOFLAG_NONE }, + { SBA_DEF_FMTVALUE, new SfxUInt32Item(SBA_DEF_FMTVALUE), SID_ATTR_NUMBERFORMAT_VALUE, SFX_ITEMINFOFLAG_NONE }, + { SBA_ATTR_ALIGN_HOR_JUSTIFY, new SvxHorJustifyItem(SvxCellHorJustify::Standard, SBA_ATTR_ALIGN_HOR_JUSTIFY), SID_ATTR_ALIGN_HOR_JUSTIFY, 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<ItemInfoPackageColumnFormatDialog> g_aItemInfoPackageColumnFormatDialog; + if (!g_aItemInfoPackageColumnFormatDialog) + g_aItemInfoPackageColumnFormatDialog.reset(new ItemInfoPackageColumnFormatDialog); + return *g_aItemInfoPackageColumnFormatDialog; +} + bool callColumnFormatDialog(weld::Widget* _pParent, SvNumberFormatter* _pFormatter, sal_Int32 _nDataType, @@ -761,33 +784,15 @@ bool callColumnFormatDialog(weld::Widget* _pParent, bool bRet = false; // UNO->ItemSet - static SfxItemInfo aItemInfos[] = - { - // _nItemInfoSlotID, _nItemInfoFlags - { 0, SFX_ITEMINFOFLAG_NONE }, // SBA_DEF_RANGEFORMAT - { SID_ATTR_NUMBERFORMAT_VALUE, SFX_ITEMINFOFLAG_NONE }, // SBA_DEF_FMTVALUE - { SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEMINFOFLAG_NONE }, // SBA_ATTR_ALIGN_HOR_JUSTIFY - { SID_ATTR_NUMBERFORMAT_INFO, SFX_ITEMINFOFLAG_NONE }, // SID_ATTR_NUMBERFORMAT_INFO - { SID_ATTR_NUMBERFORMAT_ONE_AREA, SFX_ITEMINFOFLAG_NONE } // SID_ATTR_NUMBERFORMAT_ONE_AREA - }; static const auto aAttrMap = svl::Items< SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA >; - std::vector<SfxPoolItem*> pDefaults - { - new SfxRangeItem(SBA_DEF_RANGEFORMAT, SBA_DEF_FMTVALUE, SBA_ATTR_ALIGN_HOR_JUSTIFY), - new SfxUInt32Item(SBA_DEF_FMTVALUE), - new SvxHorJustifyItem(SvxCellHorJustify::Standard, SBA_ATTR_ALIGN_HOR_JUSTIFY), - new SvxNumberInfoItem(SID_ATTR_NUMBERFORMAT_INFO), - new SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, false) - }; - - rtl::Reference<SfxItemPool> pPool(new SfxItemPool("GridBrowserProperties", SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, aItemInfos, &pDefaults)); + rtl::Reference<SfxItemPool> pPool(new SfxItemPool("GridBrowserProperties")); + pPool->registerItemInfoPackage(getItemInfoPackageColumnFormatDialog()); pPool->SetDefaultMetric( MapUnit::MapTwip ); // ripped, don't understand why - pPool->FreezeIdRanges(); // the same std::optional<SfxItemSet> pFormatDescriptor(SfxItemSet(*pPool, aAttrMap)); // fill it @@ -853,8 +858,6 @@ bool callColumnFormatDialog(weld::Widget* _pParent, pFormatDescriptor.reset(); pPool.clear(); - for (SfxPoolItem* pDefault : pDefaults) - delete pDefault; return bRet; } diff --git a/dbaccess/source/ui/uno/unoadmin.cxx b/dbaccess/source/ui/uno/unoadmin.cxx index 3d863b92e8f9..8a98fff515f1 100644 --- a/dbaccess/source/ui/uno/unoadmin.cxx +++ b/dbaccess/source/ui/uno/unoadmin.cxx @@ -31,11 +31,10 @@ namespace dbaui using namespace ::com::sun::star::beans; ODatabaseAdministrationDialog::ODatabaseAdministrationDialog(const Reference< XComponentContext >& _rxORB) - :ODatabaseAdministrationDialogBase(_rxORB) - ,m_pItemPoolDefaults(nullptr) +: ODatabaseAdministrationDialogBase(_rxORB) { m_pCollection.reset( new ::dbaccess::ODsnTypeCollection(_rxORB) ); - ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults, m_pCollection.get()); + ODbAdminDialog::createItemSet(m_pDatasourceItems, m_pItemPool, m_pCollection.get()); } ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog() @@ -43,7 +42,7 @@ ODatabaseAdministrationDialog::~ODatabaseAdministrationDialog() ::osl::MutexGuard aGuard(m_aMutex); if (m_xDialog) destroyDialog(); - ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool, m_pItemPoolDefaults); + ODbAdminDialog::destroyItemSet(m_pDatasourceItems, m_pItemPool); } void ODatabaseAdministrationDialog::implInitialize(const Any& _rValue) diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index 0c2bcd28fa97..ede186b717a5 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -225,8 +225,6 @@ void CheckOrderedList(const CharAttribList::AttribsType& rAttribs); class EditEngineItemPool final : public SfxItemPool { -private: - std::shared_ptr<DefItems> m_xDefItems; public: EditEngineItemPool(); private: diff --git a/editeng/inc/eerdll2.hxx b/editeng/inc/eerdll2.hxx index 76653e79c403..e7882904d688 100644 --- a/editeng/inc/eerdll2.hxx +++ b/editeng/inc/eerdll2.hxx @@ -39,26 +39,13 @@ namespace editeng }; } -class DefItems -{ -public: - DefItems(); - std::vector<SfxPoolItem*> & getDefaults() { return mvDefItems; } - ~DefItems(); -private: - std::vector<SfxPoolItem*> mvDefItems; -}; - class GlobalEditData { private: css::uno::Reference< css::linguistic2::XLanguageGuessing > xLanguageGuesser; - std::weak_ptr<DefItems> m_xDefItems; std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenCharsTable; public: - std::shared_ptr<DefItems> GetDefItems(); - std::shared_ptr<SvxForbiddenCharactersTable> const & GetForbiddenCharsTable(); void SetForbiddenCharsTable(std::shared_ptr<SvxForbiddenCharactersTable> const & xForbiddenChars ) { xForbiddenCharsTable = xForbiddenChars; } css::uno::Reference< css::linguistic2::XLanguageGuessing > const & GetLanguageGuesser(); diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 14d4fdaf9b0f..bf9fca26f36c 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -157,67 +157,6 @@ bool IsScriptItemValid( sal_uInt16 nItemId, short nScriptType ) return bValid; } -const SfxItemInfo aItemInfos[EDITITEMCOUNT] = -{ - // _nItemInfoSlotID, _nItemInfoFlags - { SID_ATTR_FRAMEDIRECTION, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_WRITINGDIR - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // EE_PARA_XMLATTRIBS - { SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_HANGINGPUNCTUATION - { SID_ATTR_PARA_FORBIDDEN_RULES, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_FORBIDDENRULES - { SID_ATTR_PARA_SCRIPTSPACE, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_ASIANCJKSPACING - { SID_ATTR_NUMBERING_RULE, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_NUMBULL - { 0, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_HYPHENATE - { 0, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_HYPHENATE_NO_CAPS - { 0, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_HYPHENATE_NO_LAST_WORD - { 0, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_BULLETSTATE - { 0, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_OUTLLRSPACE - { SID_ATTR_PARA_OUTLLEVEL, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_OUTLLEVEL - { SID_ATTR_PARA_BULLET, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_BULLET - { SID_ATTR_LRSPACE, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_LRSPACE - { SID_ATTR_ULSPACE, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_ULSPACE - { SID_ATTR_PARA_LINESPACE, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_SBL - { SID_ATTR_PARA_ADJUST, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_JUST - { SID_ATTR_TABSTOP, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_TABS - { SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_JUST_METHOD - { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEMINFOFLAG_NONE }, // EE_PARA_VER_JUST - { SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // EE_CHAR_COLOR - { SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // EE_CHAR_FONTINFO - { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_FONTHEIGHT - { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_FONTWIDTH - { SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_WEIGHT - { SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_UNDERLINE - { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_STRIKEOUT - { SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_ITALIC - { SID_ATTR_CHAR_CONTOUR, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_OUTLINE - { SID_ATTR_CHAR_SHADOWED, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_SHADOW - { SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_ESCAPEMENT - { SID_ATTR_CHAR_AUTOKERN, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_PAIRKERNING - { SID_ATTR_CHAR_KERNING, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_KERNING - { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_WLM - { SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_LANGUAGE - { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_LANGUAGE_CJK - { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_LANGUAGE_CTL - { SID_ATTR_CHAR_CJK_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // EE_CHAR_FONTINFO_CJK - { SID_ATTR_CHAR_CTL_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // EE_CHAR_FONTINFO_CTL - { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_FONTHEIGHT_CJK - { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_FONTHEIGHT_CTL - { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_WEIGHT_CJK - { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_WEIGHT_CTL - { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_ITALIC_CJK - { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_ITALIC_CTL - { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_EMPHASISMARK - { SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_RELIEF - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // EE_CHAR_XMLATTRIBS - { SID_ATTR_CHAR_OVERLINE, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_OVERLINE - { SID_ATTR_CHAR_CASEMAP, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_CASEMAP - { SID_ATTR_CHAR_GRABBAG, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_GRABBAG - { SID_ATTR_CHAR_BACK_COLOR, SFX_ITEMINFOFLAG_NONE }, // EE_CHAR_BKGCOLOR - { 0, SFX_ITEMINFOFLAG_NONE }, // EE_FEATURE_TAB - { 0, SFX_ITEMINFOFLAG_NONE }, // EE_FEATURE_LINEBR - { SID_ATTR_CHAR_CHARSETCOLOR, SFX_ITEMINFOFLAG_NONE }, // EE_FEATURE_NOTCONV - { SID_FIELD, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // EE_FEATURE_FIELD -}; - EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_Int32 nS, sal_Int32 nE ) { // Create a new attribute in the pool @@ -1539,16 +1478,13 @@ void EditDoc::dumpAsXml(xmlTextWriterPtr pWriter) const } EditEngineItemPool::EditEngineItemPool() - : SfxItemPool( "EditEngineItemPool", EE_ITEMS_START, EE_ITEMS_END, - aItemInfos, nullptr ) +: SfxItemPool("EditEngineItemPool") { - m_xDefItems = EditDLL::Get().GetGlobalData()->GetDefItems(); - SetPoolDefaults(&m_xDefItems->getDefaults()); + registerItemInfoPackage(getItemInfoPackageEditEngine()); } EditEngineItemPool::~EditEngineItemPool() { - ClearPoolDefaults(); SetSecondaryPool(nullptr); } diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index d93eded8cbf7..ab6495c8a804 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -66,6 +66,8 @@ #include <editeng/justifyitem.hxx> #include <tools/mapunit.hxx> #include <vcl/lazydelete.hxx> +#include <svl/itempool.hxx> +#include <editeng/editids.hrc> using namespace ::com::sun::star; @@ -80,97 +82,132 @@ EditDLL& EditDLL::Get() return *gaEditDll.get(); } -DefItems::DefItems() - : mvDefItems(EDITITEMCOUNT) +ItemInfoPackage& getItemInfoPackageEditEngine() { - std::vector<SfxPoolItem*>& rDefItems = mvDefItems; - - // Paragraph attributes: - SvxNumRule aDefaultNumRule( SvxNumRuleFlags::NONE, 0, false ); - - rDefItems[0] = new SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ); - rDefItems[1] = new SvXMLAttrContainerItem( EE_PARA_XMLATTRIBS ); - rDefItems[2] = new SvxHangingPunctuationItem(false, EE_PARA_HANGINGPUNCTUATION); - rDefItems[3] = new SvxForbiddenRuleItem(true, EE_PARA_FORBIDDENRULES); - rDefItems[4] = new SvxScriptSpaceItem( true, EE_PARA_ASIANCJKSPACING ); - rDefItems[5] = new SvxNumBulletItem( aDefaultNumRule, EE_PARA_NUMBULLET ); - rDefItems[6] = new SfxBoolItem( EE_PARA_HYPHENATE, false ); - rDefItems[7] = new SfxBoolItem( EE_PARA_HYPHENATE_NO_CAPS, false ); - rDefItems[8] = new SfxBoolItem( EE_PARA_HYPHENATE_NO_LAST_WORD, false ); - rDefItems[9] = new SfxBoolItem( EE_PARA_BULLETSTATE, true ); - rDefItems[10] = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE ); - rDefItems[11] = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 ); - rDefItems[12] = new SvxBulletItem( EE_PARA_BULLET ); - rDefItems[13] = new SvxLRSpaceItem( EE_PARA_LRSPACE ); - rDefItems[14] = new SvxULSpaceItem( EE_PARA_ULSPACE ); - rDefItems[15] = new SvxLineSpacingItem( 0, EE_PARA_SBL ); - rDefItems[16] = new SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ); - rDefItems[17] = new SvxTabStopItem( 0, 0, SvxTabAdjust::Left, EE_PARA_TABS ); - rDefItems[18] = new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, EE_PARA_JUST_METHOD ); - rDefItems[19] = new SvxVerJustifyItem( SvxCellVerJustify::Standard, EE_PARA_VER_JUST ); - - // Character attributes: - rDefItems[20] = new SvxColorItem( COL_AUTO, EE_CHAR_COLOR ); - rDefItems[21] = new SvxFontItem( EE_CHAR_FONTINFO ); - rDefItems[22] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ); - rDefItems[23] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH ); - rDefItems[24] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ); - rDefItems[25] = new SvxUnderlineItem( LINESTYLE_NONE, EE_CHAR_UNDERLINE ); - rDefItems[26] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ); - rDefItems[27] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ); - rDefItems[28] = new SvxContourItem( false, EE_CHAR_OUTLINE ); - rDefItems[29] = new SvxShadowedItem( false, EE_CHAR_SHADOW ); - rDefItems[30] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT ); - rDefItems[31] = new SvxAutoKernItem( false, EE_CHAR_PAIRKERNING ); - rDefItems[32] = new SvxKerningItem( 0, EE_CHAR_KERNING ); - rDefItems[33] = new SvxWordLineModeItem( false, EE_CHAR_WLM ); - rDefItems[34] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE ); - rDefItems[35] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK ); - rDefItems[36] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL ); - rDefItems[37] = new SvxFontItem( EE_CHAR_FONTINFO_CJK ); - rDefItems[38] = new SvxFontItem( EE_CHAR_FONTINFO_CTL ); - rDefItems[39] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK ); - rDefItems[40] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL ); - rDefItems[41] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ); - rDefItems[42] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ); - rDefItems[43] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ); - rDefItems[44] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ); - rDefItems[45] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ); - rDefItems[46] = new SvxCharReliefItem( FontRelief::NONE, EE_CHAR_RELIEF ); - rDefItems[47] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ); - rDefItems[48] = new SvxOverlineItem( LINESTYLE_NONE, EE_CHAR_OVERLINE ); - rDefItems[49] = new SvxCaseMapItem( SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ); - rDefItems[50] = new SfxGrabBagItem( EE_CHAR_GRABBAG ); - rDefItems[51] = new SvxColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ); - // Features - rDefItems[52] = new SfxVoidItem( EE_FEATURE_TAB ); - rDefItems[53] = new SfxVoidItem( EE_FEATURE_LINEBR ); - rDefItems[54] = new SvxColorItem( COL_RED, EE_FEATURE_NOTCONV ); - rDefItems[55] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD ); - - assert(EDITITEMCOUNT == 56 && "ITEMCOUNT changed, adjust DefItems!"); - - // Init DefFonts: - GetDefaultFonts( *static_cast<SvxFontItem*>(rDefItems[EE_CHAR_FONTINFO - EE_ITEMS_START]), - *static_cast<SvxFontItem*>(rDefItems[EE_CHAR_FONTINFO_CJK - EE_ITEMS_START]), - *static_cast<SvxFontItem*>(rDefItems[EE_CHAR_FONTINFO_CTL - EE_ITEMS_START]) ); -} + class ItemInfoPackageEditEngine : public ItemInfoPackage + { + typedef std::array<ItemInfoStatic, EE_ITEMS_END - EE_ITEMS_START + 1> ItemInfoArrayEditEngine; + ItemInfoArrayEditEngine maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { EE_PARA_WRITINGDIR, new SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ), SID_ATTR_FRAMEDIRECTION, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_XMLATTRIBS, new SvXMLAttrContainerItem( EE_PARA_XMLATTRIBS ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { EE_PARA_HANGINGPUNCTUATION, new SvxHangingPunctuationItem(false, EE_PARA_HANGINGPUNCTUATION), SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_FORBIDDENRULES, new SvxForbiddenRuleItem(true, EE_PARA_FORBIDDENRULES), SID_ATTR_PARA_FORBIDDEN_RULES, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_ASIANCJKSPACING, new SvxScriptSpaceItem( true, EE_PARA_ASIANCJKSPACING ), SID_ATTR_PARA_SCRIPTSPACE, SFX_ITEMINFOFLAG_NONE }, -DefItems::~DefItems() -{ - for (const auto& rItem : mvDefItems) - delete rItem; -} + // need to use dynamic default for this Item, the office tends to crash at shutdown + // due to static stuff/cleanup at ~SvxNumRule (pStdNumFmt/pStdOutlineNumFmt) + { EE_PARA_NUMBULLET, nullptr, SID_ATTR_NUMBERING_RULE, SFX_ITEMINFOFLAG_NONE }, -std::shared_ptr<DefItems> GlobalEditData::GetDefItems() -{ - auto xDefItems = m_xDefItems.lock(); - if (!xDefItems) - { - xDefItems = std::make_shared<DefItems>(); - m_xDefItems = xDefItems; - } - return xDefItems; + { EE_PARA_HYPHENATE, new SfxBoolItem( EE_PARA_HYPHENATE, false ), 0, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_HYPHENATE_NO_CAPS, new SfxBoolItem( EE_PARA_HYPHENATE_NO_CAPS, false ), 0, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_HYPHENATE_NO_LAST_WORD, new SfxBoolItem( EE_PARA_HYPHENATE_NO_LAST_WORD, false ), 0, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_BULLETSTATE, new SfxBoolItem( EE_PARA_BULLETSTATE, true ), 0, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_OUTLLRSPACE, new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE ), 0, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_OUTLLEVEL, new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 ), SID_ATTR_PARA_OUTLLEVEL, SFX_ITEMINFOFLAG_NONE }, + + // needs on-demand initialization + { EE_PARA_BULLET, nullptr, SID_ATTR_PARA_BULLET, SFX_ITEMINFOFLAG_NONE }, + + { EE_PARA_LRSPACE, new SvxLRSpaceItem( EE_PARA_LRSPACE ), SID_ATTR_LRSPACE, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_ULSPACE, new SvxULSpaceItem( EE_PARA_ULSPACE ), SID_ATTR_ULSPACE, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_SBL, new SvxLineSpacingItem( 0, EE_PARA_SBL ), SID_ATTR_PARA_LINESPACE, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_JUST, new SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ), SID_ATTR_PARA_ADJUST, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_TABS, new SvxTabStopItem( 0, 0, SvxTabAdjust::Left, EE_PARA_TABS ), SID_ATTR_TABSTOP, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_JUST_METHOD, new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, EE_PARA_JUST_METHOD ), SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, SFX_ITEMINFOFLAG_NONE }, + { EE_PARA_VER_JUST, new SvxVerJustifyItem( SvxCellVerJustify::Standard, EE_PARA_VER_JUST ), SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_COLOR, new SvxColorItem( COL_AUTO, EE_CHAR_COLOR ), SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + + // EE_CHAR_FONTINFO, EE_CHAR_FONTINFO_CJK and EE_CHAR_FONTINFO_CTL need on-demand initialization + { EE_CHAR_FONTINFO, nullptr, SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + + { EE_CHAR_FONTHEIGHT, new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ), SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_FONTWIDTH, new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH ), SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_WEIGHT, new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ), SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_UNDERLINE, new SvxUnderlineItem( LINESTYLE_NONE, EE_CHAR_UNDERLINE ), SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_STRIKEOUT, new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ), SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_ITALIC, new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ), SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_OUTLINE, new SvxContourItem( false, EE_CHAR_OUTLINE ), SID_ATTR_CHAR_CONTOUR, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_SHADOW, new SvxShadowedItem( false, EE_CHAR_SHADOW ), SID_ATTR_CHAR_SHADOWED, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_ESCAPEMENT, new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT ), SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_PAIRKERNING, new SvxAutoKernItem( false, EE_CHAR_PAIRKERNING ), SID_ATTR_CHAR_AUTOKERN, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_KERNING, new SvxKerningItem( 0, EE_CHAR_KERNING ), SID_ATTR_CHAR_KERNING, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_WLM, new SvxWordLineModeItem( false, EE_CHAR_WLM ), SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_LANGUAGE, new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE ), SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_LANGUAGE_CJK, new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK ), SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_LANGUAGE_CTL, new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL ), SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + + // see EE_CHAR_FONTINFO above + { EE_CHAR_FONTINFO_CJK, nullptr, SID_ATTR_CHAR_CJK_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { EE_CHAR_FONTINFO_CTL, nullptr, SID_ATTR_CHAR_CTL_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + + { EE_CHAR_FONTHEIGHT_CJK, new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK ), SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_FONTHEIGHT_CTL, new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL ), SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_WEIGHT_CJK, new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ), SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_WEIGHT_CTL, new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ), SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_ITALIC_CJK, new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ), SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_ITALIC_CTL, new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ), SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_EMPHASISMARK, new SvxEmphasisMarkItem( FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ), SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_RELIEF, new SvxCharReliefItem( FontRelief::NONE, EE_CHAR_RELIEF ), SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_XMLATTRIBS, new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { EE_CHAR_OVERLINE, new SvxOverlineItem( LINESTYLE_NONE, EE_CHAR_OVERLINE ), SID_ATTR_CHAR_OVERLINE, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_CASEMAP, new SvxCaseMapItem( SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ), SID_ATTR_CHAR_CASEMAP, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_GRABBAG, new SfxGrabBagItem( EE_CHAR_GRABBAG ), SID_ATTR_CHAR_GRABBAG, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_BKGCOLOR, new SvxColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ), SID_ATTR_CHAR_BACK_COLOR, SFX_ITEMINFOFLAG_NONE }, + { EE_FEATURE_TAB, new SfxVoidItem( EE_FEATURE_TAB ), 0, SFX_ITEMINFOFLAG_NONE }, + { EE_FEATURE_LINEBR, new SfxVoidItem( EE_FEATURE_LINEBR ), 0, SFX_ITEMINFOFLAG_NONE }, + { EE_FEATURE_NOTCONV, new SvxColorItem( COL_RED, EE_FEATURE_NOTCONV ), SID_ATTR_CHAR_CHARSETCOLOR, SFX_ITEMINFOFLAG_NONE }, + { EE_FEATURE_FIELD, new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD ), SID_FIELD, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE } + }}; + + public: + ItemInfoPackageEditEngine() + { + // on-demand (but only once) as static defaults - above (and also + // in constructor) the needed OutputDevice::Font stuff is not yet + // initialized + setItemAtItemInfoStatic( + new SvxBulletItem(EE_PARA_BULLET), + maItemInfos[EE_PARA_BULLET - EE_ITEMS_START]); + + // same for EE_CHAR_FONTINFO/EE_CHAR_FONTINFO_CJK/EE_CHAR_FONTINFO_CTL + // doing here as static default will be done only once for LO runtime + SvxFontItem* pFont(new SvxFontItem(EE_CHAR_FONTINFO)); + SvxFontItem* pFontCJK(new SvxFontItem(EE_CHAR_FONTINFO_CJK)); + SvxFontItem* pFontCTL(new SvxFontItem(EE_CHAR_FONTINFO_CTL)); + + // Init DefFonts: + GetDefaultFonts(*pFont, *pFontCJK, *pFontCTL); + + setItemAtItemInfoStatic(pFont, maItemInfos[EE_CHAR_FONTINFO - EE_ITEMS_START]); + setItemAtItemInfoStatic(pFontCJK, maItemInfos[EE_CHAR_FONTINFO_CJK - EE_ITEMS_START]); + setItemAtItemInfoStatic(pFontCTL, maItemInfos[EE_CHAR_FONTINFO_CTL - EE_ITEMS_START]); + } + + 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 SvxNumBulletItem + if (EE_PARA_NUMBULLET == rRetval.getWhich()) + return *new ItemInfoDynamic( + rRetval, + new SvxNumBulletItem( SvxNumRule( SvxNumRuleFlags::NONE, 0, false ), EE_PARA_NUMBULLET )); + + // return in any case + return rRetval; + } + }; + + static std::unique_ptr<ItemInfoPackageEditEngine> g_aItemInfoPackageEditEngine; + if (!g_aItemInfoPackageEditEngine) + g_aItemInfoPackageEditEngine.reset(new ItemInfoPackageEditEngine); + return *g_aItemInfoPackageEditEngine; } std::shared_ptr<SvxForbiddenCharactersTable> const & GlobalEditData::GetForbiddenCharsTable() 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; } diff --git a/forms/source/richtext/richtextengine.cxx b/forms/source/richtext/richtextengine.cxx index 96be77103f90..37570639e808 100644 --- a/forms/source/richtext/richtextengine.cxx +++ b/forms/source/richtext/richtextengine.cxx @@ -45,8 +45,6 @@ namespace frm SolarMutexGuard g; rtl::Reference<SfxItemPool> pPool = EditEngine::CreatePool(); - pPool->FreezeIdRanges(); - RichTextEngine* pReturn = new RichTextEngine( pPool.get() ); OutputDevice* pOutputDevice = pReturn->GetRefDevice(); const MapMode& aDeviceMapMode( pOutputDevice->GetMapMode() ); diff --git a/include/editeng/eerdll.hxx b/include/editeng/eerdll.hxx index b77d6a0d4703..13c46ec74afd 100644 --- a/include/editeng/eerdll.hxx +++ b/include/editeng/eerdll.hxx @@ -31,6 +31,9 @@ namespace editeng class SharedVclResources; } +class ItemInfoPackage; +ItemInfoPackage& getItemInfoPackageEditEngine(); + OUString EDITENG_DLLPUBLIC EditResId(TranslateId aId); class EditDLL diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx index cf442c9ef083..244083c67b0c 100644 --- a/include/svl/itempool.hxx +++ b/include/svl/itempool.hxx @@ -27,6 +27,7 @@ #include <memory> #include <vector> #include <unordered_set> +#include <unordered_map> #include <o3tl/sorted_vector.hxx> #include <salhelper/simplereferenceobject.hxx> #include <svl/SfxBroadcaster.hxx> @@ -42,22 +43,90 @@ // GetItemSurrogates impl that will mention that #define SFX_ITEMINFOFLAG_SUPPORT_SURROGATE 0x0001 -struct SfxItemInfo +class SVL_DLLPUBLIC ItemInfo { - // Defines a mapping between WhichID <-> SlotID - sal_uInt16 _nItemInfoSlotID; - - // Pool-dependent Item-Attributes, please use - // SFX_ITEMINFOFLAG_* to create/set. Now using a - // sal_uInt16 and not separate bools so changes - // will be easier - sal_uInt16 _nItemInfoFlags; + sal_uInt16 m_nWhich; + sal_uInt16 m_nSlotID; + sal_uInt16 m_nItemInfoFlags; + +public: + ItemInfo(sal_uInt16 nWhich, sal_uInt16 nSlotID, sal_uInt16 nItemInfoFlags) + : m_nWhich(nWhich), m_nSlotID(nSlotID), m_nItemInfoFlags(nItemInfoFlags) {} + ItemInfo(const ItemInfo& rIemInfo) = default; + virtual ~ItemInfo() = default; + + sal_uInt16 getWhich() const { return m_nWhich; } + virtual const SfxPoolItem* getItem() const = 0; + sal_uInt16 getSlotID() const { return m_nSlotID; } + sal_uInt16 getItemInfoFlags() const { return m_nItemInfoFlags; } +}; + +class SVL_DLLPUBLIC ItemInfoStatic : public ItemInfo +{ + friend class ItemInfoPackage; + void setItem(SfxPoolItem* pItem) + { + if (nullptr != pItem) + pItem->setStaticDefault(); + m_pItem.reset(pItem); + } + + std::unique_ptr<const SfxPoolItem> m_pItem; + +public: + ItemInfoStatic(sal_uInt16 nWhich, SfxPoolItem* pItem, sal_uInt16 nSlotID, sal_uInt16 nItemInfoFlags) + : ItemInfo(nWhich, nSlotID, nItemInfoFlags) + , m_pItem(pItem) { if(nullptr != pItem) pItem->setStaticDefault(); } + + virtual const SfxPoolItem* getItem() const override { return m_pItem.get(); } +}; + +class SVL_DLLPUBLIC ItemInfoDynamic : public ItemInfo +{ + std::unique_ptr<const SfxPoolItem> m_pItem; + +public: + ItemInfoDynamic(const ItemInfo& rItemInfo, SfxPoolItem* pItem) + : ItemInfo(rItemInfo) + , m_pItem(pItem) { if(nullptr != pItem) pItem->setDynamicDefault(); } + + virtual const SfxPoolItem* getItem() const override { return m_pItem.get(); } +}; + +class SVL_DLLPUBLIC ItemInfoUser : public ItemInfo +{ + const SfxPoolItem* m_pItem; + +public: + ItemInfoUser(const ItemInfo& rItemInfo, SfxItemPool& rItemPool, const SfxPoolItem& rItem, bool bPassingOwnership = false); + virtual ~ItemInfoUser(); + + virtual const SfxPoolItem* getItem() const override { return m_pItem; } +}; + +class SVL_DLLPUBLIC ItemInfoPackage +{ +protected: + // this is needed for on-demand creation of static entries in constructors + // derived from ItemInfoPackage or implementations of ::getItemInfo(). This + // takes ownership of the item + static void setItemAtItemInfoStatic(SfxPoolItem* pItem, ItemInfoStatic& rItemInfo) { rItemInfo.setItem(pItem); } + +public: + ItemInfoPackage() = default; + virtual ~ItemInfoPackage() = default; + + virtual size_t size() const = 0; + virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& rPool) = 0; + virtual const ItemInfo& getExistingItemInfo(size_t /*nIndex*/); }; typedef std::unordered_set<SfxItemSet*> registeredSfxItemSets; class SfxPoolItemHolder; typedef std::unordered_set<SfxPoolItemHolder*> registeredSfxPoolItemHolders; typedef std::vector<const SfxPoolItem*> ItemSurrogates; +typedef std::unordered_map<sal_uInt16, const ItemInfo*> userItemInfos; +typedef std::vector<const ItemInfo*> itemInfoVector; /** Base class for providers of defaults of SfxPoolItems. * @@ -76,30 +145,48 @@ class SVL_DLLPUBLIC SfxItemPool : public salhelper::SimpleReferenceObject friend SfxPoolItem const* implCreateItemEntry(SfxItemPool&, SfxPoolItem const*, bool); friend void implCleanupItemEntry(SfxPoolItem const*); - const SfxItemInfo* pItemInfos; SfxBroadcaster aBC; OUString aName; - std::vector<SfxPoolItem*> maUserDefaults; - std::vector<SfxPoolItem*>* mpPoolDefaults; SfxItemPool* mpMaster; rtl::Reference<SfxItemPool> mpSecondary; - WhichRangesContainer mpPoolRanges; + mutable WhichRangesContainer maPoolRanges; sal_uInt16 mnStart; sal_uInt16 mnEnd; MapUnit eDefMetric; registeredSfxItemSets maRegisteredSfxItemSets; registeredSfxPoolItemHolders maRegisteredSfxPoolItemHolders; - bool mbPreDeleteDone; + bool mbShutdownHintSent; + + itemInfoVector maItemInfos; + userItemInfos maUserItemInfos; +public: + void registerItemInfoPackage( + ItemInfoPackage& rPackage, + const std::function<SfxPoolItem*(sal_uInt16)>& rCallback = std::function<SfxPoolItem*(sal_uInt16)>()); +protected: + const ItemInfo* impCheckItemInfoForClone(const ItemInfo* pInfo); + void impClearUserDefault(userItemInfos::iterator& rHit); + void impCreateUserDefault(const SfxPoolItem& rItem); private: - sal_uInt16 GetIndex_Impl(sal_uInt16 nWhich) const; - sal_uInt16 GetSize_Impl() const; + void cleanupItemInfos(); + +private: + sal_uInt16 GetIndex_Impl(sal_uInt16 nWhich) const + { + if (IsInRange(nWhich)) + return nWhich - mnStart; + assert(false && "missing bounds check before use"); + return 0; + } + sal_uInt16 GetSize_Impl() const { return mnEnd - mnStart + 1; } + SfxItemPool* getTargetPool(sal_uInt16 nWhich) const; // moved to private: use the access methods, e.g. NeedsSurrogateSupport SVL_DLLPRIVATE bool CheckItemInfoFlag(sal_uInt16 nWhich, sal_uInt16 nMask) const; SVL_DLLPRIVATE bool CheckItemInfoFlag_Impl(sal_uInt16 nPos, sal_uInt16 nMask) const - { return pItemInfos[nPos]._nItemInfoFlags & nMask; } + { return maItemInfos[nPos]->getItemInfoFlags() & nMask; } void registerItemSet(SfxItemSet& rSet); void unregisterItemSet(SfxItemSet& rSet); @@ -109,8 +196,7 @@ private: public: // for default SfxItemSet::CTOR, set default WhichRanges - void FillItemIdRanges_Impl( WhichRangesContainer& pWhichRanges ) const; - const WhichRangesContainer & GetFrozenIdRanges() const; + const WhichRangesContainer& GetMergedIdRanges() const; protected: static inline void ClearRefCount(SfxPoolItem& rItem); @@ -118,14 +204,9 @@ protected: static inline sal_uInt32 ReleaseRef(const SfxPoolItem& rItem, sal_uInt32 n = 1); public: - SfxItemPool( const SfxItemPool &rPool, - bool bCloneStaticDefaults = false ); - SfxItemPool( const OUString &rName, - sal_uInt16 nStart, sal_uInt16 nEnd, - const SfxItemInfo *pItemInfos, - std::vector<SfxPoolItem*> *pDefaults = nullptr ); - - virtual ~SfxItemPool(); + SfxItemPool(const SfxItemPool &rPool); + SfxItemPool(const OUString &rName); + virtual ~SfxItemPool(); SfxBroadcaster& BC(); @@ -141,10 +222,6 @@ public: // PoolDefaults: Owned by the pool. The read access will only return // nullptr if the WhichID asked for is not in the range of the pool, // making the request invalid. - void SetPoolDefaults(std::vector<SfxPoolItem*>* pDefaults); - void ClearPoolDefaults(); - void ReleasePoolDefaults( bool bDelete = false ); - static void ReleasePoolDefaults( std::vector<SfxPoolItem*> *pDefaults, bool bDelete = false ); const SfxPoolItem * GetPoolDefaultItem(sal_uInt16 nWhich) const; template<class T> const T* GetPoolDefaultItem( TypedWhichId<T> nWhich ) const { return static_cast<const T*>(GetPoolDefaultItem(sal_uInt16(nWhich))); } @@ -161,7 +238,7 @@ public: virtual MapUnit GetMetric( sal_uInt16 nWhich ) const; void SetDefaultMetric( MapUnit eNewMetric ); - MapUnit GetDefaultMetric() const; + MapUnit GetDefaultMetric() const { return eDefMetric; } /** Request string representation of pool items. @@ -194,7 +271,7 @@ public: OUString& rText, const IntlWrapper& rIntlWrapper ) const; virtual rtl::Reference<SfxItemPool> Clone() const; - const OUString& GetName() const; + const OUString& GetName() const { return aName; } public: // SurrogateData callback helper for iterateItemSurrogates @@ -225,23 +302,22 @@ public: // Read commit text for more information void GetItemSurrogates(ItemSurrogates& rTarget, sal_uInt16 nWhich) const; - sal_uInt16 GetFirstWhich() const; - sal_uInt16 GetLastWhich() const; - bool IsInRange( sal_uInt16 nWhich ) const; + sal_uInt16 GetFirstWhich() const { return mnStart; } + sal_uInt16 GetLastWhich() const { return mnEnd; } + bool IsInRange( sal_uInt16 nWhich ) const { return nWhich >= mnStart && nWhich <= mnEnd; } + void SetSecondaryPool( SfxItemPool *pPool ); - SfxItemPool* GetSecondaryPool() const; + SfxItemPool* GetSecondaryPool() const { return mpSecondary.get(); } /* get the last pool by following the GetSecondaryPool chain */ SfxItemPool* GetLastPoolInChain(); - SfxItemPool* GetMasterPool() const; - void FreezeIdRanges(); - void Delete(); + SfxItemPool* GetMasterPool() const { return mpMaster; } + void sendShutdownHint(); // syntactical sugar: direct call to not have to use the flag define // and make the intention clearer bool NeedsSurrogateSupport(sal_uInt16 nWhich) const { return CheckItemInfoFlag(nWhich, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE); } - void SetItemInfos( const SfxItemInfo *pInfos ); sal_uInt16 GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const; template<class T> TypedWhichId<T> GetWhich( TypedWhichId<T> nSlot, bool bDeep = true ) const diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index 5cbbf4268cc6..cc475788b9db 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -118,6 +118,8 @@ class SVL_DLLPUBLIC SfxPoolItem friend class SfxItemPool; friend class SfxItemSet; friend class InstanceManagerHelper; + friend class ItemInfoStatic; + friend class ItemInfoDynamic; // allow ItemSetTooling to access friend SfxPoolItem const* implCreateItemEntry(SfxItemPool&, SfxPoolItem const*, bool); @@ -142,38 +144,34 @@ class SVL_DLLPUBLIC SfxPoolItem // these are not really 'static', but should be) // m_bDynamicDefault: dynamic pool item, e.g. // SfxSetItems which are Pool dependent - // m_bUserDefault: set by user using - // SetUserDefaultItem - bool m_bStaticDefault : 1; // bit 0 - bool m_bDynamicDefault : 1; // bit 1 - bool m_bUserDefault : 1; // bit 2 + bool m_bStaticDefault : 1; + bool m_bDynamicDefault : 1; // Item is derived from SfxSetItem -> is Pool-dependent - bool m_bIsSetItem : 1; // bit 3 + bool m_bIsSetItem : 1; // Defines if the Item can be shared/RefCounted else it will be cloned. // Default is true - as it should be for all Items. It is needed by some // SW items, so protected to let them set it in constructor. If this could // be fixed at that Items we may remove this again. - bool m_bShareable : 1; // bit 4 + bool m_bShareable : 1; protected: #ifdef DBG_UTIL // this flag will make debugging item stuff much simpler - bool m_bDeleted : 1; // bit 5 + bool m_bDeleted : 1; #endif private: inline void SetRefCount(sal_uInt32 n) { m_nRefCount = n; - m_bStaticDefault = m_bDynamicDefault = m_bUserDefault = false; + m_bStaticDefault = m_bDynamicDefault = false; } protected: void setStaticDefault() { m_bStaticDefault = true; } void setDynamicDefault() { m_bDynamicDefault = true; } - void setUserDefault() { m_bUserDefault = true; } void setIsSetItem() { m_bIsSetItem = true; } void setNonShareable() { m_bShareable = false; } @@ -199,7 +197,6 @@ public: bool isStaticDefault() const { return m_bStaticDefault; } bool isDynamicDefault() const { return m_bDynamicDefault; } - bool isUserDefault() const { return m_bUserDefault; } bool isSetItem() const { return m_bIsSetItem; } bool isShareable() const { return m_bShareable; } @@ -349,11 +346,6 @@ private: virtual void remove(const SfxPoolItem&) override; }; -inline bool IsUserDefaultItem(const SfxPoolItem *pItem ) -{ - return pItem && pItem->isUserDefault(); -} - inline bool IsStaticDefaultItem(const SfxPoolItem *pItem ) { return pItem && pItem->isStaticDefault(); @@ -366,7 +358,7 @@ inline bool IsDynamicDefaultItem(const SfxPoolItem *pItem ) inline bool IsDefaultItem( const SfxPoolItem *pItem ) { - return pItem && (pItem->isUserDefault() || pItem->isStaticDefault() || pItem->isDynamicDefault()); + return pItem && (pItem->isStaticDefault() || pItem->isDynamicDefault()); } inline bool IsPooledItem( const SfxPoolItem *pItem ) diff --git a/include/svx/svdpool.hxx b/include/svx/svdpool.hxx index 3d2201edef5b..b060e9a20483 100644 --- a/include/svx/svdpool.hxx +++ b/include/svx/svdpool.hxx @@ -19,20 +19,22 @@ #pragma once -#include <svx/xpool.hxx> +#include <svx/svxdllapi.h> +#include <svl/itempool.hxx> class XLineAttrSetItem; class XFillAttrSetItem; -class SVXCORE_DLLPUBLIC SdrItemPool final : public XOutdevItemPool +class SVXCORE_DLLPUBLIC SdrItemPool final : public SfxItemPool { public: SdrItemPool(SfxItemPool* pMaster = nullptr); SdrItemPool(const SdrItemPool& rPool); + private: virtual ~SdrItemPool() override; -public: +public: virtual rtl::Reference<SfxItemPool> Clone() const override; virtual bool GetPresentation(const SfxPoolItem& rItem, MapUnit ePresentationMetric, diff --git a/include/svx/xpool.hxx b/include/svx/xpool.hxx deleted file mode 100644 index 13f5fa3d7a7d..000000000000 --- a/include/svx/xpool.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SVX_XPOOL_HXX -#define INCLUDED_SVX_XPOOL_HXX - -#include <svx/svxdllapi.h> -#include <svl/itempool.hxx> -#include <memory> - -/************************************************************************* -|* -|* Klassendeklaration -|* -\************************************************************************/ - -class SVXCORE_DLLPUBLIC XOutdevItemPool : public SfxItemPool -{ -protected: - std::vector<SfxPoolItem*>* mpLocalPoolDefaults; - std::unique_ptr<SfxItemInfo[]> mpLocalItemInfos; - -public: - XOutdevItemPool(SfxItemPool* pMaster); - XOutdevItemPool(const XOutdevItemPool& rPool); - - virtual rtl::Reference<SfxItemPool> Clone() const override; - -protected: - virtual ~XOutdevItemPool() override; -}; - -#endif // INCLUDED_SVX_XPOOL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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 ); diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 8740d7979b05..416a1d5885ec 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -87,241 +87,191 @@ SvxFontItem* getDefaultFontItem(LanguageType eLang, DefaultFontType nFontType, s } -SfxItemInfo const aItemInfos[] = +static ItemInfoPackage& getItemInfoPackageScDocument() { - // _nItemInfoSlotID, _nItemInfoFlags - { SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_FONT - { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_HEIGHT - { SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_WEIGHT - { SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_POSTURE - { SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_UNDERLINE - { SID_ATTR_CHAR_OVERLINE, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_OVERLINE - { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_CROSSEDOUT - { SID_ATTR_CHAR_CONTOUR, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_CONTOUR - { SID_ATTR_CHAR_SHADOWED, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_SHADOWED - { SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_FONT_COLOR - { SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_LANGUAGE - { SID_ATTR_CHAR_CJK_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_CJK_FONT from 614 - { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, // ATTR_CJK_FONT_HEIGHT from 614 - { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEMINFOFLAG_NONE }, // ATTR_CJK_FONT_WEIGHT from 614 - { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEMINFOFLAG_NONE }, // ATTR_CJK_FONT_POSTURE from 614 - { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, // ATTR_CJK_FONT_LANGUAGE from 614 - { SID_ATTR_CHAR_CTL_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_CTL_FONT from 614 - { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, // ATTR_CTL_FONT_HEIGHT from 614 - { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEMINFOFLAG_NONE }, // ATTR_CTL_FONT_WEIGHT from 614 - { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEMINFOFLAG_NONE }, // ATTR_CTL_FONT_POSTURE from 614 - { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, // ATTR_CTL_FONT_LANGUAGE from 614 - { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_EMPHASISMARK from 614 - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_USERDEF from 614 / 641c - { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_WORDLINE from 632b - { SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE }, // ATTR_FONT_RELIEF from 632b - { SID_ATTR_ALIGN_HYPHENATION, SFX_ITEMINFOFLAG_NONE }, // ATTR_HYPHENATE from 632b - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_SCRIPTSPACE from 614d - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_HANGPUNCTUATION from 614d - { SID_ATTR_PARA_FORBIDDEN_RULES, SFX_ITEMINFOFLAG_NONE }, // ATTR_FORBIDDEN_RULES from 614d - { SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEMINFOFLAG_NONE }, // ATTR_HOR_JUSTIFY - { SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, SFX_ITEMINFOFLAG_NONE }, // ATTR_HOR_JUSTIFY_METHOD - { SID_ATTR_ALIGN_INDENT, SFX_ITEMINFOFLAG_NONE }, // ATTR_INDENT from 350 - { SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEMINFOFLAG_NONE }, // ATTR_VER_JUSTIFY - { SID_ATTR_ALIGN_VER_JUSTIFY_METHOD, SFX_ITEMINFOFLAG_NONE }, // ATTR_VER_JUSTIFY_METHOD - { SID_ATTR_ALIGN_STACKED, SFX_ITEMINFOFLAG_NONE }, // ATTR_STACKED from 680/dr14 (replaces ATTR_ORIENTATION) - { SID_ATTR_ALIGN_DEGREES, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_ROTATE_VALUE from 367 - { SID_ATTR_ALIGN_LOCKPOS, SFX_ITEMINFOFLAG_NONE }, // ATTR_ROTATE_MODE from 367 - { SID_ATTR_ALIGN_ASIANVERTICAL, SFX_ITEMINFOFLAG_NONE }, // ATTR_VERTICAL_ASIAN from 642 - { SID_ATTR_FRAMEDIRECTION, SFX_ITEMINFOFLAG_NONE }, // ATTR_WRITINGDIR from 643 - { SID_ATTR_ALIGN_LINEBREAK, SFX_ITEMINFOFLAG_NONE }, // ATTR_LINEBREAK - { SID_ATTR_ALIGN_SHRINKTOFIT, SFX_ITEMINFOFLAG_NONE }, // ATTR_SHRINKTOFIT from 680/dr14 - { SID_ATTR_BORDER_DIAG_TLBR, SFX_ITEMINFOFLAG_NONE }, // ATTR_BORDER_TLBR from 680/dr14 - { SID_ATTR_BORDER_DIAG_BLTR, SFX_ITEMINFOFLAG_NONE }, // ATTR_BORDER_BLTR from 680/dr14 - { SID_ATTR_ALIGN_MARGIN, SFX_ITEMINFOFLAG_NONE }, // ATTR_MARGIN - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_MERGE - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_MERGE_FLAG - { SID_ATTR_NUMBERFORMAT_VALUE, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_VALUE_FORMAT - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_LANGUAGE_FORMAT from 329, is combined with SID_ATTR_NUMBERFORMAT_VALUE in the dialog - { SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_BACKGROUND - { SID_SCATTR_PROTECTION, SFX_ITEMINFOFLAG_NONE }, // ATTR_PROTECTION - { SID_ATTR_BORDER_OUTER, SFX_ITEMINFOFLAG_NONE }, // ATTR_BORDER - { SID_ATTR_BORDER_INNER, SFX_ITEMINFOFLAG_NONE }, // ATTR_BORDER_INNER - { SID_ATTR_BORDER_SHADOW, SFX_ITEMINFOFLAG_NONE }, // ATTR_SHADOW - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_VALIDDATA - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_CONDITIONAL - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_HYPERLINK - { SID_ATTR_LRSPACE, SFX_ITEMINFOFLAG_NONE }, // ATTR_LRSPACE - { SID_ATTR_ULSPACE, SFX_ITEMINFOFLAG_NONE }, // ATTR_ULSPACE - { SID_ATTR_PAGE, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE - { SID_ATTR_PAGE_PAPERBIN, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_PAPERBIN - { SID_ATTR_PAGE_SIZE, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_SIZE - { SID_ATTR_PAGE_EXT1, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_HORCENTER - { SID_ATTR_PAGE_EXT2, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_VERCENTER - { SID_ATTR_PAGE_ON, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_ON - { SID_ATTR_PAGE_DYNAMIC, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_DYNAMIC - { SID_ATTR_PAGE_SHARED, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_SHARED - { SID_ATTR_PAGE_SHARED_FIRST, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_SHARED_FIRST - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_NOTES aka. SID_SCATTR_PAGE_NOTES - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_GRID aka. SID_SCATTR_PAGE_GRID - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_HEADERS aka. SID_SCATTR_PAGE_HEADERS - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_CHARTS aka. SID_SCATTR_PAGE_CHARTS - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_OBJECTS aka. SID_SCATTR_PAGE_OBJECTS - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_DRAWINGS aka. SID_SCATTR_PAGE_DRAWINGS - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_TOPDOWN aka. SID_SCATTR_PAGE_TOPDOWN - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_SCALE aka SID_SCATTR_PAGE_SCALE - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_SCALETOPAGES aka SID_SCATTR_PAGE_SCALETOPAGES - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_FIRSTPAGENO aka SID_SCATTR_PAGE_FIRSTPAGENO - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_PAGE_HEADERLEFT aka SID_SCATTR_PAGE_HEADERLEFT - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_PAGE_FOOTERLEFT aka SID_SCATTR_PAGE_FOOTERLEFT - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_PAGE_HEADERRIGHT aka SID_SCATTR_PAGE_HEADERRIGHT - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_PAGE_FOOTERRIGHT aka. SID_SCATTR_PAGE_FOOTERRIGHT - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_PAGE_HEADERFIRST aka. SID_SCATTR_PAGE_HEADERFIRST - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // ATTR_PAGE_FOOTERFIRST aka. SID_SCATTR_PAGE_FOOTERFIRST` - { SID_ATTR_PAGE_HEADERSET, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_HEADERSET - { SID_ATTR_PAGE_FOOTERSET, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_FOOTERSET - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_FORMULAS aka. SID_SCATTR_PAGE_FORMULAS - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_NULLVALS aka. SID_SCATTR_PAGE_NULLVALS - { 0, SFX_ITEMINFOFLAG_NONE }, // ATTR_PAGE_SCALETO aka. SID_SCATTR_PAGE_SCALETO - { 0, SFX_ITEMINFOFLAG_NONE } // ATTR_HIDDEN -}; -static_assert( - SAL_N_ELEMENTS(aItemInfos) == ATTR_ENDINDEX - ATTR_STARTINDEX + 1, "these must match"); + class ItemInfoPackageScDocument : public ItemInfoPackage + { + typedef std::array<ItemInfoStatic, ATTR_ENDINDEX - ATTR_STARTINDEX + 1> ItemInfoArrayScDocument; + ItemInfoArrayScDocument maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { ATTR_FONT, nullptr, SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_FONT_HEIGHT, new SvxFontHeightItem( 200, 100, ATTR_FONT_HEIGHT ), SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FONT_WEIGHT, new SvxWeightItem( WEIGHT_NORMAL, ATTR_FONT_WEIGHT ), SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FONT_POSTURE, new SvxPostureItem( ITALIC_NONE, ATTR_FONT_POSTURE ), SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FONT_UNDERLINE, new SvxUnderlineItem( LINESTYLE_NONE, ATTR_FONT_UNDERLINE ), SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FONT_OVERLINE, new SvxOverlineItem( LINESTYLE_NONE, ATTR_FONT_OVERLINE ), SID_ATTR_CHAR_OVERLINE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FONT_CROSSEDOUT, new SvxCrossedOutItem( STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT ), SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FONT_CONTOUR, new SvxContourItem( false, ATTR_FONT_CONTOUR ), SID_ATTR_CHAR_CONTOUR, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FONT_SHADOWED, new SvxShadowedItem( false, ATTR_FONT_SHADOWED ), SID_ATTR_CHAR_SHADOWED, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FONT_COLOR, new SvxColorItem( COL_AUTO, ATTR_FONT_COLOR ), SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_FONT_LANGUAGE, new SvxLanguageItem( LANGUAGE_DONTKNOW, ATTR_FONT_LANGUAGE ), SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_CJK_FONT, nullptr, SID_ATTR_CHAR_CJK_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_CJK_FONT_HEIGHT, new SvxFontHeightItem( 200, 100, ATTR_CJK_FONT_HEIGHT ), SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { ATTR_CJK_FONT_WEIGHT, new SvxWeightItem( WEIGHT_NORMAL, ATTR_CJK_FONT_WEIGHT ), SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + { ATTR_CJK_FONT_POSTURE, new SvxPostureItem( ITALIC_NONE, ATTR_CJK_FONT_POSTURE ), SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_CJK_FONT_LANGUAGE, new SvxLanguageItem( LANGUAGE_DONTKNOW, ATTR_CJK_FONT_LANGUAGE ), SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_CTL_FONT, nullptr, SID_ATTR_CHAR_CTL_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_CTL_FONT_HEIGHT, new SvxFontHeightItem( 200, 100, ATTR_CTL_FONT_HEIGHT ), SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { ATTR_CTL_FONT_WEIGHT, new SvxWeightItem( WEIGHT_NORMAL, ATTR_CTL_FONT_WEIGHT ), SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + { ATTR_CTL_FONT_POSTURE, new SvxPostureItem( ITALIC_NONE, ATTR_CTL_FONT_POSTURE ), SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_CTL_FONT_LANGUAGE, new SvxLanguageItem( LANGUAGE_DONTKNOW, ATTR_CTL_FONT_LANGUAGE ), SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FONT_EMPHASISMARK, new SvxEmphasisMarkItem( FontEmphasisMark::NONE, ATTR_FONT_EMPHASISMARK ), SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE }, + { ATTR_USERDEF, new SvXMLAttrContainerItem( ATTR_USERDEF ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_FONT_WORDLINE, new SvxWordLineModeItem(false, ATTR_FONT_WORDLINE ), SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FONT_RELIEF, new SvxCharReliefItem( FontRelief::NONE, ATTR_FONT_RELIEF ), SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE }, + { ATTR_HYPHENATE, new ScHyphenateCell(), SID_ATTR_ALIGN_HYPHENATION, SFX_ITEMINFOFLAG_NONE }, + { ATTR_SCRIPTSPACE, new SvxScriptSpaceItem( false, ATTR_SCRIPTSPACE), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_HANGPUNCTUATION, new SvxHangingPunctuationItem( false, ATTR_HANGPUNCTUATION), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_FORBIDDEN_RULES, new SvxForbiddenRuleItem( false, ATTR_FORBIDDEN_RULES), SID_ATTR_PARA_FORBIDDEN_RULES, SFX_ITEMINFOFLAG_NONE }, + { ATTR_HOR_JUSTIFY, new SvxHorJustifyItem( SvxCellHorJustify::Standard, ATTR_HOR_JUSTIFY), SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEMINFOFLAG_NONE }, + { ATTR_HOR_JUSTIFY_METHOD, new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, ATTR_HOR_JUSTIFY_METHOD), SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, SFX_ITEMINFOFLAG_NONE }, + { ATTR_INDENT, new ScIndentItem( 0 ), SID_ATTR_ALIGN_INDENT, SFX_ITEMINFOFLAG_NONE }, + { ATTR_VER_JUSTIFY, new SvxVerJustifyItem( SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY), SID_ATTR_ALIGN_VER_JUSTIFY, SFX_ITEMINFOFLAG_NONE }, + { ATTR_VER_JUSTIFY_METHOD, new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, ATTR_VER_JUSTIFY_METHOD), SID_ATTR_ALIGN_VER_JUSTIFY_METHOD, SFX_ITEMINFOFLAG_NONE }, + { ATTR_STACKED, new ScVerticalStackCell(false), SID_ATTR_ALIGN_STACKED, SFX_ITEMINFOFLAG_NONE }, + { ATTR_ROTATE_VALUE, new ScRotateValueItem( 0_deg100 ), SID_ATTR_ALIGN_DEGREES, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_ROTATE_MODE, new SvxRotateModeItem( SVX_ROTATE_MODE_BOTTOM, ATTR_ROTATE_MODE ), SID_ATTR_ALIGN_LOCKPOS, SFX_ITEMINFOFLAG_NONE }, + { ATTR_VERTICAL_ASIAN, new SfxBoolItem( ATTR_VERTICAL_ASIAN ), SID_ATTR_ALIGN_ASIANVERTICAL, SFX_ITEMINFOFLAG_NONE }, + + // The default for the ATTR_WRITINGDIR cell attribute must by SvxFrameDirection::Environment, + // so that value is returned when asking for a default cell's attributes. + // The value from the page style is set as DefaultHorizontalTextDirection for the EditEngine. + { ATTR_WRITINGDIR, new SvxFrameDirectionItem( SvxFrameDirection::Environment, ATTR_WRITINGDIR ), SID_ATTR_FRAMEDIRECTION, SFX_ITEMINFOFLAG_NONE }, + + { ATTR_LINEBREAK, new ScLineBreakCell(), SID_ATTR_ALIGN_LINEBREAK, SFX_ITEMINFOFLAG_NONE }, + { ATTR_SHRINKTOFIT, new ScShrinkToFitCell(), SID_ATTR_ALIGN_SHRINKTOFIT, SFX_ITEMINFOFLAG_NONE }, + { ATTR_BORDER_TLBR, new SvxLineItem( ATTR_BORDER_TLBR ), SID_ATTR_BORDER_DIAG_TLBR, SFX_ITEMINFOFLAG_NONE }, + { ATTR_BORDER_BLTR, new SvxLineItem( ATTR_BORDER_BLTR ), SID_ATTR_BORDER_DIAG_BLTR, SFX_ITEMINFOFLAG_NONE }, + { ATTR_MARGIN, new SvxMarginItem( ATTR_MARGIN ), SID_ATTR_ALIGN_MARGIN, SFX_ITEMINFOFLAG_NONE }, + { ATTR_MERGE, new ScMergeAttr, 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_MERGE_FLAG, new ScMergeFlagAttr, 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_VALUE_FORMAT, new SfxUInt32Item( ATTR_VALUE_FORMAT, 0 ), SID_ATTR_NUMBERFORMAT_VALUE, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_LANGUAGE_FORMAT, new SvxLanguageItem( ScGlobal::eLnge, ATTR_LANGUAGE_FORMAT ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_BACKGROUND, new SvxBrushItem( COL_TRANSPARENT, ATTR_BACKGROUND ), SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_PROTECTION, new ScProtectionAttr, SID_SCATTR_PROTECTION, SFX_ITEMINFOFLAG_NONE }, + { ATTR_BORDER, new SvxBoxItem( ATTR_BORDER ), SID_ATTR_BORDER_OUTER, SFX_ITEMINFOFLAG_NONE }, + { ATTR_BORDER_INNER,nullptr, SID_ATTR_BORDER_INNER, SFX_ITEMINFOFLAG_NONE }, + { ATTR_SHADOW, new SvxShadowItem( ATTR_SHADOW ), SID_ATTR_BORDER_SHADOW, SFX_ITEMINFOFLAG_NONE }, + { ATTR_VALIDDATA, new SfxUInt32Item( ATTR_VALIDDATA, 0 ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_CONDITIONAL, new ScCondFormatItem, 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_HYPERLINK, new SfxStringItem( ATTR_HYPERLINK, OUString() ) , 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_LRSPACE, new SvxLRSpaceItem( ATTR_LRSPACE ), SID_ATTR_LRSPACE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_ULSPACE, new SvxULSpaceItem( ATTR_ULSPACE ), SID_ATTR_ULSPACE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE, new SvxPageItem( ATTR_PAGE ), SID_ATTR_PAGE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_PAPERBIN, new SvxPaperBinItem( ATTR_PAGE_PAPERBIN ), SID_ATTR_PAGE_PAPERBIN, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_SIZE, new SvxSizeItem( ATTR_PAGE_SIZE ), SID_ATTR_PAGE_SIZE, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_HORCENTER, new SfxBoolItem( ATTR_PAGE_HORCENTER ), SID_ATTR_PAGE_EXT1, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_VERCENTER, new SfxBoolItem( ATTR_PAGE_VERCENTER ), SID_ATTR_PAGE_EXT2, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_ON, new SfxBoolItem( ATTR_PAGE_ON, true ), SID_ATTR_PAGE_ON, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_DYNAMIC, new SfxBoolItem( ATTR_PAGE_DYNAMIC, true ), SID_ATTR_PAGE_DYNAMIC, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_SHARED, new SfxBoolItem( ATTR_PAGE_SHARED, true ), SID_ATTR_PAGE_SHARED, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_SHARED_FIRST, new SfxBoolItem( ATTR_PAGE_SHARED_FIRST, true ), SID_ATTR_PAGE_SHARED_FIRST, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_NOTES, new SfxBoolItem( ATTR_PAGE_NOTES, false ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_GRID, new SfxBoolItem( ATTR_PAGE_GRID, false ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_HEADERS, new SfxBoolItem( ATTR_PAGE_HEADERS, false ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_CHARTS, new ScViewObjectModeItem( ATTR_PAGE_CHARTS ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_OBJECTS, new ScViewObjectModeItem( ATTR_PAGE_OBJECTS ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_DRAWINGS, new ScViewObjectModeItem( ATTR_PAGE_DRAWINGS ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_TOPDOWN, new SfxBoolItem( ATTR_PAGE_TOPDOWN, true ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_SCALE, new SfxUInt16Item( ATTR_PAGE_SCALE, 100 ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_SCALETOPAGES, new SfxUInt16Item( ATTR_PAGE_SCALETOPAGES, 1 ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_FIRSTPAGENO, new SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, 1 ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_HEADERLEFT, new ScPageHFItem( ATTR_PAGE_HEADERLEFT ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_PAGE_FOOTERLEFT, new ScPageHFItem( ATTR_PAGE_FOOTERLEFT ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_PAGE_HEADERRIGHT, new ScPageHFItem( ATTR_PAGE_HEADERRIGHT ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_PAGE_FOOTERRIGHT, new ScPageHFItem( ATTR_PAGE_FOOTERRIGHT ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_PAGE_HEADERFIRST, new ScPageHFItem( ATTR_PAGE_HEADERFIRST ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_PAGE_FOOTERFIRST, new ScPageHFItem( ATTR_PAGE_FOOTERFIRST ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { ATTR_PAGE_HEADERSET, nullptr, SID_ATTR_PAGE_HEADERSET, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_FOOTERSET, nullptr, SID_ATTR_PAGE_FOOTERSET, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_FORMULAS, new SfxBoolItem( ATTR_PAGE_FORMULAS, false ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_NULLVALS, new SfxBoolItem( ATTR_PAGE_NULLVALS, true ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_PAGE_SCALETO, new ScPageScaleToItem( 1, 1 ), 0, SFX_ITEMINFOFLAG_NONE }, + { ATTR_HIDDEN, new SfxBoolItem( ATTR_HIDDEN, false ), 0, SFX_ITEMINFOFLAG_NONE } + }}; + + public: + ItemInfoPackageScDocument() + { + LanguageType nDefLang, nCjkLang, nCtlLang; + bool bAutoSpell; + ScModule::GetSpellSettings( nDefLang, nCjkLang, nCtlLang, bAutoSpell ); + + // latin font from GetDefaultFonts is not used, DEFAULTFONT_LATIN_SPREADSHEET instead + SvxFontItem* pStdFont = getDefaultFontItem(nDefLang, DefaultFontType::LATIN_SPREADSHEET, ATTR_FONT); + SvxFontItem* pCjkFont = getDefaultFontItem(nCjkLang, DefaultFontType::CJK_SPREADSHEET, ATTR_CJK_FONT); + SvxFontItem* pCtlFont = getDefaultFontItem(nCtlLang, DefaultFontType::CTL_SPREADSHEET, ATTR_CTL_FONT); + setItemAtItemInfoStatic(pStdFont, maItemInfos[ATTR_FONT - ATTR_STARTINDEX]); + setItemAtItemInfoStatic(pCjkFont, maItemInfos[ATTR_CJK_FONT - ATTR_STARTINDEX]); + setItemAtItemInfoStatic(pCtlFont, maItemInfos[ATTR_CTL_FONT - ATTR_STARTINDEX]); + + SvxBoxInfoItem* pGlobalBorderInnerAttr = new SvxBoxInfoItem( ATTR_BORDER_INNER ); + pGlobalBorderInnerAttr->SetLine(nullptr, SvxBoxInfoItemLine::HORI); + pGlobalBorderInnerAttr->SetLine(nullptr, SvxBoxInfoItemLine::VERT); + pGlobalBorderInnerAttr->SetTable(true); + pGlobalBorderInnerAttr->SetDist(true); + pGlobalBorderInnerAttr->SetMinDist(false); + setItemAtItemInfoStatic(pGlobalBorderInnerAttr, maItemInfos[ATTR_BORDER_INNER - ATTR_STARTINDEX]); + } + 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 (ATTR_PAGE_HEADERSET == rRetval.getWhich()) + { + SfxItemSet aSetItemItemSet(rPool, + svl::Items< + ATTR_BACKGROUND, ATTR_BACKGROUND, + ATTR_BORDER, ATTR_SHADOW, + ATTR_LRSPACE, ATTR_ULSPACE, + ATTR_PAGE_SIZE, ATTR_PAGE_SIZE, + ATTR_PAGE_ON, ATTR_PAGE_SHARED_FIRST>); + return *new ItemInfoDynamic(rRetval, new SvxSetItem(ATTR_PAGE_HEADERSET, aSetItemItemSet)); + } + + if (ATTR_PAGE_FOOTERSET == rRetval.getWhich()) + { + SfxItemSet aSetItemItemSet(rPool, + svl::Items< + ATTR_BACKGROUND, ATTR_BACKGROUND, + ATTR_BORDER, ATTR_SHADOW, + ATTR_LRSPACE, ATTR_ULSPACE, + ATTR_PAGE_SIZE, ATTR_PAGE_SIZE, + ATTR_PAGE_ON, ATTR_PAGE_SHARED_FIRST>); + return *new ItemInfoDynamic(rRetval, new SvxSetItem(ATTR_PAGE_FOOTERSET, aSetItemItemSet)); + } + + // return in any case + return rRetval; + } + }; + + static std::unique_ptr<ItemInfoPackageScDocument> g_aItemInfoPackageScDocument; + if (!g_aItemInfoPackageScDocument) + g_aItemInfoPackageScDocument.reset(new ItemInfoPackageScDocument); + return *g_aItemInfoPackageScDocument; +} ScDocumentPool::ScDocumentPool() -: SfxItemPool ( "ScDocumentPool", ATTR_STARTINDEX, ATTR_ENDINDEX, aItemInfos, nullptr ) -, mvPoolDefaults(ATTR_ENDINDEX-ATTR_STARTINDEX+1) +: SfxItemPool("ScDocumentPool") { - - LanguageType nDefLang, nCjkLang, nCtlLang; - bool bAutoSpell; - ScModule::GetSpellSettings( nDefLang, nCjkLang, nCtlLang, bAutoSpell ); - - // latin font from GetDefaultFonts is not used, DEFAULTFONT_LATIN_SPREADSHEET instead - SvxFontItem* pStdFont = getDefaultFontItem(nDefLang, DefaultFontType::LATIN_SPREADSHEET, ATTR_FONT); - SvxFontItem* pCjkFont = getDefaultFontItem(nCjkLang, DefaultFontType::CJK_SPREADSHEET, ATTR_CJK_FONT); - SvxFontItem* pCtlFont = getDefaultFontItem(nCtlLang, DefaultFontType::CTL_SPREADSHEET, ATTR_CTL_FONT); - - SvxBoxInfoItem* pGlobalBorderInnerAttr = new SvxBoxInfoItem( ATTR_BORDER_INNER ); - SfxItemSet aSetItemItemSet( *this, - svl::Items<ATTR_BACKGROUND, ATTR_BACKGROUND, - ATTR_BORDER, ATTR_SHADOW, - ATTR_LRSPACE, ATTR_ULSPACE, - ATTR_PAGE_SIZE, ATTR_PAGE_SIZE, - ATTR_PAGE_ON, ATTR_PAGE_SHARED_FIRST> ); - - pGlobalBorderInnerAttr->SetLine(nullptr, SvxBoxInfoItemLine::HORI); - pGlobalBorderInnerAttr->SetLine(nullptr, SvxBoxInfoItemLine::VERT); - pGlobalBorderInnerAttr->SetTable(true); - pGlobalBorderInnerAttr->SetDist(true); - pGlobalBorderInnerAttr->SetMinDist(false); - - mvPoolDefaults[ ATTR_FONT - ATTR_STARTINDEX ] = pStdFont; - mvPoolDefaults[ ATTR_FONT_HEIGHT - ATTR_STARTINDEX ] = new SvxFontHeightItem( 200, 100, ATTR_FONT_HEIGHT ); // 10 pt; - mvPoolDefaults[ ATTR_FONT_WEIGHT - ATTR_STARTINDEX ] = new SvxWeightItem( WEIGHT_NORMAL, ATTR_FONT_WEIGHT ); - mvPoolDefaults[ ATTR_FONT_POSTURE - ATTR_STARTINDEX ] = new SvxPostureItem( ITALIC_NONE, ATTR_FONT_POSTURE ); - mvPoolDefaults[ ATTR_FONT_UNDERLINE - ATTR_STARTINDEX ] = new SvxUnderlineItem( LINESTYLE_NONE, ATTR_FONT_UNDERLINE ); - mvPoolDefaults[ ATTR_FONT_OVERLINE - ATTR_STARTINDEX ] = new SvxOverlineItem( LINESTYLE_NONE, ATTR_FONT_OVERLINE ); - mvPoolDefaults[ ATTR_FONT_CROSSEDOUT - ATTR_STARTINDEX ] = new SvxCrossedOutItem( STRIKEOUT_NONE, ATTR_FONT_CROSSEDOUT ); - mvPoolDefaults[ ATTR_FONT_CONTOUR - ATTR_STARTINDEX ] = new SvxContourItem( false, ATTR_FONT_CONTOUR ); - mvPoolDefaults[ ATTR_FONT_SHADOWED - ATTR_STARTINDEX ] = new SvxShadowedItem( false, ATTR_FONT_SHADOWED ); - mvPoolDefaults[ ATTR_FONT_COLOR - ATTR_STARTINDEX ] = new SvxColorItem( COL_AUTO, ATTR_FONT_COLOR ); - mvPoolDefaults[ ATTR_FONT_LANGUAGE - ATTR_STARTINDEX ] = new SvxLanguageItem( LANGUAGE_DONTKNOW, ATTR_FONT_LANGUAGE ); - mvPoolDefaults[ ATTR_CJK_FONT - ATTR_STARTINDEX ] = pCjkFont; - mvPoolDefaults[ ATTR_CJK_FONT_HEIGHT - ATTR_STARTINDEX ] = new SvxFontHeightItem( 200, 100, ATTR_CJK_FONT_HEIGHT ); - mvPoolDefaults[ ATTR_CJK_FONT_WEIGHT - ATTR_STARTINDEX ] = new SvxWeightItem( WEIGHT_NORMAL, ATTR_CJK_FONT_WEIGHT ); - mvPoolDefaults[ ATTR_CJK_FONT_POSTURE- ATTR_STARTINDEX ] = new SvxPostureItem( ITALIC_NONE, ATTR_CJK_FONT_POSTURE ); - mvPoolDefaults[ ATTR_CJK_FONT_LANGUAGE-ATTR_STARTINDEX ] = new SvxLanguageItem( LANGUAGE_DONTKNOW, ATTR_CJK_FONT_LANGUAGE ); - mvPoolDefaults[ ATTR_CTL_FONT - ATTR_STARTINDEX ] = pCtlFont; - mvPoolDefaults[ ATTR_CTL_FONT_HEIGHT - ATTR_STARTINDEX ] = new SvxFontHeightItem( 200, 100, ATTR_CTL_FONT_HEIGHT ); - mvPoolDefaults[ ATTR_CTL_FONT_WEIGHT - ATTR_STARTINDEX ] = new SvxWeightItem( WEIGHT_NORMAL, ATTR_CTL_FONT_WEIGHT ); - mvPoolDefaults[ ATTR_CTL_FONT_POSTURE- ATTR_STARTINDEX ] = new SvxPostureItem( ITALIC_NONE, ATTR_CTL_FONT_POSTURE ); - mvPoolDefaults[ ATTR_CTL_FONT_LANGUAGE-ATTR_STARTINDEX ] = new SvxLanguageItem( LANGUAGE_DONTKNOW, ATTR_CTL_FONT_LANGUAGE ); - mvPoolDefaults[ ATTR_FONT_EMPHASISMARK-ATTR_STARTINDEX ] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, ATTR_FONT_EMPHASISMARK ); - mvPoolDefaults[ ATTR_USERDEF - ATTR_STARTINDEX ] = new SvXMLAttrContainerItem( ATTR_USERDEF ); - mvPoolDefaults[ ATTR_FONT_WORDLINE - ATTR_STARTINDEX ] = new SvxWordLineModeItem(false, ATTR_FONT_WORDLINE ); - mvPoolDefaults[ ATTR_FONT_RELIEF - ATTR_STARTINDEX ] = new SvxCharReliefItem( FontRelief::NONE, ATTR_FONT_RELIEF ); - mvPoolDefaults[ ATTR_HYPHENATE - ATTR_STARTINDEX ] = new ScHyphenateCell(); - mvPoolDefaults[ ATTR_SCRIPTSPACE - ATTR_STARTINDEX ] = new SvxScriptSpaceItem( false, ATTR_SCRIPTSPACE); - mvPoolDefaults[ ATTR_HANGPUNCTUATION - ATTR_STARTINDEX ] = new SvxHangingPunctuationItem( false, ATTR_HANGPUNCTUATION); - mvPoolDefaults[ ATTR_FORBIDDEN_RULES - ATTR_STARTINDEX ] = new SvxForbiddenRuleItem( false, ATTR_FORBIDDEN_RULES); - mvPoolDefaults[ ATTR_HOR_JUSTIFY - ATTR_STARTINDEX ] = new SvxHorJustifyItem( SvxCellHorJustify::Standard, ATTR_HOR_JUSTIFY); - mvPoolDefaults[ ATTR_HOR_JUSTIFY_METHOD - ATTR_STARTINDEX ] = new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, ATTR_HOR_JUSTIFY_METHOD); - mvPoolDefaults[ ATTR_INDENT - ATTR_STARTINDEX ] = new ScIndentItem( 0 ); - mvPoolDefaults[ ATTR_VER_JUSTIFY - ATTR_STARTINDEX ] = new SvxVerJustifyItem( SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY); - mvPoolDefaults[ ATTR_VER_JUSTIFY_METHOD - ATTR_STARTINDEX ] = new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, ATTR_VER_JUSTIFY_METHOD); - mvPoolDefaults[ ATTR_STACKED - ATTR_STARTINDEX ] = new ScVerticalStackCell(false); - mvPoolDefaults[ ATTR_ROTATE_VALUE - ATTR_STARTINDEX ] = new ScRotateValueItem( 0_deg100 ); - mvPoolDefaults[ ATTR_ROTATE_MODE - ATTR_STARTINDEX ] = new SvxRotateModeItem( SVX_ROTATE_MODE_BOTTOM, ATTR_ROTATE_MODE ); - mvPoolDefaults[ ATTR_VERTICAL_ASIAN - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_VERTICAL_ASIAN ); - // The default for the ATTR_WRITINGDIR cell attribute must by SvxFrameDirection::Environment, - // so that value is returned when asking for a default cell's attributes. - // The value from the page style is set as DefaultHorizontalTextDirection for the EditEngine. - mvPoolDefaults[ ATTR_WRITINGDIR - ATTR_STARTINDEX ] = new SvxFrameDirectionItem( SvxFrameDirection::Environment, ATTR_WRITINGDIR ); - mvPoolDefaults[ ATTR_LINEBREAK - ATTR_STARTINDEX ] = new ScLineBreakCell(); - mvPoolDefaults[ ATTR_SHRINKTOFIT - ATTR_STARTINDEX ] = new ScShrinkToFitCell(); - mvPoolDefaults[ ATTR_BORDER_TLBR - ATTR_STARTINDEX ] = new SvxLineItem( ATTR_BORDER_TLBR ); - mvPoolDefaults[ ATTR_BORDER_BLTR - ATTR_STARTINDEX ] = new SvxLineItem( ATTR_BORDER_BLTR ); - mvPoolDefaults[ ATTR_MARGIN - ATTR_STARTINDEX ] = new SvxMarginItem( ATTR_MARGIN ); - mvPoolDefaults[ ATTR_MERGE - ATTR_STARTINDEX ] = new ScMergeAttr; - mvPoolDefaults[ ATTR_MERGE_FLAG - ATTR_STARTINDEX ] = new ScMergeFlagAttr; - mvPoolDefaults[ ATTR_VALUE_FORMAT - ATTR_STARTINDEX ] = new SfxUInt32Item( ATTR_VALUE_FORMAT, 0 ); - mvPoolDefaults[ ATTR_LANGUAGE_FORMAT - ATTR_STARTINDEX ] = new SvxLanguageItem( ScGlobal::eLnge, ATTR_LANGUAGE_FORMAT ); - mvPoolDefaults[ ATTR_BACKGROUND - ATTR_STARTINDEX ] = new SvxBrushItem( COL_TRANSPARENT, ATTR_BACKGROUND ); - mvPoolDefaults[ ATTR_PROTECTION - ATTR_STARTINDEX ] = new ScProtectionAttr; - mvPoolDefaults[ ATTR_BORDER - ATTR_STARTINDEX ] = new SvxBoxItem( ATTR_BORDER ); - mvPoolDefaults[ ATTR_BORDER_INNER - ATTR_STARTINDEX ] = pGlobalBorderInnerAttr; - mvPoolDefaults[ ATTR_SHADOW - ATTR_STARTINDEX ] = new SvxShadowItem( ATTR_SHADOW ); - mvPoolDefaults[ ATTR_VALIDDATA - ATTR_STARTINDEX ] = new SfxUInt32Item( ATTR_VALIDDATA, 0 ); - mvPoolDefaults[ ATTR_CONDITIONAL - ATTR_STARTINDEX ] = new ScCondFormatItem; - mvPoolDefaults[ ATTR_HYPERLINK - ATTR_STARTINDEX ] = new SfxStringItem( ATTR_HYPERLINK, OUString() ) ; - mvPoolDefaults[ ATTR_LRSPACE - ATTR_STARTINDEX ] = new SvxLRSpaceItem( ATTR_LRSPACE ); - mvPoolDefaults[ ATTR_ULSPACE - ATTR_STARTINDEX ] = new SvxULSpaceItem( ATTR_ULSPACE ); - mvPoolDefaults[ ATTR_PAGE - ATTR_STARTINDEX ] = new SvxPageItem( ATTR_PAGE ); - mvPoolDefaults[ ATTR_PAGE_PAPERBIN - ATTR_STARTINDEX ] = new SvxPaperBinItem( ATTR_PAGE_PAPERBIN ); - mvPoolDefaults[ ATTR_PAGE_SIZE - ATTR_STARTINDEX ] = new SvxSizeItem( ATTR_PAGE_SIZE ); - mvPoolDefaults[ ATTR_PAGE_HORCENTER - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_HORCENTER ); - mvPoolDefaults[ ATTR_PAGE_VERCENTER - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_VERCENTER ); - mvPoolDefaults[ ATTR_PAGE_ON - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_ON, true ); - mvPoolDefaults[ ATTR_PAGE_DYNAMIC - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_DYNAMIC, true ); - mvPoolDefaults[ ATTR_PAGE_SHARED - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_SHARED, true ); - mvPoolDefaults[ ATTR_PAGE_SHARED_FIRST- ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_SHARED_FIRST, true ); - mvPoolDefaults[ ATTR_PAGE_NOTES - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_NOTES, false ); - mvPoolDefaults[ ATTR_PAGE_GRID - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_GRID, false ); - mvPoolDefaults[ ATTR_PAGE_HEADERS - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_HEADERS, false ); - mvPoolDefaults[ ATTR_PAGE_CHARTS - ATTR_STARTINDEX ] = new ScViewObjectModeItem( ATTR_PAGE_CHARTS ); - mvPoolDefaults[ ATTR_PAGE_OBJECTS - ATTR_STARTINDEX ] = new ScViewObjectModeItem( ATTR_PAGE_OBJECTS ); - mvPoolDefaults[ ATTR_PAGE_DRAWINGS - ATTR_STARTINDEX ] = new ScViewObjectModeItem( ATTR_PAGE_DRAWINGS ); - mvPoolDefaults[ ATTR_PAGE_TOPDOWN - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_TOPDOWN, true ); - mvPoolDefaults[ ATTR_PAGE_SCALE - ATTR_STARTINDEX ] = new SfxUInt16Item( ATTR_PAGE_SCALE, 100 ); - mvPoolDefaults[ ATTR_PAGE_SCALETOPAGES-ATTR_STARTINDEX ] = new SfxUInt16Item( ATTR_PAGE_SCALETOPAGES, 1 ); - mvPoolDefaults[ ATTR_PAGE_FIRSTPAGENO- ATTR_STARTINDEX ] = new SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, 1 ); - mvPoolDefaults[ ATTR_PAGE_HEADERLEFT - ATTR_STARTINDEX ] = new ScPageHFItem( ATTR_PAGE_HEADERLEFT ); - mvPoolDefaults[ ATTR_PAGE_FOOTERLEFT - ATTR_STARTINDEX ] = new ScPageHFItem( ATTR_PAGE_FOOTERLEFT ); - mvPoolDefaults[ ATTR_PAGE_HEADERRIGHT- ATTR_STARTINDEX ] = new ScPageHFItem( ATTR_PAGE_HEADERRIGHT ); - mvPoolDefaults[ ATTR_PAGE_FOOTERRIGHT- ATTR_STARTINDEX ] = new ScPageHFItem( ATTR_PAGE_FOOTERRIGHT ); - mvPoolDefaults[ ATTR_PAGE_HEADERFIRST- ATTR_STARTINDEX ] = new ScPageHFItem( ATTR_PAGE_HEADERFIRST ); - mvPoolDefaults[ ATTR_PAGE_FOOTERFIRST- ATTR_STARTINDEX ] = new ScPageHFItem( ATTR_PAGE_FOOTERFIRST ); - mvPoolDefaults[ ATTR_PAGE_HEADERSET - ATTR_STARTINDEX ] = new SvxSetItem( ATTR_PAGE_HEADERSET, aSetItemItemSet ); - mvPoolDefaults[ ATTR_PAGE_FOOTERSET - ATTR_STARTINDEX ] = new SvxSetItem( ATTR_PAGE_FOOTERSET, aSetItemItemSet ); - mvPoolDefaults[ ATTR_PAGE_FORMULAS - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_FORMULAS, false ); - mvPoolDefaults[ ATTR_PAGE_NULLVALS - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_PAGE_NULLVALS, true ); - mvPoolDefaults[ ATTR_PAGE_SCALETO - ATTR_STARTINDEX ] = new ScPageScaleToItem( 1, 1 ); - mvPoolDefaults[ ATTR_HIDDEN - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_HIDDEN, false ); - - SetPoolDefaults( &mvPoolDefaults ); + registerItemInfoPackage(getItemInfoPackageScDocument()); } ScDocumentPool::~ScDocumentPool() { - Delete(); + sendShutdownHint(); SetSecondaryPool(nullptr); - - for ( sal_uInt16 i=0; i < ATTR_ENDINDEX-ATTR_STARTINDEX+1; i++ ) - { - ClearRefCount( *mvPoolDefaults[i] ); - delete mvPoolDefaults[i]; - } } rtl::Reference<SfxItemPool> ScDocumentPool::Clone() const { - return new SfxItemPool (*this, true); + return new SfxItemPool(*this); } static bool lcl_HFPresentation diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 80bebd1be8a2..6022539c1658 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -294,8 +294,6 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, OUString _aName ) : rPool.GetSecondaryPool()->SetUserDefaultItem( SvxScriptSpaceItem( false, EE_PARA_ASIANCJKSPACING ) ); } - rPool.FreezeIdRanges(); // the pool is also used directly - SetStyleSheetPool(pDocument ? pDocument->GetStyleSheetPool() : new ScStyleSheetPool(rPool, pDocument)); SdrLayerAdmin& rAdmin = GetLayerAdmin(); diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx index 64978eb2d5a2..6eb5e1232da0 100644 --- a/sc/source/core/data/poolhelp.cxx +++ b/sc/source/core/data/poolhelp.cxx @@ -30,8 +30,6 @@ ScPoolHelper::ScPoolHelper( ScDocument& rSourceDoc ) : pDocPool(new ScDocumentPool) { - pDocPool->FreezeIdRanges(); - mxStylePool = new ScStyleSheetPool( *pDocPool, &rSourceDoc ); } @@ -50,7 +48,6 @@ SfxItemPool* ScPoolHelper::GetEditPool() const { pEditPool = EditEngine::CreatePool(); pEditPool->SetDefaultMetric( MapUnit::Map100thMM ); - pEditPool->FreezeIdRanges(); } return pEditPool.get(); } @@ -61,7 +58,6 @@ SfxItemPool* ScPoolHelper::GetEnginePool() const { pEnginePool = EditEngine::CreatePool(); pEnginePool->SetDefaultMetric( MapUnit::Map100thMM ); - pEnginePool->FreezeIdRanges(); } // ifg ( pEnginePool ) return pEnginePool.get(); } diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 4dcaf50cd368..94a4e432b1f6 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -644,7 +644,6 @@ ScEEParser::ScEEParser( EditEngine* pEditP ) : { // pPool is foisted on SvxRTFParser at RtfImportState::Start later on pPool->SetSecondaryPool( pDocPool.get() ); - pPool->FreezeIdRanges(); NewActEntry( nullptr ); } diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 413cf831467b..3413772e4707 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -817,7 +817,6 @@ SvxTextForwarder* ScAccessibleEditLineTextData::GetTextForwarder() if (!mpEditEngine) { rtl::Reference<SfxItemPool> pEnginePool = EditEngine::CreatePool(); - pEnginePool->FreezeIdRanges(); mpEditEngine = new ScFieldEditEngine(nullptr, pEnginePool.get(), nullptr, true); mbEditEngineCreated = true; mpEditEngine->EnableUndo( false ); @@ -1021,7 +1020,6 @@ SvxTextForwarder* ScAccessiblePreviewHeaderCellTextData::GetTextForwarder() else { rtl::Reference<SfxItemPool> pEnginePool = EditEngine::CreatePool(); - pEnginePool->FreezeIdRanges(); pEditEngine.reset( new ScFieldEditEngine(nullptr, pEnginePool.get(), nullptr, true) ); } pEditEngine->EnableUndo( false ); @@ -1122,7 +1120,6 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder() if (!mpEditEngine) { rtl::Reference<SfxItemPool> pEnginePool = EditEngine::CreatePool(); - pEnginePool->FreezeIdRanges(); std::unique_ptr<ScHeaderEditEngine> pHdrEngine(new ScHeaderEditEngine( pEnginePool.get() )); pHdrEngine->EnableUndo( false ); @@ -1250,7 +1247,6 @@ SvxTextForwarder* ScAccessibleNoteTextData::GetTextForwarder() else { rtl::Reference<SfxItemPool> pEnginePool = EditEngine::CreatePool(); - pEnginePool->FreezeIdRanges(); mpEditEngine.reset( new ScFieldEditEngine(nullptr, pEnginePool.get(), nullptr, true) ); } mpEditEngine->EnableUndo( false ); diff --git a/sc/source/ui/app/msgpool.cxx b/sc/source/ui/app/msgpool.cxx index 68d03ecd663c..d778d04f380f 100644 --- a/sc/source/ui/app/msgpool.cxx +++ b/sc/source/ui/app/msgpool.cxx @@ -23,60 +23,49 @@ #include <docpool.hxx> #include <msgpool.hxx> -SfxItemInfo const aMsgItemInfos[] = +static ItemInfoPackage& getItemInfoPackageScMessage() { - // _nItemInfoSlotID, _nItemInfoFlags - { 0, SFX_ITEMINFOFLAG_NONE }, // SCITEM_STRING - { 0, SFX_ITEMINFOFLAG_NONE }, // SCITEM_SEARCHDATA - stop using this! - { SID_SORT, SFX_ITEMINFOFLAG_NONE }, // SCITEM_SORTDATA - { SID_QUERY, SFX_ITEMINFOFLAG_NONE }, // SCITEM_QUERYDATA - { SID_SUBTOTALS, SFX_ITEMINFOFLAG_NONE }, // SCITEM_SUBTDATA - { SID_CONSOLIDATE, SFX_ITEMINFOFLAG_NONE }, // SCITEM_CONSOLIDATEDATA - { SID_PIVOT_TABLE, SFX_ITEMINFOFLAG_NONE }, // SCITEM_PIVOTDATA - { SID_SOLVE, SFX_ITEMINFOFLAG_NONE }, // SCITEM_SOLVEDATA - { SID_SCUSERLISTS, SFX_ITEMINFOFLAG_NONE }, // SCITEM_USERLIST -}; + class ItemInfoPackageScMessage : public ItemInfoPackage + { + typedef std::array<ItemInfoStatic, MSGPOOL_END - MSGPOOL_START + 1> ItemInfoArrayScMessage; + ItemInfoArrayScMessage maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { SCITEM_STRING, new SfxStringItem(SCITEM_STRING, OUString() ), 0, SFX_ITEMINFOFLAG_NONE }, + { SCITEM_SEARCHDATA, new SvxSearchItem(SCITEM_SEARCHDATA ), 0, SFX_ITEMINFOFLAG_NONE }, + { SCITEM_SORTDATA, new ScSortItem(SCITEM_SORTDATA, nullptr ), SID_SORT, SFX_ITEMINFOFLAG_NONE }, + { SCITEM_QUERYDATA, new ScQueryItem(SCITEM_QUERYDATA, nullptr, nullptr ), SID_QUERY, SFX_ITEMINFOFLAG_NONE }, + { SCITEM_SUBTDATA, new ScSubTotalItem(SCITEM_SUBTDATA, nullptr, nullptr ), SID_SUBTOTALS, SFX_ITEMINFOFLAG_NONE }, + { SCITEM_CONSOLIDATEDATA, new ScConsolidateItem(SCITEM_CONSOLIDATEDATA, nullptr ), SID_CONSOLIDATE, SFX_ITEMINFOFLAG_NONE }, + { SCITEM_PIVOTDATA, new ScPivotItem(SCITEM_PIVOTDATA, nullptr, nullptr, false ), SID_PIVOT_TABLE, SFX_ITEMINFOFLAG_NONE }, + { SCITEM_SOLVEDATA, new ScSolveItem(SCITEM_SOLVEDATA, nullptr ), SID_SOLVE, SFX_ITEMINFOFLAG_NONE }, + { SCITEM_USERLIST, new ScUserListItem(SCITEM_USERLIST ), SID_SCUSERLISTS, SFX_ITEMINFOFLAG_NONE } + }}; -ScMessagePool::ScMessagePool() - : SfxItemPool ( "ScMessagePool", - MSGPOOL_START, MSGPOOL_END, - aMsgItemInfos, nullptr ), + public: + + virtual size_t size() const override { return maItemInfos.size(); } + virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; } + }; - aGlobalStringItem ( SfxStringItem ( SCITEM_STRING, OUString() ) ), - aGlobalSearchItem ( SvxSearchItem ( SCITEM_SEARCHDATA ) ), - aGlobalSortItem ( ScSortItem ( SCITEM_SORTDATA, nullptr ) ), - aGlobalQueryItem ( ScQueryItem ( SCITEM_QUERYDATA, nullptr, nullptr ) ), - aGlobalSubTotalItem ( ScSubTotalItem ( SCITEM_SUBTDATA, nullptr, nullptr ) ), - aGlobalConsolidateItem ( ScConsolidateItem ( SCITEM_CONSOLIDATEDATA, nullptr ) ), - aGlobalPivotItem ( ScPivotItem ( SCITEM_PIVOTDATA, nullptr, nullptr, false ) ), - aGlobalSolveItem ( ScSolveItem ( SCITEM_SOLVEDATA, nullptr ) ), - aGlobalUserListItem ( ScUserListItem ( SCITEM_USERLIST ) ), + static std::unique_ptr<ItemInfoPackageScMessage> g_aItemInfoPackageScMessage; + if (!g_aItemInfoPackageScMessage) + g_aItemInfoPackageScMessage.reset(new ItemInfoPackageScMessage); + return *g_aItemInfoPackageScMessage; +} - mvPoolDefaults(MSGPOOL_END - MSGPOOL_START + 1), +ScMessagePool::ScMessagePool() +: SfxItemPool("ScMessagePool"), pDocPool(new ScDocumentPool) { - mvPoolDefaults[SCITEM_STRING - MSGPOOL_START] = &aGlobalStringItem; - mvPoolDefaults[SCITEM_SEARCHDATA - MSGPOOL_START] = &aGlobalSearchItem; - mvPoolDefaults[SCITEM_SORTDATA - MSGPOOL_START] = &aGlobalSortItem; - mvPoolDefaults[SCITEM_QUERYDATA - MSGPOOL_START] = &aGlobalQueryItem; - mvPoolDefaults[SCITEM_SUBTDATA - MSGPOOL_START] = &aGlobalSubTotalItem; - mvPoolDefaults[SCITEM_CONSOLIDATEDATA - MSGPOOL_START] = &aGlobalConsolidateItem; - mvPoolDefaults[SCITEM_PIVOTDATA - MSGPOOL_START] = &aGlobalPivotItem; - mvPoolDefaults[SCITEM_SOLVEDATA - MSGPOOL_START] = &aGlobalSolveItem; - mvPoolDefaults[SCITEM_USERLIST - MSGPOOL_START] = &aGlobalUserListItem; - - SetPoolDefaults( &mvPoolDefaults ); + registerItemInfoPackage(getItemInfoPackageScMessage()); SetSecondaryPool( pDocPool.get() ); } ScMessagePool::~ScMessagePool() { - Delete(); - SetSecondaryPool( nullptr ); // before deleting defaults (accesses defaults) - - for ( sal_uInt16 i=0; i <= MSGPOOL_END-MSGPOOL_START; i++ ) - ClearRefCount( *mvPoolDefaults[i] ); + sendShutdownHint(); + SetSecondaryPool(nullptr); // before deleting defaults (accesses defaults) } MapUnit ScMessagePool::GetMetric( sal_uInt16 nWhich ) const diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index de444001d022..e6f735aa11b7 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -148,7 +148,6 @@ ScModule::ScModule( SfxObjectFactory* pFact ) : m_aIdleTimer.Start(); m_pMessagePool = new ScMessagePool; - m_pMessagePool->FreezeIdRanges(); SetPool( m_pMessagePool.get() ); ScGlobal::InitTextHeight( *m_pMessagePool ); diff --git a/sc/source/ui/drawfunc/fuconcustomshape.cxx b/sc/source/ui/drawfunc/fuconcustomshape.cxx index 2994187b368e..14055f069946 100644 --- a/sc/source/ui/drawfunc/fuconcustomshape.cxx +++ b/sc/source/ui/drawfunc/fuconcustomshape.cxx @@ -145,8 +145,6 @@ void FuConstCustomShape::SetAttributes( SdrObject* pObj ) if ( aObjList[ i ].equalsIgnoreAsciiCase( aCustomShape ) ) { FmFormModel aFormModel; - SfxItemPool& rPool(aFormModel.GetItemPool()); - rPool.FreezeIdRanges(); if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) ) { diff --git a/sc/source/ui/inc/msgpool.hxx b/sc/source/ui/inc/msgpool.hxx index db8811c9c333..6c0e0432033b 100644 --- a/sc/source/ui/inc/msgpool.hxx +++ b/sc/source/ui/inc/msgpool.hxx @@ -20,7 +20,6 @@ #pragma once #include <svl/srchitem.hxx> - #include <svl/itempool.hxx> #include <svl/stritem.hxx> @@ -30,17 +29,6 @@ class ScDocumentPool; class ScMessagePool final : public SfxItemPool { - SfxStringItem aGlobalStringItem; - SvxSearchItem aGlobalSearchItem; - ScSortItem aGlobalSortItem; - ScQueryItem aGlobalQueryItem; - ScSubTotalItem aGlobalSubTotalItem; - ScConsolidateItem aGlobalConsolidateItem; - ScPivotItem aGlobalPivotItem; - ScSolveItem aGlobalSolveItem; - ScUserListItem aGlobalUserListItem; - - std::vector<SfxPoolItem*> mvPoolDefaults; rtl::Reference<ScDocumentPool> pDocPool; public: diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx index f96f9c020125..d39358e61f7d 100644 --- a/sc/source/ui/unoobj/editsrc.cxx +++ b/sc/source/ui/unoobj/editsrc.cxx @@ -142,7 +142,6 @@ SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder() else { rtl::Reference<SfxItemPool> pEnginePool = EditEngine::CreatePool(); - pEnginePool->FreezeIdRanges(); pEditEngine.reset( new ScEditEngineDefaulter( pEnginePool.get(), true ) ); } pForwarder.reset( new SvxEditEngineForwarder(*pEditEngine) ); diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index dea96fc2310d..20bfb1339e1e 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -165,7 +165,6 @@ SvxTextForwarder* ScHeaderFooterTextData::GetTextForwarder() if (!pEditEngine) { rtl::Reference<SfxItemPool> pEnginePool = EditEngine::CreatePool(); - pEnginePool->FreezeIdRanges(); std::unique_ptr<ScHeaderEditEngine> pHdrEngine(new ScHeaderEditEngine( pEnginePool.get() )); pHdrEngine->EnableUndo( false ); @@ -698,8 +697,6 @@ ScSimpleEditSourceHelper::ScSimpleEditSourceHelper() { rtl::Reference<SfxItemPool> pEnginePool = EditEngine::CreatePool(); pEnginePool->SetDefaultMetric( MapUnit::Map100thMM ); - pEnginePool->FreezeIdRanges(); - pEditEngine.reset( new ScFieldEditEngine(nullptr, pEnginePool.get(), nullptr, true) ); // TRUE: become owner of pool pForwarder.reset( new SvxEditEngineForwarder( *pEditEngine ) ); pOriginalSource.reset( new ScSimpleEditSource( pForwarder.get() ) ); @@ -785,7 +782,6 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() else { rtl::Reference<SfxItemPool> pEnginePool = EditEngine::CreatePool(); - pEnginePool->FreezeIdRanges(); pEditEngine.reset( new ScFieldEditEngine(nullptr, pEnginePool.get(), nullptr, true) ); } // currently, GetPortions doesn't work if UpdateMode is sal_False, diff --git a/sc/source/ui/view/notemark.cxx b/sc/source/ui/view/notemark.cxx index 2824a453e7e9..9106e291eeb0 100644 --- a/sc/source/ui/view/notemark.cxx +++ b/sc/source/ui/view/notemark.cxx @@ -80,7 +80,6 @@ IMPL_LINK_NOARG(ScNoteMarker, TimeHdl, Timer *, void) m_pModel->SetScaleUnit(MapUnit::Map100thMM); SfxItemPool& rPool = m_pModel->GetItemPool(); rPool.SetDefaultMetric(MapUnit::Map100thMM); - rPool.FreezeIdRanges(); OutputDevice* pPrinter = m_pDoc->GetRefDevice(); if (pPrinter) diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 8df4f49c1d9a..2f9f431866a5 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -167,7 +167,6 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) SetDefaultFontHeight(o3tl::convert(24, o3tl::Length::pt, o3tl::Length::mm100)); m_pItemPool->SetDefaultMetric(MapUnit::Map100thMM); - m_pItemPool->FreezeIdRanges(); SetTextDefaults(); // DrawingEngine has to know where it is... diff --git a/sd/source/ui/func/fuconcs.cxx b/sd/source/ui/func/fuconcs.cxx index 7ca906c51805..58c977ff9747 100644 --- a/sd/source/ui/func/fuconcs.cxx +++ b/sd/source/ui/func/fuconcs.cxx @@ -177,8 +177,6 @@ void FuConstructCustomShape::SetAttributes( SdrObject* pObj ) if ( aObjList[ i ].equalsIgnoreAsciiCase( aCustomShape ) ) { FmFormModel aFormModel; - SfxItemPool& rPool(aFormModel.GetItemPool()); - rPool.FreezeIdRanges(); if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) ) { diff --git a/sfx2/source/explorer/nochaos.cxx b/sfx2/source/explorer/nochaos.cxx index 045d58ea7303..3fb582a3d43d 100644 --- a/sfx2/source/explorer/nochaos.cxx +++ b/sfx2/source/explorer/nochaos.cxx @@ -30,29 +30,6 @@ namespace { - -class CntItemPool; - -class CntStaticPoolDefaults_Impl -{ - static const sal_uInt32 m_nItems = 1; - std::vector<SfxPoolItem*> mvDefaults; - std::unique_ptr<SfxItemInfo[]> m_pItemInfos; - -private: - inline void Insert( SfxPoolItem* pItem ); - -public: - explicit CntStaticPoolDefaults_Impl(); - ~CntStaticPoolDefaults_Impl(); - CntStaticPoolDefaults_Impl(const CntStaticPoolDefaults_Impl&) = delete; - CntStaticPoolDefaults_Impl& operator=(const CntStaticPoolDefaults_Impl&) = delete; - - std::vector<SfxPoolItem*>* GetDefaults() { return &mvDefaults; } - const SfxItemInfo* GetItemInfos() const { return m_pItemInfos.get(); } -}; - - class CntItemPool: public SfxItemPool { static CntItemPool* _pThePool; @@ -86,36 +63,44 @@ sal_uInt16 NoChaos::ReleaseItemPool() // CntItemPool implementation +static ItemInfoPackage& getItemInfoPackageNoChaos() +{ + class ItemInfoPackageNoChaos : public ItemInfoPackage + { + typedef std::array<ItemInfoStatic, 1> ItemInfoArrayNoChaos; + ItemInfoArrayNoChaos maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { WID_CHAOS_START, new SfxStringItem(WID_CHAOS_START, OUString()), 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<ItemInfoPackageNoChaos> g_aItemInfoPackageNoChaos; + if (!g_aItemInfoPackageNoChaos) + g_aItemInfoPackageNoChaos.reset(new ItemInfoPackageNoChaos); + return *g_aItemInfoPackageNoChaos; +} -static CntStaticPoolDefaults_Impl* pPoolDefs_Impl = nullptr; +// static CntStaticPoolDefaults_Impl* pPoolDefs_Impl = nullptr; // static member! CntItemPool* CntItemPool::_pThePool = nullptr; - CntItemPool::CntItemPool() -: SfxItemPool( "chaos", WID_CHAOS_START, WID_CHAOS_START, nullptr ), - _nRefs( 0 ) +: SfxItemPool("chaos") +, _nRefs(0) { - FreezeIdRanges(); - - // Create static defaults. - pPoolDefs_Impl = new CntStaticPoolDefaults_Impl; - - // Set item infos. - SetItemInfos( pPoolDefs_Impl->GetItemInfos() ); - - // Set static pool default items. - SetPoolDefaults( pPoolDefs_Impl->GetDefaults() ); + registerItemInfoPackage(getItemInfoPackageNoChaos()); } //virtual CntItemPool::~CntItemPool() { - // Release static pool default items. - ReleasePoolDefaults(); } @@ -146,42 +131,10 @@ sal_uInt16 CntItemPool::Release() { delete _pThePool; _pThePool = nullptr; - delete pPoolDefs_Impl; - pPoolDefs_Impl = nullptr; return 0; } return nRefs; } - -// CntStaticPoolDefaults_Impl implementation. - - -inline void CntStaticPoolDefaults_Impl::Insert( - SfxPoolItem* pItem /* Static Pool Default Item */ ) -{ - sal_uInt16 nPos = pItem->Which() - WID_CHAOS_START; - - mvDefaults[ nPos ] = pItem; - m_pItemInfos[ nPos ]._nItemInfoSlotID = 0; - m_pItemInfos[ nPos ]._nItemInfoFlags = SFX_ITEMINFOFLAG_NONE; -} - - -CntStaticPoolDefaults_Impl::~CntStaticPoolDefaults_Impl() -{ - for ( sal_uInt32 n = 0; n < m_nItems; ++n ) - delete mvDefaults[ n ]; -} - - -CntStaticPoolDefaults_Impl::CntStaticPoolDefaults_Impl() -: mvDefaults( m_nItems, nullptr ), - m_pItemInfos( new SfxItemInfo [ m_nItems ] ) -{ - memset( m_pItemInfos.get(), 0, sizeof( SfxItemInfo ) * m_nItems ); - Insert( new SfxStringItem( WID_CHAOS_START, OUString() ) ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index e6e95fe011b2..f2b9905bda3a 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -11845,7 +11845,6 @@ svx/source/xoutdev/_xpoly.cxx svx/source/xoutdev/xattr.cxx svx/source/xoutdev/xattr2.cxx svx/source/xoutdev/xattrbmp.cxx -svx/source/xoutdev/xpool.cxx svx/source/xoutdev/xtabbtmp.cxx svx/source/xoutdev/xtabcolr.cxx svx/source/xoutdev/xtabdash.cxx diff --git a/svl/qa/unit/items/stylepool.cxx b/svl/qa/unit/items/stylepool.cxx index 52625648dbb3..c77a152a0f7d 100644 --- a/svl/qa/unit/items/stylepool.cxx +++ b/svl/qa/unit/items/stylepool.cxx @@ -21,17 +21,33 @@ class StylePoolTest : public CppUnit::TestFixture { }; -CPPUNIT_TEST_FIXTURE(StylePoolTest, testIterationOrder) +ItemInfoPackage& getItemInfoPackageTest() { - // Set up a style pool with multiple parents. - SfxStringItem aDefault1(1); - std::vector<SfxPoolItem*> aDefaults{ &aDefault1 }; - SfxItemInfo const aItems[] = { // _nItemInfoSlotID, _nItemInfoFlags - { 2, SFX_ITEMINFOFLAG_NONE } + class ItemInfoPackageTest : public ItemInfoPackage + { + typedef std::array<ItemInfoStatic, 1> ItemInfoArrayTest; + ItemInfoArrayTest maItemInfos{ { // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { 1, new SfxStringItem(1), 2, 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]; + } }; - rtl::Reference<SfxItemPool> pPool = new SfxItemPool("test", 1, 1, aItems); - pPool->SetPoolDefaults(&aDefaults); + static std::unique_ptr<ItemInfoPackageTest> g_aItemInfoPackageTest; + if (!g_aItemInfoPackageTest) + g_aItemInfoPackageTest.reset(new ItemInfoPackageTest); + return *g_aItemInfoPackageTest; +} + +CPPUNIT_TEST_FIXTURE(StylePoolTest, testIterationOrder) +{ + // Set up a style pool with multiple parents. + rtl::Reference<SfxItemPool> pPool = new SfxItemPool("test"); + pPool->registerItemInfoPackage(getItemInfoPackageTest()); { // Set up parents in mixed order to make sure we do not sort by pointer address. SfxItemSet aParent1(*pPool, svl::Items<1, 1>); @@ -82,17 +98,12 @@ CPPUNIT_TEST_FIXTURE(StylePoolTest, testIterationOrder) CPPUNIT_TEST_FIXTURE(StylePoolTest, testFixedItemSet) { - SfxStringItem aDefault1(1); - std::vector<SfxPoolItem*> aDefaults{ &aDefault1 }; - SfxItemInfo const aItems[] = { // _nItemInfoSlotID, _nItemInfoFlags - { 2, SFX_ITEMINFOFLAG_NONE } - }; - rtl::Reference<SfxItemPool> pPool = new SfxItemPool("test", 1, 1, aItems); - pPool->SetPoolDefaults(&aDefaults); + rtl::Reference<SfxItemPool> pPool = new SfxItemPool("test"); + pPool->registerItemInfoPackage(getItemInfoPackageTest()); SfxItemSetFixed<1, 2> aItemSet1(*pPool); - SfxItemSetFixed<1, 2> aItemSet2(aItemSet1); // test copy constructor + assert(aItemSet2.IsItemsFixed()); } } diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 0b5fd21b2fe8..8108a72b31c4 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -186,57 +186,150 @@ // RES_UNKNOWNATR_CONTAINER ok // RES_TXTATR_UNKNOWN_CONTAINER ok +ItemInfoUser::ItemInfoUser(const ItemInfo& rItemInfo, SfxItemPool& rItemPool, const SfxPoolItem& rItem, bool bPassingOwnership) +: ItemInfo(rItemInfo) +, m_pItem(implCreateItemEntry(rItemPool, &rItem, bPassingOwnership)) +{ +} +ItemInfoUser::~ItemInfoUser() +{ + implCleanupItemEntry(m_pItem); +} -#if OSL_DEBUG_LEVEL > 0 -#include <map> +const ItemInfo& ItemInfoPackage::getExistingItemInfo(size_t /*nIndex*/) +{ + static ItemInfoStatic EMPTY(0, nullptr, 0, 0); + return EMPTY; +} -static void -lcl_CheckSlots2(std::map<sal_uInt16, sal_uInt16> & rSlotMap, - SfxItemPool const& rPool, SfxItemInfo const* pInfo) +void SfxItemPool::registerItemInfoPackage( + ItemInfoPackage& rPackage, + const std::function<SfxPoolItem*(sal_uInt16)>& rCallback) { - if (!pInfo) - return; // may not be initialized yet - if (rPool.GetName() == "EditEngineItemPool") - return; // HACK: this one has loads of duplicates already, ignore it :( - sal_uInt16 const nFirst(rPool.GetFirstWhich()); - sal_uInt16 const nCount(rPool.GetLastWhich() - rPool.GetFirstWhich() + 1); - for (sal_uInt16 n = 0; n < nCount; ++n) + assert(maItemInfos.empty() && "ITEM: registering more than one ItemInfoPackage per Pool is not allowed (!)"); + + // we know the size :-) + maItemInfos.reserve(rPackage.size()); + + // loop over ItemInfoPackage and add ptrs to provided ItemInfos + for(size_t a(0); a < rPackage.size(); a++) { - sal_uInt16 const nSlotId(pInfo[n]._nItemInfoSlotID); - if (nSlotId != 0 - && nSlotId != 10883 // preexisting duplicate SID_ATTR_GRAF_CROP - && nSlotId != 10023 // preexisting duplicate SID_ATTR_BORDER_INNER - && nSlotId != 10024 // preexisting duplicate SID_ATTR_BORDER_OUTER - && nSlotId != 11013 // preexisting duplicate SID_ATTR_BORDER_DIAG_TLBR - && nSlotId != 11014) // preexisting duplicate SID_ATTR_BORDER_DIAG_BLTR - { // check for duplicate slot-id mapping - std::map<sal_uInt16, sal_uInt16>::const_iterator const iter( - rSlotMap.find(nSlotId)); - sal_uInt16 const nWhich(nFirst + n); - if (iter != rSlotMap.end()) - { - SAL_WARN("svl", "SfxItemPool: duplicate SlotId " << nSlotId - << " mapped to " << iter->second << " and " << nWhich); - assert(false); - } - rSlotMap.insert(std::make_pair(nSlotId, nWhich)); + // get ItemInfo entry, maybe StaticDefault or DynamicDefault + const ItemInfo& rItemInfo(rPackage.getItemInfo(a, *this)); + + if (nullptr != rItemInfo.getItem()) + { + // if it has an item, use it, done + maItemInfos.push_back(&rItemInfo); + continue; } + + // if not, use the callback to create a DynamicDefault. This + // *has* to be supported then by the caller + SfxPoolItem* pDynamicItem(rCallback(rItemInfo.getWhich())); + assert(nullptr != pDynamicItem); + maItemInfos.push_back(new ItemInfoDynamic(rItemInfo, pDynamicItem)); + } + + // use infos to fill local variables + mnStart = maItemInfos.front()->getWhich(); + mnEnd = maItemInfos.back()->getWhich(); + +#ifdef DBG_UTIL + for (size_t a(1); a < maItemInfos.size(); a++) + if (maItemInfos[a-1]->getWhich() + 1 != maItemInfos[a]->getWhich()) + assert(false && "ITEM: Order is wrong (!)"); +#endif +} + +const ItemInfo* SfxItemPool::impCheckItemInfoForClone(const ItemInfo* pInfo) +{ + const SfxPoolItem* pItem(pInfo->getItem()); + assert(nullptr != pItem && "ITEM: Missing Item in ItemInfo (!)"); + + if (pItem->isStaticDefault()) + // noting to do, not ref-counted + return pInfo; + + if (pItem->isDynamicDefault()) + { + // need to clone to new Pool as DynamicDefault, owned by the Pool + // and not shared. Mainly SfxSetItems. Not RefCounted + return new ItemInfoDynamic(*pInfo, pItem->Clone(this)); } + + // all Items else that can be in the Pool are UserDefaults. These + // are RefCounted, so use implCreateItemEntry to increase reference + return new ItemInfoUser(*pInfo, *this, *pItem); +} + +void SfxItemPool::impClearUserDefault(userItemInfos::iterator& rHit) +{ + if (rHit == maUserItemInfos.end()) + // does not exist + return; + + // get ItemInfo and Item, HAS to be a UserDefault + const sal_uInt16 nIndex(GetIndex_Impl(rHit->first)); + const ItemInfo* pInfo(maItemInfos[nIndex]); + assert(nullptr != pInfo && "ITEM: access error to Defaults in Pool (!)"); + + // restore original entry using the remembered one + maItemInfos[nIndex] = rHit->second; + + // free Item, delete ItemInfo + delete pInfo; } -#define CHECK_SLOTS() \ -do { \ - std::map<sal_uInt16, sal_uInt16> slotmap; \ - for (SfxItemPool * p = mpMaster; p; p = p->mpSecondary.get()) \ - { \ - lcl_CheckSlots2(slotmap, *p, p->pItemInfos); \ - } \ -} while (false) - -#else -#define CHECK_SLOTS() do {} while (false) +void SfxItemPool::impCreateUserDefault(const SfxPoolItem& rItem) +{ + const sal_uInt16 nWhich(rItem.Which()); + + // make sure by an assert check that none exists + assert(maUserItemInfos.end() == maUserItemInfos.find(nWhich)); + + const sal_uInt16 nIndex(GetIndex_Impl(nWhich)); + const ItemInfo* pInfo(maItemInfos[nIndex]); + assert(nullptr != pInfo && "ITEM: access error to Defaults in Pool (!)"); + + // safe original ItemInfo in UserItemInfos + maUserItemInfos.insert({nWhich, pInfo}); + + // create new Item by using implCreateItemEntry and new ItemInfo + maItemInfos[nIndex] = new ItemInfoUser(*pInfo, *this, rItem); +} + +void SfxItemPool::cleanupItemInfos() +{ + // reset all UserDefaultItems & restore original maItemInfos + while (!maUserItemInfos.empty()) + { + // get next candidate, cleanup UseDefault and remove data + userItemInfos::iterator aHit(maUserItemInfos.begin()); + impClearUserDefault(aHit); + maUserItemInfos.erase(aHit); + } + + // delete DynamicDefaults in maItemInfos, these only exist + // for Pool lifetime since they are Pool-dependent. There should + // be NO MORE UserDefaults after cleanup above + for (auto& rInfo : maItemInfos) + { + if (rInfo->getItem()->isDynamicDefault()) + { + // the whole ItemInfo is owned by the pool, so + // delete the Item and the ItemInfo (in that order :-) + delete rInfo; + } +#ifdef DBG_UTIL + // since there should be NO MORE UserDefaults the item + // then *has* to be StaticDefault - check that + else if (!rInfo->getItem()->isStaticDefault()) + assert(false && "ITEM: Error in UserDefault handling (!)"); #endif + } +} void SfxItemPool::registerItemSet(SfxItemSet& rSet) { @@ -302,63 +395,30 @@ void SfxItemPool::unregisterPoolItemHolder(SfxPoolItemHolder& rHolder) #endif } -sal_uInt16 SfxItemPool::GetFirstWhich() const -{ - return mnStart; -} - -sal_uInt16 SfxItemPool::GetLastWhich() const -{ - return mnEnd; -} - -bool SfxItemPool::IsInRange( sal_uInt16 nWhich ) const -{ - return nWhich >= mnStart && nWhich <= mnEnd; -} - -sal_uInt16 SfxItemPool::GetIndex_Impl(sal_uInt16 nWhich) const +SfxItemPool* SfxItemPool::getTargetPool(sal_uInt16 nWhich) const { - if (nWhich < mnStart || nWhich > mnEnd) - { - assert(false && "missing bounds check before use"); - return 0; - } - return nWhich - mnStart; + if (IsInRange(nWhich)) + return const_cast<SfxItemPool*>(this); + if (mpSecondary) + return mpSecondary->getTargetPool(nWhich); + return nullptr; } -sal_uInt16 SfxItemPool::GetSize_Impl() const -{ - return mnEnd - mnStart + 1; -} - -const SfxPoolItem* SfxItemPool::GetUserDefaultItem( sal_uInt16 nWhich ) const -{ - const SfxPoolItem* pRet; - if( IsInRange( nWhich ) ) - pRet = maUserDefaults[GetIndex_Impl(nWhich)]; - else if( mpSecondary ) - pRet = mpSecondary->GetUserDefaultItem( nWhich ); - else - { - assert(false && "unknown WhichId - cannot get pool default"); - pRet = nullptr; - } - return pRet; -} - - bool SfxItemPool::CheckItemInfoFlag(sal_uInt16 nWhich, sal_uInt16 nMask) const { - if (!IsInRange(nWhich)) - { - // get to correct pool - if (mpSecondary) - return mpSecondary->CheckItemInfoFlag(nWhich, nMask); + SfxItemPool* pTarget(getTargetPool(nWhich)); + if (nullptr == pTarget) return false; + + if (!pTarget->maItemInfos.empty()) + { + const sal_uInt16 nIndex(pTarget->GetIndex_Impl(nWhich)); + const ItemInfo* pInfo(pTarget->maItemInfos[nIndex]); + assert(nullptr != pInfo); + return pInfo->getItemInfoFlags() & nMask; } - return CheckItemInfoFlag_Impl(nWhich - mnStart, nMask); + return pTarget->CheckItemInfoFlag_Impl(pTarget->GetIndex_Impl(nWhich), nMask); } SfxBroadcaster& SfxItemPool::BC() @@ -366,7 +426,6 @@ SfxBroadcaster& SfxItemPool::BC() return aBC; } - /** * This is the regular ctor to be used for this class. * An SfxItemPool instance is initialized, which can manage Items in the @@ -389,212 +448,67 @@ SfxBroadcaster& SfxItemPool::BC() * @see SfxItemPool::ReleasePoolDefaults(std::vector<SfxPoolItem*>*,bool) * @see SfxItemPool::ReleasePoolDefaults(bool) */ -SfxItemPool::SfxItemPool -( - const OUString& rName, /* Pool name to identify in the file format */ - sal_uInt16 nStartWhich, /* First WhichId of the Pool (must be > 0) */ - sal_uInt16 nEndWhich, /* Last WhichId of the Pool */ - const SfxItemInfo* pInfo, /* SID Map and Item flags */ - std::vector<SfxPoolItem*>* - pDefaults /* Pointer to static Defaults; - is directly referenced by the Pool, - but no transfer of ownership */ -) +SfxItemPool::SfxItemPool(const OUString& rName) /* Pool name to identify in the file format */ : salhelper::SimpleReferenceObject() -,pItemInfos(pInfo) +, aBC() , aName(rName) -, maUserDefaults(nEndWhich - nStartWhich + 1) -, mpPoolDefaults(nullptr) , mpMaster(this) -, mnStart(nStartWhich) -, mnEnd(nEndWhich) +, mpSecondary() +, mnStart(0) +, mnEnd(0) , eDefMetric(MapUnit::MapCM) , maRegisteredSfxItemSets() , maRegisteredSfxPoolItemHolders() -, mbPreDeleteDone(false) +, mbShutdownHintSent(false) +, maItemInfos() +, maUserItemInfos() { eDefMetric = MapUnit::MapTwip; - - if ( pDefaults ) - SetPoolDefaults(pDefaults); - -#ifdef DBG_UTIL - if (pItemInfos) - { - auto p = pItemInfos; - auto nWhich = nStartWhich; - while (nWhich <= nEndWhich) - { - if (p->_nItemInfoSlotID == nWhich) - { - SAL_WARN("svl.items", "No point mapping a SID to itself, just put a 0 here in the SfxItemInfo array, at index " << (p - pItemInfos)); - assert(false); - } - ++p; - ++nWhich; - } - } -#endif } - /** * Copy ctor * * @see SfxItemPool::Clone() const */ -SfxItemPool::SfxItemPool -( - const SfxItemPool& rPool, // Copy from this instance - bool bCloneStaticDefaults /* true - Copy static Defaults - - false - Take over static Defaults */ -) +SfxItemPool::SfxItemPool(const SfxItemPool& rPool) // Copy from this instance : salhelper::SimpleReferenceObject() -, pItemInfos(rPool.pItemInfos) +, aBC() , aName(rPool.aName) -, maUserDefaults(rPool.mnEnd - rPool.mnStart + 1) -, mpPoolDefaults(nullptr) , mpMaster(this) +, mpSecondary() +, maPoolRanges() , mnStart(rPool.mnStart) , mnEnd(rPool.mnEnd) , eDefMetric(MapUnit::MapCM) , maRegisteredSfxItemSets() , maRegisteredSfxPoolItemHolders() -, mbPreDeleteDone(false) +, mbShutdownHintSent(false) +, maItemInfos(rPool.maItemInfos) +, maUserItemInfos(rPool.maUserItemInfos) { - eDefMetric = rPool.eDefMetric; - - // Take over static Defaults - if ( bCloneStaticDefaults ) - { - std::vector<SfxPoolItem *>* ppDefaults = new std::vector<SfxPoolItem*>(mnEnd-mnStart+1); - for ( sal_uInt16 n = 0; n <= mnEnd - mnStart; ++n ) - { - (*ppDefaults)[n] = (*rPool.mpPoolDefaults)[n]->Clone(this); - (*ppDefaults)[n]->setStaticDefault(); - } + // DynamicDefaults and UserDefaults need to be cloned for the new Pool + for (itemInfoVector::iterator aInfo(maItemInfos.begin()); aInfo != maItemInfos.end(); aInfo++) + *aInfo = impCheckItemInfoForClone(*aInfo); - SetPoolDefaults( ppDefaults ); - } - else - SetPoolDefaults( rPool.mpPoolDefaults ); + // DynamicDefaults need to be cloned for the new Pool (no UserDefaults in UserItemInfos) + for (auto& rUserItem : maUserItemInfos) + rUserItem.second = impCheckItemInfoForClone(rUserItem.second); - // Copy Pool Defaults - for (size_t n = 0; n < maUserDefaults.size(); ++n ) - if (rPool.maUserDefaults[n]) - { - maUserDefaults[n] = rPool.maUserDefaults[n]->Clone(this); //resets kind - maUserDefaults[n]->setUserDefault(); - } + eDefMetric = rPool.eDefMetric; // Repair linkage if ( rPool.mpSecondary ) SetSecondaryPool( rPool.mpSecondary->Clone().get() ); } -void SfxItemPool::SetPoolDefaults( std::vector<SfxPoolItem*>* pDefaults ) -{ - DBG_ASSERT( pDefaults, "first we ask for it, and then we don't give back..." ); - DBG_ASSERT( !mpPoolDefaults, "already have Defaults" ); - - mpPoolDefaults = pDefaults; - //! if ((*mpPoolDefaults)->GetKind() != SfxItemKind::StaticDefault) - //! FIXME: Probably doesn't work with SetItems at the end - { - DBG_ASSERT( (*mpPoolDefaults)[0]->GetRefCount() == 0 || - IsDefaultItem( (*mpPoolDefaults)[0] ), - "these are not static" ); - for ( sal_uInt16 n = 0; n <= mnEnd - mnStart; ++n ) - { - assert( ((*mpPoolDefaults)[n]->Which() == n + mnStart) - && "items ids in pool-ranges and in static-defaults do not match" ); - (*mpPoolDefaults)[n]->setStaticDefault(); - } - } -} - -void SfxItemPool::ClearPoolDefaults() -{ - mpPoolDefaults = nullptr; -} - -/** - * Frees the static Defaults of the corresponding SfxItemPool instance - * and deletes them if specified. - * - * The SfxItemPool instance MUST NOT BE USED after this function has - * been called; only the dtor must be called. - */ -void SfxItemPool::ReleasePoolDefaults -( - bool bDelete /* true - Deletes the array as well as the single static Defaults - - false - Neither deletes the array not the single static Defaults */ -) - - -{ - DBG_ASSERT( mpPoolDefaults, "requirements not met" ); - ReleasePoolDefaults( mpPoolDefaults, bDelete ); - - // mpPoolDefaults points to deleted memory if bDelete == true. - if ( bDelete ) - mpPoolDefaults = nullptr; -} - - -/** - * Frees the specified static Defaults and also deletes them, if so - * specified. - * - * This method MUST be called AFTER all SfxItemPool instances (which - * use the specified static Defaults 'pDefault') have been destroyed. - */ -void SfxItemPool::ReleasePoolDefaults -( - std::vector<SfxPoolItem*>* - pDefaults, /* Static Defaults that are to be freed */ - - bool bDelete /* true - Deletes the array as well as the specified - static Defaults - - false - Neither deletes the array nor the single - static Defaults */ -) -{ - DBG_ASSERT( pDefaults, "we first ask for it and the return nothing ..." ); - - for ( auto & rpItem : *pDefaults ) - { - assert(IsStaticDefaultItem(rpItem)); - rpItem->SetRefCount(0); - if ( bDelete ) - { - delete rpItem; - rpItem = nullptr; - } - } - - if ( bDelete ) - { - delete pDefaults; - pDefaults = nullptr; - } -} - - SfxItemPool::~SfxItemPool() { - // Need to be deleted? - if (!mbPreDeleteDone)//maUserDefaults.empty()) - Delete(); + // cleanup UserDefaults & delete owned DynamicDefaults + cleanupItemInfos(); + + // Need to send ShutdownHint? + sendShutdownHint(); if (mpMaster != nullptr && mpMaster != this) { @@ -626,40 +540,19 @@ void SfxItemPool::SetSecondaryPool( SfxItemPool *pPool ) // Remember new Secondary Pool mpSecondary = pPool; - - CHECK_SLOTS(); -} - -void SfxItemPool::SetItemInfos(SfxItemInfo const*const pInfo) -{ - pItemInfos = pInfo; - CHECK_SLOTS(); } - MapUnit SfxItemPool::GetMetric( sal_uInt16 ) const { return eDefMetric; } - void SfxItemPool::SetDefaultMetric( MapUnit eNewMetric ) { -// assert((pImpl->eDefMetric == eNewMetric || !pImpl->mpPoolRanges) && "pool already frozen, cannot change metric"); +// assert((pImpl->eDefMetric == eNewMetric || !pImpl->maPoolRanges) && "pool already frozen, cannot change metric"); eDefMetric = eNewMetric; } -MapUnit SfxItemPool::GetDefaultMetric() const -{ - return eDefMetric; -} - -const OUString& SfxItemPool::GetName() const -{ - return aName; -} - - bool SfxItemPool::GetPresentation ( const SfxPoolItem& rItem, @@ -672,166 +565,162 @@ bool SfxItemPool::GetPresentation SfxItemPresentation::Complete, GetMetric(rItem.Which()), eMetric, rText, rIntlWrapper ); } - rtl::Reference<SfxItemPool> SfxItemPool::Clone() const { return new SfxItemPool( *this ); } - -void SfxItemPool::Delete() +void SfxItemPool::sendShutdownHint() { - // Already deleted? - if (mbPreDeleteDone)//maUserDefaults.empty()) + // Already sent? + if (mbShutdownHintSent) return; - mbPreDeleteDone = true; + + mbShutdownHintSent = true; // Inform e.g. running Requests aBC.Broadcast( SfxHint( SfxHintId::Dying ) ); + maPoolRanges.reset(); +} + +void SfxItemPool::SetUserDefaultItem(const SfxPoolItem& rItem) +{ + SfxItemPool* pTarget(getTargetPool(rItem.Which())); + if (nullptr == pTarget) + assert(false && "unknown WhichId - cannot set pool default"); - // default items - for (auto rItemPtr : maUserDefaults) + const sal_uInt16 nWhich(rItem.Which()); + userItemInfos::iterator aHit(pTarget->maUserItemInfos.find(nWhich)); + + if (aHit == pTarget->maUserItemInfos.end()) { - if (rItemPtr) - { -#ifdef DBG_UTIL - ClearRefCount(*rItemPtr); -#endif - delete rItemPtr; - rItemPtr = nullptr; - } + // UserDefault does not exist, create needed entries to safe + // original ItemInfo in UserItemInfos and set new, owned + // ItemInfo containing an owned clone of the Item in ItemInfos + pTarget->impCreateUserDefault(rItem); + return; } - maUserDefaults.clear(); - mpPoolRanges.reset(); -} + // UserDefault does exist, check and evtl. replace + const sal_uInt16 nIndex(pTarget->GetIndex_Impl(nWhich)); + const ItemInfo* pInfo(pTarget->maItemInfos[nIndex]); + assert(nullptr != pInfo && "ITEM: access error to Defaults in Pool (!)"); + const SfxPoolItem* pItem(pInfo->getItem()); + assert(nullptr != pItem && "ITEM: access error to Defaults in Pool (!)"); + // nothing to do if equal, so check + if (SfxPoolItem::areSame(pItem, &rItem)) + return; + + // need to exchange existing instance and free current one + pTarget->maItemInfos[nIndex] = new ItemInfoUser(*pInfo, *pTarget, rItem); + delete pInfo; +} -void SfxItemPool::SetUserDefaultItem(const SfxPoolItem &rItem) +const SfxPoolItem* SfxItemPool::GetUserDefaultItem( sal_uInt16 nWhich ) const { - if ( IsInRange(rItem.Which()) ) + SfxItemPool* pTarget(getTargetPool(nWhich)); + if (nullptr == pTarget) { - auto& rOldDefault = - maUserDefaults[GetIndex_Impl(rItem.Which())]; - SfxPoolItem *pNewDefault = rItem.Clone(this); - pNewDefault->setUserDefault(); - if (rOldDefault) - { - rOldDefault->SetRefCount(0); - delete rOldDefault; - rOldDefault = nullptr; - } - rOldDefault = pNewDefault; - } - else if ( mpSecondary ) - mpSecondary->SetUserDefaultItem(rItem); - else - { - assert(false && "unknown WhichId - cannot set pool default"); + assert(false && "unknown WhichId - cannot get pool default"); + return nullptr; } + + userItemInfos::iterator aHit(pTarget->maUserItemInfos.find(nWhich)); + + if (aHit == pTarget->maUserItemInfos.end()) + // no default item + return nullptr; + + const sal_uInt16 nIndex(pTarget->GetIndex_Impl(nWhich)); + const ItemInfo* pInfo(pTarget->maItemInfos[nIndex]); + assert(nullptr != pInfo && "ITEM: access error to Defaults in Pool (!)"); + const SfxPoolItem* pItem(pInfo->getItem()); + assert(nullptr != pItem && "ITEM: access error to Defaults in Pool (!)"); + return pItem; } /** * Resets the default of the given WhichId back to the static Default. * If a pool default exists, it is removed. */ -void SfxItemPool::ResetUserDefaultItem( sal_uInt16 nWhichId ) +void SfxItemPool::ResetUserDefaultItem( sal_uInt16 nWhich ) { - if ( IsInRange(nWhichId) ) - { - auto& rOldDefault = - maUserDefaults[GetIndex_Impl(nWhichId)]; - if (rOldDefault) - { - rOldDefault->SetRefCount(0); - delete rOldDefault; - rOldDefault = nullptr; - } - } - else if ( mpSecondary ) - mpSecondary->ResetUserDefaultItem(nWhichId); - else - { + SfxItemPool* pTarget(getTargetPool(nWhich)); + if (nullptr == pTarget) assert(false && "unknown WhichId - cannot reset pool default"); + + userItemInfos::iterator aHit(pTarget->maUserItemInfos.find(nWhich)); + + if (aHit != pTarget->maUserItemInfos.end()) + { + // clear entry, cleanup, restore previous data + pTarget->impClearUserDefault(aHit); + + // remove remembered data + pTarget->maUserItemInfos.erase(aHit); } } const SfxPoolItem& SfxItemPool::GetUserOrPoolDefaultItem( sal_uInt16 nWhich ) const { - if ( !IsInRange(nWhich) ) - { - if ( mpSecondary ) - return mpSecondary->GetUserOrPoolDefaultItem( nWhich ); + SfxItemPool* pTarget(getTargetPool(nWhich)); + if (nullptr == pTarget) assert(!"unknown which - don't ask me for defaults"); - } - - DBG_ASSERT( mpPoolDefaults, "no defaults known - don't ask me for defaults" ); - sal_uInt16 nPos = GetIndex_Impl(nWhich); - SfxPoolItem* pDefault = maUserDefaults[nPos]; - if ( pDefault ) - return *pDefault; - return *(*mpPoolDefaults)[nPos]; -} -SfxItemPool* SfxItemPool::GetSecondaryPool() const -{ - return mpSecondary.get(); + const sal_uInt16 nIndex(pTarget->GetIndex_Impl(nWhich)); + const ItemInfo* pInfo(pTarget->maItemInfos[nIndex]); + assert(nullptr != pInfo && "ITEM: access error to Defaults in Pool (!)"); + const SfxPoolItem* pItem(pInfo->getItem()); + assert(nullptr != pItem && "ITEM: access error to Defaults in Pool (!)"); + return *pItem; } /* get the last pool by following the GetSecondaryPool chain */ SfxItemPool* SfxItemPool::GetLastPoolInChain() { - SfxItemPool* pLast = this; + SfxItemPool* pLast(this); + while(pLast->GetSecondaryPool()) pLast = pLast->GetSecondaryPool(); + return pLast; } -SfxItemPool* SfxItemPool::GetMasterPool() const +const WhichRangesContainer& SfxItemPool::GetMergedIdRanges() const { - return mpMaster; -} + if (maPoolRanges.empty()) + { + // Merge all ranges, keeping them sorted + for (const SfxItemPool* pPool = this; pPool; pPool = pPool->mpSecondary.get()) + maPoolRanges = maPoolRanges.MergeRange(pPool->mnStart, pPool->mnEnd); + } -/** - * This method should be called at the master pool, when all secondary - * pools are appended to it. - * - * It calculates the ranges of 'which-ids' for fast construction of - * item-sets, which contains all 'which-ids'. - */ -void SfxItemPool::FreezeIdRanges() -{ - assert(mpPoolRanges.empty() && "pool already frozen, cannot freeze twice"); - FillItemIdRanges_Impl( mpPoolRanges ); + return maPoolRanges; } - -void SfxItemPool::FillItemIdRanges_Impl( WhichRangesContainer& pWhichRanges ) const +const SfxPoolItem* SfxItemPool::GetPoolDefaultItem(sal_uInt16 nWhich) const { - DBG_ASSERT( mpPoolRanges.empty(), "GetFrozenRanges() would be faster!" ); - - pWhichRanges.reset(); - - // Merge all ranges, keeping them sorted - for (const SfxItemPool* pPool = this; pPool; pPool = pPool->mpSecondary.get()) - pWhichRanges = pWhichRanges.MergeRange(pPool->mnStart, pPool->mnEnd); -} + SfxItemPool* pTarget(getTargetPool(nWhich)); + if (nullptr == pTarget) + assert(false && "unknown WhichId - cannot resolve surrogate"); -const WhichRangesContainer& SfxItemPool::GetFrozenIdRanges() const -{ - return mpPoolRanges; -} + const sal_uInt16 nIndex(pTarget->GetIndex_Impl(nWhich)); + userItemInfos::iterator aHit(pTarget->maUserItemInfos.find(nWhich)); -const SfxPoolItem *SfxItemPool::GetPoolDefaultItem(sal_uInt16 nWhich) const -{ - if ( !IsInRange(nWhich) ) + if (aHit != pTarget->maUserItemInfos.end()) { - if ( mpSecondary ) - return mpSecondary->GetPoolDefaultItem( nWhich ); - assert(false && "unknown WhichId - cannot resolve surrogate"); - return nullptr; + // If it is a UserDefault Item, check saved ItemInfo and use + // Item from there + assert(aHit != pTarget->maUserItemInfos.end() && "ITEM: Error in UserDefault handling (!)"); + return aHit->second->getItem(); } - return (*mpPoolDefaults)[ GetIndex_Impl(nWhich) ]; + + const ItemInfo* pInfo(pTarget->maItemInfos[nIndex]); + assert(nullptr != pInfo && "ITEM: access error to Defaults in Pool (!)"); + const SfxPoolItem* pItem(pInfo->getItem()); + assert(nullptr != pItem && "ITEM: access error to Defaults in Pool (!)"); + return pItem; } namespace @@ -967,67 +856,78 @@ void SfxItemPool::GetItemSurrogates(ItemSurrogates& rTarget, sal_uInt16 nWhich) rTarget = ItemSurrogates(aNewSurrogates.begin(), aNewSurrogates.end()); } -sal_uInt16 SfxItemPool::GetWhich( sal_uInt16 nSlotId, bool bDeep ) const +sal_uInt16 SfxItemPool::GetWhich(sal_uInt16 nSlotId, bool bDeep) const { - if ( !IsSlot(nSlotId) ) + if (!IsSlot(nSlotId)) return nSlotId; - sal_uInt16 nCount = mnEnd - mnStart + 1; - for ( sal_uInt16 nOfs = 0; nOfs < nCount; ++nOfs ) - if ( pItemInfos[nOfs]._nItemInfoSlotID == nSlotId ) - return nOfs + mnStart; - if ( mpSecondary && bDeep ) + for (auto& rInfo : maItemInfos) + { + assert(nullptr != rInfo && "ITEM: access error to Defaults in Pool (!)"); + if (nSlotId == rInfo->getSlotID()) + { + return rInfo->getWhich(); + } + } + + if (mpSecondary && bDeep) return mpSecondary->GetWhich(nSlotId); + return nSlotId; } -sal_uInt16 SfxItemPool::GetSlotId( sal_uInt16 nWhich ) const +sal_uInt16 SfxItemPool::GetSlotId(sal_uInt16 nWhich) const { - if ( !IsWhich(nWhich) ) + if (!IsWhich(nWhich)) return nWhich; - if ( !IsInRange( nWhich ) ) - { - if ( mpSecondary ) - return mpSecondary->GetSlotId(nWhich); + SfxItemPool* pTarget(getTargetPool(nWhich)); + if (nullptr == pTarget) assert(false && "unknown WhichId - cannot get slot-id"); - return 0; - } - sal_uInt16 nSID = pItemInfos[nWhich - mnStart]._nItemInfoSlotID; - return nSID ? nSID : nWhich; + const sal_uInt16 nIndex(pTarget->GetIndex_Impl(nWhich)); + const ItemInfo* pInfo(pTarget->maItemInfos[nIndex]); + assert(nullptr != pInfo && "ITEM: access error to Defaults in Pool (!)"); + const sal_uInt16 nSID(pInfo->getSlotID()); + return (0 != nSID) ? nSID : nWhich; } sal_uInt16 SfxItemPool::GetTrueWhich( sal_uInt16 nSlotId, bool bDeep ) const { - if ( !IsSlot(nSlotId) ) + if (!IsSlot(nSlotId)) return 0; - sal_uInt16 nCount = mnEnd - mnStart + 1; - for ( sal_uInt16 nOfs = 0; nOfs < nCount; ++nOfs ) - if ( pItemInfos[nOfs]._nItemInfoSlotID == nSlotId ) - return nOfs + mnStart; - if ( mpSecondary && bDeep ) + for (auto& rInfo : maItemInfos) + { + assert(nullptr != rInfo && "ITEM: access error to Defaults in Pool (!)"); + if (nSlotId == rInfo->getSlotID()) + { + return rInfo->getWhich(); + } + } + + if (mpSecondary && bDeep) return mpSecondary->GetTrueWhich(nSlotId); + return 0; } sal_uInt16 SfxItemPool::GetTrueSlotId( sal_uInt16 nWhich ) const { - if ( !IsWhich(nWhich) ) + if (!IsWhich(nWhich)) return 0; - if ( !IsInRange( nWhich ) ) - { - if ( mpSecondary ) - return mpSecondary->GetTrueSlotId(nWhich); + SfxItemPool* pTarget(getTargetPool(nWhich)); + if (nullptr == pTarget) assert(false && "unknown WhichId - cannot get slot-id"); - return 0; - } - return pItemInfos[nWhich - mnStart]._nItemInfoSlotID; + + const sal_uInt16 nIndex(pTarget->GetIndex_Impl(nWhich)); + const ItemInfo* pInfo(pTarget->maItemInfos[nIndex]); + assert(nullptr != pInfo && "ITEM: access error to Defaults in Pool (!)"); + return pInfo->getSlotID(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index 9271ab13f3c1..b01b0d54519e 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -209,18 +209,16 @@ bool SfxPoolItemHolder::operator==(const SfxPoolItemHolder &rHolder) const * * For Sfx programmers: an SfxItemSet constructed in this way cannot * contain any Items with SlotIds as Which values. - * - * Don't create ItemSets with full range before FreezeIdRanges()! */ SfxItemSet::SfxItemSet(SfxItemPool& rPool) : m_pPool(&rPool) , m_pParent(nullptr) , m_nCount(0) , m_nRegister(0) - , m_nTotalCount(svl::detail::CountRanges(rPool.GetFrozenIdRanges())) + , m_nTotalCount(svl::detail::CountRanges(rPool.GetMergedIdRanges())) , m_bItemsFixed(false) , m_ppItems(new SfxPoolItem const *[m_nTotalCount]{}) - , m_pWhichRanges(rPool.GetFrozenIdRanges()) + , m_pWhichRanges(rPool.GetMergedIdRanges()) , m_aCallback() { #ifdef DBG_UTIL @@ -497,16 +495,17 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, SfxPoolItem const* pS // just use pSource which equals DISABLED_POOL_ITEM return pSource; - // CAUTION: static default items are not *that* static as it seems - // (or: should be). If they are freed with the Pool (see - // ::ReleaseDefaults) they will be deleted. Same is true for - // dynamic defaults. Thus currently no default can be shared - // at all since these may be deleted with the pool owning them. - // That these are not shared but cloned is ensured by those - // having a default RefCount of zero, so these are used merely as - // templates. - // if (IsStaticDefaultItem(pSource)) - // return pSource; + if (pSource->isStaticDefault()) + // static default Items can just be used without RefCounting + return pSource; + + if (pSource->isDynamicDefault() && !pSource->isSetItem()) + { + // dynamic default Items can only be used without RefCounting + // when same pool, else it has to be cloned (below) + if (static_cast<const SfxSetItem*>(pSource)->GetItemSet().GetPool() == &rPool) + return pSource; + } if (0 == pSource->Which()) { @@ -690,6 +689,17 @@ void implCleanupItemEntry(SfxPoolItem const* pSource) // nothing to do for disabled item entries return; + if (pSource->isStaticDefault()) + // static default Items can just be used without RefCounting + return; + + if (pSource->isDynamicDefault()) + // dynamic default Items can only be used without RefCounting + // when same pool. this is already checked at implCreateItemEntry, + // so it would have been cloned (and would no longer have this + // flag). So we can just return here + return; + if (0 == pSource->Which()) { // There should be no Items with 0 == WhichID, but there are some @@ -713,10 +723,6 @@ void implCleanupItemEntry(SfxPoolItem const* pSource) return; } - if (IsDefaultItem(pSource)) - // default items (static and dynamic) are owned by the pool, do not delete - return; - // try to get an ItemInstanceManager for global Item instance sharing ItemInstanceManager* pManager(aInstanceManagerHelper.getExistingItemInstanceManager(*pSource)); diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index 31f6cd27990d..4ec0a5a2cd25 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -511,7 +511,6 @@ SfxPoolItem::SfxPoolItem(sal_uInt16 const nWhich) #endif , m_bStaticDefault(false) , m_bDynamicDefault(false) - , m_bUserDefault(false) , m_bIsSetItem(false) , m_bShareable(true) #ifdef DBG_UTIL diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 5fcaba011431..2363f5023bfd 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -472,7 +472,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/xoutdev/xattrbmp \ svx/source/xoutdev/_xoutbmp \ svx/source/xoutdev/_xpoly \ - svx/source/xoutdev/xpool \ svx/source/xoutdev/xtabbtmp \ svx/source/xoutdev/xtabcolr \ svx/source/xoutdev/xtabdash \ diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index 53f2d2a9f981..fad66727e9fb 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -257,8 +257,6 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testTextEditEmptyGrabBag) CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObject) { std::unique_ptr<SdrModel> pModel(new SdrModel(nullptr, nullptr, true)); - pModel->GetItemPool().FreezeIdRanges(); - rtl::Reference<SdrPage> pPage(new SdrPage(*pModel, false)); pPage->SetSize(Size(1000, 1000)); pModel->InsertPage(pPage.get(), 0); @@ -595,8 +593,6 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testPageViewDrawLayerClip) CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObjectMove) { std::unique_ptr<SdrModel> pModel(new SdrModel(nullptr, nullptr, true)); - pModel->GetItemPool().FreezeIdRanges(); - rtl::Reference<SdrPage> pPage(new SdrPage(*pModel, false)); pPage->SetSize(Size(50000, 50000)); pModel->InsertPage(pPage.get(), 0); @@ -617,8 +613,6 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObjectMove) CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObjectRotate) { std::unique_ptr<SdrModel> pModel(new SdrModel(nullptr, nullptr, true)); - pModel->GetItemPool().FreezeIdRanges(); - rtl::Reference<SdrPage> pPage(new SdrPage(*pModel, false)); pPage->SetSize(Size(50000, 50000)); pModel->InsertPage(pPage.get(), 0); diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index e315819b06f5..f822f16e3251 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -77,7 +77,6 @@ void Svx3DPreviewControl::Construct() // Model mpModel.reset(new FmFormModel()); - mpModel->GetItemPool().FreezeIdRanges(); // Page mxFmPage = new FmFormPage( *mpModel ); diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index df3d7b1c8b71..456a369fcd16 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1295,8 +1295,6 @@ void SvxPreviewBase::InitSettings() SvxPreviewBase::SvxPreviewBase() : mpModel(new SdrModel(nullptr, nullptr, true)) { - // init model - mpModel->GetItemPool().FreezeIdRanges(); } void SvxPreviewBase::SetDrawingArea(weld::DrawingArea* pDrawingArea) diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index cf127d670ab1..34e411923464 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -121,7 +121,6 @@ void GraphCtrl::InitSdrModel() // Creating a Model pModel.reset(new SdrModel(nullptr, nullptr, true)); - pModel->GetItemPool().FreezeIdRanges(); pModel->SetScaleUnit(aMap100.GetMapUnit()); pModel->SetDefaultFontHeight( 500 ); diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 0a6a65077226..f645a4789f24 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -51,13 +51,33 @@ using ::com::sun::star::uno::Reference; #define TRANSCOL COL_WHITE +static ItemInfoPackage& getItemInfoPackageIMapWindow() +{ + class ItemInfoPackageIMapWindow : public ItemInfoPackage + { + typedef std::array<ItemInfoStatic, 1> ItemInfoArrayIMapWindow; + ItemInfoArrayIMapWindow maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { SID_ATTR_MACROITEM, new SvxMacroItem(SID_ATTR_MACROITEM), 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<ItemInfoPackageIMapWindow> g_aItemInfoPackageIMapWindow; + if (!g_aItemInfoPackageIMapWindow) + g_aItemInfoPackageIMapWindow.reset(new ItemInfoPackageIMapWindow); + return *g_aItemInfoPackageIMapWindow; +} + IMapWindow::IMapWindow(const Reference< XFrame >& rxDocumentFrame, weld::Dialog* pDialog) : GraphCtrl(pDialog) , mxDocumentFrame(rxDocumentFrame) { - pIMapPool = new SfxItemPool( "IMapItemPool", - SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, maItemInfos ); - pIMapPool->FreezeIdRanges(); + pIMapPool = new SfxItemPool("IMapItemPool"); + pIMapPool->registerItemInfoPackage(getItemInfoPackageIMapWindow()); } IMapWindow::~IMapWindow() diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx index fee372a25f1a..d08f18c12ce8 100644 --- a/svx/source/dialog/imapwnd.hxx +++ b/svx/source/dialog/imapwnd.hxx @@ -85,7 +85,6 @@ class IMapWindow final : public GraphCtrl TargetList aTargetList; Link<IMapWindow&,void> aInfoLink; rtl::Reference<SfxItemPool> pIMapPool; - SfxItemInfo maItemInfos[1] = {}; css::uno::Reference< css::frame::XFrame > mxDocumentFrame; std::unique_ptr<IMapDropTargetHelper> mxDropTargetHelper; diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index e938a0ad140d..8520e74cc41f 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -618,7 +618,6 @@ namespace svx return; rtl::Reference<SfxItemPool> pPool(EditEngine::CreatePool()); - pPool->FreezeIdRanges(); std::optional< SfxItemSet > xPureItems(( SfxItemSet( *pPool ) )); // put the current states of the items into the set diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index ceaa80259fd9..7fac9abec9e7 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -45,6 +45,52 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <svx/xflbckit.hxx> +#include <xftshtit.hxx> +#include <svx/xflboxy.hxx> +#include <svx/xflbstit.hxx> +#include <svx/xflclit.hxx> +#include <svx/xflgrit.hxx> +#include <svx/xflhtit.hxx> +#include <svx/xbtmpit.hxx> +#include <svx/xflftrit.hxx> +#include <svx/xsflclit.hxx> +#include <svx/xlntrit.hxx> +#include <svx/xfltrit.hxx> +#include <svx/xgrscit.hxx> +#include <svx/xflasit.hxx> +#include <svx/xflbmtit.hxx> +#include <svx/xflbmpit.hxx> +#include <svx/xflbmsxy.hxx> +#include <svx/xflbmsli.hxx> +#include <svx/xflbtoxy.hxx> +#include <svx/xlineit0.hxx> +#include <svx/xlinjoit.hxx> +#include <svx/xlncapit.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xfilluseslidebackgrounditem.hxx> +#include <svx/xtextit0.hxx> +#include <svx/xlnasit.hxx> +#include <svx/xlndsit.hxx> +#include <svx/xlnwtit.hxx> +#include <svx/xlnclit.hxx> +#include <svx/xlnstit.hxx> +#include <svx/xlnedit.hxx> +#include <svx/xlnstwit.hxx> +#include <svx/xlnedwit.hxx> +#include <svx/xlnstcit.hxx> +#include <svx/xlnedcit.hxx> +#include <svx/svddef.hxx> +#include <svl/itemset.hxx> +#include <svx/xftadit.hxx> +#include <svx/xftdiit.hxx> +#include <svx/xftstit.hxx> +#include <svx/xftmrit.hxx> +#include <svx/xftouit.hxx> +#include <svx/xftshit.hxx> +#include <svx/xftshcit.hxx> +#include <svx/xftshxy.hxx> + #include <svl/grabbagitem.hxx> #include <svl/voiditem.hxx> @@ -115,273 +161,341 @@ using namespace ::com::sun::star; -SdrItemPool::SdrItemPool( - SfxItemPool* _pMaster) -: XOutdevItemPool(_pMaster) +static ItemInfoPackage& getItemInfoPackageSdr() { - // prepare some constants - const Color aNullCol(COL_BLACK); - const sal_Int32 nDefEdgeDist(500); // Defaulting hard for Draw (100TH_MM) currently. MapMode will have to be taken into account in the future. + class ItemInfoPackageSdr : public ItemInfoPackage + { + typedef std::array<ItemInfoStatic, SDRATTR_END - SDRATTR_START + 1> ItemInfoArraySdr; + ItemInfoArraySdr maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { XATTR_LINESTYLE, new XLineStyleItem, SID_ATTR_LINE_STYLE, SFX_ITEMINFOFLAG_NONE }, + { XATTR_LINEDASH, new XLineDashItem(XDash()), SID_ATTR_LINE_DASH, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { XATTR_LINEWIDTH, new XLineWidthItem, SID_ATTR_LINE_WIDTH, SFX_ITEMINFOFLAG_NONE }, + { XATTR_LINECOLOR, new XLineColorItem(OUString(), COL_DEFAULT_SHAPE_STROKE), SID_ATTR_LINE_COLOR, SFX_ITEMINFOFLAG_NONE }, + { XATTR_LINESTART, new XLineStartItem(basegfx::B2DPolyPolygon()), SID_ATTR_LINE_START, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { XATTR_LINEEND, new XLineEndItem (basegfx::B2DPolyPolygon()), SID_ATTR_LINE_END, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { XATTR_LINESTARTWIDTH, new XLineStartWidthItem, SID_ATTR_LINE_STARTWIDTH, SFX_ITEMINFOFLAG_NONE }, + { XATTR_LINEENDWIDTH, new XLineEndWidthItem, SID_ATTR_LINE_ENDWIDTH, SFX_ITEMINFOFLAG_NONE }, + { XATTR_LINESTARTCENTER, new XLineStartCenterItem, SID_ATTR_LINE_STARTCENTER, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { XATTR_LINEENDCENTER, new XLineEndCenterItem, SID_ATTR_LINE_ENDCENTER, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { XATTR_LINETRANSPARENCE, new XLineTransparenceItem, SID_ATTR_LINE_TRANSPARENCE, SFX_ITEMINFOFLAG_NONE }, + { XATTR_LINEJOINT, new XLineJointItem, SID_ATTR_LINE_JOINT, SFX_ITEMINFOFLAG_NONE }, + { XATTR_LINECAP, new XLineCapItem, SID_ATTR_LINE_CAP, SFX_ITEMINFOFLAG_NONE }, + { XATTRSET_LINE, nullptr, 0, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FILLSTYLE, new XFillStyleItem, SID_ATTR_FILL_STYLE, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FILLCOLOR, new XFillColorItem (OUString(), COL_DEFAULT_SHAPE_FILLING), SID_ATTR_FILL_COLOR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { XATTR_FILLGRADIENT, new XFillGradientItem(basegfx::BGradient()), SID_ATTR_FILL_GRADIENT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { XATTR_FILLHATCH, new XFillHatchItem (XHatch(COL_DEFAULT_SHAPE_STROKE)), SID_ATTR_FILL_HATCH, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { XATTR_FILLBITMAP, nullptr, SID_ATTR_FILL_BITMAP, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { XATTR_FILLTRANSPARENCE, new XFillTransparenceItem, SID_ATTR_FILL_TRANSPARENCE, 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(basegfx::BColorStops(COL_BLACK.getBColor(), COL_BLACK.getBColor())), false), SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { XATTR_SECONDARYFILLCOLOR, new XSecondaryFillColorItem(OUString(), 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 }, + { XATTR_FILLUSESLIDEBACKGROUND, new XFillUseSlideBackgroundItem, SID_ATTR_FILL_USE_SLIDE_BACKGROUND, SFX_ITEMINFOFLAG_NONE }, + { XATTRSET_FILL, nullptr, 0, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTSTYLE, new XFormTextStyleItem, SID_FORMTEXT_STYLE, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTADJUST, new XFormTextAdjustItem, SID_FORMTEXT_ADJUST, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTDISTANCE, new XFormTextDistanceItem, SID_FORMTEXT_DISTANCE, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTSTART, new XFormTextStartItem, SID_FORMTEXT_START, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTMIRROR, new XFormTextMirrorItem, SID_FORMTEXT_MIRROR, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTOUTLINE, new XFormTextOutlineItem, SID_FORMTEXT_OUTLINE, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTSHADOW, new XFormTextShadowItem, SID_FORMTEXT_SHADOW, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTSHDWCOLOR, new XFormTextShadowColorItem(OUString(),COL_LIGHTGRAY), SID_FORMTEXT_SHDWCOLOR, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTSHDWXVAL, new XFormTextShadowXValItem, SID_FORMTEXT_SHDWXVAL, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTSHDWYVAL, new XFormTextShadowYValItem, SID_FORMTEXT_SHDWYVAL, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTHIDEFORM, new XFormTextHideFormItem, SID_FORMTEXT_HIDEFORM, SFX_ITEMINFOFLAG_NONE }, + { XATTR_FORMTXTSHDWTRANSP, new XFormTextShadowTranspItem, 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_SHADOW, new SdrOnOffItem(SDRATTR_SHADOW, false), SID_ATTR_FILL_SHADOW, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHADOWCOLOR, new XColorItem(SDRATTR_SHADOWCOLOR, COL_BLACK), SID_ATTR_SHADOW_COLOR, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHADOWXDIST, new SdrMetricItem(SDRATTR_SHADOWXDIST, 0), SID_ATTR_SHADOW_XDISTANCE, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHADOWYDIST, new SdrMetricItem(SDRATTR_SHADOWYDIST, 0), SID_ATTR_SHADOW_YDISTANCE, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHADOWTRANSPARENCE, new SdrPercentItem(SDRATTR_SHADOWTRANSPARENCE, 0), SID_ATTR_SHADOW_TRANSPARENCE, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHADOW3D, new SfxVoidItem(SDRATTR_SHADOW3D), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHADOWPERSP, new SfxVoidItem(SDRATTR_SHADOWPERSP), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHADOWSIZEX, new SdrMetricItem(SDRATTR_SHADOWSIZEX, 100000), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHADOWSIZEY, new SdrMetricItem(SDRATTR_SHADOWSIZEY, 100000), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHADOWBLUR, new SdrMetricItem(SDRATTR_SHADOWBLUR, 0), SID_ATTR_SHADOW_BLUR, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHADOWALIGNMENT, new SvxRectangleAlignmentItem(SDRATTR_SHADOWALIGNMENT, model::RectangleAlignment::Unset), 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_CAPTIONTYPE, new SdrCaptionTypeItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CAPTIONFIXEDANGLE, new SdrOnOffItem(SDRATTR_CAPTIONFIXEDANGLE, true), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CAPTIONANGLE, new SdrCaptionAngleItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CAPTIONGAP, new SdrCaptionGapItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CAPTIONESCDIR, new SdrCaptionEscDirItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CAPTIONESCISREL, new SdrCaptionEscIsRelItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CAPTIONESCREL, new SdrCaptionEscRelItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CAPTIONESCABS, new SdrCaptionEscAbsItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CAPTIONLINELEN, new SdrCaptionLineLenItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CAPTIONFITLINELEN, new SdrCaptionFitLineLenItem, 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_CORNER_RADIUS, new SdrMetricItem(SDRATTR_CORNER_RADIUS, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_MINFRAMEHEIGHT, new SdrMetricItem(SDRATTR_TEXT_MINFRAMEHEIGHT, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_AUTOGROWHEIGHT, new SdrOnOffItem(SDRATTR_TEXT_AUTOGROWHEIGHT, true), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_FITTOSIZE, new SdrTextFitToSizeTypeItem, SID_ATTR_TEXT_FITTOSIZE, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_LEFTDIST, new SdrMetricItem(SDRATTR_TEXT_LEFTDIST, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_RIGHTDIST, new SdrMetricItem(SDRATTR_TEXT_RIGHTDIST, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_UPPERDIST, new SdrMetricItem(SDRATTR_TEXT_UPPERDIST, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_LOWERDIST, new SdrMetricItem(SDRATTR_TEXT_LOWERDIST, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_VERTADJUST, new SdrTextVertAdjustItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_MAXFRAMEHEIGHT, new SdrMetricItem(SDRATTR_TEXT_MAXFRAMEHEIGHT, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_MINFRAMEWIDTH, new SdrMetricItem(SDRATTR_TEXT_MINFRAMEWIDTH, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_MAXFRAMEWIDTH, new SdrMetricItem(SDRATTR_TEXT_MAXFRAMEWIDTH, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_AUTOGROWWIDTH, new SdrOnOffItem(SDRATTR_TEXT_AUTOGROWWIDTH, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_HORZADJUST, new SdrTextHorzAdjustItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_ANIKIND, new SdrTextAniKindItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_ANIDIRECTION, new SdrTextAniDirectionItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_ANISTARTINSIDE, new SdrTextAniStartInsideItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_ANISTOPINSIDE, new SdrTextAniStopInsideItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_ANICOUNT, new SdrTextAniCountItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_ANIDELAY, new SdrTextAniDelayItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_ANIAMOUNT, new SdrTextAniAmountItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_CONTOURFRAME, new SdrOnOffItem(SDRATTR_TEXT_CONTOURFRAME, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_XMLATTRIBUTES, new SvXMLAttrContainerItem( SDRATTR_XMLATTRIBUTES ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { SDRATTR_TEXT_USEFIXEDCELLHEIGHT, new SdrTextFixedCellHeightItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_WORDWRAP, new SdrOnOffItem(SDRATTR_TEXT_WORDWRAP, true), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_CHAINNEXTNAME, new SfxStringItem(SDRATTR_TEXT_CHAINNEXTNAME, ""), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXT_CLIPVERTOVERFLOW, new SdrOnOffItem(SDRATTR_TEXT_CLIPVERTOVERFLOW, false), 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_EDGEKIND, new SdrEdgeKindItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_EDGENODE1HORZDIST, new SdrEdgeNode1HorzDistItem(500), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_EDGENODE1VERTDIST, new SdrEdgeNode1VertDistItem(500), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_EDGENODE2HORZDIST, new SdrEdgeNode2HorzDistItem(500), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_EDGENODE2VERTDIST, new SdrEdgeNode2VertDistItem(500), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_EDGENODE1GLUEDIST, new SdrEdgeNode1GlueDistItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_EDGENODE2GLUEDIST, new SdrEdgeNode2GlueDistItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_EDGELINEDELTACOUNT, new SdrEdgeLineDeltaCountItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_EDGELINE1DELTA, new SdrMetricItem(SDRATTR_EDGELINE1DELTA, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_EDGELINE2DELTA, new SdrMetricItem(SDRATTR_EDGELINE2DELTA, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_EDGELINE3DELTA, new SdrMetricItem(SDRATTR_EDGELINE3DELTA, 0), 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_MEASUREKIND, new SdrMeasureKindItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURETEXTHPOS, new SdrMeasureTextHPosItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURETEXTVPOS, new SdrMeasureTextVPosItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURELINEDIST, new SdrMetricItem(SDRATTR_MEASURELINEDIST, 800), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASUREHELPLINEOVERHANG, new SdrMetricItem(SDRATTR_MEASUREHELPLINEOVERHANG, 200), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASUREHELPLINEDIST, new SdrMetricItem(SDRATTR_MEASUREHELPLINEDIST, 100), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASUREHELPLINE1LEN, new SdrMetricItem(SDRATTR_MEASUREHELPLINE1LEN, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASUREHELPLINE2LEN, new SdrMetricItem(SDRATTR_MEASUREHELPLINE2LEN, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASUREBELOWREFEDGE, new SdrMeasureBelowRefEdgeItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURETEXTROTA90, new SdrMeasureTextRota90Item, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURETEXTUPSIDEDOWN, new SdrMeasureTextUpsideDownItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASUREOVERHANG, new SdrMeasureOverhangItem(600), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASUREUNIT, new SdrMeasureUnitItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURESCALE, new SdrMeasureScaleItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURESHOWUNIT, new SdrYesNoItem(SDRATTR_MEASURESHOWUNIT, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASUREFORMATSTRING, new SdrMeasureFormatStringItem(), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURETEXTAUTOANGLE, new SdrMeasureTextAutoAngleItem(), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURETEXTAUTOANGLEVIEW, new SdrMeasureTextAutoAngleViewItem(), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURETEXTISFIXEDANGLE, new SdrMeasureTextIsFixedAngleItem(), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASURETEXTFIXEDANGLE, new SdrMeasureTextFixedAngleItem(), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MEASUREDECIMALPLACES, new SdrMeasureDecimalPlacesItem(), 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_CIRCKIND, new SdrCircKindItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CIRCSTARTANGLE, new SdrAngleItem(SDRATTR_CIRCSTARTANGLE, 0_deg100), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CIRCENDANGLE, new SdrAngleItem(SDRATTR_CIRCENDANGLE, 36000_deg100), 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_OBJMOVEPROTECT, new SdrYesNoItem(SDRATTR_OBJMOVEPROTECT, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_OBJSIZEPROTECT, new SdrYesNoItem(SDRATTR_OBJSIZEPROTECT, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_OBJPRINTABLE, new SdrObjPrintableItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_LAYERID, new SdrLayerIdItem(SdrLayerID(0)), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_LAYERNAME, new SdrLayerNameItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_OBJECTNAME, new SfxStringItem(SDRATTR_OBJECTNAME), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ALLPOSITIONX, new SdrAllPositionXItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ALLPOSITIONY, new SdrAllPositionYItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ALLSIZEWIDTH, new SdrAllSizeWidthItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ALLSIZEHEIGHT, new SdrAllSizeHeightItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ONEPOSITIONX, new SdrOnePositionXItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ONEPOSITIONY, new SdrOnePositionYItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ONESIZEWIDTH, new SdrOneSizeWidthItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ONESIZEHEIGHT, new SdrOneSizeHeightItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_LOGICSIZEWIDTH, new SdrLogicSizeWidthItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_LOGICSIZEHEIGHT, new SdrLogicSizeHeightItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ROTATEANGLE, new SdrAngleItem(SDRATTR_ROTATEANGLE, 0_deg100), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_SHEARANGLE, new SdrShearAngleItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MOVEX, new SdrMoveXItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_MOVEY, new SdrMoveYItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_RESIZEXONE, new SdrResizeXOneItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_RESIZEYONE, new SdrResizeYOneItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ROTATEONE, new SdrRotateOneItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_HORZSHEARONE, new SdrHorzShearOneItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_VERTSHEARONE, new SdrVertShearOneItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_RESIZEXALL, new SdrResizeXAllItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_RESIZEYALL, new SdrResizeYAllItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_ROTATEALL, new SdrRotateAllItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_HORZSHEARALL, new SdrHorzShearAllItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_VERTSHEARALL, new SdrVertShearAllItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TRANSFORMREF1X, new SdrTransformRef1XItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TRANSFORMREF1Y, new SdrTransformRef1YItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TRANSFORMREF2X, new SdrTransformRef2XItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TRANSFORMREF2Y, new SdrTransformRef2YItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXTDIRECTION, new SvxWritingModeItem(css::text::WritingMode_LR_TB, SDRATTR_TEXTDIRECTION), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_OBJVISIBLE, new SdrObjVisibleItem, 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_GRAFRED, new SdrGrafRedItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GRAFGREEN, new SdrGrafGreenItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GRAFBLUE, new SdrGrafBlueItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GRAFLUMINANCE, new SdrGrafLuminanceItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GRAFCONTRAST, new SdrGrafContrastItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GRAFGAMMA, new SdrGrafGamma100Item, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GRAFTRANSPARENCE, new SdrGrafTransparenceItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GRAFINVERT, new SdrGrafInvertItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GRAFMODE, new SdrGrafModeItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GRAFCROP, new SdrGrafCropItem, SID_ATTR_GRAF_CROP, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_3DOBJ_PERCENT_DIAGONAL, new SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, 10), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_BACKSCALE, new SfxUInt16Item(SDRATTR_3DOBJ_BACKSCALE, 100), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_DEPTH, new SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, 1000), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_HORZ_SEGS, new SfxUInt32Item(SDRATTR_3DOBJ_HORZ_SEGS, 24), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_VERT_SEGS, new SfxUInt32Item(SDRATTR_3DOBJ_VERT_SEGS, 24), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_END_ANGLE, new SfxUInt32Item(SDRATTR_3DOBJ_END_ANGLE, 3600), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_DOUBLE_SIDED, new SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_NORMALS_KIND, new Svx3DNormalsKindItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_NORMALS_INVERT, new SfxBoolItem(SDRATTR_3DOBJ_NORMALS_INVERT, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_TEXTURE_PROJ_X, new Svx3DTextureProjectionXItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_TEXTURE_PROJ_Y, new Svx3DTextureProjectionYItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_SHADOW_3D, new SfxBoolItem(SDRATTR_3DOBJ_SHADOW_3D, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_MAT_COLOR, new SvxColorItem(Color(0x0000b8ff), SDRATTR_3DOBJ_MAT_COLOR), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_MAT_EMISSION, new SvxColorItem(Color(0x00000000), SDRATTR_3DOBJ_MAT_EMISSION), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_MAT_SPECULAR, new SvxColorItem(Color(0x00ffffff), SDRATTR_3DOBJ_MAT_SPECULAR), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, new SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, 15), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_TEXTURE_KIND, new Svx3DTextureKindItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_TEXTURE_MODE, new Svx3DTextureModeItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_TEXTURE_FILTER, new SfxBoolItem(SDRATTR_3DOBJ_TEXTURE_FILTER, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_SMOOTH_NORMALS, new Svx3DSmoothNormalsItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_SMOOTH_LIDS, new Svx3DSmoothLidsItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_CHARACTER_MODE, new Svx3DCharacterModeItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_CLOSE_FRONT, new Svx3DCloseFrontItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_CLOSE_BACK, new Svx3DCloseBackItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY, new Svx3DReducedLineGeometryItem, 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_3DSCENE_PERSPECTIVE, new Svx3DPerspectiveItem, 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_DISTANCE, new SfxUInt32Item(SDRATTR_3DSCENE_DISTANCE, 100), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_FOCAL_LENGTH, new SfxUInt32Item(SDRATTR_3DSCENE_FOCAL_LENGTH, 100), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, new SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTCOLOR_1, new SvxColorItem(Color(ColorTransparency, 0xffcccccc), SDRATTR_3DSCENE_LIGHTCOLOR_1), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTCOLOR_2, new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_2), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTCOLOR_3, new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_3), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTCOLOR_4, new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_4), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTCOLOR_5, new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_5), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTCOLOR_6, new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_6), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTCOLOR_7, new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_7), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTCOLOR_8, new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_8), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_AMBIENTCOLOR, new SvxColorItem(Color(0x00666666), SDRATTR_3DSCENE_AMBIENTCOLOR), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTON_1, new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, true), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTON_2, new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTON_3, new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTON_4, new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_4, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTON_5, new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_5, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTON_6, new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_6, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTON_7, new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_7, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTON_8, new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_8, false), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTDIRECTION_1, new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, basegfx::B3DVector(0.57735026918963, 0.57735026918963, 0.57735026918963)), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTDIRECTION_2, new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, basegfx::B3DVector(0.0,0.0,1.0)), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTDIRECTION_3, new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, basegfx::B3DVector(0.0,0.0,1.0)), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTDIRECTION_4, new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_4, basegfx::B3DVector(0.0,0.0,1.0)), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTDIRECTION_5, new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_5, basegfx::B3DVector(0.0,0.0,1.0)), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTDIRECTION_6, new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_6, basegfx::B3DVector(0.0,0.0,1.0)), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTDIRECTION_7, new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_7, basegfx::B3DVector(0.0,0.0,1.0)), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_LIGHTDIRECTION_8, new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_8, basegfx::B3DVector(0.0,0.0,1.0)), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_SHADOW_SLANT, new SfxUInt16Item(SDRATTR_3DSCENE_SHADOW_SLANT, 0), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_3DSCENE_SHADE_MODE, new Svx3DShadeModeItem, 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_CUSTOMSHAPE_ENGINE, new SfxStringItem(SDRATTR_CUSTOMSHAPE_ENGINE, ""), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CUSTOMSHAPE_DATA, new SfxStringItem(SDRATTR_CUSTOMSHAPE_DATA, ""), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_CUSTOMSHAPE_GEOMETRY, new SdrCustomShapeGeometryItem, 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_TABLE_BORDER, nullptr, SID_ATTR_BORDER_OUTER, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TABLE_BORDER_INNER, nullptr, SID_ATTR_BORDER_INNER, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TABLE_BORDER_TLBR, new SvxLineItem( SDRATTR_TABLE_BORDER_TLBR ), SID_ATTR_BORDER_DIAG_TLBR, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TABLE_BORDER_BLTR, new SvxLineItem( SDRATTR_TABLE_BORDER_BLTR ), SID_ATTR_BORDER_DIAG_BLTR, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TABLE_TEXT_ROTATION, new SvxTextRotateItem(0_deg10, SDRATTR_TABLE_TEXT_ROTATION), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TABLE_CELL_GRABBAG, new SfxGrabBagItem(SDRATTR_TABLE_CELL_GRABBAG), 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_GLOW_RADIUS, new SdrMetricItem(SDRATTR_GLOW_RADIUS, 0), SID_ATTR_GLOW_RADIUS, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GLOW_COLOR, new XColorItem(SDRATTR_GLOW_COLOR, COL_BLACK), SID_ATTR_GLOW_COLOR, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_GLOW_TRANSPARENCY, new SdrPercentItem(SDRATTR_GLOW_TRANSPARENCY, 0), SID_ATTR_GLOW_TRANSPARENCY, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_SOFTEDGE_RADIUS, new SdrMetricItem(SDRATTR_SOFTEDGE_RADIUS, 0), SID_ATTR_SOFTEDGE_RADIUS, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_TEXTCOLUMNS_NUMBER, new SfxInt16Item(SDRATTR_TEXTCOLUMNS_NUMBER, 1), 0, SFX_ITEMINFOFLAG_NONE }, + { SDRATTR_TEXTCOLUMNS_SPACING, new SdrMetricItem(SDRATTR_TEXTCOLUMNS_SPACING, 0), 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_WRITINGMODE2, new SvxFrameDirectionItem(SvxFrameDirection::Horizontal_LR_TB, SDRATTR_WRITINGMODE2), 0, SFX_ITEMINFOFLAG_NONE }, + + { SDRATTR_EDGEOOXMLCURVE, new SfxBoolItem(SDRATTR_EDGEOOXMLCURVE, false), 0, SFX_ITEMINFOFLAG_NONE } + }}; + + public: + ItemInfoPackageSdr() + { + SvxBoxItem* pboxItem(new SvxBoxItem(SDRATTR_TABLE_BORDER)); + pboxItem->SetAllDistances(100); + setItemAtItemInfoStatic(pboxItem, maItemInfos[SDRATTR_TABLE_BORDER - SDRATTR_START]); + + SvxBoxInfoItem* pBoxInfoItem = new SvxBoxInfoItem(SDRATTR_TABLE_BORDER_INNER); + pBoxInfoItem->SetTable(true); + pBoxInfoItem->SetDist(true); // always show margin field + // some lines may have DontCare state only in tables + pBoxInfoItem->SetValid(SvxBoxInfoItemValidFlags::DISABLE); + setItemAtItemInfoStatic(pBoxInfoItem, maItemInfos[SDRATTR_TABLE_BORDER_INNER - SDRATTR_START]); + } + + 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 (XATTRSET_LINE == rRetval.getWhich()) + return *new ItemInfoDynamic(rRetval, new XLineAttrSetItem(SfxItemSetFixed<XATTR_LINE_FIRST, XATTR_LINE_LAST>(rPool))); + + if (XATTRSET_FILL == rRetval.getWhich()) + return *new ItemInfoDynamic(rRetval, new XFillAttrSetItem(SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST>(rPool))); + + if (XATTR_FILLBITMAP == rRetval.getWhich()) + return *new ItemInfoDynamic(rRetval, new XFillBitmapItem(Graphic())); - // init the non-persistent items - for(sal_uInt16 i(SDRATTR_NOTPERSIST_FIRST); i <= SDRATTR_NOTPERSIST_LAST; i++) + // return in any case + return rRetval; + } + }; + + static std::unique_ptr<ItemInfoPackageSdr> g_aItemInfoPackageSdr; + if (!g_aItemInfoPackageSdr) + g_aItemInfoPackageSdr.reset(new ItemInfoPackageSdr); + return *g_aItemInfoPackageSdr; +} + +SdrItemPool::SdrItemPool(SfxItemPool* _pMaster) +: SfxItemPool("SdrItemPool") +{ + // registerItemInfoPackage(getItemInfoPackageXOutdev()); + registerItemInfoPackage(getItemInfoPackageSdr()); + + // get master pointer, evtl. add myself to the end of the pools + if(nullptr != _pMaster) { - mpLocalItemInfos[i - SDRATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_NONE; + _pMaster->GetLastPoolInChain()->SetSecondaryPool(this); } +} - // these slots need SFX_ITEMINFOFLAG_SUPPORT_SURROGATE, see - // text @svl/source/items/itempool.cxx - mpLocalItemInfos[SDRATTR_XMLATTRIBUTES -SDRATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_SUPPORT_SURROGATE; - - // init own PoolDefaults - std::vector<SfxPoolItem*>& rPoolDefaults = *mpLocalPoolDefaults; - rPoolDefaults[SDRATTR_SHADOW -SDRATTR_START]=new SdrOnOffItem(SDRATTR_SHADOW, false); - rPoolDefaults[SDRATTR_SHADOWCOLOR -SDRATTR_START]=new XColorItem(SDRATTR_SHADOWCOLOR, aNullCol); - rPoolDefaults[SDRATTR_SHADOWXDIST -SDRATTR_START]=new SdrMetricItem(SDRATTR_SHADOWXDIST, 0); - rPoolDefaults[SDRATTR_SHADOWYDIST -SDRATTR_START]=new SdrMetricItem(SDRATTR_SHADOWYDIST, 0); - rPoolDefaults[SDRATTR_SHADOWSIZEX -SDRATTR_START]=new SdrMetricItem(SDRATTR_SHADOWSIZEX, 100000); - rPoolDefaults[SDRATTR_SHADOWSIZEY -SDRATTR_START]=new SdrMetricItem(SDRATTR_SHADOWSIZEY, 100000); - rPoolDefaults[SDRATTR_SHADOWTRANSPARENCE-SDRATTR_START]=new SdrPercentItem(SDRATTR_SHADOWTRANSPARENCE, 0); - rPoolDefaults[SDRATTR_SHADOWBLUR -SDRATTR_START]=new SdrMetricItem(SDRATTR_SHADOWBLUR, 0); - rPoolDefaults[SDRATTR_SHADOWALIGNMENT -SDRATTR_START]=new SvxRectangleAlignmentItem(SDRATTR_SHADOWALIGNMENT, model::RectangleAlignment::Unset); - rPoolDefaults[SDRATTR_SHADOW3D -SDRATTR_START]=new SfxVoidItem(SDRATTR_SHADOW3D ); - rPoolDefaults[SDRATTR_SHADOWPERSP -SDRATTR_START]=new SfxVoidItem(SDRATTR_SHADOWPERSP ); - rPoolDefaults[SDRATTR_CAPTIONTYPE -SDRATTR_START]=new SdrCaptionTypeItem ; - rPoolDefaults[SDRATTR_CAPTIONFIXEDANGLE-SDRATTR_START]=new SdrOnOffItem(SDRATTR_CAPTIONFIXEDANGLE, true); - rPoolDefaults[SDRATTR_CAPTIONANGLE -SDRATTR_START]=new SdrCaptionAngleItem ; - rPoolDefaults[SDRATTR_CAPTIONGAP -SDRATTR_START]=new SdrCaptionGapItem ; - rPoolDefaults[SDRATTR_CAPTIONESCDIR -SDRATTR_START]=new SdrCaptionEscDirItem ; - rPoolDefaults[SDRATTR_CAPTIONESCISREL -SDRATTR_START]=new SdrCaptionEscIsRelItem ; - rPoolDefaults[SDRATTR_CAPTIONESCREL -SDRATTR_START]=new SdrCaptionEscRelItem ; - rPoolDefaults[SDRATTR_CAPTIONESCABS -SDRATTR_START]=new SdrCaptionEscAbsItem ; - rPoolDefaults[SDRATTR_CAPTIONLINELEN -SDRATTR_START]=new SdrCaptionLineLenItem ; - rPoolDefaults[SDRATTR_CAPTIONFITLINELEN-SDRATTR_START]=new SdrCaptionFitLineLenItem; - rPoolDefaults[SDRATTR_CORNER_RADIUS -SDRATTR_START]=new SdrMetricItem(SDRATTR_CORNER_RADIUS, 0); - rPoolDefaults[SDRATTR_TEXT_MINFRAMEHEIGHT -SDRATTR_START]=new SdrMetricItem(SDRATTR_TEXT_MINFRAMEHEIGHT, 0); - rPoolDefaults[SDRATTR_TEXT_AUTOGROWHEIGHT -SDRATTR_START]=new SdrOnOffItem(SDRATTR_TEXT_AUTOGROWHEIGHT, true); - rPoolDefaults[SDRATTR_TEXT_FITTOSIZE -SDRATTR_START]=new SdrTextFitToSizeTypeItem; - rPoolDefaults[SDRATTR_TEXT_LEFTDIST -SDRATTR_START]=new SdrMetricItem(SDRATTR_TEXT_LEFTDIST, 0); - rPoolDefaults[SDRATTR_TEXT_RIGHTDIST -SDRATTR_START]=new SdrMetricItem(SDRATTR_TEXT_RIGHTDIST, 0); - rPoolDefaults[SDRATTR_TEXT_UPPERDIST -SDRATTR_START]=new SdrMetricItem(SDRATTR_TEXT_UPPERDIST, 0); - rPoolDefaults[SDRATTR_TEXT_LOWERDIST -SDRATTR_START]=new SdrMetricItem(SDRATTR_TEXT_LOWERDIST, 0); - rPoolDefaults[SDRATTR_TEXT_VERTADJUST -SDRATTR_START]=new SdrTextVertAdjustItem; - rPoolDefaults[SDRATTR_TEXT_MAXFRAMEHEIGHT -SDRATTR_START]=new SdrMetricItem(SDRATTR_TEXT_MAXFRAMEHEIGHT, 0); - rPoolDefaults[SDRATTR_TEXT_MINFRAMEWIDTH -SDRATTR_START]=new SdrMetricItem(SDRATTR_TEXT_MINFRAMEWIDTH, 0); - rPoolDefaults[SDRATTR_TEXT_MAXFRAMEWIDTH -SDRATTR_START]=new SdrMetricItem(SDRATTR_TEXT_MAXFRAMEWIDTH, 0); - rPoolDefaults[SDRATTR_TEXT_AUTOGROWWIDTH -SDRATTR_START]=new SdrOnOffItem(SDRATTR_TEXT_AUTOGROWWIDTH, false); - rPoolDefaults[SDRATTR_TEXT_HORZADJUST -SDRATTR_START]=new SdrTextHorzAdjustItem; - rPoolDefaults[SDRATTR_TEXT_ANIKIND -SDRATTR_START]=new SdrTextAniKindItem; - rPoolDefaults[SDRATTR_TEXT_ANIDIRECTION -SDRATTR_START]=new SdrTextAniDirectionItem; - rPoolDefaults[SDRATTR_TEXT_ANISTARTINSIDE -SDRATTR_START]=new SdrTextAniStartInsideItem; - rPoolDefaults[SDRATTR_TEXT_ANISTOPINSIDE -SDRATTR_START]=new SdrTextAniStopInsideItem; - rPoolDefaults[SDRATTR_TEXT_ANICOUNT -SDRATTR_START]=new SdrTextAniCountItem; - rPoolDefaults[SDRATTR_TEXT_ANIDELAY -SDRATTR_START]=new SdrTextAniDelayItem; - rPoolDefaults[SDRATTR_TEXT_ANIAMOUNT -SDRATTR_START]=new SdrTextAniAmountItem; - rPoolDefaults[SDRATTR_TEXT_CONTOURFRAME -SDRATTR_START]=new SdrOnOffItem(SDRATTR_TEXT_CONTOURFRAME, false); - rPoolDefaults[SDRATTR_XMLATTRIBUTES -SDRATTR_START]=new SvXMLAttrContainerItem( SDRATTR_XMLATTRIBUTES ); - rPoolDefaults[SDRATTR_TEXT_CHAINNEXTNAME -SDRATTR_START]=new SfxStringItem(SDRATTR_TEXT_CHAINNEXTNAME, ""); - rPoolDefaults[SDRATTR_TEXT_USEFIXEDCELLHEIGHT -SDRATTR_START]=new SdrTextFixedCellHeightItem; - rPoolDefaults[SDRATTR_TEXT_WORDWRAP -SDRATTR_START]=new SdrOnOffItem(SDRATTR_TEXT_WORDWRAP, true); - rPoolDefaults[SDRATTR_TEXT_CLIPVERTOVERFLOW-SDRATTR_START]=new SdrOnOffItem(SDRATTR_TEXT_CLIPVERTOVERFLOW, false); - rPoolDefaults[SDRATTR_EDGEKIND -SDRATTR_START]=new SdrEdgeKindItem; - rPoolDefaults[SDRATTR_EDGENODE1HORZDIST-SDRATTR_START]=new SdrEdgeNode1HorzDistItem(nDefEdgeDist); - rPoolDefaults[SDRATTR_EDGENODE1VERTDIST-SDRATTR_START]=new SdrEdgeNode1VertDistItem(nDefEdgeDist); - rPoolDefaults[SDRATTR_EDGENODE2HORZDIST-SDRATTR_START]=new SdrEdgeNode2HorzDistItem(nDefEdgeDist); - rPoolDefaults[SDRATTR_EDGENODE2VERTDIST-SDRATTR_START]=new SdrEdgeNode2VertDistItem(nDefEdgeDist); - rPoolDefaults[SDRATTR_EDGENODE1GLUEDIST-SDRATTR_START]=new SdrEdgeNode1GlueDistItem; - rPoolDefaults[SDRATTR_EDGENODE2GLUEDIST-SDRATTR_START]=new SdrEdgeNode2GlueDistItem; - rPoolDefaults[SDRATTR_EDGELINEDELTACOUNT-SDRATTR_START]=new SdrEdgeLineDeltaCountItem; - rPoolDefaults[SDRATTR_EDGELINE1DELTA -SDRATTR_START]=new SdrMetricItem(SDRATTR_EDGELINE1DELTA, 0); - rPoolDefaults[SDRATTR_EDGELINE2DELTA -SDRATTR_START]=new SdrMetricItem(SDRATTR_EDGELINE2DELTA, 0); - rPoolDefaults[SDRATTR_EDGELINE3DELTA -SDRATTR_START]=new SdrMetricItem(SDRATTR_EDGELINE3DELTA, 0); - rPoolDefaults[SDRATTR_EDGEOOXMLCURVE -SDRATTR_START]=new SfxBoolItem(SDRATTR_EDGEOOXMLCURVE, false); - rPoolDefaults[SDRATTR_MEASUREKIND -SDRATTR_START]=new SdrMeasureKindItem; - rPoolDefaults[SDRATTR_MEASURETEXTHPOS -SDRATTR_START]=new SdrMeasureTextHPosItem; - rPoolDefaults[SDRATTR_MEASURETEXTVPOS -SDRATTR_START]=new SdrMeasureTextVPosItem; - rPoolDefaults[SDRATTR_MEASURELINEDIST -SDRATTR_START]=new SdrMetricItem(SDRATTR_MEASURELINEDIST, 800); - rPoolDefaults[SDRATTR_MEASUREHELPLINEOVERHANG -SDRATTR_START]=new SdrMetricItem(SDRATTR_MEASUREHELPLINEOVERHANG, 200); - rPoolDefaults[SDRATTR_MEASUREHELPLINEDIST -SDRATTR_START]=new SdrMetricItem(SDRATTR_MEASUREHELPLINEDIST, 100); - rPoolDefaults[SDRATTR_MEASUREHELPLINE1LEN -SDRATTR_START]=new SdrMetricItem(SDRATTR_MEASUREHELPLINE1LEN, 0); - rPoolDefaults[SDRATTR_MEASUREHELPLINE2LEN -SDRATTR_START]=new SdrMetricItem(SDRATTR_MEASUREHELPLINE2LEN, 0); - rPoolDefaults[SDRATTR_MEASUREBELOWREFEDGE -SDRATTR_START]=new SdrMeasureBelowRefEdgeItem; - rPoolDefaults[SDRATTR_MEASURETEXTROTA90 -SDRATTR_START]=new SdrMeasureTextRota90Item; - rPoolDefaults[SDRATTR_MEASURETEXTUPSIDEDOWN -SDRATTR_START]=new SdrMeasureTextUpsideDownItem; - rPoolDefaults[SDRATTR_MEASUREOVERHANG -SDRATTR_START]=new SdrMeasureOverhangItem(600); - rPoolDefaults[SDRATTR_MEASUREUNIT -SDRATTR_START]=new SdrMeasureUnitItem; - rPoolDefaults[SDRATTR_MEASURESCALE -SDRATTR_START]=new SdrMeasureScaleItem; - rPoolDefaults[SDRATTR_MEASURESHOWUNIT -SDRATTR_START]=new SdrYesNoItem(SDRATTR_MEASURESHOWUNIT, false); - rPoolDefaults[SDRATTR_MEASUREFORMATSTRING -SDRATTR_START]=new SdrMeasureFormatStringItem(); - rPoolDefaults[SDRATTR_MEASURETEXTAUTOANGLE -SDRATTR_START]=new SdrMeasureTextAutoAngleItem(); - rPoolDefaults[SDRATTR_MEASURETEXTAUTOANGLEVIEW-SDRATTR_START]=new SdrMeasureTextAutoAngleViewItem(); - rPoolDefaults[SDRATTR_MEASURETEXTISFIXEDANGLE -SDRATTR_START]=new SdrMeasureTextIsFixedAngleItem(); - rPoolDefaults[SDRATTR_MEASURETEXTFIXEDANGLE -SDRATTR_START]=new SdrMeasureTextFixedAngleItem(); - rPoolDefaults[SDRATTR_MEASUREDECIMALPLACES -SDRATTR_START]=new SdrMeasureDecimalPlacesItem(); - rPoolDefaults[SDRATTR_CIRCKIND -SDRATTR_START]=new SdrCircKindItem; - rPoolDefaults[SDRATTR_CIRCSTARTANGLE-SDRATTR_START]=new SdrAngleItem(SDRATTR_CIRCSTARTANGLE, 0_deg100); - rPoolDefaults[SDRATTR_CIRCENDANGLE -SDRATTR_START]=new SdrAngleItem(SDRATTR_CIRCENDANGLE, 36000_deg100); - rPoolDefaults[SDRATTR_OBJMOVEPROTECT -SDRATTR_START]=new SdrYesNoItem(SDRATTR_OBJMOVEPROTECT, false); - rPoolDefaults[SDRATTR_OBJSIZEPROTECT -SDRATTR_START]=new SdrYesNoItem(SDRATTR_OBJSIZEPROTECT, false); - rPoolDefaults[SDRATTR_OBJPRINTABLE -SDRATTR_START]=new SdrObjPrintableItem; - rPoolDefaults[SDRATTR_OBJVISIBLE -SDRATTR_START]=new SdrObjVisibleItem; - rPoolDefaults[SDRATTR_LAYERID -SDRATTR_START]=new SdrLayerIdItem(SdrLayerID(0)); - rPoolDefaults[SDRATTR_LAYERNAME -SDRATTR_START]=new SdrLayerNameItem; - rPoolDefaults[SDRATTR_OBJECTNAME -SDRATTR_START]=new SfxStringItem(SDRATTR_OBJECTNAME); - rPoolDefaults[SDRATTR_ALLPOSITIONX -SDRATTR_START]=new SdrAllPositionXItem; - rPoolDefaults[SDRATTR_ALLPOSITIONY -SDRATTR_START]=new SdrAllPositionYItem; - rPoolDefaults[SDRATTR_ALLSIZEWIDTH -SDRATTR_START]=new SdrAllSizeWidthItem; - rPoolDefaults[SDRATTR_ALLSIZEHEIGHT -SDRATTR_START]=new SdrAllSizeHeightItem; - rPoolDefaults[SDRATTR_ONEPOSITIONX -SDRATTR_START]=new SdrOnePositionXItem; - rPoolDefaults[SDRATTR_ONEPOSITIONY -SDRATTR_START]=new SdrOnePositionYItem; - rPoolDefaults[SDRATTR_ONESIZEWIDTH -SDRATTR_START]=new SdrOneSizeWidthItem; - rPoolDefaults[SDRATTR_ONESIZEHEIGHT -SDRATTR_START]=new SdrOneSizeHeightItem; - rPoolDefaults[SDRATTR_LOGICSIZEWIDTH -SDRATTR_START]=new SdrLogicSizeWidthItem; - rPoolDefaults[SDRATTR_LOGICSIZEHEIGHT-SDRATTR_START]=new SdrLogicSizeHeightItem; - rPoolDefaults[SDRATTR_ROTATEANGLE -SDRATTR_START]=new SdrAngleItem(SDRATTR_ROTATEANGLE, 0_deg100); - rPoolDefaults[SDRATTR_SHEARANGLE -SDRATTR_START]=new SdrShearAngleItem; - rPoolDefaults[SDRATTR_MOVEX -SDRATTR_START]=new SdrMoveXItem; - rPoolDefaults[SDRATTR_MOVEY -SDRATTR_START]=new SdrMoveYItem; - rPoolDefaults[SDRATTR_RESIZEXONE -SDRATTR_START]=new SdrResizeXOneItem; - rPoolDefaults[SDRATTR_RESIZEYONE -SDRATTR_START]=new SdrResizeYOneItem; - rPoolDefaults[SDRATTR_ROTATEONE -SDRATTR_START]=new SdrRotateOneItem; - rPoolDefaults[SDRATTR_HORZSHEARONE -SDRATTR_START]=new SdrHorzShearOneItem; - rPoolDefaults[SDRATTR_VERTSHEARONE -SDRATTR_START]=new SdrVertShearOneItem; - rPoolDefaults[SDRATTR_RESIZEXALL -SDRATTR_START]=new SdrResizeXAllItem; - rPoolDefaults[SDRATTR_RESIZEYALL -SDRATTR_START]=new SdrResizeYAllItem; - rPoolDefaults[SDRATTR_ROTATEALL -SDRATTR_START]=new SdrRotateAllItem; - rPoolDefaults[SDRATTR_HORZSHEARALL -SDRATTR_START]=new SdrHorzShearAllItem; - rPoolDefaults[SDRATTR_VERTSHEARALL -SDRATTR_START]=new SdrVertShearAllItem; - rPoolDefaults[SDRATTR_TRANSFORMREF1X -SDRATTR_START]=new SdrTransformRef1XItem; - rPoolDefaults[SDRATTR_TRANSFORMREF1Y -SDRATTR_START]=new SdrTransformRef1YItem; - rPoolDefaults[SDRATTR_TRANSFORMREF2X -SDRATTR_START]=new SdrTransformRef2XItem; - rPoolDefaults[SDRATTR_TRANSFORMREF2Y -SDRATTR_START]=new SdrTransformRef2YItem; - rPoolDefaults[SDRATTR_TEXTDIRECTION -SDRATTR_START]=new SvxWritingModeItem(css::text::WritingMode_LR_TB, SDRATTR_TEXTDIRECTION); - rPoolDefaults[ SDRATTR_GRAFRED - SDRATTR_START] = new SdrGrafRedItem; - rPoolDefaults[ SDRATTR_GRAFGREEN - SDRATTR_START] = new SdrGrafGreenItem; - rPoolDefaults[ SDRATTR_GRAFBLUE - SDRATTR_START] = new SdrGrafBlueItem; - rPoolDefaults[ SDRATTR_GRAFLUMINANCE - SDRATTR_START] = new SdrGrafLuminanceItem; - rPoolDefaults[ SDRATTR_GRAFCONTRAST - SDRATTR_START] = new SdrGrafContrastItem; - rPoolDefaults[ SDRATTR_GRAFGAMMA - SDRATTR_START] = new SdrGrafGamma100Item; - rPoolDefaults[ SDRATTR_GRAFTRANSPARENCE - SDRATTR_START] = new SdrGrafTransparenceItem; - rPoolDefaults[ SDRATTR_GRAFINVERT - SDRATTR_START] = new SdrGrafInvertItem; - rPoolDefaults[ SDRATTR_GRAFMODE - SDRATTR_START] = new SdrGrafModeItem; - rPoolDefaults[ SDRATTR_GRAFCROP - SDRATTR_START] = new SdrGrafCropItem; - rPoolDefaults[ SDRATTR_3DOBJ_PERCENT_DIAGONAL - SDRATTR_START ] = new SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, 10); - rPoolDefaults[ SDRATTR_3DOBJ_BACKSCALE - SDRATTR_START ] = new SfxUInt16Item(SDRATTR_3DOBJ_BACKSCALE, 100); - rPoolDefaults[ SDRATTR_3DOBJ_DEPTH - SDRATTR_START ] = new SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, 1000); - rPoolDefaults[ SDRATTR_3DOBJ_HORZ_SEGS - SDRATTR_START ] = new SfxUInt32Item(SDRATTR_3DOBJ_HORZ_SEGS, 24); - rPoolDefaults[ SDRATTR_3DOBJ_VERT_SEGS - SDRATTR_START ] = new SfxUInt32Item(SDRATTR_3DOBJ_VERT_SEGS, 24); - rPoolDefaults[ SDRATTR_3DOBJ_END_ANGLE - SDRATTR_START ] = new SfxUInt32Item(SDRATTR_3DOBJ_END_ANGLE, 3600); - rPoolDefaults[ SDRATTR_3DOBJ_DOUBLE_SIDED - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, false); - rPoolDefaults[ SDRATTR_3DOBJ_NORMALS_KIND - SDRATTR_START ] = new Svx3DNormalsKindItem; - rPoolDefaults[ SDRATTR_3DOBJ_NORMALS_INVERT - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DOBJ_NORMALS_INVERT, false); - rPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_PROJ_X - SDRATTR_START ] = new Svx3DTextureProjectionXItem; - rPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_PROJ_Y - SDRATTR_START ] = new Svx3DTextureProjectionYItem; - rPoolDefaults[ SDRATTR_3DOBJ_SHADOW_3D - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DOBJ_SHADOW_3D, false); - rPoolDefaults[ SDRATTR_3DOBJ_MAT_COLOR - SDRATTR_START ] = new SvxColorItem(Color(0x0000b8ff), SDRATTR_3DOBJ_MAT_COLOR); - rPoolDefaults[ SDRATTR_3DOBJ_MAT_EMISSION - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DOBJ_MAT_EMISSION); - rPoolDefaults[ SDRATTR_3DOBJ_MAT_SPECULAR - SDRATTR_START ] = new SvxColorItem(Color(0x00ffffff), SDRATTR_3DOBJ_MAT_SPECULAR); - rPoolDefaults[ SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY - SDRATTR_START ] = new SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, 15); - rPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_KIND - SDRATTR_START ] = new Svx3DTextureKindItem; - rPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_MODE - SDRATTR_START ] = new Svx3DTextureModeItem; - rPoolDefaults[ SDRATTR_3DOBJ_TEXTURE_FILTER - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DOBJ_TEXTURE_FILTER, false); - rPoolDefaults[ SDRATTR_3DOBJ_SMOOTH_NORMALS - SDRATTR_START ] = new Svx3DSmoothNormalsItem; - rPoolDefaults[ SDRATTR_3DOBJ_SMOOTH_LIDS - SDRATTR_START ] = new Svx3DSmoothLidsItem; - rPoolDefaults[ SDRATTR_3DOBJ_CHARACTER_MODE - SDRATTR_START ] = new Svx3DCharacterModeItem; - rPoolDefaults[ SDRATTR_3DOBJ_CLOSE_FRONT - SDRATTR_START ] = new Svx3DCloseFrontItem; - rPoolDefaults[ SDRATTR_3DOBJ_CLOSE_BACK - SDRATTR_START ] = new Svx3DCloseBackItem; - rPoolDefaults[ SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY - SDRATTR_START ] = new Svx3DReducedLineGeometryItem; - rPoolDefaults[ SDRATTR_3DSCENE_PERSPECTIVE - SDRATTR_START ] = new Svx3DPerspectiveItem; - rPoolDefaults[ SDRATTR_3DSCENE_DISTANCE - SDRATTR_START ] = new SfxUInt32Item(SDRATTR_3DSCENE_DISTANCE, 100); - rPoolDefaults[ SDRATTR_3DSCENE_FOCAL_LENGTH - SDRATTR_START ] = new SfxUInt32Item(SDRATTR_3DSCENE_FOCAL_LENGTH, 100); - rPoolDefaults[ SDRATTR_3DSCENE_TWO_SIDED_LIGHTING - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, false); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_1 - SDRATTR_START ] = new SvxColorItem(Color(ColorTransparency, 0xffcccccc), SDRATTR_3DSCENE_LIGHTCOLOR_1); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_2 - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_2); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_3 - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_3); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_4 - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_4); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_5 - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_5); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_6 - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_6); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_7 - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_7); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTCOLOR_8 - SDRATTR_START ] = new SvxColorItem(Color(0x00000000), SDRATTR_3DSCENE_LIGHTCOLOR_8); - rPoolDefaults[ SDRATTR_3DSCENE_AMBIENTCOLOR - SDRATTR_START ] = new SvxColorItem(Color(0x00666666), SDRATTR_3DSCENE_AMBIENTCOLOR); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_1 - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, true); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_2 - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, false); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_3 - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, false); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_4 - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_4, false); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_5 - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_5, false); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_6 - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_6, false); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_7 - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_7, false); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTON_8 - SDRATTR_START ] = new SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_8, false); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_1 - SDRATTR_START ] = new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, basegfx::B3DVector(0.57735026918963, 0.57735026918963, 0.57735026918963)); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_2 - SDRATTR_START ] = new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, basegfx::B3DVector(0.0,0.0,1.0)); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_3 - SDRATTR_START ] = new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, basegfx::B3DVector(0.0,0.0,1.0)); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_4 - SDRATTR_START ] = new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_4, basegfx::B3DVector(0.0,0.0,1.0)); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_5 - SDRATTR_START ] = new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_5, basegfx::B3DVector(0.0,0.0,1.0)); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_6 - SDRATTR_START ] = new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_6, basegfx::B3DVector(0.0,0.0,1.0)); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_7 - SDRATTR_START ] = new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_7, basegfx::B3DVector(0.0,0.0,1.0)); - rPoolDefaults[ SDRATTR_3DSCENE_LIGHTDIRECTION_8 - SDRATTR_START ] = new SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_8, basegfx::B3DVector(0.0,0.0,1.0)); - rPoolDefaults[ SDRATTR_3DSCENE_SHADOW_SLANT - SDRATTR_START ] = new SfxUInt16Item(SDRATTR_3DSCENE_SHADOW_SLANT, 0); - rPoolDefaults[ SDRATTR_3DSCENE_SHADE_MODE - SDRATTR_START ] = new Svx3DShadeModeItem; - rPoolDefaults[ SDRATTR_CUSTOMSHAPE_ENGINE - SDRATTR_START ] = new SfxStringItem(SDRATTR_CUSTOMSHAPE_ENGINE, ""); - rPoolDefaults[ SDRATTR_CUSTOMSHAPE_DATA - SDRATTR_START ] = new SfxStringItem(SDRATTR_CUSTOMSHAPE_DATA, ""); - rPoolDefaults[ SDRATTR_CUSTOMSHAPE_GEOMETRY - SDRATTR_START ] = new SdrCustomShapeGeometryItem; - - SvxBoxItem* pboxItem = new SvxBoxItem( SDRATTR_TABLE_BORDER ); - pboxItem->SetAllDistances( 100 ); - rPoolDefaults[ SDRATTR_TABLE_BORDER - SDRATTR_START ] = pboxItem; - - SvxBoxInfoItem* pBoxInfoItem = new SvxBoxInfoItem( SDRATTR_TABLE_BORDER_INNER ); - - pBoxInfoItem->SetTable( true ); - pBoxInfoItem->SetDist( true); // always show margin field - pBoxInfoItem->SetValid( SvxBoxInfoItemValidFlags::DISABLE ); // some lines may have DontCare state only in tables - - rPoolDefaults[ SDRATTR_TABLE_BORDER_INNER - SDRATTR_START ] = pBoxInfoItem; - rPoolDefaults[ SDRATTR_TABLE_BORDER_TLBR - SDRATTR_START ] = new SvxLineItem( SDRATTR_TABLE_BORDER_TLBR ); - rPoolDefaults[ SDRATTR_TABLE_BORDER_BLTR - SDRATTR_START ] = new SvxLineItem( SDRATTR_TABLE_BORDER_BLTR ); - rPoolDefaults[ SDRATTR_TABLE_TEXT_ROTATION - SDRATTR_START ] = new SvxTextRotateItem(0_deg10, SDRATTR_TABLE_TEXT_ROTATION); - rPoolDefaults[ SDRATTR_TABLE_CELL_GRABBAG - SDRATTR_START ] = new SfxGrabBagItem(SDRATTR_TABLE_CELL_GRABBAG); - - rPoolDefaults[ SDRATTR_GLOW_RADIUS - SDRATTR_START ] = new SdrMetricItem(SDRATTR_GLOW_RADIUS, 0); - rPoolDefaults[ SDRATTR_GLOW_COLOR - SDRATTR_START ] = new XColorItem(SDRATTR_GLOW_COLOR, aNullCol); - rPoolDefaults[ SDRATTR_GLOW_TRANSPARENCY - SDRATTR_START ] = new SdrPercentItem(SDRATTR_GLOW_TRANSPARENCY, 0); - - rPoolDefaults[SDRATTR_SOFTEDGE_RADIUS - SDRATTR_START] = new SdrMetricItem(SDRATTR_SOFTEDGE_RADIUS, 0); - - rPoolDefaults[SDRATTR_TEXTCOLUMNS_NUMBER - SDRATTR_START] = new SfxInt16Item(SDRATTR_TEXTCOLUMNS_NUMBER, 1); - rPoolDefaults[SDRATTR_TEXTCOLUMNS_SPACING - SDRATTR_START] = new SdrMetricItem(SDRATTR_TEXTCOLUMNS_SPACING, 0); - - rPoolDefaults[SDRATTR_WRITINGMODE2 - SDRATTR_START] = new SvxFrameDirectionItem(SvxFrameDirection::Horizontal_LR_TB, SDRATTR_WRITINGMODE2); - - // set own ItemInfos - mpLocalItemInfos[SDRATTR_SHADOW-SDRATTR_START]._nItemInfoSlotID=SID_ATTR_FILL_SHADOW; - mpLocalItemInfos[SDRATTR_SHADOWCOLOR-SDRATTR_START]._nItemInfoSlotID=SID_ATTR_SHADOW_COLOR; - mpLocalItemInfos[SDRATTR_SHADOWTRANSPARENCE-SDRATTR_START]._nItemInfoSlotID=SID_ATTR_SHADOW_TRANSPARENCE; - mpLocalItemInfos[SDRATTR_SHADOWBLUR-SDRATTR_START]._nItemInfoSlotID=SID_ATTR_SHADOW_BLUR; - mpLocalItemInfos[SDRATTR_SHADOWXDIST-SDRATTR_START]._nItemInfoSlotID=SID_ATTR_SHADOW_XDISTANCE; - mpLocalItemInfos[SDRATTR_SHADOWYDIST-SDRATTR_START]._nItemInfoSlotID=SID_ATTR_SHADOW_YDISTANCE; - mpLocalItemInfos[SDRATTR_TEXT_FITTOSIZE-SDRATTR_START]._nItemInfoSlotID=SID_ATTR_TEXT_FITTOSIZE; - mpLocalItemInfos[SDRATTR_GRAFCROP-SDRATTR_START]._nItemInfoSlotID=SID_ATTR_GRAF_CROP; - mpLocalItemInfos[SDRATTR_TABLE_BORDER - SDRATTR_START ]._nItemInfoSlotID = SID_ATTR_BORDER_OUTER; - mpLocalItemInfos[SDRATTR_TABLE_BORDER_INNER - SDRATTR_START ]._nItemInfoSlotID = SID_ATTR_BORDER_INNER; - mpLocalItemInfos[SDRATTR_TABLE_BORDER_TLBR - SDRATTR_START ]._nItemInfoSlotID = SID_ATTR_BORDER_DIAG_TLBR; - mpLocalItemInfos[SDRATTR_TABLE_BORDER_BLTR - SDRATTR_START ]._nItemInfoSlotID = SID_ATTR_BORDER_DIAG_BLTR; - mpLocalItemInfos[SDRATTR_GLOW_RADIUS - SDRATTR_START]._nItemInfoSlotID = SID_ATTR_GLOW_RADIUS; - mpLocalItemInfos[SDRATTR_GLOW_COLOR - SDRATTR_START]._nItemInfoSlotID = SID_ATTR_GLOW_COLOR; - mpLocalItemInfos[SDRATTR_GLOW_TRANSPARENCY - SDRATTR_START]._nItemInfoSlotID = SID_ATTR_GLOW_TRANSPARENCY; - mpLocalItemInfos[SDRATTR_SOFTEDGE_RADIUS - SDRATTR_START]._nItemInfoSlotID = SID_ATTR_SOFTEDGE_RADIUS; - mpLocalItemInfos[SDRATTR_TEXTCOLUMNS_NUMBER - SDRATTR_START]._nItemInfoSlotID = 0 /*TODO*/; - mpLocalItemInfos[SDRATTR_TEXTCOLUMNS_SPACING - SDRATTR_START]._nItemInfoSlotID = 0 /*TODO*/; - mpLocalItemInfos[SDRATTR_WRITINGMODE2 - SDRATTR_START]._nItemInfoSlotID = 0 /*TODO*/; - - // it's my own creation level, set Defaults and ItemInfos - SetPoolDefaults(mpLocalPoolDefaults); - SetItemInfos(mpLocalItemInfos.get()); -} - -// copy ctor, so that static defaults are cloned -// (Parameter 2 = sal_True) SdrItemPool::SdrItemPool(const SdrItemPool& rPool) -: XOutdevItemPool(rPool) +: SfxItemPool(rPool) { } @@ -394,6 +508,7 @@ SdrItemPool::~SdrItemPool() { // split pools before destroying SetSecondaryPool(nullptr); + sendShutdownHint(); } bool SdrItemPool::GetPresentation( @@ -412,7 +527,8 @@ bool SdrItemPool::GetPresentation( return true; } } - return XOutdevItemPool::GetPresentation(rItem,ePresentationMetric,rText,rIntlWrapper); + + return SfxItemPool::GetPresentation(rItem,ePresentationMetric,rText,rIntlWrapper); } OUString SdrItemPool::GetItemName(sal_uInt16 nWhich) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 10dba8f0ebc7..f169ba06056f 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -542,7 +542,6 @@ SdrItemPool& SdrObject::GetGlobalDrawObjectItemPool() rtl::Reference<SfxItemPool> pGlobalOutlPool = EditEngine::CreatePool(); mpGlobalItemPool->SetSecondaryPool(pGlobalOutlPool.get()); mpGlobalItemPool->SetDefaultMetric(SdrEngineDefaults::GetMapUnit()); - mpGlobalItemPool->FreezeIdRanges(); if (comphelper::IsFuzzing()) mpGlobalItemPool->acquire(); else diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 8b995ce9d473..5a7a24f32d6a 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -161,7 +161,6 @@ void FontWorkGalleryDialog::insertSelectedFontwork() return; FmFormModel aModel; - aModel.GetItemPool().FreezeIdRanges(); if( !GalleryExplorer::GetSdrObj( mnThemeId, nItemId-1, &aModel ) ) return; diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index db26250def81..8c81935b17f7 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -340,8 +340,6 @@ static void GetGeometryForCustomShape( SdrCustomShapeGeometryItem& rGeometryItem if ( aObjList[ i ].equalsIgnoreAsciiCase( rCustomShape ) ) { FmFormModel aFormModel; - SfxItemPool& rPool(aFormModel.GetItemPool()); - rPool.FreezeIdRanges(); if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) ) { diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx index 3be3c0418ea7..82b362f991eb 100644 --- a/svx/source/unodraw/unopool.cxx +++ b/svx/source/unodraw/unopool.cxx @@ -57,7 +57,6 @@ void SvxUnoDrawPool::init() SdrModel::SetTextDefaults( mpDefaultsPool.get(), SdrEngineDefaults::GetFontHeight() ); mpDefaultsPool->SetDefaultMetric(SdrEngineDefaults::GetMapUnit()); - mpDefaultsPool->FreezeIdRanges(); } SfxItemPool* SvxUnoDrawPool::getModelPool( bool bReadOnly ) noexcept diff --git a/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx index d6efdf2822d8..6e9f072585e7 100644 --- a/svx/source/unogallery/unogalitem.cxx +++ b/svx/source/unogallery/unogalitem.cxx @@ -310,8 +310,6 @@ void GalleryItem::_getPropertyValues( const comphelper::PropertyMapEntry** ppEnt ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : nullptr ); FmFormModel* pModel = new FmFormModel(); - pModel->GetItemPool().FreezeIdRanges(); - if( pGalTheme && pGalTheme->GetModel( pGalTheme->maGalleryObjectCollection.searchPosWithObject( implGetObject() ), *pModel ) ) { rtl::Reference< GalleryDrawingModel > xDrawing( new GalleryDrawingModel( pModel ) ); diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx deleted file mode 100644 index 9419a5c43456..000000000000 --- a/svx/source/xoutdev/xpool.cxx +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <sal/config.h> - -#include <svx/xflbckit.hxx> -#include <xftshtit.hxx> -#include <svx/xflboxy.hxx> -#include <svx/xflbstit.hxx> -#include <svx/xflclit.hxx> -#include <svx/xflgrit.hxx> -#include <svx/xflhtit.hxx> -#include <svx/xbtmpit.hxx> -#include <svx/xflftrit.hxx> -#include <svx/xsflclit.hxx> -#include <svx/xlntrit.hxx> -#include <svx/xfltrit.hxx> -#include <svx/xgrscit.hxx> -#include <svx/xflasit.hxx> -#include <svx/xflbmtit.hxx> -#include <svx/xflbmpit.hxx> -#include <svx/xflbmsxy.hxx> -#include <svx/xflbmsli.hxx> -#include <svx/xflbtoxy.hxx> -#include <svx/xlineit0.hxx> -#include <svx/xlinjoit.hxx> -#include <svx/xlncapit.hxx> -#include <svx/xfillit0.hxx> -#include <svx/xfilluseslidebackgrounditem.hxx> -#include <svx/xtextit0.hxx> -#include <svx/xlnasit.hxx> -#include <svx/xlndsit.hxx> -#include <svx/xlnwtit.hxx> -#include <svx/xlnclit.hxx> -#include <svx/xlnstit.hxx> -#include <svx/xlnedit.hxx> -#include <svx/xlnstwit.hxx> -#include <svx/xlnedwit.hxx> -#include <svx/xlnstcit.hxx> -#include <svx/xlnedcit.hxx> -#include <svx/xpool.hxx> -#include <svx/svddef.hxx> -#include <svx/svxids.hrc> -#include <svl/itemset.hxx> -#include <svx/xftadit.hxx> -#include <svx/xftdiit.hxx> -#include <svx/xftstit.hxx> -#include <svx/xftmrit.hxx> -#include <svx/xftouit.hxx> -#include <svx/xftshit.hxx> -#include <svx/xftshcit.hxx> -#include <svx/xftshxy.hxx> - -XOutdevItemPool::XOutdevItemPool(SfxItemPool* _pMaster) - : SfxItemPool("XOutdevItemPool", SDRATTR_START, SDRATTR_END, nullptr, nullptr) - , mpLocalPoolDefaults(new std::vector<SfxPoolItem*>(SDRATTR_END - SDRATTR_START + 1)) - , mpLocalItemInfos(new SfxItemInfo[SDRATTR_END - SDRATTR_START + 1]) -{ - // prepare some defaults - const OUString aNullStr; - const basegfx::B2DPolyPolygon aNullPol; - const Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color - const Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #i121448# Use defined default color - const Color aNullShadowCol(COL_LIGHTGRAY); - const XDash aNullDash; - const XHatch aNullHatch(aNullLineCol); - - // get master pointer, evtl. add myself to the end of the pools - if(!_pMaster) - { - _pMaster = this; - } - else - { - _pMaster->GetLastPoolInChain()->SetSecondaryPool(this); - } - - // prepare PoolDefaults - std::vector<SfxPoolItem*>& rPoolDefaults = *mpLocalPoolDefaults; - rPoolDefaults[XATTR_LINESTYLE -XATTR_START] = new XLineStyleItem; - rPoolDefaults[XATTR_LINEDASH -XATTR_START] = new XLineDashItem(aNullDash); - rPoolDefaults[XATTR_LINEWIDTH -XATTR_START] = new XLineWidthItem; - rPoolDefaults[XATTR_LINECOLOR -XATTR_START] = new XLineColorItem(aNullStr,aNullLineCol); - rPoolDefaults[XATTR_LINESTART -XATTR_START] = new XLineStartItem(aNullPol); - rPoolDefaults[XATTR_LINEEND -XATTR_START] = new XLineEndItem (aNullPol); - rPoolDefaults[XATTR_LINESTARTWIDTH -XATTR_START] = new XLineStartWidthItem; - rPoolDefaults[XATTR_LINEENDWIDTH -XATTR_START] = new XLineEndWidthItem; - rPoolDefaults[XATTR_LINESTARTCENTER -XATTR_START] = new XLineStartCenterItem; - rPoolDefaults[XATTR_LINEENDCENTER -XATTR_START] = new XLineEndCenterItem; - rPoolDefaults[XATTR_LINETRANSPARENCE -XATTR_START] = new XLineTransparenceItem; - rPoolDefaults[XATTR_LINEJOINT -XATTR_START] = new XLineJointItem; - rPoolDefaults[XATTR_LINECAP -XATTR_START] = new XLineCapItem; - rPoolDefaults[XATTR_FILLSTYLE -XATTR_START] = new XFillStyleItem; - rPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol); - - // basegfx::BGradient() default already creates [COL_BLACK, COL_WHITE] as defaults - rPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(basegfx::BGradient()); - - rPoolDefaults[XATTR_FILLHATCH -XATTR_START] = new XFillHatchItem (aNullHatch); - rPoolDefaults[XATTR_FILLBITMAP -XATTR_START] = new XFillBitmapItem (Graphic()); - rPoolDefaults[XATTR_FILLTRANSPARENCE -XATTR_START] = new XFillTransparenceItem; - rPoolDefaults[XATTR_GRADIENTSTEPCOUNT -XATTR_START] = new XGradientStepCountItem; - rPoolDefaults[XATTR_FILLBMP_TILE -XATTR_START] = new XFillBmpTileItem; - rPoolDefaults[XATTR_FILLBMP_POS -XATTR_START] = new XFillBmpPosItem; - rPoolDefaults[XATTR_FILLBMP_SIZEX -XATTR_START] = new XFillBmpSizeXItem; - rPoolDefaults[XATTR_FILLBMP_SIZEY -XATTR_START] = new XFillBmpSizeYItem; - rPoolDefaults[XATTR_FILLBMP_SIZELOG -XATTR_START] = new XFillBmpSizeLogItem; - rPoolDefaults[XATTR_FILLBMP_TILEOFFSETX -XATTR_START] = new XFillBmpTileOffsetXItem; - rPoolDefaults[XATTR_FILLBMP_TILEOFFSETY -XATTR_START] = new XFillBmpTileOffsetYItem; - rPoolDefaults[XATTR_FILLBMP_STRETCH -XATTR_START] = new XFillBmpStretchItem; - rPoolDefaults[XATTR_FILLBMP_POSOFFSETX -XATTR_START] = new XFillBmpPosOffsetXItem; - rPoolDefaults[XATTR_FILLBMP_POSOFFSETY -XATTR_START] = new XFillBmpPosOffsetYItem; - - rPoolDefaults[XATTR_FILLFLOATTRANSPARENCE -XATTR_START] = new XFillFloatTransparenceItem( - basegfx::BGradient( - basegfx::BColorStops( - COL_BLACK.getBColor(), - COL_BLACK.getBColor())), - false); - - rPoolDefaults[XATTR_SECONDARYFILLCOLOR -XATTR_START] = new XSecondaryFillColorItem(aNullStr, aNullFillCol); - rPoolDefaults[XATTR_FILLBACKGROUND -XATTR_START] = new XFillBackgroundItem; - rPoolDefaults[XATTR_FILLUSESLIDEBACKGROUND -XATTR_START] = new XFillUseSlideBackgroundItem; - rPoolDefaults[XATTR_FORMTXTSTYLE -XATTR_START] = new XFormTextStyleItem; - rPoolDefaults[XATTR_FORMTXTADJUST -XATTR_START] = new XFormTextAdjustItem; - rPoolDefaults[XATTR_FORMTXTDISTANCE -XATTR_START] = new XFormTextDistanceItem; - rPoolDefaults[XATTR_FORMTXTSTART -XATTR_START] = new XFormTextStartItem; - rPoolDefaults[XATTR_FORMTXTMIRROR -XATTR_START] = new XFormTextMirrorItem; - rPoolDefaults[XATTR_FORMTXTOUTLINE -XATTR_START] = new XFormTextOutlineItem; - rPoolDefaults[XATTR_FORMTXTSHADOW -XATTR_START] = new XFormTextShadowItem; - rPoolDefaults[XATTR_FORMTXTSHDWCOLOR -XATTR_START] = new XFormTextShadowColorItem(aNullStr,aNullShadowCol); - rPoolDefaults[XATTR_FORMTXTSHDWXVAL -XATTR_START] = new XFormTextShadowXValItem; - rPoolDefaults[XATTR_FORMTXTSHDWYVAL -XATTR_START] = new XFormTextShadowYValItem; - rPoolDefaults[XATTR_FORMTXTHIDEFORM -XATTR_START] = new XFormTextHideFormItem; - rPoolDefaults[XATTR_FORMTXTSHDWTRANSP -XATTR_START] = new XFormTextShadowTranspItem; - - // create SetItems - rPoolDefaults[XATTRSET_LINE - XATTR_START] = new XLineAttrSetItem( - SfxItemSetFixed<XATTR_LINE_FIRST, XATTR_LINE_LAST>( *_pMaster ) ); - rPoolDefaults[XATTRSET_FILL - XATTR_START] = new XFillAttrSetItem( - SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST>( *_pMaster ) ); - - // create ItemInfos - for(sal_uInt16 i(GetFirstWhich()); i <= GetLastWhich(); i++) - { - // _nItemInfoSlotID, _nItemInfoFlags - mpLocalItemInfos[i - XATTR_START]._nItemInfoSlotID = 0; - mpLocalItemInfos[i - XATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_NONE; - } - - // these slots need SFX_ITEMINFOFLAG_SUPPORT_SURROGATE, see - // text @svl/source/items/itempool.cxx - mpLocalItemInfos[XATTR_FILLBITMAP -XATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_SUPPORT_SURROGATE; - mpLocalItemInfos[XATTR_FILLGRADIENT -XATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_SUPPORT_SURROGATE; - mpLocalItemInfos[XATTR_FILLHATCH -XATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_SUPPORT_SURROGATE; - mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_SUPPORT_SURROGATE; - mpLocalItemInfos[XATTR_LINEEND -XATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_SUPPORT_SURROGATE; - mpLocalItemInfos[XATTR_LINESTART -XATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_SUPPORT_SURROGATE; - mpLocalItemInfos[XATTR_LINEDASH -XATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_SUPPORT_SURROGATE; - mpLocalItemInfos[XATTR_FILLCOLOR -XATTR_START]._nItemInfoFlags = SFX_ITEMINFOFLAG_SUPPORT_SURROGATE; - - // set the SlotIDs, this is a mapping used by GetWhich()/GetSlotId() - mpLocalItemInfos[XATTR_LINESTYLE -XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_STYLE; - mpLocalItemInfos[XATTR_LINEDASH -XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_DASH; - mpLocalItemInfos[XATTR_LINEWIDTH -XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_WIDTH; - mpLocalItemInfos[XATTR_LINECOLOR -XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_COLOR; - mpLocalItemInfos[XATTR_LINESTART -XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_START; - mpLocalItemInfos[XATTR_LINEEND -XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_END; - mpLocalItemInfos[XATTR_LINESTARTWIDTH -XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_STARTWIDTH; - mpLocalItemInfos[XATTR_LINEENDWIDTH -XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_ENDWIDTH; - mpLocalItemInfos[XATTR_LINESTARTCENTER -XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_STARTCENTER; - mpLocalItemInfos[XATTR_LINEENDCENTER -XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_ENDCENTER; - mpLocalItemInfos[XATTR_FILLSTYLE -XATTR_START]._nItemInfoSlotID = SID_ATTR_FILL_STYLE; - mpLocalItemInfos[XATTR_FILLCOLOR -XATTR_START]._nItemInfoSlotID = SID_ATTR_FILL_COLOR; - mpLocalItemInfos[XATTR_FILLGRADIENT -XATTR_START]._nItemInfoSlotID = SID_ATTR_FILL_GRADIENT; - mpLocalItemInfos[XATTR_FILLHATCH -XATTR_START]._nItemInfoSlotID = SID_ATTR_FILL_HATCH; - mpLocalItemInfos[XATTR_FILLBITMAP -XATTR_START]._nItemInfoSlotID = SID_ATTR_FILL_BITMAP; - mpLocalItemInfos[XATTR_FORMTXTSTYLE -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_STYLE; - mpLocalItemInfos[XATTR_FORMTXTADJUST -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_ADJUST; - mpLocalItemInfos[XATTR_FORMTXTDISTANCE -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_DISTANCE; - mpLocalItemInfos[XATTR_FORMTXTSTART -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_START; - mpLocalItemInfos[XATTR_FORMTXTMIRROR -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_MIRROR; - mpLocalItemInfos[XATTR_FORMTXTOUTLINE -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_OUTLINE; - mpLocalItemInfos[XATTR_FORMTXTSHADOW -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_SHADOW; - mpLocalItemInfos[XATTR_FORMTXTSHDWCOLOR -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_SHDWCOLOR; - mpLocalItemInfos[XATTR_FORMTXTSHDWXVAL -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_SHDWXVAL; - mpLocalItemInfos[XATTR_FORMTXTSHDWYVAL -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_SHDWYVAL; - mpLocalItemInfos[XATTR_FORMTXTHIDEFORM -XATTR_START]._nItemInfoSlotID = SID_FORMTEXT_HIDEFORM; - - // associate new slots for panels with known items - mpLocalItemInfos[XATTR_FILLUSESLIDEBACKGROUND - XATTR_START]._nItemInfoSlotID = SID_ATTR_FILL_USE_SLIDE_BACKGROUND; - mpLocalItemInfos[XATTR_FILLTRANSPARENCE - XATTR_START]._nItemInfoSlotID = SID_ATTR_FILL_TRANSPARENCE; - mpLocalItemInfos[XATTR_FILLFLOATTRANSPARENCE - XATTR_START]._nItemInfoSlotID = SID_ATTR_FILL_FLOATTRANSPARENCE; - mpLocalItemInfos[XATTR_LINETRANSPARENCE - XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_TRANSPARENCE; - mpLocalItemInfos[XATTR_LINEJOINT - XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_JOINT; - mpLocalItemInfos[XATTR_LINECAP - XATTR_START]._nItemInfoSlotID = SID_ATTR_LINE_CAP; - - // if it's my own creation level, set Defaults and ItemInfos - if(XATTR_START == GetFirstWhich() && XATTR_END == GetLastWhich()) - { - SetPoolDefaults(mpLocalPoolDefaults); - SetItemInfos(mpLocalItemInfos.get()); - } -} - -// copy ctor, clones all static defaults -XOutdevItemPool::XOutdevItemPool(const XOutdevItemPool& rPool) -: SfxItemPool(rPool, true), - mpLocalPoolDefaults(nullptr) -{ -} - -rtl::Reference<SfxItemPool> XOutdevItemPool::Clone() const -{ - return new XOutdevItemPool(*this); -} - -XOutdevItemPool::~XOutdevItemPool() -{ - Delete(); - // release and delete static pool default items - ReleasePoolDefaults(true); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index ff9f06e5dc66..c9f7d756c0b9 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -102,6 +102,8 @@ class SW_DLLPUBLIC SwFormatField final , public sw::BroadcastingModify , public SfxBroadcaster { + friend SwFormatField* createSwFormatFieldForItemInfoPackage(sal_uInt16); + // friend class ItemInfoPackageSwAttributes; friend void InitCore(); SwFormatField( sal_uInt16 nWhich ); // for default-Attribute diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 011a35edd4db..7f661ab5209b 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -522,9 +522,6 @@ class SfxPoolItem; struct SfxItemInfo; typedef std::vector<SfxPoolItem*> SwDfltAttrTab; -extern SwDfltAttrTab aAttrTab; -extern SfxItemInfo aSlotTab[]; - /** Get the default attribute from corresponding default attribute table. @param[in] nWhich Position in table diff --git a/sw/inc/init.hxx b/sw/inc/init.hxx index b357864109cd..438be221de6c 100644 --- a/sw/inc/init.hxx +++ b/sw/inc/init.hxx @@ -28,9 +28,11 @@ class SvGlobalName; class SwViewShell; +class ItemInfoPackage; void InitCore(); // bastyp/init.cxx void FinitCore(); +ItemInfoPackage& getItemInfoPackageSwAttributes(); namespace sw { diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx index c3cc0ae85a44..74b26b9515d7 100644 --- a/sw/inc/tox.hxx +++ b/sw/inc/tox.hxx @@ -84,6 +84,8 @@ class SW_DLLPUBLIC SwTOXMark final { friend void InitCore(); friend class SwTextTOXMark; + friend SwTOXMark* createSwTOXMarkForItemInfoPackage(); + // friend class ItemInfoPackageSwAttributes; const SwTOXType* m_pType; OUString m_aAltText; // Text of caption is different. diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx index 641d7380312f..0190d415daff 100644 --- a/sw/source/core/attr/hints.cxx +++ b/sw/source/core/attr/hints.cxx @@ -22,6 +22,7 @@ #include <hints.hxx> #include <ndtxt.hxx> #include <swtypes.hxx> +#include <init.hxx> #include <svl/languageoptions.hxx> #include <utility> #include <vcl/outdev.hxx> @@ -155,21 +156,17 @@ SwMsgPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const return nullptr; } -#if OSL_DEBUG_LEVEL > 0 -const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich ) +const SfxPoolItem* GetDfltAttr(sal_uInt16 nWhich) { - OSL_ASSERT( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN ); - - SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ]; - OSL_ENSURE( pHt, "GetDfltFormatAttr(): Dflt == 0" ); - return pHt; -} +#ifdef DBG_UTIL + OSL_ASSERT(nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN); + const SfxPoolItem* pRetval(getItemInfoPackageSwAttributes().getExistingItemInfo(nWhich - POOLATTR_BEGIN).getItem()); + OSL_ENSURE(pRetval, "GetDfltFormatAttr(): Dflt == 0"); + return pRetval; #else -const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich ) -{ - return aAttrTab[ nWhich - POOLATTR_BEGIN ]; -} + return getItemInfoPackageSwAttributes().getExistingItemInfo(nWhich - POOLATTR_BEGIN).getItem(); #endif +} SwFindNearestNode::SwFindNearestNode( const SwNode& rNd ) : SwMsgPoolItem( RES_FINDNEARESTNODE ), m_pNode( &rNd ), m_pFound( nullptr ) diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx index 17adbeeb6901..725b4dd304cc 100644 --- a/sw/source/core/attr/swatrset.cxx +++ b/sw/source/core/attr/swatrset.cxx @@ -34,6 +34,7 @@ #include <numrule.hxx> #include <pagedesc.hxx> #include <paratr.hxx> +#include <init.hxx> #include <o3tl/unit_conversion.hxx> #include <osl/diagnose.h> #include <svl/whiter.hxx> @@ -42,12 +43,14 @@ #include <svx/sxenditm.hxx> #include <svx/sdsxyitm.hxx> -SwAttrPool::SwAttrPool( SwDoc* pD ) - : SfxItemPool( "SWG", - POOLATTR_BEGIN, POOLATTR_END-1, - aSlotTab, &aAttrTab ), - m_pDoc( pD ) + + +SwAttrPool::SwAttrPool(SwDoc* pD) +: SfxItemPool("SWG") +, m_pDoc(pD) { + registerItemInfoPackage(getItemInfoPackageSwAttributes()); + // create SfxItemPool and EditEngine pool and add these in a chain. These // belong us and will be removed/destroyed in removeAndDeleteSecondaryPools() used from // the destructor @@ -72,23 +75,15 @@ SwAttrPool::SwAttrPool( SwDoc* pD ) rtl::Reference<SfxItemPool> pEEgPool = EditEngine::CreatePool(); pSdrPool->SetSecondaryPool(pEEgPool.get()); - - if(GetFrozenIdRanges().empty()) - { - FreezeIdRanges(); - } - else - { - pSdrPool->FreezeIdRanges(); - } } SwAttrPool::~SwAttrPool() { // cleanup secondary pools - SfxItemPool *pSdrPool = GetSecondaryPool(); + SfxItemPool* pSdrPool(GetSecondaryPool()); + // first delete the items, then break the linking - pSdrPool->Delete(); + pSdrPool->sendShutdownHint(); SetSecondaryPool(nullptr); } diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 20ca5c6ca4f6..7827281b9fee 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -260,187 +260,244 @@ WhichRangesContainer const aPgFrameFormatSetRange(svl::Items< RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1 >); -// create table for accessing default format attributes -SwDfltAttrTab aAttrTab( POOLATTR_END - POOLATTR_BEGIN, nullptr ); +SwFormatField* createSwFormatFieldForItemInfoPackage(sal_uInt16 nWhich) +{ + return new SwFormatField(nWhich); +} -SfxItemInfo aSlotTab[] = +SwTOXMark* createSwTOXMarkForItemInfoPackage() { - // _nItemInfoSlotID, _nItemInfoFlags - { SID_ATTR_CHAR_CASEMAP, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CASEMAP - { SID_ATTR_CHAR_CHARSETCOLOR, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CHARSETCOLOR - { SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_CHRATR_COLOR - { SID_ATTR_CHAR_CONTOUR, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CONTOUR - { SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CROSSEDOUT - { SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_ESCAPEMENT - { SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_CHRATR_FONT - { SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_FONTSIZE - { SID_ATTR_CHAR_KERNING, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_KERNING - { SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_LANGUAGE - { SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_POSTURE - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_UNUSED1 - { SID_ATTR_CHAR_SHADOWED, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_SHADOWED - { SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_CHRATR_UNDERLINE - { SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_WEIGHT - { SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_WORDLINEMODE - { SID_ATTR_CHAR_AUTOKERN, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_AUTOKERN - { SID_ATTR_FLASH, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_BLINK - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_UNUSED2 - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_NOHYPHEN - { SID_ATTR_BRUSH_CHAR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_CHRATR_BACKGROUND - { SID_ATTR_CHAR_CJK_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_CHRATR_CJK_FONT - { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CJK_FONTSIZE - { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CJK_LANGUAGE - { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CJK_POSTURE - { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CJK_WEIGHT - { SID_ATTR_CHAR_CTL_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_CHRATR_CTL_FONT - { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CTL_FONTSIZE - { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CTL_LANGUAGE - { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CTL_POSTURE - { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_CTL_WEIGHT - { SID_ATTR_CHAR_ROTATED, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_ROTATE - { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_EMPHASIS_MARK - { SID_ATTR_CHAR_TWO_LINES, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_TWO_LINES - { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_SCALEW - { SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_RELIEF - { SID_ATTR_CHAR_HIDDEN, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_HIDDEN - { SID_ATTR_CHAR_OVERLINE, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_CHRATR_OVERLINE - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_RSID - { SID_ATTR_CHAR_BOX, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_CHRATR_BOX - { SID_ATTR_CHAR_SHADOW, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_SHADOW - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_CHRATR_HIGHLIGHT - { SID_ATTR_CHAR_GRABBAG, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_GRABBAG - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_BIDIRTL - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_CHRATR_IDCTHINT - - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_TXTATR_REFMARK - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_TXTATR_TOXMARK - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TXTATR_META - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TXTATR_METAFIELD - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TXTATR_AUTOFMT - { FN_TXTATR_INET, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_TXTATR_INETFMT - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TXTATR_CHARFMT - { SID_ATTR_CHAR_CJK_RUBY, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_TXTATR_CJK_RUBY - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_TXTATR_UNKNOWN_CONTAINER - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_TXTATR_INPUTFIELD - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TXTATR_CONTENTCONTROL - - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_TXTATR_FIELD - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TXTATR_FLYCNT - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TXTATR_FTN - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TXTATR_ANNOTATION - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TXTATR_LINEBREAK - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TXTATR_DUMMY1 - - { SID_ATTR_PARA_LINESPACE, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_LINESPACING - { SID_ATTR_PARA_ADJUST, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_ADJUST - { SID_ATTR_PARA_SPLIT, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_SPLIT - { SID_ATTR_PARA_ORPHANS, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_ORPHANS - { SID_ATTR_PARA_WIDOWS, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_WIDOWS - { SID_ATTR_TABSTOP, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_PARATR_TABSTOP - { SID_ATTR_PARA_HYPHENZONE, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_HYPHENZONE - { FN_FORMAT_DROPCAPS, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_DROP - { SID_ATTR_PARA_REGISTER, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_REGISTER - { SID_ATTR_PARA_NUMRULE, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_NUMRULE - { SID_ATTR_PARA_SCRIPTSPACE, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_SCRIPTSPACE - { SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_HANGINGPUNCTUATION - - { SID_ATTR_PARA_FORBIDDEN_RULES, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_FORBIDDEN_RULES - { SID_PARA_VERTALIGN, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_VERTALIGN - { SID_ATTR_PARA_SNAPTOGRID, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_SNAPTOGRID - { SID_ATTR_BORDER_CONNECT, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_CONNECT_BORDER - - { SID_ATTR_PARA_OUTLINE_LEVEL, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_OUTLINELEVEL //#outline level - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_RSID - { SID_ATTR_PARA_GRABBAG, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_GRABBAG - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_LIST_ID - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_LIST_LEVEL - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_LIST_ISRESTART - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_LIST_RESTARTVALUE - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_LIST_ISCOUNTED - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_PARATR_LIST_AUTOFMT - - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_FILL_ORDER - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_FRM_SIZE - { SID_ATTR_PAGE_PAPERBIN, SFX_ITEMINFOFLAG_NONE }, // RES_PAPER_BIN - { SID_ATTR_PARA_FIRSTLINESPACE, SFX_ITEMINFOFLAG_NONE }, // RES_MARGIN_FIRSTLINE - { SID_ATTR_PARA_LEFTSPACE, SFX_ITEMINFOFLAG_NONE }, // RES_MARGIN_TEXTLEFT - { SID_ATTR_PARA_RIGHTSPACE, SFX_ITEMINFOFLAG_NONE }, // RES_MARGIN_RIGHT - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_MARGIN_LEFT - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_MARGIN_GUTTER - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_MARGIN_GUTTER_RIGHT - { SID_ATTR_LRSPACE, SFX_ITEMINFOFLAG_NONE }, // RES_LR_SPACE - { SID_ATTR_ULSPACE, SFX_ITEMINFOFLAG_NONE }, // RES_UL_SPACE - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_PAGEDESC - { SID_ATTR_PARA_PAGEBREAK, SFX_ITEMINFOFLAG_NONE }, // RES_BREAK - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_CNTNT - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_HEADER - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_FOOTER - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_PRINT - { FN_OPAQUE, SFX_ITEMINFOFLAG_NONE }, // RES_OPAQUE - { FN_SET_PROTECT, SFX_ITEMINFOFLAG_NONE }, // RES_PROTECT - { FN_SURROUND, SFX_ITEMINFOFLAG_NONE }, // RES_SURROUND - { FN_VERT_ORIENT, SFX_ITEMINFOFLAG_NONE }, // RES_VERT_ORIENT - { FN_HORI_ORIENT, SFX_ITEMINFOFLAG_NONE }, // RES_HORI_ORIENT - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_ANCHOR - { SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_BACKGROUND - { SID_ATTR_BORDER_OUTER, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_BOX - { SID_ATTR_BORDER_SHADOW, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_SHADOW - { SID_ATTR_MACROITEM, SFX_ITEMINFOFLAG_NONE }, // RES_FRMMACRO - { FN_ATTR_COLUMNS, SFX_ITEMINFOFLAG_NONE }, // RES_COL - { SID_ATTR_PARA_KEEP, SFX_ITEMINFOFLAG_NONE }, // RES_KEEP - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_URL - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_EDIT_IN_READONLY - - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_LAYOUT_SPLIT - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_CHAIN - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TEXTGRID - { FN_FORMAT_LINENUMBER, SFX_ITEMINFOFLAG_NONE }, // RES_LINENUMBER - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_FTN_AT_TXTEND - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_END_AT_TXTEND - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_COLUMNBALANCE - - { SID_ATTR_FRAMEDIRECTION, SFX_ITEMINFOFLAG_NONE }, // RES_FRAMEDIR - - { SID_ATTR_HDFT_DYNAMIC_SPACING, SFX_ITEMINFOFLAG_NONE }, // RES_HEADER_FOOTER_EAT_SPACING - { FN_TABLE_ROW_SPLIT, SFX_ITEMINFOFLAG_NONE }, // RES_ROW_SPLIT - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_FLY_SPLIT - // #i18732# - use slot-id define in svx - { SID_SW_FOLLOW_TEXT_FLOW, SFX_ITEMINFOFLAG_NONE }, // RES_FOLLOW_TEXT_FLOW - // #i29550# - { SID_SW_COLLAPSING_BORDERS, SFX_ITEMINFOFLAG_NONE }, // RES_COLLAPSING_BORDERS - // #i28701# - { SID_SW_WRAP_INFLUENCE_ON_OBJPOS, SFX_ITEMINFOFLAG_NONE }, // RES_WRAP_INFLUENCE_ON_OBJPOS - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_AUTO_STYLE - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_FRMATR_STYLE_NAME - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_FRMATR_CONDITIONAL_STYLE_NAME - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_FRMATR_GRABBAG - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_TEXT_VERT_ADJUST - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_BACKGROUND_FULL_SIZE - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_RTL_GUTTER - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_DECORATIVE - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_WRAP_TEXT_AT_FLY_START - - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_MIRRORGRF - { SID_ATTR_GRAF_CROP, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_CROPGRF - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_ROTATION, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_LUMINANCE, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_CONTRAST, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_CHANNELR, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_CHANNELG, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_CHANNELB, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_GAMMA, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_INVERT, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_TRANSPARENCY, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_DUMMY4, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_DUMMY5, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_GRFATR_DUMMY6, - - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_BOXATR_FORMAT - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, // RES_BOXATR_FORMULA, - { 0, SFX_ITEMINFOFLAG_NONE }, // RES_BOXATR_VALUE - - { 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE } // RES_UNKNOWNATR_CONTAINER -}; + return new SwTOXMark(); +} + +ItemInfoPackage& getItemInfoPackageSwAttributes() +{ + class ItemInfoPackageSwAttributes : public ItemInfoPackage + { + typedef std::array<ItemInfoStatic, POOLATTR_END - POOLATTR_BEGIN> ItemInfoArrayWriter; + ItemInfoArrayWriter maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { RES_CHRATR_CASEMAP, new SvxCaseMapItem( SvxCaseMap::NotMapped, RES_CHRATR_CASEMAP), SID_ATTR_CHAR_CASEMAP, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_CHARSETCOLOR, new SvxColorItem(RES_CHRATR_CHARSETCOLOR), SID_ATTR_CHAR_CHARSETCOLOR, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_COLOR, new SvxColorItem(RES_CHRATR_COLOR), SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_CHRATR_CONTOUR, new SvxContourItem( false, RES_CHRATR_CONTOUR ), SID_ATTR_CHAR_CONTOUR, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_CROSSEDOUT, new SvxCrossedOutItem( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ), SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_ESCAPEMENT, new SvxEscapementItem( RES_CHRATR_ESCAPEMENT ), SID_ATTR_CHAR_ESCAPEMENT, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_FONT, nullptr, SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_CHRATR_FONTSIZE, new SvxFontHeightItem( 240, 100, RES_CHRATR_FONTSIZE ), SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_KERNING, new SvxKerningItem( 0, RES_CHRATR_KERNING ), SID_ATTR_CHAR_KERNING, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_LANGUAGE, new SvxLanguageItem(LANGUAGE_DONTKNOW, RES_CHRATR_LANGUAGE ), SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_POSTURE, new SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE ), SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_UNUSED1, new SfxVoidItem( RES_CHRATR_UNUSED1 ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_SHADOWED, new SvxShadowedItem( false, RES_CHRATR_SHADOWED ), SID_ATTR_CHAR_SHADOWED, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_UNDERLINE, new SvxUnderlineItem( LINESTYLE_NONE, RES_CHRATR_UNDERLINE ), SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_CHRATR_WEIGHT, new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ), SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_WORDLINEMODE, new SvxWordLineModeItem( false, RES_CHRATR_WORDLINEMODE ), SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_AUTOKERN, new SvxAutoKernItem( false, RES_CHRATR_AUTOKERN ), SID_ATTR_CHAR_AUTOKERN, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_BLINK, new SvxBlinkItem( false, RES_CHRATR_BLINK ), SID_ATTR_FLASH, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_NOHYPHEN, new SvxNoHyphenItem( false, RES_CHRATR_NOHYPHEN ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_UNUSED2, new SfxVoidItem( RES_CHRATR_UNUSED2 ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_BACKGROUND, new SvxBrushItem( RES_CHRATR_BACKGROUND ), SID_ATTR_BRUSH_CHAR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + + // CJK-Attributes + { RES_CHRATR_CJK_FONT, nullptr, SID_ATTR_CHAR_CJK_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_CHRATR_CJK_FONTSIZE, new SvxFontHeightItem( 240, 100, RES_CHRATR_CJK_FONTSIZE ), SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_CJK_LANGUAGE, new SvxLanguageItem(LANGUAGE_DONTKNOW, RES_CHRATR_CJK_LANGUAGE), SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_CJK_POSTURE, new SvxPostureItem(ITALIC_NONE, RES_CHRATR_CJK_POSTURE ), SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_CJK_WEIGHT, new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ), SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + + // CTL-Attributes + { RES_CHRATR_CTL_FONT, nullptr, SID_ATTR_CHAR_CTL_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_CHRATR_CTL_FONTSIZE, new SvxFontHeightItem( 240, 100, RES_CHRATR_CTL_FONTSIZE ), SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_CTL_LANGUAGE, new SvxLanguageItem(LANGUAGE_DONTKNOW, RES_CHRATR_CTL_LANGUAGE), SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_CTL_POSTURE, new SvxPostureItem(ITALIC_NONE, RES_CHRATR_CTL_POSTURE ), SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_CTL_WEIGHT, new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ), SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + + { RES_CHRATR_ROTATE, new SvxCharRotateItem( 0_deg10, false, RES_CHRATR_ROTATE ), SID_ATTR_CHAR_ROTATED, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_EMPHASIS_MARK, new SvxEmphasisMarkItem( FontEmphasisMark::NONE, RES_CHRATR_EMPHASIS_MARK ), SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_TWO_LINES, new SvxTwoLinesItem( false, 0, 0, RES_CHRATR_TWO_LINES ), SID_ATTR_CHAR_TWO_LINES, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_SCALEW, new SvxCharScaleWidthItem( 100, RES_CHRATR_SCALEW ), SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_RELIEF, new SvxCharReliefItem( FontRelief::NONE, RES_CHRATR_RELIEF ), SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_HIDDEN, new SvxCharHiddenItem( false, RES_CHRATR_HIDDEN ), SID_ATTR_CHAR_HIDDEN, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_OVERLINE, new SvxOverlineItem( LINESTYLE_NONE, RES_CHRATR_OVERLINE ), SID_ATTR_CHAR_OVERLINE, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_CHRATR_RSID, new SvxRsidItem( 0, RES_CHRATR_RSID ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_BOX, new SvxBoxItem( RES_CHRATR_BOX ), SID_ATTR_CHAR_BOX, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_CHRATR_SHADOW, new SvxShadowItem( RES_CHRATR_SHADOW ), SID_ATTR_CHAR_SHADOW, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_HIGHLIGHT, new SvxBrushItem( RES_CHRATR_HIGHLIGHT ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_CHRATR_GRABBAG, new SfxGrabBagItem( RES_CHRATR_GRABBAG ), SID_ATTR_CHAR_GRABBAG, SFX_ITEMINFOFLAG_NONE }, + + // CharacterAttr - MSWord weak char direction/script override emulation + { RES_CHRATR_BIDIRTL, new SfxInt16Item( RES_CHRATR_BIDIRTL, sal_Int16(-1) ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_IDCTHINT, new SfxInt16Item( RES_CHRATR_IDCTHINT, sal_Int16(-1) ), 0, SFX_ITEMINFOFLAG_NONE }, + + { RES_TXTATR_REFMARK, new SwFormatRefMark( OUString() ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_TXTATR_TOXMARK, createSwTOXMarkForItemInfoPackage(), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_TXTATR_META, SwFormatMeta::CreatePoolDefault(RES_TXTATR_META), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TXTATR_METAFIELD, SwFormatMeta::CreatePoolDefault(RES_TXTATR_METAFIELD), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TXTATR_AUTOFMT, new SwFormatAutoFormat, 0, SFX_ITEMINFOFLAG_NONE }, + + // We cannot yet create the SwFormatINetFormat, that would crash since SW_MOD + // is not initialized and the translated ressource strings would not be available. + // Luckily this mechanism allows to also flag this ItemInfo as 'incomplete' using + // a nullptr as ItemPtr and implementing on-demand creation, see ::getItemInfo + { RES_TXTATR_INETFMT, nullptr, FN_TXTATR_INET, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + + { RES_TXTATR_CHARFMT, new SwFormatCharFormat( nullptr ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TXTATR_CJK_RUBY, new SwFormatRuby( OUString() ), SID_ATTR_CHAR_CJK_RUBY, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_TXTATR_UNKNOWN_CONTAINER, new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_TXTATR_INPUTFIELD, createSwFormatFieldForItemInfoPackage( RES_TXTATR_INPUTFIELD ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_TXTATR_CONTENTCONTROL, new SwFormatContentControl( RES_TXTATR_CONTENTCONTROL ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TXTATR_FIELD, createSwFormatFieldForItemInfoPackage( RES_TXTATR_FIELD ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_TXTATR_FLYCNT, new SwFormatFlyCnt( nullptr ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TXTATR_FTN, new SwFormatFootnote, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TXTATR_ANNOTATION, createSwFormatFieldForItemInfoPackage( RES_TXTATR_ANNOTATION ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TXTATR_LINEBREAK, new SwFormatLineBreak(SwLineBreakClear::NONE), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TXTATR_DUMMY1, new SfxBoolItem( RES_TXTATR_DUMMY1 ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_LINESPACING, new SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING ), SID_ATTR_PARA_LINESPACE, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_ADJUST, new SvxAdjustItem( SvxAdjust::Left, RES_PARATR_ADJUST ), SID_ATTR_PARA_ADJUST, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_SPLIT, new SvxFormatSplitItem( true, RES_PARATR_SPLIT ), SID_ATTR_PARA_SPLIT, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_ORPHANS, new SvxOrphansItem( 0, RES_PARATR_ORPHANS ), SID_ATTR_PARA_ORPHANS, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_WIDOWS, new SvxWidowsItem( 0, RES_PARATR_WIDOWS ), SID_ATTR_PARA_WIDOWS, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_TABSTOP, new SvxTabStopItem( 1, SVX_TAB_DEFDIST, SvxTabAdjust::Default, RES_PARATR_TABSTOP ), SID_ATTR_TABSTOP, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + + // for this at the Item GetMaxHyphens() = 0 was called, do this now on-demand at construction time + // it willl get added in costructor below once for LO runtime as static default + { RES_PARATR_HYPHENZONE, nullptr, SID_ATTR_PARA_HYPHENZONE, SFX_ITEMINFOFLAG_NONE }, + + { RES_PARATR_DROP, new SwFormatDrop, FN_FORMAT_DROPCAPS, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_REGISTER, new SwRegisterItem( false ), SID_ATTR_PARA_REGISTER, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_NUMRULE, new SwNumRuleItem( OUString() ), SID_ATTR_PARA_NUMRULE, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_SCRIPTSPACE, new SvxScriptSpaceItem( true, RES_PARATR_SCRIPTSPACE ), SID_ATTR_PARA_SCRIPTSPACE, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_HANGINGPUNCTUATION, new SvxHangingPunctuationItem( true, RES_PARATR_HANGINGPUNCTUATION ), SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_FORBIDDEN_RULES, new SvxForbiddenRuleItem( true, RES_PARATR_FORBIDDEN_RULES ), SID_ATTR_PARA_FORBIDDEN_RULES, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_VERTALIGN, new SvxParaVertAlignItem( SvxParaVertAlignItem::Align::Automatic, RES_PARATR_VERTALIGN ), SID_PARA_VERTALIGN, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_SNAPTOGRID, new SvxParaGridItem( true, RES_PARATR_SNAPTOGRID ), SID_ATTR_PARA_SNAPTOGRID, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_CONNECT_BORDER, new SwParaConnectBorderItem, SID_ATTR_BORDER_CONNECT, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_OUTLINELEVEL, new SfxUInt16Item( RES_PARATR_OUTLINELEVEL, 0 ), SID_ATTR_PARA_OUTLINE_LEVEL, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_RSID, new SvxRsidItem( 0, RES_PARATR_RSID ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_GRABBAG, new SfxGrabBagItem( RES_PARATR_GRABBAG ), SID_ATTR_PARA_GRABBAG, SFX_ITEMINFOFLAG_NONE }, + + { RES_PARATR_LIST_ID, new SfxStringItem( RES_PARATR_LIST_ID, OUString() ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_LIST_LEVEL, new SfxInt16Item( RES_PARATR_LIST_LEVEL, 0 ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_LIST_ISRESTART, new SfxBoolItem( RES_PARATR_LIST_ISRESTART, false ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_LIST_RESTARTVALUE, new SfxInt16Item( RES_PARATR_LIST_RESTARTVALUE, 1 ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_LIST_ISCOUNTED, new SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, true ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_PARATR_LIST_AUTOFMT, new SwFormatAutoFormat(RES_PARATR_LIST_AUTOFMT), 0, SFX_ITEMINFOFLAG_NONE }, + + { RES_FILL_ORDER, new SwFormatFillOrder, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_FRM_SIZE, new SwFormatFrameSize, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_PAPER_BIN, new SvxPaperBinItem( RES_PAPER_BIN ), SID_ATTR_PAGE_PAPERBIN, SFX_ITEMINFOFLAG_NONE }, + { RES_MARGIN_FIRSTLINE, new SvxFirstLineIndentItem(RES_MARGIN_FIRSTLINE), SID_ATTR_PARA_FIRSTLINESPACE, SFX_ITEMINFOFLAG_NONE }, + { RES_MARGIN_TEXTLEFT, new SvxTextLeftMarginItem(RES_MARGIN_TEXTLEFT), SID_ATTR_PARA_LEFTSPACE, SFX_ITEMINFOFLAG_NONE }, + { RES_MARGIN_RIGHT, new SvxRightMarginItem(RES_MARGIN_RIGHT), SID_ATTR_PARA_RIGHTSPACE, SFX_ITEMINFOFLAG_NONE }, + { RES_MARGIN_LEFT, new SvxLeftMarginItem(RES_MARGIN_LEFT), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_MARGIN_GUTTER, new SvxGutterLeftMarginItem(RES_MARGIN_GUTTER), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_MARGIN_GUTTER_RIGHT, new SvxGutterRightMarginItem(RES_MARGIN_GUTTER_RIGHT), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_LR_SPACE, new SvxLRSpaceItem( RES_LR_SPACE ), SID_ATTR_LRSPACE, SFX_ITEMINFOFLAG_NONE }, + { RES_UL_SPACE, new SvxULSpaceItem( RES_UL_SPACE ), SID_ATTR_ULSPACE, SFX_ITEMINFOFLAG_NONE }, + { RES_PAGEDESC, new SwFormatPageDesc, 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_BREAK, new SvxFormatBreakItem( SvxBreak::NONE, RES_BREAK), SID_ATTR_PARA_PAGEBREAK, SFX_ITEMINFOFLAG_NONE }, + { RES_CNTNT, new SwFormatContent, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_HEADER, new SwFormatHeader, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_FOOTER, new SwFormatFooter, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_PRINT, new SvxPrintItem( RES_PRINT ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_OPAQUE, new SvxOpaqueItem( RES_OPAQUE ), FN_OPAQUE, SFX_ITEMINFOFLAG_NONE }, + { RES_PROTECT, new SvxProtectItem( RES_PROTECT ), FN_SET_PROTECT, SFX_ITEMINFOFLAG_NONE }, + { RES_SURROUND, new SwFormatSurround, FN_SURROUND, SFX_ITEMINFOFLAG_NONE }, + { RES_VERT_ORIENT, new SwFormatVertOrient, FN_VERT_ORIENT, SFX_ITEMINFOFLAG_NONE }, + { RES_HORI_ORIENT, new SwFormatHoriOrient, FN_HORI_ORIENT, SFX_ITEMINFOFLAG_NONE }, + { RES_ANCHOR, new SwFormatAnchor, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_BACKGROUND, new SvxBrushItem( RES_BACKGROUND ), SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_BOX, new SvxBoxItem( RES_BOX ), SID_ATTR_BORDER_OUTER, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_SHADOW, new SvxShadowItem( RES_SHADOW ), SID_ATTR_BORDER_SHADOW, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_FRMMACRO, new SvxMacroItem( RES_FRMMACRO ), SID_ATTR_MACROITEM, SFX_ITEMINFOFLAG_NONE }, + { RES_COL, new SwFormatCol, FN_ATTR_COLUMNS, SFX_ITEMINFOFLAG_NONE }, + { RES_KEEP, new SvxFormatKeepItem( false, RES_KEEP ), SID_ATTR_PARA_KEEP, SFX_ITEMINFOFLAG_NONE }, + { RES_URL, new SwFormatURL(), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_EDIT_IN_READONLY, new SwFormatEditInReadonly, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_LAYOUT_SPLIT, new SwFormatLayoutSplit, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_CHAIN, new SwFormatChain, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TEXTGRID, new SwTextGridItem, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_LINENUMBER, new SwFormatLineNumber, FN_FORMAT_LINENUMBER, SFX_ITEMINFOFLAG_NONE }, + { RES_FTN_AT_TXTEND, new SwFormatFootnoteAtTextEnd, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_END_AT_TXTEND, new SwFormatEndAtTextEnd, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_COLUMNBALANCE, new SwFormatNoBalancedColumns, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_FRAMEDIR, new SvxFrameDirectionItem( SvxFrameDirection::Environment, RES_FRAMEDIR ), SID_ATTR_FRAMEDIRECTION, SFX_ITEMINFOFLAG_NONE }, + { RES_HEADER_FOOTER_EAT_SPACING, new SwHeaderAndFooterEatSpacingItem, SID_ATTR_HDFT_DYNAMIC_SPACING, SFX_ITEMINFOFLAG_NONE }, + { RES_ROW_SPLIT, new SwFormatRowSplit, FN_TABLE_ROW_SPLIT, SFX_ITEMINFOFLAG_NONE }, + { RES_FLY_SPLIT, new SwFormatFlySplit, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_FOLLOW_TEXT_FLOW, new SwFormatFollowTextFlow(false), SID_SW_FOLLOW_TEXT_FLOW, SFX_ITEMINFOFLAG_NONE }, + { RES_COLLAPSING_BORDERS, new SfxBoolItem( RES_COLLAPSING_BORDERS, false ), SID_SW_COLLAPSING_BORDERS, SFX_ITEMINFOFLAG_NONE }, + { RES_WRAP_INFLUENCE_ON_OBJPOS, new SwFormatWrapInfluenceOnObjPos( text::WrapInfluenceOnPosition::ONCE_CONCURRENT ), SID_SW_WRAP_INFLUENCE_ON_OBJPOS, SFX_ITEMINFOFLAG_NONE }, + { RES_AUTO_STYLE, new SwFormatAutoFormat( RES_AUTO_STYLE ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_FRMATR_STYLE_NAME, new SfxStringItem( RES_FRMATR_STYLE_NAME, OUString()), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_FRMATR_CONDITIONAL_STYLE_NAME, new SfxStringItem( RES_FRMATR_CONDITIONAL_STYLE_NAME, OUString() ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_FRMATR_GRABBAG, new SfxGrabBagItem(RES_FRMATR_GRABBAG), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TEXT_VERT_ADJUST, new SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP,RES_TEXT_VERT_ADJUST), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_BACKGROUND_FULL_SIZE, new SfxBoolItem(RES_BACKGROUND_FULL_SIZE, true), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_RTL_GUTTER, new SfxBoolItem(RES_RTL_GUTTER, false), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_DECORATIVE, new SfxBoolItem(RES_DECORATIVE, false), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_WRAP_TEXT_AT_FLY_START, new SwFormatWrapTextAtFlyStart, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_MIRRORGRF, new SwMirrorGrf, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_CROPGRF, new SwCropGrf, SID_ATTR_GRAF_CROP, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_ROTATION, new SwRotationGrf, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_LUMINANCE, new SwLuminanceGrf, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_CONTRAST, new SwContrastGrf, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_CHANNELR, new SwChannelRGrf, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_CHANNELG, new SwChannelGGrf, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_CHANNELB, new SwChannelBGrf, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_GAMMA, new SwGammaGrf, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_INVERT, new SwInvertGrf, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_TRANSPARENCY, new SwTransparencyGrf, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_DRAWMODE, new SwDrawModeGrf, 0, SFX_ITEMINFOFLAG_NONE }, + + // GraphicAttr - Dummies + { RES_GRFATR_DUMMY4, new SfxBoolItem( RES_GRFATR_DUMMY4 ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_GRFATR_DUMMY5, new SfxBoolItem( RES_GRFATR_DUMMY5 ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_BOXATR_FORMAT, new SwTableBoxNumFormat, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_BOXATR_FORMULA, new SwTableBoxFormula( OUString() ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, + { RES_BOXATR_VALUE, new SwTableBoxValue, 0, SFX_ITEMINFOFLAG_NONE }, + { RES_UNKNOWNATR_CONTAINER, new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE } + }}; + + public: + ItemInfoPackageSwAttributes() + { + SvxHyphenZoneItem* pSvxHyphenZoneItem(new SvxHyphenZoneItem(false, RES_PARATR_HYPHENZONE)); + pSvxHyphenZoneItem->GetMaxHyphens() = 0; // Default: 0 + setItemAtItemInfoStatic(pSvxHyphenZoneItem, maItemInfos[RES_PARATR_HYPHENZONE - POOLATTR_BEGIN]); + + SvxFontItem* pFont(new SvxFontItem(RES_CHRATR_FONT)); + SvxFontItem* pFontCJK(new SvxFontItem(RES_CHRATR_CJK_FONT)); + SvxFontItem* pFontCTL(new SvxFontItem(RES_CHRATR_CTL_FONT)); + + // Init DefFonts: + GetDefaultFonts(*pFont, *pFontCJK, *pFontCTL); + + setItemAtItemInfoStatic(pFont, maItemInfos[RES_CHRATR_FONT - POOLATTR_BEGIN]); + setItemAtItemInfoStatic(pFontCJK, maItemInfos[RES_CHRATR_CJK_FONT - POOLATTR_BEGIN]); + setItemAtItemInfoStatic(pFontCTL, maItemInfos[RES_CHRATR_CTL_FONT - POOLATTR_BEGIN]); + + // as described above, this Item gets created on-demand. + setItemAtItemInfoStatic( + new SwFormatINetFormat(OUString(), OUString()), + maItemInfos[RES_TXTATR_INETFMT - POOLATTR_BEGIN]); + } + + virtual size_t size() const override { return maItemInfos.size(); } + virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; } + virtual const ItemInfo& getExistingItemInfo(size_t nIndex) override + { + return maItemInfos[nIndex]; + } + }; + + + static std::unique_ptr<ItemInfoPackageSwAttributes> g_aItemInfoPackageSwAttributes; + if (!g_aItemInfoPackageSwAttributes) + g_aItemInfoPackageSwAttributes.reset(new ItemInfoPackageSwAttributes); + return *g_aItemInfoPackageSwAttributes; +} std::vector<SvGlobalName> *pGlobalOLEExcludeList = nullptr; @@ -461,206 +518,6 @@ SwCalendarWrapper& s_getCalendarWrapper() void InitCore() { - SfxPoolItem* pItem; - - aAttrTab[ RES_CHRATR_CASEMAP- POOLATTR_BEGIN ] = new SvxCaseMapItem( SvxCaseMap::NotMapped, RES_CHRATR_CASEMAP); - aAttrTab[ RES_CHRATR_CHARSETCOLOR- POOLATTR_BEGIN ] = new SvxColorItem(RES_CHRATR_CHARSETCOLOR); - aAttrTab[ RES_CHRATR_COLOR- POOLATTR_BEGIN ] = new SvxColorItem(RES_CHRATR_COLOR); - aAttrTab[ RES_CHRATR_CONTOUR- POOLATTR_BEGIN ] = new SvxContourItem( false, RES_CHRATR_CONTOUR ); - aAttrTab[ RES_CHRATR_CROSSEDOUT- POOLATTR_BEGIN ] = new SvxCrossedOutItem( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ); - aAttrTab[ RES_CHRATR_ESCAPEMENT- POOLATTR_BEGIN ] = new SvxEscapementItem( RES_CHRATR_ESCAPEMENT ); - aAttrTab[ RES_CHRATR_FONT- POOLATTR_BEGIN ] = new SvxFontItem( RES_CHRATR_FONT ); - - aAttrTab[ RES_CHRATR_FONTSIZE- POOLATTR_BEGIN ] = new SvxFontHeightItem( 240, 100, RES_CHRATR_FONTSIZE ); - aAttrTab[ RES_CHRATR_KERNING- POOLATTR_BEGIN ] = new SvxKerningItem( 0, RES_CHRATR_KERNING ); - aAttrTab[ RES_CHRATR_LANGUAGE- POOLATTR_BEGIN ] = new SvxLanguageItem(LANGUAGE_DONTKNOW, RES_CHRATR_LANGUAGE ); - aAttrTab[ RES_CHRATR_POSTURE- POOLATTR_BEGIN ] = new SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE ); - aAttrTab[ RES_CHRATR_UNUSED1- POOLATTR_BEGIN ] = new SfxVoidItem( RES_CHRATR_UNUSED1 ); - aAttrTab[ RES_CHRATR_SHADOWED- POOLATTR_BEGIN ] = new SvxShadowedItem( false, RES_CHRATR_SHADOWED ); - aAttrTab[ RES_CHRATR_UNDERLINE- POOLATTR_BEGIN ] = new SvxUnderlineItem( LINESTYLE_NONE, RES_CHRATR_UNDERLINE ); - aAttrTab[ RES_CHRATR_WEIGHT- POOLATTR_BEGIN ] = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ); - aAttrTab[ RES_CHRATR_RSID - POOLATTR_BEGIN ] = new SvxRsidItem( 0, RES_CHRATR_RSID ); - aAttrTab[ RES_CHRATR_WORDLINEMODE- POOLATTR_BEGIN ] = new SvxWordLineModeItem( false, RES_CHRATR_WORDLINEMODE ); - aAttrTab[ RES_CHRATR_AUTOKERN- POOLATTR_BEGIN ] = new SvxAutoKernItem( false, RES_CHRATR_AUTOKERN ); - aAttrTab[ RES_CHRATR_BLINK - POOLATTR_BEGIN ] = new SvxBlinkItem( false, RES_CHRATR_BLINK ); - aAttrTab[ RES_CHRATR_NOHYPHEN - POOLATTR_BEGIN ] = new SvxNoHyphenItem( false, RES_CHRATR_NOHYPHEN ); - aAttrTab[ RES_CHRATR_UNUSED2- POOLATTR_BEGIN ] = new SfxVoidItem( RES_CHRATR_UNUSED2 ); - aAttrTab[ RES_CHRATR_BACKGROUND - POOLATTR_BEGIN ] = new SvxBrushItem( RES_CHRATR_BACKGROUND ); - - // CJK-Attributes - aAttrTab[ RES_CHRATR_CJK_FONT - POOLATTR_BEGIN ] = new SvxFontItem( RES_CHRATR_CJK_FONT ); - aAttrTab[ RES_CHRATR_CJK_FONTSIZE - POOLATTR_BEGIN ] = new SvxFontHeightItem( 240, 100, RES_CHRATR_CJK_FONTSIZE ); - aAttrTab[ RES_CHRATR_CJK_LANGUAGE - POOLATTR_BEGIN ] = new SvxLanguageItem(LANGUAGE_DONTKNOW, RES_CHRATR_CJK_LANGUAGE); - aAttrTab[ RES_CHRATR_CJK_POSTURE - POOLATTR_BEGIN ] = new SvxPostureItem(ITALIC_NONE, RES_CHRATR_CJK_POSTURE ); - aAttrTab[ RES_CHRATR_CJK_WEIGHT - POOLATTR_BEGIN ] = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ); - - // CTL-Attributes - aAttrTab[ RES_CHRATR_CTL_FONT - POOLATTR_BEGIN ] = new SvxFontItem( RES_CHRATR_CTL_FONT ); - aAttrTab[ RES_CHRATR_CTL_FONTSIZE - POOLATTR_BEGIN ] = new SvxFontHeightItem( 240, 100, RES_CHRATR_CTL_FONTSIZE ); - aAttrTab[ RES_CHRATR_CTL_LANGUAGE - POOLATTR_BEGIN ] = new SvxLanguageItem(LANGUAGE_DONTKNOW, RES_CHRATR_CTL_LANGUAGE); - aAttrTab[ RES_CHRATR_CTL_POSTURE - POOLATTR_BEGIN ] = new SvxPostureItem(ITALIC_NONE, RES_CHRATR_CTL_POSTURE ); - aAttrTab[ RES_CHRATR_CTL_WEIGHT - POOLATTR_BEGIN ] = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ); - - aAttrTab[ RES_CHRATR_ROTATE - POOLATTR_BEGIN ] = new SvxCharRotateItem( 0_deg10, false, RES_CHRATR_ROTATE ); - aAttrTab[ RES_CHRATR_EMPHASIS_MARK - POOLATTR_BEGIN ] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, RES_CHRATR_EMPHASIS_MARK ); - aAttrTab[ RES_CHRATR_TWO_LINES - POOLATTR_BEGIN ] = new SvxTwoLinesItem( false, 0, 0, RES_CHRATR_TWO_LINES ); - aAttrTab[ RES_CHRATR_SCALEW - POOLATTR_BEGIN ] = new SvxCharScaleWidthItem( 100, RES_CHRATR_SCALEW ); - aAttrTab[ RES_CHRATR_RELIEF - POOLATTR_BEGIN ] = new SvxCharReliefItem( FontRelief::NONE, RES_CHRATR_RELIEF ); - aAttrTab[ RES_CHRATR_HIDDEN - POOLATTR_BEGIN ] = new SvxCharHiddenItem( false, RES_CHRATR_HIDDEN ); - aAttrTab[ RES_CHRATR_OVERLINE- POOLATTR_BEGIN ] = new SvxOverlineItem( LINESTYLE_NONE, RES_CHRATR_OVERLINE ); - aAttrTab[ RES_CHRATR_BOX - POOLATTR_BEGIN ] = new SvxBoxItem( RES_CHRATR_BOX ); - aAttrTab[ RES_CHRATR_SHADOW - POOLATTR_BEGIN ] = new SvxShadowItem( RES_CHRATR_SHADOW ); - aAttrTab[ RES_CHRATR_HIGHLIGHT - POOLATTR_BEGIN ] = new SvxBrushItem( RES_CHRATR_HIGHLIGHT ); - aAttrTab[ RES_CHRATR_GRABBAG - POOLATTR_BEGIN ] = new SfxGrabBagItem( RES_CHRATR_GRABBAG ); - -// CharacterAttr - MSWord weak char direction/script override emulation - aAttrTab[ RES_CHRATR_BIDIRTL - POOLATTR_BEGIN ] = new SfxInt16Item( RES_CHRATR_BIDIRTL, sal_Int16(-1) ); - aAttrTab[ RES_CHRATR_IDCTHINT - POOLATTR_BEGIN ] = new SfxInt16Item( RES_CHRATR_IDCTHINT, sal_Int16(-1) ); - - aAttrTab[ RES_TXTATR_REFMARK - POOLATTR_BEGIN ] = new SwFormatRefMark( OUString() ); - aAttrTab[ RES_TXTATR_TOXMARK - POOLATTR_BEGIN ] = new SwTOXMark; - aAttrTab[ RES_TXTATR_META - POOLATTR_BEGIN ] = SwFormatMeta::CreatePoolDefault(RES_TXTATR_META); - aAttrTab[ RES_TXTATR_METAFIELD - POOLATTR_BEGIN ] = SwFormatMeta::CreatePoolDefault(RES_TXTATR_METAFIELD); - aAttrTab[ RES_TXTATR_AUTOFMT- POOLATTR_BEGIN ] = new SwFormatAutoFormat; - aAttrTab[ RES_TXTATR_INETFMT - POOLATTR_BEGIN ] = new SwFormatINetFormat( OUString(), OUString() ); - aAttrTab[ RES_TXTATR_CHARFMT- POOLATTR_BEGIN ] = new SwFormatCharFormat( nullptr ); - aAttrTab[ RES_TXTATR_CJK_RUBY - POOLATTR_BEGIN ] = new SwFormatRuby( OUString() ); - aAttrTab[ RES_TXTATR_UNKNOWN_CONTAINER - POOLATTR_BEGIN ] = new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER ); - aAttrTab[ RES_TXTATR_INPUTFIELD - POOLATTR_BEGIN ] = new SwFormatField( RES_TXTATR_INPUTFIELD ); - aAttrTab[ RES_TXTATR_CONTENTCONTROL - POOLATTR_BEGIN ] = new SwFormatContentControl( RES_TXTATR_CONTENTCONTROL ); - - aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFormatField( RES_TXTATR_FIELD ); - aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFormatFlyCnt( nullptr ); - aAttrTab[ RES_TXTATR_FTN - POOLATTR_BEGIN ] = new SwFormatFootnote; - aAttrTab[ RES_TXTATR_ANNOTATION - POOLATTR_BEGIN ] = new SwFormatField( RES_TXTATR_ANNOTATION ); - aAttrTab[RES_TXTATR_LINEBREAK - POOLATTR_BEGIN] = new SwFormatLineBreak(SwLineBreakClear::NONE); - -// TextAttr - Dummies - aAttrTab[ RES_TXTATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY1 ); - - aAttrTab[ RES_PARATR_LINESPACING- POOLATTR_BEGIN ] = new SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING ); - aAttrTab[ RES_PARATR_ADJUST- POOLATTR_BEGIN ] = new SvxAdjustItem( SvxAdjust::Left, RES_PARATR_ADJUST ); - aAttrTab[ RES_PARATR_SPLIT- POOLATTR_BEGIN ] = new SvxFormatSplitItem( true, RES_PARATR_SPLIT ); - aAttrTab[ RES_PARATR_WIDOWS- POOLATTR_BEGIN ] = new SvxWidowsItem( 0, RES_PARATR_WIDOWS ); - aAttrTab[ RES_PARATR_ORPHANS- POOLATTR_BEGIN ] = new SvxOrphansItem( 0, RES_PARATR_ORPHANS ); - aAttrTab[ RES_PARATR_TABSTOP- POOLATTR_BEGIN ] = new SvxTabStopItem( 1, SVX_TAB_DEFDIST, SvxTabAdjust::Default, RES_PARATR_TABSTOP ); - - pItem = new SvxHyphenZoneItem( false, RES_PARATR_HYPHENZONE ); - static_cast<SvxHyphenZoneItem*>(pItem)->GetMaxHyphens() = 0; // Default: 0 - aAttrTab[ RES_PARATR_HYPHENZONE- POOLATTR_BEGIN ] = pItem; - - aAttrTab[ RES_PARATR_DROP- POOLATTR_BEGIN ] = new SwFormatDrop; - aAttrTab[ RES_PARATR_REGISTER - POOLATTR_BEGIN ] = new SwRegisterItem( false ); - aAttrTab[ RES_PARATR_NUMRULE - POOLATTR_BEGIN ] = new SwNumRuleItem( OUString() ); - - aAttrTab[ RES_PARATR_SCRIPTSPACE - POOLATTR_BEGIN ] = new SvxScriptSpaceItem( true, RES_PARATR_SCRIPTSPACE ); - aAttrTab[ RES_PARATR_HANGINGPUNCTUATION - POOLATTR_BEGIN ] = new SvxHangingPunctuationItem( true, RES_PARATR_HANGINGPUNCTUATION ); - aAttrTab[ RES_PARATR_FORBIDDEN_RULES - POOLATTR_BEGIN ] = new SvxForbiddenRuleItem( true, RES_PARATR_FORBIDDEN_RULES ); - aAttrTab[ RES_PARATR_VERTALIGN - POOLATTR_BEGIN ] = new SvxParaVertAlignItem( SvxParaVertAlignItem::Align::Automatic, RES_PARATR_VERTALIGN ); - aAttrTab[ RES_PARATR_SNAPTOGRID - POOLATTR_BEGIN ] = new SvxParaGridItem( true, RES_PARATR_SNAPTOGRID ); - aAttrTab[ RES_PARATR_CONNECT_BORDER - POOLATTR_BEGIN ] = new SwParaConnectBorderItem; - - aAttrTab[ RES_PARATR_OUTLINELEVEL - POOLATTR_BEGIN ] = new SfxUInt16Item( RES_PARATR_OUTLINELEVEL, 0 ); - aAttrTab[ RES_PARATR_RSID - POOLATTR_BEGIN ] = new SvxRsidItem( 0, RES_PARATR_RSID ); - aAttrTab[ RES_PARATR_GRABBAG - POOLATTR_BEGIN ] = new SfxGrabBagItem( RES_PARATR_GRABBAG ); - - aAttrTab[ RES_PARATR_LIST_ID - POOLATTR_BEGIN ] = new SfxStringItem( RES_PARATR_LIST_ID, OUString() ); - aAttrTab[ RES_PARATR_LIST_LEVEL - POOLATTR_BEGIN ] = new SfxInt16Item( RES_PARATR_LIST_LEVEL, 0 ); - aAttrTab[ RES_PARATR_LIST_ISRESTART - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_LIST_ISRESTART, false ); - aAttrTab[ RES_PARATR_LIST_RESTARTVALUE - POOLATTR_BEGIN ] = new SfxInt16Item( RES_PARATR_LIST_RESTARTVALUE, 1 ); - aAttrTab[ RES_PARATR_LIST_ISCOUNTED - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, true ); - aAttrTab[ RES_PARATR_LIST_AUTOFMT - POOLATTR_BEGIN ] = new SwFormatAutoFormat(RES_PARATR_LIST_AUTOFMT);//new SfxSetItem(RES_PARATR_LIST_AUTOFMT, std::make_unique<SfxItemSet>(aCharAutoFormatSetRange)); - - aAttrTab[ RES_FILL_ORDER- POOLATTR_BEGIN ] = new SwFormatFillOrder; - aAttrTab[ RES_FRM_SIZE- POOLATTR_BEGIN ] = new SwFormatFrameSize; - aAttrTab[ RES_PAPER_BIN- POOLATTR_BEGIN ] = new SvxPaperBinItem( RES_PAPER_BIN ); - aAttrTab[ RES_MARGIN_FIRSTLINE - POOLATTR_BEGIN ] = new SvxFirstLineIndentItem(RES_MARGIN_FIRSTLINE); - aAttrTab[ RES_MARGIN_TEXTLEFT - POOLATTR_BEGIN ] = new SvxTextLeftMarginItem(RES_MARGIN_TEXTLEFT); - aAttrTab[ RES_MARGIN_RIGHT - POOLATTR_BEGIN ] = new SvxRightMarginItem(RES_MARGIN_RIGHT); - aAttrTab[ RES_MARGIN_LEFT - POOLATTR_BEGIN ] = new SvxLeftMarginItem(RES_MARGIN_LEFT); - aAttrTab[ RES_MARGIN_GUTTER - POOLATTR_BEGIN ] = new SvxGutterLeftMarginItem(RES_MARGIN_GUTTER); - aAttrTab[ RES_MARGIN_GUTTER_RIGHT - POOLATTR_BEGIN ] = new SvxGutterRightMarginItem(RES_MARGIN_GUTTER_RIGHT); - aAttrTab[ RES_LR_SPACE- POOLATTR_BEGIN ] = new SvxLRSpaceItem( RES_LR_SPACE ); - aAttrTab[ RES_UL_SPACE- POOLATTR_BEGIN ] = new SvxULSpaceItem( RES_UL_SPACE ); - aAttrTab[ RES_PAGEDESC- POOLATTR_BEGIN ] = new SwFormatPageDesc; - aAttrTab[ RES_BREAK- POOLATTR_BEGIN ] = new SvxFormatBreakItem( SvxBreak::NONE, RES_BREAK); - aAttrTab[ RES_CNTNT- POOLATTR_BEGIN ] = new SwFormatContent; - aAttrTab[ RES_HEADER- POOLATTR_BEGIN ] = new SwFormatHeader; - aAttrTab[ RES_FOOTER- POOLATTR_BEGIN ] = new SwFormatFooter; - aAttrTab[ RES_PRINT- POOLATTR_BEGIN ] = new SvxPrintItem( RES_PRINT ); - aAttrTab[ RES_OPAQUE- POOLATTR_BEGIN ] = new SvxOpaqueItem( RES_OPAQUE ); - aAttrTab[ RES_PROTECT- POOLATTR_BEGIN ] = new SvxProtectItem( RES_PROTECT ); - aAttrTab[ RES_SURROUND- POOLATTR_BEGIN ] = new SwFormatSurround; - aAttrTab[ RES_VERT_ORIENT- POOLATTR_BEGIN ] = new SwFormatVertOrient; - aAttrTab[ RES_HORI_ORIENT- POOLATTR_BEGIN ] = new SwFormatHoriOrient; - aAttrTab[ RES_ANCHOR- POOLATTR_BEGIN ] = new SwFormatAnchor; - aAttrTab[ RES_BACKGROUND- POOLATTR_BEGIN ] = new SvxBrushItem( RES_BACKGROUND ); - aAttrTab[ RES_BOX- POOLATTR_BEGIN ] = new SvxBoxItem( RES_BOX ); - aAttrTab[ RES_SHADOW- POOLATTR_BEGIN ] = new SvxShadowItem( RES_SHADOW ); - aAttrTab[ RES_FRMMACRO- POOLATTR_BEGIN ] = new SvxMacroItem( RES_FRMMACRO ); - aAttrTab[ RES_COL- POOLATTR_BEGIN ] = new SwFormatCol; - aAttrTab[ RES_KEEP - POOLATTR_BEGIN ] = new SvxFormatKeepItem( false, RES_KEEP ); - aAttrTab[ RES_URL - POOLATTR_BEGIN ] = new SwFormatURL(); - aAttrTab[ RES_EDIT_IN_READONLY - POOLATTR_BEGIN ] = new SwFormatEditInReadonly; - aAttrTab[ RES_LAYOUT_SPLIT - POOLATTR_BEGIN ] = new SwFormatLayoutSplit; - aAttrTab[ RES_CHAIN - POOLATTR_BEGIN ] = new SwFormatChain; - aAttrTab[ RES_TEXTGRID - POOLATTR_BEGIN ] = new SwTextGridItem; - aAttrTab[ RES_HEADER_FOOTER_EAT_SPACING - POOLATTR_BEGIN ] = new SwHeaderAndFooterEatSpacingItem; - aAttrTab[ RES_LINENUMBER - POOLATTR_BEGIN ] = new SwFormatLineNumber; - aAttrTab[ RES_FTN_AT_TXTEND - POOLATTR_BEGIN ] = new SwFormatFootnoteAtTextEnd; - aAttrTab[ RES_END_AT_TXTEND - POOLATTR_BEGIN ] = new SwFormatEndAtTextEnd; - aAttrTab[ RES_COLUMNBALANCE - POOLATTR_BEGIN ] = new SwFormatNoBalancedColumns; - aAttrTab[ RES_FRAMEDIR - POOLATTR_BEGIN ] = new SvxFrameDirectionItem( SvxFrameDirection::Environment, RES_FRAMEDIR ); - aAttrTab[ RES_ROW_SPLIT - POOLATTR_BEGIN ] = new SwFormatRowSplit; - aAttrTab[ RES_FLY_SPLIT - POOLATTR_BEGIN ] = new SwFormatFlySplit; - - // #i18732# - aAttrTab[ RES_FOLLOW_TEXT_FLOW - POOLATTR_BEGIN ] = new SwFormatFollowTextFlow(false); - // collapsing borders #i29550# - aAttrTab[ RES_COLLAPSING_BORDERS - POOLATTR_BEGIN ] = new SfxBoolItem( RES_COLLAPSING_BORDERS, false ); - // #i28701# - // #i35017# - constant name has changed - aAttrTab[ RES_WRAP_INFLUENCE_ON_OBJPOS - POOLATTR_BEGIN ] = new SwFormatWrapInfluenceOnObjPos( text::WrapInfluenceOnPosition::ONCE_CONCURRENT ); - - aAttrTab[ RES_AUTO_STYLE - POOLATTR_BEGIN ] = new SwFormatAutoFormat( RES_AUTO_STYLE ); - aAttrTab[ RES_FRMATR_STYLE_NAME - POOLATTR_BEGIN ] = new SfxStringItem( RES_FRMATR_STYLE_NAME, OUString()); - aAttrTab[ RES_FRMATR_CONDITIONAL_STYLE_NAME - POOLATTR_BEGIN ] = new SfxStringItem( RES_FRMATR_CONDITIONAL_STYLE_NAME, OUString() ); - aAttrTab[ RES_FRMATR_GRABBAG - POOLATTR_BEGIN ] = new SfxGrabBagItem(RES_FRMATR_GRABBAG); - aAttrTab[ RES_TEXT_VERT_ADJUST - POOLATTR_BEGIN ] = new SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP,RES_TEXT_VERT_ADJUST); - aAttrTab[ RES_BACKGROUND_FULL_SIZE - POOLATTR_BEGIN ] = new SfxBoolItem(RES_BACKGROUND_FULL_SIZE, true); - aAttrTab[ RES_RTL_GUTTER - POOLATTR_BEGIN ] = new SfxBoolItem(RES_RTL_GUTTER, false); - aAttrTab[ RES_DECORATIVE - POOLATTR_BEGIN ] = new SfxBoolItem(RES_DECORATIVE, false); - aAttrTab[ RES_WRAP_TEXT_AT_FLY_START - POOLATTR_BEGIN ] = new SwFormatWrapTextAtFlyStart; - - aAttrTab[ RES_GRFATR_MIRRORGRF- POOLATTR_BEGIN ] = new SwMirrorGrf; - aAttrTab[ RES_GRFATR_CROPGRF- POOLATTR_BEGIN ] = new SwCropGrf; - aAttrTab[ RES_GRFATR_ROTATION - POOLATTR_BEGIN ] = new SwRotationGrf; - aAttrTab[ RES_GRFATR_LUMINANCE - POOLATTR_BEGIN ] = new SwLuminanceGrf; - aAttrTab[ RES_GRFATR_CONTRAST - POOLATTR_BEGIN ] = new SwContrastGrf; - aAttrTab[ RES_GRFATR_CHANNELR - POOLATTR_BEGIN ] = new SwChannelRGrf; - aAttrTab[ RES_GRFATR_CHANNELG - POOLATTR_BEGIN ] = new SwChannelGGrf; - aAttrTab[ RES_GRFATR_CHANNELB - POOLATTR_BEGIN ] = new SwChannelBGrf; - aAttrTab[ RES_GRFATR_GAMMA - POOLATTR_BEGIN ] = new SwGammaGrf; - aAttrTab[ RES_GRFATR_INVERT - POOLATTR_BEGIN ] = new SwInvertGrf; - aAttrTab[ RES_GRFATR_TRANSPARENCY - POOLATTR_BEGIN ] = new SwTransparencyGrf; - aAttrTab[ RES_GRFATR_DRAWMODE - POOLATTR_BEGIN ] = new SwDrawModeGrf; - -// GraphicAttr - Dummies - aAttrTab[ RES_GRFATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY4 ); - aAttrTab[ RES_GRFATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY5 ); - - aAttrTab[ RES_BOXATR_FORMAT- POOLATTR_BEGIN ] = new SwTableBoxNumFormat; - aAttrTab[ RES_BOXATR_FORMULA- POOLATTR_BEGIN ] = new SwTableBoxFormula( OUString() ); - aAttrTab[ RES_BOXATR_VALUE- POOLATTR_BEGIN ] = new SwTableBoxValue; - - aAttrTab[ RES_UNKNOWNATR_CONTAINER- POOLATTR_BEGIN ] = - new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER ); - - // get the correct fonts: - ::GetDefaultFonts( (aAttrTab[ RES_CHRATR_FONT- POOLATTR_BEGIN ])->StaticWhichCast(RES_CHRATR_FONT), - (aAttrTab[ RES_CHRATR_CJK_FONT - POOLATTR_BEGIN ])->StaticWhichCast(RES_CHRATR_CJK_FONT), - (aAttrTab[ RES_CHRATR_CTL_FONT - POOLATTR_BEGIN ])->StaticWhichCast(RES_CHRATR_CTL_FONT) ); - SwBreakIt::Create_( ::comphelper::getProcessComponentContext() ); pCheckIt = nullptr; @@ -704,19 +561,8 @@ void FinitCore() delete SwEditShell::s_pAutoFormatFlags; -#if OSL_DEBUG_LEVEL > 0 - // free defaults to prevent assertions - if ( aAttrTab[0]->GetRefCount() ) - SfxItemPool::ReleasePoolDefaults( &aAttrTab ); -#endif delete SwDoc::s_pAutoCompleteWords; - // delete all default attributes - for(SfxPoolItem* pHt : aAttrTab) - { - delete pHt; - } - delete pGlobalOLEExcludeList; } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 7a854008a923..fc722b391de1 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -112,6 +112,7 @@ #include <svx/xfillit0.hxx> #include <unotools/configmgr.hxx> #include <i18nlangtag/mslangid.hxx> +#include <svl/setitem.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::document; @@ -868,9 +869,21 @@ void SwDoc::ReplaceDefaults(const SwDoc& rSource) for (sal_uInt16 nWhich = rPair.first; nWhich <= rPair.second; ++nWhich) { - const SfxPoolItem& rSourceAttr = - rSource.mpAttrPool->GetUserOrPoolDefaultItem(nWhich); - if (rSourceAttr != mpAttrPool->GetUserOrPoolDefaultItem(nWhich)) + const SfxPoolItem& rSourceAttr(rSource.mpAttrPool->GetUserOrPoolDefaultItem(nWhich)); + const SfxPoolItem& rDestAttr(mpAttrPool->GetUserOrPoolDefaultItem(nWhich)); + bool bEqual(SfxPoolItem::areSame(rSourceAttr, rDestAttr)); + + if (!bEqual && rSourceAttr.isSetItem() && rDestAttr.isSetItem()) + { + // the normal SfxSetItem::operator== returns false when pools are different, + // which will always be the case here. Use the compare without pool + // comparison - the chances that the defaults in pools of the same type are + // equal are high, and cloning them is expensive + bEqual = static_cast<const SfxSetItem&>(rSourceAttr).GetItemSet().Equals( + static_cast<const SfxSetItem&>(rDestAttr).GetItemSet(), false); + } + + if (!bEqual) aNewDefaults.Put(rSourceAttr); } } diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 1d8b0ef68065..b8f6c45c5bb6 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1357,8 +1357,6 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr nAction, const Point* pPt ) nullptr, GetDoc()->GetDocShell())); - pModel->GetItemPool().FreezeIdRanges(); - rStrm.Seek(0); uno::Reference< io::XInputStream > xInputStream( new utl::OInputStreamWrapper( rStrm ) ); diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx index 56030fc42d35..ab6fa71ca13f 100644 --- a/sw/source/uibase/ribbar/concustomshape.cxx +++ b/sw/source/uibase/ribbar/concustomshape.cxx @@ -110,8 +110,6 @@ void ConstCustomShape::SetAttributes( SdrObject* pObj ) if ( aObjList[ i ].equalsIgnoreAsciiCase( m_aCustomShape ) ) { FmFormModel aFormModel; - SfxItemPool& rPool(aFormModel.GetItemPool()); - rPool.FreezeIdRanges(); if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) ) { |