Kaydet (Commit) e168de6d authored tarafından John Rice's avatar John Rice

Updates from code review for end of September release

üst a9dcd874
......@@ -2,9 +2,9 @@
*
* $RCSfile: ScriptingContext.cxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: aledoux $ $Date: 2002-09-25 09:14:20 $
* last change: $Author: jmrice $ $Date: 2002-09-27 12:16:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -59,8 +59,6 @@
*
************************************************************************/
#include <stdio.h>
#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/factory.hxx>
......@@ -79,32 +77,29 @@ namespace func_provider
// XScriptingContext implementation
//
//*************************************************************************
ScriptingContext::ScriptingContext( const Reference< XComponentContext > & xContext ) : m_xContext( xContext )
ScriptingContext::ScriptingContext( const Reference< XComponentContext > & xContext ) :
m_xContext( xContext )
{
OSL_TRACE( "< ScriptingContext ctor called >\n" );
validateXRef(m_xContext, "ScriptingContext::ScriptingContext: No context available\n");
validateXRef( m_xContext,
"ScriptingContext::ScriptingContext: No context available\n" );
//Setup internal hash map
Any nullAny;
/*m_propertyMap[scripting_constants::DOC_REF] = nullAny;
m_propertyMap[scripting_constants::DOC_STORAGE_ID] = nullAny;
m_propertyMap[scripting_constants::DOC_URI] = nullAny;
m_propertyMap[scripting_constants::RESOLVED_STORAGE_ID] = nullAny;*/
doc_ref = nullAny;
doc_storage_id = nullAny;
doc_uri = nullAny;
resolved_storage_id = nullAny;
m_propertyMap[ scripting_constants::DOC_REF ] = nullAny;
m_propertyMap[ scripting_constants::DOC_STORAGE_ID ] = nullAny;
m_propertyMap[ scripting_constants::DOC_URI ] = nullAny;
m_propertyMap[ scripting_constants::RESOLVED_STORAGE_ID ] = nullAny;
}
//*************************************************************************
/*bool ScriptingContext::validateKey( const ::rtl::OUString& key)
bool ScriptingContext::validateKey( const ::rtl::OUString& key )
{
::osl::Guard< osl::Mutex > aGuard( m_mutex );
return ( m_propertyMap.find( key ) != m_propertyMap.end() );
}*/
}
//*************************************************************************
ScriptingContext::~ScriptingContext()
......@@ -114,92 +109,94 @@ ScriptingContext::~ScriptingContext()
//*************************************************************************
// XPropertySet implementation
//
//*************************************************************************
Reference< beans::XPropertySetInfo > SAL_CALL ScriptingContext::getPropertySetInfo( ) throw (RuntimeException)
Reference< beans::XPropertySetInfo > SAL_CALL ScriptingContext::getPropertySetInfo( )
throw ( RuntimeException )
{
return Reference< beans::XPropertySetInfo > (); // Not supported
}
//*************************************************************************
void SAL_CALL ScriptingContext::setPropertyValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, RuntimeException)
void SAL_CALL ScriptingContext::setPropertyValue( const ::rtl::OUString& aPropertyName,
const Any& aValue )
throw ( beans::UnknownPropertyException, beans::PropertyVetoException,
lang::IllegalArgumentException, lang::WrappedTargetException,
RuntimeException )
{
/*if ( !validateKey(aPropertyName) )
if ( !validateKey( aPropertyName ) )
{
throw RuntimeException(OUSTR("ScriptingContext::setPropertyValue: invalid key"),
Reference< XInterface >());
}*/
throw RuntimeException(
OUSTR( "ScriptingContext::setPropertyValue: invalid key" ),
Reference< XInterface >() );
}
::osl::Guard< osl::Mutex > aGuard( m_mutex );
if ( aPropertyName.equals(scripting_constants::DOC_REF) )
doc_ref = aValue;
if ( aPropertyName.equals(scripting_constants::DOC_STORAGE_ID) )
doc_storage_id = aValue;
if ( aPropertyName.equals(scripting_constants::DOC_URI) )
doc_uri = aValue;
if ( aPropertyName.equals(scripting_constants::RESOLVED_STORAGE_ID) )
resolved_storage_id = aValue;
//m_propertyMap[ aPropertyName ] = aValue;
m_propertyMap[ aPropertyName ] = aValue;
}
//*************************************************************************
Any SAL_CALL ScriptingContext::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, RuntimeException)
Any SAL_CALL ScriptingContext::getPropertyValue( const ::rtl::OUString& PropertyName )
throw ( beans::UnknownPropertyException,
lang::WrappedTargetException, RuntimeException )
{
Any temp;
/*if ( !validateKey(PropertyName) )
if ( !validateKey( PropertyName ) )
{
throw RuntimeException(OUSTR("ScriptingContext::getPropertyValue: invalid key"),
Reference< XInterface >());
}*/
if ( PropertyName.equals(scripting_constants::DOC_REF) )
return doc_ref;
if ( PropertyName.equals(scripting_constants::DOC_STORAGE_ID) )
return doc_storage_id;
if ( PropertyName.equals(scripting_constants::DOC_URI) )
return doc_uri;
if ( PropertyName.equals(scripting_constants::RESOLVED_STORAGE_ID) )
return resolved_storage_id;
return temp;
throw RuntimeException(
OUSTR( "ScriptingContext::getPropertyValue: invalid key" ),
Reference< XInterface >() );
}
::osl::Guard< osl::Mutex > aGuard( m_mutex );
Any returnValue = m_propertyMap[ PropertyName ];
return returnValue;
}
//*************************************************************************
void SAL_CALL ScriptingContext::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, RuntimeException)
void SAL_CALL ScriptingContext::addPropertyChangeListener(
const ::rtl::OUString& aPropertyName,
const Reference< beans::XPropertyChangeListener >& xListener )
throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
RuntimeException )
{
throw RuntimeException(OUSTR("ScriptingContext::addPropertyChangeListener: method not supported"),
Reference< XInterface >());
throw RuntimeException(
OUSTR( "ScriptingContext::addPropertyChangeListener: method not supported" ),
Reference< XInterface >() );
}
//*************************************************************************
void SAL_CALL ScriptingContext::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, RuntimeException)
void SAL_CALL ScriptingContext::removePropertyChangeListener(
const ::rtl::OUString& aPropertyName,
const Reference< beans::XPropertyChangeListener >& aListener )
throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
RuntimeException )
{
throw RuntimeException(OUSTR("ScriptingContext::removePropertyChangeListener: method not supported"),
Reference< XInterface >());
throw RuntimeException(
OUSTR( "ScriptingContext::removePropertyChangeListener: method not supported" ),
Reference< XInterface >() );
}
//*************************************************************************
void SAL_CALL ScriptingContext::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, RuntimeException)
void SAL_CALL ScriptingContext::addVetoableChangeListener(
const ::rtl::OUString& PropertyName,
const Reference< beans::XVetoableChangeListener >& aListener )
throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
RuntimeException )
{
throw RuntimeException(OUSTR("ScriptingContext::addVetoableChangeListener: method not supported"),
Reference< XInterface >());
throw RuntimeException(
OUSTR( "ScriptingContext::addVetoableChangeListener: method not supported" ),
Reference< XInterface >() );
}
//*************************************************************************
void SAL_CALL ScriptingContext::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, RuntimeException)
void SAL_CALL ScriptingContext::removeVetoableChangeListener(
const ::rtl::OUString& PropertyName,
const Reference< beans::XVetoableChangeListener >& aListener )
throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
RuntimeException )
{
throw RuntimeException(OUSTR("ScriptingContext::removeVetoableChangeListener: method not supported"),
Reference< XInterface >());
throw RuntimeException(
OUSTR( "ScriptingContext::removeVetoableChangeListener: method not supported" ),
Reference< XInterface >() );
}
} // namespace func_provider
......@@ -2,9 +2,9 @@
*
* $RCSfile: ScriptingContext.hxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: aledoux $ $Date: 2002-09-25 09:14:20 $
* last change: $Author: jmrice $ $Date: 2002-09-27 12:16:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -59,10 +59,10 @@
*
************************************************************************/
#ifndef _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_PROTOCOLHANDLER_SCRIPTING_CONTEXT_HXX_
#define _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_PROTOCOLHANDLER_SCRIPTING_CONTEXT_HXX_
#ifndef _FRAMEWORK_SCRIPT_PROTOCOLHANDLER_SCRIPTING_CONTEXT_HXX_
#define _FRAMEWORK_SCRIPT_PROTOCOLHANDLER_SCRIPTING_CONTEXT_HXX_
//#include <hash_map>
#include <hash_map>
#include <osl/mutex.hxx>
#include <rtl/ustring>
......@@ -76,41 +76,75 @@ namespace func_provider
//Typedefs
//=============================================================================
//typedef ::std::hash_map < ::rtl::OUString, ::com::sun::star::uno::Any,
//::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > >
//ScriptingConext_hash;
//typedef ::std::vector< ::rtl::OUString >
//OUString_vec;
typedef ::std::hash_map < ::rtl::OUString, ::com::sun::star::uno::Any,
::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ScriptingConext_hash;
typedef ::std::vector< ::rtl::OUString > OUString_vec;
class ScriptingContext : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySet >
class ScriptingContext :
public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySet >
{
private:
// to obtain other services if needed
//ScriptingConext_hash m_propertyMap;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
ScriptingConext_hash m_propertyMap;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
m_xContext;
osl::Mutex m_mutex;
osl::Mutex m_mutex;
// Private helper methods
//bool validateKey( const ::rtl::OUString& key);
::com::sun::star::uno::Any doc_ref;
::com::sun::star::uno::Any doc_storage_id;
::com::sun::star::uno::Any doc_uri;
::com::sun::star::uno::Any resolved_storage_id;
bool validateKey( const ::rtl::OUString& key );
public:
ScriptingContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext );
ScriptingContext( const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext > & xContext );
~ScriptingContext();
// XPropertySet implementation
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
SAL_CALL getPropertySetInfo( )
throw ( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL setPropertyValue(
const ::rtl::OUString& aPropertyName,
const ::com::sun::star::uno::Any& aValue )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::beans::PropertyVetoException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
const ::rtl::OUString& PropertyName )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL addPropertyChangeListener(
const ::rtl::OUString& aPropertyName,
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertyChangeListener >& xListener )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL removePropertyChangeListener(
const ::rtl::OUString& aPropertyName,
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertyChangeListener >& aListener )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL addVetoableChangeListener(
const ::rtl::OUString& PropertyName,
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XVetoableChangeListener >& aListener )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL removeVetoableChangeListener(
const ::rtl::OUString& PropertyName,
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XVetoableChangeListener >& aListener )
throw ( ::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException );
};
}// func_provider
#endif //_DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_PROVIDER_XFUNCTIONPROVIDER_HXX_
} // func_provider
#endif //_FRAMEWORK_SCRIPT_PROVIDER_XFUNCTIONPROVIDER_HXX_
......@@ -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
/*************************************************************************
*
* $RCSfile: StorageBridge.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
*
* $RCSfile: StorageBridge.hxx,v $
*
* $Revision: 1.2 $
*
* 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
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGEBRIDGE_HXX_
#define _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGEBRIDGE_HXX_
#ifndef _FRAMEWORK_SCRIPT_STORAGEBRIDGE_HXX_
#define _FRAMEWORK_SCRIPT_STORAGEBRIDGE_HXX_
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
......@@ -71,18 +71,41 @@
namespace scripting_runtimemgr
{
class StorageBridge : public ::cppu::WeakImplHelper1< ::drafts::com::sun::star::script::framework::storage::XScriptImplAccess >
class StorageBridge :
public ::cppu::WeakImplHelper1<
::drafts::com::sun::star::script::framework::storage::XScriptImplAccess >
{
friend class StorageBridgeFactory;
public:
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::drafts::com::sun::star::script::framework::scripturi::XScriptURI > > SAL_CALL getImplementations( const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::script::framework::scripturi::XScriptURI >& queryURI ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
//XScriptImplAccess
//=========================================================================
/**
* Get the implementations for a given URI
*
* @param queryURI
* The URI to get the implementations for
*
* @return XScriptURI
* The URIs of the implementations
*/
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
::drafts::com::sun::star::script::framework::scripturi::XScriptURI > > SAL_CALL
getImplementations(
const ::com::sun::star::uno::Reference<
::drafts::com::sun::star::script::framework::scripturi::XScriptURI >& queryURI )
throw ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException );
private:
StorageBridge(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_Int16 sid );
StorageBridge( const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& xContext, sal_uInt16 sid );
void initStorage() throw (::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::drafts::com::sun::star::script::framework::storage::XScriptImplAccess > m_xScriptImplAccess;
sal_Int16 m_sid;
void initStorage() throw ( ::com::sun::star::uno::RuntimeException );
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
m_xContext;
::com::sun::star::uno::Reference<
::drafts::com::sun::star::script::framework::storage::XScriptImplAccess >
m_xScriptImplAccess;
sal_uInt16 m_sid;
};
}
......
/*************************************************************************
*
* $RCSfile: StorageBridgeFactory.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
*
* $RCSfile: StorageBridgeFactory.cxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: jmrice $ $Date: 2002-09-27 12:16:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include "StorageBridgeFactory.hxx"
#include "StorageBridge.hxx"
using namespace ::drafts::com::sun::star::script::framework;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
namespace scripting_runtimemgr
{
//*************************************************************************
StorageBridgeFactory::StorageBridgeFactory( const Reference< XComponentContext >& xContext ):
m_xContext(xContext)
{
}
StorageBridgeFactory::StorageBridgeFactory(
const Reference< XComponentContext >& xContext ) :
m_xContext( xContext )
{}
//*************************************************************************
// StorageBridge is a bridge between us an storage, the StorageBridge implements the XScriptImplAccess
// interface, it allows both the "real" storage and a java test storage component to be configured.
// StorageBridge is a bridge between us an storage, the StorageBridge implements the
// XScriptImplAccess
// interface, it allows both the "real" storage and a java test storage component to be
// configured.
// @param location contains a url for the document.
// @returns a storage instance for the location "location".
// @see StorageBridge.cxx for flag "STORAGEPROXY", set to use java "test" component or use "real" storage.
// @see StorageBridge.cxx for flag "STORAGEPROXY", set to use java "test" component or
// use "real" storage.
Reference< storage::XScriptImplAccess >
StorageBridgeFactory::getStorageInstance(sal_Int16 sid)
StorageBridgeFactory::getStorageInstance( sal_Int16 sid )
{
Reference <storage::XScriptImplAccess> storage = new StorageBridge(m_xContext,sid) ;
Reference< storage::XScriptImplAccess > storage = new StorageBridge( m_xContext,
sid ) ;
return storage;
}
} //scripting_runtimemgr
/*************************************************************************
*
* $RCSfile: StorageBridgeFactory.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
*
* $RCSfile: StorageBridgeFactory.hxx,v $
*
* $Revision: 1.2 $
*
* last change: $Author: jmrice $ $Date: 2002-09-27 12:16:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGEBRIDGEFACTORY_HXX_
#define _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGEBRIDGEFACTORY_HXX_
#ifndef _FRAMEWORK_SCRIPT_STORAGEBRIDGEFACTORY_HXX_
#define _FRAMEWORK_SCRIPT_STORAGEBRIDGEFACTORY_HXX_
#include <rtl/ustring>
......@@ -76,11 +76,16 @@ class StorageBridgeFactory
{
public:
StorageBridgeFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
::com::sun::star::uno::Reference< ::drafts::com::sun::star::script::framework::storage::XScriptImplAccess > getStorageInstance(sal_Int16 sid);
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
explicit StorageBridgeFactory( const ::com::sun::star::uno::Reference <
::com::sun::star::uno::XComponentContext > & xContext
);
::com::sun::star::uno::Reference <
::drafts::com::sun::star::script::framework::storage::XScriptImplAccess >
getStorageInstance( sal_Int16 sid );
private:
StorageBridgeFactory();// No definition for default ctor
StorageBridgeFactory(); // No definition for default ctor
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
m_xContext;
};
}// scripting_runtimemgr
#endif //_DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_NAMERESOLVER_HXX_
} // scripting_runtimemgr
#endif //_FRAMEWORK_SCRIPT_NAMERESOLVER_HXX_
......@@ -2,9 +2,9 @@
*
* $RCSfile: ScriptInfo.hxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: lkovacs $ $Date: 2002-09-23 14:08:29 $
* last change: $Author: jmrice $ $Date: 2002-09-27 12:16:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -70,26 +70,19 @@
#include <drafts/com/sun/star/script/framework/storage/XScriptInfo.hpp>
#include <drafts/com/sun/star/script/framework/storage/ScriptImplInfo.hpp>
#ifndef _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_XSCRIPTINVOCATIONPREP_HPP_
#include <drafts/com/sun/star/script/framework/storage/XScriptInvocationPrep.hpp>
#endif
namespace scripting_impl {
class ScriptInfo : public ::cppu::WeakImplHelper4< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XInitialization, ::drafts::com::sun::star::script::framework::storage::XScriptInfo, ::drafts::com::sun::star::script::framework::storage::XScriptInvocationPrep >
class ScriptInfo :
public ::cppu::WeakImplHelper4<
::com::sun::star::lang::XServiceInfo,
::com::sun::star::lang::XInitialization,
::drafts::com::sun::star::script::framework::storage::XScriptInfo,
::drafts::com::sun::star::script::framework::storage::XScriptInvocationPrep >
{
// private member
private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
::osl::Mutex m_mutex;
::drafts::com::sun::star::script::framework::storage::ScriptImplInfo m_scriptImplInfo;
sal_uInt16 m_storageID;
// public interface
public:
explicit ScriptInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
explicit ScriptInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext);
virtual ~ScriptInfo();
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
......@@ -123,6 +116,14 @@ public:
*/
virtual ::rtl::OUString SAL_CALL prepareForInvocation() throw (::com::sun::star::uno::RuntimeException);
private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
::osl::Mutex m_mutex;
::drafts::com::sun::star::script::framework::storage::ScriptImplInfo m_scriptImplInfo;
sal_uInt16 m_storageID;
};
}
......
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