diff options
Diffstat (limited to 'basctl/source/basicide/bastype3.cxx')
-rw-r--r-- | basctl/source/basicide/bastype3.cxx | 302 |
1 files changed, 0 insertions, 302 deletions
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx index 93fb1525d473..19ca594a213b 100644 --- a/basctl/source/basicide/bastype3.cxx +++ b/basctl/source/basicide/bastype3.cxx @@ -36,99 +36,8 @@ namespace basctl using namespace ::com::sun::star::uno; using namespace ::com::sun::star; - typedef std::deque< SvTreeListEntry* > EntryArray; - -void TreeListBox::RequestingChildren( SvTreeListEntry* pEntry ) -{ - EntryDescriptor aDesc = GetEntryDescriptor(pEntry); - const ScriptDocument& aDocument = aDesc.GetDocument(); - OSL_ENSURE( aDocument.isAlive(), "basctl::TreeListBox::RequestingChildren: invalid document!" ); - if ( !aDocument.isAlive() ) - return; - - LibraryLocation eLocation = aDesc.GetLocation(); - EntryType eType = aDesc.GetType(); - - if ( eType == OBJ_TYPE_DOCUMENT ) - { - ImpCreateLibEntries( pEntry, aDocument, eLocation ); - } - else if ( eType == OBJ_TYPE_LIBRARY ) - { - const OUString& aOULibName( aDesc.GetLibName() ); - - // check password - bool bOK = true; - Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - { - Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); - if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) ) - { - OUString aPassword; - bOK = QueryPassword(GetFrameWeld(), xModLibContainer, aOULibName, aPassword); - } - } - - if ( bOK ) - { - // load module library - bool bModLibLoaded = false; - if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) - { - if ( !xModLibContainer->isLibraryLoaded( aOULibName ) ) - { - EnterWait(); - xModLibContainer->loadLibrary( aOULibName ); - LeaveWait(); - } - bModLibLoaded = xModLibContainer->isLibraryLoaded( aOULibName ); - } - - // load dialog library - bool bDlgLibLoaded = false; - Reference< script::XLibraryContainer > xDlgLibContainer = aDocument.getLibraryContainer( E_DIALOGS ); - if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) ) - { - if ( !xDlgLibContainer->isLibraryLoaded( aOULibName ) ) - { - EnterWait(); - xDlgLibContainer->loadLibrary( aOULibName ); - LeaveWait(); - } - bDlgLibLoaded = xDlgLibContainer->isLibraryLoaded( aOULibName ); - } - - if ( bModLibLoaded || bDlgLibLoaded ) - { - // create the sub entries - ImpCreateLibSubEntries( pEntry, aDocument, aOULibName ); - - // exchange image - Image aImage(StockImage::Yes, OUStringLiteral(RID_BMP_MODLIB)); - SetEntryBitmaps( pEntry, aImage ); - } - else - { - OSL_FAIL( "basctl::TreeListBox::RequestingChildren: Error loading library!" ); - } - } - } - else if ( eType == OBJ_TYPE_DOCUMENT_OBJECTS - || eType == OBJ_TYPE_USERFORMS - || eType == OBJ_TYPE_NORMAL_MODULES - || eType == OBJ_TYPE_CLASS_MODULES ) - { - const OUString& aLibName( aDesc.GetLibName() ); - ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName ); - } - else { - OSL_FAIL( "basctl::TreeListBox::RequestingChildren: Unknown Type!" ); - } -} - IMPL_LINK(SbTreeListBox, RequestingChildrenHdl, const weld::TreeIter&, rEntry, bool) { EntryDescriptor aDesc = GetEntryDescriptor(&rEntry); @@ -216,34 +125,6 @@ IMPL_LINK(SbTreeListBox, RequestingChildrenHdl, const weld::TreeIter&, rEntry, b return true; } -void TreeListBox::ExpandedHdl() -{ - SvTreeListEntry* pEntry = GetHdlEntry(); - assert(pEntry && "What was collapsed?"); - if ( !IsExpanded( pEntry ) && pEntry->HasChildrenOnDemand() ) - { - SvTreeListEntry* pChild = FirstChild( pEntry ); - while ( pChild ) - { - GetModel()->Remove( pChild ); // does also call the DTOR - pChild = FirstChild( pEntry ); - } - } -} - -void TreeListBox::ScanAllEntries() -{ - ScanEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER ); - ScanEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE ); - - ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::DocumentsSorted ) ); - for (auto const& doc : aDocuments) - { - if ( doc.isAlive() ) - ScanEntry(doc, LIBRARY_LOCATION_DOCUMENT); - } -} - void SbTreeListBox::ScanAllEntries() { // instead of always freezing, freeze on the first add/remove, which keeps gtk @@ -359,104 +240,6 @@ SbxVariable* SbTreeListBox::FindVariable(const weld::TreeIter* pEntry) return pVar; } -EntryDescriptor TreeListBox::GetEntryDescriptor( SvTreeListEntry* pEntry ) -{ - ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() ); - LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN; - OUString aLibName; - OUString aLibSubName; - OUString aName; - OUString aMethodName; - EntryType eType = OBJ_TYPE_UNKNOWN; - - if ( !pEntry ) - return EntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); - - EntryArray aEntries; - - while ( pEntry ) - { - sal_uInt16 nDepth = GetModel()->GetDepth( pEntry ); - switch ( nDepth ) - { - case 4: - case 3: - case 2: - case 1: - { - aEntries.push_front( pEntry ); - } - break; - case 0: - { - if (DocumentEntry* pDocumentEntry = static_cast<DocumentEntry*>(pEntry->GetUserData())) - { - aDocument = pDocumentEntry->GetDocument(); - eLocation = pDocumentEntry->GetLocation(); - eType = OBJ_TYPE_DOCUMENT; - } - } - break; - } - pEntry = GetParent( pEntry ); - } - - for (SvTreeListEntry* pLE : aEntries) - { - assert(pLE && "Entry not found in array"); - Entry* pBE = static_cast<Entry*>(pLE->GetUserData()); - assert(pBE && "No data found in entry!"); - - switch ( pBE->GetType() ) - { - case OBJ_TYPE_LIBRARY: - { - aLibName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_MODULE: - { - aName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_METHOD: - { - aMethodName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_DIALOG: - { - aName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_DOCUMENT_OBJECTS: - case OBJ_TYPE_USERFORMS: - case OBJ_TYPE_NORMAL_MODULES: - case OBJ_TYPE_CLASS_MODULES: - { - aLibSubName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - default: - { - OSL_FAIL( "GetEntryDescriptor: unknown type" ); - eType = OBJ_TYPE_UNKNOWN; - } - break; - } - - if ( eType == OBJ_TYPE_UNKNOWN ) - break; - } - - return EntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); -} - EntryDescriptor SbTreeListBox::GetEntryDescriptor(const weld::TreeIter* pEntry) { ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() ); @@ -561,20 +344,6 @@ EntryDescriptor SbTreeListBox::GetEntryDescriptor(const weld::TreeIter* pEntry) return EntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); } -ItemType TreeListBox::ConvertType (EntryType eType) -{ - switch (eType) - { - case OBJ_TYPE_DOCUMENT: return TYPE_SHELL; - case OBJ_TYPE_LIBRARY: return TYPE_LIBRARY; - case OBJ_TYPE_MODULE: return TYPE_MODULE; - case OBJ_TYPE_DIALOG: return TYPE_DIALOG; - case OBJ_TYPE_METHOD: return TYPE_METHOD; - default: - return static_cast<ItemType>(OBJ_TYPE_UNKNOWN); - } -} - ItemType SbTreeListBox::ConvertType (EntryType eType) { switch (eType) @@ -589,61 +358,6 @@ ItemType SbTreeListBox::ConvertType (EntryType eType) } } -bool TreeListBox::IsValidEntry( SvTreeListEntry* pEntry ) -{ - bool bIsValid = false; - - EntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); - const ScriptDocument& aDocument( aDesc.GetDocument() ); - LibraryLocation eLocation( aDesc.GetLocation() ); - const OUString& aLibName( aDesc.GetLibName() ); - const OUString& aName( aDesc.GetName() ); - const OUString& aMethodName( aDesc.GetMethodName() ); - EntryType eType( aDesc.GetType() ); - - switch ( eType ) - { - case OBJ_TYPE_DOCUMENT: - { - bIsValid = aDocument.isAlive() - && (aDocument.isApplication() - || GetRootEntryName(aDocument, eLocation) == GetEntryText(pEntry)); - } - break; - case OBJ_TYPE_LIBRARY: - { - bIsValid = aDocument.hasLibrary( E_SCRIPTS, aLibName ) || aDocument.hasLibrary( E_DIALOGS, aLibName ); - } - break; - case OBJ_TYPE_MODULE: - { - bIsValid = aDocument.hasModule( aLibName, aName ); - } - break; - case OBJ_TYPE_DIALOG: - { - bIsValid = aDocument.hasDialog( aLibName, aName ); - } - break; - case OBJ_TYPE_METHOD: - { - bIsValid = HasMethod( aDocument, aLibName, aName, aMethodName ); - } - break; - case OBJ_TYPE_DOCUMENT_OBJECTS: - case OBJ_TYPE_USERFORMS: - case OBJ_TYPE_NORMAL_MODULES: - case OBJ_TYPE_CLASS_MODULES: - { - bIsValid = true; - } - break; - default: ; - } - - return bIsValid; -} - bool SbTreeListBox::IsValidEntry(weld::TreeIter& rEntry) { bool bIsValid = false; @@ -704,22 +418,6 @@ SbModule* SbTreeListBox::FindModule(const weld::TreeIter* pEntry) return dynamic_cast<SbModule*>(FindVariable(pEntry)); } -SvTreeListEntry* TreeListBox::FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ) -{ - OSL_ENSURE( rDocument.isValid(), "basctl::TreeListBox::FindRootEntry: invalid document!" ); - sal_uLong nRootPos = 0; - SvTreeListEntry* pRootEntry = GetEntry( nRootPos ); - while ( pRootEntry ) - { - DBG_ASSERT( static_cast<Entry*>(pRootEntry->GetUserData())->GetType() == OBJ_TYPE_DOCUMENT, "No shell entry?" ); - DocumentEntry* pBDEntry = static_cast<DocumentEntry*>(pRootEntry->GetUserData()); - if (pBDEntry && pBDEntry->GetDocument() == rDocument && pBDEntry->GetLocation() == eLocation) - return pRootEntry; - pRootEntry = GetEntry( ++nRootPos ); - } - return nullptr; -} - bool SbTreeListBox::FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, weld::TreeIter& rIter) { OSL_ENSURE( rDocument.isValid(), "basctl::TreeListBox::FindRootEntry: invalid document!" ); |