summaryrefslogtreecommitdiff
path: root/sd/source/ui/view
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/view')
-rw-r--r--sd/source/ui/view/drtxtob1.cxx17
-rw-r--r--sd/source/ui/view/drviewsf.cxx2
-rw-r--r--sd/source/ui/view/viewshel.cxx119
3 files changed, 61 insertions, 77 deletions
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index 6aa73bce3301..eda20834083d 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -112,7 +112,6 @@ namespace sd {
void TextObjectBar::Execute( SfxRequest &rReq )
{
const SfxItemSet* pArgs = rReq.GetArgs();
- const SfxPoolItem* pPoolItem = nullptr;
sal_uInt16 nSlot = rReq.GetSlot();
OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
@@ -459,7 +458,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
OUString sStyleName(SdResId(STR_PSEUDOSHEET_OUTLINE) + " 1");
SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find(sStyleName, SfxStyleFamily::Pseudo);
if( pFirstStyleSheet )
- pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem));
+ pItem = pFirstStyleSheet->GetItemSet().GetItemIfSet(EE_PARA_NUMBULLET, false);
if (pItem )
{
@@ -712,8 +711,8 @@ void TextObjectBar::Execute( SfxRequest &rReq )
bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
SvxAdjust nAdjust = SvxAdjust::Left;
- if( SfxItemState::SET == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) )
- nAdjust = static_cast<const SvxAdjustItem*>(pPoolItem)->GetAdjust();
+ if( const SvxAdjustItem* pAdjustItem = aEditAttr.GetItemIfSet(EE_PARA_JUST) )
+ nAdjust = pAdjustItem->GetAdjust();
if( bLeftToRight )
{
@@ -823,20 +822,16 @@ void TextObjectBar::Execute( SfxRequest &rReq )
{
pColorItem = std::make_unique<SvxColorItem>(pNewArgs->Get(EE_CHAR_COLOR));
}
- const SfxPoolItem* pItem = nullptr;
- if (pArgs->GetItemState(SID_ATTR_COLOR_THEME_INDEX, false, &pItem) == SfxItemState::SET)
+ if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_THEME_INDEX, false))
{
- auto pIntItem = static_cast<const SfxInt16Item*>(pItem);
pColorItem->GetThemeColor().SetThemeIndex(pIntItem->GetValue());
}
- if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_MOD, false, &pItem) == SfxItemState::SET)
+ if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_LUM_MOD, false))
{
- auto pIntItem = static_cast<const SfxInt16Item*>(pItem);
pColorItem->GetThemeColor().SetLumMod(pIntItem->GetValue());
}
- if (pArgs->GetItemState(SID_ATTR_COLOR_LUM_OFF, false, &pItem) == SfxItemState::SET)
+ if (const SfxInt16Item* pIntItem = pArgs->GetItemIfSet(SID_ATTR_COLOR_LUM_OFF, false))
{
- auto pIntItem = static_cast<const SfxInt16Item*>(pItem);
pColorItem->GetThemeColor().SetLumOff(pIntItem->GetValue());
}
if (pColorItem)
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index d54b43fd908a..471d549cb12a 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -617,7 +617,7 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
std::unique_ptr<SvxNumRule> pNumRule;
const SfxPoolItem* pTmpItem=nullptr;
- sal_uInt16 nNumItemId = SID_ATTR_NUMBERING_RULE;
+ TypedWhichId<SvxNumBulletItem> nNumItemId = SID_ATTR_NUMBERING_RULE;
sal_uInt16 nActNumLvl = mpDrawView->GetSelectionLevel();
pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId);
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index ae99d6a72b1f..866b794611bb 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -793,81 +793,72 @@ void ViewShell::SetupRulers()
}
}
-const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId)
+const SvxNumBulletItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, TypedWhichId<SvxNumBulletItem>& nNumItemId)
{
- const SfxPoolItem* pTmpItem = nullptr;
+ const SvxNumBulletItem* pTmpItem = aNewAttr.GetItemIfSet(nNumItemId, false);
+ if(pTmpItem)
+ return pTmpItem;
- if(aNewAttr.GetItemState(nNumItemId, false, &pTmpItem) == SfxItemState::SET)
- {
+ nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+ pTmpItem = aNewAttr.GetItemIfSet(nNumItemId, false);
+ if(pTmpItem)
return pTmpItem;
- }
- else
+
+ bool bOutliner = false;
+ bool bTitle = false;
+
+ if( mpView )
{
- nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
- SfxItemState eState = aNewAttr.GetItemState(nNumItemId, false, &pTmpItem);
- if (eState == SfxItemState::SET)
- return pTmpItem;
- else
- {
- bool bOutliner = false;
- bool bTitle = false;
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ const size_t nCount = rMarkList.GetMarkCount();
- if( mpView )
+ for(size_t nNum = 0; nNum < nCount; ++nNum)
+ {
+ SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
+ if( pObj->GetObjInventor() == SdrInventor::Default )
{
- const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
- const size_t nCount = rMarkList.GetMarkCount();
-
- for(size_t nNum = 0; nNum < nCount; ++nNum)
+ switch(pObj->GetObjIdentifier())
{
- SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
- if( pObj->GetObjInventor() == SdrInventor::Default )
- {
- switch(pObj->GetObjIdentifier())
- {
- case SdrObjKind::TitleText:
- bTitle = true;
- break;
- case SdrObjKind::OutlineText:
- bOutliner = true;
- break;
- default:
- break;
- }
- }
+ case SdrObjKind::TitleText:
+ bTitle = true;
+ break;
+ case SdrObjKind::OutlineText:
+ bOutliner = true;
+ break;
+ default:
+ break;
}
}
+ }
+ }
- const SvxNumBulletItem *pItem = nullptr;
- if(bOutliner)
- {
- SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
- SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( STR_LAYOUT_OUTLINE + " 1", SfxStyleFamily::Pseudo);
- if( pFirstStyleSheet )
- pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pItem));
- }
+ const SvxNumBulletItem *pItem = nullptr;
+ if(bOutliner)
+ {
+ SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
+ SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( STR_LAYOUT_OUTLINE + " 1", SfxStyleFamily::Pseudo);
+ if( pFirstStyleSheet )
+ pItem = pFirstStyleSheet->GetItemSet().GetItemIfSet(EE_PARA_NUMBULLET, false);
+ }
- if( pItem == nullptr )
- pItem = aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
+ if( pItem == nullptr )
+ pItem = aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
- aNewAttr.Put(pItem->CloneSetWhich(EE_PARA_NUMBULLET));
+ aNewAttr.Put(pItem->CloneSetWhich(EE_PARA_NUMBULLET));
- if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET )
- {
- const SvxNumBulletItem* pBulletItem = aNewAttr.GetItem(EE_PARA_NUMBULLET);
- const SvxNumRule& rRule = pBulletItem->GetNumRule();
- SvxNumRule aNewRule( rRule );
- aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS );
+ if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET )
+ {
+ const SvxNumBulletItem* pBulletItem = aNewAttr.GetItem(EE_PARA_NUMBULLET);
+ const SvxNumRule& rRule = pBulletItem->GetNumRule();
+ SvxNumRule aNewRule( rRule );
+ aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS );
- SvxNumBulletItem aNewItem( std::move(aNewRule), EE_PARA_NUMBULLET );
- aNewAttr.Put(aNewItem);
- }
+ SvxNumBulletItem aNewItem( std::move(aNewRule), EE_PARA_NUMBULLET );
+ aNewAttr.Put(aNewItem);
+ }
- SfxItemState eNumState = aNewAttr.GetItemState(nNumItemId, false, &pTmpItem);
- if (eNumState == SfxItemState::SET)
- return pTmpItem;
+ pTmpItem = aNewAttr.GetItemIfSet(nNumItemId, false);
- }
- }
return pTmpItem;
}
@@ -1202,9 +1193,8 @@ void ViewShell::ImpSidUndo(SfxRequest& rReq)
// Repair mode: allow undo/redo of all undo actions, even if access would
// be limited based on the view shell ID.
- const SfxPoolItem* pRepairItem;
- if (pReqArgs->GetItemState(SID_REPAIRPACKAGE, false, &pRepairItem) == SfxItemState::SET)
- bRepair = static_cast<const SfxBoolItem*>(pRepairItem)->GetValue();
+ if (const SfxBoolItem* pRepairItem = pReqArgs->GetItemIfSet(SID_REPAIRPACKAGE, false))
+ bRepair = pRepairItem->GetValue();
}
if(nNumber && pUndoManager)
@@ -1270,9 +1260,8 @@ void ViewShell::ImpSidRedo(SfxRequest& rReq)
nNumber = pUIntItem->GetValue();
// Repair mode: allow undo/redo of all undo actions, even if access would
// be limited based on the view shell ID.
- const SfxPoolItem* pRepairItem;
- if (pReqArgs->GetItemState(SID_REPAIRPACKAGE, false, &pRepairItem) == SfxItemState::SET)
- bRepair = static_cast<const SfxBoolItem*>(pRepairItem)->GetValue();
+ if (const SfxBoolItem* pRepairItem = pReqArgs->GetItemIfSet(SID_REPAIRPACKAGE, false))
+ bRepair = pRepairItem->GetValue();
}
if(nNumber && pUndoManager)