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

Use move semantics

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