diff options
author | John Rice <jmrice@openoffice.org> | 2002-09-27 11:16:30 +0000 |
---|---|---|
committer | John Rice <jmrice@openoffice.org> | 2002-09-27 11:16:30 +0000 |
commit | e168de6dd36a1a38dd81b7f4fcae5df817ad11a6 (patch) | |
tree | 85270cac2b7422cb0d58e884dccbc99da61bff23 /scripting/source/runtimemgr/StorageBridge.cxx | |
parent | a9dcd87448499e3d23f4b50c23a5ad6ee1641527 (diff) |
Updates from code review for end of September release
Diffstat (limited to 'scripting/source/runtimemgr/StorageBridge.cxx')
-rw-r--r-- | scripting/source/runtimemgr/StorageBridge.cxx | 85 |
1 files changed, 47 insertions, 38 deletions
diff --git a/scripting/source/runtimemgr/StorageBridge.cxx b/scripting/source/runtimemgr/StorageBridge.cxx index b46d85c98c79..17f3d488a634 100644 --- a/scripting/source/runtimemgr/StorageBridge.cxx +++ b/scripting/source/runtimemgr/StorageBridge.cxx @@ -2,9 +2,9 @@ * * $RCSfile: StorageBridge.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aledoux $ $Date: 2002-09-24 12:59:32 $ + * last change: $Author: jmrice $ $Date: 2002-09-27 12:16:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,11 +59,6 @@ * ************************************************************************/ - -#include <stdio.h> -#include <rtl/ustring.hxx> -#include <osl/diagnose.h> - #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <drafts/com/sun/star/script/framework/storage/XScriptStorageManager.hpp> @@ -79,77 +74,91 @@ using namespace ::drafts::com::sun::star::script::framework; namespace scripting_runtimemgr { -const char* const SCRIPTIMPLACCESS_SERVICE = "drafts.com.sun.star.script.framework.storage.StorageProxy"; -const char* const SCRIPTSTORAGEMANAGER_SERVICE = "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager"; +const char* const SCRIPTIMPLACCESS_SERVICE = + "drafts.com.sun.star.script.framework.storage.StorageProxy"; +const char* const SCRIPTSTORAGEMANAGER_SERVICE = + "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager"; const int STORAGEID = 0; const int STORAGEPROXY = 0; //************************************************************************* // StorageBridge Constructor -StorageBridge::StorageBridge( const Reference< XComponentContext >& xContext, sal_Int16 sid ):m_xContext(xContext),m_sid(sid) +StorageBridge::StorageBridge( const Reference< XComponentContext >& xContext, + sal_uInt16 sid ) : m_xContext( xContext ), m_sid( sid ) { try { initStorage(); } - catch(RuntimeException& re) + catch ( RuntimeException & re ) { - OUString temp = OUSTR("StorageBridge::StorageBridge(salIn32&): "); - throw RuntimeException( temp.concat(re.Message), Reference< XInterface >()); + OUString temp = OUSTR( "StorageBridge::StorageBridge(salIn32&): " ); + throw RuntimeException( temp.concat( re.Message ), Reference< XInterface >() ); } } //************************************************************************* void -StorageBridge::initStorage() throw (::com::sun::star::uno::RuntimeException) +StorageBridge::initStorage() throw ( ::com::sun::star::uno::RuntimeException ) { try { - Reference< lang::XMultiComponentFactory > xMultiComFac = m_xContext->getServiceManager(); - validateXRef(xMultiComFac, "StorageBridge::StorageBridge: cannot get multicomponentfactory from multiservice factory"); + Reference< lang::XMultiComponentFactory > xMultiComFac = + m_xContext->getServiceManager(); + validateXRef( xMultiComFac, + "StorageBridge::StorageBridge: cannot get multicomponentfactory from multiservice factory" ); Reference< XInterface > temp; - if(STORAGEPROXY) + if ( STORAGEPROXY ) { - temp = xMultiComFac->createInstanceWithContext(OUString::createFromAscii(SCRIPTIMPLACCESS_SERVICE),m_xContext); - validateXRef(temp, "StorageBridge::StorageBridge: cannot get Storage service"); - m_xScriptImplAccess = Reference< storage::XScriptImplAccess > (temp, UNO_QUERY_THROW); + temp = xMultiComFac->createInstanceWithContext( + OUString::createFromAscii( SCRIPTIMPLACCESS_SERVICE ), m_xContext ); + validateXRef( temp, "StorageBridge::StorageBridge: cannot get Storage service" ); + m_xScriptImplAccess = Reference< storage::XScriptImplAccess > ( temp, + UNO_QUERY_THROW ); } else { - Any a = m_xContext->getValueByName(OUString::createFromAscii(SCRIPTSTORAGEMANAGER_SERVICE)); + Any a = m_xContext->getValueByName( + OUString::createFromAscii( SCRIPTSTORAGEMANAGER_SERVICE ) ); a >>= temp; - validateXRef(temp, "StorageBridge::StorageBridge: cannot get Storage service"); - Reference < storage::XScriptStorageManager > xScriptStorageManager = Reference< storage::XScriptStorageManager > (temp, UNO_QUERY_THROW); - validateXRef(xScriptStorageManager, "StorageBridge::StorageBridge: cannot get Script Storage Manager service"); - Reference < XInterface > xScriptStorage = xScriptStorageManager->getScriptStorage(m_sid); - validateXRef(xScriptStorage, "StorageBridge::StorageBridge: cannot get Script Storage service"); - m_xScriptImplAccess = Reference< storage::XScriptImplAccess > (xScriptStorage, UNO_QUERY_THROW); + validateXRef( temp, + "StorageBridge::StorageBridge: cannot get Storage service" ); + Reference< storage::XScriptStorageManager > xScriptStorageManager = + Reference< storage::XScriptStorageManager > ( temp, UNO_QUERY_THROW ); + validateXRef( xScriptStorageManager, + "StorageBridge::StorageBridge: cannot get Script Storage Manager service" ); + Reference< XInterface > xScriptStorage = + xScriptStorageManager->getScriptStorage( m_sid ); + validateXRef( xScriptStorage, + "StorageBridge::StorageBridge: cannot get Script Storage service" ); + m_xScriptImplAccess = + Reference< storage::XScriptImplAccess > ( xScriptStorage, UNO_QUERY_THROW ); } } - catch (Exception e) + catch ( Exception e ) { - OUString temp = OUSTR("StorageBridge::StorageBridge: "); - throw RuntimeException( temp.concat(e.Message), Reference< XInterface >()); + OUString temp = OUSTR( "StorageBridge::StorageBridge: " ); + throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() ); } } //************************************************************************* Sequence < Reference< scripturi::XScriptURI > > -StorageBridge::getImplementations(const Reference< scripturi::XScriptURI >& queryURI ) -throw (lang::IllegalArgumentException, RuntimeException) +StorageBridge::getImplementations( const Reference< scripturi::XScriptURI >& queryURI ) +throw ( lang::IllegalArgumentException, RuntimeException ) { - OSL_TRACE("In StorageBridge getImplementations...\n"); + OSL_TRACE( "In StorageBridge getImplementations...\n" ); Sequence < Reference< scripturi::XScriptURI > > results; try { - results = m_xScriptImplAccess->getImplementations(queryURI); + results = m_xScriptImplAccess->getImplementations( queryURI ); } - catch (Exception e) + catch ( Exception e ) { - OUString temp = OUSTR("StorageBridge::getImplementations: "); - throw RuntimeException( temp.concat(e.Message), Reference< XInterface >()); + OUString temp = OUSTR( "StorageBridge::getImplementations: " ); + throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() ); } return results; } -} +}// namespace |