diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-28 13:09:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-30 07:20:06 +0100 |
commit | afbc75c207f367fb60cbe2f1c634fe78cd86bf92 (patch) | |
tree | 2b74b0ceaf391255efd2daebc66f2b6aa966ef21 /sw | |
parent | 0025fa723afb9f6a0d94b9b3185ea14da18f1bd5 (diff) |
TypedWhichId for RES_PARAATR constants
Change-Id: If2257d32fdd66703735466982e6913070ac1166d
Reviewed-on: https://gerrit.libreoffice.org/45402
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/hintids.hxx | 65 | ||||
-rw-r--r-- | sw/inc/paratr.hxx | 32 | ||||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentStylePoolManager.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/tblafmt.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/text/frmcrsr.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/text/txttab.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap1.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfexport.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/chrdlg/drpcps.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/envelp/envfmt.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/shells/txtattr.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewtab.cxx | 5 |
20 files changed, 85 insertions, 88 deletions
diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 9d6111abcbe3..344478a078ef 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -148,43 +148,37 @@ RES_TXTATR_NOEND_END, RES_TXTATR_END = RES_TXTATR_NOEND_END }; -enum RES_PARATR -{ -RES_PARATR_BEGIN = RES_TXTATR_END, - RES_PARATR_LINESPACING = RES_PARATR_BEGIN, // 63 - RES_PARATR_ADJUST, // 64 - RES_PARATR_SPLIT, // 65 - RES_PARATR_ORPHANS, // 66 - RES_PARATR_WIDOWS, // 67 - RES_PARATR_TABSTOP, // 68 - RES_PARATR_HYPHENZONE, // 69 - RES_PARATR_DROP, // 70 - RES_PARATR_REGISTER, // 71 - RES_PARATR_NUMRULE, // 72 - RES_PARATR_SCRIPTSPACE, // 73 - RES_PARATR_HANGINGPUNCTUATION, // 74 - RES_PARATR_FORBIDDEN_RULES, // 75 - RES_PARATR_VERTALIGN, // 76 - RES_PARATR_SNAPTOGRID, // 77 - RES_PARATR_CONNECT_BORDER, // 78 - RES_PARATR_OUTLINELEVEL, // 79 - RES_PARATR_RSID, // 80 - RES_PARATR_GRABBAG, // 81 -RES_PARATR_END -}; +#define RES_PARATR_BEGIN RES_TXTATR_END +#define RES_PARATR_LINESPACING TypedWhichId<SvxLineSpacingItem>(RES_PARATR_BEGIN) // 63 +#define RES_PARATR_ADJUST TypedWhichId<SvxAdjustItem>(64) +#define RES_PARATR_SPLIT TypedWhichId<SvxFormatSplitItem>(65) +#define RES_PARATR_ORPHANS TypedWhichId<SvxOrphansItem>(66) +#define RES_PARATR_WIDOWS TypedWhichId<SvxWidowsItem>(67) +#define RES_PARATR_TABSTOP TypedWhichId<SvxTabStopItem>(68) +#define RES_PARATR_HYPHENZONE TypedWhichId<SvxHyphenZoneItem>(69) +#define RES_PARATR_DROP TypedWhichId<SwFormatDrop>(70) +#define RES_PARATR_REGISTER TypedWhichId<SwRegisterItem>(71) +#define RES_PARATR_NUMRULE TypedWhichId<SwNumRuleItem>(72) +#define RES_PARATR_SCRIPTSPACE TypedWhichId<SvxScriptSpaceItem>(73) +#define RES_PARATR_HANGINGPUNCTUATION TypedWhichId<SvxHangingPunctuationItem>(74) +#define RES_PARATR_FORBIDDEN_RULES TypedWhichId<SvxForbiddenRuleItem>(75) +#define RES_PARATR_VERTALIGN TypedWhichId<SvxParaVertAlignItem>(76) +#define RES_PARATR_SNAPTOGRID TypedWhichId<SvxParaGridItem>(77) +#define RES_PARATR_CONNECT_BORDER TypedWhichId<SwParaConnectBorderItem>(78) +#define RES_PARATR_OUTLINELEVEL TypedWhichId<SfxUInt16Item>(79) +#define RES_PARATR_RSID TypedWhichId<SvxRsidItem>(80) +#define RES_PARATR_GRABBAG TypedWhichId<SfxGrabBagItem>(81) +#define RES_PARATR_END (82) // list attributes for paragraphs. // intentionally these list attributes are not contained in paragraph styles -enum RES_PARATR_LIST -{ -RES_PARATR_LIST_BEGIN = RES_PARATR_END, - RES_PARATR_LIST_ID = RES_PARATR_LIST_BEGIN, // 82 - RES_PARATR_LIST_LEVEL, // 83 - RES_PARATR_LIST_ISRESTART, // 84 - RES_PARATR_LIST_RESTARTVALUE, // 85 - RES_PARATR_LIST_ISCOUNTED, // 86 -RES_PARATR_LIST_END -}; +#define RES_PARATR_LIST_BEGIN RES_PARATR_END +#define RES_PARATR_LIST_ID TypedWhichId<SfxStringItem>(RES_PARATR_LIST_BEGIN) // 82 +#define RES_PARATR_LIST_LEVEL TypedWhichId<SfxInt16Item>(83) +#define RES_PARATR_LIST_ISRESTART TypedWhichId<SfxBoolItem>(84) +#define RES_PARATR_LIST_RESTARTVALUE TypedWhichId<SfxInt16Item>(85) +#define RES_PARATR_LIST_ISCOUNTED TypedWhichId<SfxBoolItem>(86) +#define RES_PARATR_LIST_END (87) enum RES_FRMATR { @@ -424,6 +418,9 @@ extern SfxItemInfo aSlotTab[]; */ SW_DLLPUBLIC const SfxPoolItem* GetDfltAttr( sal_uInt16 nWhich ); +template<class T> inline const T* GetDfltAttr( TypedWhichId<T> nWhich ) +{ return static_cast<const T*>(GetDfltAttr(sal_uInt16(nWhich))); } + SW_DLLPUBLIC sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript ); // return for the given TextAttribute without an end the correct character. diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx index a803b924d39f..2f7e2305556e 100644 --- a/sw/inc/paratr.hxx +++ b/sw/inc/paratr.hxx @@ -202,37 +202,37 @@ inline SwParaConnectBorderItem& SwParaConnectBorderItem::operator=( // Implementation of paragraph-attributes methods of SwAttrSet inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(bool bInP) const - { return static_cast<const SvxLineSpacingItem&>(Get( RES_PARATR_LINESPACING,bInP)); } + { return Get( RES_PARATR_LINESPACING,bInP); } inline const SvxAdjustItem &SwAttrSet::GetAdjust(bool bInP) const - { return static_cast<const SvxAdjustItem&>(Get( RES_PARATR_ADJUST,bInP)); } + { return Get( RES_PARATR_ADJUST,bInP); } inline const SvxFormatSplitItem &SwAttrSet::GetSplit(bool bInP) const - { return static_cast<const SvxFormatSplitItem&>(Get( RES_PARATR_SPLIT,bInP)); } + { return Get( RES_PARATR_SPLIT,bInP); } inline const SwRegisterItem &SwAttrSet::GetRegister(bool bInP) const - { return static_cast<const SwRegisterItem&>(Get( RES_PARATR_REGISTER,bInP)); } + { return Get( RES_PARATR_REGISTER,bInP); } inline const SvxWidowsItem &SwAttrSet::GetWidows(bool bInP) const - { return static_cast<const SvxWidowsItem&>(Get( RES_PARATR_WIDOWS,bInP)); } + { return Get( RES_PARATR_WIDOWS,bInP); } inline const SvxOrphansItem &SwAttrSet::GetOrphans(bool bInP) const - { return static_cast<const SvxOrphansItem&>(Get( RES_PARATR_ORPHANS,bInP)); } + { return Get( RES_PARATR_ORPHANS,bInP); } inline const SvxTabStopItem &SwAttrSet::GetTabStops(bool bInP) const - { return static_cast<const SvxTabStopItem&>(Get( RES_PARATR_TABSTOP,bInP)); } + { return Get( RES_PARATR_TABSTOP,bInP); } inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(bool bInP) const - { return static_cast<const SvxHyphenZoneItem&>(Get(RES_PARATR_HYPHENZONE,bInP)); } + { return Get(RES_PARATR_HYPHENZONE,bInP); } inline const SwFormatDrop &SwAttrSet::GetDrop(bool bInP) const - { return static_cast<const SwFormatDrop&>(Get(RES_PARATR_DROP,bInP)); } + { return Get(RES_PARATR_DROP,bInP); } inline const SwNumRuleItem &SwAttrSet::GetNumRule(bool bInP) const - { return static_cast<const SwNumRuleItem&>(Get(RES_PARATR_NUMRULE,bInP)); } + { return Get(RES_PARATR_NUMRULE,bInP); } inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(bool bInP) const - { return static_cast<const SvxScriptSpaceItem&>(Get(RES_PARATR_SCRIPTSPACE,bInP)); } + { return Get(RES_PARATR_SCRIPTSPACE,bInP); } inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(bool bInP) const - { return static_cast<const SvxHangingPunctuationItem&>(Get(RES_PARATR_HANGINGPUNCTUATION,bInP)); } + { return Get(RES_PARATR_HANGINGPUNCTUATION,bInP); } inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(bool bInP) const - { return static_cast<const SvxForbiddenRuleItem&>(Get(RES_PARATR_FORBIDDEN_RULES, bInP)); } + { return Get(RES_PARATR_FORBIDDEN_RULES, bInP); } inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(bool bInP) const - { return static_cast<const SvxParaVertAlignItem&>(Get( RES_PARATR_VERTALIGN, bInP )); } + { return Get( RES_PARATR_VERTALIGN, bInP ); } inline const SvxParaGridItem &SwAttrSet::GetParaGrid(bool bInP) const - { return static_cast<const SvxParaGridItem&>(Get( RES_PARATR_SNAPTOGRID, bInP )); } + { return Get( RES_PARATR_SNAPTOGRID, bInP ); } inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(bool bInP) const - { return static_cast<const SwParaConnectBorderItem&>(Get( RES_PARATR_CONNECT_BORDER, bInP )); } + { return Get( RES_PARATR_CONNECT_BORDER, bInP ); } // Implementation of paragraph-attributes methods of SwFormat inline const SvxLineSpacingItem &SwFormat::GetLineSpacing(bool bInP) const diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 89ca0a775383..69ff0a74e643 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -57,6 +57,7 @@ #include <editeng/scripttypeitem.hxx> #include <editeng/fontitem.hxx> #include <editeng/wghtitem.hxx> +#include <editeng/rsiditem.hxx> #include <i18nutil/transliteration.hxx> #include <i18nutil/searchopt.hxx> #include <reffld.hxx> diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index ffc1833d6e2c..abcafa39111a 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -1514,8 +1514,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId ) case RES_POOLCHR_RUBYTEXT: { - long nH = static_cast<const SvxFontHeightItem*>(GetDfltAttr( - RES_CHRATR_CJK_FONTSIZE ))->GetHeight() / 2; + long nH = GetDfltAttr( RES_CHRATR_CJK_FONTSIZE )->GetHeight() / 2; SetAllScriptItem( aSet, SvxFontHeightItem( nH, 100, RES_CHRATR_FONTSIZE)); aSet.Put(SvxUnderlineItem( LINESTYLE_NONE, RES_CHRATR_UNDERLINE )); aSet.Put(SvxEmphasisMarkItem( FontEmphasisMark::NONE, RES_CHRATR_EMPHASIS_MARK) ); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 191d5bcb28bb..8cd67e260830 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -631,7 +631,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) // we don't calculate the same value on the same TabStop (pooled!) for all sets. // We send a FormatChg to modify. SwTwips nNewWidth = (*static_cast<const SvxTabStopItem*>(pTmpItem))[ 0 ].GetTabPos(), - nOldWidth = static_cast<const SvxTabStopItem&>(aOld.Get(RES_PARATR_TABSTOP))[ 0 ].GetTabPos(); + nOldWidth = aOld.Get(RES_PARATR_TABSTOP)[ 0 ].GetTabPos(); bool bChg = false; sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_PARATR_TABSTOP ); diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index ba5d238f1a62..885a93a6350f 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -262,17 +262,17 @@ void SwAfVersions::Load( SvStream& rStream, sal_uInt16 nVer ) } SwBoxAutoFormat::SwBoxAutoFormat() - : m_aFont( *static_cast<const SvxFontItem*>(GetDfltAttr( RES_CHRATR_FONT )) ), + : m_aFont( *GetDfltAttr( RES_CHRATR_FONT ) ), m_aHeight( 240, 100, RES_CHRATR_FONTSIZE ), m_aWeight( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ), m_aPosture( ITALIC_NONE, RES_CHRATR_POSTURE ), - m_aCJKFont( *static_cast<const SvxFontItem*>(GetDfltAttr( RES_CHRATR_CJK_FONT )) ), + m_aCJKFont( *GetDfltAttr( RES_CHRATR_CJK_FONT ) ), m_aCJKHeight( 240, 100, RES_CHRATR_CJK_FONTSIZE ), m_aCJKWeight( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ), m_aCJKPosture( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ), - m_aCTLFont( *static_cast<const SvxFontItem*>(GetDfltAttr( RES_CHRATR_CTL_FONT )) ), + m_aCTLFont( *GetDfltAttr( RES_CHRATR_CTL_FONT ) ), m_aCTLHeight( 240, 100, RES_CHRATR_CTL_FONTSIZE ), m_aCTLWeight( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ), m_aCTLPosture( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ), @@ -759,7 +759,7 @@ void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos, pFormat->SetContour( rSet.Get( RES_CHRATR_CONTOUR ) ); pFormat->SetShadowed( rSet.Get( RES_CHRATR_SHADOWED ) ); pFormat->SetColor( rSet.Get( RES_CHRATR_COLOR ) ); - pFormat->SetAdjust( static_cast<const SvxAdjustItem&>(rSet.Get( RES_PARATR_ADJUST )) ); + pFormat->SetAdjust( rSet.Get( RES_PARATR_ADJUST ) ); } if( UPDATE_BOX & eFlags ) { diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index c18eabd9b5e4..e5f65cd2168b 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -1529,8 +1529,7 @@ void SwTextFrame::FillCursorPos( SwFillData& rFill ) const else { const SvxTabStopItem& rTab = - static_cast<const SvxTabStopItem &>(pSet-> - GetPool()->GetDefaultItem( RES_PARATR_TABSTOP )); + pSet->GetPool()->GetDefaultItem( RES_PARATR_TABSTOP ); const SwTwips nDefTabDist = rTab[0].GetTabPos(); nRightTab = nLeftTab - nTextLeft; nRightTab /= nDefTabDist; diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 08582e0c1387..9dc567118f9f 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -149,8 +149,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto if( USHRT_MAX == nDefTabDist ) { const SvxTabStopItem& rTab = - static_cast<const SvxTabStopItem &>(m_pFrame->GetAttrSet()-> - GetPool()->GetDefaultItem( RES_PARATR_TABSTOP )); + m_pFrame->GetAttrSet()->GetPool()->GetDefaultItem( RES_PARATR_TABSTOP ); if( rTab.Count() ) nDefTabDist = (sal_uInt16)rTab[0].GetTabPos(); else diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 61b6dcd9feb2..94c11d3d8b63 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -98,6 +98,7 @@ #include <editeng/twolinesitem.hxx> #include <editeng/udlnitem.hxx> #include <editeng/wghtitem.hxx> +#include <editeng/adjustitem.hxx> #include <svx/xdef.hxx> #include "unomapproperties.hxx" diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx index d610e76d09f0..16302aecf264 100644 --- a/sw/source/core/unocore/unomap1.cxx +++ b/sw/source/core/unocore/unomap1.cxx @@ -99,6 +99,7 @@ #include <editeng/escapementitem.hxx> #include <editeng/fhgtitem.hxx> #include <editeng/fontitem.hxx> +#include <editeng/hyphenzoneitem.hxx> #include <editeng/kernitem.hxx> #include <editeng/langitem.hxx> #include <editeng/memberids.h> @@ -114,6 +115,7 @@ #include <editeng/wrlmitem.hxx> #include <svl/grabbagitem.hxx> #include <svx/xdef.hxx> +#include <paratr.hxx> #include "unomapproperties.hxx" using namespace ::com::sun::star; diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 3839de130984..781abb30f833 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1748,7 +1748,7 @@ void SwXStyle::SetPropertyValue<FN_UNO_NUM_RULES>(const SfxItemPropertySimpleEnt o_rStyleBase.getNewBase()->SetNumRule(aSetRule); } template<> -void SwXStyle::SetPropertyValue<RES_PARATR_OUTLINELEVEL>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) +void SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_OUTLINELEVEL)>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) { if(!rValue.has<sal_Int16>()) return; @@ -1922,7 +1922,7 @@ void SwXStyle::SetPropertyValue<RES_TXTATR_CJK_RUBY>(const SfxItemPropertySimple SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, rValue, o_rStyleBase); } template<> -void SwXStyle::SetPropertyValue<RES_PARATR_DROP>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) +void SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_DROP)>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) { if(MID_DROPCAP_CHAR_STYLE_NAME != rEntry.nMemberId) { @@ -1951,7 +1951,7 @@ void SwXStyle::SetPropertyValue<RES_PARATR_DROP>(const SfxItemPropertySimpleEntr rStyleSet.Put(*pDrop); } template<> -void SwXStyle::SetPropertyValue<RES_PARATR_NUMRULE>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) +void SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_NUMRULE)>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) { uno::Any aValue(rValue); lcl_TranslateMetric(rEntry, m_pDoc, aValue); @@ -1988,7 +1988,7 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const { OWN_ATTR_FILLBMP_MODE, std::mem_fn(&SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>) }, { RES_PAPER_BIN, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PAPER_BIN>) }, { FN_UNO_NUM_RULES, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_NUM_RULES>) }, - { RES_PARATR_OUTLINELEVEL, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PARATR_OUTLINELEVEL>) }, + { RES_PARATR_OUTLINELEVEL, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_OUTLINELEVEL)>) }, { FN_UNO_FOLLOW_STYLE, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_FOLLOW_STYLE>) }, { RES_PAGEDESC, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PAGEDESC>) }, { RES_TEXT_VERT_ADJUST, std::mem_fn(&SwXStyle::SetPropertyValue<RES_TEXT_VERT_ADJUST>) }, @@ -1997,8 +1997,8 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const { FN_UNO_CATEGORY, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_CATEGORY>) }, { SID_SWREGISTER_COLLECTION, std::mem_fn(&SwXStyle::SetPropertyValue<SID_SWREGISTER_COLLECTION>) }, { RES_TXTATR_CJK_RUBY, std::mem_fn(&SwXStyle::SetPropertyValue<RES_TXTATR_CJK_RUBY>) }, - { RES_PARATR_DROP, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PARATR_DROP>) }, - { RES_PARATR_NUMRULE, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PARATR_NUMRULE>) } + { RES_PARATR_DROP, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_DROP)>) }, + { RES_PARATR_NUMRULE, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_NUMRULE)>) } }); } const auto pUnoToCoreIt(pUnoToCore->find(rEntry.nWID)); @@ -2156,7 +2156,7 @@ uno::Any SwXStyle::GetStyleProperty<FN_UNO_NUM_RULES>(const SfxItemPropertySimpl return uno::makeAny<uno::Reference<container::XIndexReplace>>(xRules); } template<> -uno::Any SwXStyle::GetStyleProperty<RES_PARATR_OUTLINELEVEL>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase) +uno::Any SwXStyle::GetStyleProperty<sal_uInt16(RES_PARATR_OUTLINELEVEL)>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase) { PrepareStyleBase(rBase); SAL_WARN_IF(SfxStyleFamily::Para != GetFamily(), "sw.uno", "only paras"); @@ -2333,7 +2333,7 @@ uno::Any SwXStyle::GetStyleProperty_Impl(const SfxItemPropertySimpleEntry& rEntr { FN_UNO_STYLE_INTEROP_GRAB_BAG, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_STYLE_INTEROP_GRAB_BAG>) }, { RES_PAPER_BIN, std::mem_fn(&SwXStyle::GetStyleProperty<RES_PAPER_BIN>) }, { FN_UNO_NUM_RULES, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_NUM_RULES>) }, - { RES_PARATR_OUTLINELEVEL, std::mem_fn(&SwXStyle::GetStyleProperty<RES_PARATR_OUTLINELEVEL>) }, + { RES_PARATR_OUTLINELEVEL, std::mem_fn(&SwXStyle::GetStyleProperty<sal_uInt16(RES_PARATR_OUTLINELEVEL)>) }, { FN_UNO_FOLLOW_STYLE, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_FOLLOW_STYLE>) }, { RES_PAGEDESC, std::mem_fn(&SwXStyle::GetStyleProperty<RES_PAGEDESC>) }, { FN_UNO_IS_AUTO_UPDATE, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_IS_AUTO_UPDATE>) }, diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 779719756a85..3a7454098294 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1171,7 +1171,7 @@ void RtfExport::OutColorTable() // char color { - auto pCol = static_cast<const SvxColorItem*>(GetDfltAttr(RES_CHRATR_COLOR)); + auto pCol = GetDfltAttr(RES_CHRATR_COLOR); InsColor(pCol->GetValue()); if ((pCol = rPool.GetPoolDefaultItem(RES_CHRATR_COLOR))) InsColor(pCol->GetValue()); @@ -1182,7 +1182,7 @@ void RtfExport::OutColorTable() InsColor(pCol->GetValue()); } - auto pUnder = static_cast<const SvxUnderlineItem*>(GetDfltAttr(RES_CHRATR_UNDERLINE)); + auto pUnder = GetDfltAttr(RES_CHRATR_UNDERLINE); InsColor(pUnder->GetColor()); nMaxItem = rPool.GetItemCount2(RES_CHRATR_UNDERLINE); for (sal_uInt32 n = 0; n < nMaxItem; ++n) @@ -1191,7 +1191,7 @@ void RtfExport::OutColorTable() InsColor(pUnder->GetColor()); } - auto pOver = static_cast<const SvxOverlineItem*>(GetDfltAttr(RES_CHRATR_OVERLINE)); + auto pOver = GetDfltAttr(RES_CHRATR_OVERLINE); InsColor(pOver->GetColor()); nMaxItem = rPool.GetItemCount2(RES_CHRATR_OVERLINE); for (sal_uInt32 n = 0; n < nMaxItem; ++n) diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index ff371d39f342..a61cbbc76e81 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -849,7 +849,7 @@ void wwFontHelper::InitFontTable(const SwDoc& rDoc) GetId(wwFont("Arial", PITCH_VARIABLE, FAMILY_SWISS, RTL_TEXTENCODING_MS_1252)); - const SvxFontItem* pFont = static_cast<const SvxFontItem*>(GetDfltAttr(RES_CHRATR_FONT)); + const SvxFontItem* pFont = GetDfltAttr(RES_CHRATR_FONT); GetId(wwFont(pFont->GetFamilyName(), pFont->GetPitch(), pFont->GetFamily(), pFont->GetCharSet())); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index c33b07057738..4eff211a0ada 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4155,7 +4155,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe aLR.SetTextLeft(pNumFormat->GetIndentAt()); // If have not explicit left, set number format list tab position is doc default tab - const SvxTabStopItem *pDefaultStopItem = static_cast<const SvxTabStopItem *>(m_rDoc.GetAttrPool().GetPoolDefaultItem(RES_PARATR_TABSTOP)); + const SvxTabStopItem *pDefaultStopItem = m_rDoc.GetAttrPool().GetPoolDefaultItem(RES_PARATR_TABSTOP); if ( pDefaultStopItem && pDefaultStopItem->Count() > 0 ) const_cast<SwNumFormat*>(pNumFormat)->SetListtabPos( const_cast<SvxTabStop&>((*pDefaultStopItem)[0]).GetTabPos() ); } diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index 7298f3e4e643..3e79b84c2dd9 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -633,7 +633,7 @@ bool SwDropCapsPage::FillItemSet(SfxItemSet *rSet) void SwDropCapsPage::Reset(const SfxItemSet *rSet) { // Characters, lines, gap and text - SwFormatDrop aFormatDrop(static_cast<const SwFormatDrop &>( rSet->Get(RES_PARATR_DROP))); + SwFormatDrop aFormatDrop( rSet->Get(RES_PARATR_DROP) ); if (aFormatDrop.GetLines() > 1) { m_pDropCapsField->SetValue(aFormatDrop.GetChars()); diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index cdc602bcb29a..6a1371e4926c 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -299,8 +299,8 @@ IMPL_LINK( SwEnvFormatPage, EditHdl, MenuButton *, pButton, void ) SfxAllItemSet aTmpSet(*pCollSet); // Insert tabs, default tabs into ItemSet - const SvxTabStopItem& rDefTabs = static_cast<const SvxTabStopItem&>( - pSh->GetView().GetCurShell()->GetPool().GetDefaultItem(RES_PARATR_TABSTOP)); + const SvxTabStopItem& rDefTabs = + pSh->GetView().GetCurShell()->GetPool().GetDefaultItem(RES_PARATR_TABSTOP); const sal_uInt16 nDefDist = static_cast<sal_uInt16>(::GetTabDist( rDefTabs )); SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist ); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 4e210a2d2c84..246d2958f212 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -937,8 +937,8 @@ void SwTextShell::Execute(SfxRequest &rReq) ::GetHtmlMode(GetView().GetDocShell()))); // Tabulators: Put DefaultTabs into ItemSet - const SvxTabStopItem& rDefTabs = static_cast<const SvxTabStopItem&>( - GetPool().GetDefaultItem(RES_PARATR_TABSTOP)); + const SvxTabStopItem& rDefTabs = + GetPool().GetDefaultItem(RES_PARATR_TABSTOP); const sal_uInt16 nDefDist = static_cast<sal_uInt16>(::GetTabDist( rDefTabs )); SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist ); diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx index 2dee9246a730..101d0d3a1122 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -320,7 +320,7 @@ void SwTextShell::ExecParaAttr(SfxRequest &rReq) { if( pArgs && SfxItemState::SET == pArgs->GetItemState(RES_PARATR_ADJUST) ) { - const SvxAdjustItem& rAdj = static_cast<const SvxAdjustItem&>( pArgs->Get(RES_PARATR_ADJUST) ); + const SvxAdjustItem& rAdj = pArgs->Get(RES_PARATR_ADJUST); SvxAdjustItem aAdj( rAdj.GetAdjust(), RES_PARATR_ADJUST ); if ( rAdj.GetAdjust() == SvxAdjust::Block ) { @@ -378,8 +378,8 @@ SET_LINESPACE: SfxItemState eAdjustState = aAdjustSet.GetItemState(RES_PARATR_ADJUST, false); if(eAdjustState >= SfxItemState::DEFAULT) { - SvxAdjust eAdjust = static_cast<const SvxAdjustItem& >( - aAdjustSet.Get(RES_PARATR_ADJUST)).GetAdjust(); + SvxAdjust eAdjust = + aAdjustSet.Get(RES_PARATR_ADJUST).GetAdjust(); bChgAdjust = (SvxAdjust::Left == eAdjust && SID_ATTR_PARA_RIGHT_TO_LEFT == nSlot) || (SvxAdjust::Right == eAdjust && SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot); } @@ -459,7 +459,7 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq) OUString sCharStyleName = static_cast<const SfxStringItem*>(pItem)->GetValue(); SfxItemSet aSet(GetPool(), svl::Items<RES_PARATR_DROP, RES_PARATR_DROP>{}); rSh.GetCurAttr(aSet); - SwFormatDrop aDropItem(static_cast<const SwFormatDrop&>(aSet.Get(RES_PARATR_DROP))); + SwFormatDrop aDropItem(aSet.Get(RES_PARATR_DROP)); SwCharFormat* pFormat = nullptr; if(!sCharStyleName.isEmpty()) pFormat = rSh.FindCharFormatByName( sCharStyleName ); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 4cb021a90f3c..e54def7c5d2b 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -139,6 +139,7 @@ #include <vcl/GraphicNativeMetadata.hxx> #include <vcl/settings.hxx> #include <i18nutil/searchopt.hxx> +#include <paratr.hxx> #include <memory> @@ -1505,8 +1506,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) aSet.GetItemState(RES_PARATR_NUMRULE)) { const OUString& rNumStyle = - static_cast<const SfxStringItem &>( - aSet.Get(RES_PARATR_NUMRULE)).GetValue(); + aSet.Get(RES_PARATR_NUMRULE).GetValue(); if(!rNumStyle.isEmpty()) { if(!sStr.isEmpty()) diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 67667185360a..773c3aeef388 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -711,7 +711,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq ) SfxItemSet aSet( GetPool(), svl::Items<RES_PARATR_TABSTOP, RES_PARATR_TABSTOP>{} ); rSh.GetCurAttr( aSet ); - const SvxTabStopItem& rTabStops = static_cast<const SvxTabStopItem&>(aSet.Get(RES_PARATR_TABSTOP)); + const SvxTabStopItem& rTabStops = aSet.Get(RES_PARATR_TABSTOP); // Do we have a tab at position zero? sal_uInt16 i; @@ -1433,8 +1433,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) rSet.DisableItem( nWhich ); else { - SvxTabStopItem aTabStops(static_cast<const SvxTabStopItem&>( - aCoreSet.Get( RES_PARATR_TABSTOP ))); + SvxTabStopItem aTabStops(aCoreSet.Get( RES_PARATR_TABSTOP )); const SvxTabStopItem& rDefTabs = static_cast<const SvxTabStopItem&>( rSh.GetDefault(RES_PARATR_TABSTOP)); |