LibreOffice Module basic (master) 1
sb.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sb.hxx>
21#include <o3tl/safeint.hxx>
22#include <rtl/ustrbuf.hxx>
23#include <tools/stream.hxx>
24#include <tools/debug.hxx>
25#include <vcl/errinf.hxx>
27#include <basic/sbx.hxx>
28#include <vcl/svapp.hxx>
30#include <image.hxx>
31#include <sbunoobj.hxx>
32#include <sbjsmeth.hxx>
33#include <sbjsmod.hxx>
34#include <sbintern.hxx>
35#include <runtime.hxx>
36#include <basic/sberrors.hxx>
37#include <basic/sbuno.hxx>
38#include <sbprop.hxx>
39#include <sbobjmod.hxx>
40#include <stdobj.hxx>
41#include <basic.hrc>
43#include <com/sun/star/lang/XMultiServiceFactory.hpp>
44#include <com/sun/star/util/XCloseBroadcaster.hpp>
45#include <com/sun/star/util/XCloseListener.hpp>
46#include <sal/log.hxx>
47#include <errobject.hxx>
48#include <memory>
49#include <unordered_map>
50
51#include <com/sun/star/script/ModuleType.hpp>
52#include <com/sun/star/script/ModuleInfo.hpp>
53
54#include <strings.hrc>
55
56using namespace ::com::sun::star::script;
57
58constexpr OUStringLiteral SB_RTLNAME = u"@SBRTL";
59// i#i68894#
60using namespace ::com::sun::star;
61using namespace ::com::sun::star::uno;
63using com::sun::star::uno::Any;
64using com::sun::star::uno::UNO_QUERY;
65using com::sun::star::lang::XMultiServiceFactory;
66
67
68class DocBasicItem : public ::cppu::WeakImplHelper< util::XCloseListener >
69{
70public:
71 explicit DocBasicItem( StarBASIC& rDocBasic );
72 virtual ~DocBasicItem() override;
73
74 const SbxObjectRef& getClassModules() const { return mxClassModules; }
75 bool isDocClosed() const { return mbDocClosed; }
76
77 void clearDependingVarsOnDelete( StarBASIC& rDeletedBasic );
78
79 void startListening();
80 void stopListening();
81
82 void setDisposed( bool bDisposed )
83 {
84 mbDisposed = bDisposed;
85 }
86
87 virtual void SAL_CALL queryClosing( const lang::EventObject& rSource, sal_Bool bGetsOwnership ) override;
88 virtual void SAL_CALL notifyClosing( const lang::EventObject& rSource ) override;
89 virtual void SAL_CALL disposing( const lang::EventObject& rSource ) override;
90
91private:
96};
97
98
100 mrDocBasic( rDocBasic ),
101 mxClassModules( new SbxObject( OUString() ) ),
102 mbDocClosed( false ),
103 mbDisposed( false )
104{
105}
106
108{
109 // tdf#90969 HACK: don't use SolarMutexGuard - there is a horrible global
110 // map GaDocBasicItems holding instances, and these get deleted from exit
111 // handlers, when the SolarMutex is already dead
113 if ( pSolarMutex )
114 pSolarMutex->acquire();
115
116 try
117 {
119 mxClassModules.clear(); // release with SolarMutex locked
120 }
121 catch (...)
122 {
123 assert(false);
124 }
125
126 pSolarMutex = comphelper::SolarMutex::get();
127 if ( pSolarMutex )
128 pSolarMutex->release();
129}
130
132{
134}
135
137{
138 Any aThisComp;
139 mrDocBasic.GetUNOConstant( "ThisComponent", aThisComp );
140 Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY );
141 mbDisposed = !xCloseBC.is();
142 if( xCloseBC.is() )
143 {
144 try { xCloseBC->addCloseListener( this ); } catch(const uno::Exception& ) {}
145 }
146}
147
149{
150 if( mbDisposed ) return;
151 mbDisposed = true;
152 Any aThisComp;
153 if (!mrDocBasic.GetUNOConstant("ThisComponent", aThisComp))
154 return;
155
156 Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY );
157 if( xCloseBC.is() )
158 {
159 try { xCloseBC->removeCloseListener( this ); } catch(const uno::Exception& ) {}
160 }
161}
162
163void SAL_CALL DocBasicItem::queryClosing( const lang::EventObject& /*rSource*/, sal_Bool /*bGetsOwnership*/ )
164{
165}
166
167void SAL_CALL DocBasicItem::notifyClosing( const lang::EventObject& /*rEvent*/ )
168{
170 mbDocClosed = true;
171}
172
173void SAL_CALL DocBasicItem::disposing( const lang::EventObject& /*rEvent*/ )
174{
176}
177
178
179namespace {
180
181typedef ::rtl::Reference< DocBasicItem > DocBasicItemRef;
182
183std::unordered_map< const StarBASIC *, DocBasicItemRef > gaDocBasicItems;
184
185const DocBasicItem* lclFindDocBasicItem( const StarBASIC* pDocBasic )
186{
187 auto it = gaDocBasicItems.find( pDocBasic );
188 auto end = gaDocBasicItems.end();
189 return (it != end) ? it->second.get() : nullptr;
190}
191
192void lclInsertDocBasicItem( StarBASIC& rDocBasic )
193{
194 DocBasicItemRef& rxDocBasicItem = gaDocBasicItems[ &rDocBasic ];
195 rxDocBasicItem.set( new DocBasicItem( rDocBasic ) );
196 rxDocBasicItem->startListening();
197}
198
199void lclRemoveDocBasicItem( StarBASIC& rDocBasic )
200{
201 auto it = gaDocBasicItems.find( &rDocBasic );
202 if( it != gaDocBasicItems.end() )
203 {
204 it->second->stopListening();
205 gaDocBasicItems.erase( it );
206 }
207 for( auto& rEntry : gaDocBasicItems )
208 {
209 rEntry.second->clearDependingVarsOnDelete( rDocBasic );
210 }
211}
212
213StarBASIC* lclGetDocBasicForModule( SbModule* pModule )
214{
215 StarBASIC* pRetBasic = nullptr;
216 SbxObject* pCurParent = pModule;
217 while( pCurParent->GetParent() != nullptr )
218 {
219 pCurParent = pCurParent->GetParent();
220 StarBASIC* pDocBasic = dynamic_cast<StarBASIC*>( pCurParent );
221 if( pDocBasic != nullptr && pDocBasic->IsDocBasic() )
222 {
223 pRetBasic = pDocBasic;
224 break;
225 }
226 }
227 return pRetBasic;
228}
229
230} // namespace
231
232
234{
235 if ( !pVBAGlobals.is() )
236 {
237 Any aThisDoc;
238 if ( GetUNOConstant("ThisComponent", aThisDoc) )
239 {
240 Reference< XMultiServiceFactory > xDocFac( aThisDoc, UNO_QUERY );
241 if ( xDocFac.is() )
242 {
243 try
244 {
245 xDocFac->createInstance("ooo.vba.VBAGlobals");
246 }
247 catch(const Exception& )
248 {
249 // Ignore
250 }
251 }
252 }
253 pVBAGlobals = static_cast<SbUnoObject*>(Find( "VBAGlobals" , SbxClassType::DontCare ));
254 }
255 return pVBAGlobals.get();
256}
257
258// i#i68894#
259SbxVariable* StarBASIC::VBAFind( const OUString& rName, SbxClassType t )
260{
261 if( rName == "ThisComponent" )
262 {
263 return nullptr;
264 }
265 // rename to init globals
266 if ( getVBAGlobals( ) )
267 {
268 return pVBAGlobals->Find( rName, t );
269 }
270 return nullptr;
271}
272
273namespace {
274
275// Create array for conversion SFX <-> VB error code
276struct SFX_VB_ErrorItem
277{
278 sal_uInt16 nErrorVB;
279 ErrCode nErrorSFX;
280};
281
282}
283
284const SFX_VB_ErrorItem SFX_VB_ErrorTab[] =
285{
286 { 1, ERRCODE_BASIC_EXCEPTION }, // #87844 Map exception to error code 1
296 { 11, ERRCODE_BASIC_ZERODIV },
327 { 94, ERRCODE_BASIC_IS_NULL },
337 { 288, ERRCODE_BASIC_DDE_BUSY },
358 { 430, ERRCODE_BASIC_NO_OLE },
372 { 952, ERRCODE_BASIC_EXPECTED },
385 { 965, ERRCODE_BASIC_BAD_EXIT },
392 { 972, ERRCODE_BASIC_NO_IF },
407 { 1007, ERRCODE_BASIC_COMPAT },
408 { 0xFFFF, ErrCode(0xFFFFFFFFUL) } // End mark
409};
410
411// The StarBASIC factory is a hack. When a SbModule is created, its pointer
412// is saved and given to the following SbProperties/SbMethods. This restores
413// the Module-relationship. But it works only when a module is loaded.
414// Can cause troubles with separately loaded properties!
415
416SbxBaseRef SbiFactory::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator )
417{
418 if( nCreator == SBXCR_SBX )
419 {
420 switch( nSbxId )
421 {
422 case SBXID_BASIC:
423 return new StarBASIC( nullptr );
424 case SBXID_BASICMOD:
425 return new SbModule( "" );
426 case SBXID_BASICPROP:
427 return new SbProperty( "", SbxVARIANT, nullptr );
429 return new SbMethod( "", SbxVARIANT, nullptr );
430 case SBXID_JSCRIPTMOD:
431 return new SbJScriptModule;
433 return new SbJScriptMethod( SbxVARIANT );
434 }
435 }
436 return nullptr;
437}
438
439SbxObjectRef SbiFactory::CreateObject( const OUString& rClass )
440{
441 if( rClass.equalsIgnoreAsciiCase( "StarBASIC" ) )
442 {
443 return new StarBASIC( nullptr );
444 }
445 else if( rClass.equalsIgnoreAsciiCase( "StarBASICModule" ) )
446 {
447 return new SbModule( OUString() );
448 }
449 else if( rClass.equalsIgnoreAsciiCase( "Collection" ) )
450 {
451 return new BasicCollection( "Collection" );
452 }
453 else if( rClass.equalsIgnoreAsciiCase( "FileSystemObject" ) )
454 {
455 try
456 {
458 OUString aServiceName("ooo.vba.FileSystemObject");
459 Reference< XInterface > xInterface( xFactory->createInstance( aServiceName ), UNO_SET_THROW );
460 return new SbUnoObject( aServiceName, uno::Any( xInterface ) );
461 }
462 catch(const Exception& )
463 {
464 }
465 }
466 return nullptr;
467}
468
469
470SbxBaseRef SbOLEFactory::Create( sal_uInt16, sal_uInt32 )
471{
472 // Not supported
473 return nullptr;
474}
475
476SbxObjectRef SbOLEFactory::CreateObject( const OUString& rClassName )
477{
478 SbxObjectRef pRet = createOLEObject_Impl( rClassName );
479 return pRet;
480}
481
482
483// SbFormFactory, show user forms by: dim as new <user form name>
484
485SbxBaseRef SbFormFactory::Create( sal_uInt16, sal_uInt32 )
486{
487 // Not supported
488 return nullptr;
489}
490
491SbxObjectRef SbFormFactory::CreateObject( const OUString& rClassName )
492{
493 if( SbModule* pMod = GetSbData()->pMod )
494 {
495 if( SbxVariable* pVar = pMod->Find( rClassName, SbxClassType::Object ) )
496 {
497 if( SbUserFormModule* pFormModule = dynamic_cast<SbUserFormModule*>( pVar->GetObject() ) )
498 {
499 bool bInitState = pFormModule->getInitState();
500 if( bInitState )
501 {
502 // Not the first instantiate, reset
503 pFormModule->ResetApiObj( false/*bTriggerTerminateEvent*/ );
504 pFormModule->setInitState( false );
505 }
506 else
507 {
508 pFormModule->Load();
509 }
510 return pFormModule->CreateInstance();
511 }
512 }
513 }
514 return nullptr;
515}
516
517
518// SbTypeFactory
519
521{
522 SbxObjectRef pRet = new SbxObject( rTypeObj );
523 pRet->PutObject( pRet.get() );
524
525 // Copy the properties, not only the reference to them
526 SbxArray* pProps = pRet->GetProperties();
527 sal_uInt32 nCount = pProps->Count();
528 for( sal_uInt32 i = 0 ; i < nCount ; i++ )
529 {
530 SbxVariable* pVar = pProps->Get(i);
531 SbxProperty* pProp = dynamic_cast<SbxProperty*>( pVar );
532 if( pProp )
533 {
534 SbxProperty* pNewProp = new SbxProperty( *pProp );
535 SbxDataType eVarType = pVar->GetType();
536 if( eVarType & SbxARRAY )
537 {
538 SbxBase* pParObj = pVar->GetObject();
539 SbxDimArray* pSource = dynamic_cast<SbxDimArray*>( pParObj );
540 SbxDimArray* pDest = new SbxDimArray( pVar->GetType() );
541
542 pDest->setHasFixedSize( pSource && pSource->hasFixedSize() );
543 if (pSource && pSource->GetDims() && pSource->hasFixedSize())
544 {
545 sal_Int32 lb = 0;
546 sal_Int32 ub = 0;
547 for (sal_Int32 j = 1; j <= pSource->GetDims(); ++j)
548 {
549 pSource->GetDim(j, lb, ub);
550 pDest->AddDim(lb, ub);
551 }
552 }
553 else
554 {
555 pDest->unoAddDim(0, -1); // variant array
556 }
557 SbxFlagBits nSavFlags = pVar->GetFlags();
558 pNewProp->ResetFlag( SbxFlagBits::Fixed );
559 // need to reset the FIXED flag
560 // when calling PutObject ( because the type will not match Object )
561 pNewProp->PutObject( pDest );
562 pNewProp->SetFlags( nSavFlags );
563 }
564 if( eVarType == SbxOBJECT )
565 {
566 SbxBase* pObjBase = pVar->GetObject();
567 SbxObject* pSrcObj = dynamic_cast<SbxObject*>( pObjBase );
568 SbxObjectRef pDestObj;
569 if( pSrcObj != nullptr )
570 pDestObj = cloneTypeObjectImpl( *pSrcObj );
571 pNewProp->PutObject( pDestObj.get() );
572 }
573 pProps->PutDirect( pNewProp, i );
574 }
575 }
576 return pRet;
577}
578
579SbxBaseRef SbTypeFactory::Create( sal_uInt16, sal_uInt32 )
580{
581 // Not supported
582 return nullptr;
583}
584
585SbxObjectRef SbTypeFactory::CreateObject( const OUString& rClassName )
586{
587 SbxObjectRef pRet;
588 SbModule* pMod = GetSbData()->pMod;
589 if( pMod )
590 {
591 const SbxObject* pObj = pMod->FindType( rClassName );
592 if( pObj )
593 {
594 pRet = cloneTypeObjectImpl( *pObj );
595 }
596 }
597 return pRet;
598}
599
600SbxObjectRef createUserTypeImpl( const OUString& rClassName )
601{
602 SbxObjectRef pRetObj = GetSbData()->pTypeFac->CreateObject( rClassName );
603 return pRetObj;
604}
605
606
607SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
608 : SbModule( pClassModule->GetName() )
609 , mpClassModule( pClassModule )
610 , mbInitializeEventDone( false )
611{
612 aOUSource = pClassModule->aOUSource;
613 aComment = pClassModule->aComment;
614 // see comment in destructor about these two
615 pImage.reset(pClassModule->pImage.get());
616 pBreaks = pClassModule->pBreaks;
617
618 SetClassName( pClassModule->GetName() );
619
620 // Allow search only internally
621 ResetFlag( SbxFlagBits::GlobalSearch );
622
623 // Copy the methods from original class module
624 SbxArray* pClassMethods = pClassModule->GetMethods().get();
625 sal_uInt32 nMethodCount = pClassMethods->Count();
626 sal_uInt32 i;
627 for( i = 0 ; i < nMethodCount ; i++ )
628 {
629 SbxVariable* pVar = pClassMethods->Get(i);
630
631 // Exclude SbIfaceMapperMethod to copy them in a second step
632 SbIfaceMapperMethod* pIfaceMethod = dynamic_cast<SbIfaceMapperMethod*>( pVar );
633 if( !pIfaceMethod )
634 {
635 SbMethod* pMethod = dynamic_cast<SbMethod*>( pVar );
636 if( pMethod )
637 {
638 SbxFlagBits nFlags_ = pMethod->GetFlags();
640 SbMethod* pNewMethod = new SbMethod( *pMethod );
641 pNewMethod->ResetFlag( SbxFlagBits::NoBroadcast );
642 pMethod->SetFlags( nFlags_ );
643 pNewMethod->pMod = this;
644 pNewMethod->SetParent( this );
645 pMethods->PutDirect( pNewMethod, i );
646 StartListening(pNewMethod->GetBroadcaster(), DuplicateHandling::Prevent);
647 }
648 }
649 }
650
651 // Copy SbIfaceMapperMethod in a second step to ensure that
652 // the corresponding base methods have already been copied
653 for( i = 0 ; i < nMethodCount ; i++ )
654 {
655 SbxVariable* pVar = pClassMethods->Get(i);
656
657 SbIfaceMapperMethod* pIfaceMethod = dynamic_cast<SbIfaceMapperMethod*>( pVar );
658 if( pIfaceMethod )
659 {
660 SbMethod* pImplMethod = pIfaceMethod->getImplMethod();
661 if( !pImplMethod )
662 {
663 OSL_FAIL( "No ImplMethod" );
664 continue;
665 }
666
667 // Search for own copy of ImplMethod
668 SbxVariable* p = pMethods->Find( pImplMethod->GetName(), SbxClassType::Method );
669 SbMethod* pImplMethodCopy = dynamic_cast<SbMethod*>( p );
670 if( !pImplMethodCopy )
671 {
672 OSL_FAIL( "Found no ImplMethod copy" );
673 continue;
674 }
675 SbIfaceMapperMethod* pNewIfaceMethod =
676 new SbIfaceMapperMethod( pIfaceMethod->GetName(), pImplMethodCopy );
677 pMethods->PutDirect( pNewIfaceMethod, i );
678 }
679 }
680
681 // Copy the properties from original class module
682 SbxArray* pClassProps = pClassModule->GetProperties();
683 sal_uInt32 nPropertyCount = pClassProps->Count();
684 for( i = 0 ; i < nPropertyCount ; i++ )
685 {
686 SbxVariable* pVar = pClassProps->Get(i);
687 SbProcedureProperty* pProcedureProp = dynamic_cast<SbProcedureProperty*>( pVar );
688 if( pProcedureProp )
689 {
690 SbxFlagBits nFlags_ = pProcedureProp->GetFlags();
691 pProcedureProp->SetFlag( SbxFlagBits::NoBroadcast );
693 ( pProcedureProp->GetName(), pProcedureProp->GetType() );
694 pNewProp->SetFlags( nFlags_ ); // Copy flags
695 pNewProp->ResetFlag( SbxFlagBits::NoBroadcast ); // except the Broadcast if it was set
696 pProcedureProp->SetFlags( nFlags_ );
697 pProps->PutDirect( pNewProp, i );
698 StartListening(pNewProp->GetBroadcaster(), DuplicateHandling::Prevent);
699 }
700 else
701 {
702 SbxProperty* pProp = dynamic_cast<SbxProperty*>( pVar );
703 if( pProp )
704 {
705 SbxFlagBits nFlags_ = pProp->GetFlags();
707 SbxProperty* pNewProp = new SbxProperty( *pProp );
708
709 // Special handling for modules instances and collections, they need
710 // to be instantiated, otherwise all refer to the same base object
711 SbxDataType eVarType = pProp->GetType();
712 if( eVarType == SbxOBJECT )
713 {
714 SbxBase* pObjBase = pProp->GetObject();
715 SbxObject* pObj = dynamic_cast<SbxObject*>( pObjBase );
716 if( pObj != nullptr )
717 {
718 const OUString& aObjClass = pObj->GetClassName();
719
720 SbClassModuleObject* pClassModuleObj = dynamic_cast<SbClassModuleObject*>( pObjBase );
721 if( pClassModuleObj != nullptr )
722 {
723 SbModule* pLclClassModule = pClassModuleObj->getClassModule();
724 SbClassModuleObject* pNewObj = new SbClassModuleObject( pLclClassModule );
725 pNewObj->SetName( pProp->GetName() );
726 pNewObj->SetParent( pLclClassModule->pParent );
727 pNewProp->PutObject( pNewObj );
728 }
729 else if( aObjClass.equalsIgnoreAsciiCase( "Collection" ) )
730 {
731 BasicCollection* pNewCollection = new BasicCollection( "Collection" );
732 pNewCollection->SetName( pProp->GetName() );
733 pNewCollection->SetParent( pClassModule->pParent );
734 pNewProp->PutObject( pNewCollection );
735 }
736 }
737 }
738
740 pNewProp->SetParent( this );
741 pProps->PutDirect( pNewProp, i );
742 pProp->SetFlags( nFlags_ );
743 }
744 }
745 }
746 SetModuleType( ModuleType::CLASS );
747 mbVBASupport = pClassModule->mbVBASupport;
748}
749
750SbClassModuleObject::~SbClassModuleObject()
751{
752 // do not trigger termination event when document is already closed
754 if( StarBASIC* pDocBasic = lclGetDocBasicForModule( this ) )
755 if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) )
756 if( !pDocBasicItem->isDocClosed() )
757 triggerTerminateEvent();
758
759 // prevent the base class destructor from deleting this because:
760 // coverity[leaked_storage] - we do not actually own it
761 pImage.release();
762 pBreaks = nullptr;
763}
764
765void SbClassModuleObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
766{
767 handleProcedureProperties( rBC, rHint );
768}
769
770SbxVariable* SbClassModuleObject::Find( const OUString& rName, SbxClassType t )
771{
772 SbxVariable* pRes = SbxObject::Find( rName, t );
773 if( pRes )
774 {
775 triggerInitializeEvent();
776
777 SbIfaceMapperMethod* pIfaceMapperMethod = dynamic_cast<SbIfaceMapperMethod*>( pRes );
778 if( pIfaceMapperMethod )
779 {
780 pRes = pIfaceMapperMethod->getImplMethod();
782 }
783 }
784 return pRes;
785}
786
787void SbClassModuleObject::triggerInitializeEvent()
788{
789 if( mbInitializeEventDone )
790 {
791 return;
792 }
793
794 mbInitializeEventDone = true;
795
796 // Search method
797 SbxVariable* pMeth = SbxObject::Find("Class_Initialize", SbxClassType::Method);
798 if( pMeth )
799 {
800 SbxValues aVals;
801 pMeth->Get( aVals );
802 }
803}
804
805void SbClassModuleObject::triggerTerminateEvent()
806{
807 if( !mbInitializeEventDone || GetSbData()->bRunInit )
808 {
809 return;
810 }
811 // Search method
812 SbxVariable* pMeth = SbxObject::Find("Class_Terminate", SbxClassType::Method );
813 if( pMeth )
814 {
815 SbxValues aVals;
816 pMeth->Get( aVals );
817 }
818}
819
820
822{
823 mxIfaces = new SbxArray();
824}
825
827{
828 mxIfaces->Clear();
829 maRequiredTypes.clear();
830}
831
833{
834 xClassModules = new SbxObject( OUString() );
835}
836
838{}
839
841{
842 SbxObjectRef xToUseClassModules = xClassModules;
843
844 if( StarBASIC* pDocBasic = lclGetDocBasicForModule( pClassModule ) )
845 if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) )
846 xToUseClassModules = pDocBasicItem->getClassModules();
847
848 SbxObject* pParent = pClassModule->GetParent();
849 xToUseClassModules->Insert( pClassModule );
850 pClassModule->SetParent( pParent );
851}
852
854{
855 xClassModules->Remove( pClassModule );
856}
857
858SbxBaseRef SbClassFactory::Create( sal_uInt16, sal_uInt32 )
859{
860 // Not supported
861 return nullptr;
862}
863
864SbxObjectRef SbClassFactory::CreateObject( const OUString& rClassName )
865{
866 SbxObjectRef xToUseClassModules = xClassModules;
867
868 if( SbModule* pMod = GetSbData()->pMod )
869 {
870 if( StarBASIC* pDocBasic = lclGetDocBasicForModule( pMod ) )
871 {
872 if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) )
873 {
874 xToUseClassModules = pDocBasicItem->getClassModules();
875 }
876 }
877 }
878 SbxVariable* pVar = xToUseClassModules->Find( rClassName, SbxClassType::Object );
879 SbxObjectRef pRet;
880 if( pVar )
881 {
882 SbModule* pVarMod = static_cast<SbModule*>(pVar);
883 pRet = new SbClassModuleObject( pVarMod );
884 }
885 return pRet;
886}
887
888SbModule* SbClassFactory::FindClass( const OUString& rClassName )
889{
890 SbxVariable* pVar = xClassModules->Find( rClassName, SbxClassType::DontCare );
891 SbModule* pMod = pVar ? static_cast<SbModule*>(pVar) : nullptr;
892 return pMod;
893}
894
895StarBASIC::StarBASIC( StarBASIC* p, bool bIsDocBasic )
896 : SbxObject("StarBASIC"), bDocBasic( bIsDocBasic )
897{
898 SetParent( p );
899 bNoRtl = bBreak = false;
900 bVBAEnabled = false;
901
902 if( !GetSbData()->nInst++ )
903 {
904 GetSbData()->pSbFac.emplace();
905 AddFactory( &*GetSbData()->pSbFac );
906 GetSbData()->pTypeFac.emplace();
907 AddFactory( &*GetSbData()->pTypeFac );
908 GetSbData()->pClassFac.reset(new SbClassFactory);
909 AddFactory( GetSbData()->pClassFac.get() );
910 GetSbData()->pOLEFac.emplace();
911 AddFactory( &*GetSbData()->pOLEFac );
912 GetSbData()->pFormFac.emplace();
913 AddFactory( &*GetSbData()->pFormFac );
914 GetSbData()->pUnoFac.emplace();
915 AddFactory( &*GetSbData()->pUnoFac );
916 }
917 pRtl = new SbiStdObject(SB_RTLNAME, this );
918 // Search via StarBasic is always global
920 pVBAGlobals = nullptr;
921 bQuit = false;
922
923 if( bDocBasic )
924 {
925 lclInsertDocBasicItem( *this );
926 }
927}
928
929// #51727 Override SetModified so that the modified state
930// is not given to the parent
932{
934}
935
937{
938 // Needs to be first action as it can trigger events
940
941 if( !--GetSbData()->nInst )
942 {
943 RemoveFactory( &*GetSbData()->pSbFac );
944 GetSbData()->pSbFac.reset();
945 RemoveFactory( &*GetSbData()->pUnoFac );
946 GetSbData()->pUnoFac.reset();
947 RemoveFactory( &*GetSbData()->pTypeFac );
948 GetSbData()->pTypeFac.reset();
949 RemoveFactory( GetSbData()->pClassFac.get() );
950 GetSbData()->pClassFac.reset();
951 RemoveFactory( &*GetSbData()->pOLEFac );
952 GetSbData()->pOLEFac.reset();
953 RemoveFactory( &*GetSbData()->pFormFac );
954 GetSbData()->pFormFac.reset();
955
957 {
959 SbiGlobals::pGlobals = nullptr;
960 }
961 }
962 else if( bDocBasic )
963 {
964 ErrCode eOld = SbxBase::GetError();
965
966 lclRemoveDocBasicItem( *this );
967
969 if( eOld != ERRCODE_NONE )
970 {
971 SbxBase::SetError( eOld );
972 }
973 }
974
975 // #100326 Set Parent NULL in registered listeners
976 if( xUnoListeners.is() )
977 {
978 sal_uInt32 uCount = xUnoListeners->Count();
979 for( sal_uInt32 i = 0 ; i < uCount ; i++ )
980 {
981 SbxVariable* pListenerObj = xUnoListeners->Get(i);
982 pListenerObj->SetParent( nullptr );
983 }
984 xUnoListeners = nullptr;
985 }
986
988}
989
991{
992 if( this != pDeletedBasic )
993 {
994 for( const auto& pModule: pModules)
995 {
996 pModule->ClearVarsDependingOnDeletedBasic( pDeletedBasic );
997 }
998 }
999
1000 for (sal_uInt32 nObj = 0; nObj < pObjs->Count(); nObj++)
1001 {
1002 SbxVariable* pVar = pObjs->Get(nObj);
1003 StarBASIC* pBasic = dynamic_cast<StarBASIC*>( pVar );
1004 if( pBasic && pBasic != pDeletedBasic )
1005 {
1006 pBasic->implClearDependingVarsOnDelete( pDeletedBasic );
1007 }
1008 }
1009}
1010
1011
1012SbModule* StarBASIC::MakeModule( const OUString& rName, const OUString& rSrc )
1013{
1014 ModuleInfo aInfo;
1015 aInfo.ModuleType = ModuleType::NORMAL;
1016 return MakeModule( rName, aInfo, rSrc );
1017}
1018SbModule* StarBASIC::MakeModule( const OUString& rName, const ModuleInfo& mInfo, const OUString& rSrc )
1019{
1020
1021 SAL_INFO(
1022 "basic",
1023 "create module " << rName << " type mInfo " << mInfo.ModuleType);
1024 SbModule* p = nullptr;
1025 switch ( mInfo.ModuleType )
1026 {
1027 case ModuleType::DOCUMENT:
1028 // In theory we should be able to create Object modules
1029 // in ordinary basic ( in vba mode thought these are create
1030 // by the application/basic and not by the user )
1031 p = new SbObjModule( rName, mInfo, isVBAEnabled() );
1032 break;
1033 case ModuleType::CLASS:
1034 p = new SbModule( rName, isVBAEnabled() );
1035 p->SetModuleType( ModuleType::CLASS );
1036 break;
1037 case ModuleType::FORM:
1038 p = new SbUserFormModule( rName, mInfo, isVBAEnabled() );
1039 break;
1040 default:
1041 p = new SbModule( rName, isVBAEnabled() );
1042 break;
1043 }
1044 p->SetSource32( rSrc );
1045 p->SetParent( this );
1046 pModules.emplace_back(p);
1047 SetModified( true );
1048 return p;
1049}
1050
1052{
1053 if( auto pModule = dynamic_cast<SbModule*>(pVar) )
1054 {
1055 pModules.emplace_back(pModule);
1056 pVar->SetParent( this );
1057 StartListening(pVar->GetBroadcaster(), DuplicateHandling::Prevent);
1058 }
1059 else
1060 {
1061 bool bWasModified = IsModified();
1062 SbxObject::Insert( pVar );
1063 if( !bWasModified && pVar->IsSet( SbxFlagBits::DontStore ) )
1064 {
1065 SetModified( false );
1066 }
1067 }
1068}
1069
1071{
1072 SbModule* pModule = dynamic_cast<SbModule*>(pVar);
1073 if( pModule )
1074 {
1075 // #87540 Can be last reference!
1076 SbModuleRef xVar = pModule;
1077 pModules.erase(std::remove(pModules.begin(), pModules.end(), xVar));
1078 pVar->SetParent( nullptr );
1079 EndListening( pVar->GetBroadcaster() );
1080 }
1081 else
1082 {
1083 SbxObject::Remove( pVar );
1084 }
1085}
1086
1088{
1089 pModules.clear();
1090}
1091
1092SbModule* StarBASIC::FindModule( std::u16string_view rName )
1093{
1094 for (const auto& pModule: pModules)
1095 {
1096 if( pModule->GetName().equalsIgnoreAsciiCase( rName ) )
1097 {
1098 return pModule.get();
1099 }
1100 }
1101 return nullptr;
1102}
1103
1104
1106{
1110
1112 : m_pModule( nullptr )
1113 , m_bProcessing( false )
1114 , m_bRunInitDone( false )
1115 {}
1117 : m_pModule( pModule )
1118 , m_bProcessing( false )
1119 , m_bRunInitDone( false )
1120 {}
1121};
1122
1123// Derive from unordered_map type instead of typedef
1124// to allow forward declaration in sbmod.hxx
1126 std::unordered_map< OUString, ClassModuleRunInitItem >
1127{};
1128
1130{
1131 rItem.m_bProcessing = true;
1132
1133 SbModule* pModule = rItem.m_pModule;
1134 if( pModule->pClassData != nullptr )
1135 {
1136 std::vector< OUString >& rReqTypes = pModule->pClassData->maRequiredTypes;
1137 for( const auto& rStr : rReqTypes )
1138 {
1139 // Is required type a class module?
1140 ModuleInitDependencyMap::iterator itFind = rMap.find( rStr );
1141 if( itFind != rMap.end() )
1142 {
1143 ClassModuleRunInitItem& rParentItem = itFind->second;
1144 if( rParentItem.m_bProcessing )
1145 {
1146 // TODO: raise error?
1147 OSL_FAIL( "Cyclic module dependency detected" );
1148 continue;
1149 }
1150
1151 if( !rParentItem.m_bRunInitDone )
1152 {
1153 implProcessModuleRunInit( rMap, rParentItem );
1154 }
1155 }
1156 }
1157 }
1158
1159 pModule->RunInit();
1160 rItem.m_bRunInitDone = true;
1161 rItem.m_bProcessing = false;
1162}
1163
1164// Run Init-Code of all modules (including inserted libraries)
1165void StarBASIC::InitAllModules( StarBASIC const * pBasicNotToInit )
1166{
1167 SolarMutexGuard guard;
1168
1169 // Init own modules
1170 for (const auto& pModule: pModules)
1171 {
1172 pModule->Compile();
1173 }
1174 // compile modules first then RunInit ( otherwise there is
1175 // can be order dependency, e.g. classmodule A has a member
1176 // of type classmodule B and classmodule B hasn't been compiled yet )
1177
1178 // Consider required types to init in right order. Class modules
1179 // that are required by other modules have to be initialized first.
1181 for (const auto& pModule: pModules)
1182 {
1183 OUString aModuleName = pModule->GetName();
1184 if( pModule->isProxyModule() )
1185 {
1186 aMIDMap[aModuleName] = ClassModuleRunInitItem( pModule.get() );
1187 }
1188 }
1189
1190 for (auto & elem : aMIDMap)
1191 {
1192 ClassModuleRunInitItem& rItem = elem.second;
1193 SbModule::implProcessModuleRunInit( aMIDMap, rItem );
1194 }
1195
1196 // Call RunInit on standard modules
1197 for (const auto& pModule: pModules)
1198 {
1199 if( !pModule->isProxyModule() )
1200 {
1201 pModule->RunInit();
1202 }
1203 }
1204
1205 // Check all objects if they are BASIC,
1206 // if yes initialize
1207 for (sal_uInt32 nObj = 0; nObj < pObjs->Count(); nObj++)
1208 {
1209 SbxVariable* pVar = pObjs->Get(nObj);
1210 StarBASIC* pBasic = dynamic_cast<StarBASIC*>( pVar );
1211 if( pBasic && pBasic != pBasicNotToInit )
1212 {
1213 pBasic->InitAllModules();
1214 }
1215 }
1216}
1217
1218// #88329 Put modules back to not initialised state to
1219// force reinitialisation at next start
1221{
1222 // Deinit own modules
1223 for (const auto& pModule: pModules)
1224 {
1225 if( pModule->pImage && !pModule->isProxyModule() && dynamic_cast<SbObjModule*>( pModule.get()) == nullptr )
1226 {
1227 pModule->pImage->bInit = false;
1228 }
1229 }
1230
1231 for (sal_uInt32 nObj = 0; nObj < pObjs->Count(); nObj++)
1232 {
1233 SbxVariable* pVar = pObjs->Get(nObj);
1234 StarBASIC* pBasic = dynamic_cast<StarBASIC*>( pVar );
1235 if( pBasic )
1236 {
1237 pBasic->DeInitAllModules();
1238 }
1239 }
1240}
1241
1242// This implementation at first searches within the runtime library,
1243// then it looks for an element within one module. This module can be
1244// a public var or an entrypoint. If it is not found and we look for a
1245// method and a module with the given name is found the search continues
1246// for entrypoint "Main".
1247// If this fails again a conventional search over objects is performed.
1248SbxVariable* StarBASIC::Find( const OUString& rName, SbxClassType t )
1249{
1250 SbxVariable* pRes = nullptr;
1251 SbModule* pNamed = nullptr;
1252 // "Extended" search in Runtime Lib
1253 // but only if SbiRuntime has not set the flag
1254 if( !bNoRtl )
1255 {
1257 {
1258 if( rName.equalsIgnoreAsciiCase( SB_RTLNAME ) )
1259 {
1260 pRes = pRtl.get();
1261 }
1262 }
1263 if( !pRes )
1264 {
1265 pRes = static_cast<SbiStdObject*>(pRtl.get())->Find( rName, t );
1266 }
1267 if( pRes )
1268 {
1270 }
1271 }
1272 // Search module
1273 if( !pRes )
1274 {
1275 for (const auto& pModule: pModules)
1276 {
1277 if( pModule->IsVisible() )
1278 {
1279 // Remember module for Main() call
1280 // or is the name equal?!?
1281 if( pModule->GetName().equalsIgnoreAsciiCase( rName ) )
1282 {
1284 {
1285 pRes = pModule.get(); break;
1286 }
1287 pNamed = pModule.get();
1288 }
1289 // Only variables qualified by the Module Name e.g. Sheet1.foo
1290 // should work for Document && Class type Modules
1291 sal_Int32 nType = pModule->GetModuleType();
1292 if ( nType == ModuleType::DOCUMENT || nType == ModuleType::FORM )
1293 {
1294 continue;
1295 }
1296 // otherwise check if the element is available
1297 // unset GBLSEARCH-Flag (due to recursion)
1298 SbxFlagBits nGblFlag = pModule->GetFlags() & SbxFlagBits::GlobalSearch;
1300 pRes = pModule->Find( rName, t );
1301 pModule->SetFlag( nGblFlag );
1302 if( pRes )
1303 {
1304 break;
1305 }
1306 }
1307 }
1308 }
1309 static constexpr OUStringLiteral aMainStr(u"Main");
1310 if( !pRes && pNamed && ( t == SbxClassType::Method || t == SbxClassType::DontCare ) &&
1311 !pNamed->GetName().equalsIgnoreAsciiCase( aMainStr ) )
1312 {
1313 pRes = pNamed->Find( aMainStr, SbxClassType::Method );
1314 }
1315 if( !pRes )
1316 {
1317 pRes = SbxObject::Find( rName, t );
1318 }
1319 return pRes;
1320}
1321
1322bool StarBASIC::Call( const OUString& rName, SbxArray* pParam )
1323{
1324 bool bRes = SbxObject::Call( rName, pParam );
1325 if( !bRes )
1326 {
1327 ErrCode eErr = SbxBase::GetError();
1328 if( eErr != ERRCODE_NONE )
1329 {
1330 RTError(eErr, SbxBase::GetErrorMsg(), 0, 0, 0);
1331 }
1333 }
1334 return bRes;
1335}
1336
1337// Find method via name (e.g. query via BASIC IDE)
1339{
1340 if( !GetSbData()->pInst )
1341 {
1342 return nullptr;
1343 }
1344 if( !GetSbData()->pInst->pRun )
1345 {
1346 return nullptr;
1347 }
1348 return GetSbData()->pInst->pRun->FindElementExtern( rName );
1349}
1350
1352{
1353 Stop();
1354 bQuit = true;
1355}
1356
1358{
1360 if( p )
1361 p->Stop();
1362}
1363
1365{
1366 return GetSbData()->pInst != nullptr;
1367}
1368
1370{
1371 if( GetSbData()->pInst )
1372 {
1373 return GetSbData()->pInst->GetCaller( nLevel );
1374 }
1375 else
1376 {
1377 return nullptr;
1378 }
1379}
1380
1382{
1383 if( GetSbData()->pInst && !GetSbData()->bCompilerError )
1384 {
1385 return GetSbData()->pInst->GetActiveModule();
1386 }
1387 else
1388 {
1389 return GetSbData()->pCompMod;
1390 }
1391}
1392
1393BasicDebugFlags StarBASIC::BreakPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
1394{
1395 SetErrorData( ERRCODE_NONE, l, c1, c2 );
1396 bBreak = true;
1397 if( GetSbData()->aBreakHdl.IsSet() )
1398 {
1399 return GetSbData()->aBreakHdl.Call( this );
1400 }
1401 else
1402 {
1403 return BreakHdl();
1404 }
1405}
1406
1407BasicDebugFlags StarBASIC::StepPoint( sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
1408{
1409 SetErrorData( ERRCODE_NONE, l, c1, c2 );
1410 bBreak = false;
1411 if( GetSbData()->aBreakHdl.IsSet() )
1412 {
1413 return GetSbData()->aBreakHdl.Call( this );
1414 }
1415 else
1416 {
1417 return BreakHdl();
1418 }
1419}
1420
1422{
1424}
1425
1426// Calls for error handler and break handler
1427sal_uInt16 StarBASIC::GetLine() { return GetSbData()->nLine; }
1428sal_uInt16 StarBASIC::GetCol1() { return GetSbData()->nCol1; }
1429sal_uInt16 StarBASIC::GetCol2() { return GetSbData()->nCol2; }
1430
1431// Specific to error handler
1433const OUString& StarBASIC::GetErrorText() { return GetSbData()->aErrMsg; }
1434
1435// From 1996-03-29:
1436// The mapping between the old and the new error codes take place by searching
1437// through the table SFX_VB_ErrorTab[]. This is indeed not with good performance,
1438// but it consumes much less memory than corresponding switch blocks.
1439// Because the conversion of error codes has not to be fast. There is no
1440// binary search by VB Error -> Error SFX.
1441
1442// Map back new error codes to old, Sbx-compatible
1444{
1445 sal_uInt16 nRet = 0;
1446
1448 {
1449 if ( nError == ERRCODE_BASIC_ARRAY_FIX )
1450 return 10;
1451 else if ( nError == ERRCODE_BASIC_STRING_OVERFLOW )
1452 return 14;
1453 else if ( nError == ERRCODE_BASIC_EXPR_TOO_COMPLEX )
1454 return 16;
1455 else if ( nError == ERRCODE_BASIC_OPER_NOT_PERFORM )
1456 return 17;
1457 else if ( nError == ERRCODE_BASIC_TOO_MANY_DLL )
1458 return 47;
1459 else if ( nError == ERRCODE_BASIC_LOOP_NOT_INIT )
1460 return 92;
1461 else
1462 nRet = 0;
1463 }
1464
1465 // search loop
1466 const SFX_VB_ErrorItem* pErrItem;
1467 sal_uInt16 nIndex = 0;
1468 do
1469 {
1470 pErrItem = SFX_VB_ErrorTab + nIndex;
1471 if( pErrItem->nErrorSFX == nError )
1472 {
1473 nRet = pErrItem->nErrorVB;
1474 break;
1475 }
1476 nIndex++;
1477 }
1478 while( pErrItem->nErrorVB != 0xFFFF ); // up to end mark
1479 return nRet;
1480}
1481
1483{
1484 ErrCode nRet = ERRCODE_NONE;
1485
1487 {
1488 switch( nError )
1489 {
1490 case 1:
1491 case 2:
1492 case 4:
1493 case 8:
1494 case 12:
1495 case 73:
1496 return ERRCODE_NONE;
1497 case 10:
1499 case 14:
1501 case 16:
1503 case 17:
1505 case 47:
1507 case 92:
1509 default:
1510 nRet = ERRCODE_NONE;
1511 }
1512 }
1513 const SFX_VB_ErrorItem* pErrItem;
1514 sal_uInt16 nIndex = 0;
1515 do
1516 {
1517 pErrItem = SFX_VB_ErrorTab + nIndex;
1518 if( pErrItem->nErrorVB == nError )
1519 {
1520 nRet = pErrItem->nErrorSFX;
1521 break;
1522 }
1523 else if( pErrItem->nErrorVB > nError )
1524 {
1525 break; // couldn't found anymore
1526 }
1527 nIndex++;
1528 }
1529 while( pErrItem->nErrorVB != 0xFFFF ); // up to end mark
1530 return nRet;
1531}
1532
1533// set Error- / Break-data
1534void StarBASIC::SetErrorData( ErrCode nCode, sal_uInt16 nLine,
1535 sal_uInt16 nCol1, sal_uInt16 nCol2 )
1536{
1537 SbiGlobals& aGlobals = *GetSbData();
1538 aGlobals.nCode = nCode;
1539 aGlobals.nLine = nLine;
1540 aGlobals.nCol1 = nCol1;
1541 aGlobals.nCol2 = nCol2;
1542}
1543
1544void StarBASIC::MakeErrorText( ErrCode nId, std::u16string_view aMsg )
1545{
1546 SolarMutexGuard aSolarGuard;
1547 sal_uInt16 nOldID = GetVBErrorCode( nId );
1548
1549 TranslateId pErrorMsg;
1550 for (std::pair<TranslateId, ErrCode> const *pItem = RID_BASIC_START; pItem->second; ++pItem)
1551 {
1552 if (nId == pItem->second)
1553 {
1554 pErrorMsg = pItem->first;
1555 break;
1556 }
1557 }
1558
1559 if (pErrorMsg)
1560 {
1561 // merge message with additional text
1562 OUString sError = BasResId(pErrorMsg);
1563 OUStringBuffer aMsg1(sError);
1564 // replace argument placeholder with %s
1565 OUString aSrgStr( "$(ARG1)" );
1566 sal_Int32 nResult = sError.indexOf(aSrgStr);
1567
1568 if( nResult >= 0 )
1569 {
1570 aMsg1.remove(nResult, aSrgStr.getLength());
1571 aMsg1.insert(nResult, aMsg);
1572 }
1573 else if (!aMsg.empty())
1574 {
1575 // tdf#123144 - create a meaningful error message
1576 aMsg1 = BasResId(STR_ADDITIONAL_INFO)
1577 .replaceFirst("$ERR", aMsg1)
1578 .replaceFirst("$MSG", aMsg);
1579 }
1580 GetSbData()->aErrMsg = aMsg1.makeStringAndClear();
1581 }
1582 // tdf#123144 - don't use an artificial error message if there is a custom one
1583 else if (!aMsg.empty())
1584 {
1585 GetSbData()->aErrMsg = aMsg;
1586 }
1587 else if( nOldID != 0 )
1588 {
1589 OUString aStdMsg = "Error " + OUString::number(nOldID) +
1590 ": No error text available!";
1591 GetSbData()->aErrMsg = aStdMsg;
1592 }
1593 else
1594 {
1595 GetSbData()->aErrMsg.clear();
1596 }
1597}
1598
1599bool StarBASIC::CError( ErrCode code, const OUString& rMsg,
1600 sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
1601{
1602 SolarMutexGuard aSolarGuard;
1603
1604 // compiler error during runtime -> stop program
1605 if( IsRunning() )
1606 {
1607 // #109018 Check if running Basic is affected
1608 StarBASIC* pStartedBasic = GetSbData()->pInst->GetBasic();
1609 if( pStartedBasic != this )
1610 {
1611 return false;
1612 }
1613 Stop();
1614 }
1615
1616 // set flag, so that GlobalRunInit notice the error
1617 GetSbData()->bGlobalInitErr = true;
1618
1619 // tinker the error message
1620 MakeErrorText( code, rMsg );
1621
1622 // Implementation of the code for the string transport to SFX-Error
1623 if( !rMsg.isEmpty() )
1624 {
1625 code = *new StringErrorInfo( code, rMsg );
1626 }
1627 SetErrorData( code, l, c1, c2 );
1628 GetSbData()->bCompilerError = true;
1629 bool bRet;
1630 if( GetSbData()->aErrHdl.IsSet() )
1631 {
1632 bRet = GetSbData()->aErrHdl.Call( this );
1633 }
1634 else
1635 {
1636 bRet = ErrorHdl();
1637 }
1638 GetSbData()->bCompilerError = false; // only true for error handler
1639 return bRet;
1640}
1641
1642bool StarBASIC::RTError( ErrCode code, const OUString& rMsg, sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
1643{
1644 SolarMutexGuard aSolarGuard;
1645
1646 ErrCode c = code;
1647 if( c.GetClass() == ErrCodeClass::Compiler )
1648 {
1649 c = ERRCODE_NONE;
1650 }
1651 MakeErrorText( c, rMsg );
1652
1653 // Implementation of the code for the string transport to SFX-Error
1654 if( !rMsg.isEmpty() )
1655 {
1656 // very confusing, even though MakeErrorText sets up the error text
1657 // seems that this is not used ( if rMsg already has content )
1658 // In the case of VBA MakeErrorText also formats the error to be a little more
1659 // like vba ( adds an error number etc )
1661 {
1662 OUString aTmp = "\'" + OUString::number(SbxErrObject::getUnoErrObject()->getNumber()) +
1663 "\'\n" + (!GetSbData()->aErrMsg.isEmpty() ? GetSbData()->aErrMsg : rMsg);
1664 code = *new StringErrorInfo( code, aTmp );
1665 }
1666 else
1667 {
1668 code = *new StringErrorInfo( code, rMsg );
1669 }
1670 }
1671
1672 SetErrorData( code, l, c1, c2 );
1673 if( GetSbData()->aErrHdl.IsSet() )
1674 {
1675 return GetSbData()->aErrHdl.Call( this );
1676 }
1677 else
1678 {
1679 return ErrorHdl();
1680 }
1681}
1682
1683void StarBASIC::Error( ErrCode n, const OUString& rMsg )
1684{
1685 if( GetSbData()->pInst )
1686 {
1687 GetSbData()->pInst->Error( n, rMsg );
1688 }
1689}
1690
1692{
1693 if( GetSbData()->pInst )
1694 {
1695 GetSbData()->pInst->FatalError( n );
1696 }
1697}
1698
1699void StarBASIC::FatalError( ErrCode _errCode, const OUString& _details )
1700{
1701 if( GetSbData()->pInst )
1702 {
1703 GetSbData()->pInst->FatalError( _errCode, _details );
1704 }
1705}
1706
1708{
1709 if( GetSbData()->pInst )
1710 {
1711 return GetSbData()->pInst->GetErr();
1712 }
1713 else
1714 {
1715 return ERRCODE_NONE;
1716 }
1717}
1718
1719// make the additional message for the RTL function error accessible
1721{
1722 if( GetSbData()->pInst )
1723 {
1724 return GetSbData()->pInst->GetErrorMsg();
1725 }
1726 else
1727 {
1728 return OUString();
1729 }
1730}
1731
1733{
1734 if( GetSbData()->pInst )
1735 {
1736 return GetSbData()->pInst->GetErl();
1737 }
1738 else
1739 {
1740 return 0;
1741 }
1742}
1743
1745{
1746 return aErrorHdl.Call( this );
1747}
1748
1750{
1751 return GetSbData()->aErrHdl;
1752}
1753
1755{
1756 GetSbData()->aErrHdl = rLink;
1757}
1758
1760{
1761 GetSbData()->aBreakHdl = rLink;
1762}
1763
1765{
1766 if( !xUnoListeners.is() )
1767 {
1768 xUnoListeners = new SbxArray();
1769 }
1770 return xUnoListeners;
1771}
1772
1773
1774bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
1775{
1776 if( !SbxObject::LoadData( r, nVer ) )
1777 {
1778 return false;
1779 }
1780 // #95459 Delete dialogs, otherwise endless recursion
1781 // in SbxVariable::GetType() if dialogs are accessed
1782 sal_uInt32 nObjCount = pObjs->Count();
1783 std::unique_ptr<SbxVariable*[]> ppDeleteTab(new SbxVariable*[ nObjCount ]);
1784 sal_uInt32 nObj;
1785
1786 for( nObj = 0 ; nObj < nObjCount ; nObj++ )
1787 {
1788 SbxVariable* pVar = pObjs->Get(nObj);
1789 StarBASIC* pBasic = dynamic_cast<StarBASIC*>( pVar );
1790 ppDeleteTab[nObj] = pBasic ? nullptr : pVar;
1791 }
1792 for( nObj = 0 ; nObj < nObjCount ; nObj++ )
1793 {
1794 SbxVariable* pVar = ppDeleteTab[nObj];
1795 if( pVar )
1796 {
1797 pObjs->Remove( pVar );
1798 }
1799 }
1800 ppDeleteTab.reset();
1801
1802 sal_uInt16 nMod(0);
1803 pModules.clear();
1804 r.ReadUInt16( nMod );
1805 const size_t nMinSbxSize(14);
1806 const size_t nMaxPossibleEntries = r.remainingSize() / nMinSbxSize;
1807 if (nMod > nMaxPossibleEntries)
1808 {
1809 nMod = nMaxPossibleEntries;
1810 SAL_WARN("basic", "Parsing error: " << nMaxPossibleEntries <<
1811 " max possible entries, but " << nMod << " claimed, truncating");
1812 }
1813 for (sal_uInt16 i = 0; i < nMod; ++i)
1814 {
1815 SbxBaseRef pBase = SbxBase::Load( r );
1816 SbModule* pMod = dynamic_cast<SbModule*>(pBase.get());
1817 if( !pMod )
1818 {
1819 return false;
1820 }
1821 else if( dynamic_cast<const SbJScriptModule*>( pMod) != nullptr )
1822 {
1823 // assign Ref, so that pMod will be deleted
1824 SbModuleRef xDeleteRef = pMod;
1825 }
1826 else
1827 {
1828 pMod->SetParent( this );
1829 pModules.emplace_back(pMod );
1830 }
1831 }
1832 // HACK for SFX-Bullshit!
1834 if( p )
1835 {
1836 Remove( p );
1837 }
1838 p = Find( "TRUE", SbxClassType::Property );
1839 if( p )
1840 {
1841 Remove( p );
1842 }
1843 // End of the hacks!
1844 // Search via StarBASIC is at all times global
1845 DBG_ASSERT( IsSet( SbxFlagBits::GlobalSearch ), "Basic loaded without GBLSEARCH" );
1847 return true;
1848}
1849
1850std::pair<bool, sal_uInt32> StarBASIC::StoreData( SvStream& r ) const
1851{
1852 auto [bSuccess, nVersion] = SbxObject::StoreData(r);
1853 if( !bSuccess )
1854 {
1855 return { false, 0 };
1856 }
1857 assert(pModules.size() < SAL_MAX_UINT16);
1858 r.WriteUInt16( static_cast<sal_uInt16>(pModules.size()));
1859 for( const auto& rpModule: pModules )
1860 {
1861 const auto& [bSuccessModule, nVersionModule] = rpModule->Store(r);
1862 if( !bSuccessModule )
1863 {
1864 return { false, 0 };
1865 }
1866 else if (nVersionModule > nVersion)
1867 {
1868 nVersion = nVersionModule;
1869 }
1870 }
1871 return { true, nVersion };
1872}
1873
1874bool StarBASIC::GetUNOConstant( const OUString& rName, css::uno::Any& aOut )
1875{
1876 bool bRes = false;
1877 SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( Find( rName, SbxClassType::DontCare ) );
1878 if ( pGlobs )
1879 {
1880 aOut = pGlobs->getUnoAny();
1881 bRes = true;
1882 }
1883 return bRes;
1884}
1885
1887{
1888 OSL_PRECOND( pBasic != nullptr, "getModelFromBasic: illegal call!" );
1889 if ( !pBasic )
1890 {
1891 return nullptr;
1892 }
1893 // look for the ThisComponent variable, first in the parent (which
1894 // might be the document's Basic), then in the parent's parent (which might be
1895 // the application Basic)
1896 static constexpr OUStringLiteral sThisComponent( u"ThisComponent");
1897 SbxVariable* pThisComponent = nullptr;
1898
1899 SbxObject* pLookup = pBasic->GetParent();
1900 while ( pLookup && !pThisComponent )
1901 {
1902 pThisComponent = pLookup->Find( sThisComponent, SbxClassType::Object );
1903 pLookup = pLookup->GetParent();
1904 }
1905 if ( !pThisComponent )
1906 {
1907 SAL_WARN("basic", "Failed to get ThisComponent");
1908 // the application Basic, at the latest, should have this variable
1909 return nullptr;
1910 }
1911
1912 Any aThisComponentAny( sbxToUnoValue( pThisComponent ) );
1913 Reference< frame::XModel > xModel( aThisComponentAny, UNO_QUERY );
1914 if ( !xModel.is() )
1915 {
1916 // it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller.
1917 Reference< frame::XController > xController( aThisComponentAny, UNO_QUERY );
1918 if ( xController.is() )
1919 {
1920 xModel = xController->getModel();
1921 }
1922 }
1923 if ( !xModel.is() )
1924 {
1925 return nullptr;
1926 }
1927
1928 return xModel;
1929}
1930
1932{
1933 for (auto const& item : gaDocBasicItems)
1934 {
1935 DocBasicItemRef xItem = item.second;
1936 xItem->setDisposed(true);
1937 }
1938}
1939
1940// #118116 Implementation Collection object
1941
1942
1943constexpr OUStringLiteral pCountStr = u"Count";
1944constexpr OUStringLiteral pAddStr = u"Add";
1945constexpr OUStringLiteral pItemStr = u"Item";
1946constexpr OUStringLiteral pRemoveStr = u"Remove";
1951
1954
1955BasicCollection::BasicCollection( const OUString& rClass )
1956 : SbxObject( rClass )
1957{
1958 Initialize();
1959}
1960
1962{}
1963
1965{
1967 Initialize();
1968}
1969
1971{
1972 xItemArray = new SbxArray();
1973 SetType( SbxOBJECT );
1976 SbxVariable* p;
1978 p->ResetFlag( SbxFlagBits::Write );
1979 p->SetFlag( SbxFlagBits::DontStore );
1981 p->SetFlag( SbxFlagBits::DontStore );
1983 p->SetFlag( SbxFlagBits::DontStore );
1985 p->SetFlag( SbxFlagBits::DontStore );
1986 if ( !xAddInfo.is() )
1987 {
1988 xAddInfo = new SbxInfo;
1989 xAddInfo->AddParam( "Item", SbxVARIANT );
1993 }
1994 if ( !xItemInfo.is() )
1995 {
1996 xItemInfo = new SbxInfo;
1998 }
1999}
2000
2002{
2003 const SbxHint* p = dynamic_cast<const SbxHint*>(&rHint);
2004 if( p )
2005 {
2006 const SfxHintId nId = p->GetId();
2007 bool bRead = nId == SfxHintId::BasicDataWanted;
2008 bool bWrite = nId == SfxHintId::BasicDataChanged;
2009 bool bRequestInfo = nId == SfxHintId::BasicInfoWanted;
2010 SbxVariable* pVar = p->GetVar();
2011 SbxArray* pArg = pVar->GetParameters();
2012 OUString aVarName( pVar->GetName() );
2013 if( bRead || bWrite )
2014 {
2015 if( pVar->GetHashCode() == nCountHash
2016 && aVarName.equalsIgnoreAsciiCase( pCountStr ) )
2017 {
2018 pVar->PutLong(xItemArray->Count());
2019 }
2020 else if( pVar->GetHashCode() == nAddHash
2021 && aVarName.equalsIgnoreAsciiCase( pAddStr ) )
2022 {
2023 CollAdd( pArg );
2024 }
2025 else if( pVar->GetHashCode() == nItemHash
2026 && aVarName.equalsIgnoreAsciiCase( pItemStr ) )
2027 {
2028 CollItem( pArg );
2029 }
2030 else if( pVar->GetHashCode() == nRemoveHash
2031 && aVarName.equalsIgnoreAsciiCase( pRemoveStr ) )
2032 {
2033 CollRemove( pArg );
2034 }
2035 else
2036 {
2037 SbxObject::Notify( rCst, rHint );
2038 }
2039 return;
2040 }
2041 else if ( bRequestInfo )
2042 {
2043 if( pVar->GetHashCode() == nAddHash
2044 && aVarName.equalsIgnoreAsciiCase( pAddStr ) )
2045 {
2046 pVar->SetInfo( xAddInfo.get() );
2047 }
2048 else if( pVar->GetHashCode() == nItemHash
2049 && aVarName.equalsIgnoreAsciiCase( pItemStr ) )
2050 {
2051 pVar->SetInfo( xItemInfo.get() );
2052 }
2053 }
2054 }
2055 SbxObject::Notify( rCst, rHint );
2056}
2057
2058sal_Int32 BasicCollection::implGetIndex( SbxVariable const * pIndexVar )
2059{
2060 sal_Int32 nIndex = -1;
2061 if( pIndexVar->GetType() == SbxSTRING )
2062 {
2063 nIndex = implGetIndexForName( pIndexVar->GetOUString() );
2064 }
2065 else
2066 {
2067 nIndex = pIndexVar->GetLong() - 1;
2068 }
2069 return nIndex;
2070}
2071
2072sal_Int32 BasicCollection::implGetIndexForName(const OUString& rName)
2073{
2074 sal_Int32 nCount = xItemArray->Count();
2075 sal_Int32 nNameHash = MakeHashCode( rName );
2076
2077 // tdf#144245 - case-insensitive operation for non-ASCII characters
2078 OUString aNameCI; // Only initialize when matching hash found
2079
2080 for( sal_Int32 i = 0 ; i < nCount ; i++ )
2081 {
2082 SbxVariable* pVar = xItemArray->Get(i);
2083 if (pVar->GetHashCode() == nNameHash)
2084 {
2085 if (aNameCI.isEmpty() && !rName.isEmpty())
2087 if (aNameCI == pVar->GetName(SbxNameType::CaseInsensitive))
2088 return i;
2089 }
2090 }
2091 return -1;
2092}
2093
2095{
2096 sal_uInt32 nCount = pPar_->Count();
2097 if( nCount < 2 || nCount > 5 )
2098 {
2100 return;
2101 }
2102
2103 SbxVariable* pItem = pPar_->Get(1);
2104 if( pItem )
2105 {
2106 sal_uInt32 nNextIndex;
2107 if( nCount < 4 )
2108 {
2109 nNextIndex = xItemArray->Count();
2110 }
2111 else
2112 {
2113 SbxVariable* pBefore = pPar_->Get(3);
2114 if( nCount == 5 )
2115 {
2116 if( !( pBefore->IsErr() || ( pBefore->GetType() == SbxEMPTY ) ) )
2117 {
2119 return;
2120 }
2121 SbxVariable* pAfter = pPar_->Get(4);
2122 sal_Int32 nAfterIndex = implGetIndex( pAfter );
2123 if( nAfterIndex == -1 )
2124 {
2126 return;
2127 }
2128 nNextIndex = sal::static_int_cast<sal_uInt32>(nAfterIndex + 1);
2129 }
2130 else // if( nCount == 4 )
2131 {
2132 sal_Int32 nBeforeIndex = implGetIndex( pBefore );
2133 if( nBeforeIndex == -1 )
2134 {
2136 return;
2137 }
2138 nNextIndex = sal::static_int_cast<sal_uInt32>(nBeforeIndex);
2139 }
2140 }
2141
2142 auto pNewItem = tools::make_ref<SbxVariable>( *pItem );
2143 if( nCount >= 3 )
2144 {
2145 SbxVariable* pKey = pPar_->Get(2);
2146 if( !( pKey->IsErr() || ( pKey->GetType() == SbxEMPTY ) ) )
2147 {
2148 if( pKey->GetType() != SbxSTRING )
2149 {
2151 return;
2152 }
2153 OUString aKey = pKey->GetOUString();
2154 if( implGetIndexForName( aKey ) != -1 )
2155 {
2157 return;
2158 }
2159 pNewItem->SetName( aKey );
2160 }
2161 }
2162 pNewItem->SetFlag( SbxFlagBits::ReadWrite );
2163 xItemArray->Insert(pNewItem.get(), nNextIndex);
2164 }
2165 else
2166 {
2168 return;
2169 }
2170}
2171
2173{
2174 if (pPar_->Count() != 2)
2175 {
2177 return;
2178 }
2179 SbxVariable* pRes = nullptr;
2180 SbxVariable* p = pPar_->Get(1);
2181 sal_Int32 nIndex = implGetIndex( p );
2182 if (nIndex >= 0 && o3tl::make_unsigned(nIndex) < xItemArray->Count())
2183 {
2184 pRes = xItemArray->Get(nIndex);
2185 }
2186 if( !pRes )
2187 {
2189 }
2190 else
2191 {
2192 *(pPar_->Get(0)) = *pRes;
2193 }
2194}
2195
2197{
2198 if (pPar_ == nullptr || pPar_->Count() != 2)
2199 {
2201 return;
2202 }
2203
2204 SbxVariable* p = pPar_->Get(1);
2205 sal_Int32 nIndex = implGetIndex( p );
2206 if (nIndex >= 0 && o3tl::make_unsigned(nIndex) < xItemArray->Count())
2207 {
2208 xItemArray->Remove( nIndex );
2209
2210 // Correct for stack if necessary
2211 SbiInstance* pInst = GetSbData()->pInst;
2212 SbiRuntime* pRT = pInst ? pInst->pRun : nullptr;
2213 if( pRT )
2214 {
2215 SbiForStack* pStack = pRT->FindForStackItemForCollection( this );
2216 if( pStack != nullptr )
2217 {
2218 if( pStack->nCurCollectionIndex >= nIndex )
2219 {
2220 --pStack->nCurCollectionIndex;
2221 }
2222 }
2223 }
2224 }
2225 else
2226 {
2228 }
2229}
2230
2231/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AgileEncryptionInfo & mInfo
XPropertyListType t
SbxArrayRef xItemArray
Definition: sbunoobj.hxx:347
void CollRemove(SbxArray *pPar_)
Definition: sb.cxx:2196
void CollItem(SbxArray *pPar_)
Definition: sb.cxx:2172
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: sb.cxx:2001
virtual ~BasicCollection() override
Definition: sb.cxx:1961
BasicCollection(const OUString &rClassname)
Definition: sb.cxx:1955
static SbxInfoRef xAddInfo
Definition: sbunoobj.hxx:348
sal_Int32 implGetIndex(SbxVariable const *pIndexVar)
Definition: sb.cxx:2058
sal_Int32 implGetIndexForName(const OUString &rName)
Definition: sb.cxx:2072
virtual void Clear() override
Definition: sb.cxx:1964
void CollAdd(SbxArray *pPar_)
Definition: sb.cxx:2094
void Initialize()
Definition: sb.cxx:1970
static SbxInfoRef xItemInfo
Definition: sbunoobj.hxx:349
void startListening()
Definition: sb.cxx:136
void stopListening()
Definition: sb.cxx:148
virtual void SAL_CALL notifyClosing(const lang::EventObject &rSource) override
Definition: sb.cxx:167
StarBASIC & mrDocBasic
Definition: sb.cxx:92
virtual ~DocBasicItem() override
Definition: sb.cxx:107
const SbxObjectRef & getClassModules() const
Definition: sb.cxx:74
bool mbDisposed
Definition: sb.cxx:95
void setDisposed(bool bDisposed)
Definition: sb.cxx:82
virtual void SAL_CALL queryClosing(const lang::EventObject &rSource, sal_Bool bGetsOwnership) override
Definition: sb.cxx:163
SbxObjectRef mxClassModules
Definition: sb.cxx:93
bool mbDocClosed
Definition: sb.cxx:94
DocBasicItem(StarBASIC &rDocBasic)
Definition: sb.cxx:99
void clearDependingVarsOnDelete(StarBASIC &rDeletedBasic)
Definition: sb.cxx:131
bool isDocClosed() const
Definition: sb.cxx:75
virtual void SAL_CALL disposing(const lang::EventObject &rSource) override
Definition: sb.cxx:173
constexpr ErrCodeClass GetClass() const
virtual SbxObjectRef CreateObject(const OUString &) override
Definition: sb.cxx:864
SbClassFactory()
Definition: sb.cxx:832
void RemoveClassModule(SbModule *pClassModule)
Definition: sb.cxx:853
void AddClassModule(SbModule *pClassModule)
Definition: sb.cxx:840
virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32) override
Definition: sb.cxx:858
virtual ~SbClassFactory() override
Definition: sb.cxx:837
SbModule * FindClass(const OUString &rClassName)
Definition: sb.cxx:888
SbxObjectRef xClassModules
Definition: sbintern.hxx:67
virtual SbxObjectRef CreateObject(const OUString &) override
Definition: sb.cxx:491
virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32) override
Definition: sb.cxx:485
SbMethod * getImplMethod()
Definition: sbmeth.hxx:82
SbModule * pMod
Definition: sbmeth.hxx:41
SAL_DLLPRIVATE const SbxObject * FindType(const OUString &aTypeName) const
Definition: sbxmod.cxx:459
static SAL_DLLPRIVATE void implProcessModuleRunInit(ModuleInitDependencyMap &rMap, ClassModuleRunInitItem &rItem)
Definition: sb.cxx:1129
OUString aComment
Definition: sbmod.hxx:65
bool mbVBASupport
Definition: sbmod.hxx:69
const SbxArrayRef & GetMethods() const
Definition: sbmod.hxx:136
virtual SAL_DLLPRIVATE SbxVariable * Find(const OUString &, SbxClassType) override
Definition: sbxmod.cxx:626
sal_Int32 GetModuleType() const
Definition: sbmod.hxx:128
bool Compile()
Definition: sbcomp.cxx:33
SAL_DLLPRIVATE void RunInit()
Definition: sbxmod.cxx:1244
std::unique_ptr< SbiImage > pImage
Definition: sbmod.hxx:66
SAL_DLLPRIVATE void ClearVarsDependingOnDeletedBasic(StarBASIC *pDeletedBasic)
Definition: sbxmod.cxx:1346
SbiBreakpoints * pBreaks
Definition: sbmod.hxx:67
std::unique_ptr< SbClassData > pClassData
Definition: sbmod.hxx:68
bool isProxyModule() const
Definition: sbmod.hxx:130
virtual SAL_DLLPRIVATE void SetParent(SbxObject *) override
Definition: sbxmod.cxx:669
OUString aOUSource
Definition: sbmod.hxx:64
virtual SbxObjectRef CreateObject(const OUString &) override
Definition: sb.cxx:476
virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32) override
Definition: sb.cxx:470
virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32) override
Definition: sb.cxx:579
virtual SbxObjectRef CreateObject(const OUString &) override
Definition: sb.cxx:585
css::uno::Any getUnoAny()
Definition: sbunoobj.cxx:2823
virtual SbxObjectRef CreateObject(const OUString &) override
Definition: sb.cxx:439
virtual SbxBaseRef Create(sal_uInt16 nSbxId, sal_uInt32) override
Definition: sb.cxx:416
void Error(ErrCode)
Definition: runtime.cxx:490
const OUString & GetErrorMsg() const
Definition: runtime.hxx:175
void FatalError(ErrCode)
Definition: runtime.cxx:534
SbiRuntime * pRun
Definition: runtime.hxx:154
SbModule * GetActiveModule()
Definition: runtime.cxx:565
sal_Int32 GetErl() const
Definition: runtime.hxx:176
StarBASIC * GetBasic()
Definition: runtime.hxx:189
ErrCode const & GetErr() const
Definition: runtime.hxx:174
SbMethod * GetCaller(sal_uInt16)
Definition: runtime.cxx:577
static bool isVBAEnabled()
Definition: runtime.cxx:115
SbiForStack * FindForStackItemForCollection(class BasicCollection const *pCollection)
Definition: runtime.cxx:1241
SbxBase * FindElementExtern(const OUString &rName)
Definition: runtime.cxx:3732
Definition: sbx.hxx:95
sal_uInt32 Count() const
Definition: sbxarray.cxx:87
BASIC_DLLPRIVATE void PutDirect(SbxVariable *pVar, sal_uInt32 nIdx)
Definition: sbxarray.cxx:392
SbxVariable * Get(sal_uInt32)
Definition: sbxarray.cxx:108
bool IsVisible() const
Definition: sbxcore.hxx:132
static OUString const & GetErrorMsg()
Definition: sbxbase.cxx:101
static void SetError(ErrCode)
Definition: sbxbase.cxx:116
void SetFlags(SbxFlagBits n)
Definition: sbxcore.hxx:102
static void AddFactory(SbxFactory *)
Definition: sbxbase.cxx:134
static ErrCode const & GetError()
Definition: sbxbase.cxx:96
bool IsSet(SbxFlagBits n) const
Definition: sbxcore.hxx:114
bool IsModified() const
Definition: sbxcore.hxx:126
void SetFlag(SbxFlagBits n)
Definition: sbxcore.hxx:108
SbxFlagBits GetFlags() const
Definition: sbxcore.hxx:105
virtual void SetModified(bool)
Definition: sbxbase.cxx:86
static SbxBaseRef Load(SvStream &)
Definition: sbxbase.cxx:212
static void RemoveFactory(SbxFactory const *)
Definition: sbxbase.cxx:139
static void ResetError()
Definition: sbxbase.cxx:128
void ResetFlag(SbxFlagBits n)
Definition: sbxcore.hxx:111
bool GetDim(sal_Int32, sal_Int32 &, sal_Int32 &) const
Definition: sbxarray.cxx:458
void AddDim(sal_Int32, sal_Int32)
Definition: sbxarray.cxx:445
sal_Int32 GetDims() const
Definition: sbx.hxx:160
bool hasFixedSize() const
Definition: sbx.hxx:164
void setHasFixedSize(bool bHasFixedSize)
Definition: sbx.hxx:165
void unoAddDim(sal_Int32, sal_Int32)
Definition: sbxarray.cxx:450
static css::uno::Reference< ooo::vba::XErrObject > const & getUnoErrObject()
Definition: errobject.cxx:191
Definition: sbx.hxx:81
SbxArray * GetProperties()
Definition: sbxobj.hxx:79
virtual void Clear() override
Definition: sbxobj.cxx:125
virtual void Insert(SbxVariable *)
Definition: sbxobj.cxx:396
virtual SbxVariable * Find(const OUString &, SbxClassType)
Definition: sbxobj.cxx:182
virtual bool Call(const OUString &, SbxArray *=nullptr)
Definition: sbxobj.cxx:262
SbxArrayRef pObjs
Definition: sbxobj.hxx:36
const OUString & GetClassName() const
Definition: sbxobj.hxx:56
void Remove(const OUString &, SbxClassType)
Definition: sbxobj.cxx:499
virtual bool LoadData(SvStream &, sal_uInt16) override
Definition: sbxobj.cxx:561
SbxVariable * Make(const OUString &, SbxClassType, SbxDataType, bool bIsRuntimeFunction=false)
Definition: sbxobj.cxx:347
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: sbxobj.cxx:140
virtual std::pair< bool, sal_uInt32 > StoreData(SvStream &) const override
Definition: sbxobj.cxx:607
OUString GetOUString() const
Definition: sbxvalue.cxx:380
SbxBase * GetObject() const
Definition: sbxvar.hxx:157
bool PutObject(SbxBase *)
sal_Int32 GetLong() const
Definition: sbxvar.hxx:142
bool SetType(SbxDataType)
Definition: sbxvalue.cxx:674
bool IsErr() const
Definition: sbxvar.hxx:123
bool Get(SbxValues &) const
Definition: sbxvalue.cxx:270
bool PutLong(sal_Int32)
const SbxObject * GetParent() const
Definition: sbxvar.hxx:296
SfxBroadcaster & GetBroadcaster()
Definition: sbxvar.cxx:102
void SetName(const OUString &)
Definition: sbxvar.cxx:192
void SetInfo(SbxInfo *p)
Definition: sbxvar.cxx:173
virtual SbxDataType GetType() const override
Definition: sbxvar.cxx:321
SbxArray * GetParameters() const
Definition: sbxvar.cxx:111
const OUString & GetName(SbxNameType=SbxNameType::NONE) const
Definition: sbxvar.cxx:199
static constexpr sal_uInt16 MakeHashCode(std::u16string_view aName)
Definition: sbxvar.hxx:307
static OUString NameToCaseInsensitiveName(const OUString &rName)
Definition: sbxvar.cxx:187
virtual void SetParent(SbxObject *)
Definition: sbxvar.cxx:355
sal_uInt16 GetHashCode() const
Definition: sbxvar.hxx:273
SbxObject * pParent
Definition: sbxvar.hxx:258
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
static bool IsRunning()
Definition: sb.cxx:1364
static sal_uInt16 GetCol2()
Definition: sb.cxx:1429
virtual bool Call(const OUString &, SbxArray *=nullptr) override
Definition: sb.cxx:1322
bool bNoRtl
Definition: sbstar.hxx:52
SbxArrayRef const & getUnoListeners()
Definition: sb.cxx:1764
bool bQuit
Definition: sbstar.hxx:56
BasicDebugFlags BreakHdl()
Definition: sb.cxx:1421
static void SetErrorData(ErrCode nCode, sal_uInt16 nLine, sal_uInt16 nCol1, sal_uInt16 nCol2)
Definition: sb.cxx:1534
static ErrCode GetErrBasic()
Definition: sb.cxx:1707
static void Stop()
Definition: sb.cxx:1357
Link< StarBASIC *, BasicDebugFlags > aBreakHdl
Definition: sbstar.hxx:51
BASIC_DLLPRIVATE BasicDebugFlags StepPoint(sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2)
Definition: sb.cxx:1407
virtual void Clear() override
Definition: sb.cxx:1087
Link< StarBASIC *, bool > aErrorHdl
Definition: sbstar.hxx:50
virtual SbxVariable * Find(const OUString &, SbxClassType) override
Definition: sb.cxx:1248
static void DetachAllDocBasicItems()
Definition: sb.cxx:1931
static void SetGlobalErrorHdl(const Link< StarBASIC *, bool > &rNewHdl)
Definition: sb.cxx:1754
SbxArrayRef xUnoListeners
Definition: sbstar.hxx:47
static sal_uInt16 GetLine()
Definition: sb.cxx:1427
static ErrCode GetSfxFromVBError(sal_uInt16 nError)
Definition: sb.cxx:1482
SbxObjectRef pRtl
Definition: sbstar.hxx:46
static Link< StarBASIC *, bool > const & GetGlobalErrorHdl()
Definition: sb.cxx:1749
bool GetUNOConstant(const OUString &rName, css::uno::Any &aOut)
Definition: sb.cxx:1874
static SbModule * GetActiveModule()
Definition: sb.cxx:1381
bool CError(ErrCode, const OUString &, sal_Int32, sal_Int32, sal_Int32)
Definition: sb.cxx:1599
static const OUString & GetErrorText()
Definition: sb.cxx:1433
static ErrCode const & GetErrorCode()
Definition: sb.cxx:1432
BASIC_DLLPRIVATE void implClearDependingVarsOnDelete(StarBASIC *pDeletedBasic)
Definition: sb.cxx:990
static css::uno::Reference< css::frame::XModel > GetModelFromBasic(SbxObject *pBasic)
Definition: sb.cxx:1886
static sal_Int32 GetErl()
Definition: sb.cxx:1732
BASIC_DLLPRIVATE BasicDebugFlags BreakPoint(sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2)
Definition: sb.cxx:1393
static void Error(ErrCode, const OUString &rMsg={})
Definition: sb.cxx:1683
BASIC_DLLPRIVATE bool RTError(ErrCode, const OUString &rMsg, sal_Int32, sal_Int32, sal_Int32)
Definition: sb.cxx:1642
virtual ~StarBASIC() override
Definition: sb.cxx:936
bool bDocBasic
Definition: sbstar.hxx:54
static void SetGlobalBreakHdl(const Link< StarBASIC *, BasicDebugFlags > &rNewHdl)
Definition: sb.cxx:1759
static sal_uInt16 GetCol1()
Definition: sb.cxx:1428
bool bVBAEnabled
Definition: sbstar.hxx:55
bool isVBAEnabled() const
Definition: runtime.cxx:129
bool bBreak
Definition: sbstar.hxx:53
SbxObjectRef pVBAGlobals
Definition: sbstar.hxx:58
SbModule * MakeModule(const OUString &rName, const OUString &rSrc)
Definition: sb.cxx:1012
virtual bool LoadData(SvStream &, sal_uInt16) override
Definition: sb.cxx:1774
static SbxBase * FindSBXInCurrentScope(const OUString &rName)
Definition: sb.cxx:1338
SbModule * FindModule(std::u16string_view)
Definition: sb.cxx:1092
StarBASIC(StarBASIC *pParent=nullptr, bool bIsDocBasic=false)
Definition: sb.cxx:895
virtual void Remove(SbxVariable *) override
Definition: sb.cxx:1070
static OUString GetErrorMsg()
Definition: sb.cxx:1720
virtual void Insert(SbxVariable *) override
Definition: sb.cxx:1051
void InitAllModules(StarBASIC const *pBasicNotToInit=nullptr)
Definition: sb.cxx:1165
bool IsDocBasic() const
Definition: sbstar.hxx:139
void DeInitAllModules()
Definition: sb.cxx:1220
static SbMethod * GetActiveMethod(sal_uInt16 nLevel=0)
Definition: sb.cxx:1369
virtual void SetModified(bool) override
Definition: sb.cxx:931
SbModules pModules
Definition: sbstar.hxx:45
static void MakeErrorText(ErrCode, std::u16string_view aMsg)
Definition: sb.cxx:1544
SbxObject * getVBAGlobals()
Definition: sb.cxx:233
bool ErrorHdl()
Definition: sb.cxx:1744
static void FatalError(ErrCode)
Definition: sb.cxx:1691
void QuitAndExitApplication()
Definition: sb.cxx:1351
static sal_uInt16 GetVBErrorCode(ErrCode nError)
Definition: sb.cxx:1443
SbxVariable * VBAFind(const OUString &rName, SbxClassType t)
Definition: sb.cxx:259
virtual std::pair< bool, sal_uInt32 > StoreData(SvStream &) const override
Definition: sb.cxx:1850
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
sal_uInt64 remainingSize()
static SolarMutex * get()
sal_uInt32 release(bool bUnlockAll=false)
void acquire(sal_uInt32 nLockCount=1)
T * get() const
bool is() const
int nCount
#define DBG_ASSERT(sCon, aError)
virtual OUString GetName() const override
float u
#define ERRCODE_NONE
sal_Int16 nVersion
Reference< XSingleServiceFactory > xFactory
SfxHintId
sal_Int32 nIndex
void * p
sal_Int64 n
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
@ Exception
Reference< XMultiServiceFactory > getProcessServiceFactory()
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
end
sal_Unicode code
sal_Int16 nId
QPRO_FUNC_TYPE nType
constexpr OUStringLiteral pItemStr
Definition: sb.cxx:1945
SbxObjectRef createUserTypeImpl(const OUString &rClassName)
Definition: sb.cxx:600
constexpr sal_uInt16 nRemoveHash
Definition: sb.cxx:1950
SbxObjectRef cloneTypeObjectImpl(const SbxObject &rTypeObj)
Definition: sb.cxx:520
constexpr OUStringLiteral SB_RTLNAME
Definition: sb.cxx:58
constexpr sal_uInt16 nItemHash
Definition: sb.cxx:1949
constexpr sal_uInt16 nCountHash
Definition: sb.cxx:1947
constexpr OUStringLiteral pRemoveStr
Definition: sb.cxx:1946
const SFX_VB_ErrorItem SFX_VB_ErrorTab[]
Definition: sb.cxx:284
constexpr sal_uInt16 nAddHash
Definition: sb.cxx:1948
constexpr OUStringLiteral pCountStr
Definition: sb.cxx:1943
constexpr OUStringLiteral pAddStr
Definition: sb.cxx:1944
#define SBXID_BASICMOD
Definition: sbdef.hxx:59
#define SBXID_BASICPROP
Definition: sbdef.hxx:60
BasicDebugFlags
Definition: sbdef.hxx:46
BASIC_DLLPUBLIC std::pair< TranslateId, ErrCode > const RID_BASIC_START[]
#define SBXID_JSCRIPTMETH
Definition: sbdef.hxx:63
#define SBXID_BASICMETHOD
Definition: sbdef.hxx:61
#define SBXID_BASIC
Definition: sbdef.hxx:58
#define SBXID_JSCRIPTMOD
Definition: sbdef.hxx:62
#define ERRCODE_BASIC_EXPECTED
Definition: sberrors.hxx:125
#define ERRCODE_BASIC_EXCEPTION
Definition: sberrors.hxx:153
#define ERRCODE_BASIC_DDE_OUTOFCHANNELS
Definition: sberrors.hxx:89
#define ERRCODE_BASIC_NO_ACTIVE_OBJECT
Definition: sberrors.hxx:37
#define ERRCODE_BASIC_USER_ABORT
Definition: sberrors.hxx:61
#define ERRCODE_BASIC_ALREADY_DIM
Definition: sberrors.hxx:58
#define ERRCODE_BASIC_BAD_METHOD
Definition: sberrors.hxx:45
#define ERRCODE_BASIC_NOT_IN_MAIN
Definition: sberrors.hxx:147
#define ERRCODE_BASIC_PROG_TOO_LARGE
Definition: sberrors.hxx:151
#define ERRCODE_BASIC_INVALID_OBJECT
Definition: sberrors.hxx:41
#define ERRCODE_BASIC_NOT_READY
Definition: sberrors.hxx:79
#define ERRCODE_BASIC_TOO_MANY_FILES
Definition: sberrors.hxx:76
#define ERRCODE_BASIC_OLE_ERROR
Definition: sberrors.hxx:46
#define ERRCODE_BASIC_BAD_DECLARATION
Definition: sberrors.hxx:141
#define ERRCODE_BASIC_BAD_CHAR_IN_NUMBER
Definition: sberrors.hxx:143
#define ERRCODE_BASIC_VAR_EXPECTED
Definition: sberrors.hxx:127
#define ERRCODE_BASIC_BAD_ACTION
Definition: sberrors.hxx:47
#define ERRCODE_BASIC_BAD_PROP_VALUE
Definition: sberrors.hxx:38
#define ERRCODE_BASIC_ACCESS_ERROR
Definition: sberrors.hxx:82
#define ERRCODE_BASIC_NOT_IN_SUBR
Definition: sberrors.hxx:146
#define ERRCODE_BASIC_BAD_INDEX
Definition: sberrors.hxx:36
#define ERRCODE_BASIC_BAD_LOCALE
Definition: sberrors.hxx:49
#define ERRCODE_BASIC_NO_METHOD
Definition: sberrors.hxx:42
#define ERRCODE_BASIC_UNDEF_PROC
Definition: sberrors.hxx:135
#define ERRCODE_BASIC_BAD_PARAMETERS
Definition: sberrors.hxx:142
#define ERRCODE_BASIC_BAD_FILE_MODE
Definition: sberrors.hxx:68
#define ERRCODE_BASIC_OPER_NOT_PERFORM
Definition: sberrors.hxx:170
#define ERRCODE_BASIC_BAD_PATTERN
Definition: sberrors.hxx:84
#define ERRCODE_BASIC_PROP_WRITEONLY
Definition: sberrors.hxx:40
#define ERRCODE_BASIC_DDE_NOTPROCESSED
Definition: sberrors.hxx:93
#define ERRCODE_BASIC_UNDEF_ARRAY
Definition: sberrors.hxx:134
#define ERRCODE_BASIC_STRING_OVERFLOW
Definition: sberrors.hxx:168
#define ERRCODE_BASIC_NO_OBJECT
Definition: sberrors.hxx:34
#define ERRCODE_BASIC_BAD_PARAMETER
Definition: sberrors.hxx:31
#define ERRCODE_BASIC_DDE_INVALID_LINK
Definition: sberrors.hxx:102
#define ERRCODE_BASIC_UNDEF_TYPE
Definition: sberrors.hxx:137
#define ERRCODE_BASIC_GETPROP_FAILED
Definition: sberrors.hxx:119
#define ERRCODE_BASIC_PROC_UNDEFINED
Definition: sberrors.hxx:32
#define ERRCODE_BASIC_DDE_LINK_ALREADY_EST
Definition: sberrors.hxx:104
#define ERRCODE_BASIC_LABEL_DEFINED
Definition: sberrors.hxx:132
#define ERRCODE_BASIC_METHOD_NOT_FOUND
Definition: sberrors.hxx:114
#define ERRCODE_BASIC_NO_DEVICE
Definition: sberrors.hxx:77
#define ERRCODE_BASIC_REDO_FROM_START
Definition: sberrors.hxx:56
#define ERRCODE_BASIC_MUST_HAVE_DIMS
Definition: sberrors.hxx:144
#define ERRCODE_BASIC_ACCESS_DENIED
Definition: sberrors.hxx:78
#define ERRCODE_BASIC_UNEXPECTED
Definition: sberrors.hxx:124
#define ERRCODE_BASIC_DDE_USER_INTERRUPT
Definition: sberrors.hxx:95
#define ERRCODE_BASIC_DDE_BUSY
Definition: sberrors.hxx:96
#define ERRCODE_BASIC_FILE_EXISTS
Definition: sberrors.hxx:71
#define ERRCODE_BASIC_NO_STRINGS_ARRAYS
Definition: sberrors.hxx:152
#define ERRCODE_BASIC_LVALUE_EXPECTED
Definition: sberrors.hxx:129
#define ERRCODE_BASIC_PROC_DEFINED
Definition: sberrors.hxx:131
#define ERRCODE_BASIC_UNDEF_LABEL
Definition: sberrors.hxx:136
#define ERRCODE_BASIC_DDE_WAITINGACK
Definition: sberrors.hxx:88
#define ERRCODE_BASIC_PROP_READONLY
Definition: sberrors.hxx:39
#define ERRCODE_BASIC_LABEL_EXPECTED
Definition: sberrors.hxx:128
#define ERRCODE_BASIC_DDE_QUEUE_OVERFLOW
Definition: sberrors.hxx:103
#define ERRCODE_BASIC_OUT_OF_RANGE
Definition: sberrors.hxx:28
#define ERRCODE_BASIC_ARG_MISSING
Definition: sberrors.hxx:115
#define ERRCODE_BASIC_TOO_MANY_DLL
Definition: sberrors.hxx:171
#define ERRCODE_BASIC_BAD_CLIPBD_FORMAT
Definition: sberrors.hxx:111
#define ERRCODE_BASIC_NO_GOSUB
Definition: sberrors.hxx:55
#define ERRCODE_BASIC_DDE_MULT_RESPONSES
Definition: sberrors.hxx:91
#define ERRCODE_BASIC_VAR_UNDEFINED
Definition: sberrors.hxx:60
#define ERRCODE_BASIC_MATH_OVERFLOW
Definition: sberrors.hxx:27
#define ERRCODE_BASIC_SYMBOL_EXPECTED
Definition: sberrors.hxx:126
#define ERRCODE_BASIC_DDE_NO_CHANNEL
Definition: sberrors.hxx:101
#define ERRCODE_BASIC_EXPR_TOO_COMPLEX
Definition: sberrors.hxx:169
#define ERRCODE_BASIC_DDE_TIMEOUT
Definition: sberrors.hxx:94
#define ERRCODE_BASIC_BAD_ORDINAL
Definition: sberrors.hxx:109
#define ERRCODE_BASIC_FILE_NOT_FOUND
Definition: sberrors.hxx:67
#define ERRCODE_BASIC_CANNOT_LOAD
Definition: sberrors.hxx:35
#define ERRCODE_BASIC_BAD_RECORD_NUMBER
Definition: sberrors.hxx:75
#define ERRCODE_BASIC_SYNTAX
Definition: sberrors.hxx:25
#define ERRCODE_BASIC_COMPAT
Definition: sberrors.hxx:166
#define ERRCODE_BASIC_METHOD_FAILED
Definition: sberrors.hxx:117
#define ERRCODE_BASIC_NAMED_NOT_FOUND
Definition: sberrors.hxx:50
#define ERRCODE_BASIC_PATH_NOT_FOUND
Definition: sberrors.hxx:83
#define ERRCODE_BASIC_BAD_BRACKETS
Definition: sberrors.hxx:140
#define ERRCODE_BASIC_CONVERSION
Definition: sberrors.hxx:30
#define ERRCODE_BASIC_DDE_NO_DATA
Definition: sberrors.hxx:97
#define ERRCODE_BASIC_NO_MEMORY
Definition: sberrors.hxx:57
#define ERRCODE_BASIC_IS_NULL
Definition: sberrors.hxx:85
#define ERRCODE_BASIC_VAR_DEFINED
Definition: sberrors.hxx:130
#define ERRCODE_BASIC_DDE_DLL_NOT_FOUND
Definition: sberrors.hxx:106
#define ERRCODE_BASIC_BAD_ARGUMENT
Definition: sberrors.hxx:26
#define ERRCODE_BASIC_DIFFERENT_DRIVE
Definition: sberrors.hxx:81
#define ERRCODE_BASIC_INTERNAL_ERROR
Definition: sberrors.hxx:33
#define ERRCODE_BASIC_NOT_A_COLL
Definition: sberrors.hxx:53
#define ERRCODE_BASIC_WRONG_ARGS
Definition: sberrors.hxx:52
#define ERRCODE_BASIC_DDE_ERROR
Definition: sberrors.hxx:87
#define ERRCODE_BASIC_NOT_IMPLEMENTED
Definition: sberrors.hxx:80
#define ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT
Definition: sberrors.hxx:98
#define ERRCODE_BASIC_ARRAY_FIX
Definition: sberrors.hxx:167
#define ERRCODE_BASIC_CONSTANT_REDECLARED
Definition: sberrors.hxx:150
#define ERRCODE_BASIC_NO_OLE
Definition: sberrors.hxx:44
#define ERRCODE_BASIC_READ_PAST_EOF
Definition: sberrors.hxx:74
#define ERRCODE_BASIC_DDE_PARTNER_QUIT
Definition: sberrors.hxx:99
#define ERRCODE_BASIC_DDE_NO_RESPONSE
Definition: sberrors.hxx:90
#define ERRCODE_BASIC_BAD_NUMBER_OF_ARGS
Definition: sberrors.hxx:116
#define ERRCODE_BASIC_BAD_RESUME
Definition: sberrors.hxx:62
#define ERRCODE_BASIC_DUPLICATE_DEF
Definition: sberrors.hxx:59
#define ERRCODE_BASIC_DISK_FULL
Definition: sberrors.hxx:73
#define ERRCODE_BASIC_LOOP_NOT_INIT
Definition: sberrors.hxx:172
#define ERRCODE_BASIC_SETPROP_FAILED
Definition: sberrors.hxx:118
#define ERRCODE_BASIC_DDE_CHANNEL_LOCKED
Definition: sberrors.hxx:92
#define ERRCODE_BASIC_PROPERTY_NOT_FOUND
Definition: sberrors.hxx:113
#define ERRCODE_BASIC_BAD_BLOCK
Definition: sberrors.hxx:139
#define ERRCODE_BASIC_NOT_OPTIONAL
Definition: sberrors.hxx:51
#define ERRCODE_BASIC_NO_NAMED_ARGS
Definition: sberrors.hxx:48
#define ERRCODE_BASIC_FILE_ALREADY_OPEN
Definition: sberrors.hxx:69
#define ERRCODE_BASIC_IO_ERROR
Definition: sberrors.hxx:70
#define ERRCODE_BASIC_NEEDS_OBJECT
Definition: sberrors.hxx:108
#define ERRCODE_BASIC_DDE_CONV_CLOSED
Definition: sberrors.hxx:100
#define ERRCODE_BASIC_BAD_RECORD_LENGTH
Definition: sberrors.hxx:72
#define ERRCODE_BASIC_BAD_EXIT
Definition: sberrors.hxx:138
#define ERRCODE_BASIC_STACK_OVERFLOW
Definition: sberrors.hxx:63
#define ERRCODE_BASIC_BAD_OPTION
Definition: sberrors.hxx:149
#define ERRCODE_BASIC_BAD_CHANNEL
Definition: sberrors.hxx:66
#define ERRCODE_BASIC_WRONG_DIMS
Definition: sberrors.hxx:148
#define ERRCODE_BASIC_DLLPROC_NOT_FOUND
Definition: sberrors.hxx:110
#define ERRCODE_BASIC_ZERODIV
Definition: sberrors.hxx:29
#define ERRCODE_BASIC_UNDEF_VAR
Definition: sberrors.hxx:133
#define ERRCODE_BASIC_DDE_LINK_INV_TOPIC
Definition: sberrors.hxx:105
#define ERRCODE_BASIC_NO_IF
Definition: sberrors.hxx:145
#define ERRCODE_BASIC_BAD_DLL_LOAD
Definition: sberrors.hxx:64
#define ERRCODE_BASIC_INVALID_USAGE_OBJECT
Definition: sberrors.hxx:43
#define ERRCODE_BASIC_BAD_DLL_CALL
Definition: sberrors.hxx:65
SbiGlobals * GetSbData()
Definition: sbintern.cxx:26
SbUnoObject * createOLEObject_Impl(const OUString &aType)
Definition: sbunoobj.cxx:234
void clearUnoMethodsForBasic(StarBASIC const *pBasic)
Definition: sbunoobj.cxx:2429
void disposeComVariablesForBasic(StarBASIC const *pBasic)
Definition: sbunoobj.cxx:4444
Any sbxToUnoValue(const SbxValue *pVar)
Definition: sbunoobj.cxx:1137
static OUString pItem
Definition: sbxcoll.cxx:30
SbxDataType
Definition: sbxdef.hxx:37
@ SbxOBJECT
Definition: sbxdef.hxx:47
@ SbxARRAY
Definition: sbxdef.hxx:80
@ SbxEMPTY
Definition: sbxdef.hxx:38
@ SbxVARIANT
Definition: sbxdef.hxx:51
@ SbxSTRING
Definition: sbxdef.hxx:46
@ SbxINTEGER
Definition: sbxdef.hxx:40
SbxClassType
Definition: sbxdef.hxx:27
SbxFlagBits
Definition: sbxdef.hxx:131
constexpr auto SBXCR_SBX
Definition: sbxdef.hxx:164
static sal_uInt16 nNameHash
Definition: sbxobj.cxx:40
OUString BasResId(TranslateId aId)
Definition: sbxscan.cxx:432
SbModule * m_pModule
Definition: sb.cxx:1107
ClassModuleRunInitItem(SbModule *pModule)
Definition: sb.cxx:1116
SbClassData()
Definition: sb.cxx:821
void clear()
Definition: sb.cxx:826
SbxArrayRef mxIfaces
Definition: sbintern.hxx:51
std::vector< OUString > maRequiredTypes
Definition: sbintern.hxx:55
sal_Int32 nCurCollectionIndex
Definition: runtime.hxx:73
Link< StarBASIC *, bool > aErrHdl
Definition: sbintern.hxx:125
static SbiGlobals * pGlobals
Definition: sbintern.hxx:107
ErrCode nCode
Definition: sbintern.hxx:127
bool bCompilerError
Definition: sbintern.hxx:130
sal_Int32 nCol2
Definition: sbintern.hxx:129
SbiInstance * pInst
Definition: sbintern.hxx:108
SbModule * pMod
Definition: sbintern.hxx:122
SbModule * pCompMod
Definition: sbintern.hxx:123
Link< StarBASIC *, BasicDebugFlags > aBreakHdl
Definition: sbintern.hxx:126
sal_Int32 nCol1
Definition: sbintern.hxx:129
sal_Int32 nLine
Definition: sbintern.hxx:128
OUString aErrMsg
Definition: sbintern.hxx:133
bool bGlobalInitErr
Definition: sbintern.hxx:131
Reference< XController > xController
Reference< XModel > xModel
#define SAL_MAX_UINT16
unsigned char sal_Bool