Kaydet (Commit) e124cd4c authored tarafından Duncan Foster's avatar Duncan Foster

Script frameowrk refactoring

üst 3ec89c4e
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScriptData.hxx,v $ * $RCSfile: ScriptData.hxx,v $
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* *
* last change: $Author: dfoster $ $Date: 2002-10-23 14:21:58 $ * last change: $Author: dfoster $ $Date: 2002-10-24 12:00:38 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -59,8 +59,8 @@ ...@@ -59,8 +59,8 @@
* *
************************************************************************/ ************************************************************************/
#ifndef _SCRIPTING_STORAGE_ScriptData_HXX_ #ifndef _SCRIPTING_STORAGE_SCRIPTDATA_HXX_
#define _SCRIPTING_STORAGE_ScriptData_HXX_ #define _SCRIPTING_STORAGE_SCRIPTDATA_HXX_
#include <vector> #include <vector>
#include <map> #include <map>
...@@ -93,8 +93,8 @@ struct ScriptData ...@@ -93,8 +93,8 @@ struct ScriptData
, logicalname() , logicalname()
, languagedepprops() , languagedepprops()
, filesets() , filesets()
{ {
} }
inline ScriptData::ScriptData( const ::rtl::OUString __parcelURI, inline ScriptData::ScriptData( const ::rtl::OUString __parcelURI,
const ::rtl::OUString& __language, const ::rtl::OUString& __language,
...@@ -110,8 +110,8 @@ struct ScriptData ...@@ -110,8 +110,8 @@ struct ScriptData
, logicalname( __logicalname ) , logicalname( __logicalname )
, languagedepprops( __languagedepprops ) , languagedepprops( __languagedepprops )
, filesets( __filesets ) , filesets( __filesets )
{ {
} }
::rtl::OUString parcelURI; ::rtl::OUString parcelURI;
::rtl::OUString language; ::rtl::OUString language;
...@@ -120,11 +120,7 @@ struct ScriptData ...@@ -120,11 +120,7 @@ struct ScriptData
::rtl::OUString logicalname; ::rtl::OUString logicalname;
props_vec languagedepprops; props_vec languagedepprops;
filesets_map filesets; filesets_map filesets;
}; };
} // namespace scripting_impl } // namespace scripting_impl
#endif // _SCRIPTING_STORAGE_ScriptData_HXX_ #endif // _SCRIPTING_STORAGE_ScriptData_HXX_
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScriptElement.cxx,v $ * $RCSfile: ScriptElement.cxx,v $
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* *
* last change: $Author: dfoster $ $Date: 2002-10-23 14:21:59 $ * last change: $Author: dfoster $ $Date: 2002-10-24 12:00:38 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -59,9 +59,7 @@ ...@@ -59,9 +59,7 @@
* *
************************************************************************/ ************************************************************************/
#ifndef _SCRIPT_FRAMEWORK_STORAGE_SCRIPT_ELEMENT_HXX_
#include "ScriptElement.hxx" #include "ScriptElement.hxx"
#endif
#include <util/util.hxx> #include <util/util.hxx>
using namespace ::rtl; using namespace ::rtl;
...@@ -83,58 +81,54 @@ namespace scripting_impl ...@@ -83,58 +81,54 @@ namespace scripting_impl
*/ */
ScriptElement::ScriptElement( ScriptData & sII ) : ScriptElement::ScriptElement( ScriptData & sII ) :
m_sII( sII ), m_sII( sII ),
XMLElement(OUSTR("parcel")) XMLElement( OUSTR( "parcel" ) )
{ {
OSL_TRACE("ScriptElement ctor called\n"); OSL_TRACE( "ScriptElement ctor called\n" );
{ {
XMLElement* xel = new XMLElement(OUSTR("script")); XMLElement* xel = new XMLElement( OUSTR( "script" ) );
xel->addAttribute(OUSTR("language"), sII.language); xel->addAttribute( OUSTR( "language" ), sII.language );
Reference < xml::sax::XAttributeList > xal(xel); Reference < xml::sax::XAttributeList > xal( xel );
addSubElement(xal); addSubElement( xal );
} }
strpair_map::const_iterator mp_it = sII.locales.begin(); strpair_map::const_iterator mp_it = sII.locales.begin();
strpair_map::const_iterator mp_itend = sII.locales.end(); strpair_map::const_iterator mp_itend = sII.locales.end();
if ( mp_it != mp_itend ) for( ; mp_it != mp_itend; ++mp_it )
{ {
//Loop through the locales XMLElement* xel = new XMLElement( OUSTR( "locale" ) );
for(; mp_it != mp_itend; ++mp_it) xel->addAttribute( OUSTR( "lang" ), mp_it->first );
{ {
XMLElement* xel = new XMLElement(OUSTR("locale")); XMLElement* subxel = new XMLElement( OUSTR( "displayname" ) );
xel->addAttribute(OUSTR("lang"), mp_it->first); subxel->addAttribute( OUSTR( "value" ), mp_it->second.first );
Reference < xml::sax::XAttributeList > subxattl( subxel );
{ xel->addSubElement( subxattl );
XMLElement* subxel = new XMLElement(OUSTR("displayname")); }
subxel->addAttribute( OUSTR("value"), mp_it->second.first); {
Reference < xml::sax::XAttributeList > subxal(subxel); XMLElement* subxel = new XMLElement( OUSTR( "description" ),
xel->addSubElement(subxal); mp_it->second.second );
} Reference< xml::sax::XAttributeList > subxattl( subxel );
{ xel->addSubElement( subxattl );
XMLElement* subxel = new XMLElement(OUSTR("description"), }
mp_it->second.second);
Reference< xml::sax::XAttributeList > subxal(subxel); Reference < xml::sax::XAttributeList > xal( xel );
xel->addSubElement(subxal); addSubElement( xal );
}
Reference < xml::sax::XAttributeList > xal(xel);
addSubElement(xal);
}
} }
{ {
XMLElement* xel = new XMLElement(OUSTR("functionname")); XMLElement* xel = new XMLElement( OUSTR( "functionname" ) );
xel->addAttribute(OUSTR("value"), sII.functionname); xel->addAttribute( OUSTR( "value" ), sII.functionname );
Reference <xml::sax::XAttributeList> xal(xel); Reference < xml::sax::XAttributeList > xal( xel );
addSubElement(xal); addSubElement( xal );
} }
{ {
XMLElement* xel = new XMLElement(OUSTR("logicalname")); XMLElement* xel = new XMLElement( OUSTR( "logicalname" ) );
xel->addAttribute(OUSTR("value"), sII.logicalname); xel->addAttribute( OUSTR( "value" ), sII.logicalname );
Reference <xml::sax::XAttributeList> xal(xel); Reference < xml::sax::XAttributeList > xal( xel );
addSubElement(xal); addSubElement( xal );
} }
props_vec::const_iterator vp_it = sII.languagedepprops.begin(); props_vec::const_iterator vp_it = sII.languagedepprops.begin();
...@@ -142,56 +136,50 @@ ScriptElement::ScriptElement( ScriptData & sII ) : ...@@ -142,56 +136,50 @@ ScriptElement::ScriptElement( ScriptData & sII ) :
if ( vp_it != vp_itend ) if ( vp_it != vp_itend )
{ {
XMLElement* xel = new XMLElement(OUSTR("languagedepprops")); XMLElement* xel = new XMLElement( OUSTR( "languagedepprops" ) );
for(; vp_it != vp_itend ; ++vp_it) for( ; vp_it != vp_itend ; ++vp_it )
{ {
XMLElement* subxel = new XMLElement(OUSTR("prop")); XMLElement* subxel = new XMLElement( OUSTR( "prop" ) );
subxel->addAttribute( OUSTR( "name" ), vp_it->first ); subxel->addAttribute( OUSTR( "name" ), vp_it->first );
subxel->addAttribute( OUSTR( "value" ), vp_it->second ); subxel->addAttribute( OUSTR( "value" ), vp_it->second );
Reference <xml::sax::XAttributeList> subxal(subxel); Reference < xml::sax::XAttributeList > subxattl( subxel );
xel->addSubElement(subxal); xel->addSubElement( subxattl );
} }
Reference <xml::sax::XAttributeList> xal(xel); Reference < xml::sax::XAttributeList > xal( xel );
addSubElement(xal); addSubElement( xal );
} }
filesets_map::const_iterator fm_it = sII.filesets.begin(); filesets_map::const_iterator fm_it = sII.filesets.begin();
filesets_map::const_iterator fm_itend = sII.filesets.end(); filesets_map::const_iterator fm_itend = sII.filesets.end();
if( fm_it != fm_itend ) for( ; fm_it != fm_itend; ++fm_it )
{ {
for(; fm_it != fm_itend; ++fm_it) XMLElement* xel = new XMLElement( OUSTR( "fileset" ) );
xel->addAttribute( OUSTR( "name" ), fm_it->first );
vp_it = fm_it->second.first.begin();
vp_itend = fm_it->second.first.end();
for( ; vp_it != vp_itend; ++vp_it )
{ {
XMLElement* xel = new XMLElement(OUSTR("fileset")); XMLElement* subxel = new XMLElement( OUSTR( "prop" ) );
xel->addAttribute( OUSTR("name"), fm_it->first ); subxel->addAttribute( OUSTR( "name" ), vp_it->first );
subxel->addAttribute( OUSTR("value"), vp_it->second );
vp_it = fm_it->second.first.begin(); Reference < xml::sax::XAttributeList > subxattl( subxel );
vp_itend = fm_it->second.first.end(); xel->addSubElement( subxattl );
}
if( vp_it != vp_itend )
{ strpairvec_map::const_iterator sm_it = fm_it->second.second.begin();
for(; vp_it != vp_itend; ++vp_it) strpairvec_map::const_iterator sm_itend = fm_it->second.second.end();
{
XMLElement* subxel = new XMLElement(OUSTR("prop")); if( sm_it != sm_itend )
subxel->addAttribute( OUSTR("name"), vp_it->first); {
subxel->addAttribute( OUSTR("value"), vp_it->second); XMLElement* subxel = new XMLElement( OUSTR( "file" ) );
Reference < xml::sax::XAttributeList > subxal(subxel); xel->addAttribute( OUSTR( "name" ), sm_it->first );
xel->addSubElement(subxal);
} }
}
strpairvec_map::const_iterator sm_it = fm_it->second.second.begin();
strpairvec_map::const_iterator sm_itend = fm_it->second.second.end();
if( sm_it != sm_itend )
{
XMLElement* subxel = new XMLElement(OUSTR("file"));
xel->addAttribute( OUSTR("name"), sm_it->first );
}
}
} }
} }
...@@ -200,4 +188,4 @@ ScriptElement::~ScriptElement() SAL_THROW(()) ...@@ -200,4 +188,4 @@ ScriptElement::~ScriptElement() SAL_THROW(())
{ {
} }
} } // namespace scripting_impl
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScriptStorage.hxx,v $ * $RCSfile: ScriptStorage.hxx,v $
* *
* $Revision: 1.7 $ * $Revision: 1.8 $
* *
* last change: $Author: dfoster $ $Date: 2002-10-23 14:22:02 $ * last change: $Author: dfoster $ $Date: 2002-10-24 12:00:38 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -110,7 +110,7 @@ public: ...@@ -110,7 +110,7 @@ public:
//Constructors and Destructors //Constructors and Destructors
//========================================================================= //=========================================================================
explicit ScriptStorage( explicit ScriptStorage(
const css::uno::Reference< css::uno::XComponentContext > & xContext); const css::uno::Reference< css::uno::XComponentContext > & xContext );
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
virtual ~ScriptStorage() SAL_THROW( () ); virtual ~ScriptStorage() SAL_THROW( () );
//========================================================================= //=========================================================================
...@@ -118,13 +118,13 @@ public: ...@@ -118,13 +118,13 @@ public:
// XServiceInfo impl // XServiceInfo impl
//========================================================================= //=========================================================================
virtual ::rtl::OUString SAL_CALL getImplementationName() virtual ::rtl::OUString SAL_CALL getImplementationName()
throw (css::uno::RuntimeException); throw ( css::uno::RuntimeException );
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString & ServiceName ) virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString & ServiceName )
throw (css::uno::RuntimeException); throw ( css::uno::RuntimeException );
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw (css::uno::RuntimeException); throw ( css::uno::RuntimeException );
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
static css::uno::Sequence< ::rtl::OUString > SAL_CALL static css::uno::Sequence< ::rtl::OUString > SAL_CALL
getSupportedServiceNames_Static(); getSupportedServiceNames_Static();
...@@ -134,7 +134,7 @@ public: ...@@ -134,7 +134,7 @@ public:
//========================================================================= //=========================================================================
virtual void SAL_CALL virtual void SAL_CALL
initialize( css::uno::Sequence< css::uno::Any > const & args ) initialize( css::uno::Sequence< css::uno::Any > const & args )
throw (css::uno::RuntimeException, css::uno::Exception); throw ( css::uno::RuntimeException, css::uno::Exception );
//========================================================================= //=========================================================================
//XScriptInfoAccess //XScriptInfoAccess
...@@ -147,7 +147,7 @@ public: ...@@ -147,7 +147,7 @@ public:
*/ */
virtual css::uno::Sequence< ::rtl::OUString > virtual css::uno::Sequence< ::rtl::OUString >
SAL_CALL getScriptLogicalNames() SAL_CALL getScriptLogicalNames()
throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException );
//========================================================================= //=========================================================================
/** /**
...@@ -162,14 +162,14 @@ public: ...@@ -162,14 +162,14 @@ public:
virtual css::uno::Sequence< css::uno::Reference< dcsssf::storage::XScriptInfo > > virtual css::uno::Sequence< css::uno::Reference< dcsssf::storage::XScriptInfo > >
SAL_CALL getImplementations( SAL_CALL getImplementations(
const ::rtl::OUString& queryURI ) const ::rtl::OUString& queryURI )
throw (css::lang::IllegalArgumentException, css::uno::RuntimeException); throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException );
//========================================================================= //=========================================================================
// XScriptStorageExport // XScriptStorageExport
void SAL_CALL save() void SAL_CALL save()
throw (css::uno::RuntimeException); throw ( css::uno::RuntimeException );
//========================================================================= //=========================================================================
...@@ -185,13 +185,12 @@ public: ...@@ -185,13 +185,12 @@ public:
osl::Mutex m_mutex; osl::Mutex m_mutex;
bool m_bInitialised; bool m_bInitialised;
void updateMaps(const Datas_vec & vScriptDatas); void updateMaps( const Datas_vec & vScriptDatas );
void writeMetadataHeader( void writeMetadataHeader(
css::uno::Reference < css::xml::sax::XExtendedDocumentHandler > & xExDocHandler); css::uno::Reference < css::xml::sax::XExtendedDocumentHandler > & xExDocHandler );
} }; // class ScriptingStorage
; // class ScriptingStorage
} } // namespace scripting_impl
#endif #endif
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScriptStorageManager.cxx,v $ * $RCSfile: ScriptStorageManager.cxx,v $
* *
* $Revision: 1.9 $ * $Revision: 1.10 $
* *
* last change: $Author: dfoster $ $Date: 2002-10-24 08:44:09 $ * last change: $Author: dfoster $ $Date: 2002-10-24 12:00:38 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -100,18 +100,20 @@ ScriptStorageManager::ScriptStorageManager( const Reference< ...@@ -100,18 +100,20 @@ ScriptStorageManager::ScriptStorageManager( const Reference<
OSL_TRACE( "< ScriptStorageManager ctor called >\n" ); OSL_TRACE( "< ScriptStorageManager ctor called >\n" );
s_moduleCount.modCnt.acquire( &s_moduleCount.modCnt ); s_moduleCount.modCnt.acquire( &s_moduleCount.modCnt );
validateXRef( m_xContext, "ScriptStorageManager::ScriptStorageManager : cannot get component context" ); validateXRef( m_xContext,
"ScriptStorageManager::ScriptStorageManager : cannot get component context" );
m_xMgr = m_xContext->getServiceManager(); m_xMgr = m_xContext->getServiceManager();
validateXRef( m_xMgr, "ScriptStorageManager::ScriptStorageManager : cannot get service manager" ); validateXRef( m_xMgr,
"ScriptStorageManager::ScriptStorageManager : cannot get service manager" );
try try
{ {
// obtain the macro expander singleton to use in determining the // obtain the macro expander singleton to use in determining the
// location of the application script storage // location of the application script storage
Any aAny = m_xContext->getValueByName( OUString::createFromAscii( Any aAny = m_xContext->getValueByName( OUString::createFromAscii(
"/singletons/com.sun.star.util.theMacroExpander" ) ); "/singletons/com.sun.star.util.theMacroExpander" ) );
Reference<util::XMacroExpander> xME; Reference< util::XMacroExpander > xME;
if ( sal_False == ( aAny >>= xME ) ) if ( sal_False == ( aAny >>= xME ) )
{ {
throw RuntimeException( throw RuntimeException(
...@@ -121,12 +123,12 @@ ScriptStorageManager::ScriptStorageManager( const Reference< ...@@ -121,12 +123,12 @@ ScriptStorageManager::ScriptStorageManager( const Reference<
validateXRef( xME, "ScriptStorageManager constructor: can't get MacroExpander" ); validateXRef( xME, "ScriptStorageManager constructor: can't get MacroExpander" );
OUString base = OUString::createFromAscii( OUString base = OUString::createFromAscii(
SAL_CONFIGFILE( "${$SYSBINDIR/bootstrap" ) ); SAL_CONFIGFILE( "${$SYSBINDIR/bootstrap" ) );
setupAppStorage( xME, setupAppStorage( xME,
base.concat( OUString::createFromAscii( "::BaseInstallation}/share" ) ) ); base.concat( OUString::createFromAscii( "::BaseInstallation}/share" ) ) );
setupAppStorage( xME, setupAppStorage( xME,
base.concat( OUString::createFromAscii( "::UserInstallation}/user" ) ) ); base.concat( OUString::createFromAscii( "::UserInstallation}/user" ) ) );
} }
catch ( Exception & e ) catch ( Exception & e )
...@@ -140,17 +142,17 @@ ScriptStorageManager::ScriptStorageManager( const Reference< ...@@ -140,17 +142,17 @@ ScriptStorageManager::ScriptStorageManager( const Reference<
// ScriptStorageManager setupAppStorage // ScriptStorageManager setupAppStorage
void void
ScriptStorageManager::setupAppStorage( ScriptStorageManager::setupAppStorage(
const Reference<util::XMacroExpander> & xME, const Reference< util::XMacroExpander > & xME,
const OUString & storageStr ) const OUString & storageStr )
SAL_THROW ( ( RuntimeException ) ) SAL_THROW ( ( RuntimeException ) )
{ {
try try
{ {
Reference<XInterface> xInterface = Reference< XInterface > xInterface =
m_xMgr->createInstanceWithContext( m_xMgr->createInstanceWithContext(
OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), m_xContext ); OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), m_xContext );
validateXRef( xInterface, validateXRef( xInterface,
"ScriptStorageManager constructor: can't get SimpleFileAccess XInterface" ); "ScriptStorageManager constructor: can't get SimpleFileAccess XInterface" );
Reference<ucb::XSimpleFileAccess> xSFA( xInterface, UNO_QUERY_THROW ); Reference<ucb::XSimpleFileAccess> xSFA( xInterface, UNO_QUERY_THROW );
setupAnyStorage( xSFA, xME->expandMacros( storageStr ) ); setupAnyStorage( xSFA, xME->expandMacros( storageStr ) );
...@@ -176,8 +178,9 @@ SAL_THROW ( ( RuntimeException ) ) ...@@ -176,8 +178,9 @@ SAL_THROW ( ( RuntimeException ) )
try try
{ {
// create a ScriptingStorage using the SimpleFileAccess, the storageID // (from the count), and the URL to the application's shared area // create a ScriptingStorage using the SimpleFileAccess, the storageID
Sequence <Any> aArgs( 3 ); // (from the count), and the URL to the application's shared area
Sequence < Any > aArgs( 3 );
aArgs[ 0 ] <<= xSFA; aArgs[ 0 ] <<= xSFA;
aArgs[ 1 ] <<= m_count; aArgs[ 1 ] <<= m_count;
aArgs[ 2 ] <<= storageStr; aArgs[ 2 ] <<= storageStr;
...@@ -185,8 +188,8 @@ SAL_THROW ( ( RuntimeException ) ) ...@@ -185,8 +188,8 @@ SAL_THROW ( ( RuntimeException ) )
#ifdef _DEBUG #ifdef _DEBUG
fprintf( stderr, "creating storage for: %s\n", fprintf( stderr, "creating storage for: %s\n",
::rtl::OUStringToOString( ::rtl::OUStringToOString( storageStr,
storageStr, RTL_TEXTENCODING_ASCII_US ).pData->buffer ); RTL_TEXTENCODING_ASCII_US ).pData->buffer );
#endif #endif
Reference<XInterface> xInterface = Reference<XInterface> xInterface =
...@@ -209,8 +212,8 @@ SAL_THROW ( ( RuntimeException ) ) ...@@ -209,8 +212,8 @@ SAL_THROW ( ( RuntimeException ) )
catch ( Exception & e ) catch ( Exception & e )
{ {
throw RuntimeException( throw RuntimeException(
OUSTR( "ScriptStorageManager::setupAnyStorage: " ).concat( e.Message ), OUSTR( "ScriptStorageManager::setupAnyStorage: " ).concat(
Reference< XInterface >() ); e.Message ), Reference< XInterface >() );
} }
return m_count -1; return m_count -1;
...@@ -235,7 +238,7 @@ throw ( RuntimeException ) ...@@ -235,7 +238,7 @@ throw ( RuntimeException )
{ {
OSL_TRACE( "** ==> ScriptStorageManager in createScriptingStorage\n" ); OSL_TRACE( "** ==> ScriptStorageManager in createScriptingStorage\n" );
validateXRef( xSFA, validateXRef( xSFA,
"ScriptStorageManager::createScriptStorage: XSimpleFileAccess is not valid" ); "ScriptStorageManager::createScriptStorage: XSimpleFileAccess is not valid" );
return setupAnyStorage( xSFA, ::rtl::OUString::createFromAscii( "" ) ); return setupAnyStorage( xSFA, ::rtl::OUString::createFromAscii( "" ) );
} }
...@@ -270,7 +273,7 @@ throw( RuntimeException ) ...@@ -270,7 +273,7 @@ throw( RuntimeException )
Reference< XInterface >() ); Reference< XInterface >() );
} }
validateXRef( itr->second, validateXRef( itr->second,
"ScriptStorageManager::getScriptStorage: Cannot get ScriptStorage from ScriptStorageHash" ); "ScriptStorageManager::getScriptStorage: Cannot get ScriptStorage from ScriptStorageHash" );
return itr->second; return itr->second;
} }
...@@ -313,7 +316,8 @@ throw ( ::com::sun::star::uno::RuntimeException ) ...@@ -313,7 +316,8 @@ throw ( ::com::sun::star::uno::RuntimeException )
{ {
OSL_TRACE( "ScriptStorageManager::disposing started" ); OSL_TRACE( "ScriptStorageManager::disposing started" );
Reference< beans::XPropertySet > xScriptingContext(Source.Source, UNO_QUERY ); Reference< beans::XPropertySet > xScriptingContext(Source.Source, UNO_QUERY );
validateXRef( xScriptingContext, "ScriptStorageManager::dispjarStreamMap.osing can't get script context from EventObject" ); validateXRef( xScriptingContext,
"ScriptStorageManager::disposing can't get script context from EventObject" );
scripting_constants::ScriptingConstantsPool& scriptingConstantsPool = scripting_constants::ScriptingConstantsPool& scriptingConstantsPool =
scripting_constants::ScriptingConstantsPool::instance(); scripting_constants::ScriptingConstantsPool::instance();
...@@ -323,9 +327,11 @@ throw ( ::com::sun::star::uno::RuntimeException ) ...@@ -323,9 +327,11 @@ throw ( ::com::sun::star::uno::RuntimeException )
OSL_TRACE( "extracting sid"); OSL_TRACE( "extracting sid");
if( sal_False == (a >>= scriptStorageID ) ) if( sal_False == (a >>= scriptStorageID ) )
{ {
throw RuntimeException( throw RuntimeException(
OUSTR( "ScriptStorageManager::disposing: can't get script context" ), Reference< XInterface > ()); OUSTR( "ScriptStorageManager::disposing: can't get script context" ),
Reference< XInterface > ());
} }
// no need to do anything if there's no doc storage
if( scriptStorageID == -1 ) if( scriptStorageID == -1 )
{ {
return; return;
...@@ -374,15 +380,15 @@ SAL_THROW( () ) ...@@ -374,15 +380,15 @@ SAL_THROW( () )
return s_implName; return s_implName;
} }
//************************************************************************* //*************************************************************************
Reference<XInterface> SAL_CALL ss_create( const Reference< XComponentContext > & xCompC ); Reference< XInterface > SAL_CALL ss_create( const Reference< XComponentContext > & xCompC );
//************************************************************************* //*************************************************************************
Sequence<OUString> ss_getSupportedServiceNames( ) SAL_THROW( () ); Sequence< OUString > ss_getSupportedServiceNames( ) SAL_THROW( () );
//************************************************************************* //*************************************************************************
OUString ss_getImplementationName( ) SAL_THROW( () ); OUString ss_getImplementationName( ) SAL_THROW( () );
//************************************************************************* //*************************************************************************
Reference<XInterface> SAL_CALL si_create( const Reference< XComponentContext > & xCompC ); Reference< XInterface > SAL_CALL si_create( const Reference< XComponentContext > & xCompC );
//************************************************************************* //*************************************************************************
Sequence<OUString> si_getSupportedServiceNames( ) SAL_THROW( () ); Sequence< OUString > si_getSupportedServiceNames( ) SAL_THROW( () );
//************************************************************************* //*************************************************************************
OUString si_getImplementationName( ) SAL_THROW( () ); OUString si_getImplementationName( ) SAL_THROW( () );
//************************************************************************* //*************************************************************************
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScriptStorageManager.hxx,v $ * $RCSfile: ScriptStorageManager.hxx,v $
* *
* $Revision: 1.7 $ * $Revision: 1.8 $
* *
* last change: $Author: dfoster $ $Date: 2002-10-23 14:22:03 $ * last change: $Author: dfoster $ $Date: 2002-10-24 12:00:39 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -99,13 +99,13 @@ public: ...@@ -99,13 +99,13 @@ public:
// XServiceInfo implementation // XServiceInfo implementation
//====================================================================== //======================================================================
virtual ::rtl::OUString SAL_CALL getImplementationName() virtual ::rtl::OUString SAL_CALL getImplementationName()
throw(css::uno::RuntimeException); throw( css::uno::RuntimeException );
//---------------------------------------------------------------------- //----------------------------------------------------------------------
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
throw(css::uno::RuntimeException); throw( css::uno::RuntimeException );
//---------------------------------------------------------------------- //----------------------------------------------------------------------
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
throw(css::uno::RuntimeException); throw( css::uno::RuntimeException );
//====================================================================== //======================================================================
//XScriptStorageManager //XScriptStorageManager
...@@ -123,7 +123,7 @@ public: ...@@ -123,7 +123,7 @@ public:
*/ */
virtual sal_Int32 SAL_CALL createScriptStorage( virtual sal_Int32 SAL_CALL createScriptStorage(
const css::uno::Reference< css::ucb::XSimpleFileAccess > & xSFA ) const css::uno::Reference< css::ucb::XSimpleFileAccess > & xSFA )
throw (css::uno::RuntimeException); throw ( css::uno::RuntimeException );
//---------------------------------------------------------------------- //----------------------------------------------------------------------
/** /**
create a ScriptStorage using the XSimpleFileAccess, and a string URL create a ScriptStorage using the XSimpleFileAccess, and a string URL
...@@ -142,7 +142,7 @@ public: ...@@ -142,7 +142,7 @@ public:
createScriptStorageWithURI( createScriptStorageWithURI(
const css::uno::Reference< css::ucb::XSimpleFileAccess >& xSFA, const css::uno::Reference< css::ucb::XSimpleFileAccess >& xSFA,
const ::rtl::OUString& stringURI ) const ::rtl::OUString& stringURI )
throw (css::uno::RuntimeException); throw ( css::uno::RuntimeException );
//---------------------------------------------------------------------- //----------------------------------------------------------------------
/** /**
get a ScriptStorage component using its scriptStorageID get a ScriptStorage component using its scriptStorageID
...@@ -157,18 +157,18 @@ public: ...@@ -157,18 +157,18 @@ public:
*/ */
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getScriptStorage( virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getScriptStorage(
sal_Int32 scriptStorageID ) sal_Int32 scriptStorageID )
throw (css::uno::RuntimeException); throw ( css::uno::RuntimeException );
//====================================================================== //======================================================================
//XEventListener //XEventListener
//====================================================================== //======================================================================
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) virtual void SAL_CALL disposing( const css::lang::EventObject& Source )
throw (css::uno::RuntimeException); throw ( css::uno::RuntimeException );
private: private:
ScriptStorageManager(const ScriptStorageManager & ); ScriptStorageManager( const ScriptStorageManager & );
ScriptStorageManager& operator= (const ScriptStorageManager &); ScriptStorageManager& operator= ( const ScriptStorageManager & );
// to obtain other services if needed // to obtain other services if needed
css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::uno::XComponentContext > m_xContext;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScriptURI.cxx,v $ * $RCSfile: ScriptURI.cxx,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: dfoster $ $Date: 2002-10-24 07:33:39 $ * last change: $Author: dfoster $ $Date: 2002-10-24 12:00:39 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -77,7 +77,7 @@ using namespace ::com::sun::star::lang; ...@@ -77,7 +77,7 @@ using namespace ::com::sun::star::lang;
namespace scripting_impl { namespace scripting_impl {
static const OUString schema = OUString::createFromAscii("script://"); static const OUString schema = OUString::createFromAscii( "script://" );
/** /**
* Constructor * Constructor
...@@ -88,14 +88,15 @@ ScriptURI::ScriptURI( const ::rtl::OUString& scriptURI ) ...@@ -88,14 +88,15 @@ ScriptURI::ScriptURI( const ::rtl::OUString& scriptURI )
throw ( IllegalArgumentException ) : m_uri( scriptURI ) throw ( IllegalArgumentException ) : m_uri( scriptURI )
{ {
#ifdef _DEBUG #ifdef _DEBUG
printf("received uri: %s\n",::rtl::OUStringToOString(m_uri,RTL_TEXTENCODING_ASCII_US).pData->buffer); printf( "received uri: %s\n",::rtl::OUStringToOString( m_uri, RTL_TEXTENCODING_ASCII_US).pData->buffer );
#endif #endif
set_values(parseIt()); set_values( parseIt() );
if(!isValid()) if( !isValid() )
{ {
OSL_TRACE("ScriptURI ctor: throwing IllegalArgException"); OSL_TRACE( "ScriptURI ctor: throwing IllegalArgException" );
throw IllegalArgumentException( throw IllegalArgumentException(
OUSTR( "Failed to parse invalid URI: " ).concat( scriptURI ), Reference < XInterface > (), 1 ); OUSTR( "Failed to parse invalid URI: " ).concat( scriptURI ),
Reference < XInterface > (), 1 );
} }
} }
...@@ -163,14 +164,14 @@ bool ScriptURI::isValid( ) { ...@@ -163,14 +164,14 @@ bool ScriptURI::isValid( ) {
} }
//Private mutex guarded method for setting the members //Private mutex guarded method for setting the members
void ScriptURI::set_values(scripting_impl::Uri values) void ScriptURI::set_values( scripting_impl::Uri values )
{ {
osl::Guard< ::osl::Mutex > aGuard( m_mutex ); osl::Guard< ::osl::Mutex > aGuard( m_mutex );
m_valid=values.valid; m_valid = values.valid;
m_location=values.location; m_location = values.location;
m_language=values.language; m_language = values.language;
m_functionName=values.functionName; m_functionName = values.functionName;
m_logicalName=values.logicalName; m_logicalName = values.logicalName;
} }
/** /**
...@@ -187,26 +188,27 @@ Uri ScriptURI::parseIt() ...@@ -187,26 +188,27 @@ Uri ScriptURI::parseIt()
//attempt to parse //attempt to parse
// check that it starts script:// // check that it starts script://
// better check for OBO errors here // better check for OBO errors here
if(m_uri.indexOf(schema)!=0) if( m_uri.indexOf( schema ) != 0 )
{ {
OSL_TRACE("wrong schema"); OSL_TRACE( "wrong schema" );
results.valid=sal_False; results.valid=sal_False;
return results; return results;
} }
// substr from here to the '?' and set the logical name // substr from here to the '?' and set the logical name
sal_Int32 len=m_uri.indexOf('?'); sal_Int32 len = m_uri.indexOf( '?' );
if(len==-1) if( len == -1 )
{ {
// no queries so just set the logical name // no queries so just set the logical name
results.logicalName=m_uri.copy(schemaLen); results.logicalName = m_uri.copy( schemaLen );
results.valid=sal_True; results.valid = sal_True;
return results; return results;
} }
results.logicalName=m_uri.copy(schemaLen,len-schemaLen); results.logicalName = m_uri.copy( schemaLen, len-schemaLen );
#ifdef _DEBUG #ifdef _DEBUG
printf("log name: %s\n",::rtl::OUStringToOString(results.logicalName,RTL_TEXTENCODING_ASCII_US).pData->buffer); printf( "log name: %s\n", ::rtl::OUStringToOString( results.logicalName,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
#endif #endif
len++; len++;
...@@ -214,40 +216,44 @@ Uri ScriptURI::parseIt() ...@@ -214,40 +216,44 @@ Uri ScriptURI::parseIt()
OUString attr; OUString attr;
do do
{ {
attr=m_uri.getToken(0,';',len); attr = m_uri.getToken( 0, ';', len );
#ifdef _DEBUG #ifdef _DEBUG
printf("chunk: %s\n",::rtl::OUStringToOString(attr,RTL_TEXTENCODING_ASCII_US).pData->buffer); printf( "chunk: %s\n", ::rtl::OUStringToOString( attr,
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
#endif #endif
if(attr.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("language"))==sal_True) if( attr.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "language" ) )
== sal_True )
{ {
sal_Int32 len2=attr.indexOf('='); sal_Int32 len2 = attr.indexOf('=');
results.language=attr.copy(len2+1); results.language = attr.copy( len2 + 1 );
continue; continue;
} }
else if (attr.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("location"))==sal_True) else if ( attr.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "location" ) )
== sal_True )
{ {
sal_Int32 len2=attr.indexOf('='); sal_Int32 len2 = attr.indexOf( '=' );
results.location=attr.copy(len2+1); results.location = attr.copy( len2 + 1 );
continue; continue;
} }
else if (attr.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("function"))==sal_True) else if ( attr.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "function" ) )
== sal_True )
{ {
sal_Int32 len2=attr.indexOf('='); sal_Int32 len2 = attr.indexOf( '=' );
results.functionName=attr.copy(len2+1); results.functionName = attr.copy( len2 + 1 );
continue; continue;
} }
else else
{ {
#ifdef _DEBUG #ifdef _DEBUG
printf("Unknown attribute?\n"); printf( "Unknown attribute?\n" );
#endif #endif
} }
} }
while (len>=0) while ( len >= 0 );
;
// parse is good // parse is good
return results; return results;
} }
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ScriptURI.hxx,v $ * $RCSfile: ScriptURI.hxx,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: dfoster $ $Date: 2002-10-24 07:33:39 $ * last change: $Author: dfoster $ $Date: 2002-10-24 12:00:40 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -87,7 +87,7 @@ class ScriptURI ...@@ -87,7 +87,7 @@ class ScriptURI
{ {
public: public:
ScriptURI( const ::rtl::OUString& scriptURI ) ScriptURI( const ::rtl::OUString& scriptURI )
throw (css::lang::IllegalArgumentException); throw ( css::lang::IllegalArgumentException );
~ScriptURI() SAL_THROW ( () ); ~ScriptURI() SAL_THROW ( () );
/** /**
...@@ -144,7 +144,7 @@ private: ...@@ -144,7 +144,7 @@ private:
Uri parseIt(); Uri parseIt();
//set the members //set the members
/** @internal */ /** @internal */
void set_values(Uri); void set_values( Uri );
bool isValid(); bool isValid();
} }
; // class ScriptURI ; // class ScriptURI
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment