diff options
author | Armin Le Grand <Armin.Le.Grand@me.com> | 2019-06-25 18:53:20 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2019-07-19 20:40:32 +0200 |
commit | c3ddc678ae5e9d5624d2c45aeb98bd17f64c6ddb (patch) | |
tree | 677a8296ffe98cfe68ba9403d635e5cea0c9fe97 | |
parent | 6c2f575f1ace404e6f97bec5cd740b6340851667 (diff) |
WIP: SvxFrameDirectionItem->Item::FrameDirectionfeature/item_refactor2
Start of op
Now done initial Item, chart2 and cui
Change-Id: I9125ec609e6a93808bc0c2877fa965c2dffa4820
23 files changed, 619 insertions, 89 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk index 02c8bcb75774..142ee73b8a73 100644 --- a/chart2/Library_chartcontroller.mk +++ b/chart2/Library_chartcontroller.mk @@ -44,6 +44,7 @@ $(eval $(call gb_Library_use_libraries,chartcontroller,\ ucbhelper \ utl \ vcl \ + item \ )) $(eval $(call gb_Library_set_componentfile,chartcontroller,chart2/source/controller/chartcontroller)) diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk index 4f98fc121251..e1a01bd8dd06 100644 --- a/chart2/Library_chartcore.mk +++ b/chart2/Library_chartcore.mk @@ -60,6 +60,7 @@ $(eval $(call gb_Library_use_libraries,chartcore,\ ucbhelper \ utl \ vcl \ + item \ )) $(eval $(call gb_Library_set_componentfile,chartcore,chart2/source/chartcore)) diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index 2889bdb74f13..45caab6d94cc 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -291,7 +291,11 @@ void DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const } if (m_xLB_TextDirection->get_active() != -1) - rOutAttrs->Put( SvxFrameDirectionItem( m_xLB_TextDirection->get_active_id(), EE_PARA_WRITINGDIR ) ); + { + // I2TM + rOutAttrs->itemSet().setItem(Item::FrameDirection(m_xLB_TextDirection->get_active_id())); + // rOutAttrs->Put( SvxFrameDirectionItem( m_xLB_TextDirection->get_active_id(), EE_PARA_WRITINGDIR ) ); + } if( m_aDC_Dial.IsVisible() ) { @@ -339,8 +343,13 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs) else m_xLB_LabelPlacement->set_active(-1); - if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, true, &pPoolItem ) == SfxItemState::SET ) - m_xLB_TextDirection->set_active_id( static_cast<const SvxFrameDirectionItem*>(pPoolItem)->GetValue() ); + // I2TM + if(const auto Item(rInAttrs.itemSet().getStateAndItem<Item::FrameDirection>()); Item.isSet()) + { + m_xLB_TextDirection->set_active_id(Item.getItem().getValue()); + } + // if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, true, &pPoolItem ) == SfxItemState::SET ) + // m_xLB_TextDirection->set_active_id( static_cast<const SvxFrameDirectionItem*>(pPoolItem)->GetValue() ); if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, true, &pPoolItem ) == SfxItemState::SET ) { diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx index 36062526cdd4..ba999de9e63f 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx @@ -129,7 +129,11 @@ bool SchAxisLabelTabPage::FillItemSet( SfxItemSet* rOutAttrs ) rOutAttrs->Put( SfxBoolItem( SCHATTR_AXIS_SHOWDESCR, m_xCbShowDescription->get_active() ) ); if (m_xLbTextDirection->get_active() != -1) - rOutAttrs->Put( SvxFrameDirectionItem( m_xLbTextDirection->get_active_id(), EE_PARA_WRITINGDIR ) ); + { + // I2TM + rOutAttrs->itemSet().setItem(Item::FrameDirection(m_xLbTextDirection->get_active_id())); + // rOutAttrs->Put( SvxFrameDirectionItem( m_xLbTextDirection->get_active_id(), EE_PARA_WRITINGDIR ) ); + } return true; } @@ -182,8 +186,13 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) m_xCbStacked->set_state(TRISTATE_INDET); StackedToggleHdl(*m_xCbStacked); - if( rInAttrs->GetItemState( EE_PARA_WRITINGDIR, true, &pPoolItem ) == SfxItemState::SET ) - m_xLbTextDirection->set_active_id( static_cast<const SvxFrameDirectionItem*>(pPoolItem)->GetValue() ); + // I2TM + if(const auto Item(rInAttrs->itemSet().getStateAndItem<Item::FrameDirection>()); Item.isSet()) + { + m_xLbTextDirection->set_active_id(Item.getItem().getValue()); + } + // if( rInAttrs->GetItemState( EE_PARA_WRITINGDIR, true, &pPoolItem ) == SfxItemState::SET ) + // m_xLbTextDirection->set_active_id( static_cast<const SvxFrameDirectionItem*>(pPoolItem)->GetValue() ); // Text overlap ---------- aState = rInAttrs->GetItemState( SCHATTR_AXIS_LABEL_OVERLAP, false, &pPoolItem ); diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx b/chart2/source/controller/dialogs/tp_LegendPosition.cxx index efd8a29c790e..22b7a6d44bc8 100644 --- a/chart2/source/controller/dialogs/tp_LegendPosition.cxx +++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx @@ -55,7 +55,11 @@ bool SchLegendPosTabPage::FillItemSet(SfxItemSet* rOutAttrs) m_aLegendPositionResources.writeToItemSet(*rOutAttrs); if (m_xLbTextDirection->get_active() != -1) - rOutAttrs->Put(SvxFrameDirectionItem(m_xLbTextDirection->get_active_id(), EE_PARA_WRITINGDIR)); + { + // I2TM + rOutAttrs->itemSet().setItem(Item::FrameDirection(m_xLbTextDirection->get_active_id())); + // rOutAttrs->Put(SvxFrameDirectionItem(m_xLbTextDirection->get_active_id(), EE_PARA_WRITINGDIR)); + } return true; } @@ -64,9 +68,14 @@ void SchLegendPosTabPage::Reset(const SfxItemSet* rInAttrs) { m_aLegendPositionResources.initFromItemSet(*rInAttrs); - const SfxPoolItem* pPoolItem = nullptr; - if( rInAttrs->GetItemState( EE_PARA_WRITINGDIR, true, &pPoolItem ) == SfxItemState::SET ) - m_xLbTextDirection->set_active_id( static_cast<const SvxFrameDirectionItem*>(pPoolItem)->GetValue() ); + // I2TM + if(const auto Item(rInAttrs->itemSet().getStateAndItem<Item::FrameDirection>()); Item.isSet()) + { + m_xLbTextDirection->set_active_id(Item.getItem().getValue()); + } + // const SfxPoolItem* pPoolItem = nullptr; + // if( rInAttrs->GetItemState( EE_PARA_WRITINGDIR, true, &pPoolItem ) == SfxItemState::SET ) + // m_xLbTextDirection->set_active_id( static_cast<const SvxFrameDirectionItem*>(pPoolItem)->GetValue() ); } } //namespace chart diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx index b9d73f337cc0..1bfd16b46c3b 100644 --- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx +++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx @@ -100,8 +100,10 @@ bool SchAlignmentTabPage::FillItemSet(SfxItemSet* rOutAttrs) sal_Int32 nDegrees = bStacked ? 0 : m_aCtrlDial.GetRotation(); rOutAttrs->Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) ); - SvxFrameDirection aDirection( m_xLbTextDirection->get_active_id() ); - rOutAttrs->Put( SvxFrameDirectionItem( aDirection, EE_PARA_WRITINGDIR ) ); + // I2TM + rOutAttrs->itemSet().setItem(Item::FrameDirection(m_xLbTextDirection->get_active_id())); + // SvxFrameDirection aDirection( m_xLbTextDirection->get_active_id() ); + // rOutAttrs->Put( SvxFrameDirectionItem( aDirection, EE_PARA_WRITINGDIR ) ); return true; } @@ -118,8 +120,13 @@ void SchAlignmentTabPage::Reset(const SfxItemSet* rInAttrs) m_xCbStacked->set_active(bStacked); StackedToggleHdl(*m_xCbStacked); - if( rInAttrs->GetItemState(EE_PARA_WRITINGDIR, true, &pItem) == SfxItemState::SET) - m_xLbTextDirection->set_active_id(static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue()); + // I2TM + if(const auto Item(rInAttrs->itemSet().getStateAndItem<Item::FrameDirection>()); Item.isSet()) + { + m_xLbTextDirection->set_active_id(Item.getItem().getValue()); + } + // if( rInAttrs->GetItemState(EE_PARA_WRITINGDIR, true, &pItem) == SfxItemState::SET) + // m_xLbTextDirection->set_active_id(static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue()); } } //namespace chart diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index d165ccb05251..b12c79aac6d2 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1410,7 +1410,11 @@ void lcl_setDefaultWritingMode( const std::shared_ptr< DrawModelWrapper >& pDraw if( nWritingMode != -1 && nWritingMode != text::WritingMode2::PAGE ) { if( pDrawModelWrapper.get() ) - pDrawModelWrapper->GetItemPool().SetPoolDefaultItem(SvxFrameDirectionItem(static_cast<SvxFrameDirection>(nWritingMode), EE_PARA_WRITINGDIR) ); + { + // I2TM + pDrawModelWrapper->GetItemPool().getModelSpecificIValues()->setAlternativeDefaultItem(Item::FrameDirection(static_cast<SvxFrameDirection>(nWritingMode))); + // pDrawModelWrapper->GetItemPool().SetPoolDefaultItem(SvxFrameDirectionItem(static_cast<SvxFrameDirection>(nWritingMode), EE_PARA_WRITINGDIR) ); + } } } catch( const uno::Exception& ) @@ -1426,9 +1430,14 @@ sal_Int16 lcl_getDefaultWritingModeFromPool( const std::shared_ptr<DrawModelWrap if(!pDrawModelWrapper) return nWritingMode; - const SfxPoolItem& rItem = pDrawModelWrapper->GetItemPool().GetDefaultItem(EE_PARA_WRITINGDIR); - nWritingMode - = static_cast<sal_Int16>(static_cast<const SvxFrameDirectionItem&>(rItem).GetValue()); + // I2TM + const Item::FrameDirection& rItem(static_cast<const Item::FrameDirection&>( + pDrawModelWrapper->GetItemPool().getModelSpecificIValues()->getDefault(Item::getDefault<Item::FrameDirection>()))); + nWritingMode = static_cast<sal_Int16>(rItem.getValue()); + // pDrawModelWrapper->GetItemPool().getModelSpecificIValues()->setAlternativeDefaultItem(Item::FrameDirection(static_cast<SvxFrameDirection>(nWritingMode))); + // const SfxPoolItem& rItem = pDrawModelWrapper->GetItemPool().GetDefaultItem(EE_PARA_WRITINGDIR); + // nWritingMode + // = static_cast<sal_Int16>(static_cast<const SvxFrameDirectionItem&>(rItem).GetValue()); return nWritingMode; } diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index e9cf3930b3fb..44925667e91d 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -298,8 +298,10 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet ) { if (m_xLbFrameDir->get_value_changed_from_saved()) { - SvxFrameDirection eDir = m_xLbFrameDir->get_active_id(); - rSet->Put(SvxFrameDirectionItem(eDir, GetWhich(SID_ATTR_FRAMEDIRECTION))); + // I2TM + rSet->itemSet().setItem(Item::FrameDirection(m_xLbFrameDir->get_active_id())); + // SvxFrameDirection eDir = m_xLbFrameDir->get_active_id(); + // rSet->Put(SvxFrameDirectionItem(eDir, GetWhich(SID_ATTR_FRAMEDIRECTION))); bChanged = true; } } @@ -531,28 +533,50 @@ void AlignmentTabPage::Reset(const SfxItemSet* pCoreAttrs) m_aVsRefEdge.SaveValue(); //text direction - nWhich = GetWhich(SID_ATTR_FRAMEDIRECTION); - eState = pCoreAttrs->GetItemState(nWhich); - switch (eState) + // I2TM + if(const auto Item(pCoreAttrs->itemSet().getStateAndItem<Item::FrameDirection>()); Item.isSet() || Item.isDefault()) { - case SfxItemState::UNKNOWN: - m_xLbFrameDir->hide(); - break; - case SfxItemState::DISABLED: - case SfxItemState::READONLY: - m_xLbFrameDir->set_sensitive(false); - break; - case SfxItemState::DONTCARE: - m_xLbFrameDir->set_active(-1); - break; - case SfxItemState::DEFAULT: - case SfxItemState::SET: - { - const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>(pCoreAttrs->Get(nWhich)); - m_xLbFrameDir->set_active_id(rFrameDirItem.GetValue()); - break; - } + m_xLbFrameDir->set_active_id(Item.getItem().getValue()); + } + else if(Item.isDontCare()) + { + m_xLbFrameDir->set_active(-1); + } + else if(Item.isDisabled()) + { + m_xLbFrameDir->set_sensitive(false); } + // I2TM There is a single 'AddTabPage("alignment", RID_SVXPAGE_ALIGNMENT);' call, so *can* + // another ItemSet where Item::FrameDirection is *not* defined come in at all? Probably not, + // so this should not be needed. + // Checked that the SfxItemSet is the same as handed in at ::Create and at costructor. + // else // SfxItemState::UNKNOWN does not exist anymore - is this used? + // { + // m_xLbFrameDir->hide(); + // } + + // nWhich = GetWhich(SID_ATTR_FRAMEDIRECTION); + // eState = pCoreAttrs->GetItemState(nWhich); + // switch (eState) + // { + // case SfxItemState::UNKNOWN: + // m_xLbFrameDir->hide(); + // break; + // case SfxItemState::DISABLED: + // case SfxItemState::READONLY: + // m_xLbFrameDir->set_sensitive(false); + // break; + // case SfxItemState::DONTCARE: + // m_xLbFrameDir->set_active(-1); + // break; + // case SfxItemState::DEFAULT: + // case SfxItemState::SET: + // { + // const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>(pCoreAttrs->Get(nWhich)); + // m_xLbFrameDir->set_active_id(rFrameDirItem.GetValue()); + // break; + // } + // } // Special treatment for distributed alignment; we need to set the justify diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index e3c3b704efd9..f5f30bdcb31b 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -545,18 +545,29 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet ) m_xRegisterLB->save_value(); } - SfxItemState eState = rSet->GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION ), - true, &pItem ); - if( SfxItemState::UNKNOWN != eState ) - { - SvxFrameDirection nVal = SfxItemState::SET == eState - ? static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue() - : SvxFrameDirection::Horizontal_LR_TB; - m_xTextFlowBox->set_active_id(nVal); + // I2TM will now always be != SfxItemState::UNKNOWN + SvxFrameDirection nVal(SvxFrameDirection::Horizontal_LR_TB); - m_xTextFlowBox->save_value(); - m_aBspWin.SetFrameDirection(nVal); + if(const auto Item(rSet->itemSet().getStateAndItem<Item::FrameDirection>()); Item.isSet()) + { + nVal = Item.getItem().getValue(); } + + m_xTextFlowBox->set_active_id(nVal); + m_xTextFlowBox->save_value(); + m_aBspWin.SetFrameDirection(nVal); + // SfxItemState eState = rSet->GetItemState( GetWhich( SID_ATTR_FRAMEDIRECTION ), + // true, &pItem ); + // if( SfxItemState::UNKNOWN != eState ) + // { + // SvxFrameDirection nVal = SfxItemState::SET == eState + // ? static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue() + // : SvxFrameDirection::Horizontal_LR_TB; + // m_xTextFlowBox->set_active_id(nVal); + + // m_xTextFlowBox->save_value(); + // m_aBspWin.SetFrameDirection(nVal); + // } } void SvxPageDescPage::FillUserData() diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index caa7a97b33c3..867be52d03e7 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -633,19 +633,29 @@ void SvxStdParagraphTabPage::ActivatePage( const SfxItemSet& rSet ) SvxAdjust eAdjust = rAdj.GetAdjust(); if ( eAdjust == SvxAdjust::Center || eAdjust == SvxAdjust::Block ) { - _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION ); - eItemState = rSet.GetItemState( _nWhich ); - - if ( eItemState >= SfxItemState::DEFAULT ) + // I2TM >= SfxItemState::DEFAULT means SET or DEFAULT + if(const auto Item(rSet.itemSet().getStateAndItem<Item::FrameDirection>()); Item.isSet() || Item.isDefault()) { - const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>( rSet.Get( _nWhich ) ); - SvxFrameDirection eFrameDirection = rFrameDirItem.GetValue(); + m_aExampleWin.EnableRTL(SvxFrameDirection::Horizontal_RL_TB == Item.getItem().getValue()); - m_aExampleWin.EnableRTL( SvxFrameDirection::Horizontal_RL_TB == eFrameDirection ); - - if ( eAdjust == SvxAdjust::Block ) - m_aExampleWin.SetLastLine( rAdj.GetLastBlock() ); + if(SvxAdjust::Block == eAdjust) + { + m_aExampleWin.SetLastLine(rAdj.GetLastBlock()); + } } + // _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION ); + // eItemState = rSet.GetItemState( _nWhich ); + + // if ( eItemState >= SfxItemState::DEFAULT ) + // { + // const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>( rSet.Get( _nWhich ) ); + // SvxFrameDirection eFrameDirection = rFrameDirItem.GetValue(); + + // m_aExampleWin.EnableRTL( SvxFrameDirection::Horizontal_RL_TB == eFrameDirection ); + + // if ( eAdjust == SvxAdjust::Block ) + // m_aExampleWin.SetLastLine( rAdj.GetLastBlock() ); + // } } else { @@ -1124,8 +1134,10 @@ bool SvxParaAlignTabPage::FillItemSet( SfxItemSet* rOutSet ) { if (m_xTextDirectionLB->get_value_changed_from_saved()) { - SvxFrameDirection eDir = m_xTextDirectionLB->get_active_id(); - rOutSet->Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) ); + // I2TM + rOutSet->itemSet().setItem(Item::FrameDirection(m_xTextDirectionLB->get_active_id())); + // SvxFrameDirection eDir = m_xTextDirectionLB->get_active_id(); + // rOutSet->Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) ); bModified = true; } } @@ -1214,14 +1226,20 @@ void SvxParaAlignTabPage::Reset( const SfxItemSet* rSet ) m_xVertAlignLB->set_active(static_cast<sal_Int32>(rAlign.GetValue())); } - _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION ); + // _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION ); //text direction - if( SfxItemState::DEFAULT <= rSet->GetItemState( _nWhich ) ) + // I2TM >= SfxItemState::DEFAULT means SET or DEFAULT + if(const auto Item(rSet->itemSet().getStateAndItem<Item::FrameDirection>()); Item.isSet() || Item.isDefault()) { - const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>( rSet->Get( _nWhich ) ); - m_xTextDirectionLB->set_active_id(rFrameDirItem.GetValue()); + m_xTextDirectionLB->set_active_id(Item.getItem().getValue()); m_xTextDirectionLB->save_value(); } + // if( SfxItemState::DEFAULT <= rSet->GetItemState( _nWhich ) ) + // { + // const SvxFrameDirectionItem& rFrameDirItem = static_cast<const SvxFrameDirectionItem&>( rSet->Get( _nWhich ) ); + // m_xTextDirectionLB->set_active_id(rFrameDirItem.GetValue()); + // m_xTextDirectionLB->save_value(); + // } m_xSnapToGridCB->save_state(); m_xVertAlignLB->save_value(); diff --git a/editeng/CppunitTest_editeng_core.mk b/editeng/CppunitTest_editeng_core.mk index 3b3a999e8fa0..161646c7cc8b 100644 --- a/editeng/CppunitTest_editeng_core.mk +++ b/editeng/CppunitTest_editeng_core.mk @@ -40,6 +40,7 @@ $(eval $(call gb_CppunitTest_use_libraries,editeng_core, \ utl \ vcl \ xo \ + item \ )) $(eval $(call gb_CppunitTest_use_externals,editeng_core,\ diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk index 9354071b3a70..e5c1c0c25f88 100644 --- a/editeng/Library_editeng.mk +++ b/editeng/Library_editeng.mk @@ -150,6 +150,7 @@ $(eval $(call gb_Library_use_libraries,editeng,\ sax \ i18nlangtag \ i18nutil \ + item \ )) $(eval $(call gb_Library_use_externals,editeng,\ diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 0d49c25681b6..104ffabfc219 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -3300,6 +3300,141 @@ void SvxBrushItem::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterEndElement(pWriter); } +const char* getFrmDirResId(size_t nIndex) +{ + const char* const RID_SVXITEMS_FRMDIR[] = + { + RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP, + RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP, + RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT, + RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT, + RID_SVXITEMS_FRMDIR_ENVIRONMENT + }; + return RID_SVXITEMS_FRMDIR[nIndex]; +} + +/////////////////////////////////////////////////////////////////////////////// +#include <item/base/ItemControlBlock.hxx> + +namespace Item +{ + ItemControlBlock& FrameDirection::GetStaticItemControlBlock() + { + static ItemControlBlock aItemControlBlock( + [](){ return new FrameDirection(SvxFrameDirection::Horizontal_LR_TB); }, + [](const ItemBase& rRef){ return new FrameDirection(static_cast<const FrameDirection&>(rRef)); }, + "FrameDirection"); + + return aItemControlBlock; + } + + FrameDirection::FrameDirection(SvxFrameDirection nValue) + : CntEnum<SvxFrameDirection>( + FrameDirection::GetStaticItemControlBlock(), + nValue) + { + } + + bool FrameDirection::getPresentation( + SfxItemPresentation, + MapUnit, + MapUnit, + rtl::OUString& rText, + const IntlWrapper&) const + { + rText = EditResId(getFrmDirResId(getEnumValueAsSalUInt16())); + return true; + } + + bool FrameDirection::queryValue(css::uno::Any& rVal, sal_uInt8) const + { + // translate SvxFrameDirection into WritingDirection2 + sal_Int16 nVal(0); + bool bRet(true); + + switch(getValue()) + { + case SvxFrameDirection::Horizontal_LR_TB: + nVal = text::WritingMode2::LR_TB; + break; + case SvxFrameDirection::Horizontal_RL_TB: + nVal = text::WritingMode2::RL_TB; + break; + case SvxFrameDirection::Vertical_RL_TB: + nVal = text::WritingMode2::TB_RL; + break; + case SvxFrameDirection::Vertical_LR_TB: + nVal = text::WritingMode2::TB_LR; + break; + case SvxFrameDirection::Vertical_LR_BT: + nVal = text::WritingMode2::BT_LR; + break; + case SvxFrameDirection::Environment: + nVal = text::WritingMode2::PAGE; + break; + default: + OSL_FAIL("Unknown SvxFrameDirection value!"); + bRet = false; + break; + } + + // return value + error state + if(bRet) + { + rVal <<= nVal; + } + + return bRet; + } + + bool FrameDirection::putAnyValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) + { + sal_Int16 nVal(-1); + bool bRet(rVal >>= nVal); + + if(bRet) + { + // translate WritingDirection2 constants into SvxFrameDirection + switch( nVal ) + { + case text::WritingMode2::LR_TB: + setValue( SvxFrameDirection::Horizontal_LR_TB ); + break; + case text::WritingMode2::RL_TB: + setValue( SvxFrameDirection::Horizontal_RL_TB ); + break; + case text::WritingMode2::TB_RL: + setValue( SvxFrameDirection::Vertical_RL_TB ); + break; + case text::WritingMode2::TB_LR: + setValue( SvxFrameDirection::Vertical_LR_TB ); + break; + case text::WritingMode2::BT_LR: + setValue( SvxFrameDirection::Vertical_LR_BT ); + break; + case text::WritingMode2::PAGE: + setValue( SvxFrameDirection::Environment ); + break; + default: + bRet = false; + break; + } + } + + return bRet; + } + + void FrameDirection::dumpAsXml(xmlTextWriterPtr pWriter) const + { + xmlTextWriterStartElement(pWriter, BAD_CAST("Item::FrameDirection")); + xmlTextWriterWriteAttribute( + pWriter, BAD_CAST("m_nValue"), + BAD_CAST(OString::number(getEnumValueAsSalUInt16()).getStr())); + xmlTextWriterEndElement(pWriter); + } +} // end of namespace Item + +/////////////////////////////////////////////////////////////////////////////// SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue , sal_uInt16 _nWhich ) @@ -3319,19 +3454,6 @@ SfxPoolItem* SvxFrameDirectionItem::Clone( SfxItemPool * ) const } -const char* getFrmDirResId(size_t nIndex) -{ - const char* const RID_SVXITEMS_FRMDIR[] = - { - RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP, - RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP, - RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT, - RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT, - RID_SVXITEMS_FRMDIR_ENVIRONMENT - }; - return RID_SVXITEMS_FRMDIR[nIndex]; -} - bool SvxFrameDirectionItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreUnit*/, diff --git a/include/editeng/frmdiritem.hxx b/include/editeng/frmdiritem.hxx index 840cae4a2f9e..8147ccb5d29d 100644 --- a/include/editeng/frmdiritem.hxx +++ b/include/editeng/frmdiritem.hxx @@ -28,6 +28,33 @@ layout text for Western, CJK and CTL languages. */ +/////////////////////////////////////////////////////////////////////////////// +#include <item/simple/CntEnum.hxx> + +namespace Item +{ + class EDITENG_DLLPUBLIC FrameDirection : public CntEnum<SvxFrameDirection> + { + public: + static ItemControlBlock& GetStaticItemControlBlock(); + + public: + FrameDirection(SvxFrameDirection nValue); + + virtual bool getPresentation( + SfxItemPresentation, + MapUnit, + MapUnit, + rtl::OUString&, + const IntlWrapper&) const override; + virtual bool queryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; + virtual bool putAnyValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; + virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; + }; +} // end of namespace Item + +/////////////////////////////////////////////////////////////////////////////// + class EDITENG_DLLPUBLIC SvxFrameDirectionItem : public SfxEnumItem<SvxFrameDirection> { public: diff --git a/include/item/base/ItemSet.hxx b/include/item/base/ItemSet.hxx index e400fff73959..d6982c0157e7 100644 --- a/include/item/base/ItemSet.hxx +++ b/include/item/base/ItemSet.hxx @@ -284,6 +284,18 @@ namespace Item IState aIState(IState::DEFAULT); const ItemBase* pItem(implGetStateAndItem(T::GetStaticItemControlBlock(), aIState, bSearchParent)); + // SfxItemState::DEFAULT + // SfxItemState::DONTCARE || SfxItemState::DISABLED -> should already be + // solved from ImplInvalidateItem/ImplDisableItem, but to have the + // fallback here additionally is never wrong + // in short: no specific ItemBase -> use default + if(nullptr == pItem) + { + return StateAndItem<T>( + aIState, + Item::getDefault<T>()); + } + // SfxItemState::SET return StateAndItem<T>( aIState, diff --git a/include/item/simple/CntEnum.hxx b/include/item/simple/CntEnum.hxx new file mode 100755 index 000000000000..19b8ecf042b5 --- /dev/null +++ b/include/item/simple/CntEnum.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_ITEM_SIMPLE_CNTENUM_HXX +#define INCLUDED_ITEM_SIMPLE_CNTENUM_HXX + +#include <item/base/ItemBase.hxx> +#include <item/base/ItemControlBlock.hxx> + +/////////////////////////////////////////////////////////////////////////////// + +namespace Item +{ + class ITEM_DLLPUBLIC CntEnumBase : public ItemBase + { + protected: + // constructor for derived classes that *have* to hand + // in the to-be-used ItemControlBlock + CntEnumBase(ItemControlBlock& rItemControlBlock); + + public: + CntEnumBase() = delete; + virtual bool operator==(const ItemBase&) const override; + + virtual bool getPresentation( + SfxItemPresentation, + MapUnit, + MapUnit, + rtl::OUString&, + const IntlWrapper&) const override; + virtual bool queryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; + virtual bool putAnyValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; + + protected: + // sal_uInt16 value interface + virtual sal_uInt16 getEnumValueAsSalUInt16() const = 0; + virtual void setEnumValueAsSalUInt16(sal_uInt16 nValue) = 0; + + public: + // bool value interface - optionally supported, for UI stuff + virtual bool hasBoolValue() const; + virtual bool getBoolValue() const; + virtual void setBoolValue(bool bValue); + }; +} // end of namespace Item + +/////////////////////////////////////////////////////////////////////////////// + +namespace Item +{ + template<typename EnumT> class SAL_DLLPUBLIC_RTTI CntEnum : public CntEnumBase + { + private: + EnumT m_nValue; + + protected: + // constructor for derived classes that *have* to hand + // in the to-be-used ItemControlBlock + CntEnum(ItemControlBlock& rItemControlBlock, EnumT nVal) + : CntEnumBase(rItemControlBlock), + m_nValue(nVal) + { + } + + public: + CntEnum() = delete; + + // value interface + EnumT getValue() const + { + return m_nValue; + } + + void setValue(EnumT nNew) + { + m_nValue = nNew; + } + + protected: + // sal_uInt16 value interface + virtual sal_uInt16 getEnumValueAsSalUInt16() const override + { + return static_cast<sal_uInt16>(getValue()); + } + + virtual void setEnumValueAsSalUInt16(sal_uInt16 nValue) override + { + setValue(static_cast<EnumT>(nValue)); + } + }; +} // end of namespace Item + +/////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_ITEM_SIMPLE_CNTENUM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/item/simple/CntInt16.hxx b/include/item/simple/CntInt16.hxx index fafd819b0c0c..fe2acc7e1011 100644 --- a/include/item/simple/CntInt16.hxx +++ b/include/item/simple/CntInt16.hxx @@ -50,7 +50,7 @@ namespace Item public: CntInt16() = delete; - virtual bool operator==(const ItemBase&) const; + virtual bool operator==(const ItemBase&) const override; sal_Int16 getValue() const { return m_nValue; } void setValue(sal_Int16 nNew) { m_nValue = nNew; } diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx index b8e641354cf0..31da5b451011 100644 --- a/include/svl/itempool.hxx +++ b/include/svl/itempool.hxx @@ -211,8 +211,11 @@ private: static const sal_uInt16 SFX_WHICH_MAX = 4999; // I2TM Transfer phase: deliver ModelSpecificItemValues for this SfxItemPool/Model +private: + // instance + Item::ModelSpecificItemValues::SharedPtr m_aModelSpecificItemValues; public: - virtual Item::ModelSpecificItemValues::SharedPtr getModelSpecificIValues() const; + Item::ModelSpecificItemValues::SharedPtr getModelSpecificIValues() const; // ~I2TM }; diff --git a/item/Library_item.mk b/item/Library_item.mk index f89945a29c89..93377e1c2ee1 100644 --- a/item/Library_item.mk +++ b/item/Library_item.mk @@ -37,6 +37,7 @@ $(eval $(call gb_Library_add_exception_objects,item,\ item/source/base/ItemBuffered \ item/source/base/ItemControlBlock \ item/source/simple/CntInt16 \ + item/source/simple/CntEnum \ item/source/simple/CntOUString \ )) diff --git a/item/source/base/ItemBase.cxx b/item/source/base/ItemBase.cxx index 1b6175c7f44e..df15575e070a 100644 --- a/item/source/base/ItemBase.cxx +++ b/item/source/base/ItemBase.cxx @@ -84,6 +84,87 @@ using the SfxItemPool::Put call, only their RefCount keeps them alive. Nonetheless these SlotItems STILL depend on the SfxItem-RANGES defined in the SfxItemSet -> SLOT ITEMS do NOT get POOLED (IsItemPoolable/IsPooledItem/...) -> SLOT ITEMS can be put in *any* ItemPool - due to not using the pooling mechanism + +/////////////////////////////////////////////////////////////////////////////// +What to do next? May try to replace all items from EditEngineItemPool and +then rempve that one completely -> much problems out of the way... +Items involved woul be (see DefItems::DefItems()): + + rDefItems[0] = new SvxFrameDirectionItem( SvxFrameDirection::Horizontal_LR_TB, EE_PARA_WRITINGDIR ); +195 results in 94 files -> lot of stuff +SvxFrameDirectionItem(EE_PARA_WRITINGDIR) -> Item::FrameDirection +cui: SID_ATTR_FRAMEDIRECTION, uses GetWhich() +sc: ATTR_WRITINGDIR +sw: RES_FRAMEDIR, FN_TABLE_BOX_TEXTORIENTATION + + 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 ); + SvxNumRule aDefaultNumRule( SvxNumRuleFlags::NONE, 0, false ); + rDefItems[5] = new SvxNumBulletItem( aDefaultNumRule, EE_PARA_NUMBULLET ); + rDefItems[6] = new SfxBoolItem( EE_PARA_HYPHENATE, false ); + rDefItems[7] = new SfxBoolItem( EE_PARA_BULLETSTATE, true ); + rDefItems[8] = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE ); + rDefItems[9] = new SfxInt16Item( EE_PARA_OUTLLEVEL, -1 ); + rDefItems[10] = new SvxBulletItem( EE_PARA_BULLET ); + rDefItems[11] = new SvxLRSpaceItem( EE_PARA_LRSPACE ); + rDefItems[12] = new SvxULSpaceItem( EE_PARA_ULSPACE ); + rDefItems[13] = new SvxLineSpacingItem( 0, EE_PARA_SBL ); + rDefItems[14] = new SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ); + rDefItems[15] = new SvxTabStopItem( 0, 0, SvxTabAdjust::Left, EE_PARA_TABS ); + rDefItems[16] = new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, EE_PARA_JUST_METHOD ); + rDefItems[17] = new SvxVerJustifyItem( SvxCellVerJustify::Standard, EE_PARA_VER_JUST ); + + // Character attributes: + rDefItems[18] = new SvxColorItem( COL_AUTO, EE_CHAR_COLOR ); + rDefItems[19] = new SvxFontItem( EE_CHAR_FONTINFO ); + rDefItems[20] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ); + rDefItems[21] = new SvxCharScaleWidthItem( 100, EE_CHAR_FONTWIDTH ); + rDefItems[22] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT ); + rDefItems[23] = new SvxUnderlineItem( LINESTYLE_NONE, EE_CHAR_UNDERLINE ); + rDefItems[24] = new SvxCrossedOutItem( STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ); + rDefItems[25] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC ); + rDefItems[26] = new SvxContourItem( false, EE_CHAR_OUTLINE ); + rDefItems[27] = new SvxShadowedItem( false, EE_CHAR_SHADOW ); + rDefItems[28] = new SvxEscapementItem( 0, 100, EE_CHAR_ESCAPEMENT ); + rDefItems[29] = new SvxAutoKernItem( false, EE_CHAR_PAIRKERNING ); + rDefItems[30] = new SvxKerningItem( 0, EE_CHAR_KERNING ); + rDefItems[31] = new SvxWordLineModeItem( false, EE_CHAR_WLM ); + rDefItems[32] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE ); + rDefItems[33] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CJK ); + rDefItems[34] = new SvxLanguageItem( LANGUAGE_DONTKNOW, EE_CHAR_LANGUAGE_CTL ); + rDefItems[35] = new SvxFontItem( EE_CHAR_FONTINFO_CJK ); + rDefItems[36] = new SvxFontItem( EE_CHAR_FONTINFO_CTL ); + rDefItems[37] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CJK ); + rDefItems[38] = new SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT_CTL ); + rDefItems[39] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CJK ); + rDefItems[40] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ); + rDefItems[41] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ); + rDefItems[42] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ); + rDefItems[43] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ); + rDefItems[44] = new SvxCharReliefItem( FontRelief::NONE, EE_CHAR_RELIEF ); + rDefItems[45] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY ); + rDefItems[46] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ); + rDefItems[47] = new SvxOverlineItem( LINESTYLE_NONE, EE_CHAR_OVERLINE ); + rDefItems[48] = new SvxCaseMapItem( SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ); + rDefItems[49] = new SfxGrabBagItem( EE_CHAR_GRABBAG ); + rDefItems[50] = new SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ); + // Features + rDefItems[51] = new SfxVoidItem( EE_FEATURE_TAB ); + rDefItems[52] = new SfxVoidItem( EE_FEATURE_LINEBR ); + rDefItems[53] = new SvxColorItem( COL_RED, EE_FEATURE_NOTCONV ); + rDefItems[54] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD ); + + assert(EDITITEMCOUNT == 55 && "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]) ); + + + */ /////////////////////////////////////////////////////////////////////////////// diff --git a/item/source/simple/CntEnum.cxx b/item/source/simple/CntEnum.cxx new file mode 100755 index 000000000000..9a6f10613432 --- /dev/null +++ b/item/source/simple/CntEnum.cxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <item/simple/CntEnum.hxx> +#include <item/base/ItemControlBlock.hxx> +#include <comphelper/extract.hxx> +#include <cassert> + +/////////////////////////////////////////////////////////////////////////////// + +namespace Item +{ + CntEnumBase::CntEnumBase(ItemControlBlock& rItemControlBlock) + : ItemBase(rItemControlBlock) + { + } + + bool CntEnumBase::operator==(const ItemBase& rRef) const + { + return ItemBase::operator==(rRef) || // ptr-compare + getEnumValueAsSalUInt16() == static_cast<const CntEnumBase&>(rRef).getEnumValueAsSalUInt16(); + } + + bool CntEnumBase::getPresentation( + SfxItemPresentation, + MapUnit, + MapUnit, + rtl::OUString& rText, + const IntlWrapper&) const + { + rText = rtl::OUString::number(getEnumValueAsSalUInt16()); + return true; + } + + bool CntEnumBase::queryValue(css::uno::Any& rVal, sal_uInt8) const + { + rVal <<= sal_Int32(getEnumValueAsSalUInt16()); + return true; + } + + bool CntEnumBase::putAnyValue(const css::uno::Any& rVal, sal_uInt8) + { + sal_Int32 nTheValue(0); + + if(::cppu::enum2int(nTheValue, rVal)) + { + setEnumValueAsSalUInt16(static_cast<sal_uInt16>(nTheValue)); + return true; + } + + assert(false && "CntEnumBase::putAnyValue - Wrong type!"); + return false; + } + + bool CntEnumBase::hasBoolValue() const + { + return false; + } + + bool CntEnumBase::getBoolValue() const + { + return false; + } + + void CntEnumBase::setBoolValue(bool /*bValue*/) + { + } +} // end of namespace Item + +/////////////////////////////////////////////////////////////////////////////// + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 6263ec308663..03f157b48c33 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -6405,6 +6405,7 @@ include/item/base/IBase.hxx include/item/base/IBaseStaticHelper.hxx include/item/base/ISet.hxx include/item/base/ModelSpecificIValues.hxx +include/item/simple/CntEnum.hxx include/item/simple/CntInt16.hxx include/item/simple/CntOUString.hxx include/jvmaccess/classpath.hxx @@ -8142,6 +8143,7 @@ item/source/base/IAdministrator.cxx item/source/base/IBase.cxx item/source/base/ISet.cxx item/source/base/ModelSpecificIValues.cxx +item/source/simple/CntEnum.cxx item/source/simple/CntInt16.cxx item/source/simple/CntOUString.cxx item/test/ItemTest.cxx diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 2ba0f5f5b106..fad45dfdb986 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -193,7 +193,9 @@ SfxItemPool::SfxItemPool but no transfer of ownership */ ) : pItemInfos(pInfo), - pImpl( new SfxItemPool_Impl( this, rName, nStartWhich, nEndWhich ) ) + pImpl( new SfxItemPool_Impl( this, rName, nStartWhich, nEndWhich ) ), + // I2TM + m_aModelSpecificItemValues() { pImpl->eDefMetric = MapUnit::MapTwip; @@ -217,7 +219,9 @@ SfxItemPool::SfxItemPool Take over static Defaults */ ) : pItemInfos(rPool.pItemInfos), - pImpl( new SfxItemPool_Impl( this, rPool.pImpl->aName, rPool.pImpl->mnStart, rPool.pImpl->mnEnd ) ) + pImpl( new SfxItemPool_Impl( this, rPool.pImpl->aName, rPool.pImpl->mnStart, rPool.pImpl->mnEnd ) ), + // I2TM + m_aModelSpecificItemValues() { pImpl->eDefMetric = rPool.pImpl->eDefMetric; @@ -953,15 +957,12 @@ void SfxItemPool::dumpAsXml(xmlTextWriterPtr pWriter) const // I2TM Transfer phase: deliver ModelSpecificItemValues for this SfxItemPool/Model Item::ModelSpecificItemValues::SharedPtr SfxItemPool::getModelSpecificIValues() const { - // global static instance fallback for all SfxItemPool(s) - static Item::ModelSpecificItemValues::SharedPtr aGlobalDefault; - - if(!aGlobalDefault) + if(!m_aModelSpecificItemValues) { - aGlobalDefault = Item::ModelSpecificItemValues::create(); + const_cast<SfxItemPool*>(this)->m_aModelSpecificItemValues = Item::ModelSpecificItemValues::create(); } - return aGlobalDefault; + return m_aModelSpecificItemValues; } // ~I2TM |