summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-03-01 08:55:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-03-01 09:54:18 +0100
commit535359269ed23e2faead8e9e905d57cc6121e269 (patch)
treeae4834fdb175b1764ff656687f0276ed347d3bac /svx
parentca3e12d5b560d27615aeac986f9dbc1258993e65 (diff)
use SfxItemSet::GetItemIfSet in svx
Change-Id: I7a56c9452102cf7f6524296219209aef05383d81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130736 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/dlgutil.cxx12
-rw-r--r--svx/source/dialog/hdft.cxx6
-rw-r--r--svx/source/dialog/optgrid.cxx17
-rw-r--r--svx/source/form/fmview.cxx5
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx16
-rw-r--r--svx/source/svdraw/MediaShellHelpers.cxx10
-rw-r--r--svx/source/svdraw/svdedtv1.cxx139
-rw-r--r--svx/source/svdraw/svdobj.cxx121
-rw-r--r--svx/source/svdraw/svdpntv.cxx14
-rw-r--r--svx/source/svdraw/svdundo.cxx8
-rw-r--r--svx/source/table/svdotable.cxx12
-rw-r--r--svx/source/table/tablecontroller.cxx30
-rw-r--r--svx/source/unodraw/unobrushitemhelper.cxx8
-rw-r--r--svx/source/unodraw/unoshape.cxx10
14 files changed, 221 insertions, 187 deletions
diff --git a/svx/source/dialog/dlgutil.cxx b/svx/source/dialog/dlgutil.cxx
index 3d40889a839f..a33e1ca9476c 100644
--- a/svx/source/dialog/dlgutil.cxx
+++ b/svx/source/dialog/dlgutil.cxx
@@ -30,9 +30,8 @@
FieldUnit GetModuleFieldUnit( const SfxItemSet& rSet )
{
- if (const SfxPoolItem* pItem = nullptr;
- SfxItemState::SET == rSet.GetItemState(SID_ATTR_METRIC, false, &pItem))
- return static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
+ if (const SfxUInt16Item* pItem = rSet.GetItemIfSet(SID_ATTR_METRIC, false))
+ return static_cast<FieldUnit>(pItem->GetValue());
return SfxModule::GetCurrentFieldUnit();
}
@@ -40,9 +39,8 @@ FieldUnit GetModuleFieldUnit( const SfxItemSet& rSet )
bool GetApplyCharUnit( const SfxItemSet& rSet )
{
bool bUseCharUnit = false;
- const SfxPoolItem* pItem = nullptr;
- if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_APPLYCHARUNIT, false, &pItem ) )
- bUseCharUnit = static_cast<const SfxBoolItem*>(pItem)->GetValue();
+ if ( const SfxBoolItem* pItem = rSet.GetItemIfSet( SID_ATTR_APPLYCHARUNIT, false ) )
+ bUseCharUnit = pItem->GetValue();
else
{
// FIXME - this might be wrong, cf. the DEV300 changes in GetModuleFieldUnit()
@@ -57,7 +55,7 @@ bool GetApplyCharUnit( const SfxItemSet& rSet )
{
pItem = pModule->GetItem( SID_ATTR_APPLYCHARUNIT );
if ( pItem )
- bUseCharUnit = static_cast<const SfxBoolItem*>(pItem)->GetValue();
+ bUseCharUnit = pItem->GetValue();
}
else
{
diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index f3bb4eccfd38..9f0985ad1057 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -416,13 +416,13 @@ void SvxHFPage::Reset( const SfxItemSet* rSet )
m_xCntSharedBox->save_state();
RangeHdl();
- const SfxPoolItem* pItem = nullptr;
SfxObjectShell* pShell;
- if(SfxItemState::SET == rSet->GetItemState(SID_HTML_MODE, false, &pItem) ||
+ const SfxUInt16Item* pItem = rSet->GetItemIfSet(SID_HTML_MODE, false);
+ if(pItem ||
( nullptr != (pShell = SfxObjectShell::Current()) &&
nullptr != (pItem = pShell->GetItem(SID_HTML_MODE))))
{
- sal_uInt16 nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ sal_uInt16 nHtmlMode = pItem->GetValue();
if (nHtmlMode & HTMLMODE_ON)
{
m_xCntSharedBox->hide();
diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx
index 06cedb798ca4..3cd12b48d1ae 100644
--- a/svx/source/dialog/optgrid.cxx
+++ b/svx/source/dialog/optgrid.cxx
@@ -175,12 +175,10 @@ bool SvxGridTabPage::FillItemSet( SfxItemSet* rCoreSet )
void SvxGridTabPage::Reset( const SfxItemSet* rSet )
{
- const SfxPoolItem* pAttr = nullptr;
+ const SvxGridItem* pGridAttr = nullptr;
- if( SfxItemState::SET == rSet->GetItemState( SID_ATTR_GRID_OPTIONS , false,
- &pAttr ))
+ if( (pGridAttr = rSet->GetItemIfSet( SID_ATTR_GRID_OPTIONS , false )) )
{
- const SvxGridItem* pGridAttr = static_cast<const SvxGridItem*>(pAttr);
m_xCbxUseGridsnap->set_active(pGridAttr->bUseGridsnap);
m_xCbxSynchronize->set_active(pGridAttr->bSynchronize);
m_xCbxGridVisible->set_active(pGridAttr->bGridVisible);
@@ -199,11 +197,9 @@ void SvxGridTabPage::Reset( const SfxItemSet* rSet )
void SvxGridTabPage::ActivatePage( const SfxItemSet& rSet )
{
- const SfxPoolItem* pAttr = nullptr;
- if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS , false,
- &pAttr ))
+ const SvxGridItem* pGridAttr = nullptr;
+ if( (pGridAttr = rSet.GetItemIfSet( SID_ATTR_GRID_OPTIONS , false )) )
{
- const SvxGridItem* pGridAttr = static_cast<const SvxGridItem*>(pAttr);
m_xCbxUseGridsnap->set_active(pGridAttr->bUseGridsnap);
ChangeGridsnapHdl_Impl(*m_xCbxUseGridsnap);
@@ -211,11 +207,10 @@ void SvxGridTabPage::ActivatePage( const SfxItemSet& rSet )
// Metric Change if necessary (as TabPage is in the dialog, where the
// metric can be set
- if( SfxItemState::SET != rSet.GetItemState( SID_ATTR_METRIC , false,
- &pAttr ))
+ const SfxUInt16Item* pItem = rSet.GetItemIfSet( SID_ATTR_METRIC , false );
+ if( !pItem )
return;
- const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pAttr);
FieldUnit eFUnit = static_cast<FieldUnit>(static_cast<tools::Long>(pItem->GetValue()));
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 09e984ee79f9..3d59d6f635d6 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -102,10 +102,9 @@ void FmFormView::Init()
SfxObjectShell* pObjShell = pFormModel->GetObjectShell();
if ( pObjShell && pObjShell->GetMedium() )
{
- const SfxPoolItem *pItem=nullptr;
- if ( pObjShell->GetMedium()->GetItemSet()->GetItemState( SID_COMPONENTDATA, false, &pItem ) == SfxItemState::SET )
+ if ( const SfxUnoAnyItem *pItem = pObjShell->GetMedium()->GetItemSet()->GetItemIfSet( SID_COMPONENTDATA, false ) )
{
- ::comphelper::NamedValueCollection aComponentData( static_cast<const SfxUnoAnyItem*>(pItem)->GetValue() );
+ ::comphelper::NamedValueCollection aComponentData( pItem->GetValue() );
bInitDesignMode = aComponentData.getOrDefault( "ApplyFormDesignMode", bInitDesignMode );
}
}
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 1b4f0abbac97..65245509440f 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -423,12 +423,12 @@ namespace drawinglayer::primitive2d
if(100 != nTransparence)
{
// need to check XFillFloatTransparence, object fill may still be completely transparent
- const SfxPoolItem* pGradientItem;
+ const XFillFloatTransparenceItem* pGradientItem;
- if(SfxItemState::SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, true, &pGradientItem)
- && static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->IsEnabled())
+ if((pGradientItem = rSet.GetItemIfSet(XATTR_FILLFLOATTRANSPARENCE, true))
+ && pGradientItem->IsEnabled())
{
- const XGradient& rGradient = static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->GetGradientValue();
+ const XGradient& rGradient = pGradientItem->GetGradientValue();
const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
@@ -618,13 +618,13 @@ namespace drawinglayer::primitive2d
attribute::FillGradientAttribute createNewTransparenceGradientAttribute(const SfxItemSet& rSet)
{
- const SfxPoolItem* pGradientItem;
+ const XFillFloatTransparenceItem* pGradientItem;
- if(SfxItemState::SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, true, &pGradientItem)
- && static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->IsEnabled())
+ if((pGradientItem = rSet.GetItemIfSet(XATTR_FILLFLOATTRANSPARENCE))
+ && pGradientItem->IsEnabled())
{
// test if float transparence is completely transparent
- const XGradient& rGradient = static_cast<const XFillFloatTransparenceItem*>(pGradientItem)->GetGradientValue();
+ const XGradient& rGradient = pGradientItem->GetGradientValue();
const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
diff --git a/svx/source/svdraw/MediaShellHelpers.cxx b/svx/source/svdraw/MediaShellHelpers.cxx
index 3277f05add98..e55a3d384ecc 100644
--- a/svx/source/svdraw/MediaShellHelpers.cxx
+++ b/svx/source/svdraw/MediaShellHelpers.cxx
@@ -81,12 +81,11 @@ const ::avmedia::MediaItem* Execute(const SdrMarkView* pSdrView, SfxRequest cons
return nullptr;
const SfxItemSet* pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem;
-
- if (!pArgs || (SfxItemState::SET != pArgs->GetItemState(SID_AVMEDIA_TOOLBOX, false, &pItem)))
- pItem = nullptr;
+ if (!pArgs)
+ return nullptr;
- if (!pItem)
+ const ::avmedia::MediaItem* pMediaItem = pArgs->GetItemIfSet(SID_AVMEDIA_TOOLBOX, false);
+ if (!pMediaItem)
return nullptr;
const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
@@ -99,7 +98,6 @@ const ::avmedia::MediaItem* Execute(const SdrMarkView* pSdrView, SfxRequest cons
if (!dynamic_cast<SdrMediaObj*>(pObj))
return nullptr;
- const ::avmedia::MediaItem* pMediaItem = static_cast<const ::avmedia::MediaItem*>(pItem);
static_cast<sdr::contact::ViewContactOfSdrMediaObj&>(pObj->GetViewContact())
.executeMediaItem(*pMediaItem);
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index be419695e324..2ec1bd1cf1d5 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -687,21 +687,24 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr)
{
// bReplaceAll has no effect here
tools::Rectangle aAllSnapRect(GetMarkedObjRect());
- const SfxPoolItem *pPoolItem=nullptr;
- if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1X,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrTransformRef1XItem*>(pPoolItem)->GetValue();
+ if (const SdrTransformRef1XItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_TRANSFORMREF1X))
+ {
+ tools::Long n = pPoolItem->GetValue();
SetRef1(Point(n,GetRef1().Y()));
}
- if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1Y,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrTransformRef1YItem*>(pPoolItem)->GetValue();
+ if (const SdrTransformRef1YItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_TRANSFORMREF1Y))
+ {
+ tools::Long n = pPoolItem->GetValue();
SetRef1(Point(GetRef1().X(),n));
}
- if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2X,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrTransformRef2XItem*>(pPoolItem)->GetValue();
+ if (const SdrTransformRef2XItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_TRANSFORMREF2X))
+ {
+ tools::Long n = pPoolItem->GetValue();
SetRef2(Point(n,GetRef2().Y()));
}
- if (rAttr.GetItemState(SDRATTR_TRANSFORMREF2Y,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrTransformRef2YItem*>(pPoolItem)->GetValue();
+ if (const SdrTransformRef2YItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_TRANSFORMREF2Y))
+ {
+ tools::Long n = pPoolItem->GetValue();
SetRef2(Point(GetRef2().X(),n));
}
tools::Long nAllPosX=0; bool bAllPosX=false;
@@ -709,20 +712,24 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr)
tools::Long nAllWdt=0; bool bAllWdt=false;
tools::Long nAllHgt=0; bool bAllHgt=false;
bool bDoIt=false;
- if (rAttr.GetItemState(SDRATTR_ALLPOSITIONX,true,&pPoolItem)==SfxItemState::SET) {
- nAllPosX=static_cast<const SdrAllPositionXItem*>(pPoolItem)->GetValue();
+ if (const SdrAllPositionXItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ALLPOSITIONX))
+ {
+ nAllPosX = pPoolItem->GetValue();
bAllPosX=true; bDoIt=true;
}
- if (rAttr.GetItemState(SDRATTR_ALLPOSITIONY,true,&pPoolItem)==SfxItemState::SET) {
- nAllPosY=static_cast<const SdrAllPositionYItem*>(pPoolItem)->GetValue();
+ if (const SdrAllPositionYItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ALLPOSITIONY))
+ {
+ nAllPosY = pPoolItem->GetValue();
bAllPosY=true; bDoIt=true;
}
- if (rAttr.GetItemState(SDRATTR_ALLSIZEWIDTH,true,&pPoolItem)==SfxItemState::SET) {
- nAllWdt=static_cast<const SdrAllSizeWidthItem*>(pPoolItem)->GetValue();
+ if (const SdrAllSizeWidthItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ALLSIZEWIDTH))
+ {
+ nAllWdt = pPoolItem->GetValue();
bAllWdt=true; bDoIt=true;
}
- if (rAttr.GetItemState(SDRATTR_ALLSIZEHEIGHT,true,&pPoolItem)==SfxItemState::SET) {
- nAllHgt=static_cast<const SdrAllSizeHeightItem*>(pPoolItem)->GetValue();
+ if (const SdrAllSizeHeightItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ALLSIZEHEIGHT))
+ {
+ nAllHgt = pPoolItem->GetValue();
bAllHgt=true; bDoIt=true;
}
if (bDoIt) {
@@ -733,24 +740,29 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr)
if (bAllHgt) aRect.SetBottom(aAllSnapRect.Top()+nAllHgt );
SetMarkedObjRect(aRect);
}
- if (rAttr.GetItemState(SDRATTR_RESIZEXALL,true,&pPoolItem)==SfxItemState::SET) {
- Fraction aXFact=static_cast<const SdrResizeXAllItem*>(pPoolItem)->GetValue();
+ if (const SdrResizeXAllItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_RESIZEXALL))
+ {
+ Fraction aXFact = pPoolItem->GetValue();
ResizeMarkedObj(aAllSnapRect.TopLeft(),aXFact,Fraction(1,1));
}
- if (rAttr.GetItemState(SDRATTR_RESIZEYALL,true,&pPoolItem)==SfxItemState::SET) {
- Fraction aYFact=static_cast<const SdrResizeYAllItem*>(pPoolItem)->GetValue();
+ if (const SdrResizeYAllItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_RESIZEYALL))
+ {
+ Fraction aYFact = pPoolItem->GetValue();
ResizeMarkedObj(aAllSnapRect.TopLeft(),Fraction(1,1),aYFact);
}
- if (rAttr.GetItemState(SDRATTR_ROTATEALL,true,&pPoolItem)==SfxItemState::SET) {
- Degree100 nAngle=static_cast<const SdrRotateAllItem*>(pPoolItem)->GetValue();
+ if (const SdrRotateAllItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ROTATEALL))
+ {
+ Degree100 nAngle = pPoolItem->GetValue();
RotateMarkedObj(aAllSnapRect.Center(),nAngle);
}
- if (rAttr.GetItemState(SDRATTR_HORZSHEARALL,true,&pPoolItem)==SfxItemState::SET) {
- Degree100 nAngle=static_cast<const SdrHorzShearAllItem*>(pPoolItem)->GetValue();
+ if (const SdrHorzShearAllItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_HORZSHEARALL))
+ {
+ Degree100 nAngle = pPoolItem->GetValue();
ShearMarkedObj(aAllSnapRect.Center(),nAngle);
}
- if (rAttr.GetItemState(SDRATTR_VERTSHEARALL,true,&pPoolItem)==SfxItemState::SET) {
- Degree100 nAngle=static_cast<const SdrVertShearAllItem*>(pPoolItem)->GetValue();
+ if (const SdrVertShearAllItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_VERTSHEARALL))
+ {
+ Degree100 nAngle = pPoolItem->GetValue();
ShearMarkedObj(aAllSnapRect.Center(),nAngle,true);
}
@@ -1593,58 +1605,63 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin
bool bSetAttr=false;
SfxItemSet aSetAttr(mpModel->GetItemPool());
- const SfxPoolItem* pPoolItem=nullptr;
-
// position
- if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_POS_X,true,&pPoolItem)) {
- nPosDX=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue() - aRect.Left();
+ if (const SfxInt32Item *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_POS_X))
+ {
+ nPosDX = pPoolItem->GetValue() - aRect.Left();
bChgPos=true;
}
- if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_POS_Y,true,&pPoolItem)){
- nPosDY=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue() - aRect.Top();
+ if (const SfxInt32Item *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_POS_Y))
+ {
+ nPosDY = pPoolItem->GetValue() - aRect.Top();
bChgPos=true;
}
// size
- if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_WIDTH,true,&pPoolItem)) {
- nSizX=static_cast<const SfxUInt32Item*>(pPoolItem)->GetValue();
+ if (const SfxUInt32Item *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_WIDTH))
+ {
+ nSizX = pPoolItem->GetValue();
bChgSiz=true;
bChgWdh=true;
}
- if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,true,&pPoolItem)) {
- nSizY=static_cast<const SfxUInt32Item*>(pPoolItem)->GetValue();
+ if (const SfxUInt32Item *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_HEIGHT))
+ {
+ nSizY = pPoolItem->GetValue();
bChgSiz=true;
bChgHgt=true;
}
if (bChgSiz) {
- if (bTiledRendering && SfxItemState::SET != rAttr.GetItemState(SID_ATTR_TRANSFORM_SIZE_POINT, true, &pPoolItem))
+ if (bTiledRendering && SfxItemState::SET != rAttr.GetItemState(SID_ATTR_TRANSFORM_SIZE_POINT))
eSizePoint = RectPoint::LT;
else
eSizePoint = static_cast<RectPoint>(rAttr.Get(SID_ATTR_TRANSFORM_SIZE_POINT).GetValue());
}
// rotation
- if (SfxItemState::SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_DELTA_ANGLE, true, &pPoolItem)) {
- nRotateAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ if (const SdrAngleItem *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_DELTA_ANGLE))
+ {
+ nRotateAngle = pPoolItem->GetValue();
bRotate = (nRotateAngle != 0_deg100);
}
// rotation
- if (SfxItemState::SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_ANGLE, true, &pPoolItem)) {
- nRotateAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue() - nOldRotateAngle;
+ if (const SdrAngleItem *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_ANGLE))
+ {
+ nRotateAngle = pPoolItem->GetValue() - nOldRotateAngle;
bRotate = (nRotateAngle != 0_deg100);
}
// position rotation point x
- if(bRotate || SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ROT_X, true ,&pPoolItem))
+ if(bRotate || rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_ROT_X))
nRotateX = rAttr.Get(SID_ATTR_TRANSFORM_ROT_X).GetValue();
// position rotation point y
- if(bRotate || SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_ROT_Y, true ,&pPoolItem))
+ if(bRotate || rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_ROT_Y))
nRotateY = rAttr.Get(SID_ATTR_TRANSFORM_ROT_Y).GetValue();
// shearing
- if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_SHEAR,true,&pPoolItem)) {
- Degree100 nNewShearAngle=static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ if (const SdrAngleItem *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_SHEAR))
+ {
+ Degree100 nNewShearAngle=pPoolItem->GetValue();
if (nNewShearAngle>SDRMAXSHEAR) nNewShearAngle=SDRMAXSHEAR;
if (nNewShearAngle<-SDRMAXSHEAR) nNewShearAngle=-SDRMAXSHEAR;
if (nNewShearAngle!=nOldShearAngle) {
@@ -1672,24 +1689,28 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin
}
// AutoGrow
- if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_AUTOWIDTH,true,&pPoolItem)) {
- bool bAutoGrow=static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ if (const SfxBoolItem *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_AUTOWIDTH))
+ {
+ bool bAutoGrow = pPoolItem->GetValue();
aSetAttr.Put(makeSdrTextAutoGrowWidthItem(bAutoGrow));
bSetAttr=true;
}
- if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_AUTOHEIGHT,true,&pPoolItem)) {
- bool bAutoGrow=static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ if (const SfxBoolItem *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_AUTOHEIGHT))
+ {
+ bool bAutoGrow = pPoolItem->GetValue();
aSetAttr.Put(makeSdrTextAutoGrowHeightItem(bAutoGrow));
bSetAttr=true;
}
// corner radius
- if (m_bEdgeRadiusAllowed && SfxItemState::SET==rAttr.GetItemState(SDRATTR_CORNER_RADIUS,true,&pPoolItem)) {
- tools::Long nRadius=static_cast<const SdrMetricItem*>(pPoolItem)->GetValue();
- aSetAttr.Put(makeSdrEckenradiusItem(nRadius));
- bSetAttr=true;
- }
+ if (m_bEdgeRadiusAllowed)
+ if (const SdrMetricItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_CORNER_RADIUS))
+ {
+ tools::Long nRadius = pPoolItem->GetValue();
+ aSetAttr.Put(makeSdrEckenradiusItem(nRadius));
+ bSetAttr=true;
+ }
ForcePossibilities();
@@ -1764,9 +1785,9 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin
const size_t nMarkCount=rMarkList.GetMarkCount();
// protect position
- if(SfxItemState::SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_POS, true, &pPoolItem))
+ if(const SfxBoolItem *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_PROTECT_POS))
{
- const bool bProtPos(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ const bool bProtPos(pPoolItem->GetValue());
bool bChanged(false);
for(size_t i = 0; i < nMarkCount; ++i)
@@ -1805,9 +1826,9 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin
if(!m_bMoveProtect)
{
// protect size
- if(SfxItemState::SET == rAttr.GetItemState(SID_ATTR_TRANSFORM_PROTECT_SIZE, true, &pPoolItem))
+ if(const SfxBoolItem *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_PROTECT_SIZE))
{
- const bool bProtSize(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
+ const bool bProtSize(pPoolItem->GetValue());
bool bChanged(false);
for(size_t i = 0; i < nMarkCount; ++i)
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index f4068748d512..8259fc8e5f3a 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -2028,37 +2028,45 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
const tools::Rectangle& rSnap=GetSnapRect();
const tools::Rectangle& rLogic=GetLogicRect();
Point aRef1(rSnap.Center());
- const SfxPoolItem *pPoolItem=nullptr;
- if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1X,true,&pPoolItem)==SfxItemState::SET) {
- aRef1.setX(static_cast<const SdrTransformRef1XItem*>(pPoolItem)->GetValue() );
+
+ if (const SdrTransformRef1XItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_TRANSFORMREF1X))
+ {
+ aRef1.setX(pPoolItem->GetValue() );
}
- if (rAttr.GetItemState(SDRATTR_TRANSFORMREF1Y,true,&pPoolItem)==SfxItemState::SET) {
- aRef1.setY(static_cast<const SdrTransformRef1YItem*>(pPoolItem)->GetValue() );
+ if (const SdrTransformRef1YItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_TRANSFORMREF1Y))
+ {
+ aRef1.setY(pPoolItem->GetValue() );
}
tools::Rectangle aNewSnap(rSnap);
- if (rAttr.GetItemState(SDRATTR_MOVEX,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrMoveXItem*>(pPoolItem)->GetValue();
+ if (const SdrMoveXItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_MOVEX))
+ {
+ tools::Long n = pPoolItem->GetValue();
aNewSnap.Move(n,0);
}
- if (rAttr.GetItemState(SDRATTR_MOVEY,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrMoveYItem*>(pPoolItem)->GetValue();
+ if (const SdrMoveYItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_MOVEY))
+ {
+ tools::Long n = pPoolItem->GetValue();
aNewSnap.Move(0,n);
}
- if (rAttr.GetItemState(SDRATTR_ONEPOSITIONX,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrOnePositionXItem*>(pPoolItem)->GetValue();
+ if (const SdrOnePositionXItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ONEPOSITIONX))
+ {
+ tools::Long n = pPoolItem->GetValue();
aNewSnap.Move(n-aNewSnap.Left(),0);
}
- if (rAttr.GetItemState(SDRATTR_ONEPOSITIONY,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrOnePositionYItem*>(pPoolItem)->GetValue();
+ if (const SdrOnePositionYItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ONEPOSITIONY))
+ {
+ tools::Long n = pPoolItem->GetValue();
aNewSnap.Move(0,n-aNewSnap.Top());
}
- if (rAttr.GetItemState(SDRATTR_ONESIZEWIDTH,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrOneSizeWidthItem*>(pPoolItem)->GetValue();
+ if (const SdrOneSizeWidthItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ONESIZEWIDTH))
+ {
+ tools::Long n = pPoolItem->GetValue();
aNewSnap.SetRight(aNewSnap.Left()+n );
}
- if (rAttr.GetItemState(SDRATTR_ONESIZEHEIGHT,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrOneSizeHeightItem*>(pPoolItem)->GetValue();
+ if (const SdrOneSizeHeightItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ONESIZEHEIGHT))
+ {
+ tools::Long n = pPoolItem->GetValue();
aNewSnap.SetBottom(aNewSnap.Top()+n );
}
if (aNewSnap!=rSnap) {
@@ -2069,42 +2077,49 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
}
}
- if (rAttr.GetItemState(SDRATTR_SHEARANGLE,true,&pPoolItem)==SfxItemState::SET) {
- Degree100 n=static_cast<const SdrShearAngleItem*>(pPoolItem)->GetValue();
+ if (const SdrShearAngleItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_SHEARANGLE))
+ {
+ Degree100 n = pPoolItem->GetValue();
n-=GetShearAngle();
if (n) {
double nTan = tan(toRadians(n));
NbcShear(aRef1,n,nTan,false);
}
}
- if (rAttr.GetItemState(SDRATTR_ROTATEANGLE,true,&pPoolItem)==SfxItemState::SET) {
- Degree100 n=static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ if (const SdrAngleItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ROTATEANGLE))
+ {
+ Degree100 n = pPoolItem->GetValue();
n-=GetRotateAngle();
if (n) {
NbcRotate(aRef1,n);
}
}
- if (rAttr.GetItemState(SDRATTR_ROTATEONE,true,&pPoolItem)==SfxItemState::SET) {
- Degree100 n=static_cast<const SdrRotateOneItem*>(pPoolItem)->GetValue();
+ if (const SdrRotateOneItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_ROTATEONE))
+ {
+ Degree100 n = pPoolItem->GetValue();
NbcRotate(aRef1,n);
}
- if (rAttr.GetItemState(SDRATTR_HORZSHEARONE,true,&pPoolItem)==SfxItemState::SET) {
- Degree100 n=static_cast<const SdrHorzShearOneItem*>(pPoolItem)->GetValue();
+ if (const SdrHorzShearOneItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_HORZSHEARONE))
+ {
+ Degree100 n = pPoolItem->GetValue();
double nTan = tan(toRadians(n));
NbcShear(aRef1,n,nTan,false);
}
- if (rAttr.GetItemState(SDRATTR_VERTSHEARONE,true,&pPoolItem)==SfxItemState::SET) {
- Degree100 n=static_cast<const SdrVertShearOneItem*>(pPoolItem)->GetValue();
+ if (const SdrVertShearOneItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_VERTSHEARONE))
+ {
+ Degree100 n = pPoolItem->GetValue();
double nTan = tan(toRadians(n));
NbcShear(aRef1,n,nTan,true);
}
- if (rAttr.GetItemState(SDRATTR_OBJMOVEPROTECT,true,&pPoolItem)==SfxItemState::SET) {
- bool b=static_cast<const SdrYesNoItem*>(pPoolItem)->GetValue();
+ if (const SdrYesNoItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_OBJMOVEPROTECT))
+ {
+ bool b = pPoolItem->GetValue();
SetMoveProtect(b);
}
- if (rAttr.GetItemState(SDRATTR_OBJSIZEPROTECT,true,&pPoolItem)==SfxItemState::SET) {
- bool b=static_cast<const SdrYesNoItem*>(pPoolItem)->GetValue();
+ if (const SdrYesNoItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_OBJSIZEPROTECT))
+ {
+ bool b = pPoolItem->GetValue();
SetResizeProtect(b);
}
@@ -2112,23 +2127,26 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
if( IsMoveProtect() )
SetResizeProtect( true );
- if (rAttr.GetItemState(SDRATTR_OBJPRINTABLE,true,&pPoolItem)==SfxItemState::SET) {
- bool b=static_cast<const SdrObjPrintableItem*>(pPoolItem)->GetValue();
+ if (const SdrObjPrintableItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_OBJPRINTABLE))
+ {
+ bool b = pPoolItem->GetValue();
SetPrintable(b);
}
- if (rAttr.GetItemState(SDRATTR_OBJVISIBLE,true,&pPoolItem)==SfxItemState::SET) {
- bool b=static_cast<const SdrObjVisibleItem*>(pPoolItem)->GetValue();
+ if (const SdrObjVisibleItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_OBJVISIBLE))
+ {
+ bool b = pPoolItem->GetValue();
SetVisible(b);
}
SdrLayerID nLayer=SDRLAYER_NOTFOUND;
- if (rAttr.GetItemState(SDRATTR_LAYERID,true,&pPoolItem)==SfxItemState::SET) {
- nLayer=static_cast<const SdrLayerIdItem*>(pPoolItem)->GetValue();
+ if (const SdrLayerIdItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LAYERID))
+ {
+ nLayer = pPoolItem->GetValue();
}
- if (rAttr.GetItemState(SDRATTR_LAYERNAME,true,&pPoolItem)==SfxItemState::SET)
+ if (const SdrLayerNameItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LAYERNAME))
{
- OUString aLayerName = static_cast<const SdrLayerNameItem*>(pPoolItem)->GetValue();
+ OUString aLayerName = pPoolItem->GetValue();
const SdrLayerAdmin& rLayAd(nullptr != getSdrPageFromSdrObject()
? getSdrPageFromSdrObject()->GetLayerAdmin()
: getSdrModelFromSdrObject().GetLayerAdmin());
@@ -2143,17 +2161,20 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
NbcSetLayer(nLayer);
}
- if (rAttr.GetItemState(SDRATTR_OBJECTNAME,true,&pPoolItem)==SfxItemState::SET) {
- OUString aName=static_cast<const SfxStringItem*>(pPoolItem)->GetValue();
+ if (const SfxStringItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_OBJECTNAME))
+ {
+ OUString aName = pPoolItem->GetValue();
SetName(aName);
}
tools::Rectangle aNewLogic(rLogic);
- if (rAttr.GetItemState(SDRATTR_LOGICSIZEWIDTH,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrLogicSizeWidthItem*>(pPoolItem)->GetValue();
+ if (const SdrLogicSizeWidthItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LOGICSIZEWIDTH))
+ {
+ tools::Long n = pPoolItem->GetValue();
aNewLogic.SetRight(aNewLogic.Left()+n );
}
- if (rAttr.GetItemState(SDRATTR_LOGICSIZEHEIGHT,true,&pPoolItem)==SfxItemState::SET) {
- tools::Long n=static_cast<const SdrLogicSizeHeightItem*>(pPoolItem)->GetValue();
+ if (const SdrLogicSizeHeightItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LOGICSIZEHEIGHT))
+ {
+ tools::Long n = pPoolItem->GetValue();
aNewLogic.SetBottom(aNewLogic.Top()+n );
}
if (aNewLogic!=rLogic) {
@@ -2161,11 +2182,13 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
}
Fraction aResizeX(1,1);
Fraction aResizeY(1,1);
- if (rAttr.GetItemState(SDRATTR_RESIZEXONE,true,&pPoolItem)==SfxItemState::SET) {
- aResizeX*=static_cast<const SdrResizeXOneItem*>(pPoolItem)->GetValue();
+ if (const SdrResizeXOneItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_RESIZEXONE))
+ {
+ aResizeX *= pPoolItem->GetValue();
}
- if (rAttr.GetItemState(SDRATTR_RESIZEYONE,true,&pPoolItem)==SfxItemState::SET) {
- aResizeY*=static_cast<const SdrResizeYOneItem*>(pPoolItem)->GetValue();
+ if (const SdrResizeYOneItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_RESIZEYONE))
+ {
+ aResizeY *= pPoolItem->GetValue();
}
if (aResizeX!=Fraction(1,1) || aResizeY!=Fraction(1,1)) {
NbcResize(aRef1,aResizeX,aResizeY);
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 0135120e577a..7843d52d49c1 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -900,18 +900,20 @@ void SdrPaintView::SetNotPersistDefaultAttr(const SfxItemSet& rAttr)
{
// bReplaceAll has no effect here at all.
bool bMeasure= dynamic_cast<const SdrView*>(this) != nullptr && static_cast<SdrView*>(this)->IsMeasureTool();
- const SfxPoolItem *pPoolItem=nullptr;
- if (rAttr.GetItemState(SDRATTR_LAYERID,true,&pPoolItem)==SfxItemState::SET) {
- SdrLayerID nLayerId=static_cast<const SdrLayerIdItem*>(pPoolItem)->GetValue();
+
+ if (const SdrLayerIdItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LAYERID))
+ {
+ SdrLayerID nLayerId = pPoolItem->GetValue();
const SdrLayer* pLayer=mpModel->GetLayerAdmin().GetLayerPerID(nLayerId);
if (pLayer!=nullptr) {
if (bMeasure) maMeasureLayer=pLayer->GetName();
else maActualLayer=pLayer->GetName();
}
}
- if (rAttr.GetItemState(SDRATTR_LAYERNAME,true,&pPoolItem)==SfxItemState::SET) {
- if (bMeasure) maMeasureLayer=static_cast<const SdrLayerNameItem*>(pPoolItem)->GetValue();
- else maActualLayer=static_cast<const SdrLayerNameItem*>(pPoolItem)->GetValue();
+ if (const SdrLayerNameItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LAYERNAME))
+ {
+ if (bMeasure) maMeasureLayer = pPoolItem->GetValue();
+ else maActualLayer = pPoolItem->GetValue();
}
}
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index d26a27339541..5f5f2708dc94 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -26,6 +26,7 @@
#include <svx/svdlayer.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdview.hxx>
+#include <svx/xbtmpit.hxx>
#include <svx/xfillit0.hxx>
#include <svx/strings.hrc>
#include <svx/dialmgr.hxx>
@@ -1472,11 +1473,10 @@ bool SdrUndoDelPage::CanSdrRepeat(SdrView& /*rView*/) const
void SdrUndoDelPage::queryFillBitmap(const SfxItemSet& rItemSet)
{
- const SfxPoolItem *pItem = nullptr;
- if (rItemSet.GetItemState(XATTR_FILLBITMAP, false, &pItem) == SfxItemState::SET)
+ if (const XFillBitmapItem *pItem = rItemSet.GetItemIfSet(XATTR_FILLBITMAP, false))
mpFillBitmapItem.reset(pItem->Clone());
- if (rItemSet.GetItemState(XATTR_FILLSTYLE, false, &pItem) == SfxItemState::SET)
- mbHasFillBitmap = static_cast<const XFillStyleItem*>(pItem)->GetValue() == css::drawing::FillStyle_BITMAP;
+ if (const XFillStyleItem *pItem = rItemSet.GetItemIfSet(XATTR_FILLSTYLE, false))
+ mbHasFillBitmap = pItem->GetValue() == css::drawing::FillStyle_BITMAP;
}
void SdrUndoDelPage::clearFillBitmap()
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 5e346f3c115c..bef65e9825ac 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -2029,15 +2029,15 @@ WritingMode SdrTableObj::GetWritingMode() const
WritingMode eWritingMode = WritingMode_LR_TB;
const SfxItemSet &rSet = pStyle->GetItemSet();
- const SfxPoolItem *pItem;
- if ( rSet.GetItemState( SDRATTR_TEXTDIRECTION, false, &pItem ) == SfxItemState::SET )
- eWritingMode = static_cast< const SvxWritingModeItem * >( pItem )->GetValue();
+ if ( const SvxWritingModeItem *pItem = rSet.GetItemIfSet( SDRATTR_TEXTDIRECTION ))
+ eWritingMode = pItem->GetValue();
- if ( ( eWritingMode != WritingMode_TB_RL ) &&
- ( rSet.GetItemState( EE_PARA_WRITINGDIR, false, &pItem ) == SfxItemState::SET ) )
+ if ( const SvxFrameDirectionItem *pItem;
+ ( eWritingMode != WritingMode_TB_RL ) &&
+ ( pItem = rSet.GetItemIfSet( EE_PARA_WRITINGDIR, false ) ) )
{
- if ( static_cast< const SvxFrameDirectionItem * >( pItem )->GetValue() == SvxFrameDirection::Horizontal_LR_TB )
+ if ( pItem->GetValue() == SvxFrameDirection::Horizontal_LR_TB )
eWritingMode = WritingMode_LR_TB;
else
eWritingMode = WritingMode_RL_TB;
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index a81140c8ddd1..6daf74eb8812 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -539,8 +539,8 @@ void SvxTableController::onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs )
if (pItem)
{
nCount = static_cast<const SfxInt16Item*>(pItem)->GetValue();
- if(SfxItemState::SET == pArgs->GetItemState(SID_TABLE_PARAM_INSERT_AFTER, true, &pItem))
- bInsertAfter = static_cast<const SfxBoolItem*>(pItem)->GetValue();
+ if(const SfxBoolItem* pItem2 = pArgs->GetItemIfSet(SID_TABLE_PARAM_INSERT_AFTER))
+ bInsertAfter = pItem2->GetValue();
}
}
@@ -1200,25 +1200,25 @@ void SvxTableController::SetTableStyleSettings( const SfxItemSet* pArgs )
SdrModel& rModel(rTableObj.getSdrModelFromSdrObject());
TableStyleSettings aSettings(rTableObj.getTableStyleSettings() );
- const SfxPoolItem *pPoolItem=nullptr;
+ const SfxBoolItem *pPoolItem=nullptr;
- if( SfxItemState::SET == pArgs->GetItemState(ID_VAL_USEFIRSTROWSTYLE, false,&pPoolItem) )
- aSettings.mbUseFirstRow = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+ if( (pPoolItem = pArgs->GetItemIfSet(ID_VAL_USEFIRSTROWSTYLE, false)) )
+ aSettings.mbUseFirstRow = pPoolItem->GetValue();
- if( SfxItemState::SET == pArgs->GetItemState(ID_VAL_USELASTROWSTYLE, false,&pPoolItem) )
- aSettings.mbUseLastRow = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+ if( (pPoolItem = pArgs->GetItemIfSet(ID_VAL_USELASTROWSTYLE, false)) )
+ aSettings.mbUseLastRow = pPoolItem->GetValue();
- if( SfxItemState::SET == pArgs->GetItemState(ID_VAL_USEBANDINGROWSTYLE, false,&pPoolItem) )
- aSettings.mbUseRowBanding = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+ if( (pPoolItem = pArgs->GetItemIfSet(ID_VAL_USEBANDINGROWSTYLE, false)) )
+ aSettings.mbUseRowBanding = pPoolItem->GetValue();
- if( SfxItemState::SET == pArgs->GetItemState(ID_VAL_USEFIRSTCOLUMNSTYLE, false,&pPoolItem) )
- aSettings.mbUseFirstColumn = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+ if( (pPoolItem = pArgs->GetItemIfSet(ID_VAL_USEFIRSTCOLUMNSTYLE, false)) )
+ aSettings.mbUseFirstColumn = pPoolItem->GetValue();
- if( SfxItemState::SET == pArgs->GetItemState(ID_VAL_USELASTCOLUMNSTYLE, false,&pPoolItem) )
- aSettings.mbUseLastColumn = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+ if( (pPoolItem = pArgs->GetItemIfSet(ID_VAL_USELASTCOLUMNSTYLE, false)) )
+ aSettings.mbUseLastColumn = pPoolItem->GetValue();
- if( SfxItemState::SET == pArgs->GetItemState(ID_VAL_USEBANDINGCOLUMNSTYLE, false,&pPoolItem) )
- aSettings.mbUseColumnBanding = static_cast< const SfxBoolItem* >(pPoolItem)->GetValue();
+ if( (pPoolItem = pArgs->GetItemIfSet(ID_VAL_USEBANDINGCOLUMNSTYLE, false)) )
+ aSettings.mbUseColumnBanding = pPoolItem->GetValue();
if( aSettings == rTableObj.getTableStyleSettings() )
return;
diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx
index d3dcf2680ec4..f0d1239f7fac 100644
--- a/svx/source/unodraw/unobrushitemhelper.cxx
+++ b/svx/source/unodraw/unobrushitemhelper.cxx
@@ -151,12 +151,12 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI
static sal_uInt16 getTransparenceForSvxBrushItem(const SfxItemSet& rSourceSet, bool bSearchInParents)
{
sal_uInt16 nFillTransparence(rSourceSet.Get(XATTR_FILLTRANSPARENCE, bSearchInParents).GetValue());
- const SfxPoolItem* pGradientItem = nullptr;
+ const XFillFloatTransparenceItem* pGradientItem = nullptr;
- if(SfxItemState::SET == rSourceSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, bSearchInParents, &pGradientItem)
- && static_cast< const XFillFloatTransparenceItem* >(pGradientItem)->IsEnabled())
+ if((pGradientItem = rSourceSet.GetItemIfSet(XATTR_FILLFLOATTRANSPARENCE, bSearchInParents))
+ && pGradientItem->IsEnabled())
{
- const XGradient& rGradient = static_cast< const XFillFloatTransparenceItem* >(pGradientItem)->GetGradientValue();
+ const XGradient& rGradient = pGradientItem->GetGradientValue();
const sal_uInt16 nStartLuminance(rGradient.GetStartColor().GetLuminance());
const sal_uInt16 nEndLuminance(rGradient.GetEndColor().GetLuminance());
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 4591c49c5899..4166fb03350a 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1877,10 +1877,9 @@ uno::Any SvxShape::GetAnyForItem( SfxItemSet const & aSet, const SfxItemProperty
{
case SDRATTR_CIRCSTARTANGLE:
{
- const SfxPoolItem* pPoolItem=nullptr;
- if(aSet.GetItemState(SDRATTR_CIRCSTARTANGLE,false,&pPoolItem)==SfxItemState::SET)
+ if(const SdrAngleItem* pPoolItem = aSet.GetItemIfSet(SDRATTR_CIRCSTARTANGLE,false))
{
- Degree100 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ Degree100 nAngle = pPoolItem->GetValue();
aAny <<= nAngle.get();
}
break;
@@ -1888,10 +1887,9 @@ uno::Any SvxShape::GetAnyForItem( SfxItemSet const & aSet, const SfxItemProperty
case SDRATTR_CIRCENDANGLE:
{
- const SfxPoolItem* pPoolItem=nullptr;
- if (aSet.GetItemState(SDRATTR_CIRCENDANGLE,false,&pPoolItem)==SfxItemState::SET)
+ if (const SdrAngleItem* pPoolItem = aSet.GetItemIfSet(SDRATTR_CIRCENDANGLE,false))
{
- Degree100 nAngle = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ Degree100 nAngle = pPoolItem->GetValue();
aAny <<= nAngle.get();
}
break;