24#include <bitmaps.hlst>
26#include <com/sun/star/script/XLibraryContainer.hpp>
27#include <com/sun/star/script/XLibraryContainerPassword.hpp>
29#include <osl/diagnose.h>
42 OSL_ENSURE(
aDocument.
isAlive(),
"basctl::TreeListBox::RequestingChildren: invalid document!" );
51 ImpCreateLibEntries( rEntry,
aDocument, eLocation );
55 const OUString& aOULibName( aDesc.
GetLibName() );
60 if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
63 if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
66 bOK =
QueryPassword(m_pTopLevel, xModLibContainer, aOULibName, aPassword);
73 bool bModLibLoaded =
false;
74 if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
76 if ( !xModLibContainer->isLibraryLoaded( aOULibName ) )
79 xModLibContainer->loadLibrary( aOULibName );
81 bModLibLoaded = xModLibContainer->isLibraryLoaded( aOULibName );
85 bool bDlgLibLoaded =
false;
87 if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
89 if ( !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
92 xDlgLibContainer->loadLibrary( aOULibName );
94 bDlgLibLoaded = xDlgLibContainer->isLibraryLoaded( aOULibName );
97 if ( bModLibLoaded || bDlgLibLoaded )
100 ImpCreateLibSubEntries( rEntry,
aDocument, aOULibName );
104 auto const aImage(bDlgMode ? OUString(RID_BMP_DLGLIB) : OUString(RID_BMP_MODLIB));
105 SetEntryBitmaps(rEntry, aImage);
109 OSL_FAIL(
"basctl::TreeListBox::RequestingChildren: Error loading library!" );
118 const OUString& aLibName( aDesc.
GetLibName() );
119 ImpCreateLibSubSubEntriesInVBAMode( rEntry,
aDocument, aLibName );
135 for (
auto const& doc : aDocuments)
153 std::unique_ptr<weld::TreeIter> xIter(
m_xControl->make_iterator(pEntry));
154 std::vector<std::pair<Entry*, OUString>>
aEntries;
155 bool bValidIter =
true;
158 sal_uInt16 nDepth =
m_xControl->get_iter_depth(*xIter);
177 }
while (bValidIter);
183 bool bDocumentObjects =
false;
186 Entry* pBE = pair.first;
187 assert(pBE &&
"No data found in entry!");
188 OUString
aName(pair.second);
194 pVar = pBasMgr->GetLib(
aName );
203 if( bDocumentObjects )
215 pVar =
static_cast<SbxObject*
>(pVar)->GetMethods()->
Find(
aName, SbxClassType::Method);
221 bDocumentObjects =
true;
229 OSL_FAIL(
"FindVariable: unknown type" );
245 OUString aLibSubName;
247 OUString aMethodName;
253 std::vector<std::pair<Entry*, OUString>>
aEntries;
255 std::unique_ptr<weld::TreeIter> xIter(
m_xControl->make_iterator(pEntry));
256 bool bValidIter =
true;
259 sal_uInt16 nDepth =
m_xControl->get_iter_depth(*xIter);
275 aDocument = pDocumentEntry->GetDocument();
276 eLocation = pDocumentEntry->GetLocation();
283 }
while (bValidIter);
290 Entry* pBE = pair.first;
291 assert(pBE &&
"No data found in entry!");
297 aLibName = pair.second;
309 aMethodName = pair.second;
324 aLibSubName = pair.second;
330 OSL_FAIL(
"GetEntryDescriptor: unknown type" );
360 bool bIsValid =
false;
365 const OUString& aLibName( aDesc.
GetLibName() );
420 OSL_ENSURE( rDocument.
isValid(),
"basctl::TreeListBox::FindRootEntry: invalid document!" );
421 bool bValidIter =
m_xControl->get_iter_first(rIter);
427 bValidIter =
m_xControl->iter_next_sibling(rIter);
434 return OUString::Concat(
"[") + rMgrName +
"]." + rLibName;
virtual SbxVariable * Find(const OUString &, SbxClassType)
LibraryLocation GetLocation() const
ScriptDocument const & GetDocument() const
const OUString & GetMethodName() const
LibraryLocation GetLocation() const
ScriptDocument const & GetDocument() const
EntryType GetType() const
const OUString & GetLibName() const
const OUString & GetName() const
EntryType GetType() const
EntryDescriptor GetEntryDescriptor(const weld::TreeIter *pEntry)
bool FindRootEntry(const ScriptDocument &rDocument, LibraryLocation eLocation, weld::TreeIter &rIter)
OUString GetRootEntryName(const ScriptDocument &rDocument, LibraryLocation eLocation) const
std::unique_ptr< weld::TreeView > m_xControl
bool m_bFreezeOnFirstAddRemove
SbxVariable * FindVariable(const weld::TreeIter *pEntry)
bool IsValidEntry(const weld::TreeIter &rEntry)
void ScanEntry(const ScriptDocument &rDocument, LibraryLocation eLocation)
SbModule * FindModule(const weld::TreeIter *pEntry)
static ItemType ConvertType(EntryType eType)
encapsulates a document which contains Basic scripts and dialogs
css::uno::Reference< css::script::XLibraryContainer > getLibraryContainer(LibraryContainerType _eType) const
returns the Basic or Dialog library container of the document
@ DocumentsSorted
real documents only, sorted lexicographically by their title (using the sys locale's default collator...
static ScriptDocuments getAllScriptDocuments(ScriptDocumentList _eListType)
returns the set of ScriptDocument instances, one for each open document which contains Basic/Dialog c...
static const ScriptDocument & getApplicationScriptDocument()
returns a reference to a shared ScriptDocument instance which operates on the application-wide script...
bool isAlive() const
determines whether the document instance is alive
bool isValid() const
determines whether the document is actually able to contain Basic/Dialog libraries
#define DBG_ASSERT(sCon, aError)
ScXMLEditAttributeMap::Entry const aEntries[]
OUString CreateMgrAndLibStr(std::u16string_view rMgrName, std::u16string_view rLibName)
bool HasMethod(ScriptDocument const &rDocument, OUString const &rLibName, OUString const &rModName, OUString const &rMethName)
bool QueryPassword(weld::Widget *pDialogParent, const Reference< script::XLibraryContainer > &xLibContainer, const OUString &rLibName, OUString &rPassword, bool bRepeat, bool bNewTitle)
@ LIBRARY_LOCATION_UNKNOWN
@ LIBRARY_LOCATION_DOCUMENT
IMPL_LINK(AccessibleDialogWindow, WindowEventListener, VclWindowEvent &, rEvent, void)
std::vector< ScriptDocument > ScriptDocuments
@ OBJ_TYPE_NORMAL_MODULES
@ OBJ_TYPE_DOCUMENT_OBJECTS