summaryrefslogtreecommitdiff
path: root/cui/source/tabpages/tplneend.cxx
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-08-15 09:19:35 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-08-15 07:49:37 +0000
commit2b68e03348b3b4009e8bb2af7979de36bd3450c5 (patch)
treeea337632ae63bc8c19cdb1b72feedbce8302433a /cui/source/tabpages/tplneend.cxx
parent3093732c17d14b0e6eb67868c514448f13bc66d0 (diff)
tdf#100782 have XPropertyList hold unique_ptr
Change-Id: I928f297e1be76b965898d83cb3dd2e79b23b7974 Reviewed-on: https://gerrit.libreoffice.org/28095 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'cui/source/tabpages/tplneend.cxx')
-rw-r--r--cui/source/tabpages/tplneend.cxx26
1 files changed, 12 insertions, 14 deletions
diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx
index c52ebf02134f..8bbe4940c701 100644
--- a/cui/source/tabpages/tplneend.cxx
+++ b/cui/source/tabpages/tplneend.cxx
@@ -45,6 +45,8 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svx/dialogs.hrc>
+#include <o3tl/make_unique.hxx>
+
#define XOUT_WIDTH 150
SvxLineEndDefTabPage::SvxLineEndDefTabPage
@@ -223,7 +225,7 @@ bool SvxLineEndDefTabPage::FillItemSet( SfxItemSet* rSet )
CheckChanges_Impl();
long nPos = m_pLbLineEnds->GetSelectEntryPos();
- XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
+ const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nPos);
rSet->Put( XLineStartItem( pEntry->GetName(), pEntry->GetLineEnd() ) );
rSet->Put( XLineEndItem( pEntry->GetName(), pEntry->GetLineEnd() ) );
@@ -242,7 +244,7 @@ void SvxLineEndDefTabPage::Reset( const SfxItemSet* )
{
int nPos = m_pLbLineEnds->GetSelectEntryPos();
- XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
+ const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nPos);
m_pEdtName->SetText( m_pLbLineEnds->GetSelectEntry() );
@@ -283,7 +285,7 @@ IMPL_LINK_NOARG_TYPED(SvxLineEndDefTabPage, SelectLineEndHdl_Impl, ListBox&, voi
{
int nPos = m_pLbLineEnds->GetSelectEntryPos();
- XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
+ const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nPos);
m_pEdtName->SetText( m_pLbLineEnds->GetSelectEntry() );
@@ -360,17 +362,16 @@ IMPL_LINK_NOARG_TYPED(SvxLineEndDefTabPage, ClickModifyHdl_Impl, Button*, void)
// if not existing, enter the entry
if( bDifferent )
{
- const XLineEndEntry* pOldEntry = pLineEndList->GetLineEnd( nPos );
+ const XLineEndEntry* pOldEntry = pLineEndList->GetLineEnd(nPos);
if(pOldEntry)
{
- // #123497# Need to replace the existing entry with a new one (old returned needs to be deleted)
- XLineEndEntry* pEntry = new XLineEndEntry(pOldEntry->GetLineEnd(), aName);
- delete pLineEndList->Replace(pEntry, nPos);
+ // #123497# Need to replace the existing entry with a new one
+ pLineEndList->Replace(o3tl::make_unique<XLineEndEntry>(pOldEntry->GetLineEnd(), aName), nPos);
m_pEdtName->SetText( aName );
- m_pLbLineEnds->Modify( *pEntry, nPos, pLineEndList->GetUiBitmap( nPos ) );
+ m_pLbLineEnds->Modify(*pLineEndList->GetLineEnd(nPos), nPos, pLineEndList->GetUiBitmap(nPos));
m_pLbLineEnds->SelectEntryPos( nPos );
// Flag fuer modifiziert setzen
@@ -422,8 +423,6 @@ IMPL_LINK_NOARG_TYPED(SvxLineEndDefTabPage, ClickAddHdl_Impl, Button*, void)
SdrObject::Free( pConvPolyObj );
- XLineEndEntry* pEntry;
-
ResMgr& rMgr = CUI_MGR();
OUString aNewName( SVX_RES( RID_SVXSTR_LINEEND ) );
OUString aDesc( ResId( RID_SVXSTR_DESC_LINEEND, rMgr ) );
@@ -463,13 +462,12 @@ IMPL_LINK_NOARG_TYPED(SvxLineEndDefTabPage, ClickAddHdl_Impl, Button*, void)
if( bDifferent )
{
bLoop = false;
- pEntry = new XLineEndEntry( aNewPolyPolygon, aName );
long nLineEndCount = pLineEndList->Count();
- pLineEndList->Insert( pEntry, nLineEndCount );
+ pLineEndList->Insert(o3tl::make_unique<XLineEndEntry>(aNewPolyPolygon, aName), nLineEndCount);
// add to the ListBox
- m_pLbLineEnds->Append( *pEntry, pLineEndList->GetUiBitmap( nLineEndCount ) );
+ m_pLbLineEnds->Append(*pLineEndList->GetLineEnd(nLineEndCount), pLineEndList->GetUiBitmap(nLineEndCount));
m_pLbLineEnds->SelectEntryPos( m_pLbLineEnds->GetEntryCount() - 1 );
*pnLineEndListState |= ChangeType::MODIFIED;
@@ -510,7 +508,7 @@ IMPL_LINK_NOARG_TYPED(SvxLineEndDefTabPage, ClickDeleteHdl_Impl, Button*, void)
if ( aQueryBox->Execute() == RET_YES )
{
- delete pLineEndList->Remove( nPos );
+ pLineEndList->Remove(nPos);
m_pLbLineEnds->RemoveEntry( nPos );
m_pLbLineEnds->SelectEntryPos( 0 );