[Libreoffice-commits] .: basctl/source
Noel Power
noelp at kemper.freedesktop.org
Thu Jul 26 02:16:09 PDT 2012
basctl/source/basicide/bastype2.cxx | 34 +++++++++++++++++++++++++++-------
basctl/source/basicide/bastype2.hxx | 2 ++
2 files changed, 29 insertions(+), 7 deletions(-)
New commits:
commit bb66a2c3ee9807e79ba437c770559787abe61b9b
Author: Uray M. János <uray.janos at gmail.com>
Date: Tue Jul 24 19:27:25 2012 +0200
fdo#50632 IDE: update Object Catalog when closing a document
Change-Id: Ia635aee1611eaff663906e2238bf23a5013242a3
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index ce4d0a3..d8ccb8b 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -559,9 +559,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*/ )
@@ -578,7 +581,7 @@ void BasicTreeListBox::UpdateEntries()
{
BasicEntryDescriptor aCurDesc( GetEntryDescriptor( FirstSelected() ) );
-
+ // removing the invalid entries
SvLBoxEntry* pLastValid = 0;
SvLBoxEntry* pEntry = First();
while ( pEntry )
@@ -586,19 +589,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 e8acb2b..efcaa4f 100644
--- a/basctl/source/basicide/bastype2.hxx
+++ b/basctl/source/basicide/bastype2.hxx
@@ -195,6 +195,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 );
More information about the Libreoffice-commits
mailing list