diff --git a/scripting/source/storage/ScriptStorage.cxx b/scripting/source/storage/ScriptStorage.cxx index 20ab77f5c98e..d6691043de61 100644 --- a/scripting/source/storage/ScriptStorage.cxx +++ b/scripting/source/storage/ScriptStorage.cxx @@ -2,8 +2,8 @@ * * $RCSfile: ScriptStorage.cxx,v $ * -* $Revision: 1.15 $ -* last change: $Author: dfoster $ $Date: 2002-11-06 16:26:25 $ +* $Revision: 1.16 $ +* last change: $Author: npower $ $Date: 2003-02-12 16:21:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -649,6 +649,43 @@ throw ( lang::IllegalArgumentException, return results; } +//************************************************************************* +Sequence< Reference< storage::XScriptInfo > > SAL_CALL +ScriptStorage::getAllImplementations() throw ( RuntimeException ) +{ + ::osl::Guard< osl::Mutex > aGuard( m_mutex ); + Sequence< Reference< storage::XScriptInfo > > results; + ScriptInfo_hash::iterator h_itEnd = mh_implementations.end(); + ScriptInfo_hash::iterator h_it = mh_implementations.begin(); + if ( h_it == h_itEnd ) + { + OSL_TRACE( "ScriptStorage::getImplementations: EMPTY STORAGE" ); + return results; + } + + + //iterater through each logical name and gather each implementation + //for that name + for ( sal_Int32 count = 0; h_it != h_itEnd; ++h_it ) + { + results.realloc( h_it->second.size() + count ); + OSL_TRACE( "Adding implementations for %s", + ::rtl::OUStringToOString( h_it->first, + RTL_TEXTENCODING_ASCII_US ).pData->buffer ); + Datas_vec::const_iterator it_datas = h_it->second.begin(); + Datas_vec::const_iterator it_datas_end = h_it->second.end(); + OSL_TRACE( "Adding %d to sequence of impls ", h_it->second.size() ); + for ( ; it_datas != it_datas_end ; ++it_datas ) + { + Reference< storage::XScriptInfo > xScriptInfo = new ScriptInfo ( + *it_datas, m_scriptStorageID ); + + results[ count++ ] = xScriptInfo; + } + } + return results; + +} //************************************************************************* OUString SAL_CALL ScriptStorage::getImplementationName( ) diff --git a/scripting/source/storage/ScriptStorage.hxx b/scripting/source/storage/ScriptStorage.hxx index 4cd8582f3e6d..891f893c30cc 100644 --- a/scripting/source/storage/ScriptStorage.hxx +++ b/scripting/source/storage/ScriptStorage.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ScriptStorage.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: lkovacs $ $Date: 2002-11-01 13:58:32 $ + * last change: $Author: npower $ $Date: 2003-02-12 16:21:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -166,6 +166,17 @@ public: const ::rtl::OUString& queryURI ) throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException ); + //========================================================================= + /** + * Get all script implementations + * + * + * @return sequence < XScriptInfo > + * script implementations + */ + virtual css::uno::Sequence< css::uno::Reference< dcsssf::storage::XScriptInfo > > + SAL_CALL getAllImplementations() + throw ( css::uno::RuntimeException ); //========================================================================= diff --git a/scripting/source/storage/ScriptStorageManager.cxx b/scripting/source/storage/ScriptStorageManager.cxx index 618fa0a04f21..c172b55c69f2 100644 --- a/scripting/source/storage/ScriptStorageManager.cxx +++ b/scripting/source/storage/ScriptStorageManager.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ScriptStorageManager.cxx,v $ * -* $Revision: 1.19 $ +* $Revision: 1.20 $ * -* last change: $Author: dfoster $ $Date: 2003-02-12 14:59:01 $ +* last change: $Author: npower $ $Date: 2003-02-12 16:21:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -294,8 +294,9 @@ throw( RuntimeException ) } //******************************************************************* -sal_Int32 -ScriptStorageManager::getScriptStorageID( const OUString & origURI ) +sal_Int32 SAL_CALL +ScriptStorageManager::getScriptStorageID( const ::rtl::OUString& origURI ) + throw (::com::sun::star::uno::RuntimeException) { StorageId_hash::const_iterator it = m_StorageIdOrigURIHash.find( origURI ); @@ -345,8 +346,9 @@ throw( RuntimeException ) sal_Int32 storageID = getScriptStorageID( stringURI ); - if ( storageID = -1 ) + if ( storageID == -1 ) { + OSL_TRACE( "** id was -1, no storage"); // Refreshing noexistent storage - just return return; } @@ -473,6 +475,7 @@ throw ( ::com::sun::star::uno::RuntimeException ) removeScriptDocURIHashEntry( docURI ); } + //************************************************************************* static Reference< XInterface > SAL_CALL ssm_create( diff --git a/scripting/source/storage/ScriptStorageManager.hxx b/scripting/source/storage/ScriptStorageManager.hxx index a2d416af6d5a..bee80dbb43fd 100644 --- a/scripting/source/storage/ScriptStorageManager.hxx +++ b/scripting/source/storage/ScriptStorageManager.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ScriptStorageManager.hxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: dfoster $ $Date: 2003-02-12 14:59:01 $ + * last change: $Author: npower $ $Date: 2003-02-12 16:21:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -169,6 +169,28 @@ public: sal_Int32 scriptStorageID ) throw ( css::uno::RuntimeException ); + /** + get a ScriptStorage ID using storage URI + + @param scriptStorageURI + the file URL for the document will retrieve storage id for the document, special treatment is reserved for the strings "USER"and "SHARE" which + retrieve storage id for application/user application/share areas respectively. + + + @returns as long ScriptStorage ID (-1 if no storage exists), which can be used in getScriptStorage method. + + */ + + virtual sal_Int32 SAL_CALL getScriptStorageID( const ::rtl::OUString& scriptStorageURI ) + throw (::com::sun::star::uno::RuntimeException); + + /** + refresh a storage component using its URI + + @param StringURI + URI of storage area, for documents, url to document eg, file:///home/user/ADocument.sxw To refresh the storage for user or share area, use USER or SHARE respectively instead or a url. + + */ virtual void SAL_CALL refreshScriptStorage(const ::rtl::OUString & stringURI) throw ( css::uno::RuntimeException ); @@ -206,7 +228,6 @@ private: ScriptStorageManager( const ScriptStorageManager & ); ScriptStorageManager& operator= ( const ScriptStorageManager & ); - sal_Int32 getScriptStorageID( const ::rtl::OUString & origURI); void removeScriptDocURIHashEntry( const ::rtl::OUString & origURI ); // to obtain other services if needed