summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-04-23 20:23:29 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-27 07:21:45 +0000
commit9eb2e683ab051edd0bce18841f0ac05df5038854 (patch)
tree71e7a4d4b8389c09ff17024fceaed94668751082 /sw
parentfd964e3b9f60bf2043fdc39ab8161a586049b481 (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 'sw')
-rw-r--r--sw/source/core/attr/swatrset.cxx2
-rw-r--r--sw/source/core/doc/poolfmt.cxx10
-rw-r--r--sw/source/core/doc/tblafmt.cxx18
-rw-r--r--sw/source/filter/ascii/parasc.cxx12
-rw-r--r--sw/source/filter/ww8/ww8graf.cxx2
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx6
-rw-r--r--sw/source/ui/frmdlg/wrap.cxx4
-rw-r--r--sw/source/uibase/app/appopt.cxx15
-rw-r--r--sw/source/uibase/lingu/olmenu.cxx2
-rw-r--r--sw/source/uibase/shells/annotsh.cxx41
-rw-r--r--sw/source/uibase/shells/basesh.cxx10
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx19
-rw-r--r--sw/source/uibase/shells/drwtxtsh.cxx12
-rw-r--r--sw/source/uibase/shells/langhelper.cxx2
-rw-r--r--sw/source/uibase/shells/tabsh.cxx13
-rw-r--r--sw/source/uibase/shells/textsh.cxx9
-rw-r--r--sw/source/uibase/shells/textsh1.cxx5
-rw-r--r--sw/source/uibase/uiview/formatclipboard.cxx13
-rw-r--r--sw/source/uibase/uiview/viewstat.cxx24
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx18
20 files changed, 162 insertions, 75 deletions
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index 2f88ebf0bed3..2b8ab0f94b36 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -178,7 +178,7 @@ SfxItemSet* SwAttrSet::Clone( bool bItems, SfxItemPool *pToPool ) const
{
const SfxPoolItem* pItem;
if ( SfxItemState::SET == GetItemState( nWhich, false, &pItem ) )
- pTmpSet->Put( *pItem, pItem->Which() );
+ pTmpSet->Put( *pItem );
nWhich = aIter.NextWhich();
}
}
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 4c812b51d657..c780f811aa6e 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -102,9 +102,15 @@ void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem )
}
if( nWhCJK )
- rSet.Put( rItem, nWhCJK );
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(rItem.CloneSetWhich(nWhCJK));
+ rSet.Put( *pNewItem );
+ }
if( nWhCTL )
- rSet.Put( rItem, nWhCTL );
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(rItem.CloneSetWhich(nWhCTL));
+ rSet.Put( *pNewItem );
+ }
}
/// Return the AutoCollection by its Id. If it doesn't
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index c27194c40ee4..6c55d0b8304f 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -779,9 +779,12 @@ void SwTableAutoFormat::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
}
else
{
- rSet.Put( rChg.GetHeight(), RES_CHRATR_CJK_FONTSIZE );
- rSet.Put( rChg.GetWeight(), RES_CHRATR_CJK_WEIGHT );
- rSet.Put( rChg.GetPosture(), RES_CHRATR_CJK_POSTURE );
+ std::unique_ptr<SfxPoolItem> pNewItem(rChg.GetHeight().CloneSetWhich(RES_CHRATR_CJK_FONTSIZE));
+ rSet.Put( *pNewItem);
+ pNewItem.reset(rChg.GetWeight().CloneSetWhich(RES_CHRATR_CJK_WEIGHT));
+ rSet.Put( *pNewItem);
+ pNewItem.reset(rChg.GetPosture().CloneSetWhich(RES_CHRATR_CJK_POSTURE));
+ rSet.Put( *pNewItem);
}
// do not insert empty CTL font
const SvxFontItem& rCTLFont = rChg.GetCTLFont();
@@ -794,9 +797,12 @@ void SwTableAutoFormat::UpdateToSet(sal_uInt8 nPos, SfxItemSet& rSet,
}
else
{
- rSet.Put( rChg.GetHeight(), RES_CHRATR_CTL_FONTSIZE );
- rSet.Put( rChg.GetWeight(), RES_CHRATR_CTL_WEIGHT );
- rSet.Put( rChg.GetPosture(), RES_CHRATR_CTL_POSTURE );
+ std::unique_ptr<SfxPoolItem> pNewItem(rChg.GetHeight().CloneSetWhich(RES_CHRATR_CTL_FONTSIZE));
+ rSet.Put( *pNewItem);
+ pNewItem.reset(rChg.GetWeight().CloneSetWhich(RES_CHRATR_CTL_WEIGHT));
+ rSet.Put( *pNewItem);
+ pNewItem.reset(rChg.GetPosture().CloneSetWhich(RES_CHRATR_CTL_POSTURE));
+ rSet.Put( *pNewItem);
}
rSet.Put( rChg.GetUnderline() );
rSet.Put( rChg.GetOverline() );
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index 852b5b5432f0..8857990cbf33 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -108,8 +108,10 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
SvxLanguageItem aLang( (LanguageType)rOpt.GetLanguage(),
RES_CHRATR_LANGUAGE );
pItemSet->Put( aLang );
- pItemSet->Put( aLang, RES_CHRATR_CJK_LANGUAGE );
- pItemSet->Put( aLang, RES_CHRATR_CTL_LANGUAGE );
+ aLang.SetWhich(RES_CHRATR_CJK_LANGUAGE);
+ pItemSet->Put( aLang );
+ aLang.SetWhich(RES_CHRATR_CTL_LANGUAGE);
+ pItemSet->Put( aLang );
}
if( !rOpt.GetFontName().isEmpty() )
{
@@ -119,8 +121,10 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
SvxFontItem aFont( aTextFont.GetFamilyType(), aTextFont.GetFamilyName(),
OUString(), aTextFont.GetPitch(), aTextFont.GetCharSet(), RES_CHRATR_FONT );
pItemSet->Put( aFont );
- pItemSet->Put( aFont, RES_CHRATR_CJK_FONT );
- pItemSet->Put( aFont, RES_CHRATR_CTL_FONT );
+ aFont.SetWhich(RES_CHRATR_CJK_FONT);
+ pItemSet->Put( aFont );
+ aFont.SetWhich(RES_CHRATR_CTL_FONT);
+ pItemSet->Put( aFont );
}
}
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 0fe0bf5287cf..37cb677378e2 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1864,7 +1864,7 @@ void SwWW8ImplReader::MatchSdrItemsIntoFlySet( SdrObject* pSdrObj,
}
if (bBrushItemOk)
- rFlySet.Put(aBrushItem, RES_BACKGROUND);
+ rFlySet.Put(aBrushItem);
}
void SwWW8ImplReader::AdjustLRWrapForWordMargins(
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index c1babe196bbf..f97036d88dfd 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -670,8 +670,10 @@ IMPL_LINK_TYPED( SwInsertDBColAutoPilot, TableFormatHdl, Button*, pButton, void
SvxBrushItem aBrush( RES_BACKGROUND );
pTableSet->Put( aBrush );
- pTableSet->Put( aBrush, SID_ATTR_BRUSH_ROW );
- pTableSet->Put( aBrush, SID_ATTR_BRUSH_TABLE );
+ aBrush.SetWhich(SID_ATTR_BRUSH_ROW);
+ pTableSet->Put( aBrush );
+ aBrush.SetWhich(SID_ATTR_BRUSH_TABLE);
+ pTableSet->Put( aBrush );
SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
// table variant, when multiple table cells are selected
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index e738e7ca04ab..d20fa3b880ae 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -360,7 +360,7 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet)
if(nullptr == (pOldItem = GetOldItem(*rSet, RES_UL_SPACE)) ||
aUL != *pOldItem )
{
- rSet->Put( aUL, RES_UL_SPACE );
+ rSet->Put( aUL );
bModified = true;
}
}
@@ -377,7 +377,7 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet)
if( nullptr == (pOldItem = GetOldItem(*rSet, RES_LR_SPACE)) ||
aLR != *pOldItem )
{
- rSet->Put(aLR, RES_LR_SPACE);
+ rSet->Put(aLR);
bModified = true;
}
}
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index f4f31a2d9fd6..f1c01ee726a8 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -136,14 +136,17 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
- pRet->Put(static_cast<const SvxLanguageItem&>(
- rWrtShell.GetDefault(RES_CHRATR_LANGUAGE)), SID_ATTR_LANGUAGE);
+ std::unique_ptr<SfxPoolItem> pNewItem( static_cast<const SvxLanguageItem&>(
+ rWrtShell.GetDefault(RES_CHRATR_LANGUAGE)).CloneSetWhich(SID_ATTR_LANGUAGE) );
+ pRet->Put(*pNewItem);
- pRet->Put(static_cast<const SvxLanguageItem&>(
- rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE)), SID_ATTR_CHAR_CJK_LANGUAGE);
+ pNewItem.reset(static_cast<const SvxLanguageItem&>(
+ rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE)).CloneSetWhich(SID_ATTR_CHAR_CJK_LANGUAGE));
+ pRet->Put(*pNewItem);
- pRet->Put(static_cast<const SvxLanguageItem&>(
- rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE)), SID_ATTR_CHAR_CTL_LANGUAGE);
+ pNewItem.reset(static_cast<const SvxLanguageItem&>(
+ rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE)).CloneSetWhich(SID_ATTR_CHAR_CTL_LANGUAGE));
+ pRet->Put(*pNewItem);
}
else
{
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx
index 0eff29ad9929..d4b1aceea5e2 100644
--- a/sw/source/uibase/lingu/olmenu.cxx
+++ b/sw/source/uibase/lingu/olmenu.cxx
@@ -616,7 +616,7 @@ void SwSpellPopup::checkRedline()
SfxItemSet aSet(pDoc->GetAttrPool(), FN_REDLINE_ACCEPT_DIRECT, FN_REDLINE_PREV_CHANGE);
for (sal_uInt16 nWhich : pRedlineIds)
{
- aSet.Put(SfxVoidItem(nWhich), nWhich);
+ aSet.Put(SfxVoidItem(nWhich));
}
m_pSh->GetView().GetState(aSet);
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index c156d6e5bc47..d9b8d9fba8c6 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -366,7 +366,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
else
aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
- aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
+ aNewAttr.Put( aItem );
}
break;
case FN_SET_SUB_SCRIPT:
@@ -379,7 +379,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
else
aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
- aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
+ aNewAttr.Put( aItem );
}
break;
case SID_HYPERLINK_SETLINK:
@@ -603,7 +603,10 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
}
if(nEEWhich && pNewAttrs)
- aNewAttr.Put(pNewAttrs->Get(nWhich), nEEWhich);
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich));
+ aNewAttr.Put(*pNewItem);
+ }
Rectangle aNullRect;
Rectangle aOutRect = pOLV->GetOutputArea();
@@ -702,7 +705,10 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet)
aSetItem.GetItemSet().Put( aEditAttr, false );
const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
if( pI )
- rSet.Put( *pI, nWhich );
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(pI->CloneSetWhich(nWhich));
+ rSet.Put( *pNewItem );
+ }
else
rSet.InvalidateItem( nWhich );
}
@@ -851,16 +857,17 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet)
if(nEEWhich)
{
- rSet.Put(aEditAttr.Get(nEEWhich), nWhich);
- if(nEEWhich == EE_CHAR_KERNING)
- {
- SfxItemState eState = aEditAttr.GetItemState( EE_CHAR_KERNING );
- if ( eState == SfxItemState::DONTCARE )
+ std::unique_ptr<SfxPoolItem> pNewItem(aEditAttr.Get(nEEWhich).CloneSetWhich(nWhich));
+ rSet.Put(*pNewItem);
+ if(nEEWhich == EE_CHAR_KERNING)
{
- rSet.InvalidateItem(EE_CHAR_KERNING);
+ SfxItemState eState = aEditAttr.GetItemState( EE_CHAR_KERNING );
+ if ( eState == SfxItemState::DONTCARE )
+ {
+ rSet.InvalidateItem(EE_CHAR_KERNING);
+ }
}
}
- }
if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
rSet.DisableItem( nWhich );
@@ -1774,11 +1781,17 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
EE_CHAR_FONTINFO );
SvtScriptType nScriptBreak = g_pBreakIt->GetAllScriptsOfText( sSym );
if( SvtScriptType::LATIN & nScriptBreak )
- aSetFont.Put( aFontItem, EE_CHAR_FONTINFO );
+ aSetFont.Put( aFontItem );
if( SvtScriptType::ASIAN & nScriptBreak )
- aSetFont.Put( aFontItem, EE_CHAR_FONTINFO_CJK );
+ {
+ aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK);
+ aSetFont.Put( aFontItem );
+ }
if( SvtScriptType::COMPLEX & nScriptBreak )
- aSetFont.Put( aFontItem, EE_CHAR_FONTINFO_CTL );
+ {
+ aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL);
+ aSetFont.Put( aFontItem );
+ }
pOLV->SetAttribs(aSetFont);
// Erase selection
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 03572fcc3809..eb70ed6bb6cb 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -2117,7 +2117,10 @@ void SwBaseShell::GetTextFontCtrlState( SfxItemSet& rSet )
aSetItem.GetItemSet().Put( *pFntCoreSet, false );
const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
if( pI )
- rSet.Put( *pI, nWhich );
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(pI->CloneSetWhich(nWhich));
+ rSet.Put( *pNewItem );
+ }
else
rSet.InvalidateItem( nWhich );
// Set input context of the SwEditWin according to the selected font and script type
@@ -2191,13 +2194,14 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet)
case SID_BACKGROUND_COLOR:
{
SvxColorItem aColorItem(aBrushItem.GetColor(),SID_BACKGROUND_COLOR);
- rSet.Put(aColorItem,SID_BACKGROUND_COLOR);
+ rSet.Put(aColorItem);
break;
}
case SID_ATTR_BRUSH:
case RES_BACKGROUND:
{
- rSet.Put(aBrushItem,GetPool().GetWhich(nWhich));
+ std::unique_ptr<SfxPoolItem> pNewItem(aBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich)));
+ rSet.Put(*pNewItem);
break;
}
}
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 4bbd6a958dce..0943a1ffd111 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -297,7 +297,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
else
aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
- aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
+ aNewAttr.Put( aItem );
}
break;
case FN_SET_SUB_SCRIPT:
@@ -310,7 +310,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
else
aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
- aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
+ aNewAttr.Put( aItem );
}
break;
@@ -564,7 +564,10 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
return;
}
if(nEEWhich && pNewAttrs)
- aNewAttr.Put(pNewAttrs->Get(nWhich), nEEWhich);
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich));
+ aNewAttr.Put(*pNewItem);
+ }
SetAttrToMarked(aNewAttr);
@@ -891,7 +894,10 @@ void SwDrawTextShell::GetDrawTextCtrlState(SfxItemSet& rSet)
aSetItem.GetItemSet().Put( aEditAttr, false );
const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
if( pI )
- rSet.Put( *pI, nWhich );
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(pI->CloneSetWhich(nWhich));
+ rSet.Put( *pNewItem );
+ }
else
rSet.InvalidateItem( nWhich );
}
@@ -941,7 +947,10 @@ void SwDrawTextShell::GetDrawTextCtrlState(SfxItemSet& rSet)
}
}
if(nEEWhich)
- rSet.Put(aEditAttr.Get(nEEWhich), nWhich);
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(aEditAttr.Get(nEEWhich).CloneSetWhich(nWhich));
+ rSet.Put(*pNewItem);
+ }
nWhich = aIter.NextWhich();
}
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 15fb8fb11aa2..df2dbda4f856 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -792,11 +792,17 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
EE_CHAR_FONTINFO );
nScript = g_pBreakIt->GetAllScriptsOfText( sSym );
if( SvtScriptType::LATIN & nScript )
- aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO );
+ aFontAttribSet.Put( aFontItem );
if( SvtScriptType::ASIAN & nScript )
- aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CJK );
+ {
+ aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK);
+ aFontAttribSet.Put( aFontItem );
+ }
if( SvtScriptType::COMPLEX & nScript )
- aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CTL );
+ {
+ aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL);
+ aFontAttribSet.Put( aFontItem );
+ }
pOLV->SetAttribs(aFontAttribSet);
// Remove selection
diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx
index bc9aa3268445..2a328ab9f4ca 100644
--- a/sw/source/uibase/shells/langhelper.cxx
+++ b/sw/source/uibase/shells/langhelper.cxx
@@ -96,7 +96,7 @@ namespace SwLangHelper
// set sequence as status value
SfxStringListItem aItem( SID_LANGUAGE_STATUS );
aItem.SetStringList( aSeq );
- rSet.Put( aItem, SID_LANGUAGE_STATUS );
+ rSet.Put( aItem );
return 0;
}
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index ef4d98abd9a7..ac84b529ed93 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -159,16 +159,23 @@ static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
rSet.Put(SwBackgroundDestinationItem(SID_BACKGRND_DESTINATION, nBackgroundDestination ));
SvxBrushItem aBrush( RES_BACKGROUND );
if(rSh.GetRowBackground(aBrush))
- rSet.Put( aBrush, SID_ATTR_BRUSH_ROW );
+ {
+ aBrush.SetWhich(SID_ATTR_BRUSH_ROW);
+ rSet.Put( aBrush );
+ }
else
rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
rSh.GetTabBackground(aBrush);
- rSet.Put( aBrush, SID_ATTR_BRUSH_TABLE );
+ aBrush.SetWhich(SID_ATTR_BRUSH_TABLE);
+ rSet.Put( aBrush );
// text direction in boxes
SvxFrameDirectionItem aBoxDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
if(rSh.GetBoxDirection( aBoxDirection ))
- rSet.Put(aBoxDirection, FN_TABLE_BOX_TEXTORIENTATION);
+ {
+ aBoxDirection.SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
+ rSet.Put(aBoxDirection);
+ }
bool bSelectAll = rSh.StartsWithTable() && rSh.ExtendedSelectedAll();
bool bTableSel = rSh.IsTableMode() || bSelectAll;
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index fe8b8277bfa5..392e42c1f88a 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -1006,17 +1006,20 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
if( SvtScriptType::LATIN & nScript )
{
aRestoreSet.Put( aSet.Get( RES_CHRATR_FONT ) );
- aSet.Put( aNewFontItem, RES_CHRATR_FONT);
+ aNewFontItem.SetWhich(RES_CHRATR_FONT);
+ aSet.Put( aNewFontItem );
}
if( SvtScriptType::ASIAN & nScript )
{
aRestoreSet.Put( aSet.Get( RES_CHRATR_CJK_FONT ) );
- aSet.Put( aNewFontItem, RES_CHRATR_CJK_FONT );
+ aNewFontItem.SetWhich(RES_CHRATR_CJK_FONT);
+ aSet.Put( aNewFontItem );
}
if( SvtScriptType::COMPLEX & nScript )
{
aRestoreSet.Put( aSet.Get( RES_CHRATR_CTL_FONT ) );
- aSet.Put( aNewFontItem, RES_CHRATR_CTL_FONT );
+ aNewFontItem.SetWhich(RES_CHRATR_CTL_FONT);
+ aSet.Put( aNewFontItem );
}
rSh.SetMark();
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index c56621e65f8e..6e7d1645c196 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1457,7 +1457,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
// set sequence as status value
SfxStringListItem aItem( SID_LANGUAGE_STATUS );
aItem.SetStringList( aSeq );
- rSet.Put( aItem, SID_LANGUAGE_STATUS );
+ rSet.Put( aItem );
}
break;
@@ -1615,7 +1615,8 @@ void SwTextShell::GetState( SfxItemSet &rSet )
SfxItemSet aSet( GetPool() );
rSh.GetCurAttr( aSet );
const SvxColorItem& aColorItem = static_cast< const SvxColorItem& >( aSet.Get(RES_CHRATR_COLOR) );
- rSet.Put( aColorItem, SID_ATTR_CHAR_COLOR2 );
+ std::unique_ptr<SfxPoolItem> pNewItem(aColorItem.CloneSetWhich(SID_ATTR_CHAR_COLOR2));
+ rSet.Put( *pNewItem );
}
break;
case SID_ATTR_CHAR_COLOR_BACKGROUND:
diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx
index 8ded8620e9dd..cab5e7bbee24 100644
--- a/sw/source/uibase/uiview/formatclipboard.cxx
+++ b/sw/source/uibase/uiview/formatclipboard.cxx
@@ -92,11 +92,15 @@ void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell &rSh )
rSh.GetBoxBackground(aBrush);
rSet.Put( aBrush );
if(rSh.GetRowBackground(aBrush))
- rSet.Put( aBrush, SID_ATTR_BRUSH_ROW );
+ {
+ aBrush.SetWhich(SID_ATTR_BRUSH_ROW);
+ rSet.Put( aBrush );
+ }
else
rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
rSh.GetTabBackground(aBrush);
- rSet.Put( aBrush, SID_ATTR_BRUSH_TABLE );
+ aBrush.SetWhich(SID_ATTR_BRUSH_TABLE);
+ rSet.Put( aBrush );
SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
rSet.Put(aBoxInfo);
@@ -104,7 +108,10 @@ void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell &rSh )
SvxFrameDirectionItem aBoxDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
if(rSh.GetBoxDirection( aBoxDirection ))
- rSet.Put(aBoxDirection, FN_TABLE_BOX_TEXTORIENTATION);
+ {
+ aBoxDirection.SetWhich(FN_TABLE_BOX_TEXTORIENTATION);
+ rSet.Put(aBoxDirection);
+ }
rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, rSh.GetBoxAlign()));
diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx
index ecb23027bb46..57230888045c 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -237,17 +237,24 @@ void SwView::GetState(SfxItemSet &rSet)
break;
case SID_ATTR_LANGUAGE:
{
- rSet.Put(static_cast<const SvxLanguageItem&>(
- m_pWrtShell->GetDefault(RES_CHRATR_LANGUAGE)), SID_ATTR_LANGUAGE);
+ std::unique_ptr<SfxPoolItem> pNewItem(static_cast<const SvxLanguageItem&>(
+ m_pWrtShell->GetDefault(RES_CHRATR_LANGUAGE)).CloneSetWhich(SID_ATTR_LANGUAGE));
+ rSet.Put(*pNewItem);
}
break;
case RES_CHRATR_CJK_LANGUAGE:
- rSet.Put(static_cast<const SvxLanguageItem&>(
- m_pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE)), RES_CHRATR_CJK_LANGUAGE);
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(static_cast<const SvxLanguageItem&>(
+ m_pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE)).CloneSetWhich(RES_CHRATR_CJK_LANGUAGE));
+ rSet.Put(*pNewItem);
+ }
break;
case RES_CHRATR_CTL_LANGUAGE:
- rSet.Put(static_cast<const SvxLanguageItem&>(
- m_pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE)), RES_CHRATR_CTL_LANGUAGE);
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(static_cast<const SvxLanguageItem&>(
+ m_pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE)).CloneSetWhich(RES_CHRATR_CTL_LANGUAGE));
+ rSet.Put(*pNewItem);
+ }
break;
case FN_REDLINE_ON:
rSet.Put( SfxBoolItem( nWhich, GetDocShell()->IsChangeRecording() ) );
@@ -449,7 +456,10 @@ void SwView::GetState(SfxItemSet &rSet)
if(nAlias)
GetViewFrame()->GetDispatcher()->QueryState( nAlias, pState );
if(pState)
- rSet.Put(*pState, nWhich);
+ {
+ std::unique_ptr<SfxPoolItem> pNewItem(pState->CloneSetWhich(nWhich));
+ rSet.Put(*pNewItem);
+ }
else if(!bDraw)
rSet.DisableItem(nWhich);
}
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index b4d865c0786a..7ab973dc82e2 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1239,7 +1239,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
m_pHRuler->SetDefTabDist( nDefTabDist );
m_pVRuler->SetDefTabDist( nDefTabDist );
::lcl_EraseDefTabs(aTabStops);
- rSet.Put(aTabStops, nWhich);
+ aTabStops.SetWhich(nWhich);
+ rSet.Put(aTabStops);
}
break;
}
@@ -1535,7 +1536,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
0, 0, true);
aColItem.Append(aColDesc);
}
- rSet.Put(aColItem, nWhich);
+ aColItem.SetWhich(nWhich);
+ rSet.Put(aColItem);
}
else if ( bFrameSelection || nFrameType & ( FrameTypeFlags::COLUMN | FrameTypeFlags::COLSECT ) )
{
@@ -1589,7 +1591,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
}
aColItem.SetOrtho(aColItem.CalcOrtho());
- rSet.Put(aColItem, nWhich);
+ aColItem.SetWhich(nWhich);
+ rSet.Put(aColItem);
}
}
else if( bFrameSelection || nFrameType & FrameTypeFlags::FLY_ANY )
@@ -1629,7 +1632,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
aColItem.SetOrtho(aColItem.CalcOrtho());
- rSet.Put(aColItem, nWhich);
+ aColItem.SetWhich(nWhich);
+ rSet.Put(aColItem);
}
else
rSet.DisableItem(nWhich);
@@ -1682,7 +1686,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
}
aColItem.SetOrtho(aColItem.CalcOrtho());
- rSet.Put(aColItem, nWhich);
+ aColItem.SetWhich(nWhich);
+ rSet.Put(aColItem);
}
}
else
@@ -1770,7 +1775,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
false );
aColItem.Append(aColDesc);
- rSet.Put(aColItem, nWhich);
+ aColItem.SetWhich(nWhich);
+ rSet.Put(aColItem);
}
else
rSet.DisableItem(nWhich);