diff options
-rw-r--r-- | basic/source/inc/rtlproto.hxx | 100 | ||||
-rw-r--r-- | basic/source/inc/runtime.hxx | 94 | ||||
-rw-r--r-- | basic/source/inc/stdobj.hxx | 2 | ||||
-rw-r--r-- | basic/source/runtime/methods.cxx | 133 | ||||
-rw-r--r-- | basic/source/runtime/props.cxx | 104 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 2 | ||||
-rw-r--r-- | basic/source/runtime/stdobj.cxx | 303 |
7 files changed, 301 insertions, 437 deletions
diff --git a/basic/source/inc/rtlproto.hxx b/basic/source/inc/rtlproto.hxx index 002359435749..ed594583a36d 100644 --- a/basic/source/inc/rtlproto.hxx +++ b/basic/source/inc/rtlproto.hxx @@ -28,112 +28,12 @@ typedef void( *RtlCall ) ( StarBASIC* p, SbxArray& rArgs, bool bWrite ); extern void SbRtl_Date(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); extern void SbRtl_Err(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); extern void SbRtl_Erl(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_False(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); extern void SbRtl_Empty(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); extern void SbRtl_Nothing(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); extern void SbRtl_Null(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_True(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); - -extern void SbRtl_ATTR_NORMAL(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_ATTR_READONLY(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_ATTR_HIDDEN(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_ATTR_SYSTEM(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_ATTR_VOLUME(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_ATTR_DIRECTORY(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_ATTR_ARCHIVE(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); - -extern void SbRtl_V_EMPTY(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_V_NULL(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_V_INTEGER(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_V_LONG(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_V_SINGLE(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_V_DOUBLE(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_V_CURRENCY(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_V_DATE(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_V_STRING(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); - -extern void SbRtl_MB_OK(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_OKCANCEL(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_ABORTRETRYIGNORE(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_YESNOCANCEL(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_YESNO(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_RETRYCANCEL(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_ICONSTOP(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_ICONQUESTION(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_ICONEXCLAMATION(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_ICONINFORMATION(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_DEFBUTTON1(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_DEFBUTTON2(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_DEFBUTTON3(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_APPLMODAL(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_MB_SYSTEMMODAL(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); - -extern void SbRtl_IDOK(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_IDCANCEL(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_IDABORT(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_IDRETRY(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_IDIGNORE(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_IDYES(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_IDNO(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); - -extern void SbRtl_CF_TEXT(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_CF_BITMAP(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_CF_METAFILEPICT(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); extern void SbRtl_PI(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_SET_OFF(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_SET_ON(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TOGGLE(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); - -extern void SbRtl_TYP_AUTHORFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_CHAPTERFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_CONDTXTFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_DATEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_DBFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_DBNAMEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_DBNEXTSETFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_DBNUMSETFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_DBSETNUMBERFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_DDEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_DOCINFOFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_DOCSTATFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_EXTUSERFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_FILENAMEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_FIXDATEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_FIXTIMEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_FORMELFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_GETFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_GETREFFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_HIDDENPARAFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_HIDDENTXTFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_INPUTFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_MACROFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_NEXTPAGEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_PAGENUMBERFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_POSTITFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_PREVPAGEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_SEQFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_SETFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_SETINPFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_SETREFFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_TEMPLNAMEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_TIMEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_USERFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_USRINPFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_SETREFPAGEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_GETREFPAGEFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_INTERNETFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_TYP_JUMPEDITFLD(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); - -extern void SbRtl_FRAMEANCHORPAGE(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_FRAMEANCHORPARA(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_FRAMEANCHORCHAR(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); - -extern void SbRtl_CLEAR_ALLTABS(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_CLEAR_TAB(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); -extern void SbRtl_SET_TAB(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); - // Methods extern void SbRtl_CreateObject(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index 662a7d696859..0612ea0d1acb 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -89,16 +89,92 @@ struct SbiForStack { // for/next stack: #define MAXRECURSION 500 //to prevent dead-recursions -enum class SbAttributes { - NONE = 0x0000, - READONLY = 0x0001, - HIDDEN = 0x0002, - DIRECTORY = 0x0010 -}; +// Related to: Dir, GetAttr, SetAttr +namespace SbAttributes +{ +constexpr sal_Int16 NORMAL = 0x0000; +constexpr sal_Int16 READONLY = 0x0001; +constexpr sal_Int16 HIDDEN = 0x0002; +constexpr sal_Int16 SYSTEM = 0x0004; +constexpr sal_Int16 VOLUME = 0x0008; +constexpr sal_Int16 DIRECTORY = 0x0010; +constexpr sal_Int16 ARCHIVE = 0x0020; +} + +// Related to: MsgBox (Buttons argument) +namespace SbMB +{ +constexpr sal_Int16 OK = 0; +constexpr sal_Int16 OKCANCEL = 1; +constexpr sal_Int16 ABORTRETRYIGNORE = 2; +constexpr sal_Int16 YESNOCANCEL = 3; +constexpr sal_Int16 YESNO = 4; +constexpr sal_Int16 RETRYCANCEL = 5; +constexpr sal_Int16 ICONSTOP = 16; +constexpr sal_Int16 ICONQUESTION = 32; +constexpr sal_Int16 ICONEXCLAMATION = 48; +constexpr sal_Int16 ICONINFORMATION = 64; +constexpr sal_Int16 DEFBUTTON1 = 0; +constexpr sal_Int16 DEFBUTTON2 = 256; +constexpr sal_Int16 DEFBUTTON3 = 512; +constexpr sal_Int16 APPLMODAL = 0; +constexpr sal_Int16 SYSTEMMODAL = 4096; +} + +// Related to: MsgBox (return value) +namespace SbMBID +{ +constexpr sal_Int16 OK = 1; +constexpr sal_Int16 CANCEL = 2; +constexpr sal_Int16 ABORT = 3; +constexpr sal_Int16 RETRY = 4; +constexpr sal_Int16 IGNORE = 5; +constexpr sal_Int16 YES = 6; +constexpr sal_Int16 NO = 7; +} -namespace o3tl +// Related to: SwFieldTypesEnum in sw/inc/fldbas.hxx +namespace SbTYP { - template<> struct typed_flags<SbAttributes> : is_typed_flags<SbAttributes, 0x13> {}; +constexpr sal_Int16 DATE = 0; +constexpr sal_Int16 TIME = 1; +constexpr sal_Int16 FILENAME = 2; +constexpr sal_Int16 DATABASENAME = 3; +constexpr sal_Int16 CHAPTER = 4; +constexpr sal_Int16 PAGENUMBER = 5; +constexpr sal_Int16 DOCUMENTSTATISTICS = 6; +constexpr sal_Int16 AUTHOR = 7; +constexpr sal_Int16 SET = 8; +constexpr sal_Int16 GET = 9; +constexpr sal_Int16 FORMEL = 10; +constexpr sal_Int16 HIDDENTEXT = 11; +constexpr sal_Int16 SETREF = 12; +constexpr sal_Int16 GETREF = 13; +constexpr sal_Int16 DDE = 14; +constexpr sal_Int16 MACRO = 15; +constexpr sal_Int16 INPUT = 16; +constexpr sal_Int16 HIDDENPARAGRAPH = 17; +constexpr sal_Int16 DOCUMENTINFO = 18; +constexpr sal_Int16 DATABASE = 19; +constexpr sal_Int16 USER = 20; +constexpr sal_Int16 POSTIT = 21; +constexpr sal_Int16 TEMPLATENAME = 22; +constexpr sal_Int16 SEQUENCE = 23; +constexpr sal_Int16 DATABASENEXTSET = 24; +constexpr sal_Int16 DATABASENUMBERSET = 25; +constexpr sal_Int16 DATABASESETNUMBER = 26; +constexpr sal_Int16 CONDITIONALTEXT = 27; +constexpr sal_Int16 NEXTPAGE = 28; +constexpr sal_Int16 PREVIOUSPAGE = 29; +constexpr sal_Int16 EXTENDEDUSER = 30; +constexpr sal_Int16 FIXEDDATE = 31; +constexpr sal_Int16 FIXEDTIME = 32; +constexpr sal_Int16 SETINPUT = 33; +constexpr sal_Int16 USERINPUT = 34; +constexpr sal_Int16 SETREFPAGE = 35; +constexpr sal_Int16 GETREFPAGE = 36; +constexpr sal_Int16 INTERNET = 37; +constexpr sal_Int16 JUMPEDIT = 38; } class SbiRTLData @@ -106,7 +182,7 @@ class SbiRTLData public: std::unique_ptr<osl::Directory> pDir; - SbAttributes nDirFlags; + sal_Int16 nDirFlags; short nCurDirPos; OUString sFullNameToBeChecked; diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx index 824cb90ea1a2..c62292351d06 100644 --- a/basic/source/inc/stdobj.hxx +++ b/basic/source/inc/stdobj.hxx @@ -30,8 +30,6 @@ class SbiStdObject final : public SbxObject std::optional<SbStdFactory> pStdFactory; virtual ~SbiStdObject() override; - using SbxVariable::GetInfo; - static SbxInfo* GetInfo(short); virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; public: diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 2e2381a121c5..05939417c688 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -2541,15 +2541,14 @@ void SbRtl_Dir(StarBASIC *, SbxArray & rPar, bool) rPar.Get(0)->PutString(u""_ustr); } - SbAttributes nFlags = SbAttributes::NONE; + sal_Int16 nFlags = SbAttributes::NORMAL; if ( nParCount > 2 ) { - rRTLData.nDirFlags = nFlags - = static_cast<SbAttributes>(rPar.Get(2)->GetInteger()); + rRTLData.nDirFlags = nFlags = rPar.Get(2)->GetInteger(); } else { - rRTLData.nDirFlags = SbAttributes::NONE; + rRTLData.nDirFlags = SbAttributes::NORMAL; } // Read directory bool bIncludeFolders = bool(nFlags & SbAttributes::DIRECTORY); @@ -2657,15 +2656,14 @@ void SbRtl_Dir(StarBASIC *, SbxArray & rPar, bool) OUString aDirURL = implSetupWildcard(aFileParam, rRTLData); - SbAttributes nFlags = SbAttributes::NONE; + sal_Int16 nFlags = SbAttributes::NORMAL; if ( nParCount > 2 ) { - rRTLData.nDirFlags = nFlags - = static_cast<SbAttributes>(rPar.Get(2)->GetInteger()); + rRTLData.nDirFlags = nFlags = rPar.Get(2)->GetInteger(); } else { - rRTLData.nDirFlags = SbAttributes::NONE; + rRTLData.nDirFlags = SbAttributes::NORMAL; } // Read directory @@ -2766,7 +2764,7 @@ void SbRtl_GetAttr(StarBASIC *, SbxArray & rPar, bool) { if (rPar.Count() == 2) { - sal_Int16 nFlags = 0; + sal_Int16 nFlags = SbAttributes::NORMAL; // In Windows, we want to use Windows API to get the file attributes // for VBA interoperability. @@ -2816,15 +2814,15 @@ void SbRtl_GetAttr(StarBASIC *, SbxArray & rPar, bool) bool bDirectory = xSFI->isFolder( aPath ); if( bReadOnly ) { - nFlags |= sal_uInt16(SbAttributes::READONLY); + nFlags |= SbAttributes::READONLY; } if( bHidden ) { - nFlags |= sal_uInt16(SbAttributes::HIDDEN); + nFlags |= SbAttributes::HIDDEN; } if( bDirectory ) { - nFlags |= sal_uInt16(SbAttributes::DIRECTORY); + nFlags |= SbAttributes::DIRECTORY; } } catch(const Exception & ) @@ -2846,11 +2844,11 @@ void SbRtl_GetAttr(StarBASIC *, SbxArray & rPar, bool) bool bDirectory = isFolder( aType ); if( bReadOnly ) { - nFlags |= sal_uInt16(SbAttributes::READONLY); + nFlags |= SbAttributes::READONLY; } if( bDirectory ) { - nFlags |= sal_uInt16(SbAttributes::DIRECTORY); + nFlags |= SbAttributes::DIRECTORY; } } rPar.Get(0)->PutInteger(nFlags); @@ -4227,28 +4225,13 @@ void SbRtl_MsgBox(StarBASIC *, SbxArray & rPar, bool) } // tdf#151012 - initialize optional parameters with their default values (number of buttons) - WinBits nType = static_cast<WinBits>(GetOptionalIntegerParamOrDefault(rPar, 2, 0)); // MB_OK - WinBits nStyle = nType; - nStyle &= 15; // delete bits 4-16 - if (nStyle > 5) - nStyle = 0; - - enum BasicResponse - { - Ok = 1, - Cancel = 2, - Abort = 3, - Retry = 4, - Ignore = 5, - Yes = 6, - No = 7 - }; + sal_Int16 nType = GetOptionalIntegerParamOrDefault(rPar, 2, SbMB::OK); OUString aMsg = rPar.Get(1)->GetOUString(); // tdf#151012 - initialize optional parameters with their default values (title of dialog box) OUString aTitle = GetOptionalOUStringParamOrDefault(rPar, 3, Application::GetDisplayName()); - WinBits nDialogType = nType & (16+32+64); + sal_Int16 nDialogType = nType & (SbMB::ICONSTOP | SbMB::ICONQUESTION | SbMB::ICONINFORMATION); SolarMutexGuard aSolarGuard; weld::Widget* pParent = Application::GetDefDialogParent(); @@ -4257,16 +4240,16 @@ void SbRtl_MsgBox(StarBASIC *, SbxArray & rPar, bool) switch (nDialogType) { - case 16: + case SbMB::ICONSTOP: eType = VclMessageType::Error; break; - case 32: + case SbMB::ICONQUESTION: eType = VclMessageType::Question; break; - case 48: + case SbMB::ICONEXCLAMATION: eType = VclMessageType::Warning; break; - case 64: + case SbMB::ICONINFORMATION: eType = VclMessageType::Info; break; } @@ -4274,64 +4257,64 @@ void SbRtl_MsgBox(StarBASIC *, SbxArray & rPar, bool) std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eType, VclButtonsType::NONE, aMsg, GetpApp())); - switch (nStyle) + switch (nType & 0x0F) // delete bits 4-16 { - case 0: // MB_OK + case SbMB::OK: default: - xBox->add_button(GetStandardText(StandardButtonType::OK), BasicResponse::Ok); + xBox->add_button(GetStandardText(StandardButtonType::OK), SbMBID::OK); break; - case 1: // MB_OKCANCEL - xBox->add_button(GetStandardText(StandardButtonType::OK), BasicResponse::Ok); - xBox->add_button(GetStandardText(StandardButtonType::Cancel), BasicResponse::Cancel); + case SbMB::OKCANCEL: + xBox->add_button(GetStandardText(StandardButtonType::OK), SbMBID::OK); + xBox->add_button(GetStandardText(StandardButtonType::Cancel), SbMBID::CANCEL); - if (nType & 256 || nType & 512) - xBox->set_default_response(BasicResponse::Cancel); + if (nType & SbMB::DEFBUTTON2 || nType & SbMB::DEFBUTTON3) + xBox->set_default_response(SbMBID::CANCEL); else - xBox->set_default_response(BasicResponse::Ok); + xBox->set_default_response(SbMBID::OK); break; - case 2: // MB_ABORTRETRYIGNORE - xBox->add_button(GetStandardText(StandardButtonType::Abort), BasicResponse::Abort); - xBox->add_button(GetStandardText(StandardButtonType::Retry), BasicResponse::Retry); - xBox->add_button(GetStandardText(StandardButtonType::Ignore), BasicResponse::Ignore); - - if (nType & 256) - xBox->set_default_response(BasicResponse::Retry); - else if (nType & 512) - xBox->set_default_response(BasicResponse::Ignore); + case SbMB::ABORTRETRYIGNORE: + xBox->add_button(GetStandardText(StandardButtonType::Abort), SbMBID::ABORT); + xBox->add_button(GetStandardText(StandardButtonType::Retry), SbMBID::RETRY); + xBox->add_button(GetStandardText(StandardButtonType::Ignore), SbMBID::IGNORE); + + if (nType & SbMB::DEFBUTTON2) + xBox->set_default_response(SbMBID::RETRY); + else if (nType & SbMB::DEFBUTTON3) + xBox->set_default_response(SbMBID::IGNORE); else - xBox->set_default_response(BasicResponse::Cancel); + xBox->set_default_response(SbMBID::CANCEL); break; - case 3: // MB_YESNOCANCEL - xBox->add_button(GetStandardText(StandardButtonType::Yes), BasicResponse::Yes); - xBox->add_button(GetStandardText(StandardButtonType::No), BasicResponse::No); - xBox->add_button(GetStandardText(StandardButtonType::Cancel), BasicResponse::Cancel); + case SbMB::YESNOCANCEL: + xBox->add_button(GetStandardText(StandardButtonType::Yes), SbMBID::YES); + xBox->add_button(GetStandardText(StandardButtonType::No), SbMBID::NO); + xBox->add_button(GetStandardText(StandardButtonType::Cancel), SbMBID::CANCEL); - if (nType & 256 || nType & 512) - xBox->set_default_response(BasicResponse::Cancel); + if (nType & SbMB::DEFBUTTON2 || nType & SbMB::DEFBUTTON3) + xBox->set_default_response(SbMBID::CANCEL); else - xBox->set_default_response(BasicResponse::Yes); + xBox->set_default_response(SbMBID::YES); break; - case 4: // MB_YESNO - xBox->add_button(GetStandardText(StandardButtonType::Yes), BasicResponse::Yes); - xBox->add_button(GetStandardText(StandardButtonType::No), BasicResponse::No); + case SbMB::YESNO: + xBox->add_button(GetStandardText(StandardButtonType::Yes), SbMBID::YES); + xBox->add_button(GetStandardText(StandardButtonType::No), SbMBID::NO); - if (nType & 256 || nType & 512) - xBox->set_default_response(BasicResponse::No); + if (nType & SbMB::DEFBUTTON2 || nType & SbMB::DEFBUTTON3) + xBox->set_default_response(SbMBID::NO); else - xBox->set_default_response(BasicResponse::Yes); + xBox->set_default_response(SbMBID::YES); break; - case 5: // MB_RETRYCANCEL - xBox->add_button(GetStandardText(StandardButtonType::Retry), BasicResponse::Retry); - xBox->add_button(GetStandardText(StandardButtonType::Cancel), BasicResponse::Cancel); + case SbMB::RETRYCANCEL: + xBox->add_button(GetStandardText(StandardButtonType::Retry), SbMBID::RETRY); + xBox->add_button(GetStandardText(StandardButtonType::Cancel), SbMBID::CANCEL); - if (nType & 256 || nType & 512) - xBox->set_default_response(BasicResponse::Cancel); + if (nType & SbMB::DEFBUTTON2 || nType & SbMB::DEFBUTTON3) + xBox->set_default_response(SbMBID::CANCEL); else - xBox->set_default_response(BasicResponse::Retry); + xBox->set_default_response(SbMBID::RETRY); break; } @@ -4347,7 +4330,7 @@ void SbRtl_SetAttr(StarBASIC *, SbxArray & rPar, bool) if (rPar.Count() == 3) { OUString aStr = rPar.Get(1)->GetOUString(); - SbAttributes nFlags = static_cast<SbAttributes>(rPar.Get(2)->GetInteger()); + sal_Int16 nFlags = rPar.Get(2)->GetInteger(); if( hasUno() ) { @@ -4358,7 +4341,7 @@ void SbRtl_SetAttr(StarBASIC *, SbxArray & rPar, bool) { bool bReadOnly = bool(nFlags & SbAttributes::READONLY); xSFI->setReadOnly( aStr, bReadOnly ); - bool bHidden = bool(nFlags & SbAttributes::HIDDEN); + bool bHidden = bool(nFlags & SbAttributes::HIDDEN); xSFI->setHidden( aStr, bHidden ); } catch(const Exception & ) diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx index 82478bf6d3cf..3eccc378efee 100644 --- a/basic/source/runtime/props.cxx +++ b/basic/source/runtime/props.cxx @@ -48,8 +48,6 @@ void SbRtl_Err(StarBASIC *, SbxArray & rPar, bool bWrite) } } -void SbRtl_False(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutBool(false); } - void SbRtl_Empty(StarBASIC *, SbxArray &, bool) {} void SbRtl_Nothing(StarBASIC *, SbxArray & rPar, bool) @@ -66,106 +64,4 @@ void SbRtl_Null(StarBASIC *, SbxArray & rPar, bool) void SbRtl_PI(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutDouble(M_PI); } -void SbRtl_True(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutBool(true); } - -void SbRtl_ATTR_NORMAL(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(0); } -void SbRtl_ATTR_READONLY(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(1); } -void SbRtl_ATTR_HIDDEN(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(2); } -void SbRtl_ATTR_SYSTEM(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(4); } -void SbRtl_ATTR_VOLUME(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(8); } -void SbRtl_ATTR_DIRECTORY(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(16); } -void SbRtl_ATTR_ARCHIVE(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(32); } - -void SbRtl_V_EMPTY(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(0); } -void SbRtl_V_NULL(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(1); } -void SbRtl_V_INTEGER(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(2); } -void SbRtl_V_LONG(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(3); } -void SbRtl_V_SINGLE(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(4); } -void SbRtl_V_DOUBLE(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(5); } -void SbRtl_V_CURRENCY(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(6); } -void SbRtl_V_DATE(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(7); } -void SbRtl_V_STRING(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(8); } - -void SbRtl_MB_OK(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(0); } -void SbRtl_MB_OKCANCEL(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(1); } -void SbRtl_MB_ABORTRETRYIGNORE(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(2); } -void SbRtl_MB_YESNOCANCEL(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(3); } -void SbRtl_MB_YESNO(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(4); } -void SbRtl_MB_RETRYCANCEL(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(5); } -void SbRtl_MB_ICONSTOP(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(16); } -void SbRtl_MB_ICONQUESTION(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(32); } -void SbRtl_MB_ICONEXCLAMATION(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(48); } -void SbRtl_MB_ICONINFORMATION(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(64); } -void SbRtl_MB_DEFBUTTON1(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(0); } -void SbRtl_MB_DEFBUTTON2(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(256); } -void SbRtl_MB_DEFBUTTON3(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(512); } -void SbRtl_MB_APPLMODAL(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(0); } -void SbRtl_MB_SYSTEMMODAL(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(4096); } - -void SbRtl_IDOK(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(1); } -void SbRtl_IDCANCEL(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(2); } -void SbRtl_IDABORT(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(3); } -void SbRtl_IDRETRY(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(4); } -void SbRtl_IDIGNORE(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(5); } -void SbRtl_IDYES(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(6); } -void SbRtl_IDNO(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(7); } - -void SbRtl_CF_TEXT(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(1); } -void SbRtl_CF_BITMAP(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(2); } -void SbRtl_CF_METAFILEPICT(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(3); } - -void SbRtl_TYP_AUTHORFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(7); } -void SbRtl_TYP_CHAPTERFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(4); } -void SbRtl_TYP_CONDTXTFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(27); } -void SbRtl_TYP_DATEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(0); } -void SbRtl_TYP_DBFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(19); } -void SbRtl_TYP_DBNAMEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(3); } -void SbRtl_TYP_DBNEXTSETFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(24); } -void SbRtl_TYP_DBNUMSETFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(25); } -void SbRtl_TYP_DBSETNUMBERFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(26); } -void SbRtl_TYP_DDEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(14); } -void SbRtl_TYP_DOCINFOFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(18); } -void SbRtl_TYP_DOCSTATFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(6); } -void SbRtl_TYP_EXTUSERFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(30); } -void SbRtl_TYP_FILENAMEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(2); } -void SbRtl_TYP_FIXDATEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(31); } -void SbRtl_TYP_FIXTIMEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(32); } -void SbRtl_TYP_FORMELFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(10); } -void SbRtl_TYP_GETFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(9); } -void SbRtl_TYP_GETREFFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(13); } -void SbRtl_TYP_HIDDENPARAFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(17); } -void SbRtl_TYP_HIDDENTXTFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(11); } -void SbRtl_TYP_INPUTFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(16); } -void SbRtl_TYP_MACROFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(15); } -void SbRtl_TYP_NEXTPAGEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(28); } -void SbRtl_TYP_PAGENUMBERFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(5); } -void SbRtl_TYP_POSTITFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(21); } -void SbRtl_TYP_PREVPAGEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(29); } -void SbRtl_TYP_SEQFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(23); } -void SbRtl_TYP_SETFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(8); } -void SbRtl_TYP_SETINPFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(33); } -void SbRtl_TYP_SETREFFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(12); } -void SbRtl_TYP_TEMPLNAMEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(22); } -void SbRtl_TYP_TIMEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(1); } -void SbRtl_TYP_USERFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(20); } -void SbRtl_TYP_USRINPFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(34); } -void SbRtl_TYP_SETREFPAGEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(35); } -void SbRtl_TYP_GETREFPAGEFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(36); } -void SbRtl_TYP_INTERNETFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(37); } - -void SbRtl_SET_ON(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(1); } -void SbRtl_SET_OFF(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(0); } -void SbRtl_TOGGLE(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(2); } - -void SbRtl_FRAMEANCHORPAGE(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(1); } -void SbRtl_FRAMEANCHORPARA(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(14); } -void SbRtl_FRAMEANCHORCHAR(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(15); } - -void SbRtl_CLEAR_ALLTABS(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(2); } -void SbRtl_CLEAR_TAB(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(1); } -void SbRtl_SET_TAB(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(0); } - -void SbRtl_TYP_JUMPEDITFLD(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(38); } - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index b692c66de698..c8540f9a4fe7 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -280,7 +280,7 @@ const SbiRuntime::pStep2 SbiRuntime::aStep2[] = {// all opcodes with two operand // SbiRTLData SbiRTLData::SbiRTLData() - : nDirFlags(SbAttributes::NONE) + : nDirFlags(SbAttributes::NORMAL) , nCurDirPos(0) { } diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx index 122c00f2aebc..27f6deddc93f 100644 --- a/basic/source/runtime/stdobj.cxx +++ b/basic/source/runtime/stdobj.cxx @@ -35,25 +35,31 @@ // allow us space for a flag to denylist some functions in vba mode #define ARGSMASK_ 0x003F // 63 Arguments -#define COMPTMASK_ 0x00C0 // COMPATIBILITY mask + #define COMPATONLY_ 0x0080 // procedure is visible in vba mode only #define NORMONLY_ 0x0040 // procedure is visible in normal mode only +#define COMPTMASK_ (COMPATONLY_ | NORMONLY_) // COMPATIBILITY mask -#define RWMASK_ 0x0F00 // mask for R/W-bits -#define TYPEMASK_ 0xF000 // mask for the entry's type - +#define READ_ 0x0100 // parameter allows read +#define WRITE_ 0x0200 // parameter allows write #define OPT_ 0x0400 // parameter is optional #define CONST_ 0x0800 // property is const -#define METHOD_ 0x3000 +#define RWMASK_ (READ_ | WRITE_ | OPT_ | CONST_) // mask for R/W-bits + +#define FUNC_TYPE_ 0x1000 // functional type +#define SUB_TYPE_ 0x2000 // sub type +#define METHOD_ (FUNC_TYPE_ | SUB_TYPE_) #define PROPERTY_ 0x4000 #define OBJECT_ 0x8000 +#define TYPEMASK_ (METHOD_ | PROPERTY_ | OBJECT_) // mask for the entry's type + // combination of bits above: -#define FUNCTION_ 0x1100 -#define LFUNCTION_ 0x1300 // mask for function which also works as Lvalue -#define SUB_ 0x2100 -#define ROPROP_ 0x4100 // mask Read Only-Property -#define RWPROP_ 0x4300 // mask Read/Write-Property -#define CPROP_ 0x4900 // mask for constant +#define FUNCTION_ (FUNC_TYPE_ | READ_) +#define LFUNCTION_ (FUNC_TYPE_ | READ_ | WRITE_) // mask for function which also works as Lvalue (statement) +#define SUB_ (SUB_TYPE_) +#define ROPROP_ (PROPERTY_ | READ_) // mask Read Only-Property +#define RWPROP_ (PROPERTY_ | READ_ | WRITE_) // mask Read/Write-Property +#define CPROP_ (PROPERTY_ | READ_ | CONST_) // mask for constant namespace { @@ -82,20 +88,9 @@ template <int N> constexpr bool MethodsTableValid(const Method (&rMethods)[N]) { int nCurMethArgs = 0; int nArgsChecked = 0; - bool bFinished = false; for (const auto& m : rMethods) { - assert(!bFinished); // no entries after end-of-table entry - if (bFinished) - return false; - if (m.nArgs == -1) // end-of-table entry - { - assert(nCurMethArgs == nArgsChecked); // last method had correct # of arguments - if (nCurMethArgs != nArgsChecked) - return false; - bFinished = true; - } - else if (m.pFunc) // main (function/sub/etc) entry + if (m.pFunc) // main (function/sub/etc) entry { assert(nCurMethArgs == nArgsChecked); // previous method had correct # of arguments if (nCurMethArgs != nArgsChecked) @@ -106,11 +101,12 @@ template <int N> constexpr bool MethodsTableValid(const Method (&rMethods)[N]) else // subordinate (argument) entry ++nArgsChecked; } - assert(bFinished); // its last entry was end-of-table entry - return bFinished; + assert(nCurMethArgs == nArgsChecked); // last method had correct # of arguments + return nCurMethArgs == nArgsChecked; } -} +template <bool N> void ConstBool(StarBASIC*, SbxArray& par, bool) { par.Get(0)->PutBool(N); } +template <sal_Int16 N> void ConstInt(StarBASIC*, SbxArray& par, bool) { par.Get(0)->PutInteger(N); } constexpr Method aMethods[] = { @@ -127,13 +123,14 @@ constexpr Method aMethods[] = { { u"Atn", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Atn }, arg(u"number", SbxDOUBLE), -{ u"ATTR_ARCHIVE", SbxINTEGER, CPROP_, SbRtl_ATTR_ARCHIVE }, -{ u"ATTR_DIRECTORY", SbxINTEGER, CPROP_, SbRtl_ATTR_DIRECTORY }, -{ u"ATTR_HIDDEN", SbxINTEGER, CPROP_, SbRtl_ATTR_HIDDEN }, -{ u"ATTR_NORMAL", SbxINTEGER, CPROP_, SbRtl_ATTR_NORMAL }, -{ u"ATTR_READONLY", SbxINTEGER, CPROP_, SbRtl_ATTR_READONLY }, -{ u"ATTR_SYSTEM", SbxINTEGER, CPROP_, SbRtl_ATTR_SYSTEM }, -{ u"ATTR_VOLUME", SbxINTEGER, CPROP_, SbRtl_ATTR_VOLUME }, +// Related to: Dir, GetAttr, SetAttr +{ u"ATTR_ARCHIVE", SbxINTEGER, CPROP_, ConstInt<SbAttributes::ARCHIVE> }, +{ u"ATTR_DIRECTORY", SbxINTEGER, CPROP_, ConstInt<SbAttributes::DIRECTORY> }, +{ u"ATTR_HIDDEN", SbxINTEGER, CPROP_, ConstInt<SbAttributes::HIDDEN> }, +{ u"ATTR_NORMAL", SbxINTEGER, CPROP_, ConstInt<SbAttributes::NORMAL> }, +{ u"ATTR_READONLY", SbxINTEGER, CPROP_, ConstInt<SbAttributes::READONLY> }, +{ u"ATTR_SYSTEM", SbxINTEGER, CPROP_, ConstInt<SbAttributes::SYSTEM> }, +{ u"ATTR_VOLUME", SbxINTEGER, CPROP_, ConstInt<SbAttributes::VOLUME> }, { u"Beep", SbxNULL, FUNCTION_, SbRtl_Beep }, { u"Blue", SbxINTEGER, 1 | FUNCTION_ | NORMONLY_, SbRtl_Blue }, @@ -186,9 +183,11 @@ constexpr Method aMethods[] = { { u"CDbl", SbxDOUBLE, 1 | FUNCTION_, SbRtl_CDbl }, arg(u"expression", SbxVARIANT), -{ u"CF_BITMAP", SbxINTEGER, CPROP_, SbRtl_CF_BITMAP }, -{ u"CF_METAFILEPICT", SbxINTEGER, CPROP_, SbRtl_CF_METAFILEPICT }, -{ u"CF_TEXT", SbxINTEGER, CPROP_, SbRtl_CF_TEXT }, +// FIXME: CF_* are for what??? They duplicate WinAPI clipboard constants, but why? +{ u"CF_BITMAP", SbxINTEGER, CPROP_, ConstInt<1> }, +{ u"CF_METAFILEPICT", SbxINTEGER, CPROP_, ConstInt<2> }, +{ u"CF_TEXT", SbxINTEGER, CPROP_, ConstInt<3> }, + { u"ChDir", SbxNULL, 1 | FUNCTION_, SbRtl_ChDir }, arg(u"string", SbxSTRING), @@ -208,8 +207,11 @@ constexpr Method aMethods[] = { { u"CInt", SbxINTEGER, 1 | FUNCTION_, SbRtl_CInt }, arg(u"expression", SbxVARIANT), -{ u"CLEAR_ALLTABS", SbxINTEGER, CPROP_, SbRtl_CLEAR_ALLTABS }, -{ u"CLEAR_TAB", SbxINTEGER, CPROP_, SbRtl_CLEAR_TAB }, +// FIXME: what for are these??? +{ u"SET_TAB", SbxINTEGER, CPROP_, ConstInt<0> }, +{ u"CLEAR_TAB", SbxINTEGER, CPROP_, ConstInt<1> }, +{ u"CLEAR_ALLTABS", SbxINTEGER, CPROP_, ConstInt<2> }, + { u"CLng", SbxLONG, 1 | FUNCTION_, SbRtl_CLng }, arg(u"expression", SbxVARIANT), @@ -358,7 +360,9 @@ constexpr Method aMethods[] = { { u"Exp", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Exp }, arg(u"number", SbxDOUBLE), -{ u"False", SbxBOOL, CPROP_, SbRtl_False }, +{ u"False", SbxBOOL, CPROP_, ConstBool<false> }, +{ u"True", SbxBOOL, CPROP_, ConstBool<true> }, + { u"FileAttr", SbxINTEGER, 2 | FUNCTION_, SbRtl_FileAttr }, arg(u"Channel", SbxINTEGER), arg(u"Attributes", SbxINTEGER), @@ -411,9 +415,11 @@ constexpr Method aMethods[] = { { u"Frac", SbxDOUBLE, 1 | FUNCTION_, SbRtl_Frac }, arg(u"number", SbxDOUBLE), -{ u"FRAMEANCHORCHAR", SbxINTEGER, CPROP_, SbRtl_FRAMEANCHORCHAR }, -{ u"FRAMEANCHORPAGE", SbxINTEGER, CPROP_, SbRtl_FRAMEANCHORPAGE }, -{ u"FRAMEANCHORPARA", SbxINTEGER, CPROP_, SbRtl_FRAMEANCHORPARA }, +// FIXME: what for are these??? +{ u"FRAMEANCHORPAGE", SbxINTEGER, CPROP_, ConstInt<1> }, +{ u"FRAMEANCHORCHAR", SbxINTEGER, CPROP_, ConstInt<15> }, +{ u"FRAMEANCHORPARA", SbxINTEGER, CPROP_, ConstInt<14> }, + { u"FreeFile", SbxINTEGER, FUNCTION_, SbRtl_FreeFile }, { u"FreeLibrary", SbxNULL, 1 | FUNCTION_, SbRtl_FreeLibrary }, arg(u"Modulename", SbxSTRING), @@ -456,13 +462,14 @@ constexpr Method aMethods[] = { { u"Hour", SbxINTEGER, 1 | FUNCTION_, SbRtl_Hour }, arg(u"Date", SbxDATE), -{ u"IDABORT", SbxINTEGER, CPROP_, SbRtl_IDABORT }, -{ u"IDCANCEL", SbxINTEGER, CPROP_, SbRtl_IDCANCEL }, -{ u"IDIGNORE", SbxINTEGER, CPROP_, SbRtl_IDIGNORE }, -{ u"IDNO", SbxINTEGER, CPROP_, SbRtl_IDNO }, -{ u"IDOK", SbxINTEGER, CPROP_, SbRtl_IDOK }, -{ u"IDRETRY", SbxINTEGER, CPROP_, SbRtl_IDRETRY }, -{ u"IDYES", SbxINTEGER, CPROP_, SbRtl_IDYES }, +// Related to: MsgBox (return value) +{ u"IDABORT", SbxINTEGER, CPROP_, ConstInt<SbMBID::ABORT> }, +{ u"IDCANCEL", SbxINTEGER, CPROP_, ConstInt<SbMBID::CANCEL> }, +{ u"IDIGNORE", SbxINTEGER, CPROP_, ConstInt<SbMBID::IGNORE> }, +{ u"IDNO", SbxINTEGER, CPROP_, ConstInt<SbMBID::NO> }, +{ u"IDOK", SbxINTEGER, CPROP_, ConstInt<SbMBID::OK> }, +{ u"IDRETRY", SbxINTEGER, CPROP_, ConstInt<SbMBID::RETRY> }, +{ u"IDYES", SbxINTEGER, CPROP_, ConstInt<SbMBID::YES> }, { u"Iif", SbxVARIANT, 3 | FUNCTION_, SbRtl_Iif }, arg(u"Bool", SbxBOOL), @@ -575,21 +582,22 @@ constexpr Method aMethods[] = { { u"LTrim", SbxSTRING, 1 | FUNCTION_, SbRtl_LTrim }, arg(u"string", SbxSTRING), -{ u"MB_ABORTRETRYIGNORE", SbxINTEGER, CPROP_, SbRtl_MB_ABORTRETRYIGNORE }, -{ u"MB_APPLMODAL", SbxINTEGER, CPROP_, SbRtl_MB_APPLMODAL }, -{ u"MB_DEFBUTTON1", SbxINTEGER, CPROP_, SbRtl_MB_DEFBUTTON1 }, -{ u"MB_DEFBUTTON2", SbxINTEGER, CPROP_, SbRtl_MB_DEFBUTTON2 }, -{ u"MB_DEFBUTTON3", SbxINTEGER, CPROP_, SbRtl_MB_DEFBUTTON3 }, -{ u"MB_ICONEXCLAMATION", SbxINTEGER, CPROP_, SbRtl_MB_ICONEXCLAMATION }, -{ u"MB_ICONINFORMATION", SbxINTEGER, CPROP_, SbRtl_MB_ICONINFORMATION }, -{ u"MB_ICONQUESTION", SbxINTEGER, CPROP_, SbRtl_MB_ICONQUESTION }, -{ u"MB_ICONSTOP", SbxINTEGER, CPROP_, SbRtl_MB_ICONSTOP }, -{ u"MB_OK", SbxINTEGER, CPROP_, SbRtl_MB_OK }, -{ u"MB_OKCANCEL", SbxINTEGER, CPROP_, SbRtl_MB_OKCANCEL }, -{ u"MB_RETRYCANCEL", SbxINTEGER, CPROP_, SbRtl_MB_RETRYCANCEL }, -{ u"MB_SYSTEMMODAL", SbxINTEGER, CPROP_, SbRtl_MB_SYSTEMMODAL }, -{ u"MB_YESNO", SbxINTEGER, CPROP_, SbRtl_MB_YESNO }, -{ u"MB_YESNOCANCEL", SbxINTEGER, CPROP_, SbRtl_MB_YESNOCANCEL }, +// Related to: MsgBox (Buttons argument) +{ u"MB_ABORTRETRYIGNORE", SbxINTEGER, CPROP_, ConstInt<SbMB::ABORTRETRYIGNORE> }, +{ u"MB_APPLMODAL", SbxINTEGER, CPROP_, ConstInt<SbMB::APPLMODAL> }, +{ u"MB_DEFBUTTON1", SbxINTEGER, CPROP_, ConstInt<SbMB::DEFBUTTON1> }, +{ u"MB_DEFBUTTON2", SbxINTEGER, CPROP_, ConstInt<SbMB::DEFBUTTON2> }, +{ u"MB_DEFBUTTON3", SbxINTEGER, CPROP_, ConstInt<SbMB::DEFBUTTON3> }, +{ u"MB_ICONEXCLAMATION", SbxINTEGER, CPROP_, ConstInt<SbMB::ICONEXCLAMATION> }, +{ u"MB_ICONINFORMATION", SbxINTEGER, CPROP_, ConstInt<SbMB::ICONINFORMATION> }, +{ u"MB_ICONQUESTION", SbxINTEGER, CPROP_, ConstInt<SbMB::ICONQUESTION> }, +{ u"MB_ICONSTOP", SbxINTEGER, CPROP_, ConstInt<SbMB::ICONSTOP> }, +{ u"MB_OK", SbxINTEGER, CPROP_, ConstInt<SbMB::OK> }, +{ u"MB_OKCANCEL", SbxINTEGER, CPROP_, ConstInt<SbMB::OKCANCEL> }, +{ u"MB_RETRYCANCEL", SbxINTEGER, CPROP_, ConstInt<SbMB::RETRYCANCEL> }, +{ u"MB_SYSTEMMODAL", SbxINTEGER, CPROP_, ConstInt<SbMB::SYSTEMMODAL> }, +{ u"MB_YESNO", SbxINTEGER, CPROP_, ConstInt<SbMB::YESNO> }, +{ u"MB_YESNOCANCEL", SbxINTEGER, CPROP_, ConstInt<SbMB::YESNOCANCEL> }, { u"Me", SbxOBJECT, 0 | FUNCTION_ | COMPATONLY_, SbRtl_Me }, { u"Mid", SbxSTRING, 3 | LFUNCTION_, SbRtl_Mid }, @@ -745,9 +753,11 @@ constexpr Method aMethods[] = { arg(u"PathName", SbxSTRING), arg(u"Attributes", SbxINTEGER), -{ u"SET_OFF", SbxINTEGER, CPROP_, SbRtl_SET_OFF }, -{ u"SET_ON", SbxINTEGER, CPROP_, SbRtl_SET_ON }, -{ u"SET_TAB", SbxINTEGER, CPROP_, SbRtl_SET_TAB }, +// FIXME: what for are these??? +{ u"SET_OFF", SbxINTEGER, CPROP_, ConstInt<0> }, +{ u"SET_ON", SbxINTEGER, CPROP_, ConstInt<1> }, +{ u"TOGGLE", SbxINTEGER, CPROP_, ConstInt<2> }, + { u"Sgn", SbxINTEGER, 1 | FUNCTION_, SbRtl_Sgn }, arg(u"number", SbxDOUBLE), @@ -823,53 +833,52 @@ constexpr Method aMethods[] = { { u"TimeValue", SbxDATE, 1 | FUNCTION_, SbRtl_TimeValue }, arg(u"String", SbxSTRING), -{ u"TOGGLE", SbxINTEGER, CPROP_, SbRtl_TOGGLE }, { u"Trim", SbxSTRING, 1 | FUNCTION_, SbRtl_Trim }, arg(u"String", SbxSTRING), -{ u"True", SbxBOOL, CPROP_, SbRtl_True }, { u"TwipsPerPixelX", SbxLONG, FUNCTION_, SbRtl_TwipsPerPixelX }, { u"TwipsPerPixelY", SbxLONG, FUNCTION_, SbRtl_TwipsPerPixelY }, -{ u"TYP_AUTHORFLD", SbxINTEGER, CPROP_, SbRtl_TYP_AUTHORFLD }, -{ u"TYP_CHAPTERFLD", SbxINTEGER, CPROP_, SbRtl_TYP_CHAPTERFLD }, -{ u"TYP_CONDTXTFLD", SbxINTEGER, CPROP_, SbRtl_TYP_CONDTXTFLD }, -{ u"TYP_DATEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DATEFLD }, -{ u"TYP_DBFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DBFLD }, -{ u"TYP_DBNAMEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DBNAMEFLD }, -{ u"TYP_DBNEXTSETFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DBNEXTSETFLD }, -{ u"TYP_DBNUMSETFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DBNUMSETFLD }, -{ u"TYP_DBSETNUMBERFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DBSETNUMBERFLD }, -{ u"TYP_DDEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DDEFLD }, -{ u"TYP_DOCINFOFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DOCINFOFLD }, -{ u"TYP_DOCSTATFLD", SbxINTEGER, CPROP_, SbRtl_TYP_DOCSTATFLD }, -{ u"TYP_EXTUSERFLD", SbxINTEGER, CPROP_, SbRtl_TYP_EXTUSERFLD }, -{ u"TYP_FILENAMEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_FILENAMEFLD }, -{ u"TYP_FIXDATEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_FIXDATEFLD }, -{ u"TYP_FIXTIMEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_FIXTIMEFLD }, -{ u"TYP_FORMELFLD", SbxINTEGER, CPROP_, SbRtl_TYP_FORMELFLD }, -{ u"TYP_GETFLD", SbxINTEGER, CPROP_, SbRtl_TYP_GETFLD }, -{ u"TYP_GETREFFLD", SbxINTEGER, CPROP_, SbRtl_TYP_GETREFFLD }, -{ u"TYP_GETREFPAGEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_GETREFPAGEFLD }, -{ u"TYP_HIDDENPARAFLD", SbxINTEGER, CPROP_, SbRtl_TYP_HIDDENPARAFLD }, -{ u"TYP_HIDDENTXTFLD", SbxINTEGER, CPROP_, SbRtl_TYP_HIDDENTXTFLD }, -{ u"TYP_INPUTFLD", SbxINTEGER, CPROP_, SbRtl_TYP_INPUTFLD }, -{ u"TYP_INTERNETFLD", SbxINTEGER, CPROP_, SbRtl_TYP_INTERNETFLD }, -{ u"TYP_JUMPEDITFLD", SbxINTEGER, CPROP_, SbRtl_TYP_JUMPEDITFLD }, -{ u"TYP_MACROFLD", SbxINTEGER, CPROP_, SbRtl_TYP_MACROFLD }, -{ u"TYP_NEXTPAGEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_NEXTPAGEFLD }, -{ u"TYP_PAGENUMBERFLD", SbxINTEGER, CPROP_, SbRtl_TYP_PAGENUMBERFLD }, -{ u"TYP_POSTITFLD", SbxINTEGER, CPROP_, SbRtl_TYP_POSTITFLD }, -{ u"TYP_PREVPAGEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_PREVPAGEFLD }, -{ u"TYP_SEQFLD", SbxINTEGER, CPROP_, SbRtl_TYP_SEQFLD }, -{ u"TYP_SETFLD", SbxINTEGER, CPROP_, SbRtl_TYP_SETFLD }, -{ u"TYP_SETINPFLD", SbxINTEGER, CPROP_, SbRtl_TYP_SETINPFLD }, -{ u"TYP_SETREFFLD", SbxINTEGER, CPROP_, SbRtl_TYP_SETREFFLD }, -{ u"TYP_SETREFPAGEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_SETREFPAGEFLD }, -{ u"TYP_TEMPLNAMEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_TEMPLNAMEFLD }, -{ u"TYP_TIMEFLD", SbxINTEGER, CPROP_, SbRtl_TYP_TIMEFLD }, -{ u"TYP_USERFLD", SbxINTEGER, CPROP_, SbRtl_TYP_USERFLD }, -{ u"TYP_USRINPFLD", SbxINTEGER, CPROP_, SbRtl_TYP_USRINPFLD }, +// Related to: SwFieldTypesEnum in sw/inc/fldbas.hxx, .uno:InsertField (Type param), .uno:InsertDBField (Type param) +{ u"TYP_AUTHORFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::AUTHOR> }, +{ u"TYP_CHAPTERFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::CHAPTER> }, +{ u"TYP_CONDTXTFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::CONDITIONALTEXT> }, +{ u"TYP_DATEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATE> }, +{ u"TYP_DBFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATABASE> }, +{ u"TYP_DBNAMEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATABASENAME> }, +{ u"TYP_DBNEXTSETFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATABASENEXTSET> }, +{ u"TYP_DBNUMSETFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATABASENUMBERSET> }, +{ u"TYP_DBSETNUMBERFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DATABASESETNUMBER> }, +{ u"TYP_DDEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DDE> }, +{ u"TYP_DOCINFOFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DOCUMENTINFO> }, +{ u"TYP_DOCSTATFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::DOCUMENTSTATISTICS> }, +{ u"TYP_EXTUSERFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::EXTENDEDUSER> }, +{ u"TYP_FILENAMEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::FILENAME> }, +{ u"TYP_FIXDATEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::FIXEDDATE> }, +{ u"TYP_FIXTIMEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::FIXEDTIME> }, +{ u"TYP_FORMELFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::FORMEL> }, +{ u"TYP_GETFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::GET> }, +{ u"TYP_GETREFFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::GETREF> }, +{ u"TYP_GETREFPAGEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::GETREFPAGE> }, +{ u"TYP_HIDDENPARAFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::HIDDENPARAGRAPH> }, +{ u"TYP_HIDDENTXTFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::HIDDENTEXT> }, +{ u"TYP_INPUTFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::INPUT> }, +{ u"TYP_INTERNETFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::INTERNET> }, +{ u"TYP_JUMPEDITFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::JUMPEDIT> }, +{ u"TYP_MACROFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::MACRO> }, +{ u"TYP_NEXTPAGEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::NEXTPAGE> }, +{ u"TYP_PAGENUMBERFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::PAGENUMBER> }, +{ u"TYP_POSTITFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::POSTIT> }, +{ u"TYP_PREVPAGEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::PREVIOUSPAGE> }, +{ u"TYP_SEQFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::SEQUENCE> }, +{ u"TYP_SETFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::SET> }, +{ u"TYP_SETINPFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::SETINPUT> }, +{ u"TYP_SETREFFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::SETREF> }, +{ u"TYP_SETREFPAGEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::SETREFPAGE> }, +{ u"TYP_TEMPLNAMEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::TEMPLATENAME> }, +{ u"TYP_TIMEFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::TIME> }, +{ u"TYP_USERFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::USER> }, +{ u"TYP_USRINPFLD", SbxINTEGER, CPROP_, ConstInt<SbTYP::USERINPUT> }, { u"TypeLen", SbxINTEGER, 1 | FUNCTION_, SbRtl_TypeLen }, arg(u"Var", SbxVARIANT), @@ -892,15 +901,16 @@ constexpr Method aMethods[] = { { u"VarType", SbxINTEGER, 1 | FUNCTION_, SbRtl_VarType }, arg(u"Varname", SbxVARIANT), -{ u"V_EMPTY", SbxINTEGER, CPROP_, SbRtl_V_EMPTY }, -{ u"V_NULL", SbxINTEGER, CPROP_, SbRtl_V_NULL }, -{ u"V_INTEGER", SbxINTEGER, CPROP_, SbRtl_V_INTEGER }, -{ u"V_LONG", SbxINTEGER, CPROP_, SbRtl_V_LONG }, -{ u"V_SINGLE", SbxINTEGER, CPROP_, SbRtl_V_SINGLE }, -{ u"V_DOUBLE", SbxINTEGER, CPROP_, SbRtl_V_DOUBLE }, -{ u"V_CURRENCY", SbxINTEGER, CPROP_, SbRtl_V_CURRENCY }, -{ u"V_DATE", SbxINTEGER, CPROP_, SbRtl_V_DATE }, -{ u"V_STRING", SbxINTEGER, CPROP_, SbRtl_V_STRING }, +// Related to: VarType +{ u"V_EMPTY", SbxINTEGER, CPROP_, ConstInt<SbxEMPTY> }, +{ u"V_NULL", SbxINTEGER, CPROP_, ConstInt<SbxNULL> }, +{ u"V_INTEGER", SbxINTEGER, CPROP_, ConstInt<SbxINTEGER> }, +{ u"V_LONG", SbxINTEGER, CPROP_, ConstInt<SbxLONG> }, +{ u"V_SINGLE", SbxINTEGER, CPROP_, ConstInt<SbxSINGLE> }, +{ u"V_DOUBLE", SbxINTEGER, CPROP_, ConstInt<SbxDOUBLE> }, +{ u"V_CURRENCY", SbxINTEGER, CPROP_, ConstInt<SbxCURRENCY> }, +{ u"V_DATE", SbxINTEGER, CPROP_, ConstInt<SbxDATE> }, +{ u"V_STRING", SbxINTEGER, CPROP_, ConstInt<SbxSTRING> }, { u"Wait", SbxNULL, 1 | FUNCTION_, SbRtl_Wait }, arg(u"Milliseconds", SbxLONG), @@ -921,11 +931,33 @@ constexpr Method aMethods[] = { { u"Year", SbxINTEGER, 1 | FUNCTION_, SbRtl_Year }, arg(u"Date", SbxDATE), - -{ {}, SbxNULL, -1, nullptr }}; // end of the table +}; // end of the table static_assert(MethodsTableValid(aMethods)); +// building the info-structure for single elements +// if nIdx = 0, don't create anything (Std-Props!) + +SbxInfo* GetMethodInfo(std::size_t nIdx) +{ + if (!nIdx) + return nullptr; + assert(nIdx <= std::size(aMethods)); + const Method* p = &aMethods[nIdx - 1]; + SbxInfo* pInfo_ = new SbxInfo; + short nPar = p->nArgs & ARGSMASK_; + for (short i = 0; i < nPar; i++) + { + p++; + SbxFlagBits nFlags_ = static_cast<SbxFlagBits>((p->nArgs >> 8) & 0x03); + if (p->nArgs & OPT_) + nFlags_ |= SbxFlagBits::Optional; + pInfo_->AddParam(OUString(p->sName), p->eType, nFlags_); + } + return pInfo_; +} +} + SbiStdObject::SbiStdObject( const OUString& r, StarBASIC* pb ) : SbxObject( r ) { // #i92642: Remove default properties @@ -962,7 +994,7 @@ SbxVariable* SbiStdObject::Find( const OUString& rName, SbxClassType t ) { // else search one sal_uInt16 nHash_ = SbxVariable::MakeHashCode( rName ); - const Method* p = aMethods; + auto p = std::begin(aMethods); bool bFound = false; short nIndex = 0; sal_uInt16 nSrchMask = TYPEMASK_; @@ -973,8 +1005,9 @@ SbxVariable* SbiStdObject::Find( const OUString& rName, SbxClassType t ) case SbxClassType::Object: nSrchMask = OBJECT_; break; default: break; } - while( p->nArgs != -1 ) + while (p != std::end(aMethods)) { + assert(p < std::end(aMethods)); if( ( p->nArgs & nSrchMask ) && ( p->nHash == nHash_ ) && (rName.equalsIgnoreAsciiCase(p->sName))) @@ -1043,14 +1076,15 @@ void SbiStdObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SbxVariable* pVar = pHint->GetVar(); SbxArray* pPar_ = pVar->GetParameters(); - const sal_uInt16 nCallId = static_cast<sal_uInt16>(pVar->GetUserData()); + const std::size_t nCallId = pVar->GetUserData(); if( nCallId ) { const SfxHintId t = pHint->GetId(); if( t == SfxHintId::BasicInfoWanted ) - pVar->SetInfo( GetInfo( static_cast<short>(pVar->GetUserData()) ) ); + pVar->SetInfo(GetMethodInfo(nCallId)); else { + assert(nCallId <= std::size(aMethods)); bool bWrite = false; if( t == SfxHintId::BasicDataChanged ) bWrite = true; @@ -1071,27 +1105,4 @@ void SbiStdObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SbxObject::Notify( rBC, rHint ); } -// building the info-structure for single elements -// if nIdx = 0, don't create anything (Std-Props!) - -SbxInfo* SbiStdObject::GetInfo( short nIdx ) -{ - if( !nIdx ) - return nullptr; - const Method* p = &aMethods[ --nIdx ]; - SbxInfo* pInfo_ = new SbxInfo; - short nPar = p->nArgs & ARGSMASK_; - for( short i = 0; i < nPar; i++ ) - { - p++; - SbxFlagBits nFlags_ = static_cast<SbxFlagBits>(( p->nArgs >> 8 ) & 0x03); - if( p->nArgs & OPT_ ) - { - nFlags_ |= SbxFlagBits::Optional; - } - pInfo_->AddParam(OUString(p->sName), p->eType, nFlags_); - } - return pInfo_; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |