diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-02 11:16:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-03 16:03:48 +0100 |
commit | aa7f880e8a847686bc4ec2d8ca5f74f39c32abac (patch) | |
tree | e10fb73e9e0d7320d22f53dada73c3baba8fe2f8 | |
parent | bc2ae79f81c8aa081d6340348c70c0440f6e895e (diff) |
use more TypedWhichId in SdrObject::GetObjectItem
Change-Id: Iacaffa4bfcca2b594d962985fb9fc93712c4464c
Reviewed-on: https://gerrit.libreoffice.org/49137
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svx/svdobj.hxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdhdl.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdoattr.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdobj.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdoedge.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdotext.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/svdotable.cxx | 2 |
9 files changed, 17 insertions, 13 deletions
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 007283844a7a..36b4b51303a7 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -904,6 +904,10 @@ protected: void SetObjectItem(const SfxPoolItem& rItem); void SetObjectItemSet(const SfxItemSet& rSet); const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const; + template<class T> const T& GetObjectItem( TypedWhichId<T> nWhich ) const + { + return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich))); + } // get MapUnit the object is using MapUnit GetObjectMapUnit() const; diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index ec3b2f1df4ea..f7fe5b520e7d 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -1660,7 +1660,7 @@ bool ImpEdgeHdl::IsHorzDrag() const if (nObjHdlNum<=1) return false; - SdrEdgeKind eEdgeKind = static_cast<const SdrEdgeKindItem&>(pEdge->GetObjectItem(SDRATTR_EDGEKIND)).GetValue(); + SdrEdgeKind eEdgeKind = pEdge->GetObjectItem(SDRATTR_EDGEKIND).GetValue(); const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo; if (eEdgeKind==SdrEdgeKind::OrthoLines || eEdgeKind==SdrEdgeKind::Bezier) diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 391196740508..ab2465689df4 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1382,7 +1382,7 @@ void SdrObjCustomShape::AdaptTextMinSize() { if (!pModel || (!pModel->IsCreatingDataObj() && !pModel->IsPasteResize())) { - const bool bResizeShapeToFitText(static_cast< const SdrOnOffItem& >(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT)).GetValue()); + const bool bResizeShapeToFitText(GetObjectItem(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue()); SfxItemSet aSet( *GetObjectItemSet().GetPool(), svl::Items<SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT, diff --git a/svx/source/svdraw/svdoattr.cxx b/svx/source/svdraw/svdoattr.cxx index c042d6aa35e1..1f118f838f84 100644 --- a/svx/source/svdraw/svdoattr.cxx +++ b/svx/source/svdraw/svdoattr.cxx @@ -140,9 +140,9 @@ sal_Int32 SdrAttrObj::ImpGetLineWdt() const { sal_Int32 nRetval(0); - if(drawing::LineStyle_NONE != static_cast<const XLineStyleItem&>(GetObjectItem(XATTR_LINESTYLE)).GetValue()) + if(drawing::LineStyle_NONE != GetObjectItem(XATTR_LINESTYLE).GetValue()) { - nRetval = static_cast<const XLineWidthItem&>(GetObjectItem(XATTR_LINEWIDTH)).GetValue(); + nRetval = GetObjectItem(XATTR_LINEWIDTH).GetValue(); } return nRetval; diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index f2008be71cb3..7677376bf48b 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -3028,12 +3028,12 @@ bool SdrObject::IsInDestruction() const // return if fill is != drawing::FillStyle_NONE bool SdrObject::HasFillStyle() const { - return static_cast<const XFillStyleItem&>(GetObjectItem(XATTR_FILLSTYLE)).GetValue() != drawing::FillStyle_NONE; + return GetObjectItem(XATTR_FILLSTYLE).GetValue() != drawing::FillStyle_NONE; } bool SdrObject::HasLineStyle() const { - return static_cast<const XLineStyleItem&>(GetObjectItem(XATTR_LINESTYLE)).GetValue() != drawing::LineStyle_NONE; + return GetObjectItem(XATTR_LINESTYLE).GetValue() != drawing::LineStyle_NONE; } diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index d9c42bfcab63..b0c7f9414afa 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -817,7 +817,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const too const Point& rPt2, long nAngle2, const tools::Rectangle& rBoundRect2, const tools::Rectangle& rBewareRect2, sal_uIntPtr* pnQuality, SdrEdgeInfoRec* pInfo) const { - SdrEdgeKind eKind=static_cast<const SdrEdgeKindItem&>(GetObjectItem(SDRATTR_EDGEKIND)).GetValue(); + SdrEdgeKind eKind=GetObjectItem(SDRATTR_EDGEKIND).GetValue(); bool bRts1=nAngle1==0; bool bObn1=nAngle1==9000; bool bLks1=nAngle1==18000; @@ -1708,7 +1708,7 @@ basegfx::B2DPolyPolygon SdrEdgeObj::GetEdgeTrackPath() const sal_uInt32 SdrEdgeObj::GetHdlCount() const { - SdrEdgeKind eKind=static_cast<const SdrEdgeKindItem&>(GetObjectItem(SDRATTR_EDGEKIND)).GetValue(); + SdrEdgeKind eKind=GetObjectItem(SDRATTR_EDGEKIND).GetValue(); sal_uInt32 nHdlCnt(0); sal_uInt32 nPointCount(pEdgeTrack->GetPointCount()); @@ -1748,7 +1748,7 @@ SdrHdl* SdrEdgeObj::GetHdl(sal_uInt32 nHdlNum) const pHdl=new ImpEdgeHdl((*pEdgeTrack)[sal_uInt16(nPointCount-1)],SdrHdlKind::Poly); if (aCon2.pObj!=nullptr && aCon2.bBestVertex) pHdl->Set1PixMore(); } else { - SdrEdgeKind eKind=static_cast<const SdrEdgeKindItem&>(GetObjectItem(SDRATTR_EDGEKIND)).GetValue(); + SdrEdgeKind eKind=GetObjectItem(SDRATTR_EDGEKIND).GetValue(); if (eKind==SdrEdgeKind::OrthoLines || eKind==SdrEdgeKind::Bezier) { sal_uInt32 nO1(aEdgeInfo.nObj1Lines > 0 ? aEdgeInfo.nObj1Lines - 1 : 0); sal_uInt32 nO2(aEdgeInfo.nObj2Lines > 0 ? aEdgeInfo.nObj2Lines - 1 : 0); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 060a357775e0..7297beb2c914 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -783,7 +783,7 @@ OUString SdrGrafObj::TakeObjNameSingul() const { case GraphicType::Bitmap: { - const char* pId = ( ( pGraphic->IsTransparent() || static_cast<const SdrGrafTransparenceItem&>( GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ? + const char* pId = ( ( pGraphic->IsTransparent() || GetObjectItem( SDRATTR_GRAFTRANSPARENCE ).GetValue() ) ? ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) : ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) ); @@ -853,7 +853,7 @@ OUString SdrGrafObj::TakeObjNamePlural() const { case GraphicType::Bitmap: { - const char* pId = ( ( pGraphic->IsTransparent() || static_cast<const SdrGrafTransparenceItem&>( GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ? + const char* pId = ( ( pGraphic->IsTransparent() || GetObjectItem( SDRATTR_GRAFTRANSPARENCE ).GetValue() ) ? ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) : ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) ); diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index c1c710080897..0dd6abe5788a 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -1471,7 +1471,7 @@ drawing::TextFitToSizeType SdrTextObj::GetFitToSize() const drawing::TextFitToSizeType eType = drawing::TextFitToSizeType_NONE; if(!IsAutoGrowWidth()) - eType = static_cast<const SdrTextFitToSizeTypeItem&>(GetObjectItem(SDRATTR_TEXT_FITTOSIZE)).GetValue(); + eType = GetObjectItem(SDRATTR_TEXT_FITTOSIZE).GetValue(); return eType; } diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index d8b3ec449414..c8f7df06313d 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -1930,7 +1930,7 @@ void SdrTableObj::ReformatText() bool SdrTableObj::IsVerticalWriting() const { - const SvxWritingModeItem* pModeItem = dynamic_cast< const SvxWritingModeItem* >( &GetObjectItem( SDRATTR_TEXTDIRECTION ) ); + const SvxWritingModeItem* pModeItem = &GetObjectItem( SDRATTR_TEXTDIRECTION ); return pModeItem && pModeItem->GetValue() == css::text::WritingMode_TB_RL; } |