summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-16 16:16:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-20 09:43:25 +0100
commit0f0049d77a0ee6ae936922213c7290d0bc4fee29 (patch)
tree21ec8c68606453166de7557afa394054907d9c85 /sw
parent21e85d591f344958c3ebee9422ba15dbd931f2cc (diff)
TypedWhichId for XATTR* constants
Change-Id: Ie9d637d701b77a549de3b00956f9c74ee8bd08c1 Reviewed-on: https://gerrit.libreoffice.org/44830 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/frmedt/feshview.cxx2
-rw-r--r--sw/source/core/layout/paintfrm.cxx4
-rw-r--r--sw/source/core/unocore/unoframe.cxx4
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx4
-rw-r--r--sw/source/core/unocore/unostyle.cxx20
-rw-r--r--sw/source/filter/html/htmldrawwriter.cxx4
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx2
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx9
-rw-r--r--sw/source/uibase/app/docstyle.cxx4
-rw-r--r--sw/source/uibase/shells/langhelper.cxx6
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx14
11 files changed, 36 insertions, 37 deletions
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 9308d78c5afe..267c1f3793d4 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -947,7 +947,7 @@ void SwFEShell::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj, sal_uInt1
// determine line width and calculate with it the line end width
if( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE )
{
- long nValue = static_cast<const XLineWidthItem&>( aSet.Get( XATTR_LINEWIDTH ) ).GetValue();
+ long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue();
if( nValue > 0 )
nWidth = nValue * 3;
}
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 74ab2b12b891..314338a7084e 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6443,7 +6443,7 @@ void SwFrame::PaintBackground( const SwRect &rRect, const SwPageFrame *pPage,
// thus need to check the model data itself for FillStyle (do not rely on
// SdrAllFillAttributesHelper since it already contains optimized information,
// e.g. transparency leads to no fill)
- const drawing::FillStyle eFillStyle(static_cast< const XFillStyleItem& >(GetAttrSet()->Get(XATTR_FILLSTYLE)).GetValue());
+ const drawing::FillStyle eFillStyle(GetAttrSet()->Get(XATTR_FILLSTYLE).GetValue());
if(drawing::FillStyle_NONE != eFillStyle)
{
@@ -7360,7 +7360,7 @@ bool SwFrame::GetBackgroundBrush(
{
// maybe optimized already when 100% transparency is used somewhere, need to test
// XFillStyleItem directly from the model data
- const drawing::FillStyle eFillStyle(static_cast< const XFillStyleItem& >(pFrame->GetAttrSet()->Get(XATTR_FILLSTYLE)).GetValue());
+ const drawing::FillStyle eFillStyle(pFrame->GetAttrSet()->Get(XATTR_FILLSTYLE).GetValue());
if(drawing::FillStyle_NONE != eFillStyle)
{
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index d907daa6ce6a..8ae5042534d0 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2266,8 +2266,8 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
}
else if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
{
- const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&rSet.Get(XATTR_FILLBMP_STRETCH));
- const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&rSet.Get(XATTR_FILLBMP_TILE));
+ const XFillBmpStretchItem* pStretchItem = &rSet.Get(XATTR_FILLBMP_STRETCH);
+ const XFillBmpTileItem* pTileItem = &rSet.Get(XATTR_FILLBMP_TILE);
if( pTileItem && pTileItem->GetValue() )
{
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 6ad3ede2bdc3..c755f8ba7dd7 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -461,8 +461,8 @@ void SwXParagraph::Impl::GetSinglePropertyValue_Impl(
}
case OWN_ATTR_FILLBMP_MODE:
{
- const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&rSet.Get(XATTR_FILLBMP_STRETCH));
- const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&rSet.Get(XATTR_FILLBMP_TILE));
+ const XFillBmpStretchItem* pStretchItem = &rSet.Get(XATTR_FILLBMP_STRETCH);
+ const XFillBmpTileItem* pTileItem = &rSet.Get(XATTR_FILLBMP_TILE);
if( pTileItem && pTileItem->GetValue() )
{
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index d8be7da3f44d..966e8b0af2a6 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1606,7 +1606,7 @@ void SwXStyle::SetPropertyValue<FN_UNO_STYLE_INTEROP_GRAB_BAG>(const SfxItemProp
SetPropertyValue<HINT_BEGIN>(rEntry, rPropSet, rValue, o_rStyleBase);
}
template<>
-void SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
+void SwXStyle::SetPropertyValue<sal_uInt16(XATTR_FILLGRADIENT)>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
{
uno::Any aValue(rValue);
const auto nMemberId(lcl_TranslateMetric(rEntry, m_pDoc, aValue));
@@ -1620,7 +1620,7 @@ void SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>(const SfxItemPropertySimpleE
}
else if(MID_GRAFURL == nMemberId)
{
- if(XATTR_FILLBITMAP == rEntry.nWID)
+ if(sal_uInt16(XATTR_FILLBITMAP) == rEntry.nWID)
{
// Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used
const Graphic aNullGraphic;
@@ -1980,10 +1980,10 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const
// these explicit std::mem_fn() calls shouldn't be needed, but apparently MSVC is currently too stupid for C++11 again
{ FN_UNO_HIDDEN, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_HIDDEN>) },
{ FN_UNO_STYLE_INTEROP_GRAB_BAG, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_STYLE_INTEROP_GRAB_BAG>) },
- { XATTR_FILLGRADIENT, std::mem_fn(&SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>) },
- { XATTR_FILLHATCH, std::mem_fn(&SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>) },
- { XATTR_FILLBITMAP, std::mem_fn(&SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>) },
- { XATTR_FILLFLOATTRANSPARENCE, std::mem_fn(&SwXStyle::SetPropertyValue<XATTR_FILLGRADIENT>) },
+ { XATTR_FILLGRADIENT, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(XATTR_FILLGRADIENT)>) },
+ { XATTR_FILLHATCH, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(XATTR_FILLGRADIENT)>) },
+ { XATTR_FILLBITMAP, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(XATTR_FILLGRADIENT)>) },
+ { XATTR_FILLFLOATTRANSPARENCE, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(XATTR_FILLGRADIENT)>) },
{ RES_BACKGROUND, std::mem_fn(&SwXStyle::SetPropertyValue<RES_BACKGROUND>) },
{ OWN_ATTR_FILLBMP_MODE, std::mem_fn(&SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>) },
{ RES_PAPER_BIN, std::mem_fn(&SwXStyle::SetPropertyValue<RES_PAPER_BIN>) },
@@ -2284,10 +2284,10 @@ uno::Any SwXStyle::GetStyleProperty<OWN_ATTR_FILLBMP_MODE>(const SfxItemProperty
{
PrepareStyleBase(rBase);
const SfxItemSet& rSet = rBase.GetItemSet();
- const XFillBmpTileItem* pTileItem = dynamic_cast<const XFillBmpTileItem*>(&rSet.Get(XATTR_FILLBMP_TILE));
+ const XFillBmpTileItem* pTileItem = &rSet.Get(XATTR_FILLBMP_TILE);
if(pTileItem && pTileItem->GetValue())
return uno::makeAny(drawing::BitmapMode_REPEAT);
- const XFillBmpStretchItem* pStretchItem = dynamic_cast<const XFillBmpStretchItem*>(&rSet.Get(XATTR_FILLBMP_STRETCH));
+ const XFillBmpStretchItem* pStretchItem = &rSet.Get(XATTR_FILLBMP_STRETCH);
if(pStretchItem && pStretchItem->GetValue())
return uno::makeAny(drawing::BitmapMode_STRETCH);
return uno::makeAny(drawing::BitmapMode_NO_REPEAT);
@@ -3974,8 +3974,8 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl(
}
case OWN_ATTR_FILLBMP_MODE:
{
- const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&mpSet->Get(XATTR_FILLBMP_STRETCH));
- const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&mpSet->Get(XATTR_FILLBMP_TILE));
+ const XFillBmpStretchItem* pStretchItem = &mpSet->Get(XATTR_FILLBMP_STRETCH);
+ const XFillBmpTileItem* pTileItem = &mpSet->Get(XATTR_FILLBMP_TILE);
if( pTileItem && pTileItem->GetValue() )
{
diff --git a/sw/source/filter/html/htmldrawwriter.cxx b/sw/source/filter/html/htmldrawwriter.cxx
index 3df710abde87..8b71164dc1e9 100644
--- a/sw/source/filter/html/htmldrawwriter.cxx
+++ b/sw/source/filter/html/htmldrawwriter.cxx
@@ -262,11 +262,11 @@ Writer& OutHTML_DrawFrameFormatAsMarquee( Writer& rWrt,
// BGCOLOR
drawing::FillStyle eFillStyle =
- static_cast<const XFillStyleItem&>(rItemSet.Get(XATTR_FILLSTYLE)).GetValue();
+ rItemSet.Get(XATTR_FILLSTYLE).GetValue();
if( drawing::FillStyle_SOLID==eFillStyle )
{
const Color& rFillColor =
- static_cast<const XFillColorItem&>(rItemSet.Get(XATTR_FILLCOLOR)).GetColorValue();
+ rItemSet.Get(XATTR_FILLCOLOR).GetColorValue();
sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_bgcolor).append("=");
rWrt.Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 6609a6cb129b..63044c1f8247 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -1223,7 +1223,7 @@ void RtfExport::OutColorTable()
nMaxItem = rPool.GetItemCount2(XATTR_FILLCOLOR);
for (sal_uInt32 i = 0; i < nMaxItem; ++i)
{
- if (auto pItem = static_cast<const XFillColorItem*>(rPool.GetItem2(XATTR_FILLCOLOR, i)))
+ if (auto pItem = rPool.GetItem2(XATTR_FILLCOLOR, i))
InsColor(pItem->GetColorValue());
}
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 96255010573c..f03331909aaf 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1668,8 +1668,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj,
{
// Now, that we know there is a line style we will make use the
// parameter given to us when calling the method... :-)
- const Color aLineColor = static_cast< XLineColorItem const & >(
- rOldSet.Get(XATTR_LINECOLOR)).GetColorValue();
+ const Color aLineColor = rOldSet.Get(XATTR_LINECOLOR).GetColorValue();
nLineThick = WW8ITEMVALUE(rOldSet, XATTR_LINEWIDTH, XLineWidthItem);
if( !nLineThick )
@@ -1813,8 +1812,8 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj,
case drawing::FillStyle_SOLID:
case drawing::FillStyle_GRADIENT:
{
- const Color aColor = static_cast< XFillColorItem const & >(
- rOldSet.Get(XATTR_FILLCOLOR)).GetColorValue();
+ const Color aColor =
+ rOldSet.Get(XATTR_FILLCOLOR).GetColorValue();
aBrushItem.SetColor(aColor);
if (bBrushItemOk) // has trans
@@ -1827,7 +1826,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject const * pSdrObj,
break;
case drawing::FillStyle_BITMAP:
{
- GraphicObject aGrfObj(static_cast< XFillBitmapItem const & >(rOldSet.Get(XATTR_FILLBITMAP)).GetGraphicObject());
+ GraphicObject aGrfObj(rOldSet.Get(XATTR_FILLBITMAP).GetGraphicObject());
const bool bTile(WW8ITEMVALUE(rOldSet, XATTR_FILLBMP_TILE, SfxBoolItem));
if(bBrushItemOk) // has trans
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 1ec7292ceba4..c5180e3038ae 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -875,8 +875,8 @@ OUString SwDocStyleSheet::GetDescription(MapUnit eUnit)
// Get currently used FillStyle and remember, also need the XFillFloatTransparenceItem
// to decide if gradient transparence is used
- const drawing::FillStyle eFillStyle(static_cast< const XFillStyleItem& >(pSet->Get(XATTR_FILLSTYLE)).GetValue());
- const bool bUseFloatTransparence(static_cast< const XFillFloatTransparenceItem& >(pSet->Get(XATTR_FILLFLOATTRANSPARENCE)).IsEnabled());
+ const drawing::FillStyle eFillStyle(pSet->Get(XATTR_FILLSTYLE).GetValue());
+ const bool bUseFloatTransparence(pSet->Get(XATTR_FILLFLOATTRANSPARENCE).IsEnabled());
for ( const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem() )
{
diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx
index ce47eafd7e15..cb6b7d6b8259 100644
--- a/sw/source/uibase/shells/langhelper.cxx
+++ b/sw/source/uibase/shells/langhelper.cxx
@@ -242,9 +242,9 @@ namespace SwLangHelper
bool bIsSingleScriptType = true;
switch (SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ))
{
- case SvtScriptType::LATIN : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE : RES_CHRATR_LANGUAGE; break;
- case SvtScriptType::ASIAN : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE_CJK : RES_CHRATR_CJK_LANGUAGE; break;
- case SvtScriptType::COMPLEX : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE_CTL : RES_CHRATR_CTL_LANGUAGE; break;
+ case SvtScriptType::LATIN : nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE) : sal_uInt16(RES_CHRATR_LANGUAGE); break;
+ case SvtScriptType::ASIAN : nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE_CJK) : sal_uInt16(RES_CHRATR_CJK_LANGUAGE); break;
+ case SvtScriptType::COMPLEX : nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE_CTL) : sal_uInt16(RES_CHRATR_CTL_LANGUAGE); break;
default:
bIsSingleScriptType = false;
OSL_FAIL("unexpected case" );
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index b3a6829a1c95..c866213a36b5 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1132,7 +1132,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
{
case SID_ATTR_PAGE_FILLSTYLE:
{
- XFillStyleItem aFSItem( static_cast<const XFillStyleItem&>(pReqArgs->Get( XATTR_FILLSTYLE )) );
+ XFillStyleItem aFSItem( pReqArgs->Get( XATTR_FILLSTYLE ) );
drawing::FillStyle eXFS = aFSItem.GetValue();
if ( eXFS == drawing::FillStyle_NONE )
@@ -1142,7 +1142,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
case SID_ATTR_PAGE_COLOR:
{
- XFillColorItem aColorItem( static_cast<const XFillColorItem&>(pReqArgs->Get( XATTR_FILLCOLOR )) );
+ XFillColorItem aColorItem( pReqArgs->Get( XATTR_FILLCOLOR ) );
rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_SOLID ) );
rMaster.SetFormatAttr( aColorItem );
}
@@ -1150,7 +1150,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
case SID_ATTR_PAGE_GRADIENT:
{
- XFillGradientItem aGradientItem( static_cast<const XFillGradientItem&>(pReqArgs->Get( XATTR_FILLGRADIENT )) );
+ XFillGradientItem aGradientItem( pReqArgs->Get( XATTR_FILLGRADIENT ) );
rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
rMaster.SetFormatAttr( aGradientItem );
}
@@ -1158,7 +1158,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
case SID_ATTR_PAGE_HATCH:
{
- XFillHatchItem aHatchItem( static_cast<const XFillHatchItem&>(pReqArgs->Get( XATTR_FILLHATCH )) );
+ XFillHatchItem aHatchItem( pReqArgs->Get( XATTR_FILLHATCH ) );
rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_HATCH ) );
rMaster.SetFormatAttr( aHatchItem );
}
@@ -1166,7 +1166,7 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
case SID_ATTR_PAGE_BITMAP:
{
- XFillBitmapItem aBitmapItem( static_cast<const XFillBitmapItem&>(pReqArgs->Get( XATTR_FILLBITMAP )) );
+ XFillBitmapItem aBitmapItem( pReqArgs->Get( XATTR_FILLBITMAP ) );
rMaster.SetFormatAttr( XFillStyleItem( drawing::FillStyle_BITMAP ) );
rMaster.SetFormatAttr( aBitmapItem );
}
@@ -2309,8 +2309,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
case SID_ATTR_PAGE_BITMAP:
{
SfxItemSet aSet = rDesc.GetMaster().GetAttrSet();
- drawing::FillStyle eXFS = (drawing::FillStyle) ( static_cast<const XFillStyleItem*>(
- aSet.GetItem(XATTR_FILLSTYLE) )->GetValue() );
+ drawing::FillStyle eXFS = (drawing::FillStyle)
+ aSet.GetItem(XATTR_FILLSTYLE)->GetValue();
XFillStyleItem aFillStyleItem( eXFS );
aFillStyleItem.SetWhich( SID_ATTR_PAGE_FILLSTYLE );
rSet.Put(aFillStyleItem);