diff options
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r-- | sw/source/core/unocore/SwXTextDefaults.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/unocore/unoframe.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/unocore/unosett.cxx | 9 |
3 files changed, 12 insertions, 19 deletions
diff --git a/sw/source/core/unocore/SwXTextDefaults.cxx b/sw/source/core/unocore/SwXTextDefaults.cxx index f9af14cb786c..82ef158a418d 100644 --- a/sw/source/core/unocore/SwXTextDefaults.cxx +++ b/sw/source/core/unocore/SwXTextDefaults.cxx @@ -88,8 +88,8 @@ void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName, SwStyleNameMapper::FillUIName(uStyle, sStyle, SwGetPoolIdFromName::ChrFmt ); SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>(m_pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SfxStyleFamily::Char)); - SwFormatDrop* pDrop = nullptr; - SwFormatCharFormat *pCharFormat = nullptr; + std::unique_ptr<SwFormatDrop> pDrop; + std::unique_ptr<SwFormatCharFormat> pCharFormat; if(!pStyle) throw lang::IllegalArgumentException(); @@ -99,26 +99,22 @@ void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName, if (RES_PARATR_DROP == pMap->nWID) { - pDrop = static_cast<SwFormatDrop*>(rItem.Clone()); // because rItem is const... + pDrop.reset(static_cast<SwFormatDrop*>(rItem.Clone())); // because rItem is const... pDrop->SetCharFormat(xStyle->GetCharFormat()); m_pDoc->SetDefault(*pDrop); } else // RES_TXTATR_CHARFMT == pMap->nWID { - pCharFormat = static_cast<SwFormatCharFormat*>(rItem.Clone()); // because rItem is const... + pCharFormat.reset(static_cast<SwFormatCharFormat*>(rItem.Clone())); // because rItem is const... pCharFormat->SetCharFormat(xStyle->GetCharFormat()); m_pDoc->SetDefault(*pCharFormat); } - - delete pDrop; - delete pCharFormat; } else { - SfxPoolItem * pNewItem = rItem.Clone(); + std::unique_ptr<SfxPoolItem> pNewItem(rItem.Clone()); pNewItem->PutValue( aValue, pMap->nMemberId); m_pDoc->SetDefault(*pNewItem); - delete pNewItem; } } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 0c04513751a4..dca356d6ad8d 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1104,10 +1104,9 @@ bool SwGraphicProperties_Impl::AnyToItemSet( sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0; if(GetProperty(nIDs[nIndex], nMId, pAny )) { - SfxPoolItem* pItem = ::GetDfltAttr( nIDs[nIndex] )->Clone(); + std::unique_ptr<SfxPoolItem> pItem(::GetDfltAttr( nIDs[nIndex] )->Clone()); bRet &= pItem->PutValue(*pAny, nMId ); rGrSet.Put(*pItem); - delete pItem; } } @@ -2705,12 +2704,12 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan UnoActionContext aCont(pDoc); if(m_pCopySource) { - SwFormatAnchor* pAnchorItem = nullptr; + std::unique_ptr<SwFormatAnchor> pAnchorItem; // the frame is inserted bound to page // to prevent conflicts if the to-be-anchored position is part of the to-be-copied text if (eAnchorId != RndStdIds::FLY_AT_PAGE) { - pAnchorItem = static_cast<SwFormatAnchor*>(aFrameSet.Get(RES_ANCHOR).Clone()); + pAnchorItem.reset(static_cast<SwFormatAnchor*>(aFrameSet.Get(RES_ANCHOR).Clone())); aFrameSet.Put( SwFormatAnchor( RndStdIds::FLY_AT_PAGE, 1 )); } @@ -2726,7 +2725,6 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan SfxItemSet aAnchorSet( pDoc->GetAttrPool(), svl::Items<RES_ANCHOR, RES_ANCHOR>{} ); aAnchorSet.Put( *pAnchorItem ); pDoc->SetFlyFrameAttr( *pFormat, aAnchorSet ); - delete pAnchorItem; } m_pCopySource.reset(); } diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 585881f14b5d..3a72361cdc49 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1613,7 +1613,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat( { SvxBrushItem* pSetBrush = nullptr; Size* pSetSize = nullptr; - SwFormatVertOrient* pSetVOrient = nullptr; + std::unique_ptr<SwFormatVertOrient> pSetVOrient; bool bCharStyleNameSet = false; for(size_t i = 0; i < SAL_N_ELEMENTS( aNumPropertyNames ) && !bExcept && !bWrongArg; ++i) @@ -1983,9 +1983,9 @@ void SwXNumberingRules::SetPropertiesToNumFormat( if(!pSetVOrient) { if(aFormat.GetGraphicOrientation()) - pSetVOrient = static_cast<SwFormatVertOrient*>(aFormat.GetGraphicOrientation()->Clone()); + pSetVOrient.reset( static_cast<SwFormatVertOrient*>(aFormat.GetGraphicOrientation()->Clone()) ); else - pSetVOrient = new SwFormatVertOrient; + pSetVOrient.reset(new SwFormatVertOrient); } pSetVOrient->PutValue(pProp->Value, MID_VERTORIENT_ORIENT); } @@ -2041,7 +2041,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat( if(pSetBrush) { if(!pSetVOrient && aFormat.GetGraphicOrientation()) - pSetVOrient = new SwFormatVertOrient(*aFormat.GetGraphicOrientation()); + pSetVOrient.reset( new SwFormatVertOrient(*aFormat.GetGraphicOrientation()) ); if(!pSetSize) { @@ -2069,7 +2069,6 @@ void SwXNumberingRules::SetPropertiesToNumFormat( } delete pSetBrush; delete pSetSize; - delete pSetVOrient; } if(bWrongArg) |