fdo#50632 IDE: update Object Catalog when closing a document
Change-Id: Ia635aee1611eaff663906e2238bf23a5013242a3
This commit is contained in:
committed by
Noel Power
parent
604b1bf89c
commit
bb66a2c3ee
@@ -559,9 +559,12 @@ void BasicTreeListBox::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*
|
|||||||
UpdateEntries();
|
UpdateEntries();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicTreeListBox::onDocumentClosed( const ScriptDocument& /*_rDocument*/ )
|
void BasicTreeListBox::onDocumentClosed( const ScriptDocument& rDocument )
|
||||||
{
|
{
|
||||||
UpdateEntries();
|
UpdateEntries();
|
||||||
|
// The document is not yet actually deleted, so we need to remove its entry
|
||||||
|
// manually.
|
||||||
|
RemoveEntry(rDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicTreeListBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ )
|
void BasicTreeListBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ )
|
||||||
@@ -578,7 +581,7 @@ void BasicTreeListBox::UpdateEntries()
|
|||||||
{
|
{
|
||||||
BasicEntryDescriptor aCurDesc( GetEntryDescriptor( FirstSelected() ) );
|
BasicEntryDescriptor aCurDesc( GetEntryDescriptor( FirstSelected() ) );
|
||||||
|
|
||||||
|
// removing the invalid entries
|
||||||
SvLBoxEntry* pLastValid = 0;
|
SvLBoxEntry* pLastValid = 0;
|
||||||
SvLBoxEntry* pEntry = First();
|
SvLBoxEntry* pEntry = First();
|
||||||
while ( pEntry )
|
while ( pEntry )
|
||||||
@@ -586,19 +589,36 @@ void BasicTreeListBox::UpdateEntries()
|
|||||||
if ( IsValidEntry( pEntry ) )
|
if ( IsValidEntry( pEntry ) )
|
||||||
pLastValid = pEntry;
|
pLastValid = pEntry;
|
||||||
else
|
else
|
||||||
{
|
RemoveEntry(pEntry);
|
||||||
delete (BasicEntry*)pEntry->GetUserData();
|
|
||||||
GetModel()->Remove( pEntry );
|
|
||||||
}
|
|
||||||
pEntry = pLastValid ? Next( pLastValid ) : First();
|
pEntry = pLastValid ? Next( pLastValid ) : First();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ScanAllEntries();
|
ScanAllEntries();
|
||||||
|
|
||||||
SetCurrentEntry( aCurDesc );
|
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* BasicTreeListBox::CloneEntry( SvLBoxEntry* pSource )
|
||||||
{
|
{
|
||||||
SvLBoxEntry* pNew = SvTreeListBox::CloneEntry( pSource );
|
SvLBoxEntry* pNew = SvTreeListBox::CloneEntry( pSource );
|
||||||
|
@@ -195,6 +195,8 @@ public:
|
|||||||
SvLBoxEntry* AddEntry( const ::rtl::OUString& rText, const Image& rImage,
|
SvLBoxEntry* AddEntry( const ::rtl::OUString& rText, const Image& rImage,
|
||||||
SvLBoxEntry* pParent, bool bChildrenOnDemand,
|
SvLBoxEntry* pParent, bool bChildrenOnDemand,
|
||||||
std::auto_ptr< BasicEntry > aUserData );
|
std::auto_ptr< BasicEntry > aUserData );
|
||||||
|
void RemoveEntry (SvLBoxEntry*);
|
||||||
|
void RemoveEntry (ScriptDocument const&);
|
||||||
|
|
||||||
::rtl::OUString GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const;
|
::rtl::OUString GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const;
|
||||||
void GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage );
|
void GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage );
|
||||||
|
Reference in New Issue
Block a user