summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-05-24 16:40:59 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-05-25 07:52:21 +0200
commit839c5010241842835a1c066be0838df4a8a53dc7 (patch)
tree5b8d8afe549a7aab39f20dbd04e7f134aa577e13
parent9a4b768b0a22bd3ae627c7355bbd223b9cf65015 (diff)
use more TypedWhichId in editeng
Change-Id: I2eb2b50ef7002e23221c985ab3218617b3832aa7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152203 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--cui/source/tabpages/page.cxx20
-rw-r--r--cui/source/tabpages/paragrph.cxx3
-rw-r--r--editeng/source/rtf/rtfitem.cxx133
-rw-r--r--editeng/source/rtf/svxrtf.cxx10
-rw-r--r--forms/source/richtext/rtattributehandler.cxx6
-rw-r--r--forms/source/richtext/specialdispatchers.cxx2
-rw-r--r--include/editeng/editids.hrc111
-rw-r--r--include/editeng/svxrtf.hxx15
-rw-r--r--sd/source/ui/func/bulmaper.cxx20
-rw-r--r--svx/source/dialog/hdft.cxx18
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.cxx3
-rw-r--r--sw/source/uibase/frmdlg/colex.cxx12
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx6
13 files changed, 192 insertions, 167 deletions
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 662ec9dd59ce..d939f0949018 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -1249,13 +1249,13 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
{
const SvxSizeItem& rSize =
rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
- const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
- rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
+ const SvxULSpaceItem& rUL =
+ rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
tools::Long nDist = rUL.GetLower();
m_aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
m_aBspWin.SetHdDist( nDist );
- const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
- rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
+ const SvxLRSpaceItem& rLR =
+ rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
m_aBspWin.SetHdLeft( rLR.GetLeft() );
m_aBspWin.SetHdRight( rLR.GetRight() );
m_aBspWin.SetHeader( true );
@@ -1304,13 +1304,13 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet )
{
const SvxSizeItem& rSize =
rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
- const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
- rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
+ const SvxULSpaceItem& rUL =
+ rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
tools::Long nDist = rUL.GetUpper();
m_aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
m_aBspWin.SetFtDist( nDist );
- const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
- rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
+ const SvxLRSpaceItem& rLR =
+ rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
m_aBspWin.SetFtLeft( rLR.GetLeft() );
m_aBspWin.SetFtRight( rLR.GetRight() );
m_aBspWin.SetFooter( true );
@@ -1435,8 +1435,8 @@ void SvxPageDescPage::RangeHdl_Impl()
SfxItemState::DEFAULT )
{
aBorder = GetMinBorderSpace_Impl(
- static_cast<const SvxShadowItem&>(_pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW))),
- static_cast<const SvxBoxItem&>(_pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER))));
+ _pSet->Get(GetWhich(SID_ATTR_BORDER_SHADOW)),
+ _pSet->Get(GetWhich(SID_ATTR_BORDER_OUTER)));
}
// limits paper
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 8a3b443cae42..483c41e6f9e2 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -45,6 +45,9 @@
#include <editeng/lrspitem.hxx>
#include <editeng/formatbreakitem.hxx>
#include <editeng/keepitem.hxx>
+#include <editeng/scriptspaceitem.hxx>
+#include <editeng/hngpnctitem.hxx>
+#include <editeng/forbiddenruleitem.hxx>
#include <svx/dlgutil.hxx>
#include <sfx2/htmlmode.hxx>
#include <editeng/paravertalignitem.hxx>
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index b74b118791d1..7abfccbd452b 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -77,37 +77,39 @@ using namespace editeng;
void SvxRTFParser::SetScriptAttr( RTF_CharTypeDef eType, SfxItemSet& rSet,
SfxPoolItem& rItem )
{
- const sal_uInt16 *pNormal = nullptr, *pCJK = nullptr, *pCTL = nullptr;
+ std::optional<sal_uInt16> pNormal;
+ std::optional<sal_uInt16> pCJK;
+ std::optional<sal_uInt16> pCTL;
switch( rItem.Which() )
{
case SID_ATTR_CHAR_FONT:
- pNormal = &aPlainMap[SID_ATTR_CHAR_FONT];
- pCJK = &aPlainMap[SID_ATTR_CHAR_CJK_FONT];
- pCTL = &aPlainMap[SID_ATTR_CHAR_CTL_FONT];
+ pNormal = aPlainMap[SID_ATTR_CHAR_FONT];
+ pCJK = aPlainMap[SID_ATTR_CHAR_CJK_FONT];
+ pCTL = aPlainMap[SID_ATTR_CHAR_CTL_FONT];
break;
case SID_ATTR_CHAR_FONTHEIGHT:
- pNormal = &aPlainMap[SID_ATTR_CHAR_FONTHEIGHT];
- pCJK = &aPlainMap[SID_ATTR_CHAR_CJK_FONTHEIGHT];
- pCTL = &aPlainMap[SID_ATTR_CHAR_CTL_FONTHEIGHT];
+ pNormal = aPlainMap[SID_ATTR_CHAR_FONTHEIGHT];
+ pCJK = aPlainMap[SID_ATTR_CHAR_CJK_FONTHEIGHT];
+ pCTL = aPlainMap[SID_ATTR_CHAR_CTL_FONTHEIGHT];
break;
case SID_ATTR_CHAR_POSTURE:
- pNormal = &aPlainMap[SID_ATTR_CHAR_POSTURE];
- pCJK = &aPlainMap[SID_ATTR_CHAR_CJK_POSTURE];
- pCTL = &aPlainMap[SID_ATTR_CHAR_CTL_POSTURE];
+ pNormal = aPlainMap[SID_ATTR_CHAR_POSTURE];
+ pCJK = aPlainMap[SID_ATTR_CHAR_CJK_POSTURE];
+ pCTL = aPlainMap[SID_ATTR_CHAR_CTL_POSTURE];
break;
case SID_ATTR_CHAR_WEIGHT:
- pNormal = &aPlainMap[SID_ATTR_CHAR_WEIGHT];
- pCJK = &aPlainMap[SID_ATTR_CHAR_CJK_WEIGHT];
- pCTL = &aPlainMap[SID_ATTR_CHAR_CTL_WEIGHT];
+ pNormal = aPlainMap[SID_ATTR_CHAR_WEIGHT];
+ pCJK = aPlainMap[SID_ATTR_CHAR_CJK_WEIGHT];
+ pCTL = aPlainMap[SID_ATTR_CHAR_CTL_WEIGHT];
break;
case SID_ATTR_CHAR_LANGUAGE:
- pNormal = &aPlainMap[SID_ATTR_CHAR_LANGUAGE];
- pCJK = &aPlainMap[SID_ATTR_CHAR_CJK_LANGUAGE];
- pCTL = &aPlainMap[SID_ATTR_CHAR_CTL_LANGUAGE];
+ pNormal = aPlainMap[SID_ATTR_CHAR_LANGUAGE];
+ pCJK = aPlainMap[SID_ATTR_CHAR_CJK_LANGUAGE];
+ pCTL = aPlainMap[SID_ATTR_CHAR_CTL_LANGUAGE];
break;
case 0:
@@ -267,55 +269,55 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
break;
case RTF_KEEP:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_SPLIT])
+ if (const TypedWhichId<SvxFormatSplitItem> wid = aPardMap[SID_ATTR_PARA_SPLIT])
{
pSet->Put(SvxFormatSplitItem(false, wid));
}
break;
case RTF_KEEPN:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_KEEP])
+ if (const TypedWhichId<SvxFormatKeepItem> wid = aPardMap[SID_ATTR_PARA_KEEP])
{
pSet->Put(SvxFormatKeepItem(true, wid));
}
break;
case RTF_LEVEL:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_OUTLLEVEL])
+ if (const TypedWhichId<SfxInt16Item> wid = aPardMap[SID_ATTR_PARA_OUTLLEVEL])
{
pSet->Put(SfxInt16Item(wid, static_cast<sal_uInt16>(nTokenValue)));
}
break;
case RTF_QL:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_ADJUST])
+ if (const TypedWhichId<SvxAdjustItem> wid = aPardMap[SID_ATTR_PARA_ADJUST])
{
pSet->Put(SvxAdjustItem(SvxAdjust::Left, wid));
}
break;
case RTF_QR:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_ADJUST])
+ if (const TypedWhichId<SvxAdjustItem> wid = aPardMap[SID_ATTR_PARA_ADJUST])
{
pSet->Put(SvxAdjustItem(SvxAdjust::Right, wid));
}
break;
case RTF_QJ:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_ADJUST])
+ if (const TypedWhichId<SvxAdjustItem> wid = aPardMap[SID_ATTR_PARA_ADJUST])
{
pSet->Put(SvxAdjustItem(SvxAdjust::Block, wid));
}
break;
case RTF_QC:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_ADJUST])
+ if (const TypedWhichId<SvxAdjustItem> wid = aPardMap[SID_ATTR_PARA_ADJUST])
{
pSet->Put(SvxAdjustItem(SvxAdjust::Center, wid));
}
break;
case RTF_FI:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_LRSPACE])
+ if (const TypedWhichId<SvxLRSpaceItem> wid = aPardMap[SID_ATTR_LRSPACE])
{
- SvxLRSpaceItem aLR(static_cast<const SvxLRSpaceItem&>(pSet->Get(wid)));
+ SvxLRSpaceItem aLR(pSet->Get(wid));
sal_uInt16 nSz = 0;
if( -1 != nTokenValue )
{
@@ -330,9 +332,9 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
case RTF_LI:
case RTF_LIN:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_LRSPACE])
+ if (const TypedWhichId<SvxLRSpaceItem> wid = aPardMap[SID_ATTR_LRSPACE])
{
- SvxLRSpaceItem aLR(static_cast<const SvxLRSpaceItem&>(pSet->Get(wid)));
+ SvxLRSpaceItem aLR(pSet->Get(wid));
sal_uInt16 nSz = 0;
if( 0 < nTokenValue )
{
@@ -347,9 +349,9 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
case RTF_RI:
case RTF_RIN:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_LRSPACE])
+ if (const TypedWhichId<SvxLRSpaceItem> wid = aPardMap[SID_ATTR_LRSPACE])
{
- SvxLRSpaceItem aLR(static_cast<const SvxLRSpaceItem&>(pSet->Get(wid)));
+ SvxLRSpaceItem aLR(pSet->Get(wid));
sal_uInt16 nSz = 0;
if( 0 < nTokenValue )
{
@@ -363,9 +365,9 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
break;
case RTF_SB:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_ULSPACE])
+ if (const TypedWhichId<SvxULSpaceItem> wid = aPardMap[SID_ATTR_ULSPACE])
{
- SvxULSpaceItem aUL(static_cast<const SvxULSpaceItem&>(pSet->Get(wid)));
+ SvxULSpaceItem aUL(pSet->Get(wid));
sal_uInt16 nSz = 0;
if( 0 < nTokenValue )
{
@@ -379,9 +381,9 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
break;
case RTF_SA:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_ULSPACE])
+ if (const TypedWhichId<SvxULSpaceItem> wid = aPardMap[SID_ATTR_ULSPACE])
{
- SvxULSpaceItem aUL(static_cast<const SvxULSpaceItem&>(pSet->Get(wid)));
+ SvxULSpaceItem aUL(pSet->Get(wid));
sal_uInt16 nSz = 0;
if( 0 < nTokenValue )
{
@@ -395,12 +397,11 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
break;
case RTF_SLMULT:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_LINESPACE];
+ if (const TypedWhichId<SvxLineSpacingItem> wid = aPardMap[SID_ATTR_PARA_LINESPACE];
wid && 1 == nTokenValue)
{
// then switches to multi-line!
- SvxLineSpacingItem aLSpace(
- static_cast<const SvxLineSpacingItem&>(pSet->Get(wid, false)));
+ SvxLineSpacingItem aLSpace(pSet->Get(wid, false));
// how much do you get from the line height value?
@@ -421,7 +422,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
break;
case RTF_SL:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_LINESPACE])
+ if (const TypedWhichId<SvxLineSpacingItem> wid = aPardMap[SID_ATTR_PARA_LINESPACE])
{
// Calculate the ratio between the default font and the
// specified size. The distance consists of the line height
@@ -459,20 +460,20 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
break;
case RTF_NOCWRAP:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_FORBIDDEN_RULES])
+ if (const TypedWhichId<SvxForbiddenRuleItem> wid = aPardMap[SID_ATTR_PARA_FORBIDDEN_RULES])
{
pSet->Put(SvxForbiddenRuleItem(false, wid));
}
break;
case RTF_NOOVERFLOW:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_HANGPUNCTUATION])
+ if (const TypedWhichId<SvxHangingPunctuationItem> wid = aPardMap[SID_ATTR_PARA_HANGPUNCTUATION])
{
pSet->Put(SvxHangingPunctuationItem(false, wid));
}
break;
case RTF_ASPALPHA:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_PARA_SCRIPTSPACE])
+ if (const TypedWhichId<SvxScriptSpaceItem> wid = aPardMap[SID_ATTR_PARA_SCRIPTSPACE])
{
pSet->Put(SvxScriptSpaceItem(true, wid));
}
@@ -490,7 +491,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet )
case RTF_FAROMAN: nFontAlign = SvxParaVertAlignItem::Align::Baseline;
goto SET_FONTALIGNMENT;
SET_FONTALIGNMENT:
- if (const sal_uInt16 wid = aPardMap[SID_PARA_VERTALIGN])
+ if (const TypedWhichId<SvxParaVertAlignItem> wid = aPardMap[SID_PARA_VERTALIGN])
{
pSet->Put(SvxParaVertAlignItem(nFontAlign, wid));
}
@@ -644,7 +645,7 @@ SET_FONTALIGNMENT:
break;
case RTF_OUTL:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_CONTOUR];
+ if (const TypedWhichId<SvxContourItem> wid = aPlainMap[SID_ATTR_CHAR_CONTOUR];
wid && IsAttrSttPos()) // not in the text flow?
{
pSet->Put(SvxContourItem(nTokenValue != 0, wid));
@@ -652,7 +653,7 @@ SET_FONTALIGNMENT:
break;
case RTF_SHAD:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_SHADOWED];
+ if (const TypedWhichId<SvxShadowedItem> wid = aPlainMap[SID_ATTR_CHAR_SHADOWED];
wid && IsAttrSttPos()) // not in the text flow?
{
pSet->Put(SvxShadowedItem(nTokenValue != 0, wid));
@@ -660,7 +661,7 @@ SET_FONTALIGNMENT:
break;
case RTF_STRIKE:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_STRIKEOUT];
+ if (const TypedWhichId<SvxCrossedOutItem> wid = aPlainMap[SID_ATTR_CHAR_STRIKEOUT];
wid && IsAttrSttPos()) // not in the text flow?
{
pSet->Put( SvxCrossedOutItem(
@@ -670,7 +671,7 @@ SET_FONTALIGNMENT:
break;
case RTF_STRIKED:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_STRIKEOUT]) // not in the text flow?
+ if (const TypedWhichId<SvxCrossedOutItem> wid = aPlainMap[SID_ATTR_CHAR_STRIKEOUT]) // not in the text flow?
{
pSet->Put( SvxCrossedOutItem(
nTokenValue ? STRIKEOUT_DOUBLE : STRIKEOUT_NONE,
@@ -736,7 +737,7 @@ SET_FONTALIGNMENT:
case RTF_ULW:
eUnderline = LINESTYLE_SINGLE;
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_WORDLINEMODE])
+ if (const TypedWhichId<SvxWordLineModeItem> wid = aPlainMap[SID_ATTR_CHAR_WORDLINEMODE])
{
pSet->Put(SvxWordLineModeItem(true, wid));
}
@@ -837,21 +838,21 @@ ATTR_SETUNDERLINE:
case RTF_OLW:
eOverline = LINESTYLE_SINGLE;
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_WORDLINEMODE])
+ if (const TypedWhichId<SvxWordLineModeItem> wid = aPlainMap[SID_ATTR_CHAR_WORDLINEMODE])
{
pSet->Put(SvxWordLineModeItem(true, wid));
}
goto ATTR_SETOVERLINE;
ATTR_SETOVERLINE:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_OVERLINE])
+ if (const TypedWhichId<SvxOverlineItem> wid = aPlainMap[SID_ATTR_CHAR_OVERLINE])
{
pSet->Put(SvxOverlineItem(eOverline, wid));
}
break;
case RTF_OLC:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_OVERLINE])
+ if (const TypedWhichId<SvxOverlineItem> wid = aPlainMap[SID_ATTR_CHAR_OVERLINE])
{
std::unique_ptr<SvxOverlineItem> aOL(std::make_unique<SvxOverlineItem>(LINESTYLE_SINGLE, wid));
const SfxPoolItem* pItem(nullptr);
@@ -866,7 +867,7 @@ ATTR_SETOVERLINE:
}
else
{
- aOL.reset(static_cast<SvxOverlineItem*>(pSet->Get(wid, false).Clone()));
+ aOL.reset(pSet->Get(wid, false).Clone());
}
if(LINESTYLE_NONE == aOL->GetLineStyle())
@@ -951,13 +952,13 @@ ATTR_SETOVERLINE:
bIsLeftToRightDef = true;
break;
case RTF_RTLPAR:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_FRAMEDIRECTION])
+ if (const TypedWhichId<SvxFrameDirectionItem> wid = aPardMap[SID_ATTR_FRAMEDIRECTION])
{
pSet->Put(SvxFrameDirectionItem(SvxFrameDirection::Horizontal_RL_TB, wid));
}
break;
case RTF_LTRPAR:
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_FRAMEDIRECTION])
+ if (const TypedWhichId<SvxFrameDirectionItem> wid = aPardMap[SID_ATTR_FRAMEDIRECTION])
{
pSet->Put(SvxFrameDirectionItem(SvxFrameDirection::Horizontal_LR_TB, wid));
}
@@ -977,14 +978,14 @@ ATTR_SETOVERLINE:
case RTF_ACCCOMMA:
eEmphasis = (FontEmphasisMark::Accent | FontEmphasisMark::PosAbove);
ATTR_SETEMPHASIS:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_EMPHASISMARK])
+ if (const TypedWhichId<SvxEmphasisMarkItem> wid = aPlainMap[SID_ATTR_CHAR_EMPHASISMARK])
{
pSet->Put(SvxEmphasisMarkItem(eEmphasis, wid));
}
break;
case RTF_TWOINONE:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_TWO_LINES])
+ if (const TypedWhichId<SvxTwoLinesItem> wid = aPlainMap[SID_ATTR_CHAR_TWO_LINES])
{
sal_Unicode cStt, cEnd;
switch ( nTokenValue )
@@ -1001,7 +1002,7 @@ ATTR_SETEMPHASIS:
break;
case RTF_CHARSCALEX :
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_SCALEWIDTH])
+ if (const TypedWhichId<SvxCharScaleWidthItem> wid = aPlainMap[SID_ATTR_CHAR_SCALEWIDTH])
{
//i21372
if (nTokenValue < 1 || nTokenValue > 600)
@@ -1011,7 +1012,7 @@ ATTR_SETEMPHASIS:
break;
case RTF_HORZVERT:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_ROTATED])
+ if (const TypedWhichId<SvxCharRotateItem> wid = aPlainMap[SID_ATTR_CHAR_ROTATED])
{
// RTF knows only 90deg
pSet->Put(SvxCharRotateItem(900_deg10, 1 == nTokenValue, wid));
@@ -1019,19 +1020,19 @@ ATTR_SETEMPHASIS:
break;
case RTF_EMBO:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_RELIEF])
+ if (const TypedWhichId<SvxCharReliefItem> wid = aPlainMap[SID_ATTR_CHAR_RELIEF])
{
pSet->Put(SvxCharReliefItem(FontRelief::Embossed, wid));
}
break;
case RTF_IMPR:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_RELIEF])
+ if (const TypedWhichId<SvxCharReliefItem> wid = aPlainMap[SID_ATTR_CHAR_RELIEF])
{
pSet->Put(SvxCharReliefItem(FontRelief::Engraved, wid));
}
break;
case RTF_V:
- if (const sal_uInt16 wid = aPlainMap[SID_ATTR_CHAR_HIDDEN])
+ if (const TypedWhichId<SvxCharHiddenItem> wid = aPlainMap[SID_ATTR_CHAR_HIDDEN])
{
pSet->Put(SvxCharHiddenItem(nTokenValue != 0, wid));
}
@@ -1051,7 +1052,7 @@ ATTR_SETEMPHASIS:
case RTF_CHCBPAT:
case RTF_CHCFPAT:
case RTF_CHSHDNG:
- if (aPlainMap[SID_ATTR_BRUSH_CHAR] != 0)
+ if (aPlainMap[SID_ATTR_BRUSH_CHAR])
ReadBackgroundAttr( nToken, *pSet );
break;
@@ -1095,7 +1096,7 @@ ATTR_SETEMPHASIS:
aPardMap[SID_ATTR_PARA_HYPHENZONE]);
aHypenZone.SetPageEnd((nTokenValue & 2) != 0);
- if( aPardMap[SID_ATTR_PARA_HYPHENZONE] != 0 &&
+ if( aPardMap[SID_ATTR_PARA_HYPHENZONE] &&
RTF_HYPHLEAD == GetNextToken() &&
RTF_HYPHTRAIL == GetNextToken() &&
RTF_HYPHMAX == GetNextToken() )
@@ -1145,7 +1146,7 @@ ATTR_SETEMPHASIS:
Color aColor = GetColor( nCol );
- if (const sal_uInt16 wid = aPardMap[SID_ATTR_BORDER_SHADOW])
+ if (const TypedWhichId<SvxShadowItem> wid = aPardMap[SID_ATTR_BORDER_SHADOW])
pSet->Put(SvxShadowItem(wid, &aColor, nDist, eSL));
bSkip = false;
@@ -1712,13 +1713,13 @@ void SvxRTFParser::RTFPardPlain( bool const bPard, SfxItemSet** ppSet )
if( bPard )
{
pCurrent->nStyleNo = 0;
- aIt = aPardMap.begin();
- aEnd = aPardMap.end();
+ aIt = aPardMap.data.begin();
+ aEnd = aPardMap.data.end();
}
else
{
- aIt = aPlainMap.begin();
- aEnd = aPlainMap.end();
+ aIt = aPlainMap.data.begin();
+ aEnd = aPlainMap.data.end();
}
for (; aIt != aEnd; ++aIt)
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 123020bf8203..1ef6f30b4024 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -597,8 +597,8 @@ const vcl::Font& SvxRTFParser::GetFont( sal_uInt16 nId )
{
return it->second;
}
- const SvxFontItem& rDfltFont = static_cast<const SvxFontItem&>(
- pAttrPool->GetDefaultItem(aPlainMap[SID_ATTR_CHAR_FONT]));
+ const SvxFontItem& rDfltFont =
+ pAttrPool->GetDefaultItem(aPlainMap[SID_ATTR_CHAR_FONT]);
pDfltFont->SetFamilyName( rDfltFont.GetStyleName() );
pDfltFont->SetFamily( rDfltFont.GetFamily() );
return *pDfltFont;
@@ -749,7 +749,7 @@ void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack
xNew->aAttrSet.SetParent( pOld->aAttrSet.GetParent() );
// Delete all paragraph attributes from xNew
- for (const auto& pair : aPardMap)
+ for (const auto& pair : aPardMap.data)
if (sal_uInt16 wid = pair.second)
xNew->aAttrSet.ClearItem(wid);
xNew->SetRTFDefaults( GetRTFDefaults() );
@@ -918,7 +918,7 @@ void SvxRTFParser::BuildWhichTable()
for (sal_uInt16 nWid : WIDS1)
{
sal_uInt16 nTrueWid = pAttrPool->GetTrueWhich(nWid, false);
- aPardMap[nWid] = nTrueWid;
+ aPardMap.data[nWid] = nTrueWid;
if (nTrueWid == 0)
continue;
aWhichMap = aWhichMap.MergeRange(nTrueWid, nTrueWid);
@@ -943,7 +943,7 @@ void SvxRTFParser::BuildWhichTable()
for (sal_uInt16 nWid : WIDS)
{
sal_uInt16 nTrueWid = pAttrPool->GetTrueWhich(nWid, false);
- aPlainMap[nWid] = nTrueWid;
+ aPlainMap.data[nWid] = nTrueWid;
if (nTrueWid == 0)
continue;
aWhichMap = aWhichMap.MergeRange(nTrueWid, nTrueWid);
diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx
index b5cfb55b7820..19ae60dc892b 100644
--- a/forms/source/richtext/rtattributehandler.cxx
+++ b/forms/source/richtext/rtattributehandler.cxx
@@ -304,8 +304,8 @@ namespace frm
FontSizeHandler::FontSizeHandler( AttributeId _nAttributeId, WhichId _nWhichId )
:AttributeHandler( _nAttributeId, _nWhichId )
{
- OSL_ENSURE( ( _nAttributeId == SID_ATTR_CHAR_FONTHEIGHT ) || ( _nAttributeId == SID_ATTR_CHAR_CTL_FONTHEIGHT )
- || ( _nAttributeId == SID_ATTR_CHAR_CJK_FONTHEIGHT ) || ( _nAttributeId == SID_ATTR_CHAR_LATIN_FONTHEIGHT ),
+ OSL_ENSURE( ( _nAttributeId == sal_uInt16(SID_ATTR_CHAR_FONTHEIGHT) ) || ( _nAttributeId == sal_uInt16(SID_ATTR_CHAR_CTL_FONTHEIGHT) )
+ || ( _nAttributeId == sal_uInt16(SID_ATTR_CHAR_CJK_FONTHEIGHT) ) || ( _nAttributeId == sal_uInt16(SID_ATTR_CHAR_LATIN_FONTHEIGHT) ),
"FontSizeHandler::FontSizeHandler: invalid attribute id!" );
}
@@ -360,7 +360,7 @@ namespace frm
SvxFontHeightItem aNewItem( nHeight, 100, getWhich() );
aNewItem.SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() );
- if ( ( getAttributeId() == SID_ATTR_CHAR_FONTHEIGHT ) && _nForScriptType != SvtScriptType::NONE)
+ if ( ( getAttributeId() == sal_uInt16(SID_ATTR_CHAR_FONTHEIGHT) ) && _nForScriptType != SvtScriptType::NONE)
putItemForScript( _rNewAttribs, aNewItem, _nForScriptType );
else
_rNewAttribs.Put( aNewItem );
diff --git a/forms/source/richtext/specialdispatchers.cxx b/forms/source/richtext/specialdispatchers.cxx
index db7ef6807df8..d75e06590fc2 100644
--- a/forms/source/richtext/specialdispatchers.cxx
+++ b/forms/source/richtext/specialdispatchers.cxx
@@ -155,7 +155,7 @@ namespace frm
{
bool bEnable = true;
OSL_VERIFY( pLookup->Value >>= bEnable );
- if ( m_nAttributeId == SID_ATTR_PARA_SCRIPTSPACE )
+ if ( m_nAttributeId == sal_uInt16(SID_ATTR_PARA_SCRIPTSPACE) )
return new SvxScriptSpaceItem( bEnable, static_cast<WhichId>(m_nAttributeId) );
return new SfxBoolItem( static_cast<WhichId>(m_nAttributeId), bEnable );
}
diff --git a/include/editeng/editids.hrc b/include/editeng/editids.hrc
index b4e717620acf..df7969ce8dc3 100644
--- a/include/editeng/editids.hrc
+++ b/include/editeng/editids.hrc
@@ -22,18 +22,47 @@
#include <svl/solar.hrc>
class SfxGrabBagItem;
+class SfxInt16Item;
class SfxUInt16Item;
+class SvxAdjustItem;
+class SvxAutoKernItem;
+class SvxBoxItem;
class SvxBrushItem;
+class SvxCaseMapItem;
+class SvxCharHiddenItem;
+class SvxCharReliefItem;
+class SvxCharRotateItem;
+class SvxCharScaleWidthItem;
class SvxColorItem;
+class SvxContourItem;
+class SvxCrossedOutItem;
+class SvxEmphasisMarkItem;
+class SvxEscapementItem;
+class SvxFontHeightItem;
class SvxFontItem;
+class SvxForbiddenRuleItem;
+class SvxFormatKeepItem;
+class SvxFormatSplitItem;
+class SvxFrameDirectionItem;
+class SvxHangingPunctuationItem;
+class SvxHyphenZoneItem;
class SvxKerningItem;
class SvxLanguageItem;
class SvxLineSpacingItem;
+class SvxLRSpaceItem;
+class SvxOverlineItem;
class SvxPageModelItem;
+class SvxParaVertAlignItem;
class SvxPostureItem;
+class SvxScriptSpaceItem;
+class SvxShadowItem;
+class SvxShadowedItem;
class SvxTabStopItem;
+class SvxTwoLinesItem;
class SvxUnderlineItem;
+class SvxULSpaceItem;
class SvxWeightItem;
+class SvxWordLineModeItem;
/*
These SID_SVX_START entries came from include/svx/svxids.hrc, avoid
@@ -50,22 +79,22 @@ class SvxWeightItem;
#define SID_ATTR_CHAR_FONT TypedWhichId<SvxFontItem>( SID_SVX_START + 7 )
#define SID_ATTR_CHAR_POSTURE TypedWhichId<SvxPostureItem>( SID_SVX_START + 8 )
#define SID_ATTR_CHAR_WEIGHT TypedWhichId<SvxWeightItem>( SID_SVX_START + 9 )
-#define SID_ATTR_CHAR_SHADOWED ( SID_SVX_START + 10 )
-#define SID_ATTR_CHAR_WORDLINEMODE ( SID_SVX_START + 11 )
-#define SID_ATTR_CHAR_CONTOUR ( SID_SVX_START + 12 )
-#define SID_ATTR_CHAR_STRIKEOUT ( SID_SVX_START + 13 )
+#define SID_ATTR_CHAR_SHADOWED TypedWhichId<SvxShadowedItem>( SID_SVX_START + 10 )
+#define SID_ATTR_CHAR_WORDLINEMODE TypedWhichId<SvxWordLineModeItem>( SID_SVX_START + 11 )
+#define SID_ATTR_CHAR_CONTOUR TypedWhichId<SvxContourItem>( SID_SVX_START + 12 )
+#define SID_ATTR_CHAR_STRIKEOUT TypedWhichId<SvxCrossedOutItem>( SID_SVX_START + 13 )
#define SID_ATTR_CHAR_UNDERLINE TypedWhichId<SvxUnderlineItem>( SID_SVX_START + 14 )
-#define SID_ATTR_CHAR_FONTHEIGHT ( SID_SVX_START + 15 )
+#define SID_ATTR_CHAR_FONTHEIGHT TypedWhichId<SvxFontHeightItem>( SID_SVX_START + 15 )
// free
#define SID_ATTR_CHAR_COLOR TypedWhichId<SvxColorItem>( SID_SVX_START + 17 )
#define SID_ATTR_CHAR_KERNING TypedWhichId<SvxKerningItem>( SID_SVX_START + 18 )
-#define SID_ATTR_CHAR_CASEMAP ( SID_SVX_START + 19 )
-#define SID_ATTR_CHAR_LANGUAGE ( SID_SVX_START + 20 )
-#define SID_ATTR_CHAR_ESCAPEMENT ( SID_SVX_START + 21 )
+#define SID_ATTR_CHAR_CASEMAP TypedWhichId<SvxCaseMapItem>( SID_SVX_START + 19 )
+#define SID_ATTR_CHAR_LANGUAGE TypedWhichId<SvxLanguageItem>( SID_SVX_START + 20 )
+#define SID_ATTR_CHAR_ESCAPEMENT TypedWhichId<SvxEscapementItem>( SID_SVX_START + 21 )
#define SID_ATTR_CHAR_FONTLIST ( SID_SVX_START + 22 )
-#define SID_ATTR_BORDER_OUTER ( SID_SVX_START + 24 )
-#define SID_ATTR_BORDER_SHADOW ( SID_SVX_START + 25 )
-#define SID_ATTR_PARA_ADJUST ( SID_SVX_START + 27 )
+#define SID_ATTR_BORDER_OUTER TypedWhichId<SvxBoxItem>( SID_SVX_START + 24 )
+#define SID_ATTR_BORDER_SHADOW TypedWhichId<SvxShadowItem>( SID_SVX_START + 25 )
+#define SID_ATTR_PARA_ADJUST TypedWhichId<SvxAdjustItem>( SID_SVX_START + 27 )
#define SID_ATTR_PARA_ADJUST_LEFT ( SID_SVX_START + 28 )
#define SID_ATTR_PARA_ADJUST_RIGHT ( SID_SVX_START + 29 )
#define SID_ATTR_PARA_ADJUST_CENTER ( SID_SVX_START + 30 )
@@ -76,8 +105,8 @@ class SvxWeightItem;
#define SID_ATTR_PARA_LINESPACE_115 ( SID_SVX_START + 26 )
#define SID_ATTR_PARA_LINESPACE_20 ( SID_SVX_START + 36 )
#define SID_ATTR_PARA_PAGEBREAK ( SID_SVX_START + 37 )
-#define SID_ATTR_PARA_HYPHENZONE ( SID_SVX_START + 38 )
-#define SID_ATTR_PARA_SPLIT ( SID_SVX_START + 39 )
+#define SID_ATTR_PARA_HYPHENZONE TypedWhichId<SvxHyphenZoneItem>( SID_SVX_START + 38 )
+#define SID_ATTR_PARA_SPLIT TypedWhichId<SvxFormatSplitItem>( SID_SVX_START + 39 )
#define SID_ATTR_PARA_ORPHANS ( SID_SVX_START + 40 )
#define SID_ATTR_PARA_WIDOWS ( SID_SVX_START + 41 )
#define SID_ATTR_PARA_ULSPACE ( SID_SVX_START + 42 )
@@ -86,60 +115,60 @@ class SvxWeightItem;
#define SID_ATTR_PARA_RIGHTSPACE ( SID_SVX_START + 45 )
#define SID_ATTR_PARA_FIRSTLINESPACE ( SID_SVX_START + 46 )
#define SID_ATTR_PARA_BELOWSPACE ( SID_SVX_START + 47 )
-#define SID_ATTR_LRSPACE ( SID_SVX_START + 48 )
-#define SID_ATTR_ULSPACE ( SID_SVX_START + 49 )
+#define SID_ATTR_LRSPACE TypedWhichId<SvxLRSpaceItem>( SID_SVX_START + 48 )
+#define SID_ATTR_ULSPACE TypedWhichId<SvxULSpaceItem>( SID_SVX_START + 49 )
#define SID_ATTR_PARA_ABOVESPACE ( SID_SVX_START + 64 )
#define SID_ATTR_PARA_MODEL TypedWhichId<SvxPageModelItem>( SID_SVX_START + 65 )
-#define SID_ATTR_PARA_KEEP ( SID_SVX_START + 66 )
-#define SID_ATTR_CHAR_AUTOKERN ( SID_SVX_START + 67 )
+#define SID_ATTR_PARA_KEEP TypedWhichId<SvxFormatKeepItem>( SID_SVX_START + 66 )
+#define SID_ATTR_CHAR_AUTOKERN TypedWhichId<SvxAutoKernItem>( SID_SVX_START + 67 )
#define SID_HANGING_INDENT ( SID_SVX_START + 68 )
#define SID_ATTR_PARA_BULLET ( SID_SVX_START + 250 )
-#define SID_ATTR_PARA_OUTLLEVEL ( SID_SVX_START + 300 )
+#define SID_ATTR_PARA_OUTLLEVEL TypedWhichId<SfxInt16Item>( SID_SVX_START + 300 )
#define SID_FIELD ( SID_SVX_START + 363 ) // related to EE_FEATURE_FIELD
#define SID_ATTR_PARA_REGISTER ( SID_SVX_START + 413 )
#define SID_ATTR_PARA_PAGENUM ( SID_SVX_START + 457 )
#define SID_ATTR_PARA_NUMRULE ( SID_SVX_START + 587 )
-#define SID_ATTR_BRUSH_CHAR ( SID_SVX_START + 591 )
+#define SID_ATTR_BRUSH_CHAR TypedWhichId<SvxBrushItem>( SID_SVX_START + 591 )
#define SID_ATTR_NUMBERING_RULE TypedWhichId<SvxNumBulletItem>( SID_SVX_START + 855 )
#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_SVX_START + 877 )
-#define SID_ATTR_CHAR_CJK_FONT ( SID_SVX_START + 887 )
-#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_SVX_START + 888 )
+#define SID_ATTR_CHAR_CJK_FONT TypedWhichId<SvxFontItem>( SID_SVX_START + 887 )
+#define SID_ATTR_CHAR_CJK_FONTHEIGHT TypedWhichId<SvxFontHeightItem>( SID_SVX_START + 888 )
#define SID_ATTR_CHAR_CJK_LANGUAGE TypedWhichId<SvxLanguageItem>( SID_SVX_START + 889 )
-#define SID_ATTR_CHAR_CJK_POSTURE ( SID_SVX_START + 890 )
-#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_SVX_START + 891 )
-#define SID_ATTR_CHAR_CTL_FONT ( SID_SVX_START + 892 )
-#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_SVX_START + 893 )
+#define SID_ATTR_CHAR_CJK_POSTURE TypedWhichId<SvxPostureItem>( SID_SVX_START + 890 )
+#define SID_ATTR_CHAR_CJK_WEIGHT TypedWhichId<SvxWeightItem>( SID_SVX_START + 891 )
+#define SID_ATTR_CHAR_CTL_FONT TypedWhichId<SvxFontItem>( SID_SVX_START + 892 )
+#define SID_ATTR_CHAR_CTL_FONTHEIGHT TypedWhichId<SvxFontHeightItem>( SID_SVX_START + 893 )
#define SID_ATTR_CHAR_CTL_LANGUAGE TypedWhichId<SvxLanguageItem>( SID_SVX_START + 894 )
-#define SID_ATTR_CHAR_CTL_POSTURE ( SID_SVX_START + 895 )
-#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_SVX_START + 896 )
-#define SID_ATTR_CHAR_TWO_LINES ( SID_SVX_START + 897 )
+#define SID_ATTR_CHAR_CTL_POSTURE TypedWhichId<SvxPostureItem>( SID_SVX_START + 895 )
+#define SID_ATTR_CHAR_CTL_WEIGHT TypedWhichId<SvxWeightItem>( SID_SVX_START + 896 )
+#define SID_ATTR_CHAR_TWO_LINES TypedWhichId<SvxTwoLinesItem>( SID_SVX_START + 897 )
#define SID_ATTR_CHAR_CJK_RUBY ( SID_SVX_START + 898 )
-#define SID_ATTR_CHAR_EMPHASISMARK ( SID_SVX_START + 899 )
-#define SID_ATTR_PARA_SCRIPTSPACE ( SID_SVX_START + 901 )
-#define SID_ATTR_PARA_HANGPUNCTUATION ( SID_SVX_START + 902 )
-#define SID_ATTR_PARA_FORBIDDEN_RULES ( SID_SVX_START + 903 )
+#define SID_ATTR_CHAR_EMPHASISMARK TypedWhichId<SvxEmphasisMarkItem>( SID_SVX_START + 899 )
+#define SID_ATTR_PARA_SCRIPTSPACE TypedWhichId<SvxScriptSpaceItem>( SID_SVX_START + 901 )
+#define SID_ATTR_PARA_HANGPUNCTUATION TypedWhichId<SvxHangingPunctuationItem>( SID_SVX_START + 902 )
+#define SID_ATTR_PARA_FORBIDDEN_RULES TypedWhichId<SvxForbiddenRuleItem>( SID_SVX_START + 903 )
#define SID_ATTR_CHAR_VERTICAL ( SID_SVX_START + 905 )
-#define SID_ATTR_CHAR_ROTATED ( SID_SVX_START + 910 )
-#define SID_ATTR_CHAR_SCALEWIDTH ( SID_SVX_START + 911 )
+#define SID_ATTR_CHAR_ROTATED TypedWhichId<SvxCharRotateItem>( SID_SVX_START + 910 )
+#define SID_ATTR_CHAR_SCALEWIDTH TypedWhichId<SvxCharScaleWidthItem>( SID_SVX_START + 911 )
#define SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ( SID_SVX_START + 919 )
-#define SID_ATTR_CHAR_RELIEF ( SID_SVX_START + 920 )
-#define SID_PARA_VERTALIGN ( SID_SVX_START + 925 )
-#define SID_ATTR_FRAMEDIRECTION ( SID_SVX_START + 944 )
+#define SID_ATTR_CHAR_RELIEF TypedWhichId<SvxCharReliefItem>( SID_SVX_START + 920 )
+#define SID_PARA_VERTALIGN TypedWhichId<SvxParaVertAlignItem>( SID_SVX_START + 925 )
+#define SID_ATTR_FRAMEDIRECTION TypedWhichId<SvxFrameDirectionItem>( SID_SVX_START + 944 )
#define SID_ATTR_PARA_SNAPTOGRID ( SID_SVX_START + 945 )
#define SID_ATTR_PARA_LRSPACE_VERTICAL ( SID_SVX_START + 947 )
#define SID_ATTR_PARA_LEFT_TO_RIGHT ( SID_SVX_START + 950 )
#define SID_ATTR_PARA_RIGHT_TO_LEFT ( SID_SVX_START + 951 )
-#define SID_ATTR_CHAR_HIDDEN ( SID_SVX_START + 989 )
+#define SID_ATTR_CHAR_HIDDEN TypedWhichId<SvxCharHiddenItem>( SID_SVX_START + 989 )
#define SID_ATTR_CHAR_LATIN_FONT ( SID_SVX_START + 994 )
-#define SID_ATTR_CHAR_LATIN_FONTHEIGHT ( SID_SVX_START + 995 )
+#define SID_ATTR_CHAR_LATIN_FONTHEIGHT TypedWhichId<SvxFontHeightItem>( SID_SVX_START + 995 )
#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_SVX_START + 996 )
-#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_SVX_START + 997 )
+#define SID_ATTR_CHAR_LATIN_POSTURE TypedWhichId<SvxPostureItem>( SID_SVX_START + 997 )
#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_SVX_START + 998 )
#define SID_ATTR_CHAR_GRABBAG TypedWhichId<SfxGrabBagItem>( SID_SVX_START + 1142 )
#define SID_ATTR_CHAR_BACK_COLOR ( SID_SVX_START + 1153 )
// these ID didn't exist prior to the svx split, add new ids here
-#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 )
+#define SID_ATTR_CHAR_OVERLINE TypedWhichId<SvxOverlineItem>( SID_EDIT_START + 68 )
#define SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD ( SID_EDIT_START + 69 )
#define SID_ATTR_ALIGN_VER_JUSTIFY_METHOD ( SID_EDIT_START + 70 )
#define SID_ATTR_ALIGN_HOR_JUSTIFY ( SID_EDIT_START + 71 )
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
index b75df2d6ed27..a70264381d51 100644
--- a/include/editeng/svxrtf.hxx
+++ b/include/editeng/svxrtf.hxx
@@ -94,8 +94,16 @@ class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
std::deque< std::unique_ptr<SvxRTFItemStackType> > aAttrStack;
SvxRTFItemStackList m_AttrSetList;
- std::map<sal_uInt16, sal_uInt16> aPlainMap;
- std::map<sal_uInt16, sal_uInt16> aPardMap;
+ struct PlainOrPardMap
+ {
+ std::map<sal_uInt16, sal_uInt16> data;
+ template<class T>
+ TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); }
+ template<class T>
+ void set(TypedWhichId<T> in, TypedWhichId<T> out) { data[in] = out; }
+ };
+ PlainOrPardMap aPlainMap;
+ PlainOrPardMap aPardMap;
WhichRangesContainer aWhichMap;
std::optional<EditPosition> mxInsertPosition;
@@ -203,7 +211,8 @@ public:
// The maps are not generated anew!
void SetAttrPool( SfxItemPool* pNewPool ) { pAttrPool = pNewPool; }
// to set different WhichIds for a different pool.
- void SetPardMap(sal_uInt16 wid, sal_uInt16 widTrue) { aPardMap[wid] = widTrue; }
+ template<class T>
+ void SetPardMap(TypedWhichId<T> wid, TypedWhichId<T> widTrue) { aPardMap[wid] = widTrue; }
// to be able to assign them from the outside as for example table cells
void ReadBorderAttr( int nToken, SfxItemSet& rSet, bool bTableDef=false );
void ReadBackgroundAttr( int nToken, SfxItemSet& rSet, bool bTableDef=false );
diff --git a/sd/source/ui/func/bulmaper.cxx b/sd/source/ui/func/bulmaper.cxx
index c7d375b8e7fe..956855279ee3 100644
--- a/sd/source/ui/func/bulmaper.cxx
+++ b/sd/source/ui/func/bulmaper.cxx
@@ -55,38 +55,34 @@ void SdBulletMapper::MapFontsInNumRule( SvxNumRule& aNumRule, const SfxItemSet&
// to be implemented if module supports CJK
vcl::Font aMyFont;
- const SvxFontItem& rFItem =
- static_cast<const SvxFontItem&>(rSet.Get(GetWhich( sal_uInt16(SID_ATTR_CHAR_FONT) )));
+ const SvxFontItem& rFItem = rSet.Get(GetWhich( SID_ATTR_CHAR_FONT ));
aMyFont.SetFamily(rFItem.GetFamily());
aMyFont.SetFamilyName(rFItem.GetFamilyName());
aMyFont.SetCharSet(rFItem.GetCharSet());
aMyFont.SetPitch(rFItem.GetPitch());
- const SvxFontHeightItem& rFHItem =
- static_cast<const SvxFontHeightItem&>(rSet.Get(GetWhich( sal_uInt16(SID_ATTR_CHAR_FONTHEIGHT) )));
+ const SvxFontHeightItem& rFHItem = rSet.Get(GetWhich( SID_ATTR_CHAR_FONTHEIGHT ));
aMyFont.SetFontSize(Size(0, rFHItem.GetHeight()));
- const SvxWeightItem& rWItem =
- static_cast<const SvxWeightItem&>(rSet.Get(GetWhich( sal_uInt16(SID_ATTR_CHAR_WEIGHT) )));
+ const SvxWeightItem& rWItem = rSet.Get(GetWhich( SID_ATTR_CHAR_WEIGHT ));
aMyFont.SetWeight(rWItem.GetWeight());
- const SvxPostureItem& rPItem =
- static_cast<const SvxPostureItem&>(rSet.Get(GetWhich( sal_uInt16(SID_ATTR_CHAR_POSTURE) )));
+ const SvxPostureItem& rPItem = rSet.Get(GetWhich(SID_ATTR_CHAR_POSTURE));
aMyFont.SetItalic(rPItem.GetPosture());
const SvxUnderlineItem& rUItem = rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE));
aMyFont.SetUnderline(rUItem.GetLineStyle());
- const SvxOverlineItem& rOItem = static_cast<const SvxOverlineItem&>(rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE)));
+ const SvxOverlineItem& rOItem = rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE));
aMyFont.SetOverline(rOItem.GetLineStyle());
- const SvxCrossedOutItem& rCOItem = static_cast<const SvxCrossedOutItem&>(rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT)));
+ const SvxCrossedOutItem& rCOItem = rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT));
aMyFont.SetStrikeout(rCOItem.GetStrikeout());
- const SvxContourItem& rCItem = static_cast<const SvxContourItem&>(rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR)));
+ const SvxContourItem& rCItem = rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR));
aMyFont.SetOutline(rCItem.GetValue());
- const SvxShadowedItem& rSItem = static_cast<const SvxShadowedItem&>(rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED)));
+ const SvxShadowedItem& rSItem = rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED));
aMyFont.SetShadow(rSItem.GetValue());
aNewLevel.SetBulletFont(&aMyFont);
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 9f0985ad1057..2052a072c083 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -350,10 +350,8 @@ void SvxHFPage::Reset( const SfxItemSet* rSet )
pSharedFirst = static_cast<const SfxBoolItem*>(&rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SHARED_FIRST ) ));
const SvxSizeItem& rSize =
rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
- const SvxULSpaceItem& rUL =
- static_cast<const SvxULSpaceItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
- const SvxLRSpaceItem& rLR =
- static_cast<const SvxLRSpaceItem&>(rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
+ const SvxULSpaceItem& rUL = rHeaderSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR = rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
if (m_xDynSpacingCB->get_visible())
{
const SfxBoolItem& rDynSpacing =
@@ -861,10 +859,8 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
{
const SvxSizeItem& rSize =
rHeaderSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
- const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
- rHeaderSet.Get( GetWhich(SID_ATTR_ULSPACE ) ));
- const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
- rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
+ const SvxULSpaceItem& rUL = rHeaderSet.Get( GetWhich(SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR = rHeaderSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
tools::Long nDist = rUL.GetLower();
m_aBspWin.SetHdHeight( rSize.GetSize().Height() - nDist );
@@ -901,10 +897,8 @@ void SvxHFPage::ActivatePage( const SfxItemSet& rSet )
{
const SvxSizeItem& rSize =
rFooterSet.Get( GetWhich( SID_ATTR_PAGE_SIZE ) );
- const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(
- rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) ));
- const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(
- rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) ));
+ const SvxULSpaceItem& rUL = rFooterSet.Get( GetWhich( SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR = rFooterSet.Get( GetWhich( SID_ATTR_LRSPACE ) );
tools::Long nDist = rUL.GetUpper();
m_aBspWin.SetFtHeight( rSize.GetSize().Height() - nDist );
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 6b7713795551..708a5c7bd384 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -632,8 +632,7 @@ sal_Int32 RtfSdrExport::StartShape()
m_rExport.GetCurrentEncoding()));
}
- auto pFontHeight = static_cast<const SvxFontHeightItem*>(
- rItemSet.GetItem(SID_ATTR_CHAR_FONTHEIGHT));
+ auto pFontHeight = rItemSet.GetItem(SID_ATTR_CHAR_FONTHEIGHT);
if (pFontHeight)
{
tools::Long nFontHeight = TransformMetric(pFontHeight->GetHeight(),
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx
index b77512b9e8e4..67cd04f79d52 100644
--- a/sw/source/uibase/frmdlg/colex.cxx
+++ b/sw/source/uibase/frmdlg/colex.cxx
@@ -106,10 +106,8 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet )
const SvxSizeItem& rSize =
rHeaderSet.Get(pPool->GetWhich(SID_ATTR_PAGE_SIZE));
- const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(rHeaderSet.Get(
- pPool->GetWhich(SID_ATTR_ULSPACE)));
- const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(rHeaderSet.Get(
- pPool->GetWhich(SID_ATTR_LRSPACE)));
+ const SvxULSpaceItem& rUL = rHeaderSet.Get(pPool->GetWhich(SID_ATTR_ULSPACE));
+ const SvxLRSpaceItem& rLR = rHeaderSet.Get(pPool->GetWhich(SID_ATTR_LRSPACE));
SetHdHeight( rSize.GetSize().Height() - rUL.GetLower());
SetHdDist( rUL.GetLower() );
@@ -144,10 +142,8 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet )
const SvxSizeItem& rSize =
rFooterSet.Get( pPool->GetWhich( SID_ATTR_PAGE_SIZE ) );
- const SvxULSpaceItem& rUL = static_cast<const SvxULSpaceItem&>(rFooterSet.Get(
- pPool->GetWhich( SID_ATTR_ULSPACE ) ));
- const SvxLRSpaceItem& rLR = static_cast<const SvxLRSpaceItem&>(rFooterSet.Get(
- pPool->GetWhich( SID_ATTR_LRSPACE ) ));
+ const SvxULSpaceItem& rUL = rFooterSet.Get(pPool->GetWhich( SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR = rFooterSet.Get(pPool->GetWhich( SID_ATTR_LRSPACE ) );
SetFtHeight( rSize.GetSize().Height() - rUL.GetUpper());
SetFtDist( rUL.GetUpper() );
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 729405068a1a..08ff87065439 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -2441,10 +2441,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
rSet.Put( SfxBoolItem(SID_ATTR_PAGE_HEADER, bHeaderOn ) );
if(bHeaderOn)
{
- const SvxLRSpaceItem* pLR = static_cast<const SvxLRSpaceItem*>(
- rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_LRSPACE));
- const SvxULSpaceItem* pUL = static_cast<const SvxULSpaceItem*>(
- rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_ULSPACE));
+ const SvxLRSpaceItem* pLR = rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_LRSPACE);
+ const SvxULSpaceItem* pUL = rHeader.GetHeaderFormat()->GetAttrSet().GetItem(SID_ATTR_ULSPACE);
if (pLR && pUL)
{
SvxLongLRSpaceItem aLR(pLR->GetLeft(), pLR->GetRight(), SID_ATTR_PAGE_HEADER_LRMARGIN);