diff options
author | Uray M. János <uray.janos@gmail.com> | 2012-07-24 19:27:25 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-08-10 21:51:32 +0200 |
commit | 3784488acbe16c4581e164e3c9a0af9ad57c1cef (patch) | |
tree | a9c9a72e4ddc2f2fdf4d9ebc8c782994af4bc70e /basctl | |
parent | 15ee0e20565962c82b0ce474ac54c200e83a2850 (diff) |
fdo#50632 IDE: update Object Catalog when closing a document
Change-Id: Ia635aee1611eaff663906e2238bf23a5013242a3
Signed-off-by: Andras Timar <atimar@suse.com>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/bastype2.cxx | 34 | ||||
-rw-r--r-- | basctl/source/basicide/bastype2.hxx | 2 |
2 files changed, 29 insertions, 7 deletions
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index 9e78d750f2c5..5317a33b2a3c 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -568,9 +568,12 @@ void BasicTreeListBox::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument* UpdateEntries(); } -void BasicTreeListBox::onDocumentClosed( const ScriptDocument& /*_rDocument*/ ) +void BasicTreeListBox::onDocumentClosed( const ScriptDocument& rDocument ) { UpdateEntries(); + // The document is not yet actually deleted, so we need to remove its entry + // manually. + RemoveEntry(rDocument); } void BasicTreeListBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) @@ -587,7 +590,7 @@ void BasicTreeListBox::UpdateEntries() { BasicEntryDescriptor aCurDesc( GetEntryDescriptor( FirstSelected() ) ); - + // removing the invalid entries SvLBoxEntry* pLastValid = 0; SvLBoxEntry* pEntry = First(); while ( pEntry ) @@ -595,19 +598,36 @@ void BasicTreeListBox::UpdateEntries() if ( IsValidEntry( pEntry ) ) pLastValid = pEntry; else - { - delete (BasicEntry*)pEntry->GetUserData(); - GetModel()->Remove( pEntry ); - } + RemoveEntry(pEntry); pEntry = pLastValid ? Next( pLastValid ) : First(); } - ScanAllEntries(); SetCurrentEntry( aCurDesc ); } +// Removes the entry from the tree. +void BasicTreeListBox::RemoveEntry (SvLBoxEntry* pEntry) +{ + // removing the associated user data + delete (BasicEntry*)pEntry->GetUserData(); + // removing the entry + GetModel()->Remove( pEntry ); +} + +// Removes the entry of rDocument. +void BasicTreeListBox::RemoveEntry (ScriptDocument const& rDocument) +{ + // finding the entry of rDocument + for (SvLBoxEntry* pEntry = First(); pEntry; pEntry = Next(pEntry)) + if (rDocument == GetEntryDescriptor(pEntry).GetDocument()) + { + RemoveEntry(pEntry); + break; + } +} + SvLBoxEntry* BasicTreeListBox::CloneEntry( SvLBoxEntry* pSource ) { SvLBoxEntry* pNew = SvTreeListBox::CloneEntry( pSource ); diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx index 20aa7c5d8c69..2e4e2f5f1f9e 100644 --- a/basctl/source/basicide/bastype2.hxx +++ b/basctl/source/basicide/bastype2.hxx @@ -208,6 +208,8 @@ public: SvLBoxEntry* AddEntry( const ::rtl::OUString& rText, const Image& rImage, SvLBoxEntry* pParent, bool bChildrenOnDemand, std::auto_ptr< BasicEntry > aUserData ); + void RemoveEntry (SvLBoxEntry*); + void RemoveEntry (ScriptDocument const&); ::rtl::OUString GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const; void GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage ); |