diff options
author | Thomas Benisch <tbe@openoffice.org> | 2001-08-03 14:28:32 +0000 |
---|---|---|
committer | Thomas Benisch <tbe@openoffice.org> | 2001-08-03 14:28:32 +0000 |
commit | a12d1c430ffcbbd08e49cd0f34e128e6f5f1aa47 (patch) | |
tree | 086e456016107f7f5837b04e072caaf8bf3200e7 /sc/source/ui/dbgui/validate.cxx | |
parent | 57079ed41374c3b048ab6dd8ec2cd732a724941f (diff) |
#90171# scriptURL
Diffstat (limited to 'sc/source/ui/dbgui/validate.cxx')
-rw-r--r-- | sc/source/ui/dbgui/validate.cxx | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 1dd216667573..87df3b2a52da 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -2,9 +2,9 @@ * * $RCSfile: validate.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tbe $ $Date: 2001-07-25 07:46:32 $ + * last change: $Author: tbe $ $Date: 2001-08-03 15:25:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -507,26 +507,54 @@ IMPL_LINK( ScTPValidationError, ClickSearchHdl, PushButton*, pBtn ) { Window* pOld = Application::GetDefDialogParent(); Application::SetDefDialogParent( this ); - String aMacroURL = OfficeApplication::ChooseMacro(FALSE, TRUE); - Application::SetDefDialogParent( pOld ); - // aMacroURL has the following format: - // 'macro:///libname.modulename.macroname(args)' => Macro via App-BasMgr - // 'macro://[docname|.]/libname.modulename.macroname(args)' => Macro via corresponging Doc-BasMgr + // choose macro dialog + String aScriptURL = OfficeApplication::ChooseMacro(FALSE, TRUE); + + Application::SetDefDialogParent( pOld ); + // aScriptURL has the following format: + // vnd.sun.star.script:language=[language],macro=[macro],location=[location] + // [language] = StarBasic + // [macro] = libname.modulename.macroname + // [location] = application|document + // e.g. 'vnd.sun.star.script:language=StarBasic,macro=Standard.Module1.Main,location=document' + // // but for the UI we need this format: // 'macroname' - if ( aMacroURL.Len() != 0 ) + if ( aScriptURL.Len() != 0 ) { - sal_uInt16 nHashPos = aMacroURL.Search( '/', 8 ); - sal_uInt16 nArgsPos = aMacroURL.Search( '(' ); - - String aBasMgrName( INetURLObject::decode(aMacroURL.Copy( 8, nHashPos - 8 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) ); - String aQualifiedName( INetURLObject::decode(aMacroURL.Copy( nHashPos + 1, nArgsPos - nHashPos - 1 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) ); - String aLibName = aQualifiedName.GetToken(0, sal_Unicode('.')); - String aModuleName = aQualifiedName.GetToken(1, sal_Unicode('.')); - String aMacroName = aQualifiedName.GetToken(2, sal_Unicode('.')); + // parse script URL + BOOL bFound; + String aValue; + INetURLObject aINetScriptURL( aScriptURL ); + + // get language + String aLanguage; + bFound = aINetScriptURL.getParameter( String( RTL_CONSTASCII_USTRINGPARAM("language") ), &aValue ); + if ( bFound ) + aLanguage = aValue; + + // get macro + String aMacro; + String aLibName; + String aModuleName; + String aMacroName; + bFound = aINetScriptURL.getParameter( String( RTL_CONSTASCII_USTRINGPARAM("macro") ), &aValue ); + if ( bFound ) + { + aMacro = aValue; + aLibName = aMacro.GetToken(0, sal_Unicode('.')); + aModuleName = aMacro.GetToken(1, sal_Unicode('.')); + aMacroName = aMacro.GetToken(2, sal_Unicode('.')); + } + + // get location + String aLocation; + bFound = aINetScriptURL.getParameter( String( RTL_CONSTASCII_USTRINGPARAM("location") ), &aValue ); + if ( bFound ) + aLocation = aValue; aEdtTitle.SetText( aMacroName ); } |