diff options
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r-- | svx/source/tbxctrls/SvxPresetListBox.cxx | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/fillctrl.cxx | 21 | ||||
-rw-r--r-- | svx/source/tbxctrls/linectrl.cxx | 16 |
3 files changed, 16 insertions, 23 deletions
diff --git a/svx/source/tbxctrls/SvxPresetListBox.cxx b/svx/source/tbxctrls/SvxPresetListBox.cxx index 1f73a4ccaddc..0786d9d9049b 100644 --- a/svx/source/tbxctrls/SvxPresetListBox.cxx +++ b/svx/source/tbxctrls/SvxPresetListBox.cxx @@ -102,7 +102,7 @@ void SvxPresetListBox::FillPresetListBoxImpl(ListType & pList, sal_uInt32 nStart for(long nIndex = 0; nIndex < pList.Count(); nIndex++, nStartIndex++) { aBitmap = pList.GetBitmapForPreview(nIndex, aSize); - EntryType *pItem = static_cast<EntryType*>( pList.Get( nIndex ) ); + EntryType* pItem = static_cast<EntryType*>( pList.Get(nIndex) ); InsertItem(nStartIndex, Image(aBitmap), pItem->GetName()); } } diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 9d3bfb067ae1..96f160254285 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -39,6 +39,8 @@ #include <svx/dialmgr.hxx> #include "helpid.hrc" #include <memory> +#include <o3tl/make_unique.hxx> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -376,19 +378,16 @@ void SvxFillToolBoxControl::Update() } aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END; - std::unique_ptr<XGradientEntry> pEntry(new XGradientEntry(mpFillGradientItem->GetGradientValue(), aTmpStr)); XGradientList aGradientList( "", ""/*TODO?*/ ); - aGradientList.Insert( pEntry.get() ); + aGradientList.Insert(o3tl::make_unique<XGradientEntry>(mpFillGradientItem->GetGradientValue(), aTmpStr)); aGradientList.SetDirty( false ); const Bitmap aBmp = aGradientList.GetUiBitmap( 0 ); if(!aBmp.IsEmpty()) { - mpLbFillAttr->InsertEntry(pEntry->GetName(), Image(aBmp)); + mpLbFillAttr->InsertEntry(aGradientList.Get(0)->GetName(), Image(aBmp)); mpLbFillAttr->SelectEntryPos(mpLbFillAttr->GetEntryCount() - 1); } - - aGradientList.Remove( 0 ); } } @@ -438,21 +437,17 @@ void SvxFillToolBoxControl::Update() } aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END; - XHatchEntry* pEntry = new XHatchEntry(mpHatchItem->GetHatchValue(), aTmpStr); XHatchList aHatchList( "", ""/*TODO?*/ ); - aHatchList.Insert( pEntry ); + aHatchList.Insert(o3tl::make_unique<XHatchEntry>(mpHatchItem->GetHatchValue(), aTmpStr)); aHatchList.SetDirty( false ); const Bitmap aBmp = aHatchList.GetUiBitmap( 0 ); if( !aBmp.IsEmpty() ) { - mpLbFillAttr->InsertEntry(pEntry->GetName(), Image(aBmp)); + mpLbFillAttr->InsertEntry(aHatchList.GetHatch(0)->GetName(), Image(aBmp)); mpLbFillAttr->SelectEntryPos( mpLbFillAttr->GetEntryCount() - 1 ); //delete pBmp; } - - aHatchList.Remove( 0 ); - delete pEntry; } } else @@ -501,16 +496,14 @@ void SvxFillToolBoxControl::Update() } aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END; - std::unique_ptr<XBitmapEntry> pEntry(new XBitmapEntry(mpBitmapItem->GetGraphicObject(), aTmpStr)); XBitmapListRef xBitmapList = XPropertyList::AsBitmapList( XPropertyList::CreatePropertyList( XBITMAP_LIST, "TmpList", ""/*TODO?*/)); - xBitmapList->Insert( pEntry.get() ); + xBitmapList->Insert(o3tl::make_unique<XBitmapEntry>(mpBitmapItem->GetGraphicObject(), aTmpStr)); xBitmapList->SetDirty( false ); mpLbFillAttr->Fill( xBitmapList ); mpLbFillAttr->SelectEntryPos(mpLbFillAttr->GetEntryCount() - 1); - xBitmapList->Remove( 0 ); } } diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 54c8a686e69e..9f9b34a37218 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -35,6 +35,7 @@ #include <svx/dialmgr.hxx> #include <svx/unoapi.hxx> #include <memory> +#include <o3tl/make_unique.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -316,13 +317,13 @@ IMPL_LINK_NOARG_TYPED(SvxLineEndWindow, SelectHdl, ValueSet*, void) } else if( nId % 2 ) // beginning of line { - XLineEndEntry* pEntry = pLineEndList->GetLineEnd( ( nId - 1 ) / 2 - 1 ); - pLineStartItem.reset(new XLineStartItem( pEntry->GetName(), pEntry->GetLineEnd() )); + const XLineEndEntry* pEntry = pLineEndList->GetLineEnd( (nId - 1) / 2 - 1 ); + pLineStartItem.reset(new XLineStartItem(pEntry->GetName(), pEntry->GetLineEnd())); } else // end of line { - XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nId / 2 - 2 ); - pLineEndItem.reset(new XLineEndItem( pEntry->GetName(), pEntry->GetLineEnd() )); + const XLineEndEntry* pEntry = pLineEndList->GetLineEnd( (nId - 1) / 2 ); + pLineEndItem.reset(new XLineEndItem(pEntry->GetName(), pEntry->GetLineEnd())); } if ( IsInPopupMode() ) @@ -359,7 +360,6 @@ void SvxLineEndWindow::FillValueSet() { if( pLineEndList.is() ) { - XLineEndEntry* pEntry = nullptr; ScopedVclPtrInstance< VirtualDevice > pVD; long nCount = pLineEndList->Count(); @@ -367,8 +367,8 @@ void SvxLineEndWindow::FillValueSet() // First entry: no line end. // An entry is temporarly added to get the UI bitmap basegfx::B2DPolyPolygon aNothing; - pLineEndList->Insert( new XLineEndEntry( aNothing, SVX_RESSTR( RID_SVXSTR_NONE ) ) ); - pEntry = pLineEndList->GetLineEnd( nCount ); + pLineEndList->Insert(o3tl::make_unique<XLineEndEntry>(aNothing, SVX_RESSTR(RID_SVXSTR_NONE))); + const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nCount); Bitmap aBmp = pLineEndList->GetUiBitmap( nCount ); OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" ); @@ -382,7 +382,7 @@ void SvxLineEndWindow::FillValueSet() aLineEndSet->InsertItem(1, Image(pVD->GetBitmap(aPt0, aBmpSize)), pEntry->GetName()); aLineEndSet->InsertItem(2, Image(pVD->GetBitmap(aPt1, aBmpSize)), pEntry->GetName()); - delete pLineEndList->Remove( nCount ); + pLineEndList->Remove(nCount); for( long i = 0; i < nCount; i++ ) { |