summaryrefslogtreecommitdiff
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
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>
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx2
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.cxx6
-rw-r--r--cui/source/options/optchart.cxx4
-rw-r--r--cui/source/tabpages/border.cxx2
-rw-r--r--cui/source/tabpages/chardlg.cxx2
-rw-r--r--cui/source/tabpages/numpages.cxx2
-rw-r--r--cui/source/tabpages/tparea.cxx4
-rw-r--r--cui/source/tabpages/tpbitmap.cxx10
-rw-r--r--cui/source/tabpages/tpcolor.cxx2
-rw-r--r--cui/source/tabpages/tpgradnt.cxx14
-rw-r--r--cui/source/tabpages/tphatch.cxx13
-rw-r--r--cui/source/tabpages/tpline.cxx4
-rw-r--r--cui/source/tabpages/tplnedef.cxx17
-rw-r--r--cui/source/tabpages/tplneend.cxx26
-rw-r--r--cui/source/tabpages/tppattern.cxx22
-rw-r--r--extensions/source/propctrlr/standardcontrol.cxx2
-rw-r--r--include/svx/xtable.hxx42
-rw-r--r--reportdesign/source/ui/dlg/Condition.cxx2
-rw-r--r--sc/source/ui/condformat/colorformat.cxx2
-rw-r--r--sc/source/ui/condformat/condformatdlgentry.cxx4
-rw-r--r--sc/source/ui/dbgui/scendlg.cxx2
-rw-r--r--sc/source/ui/optdlg/opredlin.cxx2
-rw-r--r--sc/source/ui/optdlg/tpview.cxx2
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.cxx4
-rw-r--r--sd/source/ui/func/fuconrec.cxx2
-rw-r--r--sd/source/ui/func/fulinend.cxx4
-rw-r--r--sd/source/ui/view/drviews9.cxx27
-rw-r--r--svx/source/dialog/dlgctrl.cxx22
-rw-r--r--svx/source/sidebar/area/AreaPropertyPanelBase.cxx5
-rw-r--r--svx/source/sidebar/line/LinePropertyPanelBase.cxx10
-rw-r--r--svx/source/tbxctrls/SvxPresetListBox.cxx2
-rw-r--r--svx/source/tbxctrls/fillctrl.cxx21
-rw-r--r--svx/source/tbxctrls/linectrl.cxx16
-rw-r--r--svx/source/unodraw/XPropertyTable.cxx82
-rw-r--r--svx/source/unodraw/unoctabl.cxx11
-rw-r--r--svx/source/unodraw/unoshape.cxx10
-rw-r--r--svx/source/xoutdev/xattr.cxx14
-rw-r--r--svx/source/xoutdev/xtabbtmp.cxx5
-rw-r--r--svx/source/xoutdev/xtabcolr.cxx80
-rw-r--r--svx/source/xoutdev/xtabdash.cxx16
-rw-r--r--svx/source/xoutdev/xtabgrdt.cxx22
-rw-r--r--svx/source/xoutdev/xtabhtch.cxx16
-rw-r--r--svx/source/xoutdev/xtable.cxx78
-rw-r--r--svx/source/xoutdev/xtablend.cxx12
-rw-r--r--svx/source/xoutdev/xtabptrn.cxx15
-rw-r--r--sw/source/ui/config/optpage.cxx2
-rw-r--r--sw/source/ui/frmdlg/column.cxx2
-rw-r--r--sw/source/ui/misc/pgfnote.cxx2
-rw-r--r--sw/source/ui/misc/pggrid.cxx2
49 files changed, 311 insertions, 359 deletions
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index 41b0f8993147..fc6e3bb2e123 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -97,7 +97,7 @@ bool DrawCommandDispatch::isFeatureSupported( const OUString& rCommandURL )
long nCount = pLineEndList->Count();
for ( long nIndex = 0; nIndex < nCount; ++nIndex )
{
- XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nIndex );
+ const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nIndex);
if ( pEntry->GetName() == aName )
{
aReturn = pEntry->GetLineEnd();
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 85c9ec26f79c..d8612e542ba2 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -107,7 +107,7 @@ XGradient getXGradientForName(const css::uno::Reference<css::frame::XModel>& xMo
size_t n = aRef->Count();
for (size_t i = 0; i < n; ++i)
{
- XGradientEntry* pGradient = aRef->GetGradient(i);
+ const XGradientEntry* pGradient = aRef->GetGradient(i);
if (!pGradient)
continue;
@@ -155,7 +155,7 @@ XHatch getXHatchFromName(const css::uno::Reference<css::frame::XModel>& xModel,
size_t n = aRef->Count();
for (size_t i = 0; i < n; ++i)
{
- XHatchEntry* pHatch = aRef->GetHatch(i);
+ const XHatchEntry* pHatch = aRef->GetHatch(i);
if (!pHatch)
continue;
@@ -185,7 +185,7 @@ GraphicObject getXBitmapFromName(const css::uno::Reference<css::frame::XModel>&
size_t n = aRef->Count();
for (size_t i = 0; i < n; ++i)
{
- XBitmapEntry* pBitmap = aRef->GetBitmap(i);
+ const XBitmapEntry* pBitmap = aRef->GetBitmap(i);
if (!pBitmap)
continue;
diff --git a/cui/source/options/optchart.cxx b/cui/source/options/optchart.cxx
index 38a9d4704ece..7c668a36aaf4 100644
--- a/cui/source/options/optchart.cxx
+++ b/cui/source/options/optchart.cxx
@@ -149,7 +149,7 @@ void SvxDefaultColorOptPage::FillColorBox()
for( long i = 0; i < nCount; i++ )
{
- XColorEntry* pColorEntry = pColorList->GetColor( i );
+ const XColorEntry* pColorEntry = pColorList->GetColor(i);
m_pValSetColorBox->InsertItem( i + 1, pColorEntry->GetColor(), pColorEntry->GetName() );
}
}
@@ -163,7 +163,7 @@ long SvxDefaultColorOptPage::GetColorIndex( const Color& rCol )
for( long i = nCount - 1; i >= 0; i-- ) // default chart colors are at the end of the table
{
- XColorEntry* pColorEntry = pColorList->GetColor( i );
+ const XColorEntry* pColorEntry = pColorList->GetColor(i);
if( pColorEntry && pColorEntry->GetColor() == rCol )
return pColorList->GetIndex( pColorEntry->GetName() );
}
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 067a26a3207b..c07f7dd9b43b 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -317,7 +317,7 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore
for ( long i = 0; i < pColorTable->Count(); ++i )
{
- XColorEntry* pEntry = pColorTable->GetColor(i);
+ const XColorEntry* pEntry = pColorTable->GetColor(i);
m_pLbLineColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
m_pLbLineColor->SetUpdateMode( true );
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 3ee76c571dae..2684039e004e 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -1463,7 +1463,7 @@ void SvxCharEffectsPage::Initialize()
}
for ( long i = 0; i < pColorTable->Count(); i++ )
{
- XColorEntry* pEntry = pColorTable->GetColor(i);
+ const XColorEntry* pEntry = pColorTable->GetColor(i);
m_pUnderlineColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
m_pOverlineColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
m_pFontColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index e3795cd3ee40..42e26ef732bc 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1402,7 +1402,7 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet )
for ( long i = 0; i < pColorTable->Count(); i++ )
{
- XColorEntry* pEntry = pColorTable->GetColor(i);
+ const XColorEntry* pEntry = pColorTable->GetColor(i);
m_pBulColLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
}
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index 67af95dccb37..1673ae32a891 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -774,7 +774,7 @@ IMPL_LINK_NOARG_TYPED(SvxAreaTabPage, ModifyGradientHdl_Impl, ListBox&, void)
if( _nPos != LISTBOX_ENTRY_NOTFOUND )
{
// fill ItemSet and pass it on to aCtlXRectPreview
- XGradientEntry* pEntry = m_pGradientList->GetGradient( _nPos );
+ const XGradientEntry* pEntry = m_pGradientList->GetGradient(_nPos);
m_rXFSet.Put( XFillStyleItem( drawing::FillStyle_GRADIENT ) );
m_rXFSet.Put( XFillGradientItem( OUString(), pEntry->GetGradient() ) );
@@ -820,7 +820,7 @@ IMPL_LINK_NOARG_TYPED(SvxAreaTabPage, ModifyHatchingHdl_Impl, ListBox&, void)
if( _nPos != LISTBOX_ENTRY_NOTFOUND )
{
// fill ItemSet and pass it on to aCtlXRectPreview
- XHatchEntry* pEntry = m_pHatchingList->GetHatch( _nPos );
+ const XHatchEntry* pEntry = m_pHatchingList->GetHatch(_nPos);
m_rXFSet.Put( XFillStyleItem( drawing::FillStyle_HATCH ) );
m_rXFSet.Put( XFillHatchItem( OUString(), pEntry->GetHatch() ) );
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 09012bb26914..2e8705534d91 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -41,6 +41,8 @@
#include <vcl/layout.hxx>
#include <svx/svxdlg.hxx>
+#include <o3tl/make_unique.hxx>
+
using namespace com::sun::star;
SvxBitmapTabPage::SvxBitmapTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) :
@@ -143,7 +145,7 @@ bool SvxBitmapTabPage::FillItemSet( SfxItemSet* rAttrs )
size_t nPos = m_pBitmapLB->GetSelectItemPos();
if(VALUESET_ITEM_NOTFOUND != nPos)
{
- const XBitmapEntry* pXBitmapEntry = m_pBitmapList->GetBitmap( static_cast<sal_uInt16>(nPos) );
+ const XBitmapEntry* pXBitmapEntry = m_pBitmapList->GetBitmap(nPos);
const OUString aString(m_pBitmapLB->GetItemText( m_pBitmapLB->GetSelectItemId() ));
rAttrs->Put(XFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject()));
bModified = true;
@@ -252,8 +254,7 @@ IMPL_LINK_NOARG_TYPED(SvxBitmapTabPage, ClickRenameHdl, SvxPresetListBox*, void)
if(bValidBitmapName)
{
bLoop = false;
- XBitmapEntry* pEntry = m_pBitmapList->GetBitmap( static_cast<sal_uInt16>(nPos) );
- pEntry->SetName( aName );
+ m_pBitmapList->GetBitmap(nPos)->SetName(aName);
m_pBitmapLB->SetItemText(nId, aName);
m_pBitmapLB->SelectItem( nId );
@@ -354,8 +355,7 @@ IMPL_LINK_NOARG_TYPED(SvxBitmapTabPage, ClickImportHdl, Button*, void)
if( !nError )
{
- XBitmapEntry* pEntry = new XBitmapEntry( aGraphic, aName );
- m_pBitmapList->Insert( pEntry, nCount );
+ m_pBitmapList->Insert(o3tl::make_unique<XBitmapEntry>(aGraphic, aName), nCount);
sal_Int32 nId = m_pBitmapLB->GetItemId( nCount - 1 );
Bitmap aBitmap = m_pBitmapList->GetBitmapForPreview( nCount, m_pBitmapLB->GetIconSize() );
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 4c70df8e38ae..634f2f782a15 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -271,7 +271,7 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& )
if( *pPageType == PT_COLOR && *pPos != LISTBOX_ENTRY_NOTFOUND )
{
m_pValSetColorList->SelectItem( m_pValSetColorList->GetItemId( static_cast<size_t>(*pPos) ) );
- XColorEntry* pEntry = pColorList->GetColor( *pPos );
+ const XColorEntry* pEntry = pColorList->GetColor(*pPos);
aPreviousColor = pEntry->GetColor();
ChangeColor(pEntry->GetColor());
}
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index d993c3ef5d7a..0125b0fb1ea2 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -41,6 +41,8 @@
#include <svx/dialogs.hrc>
#include "paragrph.hrc"
+#include <o3tl/make_unique.hxx>
+
#define DEFAULT_GRADIENTSTEP 64
using namespace com::sun::star;
@@ -511,9 +513,8 @@ IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickAddHdl_Impl, Button*, void)
(sal_uInt16) m_pMtrBorder->GetValue(),
(sal_uInt16) m_pMtrColorFrom->GetValue(),
(sal_uInt16) m_pMtrColorTo->GetValue() );
- XGradientEntry* pEntry = new XGradientEntry( aXGradient, aName );
- m_pGradientList->Insert( pEntry, nCount );
+ m_pGradientList->Insert(o3tl::make_unique<XGradientEntry>(aXGradient, aName), nCount);
sal_Int32 nId = m_pGradientLB->GetItemId(nCount - 1); //calculate the last ID
Bitmap aBitmap = m_pGradientList->GetBitmapForPreview( nCount, m_pGradientLB->GetIconSize() );
@@ -551,9 +552,7 @@ IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickModifyHdl_Impl, Button*, void)
(sal_uInt16) m_pMtrColorFrom->GetValue(),
(sal_uInt16) m_pMtrColorTo->GetValue() );
- XGradientEntry* pEntry = new XGradientEntry( aXGradient, aName );
-
- delete m_pGradientList->Replace( pEntry, static_cast<sal_uInt16>(nPos) );
+ m_pGradientList->Replace(o3tl::make_unique<XGradientEntry>(aXGradient, aName), nPos);
Bitmap aBitmap = m_pGradientList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), m_pGradientLB->GetIconSize() );
m_pGradientLB->RemoveItem( nId );
@@ -575,7 +574,7 @@ IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*
if ( aQueryBox->Execute() == RET_YES )
{
- delete m_pGradientList->Remove( static_cast<sal_uInt16>(nPos) );
+ m_pGradientList->Remove(nPos);
m_pGradientLB->RemoveItem( nId );
nId = m_pGradientLB->GetItemId( 0 );
m_pGradientLB->SelectItem( nId );
@@ -618,8 +617,7 @@ IMPL_LINK_NOARG_TYPED(SvxGradientTabPage, ClickRenameHdl_Impl, SvxPresetListBox*
if( bValidGradientName )
{
bLoop = false;
- XGradientEntry* pEntry = m_pGradientList->GetGradient( static_cast<sal_uInt16>(nPos) );
- pEntry->SetName( aName );
+ m_pGradientList->GetGradient(nPos)->SetName(aName);
m_pGradientLB->SetItemText( nId, aName );
m_pGradientLB->SelectItem( nId );
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index f46eaad5aacb..7082fedf80e4 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -43,6 +43,7 @@
#include "paragrph.hrc"
#include <svx/dialogs.hrc>
+#include <o3tl/make_unique.hxx>
using namespace com::sun::star;
@@ -573,9 +574,8 @@ IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickAddHdl_Impl, Button*, void)
(css::drawing::HatchStyle) m_pLbLineType->GetSelectEntryPos(),
GetCoreValue( *m_pMtrDistance, m_ePoolUnit ),
static_cast<long>(m_pMtrAngle->GetValue() * 10) );
- XHatchEntry* pEntry = new XHatchEntry( aXHatch, aName );
- m_pHatchingList->Insert( pEntry, nCount );
+ m_pHatchingList->Insert(o3tl::make_unique<XHatchEntry>(aXHatch, aName), nCount);
sal_Int32 nId = m_pHatchLB->GetItemId(nCount - 1); // calculate the last ID
Bitmap aBitmap = m_pHatchingList->GetBitmapForPreview( nCount, m_pHatchLB->GetIconSize() );
@@ -604,9 +604,7 @@ IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickModifyHdl_Impl, Button*, void)
GetCoreValue( *m_pMtrDistance, m_ePoolUnit ),
static_cast<long>(m_pMtrAngle->GetValue() * 10) );
- XHatchEntry* pEntry = new XHatchEntry( aXHatch, aName );
-
- delete m_pHatchingList->Replace( pEntry, static_cast<sal_uInt16>(nPos) );
+ m_pHatchingList->Replace(o3tl::make_unique<XHatchEntry>(aXHatch, aName), nPos);
Bitmap aBitmap = m_pHatchingList->GetBitmapForPreview( static_cast<sal_uInt16>(nPos), m_pHatchLB->GetIconSize() );
m_pHatchLB->RemoveItem( nId );
@@ -635,7 +633,7 @@ IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*, v
if( aQueryBox->Execute() == RET_YES )
{
- m_pHatchingList->Remove( static_cast<sal_uInt16>(nPos) );
+ m_pHatchingList->Remove(nPos);
m_pHatchLB->RemoveItem( nId );
nId = m_pHatchLB->GetItemId(0);
m_pHatchLB->SelectItem( nId );
@@ -675,8 +673,7 @@ IMPL_LINK_NOARG_TYPED(SvxHatchTabPage, ClickRenameHdl_Impl, SvxPresetListBox*, v
if(bValidHatchName)
{
bLoop = false;
- XHatchEntry* pEntry = m_pHatchingList->GetHatch( static_cast<sal_uInt16>(nPos) );
- pEntry->SetName( aName );
+ m_pHatchingList->GetHatch(nPos)->SetName(aName);
m_pHatchLB->SetItemText(nId, aName);
m_pHatchLB->SelectItem( nId );
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 99417a40dd9a..f3cfa0389441 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -1292,7 +1292,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
for(sal_Int32 a(0);!bSelected && a < m_pLineEndList->Count(); a++)
{
- XLineEndEntry* pEntry = m_pLineEndList->GetLineEnd(a);
+ const XLineEndEntry* pEntry = m_pLineEndList->GetLineEnd(a);
const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
if(rItemPolygon == rEntryPolygon)
@@ -1324,7 +1324,7 @@ void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
for(sal_Int32 a(0);!bSelected && a < m_pLineEndList->Count(); a++)
{
- XLineEndEntry* pEntry = m_pLineEndList->GetLineEnd(a);
+ const XLineEndEntry* pEntry = m_pLineEndList->GetLineEnd(a);
const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
if(rItemPolygon == rEntryPolygon)
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index d689690cbf5b..701a43fd49ef 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -42,6 +42,7 @@
#include "svx/dlgutil.hxx"
#include <svx/dialmgr.hxx>
#include <svx/dialogs.hrc>
+#include <o3tl/make_unique.hxx>
#define XOUT_WIDTH 150
@@ -535,7 +536,6 @@ IMPL_LINK_NOARG_TYPED(SvxLineDefTabPage, ClickAddHdl_Impl, Button*, void)
OUString aNewName( SVX_RES( RID_SVXSTR_LINESTYLE ) );
OUString aDesc( ResId( RID_SVXSTR_DESC_LINESTYLE, rMgr ) );
OUString aName;
- XDashEntry* pEntry;
long nCount = pDashList->Count();
long j = 1;
@@ -573,12 +573,9 @@ IMPL_LINK_NOARG_TYPED(SvxLineDefTabPage, ClickAddHdl_Impl, Button*, void)
bLoop = false;
FillDash_Impl();
- pEntry = new XDashEntry( aDash, aName );
-
long nDashCount = pDashList->Count();
- pDashList->Insert( pEntry, nDashCount );
- const Bitmap aBitmap = pDashList->GetUiBitmap( nDashCount );
- m_pLbLineStyles->Append( *pEntry, pDashList->GetUiBitmap( nDashCount ) );
+ pDashList->Insert( o3tl::make_unique<XDashEntry>(aDash, aName), nDashCount );
+ m_pLbLineStyles->Append( *pDashList->GetDash(nDashCount), pDashList->GetUiBitmap(nDashCount) );
m_pLbLineStyles->SelectEntryPos( m_pLbLineStyles->GetEntryCount() - 1 );
@@ -651,10 +648,8 @@ IMPL_LINK_NOARG_TYPED(SvxLineDefTabPage, ClickModifyHdl_Impl, Button*, void)
bLoop = false;
FillDash_Impl();
- XDashEntry* pEntry = new XDashEntry( aDash, aName );
-
- delete pDashList->Replace( pEntry, nPos );
- m_pLbLineStyles->Modify( *pEntry, nPos, pDashList->GetUiBitmap( nPos ) );
+ pDashList->Replace(o3tl::make_unique<XDashEntry>(aDash, aName), nPos);
+ m_pLbLineStyles->Modify(*pDashList->GetDash(nPos), nPos, pDashList->GetUiBitmap(nPos));
m_pLbLineStyles->SelectEntryPos( nPos );
@@ -695,7 +690,7 @@ IMPL_LINK_NOARG_TYPED(SvxLineDefTabPage, ClickDeleteHdl_Impl, Button*, void)
if ( aQueryBox->Execute() == RET_YES )
{
- delete pDashList->Remove( nPos );
+ pDashList->Remove(nPos);
m_pLbLineStyles->RemoveEntry( nPos );
m_pLbLineStyles->SelectEntryPos( 0 );
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 );
diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx
index 10fcf5d6e86d..92a0edfb96f8 100644
--- a/cui/source/tabpages/tppattern.cxx
+++ b/cui/source/tabpages/tppattern.cxx
@@ -47,6 +47,8 @@
#include "sfx2/opengrf.hxx"
#include "paragrph.hrc"
+#include <o3tl/make_unique.hxx>
+
using namespace com::sun::star;
/*************************************************************************
@@ -523,12 +525,12 @@ IMPL_LINK_NOARG_TYPED(SvxPatternTabPage, ClickAddHdl_Impl, Button*, void)
if( !nError )
{
- XBitmapEntry* pEntry = nullptr;
+ std::unique_ptr<XBitmapEntry> pEntry;
if( m_pCtlPixel->IsEnabled() )
{
const BitmapEx aBitmapEx(m_pBitmapCtl->GetBitmapEx());
- pEntry = new XBitmapEntry(Graphic(aBitmapEx), aName);
+ pEntry.reset(new XBitmapEntry(Graphic(aBitmapEx), aName));
}
else // it must be a not existing imported bitmap
{
@@ -536,15 +538,15 @@ IMPL_LINK_NOARG_TYPED(SvxPatternTabPage, ClickAddHdl_Impl, Button*, void)
if(SfxItemState::SET == m_rOutAttrs.GetItemState(XATTR_FILLBITMAP, true, &pPoolItem))
{
- pEntry = new XBitmapEntry(dynamic_cast< const XFillBitmapItem* >(pPoolItem)->GetGraphicObject(), aName);
+ pEntry.reset(new XBitmapEntry(dynamic_cast<const XFillBitmapItem*>(pPoolItem)->GetGraphicObject(), aName));
}
+ else
+ assert("SvxPatternTabPage::ClickAddHdl_Impl(), XBitmapEntry* pEntry == nullptr ?");
}
- assert( pEntry && "SvxPatternTabPage::ClickAddHdl_Impl(), pEntry == 0 ?" );
-
if( pEntry )
{
- m_pPatternList->Insert( pEntry, nCount );
+ m_pPatternList->Insert(std::move(pEntry), nCount);
sal_Int32 nId = m_pPatternLB->GetItemId( nCount - 1 );
Bitmap aBitmap = m_pPatternList->GetBitmapForPreview( nCount, m_pPatternLB->GetIconSize() );
m_pPatternLB->InsertItem( nId + 1, Image(aBitmap), aName );
@@ -581,8 +583,7 @@ IMPL_LINK_NOARG_TYPED(SvxPatternTabPage, ClickModifyHdl_Impl, Button*, void)
const BitmapEx aBitmapEx(m_pBitmapCtl->GetBitmapEx());
// #i123497# Need to replace the existing entry with a new one (old returned needs to be deleted)
- XBitmapEntry* pEntry = new XBitmapEntry(Graphic(aBitmapEx), aName);
- delete m_pPatternList->Replace(pEntry, nPos);
+ m_pPatternList->Replace(o3tl::make_unique<XBitmapEntry>(Graphic(aBitmapEx), aName), nPos);
Bitmap aBitmap = m_pPatternList->GetBitmapForPreview( static_cast<sal_uInt16>( nPos ), m_pPatternLB->GetIconSize() );
m_pPatternLB->RemoveItem(nId);
@@ -632,8 +633,7 @@ IMPL_LINK_NOARG_TYPED(SvxPatternTabPage, ClickRenameHdl_Impl, SvxPresetListBox*,
{
bLoop = false;
- XBitmapEntry* pEntry = m_pPatternList->GetBitmap( static_cast<sal_uInt16>(nPos) );
- pEntry->SetName( aName );
+ m_pPatternList->GetBitmap(nPos)->SetName(aName);
m_pPatternLB->SetItemText( nId, aName );
m_pPatternLB->SelectItem( nId );
@@ -666,7 +666,7 @@ IMPL_LINK_NOARG_TYPED(SvxPatternTabPage, ClickDeleteHdl_Impl, SvxPresetListBox*,
if( aQueryBox->Execute() == RET_YES )
{
- delete m_pPatternList->Remove( static_cast<sal_uInt16>(nPos) );
+ m_pPatternList->Remove(nPos);
m_pPatternLB->RemoveItem( nId );
nId = m_pPatternLB->GetItemId(0);
m_pPatternLB->SelectItem( nId );
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index 325dba0e46fb..5aa8a4ff9104 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -681,7 +681,7 @@ namespace pcr
{
for (long i = 0; i < pColorList->Count(); ++i)
{
- XColorEntry* pEntry = pColorList->GetColor( i );
+ const XColorEntry* pEntry = pColorList->GetColor(i);
getTypedControlWindow()->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
}
diff --git a/include/svx/xtable.hxx b/include/svx/xtable.hxx
index c55827e97cb0..021627167449 100644
--- a/include/svx/xtable.hxx
+++ b/include/svx/xtable.hxx
@@ -41,6 +41,7 @@
#include <svx/XPropertyEntry.hxx>
#include <limits>
+#include <memory>
class Color;
class Bitmap;
@@ -172,7 +173,7 @@ class SVX_DLLPUBLIC XPropertyList : public cppu::OWeakObject
protected:
SAL_DLLPRIVATE void operator delete(void *);
protected:
- typedef ::std::vector< XPropertyEntry* > XPropertyEntryList_impl;
+ typedef std::vector< std::unique_ptr<XPropertyEntry> > XPropertyEntryList_impl;
XPropertyListType meType;
OUString maName; // not persistent
@@ -185,18 +186,20 @@ protected:
bool mbEmbedInDocument;
XPropertyList(XPropertyListType t, const OUString& rPath, const OUString& rReferer);
-
+ bool isValidIdx(long nIndex) const;
virtual Bitmap CreateBitmapForUI(long nIndex) = 0;
public:
+ XPropertyList(const XPropertyList&) = delete;
+ XPropertyList& operator=(const XPropertyList&) = delete;
virtual ~XPropertyList();
XPropertyListType Type() const { return meType; }
long Count() const;
- void Insert(XPropertyEntry* pEntry, long nIndex = ::std::numeric_limits<long>::max());
- XPropertyEntry* Replace(XPropertyEntry* pEntry, long nIndex);
- XPropertyEntry* Remove(long nIndex);
+ void Insert(std::unique_ptr<XPropertyEntry> pEntry, long nIndex = std::numeric_limits<long>::max());
+ void Replace(std::unique_ptr<XPropertyEntry> pEntry, long nIndex);
+ void Remove(long nIndex);
XPropertyEntry* Get(long nIndex) const;
long GetIndex(const OUString& rName) const;
@@ -264,11 +267,7 @@ public:
XColorList(const OUString& rPath, const OUString& rReferer)
: XPropertyList(XCOLOR_LIST, rPath, rReferer) {}
- using XPropertyList::Replace;
- using XPropertyList::Remove;
-
- XColorEntry* Replace(long nIndex, XColorEntry* pEntry);
- XColorEntry* Remove(long nIndex);
+ void Replace(long nIndex, std::unique_ptr<XColorEntry> pEntry);
XColorEntry* GetColor(long nIndex) const;
virtual css::uno::Reference< css::container::XNameContainer > createInstance() override;
virtual bool Create() override;
@@ -286,8 +285,6 @@ public:
XLineEndList(const OUString& rPath, const OUString& rReferer);
virtual ~XLineEndList();
- using XPropertyList::Remove;
- XLineEndEntry* Remove(long nIndex);
XLineEndEntry* GetLineEnd(long nIndex) const;
virtual css::uno::Reference< css::container::XNameContainer > createInstance() override;
@@ -309,10 +306,7 @@ public:
XDashList(const OUString& rPath, const OUString& rReferer);
virtual ~XDashList();
- using XPropertyList::Replace;
- XDashEntry* Replace(XDashEntry* pEntry, long nIndex);
- using XPropertyList::Remove;
- XDashEntry* Remove(long nIndex);
+ void Replace(std::unique_ptr<XDashEntry> pEntry, long nIndex);
XDashEntry* GetDash(long nIndex) const;
virtual css::uno::Reference< css::container::XNameContainer > createInstance() override;
@@ -339,10 +333,7 @@ public:
XHatchList(const OUString& rPath, const OUString& rReferer);
virtual ~XHatchList();
- using XPropertyList::Replace;
- XHatchEntry* Replace(XHatchEntry* pEntry, long nIndex);
- using XPropertyList::Remove;
- XHatchEntry* Remove(long nIndex);
+ void Replace(std::unique_ptr<XHatchEntry> pEntry, long nIndex);
XHatchEntry* GetHatch(long nIndex) const;
Bitmap GetBitmapForPreview(long nIndex, const Size& rSize);
@@ -362,10 +353,7 @@ public:
XGradientList(const OUString& rPath, const OUString& rReferer);
virtual ~XGradientList();
- using XPropertyList::Replace;
- XGradientEntry* Replace(XGradientEntry* pEntry, long nIndex);
- using XPropertyList::Remove;
- XGradientEntry* Remove(long nIndex);
+ void Replace(std::unique_ptr<XGradientEntry> pEntry, long nIndex);
XGradientEntry* GetGradient(long nIndex) const;
Bitmap GetBitmapForPreview(long nIndex, const Size& rSize);
@@ -385,9 +373,6 @@ public:
XBitmapList(const OUString& rPath, const OUString& rReferer)
: XPropertyList(XBITMAP_LIST, rPath, rReferer) {}
- using XPropertyList::Replace;
- using XPropertyList::Remove;
- XBitmapEntry* Remove(long nIndex);
XBitmapEntry* GetBitmap(long nIndex) const;
Bitmap GetBitmapForPreview(long nIndex, const Size& rSize);
@@ -407,9 +392,6 @@ public:
XPatternList(const OUString& rPath, const OUString& rReferer)
: XPropertyList(XPATTERN_LIST, rPath, rReferer) {}
- using XPropertyList::Replace;
- using XPropertyList::Remove;
- XBitmapEntry* Remove(long nIndex);
XBitmapEntry* GetBitmap(long nIndex) const;
Bitmap GetBitmapForPreview(long nIndex, const Size& rSize);
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index 36cf30541c67..bae1c457cb92 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -132,7 +132,7 @@ OColorPopup::OColorPopup(vcl::Window* _pParent,Condition* _pCondition)
for ( i = 0; i < nCount; i++ )
{
- XColorEntry* pEntry = pColorList->GetColor(i);
+ const XColorEntry* pEntry = pColorList->GetColor(i);
m_aColorSet->InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() );
}
diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx
index f6e3cce92ffc..9a455b4bb122 100644
--- a/sc/source/ui/condformat/colorformat.cxx
+++ b/sc/source/ui/condformat/colorformat.cxx
@@ -180,7 +180,7 @@ void ScDataBarSettingsDlg::Init()
for ( long i = 0; i < pColorTable->Count(); ++i )
{
- XColorEntry* pEntry = pColorTable->GetColor(i);
+ const XColorEntry* pEntry = pColorTable->GetColor(i);
mpLbPos->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
mpLbNeg->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
mpLbAxisCol->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 3e3d7f18215f..9cb3e1436f8c 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -810,7 +810,7 @@ void ScColorScale2FrmtEntry::Init()
for ( long i = 0; i < pColorTable->Count(); ++i )
{
- XColorEntry* pEntry = pColorTable->GetColor(i);
+ const XColorEntry* pEntry = pColorTable->GetColor(i);
maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
@@ -991,7 +991,7 @@ void ScColorScale3FrmtEntry::Init()
for ( long i = 0; i < pColorTable->Count(); ++i )
{
- XColorEntry* pEntry = pColorTable->GetColor(i);
+ const XColorEntry* pEntry = pColorTable->GetColor(i);
maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
maLbColMiddle->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx
index 5cefb49045a1..e775aa9e5ffa 100644
--- a/sc/source/ui/dbgui/scendlg.cxx
+++ b/sc/source/ui/dbgui/scendlg.cxx
@@ -71,7 +71,7 @@ ScNewScenarioDlg::ScNewScenarioDlg( vcl::Window* pParent, const OUString& rName,
long nCount = pColorList->Count();
for ( long n=0; n<nCount; n++ )
{
- XColorEntry* pEntry = pColorList->GetColor(n);
+ const XColorEntry* pEntry = pColorList->GetColor(n);
m_pLbColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
m_pLbColor->SetUpdateMode( true );
diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx
index 5322adf821b5..f8fb21682a47 100644
--- a/sc/source/ui/optdlg/opredlin.cxx
+++ b/sc/source/ui/optdlg/opredlin.cxx
@@ -146,7 +146,7 @@ void ScRedlineOptionsTabPage::Reset( const SfxItemSet* /* rSet */ )
XColorListRef xColorLst = XColorList::GetStdColorList();
for( long i = 0; i < xColorLst->Count(); ++i )
{
- XColorEntry* pEntry = xColorLst->GetColor( i );
+ const XColorEntry* pEntry = xColorLst->GetColor(i);
Color aColor = pEntry->GetColor();
OUString sName = pEntry->GetName();
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx
index 99b4fe7e9f85..4b4aa46f6ba1 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -328,7 +328,7 @@ void ScTpContentOptions::InitGridOpt()
long nCount = pColorList->Count();
for ( long n=0; n<nCount; n++ )
{
- XColorEntry* pEntry = pColorList->GetColor(n);
+ const XColorEntry* pEntry = pColorList->GetColor(n);
pColorLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index a02af081e527..18c409531440 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -220,7 +220,7 @@ ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent
for ( long i = 0; i < pColorList->Count(); i++ )
{
- XColorEntry* pEntry = pColorList->GetColor(i);
+ const XColorEntry* pEntry = pColorList->GetColor(i);
sal_Int32 nPos = mpControl->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
if( pEntry->GetColor().GetRGBColor() == (sal_uInt32)nColor )
mpControl->SelectEntryPos( nPos );
@@ -1093,7 +1093,7 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent
for ( long i = 0; i < pColorList->Count(); i++ )
{
- XColorEntry* pEntry = pColorList->GetColor(i);
+ const XColorEntry* pEntry = pColorList->GetColor(i);
mpCLBDimColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx
index d7fe22933962..74be18f01548 100644
--- a/sd/source/ui/func/fuconrec.cxx
+++ b/sd/source/ui/func/fuconrec.cxx
@@ -511,7 +511,7 @@ void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj)
long nIndex;
for( nIndex = 0L; nIndex < nCount; nIndex++ )
{
- XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nIndex);
+ const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nIndex);
if( pEntry->GetName() == aArrowName )
{
aRetval = pEntry->GetLineEnd();
diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx
index a92a97c65f44..6025641dfd48 100644
--- a/sd/source/ui/func/fulinend.cxx
+++ b/sd/source/ui/func/fulinend.cxx
@@ -33,6 +33,7 @@
#include "View.hxx"
#include "Window.hxx"
#include <memory>
+#include <o3tl/make_unique.hxx>
namespace sd {
@@ -132,8 +133,7 @@ void FuLineEnd::DoExecute( SfxRequest& )
if( bDifferent )
{
- XLineEndEntry* pEntry = new XLineEndEntry( aPolyPolygon, aName );
- pLineEndList->Insert( pEntry);
+ pLineEndList->Insert(o3tl::make_unique<XLineEndEntry>(aPolyPolygon, aName));
}
else
{
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index 2e0b5dbb7a6b..6b3b0606b5ca 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -61,6 +61,7 @@
#include <com/sun/star/gallery/GalleryItemType.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <memory>
+#include <o3tl/make_unique.hxx>
using namespace com::sun::star;
@@ -347,7 +348,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
for ( i = 0; i < nCounts; i ++)
{
- XGradientEntry *pEntry = pGradientList->GetGradient (i);
+ const XGradientEntry* pEntry = pGradientList->GetGradient(i);
if (pEntry->GetName () == pName->GetValue ())
{
@@ -376,7 +377,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
? aColor
: aBlack);
- GetDoc()->GetGradientList ()->Insert (new XGradientEntry (aGradient, pName->GetValue ()));
+ GetDoc()->GetGradientList()->Insert(o3tl::make_unique<XGradientEntry>(aGradient, pName->GetValue()));
XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
aStyleItem.SetWhich(XATTR_FILLSTYLE);
@@ -418,7 +419,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
for ( i = 0; i < nCounts; i ++)
{
- XHatchEntry *pEntry = pHatchList->GetHatch (i);
+ const XHatchEntry* pEntry = pHatchList->GetHatch(i);
if (pEntry->GetName () == pName->GetValue ())
{
@@ -440,7 +441,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
{
XHatch aHatch (aColor);
- GetDoc()->GetHatchList ()->Insert (new XHatchEntry (aHatch, pName->GetValue ()));
+ GetDoc()->GetHatchList()->Insert(o3tl::make_unique<XHatchEntry>(aHatch, pName->GetValue()));
XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
aStyleItem.SetWhich(XATTR_FILLSTYLE);
@@ -484,7 +485,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
XDashListRef pDashList = GetDoc()->GetDashList();
long nCounts = pDashList->Count ();
- XDashEntry *pEntry = new XDashEntry (aNewDash, pName->GetValue ());
+ std::unique_ptr<XDashEntry> pEntry = o3tl::make_unique<XDashEntry>(aNewDash, pName->GetValue());
long i;
for ( i = 0; i < nCounts; i++ )
@@ -492,9 +493,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
break;
if (i < nCounts)
- pDashList->Replace (pEntry, i);
+ pDashList->Replace(std::move(pEntry), i);
else
- pDashList->Insert (pEntry);
+ pDashList->Insert(std::move(pEntry));
XLineDashItem aDashItem(pName->GetValue(), aNewDash);
aDashItem.SetWhich(XATTR_LINEDASH);
@@ -546,7 +547,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
for ( i = 0; i < nCounts; i++ )
{
- XGradientEntry *pEntry = pGradientList->GetGradient (i);
+ const XGradientEntry* pEntry = pGradientList->GetGradient(i);
if (pEntry->GetName () == pName->GetValue ())
{
@@ -578,7 +579,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
(short) pCenterY->GetValue (), (short) pBorder->GetValue (),
(short) pStart->GetValue (), (short) pEnd->GetValue ());
- pGradientList->Insert (new XGradientEntry (aGradient, pName->GetValue ()));
+ pGradientList->Insert(o3tl::make_unique<XGradientEntry>(aGradient, pName->GetValue()));
XFillStyleItem aStyleItem(drawing::FillStyle_GRADIENT);
aStyleItem.SetWhich(XATTR_FILLSTYLE);
pAttr->Put(aStyleItem);
@@ -624,7 +625,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
for ( i = 0; i < nCounts; i++ )
{
- XHatchEntry *pEntry = pHatchList->GetHatch (i);
+ const XHatchEntry* pEntry = pHatchList->GetHatch(i);
if (pEntry->GetName () == pName->GetValue ())
{
@@ -650,7 +651,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
XHatch aHatch (aBlack, (css::drawing::HatchStyle) pStyle->GetValue (), pDistance->GetValue (),
pAngle->GetValue () * 10);
- pHatchList->Insert (new XHatchEntry (aHatch, pName->GetValue ()));
+ pHatchList->Insert(o3tl::make_unique<XHatchEntry>(aHatch, pName->GetValue()));
XFillStyleItem aStyleItem(drawing::FillStyle_HATCH);
aStyleItem.SetWhich(XATTR_FILLSTYLE);
pAttr->Put(aStyleItem);
@@ -685,7 +686,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
i < nCounts;
i ++)
{
- XGradientEntry *pEntry = pGradientList->GetGradient (i);
+ const XGradientEntry* pEntry = pGradientList->GetGradient(i);
if (pEntry->GetName () == pName->GetValue ())
{
@@ -725,7 +726,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq)
i < nCounts;
i ++)
{
- XHatchEntry *pEntry = pHatchList->GetHatch (i);
+ const XHatchEntry* pEntry = pHatchList->GetHatch(i);
if (pEntry->GetName () == pName->GetValue ())
{
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index a864a0a93cc2..17934ed34fde 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1129,7 +1129,7 @@ void ColorLB::Fill( const XColorListRef &pColorTab )
for( long i = 0; i < nCount; i++ )
{
- XColorEntry* pEntry = pColorTab->GetColor( i );
+ const XColorEntry* pEntry = pColorTab->GetColor(i);
InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
@@ -1181,7 +1181,7 @@ void HatchingLB::Fill( const XHatchListRef &pList )
for( long i = 0; i < nCount; i++ )
{
- XHatchEntry* pEntry = pList->GetHatch( i );
+ const XHatchEntry* pEntry = pList->GetHatch(i);
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
InsertEntry(pEntry->GetName(), Image(aBitmap));
@@ -1230,7 +1230,7 @@ void FillAttrLB::Fill( const XHatchListRef &pList )
for( long i = 0; i < nCount; i++ )
{
- XHatchEntry* pEntry = pList->GetHatch( i );
+ const XHatchEntry* pEntry = pList->GetHatch(i);
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
ListBox::InsertEntry(pEntry->GetName(), Image(aBitmap));
@@ -1274,7 +1274,7 @@ void GradientLB::Fill( const XGradientListRef &pList )
for( long i = 0; i < nCount; i++ )
{
- XGradientEntry* pEntry = pList->GetGradient( i );
+ const XGradientEntry* pEntry = pList->GetGradient(i);
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
InsertEntry(pEntry->GetName(), Image(aBitmap));
@@ -1318,7 +1318,7 @@ void GradientLB::SelectEntryByList( const XGradientListRef &pList, const OUStrin
const XGradient& rGradient )
{
long nCount = pList.get() ? pList->Count() : 0;
- XGradientEntry* pEntry;
+ const XGradientEntry* pEntry;
bool bFound = false;
OUString aStr;
@@ -1345,7 +1345,7 @@ void FillAttrLB::Fill( const XGradientListRef &pList )
for( long i = 0; i < nCount; i++ )
{
- XGradientEntry* pEntry = pList->GetGradient( i );
+ const XGradientEntry* pEntry = pList->GetGradient(i);
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
ListBox::InsertEntry(pEntry->GetName(), Image(aBitmap));
@@ -1438,7 +1438,7 @@ void BitmapLB::Fill( const XBitmapListRef &pList )
return;
mpList = pList;
- XBitmapEntry* pEntry;
+ const XBitmapEntry* pEntry;
const long nCount(pList->Count());
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
@@ -1498,7 +1498,7 @@ FillAttrLB::FillAttrLB(vcl::Window* pParent, WinBits aWB)
void FillAttrLB::Fill( const XBitmapListRef &pList )
{
const long nCount(pList->Count());
- XBitmapEntry* pEntry;
+ const XBitmapEntry* pEntry;
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
@@ -1519,7 +1519,7 @@ void FillAttrLB::Fill( const XBitmapListRef &pList )
void FillAttrLB::Fill( const XPatternListRef &pList )
{
const long nCount(pList->Count());
- XBitmapEntry* pEntry;
+ const XBitmapEntry* pEntry;
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
@@ -1607,7 +1607,7 @@ void LineLB::Fill( const XDashListRef &pList )
for( long i = 0; i < nCount; i++ )
{
- XDashEntry* pEntry = pList->GetDash( i );
+ const XDashEntry* pEntry = pList->GetDash(i);
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
{
@@ -1682,7 +1682,7 @@ void LineEndLB::Fill( const XLineEndListRef &pList, bool bStart )
for( long i = 0; i < nCount; i++ )
{
- XLineEndEntry* pEntry = pList->GetLineEnd( i );
+ const XLineEndEntry* pEntry = pList->GetLineEnd(i);
const Bitmap aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
{
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index 46aa13e15b5a..a96ea76afc36 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -42,6 +42,8 @@
#include <svx/tbcontrl.hxx>
#include "sfx2/opengrf.hxx"
+#include <o3tl/make_unique.hxx>
+
using namespace css;
using namespace css::uno;
@@ -233,8 +235,7 @@ IMPL_LINK_NOARG_TYPED(AreaPropertyPanelBase, ClickImportBitmapHdl, Button*, void
}
}
- XBitmapEntry* pEntry = new XBitmapEntry( aGraphic, aName );
- pList->Insert(pEntry);
+ pList->Insert(o3tl::make_unique<XBitmapEntry>(aGraphic, aName));
pList->Save();
mpLbFillAttr->Clear();
mpLbFillAttr->Fill(pList);
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index 906a4128e458..b433529ac16d 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -69,7 +69,7 @@ void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLin
for(sal_uInt32 i(0); i < nCount; i++)
{
- XLineEndEntry* pEntry = rList.GetLineEnd(i);
+ const XLineEndEntry* pEntry = rList.GetLineEnd(i);
const Bitmap aBitmap = const_cast< XLineEndList& >(rList).GetUiBitmap(i);
if(!aBitmap.IsEmpty())
@@ -140,7 +140,7 @@ void FillLineStyleListBox(ListBox& rListBox, const XDashList& rList)
for(sal_uInt32 i(0); i < nCount; i++)
{
- XDashEntry* pEntry = rList.GetDash(i);
+ const XDashEntry* pEntry = rList.GetDash(i);
const Bitmap aBitmap = const_cast< XDashList& >(rList).GetUiBitmap(i);
if(!aBitmap.IsEmpty())
@@ -812,7 +812,7 @@ void LinePropertyPanelBase::SelectLineStyle()
const XDash& rDash = mpDashItem->GetDashValue();
for(sal_Int32 a(0);!bSelected && a < mxLineStyleList->Count(); a++)
{
- XDashEntry* pEntry = mxLineStyleList->GetDash(a);
+ const XDashEntry* pEntry = mxLineStyleList->GetDash(a);
const XDash& rEntry = pEntry->GetDash();
if(rDash == rEntry)
{
@@ -848,7 +848,7 @@ void LinePropertyPanelBase::SelectEndStyle(bool bStart)
const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue();
for(sal_Int32 a(0);!bSelected && a < mxLineEndList->Count(); a++)
{
- XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a);
+ const XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a);
const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
if(rItemPolygon == rEntryPolygon)
{
@@ -877,7 +877,7 @@ void LinePropertyPanelBase::SelectEndStyle(bool bStart)
const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue();
for(sal_Int32 a(0);!bSelected && a < mxLineEndList->Count(); a++)
{
- XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a);
+ const XLineEndEntry* pEntry = mxLineEndList->GetLineEnd(a);
const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
if(rItemPolygon == rEntryPolygon)
{
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++ )
{
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index d1016614b92b..031063730b58 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <o3tl/any.hxx>
+#include <o3tl/make_unique.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
@@ -48,14 +49,14 @@ private:
sal_Int16 mnWhich;
long getCount() const { return mpList ? mpList->Count() : 0; }
- XPropertyEntry* get( long index ) const;
+ const XPropertyEntry* get(long index) const;
public:
SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw();
virtual ~SvxUnoXPropertyTable() throw();
virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw(uno::RuntimeException) = 0;
- virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw(uno::RuntimeException, lang::IllegalArgumentException) = 0;
+ virtual std::unique_ptr<XPropertyEntry> createEntry(const OUString& rName, const uno::Any& rAny) const throw(uno::RuntimeException, lang::IllegalArgumentException) = 0;
// XServiceInfo
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( uno::RuntimeException, std::exception) override;
@@ -85,7 +86,7 @@ SvxUnoXPropertyTable::~SvxUnoXPropertyTable() throw()
{
}
-XPropertyEntry* SvxUnoXPropertyTable::get( long index ) const
+const XPropertyEntry* SvxUnoXPropertyTable::get(long index) const
{
if( mpList )
return mpList->Get(index);
@@ -114,12 +115,11 @@ void SAL_CALL SvxUnoXPropertyTable::insertByName( const OUString& aName, const
OUString aInternalName = SvxUnogetInternalNameForItem(mnWhich, aName);
- XPropertyEntry* pNewEntry = getEntry( aInternalName, aElement );
- if( nullptr == pNewEntry )
+ std::unique_ptr<XPropertyEntry> pNewEntry(createEntry(aInternalName, aElement));
+ if (!pNewEntry)
throw lang::IllegalArgumentException();
- if( mpList )
- mpList->Insert( pNewEntry );
+ mpList->Insert(std::move(pNewEntry));
}
void SAL_CALL SvxUnoXPropertyTable::removeByName( const OUString& Name )
@@ -133,11 +133,10 @@ void SAL_CALL SvxUnoXPropertyTable::removeByName( const OUString& Name )
long i;
for( i = 0; i < nCount; i++ )
{
- XPropertyEntry* pEntry = get( i );
+ const XPropertyEntry* pEntry = get(i);
if (pEntry && aInternalName.equals(pEntry->GetName()))
{
- if( mpList )
- delete mpList->Remove( i );
+ mpList->Remove(i);
return;
}
}
@@ -157,15 +156,14 @@ void SAL_CALL SvxUnoXPropertyTable::replaceByName( const OUString& aName, const
long i;
for( i = 0; i < nCount; i++ )
{
- XPropertyEntry* pEntry = get( i );
+ const XPropertyEntry* pEntry = get(i);
if (pEntry && aInternalName.equals(pEntry->GetName()))
{
- XPropertyEntry* pNewEntry = getEntry( aInternalName, aElement );
- if( nullptr == pNewEntry )
+ std::unique_ptr<XPropertyEntry> pNewEntry(createEntry(aInternalName, aElement));
+ if (!pNewEntry)
throw lang::IllegalArgumentException();
- if( mpList )
- delete mpList->Replace( pNewEntry, i );
+ mpList->Replace(std::move(pNewEntry), i);
return;
}
}
@@ -185,7 +183,7 @@ uno::Any SAL_CALL SvxUnoXPropertyTable::getByName( const OUString& aName )
long i;
for( i = 0; i < nCount; i++ )
{
- XPropertyEntry* pEntry = get( i );
+ const XPropertyEntry* pEntry = get(i);
if (pEntry && aInternalName.equals(pEntry->GetName()))
return getAny( pEntry );
@@ -205,7 +203,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXPropertyTable::getElementNames()
long i;
for( i = 0; i < nCount; i++ )
{
- XPropertyEntry* pEntry = get( i );
+ const XPropertyEntry* pEntry = get(i);
if (pEntry)
*pNames++ = SvxUnogetApiNameForItem(mnWhich, pEntry->GetName());
@@ -225,7 +223,7 @@ sal_Bool SAL_CALL SvxUnoXPropertyTable::hasByName( const OUString& aName )
long i;
for( i = 0; i < nCount; i++ )
{
- XPropertyEntry* pEntry = get( i );
+ const XPropertyEntry* pEntry = get(i);
if (pEntry && aInternalName.equals(pEntry->GetName()))
return true;
}
@@ -250,7 +248,7 @@ public:
// SvxUnoXPropertyTable
virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw() override;
- virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw() override;
+ virtual std::unique_ptr<XPropertyEntry> createEntry(const OUString& rName, const uno::Any& rAny) const throw() override;
// XElementAccess
virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException, std::exception ) override;
@@ -271,14 +269,14 @@ uno::Any SvxUnoXColorTable::getAny( const XPropertyEntry* pEntry ) const throw()
return uno::Any( (sal_Int32)static_cast<const XColorEntry*>(pEntry)->GetColor().GetColor() );
}
-XPropertyEntry* SvxUnoXColorTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
+std::unique_ptr<XPropertyEntry> SvxUnoXColorTable::createEntry(const OUString& rName, const uno::Any& rAny) const throw()
{
sal_Int32 nColor = 0;
if( !(rAny >>= nColor) )
- return nullptr;
+ return std::unique_ptr<XPropertyEntry>();
const Color aColor( (ColorData)nColor );
- return new XColorEntry( aColor, rName );
+ return o3tl::make_unique<XColorEntry>(aColor, rName);
}
// XElementAccess
@@ -309,7 +307,7 @@ public:
// SvxUnoXPropertyTable
virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw() override;
- virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw(lang::IllegalArgumentException) override;
+ virtual std::unique_ptr<XPropertyEntry> createEntry(const OUString& rName, const uno::Any& rAny) const throw(lang::IllegalArgumentException) override;
// XElementAccess
virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException, std::exception ) override;
@@ -333,11 +331,11 @@ uno::Any SvxUnoXLineEndTable::getAny( const XPropertyEntry* pEntry ) const throw
return uno::Any(aBezier);
}
-XPropertyEntry* SvxUnoXLineEndTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw(lang::IllegalArgumentException)
+std::unique_ptr<XPropertyEntry> SvxUnoXLineEndTable::createEntry(const OUString& rName, const uno::Any& rAny) const throw(lang::IllegalArgumentException)
{
auto pCoords = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rAny);
if( !pCoords )
- return nullptr;
+ return std::unique_ptr<XLineEndEntry>();
basegfx::B2DPolyPolygon aPolyPolygon;
if( pCoords->Coordinates.getLength() > 0 )
@@ -346,7 +344,7 @@ XPropertyEntry* SvxUnoXLineEndTable::getEntry( const OUString& rName, const uno:
// #86265# make sure polygon is closed
aPolyPolygon.setClosed(true);
- return new XLineEndEntry( aPolyPolygon, rName );
+ return o3tl::make_unique<XLineEndEntry>(aPolyPolygon, rName);
}
// XElementAccess
@@ -377,7 +375,7 @@ public:
// SvxUnoXPropertyTable
virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw() override;
- virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw() override;
+ virtual std::unique_ptr<XPropertyEntry> createEntry(const OUString& rName, const uno::Any& rAny) const throw() override;
// XElementAccess
virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException, std::exception ) override;
@@ -409,11 +407,11 @@ uno::Any SvxUnoXDashTable::getAny( const XPropertyEntry* pEntry ) const throw()
return uno::Any(aLineDash);
}
-XPropertyEntry* SvxUnoXDashTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
+std::unique_ptr<XPropertyEntry> SvxUnoXDashTable::createEntry(const OUString& rName, const uno::Any& rAny) const throw()
{
drawing::LineDash aLineDash;
if(!(rAny >>= aLineDash))
- return nullptr;
+ return std::unique_ptr<XDashEntry>();
XDash aXDash;
@@ -424,7 +422,7 @@ XPropertyEntry* SvxUnoXDashTable::getEntry( const OUString& rName, const uno::An
aXDash.SetDashLen(aLineDash.DashLen);
aXDash.SetDistance(aLineDash.Distance);
- return new XDashEntry( aXDash, rName );
+ return o3tl::make_unique<XDashEntry>(aXDash, rName);
}
// XElementAccess
@@ -455,7 +453,7 @@ public:
// SvxUnoXPropertyTable
virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw() override;
- virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw() override;
+ virtual std::unique_ptr<XPropertyEntry> createEntry(const OUString& rName, const uno::Any& rAny) const throw() override;
// XElementAccess
virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException, std::exception ) override;
@@ -485,11 +483,11 @@ uno::Any SvxUnoXHatchTable::getAny( const XPropertyEntry* pEntry ) const throw()
return uno::Any(aUnoHatch);
}
-XPropertyEntry* SvxUnoXHatchTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
+std::unique_ptr<XPropertyEntry> SvxUnoXHatchTable::createEntry(const OUString& rName, const uno::Any& rAny) const throw()
{
drawing::Hatch aUnoHatch;
if(!(rAny >>= aUnoHatch))
- return nullptr;
+ return std::unique_ptr<XHatchEntry>();
XHatch aXHatch;
aXHatch.SetHatchStyle( (css::drawing::HatchStyle)aUnoHatch.Style );
@@ -497,7 +495,7 @@ XPropertyEntry* SvxUnoXHatchTable::getEntry( const OUString& rName, const uno::A
aXHatch.SetDistance( aUnoHatch.Distance );
aXHatch.SetAngle( aUnoHatch.Angle );
- return new XHatchEntry( aXHatch, rName );
+ return o3tl::make_unique<XHatchEntry>(aXHatch, rName);
}
// XElementAccess
@@ -528,7 +526,7 @@ public:
// SvxUnoXPropertyTable
virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw() override;
- virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw() override;
+ virtual std::unique_ptr<XPropertyEntry> createEntry(const OUString& rName, const uno::Any& rAny) const throw() override;
// XElementAccess
virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException, std::exception ) override;
@@ -563,11 +561,11 @@ uno::Any SvxUnoXGradientTable::getAny( const XPropertyEntry* pEntry ) const thro
return uno::Any(aGradient);
}
-XPropertyEntry* SvxUnoXGradientTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw()
+std::unique_ptr<XPropertyEntry> SvxUnoXGradientTable::createEntry(const OUString& rName, const uno::Any& rAny) const throw()
{
awt::Gradient aGradient;
if(!(rAny >>= aGradient))
- return nullptr;
+ return std::unique_ptr<XPropertyEntry>();
XGradient aXGradient;
@@ -582,7 +580,7 @@ XPropertyEntry* SvxUnoXGradientTable::getEntry( const OUString& rName, const uno
aXGradient.SetEndIntens( aGradient.EndIntensity );
aXGradient.SetSteps( aGradient.StepCount );
- return new XGradientEntry( aXGradient, rName );
+ return o3tl::make_unique<XGradientEntry>(aXGradient, rName);
}
// XElementAccess
@@ -613,7 +611,7 @@ public:
// SvxUnoXPropertyTable
virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw(uno::RuntimeException) override;
- virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw(uno::RuntimeException) override;
+ virtual std::unique_ptr<XPropertyEntry> createEntry(const OUString& rName, const uno::Any& rAny) const throw(uno::RuntimeException) override;
// XElementAccess
virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException, std::exception ) override;
@@ -638,15 +636,15 @@ uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const throw(
return uno::Any(aURL);
}
-XPropertyEntry* SvxUnoXBitmapTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw(uno::RuntimeException)
+std::unique_ptr<XPropertyEntry> SvxUnoXBitmapTable::createEntry(const OUString& rName, const uno::Any& rAny) const throw(uno::RuntimeException)
{
OUString aURL;
if(!(rAny >>= aURL))
- return nullptr;
+ return std::unique_ptr<XPropertyEntry>();
const GraphicObject aGrafObj(GraphicObject::CreateGraphicObjectFromURL(aURL));
- return new XBitmapEntry(aGrafObj, rName);
+ return o3tl::make_unique<XBitmapEntry>(aGrafObj, rName);
}
// XElementAccess
diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx
index bda46f67def5..55f01081a6fe 100644
--- a/svx/source/unodraw/unoctabl.cxx
+++ b/svx/source/unodraw/unoctabl.cxx
@@ -25,6 +25,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <rtl/ref.hxx>
#include <svx/xtable.hxx>
+#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star;
@@ -99,8 +100,7 @@ void SAL_CALL SvxUnoColorTable::insertByName( const OUString& aName, const uno::
if( pList.is() )
{
- XColorEntry* pEntry = new XColorEntry( Color( (ColorData)nColor ), aName );
- pList->Insert( pEntry, pList->Count() );
+ pList->Insert(o3tl::make_unique<XColorEntry>(Color((ColorData)nColor), aName));
}
}
@@ -126,8 +126,7 @@ void SAL_CALL SvxUnoColorTable::replaceByName( const OUString& aName, const uno:
if( nIndex == -1 )
throw container::NoSuchElementException();
- XColorEntry* pEntry = new XColorEntry( Color( (ColorData)nColor ), aName );
- delete pList->Replace( nIndex, pEntry );
+ pList->Replace(nIndex, o3tl::make_unique<XColorEntry>(Color((ColorData)nColor), aName ));
}
// XNameAccess
@@ -138,7 +137,7 @@ uno::Any SAL_CALL SvxUnoColorTable::getByName( const OUString& aName )
if( nIndex == -1 )
throw container::NoSuchElementException();
- XColorEntry* pEntry = pList->GetColor( nIndex );
+ const XColorEntry* pEntry = pList->GetColor(nIndex);
return uno::Any( (sal_Int32) pEntry->GetColor().GetRGBColor() );
}
@@ -152,7 +151,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getElementNames()
for( long nIndex = 0; nIndex < nCount; nIndex++ )
{
- XColorEntry* pEntry = pList->GetColor( (long)nIndex );
+ const XColorEntry* pEntry = pList->GetColor(nIndex);
pStrings[nIndex] = pEntry->GetName();
}
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 8f04d60ed142..a239ee34bc68 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1436,7 +1436,7 @@ bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName,
if( nPos == -1 )
return false;
- XBitmapEntry* pEntry = pBitmapList->GetBitmap( nPos );
+ const XBitmapEntry* pEntry = pBitmapList->GetBitmap(nPos);
XFillBitmapItem aBmpItem;
aBmpItem.SetWhich( XATTR_FILLBITMAP );
aBmpItem.SetName( rName );
@@ -1455,7 +1455,7 @@ bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName,
if( nPos == -1 )
return false;
- XGradientEntry* pEntry = pGradientList->GetGradient( nPos );
+ const XGradientEntry* pEntry = pGradientList->GetGradient(nPos);
XFillGradientItem aGrdItem;
aGrdItem.SetWhich( XATTR_FILLGRADIENT );
aGrdItem.SetName( rName );
@@ -1474,7 +1474,7 @@ bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName,
if( nPos == -1 )
return false;
- XHatchEntry* pEntry = pHatchList->GetHatch( nPos );
+ const XHatchEntry* pEntry = pHatchList->GetHatch( nPos );
XFillHatchItem aHatchItem;
aHatchItem.SetWhich( XATTR_FILLHATCH );
aHatchItem.SetName( rName );
@@ -1494,7 +1494,7 @@ bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName,
if( nPos == -1 )
return false;
- XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
+ const XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nPos);
if( XATTR_LINEEND == nWID )
{
XLineEndItem aLEItem;
@@ -1525,7 +1525,7 @@ bool SAL_CALL SvxShape::SetFillAttribute( sal_Int32 nWID, const OUString& rName,
if( nPos == -1 )
return false;
- XDashEntry* pEntry = pDashList->GetDash( nPos );
+ const XDashEntry* pEntry = pDashList->GetDash(nPos);
XLineDashItem aDashItem;
aDashItem.SetWhich( XATTR_LINEDASH );
aDashItem.SetName( rName );
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index d0c445b348c3..c0884bd9c6b2 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -178,7 +178,7 @@ OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_u
int nIndex;
for( nIndex = 0; nIndex < nCount; nIndex++ )
{
- XPropertyEntry* pEntry = pDefaults->Get(nIndex);
+ const XPropertyEntry* pEntry = pDefaults->Get(nIndex);
if( pEntry )
{
bool bFound = false;
@@ -188,25 +188,25 @@ OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_u
case XATTR_FILLBITMAP:
{
const GraphicObject& rGraphicObjectA(static_cast<const XFillBitmapItem*>(pCheckItem)->GetGraphicObject());
- const GraphicObject& rGraphicObjectB(static_cast<XBitmapEntry*>(pEntry)->GetGraphicObject());
+ const GraphicObject& rGraphicObjectB(static_cast<const XBitmapEntry*>(pEntry)->GetGraphicObject());
bFound = (rGraphicObjectA == rGraphicObjectB);
break;
}
case XATTR_LINEDASH:
- bFound = static_cast<const XLineDashItem*>(pCheckItem)->GetDashValue() == static_cast<XDashEntry*>(pEntry)->GetDash();
+ bFound = static_cast<const XLineDashItem*>(pCheckItem)->GetDashValue() == static_cast<const XDashEntry*>(pEntry)->GetDash();
break;
case XATTR_LINESTART:
- bFound = static_cast<const XLineStartItem*>(pCheckItem)->GetLineStartValue() == static_cast<XLineEndEntry*>(pEntry)->GetLineEnd();
+ bFound = static_cast<const XLineStartItem*>(pCheckItem)->GetLineStartValue() == static_cast<const XLineEndEntry*>(pEntry)->GetLineEnd();
break;
case XATTR_LINEEND:
- bFound = static_cast<const XLineEndItem*>(pCheckItem)->GetLineEndValue() == static_cast<XLineEndEntry*>(pEntry)->GetLineEnd();
+ bFound = static_cast<const XLineEndItem*>(pCheckItem)->GetLineEndValue() == static_cast<const XLineEndEntry*>(pEntry)->GetLineEnd();
break;
case XATTR_FILLGRADIENT:
- bFound = static_cast<const XFillGradientItem*>(pCheckItem)->GetGradientValue() == static_cast<XGradientEntry*>(pEntry)->GetGradient();
+ bFound = static_cast<const XFillGradientItem*>(pCheckItem)->GetGradientValue() == static_cast<const XGradientEntry*>(pEntry)->GetGradient();
break;
case XATTR_FILLHATCH:
- bFound = static_cast<const XFillHatchItem*>(pCheckItem)->GetHatchValue() == static_cast<XHatchEntry*>(pEntry)->GetHatch();
+ bFound = static_cast<const XFillHatchItem*>(pCheckItem)->GetHatchValue() == static_cast<const XHatchEntry*>(pEntry)->GetHatch();
break;
}
diff --git a/svx/source/xoutdev/xtabbtmp.cxx b/svx/source/xoutdev/xtabbtmp.cxx
index e0a280a14e7a..856d52a0f406 100644
--- a/svx/source/xoutdev/xtabbtmp.cxx
+++ b/svx/source/xoutdev/xtabbtmp.cxx
@@ -33,11 +33,6 @@
using namespace com::sun::star;
-XBitmapEntry* XBitmapList::Remove(long nIndex)
-{
- return static_cast<XBitmapEntry*>( XPropertyList::Remove(nIndex) );
-}
-
XBitmapEntry* XBitmapList::GetBitmap(long nIndex) const
{
return static_cast<XBitmapEntry*>( XPropertyList::Get(nIndex) );
diff --git a/svx/source/xoutdev/xtabcolr.cxx b/svx/source/xoutdev/xtabcolr.cxx
index c0d911bdefe0..3d16c4d26440 100644
--- a/svx/source/xoutdev/xtabcolr.cxx
+++ b/svx/source/xoutdev/xtabcolr.cxx
@@ -25,6 +25,8 @@
#include <svx/xtable.hxx>
#include <svx/xpool.hxx>
+#include <o3tl/make_unique.hxx>
+
using namespace com::sun::star;
XColorListRef XColorList::CreateStdColorList()
@@ -40,16 +42,10 @@ XColorListRef XColorList::GetStdColorList()
return aTable;
}
-XColorEntry* XColorList::Replace(long nIndex, XColorEntry* pEntry )
+void XColorList::Replace(long nIndex, std::unique_ptr<XColorEntry> pEntry)
{
- return static_cast<XColorEntry*>(XPropertyList::Replace( pEntry, nIndex ));
+ XPropertyList::Replace(std::move(pEntry), nIndex);
}
-
-XColorEntry* XColorList::Remove(long nIndex)
-{
- return static_cast<XColorEntry*>(XPropertyList::Remove(nIndex));
-}
-
XColorEntry* XColorList::GetColor(long nIndex) const
{
return static_cast<XColorEntry*>( XPropertyList::Get(nIndex) );
@@ -70,18 +66,18 @@ bool XColorList::Create()
// <!-- Gray palette from white to black -->
const OUString aStrGrey( SVX_RESSTR( RID_SVXSTR_COLOR_GREY ) );
- Insert( new XColorEntry( Color( 0xff, 0xff, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_WHITE ) ) );
- Insert( new XColorEntry( Color( 0xee, 0xee, 0xee ), aStrGrey + " 1" ) );
- Insert( new XColorEntry( Color( 0xdd, 0xdd, 0xdd ), aStrGrey + " 2" ) );
- Insert( new XColorEntry( Color( 0xcc, 0xcc, 0xcc ), aStrGrey + " 3" ) );
- Insert( new XColorEntry( Color( 0xb2, 0xb2, 0xb2 ), aStrGrey + " 4" ) );
- Insert( new XColorEntry( Color( 0x99, 0x99, 0x99 ), aStrGrey + " 5" ) );
- Insert( new XColorEntry( Color( 0x80, 0x80, 0x80 ), aStrGrey + " 6" ) );
- Insert( new XColorEntry( Color( 0x66, 0x66, 0x66 ), aStrGrey + " 7" ) );
- Insert( new XColorEntry( Color( 0x33, 0x33, 0x33 ), aStrGrey + " 8" ) );
- Insert( new XColorEntry( Color( 0x1c, 0x1c, 0x1c ), aStrGrey + " 9" ) );
- Insert( new XColorEntry( Color( 0x11, 0x11, 0x11 ), aStrGrey + " 10") );
- Insert( new XColorEntry( Color( 0x00, 0x00, 0x00 ), SVX_RESSTR( RID_SVXSTR_COLOR_BLACK ) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xff, 0xff, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_WHITE ) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xee, 0xee, 0xee ), aStrGrey + " 1" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xdd, 0xdd, 0xdd ), aStrGrey + " 2" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xcc, 0xcc, 0xcc ), aStrGrey + " 3" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xb2, 0xb2, 0xb2 ), aStrGrey + " 4" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x99, 0x99, 0x99 ), aStrGrey + " 5" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x80, 0x80, 0x80 ), aStrGrey + " 6" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x66, 0x66, 0x66 ), aStrGrey + " 7" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x33, 0x33, 0x33 ), aStrGrey + " 8" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x1c, 0x1c, 0x1c ), aStrGrey + " 9" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x11, 0x11, 0x11 ), aStrGrey + " 10") );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x00, 0x00, 0x00 ), SVX_RESSTR( RID_SVXSTR_COLOR_BLACK ) ) );
// <!-- Base colors step 0 to 10 -->
const sal_uInt32 nNumColorsInGroup(12);
@@ -121,37 +117,37 @@ bool XColorList::Create()
for(b = 0; b < nNumColorsInGroup; b++)
{
- Insert( new XColorEntry( aStdCol[nOffset + b], aStrCol[b] + aSuffix ) );
+ Insert( o3tl::make_unique<XColorEntry>( aStdCol[nOffset + b], aStrCol[b] + aSuffix ) );
}
}
// <!-- use some 'nice' colors from original palette -->
- Insert( new XColorEntry( Color( 0xe6, 0xe6, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_BLUEGREY) ) );
- Insert( new XColorEntry( Color( 0xCF, 0xE7, 0xF5 ), SVX_RESSTR( RID_SVXSTR_COLOR_BLUE_CLASSIC ) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xe6, 0xe6, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_BLUEGREY) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xCF, 0xE7, 0xF5 ), SVX_RESSTR( RID_SVXSTR_COLOR_BLUE_CLASSIC ) ) );
// <!-- add 'pale' colors from original palette -->
- Insert( new XColorEntry( Color( 0x99, 0x99, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_VIOLET ) ) );
- Insert( new XColorEntry( Color( 0x99, 0x33, 0x66 ), SVX_RESSTR( RID_SVXSTR_COLOR_BORDEAUX ) ) );
- Insert( new XColorEntry( Color( 0xff, 0xff, 0xcc ), SVX_RESSTR( RID_SVXSTR_COLOR_PALE_YELLOW ) ) );
- Insert( new XColorEntry( Color( 0xcc, 0xff, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_PALE_GREEN ) ) );
- Insert( new XColorEntry( Color( 0x66, 0x00, 0x66 ), SVX_RESSTR( RID_SVXSTR_COLOR_DARKVIOLET ) ) );
- Insert( new XColorEntry( Color( 0xff, 0x80, 0x80 ), SVX_RESSTR( RID_SVXSTR_COLOR_SALMON ) ) );
- Insert( new XColorEntry( Color( 0x00, 0x66, 0xcc ), SVX_RESSTR( RID_SVXSTR_COLOR_SEABLUE ) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x99, 0x99, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_VIOLET ) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x99, 0x33, 0x66 ), SVX_RESSTR( RID_SVXSTR_COLOR_BORDEAUX ) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xff, 0xff, 0xcc ), SVX_RESSTR( RID_SVXSTR_COLOR_PALE_YELLOW ) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xcc, 0xff, 0xff ), SVX_RESSTR( RID_SVXSTR_COLOR_PALE_GREEN ) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x66, 0x00, 0x66 ), SVX_RESSTR( RID_SVXSTR_COLOR_DARKVIOLET ) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xff, 0x80, 0x80 ), SVX_RESSTR( RID_SVXSTR_COLOR_SALMON ) ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x00, 0x66, 0xcc ), SVX_RESSTR( RID_SVXSTR_COLOR_SEABLUE ) ) );
// <!-- add Chart colors from original palette (also 12, coincidence?) -->
const OUString aStrChart( SVX_RESSTR( RID_SVXSTR_COLOR_CHART ) );
- Insert( new XColorEntry( Color( 0x00, 0x45, 0x86 ), aStrChart + " 1" ) );
- Insert( new XColorEntry( Color( 0xff, 0x42, 0x0e ), aStrChart + " 2" ) );
- Insert( new XColorEntry( Color( 0xff, 0xd3, 0x20 ), aStrChart + " 3" ) );
- Insert( new XColorEntry( Color( 0x57, 0x9d, 0x1c ), aStrChart + " 4" ) );
- Insert( new XColorEntry( Color( 0x7e, 0x00, 0x21 ), aStrChart + " 5" ) );
- Insert( new XColorEntry( Color( 0x83, 0xca, 0xff ), aStrChart + " 6" ) );
- Insert( new XColorEntry( Color( 0x31, 0x40, 0x04 ), aStrChart + " 7" ) );
- Insert( new XColorEntry( Color( 0xae, 0xcf, 0x00 ), aStrChart + " 8" ) );
- Insert( new XColorEntry( Color( 0x4b, 0x1f, 0x6f ), aStrChart + " 9" ) );
- Insert( new XColorEntry( Color( 0xff, 0x95, 0x0e ), aStrChart + " 10" ) );
- Insert( new XColorEntry( Color( 0xc5, 0x00, 0x0b ), aStrChart + " 11" ) );
- Insert( new XColorEntry( Color( 0x00, 0x84, 0xd1 ), aStrChart + " 12" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x00, 0x45, 0x86 ), aStrChart + " 1" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xff, 0x42, 0x0e ), aStrChart + " 2" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xff, 0xd3, 0x20 ), aStrChart + " 3" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x57, 0x9d, 0x1c ), aStrChart + " 4" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x7e, 0x00, 0x21 ), aStrChart + " 5" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x83, 0xca, 0xff ), aStrChart + " 6" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x31, 0x40, 0x04 ), aStrChart + " 7" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xae, 0xcf, 0x00 ), aStrChart + " 8" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x4b, 0x1f, 0x6f ), aStrChart + " 9" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xff, 0x95, 0x0e ), aStrChart + " 10" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0xc5, 0x00, 0x0b ), aStrChart + " 11" ) );
+ Insert( o3tl::make_unique<XColorEntry>( Color( 0x00, 0x84, 0xd1 ), aStrChart + " 12" ) );
return(165 == Count());
}
diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx
index 1dee829d276a..817f115563a8 100644
--- a/svx/source/xoutdev/xtabdash.cxx
+++ b/svx/source/xoutdev/xtabdash.cxx
@@ -32,6 +32,7 @@
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <memory>
+#include <o3tl/make_unique.hxx>
using namespace com::sun::star;
@@ -47,14 +48,9 @@ XDashList::~XDashList()
{
}
-XDashEntry* XDashList::Replace(XDashEntry* pEntry, long nIndex )
+void XDashList::Replace(std::unique_ptr<XDashEntry> pEntry, long nIndex)
{
- return static_cast<XDashEntry*>( XPropertyList::Replace(pEntry, nIndex) );
-}
-
-XDashEntry* XDashList::Remove(long nIndex)
-{
- return static_cast<XDashEntry*>( XPropertyList::Remove(nIndex) );
+ XPropertyList::Replace(std::move(pEntry), nIndex);
}
XDashEntry* XDashList::GetDash(long nIndex) const
@@ -72,9 +68,9 @@ bool XDashList::Create()
{
const OUString aStr(SVX_RESSTR(RID_SVXSTR_LINESTYLE));
- Insert(new XDashEntry(XDash(css::drawing::DashStyle_RECT,1, 50,1, 50, 50),aStr + " 1"));
- Insert(new XDashEntry(XDash(css::drawing::DashStyle_RECT,1,500,1,500,500),aStr + " 2"));
- Insert(new XDashEntry(XDash(css::drawing::DashStyle_RECT,2, 50,3,250,120),aStr + " 3"));
+ Insert(o3tl::make_unique<XDashEntry>(XDash(css::drawing::DashStyle_RECT,1, 50,1, 50, 50),aStr + " 1"));
+ Insert(o3tl::make_unique<XDashEntry>(XDash(css::drawing::DashStyle_RECT,1,500,1,500,500),aStr + " 2"));
+ Insert(o3tl::make_unique<XDashEntry>(XDash(css::drawing::DashStyle_RECT,2, 50,3,250,120),aStr + " 3"));
return true;
}
diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx
index b8c25e2e9a7a..78c358558e27 100644
--- a/svx/source/xoutdev/xtabgrdt.cxx
+++ b/svx/source/xoutdev/xtabgrdt.cxx
@@ -33,6 +33,7 @@
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <memory>
+#include <o3tl/make_unique.hxx>
using namespace com::sun::star;
@@ -45,14 +46,9 @@ XGradientList::~XGradientList()
{
}
-XGradientEntry* XGradientList::Replace(XGradientEntry* pEntry, long nIndex )
+void XGradientList::Replace(std::unique_ptr<XGradientEntry> pEntry, long nIndex)
{
- return static_cast<XGradientEntry*>( XPropertyList::Replace( pEntry, nIndex ) );
-}
-
-XGradientEntry* XGradientList::Remove(long nIndex)
-{
- return static_cast<XGradientEntry*>( XPropertyList::Remove( nIndex ) );
+ XPropertyList::Replace(std::move(pEntry), nIndex);
}
XGradientEntry* XGradientList::GetGradient(long nIndex) const
@@ -72,17 +68,17 @@ bool XGradientList::Create()
rtl::OUStringBuffer aStr(SVX_RESSTR(RID_SVXSTR_GRADIENT));
aStr.append(" 1");
sal_Int32 nLen = aStr.getLength() - 1;
- Insert(new XGradientEntry(XGradient(RGB_Color(COL_BLACK ),RGB_Color(COL_WHITE ),css::awt::GradientStyle_LINEAR , 0,10,10, 0,100,100),aStr.toString()));
+ Insert(o3tl::make_unique<XGradientEntry>(XGradient(RGB_Color(COL_BLACK ),RGB_Color(COL_WHITE ),css::awt::GradientStyle_LINEAR , 0,10,10, 0,100,100),aStr.toString()));
aStr[nLen] = '2';
- Insert(new XGradientEntry(XGradient(RGB_Color(COL_BLUE ),RGB_Color(COL_RED ),css::awt::GradientStyle_AXIAL , 300,20,20,10,100,100),aStr.toString()));
+ Insert(o3tl::make_unique<XGradientEntry>(XGradient(RGB_Color(COL_BLUE ),RGB_Color(COL_RED ),css::awt::GradientStyle_AXIAL , 300,20,20,10,100,100),aStr.toString()));
aStr[nLen] = '3';
- Insert(new XGradientEntry(XGradient(RGB_Color(COL_RED ),RGB_Color(COL_YELLOW ),css::awt::GradientStyle_RADIAL , 600,30,30,20,100,100),aStr.toString()));
+ Insert(o3tl::make_unique<XGradientEntry>(XGradient(RGB_Color(COL_RED ),RGB_Color(COL_YELLOW ),css::awt::GradientStyle_RADIAL , 600,30,30,20,100,100),aStr.toString()));
aStr[nLen] = '4';
- Insert(new XGradientEntry(XGradient(RGB_Color(COL_YELLOW ),RGB_Color(COL_GREEN ),css::awt::GradientStyle_ELLIPTICAL, 900,40,40,30,100,100),aStr.toString()));
+ Insert(o3tl::make_unique<XGradientEntry>(XGradient(RGB_Color(COL_YELLOW ),RGB_Color(COL_GREEN ),css::awt::GradientStyle_ELLIPTICAL, 900,40,40,30,100,100),aStr.toString()));
aStr[nLen] = '5';
- Insert(new XGradientEntry(XGradient(RGB_Color(COL_GREEN ),RGB_Color(COL_MAGENTA),css::awt::GradientStyle_SQUARE , 1200,50,50,40,100,100),aStr.toString()));
+ Insert(o3tl::make_unique<XGradientEntry>(XGradient(RGB_Color(COL_GREEN ),RGB_Color(COL_MAGENTA),css::awt::GradientStyle_SQUARE , 1200,50,50,40,100,100),aStr.toString()));
aStr[nLen] = '6';
- Insert(new XGradientEntry(XGradient(RGB_Color(COL_MAGENTA),RGB_Color(COL_YELLOW ),css::awt::GradientStyle_RECT , 1900,60,60,50,100,100),aStr.toString()));
+ Insert(o3tl::make_unique<XGradientEntry>(XGradient(RGB_Color(COL_MAGENTA),RGB_Color(COL_YELLOW ),css::awt::GradientStyle_RECT , 1900,60,60,50,100,100),aStr.toString()));
return true;
}
diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx
index 78869c87d5fa..a5227ba7b2b2 100644
--- a/svx/source/xoutdev/xtabhtch.cxx
+++ b/svx/source/xoutdev/xtabhtch.cxx
@@ -32,6 +32,7 @@
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <memory>
+#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star;
@@ -44,14 +45,9 @@ XHatchList::~XHatchList()
{
}
-XHatchEntry* XHatchList::Replace(XHatchEntry* pEntry, long nIndex )
+void XHatchList::Replace(std::unique_ptr<XHatchEntry> pEntry, long nIndex)
{
- return static_cast<XHatchEntry*>( XPropertyList::Replace(pEntry, nIndex) );
-}
-
-XHatchEntry* XHatchList::Remove(long nIndex)
-{
- return static_cast<XHatchEntry*>( XPropertyList::Remove(nIndex) );
+ XPropertyList::Replace(std::move(pEntry), nIndex);
}
XHatchEntry* XHatchList::GetHatch(long nIndex) const
@@ -71,11 +67,11 @@ bool XHatchList::Create()
aStr.append(" 1");
sal_Int32 nLen = aStr.getLength() - 1;
- Insert(new XHatchEntry(XHatch(RGB_Color(COL_BLACK),css::drawing::HatchStyle_SINGLE,100, 0),aStr.toString()));
+ Insert(o3tl::make_unique<XHatchEntry>(XHatch(RGB_Color(COL_BLACK),css::drawing::HatchStyle_SINGLE,100, 0),aStr.toString()));
aStr[nLen] = '2';
- Insert(new XHatchEntry(XHatch(RGB_Color(COL_RED ),css::drawing::HatchStyle_DOUBLE, 80,450),aStr.toString()));
+ Insert(o3tl::make_unique<XHatchEntry>(XHatch(RGB_Color(COL_RED ),css::drawing::HatchStyle_DOUBLE, 80,450),aStr.toString()));
aStr[nLen] = '3';
- Insert(new XHatchEntry(XHatch(RGB_Color(COL_BLUE ),css::drawing::HatchStyle_TRIPLE,120, 0),aStr.toString()));
+ Insert(o3tl::make_unique<XHatchEntry>(XHatch(RGB_Color(COL_BLUE ),css::drawing::HatchStyle_TRIPLE,120, 0),aStr.toString()));
return true;
}
diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx
index aebf849ccd74..e8c9d825848a 100644
--- a/svx/source/xoutdev/xtable.cxx
+++ b/svx/source/xoutdev/xtable.cxx
@@ -123,13 +123,14 @@ XPropertyList::XPropertyList(
// fprintf (stderr, "Create type %d count %d\n", (int)meType, count++);
}
-XPropertyList::~XPropertyList()
+bool XPropertyList::isValidIdx(long nIndex) const
{
-// fprintf (stderr, "Destroy type %d count %d\n", (int)meType, --count);
- for(XPropertyEntry* p : maList)
- delete p;
+ return ((size_t)nIndex < maList.size() && nIndex >= 0);
+}
+
- maList.clear();
+XPropertyList::~XPropertyList()
+{
}
long XPropertyList::Count() const
@@ -149,7 +150,10 @@ XPropertyEntry* XPropertyList::Get( long nIndex ) const
if( !const_cast<XPropertyList*>(this)->Load() )
const_cast<XPropertyList*>(this)->Create();
}
- return ( (size_t)nIndex < maList.size() ) ? maList[ nIndex ] : nullptr;
+ if (!isValidIdx(nIndex))
+ return nullptr;
+
+ return maList[nIndex].get();
}
long XPropertyList::GetIndex(const OUString& rName) const
@@ -171,46 +175,60 @@ long XPropertyList::GetIndex(const OUString& rName) const
Bitmap XPropertyList::GetUiBitmap( long nIndex ) const
{
Bitmap aRetval;
- XPropertyEntry* pEntry = ( (size_t)nIndex < maList.size() ) ? maList[ nIndex ] : nullptr;
- if(pEntry)
- {
- aRetval = pEntry->GetUiBitmap();
+ if (!isValidIdx(nIndex))
+ return aRetval;
- if(aRetval.IsEmpty())
- {
- aRetval = const_cast< XPropertyList* >(this)->CreateBitmapForUI(nIndex);
- pEntry->SetUiBitmap(aRetval);
- }
+ XPropertyEntry* pEntry = maList[nIndex].get();
+ aRetval = pEntry->GetUiBitmap();
+
+ if(aRetval.IsEmpty())
+ {
+ aRetval = const_cast< XPropertyList* >(this)->CreateBitmapForUI(nIndex);
+ pEntry->SetUiBitmap(aRetval);
}
return aRetval;
}
-void XPropertyList::Insert( XPropertyEntry* pEntry, long nIndex )
+void XPropertyList::Insert(std::unique_ptr<XPropertyEntry> pEntry, long nIndex)
{
- if ( (size_t)nIndex < maList.size() ) {
- maList.insert( maList.begin() + nIndex, pEntry );
+ if (!pEntry)
+ {
+ assert("empty XPropertyEntry not allowed in XPropertyList");
+ return;
+ }
+
+ if (isValidIdx(nIndex)) {
+ maList.insert( maList.begin()+nIndex, std::move(pEntry) );
} else {
- maList.push_back( pEntry );
+ maList.push_back( std::move(pEntry) );
}
}
-XPropertyEntry* XPropertyList::Replace( XPropertyEntry* pEntry, long nIndex )
+void XPropertyList::Replace(std::unique_ptr<XPropertyEntry> pEntry, long nIndex)
{
- XPropertyEntry* pOldEntry = (size_t)nIndex < maList.size() ? maList[ nIndex ] : nullptr;
- if ( pOldEntry ) {
- maList[ nIndex ] = pEntry;
+ if (!pEntry)
+ {
+ assert("empty XPropertyEntry not allowed in XPropertyList");
+ return;
}
- return pOldEntry;
+ if (!isValidIdx(nIndex))
+ {
+ assert("trying to replace invalid entry in XPropertyList");
+ return;
+ }
+
+ maList[nIndex] = std::move(pEntry);
}
-XPropertyEntry* XPropertyList::Remove( long nIndex )
+void XPropertyList::Remove(long nIndex)
{
- XPropertyEntry* pEntry = nullptr;
- if ( (size_t)nIndex < maList.size() ) {
- pEntry = maList[ nIndex ];
- maList.erase( maList.begin() + nIndex );
+ if (!isValidIdx(nIndex))
+ {
+ assert("trying to remove invalid entry in XPropertyList");
+ return;
}
- return pEntry;
+
+ maList.erase(maList.begin() + nIndex);
}
void XPropertyList::SetName( const OUString& rString )
diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx
index d27a9c6886c4..988bcb8edfa1 100644
--- a/svx/source/xoutdev/xtablend.cxx
+++ b/svx/source/xoutdev/xtablend.cxx
@@ -32,6 +32,7 @@
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <memory>
+#include <o3tl/make_unique.hxx>
using namespace com::sun::star;
@@ -44,11 +45,6 @@ XLineEndList::~XLineEndList()
{
}
-XLineEndEntry* XLineEndList::Remove(long nIndex)
-{
- return static_cast<XLineEndEntry*>( XPropertyList::Remove(nIndex) );
-}
-
XLineEndEntry* XLineEndList::GetLineEnd(long nIndex) const
{
return static_cast<XLineEndEntry*>( XPropertyList::Get(nIndex) );
@@ -67,7 +63,7 @@ bool XLineEndList::Create()
aTriangle.append(basegfx::B2DPoint(0.0, 30.0));
aTriangle.append(basegfx::B2DPoint(20.0, 30.0));
aTriangle.setClosed(true);
- Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aTriangle), SVX_RESSTR( RID_SVXSTR_ARROW ) ) );
+ Insert( o3tl::make_unique<XLineEndEntry>( basegfx::B2DPolyPolygon(aTriangle), SVX_RESSTR( RID_SVXSTR_ARROW ) ) );
basegfx::B2DPolygon aSquare;
aSquare.append(basegfx::B2DPoint(0.0, 0.0));
@@ -75,10 +71,10 @@ bool XLineEndList::Create()
aSquare.append(basegfx::B2DPoint(10.0, 10.0));
aSquare.append(basegfx::B2DPoint(0.0, 10.0));
aSquare.setClosed(true);
- Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aSquare), SVX_RESSTR( RID_SVXSTR_SQUARE ) ) );
+ Insert( o3tl::make_unique<XLineEndEntry>( basegfx::B2DPolyPolygon(aSquare), SVX_RESSTR( RID_SVXSTR_SQUARE ) ) );
basegfx::B2DPolygon aCircle(basegfx::tools::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), 100.0));
- Insert( new XLineEndEntry( basegfx::B2DPolyPolygon(aCircle), SVX_RESSTR( RID_SVXSTR_CIRCLE ) ) );
+ Insert( o3tl::make_unique<XLineEndEntry>( basegfx::B2DPolyPolygon(aCircle), SVX_RESSTR( RID_SVXSTR_CIRCLE ) ) );
return true;
}
diff --git a/svx/source/xoutdev/xtabptrn.cxx b/svx/source/xoutdev/xtabptrn.cxx
index aaa343de2a6e..f0c16f0e6909 100644
--- a/svx/source/xoutdev/xtabptrn.cxx
+++ b/svx/source/xoutdev/xtabptrn.cxx
@@ -30,12 +30,9 @@
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
-using namespace com::sun::star;
+#include <o3tl/make_unique.hxx>
-XBitmapEntry* XPatternList::Remove(long nIndex)
-{
- return static_cast<XBitmapEntry*>( XPropertyList::Remove(nIndex) );
-}
+using namespace com::sun::star;
XBitmapEntry* XPatternList::GetBitmap(long nIndex) const
{
@@ -60,28 +57,28 @@ bool XPatternList::Create()
// white/white bitmap
aStr.append(" 1");
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_WHITE), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString()));
+ Insert(o3tl::make_unique<XBitmapEntry>(Graphic(aBitmap), aStr.toString()));
// black/white bitmap
aArray[ 0] = 1; aArray[ 9] = 1; aArray[18] = 1; aArray[27] = 1;
aArray[36] = 1; aArray[45] = 1; aArray[54] = 1; aArray[63] = 1;
aStr[nLen] = '2';
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString()));
+ Insert(o3tl::make_unique<XBitmapEntry>(Graphic(aBitmap), aStr.toString()));
// lightred/white bitmap
aArray[ 7] = 1; aArray[14] = 1; aArray[21] = 1; aArray[28] = 1;
aArray[35] = 1; aArray[42] = 1; aArray[49] = 1; aArray[56] = 1;
aStr[nLen] = '3';
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTRED), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString()));
+ Insert(o3tl::make_unique<XBitmapEntry>(Graphic(aBitmap), aStr.toString()));
// lightblue/white bitmap
aArray[24] = 1; aArray[25] = 1; aArray[26] = 1;
aArray[29] = 1; aArray[30] = 1; aArray[31] = 1;
aStr[nLen] = '4';
aBitmap = createHistorical8x8FromArray(aArray, RGB_Color(COL_LIGHTBLUE), RGB_Color(COL_WHITE));
- Insert(new XBitmapEntry(Graphic(aBitmap), aStr.toString()));
+ Insert(o3tl::make_unique<XBitmapEntry>(Graphic(aBitmap), aStr.toString()));
return true;
}
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 8eca7911e254..38b45687ccc6 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1973,7 +1973,7 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet* )
XColorListRef pColorLst = XColorList::GetStdColorList();
for( long i = 0; i < pColorLst->Count(); ++i )
{
- XColorEntry* pEntry = pColorLst->GetColor( i );
+ const XColorEntry* pEntry = pColorLst->GetColor(i);
Color aColor = pEntry->GetColor();
const OUString sName = pEntry->GetName();
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 534e1c1d4783..7ec636d63c1a 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -542,7 +542,7 @@ SwColumnPage::SwColumnPage(vcl::Window *pParent, const SfxItemSet &rSet)
for (long i = 0; i < pColorList->Count(); ++i )
{
- XColorEntry* pEntry = pColorList->GetColor(i);
+ const XColorEntry* pEntry = pColorList->GetColor(i);
m_pLineColorDLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
m_pLineColorDLB->SetUpdateMode( true );
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index 88cd797ffd7f..efa2aaf63b60 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -231,7 +231,7 @@ void SwFootNotePage::Reset(const SfxItemSet *rSet)
for ( long i = 0; i < pColorList->Count(); ++i )
{
- XColorEntry* pEntry = pColorList->GetColor(i);
+ const XColorEntry* pEntry = pColorList->GetColor(i);
m_pLineColorBox->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
m_pLineColorBox->SetUpdateMode( true );
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 3614c8899bad..3854fa0400f0 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -113,7 +113,7 @@ SwTextGridPage::SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet) :
const long nCount = pColorLst->Count();
for( long i = 0; i < nCount; ++i )
{
- XColorEntry* pEntry = pColorLst->GetColor( i );
+ const XColorEntry* pEntry = pColorLst->GetColor(i);
Color aColor = pEntry->GetColor();
OUString sName = pEntry->GetName();
m_pColorLB->InsertEntry( aColor, sName );