diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-03-01 19:20:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-03-02 08:31:49 +0100 |
commit | 2d33c22e55b7af7481cc36a1fff979a33daf8519 (patch) | |
tree | 6e90a9aedc3c861043bf6022281566a064f4478e | |
parent | 24bcd1692cd9689f2586beebb5e4215d02fe8196 (diff) |
remove writerhelper::DefaultItemGet
the TypedWhichId template methods on SfxItemPool supercede this
Change-Id: Ice8fc953b0ec2cc3cfd4075a99f21889c23accda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130806
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/source/filter/ww8/writerhelper.hxx | 65 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 2 |
4 files changed, 7 insertions, 72 deletions
diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx index e07c6759d9c6..a9bb8ce04a66 100644 --- a/sw/source/filter/ww8/writerhelper.hxx +++ b/sw/source/filter/ww8/writerhelper.hxx @@ -248,71 +248,6 @@ namespace sw return dynamic_cast<const T *>(pItem); } - /** Extract a default SfxPoolItem derived property from a SfxItemPool - - Writer's attributes are retrieved by passing a numeric identifier - and receiving a SfxPoolItem reference which must then typically be - cast back to its original type which is both tedious and verbose. - - DefaultItemGet returns a reference to the default property of a - given SfxItemPool for a given property id, e.g. default fontsize - - DefaultItemGet uses item_cast () on the retrieved reference to test - that the retrieved property is of the type that the developer thinks - it is. - - @param rPool - The SfxItemPool whose default property we want - - @param eType - The numeric identifier of the default property to be retrieved - - @tplparam T - A SfxPoolItem derived class of the retrieved property - - @exception std::bad_cast Thrown if the property was not a T - - @return The T requested - */ - template<class T> const T & DefaultItemGet(const SfxItemPool &rPool, - sal_uInt16 eType) - { - return item_cast<T>(rPool.GetDefaultItem(eType)); - } - - /** Extract a default SfxPoolItem derived property from a SwDoc - - Writer's attributes are retrieved by passing a numeric identifier - and receiving a SfxPoolItem reference which must then typically be - cast back to its original type which is both tedious and verbose. - - DefaultItemGet returns a reference to the default property of a - given SwDoc (Writer Document) for a given property id, e.g default - fontsize - - DefaultItemGet uses item_cast () on the retrieved reference to test - that the retrieved property is of the type that the developer thinks - it is. - - @param rPool - The SfxItemPool whose default property we want - - @param eType - The numeric identifier of the default property to be retrieved - - @tplparam T - A SfxPoolItem derived class of the retrieved property - - @exception std::bad_cast Thrown if the property was not a T - - @return The T requested - */ - template<class T> const T & DefaultItemGet(const SwDoc &rDoc, - sal_uInt16 eType) - { - return DefaultItemGet<T>(rDoc.GetAttrPool(), eType); - } - /** Get the Paragraph Styles of a SwDoc Writer's styles are in one of those dreaded macro based pre-STL diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index ff9304815f78..658cadabba08 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1706,7 +1706,7 @@ const SvxBrushItem* WW8Export::GetCurrentPageBgBrush() const if (SfxItemState::SET != eState || !pRet || (!pRet->GetGraphic() && pRet->GetColor() == COL_TRANSPARENT)) { - pRet = &(DefaultItemGet<SvxBrushItem>(m_rDoc,RES_BACKGROUND)); + pRet = &m_rDoc.GetAttrPool().GetDefaultItem(RES_BACKGROUND); } return pRet; } @@ -3644,12 +3644,12 @@ WW8Ruby::WW8Ruby(const SwTextNode& rNode, const SwFormatRuby& rRuby, const MSWor pPool = pPool ? pPool : &rExport.m_rDoc.GetAttrPool(); - const auto& rFont - = DefaultItemGet<SvxFontItem>(*pPool, GetWhichOfScript(RES_CHRATR_FONT, nRubyScript)); + const SvxFontItem& rFont + = pPool->GetDefaultItem( GetWhichOfScript(RES_CHRATR_FONT, nRubyScript) ); m_sFontFamily = rFont.GetFamilyName(); - const auto& rHeight = DefaultItemGet<SvxFontHeightItem>( - *pPool, GetWhichOfScript(RES_CHRATR_FONTSIZE, nRubyScript)); + const SvxFontHeightItem& rHeight = + pPool->GetDefaultItem( GetWhichOfScript(RES_CHRATR_FONTSIZE, nRubyScript)); m_nRubyHeight = rHeight.GetHeight(); } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index c5013e4cc556..0274944d26d6 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -461,7 +461,7 @@ static void WriteDop( WW8Export& rWrt ) // write default TabStop const SvxTabStopItem& rTabStop = - DefaultItemGet<SvxTabStopItem>(rWrt.m_rDoc, RES_PARATR_TABSTOP); + rWrt.m_rDoc.GetAttrPool().GetDefaultItem(RES_PARATR_TABSTOP); rDop.dxaTab = o3tl::narrowing<sal_uInt16>(rTabStop[0].GetTabPos()); // Zoom factor and type diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 3b787d257fb4..178cc6cdc84f 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1766,7 +1766,7 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen) { SvxTabStopItem aOrig = pSty ? pSty->GetFormatAttr(RES_PARATR_TABSTOP) : - DefaultItemGet<SvxTabStopItem>(m_rDoc, RES_PARATR_TABSTOP); + m_rDoc.GetAttrPool().GetDefaultItem(RES_PARATR_TABSTOP); NewAttr(aOrig); } } |