sw/source/filter/ww8/docxattributeoutput.cxx | 2 +- sw/source/filter/ww8/rtfattributeoutput.cxx | 5 ++--- sw/source/filter/ww8/wrtww8.hxx | 6 +++++- sw/source/filter/ww8/wrtww8gr.cxx | 3 +-- sw/source/filter/ww8/ww8atr.cxx | 3 +-- sw/source/filter/ww8/ww8par.cxx | 2 +- sw/source/filter/ww8/ww8par.hxx | 4 ++++ 7 files changed, 15 insertions(+), 10 deletions(-)
New commits: commit cfd78dadbb461d8364e9294094e38a03732cabc1 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Feb 5 11:10:50 2018 +0200 TypedWhichId in sw(2) Change-Id: I68816c196f36d92fcd1ed58826368bbfe9aa52ce Reviewed-on: https://gerrit.libreoffice.org/49224 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index e24b02e9dd55..c4143c91a8c1 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6757,7 +6757,7 @@ void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement ) m_pSerializer->singleElementNS( XML_w, XML_vertAlign, FSNS( XML_w, XML_val ), sIss.getStr(), FSEND ); - const SvxFontHeightItem& rItem = static_cast<const SvxFontHeightItem&>(m_rExport.GetItem(RES_CHRATR_FONTSIZE)); + const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE); if (sIss.isEmpty() || sIss.match(OString("baseline"))) { long nHeight = rItem.GetHeight(); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index fd5df7d44011..88c70e14532d 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2229,8 +2229,7 @@ void RtfAttributeOutput::CharEscapement(const SvxEscapementItem& rEscapement) const char* pUpDn; - SwTwips nH - = static_cast<const SvxFontHeightItem&>(m_rExport.GetItem(RES_CHRATR_FONTSIZE)).GetHeight(); + SwTwips nH = m_rExport.GetItem(RES_CHRATR_FONTSIZE).GetHeight(); if (0 < rEscapement.GetEsc()) pUpDn = OOO_STRING_SVTOOLS_RTF_UP; @@ -2752,7 +2751,7 @@ void RtfAttributeOutput::ParaTabStop(const SvxTabStopItem& rTabStop) // Tabs are absolute by default. if (m_rExport.m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::TABS_RELATIVE_TO_INDENT)) - nOffset = static_cast<const SvxLRSpaceItem&>(m_rExport.GetItem(RES_LR_SPACE)).GetTextLeft(); + nOffset = m_rExport.GetItem(RES_LR_SPACE).GetTextLeft(); for (sal_uInt16 n = 0; n < rTabStop.Count(); n++) { diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 2b39a7d887d5..5a52a2aa852f 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -612,6 +612,10 @@ public: } const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const; + template<class T> const T& GetItem( TypedWhichId<T> nWhich ) const + { + return static_cast<const T&>(GetItem(sal_uInt16(nWhich))); + } /// Find the reference. bool HasRefToObject( sal_uInt16 nTyp, const OUString* pName, sal_uInt16 nSeqNo ); @@ -1405,7 +1409,7 @@ public: virtual const SfxPoolItem* HasTextItem( sal_uInt16 nWhich ) const = 0; virtual const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const = 0; -}; + }; /// Used to export formatted text associated to drawings. class MSWord_SdrAttrIter : public MSWordAttrIter diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 31f4a501a019..d0b47f658c7a 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -420,8 +420,7 @@ void WW8Export::OutGrf(const ww8::Frame &rFrame) SwTwips nHeight = rFlyFormat.GetFrameSize().GetHeight(); nHeight/=20; //nHeight was in twips, want it in half points, but //then half of total height. - long nFontHeight = static_cast<const SvxFontHeightItem&>( - GetItem(RES_CHRATR_FONTSIZE)).GetHeight(); + long nFontHeight = GetItem(RES_CHRATR_FONTSIZE).GetHeight(); nHeight-=nFontHeight/20; Set_UInt16( pArr, NS_sprm::sprmCHpsPos ); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index cd8930647624..2c187e610522 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1387,8 +1387,7 @@ void WW8AttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement ) if ( 0 == b || 0xFF == b ) { - long nHeight = static_cast<const SvxFontHeightItem&>(m_rWW8Export.GetItem( - RES_CHRATR_FONTSIZE )).GetHeight(); + long nHeight = m_rWW8Export.GetItem( RES_CHRATR_FONTSIZE ).GetHeight(); m_rWW8Export.InsUInt16( NS_sprm::sprmCHpsPos ); m_rWW8Export.InsUInt16( static_cast<short>(( nHeight * nEsc + 500 ) / 1000 )); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index e658111d03fd..e6aca96267fd 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2418,7 +2418,7 @@ bool SwWW8ImplReader::SetSpacing(SwPaM &rMyPam, int nSpace, bool bIsUpper ) bool bRet = false; const SwPosition* pSpacingPos = rMyPam.GetPoint(); - const SvxULSpaceItem* pULSpaceItem = static_cast<const SvxULSpaceItem*>(m_xCtrlStck->GetFormatAttr(*pSpacingPos, RES_UL_SPACE)); + const SvxULSpaceItem* pULSpaceItem = m_xCtrlStck->GetFormatAttr(*pSpacingPos, RES_UL_SPACE); if(pULSpaceItem != nullptr) { diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 784bb7dc0a62..8e5404ab9ce5 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -408,6 +408,10 @@ public: void SetToggleBiDiAttrFlags(sal_uInt16 nFlags) {nToggleBiDiAttrFlags = nFlags;} const SfxPoolItem* GetFormatAttr(const SwPosition& rPos, sal_uInt16 nWhich); + template<class T> const T* GetFormatAttr( const SwPosition& rPos, TypedWhichId<T> nWhich ) + { + return static_cast<const T*>(GetFormatAttr(rPos, sal_uInt16(nWhich))); + } const SfxPoolItem* GetStackAttr(const SwPosition& rPos, sal_uInt16 nWhich); }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits