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

Initial commit of Scripting Framework code.

The Scripting Framework Team:
Duncan Foster Alexis Ledoux Laszlo Kovacs Misha Krivoruchko
Neil Montgomery Tomas O'Connor Noel Power John Rice Darragh Sherwin
üst bf1f075d
<!--
#*************************************************************************
#
# $RCSfile: build.xml,v $
#
# $Revision: 1.1 $
#
# last change: $Author: dfoster $ $Date: 2002-09-20 14:37:46 $
#
# 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): _______________________________________
#
#
#
#*************************************************************************
-->
<project name="Scipting Framework" default="jar" basedir=".">
<!-- =================== Environmental Properties ======================= -->
<property name="prj" value=".."/>
<property name="build.compiler" value="classic"/>
<property name="optimize" value="on"/>
<property name="debug" value="on"/>
<property name="scriptingclasses" value="${out}/class/scriptingtemp"/>
<property name="storageclasses" value="${out}/class/storagetemp"/>
<property name="bindir" value="${out}/bin"/>
<property name="scriptingjarname" value="ScriptRuntimeForJava.jar"/>
<property name="storagejarname" value="StorageProxy.jar"/>
<!-- ==================== classpath setting ============================ -->
<path id="idlclasspath">
<pathelement location="${prj}/../unoil/${inpath}/class/unoil.jar"/>
</path>
<!-- ===================== Prepare Directories ========================= -->
<target name="prepare">
<mkdir dir="${scriptingclasses}"/>
<mkdir dir="${storageclasses}"/>
<mkdir dir="${jardir}"/>
<copy file="StorageProxy/com/sun/star/scripting/storage/scriptURI.xml" todir="${bindir}"/>
</target>
<!-- ======================== Compile Classes ========================== -->
<target name="compile" depends="prepare">
<javac srcdir="JRuntime/" destdir="${scriptingclasses}"
includes="**/*.java" classpathref="idlclasspath"
debug="${debug}" optimize="${optimize}" deprecation="on"/>
<javac srcdir="StorageProxy/" destdir="${storageclasses}"
includes="**/*.java" classpathref="idlclasspath"
debug="${debug}" optimize="${optimize}" deprecation="on"/>
</target>
<!-- ===================== jar ========================= -->
<target name="jar" depends="compile">
<jar jarfile="${jardir}/${scriptingjarname}"
basedir="${scriptingclasses}">
<manifest>
<attribute name="Built-By" value="Sun Microsystems"/>
<attribute name="RegistrationClassName" value="ScriptRuntimeComponentRegistration"/>
</manifest>
</jar>
<jar jarfile="${jardir}/${storagejarname}"
basedir="${storageclasses}">
<manifest>
<attribute name="Built-By" value="Sun Microsystems"/>
<attribute name="RegistrationClassName" value="StorageProxy"/>
</manifest>
</jar>
</target>
<!-- ====================== Clean Generated Files ===================== -->
<target name="clean">
<delete dir="${scriptingclasses}"/>
<delete dir="${storageclasses}"/>
<delete dir="${jardir}/${scriptingjarname}"/>
<delete dir="${jardir}/${storagejarname}"/>
</target>
<!-- ========================= All In One Build ======================= -->
<target name="all" depends="clean,jar"/>
</project>
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: dfoster $ $Date: 2002-09-20 14:37:46 $
#
# 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): _______________________________________
#
#
#
#*************************************************************************
PRJ=..
PRJNAME=scripting
TARGET=scriptruntimeforjava
.INCLUDE : $(PRJ)/util/makefile.pmk
ANT_BUILDFILE=build.xml
.IF "$(debug)$(DEBUG)"!=""
ANTFLAGS=-Ddebug=on -Doptimize=off
.ENDIF
JARFILES=ant.jar jurt.jar unoil.jar ridl.jar juh.jar java_uno.jar jut.jar
.INCLUDE : $(PRJ)/util/ant.pmk
prepare .PHONY:
$(ANT) $(ANTFLAGS) $@
compile .PHONY:
$(ANT) $(ANTFLAGS) $@
jar .PHONY:
$(ANT) $(ANTFLAGS) $@
javadoc .PHONY:
$(ANT) $(ANTFLAGS) $@
clean .PHONY:
$(ANT) $(ANTFLAGS) $@
all .PHONY:
$(ANT) $(ANTFLAGS) all
testcp:
@echo $(CLASSPATH)
xxxx:
@echo $(PATH)
component_getImplementationEnvironment
component_writeInfo
component_getFactory
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: dfoster $ $Date: 2002-09-20 14:33:11 $
#
# 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): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJNAME= scripting
TARGET= protocolhandler
USE_DEFFILE= TRUE
NO_BSYMBOLIC= TRUE
ENABLE_EXCEPTIONS=TRUE
COMP1TYPELIST=$(TARGET)
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
# ------------------------------------------------------------------
.INCLUDE : ..$/cppumaker.mk
SLOFILES=\
$(SLO)$/scripthandler.obj\
SHL1TARGET= $(TARGET)
SHL1STDLIBS= \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(SALLIB)
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
<module-name> ScriptProtocolHandler </module-name>
<component-description>
<author> Noel Power</author>
<name> com.sun.star.frame.ProtocolHandler</name>
<description>
This component is part of the Scripting Framework
</description>
<loader-name> com.sun.star.loader.SharedLibrary </loader-name>
<language> c++ </language>
<status value="com"/>
<supported-service> com.sun.star.frame.ProtocolHandler </supported-service>
<type> com.sun.star.frame.XDispatchProvider </type>
<type> com.sun.star.frame.XNotifyingDispatch </type>
<type> com.sun.star.lang.XServiceInfo </type>
<type> com.sun.star.lang.XInitialization </type>
<type> com.sun.star.io.IOException </type>
</component-description>
<project-build-dependency> cppuhelper </project-build-dependency>
<project-build-dependency> cppu </project-build-dependency>
<project-build-dependency> sal </project-build-dependency>
<runtime-module-dependency> cppuhelper2$(COM) </runtime-module-dependency>
<runtime-module-dependency> cppu2 </runtime-module-dependency>
<runtime-module-dependency> sal2 </runtime-module-dependency>
</module-description>
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: scripthandler.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:14 $
*
* 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 _SFX2_SCRIPTHANDLER_HXX
#define _SFX2_SCRIPTHANDLER_HXX
// .. as always
#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
#include <com/sun/star/uno/Reference.h>
#endif
#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_
#include <com/sun/star/uno/RuntimeException.hpp>
#endif
// base classes
#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
#include <com/sun/star/frame/XDispatchProvider.hpp>
#endif
#ifndef _COM_SUN_STAR_FRAME_XNOTIFYINGDISPATCJ_HPP_
#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
#include <com/sun/star/lang/XInitialization.hpp>
#endif
#ifndef _CPPUHELPER_IMPLBASE4_HXX_
#include <cppuhelper/implbase4.hxx>
#endif
#include <drafts/com/sun/star/script/framework/provider/XFunctionProvider.hpp>
namespace rtl
{
class OUString;
};
namespace com
{
namespace sun
{
namespace star
{
namespace uno
{
class Any;
}
namespace lang
{
class XMultiServiceFactory;
class XSingleServiceFactory;
}
namespace frame
{
class XFrame;
class XModel;
class XDispatch;
class XNotifyingDispatch;
class XDispatchResultListener;
struct DispatchDescriptor;
}
namespace beans
{
struct PropertyValue;
}
namespace util
{
struct URL;
}
}
}
}
namespace scripting_protocolhandler
{
// for simplification
#define css ::com::sun::star
#define dcss ::drafts::com::sun::star
class ScriptProtocolHandler : public ::cppu::WeakImplHelper4< css::frame::XDispatchProvider, css::frame::XNotifyingDispatch, css::lang::XServiceInfo, css::lang::XInitialization >
{
private:
bool m_bInitialised;
css::uno::Reference < css::lang::XMultiServiceFactory > m_xFactory;
css::uno::Reference < css::frame::XFrame > m_xFrame;
css::uno::Reference < dcss::script::framework::provider::XFunctionProvider > m_xFunctionProvider;
public:
ScriptProtocolHandler( const css::uno::Reference < css::lang::XMultiServiceFactory >& xFactory );
virtual ~ScriptProtocolHandler();
/* XServiceInfo */
virtual ::rtl::OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException );
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& sServiceName ) throw( css::uno::RuntimeException );
virtual css::uno::Sequence < ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException );
/* Helper for XServiceInfo */
static css::uno::Sequence < ::rtl::OUString > impl_getStaticSupportedServiceNames();
static ::rtl::OUString impl_getStaticImplementationName();
/* Helper for registry */
static css::uno::Reference < css::uno::XInterface > SAL_CALL impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::RuntimeException );
static css::uno::Reference < css::lang::XSingleServiceFactory > impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
/* Implementation for XDispatchProvider */
virtual css::uno::Reference < css::frame::XDispatch > SAL_CALL
queryDispatch( const css::util::URL& aURL, const ::rtl::OUString& sTargetFrameName,
sal_Int32 eSearchFlags ) throw( css::uno::RuntimeException ) ;
virtual css::uno::Sequence< css::uno::Reference < css::frame::XDispatch > > SAL_CALL
queryDispatches( const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescriptor )
throw( css::uno::RuntimeException );
/* Implementation for X(Notifying)Dispatch */
virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL, const css::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& Listener ) throw (css::uno::RuntimeException);
virtual void SAL_CALL dispatch( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) throw (css::uno::RuntimeException);
virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) throw (css::uno::RuntimeException);
virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, const css::util::URL& aURL ) throw (css::uno::RuntimeException);
/* Implementation for XInitialization */
virtual void SAL_CALL initialize( const css::uno::Sequence < css::uno::Any >& aArguments ) throw ( css::uno::Exception );
};
}
#endif
/*************************************************************************
*
* $RCSfile: ScriptingContext.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:20 $
*
* 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 <stdio.h>
#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/factory.hxx>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <util/scriptingconstants.hxx>
#include <util/util.hxx>
#include "ScriptingContext.hxx"
using namespace com::sun::star::uno;
using namespace com::sun::star;
namespace func_provider
{
//*************************************************************************
// XScriptingContext implementation
//
//*************************************************************************
ScriptingContext::ScriptingContext( const Reference< XComponentContext > & xContext ) : m_xContext( xContext )
{
OSL_TRACE( "< ScriptingContext ctor called >\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;
}
//*************************************************************************
bool ScriptingContext::validateKey( const ::rtl::OUString& key)
{
::osl::Guard< osl::Mutex > aGuard( m_mutex );
return ( m_propertyMap.find( key ) != m_propertyMap.end() );
}
//*************************************************************************
ScriptingContext::~ScriptingContext()
{
OSL_TRACE( "< ScriptingContext dtor called >\n" );
}
//*************************************************************************
// XPropertySet implementation
//
//*************************************************************************
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)
{
if ( !validateKey(aPropertyName) )
{
throw RuntimeException(OUSTR("ScriptingContext::setPropertyValue: invalid key"),
Reference< XInterface >());
}
::osl::Guard< osl::Mutex > aGuard( m_mutex );
m_propertyMap[ aPropertyName ] = aValue;
}
//*************************************************************************
Any SAL_CALL ScriptingContext::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, RuntimeException)
{
if ( !validateKey(PropertyName) )
{
throw RuntimeException(OUSTR("ScriptingContext::getPropertyValue: invalid key"),
Reference< XInterface >());
}
return m_propertyMap[ PropertyName ];
}
//*************************************************************************
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 >());
}
//*************************************************************************
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 >());
}
//*************************************************************************
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 >());
}
//*************************************************************************
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 >());
}
} // namespace func_provider
/*************************************************************************
*
* $RCSfile: ScriptingContext.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:21 $
*
* 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_PROTOCOLHANDLER_SCRIPTING_CONTEXT_HXX_
#define _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_PROTOCOLHANDLER_SCRIPTING_CONTEXT_HXX_
#include <hash_map>
#include <osl/mutex.hxx>
#include <rtl/ustring>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
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;
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;
osl::Mutex m_mutex;
// Private helper methods
bool validateKey( const ::rtl::OUString& key);
public:
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);
};
}// func_provider
#endif //_DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_PROVIDER_XFUNCTIONPROVIDER_HXX_
component_getImplementationEnvironment
component_writeInfo
component_getFactory
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: dfoster $ $Date: 2002-09-20 14:33:24 $
#
# 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): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJNAME= scripting
TARGET= provider
USE_DEFFILE= TRUE
NO_BSYMBOLIC= TRUE
ENABLE_EXCEPTIONS=TRUE
COMP1TYPELIST=$(TARGET)
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
# ------------------------------------------------------------------
.INCLUDE : ..$/cppumaker.mk
SLOFILES=\
$(SLO)$/ScriptingContext.obj\
$(SLO)$/FunctionImpl.obj\
$(SLO)$/FunctionProvider.obj\
SHL1TARGET= $(TARGET)
SHL1STDLIBS= \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(SALLIB)
# If you want our own way of debug uncomment this flag...
# ENVCFLAGS= -DDEBUG
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
<module-name> ScriptRuntimeManager </module-name>
<component-description>
<author> Noel Power</author>
<name> drafts.com.sun.star.script.framework.provider.FunctionProvider </name>
<description>
This component is part of the Scripting Framework
</description>
<loader-name> com.sun.star.loader.SharedLibrary </loader-name>
<language> c++ </language>
<status value="drafts"/>
<supported-service> drafts.com.sun.star.script.framework.provider.FunctionProvider </supported-service>
<type> com.sun.star.beans.XPropertySet </type>
<type> com.sun.star.uno.Exception </type>
<type> com.sun.star.io.IOException </type>
<type> com.sun.star.io.XStream </type>
<type> drafts.com.sun.star.script.framework.provider.XFunction </type>
<type> drafts.com.sun.star.script.framework.provider.XFunctionProvider </type>
<type> drafts.com.sun.star.script.framework.XScriptInvocation </type>
<type> drafts.com.sun.star.script.framework.scripturi.XScriptURI </type>
</component-description>
<project-build-dependency> cppuhelper </project-build-dependency>
<project-build-dependency> cppu </project-build-dependency>
<project-build-dependency> sal </project-build-dependency>
<runtime-module-dependency> cppuhelper2$(COM) </runtime-module-dependency>
<runtime-module-dependency> cppu2 </runtime-module-dependency>
<runtime-module-dependency> sal2 </runtime-module-dependency>
</module-description>
/*************************************************************************
*
* $RCSfile: ScriptNameResolverImpl.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:30 $
*
* 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_SCRIPTNAMERESOLVERIMPL_HXX_
#define _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_SCRIPTNAMERESOLVERIMPL_HXX_
#include <cppuhelper/implbase1.hxx> // helper for XInterface, XTypeProvider etc.
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/script/CannotConvertException.hpp>
#include <com/sun/star/reflection/InvocationTargetException.hpp>
#include <drafts/com/sun/star/script/framework/XScriptNameResolver.hpp>
#include <drafts/com/sun/star/script/framework/scripturi/XScriptURI.hpp>
#include "StorageBridgeFactory.hxx"
namespace scripting_runtimemgr
{
class ScriptNameResolverImpl : public ::cppu::WeakImplHelper1< ::drafts::com::sun::star::script::framework::XScriptNameResolver >
{
private:
::com::sun::star::uno::Reference< ::drafts::com::sun::star::script::framework::scripturi::XScriptURI > resolveURIFromStorageID(sal_Int16 sid, const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::script::framework::scripturi::XScriptURI >& nameToResolve) SAL_THROW ( ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) );
/**********************************************
Reference< XComponentContext > m_xContext
to obtain other services if needed
*/
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
StorageBridgeFactory mStorageFactory;
::osl::Mutex m_mutex;
public:
/**********************************************
ScriptNameResolverImpl Constructor
@param the current context
*/
ScriptNameResolverImpl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext);
~ScriptNameResolverImpl();
// XServiceInfo implementation
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
/**********************************************
resolve method
@param scriptURI this is the given ScriptURI
@param invocationCtx the invocation context contains the
documentStorageID and document reference for use in script name
resolving. On full name resolution it sets the resolvedScriptStorageID to
the actual storage location of the fully resolved script. May or may not * be the same as the documentStorageID.
@exception CannotResolveScriptNameException
@exception IllegalArgumentException
@exception NullPointerException
@return the resolved XScriptURI
*/
::com::sun::star::uno::Reference< ::drafts::com::sun::star::script::framework::scripturi::XScriptURI > SAL_CALL
resolve(const ::com::sun::star::uno::Reference< ::drafts::com::sun::star::script::framework::scripturi::XScriptURI > & scriptURI,
::com::sun::star::uno::Any& invocationCtx)
throw(::com::sun::star::script::CannotConvertException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
};
}// scripting_runtimemgr
#endif //_DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_SCRIPTNAMERESOLVERIMPL_HXX_
/*************************************************************************
*
* $RCSfile: ScriptRuntimeManager.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:32 $
*
* 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_SCRIPTRUNTIMEMANAGER_HXX_
#define _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_SCRIPTRUNTIMEMANAGER_HXX_
#include <osl/mutex.hxx>
#include <cppuhelper/implbase3.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/script/CannotConvertException.hpp>
#include <com/sun/star/reflection/InvocationTargetException.hpp>
#include <drafts/com/sun/star/script/framework/XScriptInvocation.hpp>
#include <drafts/com/sun/star/script/framework/XScriptNameResolver.hpp>
#include <drafts/com/sun/star/script/framework/scripturi/XScriptURI.hpp>
namespace scripting_runtimemgr
{
/**
* Class responsible for managing the various ScriptRuntime implementations.
*/
class ScriptRuntimeManager : public ::cppu::WeakImplHelper3< ::drafts::com::sun::star::script::framework::XScriptInvocation, ::com::sun::star::lang::XServiceInfo, ::drafts::com::sun::star::script::framework::XScriptNameResolver >
{
// to obtain other services if needed
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::osl::Mutex m_mutex;
public:
ScriptRuntimeManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext );
~ScriptRuntimeManager();
// XServiceInfo implementation
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
/**
* implements XScriptInvocation, invokes the script named in scriptURI
* (resolving it first, if necessary), with the args passed.
*
* @param scriptURI the URI, which may not be fully qualified, for the
* script to be invoked
*
/*************************************************************
Invoke
@param scriptUri script uri describing the script
@param invocationCtx
the invocation context contains the documentStorageID and document reference for use in script name resolving
@param aParams all parameters; pure, out params are undefined in sequence,
i.e., the value has to be ignored by the callee
@param aOutParamIndex out indices
@param aOutParam out parameters
@returns
the value returned from the function being invoked
@throws IllegalArgumentException
if there is no matching script name
@throws CannotConvertException
if args do not match or cannot be converted the those
of the invokee
@throws InvocationTargetException
if the running script throws an exception this information is captured and rethrown as this exception type.
*/
virtual ::com::sun::star::uno::Any SAL_CALL invoke(
const ::com::sun::star::uno::Reference < ::drafts::com::sun::star::script::framework::scripturi::XScriptURI > & scriptUri,
const ::com::sun::star::uno::Any& invocationCtx, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams, ::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::script::CannotConvertException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException);
/**
* implements XScriptNameResolver, attempts to resolve the script URI
* passed in
*
* @param scriptURI the URI to be resolved
* @param invocationCtx the invocation context contains the
* documentStorageID and document reference for use in script name
* resolving. On full name resolution it sets the resolvedScriptStorageID to
* the actual storage location of the fully resolved script. May or may not * be the same as the documentStorageID.
* @return the resolved URI
*/
virtual ::com::sun::star::uno::Reference < ::drafts::com::sun::star::script::framework::scripturi::XScriptURI > SAL_CALL
resolve( const ::com::sun::star::uno::Reference < ::drafts::com::sun::star::script::framework::scripturi::XScriptURI >& scriptUri ,::com::sun::star::uno::Any& invocationCtx)
throw(::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::script::CannotConvertException,
::com::sun::star::uno::RuntimeException);
private:
::com::sun::star::uno::Reference < ::drafts::com::sun::star::script::framework::XScriptInvocation > SAL_CALL getScriptRuntime(const ::com::sun::star::uno::Reference < ::drafts::com::sun::star::script::framework::scripturi::XScriptURI > & scriptUri) throw( ::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Reference < ::drafts::com::sun::star::script::framework::XScriptNameResolver > SAL_CALL getScriptNameResolver() throw( ::com::sun::star::uno::RuntimeException);
};
} // scripting_runtimemgr
#endif //_COM_SUN_STAR_SCRIPTING_SCRIPTRUNTIMEMANAGER_HXX_
/*************************************************************************
*
* $RCSfile: StorageBridge.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:32 $
*
* 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 <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>
#include "StorageBridge.hxx"
#include <util/util.hxx>
using namespace ::rtl;
using namespace ::osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
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 int STORAGEID = 0;
const int STORAGEPROXY = 0;
//*************************************************************************
// StorageBridge Constructor
StorageBridge::StorageBridge( const Reference< XComponentContext >& xContext, sal_Int16 sid ):m_xContext(xContext),m_sid(sid)
{
try
{
initStorage();
}
catch(RuntimeException& re)
{
throw RuntimeException(OUSTR("StorageBridge::StorageBridge(salIn32&): ") + re.Message, Reference< XInterface >());
}
}
//*************************************************************************
void
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< XInterface > temp;
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);
}
else
{
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);
}
}
catch (Exception e)
{
throw RuntimeException(OUSTR("StorageBridge::StorageBridge: ") + e.Message, Reference< XInterface >());
}
}
//*************************************************************************
Sequence < Reference< scripturi::XScriptURI > >
StorageBridge::getImplementations(const Reference< scripturi::XScriptURI >& queryURI )
throw (lang::IllegalArgumentException, RuntimeException)
{
OSL_TRACE("In StorageBridge getImplementations...\n");
Sequence < Reference< scripturi::XScriptURI > > results;
try
{
results = m_xScriptImplAccess->getImplementations(queryURI);
}
catch (Exception e)
{
throw RuntimeException(OUSTR("StorageBridge::getImplementations: ") + e.Message, Reference< XInterface >());
}
return results;
}
}
/*************************************************************************
*
* $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): _______________________________________
*
*
************************************************************************/
#ifndef _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGEBRIDGE_HXX_
#define _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGEBRIDGE_HXX_
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <drafts/com/sun/star/script/framework/storage/XScriptImplAccess.hpp>
#include "StorageBridgeFactory.hxx"
namespace scripting_runtimemgr
{
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);
private:
StorageBridge(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_Int16 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;
};
}
#endif //_COM_SUN_STAR_SCRIPTING_STORAGEBRIDGE_HXX_
/*************************************************************************
*
* $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): _______________________________________
*
*
************************************************************************/
#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)
{
}
//*************************************************************************
// 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.
Reference< storage::XScriptImplAccess >
StorageBridgeFactory::getStorageInstance(sal_Int16 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): _______________________________________
*
*
************************************************************************/
#ifndef _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGEBRIDGEFACTORY_HXX_
#define _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGEBRIDGEFACTORY_HXX_
#include <rtl/ustring>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <drafts/com/sun/star/script/framework/storage/XScriptImplAccess.hpp>
namespace scripting_runtimemgr
{
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;
private:
StorageBridgeFactory();// No definition for default ctor
};
}// scripting_runtimemgr
#endif //_DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_NAMERESOLVER_HXX_
component_getDescriptionFunc
component_getImplementationEnvironment
component_writeInfo
component_getFactory
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: dfoster $ $Date: 2002-09-20 14:33:36 $
#
# 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): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJNAME= scripting
TARGET= runtimemgr
USE_DEFFILE= TRUE
NO_BSYMBOLIC= TRUE
ENABLE_EXCEPTIONS=TRUE
COMP1TYPELIST=$(TARGET)
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
# ------------------------------------------------------------------
.INCLUDE : ..$/cppumaker.mk
SLOFILES=\
$(SLO)$/ScriptNameResolverImpl.obj\
$(SLO)$/ScriptRuntimeManager.obj\
$(SLO)$/StorageBridge.obj\
$(SLO)$/StorageBridgeFactory.obj\
SHL1TARGET= $(TARGET)
SHL1STDLIBS= \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(SALLIB)
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
<module-name> ScriptRuntimeManager </module-name>
<component-description>
<author> Alexis Ledoux</author>
<name> drafts.com.sun.star.script.framework.ScriptRuntimeManager </name>
<description>
This component is part of the Scripting Framework
</description>
<loader-name> com.sun.star.loader.SharedLibrary </loader-name>
<language> c++ </language>
<status value="final"/>
<supported-service> drafts.com.sun.star.script.framework.ScriptRuntimeManager </supported-service>
<type> com.sun.star.lang.XSingleServiceFactory </type>
<type> com.sun.star.lang.XMultiComponentFactory </type>
<type> com.sun.star.lang.XSingleComponentFactory </type>
<type> com.sun.star.uno.XNamingService </type>
<type> com.sun.star.uno.XWeak </type>
<type> com.sun.star.lang.XMain </type>
<type> com.sun.star.uno.XAggregation </type>
<type> com.sun.star.lang.XMultiServiceFactory </type>
<type> com.sun.star.lang.XTypeProvider </type>
<type> com.sun.star.registry.XSimpleRegistry </type>
<type> com.sun.star.loader.XImplementationLoader </type>
<type> com.sun.star.registry.XImplementationRegistration </type>
<type> com.sun.star.lang.XComponent </type>
<type> com.sun.star.connection.XAcceptor </type>
<type> com.sun.star.connection.XConnector </type>
<type> com.sun.star.container.XHierarchicalNameAccess </type>
<type> com.sun.star.lang.XServiceInfo </type>
<type> com.sun.star.io.XOutputStream </type>
<type> drafts.com.sun.star.script.framework.storage.XScriptImplAccess </type>
<type> drafts.com.sun.star.script.framework.XScriptInvocation </type>
<type> drafts.com.sun.star.script.framework.XScriptNameResolver </type>
<type> drafts.com.sun.star.script.framework.scripturi.XScriptURI </type>
</component-description>
<project-build-dependency> cppuhelper </project-build-dependency>
<project-build-dependency> cppu </project-build-dependency>
<project-build-dependency> sal </project-build-dependency>
<runtime-module-dependency> cppuhelper$(UDK_MAJOR)$(COM) </runtime-module-dependency>
<runtime-module-dependency> salhelper$(UDK_MAJOR)$(COM) </runtime-module-dependency>
<runtime-module-dependency> cppu$(UDK_MAJOR) </runtime-module-dependency>
<runtime-module-dependency> reg$(UDK_MAJOR) </runtime-module-dependency>
<runtime-module-dependency> store$(UDK_MAJOR) </runtime-module-dependency>
<runtime-module-dependency> sal$(UDK_MAJOR) </runtime-module-dependency>
</module-description>
/*************************************************************************
*
* $RCSfile: ScriptElement.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:48 $
*
* 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 "ScriptElement.hxx"
#include <util/util.hxx>
using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::drafts::com::sun::star::script::framework;
namespace scripting_impl
{
//*************************************************************************
ScriptElement::ScriptElement(storage::ScriptImplInfo & sII) :
m_sII( sII ),
XMLElement(OUSTR("script"))
{
OSL_TRACE("ScriptElement ctor called\n");
addAttribute(OUSTR("language"), sII.scriptLanguage);
addAttribute(OUSTR("deploymentdir"), sII.scriptRoot);
{
XMLElement* xel = new XMLElement(OUSTR("logicalname"));
xel->addAttribute(OUSTR("value"), sII.logicalName);
Reference <xml::sax::XAttributeList> xal(xel);
addSubElement(xal);
}
{
XMLElement* xel = new XMLElement(OUSTR("languagename"));
xel->addAttribute(OUSTR("value"), sII.functionName);
xel->addAttribute(OUSTR("location"), sII.scriptLocation);
Reference <xml::sax::XAttributeList> xal(xel);
addSubElement(xal);
}
storage::ScriptDepFile *pArray = sII.scriptDependencies.getArray();
sal_Int32 len = sII.scriptDependencies.getLength();
if (len > 0)
{
XMLElement* xel = new XMLElement(OUSTR("dependencies"));
for(sal_Int32 i = 0; i < len; i++)
{
XMLElement* subxel = new XMLElement(OUSTR("dependfile"));
subxel->addAttribute(OUSTR("name"), pArray[i].fileName);
if(pArray[i].isDeliverable)
{
subxel->addAttribute(OUSTR("isdeliverable"), OUSTR("yes"));
}
else
{
subxel->addAttribute(OUSTR("isdeliverable"), OUSTR("no"));
}
Reference <xml::sax::XAttributeList> subxal(subxel);
xel->addSubElement(subxal);
}
Reference <xml::sax::XAttributeList> xal(xel);
addSubElement(xal);
}
if(sII.scriptDescription.getLength() > 0)
{
XMLElement* xel = new XMLElement(OUSTR("description"),
sII.scriptDescription);
Reference< xml::sax::XAttributeList > xal(xel);
addSubElement(xal);
}
storage::ScriptDeliverFile *pt_Array = sII.parcelDelivers.getArray();
sal_Int32 len_d = sII.parcelDelivers.getLength();
if(len_d > 0)
{
XMLElement* xel = new XMLElement(OUSTR("delivery"));
for(sal_Int32 i = 0; i < len_d; i++)
{
XMLElement* subxel = new XMLElement(OUSTR("deliverfile"));
subxel->addAttribute(OUSTR("name"), pt_Array[i].fileName);
subxel->addAttribute(OUSTR("type"), pt_Array[i].fileType);
Reference < xml::sax::XAttributeList > subxal(subxel);
xel->addSubElement(subxal);
}
Reference <xml::sax::XAttributeList> xal(xel);
addSubElement(xal);
}
}
//*************************************************************************
ScriptElement::~ScriptElement() SAL_THROW(())
{
}
}
/*************************************************************************
*
* $RCSfile: ScriptElement.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:48 $
*
* 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 _SCRIPTING_STORAGE_METADATA_ELEMENT_HXX_
#define _SCRIPTING_STORAGE_METADATA_ELEMENT_HXX_
#include <osl/mutex.hxx>
#include <drafts/com/sun/star/script/framework/storage/ScriptImplInfo.hpp>
#include "XMLElement.hxx"
namespace scripting_impl
{
class ScriptElement : public ::scripting_impl::XMLElement
{
private:
drafts::com::sun::star::script::framework::storage::ScriptImplInfo m_sII;
public:
explicit ScriptElement(drafts::com::sun::star::script::framework::storage::ScriptImplInfo &);
~ScriptElement() SAL_THROW (());
};
}
#endif
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: ScriptInfo.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:50 $
*
* 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 __SCRIPTING_STORAGE_SCRIPTINFO_HXX_
#define __SCRIPTING_STORAGE_SCRIPTINFO_HXX_
#include <cppuhelper/implbase4.hxx> // helper for component factory
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <drafts/com/sun/star/script/framework/storage/XScriptInfo.hpp>
#include <drafts/com/sun/star/script/framework/storage/ScriptImplInfo.hpp>
#include <drafts/com/sun/star/script/framework/storage/XScriptInvocationPrep.hpp>
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 >
{
// 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 >& );
virtual ~ScriptInfo();
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL initialize(::com::sun::star::uno::Sequence < ::com::sun::star::uno::Any > const & args) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception);
// XScriptInfo
virtual ::rtl::OUString SAL_CALL getLogicalName( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setLogicalName( const ::rtl::OUString& name ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getDescription( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setDescription( const ::rtl::OUString& desc ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getLanguage( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getScriptLocation( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setLanguage( const ::rtl::OUString& language ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasSource( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getLanguageSpecificName( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setLanguageSpecificName( const ::rtl::OUString& langName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getRoot( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getDependencies( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL extraProperties( ) throw (::com::sun::star::uno::RuntimeException);
/**
* This function prepares the script for invocation and returns the full path
* to the prepared parcel folder
*/
virtual ::rtl::OUString SAL_CALL prepareForInvocation() throw (::com::sun::star::uno::RuntimeException);
};
}
#endif // define __SCRIPTING_STORAGE...
/*************************************************************************
*
* $RCSfile: ScriptMetadataImporter.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:50 $
*
* 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 _SCRIPTING_STORAGE_SCRIPTMETADATAIMPORTER_HXX_
#define _SCRIPTING_STORAGE_SCRIPTMETADATAIMPORTER_HXX_
#include <vector>
#include <rtl/ustring.h>
#include <osl/mutex.hxx>
#include <cppuhelper/implbase1.hxx> // helper for component factory
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <drafts/com/sun/star/script/framework/storage/ScriptImplInfo.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/io/XInputStream.hpp>
namespace scripting_impl
{
typedef ::std::vector< ::drafts::com::sun::star::script::framework::storage::ScriptImplInfo > Impls_vec;
typedef ::std::vector< ::rtl::OUString > Deps_vec;
typedef ::std::vector< bool > Bool_vec;
/**
* Script Meta Data Importer
*/
class ScriptMetadataImporter
: public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XExtendedDocumentHandler >
{
// private member
private:
/** Vector contains the ScriptImplInfo structs */
Impls_vec ms_scriptInfos;
/** @internal */
Deps_vec mv_deps;
/** @internal */
Deps_vec mv_delivFile;
/** @internal */
Deps_vec mv_deliverType;
/** @internal */
Bool_vec mv_depsDelivered;
/** @internal */
osl::Mutex m_mutex;
/** @internal */
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
//Placeholder for the parcel URI
::rtl::OUString ms_parcelURI;
/** States for state machine during parsing */
enum { PARCEL, SCRIPT, LANGUAGE_NAME, LOGICALNAME, LANGUAGENAME,
DEPENDENCIES, DESCRIPTION, DELIVERY, DELIVERFILE, DEPENDFILE } m_state;
::com::sun::star::uno::Sequence< ::rtl::OUString > ms_dependFiles;
//Build up the struct during parsing the meta data
::drafts::com::sun::star::script::framework::storage::ScriptImplInfo m_scriptImplInfo;
//Helper function to set the state
void setState(const ::rtl::OUString & tagName);
// public interface
public:
/**
* This function will begin the parser and parse the meta data
*
* @param xInput The XInputStream for the parser which contains the XML
* @param parcelURI The parcel's URI in the document or the application
*
* @see ::com::sun::star::io::XInputStream
*/
Impls_vec parseMetaData(
::com::sun::star::uno::Reference<
::com::sun::star::io::XInputStream >
const & xInput, const ::rtl::OUString & parcelURI )
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException);
explicit ScriptMetadataImporter( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
virtual ~ScriptMetadataImporter() SAL_THROW( () );
// XExtendedDocumentHandler impl
/**
* Function to handle the start of CDATA in XML
*
* @see com::sun::star::xml::sax::XExtendedDocumentHandler
*/
virtual void SAL_CALL startCDATA()
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to handle the end of CDATA in XML
*
* @see com::sun::star::xml::sax::XExtendedDocumentHandler
*/
virtual void SAL_CALL endCDATA()
throw ( ::com::sun::star::uno::RuntimeException );
/**
* Function to handle comments in XML
*
* @see com::sun::star::xml::sax::XExtendedDocumentHandler
*/
virtual void SAL_CALL comment( const ::rtl::OUString & sComment )
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to handle line breaks in XML
*
* @see com::sun::star::xml::sax::XExtendedDocumentHandler
*/
virtual void SAL_CALL allowLineBreak()
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to handle unknowns in XML
*
* @see com::sun::star::xml::sax::XExtendedDocumentHandler
*/
virtual void SAL_CALL unknown( const ::rtl::OUString & sString )
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to handle the start of XML document
*
* @see com::sun::star::xml::sax::XExtendedDocumentHandler
*/
// XDocumentHandler impl
virtual void SAL_CALL startDocument()
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to handle the end of the XML document
*
* @see com::sun::star::xml::sax::XDocumentHandler
*/
virtual void SAL_CALL endDocument()
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to handle the start of an element
*
* @see com::sun::star::xml::sax::XDocumentHandler
*/
virtual void SAL_CALL startElement(
const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs )
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to handle the end of an element
*
* @see com::sun::star::xml::sax::XDocumentHandler
*/
virtual void SAL_CALL endElement( const ::rtl::OUString & aName )
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to handle characters in elements
*
* @see com::sun::star::xml::sax::XDocumentHandler
*/
virtual void SAL_CALL characters( const ::rtl::OUString & aChars )
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to handle whitespace
*
* @see com::sun::star::xml::sax::XDocumentHandler
*/
virtual void SAL_CALL ignorableWhitespace(
const ::rtl::OUString & aWhitespaces )
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to handle XML processing instructions
*
* @see com::sun::star::xml::sax::XDocumentHandler
*/
virtual void SAL_CALL processingInstruction(
const ::rtl::OUString & aTarget, const ::rtl::OUString & aData )
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
/**
* Function to set the document locator
*
* @see com::sun::star::xml::sax::XDocumentHandler
*/
virtual void SAL_CALL setDocumentLocator(
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator )
throw ( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
}
; // class ScriptMetadataImporter
}
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: ScriptStorageManager.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dfoster $ $Date: 2002-09-20 14:33:54 $
*
* 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_STORAGE_SCRIPTSTORAGEMANAGER_HXX_
#define _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGE_SCRIPTSTORAGEMANAGER_HXX_
#include <osl/mutex.hxx>
#include <hash_map>
#include <cppuhelper/implbase3.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <drafts/com/sun/star/script/framework/scripturi/XScriptURI.hpp>
#include <drafts/com/sun/star/script/framework/storage/XScriptStorageManager.hpp>
namespace scripting_impl
{
// Define a hash_map used to store the ScriptingStorages key;d by ID
typedef ::std::hash_map < sal_Int16, ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > > ScriptStorage_hash;
class ScriptStorageManager : public ::cppu::WeakImplHelper3< ::drafts::com::sun::star::script::framework::storage::XScriptStorageManager, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XEventListener>
{
// to obtain other services if needed
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::osl::Mutex m_mutex;
ScriptStorage_hash m_ScriptStorageHash;
sal_Int16 count;
public:
ScriptStorageManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext );
~ScriptStorageManager();
// XServiceInfo implementation
//======================================================================
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
//----------------------------------------------------------------------
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
//----------------------------------------------------------------------
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
//======================================================================
//XScriptStorageManager
//======================================================================
/**
create a ScriptStorage using the XSimpleFileAccess passed as an
argument, and return a ID for getting the associated ScriptStorage
@params xSFA
an implementation of XSimpleFileAccess that knows its own base URL
and can thus take URLs relative to that base.
@returns an unsigned short ScriptStorage ID, which can be used in the
getScriptStorage method
*/
virtual sal_uInt16 SAL_CALL createScriptStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFA ) throw (::com::sun::star::uno::RuntimeException);
//----------------------------------------------------------------------
/**
create a ScriptStorage using the XSimpleFileAccess, and a string URL
and return a ID for getting the associated ScriptStorage
@params xSFA
a standard implementation of XSimpleFileAccess
@params stringURI
a string URI to the head of the script storage
@returns an unsigned short ScriptStorage ID, which can be used in the
getScriptStorage method
*/
virtual sal_uInt16 SAL_CALL createScriptStorageWithURI( const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFA, const ::rtl::OUString& stringURI ) throw (::com::sun::star::uno::RuntimeException);
//----------------------------------------------------------------------
/**
get a ScriptStorage component using its scriptStorageID
@params scriptStorageID
the usigned short returned by one of the methods above. ID=0 is
reserved for the application/share scripts, and ID=1 is reserved
for the application/user scripts
@returns an XInterface to a component that implements the ScriptStorage
service
*/
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getScriptStorage( sal_uInt16 scriptStorageID ) throw (::com::sun::star::uno::RuntimeException);
//======================================================================
//XEventListener
//======================================================================
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
};
} // scripting_impl
#endif //_COM_SUN_STAR_SCRIPTING_STORAGE_SCRIPTSTORAGEMANAGER_HXX_
This diff is collapsed.
This diff is collapsed.
component_getImplementationEnvironment
component_writeInfo
component_getFactory
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: dfoster $ $Date: 2002-09-20 14:33:56 $
#
# 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): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJNAME= scripting
TARGET= storage
USE_DEFFILE= TRUE
NO_BSYMBOLIC= TRUE
ENABLE_EXCEPTIONS=TRUE
COMP1TYPELIST=$(TARGET)
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
# ------------------------------------------------------------------
.INCLUDE : ..$/cppumaker.mk
SLOFILES=\
$(SLO)$/ScriptStorage.obj\
$(SLO)$/ScriptInfo.obj\
$(SLO)$/ScriptMetadataImporter.obj\
$(SLO)$/ScriptElement.obj\
$(SLO)$/XMLElement.obj\
$(SLO)$/ScriptStorageManager.obj\
SHL1TARGET= $(TARGET)
SHL1STDLIBS= \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(SALLIB) \
$(SALLIB)
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
DEF1EXPORTFILE= exports.dxp
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
This diff is collapsed.
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