Kaydet (Commit) cfd78dad authored tarafından Noel Grandin's avatar Noel Grandin

TypedWhichId in sw(2)

Change-Id: I68816c196f36d92fcd1ed58826368bbfe9aa52ce
Reviewed-on: https://gerrit.libreoffice.org/49224Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b189726c
......@@ -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();
......
......@@ -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++)
{
......
......@@ -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
......
......@@ -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 );
......
......@@ -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 ));
......
......@@ -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)
{
......
......@@ -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);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment