summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/app/optsitem.cxx19
-rw-r--r--sd/source/ui/inc/optsitem.hxx7
2 files changed, 22 insertions, 4 deletions
diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx
index cdbcacd330e4..f23f1fbc6059 100644
--- a/sd/source/ui/app/optsitem.cxx
+++ b/sd/source/ui/app/optsitem.cxx
@@ -86,6 +86,21 @@ SdOptionsGeneric::SdOptionsGeneric(sal_uInt16 nConfigId, const OUString& rSubTre
{
}
+SdOptionsGeneric::SdOptionsGeneric(SdOptionsGeneric const & rSource)
+{
+ operator=(rSource);
+}
+
+SdOptionsGeneric& SdOptionsGeneric::operator=(SdOptionsGeneric const & rSource)
+{
+ maSubTree = rSource.maSubTree;
+ mpCfgItem.reset(rSource.mpCfgItem ? new SdOptionsItem(*rSource.mpCfgItem) : nullptr );
+ mnConfigId = rSource.mnConfigId;
+ mbInit = rSource.mbInit;
+ mbEnableModify = rSource.mbEnableModify;
+ return *this;
+}
+
void SdOptionsGeneric::Init() const
{
if( !mbInit )
@@ -93,7 +108,7 @@ void SdOptionsGeneric::Init() const
SdOptionsGeneric* pThis = const_cast<SdOptionsGeneric*>(this);
if( !mpCfgItem )
- pThis->mpCfgItem = new SdOptionsItem( *this, maSubTree );
+ pThis->mpCfgItem.reset( new SdOptionsItem( *this, maSubTree ) );
const Sequence< OUString > aNames( GetPropertyNames() );
const Sequence< Any > aValues = mpCfgItem->GetProperties( aNames );
@@ -113,8 +128,6 @@ void SdOptionsGeneric::Init() const
SdOptionsGeneric::~SdOptionsGeneric()
{
- delete mpCfgItem;
- mpCfgItem = nullptr;
}
void SdOptionsGeneric::Commit( SdOptionsItem& rCfgItem ) const
diff --git a/sd/source/ui/inc/optsitem.hxx b/sd/source/ui/inc/optsitem.hxx
index 5bf26e738eff..5ff8e4cf7e81 100644
--- a/sd/source/ui/inc/optsitem.hxx
+++ b/sd/source/ui/inc/optsitem.hxx
@@ -27,6 +27,7 @@
#include <svx/optgrid.hxx>
#include <svx/dlgutil.hxx>
#include "sddllapi.h"
+#include <memory>
class SdOptions;
@@ -65,7 +66,8 @@ friend class SdOptionsItem;
private:
OUString maSubTree;
- SdOptionsItem* mpCfgItem;
+ std::unique_ptr<SdOptionsItem>
+ mpCfgItem;
sal_uInt16 mnConfigId;
bool mbInit : 1;
bool mbEnableModify : 1;
@@ -87,8 +89,11 @@ protected:
public:
SdOptionsGeneric( sal_uInt16 nConfigId, const OUString& rSubTree );
+ SdOptionsGeneric( SdOptionsGeneric const & );
virtual ~SdOptionsGeneric();
+ SdOptionsGeneric& operator=( SdOptionsGeneric const & );
+
sal_uInt16 GetConfigId() const { return mnConfigId; }
void EnableModify( bool bModify ) { mbEnableModify = bModify; }