Kaydet (Commit) 9aeac1b2 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Use move semantics

Change-Id: I9ba8265044d0f83afe44b6965b78cc733cace653
üst 168ad257
......@@ -22,6 +22,7 @@
#include <bastype2.hxx>
#include <baside2.hrc>
#include <iderid.hxx>
#include <o3tl/make_unique.hxx>
#include <tools/urlobj.hxx>
#include <tools/diagnose_ex.h>
#include <svtools/imagemgr.hxx>
......@@ -245,11 +246,10 @@ void TreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation eL
OUString aRootName( GetRootEntryName( rDocument, eLocation ) );
Image aImage;
GetRootEntryBitmaps( rDocument, aImage );
std::unique_ptr<Entry> e(new DocumentEntry(rDocument, eLocation));
AddEntry(
aRootName,
aImage,
0, true, &e);
0, true, o3tl::make_unique<DocumentEntry>(rDocument, eLocation));
}
SetUpdateMode(true);
......@@ -308,11 +308,11 @@ void TreeListBox::ImpCreateLibEntries( SvTreeListEntry* pDocumentRootEntry, cons
}
else
{
std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_LIBRARY));
AddEntry(
aLibName,
Image( IDEResId( nId ) ),
pDocumentRootEntry, true, &e);
pDocumentRootEntry, true,
o3tl::make_unique<Entry>(OBJ_TYPE_LIBRARY));
}
}
}
......@@ -344,11 +344,11 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const
SvTreeListEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE );
if ( !pModuleEntry )
{
std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_MODULE));
pModuleEntry = AddEntry(
aModName,
Image( IDEResId( RID_IMG_MODULE ) ),
pLibRootEntry, false, &e);
pLibRootEntry, false,
o3tl::make_unique<Entry>(OBJ_TYPE_MODULE));
}
// methods
......@@ -364,12 +364,12 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const
SvTreeListEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
if ( !pEntry )
{
std::unique_ptr<Entry> e(
new Entry(OBJ_TYPE_METHOD));
pEntry = AddEntry(
aName,
Image( IDEResId( RID_IMG_MACRO ) ),
pModuleEntry, false, &e);
pModuleEntry, false,
o3tl::make_unique<Entry>(
OBJ_TYPE_METHOD));
}
}
}
......@@ -403,11 +403,11 @@ void TreeListBox::ImpCreateLibSubEntries( SvTreeListEntry* pLibRootEntry, const
SvTreeListEntry* pDialogEntry = FindEntry( pLibRootEntry, aDlgName, OBJ_TYPE_DIALOG );
if ( !pDialogEntry )
{
std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_DIALOG));
pDialogEntry = AddEntry(
aDlgName,
Image( IDEResId( RID_IMG_DIALOG ) ),
pLibRootEntry, false, &e);
pLibRootEntry, false,
o3tl::make_unique<Entry>(OBJ_TYPE_DIALOG));
}
}
}
......@@ -439,11 +439,10 @@ void TreeListBox::ImpCreateLibSubEntriesInVBAMode( SvTreeListEntry* pLibRootEntr
}
else
{
std::unique_ptr<Entry> e(new Entry(eType));
AddEntry(
aEntryName,
Image( IDEResId( RID_IMG_MODLIB ) ),
pLibRootEntry, true, &e);
pLibRootEntry, true, o3tl::make_unique<Entry>(eType));
}
}
}
......@@ -501,11 +500,11 @@ void TreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvTreeListEntry* pLibSubRo
SvTreeListEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aEntryName, OBJ_TYPE_MODULE );
if ( !pModuleEntry )
{
std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_MODULE));
pModuleEntry = AddEntry(
aEntryName,
Image( IDEResId( RID_IMG_MODULE ) ),
pLibSubRootEntry, false, &e);
pLibSubRootEntry, false,
o3tl::make_unique<Entry>(OBJ_TYPE_MODULE));
}
// methods
......@@ -521,11 +520,11 @@ void TreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvTreeListEntry* pLibSubRo
SvTreeListEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD );
if ( !pEntry )
{
std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_METHOD));
pEntry = AddEntry(
aName,
Image( IDEResId( RID_IMG_MACRO ) ),
pModuleEntry, false, &e);
pModuleEntry, false,
o3tl::make_unique<Entry>(OBJ_TYPE_METHOD));
}
}
}
......@@ -736,15 +735,14 @@ SvTreeListEntry* TreeListBox::AddEntry(
const Image& rImage,
SvTreeListEntry* pParent,
bool bChildrenOnDemand,
std::unique_ptr<Entry> * aUserData
std::unique_ptr<Entry> && aUserData
)
{
assert(aUserData != 0);
SvTreeListEntry* p = InsertEntry(
rText, rImage, rImage, pParent, bChildrenOnDemand, TREELIST_APPEND,
aUserData->get()
aUserData.get()
);
aUserData->release();
aUserData.release();
return p;
}
......
......@@ -231,7 +231,7 @@ public:
SvTreeListEntry* AddEntry(
const OUString& rText, const Image& rImage,
SvTreeListEntry* pParent, bool bChildrenOnDemand,
std::unique_ptr<Entry> * aUserData
std::unique_ptr<Entry> && aUserData
);
void RemoveEntry (SvTreeListEntry*);
void RemoveEntry (ScriptDocument const&);
......
......@@ -23,6 +23,7 @@
#include <baside2.hrc>
#include <iderdll.hxx>
#include <iderdll2.hxx>
#include <o3tl/make_unique.hxx>
#include <svx/passwd.hxx>
#include <ucbhelper/content.hxx>
#include <rtl/uri.hxx>
......@@ -1555,20 +1556,20 @@ void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
sal_uInt16 nMode = pBasicBox->GetMode();
bool bDlgMode = ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES );
sal_uInt16 nId = bDlgMode ? RID_IMG_DLGLIB : RID_IMG_MODLIB;
std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_LIBRARY));
SvTreeListEntry* pNewLibEntry = pBasicBox->AddEntry(
aLibName,
Image( IDEResId( nId ) ),
pRootEntry, false, &e);
pRootEntry, false,
o3tl::make_unique<Entry>(OBJ_TYPE_LIBRARY));
DBG_ASSERT( pNewLibEntry, "InsertEntry fehlgeschlagen!" );
if( pNewLibEntry )
{
e.reset(new Entry(OBJ_TYPE_MODULE));
SvTreeListEntry* pEntry_ = pBasicBox->AddEntry(
aModName,
Image( IDEResId( RID_IMG_MODULE ) ),
pNewLibEntry, false, &e);
pNewLibEntry, false,
o3tl::make_unique<Entry>(OBJ_TYPE_MODULE));
DBG_ASSERT( pEntry_, "InsertEntry fehlgeschlagen!" );
pBasicBox->SetCurEntry( pEntry_ );
pBasicBox->Select( pBasicBox->GetCurEntry() ); // OV-Bug?!
......
......@@ -28,6 +28,7 @@
#include <basic/basmgr.hxx>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <comphelper/processfactory.hxx>
#include <o3tl/make_unique.hxx>
#include <sfx2/app.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
......@@ -858,11 +859,11 @@ void ObjectPage::NewDialog()
SvTreeListEntry* pEntry = m_pBasicBox->FindEntry( pLibEntry, aDlgName, OBJ_TYPE_DIALOG );
if ( !pEntry )
{
std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_DIALOG));
pEntry = m_pBasicBox->AddEntry(
aDlgName,
Image( IDEResId( RID_IMG_DIALOG ) ),
pLibEntry, false, &e);
pLibEntry, false,
o3tl::make_unique<Entry>(OBJ_TYPE_DIALOG));
DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" );
}
m_pBasicBox->SetCurEntry( pEntry );
......@@ -1029,11 +1030,11 @@ SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
SvTreeListEntry* pEntry = rBasicBox.FindEntry( pSubRootEntry, aModName, OBJ_TYPE_MODULE );
if ( !pEntry )
{
std::unique_ptr<Entry> e(new Entry(OBJ_TYPE_MODULE));
pEntry = rBasicBox.AddEntry(
aModName,
Image( IDEResId( RID_IMG_MODULE ) ),
pSubRootEntry, false, &e);
pSubRootEntry, false,
o3tl::make_unique<Entry>(OBJ_TYPE_MODULE));
DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" );
}
rBasicBox.SetCurEntry( pEntry );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment