diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-04-23 20:23:29 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-27 07:21:45 +0000 |
commit | 9eb2e683ab051edd0bce18841f0ac05df5038854 (patch) | |
tree | 71e7a4d4b8389c09ff17024fceaed94668751082 /sd | |
parent | fd964e3b9f60bf2043fdc39ab8161a586049b481 (diff) |
tdf#34465 remove calls to SfxItemSet::Put(const SfxPoolItem&, sal_uInt16)
and put an assert in SfxPoolItem::SetWhich() so nothing new
creeps in.
Change-Id: I6497650fa61ffb2b6941ffff2d471c8f117be1df
Reviewed-on: https://gerrit.libreoffice.org/24324
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/dlg/dlgolbul.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/func/fubullet.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/func/fuolbull.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/drviews9.cxx | 118 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 3 |
6 files changed, 99 insertions, 42 deletions
diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx index 89ee17d726e3..4fbeeb673a6b 100644 --- a/sd/source/ui/dlg/dlgolbul.cxx +++ b/sd/source/ui/dlg/dlgolbul.cxx @@ -106,7 +106,8 @@ OutlineBulletDlg::OutlineBulletDlg( DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in Pool! [CL]" ); - aInputSet.Put(*pItem, EE_PARA_NUMBULLET); + std::unique_ptr<SfxPoolItem> pNewItem(pItem->CloneSetWhich(EE_PARA_NUMBULLET)); + aInputSet.Put(*pNewItem); } if(bTitle && aInputSet.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET ) diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx index 6ff754acd531..666952a9ebf6 100644 --- a/sd/source/ui/func/fubullet.cxx +++ b/sd/source/ui/func/fubullet.cxx @@ -266,8 +266,10 @@ void FuBullet::InsertSpecialCharacter( SfxRequest& rReq ) aFont.GetCharSet(), EE_CHAR_FONTINFO); aSet.Put(aFontItem); - aSet.Put(aFontItem, EE_CHAR_FONTINFO_CJK); - aSet.Put(aFontItem, EE_CHAR_FONTINFO_CTL); + aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK); + aSet.Put(aFontItem); + aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL); + aSet.Put(aFontItem); pOV->SetAttribs(aSet); ESelection aSel = pOV->GetSelection(); diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx index a67537f6053c..064c6b85ea7a 100644 --- a/sd/source/ui/func/fuolbull.cxx +++ b/sd/source/ui/func/fuolbull.cxx @@ -269,7 +269,7 @@ void FuOutlineBullet::SetCurrentBulletsNumbering(SfxRequest& rReq) if ( bInMasterView ) { SfxItemSet aSetAttr( mpViewShell->GetPool(), EE_ITEMS_START, EE_ITEMS_END ); - aSetAttr.Put(SvxNumBulletItem( *pNumRule ), nNumItemId); + aSetAttr.Put(SvxNumBulletItem( *pNumRule, nNumItemId )); mpView->SetAttributes(aSetAttr); } @@ -344,7 +344,8 @@ const SfxPoolItem* FuOutlineBullet::GetNumBulletItem(SfxItemSet& aNewAttr, sal_u //DBG_ASSERT( pItem, "No EE_PARA_NUMBULLET in the Pool!" ); - aNewAttr.Put(*pItem, EE_PARA_NUMBULLET); + std::unique_ptr<SfxPoolItem> pNewItem(pItem->CloneSetWhich(EE_PARA_NUMBULLET)); + aNewAttr.Put(*pNewItem); if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET ) { diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 25e0e44f39ab..237a451c007e 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -215,11 +215,13 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) { SvxFontHeightItem aFontItem = dynamic_cast<const SvxFontHeightItem&>(*pI); aFontItem.SetHeight(aFontItem.GetHeight(), stretchX, aFontItem.GetPropUnit()); - aAttrSet.Put( aFontItem, nWhich ); + aFontItem.SetWhich(nWhich); + aAttrSet.Put( aFontItem ); } else { - aAttrSet.Put( *pI, nWhich ); + std::unique_ptr<SfxPoolItem> pNewItem(pI->CloneSetWhich(nWhich)); + aAttrSet.Put( *pNewItem ); } } else diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx index 1678b78b256d..2e0b5dbb7a6b 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -219,7 +219,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) if (CHECK_RANGE (drawing::FillStyle_NONE, (sal_Int32)pFillStyle->GetValue (), drawing::FillStyle_BITMAP)) { pAttr->ClearItem (XATTR_FILLSTYLE); - pAttr->Put (XFillStyleItem ((drawing::FillStyle) pFillStyle->GetValue ()), XATTR_FILLSTYLE); + XFillStyleItem aStyleItem((drawing::FillStyle) pFillStyle->GetValue ()); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put (aStyleItem); rBindings.Invalidate (SID_ATTR_FILL_STYLE); rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE); } @@ -242,7 +244,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) if (CHECK_RANGE (drawing::LineStyle_NONE, (sal_Int32)pLineStyle->GetValue (), drawing::LineStyle_DASH)) { pAttr->ClearItem (XATTR_LINESTYLE); - pAttr->Put (XLineStyleItem ((drawing::LineStyle) pLineStyle->GetValue ()), XATTR_LINESTYLE); + XLineStyleItem aStyleItem((drawing::LineStyle) pLineStyle->GetValue()); + aStyleItem.SetWhich(XATTR_LINESTYLE); + pAttr->Put(aStyleItem); rBindings.Invalidate (SID_ATTR_LINE_STYLE); } #if HAVE_FEATURE_SCRIPTING @@ -262,7 +266,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) { const SfxUInt32Item* pLineWidth = rReq.GetArg<SfxUInt32Item>(ID_VAL_WIDTH); pAttr->ClearItem (XATTR_LINEWIDTH); - pAttr->Put (XLineWidthItem (pLineWidth->GetValue ()), XATTR_LINEWIDTH); + XLineWidthItem aWidthItem(pLineWidth->GetValue()); + aWidthItem.SetWhich(XATTR_LINEWIDTH); + pAttr->Put(aWidthItem); rBindings.Invalidate (SID_ATTR_LINE_WIDTH); break; } @@ -281,11 +287,11 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAttr->ClearItem (XATTR_FILLCOLOR); pAttr->ClearItem (XATTR_FILLSTYLE); - pAttr->Put (XFillColorItem (-1, Color ((sal_uInt8) pRed->GetValue (), + XFillColorItem aColorItem(-1, Color ((sal_uInt8) pRed->GetValue (), (sal_uInt8) pGreen->GetValue (), - (sal_uInt8) pBlue->GetValue ())), - XATTR_FILLCOLOR); - pAttr->Put (XFillStyleItem (drawing::FillStyle_SOLID), XATTR_FILLSTYLE); + (sal_uInt8) pBlue->GetValue ())); + aColorItem.SetWhich(XATTR_FILLCOLOR); + pAttr->Put(aColorItem); rBindings.Invalidate (SID_ATTR_FILL_COLOR); rBindings.Invalidate (SID_ATTR_PAGE_COLOR); rBindings.Invalidate (SID_ATTR_FILL_STYLE); @@ -306,10 +312,11 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) const SfxUInt32Item* pBlue = rReq.GetArg<SfxUInt32Item>(ID_VAL_BLUE); pAttr->ClearItem (XATTR_LINECOLOR); - pAttr->Put (XLineColorItem (-1, Color ((sal_uInt8) pRed->GetValue (), - (sal_uInt8) pGreen->GetValue (), - (sal_uInt8) pBlue->GetValue ())), - XATTR_LINECOLOR); + XLineColorItem aColorItem(-1, Color((sal_uInt8) pRed->GetValue(), + (sal_uInt8) pGreen->GetValue(), + (sal_uInt8) pBlue->GetValue())); + aColorItem.SetWhich(XATTR_LINECOLOR); + pAttr->Put(aColorItem); rBindings.Invalidate (SID_ATTR_LINE_COLOR); break; } @@ -349,8 +356,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) if (rReq.GetSlot () == SID_SETGRADSTARTCOLOR) aGradient.SetStartColor (aColor); else aGradient.SetEndColor (aColor); - pAttr->Put (XFillStyleItem (drawing::FillStyle_GRADIENT), XATTR_FILLSTYLE); - pAttr->Put (XFillGradientItem (pName->GetValue (), aGradient), XATTR_FILLGRADIENT); + XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put(aStyleItem); + XFillGradientItem aGradientItem(pName->GetValue (), aGradient); + aGradientItem.SetWhich(XATTR_FILLGRADIENT); + pAttr->Put(aGradientItem); break; } } @@ -367,8 +378,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) GetDoc()->GetGradientList ()->Insert (new XGradientEntry (aGradient, pName->GetValue ())); - pAttr->Put (XFillStyleItem (drawing::FillStyle_GRADIENT), XATTR_FILLSTYLE); - pAttr->Put (XFillGradientItem (pName->GetValue (), aGradient), XATTR_FILLGRADIENT); + XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put(aStyleItem); + XFillGradientItem aGradientItem(pName->GetValue(), aGradient); + aGradientItem.SetWhich(XATTR_FILLGRADIENT); + pAttr->Put(aGradientItem); } rBindings.Invalidate (SID_ATTR_FILL_STYLE); @@ -411,8 +426,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) aHatch.SetColor (aColor); - pAttr->Put (XFillStyleItem (drawing::FillStyle_HATCH), XATTR_FILLSTYLE); - pAttr->Put (XFillHatchItem (pName->GetValue (), aHatch), XATTR_FILLHATCH); + XFillStyleItem aStyleItem(drawing::FillStyle_HATCH); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put(aStyleItem); + XFillHatchItem aHatchItem(pName->GetValue(), aHatch); + aHatchItem.SetWhich(XATTR_FILLHATCH); + pAttr->Put(aHatchItem); break; } } @@ -423,8 +442,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) GetDoc()->GetHatchList ()->Insert (new XHatchEntry (aHatch, pName->GetValue ())); - pAttr->Put (XFillStyleItem (drawing::FillStyle_HATCH), XATTR_FILLSTYLE); - pAttr->Put (XFillHatchItem (pName->GetValue (), aHatch), XATTR_FILLHATCH); + XFillStyleItem aStyleItem(drawing::FillStyle_HATCH); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put(aStyleItem); + XFillHatchItem aHatchItem(pName->GetValue (), aHatch); + aHatchItem.SetWhich(XATTR_FILLHATCH); + pAttr->Put(aHatchItem); } rBindings.Invalidate (SID_ATTR_FILL_HATCH); @@ -473,8 +496,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) else pDashList->Insert (pEntry); - pAttr->Put (XLineDashItem (pName->GetValue (), aNewDash), XATTR_LINEDASH); - pAttr->Put (XLineStyleItem (drawing::LineStyle_DASH), XATTR_LINESTYLE); + XLineDashItem aDashItem(pName->GetValue(), aNewDash); + aDashItem.SetWhich(XATTR_LINEDASH); + pAttr->Put(aDashItem); + XLineStyleItem aStyleItem(drawing::LineStyle_DASH); + aStyleItem.SetWhich(XATTR_LINESTYLE); + pAttr->Put(aStyleItem); rBindings.Invalidate (SID_ATTR_LINE_DASH); rBindings.Invalidate (SID_ATTR_FILL_STYLE); } @@ -533,8 +560,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) aGradient.SetStartIntens ((short) pStart->GetValue ()); aGradient.SetEndIntens ((short) pEnd->GetValue ()); - pAttr->Put (XFillStyleItem (drawing::FillStyle_GRADIENT), XATTR_FILLSTYLE); - pAttr->Put (XFillGradientItem (pName->GetValue (), aGradient), XATTR_FILLGRADIENT); + XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put(aStyleItem); + XFillGradientItem aGradientItem(pName->GetValue (), aGradient); + aGradientItem.SetWhich(XATTR_FILLGRADIENT); + pAttr->Put(aGradientItem); break; } } @@ -548,8 +579,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) (short) pStart->GetValue (), (short) pEnd->GetValue ()); pGradientList->Insert (new XGradientEntry (aGradient, pName->GetValue ())); - pAttr->Put (XFillStyleItem (drawing::FillStyle_GRADIENT), XATTR_FILLSTYLE); - pAttr->Put (XFillGradientItem (pName->GetValue (), aGradient), XATTR_FILLGRADIENT); + XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put(aStyleItem); + XFillGradientItem aGradientItem(pName->GetValue (), aGradient); + aGradientItem.SetWhich(XATTR_FILLGRADIENT); + pAttr->Put(aGradientItem);; } rBindings.Invalidate (SID_ATTR_FILL_GRADIENT); @@ -599,8 +634,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) aHatch.SetDistance (pDistance->GetValue ()); aHatch.SetAngle (pAngle->GetValue () * 10); - pAttr->Put (XFillStyleItem (drawing::FillStyle_HATCH), XATTR_FILLSTYLE); - pAttr->Put (XFillHatchItem (pName->GetValue (), aHatch), XATTR_FILLHATCH); + XFillStyleItem aStyleItem(drawing::FillStyle_HATCH); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put(aStyleItem); + XFillHatchItem aHatchItem(pName->GetValue (), aHatch); + aHatchItem.SetWhich(XATTR_FILLHATCH); + pAttr->Put(aHatchItem); break; } } @@ -612,8 +651,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAngle->GetValue () * 10); pHatchList->Insert (new XHatchEntry (aHatch, pName->GetValue ())); - pAttr->Put (XFillStyleItem (drawing::FillStyle_HATCH), XATTR_FILLSTYLE); - pAttr->Put (XFillHatchItem (pName->GetValue (), aHatch), XATTR_FILLHATCH); + XFillStyleItem aStyleItem(drawing::FillStyle_HATCH); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put(aStyleItem); + XFillHatchItem aHatchItem(pName->GetValue (), aHatch); + aHatchItem.SetWhich(XATTR_FILLHATCH); + pAttr->Put(aHatchItem); } rBindings.Invalidate (SID_ATTR_FILL_HATCH); @@ -648,9 +691,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) { pAttr->ClearItem (XATTR_FILLGRADIENT); pAttr->ClearItem (XATTR_FILLSTYLE); - pAttr->Put (XFillStyleItem (drawing::FillStyle_GRADIENT), XATTR_FILLSTYLE); - pAttr->Put (XFillGradientItem (pName->GetValue (), pEntry->GetGradient ()), XATTR_FILLGRADIENT); - + XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put(aStyleItem); + XFillGradientItem aGradientItem(pName->GetValue (), pEntry->GetGradient ()); + aGradientItem.SetWhich(XATTR_FILLGRADIENT); + pAttr->Put(aGradientItem); rBindings.Invalidate (SID_ATTR_FILL_GRADIENT); rBindings.Invalidate (SID_ATTR_PAGE_GRADIENT); rBindings.Invalidate (SID_ATTR_FILL_STYLE); @@ -685,8 +731,12 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) { pAttr->ClearItem (XATTR_FILLHATCH); pAttr->ClearItem (XATTR_FILLSTYLE); - pAttr->Put (XFillStyleItem (drawing::FillStyle_HATCH), XATTR_FILLSTYLE); - pAttr->Put (XFillHatchItem (pName->GetValue (), pEntry->GetHatch ()), XATTR_FILLHATCH); + XFillStyleItem aStyleItem(drawing::FillStyle_HATCH); + aStyleItem.SetWhich(XATTR_FILLSTYLE); + pAttr->Put(aStyleItem); + XFillHatchItem aHatchItem(pName->GetValue (), pEntry->GetHatch ()); + aHatchItem.SetWhich(XATTR_FILLHATCH); + pAttr->Put(aHatchItem); rBindings.Invalidate (SID_ATTR_FILL_HATCH); rBindings.Invalidate (SID_ATTR_PAGE_HATCH); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index f76536beb97a..07c238254854 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -920,7 +920,8 @@ const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& if( pItem == nullptr ) pItem = static_cast<const SvxNumBulletItem*>( aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET) ); - aNewAttr.Put(*pItem, EE_PARA_NUMBULLET); + std::unique_ptr<SfxPoolItem> pNewItem(pItem->CloneSetWhich(EE_PARA_NUMBULLET)); + aNewAttr.Put(*pNewItem); if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET ) { |