summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
Diffstat (limited to 'sd')
-rw-r--r--sd/source/core/sdpage2.cxx6
-rw-r--r--sd/source/filter/html/sdhtmlfilter.cxx6
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx22
-rw-r--r--sd/source/ui/app/sdmod1.cxx13
-rw-r--r--sd/source/ui/app/sdmod2.cxx41
-rw-r--r--sd/source/ui/dlg/BulletAndPositionDlg.cxx29
-rw-r--r--sd/source/ui/dlg/copydlg.cxx39
-rw-r--r--sd/source/ui/dlg/dlgfield.cxx5
-rw-r--r--sd/source/ui/dlg/dlgolbul.cxx2
-rw-r--r--sd/source/ui/dlg/prltempl.cxx4
-rw-r--r--sd/source/ui/dlg/prntopts.cxx5
-rw-r--r--sd/source/ui/dlg/sdpreslt.cxx9
-rw-r--r--sd/source/ui/dlg/tpoption.cxx9
-rw-r--r--sd/source/ui/docshell/docshel4.cxx4
-rw-r--r--sd/source/ui/func/fubullet.cxx10
-rw-r--r--sd/source/ui/func/fuchar.cxx7
-rw-r--r--sd/source/ui/func/fuconbez.cxx6
-rw-r--r--sd/source/ui/func/fucopy.cxx77
-rw-r--r--sd/source/ui/func/fuinsert.cxx4
-rw-r--r--sd/source/ui/func/fuolbull.cxx124
-rw-r--r--sd/source/ui/func/fupage.cxx12
-rw-r--r--sd/source/ui/func/fuparagr.cxx9
-rw-r--r--sd/source/ui/func/futempl.cxx7
-rw-r--r--sd/source/ui/func/undoback.cxx8
-rw-r--r--sd/source/ui/inc/BulletAndPositionDlg.hxx2
-rw-r--r--sd/source/ui/inc/ViewShell.hxx4
-rw-r--r--sd/source/ui/inc/fuolbull.hxx3
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.cxx8
-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
31 files changed, 278 insertions, 335 deletions
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 1870ed3287a7..a5c8d1d5ff6d 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -469,16 +469,16 @@ bool SdPage::setAlienAttributes( const css::uno::Any& rAttributes )
void SdPage::getAlienAttributes( css::uno::Any& rAttributes )
{
- const SfxPoolItem* pItem;
+ const SvXMLAttrContainerItem* pItem;
- if( (mpItems == nullptr) || ( SfxItemState::SET != mpItems->GetItemState( SDRATTR_XMLATTRIBUTES, false, &pItem ) ) )
+ if( (mpItems == nullptr) || !( pItem = mpItems->GetItemIfSet( SDRATTR_XMLATTRIBUTES, false ) ) )
{
SvXMLAttrContainerItem aAlienAttributes;
aAlienAttributes.QueryValue( rAttributes );
}
else
{
- static_cast<const SvXMLAttrContainerItem*>(pItem)->QueryValue( rAttributes );
+ pItem->QueryValue( rAttributes );
}
}
diff --git a/sd/source/filter/html/sdhtmlfilter.cxx b/sd/source/filter/html/sdhtmlfilter.cxx
index 6e9488c04278..f7a3bc10f2aa 100644
--- a/sd/source/filter/html/sdhtmlfilter.cxx
+++ b/sd/source/filter/html/sdhtmlfilter.cxx
@@ -40,10 +40,8 @@ bool SdHTMLFilter::Export()
css::uno::Sequence<css::beans::PropertyValue> aParams;
- const SfxPoolItem* pItem;
-
- if (pSet->GetItemState(SID_FILTER_DATA, false, &pItem) == SfxItemState::SET)
- static_cast<const SfxUnoAnyItem*>(pItem)->GetValue() >>= aParams;
+ if (const SfxUnoAnyItem* pItem = pSet->GetItemIfSet(SID_FILTER_DATA, false))
+ pItem->GetValue() >>= aParams;
HtmlExport aExport(mrMedium.GetName(), aParams, &mrDocument, &mrDocShell);
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index fc44a5877307..ab9fe0c1a750 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -322,10 +322,9 @@ void AnnotationManagerImpl::ExecuteInsertAnnotation(SfxRequest const & rReq)
OUString sText;
if (pArgs)
{
- const SfxPoolItem* pPoolItem = nullptr;
- if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_TEXT, true, &pPoolItem))
+ if (const SfxStringItem* pPoolItem = pArgs->GetItemIfSet(SID_ATTR_POSTIT_TEXT))
{
- sText = static_cast<const SfxStringItem*>(pPoolItem)->GetValue();
+ sText = pPoolItem->GetValue();
}
}
@@ -394,20 +393,19 @@ void AnnotationManagerImpl::ExecuteEditAnnotation(SfxRequest const & rReq)
if (mpDoc->IsUndoEnabled())
mpDoc->BegUndo(SdResId(STR_ANNOTATION_UNDO_EDIT));
- const SfxPoolItem* pPoolItem = nullptr;
- if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_ID, true, &pPoolItem))
+ if (const SvxPostItIdItem* pPoolItem = pArgs->GetItemIfSet(SID_ATTR_POSTIT_ID))
{
- sal_uInt32 nId = static_cast<const SvxPostItIdItem*>(pPoolItem)->GetValue().toUInt32();
+ sal_uInt32 nId = pPoolItem->GetValue().toUInt32();
xAnnotation = GetAnnotationById(nId);
}
- if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_TEXT, true, &pPoolItem))
- sText = static_cast<const SfxStringItem*>(pPoolItem)->GetValue();
+ if (const SfxStringItem* pPoolItem = pArgs->GetItemIfSet(SID_ATTR_POSTIT_TEXT))
+ sText = pPoolItem->GetValue();
- if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_POSITION_X, true, &pPoolItem))
- nPositionX = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ if (const SfxInt32Item* pPoolItem = pArgs->GetItemIfSet(SID_ATTR_POSTIT_POSITION_X))
+ nPositionX = pPoolItem->GetValue();
- if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_POSITION_Y, true, &pPoolItem))
- nPositionY = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+ if (const SfxInt32Item* pPoolItem = pArgs->GetItemIfSet(SID_ATTR_POSTIT_POSITION_Y))
+ nPositionY = pPoolItem->GetValue();
if (xAnnotation.is())
{
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 74c40dffcd1c..66a211bfe125 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -90,11 +90,10 @@ void SdModule::Execute(SfxRequest& rReq)
case SID_AUTOSPELL_CHECK:
{
// automatic spell checker
- const SfxPoolItem* pItem;
- if( pSet && SfxItemState::SET == pSet->GetItemState(
- SID_AUTOSPELL_CHECK, false, &pItem ) )
+ const SfxBoolItem* pItem;
+ if( pSet && (pItem = pSet->GetItemIfSet( SID_AUTOSPELL_CHECK, false ) ) )
{
- bool bOnlineSpelling = static_cast<const SfxBoolItem*>( pItem )->GetValue();
+ bool bOnlineSpelling = pItem->GetValue();
// save at document:
::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() );
if( pDocSh )
@@ -108,10 +107,10 @@ void SdModule::Execute(SfxRequest& rReq)
case SID_ATTR_METRIC:
{
- const SfxPoolItem* pItem;
- if ( pSet && SfxItemState::SET == pSet->GetItemState( SID_ATTR_METRIC, true, &pItem ) )
+ const SfxUInt16Item* pItem;
+ if ( pSet && (pItem = pSet->GetItemIfSet( SID_ATTR_METRIC ) ) )
{
- FieldUnit eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
+ FieldUnit eUnit = static_cast<FieldUnit>(pItem->GetValue());
switch( eUnit )
{
case FieldUnit::MM: // only the units which are also in the dialog
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 16dd1af96af5..58c822c47bc4 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -533,7 +533,6 @@ std::optional<SfxItemSet> SdModule::CreateItemSet( sal_uInt16 nSlot )
void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet )
{
- const SfxPoolItem* pItem = nullptr;
bool bNewDefTab = false;
bool bNewPrintOptions = false;
bool bMiscOptions = false;
@@ -557,45 +556,42 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet )
}
SdOptions* pOptions = GetSdOptions(eDocType);
// Grid
- if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS ,
- false, &pItem ))
+ if( const SdOptionsGridItem* pGridItem = static_cast<const SdOptionsGridItem*>(rSet.GetItemIfSet( SID_ATTR_GRID_OPTIONS, false )) )
{
- const SdOptionsGridItem* pGridItem = static_cast<const SdOptionsGridItem*>(pItem);
pGridItem->SetOptions( pOptions );
}
// Layout
- const SdOptionsLayoutItem* pLayoutItem = nullptr;
- if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_LAYOUT,
- false, reinterpret_cast<const SfxPoolItem**>(&pLayoutItem) ))
+ if( const SdOptionsLayoutItem* pLayoutItem = rSet.GetItemIfSet( ATTR_OPTIONS_LAYOUT, false ))
{
pLayoutItem->SetOptions( pOptions );
}
// Metric
- if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_METRIC, false, &pItem ) )
+ if( const SfxUInt16Item* pItem = rSet.GetItemIfSet( SID_ATTR_METRIC, false ) )
{
if( pDoc && eDocType == pDoc->GetDocumentType() )
PutItem( *pItem );
- pOptions->SetMetric( static_cast<const SfxUInt16Item*>( pItem )->GetValue() );
+ pOptions->SetMetric( pItem->GetValue() );
}
sal_uInt16 nDefTab = pOptions->GetDefTab();
// Default-Tabulator
- if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_DEFTABSTOP, false, &pItem ) )
+ if( const SfxUInt16Item* pItem = rSet.GetItemIfSet( SID_ATTR_DEFTABSTOP, false ) )
{
- nDefTab = static_cast<const SfxUInt16Item*>( pItem )->GetValue();
+ nDefTab = pItem->GetValue();
pOptions->SetDefTab( nDefTab );
bNewDefTab = true;
}
// Scale
- if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_SCALE_X, false, &pItem ) )
+ if( const SfxInt32Item* pItem = rSet.GetItemIfSet( ATTR_OPTIONS_SCALE_X, false ) )
{
- sal_Int32 nX = static_cast<const SfxInt32Item*>( pItem )->GetValue();
- if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_SCALE_Y, false, &pItem ) )
+ sal_Int32 nX = pItem->GetValue();
+ pItem = rSet.GetItemIfSet( ATTR_OPTIONS_SCALE_Y, false );
+ if( pItem )
{
- sal_Int32 nY = static_cast<const SfxInt32Item*>( pItem )->GetValue();
+ sal_Int32 nY = pItem->GetValue();
pOptions->SetScale( nX, nY );
// Apply to document only if doc type match
@@ -609,18 +605,16 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet )
}
// Misc
- const SdOptionsMiscItem* pMiscItem = nullptr;
- if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_MISC,
- false, reinterpret_cast<const SfxPoolItem**>(&pMiscItem) ))
+ const SdOptionsMiscItem* pMiscItem = rSet.GetItemIfSet( ATTR_OPTIONS_MISC, false);
+ if( pMiscItem )
{
pMiscItem->SetOptions( pOptions );
bMiscOptions = true;
}
// Snap
- const SdOptionsSnapItem* pSnapItem = nullptr;
- if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_SNAP,
- false, reinterpret_cast<const SfxPoolItem**>(&pSnapItem) ))
+ const SdOptionsSnapItem* pSnapItem = rSet.GetItemIfSet( ATTR_OPTIONS_SNAP, false );
+ if( pSnapItem )
{
pSnapItem->SetOptions( pOptions );
}
@@ -630,9 +624,8 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const SfxItemSet& rSet )
ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT> aPrintSet( GetPool() );
// Print
- const SdOptionsPrintItem* pPrintItem = nullptr;
- if( SfxItemState::SET == rSet.GetItemState( ATTR_OPTIONS_PRINT,
- false, reinterpret_cast<const SfxPoolItem**>(&pPrintItem) ))
+ const SdOptionsPrintItem* pPrintItem = rSet.GetItemIfSet( ATTR_OPTIONS_PRINT, false);
+ if( pPrintItem )
{
pPrintItem->SetOptions( pOptions );
diff --git a/sd/source/ui/dlg/BulletAndPositionDlg.cxx b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
index 8b42d63c8add..becea079e374 100644
--- a/sd/source/ui/dlg/BulletAndPositionDlg.cxx
+++ b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
@@ -216,20 +216,19 @@ SvxBulletAndPositionDlg::SvxBulletAndPositionDlg(weld::Window* pWindow, const Sf
// ActivatePage part
- const SfxPoolItem* pItem;
const SfxItemSet* pExampleSet = &rSet;
sal_uInt16 nTmpNumLvl = 1;
bool bPreset = false;
if (pExampleSet)
{
- if (SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, false, &pItem))
- bPreset = static_cast<const SfxBoolItem*>(pItem)->GetValue();
- if (SfxItemState::SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pItem))
- nTmpNumLvl = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if (const SfxBoolItem* pItem = pExampleSet->GetItemIfSet(SID_PARAM_NUM_PRESET, false))
+ bPreset = pItem->GetValue();
+ if (const SfxUInt16Item* pItem = pExampleSet->GetItemIfSet(SID_PARAM_CUR_NUM_LEVEL, false))
+ nTmpNumLvl = pItem->GetValue();
}
- if (SfxItemState::SET == rSet.GetItemState(nNumItemId, false, &pItem))
+ if (const SvxNumBulletItem* pItem = rSet.GetItemIfSet(nNumItemId, false))
{
- pSaveNum.reset(new SvxNumRule(static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()));
+ pSaveNum.reset(new SvxNumRule(pItem->GetNumRule()));
}
bModified = (!pActNum->Get(0) || bPreset);
@@ -296,22 +295,20 @@ bool SvxBulletAndPositionDlg::IsSlideScope() const { return m_xSlideRB->get_acti
void SvxBulletAndPositionDlg::Reset(const SfxItemSet* rSet)
{
- const SfxPoolItem* pItem;
+ const SvxNumBulletItem* pItem = rSet->GetItemIfSet(SID_ATTR_NUMBERING_RULE, false);
// in Draw the item exists as WhichId, in Writer only as SlotId
- SfxItemState eState = rSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
- if (eState != SfxItemState::SET)
+ if (!pItem)
{
nNumItemId = rSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
- eState = rSet->GetItemState(nNumItemId, false, &pItem);
+ pItem = rSet->GetItemIfSet(nNumItemId, false);
- if (eState != SfxItemState::SET)
+ if (!pItem)
{
- pItem = &static_cast<const SvxNumBulletItem&>(rSet->Get(nNumItemId));
- eState = SfxItemState::SET;
+ pItem = &rSet->Get(nNumItemId);
}
}
- DBG_ASSERT(eState == SfxItemState::SET, "no item found!");
- pSaveNum.reset(new SvxNumRule(static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule()));
+ DBG_ASSERT(pItem, "no item found!");
+ pSaveNum.reset(new SvxNumRule(pItem->GetNumRule()));
// insert levels
if (!m_xLevelLB->n_children())
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index 7dd290bdb9e7..eedae722a5a4 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -105,7 +105,6 @@ void CopyDlg::Reset()
m_xMtrFldWidth->set_range(-nRectWidth, nPageWidth, FieldUnit::MM_100TH);
m_xMtrFldHeight->set_range(-nRectHeight, nPageHeight, FieldUnit::MM_100TH);
- const SfxPoolItem* pPoolItem = nullptr;
OUString aStr;
SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8));
if (aDlgOpt.Exists())
@@ -116,39 +115,39 @@ void CopyDlg::Reset()
if (aStr.isEmpty())
{
- if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_NUMBER, true, &pPoolItem ) )
- m_xNumFldCopies->set_value(static_cast<const SfxUInt16Item*>(pPoolItem)->GetValue());
+ if( const SfxUInt16Item* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_NUMBER ) )
+ m_xNumFldCopies->set_value(pPoolItem->GetValue());
else
m_xNumFldCopies->set_value(1);
tools::Long nMoveX = 500;
- if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_X, true, &pPoolItem ) )
- nMoveX = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
+ if( const SfxInt32Item* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_MOVE_X ) )
+ nMoveX = pPoolItem->GetValue();
SetMetricValue( *m_xMtrFldMoveX, tools::Long(nMoveX / maUIScale), MapUnit::Map100thMM);
tools::Long nMoveY = 500;
- if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_Y, true, &pPoolItem ) )
- nMoveY = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
+ if( const SfxInt32Item* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_MOVE_Y ) )
+ nMoveY = pPoolItem->GetValue();
SetMetricValue( *m_xMtrFldMoveY, tools::Long(nMoveY / maUIScale), MapUnit::Map100thMM);
- if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, true, &pPoolItem ) )
- m_xMtrFldAngle->set_value(static_cast<const SdrAngleItem*>( pPoolItem )->GetValue().get(), FieldUnit::NONE);
+ if( const SdrAngleItem* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_ANGLE ) )
+ m_xMtrFldAngle->set_value( pPoolItem->GetValue().get(), FieldUnit::NONE);
else
m_xMtrFldAngle->set_value(0, FieldUnit::NONE);
tools::Long nWidth = 0;
- if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_WIDTH, true, &pPoolItem ) )
- nWidth = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
+ if( const SfxInt32Item* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_WIDTH ) )
+ nWidth = pPoolItem->GetValue();
SetMetricValue( *m_xMtrFldWidth, tools::Long(nWidth / maUIScale), MapUnit::Map100thMM);
tools::Long nHeight = 0;
- if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_HEIGHT, true, &pPoolItem ) )
- nHeight = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
+ if( const SfxInt32Item* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_HEIGHT ) )
+ nHeight = pPoolItem->GetValue();
SetMetricValue( *m_xMtrFldHeight, tools::Long(nHeight / maUIScale), MapUnit::Map100thMM);
- if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) )
+ if( const XColorItem* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_START_COLOR ) )
{
- Color aColor = static_cast<const XColorItem*>( pPoolItem )->GetColorValue();
+ Color aColor = pPoolItem->GetColorValue();
m_xLbStartColor->SelectEntry( aColor );
m_xLbEndColor->SelectEntry( aColor );
}
@@ -226,10 +225,9 @@ IMPL_LINK_NOARG(CopyDlg, SetViewData, weld::Button&, void)
maUIScale ), MapUnit::Map100thMM);
// sets color attribute
- const SfxPoolItem* pPoolItem = nullptr;
- if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) )
+ if( const XColorItem* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_START_COLOR ) )
{
- Color aColor = static_cast<const XColorItem*>( pPoolItem )->GetColorValue();
+ Color aColor = pPoolItem->GetColorValue();
m_xLbStartColor->SelectEntry( aColor );
}
}
@@ -251,10 +249,9 @@ IMPL_LINK_NOARG(CopyDlg, SetDefault, weld::Button&, void)
SetMetricValue( *m_xMtrFldHeight, tools::Long(nValue / maUIScale), MapUnit::Map100thMM);
// set color attribute
- const SfxPoolItem* pPoolItem = nullptr;
- if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) )
+ if( const XColorItem* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_START_COLOR ) )
{
- Color aColor = static_cast<const XColorItem*>( pPoolItem )->GetColorValue();
+ Color aColor = pPoolItem->GetColorValue();
m_xLbStartColor->SelectEntry( aColor );
m_xLbEndColor->SelectEntry( aColor );
}
diff --git a/sd/source/ui/dlg/dlgfield.cxx b/sd/source/ui/dlg/dlgfield.cxx
index 76d9eb2de9ea..75263a17c8a4 100644
--- a/sd/source/ui/dlg/dlgfield.cxx
+++ b/sd/source/ui/dlg/dlgfield.cxx
@@ -264,9 +264,8 @@ void SdModifyFieldDlg::FillControls()
m_xRbtFix->save_state();
m_xRbtVar->save_state();
- const SfxPoolItem* pItem;
- if( SfxItemState::SET == m_aInputSet.GetItemState(EE_CHAR_LANGUAGE, true, &pItem ) )
- m_xLbLanguage->set_active_id(static_cast<const SvxLanguageItem*>(pItem)->GetLanguage());
+ if( const SvxLanguageItem* pItem = m_aInputSet.GetItemIfSet(EE_CHAR_LANGUAGE ) )
+ m_xLbLanguage->set_active_id(pItem->GetLanguage());
m_xLbLanguage->save_active_id();
diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx
index 002629ec8814..41c00efa8afa 100644
--- a/sd/source/ui/dlg/dlgolbul.cxx
+++ b/sd/source/ui/dlg/dlgolbul.cxx
@@ -90,7 +90,7 @@ OutlineBulletDlg::OutlineBulletDlg(weld::Window* pParent, const SfxItemSet* pAtt
SfxStyleSheetBasePool* pSSPool = pView->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));
+ pItem = pFirstStyleSheet->GetItemSet().GetItemIfSet(EE_PARA_NUMBULLET, false);
}
if( pItem == nullptr )
diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx
index d5bf449f75e5..869f13c837d4 100644
--- a/sd/source/ui/dlg/prltempl.cxx
+++ b/sd/source/ui/dlg/prltempl.cxx
@@ -274,8 +274,8 @@ const SfxItemSet* SdPresLayoutTemplateDlg::GetOutputItemSet() const
{
pOutSet->Put(*SfxTabDialogController::GetOutputItemSet());
- const SvxNumBulletItem *pSvxNumBulletItem = nullptr;
- if (SfxItemState::SET == pOutSet->GetItemState(EE_PARA_NUMBULLET, false, reinterpret_cast<const SfxPoolItem**>(&pSvxNumBulletItem)))
+ const SvxNumBulletItem *pSvxNumBulletItem = pOutSet->GetItemIfSet(EE_PARA_NUMBULLET, false);
+ if (pSvxNumBulletItem)
SdBulletMapper::MapFontsInNumRule( const_cast<SvxNumRule&>(pSvxNumBulletItem->GetNumRule()), *pOutSet );
return pOutSet.get();
}
diff --git a/sd/source/ui/dlg/prntopts.cxx b/sd/source/ui/dlg/prntopts.cxx
index d3145f681c95..4b50875bb8cc 100644
--- a/sd/source/ui/dlg/prntopts.cxx
+++ b/sd/source/ui/dlg/prntopts.cxx
@@ -122,9 +122,8 @@ bool SdPrintOptions::FillItemSet( SfxItemSet* rAttrs )
void SdPrintOptions::Reset( const SfxItemSet* rAttrs )
{
- const SdOptionsPrintItem* pPrintOpts = nullptr;
- if( SfxItemState::SET == rAttrs->GetItemState( ATTR_OPTIONS_PRINT, false,
- reinterpret_cast<const SfxPoolItem**>(&pPrintOpts) ) )
+ const SdOptionsPrintItem* pPrintOpts = rAttrs->GetItemIfSet( ATTR_OPTIONS_PRINT, false);
+ if( pPrintOpts )
{
m_xCbxDraw->set_active( pPrintOpts->GetOptionsPrint().IsDraw() );
m_xCbxNotes->set_active( pPrintOpts->GetOptionsPrint().IsNotes() );
diff --git a/sd/source/ui/dlg/sdpreslt.cxx b/sd/source/ui/dlg/sdpreslt.cxx
index 6dda740bf887..dd54611e28d9 100644
--- a/sd/source/ui/dlg/sdpreslt.cxx
+++ b/sd/source/ui/dlg/sdpreslt.cxx
@@ -66,13 +66,12 @@ SdPresLayoutDlg::~SdPresLayoutDlg()
*/
void SdPresLayoutDlg::Reset()
{
- const SfxPoolItem *pPoolItem = nullptr;
tools::Long nName;
// replace master page
- if( mrOutAttrs.GetItemState( ATTR_PRESLAYOUT_MASTER_PAGE, false, &pPoolItem ) == SfxItemState::SET )
+ if( const SfxBoolItem* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_PRESLAYOUT_MASTER_PAGE, false ) )
{
- bool bMasterPage = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue();
+ bool bMasterPage = pPoolItem->GetValue();
m_xCbxMasterPage->set_sensitive( !bMasterPage );
m_xCbxMasterPage->set_active( bMasterPage );
}
@@ -80,8 +79,8 @@ void SdPresLayoutDlg::Reset()
// remove not used master pages
m_xCbxCheckMasters->set_active(false);
- if(mrOutAttrs.GetItemState(ATTR_PRESLAYOUT_NAME, true, &pPoolItem) == SfxItemState::SET)
- maName = static_cast<const SfxStringItem*>(pPoolItem)->GetValue();
+ if( const SfxStringItem* pPoolItem = mrOutAttrs.GetItemIfSet(ATTR_PRESLAYOUT_NAME) )
+ maName = pPoolItem->GetValue();
else
maName.clear();
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index 27bd1396684f..6666cbb4a1b3 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -268,14 +268,11 @@ void SdTpOptionsMisc::ActivatePage( const SfxItemSet& rSet )
m_xLbMetric->save_value();
// change metric if necessary (since TabPage is in the Dialog where
// the metric is set)
- const SfxPoolItem* pAttr = nullptr;
- if( SfxItemState::SET != rSet.GetItemState( SID_ATTR_METRIC , false,
- &pAttr ))
+ const SfxUInt16Item* pAttr = rSet.GetItemIfSet( SID_ATTR_METRIC , false );
+ if( !pAttr )
return;
- const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pAttr);
-
- FieldUnit eFUnit = static_cast<FieldUnit>(static_cast<tools::Long>(pItem->GetValue()));
+ FieldUnit eFUnit = static_cast<FieldUnit>(static_cast<tools::Long>(pAttr->GetValue()));
if( eFUnit == m_xMtrFldOriginalWidth->get_unit() )
return;
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 622d35c7f1eb..bed18cbddf70 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -868,8 +868,8 @@ bool DrawDocShell::SaveAsOwnFormat( SfxMedium& rMedium )
OUString aLayoutName;
- SfxStringItem const * pLayoutItem;
- if( rMedium.GetItemSet()->GetItemState(SID_TEMPLATE_NAME, false, reinterpret_cast<const SfxPoolItem**>(& pLayoutItem) ) == SfxItemState::SET )
+ SfxStringItem const * pLayoutItem = rMedium.GetItemSet()->GetItemIfSet(SID_TEMPLATE_NAME, false);
+ if( pLayoutItem )
{
aLayoutName = pLayoutItem->GetValue();
}
diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx
index 3cf19b9a139f..ab0cf7de87ab 100644
--- a/sd/source/ui/func/fubullet.cxx
+++ b/sd/source/ui/func/fubullet.cxx
@@ -151,18 +151,16 @@ void FuBullet::InsertFormattingMark( sal_Unicode cMark )
void FuBullet::InsertSpecialCharacter( SfxRequest const & rReq )
{
const SfxItemSet *pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem = nullptr;
+ const SfxStringItem* pItem = nullptr;
if( pArgs )
- pArgs->GetItemState(SID_CHARMAP, false, &pItem);
+ pItem = pArgs->GetItemIfSet(SID_CHARMAP, false);
OUString aChars;
vcl::Font aFont;
if ( pItem )
{
- aChars = static_cast<const SfxStringItem*>(pItem)->GetValue();
- const SfxPoolItem* pFtItem = nullptr;
- pArgs->GetItemState( SID_ATTR_SPECIALCHAR, false, &pFtItem);
- const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem );
+ aChars = pItem->GetValue();
+ const SfxStringItem* pFontItem = pArgs->GetItemIfSet( SID_ATTR_SPECIALCHAR, false );
if ( pFontItem )
{
const OUString& aFontName = pFontItem->GetValue();
diff --git a/sd/source/ui/func/fuchar.cxx b/sd/source/ui/func/fuchar.cxx
index bc6f391f0f8a..3935f64a1da4 100644
--- a/sd/source/ui/func/fuchar.cxx
+++ b/sd/source/ui/func/fuchar.cxx
@@ -116,10 +116,9 @@ void FuChar::DoExecute( SfxRequest& rReq )
if( mpDoc->GetOnlineSpell() )
{
- const SfxPoolItem* pItem;
- if( SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, false, &pItem ) ||
- SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, false, &pItem ) ||
- SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, false, &pItem ) )
+ if( SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, false ) ||
+ SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, false ) ||
+ SfxItemState::SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, false ) )
{
mpDoc->StopOnlineSpelling();
mpDoc->StartOnlineSpelling();
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
index 83d8e8bd42d3..b123e9c2ddff 100644
--- a/sd/source/ui/func/fuconbez.cxx
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -108,9 +108,9 @@ void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
if( !pArgs )
return;
- const SfxPoolItem* pPoolItem = nullptr;
- if( SfxItemState::SET == pArgs->GetItemState( SID_ADD_MOTION_PATH, true, &pPoolItem ) )
- maTargets = static_cast<const SfxUnoAnyItem*>( pPoolItem )->GetValue();
+ const SfxUnoAnyItem* pPoolItem = pArgs->GetItemIfSet( SID_ADD_MOTION_PATH );
+ if( pPoolItem )
+ maTargets = pPoolItem->GetValue();
if (nSlotId != SID_DRAW_FREELINE_NOFILL)
return;
diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx
index b051e63695c5..99e5f7b87a3b 100644
--- a/sd/source/ui/func/fucopy.cxx
+++ b/sd/source/ui/func/fucopy.cxx
@@ -79,18 +79,17 @@ void FuCopy::DoExecute( SfxRequest& rReq )
// indicate color attribute
SfxItemSet aAttr( mpDoc->GetPool() );
mpView->GetAttributes( aAttr );
- const SfxPoolItem* pPoolItem = nullptr;
- if( SfxItemState::SET == aAttr.GetItemState( XATTR_FILLSTYLE, true, &pPoolItem ) )
+ if( const XFillStyleItem* pFillStyleItem = aAttr.GetItemIfSet( XATTR_FILLSTYLE ) )
{
- drawing::FillStyle eStyle = static_cast<const XFillStyleItem*>(pPoolItem)->GetValue();
+ drawing::FillStyle eStyle = pFillStyleItem->GetValue();
+ const XFillColorItem* pFillColorItem;
if( eStyle == drawing::FillStyle_SOLID &&
- SfxItemState::SET == aAttr.GetItemState( XATTR_FILLCOLOR, true, &pPoolItem ) )
+ (pFillColorItem = aAttr.GetItemIfSet( XATTR_FILLCOLOR )) )
{
- const XFillColorItem* pItem = static_cast<const XFillColorItem*>(pPoolItem);
- XColorItem aXColorItem( ATTR_COPY_START_COLOR, pItem->GetName(),
- pItem->GetColorValue() );
+ XColorItem aXColorItem( ATTR_COPY_START_COLOR, pFillColorItem->GetName(),
+ pFillColorItem->GetColorValue() );
aSet.Put( aXColorItem );
}
@@ -124,40 +123,40 @@ void FuCopy::DoExecute( SfxRequest& rReq )
sal_uInt16 nNumber = 0;
Color aStartColor, aEndColor;
bool bColor = false;
- const SfxPoolItem* pPoolItem = nullptr;
-
- // Count
- if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_NUMBER, true, &pPoolItem ) )
- nNumber = static_cast<const SfxUInt16Item*>( pPoolItem )->GetValue();
-
- // translation
- if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_MOVE_X, true, &pPoolItem ) )
- lSizeX = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
- if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_MOVE_Y, true, &pPoolItem ) )
- lSizeY = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
- if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_ANGLE, true, &pPoolItem ) )
- lAngle = static_cast<const SdrAngleItem*>( pPoolItem )->GetValue();
-
- // scale
- if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_WIDTH, true, &pPoolItem ) )
- lWidth = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
- if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_HEIGHT, true, &pPoolItem ) )
- lHeight = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue();
-
- // start/end color
- if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) )
- {
- aStartColor = static_cast<const XColorItem*>( pPoolItem )->GetColorValue();
- bColor = true;
- }
- if( pArgs && SfxItemState::SET == pArgs->GetItemState( ATTR_COPY_END_COLOR, true, &pPoolItem ) )
+
+ if (pArgs)
{
- aEndColor = static_cast<const XColorItem*>( pPoolItem )->GetColorValue();
- if( aStartColor == aEndColor )
- bColor = false;
+ // Count
+ if( const SfxUInt16Item* pPoolItem = pArgs->GetItemIfSet( ATTR_COPY_NUMBER ) )
+ nNumber = pPoolItem->GetValue();
+
+ // translation
+ if( const SfxInt32Item* pPoolItem = pArgs->GetItemIfSet( ATTR_COPY_MOVE_X ) )
+ lSizeX = pPoolItem->GetValue();
+ if( const SfxInt32Item* pPoolItem = pArgs->GetItemIfSet( ATTR_COPY_MOVE_Y ) )
+ lSizeY = pPoolItem->GetValue();
+ if( const SdrAngleItem* pPoolItem = pArgs->GetItemIfSet( ATTR_COPY_ANGLE ) )
+ lAngle = pPoolItem->GetValue();
+
+ // scale
+ if( const SfxInt32Item* pPoolItem = pArgs->GetItemIfSet( ATTR_COPY_WIDTH ) )
+ lWidth = pPoolItem->GetValue();
+ if( const SfxInt32Item* pPoolItem = pArgs->GetItemIfSet( ATTR_COPY_HEIGHT ) )
+ lHeight = pPoolItem->GetValue();
+
+ // start/end color
+ if( const XColorItem* pPoolItem = pArgs->GetItemIfSet( ATTR_COPY_START_COLOR ) )
+ {
+ aStartColor = pPoolItem->GetColorValue();
+ bColor = true;
+ }
+ if( const XColorItem* pPoolItem = pArgs->GetItemIfSet( ATTR_COPY_END_COLOR ) )
+ {
+ aEndColor = pPoolItem->GetColorValue();
+ if( aStartColor == aEndColor )
+ bColor = false;
+ }
}
- else
- bColor = false;
// remove handles
//HMHmpView->HideMarkHdl();
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index d65e7c8b2ff2..919814d56093 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -121,8 +121,8 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
aFileName = static_cast<const SfxStringItem*>(pItem)->GetValue();
OUString aFilterName;
- if ( pArgs->GetItemState( FN_PARAM_FILTER, true, &pItem ) == SfxItemState::SET )
- aFilterName = static_cast<const SfxStringItem*>(pItem)->GetValue();
+ if ( const SfxStringItem* pFilterItem = pArgs->GetItemIfSet( FN_PARAM_FILTER ) )
+ aFilterName = pFilterItem->GetValue();
if ( pArgs->GetItemState( FN_PARAM_1, true, &pItem ) == SfxItemState::SET )
bAsLink = static_cast<const SfxBoolItem*>(pItem)->GetValue();
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index 403c484464bb..1f91fe3e719c 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -170,7 +170,7 @@ void FuBulletAndPosition::SetCurrentBulletsNumbering(SfxRequest& rReq)
}
nIdx--;
- sal_uInt32 nNumItemId = SID_ATTR_NUMBERING_RULE;
+ TypedWhichId<SvxNumBulletItem> nNumItemId = SID_ATTR_NUMBERING_RULE;
const SfxPoolItem* pTmpItem = GetNumBulletItem( aNewAttr, nNumItemId );
std::unique_ptr<SvxNumRule> pNumRule;
if ( pTmpItem )
@@ -184,9 +184,8 @@ void FuBulletAndPosition::SetCurrentBulletsNumbering(SfxRequest& rReq)
if ( pNumRuleMgr )
{
sal_uInt16 nActNumLvl = sal_uInt16(0xFFFF);
- const SfxPoolItem* pNumLevelItem = nullptr;
- if(SfxItemState::SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, false, &pNumLevelItem))
- nActNumLvl = static_cast<const SfxUInt16Item*>(pNumLevelItem)->GetValue();
+ if(const SfxUInt16Item* pNumLevelItem = aNewAttr.GetItemIfSet(SID_PARAM_CUR_NUM_LEVEL, false))
+ nActNumLvl = pNumLevelItem->GetValue();
pNumRuleMgr->SetItems(&aNewAttr);
SvxNumRule aTmpRule( *pNumRule );
@@ -264,86 +263,75 @@ void FuBulletAndPosition::SetCurrentBulletsNumbering(SfxRequest& rReq)
rReq.Done();
}
-const SfxPoolItem* FuBulletAndPosition::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId)
+const SvxNumBulletItem* FuBulletAndPosition::GetNumBulletItem(SfxItemSet& aNewAttr, TypedWhichId<SvxNumBulletItem>& nNumItemId)
{
- //SvxNumBulletItem* pRetItem = NULL;
- const SfxPoolItem* pTmpItem = nullptr;
+ const SvxNumBulletItem* pTmpItem = aNewAttr.GetItemIfSet(nNumItemId, false);
- if(aNewAttr.GetItemState(nNumItemId, false, &pTmpItem) == SfxItemState::SET)
- {
+ if(pTmpItem)
return pTmpItem;
- }
- else
+
+ nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
+ pTmpItem = aNewAttr.GetItemIfSet(nNumItemId, false);
+ if (pTmpItem)
+ return pTmpItem;
+
+ 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));
- }
-
- if( pItem == nullptr )
- pItem = aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
+ 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);
+ }
- //DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in the Pool!" );
+ if( pItem == nullptr )
+ pItem = aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
- std::unique_ptr<SfxPoolItem> pNewItem(pItem->CloneSetWhich(EE_PARA_NUMBULLET));
- aNewAttr.Put(*pNewItem);
+ //DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in the Pool!" );
- if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET )
- {
- const SvxNumBulletItem* pBulletItem = aNewAttr.GetItem(EE_PARA_NUMBULLET);
- const SvxNumRule& rLclRule = pBulletItem->GetNumRule();
- SvxNumRule aNewRule( rLclRule );
- aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS );
+ std::unique_ptr<SfxPoolItem> pNewItem(pItem->CloneSetWhich(EE_PARA_NUMBULLET));
+ aNewAttr.Put(*pNewItem);
- SvxNumBulletItem aNewItem( std::move(aNewRule), EE_PARA_NUMBULLET );
- aNewAttr.Put(aNewItem);
- }
-
- SfxItemState eItemState = aNewAttr.GetItemState(nNumItemId, false, &pTmpItem);
- if (eItemState == SfxItemState::SET)
- return pTmpItem;
+ if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET )
+ {
+ const SvxNumBulletItem* pBulletItem = aNewAttr.GetItem(EE_PARA_NUMBULLET);
+ const SvxNumRule& rLclRule = pBulletItem->GetNumRule();
+ SvxNumRule aNewRule( rLclRule );
+ aNewRule.SetFeatureFlag( SvxNumRuleFlags::NO_NUMBERS );
- }
- //DBG_ASSERT(eState == SfxItemState::SET, "No item found");
+ SvxNumBulletItem aNewItem( std::move(aNewRule), EE_PARA_NUMBULLET );
+ aNewAttr.Put(aNewItem);
}
+
+ pTmpItem = aNewAttr.GetItemIfSet(nNumItemId, false);
return pTmpItem;
}
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 2c1abb8123f7..5427e6b7dac3 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -135,8 +135,7 @@ void FuPage::DoExecute(SfxRequest& rReq)
return;
// if there are no arguments given, open the dialog
- const SfxPoolItem* pItem;
- if (!mpArgs || mpArgs->GetItemState(SID_SELECT_BACKGROUND, true, &pItem) == SfxItemState::SET)
+ if (!mpArgs || mpArgs->GetItemState(SID_SELECT_BACKGROUND) == SfxItemState::SET)
{
mpView->SdrEndTextEdit();
mpArgs = ExecuteDialog(mpWindow ? mpWindow->GetFrameWeld() : nullptr, rReq);
@@ -325,8 +324,8 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest&
OUString aFileName(static_cast<const SfxStringItem*>(pItem)->GetValue());
OUString aFilterName;
- if (pArgs->GetItemState(FN_PARAM_FILTER, true, &pItem) == SfxItemState::SET)
- aFilterName = static_cast<const SfxStringItem*>(pItem)->GetValue();
+ if (const SfxStringItem* pFilterItem = pArgs->GetItemIfSet(FN_PARAM_FILTER))
+ aFilterName = pFilterItem->GetValue();
nError = GraphicFilter::LoadGraphic(aFileName, aFilterName, aGraphic,
&GraphicFilter::GetGraphicFilter());
@@ -466,10 +465,9 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent, const SfxRequest&
pTempSet->Put(XFillStyleItem(drawing::FillStyle_NONE));
}
- const SfxPoolItem *pItem;
- if( SfxItemState::SET == pTempSet->GetItemState( EE_PARA_WRITINGDIR, false, &pItem ) )
+ if( const SvxFrameDirectionItem* pItem = pTempSet->GetItemIfSet( EE_PARA_WRITINGDIR, false ) )
{
- SvxFrameDirection nVal = static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue();
+ SvxFrameDirection nVal = pItem->GetValue();
mpDoc->SetDefaultWritingMode( nVal == SvxFrameDirection::Horizontal_RL_TB ? css::text::WritingMode_RL_TB : css::text::WritingMode_LR_TB );
}
diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx
index 0caaa83647f9..ac5d87636098 100644
--- a/sd/source/ui/func/fuparagr.cxx
+++ b/sd/source/ui/func/fuparagr.cxx
@@ -111,16 +111,15 @@ void FuParagraph::DoExecute( SfxRequest& rReq )
{
ESelection eSelection = pOutlView->GetSelection();
- const SfxPoolItem *pItem = nullptr;
- if( SfxItemState::SET == pArgs->GetItemState( ATTR_NUMBER_NEWSTART, false, &pItem ) )
+ if( const SfxBoolItem* pItem = pArgs->GetItemIfSet( ATTR_NUMBER_NEWSTART, false ) )
{
- const bool bNewStart = static_cast<const SfxBoolItem*>(pItem)->GetValue();
+ const bool bNewStart = pItem->GetValue();
pOutliner->SetParaIsNumberingRestart( eSelection.nStartPara, bNewStart );
}
- if( SfxItemState::SET == pArgs->GetItemState( ATTR_NUMBER_NEWSTART_AT, false, &pItem ) )
+ if( const SfxInt16Item* pItem = pArgs->GetItemIfSet( ATTR_NUMBER_NEWSTART_AT, false ) )
{
- const sal_Int16 nStartAt = static_cast<const SfxInt16Item*>(pItem)->GetValue();
+ const sal_Int16 nStartAt = pItem->GetValue();
pOutliner->SetNumberingStartValue( eSelection.nStartPara, nStartAt );
}
}
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
index a29fb21ab35c..21f19f3e725f 100644
--- a/sd/source/ui/func/futempl.cxx
+++ b/sd/source/ui/func/futempl.cxx
@@ -530,10 +530,9 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
if( mpDoc->GetOnlineSpell() )
{
- const SfxPoolItem* pTempItem;
- if( SfxItemState::SET == rAttr.GetItemState(EE_CHAR_LANGUAGE, false, &pTempItem ) ||
- SfxItemState::SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CJK, false, &pTempItem ) ||
- SfxItemState::SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CTL, false, &pTempItem ) )
+ if( SfxItemState::SET == rAttr.GetItemState(EE_CHAR_LANGUAGE, false ) ||
+ SfxItemState::SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CJK, false ) ||
+ SfxItemState::SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CTL, false ) )
{
mpDoc->StopOnlineSpelling();
mpDoc->StartOnlineSpelling();
diff --git a/sd/source/ui/func/undoback.cxx b/sd/source/ui/func/undoback.cxx
index 38c8ee8ba79f..768ca2ec2f1a 100644
--- a/sd/source/ui/func/undoback.cxx
+++ b/sd/source/ui/func/undoback.cxx
@@ -30,6 +30,7 @@
#include <svx/xdef.hxx>
#include <svx/xfillit0.hxx>
+#include <svx/xbtmpit.hxx>
SdBackgroundObjUndoAction::SdBackgroundObjUndoAction(
SdDrawDocument& rDoc,
@@ -82,13 +83,12 @@ SdUndoAction* SdBackgroundObjUndoAction::Clone() const
void SdBackgroundObjUndoAction::saveFillBitmap(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 (bool(mpFillBitmapItem))
{
- 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;
rItemSet.ClearItem(XATTR_FILLBITMAP);
if (mbHasFillBitmap)
rItemSet.ClearItem(XATTR_FILLSTYLE);
diff --git a/sd/source/ui/inc/BulletAndPositionDlg.hxx b/sd/source/ui/inc/BulletAndPositionDlg.hxx
index b6984af8ccb5..4645060e251c 100644
--- a/sd/source/ui/inc/BulletAndPositionDlg.hxx
+++ b/sd/source/ui/inc/BulletAndPositionDlg.hxx
@@ -67,7 +67,7 @@ class SvxBulletAndPositionDlg : public weld::GenericDialogController
sal_uInt8 nBullet;
sal_uInt16 nActNumLvl;
weld::Window* p_Window;
- sal_uInt16 nNumItemId;
+ TypedWhichId<SvxNumBulletItem> nNumItemId;
MapUnit eCoreUnit;
SvxNumberingPreview m_aPreviewWIN;
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index 4c84ebc13c6c..1eeede9e249d 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -22,6 +22,7 @@
#include <rtl/ref.hxx>
#include <sfx2/viewsh.hxx>
+#include <svl/typedwhich.hxx>
#include <vcl/prntypes.hxx>
#include <vcl/scrbar.hxx>
#include <o3tl/deleter.hxx>
@@ -36,6 +37,7 @@ class SdPage;
class SvxRuler;
class SdrOle2Obj; // for the ones, who have undefined parts of SVDRAW
class SdDrawDocument;
+class SvxNumBulletItem;
namespace weld
{
@@ -184,7 +186,7 @@ public:
void SetUIUnit(FieldUnit eUnit);
void SetDefTabHRuler( sal_uInt16 nDefTab );
- const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId);
+ const SvxNumBulletItem* GetNumBulletItem(SfxItemSet& aNewAttr, TypedWhichId<SvxNumBulletItem>& nNumItemId);
bool HasRuler() const { return mbHasRulers;}
void SetRuler(bool bRuler);
diff --git a/sd/source/ui/inc/fuolbull.hxx b/sd/source/ui/inc/fuolbull.hxx
index 004ede764847..1ed73cf91773 100644
--- a/sd/source/ui/inc/fuolbull.hxx
+++ b/sd/source/ui/inc/fuolbull.hxx
@@ -25,6 +25,7 @@ class SdDrawDocument;
class SfxRequest;
class SfxItemSet;
class SfxPoolItem;
+class SvxNumBulletItem;
namespace sd {
@@ -53,7 +54,7 @@ private:
void SetCurrentBulletsNumbering(SfxRequest& rReq);
- const SfxPoolItem* GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt32& nNumItemId);
+ const SvxNumBulletItem* GetNumBulletItem(SfxItemSet& aNewAttr, TypedWhichId<SvxNumBulletItem>& nNumItemId);
};
} // end of namespace sd
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 2515ea32eecc..6b0f64471721 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -425,8 +425,8 @@ DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries,
VclPtr<SfxPrinter> pPrinter = pDocSh->GetPrinter( false );
if( pPrinter )
{
- SdOptionsPrintItem const * pPrinterOptions = nullptr;
- if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, false, reinterpret_cast<const SfxPoolItem**>(&pPrinterOptions)) == SfxItemState::SET)
+ SdOptionsPrintItem const * pPrinterOptions = pPrinter->GetOptions().GetItemIfSet( ATTR_OPTIONS_PRINT, false );
+ if(pPrinterOptions)
aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
}
else
@@ -1099,8 +1099,8 @@ DocumentSettings::_getPropertyValues(
SfxPrinter* pPrinter = pDocSh->GetPrinter( false );
if( pPrinter )
{
- SdOptionsPrintItem const * pPrinterOptions = nullptr;
- if(pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, false, reinterpret_cast<const SfxPoolItem**>(&pPrinterOptions)) == SfxItemState::SET)
+ SdOptionsPrintItem const * pPrinterOptions = pPrinter->GetOptions().GetItemIfSet( ATTR_OPTIONS_PRINT, false );
+ if (pPrinterOptions)
aOptionsPrintItem.GetOptionsPrint() = pPrinterOptions->GetOptionsPrint();
}
else
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)