summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-06-11 00:05:05 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-06-13 11:43:07 +0100
commit3d016a2bb2fe8135418e097b124934d44dc17fd9 (patch)
treec49b85f23f0c7707da0a2f015375f3f881b32e60 /scripting
parent9bcad6f6a21afe50df2c1c9db4cae3e6b2723d20 (diff)
entire storage dir is unused/unbuilt
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/storage/ScriptData.hxx93
-rw-r--r--scripting/source/storage/ScriptElement.cxx164
-rw-r--r--scripting/source/storage/ScriptElement.hxx64
-rw-r--r--scripting/source/storage/ScriptInfo.cxx376
-rw-r--r--scripting/source/storage/ScriptInfo.hxx78
-rw-r--r--scripting/source/storage/ScriptInfoImpl.hxx95
-rw-r--r--scripting/source/storage/ScriptMetadataImporter.cxx509
-rw-r--r--scripting/source/storage/ScriptMetadataImporter.hxx254
-rw-r--r--scripting/source/storage/ScriptSecurityManager.cxx528
-rw-r--r--scripting/source/storage/ScriptSecurityManager.hxx102
-rw-r--r--scripting/source/storage/ScriptStorage.cxx831
-rw-r--r--scripting/source/storage/ScriptStorage.hxx208
-rw-r--r--scripting/source/storage/ScriptStorageManager.cxx533
-rw-r--r--scripting/source/storage/ScriptStorageManager.hxx228
-rw-r--r--scripting/source/storage/ScriptURI.cxx229
-rw-r--r--scripting/source/storage/ScriptURI.hxx123
-rw-r--r--scripting/source/storage/XMLElement.cxx174
-rw-r--r--scripting/source/storage/XMLElement.hxx143
-rwxr-xr-xscripting/source/storage/exports.dxp2
-rwxr-xr-xscripting/source/storage/makefile.mk53
-rwxr-xr-xscripting/source/storage/storage.xml47
21 files changed, 0 insertions, 4834 deletions
diff --git a/scripting/source/storage/ScriptData.hxx b/scripting/source/storage/ScriptData.hxx
deleted file mode 100644
index f26f7c3149d2..000000000000
--- a/scripting/source/storage/ScriptData.hxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SCRIPTING_STORAGE_SCRIPTDATA_HXX_
-#define _SCRIPTING_STORAGE_SCRIPTDATA_HXX_
-
-#include <vector>
-#include <boost/unordered_map.hpp>
-
-#include <cppu/macros.hxx>
-#include <rtl/ustring.hxx>
-
-
-
-namespace scripting_impl
-{
-
-typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > str_pair;
-typedef ::std::vector< str_pair > props_vec;
-typedef ::boost::unordered_map< ::rtl::OUString, props_vec, ::rtl::OUStringHash,
- ::std::equal_to< ::rtl::OUString > > strpairvec_map;
-typedef ::boost::unordered_map< ::rtl::OUString, ::std::pair< ::rtl::OUString,
- ::rtl::OUString >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > strpair_map;
-typedef ::boost::unordered_map< ::rtl::OUString, ::std::pair< props_vec, strpairvec_map >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > filesets_map;
-
-struct ScriptData
-{
-
- inline ScriptData::ScriptData() SAL_THROW( () )
- : parcelURI()
- , language()
- , locales()
- , functionname()
- , logicalname()
- , languagedepprops()
- , filesets()
- {
- }
-
- inline ScriptData::ScriptData( const ::rtl::OUString __parcelURI,
- const ::rtl::OUString& __language,
- const strpair_map& __locales,
- const ::rtl::OUString& __functionname,
- const ::rtl::OUString& __logicalname,
- const props_vec& __languagedepprops,
- const filesets_map& __filesets ) SAL_THROW( () )
- : parcelURI( __parcelURI )
- , language( __language )
- , locales( __locales )
- , functionname( __functionname )
- , logicalname( __logicalname )
- , languagedepprops( __languagedepprops )
- , filesets( __filesets )
- {
- }
-
- ::rtl::OUString parcelURI;
- ::rtl::OUString language;
- strpair_map locales;
- ::rtl::OUString functionname;
- ::rtl::OUString logicalname;
- props_vec languagedepprops;
- filesets_map filesets;
-};
-} // namespace scripting_impl
-#endif // _SCRIPTING_STORAGE_ScriptData_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptElement.cxx b/scripting/source/storage/ScriptElement.cxx
deleted file mode 100644
index 422e62aab361..000000000000
--- a/scripting/source/storage/ScriptElement.cxx
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-
-#include "ScriptElement.hxx"
-#include <util/util.hxx>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-typedef ::std::vector < ::std::pair < ::rtl::OUString, bool > > dependencies_vec;
-typedef ::std::vector < ::std::pair < ::rtl::OUString, ::rtl::OUString > > deliveries_vec;
-
-namespace scripting_impl
-{
-
-//*************************************************************************
-/**
- Construct a ScriptElement from a ScriptData object
-
- @param sII
- the ScriptDataObject
-*/
-ScriptElement::ScriptElement( ScriptData & sII ) :
- XMLElement( OUSTR( "parcel" ) ),
- m_sII( sII )
-{
- OSL_TRACE( "ScriptElement ctor called\n" );
-
- addAttribute( OUSTR( "language" ), sII.language );
- addAttribute( OUSTR( "xmlns:parcel" ), OUSTR( "scripting.dtd" ) );
- XMLElement* xScriptElt = new XMLElement( OUSTR( "script" ) );
- xScriptElt->addAttribute( OUSTR( "language" ), sII.language );
- Reference < xml::sax::XAttributeList > xal( xScriptElt );
- addSubElement( xal );
-
- strpair_map::const_iterator mp_it = sII.locales.begin();
- strpair_map::const_iterator mp_itend = sII.locales.end();
-
- for( ; mp_it != mp_itend; ++mp_it )
- {
- XMLElement* xel = new XMLElement( OUSTR( "locale" ) );
- xel->addAttribute( OUSTR( "lang" ), mp_it->first );
-
- {
- XMLElement* subxel = new XMLElement( OUSTR( "displayname" ) );
- subxel->addAttribute( OUSTR( "value" ), mp_it->second.first );
- Reference < xml::sax::XAttributeList > subxattl( subxel );
- xel->addSubElement( subxattl );
- }
- {
- XMLElement* subxel = new XMLElement( OUSTR( "description" ),
- mp_it->second.second );
- Reference< xml::sax::XAttributeList > subxattl( subxel );
- xel->addSubElement( subxattl );
- }
-
- Reference < xml::sax::XAttributeList > xal( xel );
- xScriptElt->addSubElement( xal );
- }
-
- {
- XMLElement* xel = new XMLElement( OUSTR( "functionname" ) );
- xel->addAttribute( OUSTR( "value" ), sII.functionname );
- Reference < xml::sax::XAttributeList > xal( xel );
- xScriptElt->addSubElement( xal );
- }
-
- {
- XMLElement* xel = new XMLElement( OUSTR( "logicalname" ) );
- xel->addAttribute( OUSTR( "value" ), sII.logicalname );
- Reference < xml::sax::XAttributeList > xal( xel );
- xScriptElt->addSubElement( xal );
- }
-
- props_vec::const_iterator vp_it = sII.languagedepprops.begin();
- props_vec::const_iterator vp_itend = sII.languagedepprops.end();
-
- if ( vp_it != vp_itend )
- {
- XMLElement* xel = new XMLElement( OUSTR( "languagedepprops" ) );
-
- for( ; vp_it != vp_itend ; ++vp_it )
- {
- XMLElement* subxel = new XMLElement( OUSTR( "prop" ) );
- subxel->addAttribute( OUSTR( "name" ), vp_it->first );
- subxel->addAttribute( OUSTR( "value" ), vp_it->second );
- Reference < xml::sax::XAttributeList > subxattl( subxel );
- xel->addSubElement( subxattl );
- }
-
- Reference < xml::sax::XAttributeList > xal( xel );
- xScriptElt->addSubElement( xal );
- }
-
- filesets_map::const_iterator fm_it = sII.filesets.begin();
- filesets_map::const_iterator fm_itend = sII.filesets.end();
-
- for( ; fm_it != fm_itend; ++fm_it )
- {
- XMLElement* xel = new XMLElement( OUSTR( "fileset" ) );
- xel->addAttribute( OUSTR( "name" ), fm_it->first );
-
- vp_it = fm_it->second.first.begin();
- vp_itend = fm_it->second.first.end();
-
- for( ; vp_it != vp_itend; ++vp_it )
- {
- XMLElement* subxel = new XMLElement( OUSTR( "prop" ) );
- subxel->addAttribute( OUSTR( "name" ), vp_it->first );
- subxel->addAttribute( OUSTR("value"), vp_it->second );
- Reference < xml::sax::XAttributeList > subxattl( subxel );
- xel->addSubElement( subxattl );
- }
-
- strpairvec_map::const_iterator sm_it = fm_it->second.second.begin();
- strpairvec_map::const_iterator sm_itend = fm_it->second.second.end();
-
- if( sm_it != sm_itend )
- {
- // was there a purpose for contstructing this
- // XMLElement* subxel = new XMLElement( OUSTR( "file" ) );
- xel->addAttribute( OUSTR( "name" ), sm_it->first );
-
- }
- }
-}
-
-//*************************************************************************
-ScriptElement::~ScriptElement() SAL_THROW(())
-{
-}
-
-} // namespace scripting_impl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptElement.hxx b/scripting/source/storage/ScriptElement.hxx
deleted file mode 100644
index 50cde2732413..000000000000
--- a/scripting/source/storage/ScriptElement.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SCRIPT_FRAMEWORK_STORAGE_SCRIPT_ELEMENT_HXX_
-#define _SCRIPT_FRAMEWORK_STORAGE_SCRIPT_ELEMENT_HXX_
-
-#include <osl/mutex.hxx>
-
-#include "ScriptData.hxx"
-
-#include "XMLElement.hxx"
-
-namespace scripting_impl
-{
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-class ScriptElement : public ::scripting_impl::XMLElement
-{
-public:
- /**
- Construct a ScriptElement from a ScriptData object
-
- @param sII
- the ScriptData Object
- */
- explicit ScriptElement( ScriptData & sII );
- ~ScriptElement() SAL_THROW (());
-
-private:
- ScriptData m_sII;
-
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptInfo.cxx b/scripting/source/storage/ScriptInfo.cxx
deleted file mode 100644
index d292ecb20224..000000000000
--- a/scripting/source/storage/ScriptInfo.cxx
+++ /dev/null
@@ -1,376 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-#include <cppuhelper/implementationentry.hxx>
-
-#include <boost/unordered_map.hpp>
-
-#include <osl/file.hxx>
-#include <cppuhelper/implbase1.hxx>
-
-#include <com/sun/star/beans/XPropertyContainer.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-
-#include <drafts/com/sun/star/script/framework/storage/XScriptStorageManager.hpp>
-
-#include <util/util.hxx>
-#include "ScriptInfo.hxx"
-
-using namespace ::rtl;
-using namespace com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::drafts::com::sun::star::script::framework;
-using namespace ::drafts::com::sun::star::script::framework::storage;
-
-namespace scripting_impl
-{
-
-typedef ::boost::unordered_map < ::rtl::OUString, css::uno::Any, ::rtl::OUStringHash,
- ::std::equal_to< ::rtl::OUString > > PropertySet_hash;
-
-class PropertySetImpl : public ::cppu::WeakImplHelper1< css::beans::XPropertySet >
-{
-
-public:
-
- PropertySetImpl();
- ~PropertySetImpl();
-
-// XPropertySet implementation
- virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
- getPropertySetInfo()
- throw ( css::uno::RuntimeException );
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
- const css::uno::Any& aValue )
- throw ( css::beans::UnknownPropertyException,
- css::beans::PropertyVetoException,
- css::lang::IllegalArgumentException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
- virtual css::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
- throw ( css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
- const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener )
- throw ( css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
- virtual void SAL_CALL removePropertyChangeListener(
- const ::rtl::OUString& aPropertyName,
- const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener )
- throw ( css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
- virtual void SAL_CALL addVetoableChangeListener(
- const ::rtl::OUString& PropertyName,
- const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener )
- throw ( css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
- virtual void SAL_CALL removeVetoableChangeListener(
- const ::rtl::OUString& PropertyName,
- const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener )
- throw ( css::beans::UnknownPropertyException,
- css::lang::WrappedTargetException,
- css::uno::RuntimeException );
-
-private:
- friend class ScriptInfo;
-
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- void PropertySetImpl::privateSetPropertyValue( const ::rtl::OUString& aPropertyName, const Any& aValue )
- throw ( beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
- RuntimeException );
-
- osl::Mutex m_mutex;
- PropertySet_hash m_propertyMap;
-};
-
-PropertySetImpl::PropertySetImpl()
-{
- OSL_TRACE( "<PropertySetImpl ctor called\n" );
-}
-
-PropertySetImpl::~PropertySetImpl()
-{
- OSL_TRACE( "<PropertySetImpl dtor called\n>" );
-}
-
-Reference< beans::XPropertySetInfo > SAL_CALL PropertySetImpl::getPropertySetInfo( )
- throw ( RuntimeException )
-{
- return Reference< beans::XPropertySetInfo > (); // Not supported
-}
-
-void SAL_CALL PropertySetImpl::setPropertyValue( const ::rtl::OUString& aPropertyName,
- const Any& aValue )
- throw ( beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
- RuntimeException )
-{
- throw RuntimeException(
- OUSTR( "PropertySetImpl::setPropertyValue: method not supported. Read-only PropertySet" ),
- Reference< XInterface >() );
-}
-
-void PropertySetImpl::privateSetPropertyValue( const ::rtl::OUString& aPropertyName,
- const Any& aValue )
- throw ( beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
- RuntimeException )
-{
- ::osl::Guard< osl::Mutex > aGuard( m_mutex );
- m_propertyMap[ aPropertyName ] = aValue;
-}
-
-//*************************************************************************
-Any SAL_CALL PropertySetImpl::getPropertyValue( const ::rtl::OUString& PropertyName )
- throw ( beans::UnknownPropertyException,
- lang::WrappedTargetException, RuntimeException )
-{
- if ( m_propertyMap.find( PropertyName ) == m_propertyMap.end() )
- {
- throw RuntimeException(
-
- OUSTR( "PropertySetImpl::getPropertyValue: invalid PropertyName ").concat(
- PropertyName),
- Reference< XInterface >() );
- }
-
- ::osl::Guard< osl::Mutex > aGuard( m_mutex );
- Any returnValue = m_propertyMap[ PropertyName ];
-
- return returnValue;
-}
-
-//*************************************************************************
-void SAL_CALL PropertySetImpl::addPropertyChangeListener(
- const ::rtl::OUString& aPropertyName,
- const Reference< beans::XPropertyChangeListener >& xListener )
- throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
- RuntimeException )
-{
- throw RuntimeException(
- OUSTR( "PropertySetImpl::addPropertyChangeListener: method not supported" ),
- Reference< XInterface >() );
-}
-
-//*************************************************************************
-void SAL_CALL PropertySetImpl::removePropertyChangeListener(
- const ::rtl::OUString& aPropertyName,
- const Reference< beans::XPropertyChangeListener >& aListener )
- throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
- RuntimeException )
-{
- throw RuntimeException(
- OUSTR( "PropertySetImpl::removePropertyChangeListener: method not supported" ),
- Reference< XInterface >() );
-}
-
-//*************************************************************************
-void SAL_CALL PropertySetImpl::addVetoableChangeListener(
- const ::rtl::OUString& PropertyName,
- const Reference< beans::XVetoableChangeListener >& aListener )
- throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
- RuntimeException )
-{
- throw RuntimeException(
- OUSTR( "PropertySetImpl::addVetoableChangeListener: method not supported" ),
- Reference< XInterface >() );
-}
-
-//*************************************************************************
-void SAL_CALL PropertySetImpl::removeVetoableChangeListener(
- const ::rtl::OUString& PropertyName,
- const Reference< beans::XVetoableChangeListener >& aListener )
- throw ( beans::UnknownPropertyException, lang::WrappedTargetException,
- RuntimeException )
-{
- throw RuntimeException(
- OUSTR( "PropertySetImpl::removeVetoableChangeListener: method not supported" ),
- Reference< XInterface >() );
-}
-
-
-//*************************************************************************
-ScriptInfo::ScriptInfo( const ScriptData & scriptData, sal_Int32 storageID )
- : m_scriptData( scriptData ), m_storageID( storageID )
-{
- OSL_TRACE( "< ++++++ ScriptInfo ctor called >\n" );
- OSL_TRACE( "< ++++++ parcelURI=%s>\n",::rtl::OUStringToOString(m_scriptData.parcelURI , RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-}
-//*************************************************************************
-ScriptInfo::~ScriptInfo()
-{
- OSL_TRACE( "< ScriptInfo dtor called >\n" );
-}
-//*************************************************************************
-OUString SAL_CALL ScriptInfo::getLogicalName( ) throw ( RuntimeException )
-{
- OSL_TRACE( "ScriptInfo::getLogicalName() " );
- return m_scriptData.logicalname;
-}
-
-//*************************************************************************
-OUString SAL_CALL ScriptInfo::getDescription( ) throw ( RuntimeException )
-{
- OUString rs_desc;
- // TDB need to determine locale here, hardcoded at the moment
- // to english
-
- OUString localeLang(RTL_CONSTASCII_USTRINGPARAM("en"));
- strpair_map::const_iterator str_it =
- m_scriptData.locales.find( localeLang );
-
- if( str_it == m_scriptData.locales.end() )
- {
- OSL_TRACE( "No description set in meta-data" );
- return rs_desc;
- }
- rs_desc = str_it->second.second;
- return rs_desc;
-}
-
-//*************************************************************************
-OUString SAL_CALL ScriptInfo::getLanguage( ) throw ( RuntimeException )
-{
- OSL_TRACE( "ScriptInfo::getLanguage() " );
- return m_scriptData.language;
-}
-
-//*************************************************************************
-OUString SAL_CALL ScriptInfo::getFunctionName( ) throw ( RuntimeException )
-{
- OSL_TRACE( "ScriptInfo::getFunctionName() " );
- return m_scriptData.functionname;
-}
-
-//*************************************************************************
-OUString SAL_CALL ScriptInfo::getParcelURI( ) throw ( RuntimeException )
-{
- return m_scriptData.parcelURI;
-}
-
-//*************************************************************************
-Reference< beans::XPropertySet > SAL_CALL ScriptInfo::getLanguageProperties( )
- throw ( RuntimeException )
-{
- PropertySetImpl* propSetImpl = new PropertySetImpl();
- Reference< beans::XPropertySet > xPropSet = propSetImpl;
-
- props_vec::const_iterator pv_it = m_scriptData.languagedepprops.begin();
- props_vec::const_iterator pv_itend = m_scriptData.languagedepprops.end();
-
- for( ; pv_it != pv_itend; ++pv_it )
- {
- try
- {
- propSetImpl->privateSetPropertyValue( pv_it->first, makeAny( pv_it->second ) );
- }
- catch( Exception& e )
- {
- OUString msg = OUSTR(
- "ScriptInfo::getLanguage caught exception while setting property," );
- msg = msg.concat( OUSTR( " PropertryName: " ) ).concat( pv_it->first );
- msg = msg.concat( OUSTR( " \nException message is: " ) );
- msg = msg.concat( e.Message );
- throw RuntimeException( msg , Reference< XInterface >() );
- }
- }
-
- return xPropSet;
-}
-//*************************************************************************
-css::uno::Sequence< ::rtl::OUString > SAL_CALL ScriptInfo::getFileSetNames()
-throw ( css::uno::RuntimeException )
-{
- OSL_TRACE("ScriptInfo::getFileSetNames");
- Sequence< OUString > results;
- filesets_map::iterator fsm_it = m_scriptData.filesets.begin();
- filesets_map::iterator fsm_itend = m_scriptData.filesets.end();
- if( fsm_it == fsm_itend )
- {
- OSL_TRACE( "ScriptInfo::getFileSetNames: no filesets" );
- return results;
- }
- results.realloc( m_scriptData.filesets.size() );
- for ( sal_Int32 count = 0; fsm_it != fsm_itend; ++fsm_it )
- {
- OUString fileSetName = fsm_it->first;
- OSL_TRACE( "ScriptInfo::getFileSetNames: adding name %s",
- ::rtl::OUStringToOString( fileSetName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- results[ count++ ] = fileSetName;
- }
- return results;
-}
-//*************************************************************************
-css::uno::Sequence< ::rtl::OUString > SAL_CALL
-ScriptInfo::getFilesInFileSet( const ::rtl::OUString & fileSetName )
-throw ( css::uno::RuntimeException )
-{
- Sequence< OUString > results;
- filesets_map::iterator fsm_it = m_scriptData.filesets.find( fileSetName );
- filesets_map::iterator fsm_itend = m_scriptData.filesets.end();
- if( fsm_it == fsm_itend )
- {
- OSL_TRACE( "ScriptInfo::getFilesInFileSet: no fileset named %s",
- ::rtl::OUStringToOString( fileSetName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- return results;
- }
-
- strpairvec_map files = fsm_it->second.second;
- strpairvec_map::iterator spvm_it = files.begin();
- strpairvec_map::iterator spvm_itend = files.end();
- if( spvm_it == spvm_itend )
- {
- OSL_TRACE( "ScriptInfo::getFilesInFileSet: no files in fileset %s",
- ::rtl::OUStringToOString( fileSetName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- return results;
- }
- results.realloc( files.size() );
- for( sal_Int32 count = 0; spvm_it != spvm_itend ; ++spvm_it )
- {
- OUString fileName = spvm_it->first;
- OSL_TRACE( "ScriptInfo::getFilesInFileSet: adding file %s",
- ::rtl::OUStringToOString( fileName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- results[ count++ ] = fileName;
- }
- return results;
-}
-//*************************************************************************
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptInfo.hxx b/scripting/source/storage/ScriptInfo.hxx
deleted file mode 100644
index c4db0142daec..000000000000
--- a/scripting/source/storage/ScriptInfo.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __SCRIPT_FRAMEWORK_STORAGE_SCRIPTINFO_HXX_
-#define __SCRIPT_FRAMEWORK_STORAGE_SCRIPTINFO_HXX_
-
-#include <cppuhelper/implbase1.hxx> // helper for component factory
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <drafts/com/sun/star/script/framework/storage/XScriptInfo.hpp>
-
-#include "ScriptData.hxx"
-
-namespace scripting_impl
-{
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-class ScriptInfo : public ::cppu::WeakImplHelper1< dcsssf::storage::XScriptInfo >
-{
-public:
- explicit ScriptInfo( const ScriptData & scriptData, sal_Int32 storageID );
- virtual ~ScriptInfo();
-
- // XScriptInfo
- virtual ::rtl::OUString SAL_CALL getLogicalName()
- throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getDescription()
- throw ( css::uno::RuntimeException ) ;
- virtual ::rtl::OUString SAL_CALL getLanguage() throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getFunctionName()
- throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getParcelURI()
- throw ( css::uno::RuntimeException );
- virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL
- getLanguageProperties() throw ( css::uno::RuntimeException );
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getFileSetNames()
- throw ( css::uno::RuntimeException );
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL
- getFilesInFileSet( const ::rtl::OUString & fileSetName )
- throw ( css::uno::RuntimeException );
-
-private:
- ScriptData m_scriptData;
- sal_Int32 m_storageID;
-};
-
-}
-#endif // define __SCRIPTING_STORAGE...
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptInfoImpl.hxx b/scripting/source/storage/ScriptInfoImpl.hxx
deleted file mode 100644
index 3b038535dee7..000000000000
--- a/scripting/source/storage/ScriptInfoImpl.hxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SCRIPTING_STORAGE_SCRIPTINFOIMPL_HXX_
-#define _SCRIPTING_STORAGE_SCRIPTINFOIMPL_HXX_
-
-#include <vector>
-#include <map>
-
-#include <cppu/macros.hxx>
-#include <rtl/ustring.hxx>
-
-
-typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > str_pair;
-typedef ::std::map< ::rtl::OUString, str_pair,
- ::std::equal_to< ::rtl::OUString > > strpair_map;
-typedef ::std::vector< str_pair > props_vec;
-typedef ::std::map< ::rtl::OUString, ::std::pair< props_vec, strpair_map >,
- ::std::equal_to< ::rtl::OUString > > filesets_map;
-
-namespace scripting_impl
-{
-
-struct ScriptInfoImpl
-{
-
- inline ScriptInfoImpl::ScriptInfoImpl() SAL_THROW( () )
- : parcelURI()
- , language()
- , locales()
- , functionname()
- , logicalname()
- , languagedepprops()
- , filesets()
- {
- }
-
- inline ScriptInfoImpl::ScriptInfoImpl( const ::rtl::OUString __parcelURI,
- const ::rtl::OUString& __language,
- const strpair_map& __locales,
- const ::rtl::OUString& __functionname,
- const ::rtl::OUString& __logicalname,
- const langdepprops_vec& __languagedepprops,
- const filesets_map& __filesets ) SAL_THROW( () )
- : parcelURI( __parcelURI )
- , language( __language )
- , locales( __locales )
- , functionname( __functionname )
- , logicalname( __logicalname )
- , languagedepprops( __languagedepprops )
- , filesets( __filesets )
- {
- }
-
- ::rtl::OUString parcelURI;
- ::rtl::OUString language;
- strpair_map locales;
- ::rtl::OUString functionname;
- ::rtl::OUString logicalname;
- props_vec languagedepprops;
- filesets_map filesets;
-
-};
-
-
-} // namespace scripting_impl
-
-#endif // _SCRIPTING_STORAGE_SCRIPTINFOIMPL_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptMetadataImporter.cxx b/scripting/source/storage/ScriptMetadataImporter.cxx
deleted file mode 100644
index b7d7c379abdf..000000000000
--- a/scripting/source/storage/ScriptMetadataImporter.cxx
+++ /dev/null
@@ -1,509 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-
-#ifdef _DEBUG
-#include <stdio.h>
-#endif
-
-#include "ScriptMetadataImporter.hxx"
-
-#include <osl/mutex.hxx>
-
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <rtl/string.h>
-#include <tools/diagnose_ex.h>
-
-#include <util/util.hxx>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-namespace scripting_impl
-{
-//*************************************************************************
-ScriptMetadataImporter::ScriptMetadataImporter(
- const Reference< XComponentContext > & xContext )
- : m_xContext( xContext )
-{
- OSL_TRACE( "< ScriptMetadataImporter ctor called >\n" );
- ms_localeDesc = new OUStringBuffer();
-}
-
-//*************************************************************************
-ScriptMetadataImporter::~ScriptMetadataImporter() SAL_THROW( () )
-{
- OSL_TRACE( "< ScriptMetadataImporter dtor called >\n" );
- delete ms_localeDesc;
-}
-
-
-//*************************************************************************
-void ScriptMetadataImporter::parseMetaData(
- Reference< io::XInputStream > const & xInput,
- const ::rtl::OUString & parcelURI,
- InfoImpls_vec & io_ScriptDatas )
- throw ( xml::sax::SAXException, io::IOException, RuntimeException )
-{
-
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- mpv_ScriptDatas = &io_ScriptDatas;
- mpv_ScriptDatas->clear();
-
- //Set the placeholder for the parcel URI
- ms_parcelURI = parcelURI;
-
- //Get the parser service
- ENSURE_OR_THROW( m_xContext.is(),
- "ScriptMetadataImporter::parseMetaData: No context available" );
-
- Reference< lang::XMultiComponentFactory > xMgr( m_xContext->getServiceManager(), UNO_SET_THROW );
-
- Reference< xml::sax::XParser > xParser(
- xMgr->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.xml.sax.Parser" ), m_xContext ),
- UNO_QUERY_THROW );
-
- // xxx todo: error handler, entity resolver omitted
- // This class is the document handler for the parser
- Reference< xml::sax::XDocumentHandler > t_smI( this );
- xParser->setDocumentHandler( t_smI );
-
- //Set up the input for the parser, the XInputStream
- xml::sax::InputSource source;
- source.aInputStream = xInput;
- source.sSystemId = OUSTR( "virtual file" );
-
- OSL_TRACE( "ScriptMetadataImporter: Start the parser\n" );
-
- try
- {
- xParser->parseStream( source );
- }
- catch ( xml::sax::SAXException & saxe )
- {
- OUString msg(RTL_CONSTASCII_USTRINGPARAM(
- "ScriptMetadata:Importer::parserMetaData SAXException" ));
- msg.concat( saxe.Message );
- throw xml::sax::SAXException( msg, Reference< XInterface > (),
- saxe.WrappedException );
- }
- catch ( io::IOException & ioe )
- {
- throw io::IOException( OUString(RTL_CONSTASCII_USTRINGPARAM(
- "ScriptMetadataImporter::parseMetaData IOException: " )) + ioe.Message,
- Reference< XInterface > () );
- }
-
-#ifdef _DEBUG
- catch ( ... )
- {
- throw RuntimeException( OUString(RTL_CONSTASCII_USTRINGPARAM(
- "ScriptMetadataImporter::parseMetadata UnknownException: " )),
- Reference< XInterface > () );
- }
-#endif
-
- OSL_TRACE( "ScriptMetadataImporter: Parser finished\n ");
-
- OSL_TRACE( "ScriptMetadataImporter: vector size is %d\n",
- mpv_ScriptDatas->size() );
-}
-
-//*************************************************************************
-// XExtendedDocumentHandler impl
-void ScriptMetadataImporter::startCDATA()
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: startCDATA()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::endCDATA()
- throw ( RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: endDATA()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::comment( const ::rtl::OUString & sComment )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: comment()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::allowLineBreak()
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: allowLineBreak()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::unknown( const ::rtl::OUString & sString )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: unknown()\n" );
-}
-
-//*************************************************************************
-// XDocumentHandler impl
-void ScriptMetadataImporter::startDocument()
- throw ( xml::sax::SAXException, RuntimeException )
-{
- // Ignore for now
- OSL_TRACE( "ScriptMetadataImporter: startDocument()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::endDocument()
- throw ( xml::sax::SAXException, RuntimeException )
-{
- // Ignore for now
- OSL_TRACE( "ScriptMetadataImporter: endDocument()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::startElement(
- const ::rtl::OUString& tagName,
- const Reference< xml::sax::XAttributeList >& xAttribs )
- throw ( xml::sax::SAXException, RuntimeException )
-{
-
- OSL_TRACE( "Trace Message : ScriptMetadataImporter: startElement() %s\n",
- ::rtl::OUStringToOString( tagName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- //Set the state of the state machine
- setState( tagName );
-
- //Processing the elements
- switch( m_state )
- {
- case SCRIPT:
- m_ScriptData.parcelURI = ms_parcelURI;
- m_ScriptData.language = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("language")));
- OSL_TRACE( "Trace Message: language is %s\n",
- ::rtl::OUStringToOString( m_ScriptData.language,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case LOCALE:
- ms_localeLang = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("lang")) );
- OSL_TRACE( "Trace Message: Locale is %s\n",
- ::rtl::OUStringToOString( ms_localeLang,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case DISPLAYNAME:
- ms_localeDisName = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")));
- OSL_TRACE( "Trace Message: Displyaname is %s\n",
- ::rtl::OUStringToOString( ms_localeDisName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case FUNCTIONNAME:
- m_ScriptData.functionname = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) );
- OSL_TRACE( "Trace Message: Functionname is %s\n",
- ::rtl::OUStringToOString( m_ScriptData.functionname,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case LOGICALNAME:
- m_ScriptData.logicalname = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")));
-#ifdef _DEBUG
- fprintf(stderr, "Trace Message: logicalname is %s\n",
- ::rtl::OUStringToOString( m_ScriptData.logicalname,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-#endif
- break;
- case LANGDEPPROPS:
- m_ScriptData.languagedepprops.push_back(
- ::std::make_pair( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) )
- ));
- OSL_TRACE( "Trace Message: Langdepprops is %s\t%s\n",
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer,
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case FILESET:
- ms_filesetname = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) );
- OSL_TRACE( "Trace Message: filesetname is %s\n",
- ::rtl::OUStringToOString(ms_filesetname,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case FILESETPROPS:
- mv_filesetprops.push_back( ::std::make_pair(
- xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) )
- ));
- OSL_TRACE( "Trace Message: filesetprops is %s\t%s\n",
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer,
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
- case FILES:
- ms_filename = xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) );
- OSL_TRACE( "Trace Message: filename is %s\n",
- ::rtl::OUStringToOString( ms_filename,
- RTL_TEXTENCODING_ASCII_US).pData->buffer );
- break;
- case FILEPROPS:
- mv_fileprops.push_back(str_pair( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) ) ) );
- OSL_TRACE( "Trace Message: fileprops is %s\t%s\n",
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer,
- ::rtl::OUStringToOString( xAttribs->getValueByName(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- break;
-
- // to prevent compiler warnings
- case PARCEL:
- case DESCRIPTION:
- case LANGUAGEDEPPROPS:
- break;
- }
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::endElement( const ::rtl::OUString & aName )
- throw ( xml::sax::SAXException, RuntimeException )
-{
-
- //The end tag of an element
- OSL_TRACE( "ScriptMetadataImporter: endElement() %s\n",
- ::rtl::OUStringToOString( aName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- //Set the state
- setState( aName );
-
-
- switch ( m_state )
- {
- case PARCEL:
- break;
- case SCRIPT:
- // np adjust logicalName to be equal to function name
- // as logical name concept has been removed
- m_ScriptData.logicalname = m_ScriptData.functionname;
- mpv_ScriptDatas->push_back( m_ScriptData );
- m_ScriptData = ScriptData();
- break;
- case LOCALE:
- m_ScriptData.locales[ ms_localeLang ] = ::std::make_pair(
- ms_localeDisName, ms_localeDesc->makeStringAndClear().trim() );
- break;
- case FILESET:
- OSL_TRACE("adding fileset %s to filesets map",
- ::rtl::OUStringToOString( ms_filesetname,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- m_ScriptData.filesets[ ms_filesetname ] = ::std::make_pair(
- mv_filesetprops, mm_files );
- mm_files.clear();
- mv_filesetprops.clear();
- break;
- case FILES:
- OSL_TRACE("adding files %s to files map",
- ::rtl::OUStringToOString( ms_filename,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- mm_files[ ms_filename ] = mv_fileprops;
- mv_fileprops.clear();
- break;
- //
- // to prevent compiler warnings
- case DISPLAYNAME:
- case DESCRIPTION:
- case FUNCTIONNAME:
- case LOGICALNAME:
- case LANGUAGEDEPPROPS:
- case LANGDEPPROPS:
- case FILESETPROPS:
- case FILEPROPS:
- break;
- }
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::characters( const ::rtl::OUString & aChars )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: characters()\n");
-
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- switch ( m_state )
- {
- case DESCRIPTION:
- //Put description into the struct
- ms_localeDesc->append(aChars);
- break;
- case PARCEL:
- case SCRIPT:
- case LOCALE:
- case DISPLAYNAME:
- case FUNCTIONNAME:
- case LOGICALNAME:
- case LANGUAGEDEPPROPS:
- case LANGDEPPROPS:
- case FILESETPROPS:
- case FILEPROPS:
- break;
- }
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::ignorableWhitespace(
- const ::rtl::OUString & aWhitespaces )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: ignorableWhiteSpace()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::processingInstruction(
- const ::rtl::OUString & aTarget, const ::rtl::OUString & aData )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: processingInstruction()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::setDocumentLocator(
- const Reference< xml::sax::XLocator >& xLocator )
- throw ( xml::sax::SAXException, RuntimeException )
-{
- OSL_TRACE( "ScriptMetadataImporter: setDocumentLocator()\n" );
-}
-
-//*************************************************************************
-void ScriptMetadataImporter::setState( const ::rtl::OUString & tagName )
-{
- //Set the state depending on the tag name of the current
- //element the parser has arrived at
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "parcel" ) ) )
- {
- //Parcel tag
- m_state = PARCEL;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "script" ) ) )
- {
- m_state = SCRIPT;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "locale" ) ) )
- {
- m_state = LOCALE;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "displayname" ) ) )
- {
- m_state = DISPLAYNAME;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "description" ) ) )
- {
- m_state = DESCRIPTION;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "functionname" ) ) )
- {
- m_state = FUNCTIONNAME;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "logicalname" ) ) )
- {
- m_state = LOGICALNAME;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "languagedepprops" ) ) )
- {
- m_state = LANGUAGEDEPPROPS;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "prop" ) ) )
- {
- if( m_state == LANGUAGEDEPPROPS )
- {
- m_state = LANGDEPPROPS;
- }
- else if( m_state == FILESET )
- {
- m_state = FILESETPROPS;
- }
- else if( m_state == FILES )
- {
- m_state = FILEPROPS;
- }
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "fileset" ) ) )
- {
- m_state = FILESET;
- }
- else if( tagName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "file" ) ) )
- {
- m_state = FILES;
- }
- else
- {
- //If there is a tag we don't know about, throw a exception (wobbler) :)
- ::rtl::OUString str_sax(RTL_CONSTASCII_USTRINGPARAM("No Such Tag"));
-
- OSL_TRACE( "ScriptMetadataImporter: No Such Tag: %s\n",
- ::rtl::OUStringToOString(
- tagName, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- throw xml::sax::SAXException(
- str_sax, Reference< XInterface >(), Any() );
- }
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptMetadataImporter.hxx b/scripting/source/storage/ScriptMetadataImporter.hxx
deleted file mode 100644
index 3c94bff75d26..000000000000
--- a/scripting/source/storage/ScriptMetadataImporter.hxx
+++ /dev/null
@@ -1,254 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SCRIPTING_STORAGE_SCRIPTMETADATAIMPORTER_HXX_
-#define _SCRIPTING_STORAGE_SCRIPTMETADATAIMPORTER_HXX_
-
-#include <vector>
-
-#include <rtl/ustring.h>
-#include <rtl/ustrbuf.hxx>
-#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 <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-
-#include "ScriptData.hxx"
-
-namespace scripting_impl
-{
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-typedef ::std::vector< ScriptData > InfoImpls_vec;
-typedef ::std::pair< ::rtl::OUString, ::std::pair< ::rtl::OUString,
- ::rtl::OUString > > strpair_pair;
-
-/**
- * Script Meta Data Importer
- */
-class ScriptMetadataImporter : public
- ::cppu::WeakImplHelper1< css::xml::sax::XExtendedDocumentHandler >
-{
-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 css::io::XInputStream
- */
- void parseMetaData( css::uno::Reference< css::io::XInputStream >
- const & xInput, const ::rtl::OUString & parcelURI,
- InfoImpls_vec & io_ScriptDatas )
- throw ( css::xml::sax::SAXException, css::io::IOException,
- css::uno::RuntimeException );
-
- /**
- * Constructor for the meta-data parser
- *
- * @param XComponentContext
- */
- explicit ScriptMetadataImporter(
- const css::uno::Reference< css::uno::XComponentContext >& );
-
- /**
- * Destructor for the parser
- */
- 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 ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle the end of CDATA in XML
- *
- * @see com::sun::star::xml::sax::XExtendedDocumentHandler
- */
- virtual void SAL_CALL endCDATA() throw ( css::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 ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle line breaks in XML
- *
- * @see com::sun::star::xml::sax::XExtendedDocumentHandler
- */
- virtual void SAL_CALL allowLineBreak()
- throw ( css::xml::sax::SAXException, css::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 ( css::xml::sax::SAXException, css::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 ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle the end of the XML document
- *
- * @see com::sun::star::xml::sax::XDocumentHandler
- */
- virtual void SAL_CALL endDocument()
- throw ( css::xml::sax::SAXException, css::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 css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs )
- throw ( css::xml::sax::SAXException,
- css::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 ( css::xml::sax::SAXException, css::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 ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to handle whitespace
- *
- * @see com::sun::star::xml::sax::XDocumentHandler
- */
- virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString & aWhitespaces )
- throw ( css::xml::sax::SAXException, css::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 ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
- /**
- * Function to set the document locator
- *
- * @see com::sun::star::xml::sax::XDocumentHandler
- */
- virtual void SAL_CALL setDocumentLocator(
- const css::uno::Reference< css::xml::sax::XLocator >& xLocator )
- throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
-
-
-
-private:
-
- /** Vector contains the ScriptData structs */
- InfoImpls_vec* mpv_ScriptDatas;
-
- /** @internal */
- osl::Mutex m_mutex;
-
- /** @internal */
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
- /** Placeholder for the parcel URI */
- ::rtl::OUString ms_parcelURI;
-
- /** States for state machine during parsing */
- enum { PARCEL, SCRIPT, LOCALE, DISPLAYNAME, DESCRIPTION, FUNCTIONNAME,
- LOGICALNAME, LANGUAGEDEPPROPS, LANGDEPPROPS, FILESET, FILESETPROPS,
- FILES, FILEPROPS } m_state;
-
- /** Build up the struct during parsing the meta data */
- ScriptData m_ScriptData;
-
- /** @internal */
- ::rtl::OUString ms_localeLang;
- ::rtl::OUString ms_localeDisName;
- ::rtl::OUStringBuffer *ms_localeDesc;
-
- props_vec mv_filesetprops;
-
- ::rtl::OUString ms_filename;
- ::rtl::OUString ms_filesetname;
-
- props_vec mv_fileprops;
-
- strpairvec_map mm_files;
-
- InfoImpls_vec mv_ScriptDatas;
-
- /**
- * Helper function to set the state
- *
- * @param tagName
- * The current tag being processed
- */
- void setState(const ::rtl::OUString & tagName);
-}
-; // class ScriptMetadataImporter
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptSecurityManager.cxx b/scripting/source/storage/ScriptSecurityManager.cxx
deleted file mode 100644
index 5c12fcdc0a13..000000000000
--- a/scripting/source/storage/ScriptSecurityManager.cxx
+++ /dev/null
@@ -1,528 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/WrappedTargetException.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/UnknownPropertyException.hpp>
-#include <com/sun/star/container/XNameReplace.hpp>
-#include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
-#include <com/sun/star/util/XStringSubstitution.hpp>
-#include <com/sun/star/awt/XDialog.hpp>
-#include <com/sun/star/security/AccessControlException.hpp>
-#include <com/sun/star/security/RuntimePermission.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptStorageManager.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptInfoAccess.hpp>
-#include "ScriptSecurityManager.hxx"
-#include <util/util.hxx>
-#include <util/scriptingconstants.hxx>
-#include <tools/diagnose_ex.h>
-
-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;
-
-// is this in the utils?
-const char* const SCRIPTSTORAGEMANAGER_SERVICE =
- "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager";
-
-namespace scripting_securitymgr
-{
-
-static OUString s_configProv(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider"));
-
-static OUString s_configAccess(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess"));
-
-static OUString s_configUpdate(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationUpdateAccess"));
-
-static OUString s_securityDialog(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.script.framework.security.SecurityDialog"));
-
-static const int PERMISSION_NEVER = 0;
-static const int PERMISSION_PATHLIST = 1;
-static const int PERMISSION_ALWAYS = 2;
-
-static const int ALLOW_RUN = 1;
-static const int ADD_TO_PATH = 2;
-
-//*************************************************************************
-// ScriptSecurityManager Constructor
-ScriptSecurityManager::ScriptSecurityManager(
- const Reference< XComponentContext > & xContext ) throw ( RuntimeException )
- : m_xContext( xContext, UNO_SET_THROW )
-{
- OSL_TRACE( "< ScriptSecurityManager ctor called >\n" );
-
- // get the service manager from the context
- Reference< lang::XMultiComponentFactory > xMgr( m_xContext->getServiceManager(), UNO_SET_THROW );
-
- // create an instance of the ConfigurationProvider
- m_xConfigProvFactory.set( xMgr->createInstanceWithContext( s_configProv, m_xContext ), UNO_QUERY_THROW );
-}
-
-void ScriptSecurityManager::addScriptStorage( rtl::OUString scriptStorageURL,
- sal_Int32 storageID)
-throw ( RuntimeException )
-{
- Permission_Hash::const_iterator ph_it = m_permissionSettings.find( scriptStorageURL );
- if ( ph_it != m_permissionSettings.end() )
- {
- OSL_TRACE( "ScriptSecurityManager::addScriptStorage: already called for %s",
- ::rtl::OUStringToOString( scriptStorageURL,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- return;
- }
- StoragePerm newPerm;
- newPerm.scriptStorageURL=scriptStorageURL;
- newPerm.storageID=storageID;
-
- // we err on the side of caution!!
- newPerm.execPermission=sal_False;
-
- //need to check if storage has any scripts
- try
- {
- // we have some scripts so read config & decide on that basis
- // Setup flags: m_runMacroSetting, m_warning, m_confirmationRequired,
- readConfiguration();
- }
- catch ( RuntimeException & rte )
- {
- OSL_TRACE( "ScriptSecurityManager::addScriptStorage: caught RuntimeException: %s",
- ::rtl::OUStringToOString( rte.Message,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::addScriptStorage: caught RuntimeException" ).concat( rte.Message ),
- Reference< XInterface >() );
- }
-
- switch( m_runMacroSetting )
- {
- case PERMISSION_NEVER: // never
- {
- OSL_TRACE("never run");
- break;
- }
- case PERMISSION_PATHLIST: // according to path list
- {
- OSL_TRACE("according to path");
- // check path
- rtl::OUString path = scriptStorageURL.copy( 0, scriptStorageURL.lastIndexOf( '/' ) );
- OSL_TRACE( "no of elts in path list = %d",
- (int)m_secureURL.getLength() );
- bool match = isSecureURL( path );
- if( match && ( m_warning == sal_True ) )
- {
- OSL_TRACE("path match & warning dialog");
- int result = (int)executeStandardDialog();
- OSL_TRACE("result = %d", (int)result);
- if ( (result&ALLOW_RUN) == ALLOW_RUN )
- {
- newPerm.execPermission=sal_True;
- }
- break;
- }
- else if ( match )
- {
- OSL_TRACE("path match & no warning dialog");
- newPerm.execPermission=sal_True;
- break;
- }
- else if( m_confirmationRequired == sal_True )
- {
- OSL_TRACE("no path match & confirmation dialog");
- int result = (int)executePathDialog( path );
- OSL_TRACE("result = %d", (int)result);
- if ( (result&ALLOW_RUN) == ALLOW_RUN )
- {
- newPerm.execPermission=sal_True;
- }
- if ( (result&ADD_TO_PATH) == ADD_TO_PATH )
- {
- /* if checkbox clicked then need to add path to registry*/
- addToSecurePaths(path);
- }
- }
- break;
- }
- case PERMISSION_ALWAYS: // always
- if( m_warning == sal_True )
- {
- OSL_TRACE("always & warning dialog");
- short result = executeStandardDialog();
- if ( (result&ALLOW_RUN) == ALLOW_RUN )
- {
- newPerm.execPermission=sal_True;
- }
- }
- else
- {
- OSL_TRACE("always & no warning dialog");
- newPerm.execPermission=sal_True;
- }
- break;
- default:
- //
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::addScriptStorage got invalid OfficeBasic setting"),
- Reference< XInterface > ());
- }
-
- if ( newPerm.execPermission == sal_True )
- {
- OSL_TRACE("setting exec permission to true for %s",
- ::rtl::OUStringToOString( scriptStorageURL,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- else
- {
- OSL_TRACE("setting exec permission to false for %s",
- ::rtl::OUStringToOString( scriptStorageURL,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
-
- m_permissionSettings[ scriptStorageURL ] = newPerm;
-}
-
-bool ScriptSecurityManager::isSecureURL( const OUString & path )
-{
- bool match = false;
- OSL_TRACE( "no of elts in path list = %d",
- (int)m_secureURL.getLength() );
- OSL_TRACE("document path: %s",
- ::rtl::OUStringToOString( path,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- int length = m_secureURL.getLength();
- for( int j = 0; j < length ; j++ )
- {
- OSL_TRACE("path list element: %s",
- ::rtl::OUStringToOString( m_secureURL[j],
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
-#ifdef WIN32
- OSL_TRACE("case insensitive comparison");
- if( path.equalsIgnoreAsciiCase( m_secureURL[j] ) )
-#else
- OSL_TRACE("case sensitive comparison");
- if( path.equals( m_secureURL[j] ) )
-#endif
- {
- match = true;
- break;
- }
- }
- return match;
-}
-
-short ScriptSecurityManager::executeStandardDialog()
-throw ( RuntimeException )
-{
- OUString dummyString;
- return executeDialog( dummyString );
-}
-
-short ScriptSecurityManager::executePathDialog( const OUString & path )
-throw ( RuntimeException )
-{
- return executeDialog( path );
-}
-
-short ScriptSecurityManager::executeDialog( const OUString & path )
-throw ( RuntimeException )
-{
- Sequence < Any > aArgs;
- if( path.getLength() != 0 )
- {
- OSL_TRACE("reallocing");
- aArgs.realloc(1);
- aArgs[ 0 ] <<= path;
- }
- short result;
- try
- {
- Reference< lang::XMultiComponentFactory > xMgr( m_xContext->getServiceManager(), UNO_SET_THROW );
- Reference< awt::XDialog > xDialog(
- xMgr->createInstanceWithArgumentsAndContext( s_securityDialog, aArgs, m_xContext ),
- UNO_QUERY_THROW );
- result = xDialog->execute();
- Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY_THROW );
- xComponent->dispose();
- }
- catch ( RuntimeException & rte )
- {
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::executeDialog: caught RuntimeException: ").concat( rte.Message ),
- Reference< XInterface > ());
- }
- catch ( Exception & e )
- {
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::executeDialog: caught Exception: ").concat( e.Message ),
- Reference< XInterface > ());
- }
- return result;
-}
-
-/**
- * checks to see whether the requested ScriptPermission is allowed.
- * This was modelled after the Java AccessController, but at this time
- * we can't see a good reason not to return a bool, rather than throw
- * an exception if the request is not granted (as is the case in Java).
- */
-void ScriptSecurityManager::checkPermission( const OUString & scriptStorageURL,
- const OUString & permissionRequest )
- throw ( RuntimeException, lang::IllegalArgumentException, security::AccessControlException )
-{
- if( permissionRequest.equals( OUString(RTL_CONSTASCII_USTRINGPARAM("execute")) ) )
- {
- OSL_TRACE(
- "ScriptSecurityManager::checkPermission: execute permission request for %s",
- ::rtl::OUStringToOString( scriptStorageURL,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- Permission_Hash::const_iterator ph_it = m_permissionSettings.find( scriptStorageURL );
- Permission_Hash::const_iterator ph_itend =
- m_permissionSettings.end();
- if ( ph_it != ph_itend )
- {
- if ( ph_it->second.execPermission )
- {
- return;
- }
- else
- {
- OSL_TRACE( "permission refused" );
- Any aPermission;
- security::RuntimePermission permission;
- permission.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("execute")).concat( scriptStorageURL );
- aPermission <<= permission;
- throw security::AccessControlException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptSecurityManager::checkPermission: no execute permission for URL")).concat( scriptStorageURL ),
- Reference< XInterface > (), aPermission );
- }
- }
- // we should never get here!!
- throw lang::IllegalArgumentException( OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptSecurityManager::checkPermission: storageURL not found")), Reference< XInterface > (), 0 );
- }
- // inappropriate permission request
- throw lang::IllegalArgumentException( OUString(RTL_CONSTASCII_USTRINGPARAM("ScriptSecurityManager::checkPermission: storageURL not found")), Reference< XInterface > (), 1 );
-}
-
-void ScriptSecurityManager::removePermissionSettings ( ::rtl::OUString & scriptStorageURL )
-{
- Permission_Hash::const_iterator ph_it =
- m_permissionSettings.find( scriptStorageURL );
-
- if ( ph_it == m_permissionSettings.end() )
- {
- OSL_TRACE( "Entry for storage url %s doesn't exist in map",
- ::rtl::OUStringToOString( scriptStorageURL,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- return;
- }
-
- // erase the entry from the hash
- m_permissionSettings.erase( scriptStorageURL );
-
-}
-
-void ScriptSecurityManager::readConfiguration()
- throw ( RuntimeException)
-{
- try
- {
- beans::PropertyValue configPath;
- configPath.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath"));
- configPath.Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/Security/Scripting"));
- Sequence < Any > aargs( 1 );
- aargs[ 0 ] <<= configPath;
- ENSURE_OR_THROW( m_xConfigProvFactory.is(),
- "ScriptSecurityManager::readConfiguration: ConfigProviderFactory no longer valid!" );
- // get the XPropertySet interface from the ConfigurationAccess service
- Reference < beans::XPropertySet > xPropSet( m_xConfigProvFactory->createInstanceWithArguments( s_configAccess, aargs ), UNO_QUERY_THROW );
-
- m_confirmationRequired = sal_True;
- OSL_VERIFY( xPropSet->getPropertyValue( OUSTR( "Confirmation" ) ) >>= m_confirmationRequired );
- if ( m_confirmationRequired == sal_True )
- {
- OSL_TRACE( "ScriptSecurityManager:readConfiguration: confirmation is true" );
- }
- else
- {
- OSL_TRACE( "ScriptSecurityManager:readConfiguration: confirmation is false" );
- }
-
- m_warning = true;
- OSL_VERIFY( xPropSet->getPropertyValue( OUSTR( "Warning" ) ) >>= m_warning );
-
- if ( m_warning == sal_True )
- {
- OSL_TRACE( "ScriptSecurityManager:readConfiguration: warning is true" );
- }
- else
- {
- OSL_TRACE( "ScriptSecurityManager:readConfiguration: warning is false" );
- }
-
- m_runMacroSetting = sal_True;
- OSL_VERIFY( xPropSet->getPropertyValue( OUSTR( "OfficeBasic" ) ) >>= m_runMacroSetting );
- OSL_TRACE( "ScriptSecurityManager:readConfiguration: OfficeBasic = %d", m_runMacroSetting );
-
- m_secureURL = ::rtl::OUString();
- OSL_VERIFY( xPropSet->getPropertyValue( OUSTR( "SecureURL" ) ) >>= m_secureURL );
- }
- catch ( beans::UnknownPropertyException & upe )
- {
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager:readConfiguration: Attempt to read unknown property: " ).concat( upe.Message ),
- Reference< XInterface > () );
- }
- catch ( lang::WrappedTargetException & wte )
- {
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager:readConfiguration: wrapped target exception? :" ).concat( wte.Message ),
- Reference< XInterface > () );
- }
- catch ( Exception & e )
- {
- OSL_TRACE( "Unknown exception in readconf: %s",
- ::rtl::OUStringToOString(e.Message ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager:readConfiguration: exception? :" ).concat( e.Message ),
- Reference< XInterface > () );
- }
-#ifdef _DEBUG
- catch ( ... )
- {
- OSL_TRACE( "Completely Unknown exception in readconf!!!!!!");
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager:readConfiguration: exception? :" ),
- Reference< XInterface > () );
- }
-#endif
-
- int length = m_secureURL.getLength();
-
- // PathSubstitution needed to interpret variables found in config
- Reference< lang::XMultiComponentFactory > xMgr( m_xContext->getServiceManager(), UNO_SET_THROW );
- Reference< XInterface > xInterface = );
- Reference< util::XStringSubstitution > xStringSubstitution(
- xMgr->createInstanceWithContext(
- ::rtl::OUString::createFromAscii( "com.sun.star.util.PathSubstitution" ), m_xContext
- ),
- UNO_QUERY_THROW
- );
- for( int i = 0; i < length; i++ )
- {
- OSL_TRACE( "ScriptSecurityManager:readConfiguration path = %s",
- ::rtl::OUStringToOString(m_secureURL[i] ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- OSL_TRACE( "ScriptSecurityManager: subpath = %s",
- ::rtl::OUStringToOString(
- xStringSubstitution->substituteVariables( m_secureURL[i], true ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- m_secureURL[i] = xStringSubstitution->substituteVariables( m_secureURL[i], true );
- }
-#ifdef _DEBUG
- int length2 = m_secureURL.getLength();
- for( int j = 0; j < length2 ; j++ )
- {
- OSL_TRACE( "ScriptSecurityManager: path = %s",
- ::rtl::OUStringToOString(m_secureURL[j] ,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
-#endif
-}
-
-void ScriptSecurityManager::addToSecurePaths( const OUString & path )
-throw ( RuntimeException )
-{
- OSL_TRACE( "--->ScriptSecurityManager::addToSecurePaths" );
- beans::PropertyValue configPath;
- configPath.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath"));
- configPath.Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/Security/Scripting"));
- Sequence < Any > aargs( 1 );
- aargs[ 0 ] <<= configPath;
- Reference < container::XNameReplace > xNameReplace(
- m_xConfigProvFactory->createInstanceWithArguments( s_configUpdate, aargs ), UNO_QUERY_THROW );
- Reference < util::XChangesBatch > xChangesBatch( xNameReplace, UNO_QUERY_THROW );
-
- OSL_TRACE( "--->ScriptSecurityManager::addToSecurePaths: after if stuff" );
- Reference < beans::XPropertySet > xPropSet( xInterface, UNO_QUERY );
- css::uno::Sequence< rtl::OUString > newSecureURL;
- Any value;
- OUString pathListPropName = OUSTR ( "SecureURL" );
- value=xPropSet->getPropertyValue( pathListPropName );
- if ( sal_False == ( value >>= newSecureURL ) )
- {
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::addToSecurePaths: can't get SecureURL setting" ),
- Reference< XInterface > () );
- }
- try
- {
- sal_Int32 length = newSecureURL.getLength();
- newSecureURL.realloc( length + 1 );
- newSecureURL[ length ] = path;
- Any aNewSecureURL;
- aNewSecureURL <<= newSecureURL;
- xNameReplace->replaceByName( pathListPropName, aNewSecureURL );
- xChangesBatch->commitChanges();
- m_secureURL = newSecureURL;
- }
- catch ( Exception & e )
- {
- OSL_TRACE( "Error updating secure paths: " );
- throw RuntimeException(
- OUSTR( "ScriptSecurityManager::addToSecurePaths: error updating SecureURL setting" ).concat( e.Message ),
- Reference< XInterface > () );
- }
-}
-
-//*************************************************************************
-// ScriptSecurityManager Destructor
-ScriptSecurityManager::~ScriptSecurityManager()
-{
- OSL_TRACE( "< ScriptSecurityManager dtor called >\n" );
-}
-
-} // Namespace
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptSecurityManager.hxx b/scripting/source/storage/ScriptSecurityManager.hxx
deleted file mode 100644
index 37dffcadcd42..000000000000
--- a/scripting/source/storage/ScriptSecurityManager.hxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
-*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-
-#ifndef _FRAMEWORK_SCRIPT_SCRIPTSECURITYMANAGER_HXX_
-#define _FRAMEWORK_SCRIPT_SCRIPTSECURITYMANAGER_HXX_
-
-#include <boost/unordered_map.hpp>
-#include <rtl/ustring.hxx>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/security/AccessControlException.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptInfo.hpp>
-
-namespace scripting_securitymgr
-{
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-struct StoragePerm {
- rtl::OUString scriptStorageURL;
- sal_Int32 storageID;
- sal_Bool execPermission;
-};
-
-typedef ::boost::unordered_map< ::rtl::OUString, StoragePerm, ::rtl::OUStringHash,
- ::std::equal_to< ::rtl::OUString > > Permission_Hash;
-/**
- * Class responsible for managing the ScriptSecurity.
- */
-class ScriptSecurityManager
-{
-public:
- explicit ScriptSecurityManager(
- const css::uno::Reference< css::uno::XComponentContext > & xContext )
- throw ( css::uno::RuntimeException );
- ~ScriptSecurityManager();
- void addScriptStorage( rtl::OUString scriptStorageURL, sal_Int32 storageID)
- throw ( css::uno::RuntimeException );
-/**
- * checks to see if the requested permission can be granted
- * checks to see whether the requested ScriptPeremission is allowed.
- */
- void checkPermission( const rtl::OUString & scriptStorageURL,
- const rtl::OUString & permissionRequest )
- throw ( css::uno::RuntimeException, css::lang::IllegalArgumentException,
- css::security::AccessControlException );
- void removePermissionSettings ( ::rtl::OUString & scriptStorageURL );
-private:
- void readConfiguration() throw (css::uno::RuntimeException);
-
- short executeDialog ( const rtl::OUString & path )
- throw (css::uno::RuntimeException);
- short executeStandardDialog()
- throw ( css::uno::RuntimeException );
- short executePathDialog(const rtl::OUString & path)
- throw ( css::uno::RuntimeException );
-
- void addToSecurePaths ( const rtl::OUString & path )
- throw (css::uno::RuntimeException);
- bool isSecureURL( const rtl::OUString & path );
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- sal_Bool m_confirmationRequired;
- sal_Bool m_warning;
- sal_Int32 m_runMacroSetting;
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvFactory;
- css::uno::Sequence< rtl::OUString > m_secureURL;
- Permission_Hash m_permissionSettings;
-
-};
-} // scripting_securitymgr
-
-#endif //_FRAMEWORK_SCRIPT_SCRIPTSECURITYMANAGER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptStorage.cxx b/scripting/source/storage/ScriptStorage.cxx
deleted file mode 100644
index c723b802f5b7..000000000000
--- a/scripting/source/storage/ScriptStorage.cxx
+++ /dev/null
@@ -1,831 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
-*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-#include <osl/file.hxx>
-#include <osl/time.h>
-#include <cppuhelper/implementationentry.hxx>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/ucb/CommandAbortedException.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-#include <util/util.hxx>
-#include <rtl/uri.hxx>
-
-
-#include "ScriptData.hxx"
-#include "ScriptInfo.hxx"
-#include "ScriptStorage.hxx"
-#include "ScriptElement.hxx"
-#include "ScriptMetadataImporter.hxx"
-#include "ScriptURI.hxx"
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::drafts::com::sun::star::script::framework;
-
-namespace scripting_impl
-{
-
-ScriptLanguages_hash* ScriptStorage::mh_scriptLangs = NULL;
-
-const sal_Char* const SERVICE_NAME =
- "drafts.com.sun.star.script.framework.storage.ScriptStorage";
-const sal_Char* const IMPL_NAME =
- "drafts.com.sun.star.script.framework.storage.ScriptStorage";
-
-const sal_Char * const SCRIPT_DIR = "/Scripts";
-const sal_Char * const SCRIPT_PARCEL = "/parcel-descriptor.xml";
-const sal_Char * const SCRIPT_PARCEL_NAME_ONLY = "parcel-descriptor";
-
-static OUString ss_implName(RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME ));
-static OUString ss_serviceName(RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ));
-static Sequence< OUString > ss_serviceNames =
- Sequence< OUString >( &ss_serviceName, 1 );
-
-const sal_uInt16 NUMBER_STORAGE_INITIALIZE_ARGS = 3;
-
-
-//*************************************************************************
-ScriptStorage::ScriptStorage( const Reference <
- XComponentContext > & xContext )
-throw ( RuntimeException )
- : m_xContext( xContext, UNO_SET_THROW ), m_bInitialised( false )
-{
- OSL_TRACE( "< ScriptStorage ctor called >\n" );
-
- m_xMgr.set( m_xContext->getServiceManager(), UNO_SET_THROW );
-
- if( !mh_scriptLangs )
- {
- ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
- if( !mh_scriptLangs )
- {
- mh_scriptLangs = new ScriptLanguages_hash();
- Reference< lang::XMultiServiceFactory > xConfigProvFactory(
- m_xMgr->createInstanceWithContext( OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ), m_xContext ),
- UNO_QUERY_THROW );
- // create an instance of the ConfigurationAccess for accessing the
- // scripting runtime settings
- beans::PropertyValue configPath;
- configPath.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath"));
- configPath.Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Scripting/ScriptRuntimes"));
- Sequence < Any > aargs( 1 );
- aargs[ 0 ] <<= configPath;
-
- Reference< container::XNameAccess > xNameAccess(
- xConfigProvFactory->createInstanceWithArguments(
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess")),
- aargs
- ),
- UNO_QUERY_THROW );
-
- Sequence< OUString > names = xNameAccess->getElementNames();
- for( int i = 0 ; i < names.getLength() ; i++ )
- {
- OSL_TRACE( "Getting propertyset for Lang=%s",
- ::rtl::OUStringToOString( names[i], RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- Reference< beans::XPropertySet > xPropSet( xNameAccess->getByName( names[i] ), UNO_QUERY_THROW );
- Any aProp = xPropSet->getPropertyValue(
- OUString(RTL_CONSTASCII_USTRINGPARAM("SupportedFileExtensions")) );
- Sequence< OUString > extns;
- if( sal_False == ( aProp >>= extns ) )
- {
- throw RuntimeException(
- OUSTR( "ScriptStorage:ScriptStorage: can't get runtime extensions" ),
- Reference< XInterface > () );
- }
- for( int j = 0 ; j < extns.getLength() ; j++ )
- {
- OSL_TRACE( "Adding Lang=%s, Extn=%s\n",
- ::rtl::OUStringToOString( names[i], RTL_TEXTENCODING_ASCII_US ).pData->buffer,
- ::rtl::OUStringToOString( extns[j], RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- (*mh_scriptLangs)[ extns[j] ] =
- names[i];
- }
- }
- }
- }
-}
-
-//*************************************************************************
-ScriptStorage::~ScriptStorage() SAL_THROW( () )
-{
- OSL_TRACE( "< ScriptStorage dtor called >\n" );
-}
-
-//*************************************************************************
-void
-ScriptStorage::initialize( const Sequence <Any> & args )
-throw ( RuntimeException, Exception )
-{
- OSL_TRACE( "Entering ScriptStorage::initialize\n" );
-
- // Should not be renitialised
- if ( m_bInitialised )
- {
- throw RuntimeException(
- OUSTR( "ScriptStorage::initalize already initialized" ),
- Reference<XInterface> () );
- }
-
- { // Protect member variable writes
- ::osl::Guard< osl::Mutex > aGuard( m_mutex );
-
- // Check args
- if ( args.getLength() != NUMBER_STORAGE_INITIALIZE_ARGS )
- {
- OSL_TRACE( "ScriptStorage::initialize: got wrong number of args\n" );
- throw RuntimeException(
- OUSTR( "Invalid number of arguments provided!" ),
- Reference< XInterface >() );
- }
-
- if ( sal_False == ( args[ 0 ] >>= m_xSimpleFileAccess ) )
- {
- throw RuntimeException(
- OUSTR( "Invalid XSimpleFileAccess argument provided!" ),
- Reference< XInterface >() );
- }
-
- if ( sal_False == ( args[ 1 ] >>= m_scriptStorageID ) )
- {
- throw RuntimeException(
- OUSTR( "Invalid ScriptStorage ID argument provided!" ),
- Reference< XInterface >() );
-
- }
- if ( sal_False == ( args[ 2 ] >>= m_stringUri ) )
- {
- throw RuntimeException(
- OUSTR( "Invalid String Uri argument provided!" ),
- Reference< XInterface >() );
- }
- } // End - Protect member variable writes
-
- OSL_TRACE( "uri: %s\n", ::rtl::OUStringToOString(
- m_stringUri, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- try
- {
- // need to check for what???
- // what we have is a URI for the filesystem or document
- // we need to check of the last element in the path has an
- // extension that is associated with a script (eg. .bsh, .js etc)
- OUString fileExtension = getFileExtension( m_stringUri );
- // and see if this is in our scripts map
- ScriptLanguages_hash::iterator h_it = mh_scriptLangs->find( fileExtension );
- if ( h_it != mh_scriptLangs->end() )
- {
- createForFilesystem( fileExtension );
- }
- else
- {
- create();
- }
- }
- catch ( RuntimeException & re )
- {
- OSL_TRACE( "caught com::sun::star::uno::RuntimeException in ScriptStorage::initialize" );
- throw RuntimeException(
- OUSTR( "ScriptStorage::initalize RuntimeException: " ).concat( re.Message ),
- Reference< XInterface > () );
- }
- catch ( Exception & ue )
- {
- OSL_TRACE( "caught com::sun::star::uno::Exception in ScriptStorage::initialize" );
- throw RuntimeException(
- OUSTR( "ScriptStorage::initalize Exception: " ).concat( ue.Message ),
- Reference< XInterface > () );
- }
-#ifdef _DEBUG
- catch ( ... )
- {
- OSL_TRACE( "caught unknown Exception in ScriptStorage::initialize" );
- throw RuntimeException(
- OUSTR( "ScriptStorage::initalize unknown exception: " ),
- Reference< XInterface > () );
- }
-#endif
-
- OSL_TRACE( "Parsed the XML\n" );
-
- m_bInitialised = true;
-}
-
-void
-ScriptStorage::create()
-throw ( RuntimeException, Exception )
-{
- ::osl::Guard< osl::Mutex > aGuard( m_mutex );
- try
- {
- // clear existing hashmap - rebuilding from scratch to avoid having
- // to search for deleted elements on refresh
- mh_implementations.clear();
-
- OUString xStringUri(m_stringUri);
-
- ScriptMetadataImporter* SMI = new ScriptMetadataImporter( m_xContext );
- Reference< xml::sax::XExtendedDocumentHandler > xSMI( SMI, UNO_SET_THROW );
-
- xStringUri = xStringUri.concat( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- SCRIPT_DIR )) );
-
- // No Scripts directory - just return
- if ( ! m_xSimpleFileAccess->isFolder( xStringUri ) )
- {
- OSL_TRACE( "ScriptStorage::initialize: no Scripts dir for this storage - install problem\n" );
- return;
- }
-
- // get the list of language folders under the Scripts directory
- Sequence< ::rtl::OUString > languageDirs =
- m_xSimpleFileAccess->getFolderContents( xStringUri, true );
-
- Reference< io::XInputStream > xInput;
- sal_Int32 languageDirsLength = languageDirs.getLength();
- for ( sal_Int32 i = 0; i < languageDirsLength ; ++i )
- {
- OSL_TRACE( "contains: %s\n", ::rtl::OUStringToOString(
- languageDirs[ i ], RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- if ( ! m_xSimpleFileAccess->isFolder( languageDirs[ i ] ) )
- {
- continue;
- }
-
- //get the list of parcel folders for each language folder
- // under Scripts
- Sequence< ::rtl::OUString > parcelDirs =
- m_xSimpleFileAccess->getFolderContents( languageDirs[ i ], true );
-
- sal_Int32 parcelDirsLength = parcelDirs.getLength();
- for ( sal_Int32 j = 0; j < parcelDirsLength ; ++j )
- {
- OSL_TRACE( "contains: %s\n",
- ::rtl::OUStringToOString( parcelDirs[ j ],
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- OUString parcelFile = parcelDirs[ j ].concat(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SCRIPT_PARCEL )) );
-
- // Do not have a valid parcel.xml
- if ( !m_xSimpleFileAccess->exists( parcelFile ) ||
- m_xSimpleFileAccess->isFolder( parcelFile ) )
- {
- continue;
- }
- OSL_TRACE( "parcel file: %s\n",
- ::rtl::OUStringToOString( parcelFile,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- xInput = m_xSimpleFileAccess->openFileRead( parcelFile );
- // Failed to get input stream
- if ( !xInput.is() )
- {
- continue;
- }
-
- OSL_TRACE( "Parse the metadata \n" );
- Datas_vec vScriptDatas;
- try
- {
- SMI->parseMetaData( xInput, parcelDirs[ j ], vScriptDatas );
- }
- catch ( xml::sax::SAXException & saxe )
- {
- if ( xInput.is() )
- {
- xInput->closeInput();
- }
- OSL_TRACE(
- "caught com::sun::star::xml::sax::SAXException in ScriptStorage::create %s",
- ::rtl::OUStringToOString( saxe.Message,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- continue;
- }
- catch ( io::IOException & ioe )
- {
- if ( xInput.is() )
- {
- xInput->closeInput();
- }
- OSL_TRACE(
- "caught com::sun::star::io::IOException in ScriptStorage::create" );
- continue;
- }
- xInput->closeInput();
-
- updateMaps( vScriptDatas );
- }
- }
- }
- catch ( io::IOException & ioe )
- {
- //From ScriptMetadata Importer
- OSL_TRACE( "caught com::sun::star::io::IOException in ScriptStorage::create" );
- throw RuntimeException(
- OUSTR( "ScriptStorage::create IOException: " ).concat( ioe.Message ),
- Reference< XInterface > () );
-
- }
- catch ( ucb::CommandAbortedException & cae )
- {
- OSL_TRACE( "caught com::sun::star::ucb::CommandAbortedException in ScriptStorage::create" );
- throw RuntimeException(
- OUSTR(
- "ScriptStorage::create CommandAbortedException: " ).concat( cae.Message ),
- Reference< XInterface > () );
- }
- catch ( RuntimeException & re )
- {
- OSL_TRACE( "caught com::sun::star::uno::RuntimeException in ScriptStorage::create" );
- throw RuntimeException(
- OUSTR( "ScriptStorage::create RuntimeException: " ).concat( re.Message ),
- Reference< XInterface > () );
- }
- catch ( Exception & ue )
- {
- OSL_TRACE( "caught com::sun::star::uno::Exception in ScriptStorage::create" );
- throw RuntimeException(
- OUSTR( "ScriptStorage::create Exception: " ).concat( ue.Message ),
- Reference< XInterface > () );
- }
-#ifdef _DEBUG
- catch ( ... )
- {
- OSL_TRACE( "caught unknown Exception in ScriptStorage::create" );
- throw RuntimeException(
- OUSTR( "ScriptStorage::initalize unknown exception: " ),
- Reference< XInterface > () );
- }
-#endif
-
- OSL_TRACE( "Parsed the XML\n" );
-
- m_bInitialised = true;
-}
-
-//*************************************************************************
-// private method to create the usual data structures for scripts located
-// on the filesystem.
-// parcelURI = the path to the script
-// functionName = the full filename with extension
-// logicalName = the filename without the extension
-void
-ScriptStorage::createForFilesystem( const OUString & fileExtension )
-throw ( RuntimeException, Exception )
-{
- // need to decode as file urls are encoded
- OUString xStringUri = ::rtl::Uri::decode( m_stringUri,
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_ASCII_US );
-
- // no x-platform issues here as we are dealing with URLs
- sal_Int32 lastFileSep = xStringUri.lastIndexOf( '/' );
- // the char just after the filesep
- lastFileSep += 1;
- sal_Int32 lastFileExt = xStringUri.lastIndexOf( fileExtension );
- OUString searchString(RTL_CONSTASCII_USTRINGPARAM("://"));
- sal_Int32 searchStringLength = searchString.getLength();
- sal_Int32 startPath = xStringUri.indexOf( searchString );
- sal_Int32 uriLength = xStringUri.getLength();
- OUString fileNameNoExt = xStringUri.copy( lastFileSep ,
- lastFileExt - lastFileSep - 1 );
- OUString fileName = xStringUri.copy( lastFileSep, uriLength - lastFileSep );
- OUString filePath = xStringUri.copy( startPath + searchStringLength,
- lastFileSep - startPath - searchStringLength );
- OUString filePathWithName = xStringUri.copy( startPath + searchStringLength,
- uriLength - startPath - searchStringLength );
-
- ScriptData scriptData;
- scriptData.language = mh_scriptLangs->find( fileExtension )->second;
- OSL_TRACE( "\t language = %s", ::rtl::OUStringToOString(
- scriptData.language, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- // do we need to encode this?
- scriptData.functionname = fileName;
- OSL_TRACE( "\t functionName = %s", ::rtl::OUStringToOString(
- scriptData.functionname, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- //scriptData.functionname = ::rtl::Uri::encode( fileName,
- //rtl_UriCharClassUricNoSlash, rtl_UriEncodeCheckEscapes,
- //RTL_TEXTENCODING_ASCII_US );
-
- scriptData.parcelURI = filePath;
- OSL_TRACE( "\t parcelURI = %s", ::rtl::OUStringToOString(
- scriptData.parcelURI, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- scriptData.logicalname = fileNameNoExt;
- OSL_TRACE( "\t logicalName = %s", ::rtl::OUStringToOString(
- scriptData.logicalname, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- // and now push onto the usual structures
- ScriptFunction_hash sfh;
- sfh[ scriptData.functionname ] = scriptData;
- mh_implementations[ scriptData.language ] = sfh;
- m_bInitialised = true;
-}
-
-//*************************************************************************
-// private method to return the file extension, eg. bsh, js etc
-OUString
-ScriptStorage::getFileExtension( const OUString & stringUri )
-{
- OUString fileExtension;
- sal_Int32 lastDot = stringUri.lastIndexOf( '.' );
- if( lastDot > 0 ) {
- sal_Int32 stringUriLength = stringUri.getLength();
- fileExtension = stringUri.copy( lastDot +1 , stringUriLength - lastDot - 1 );
- }
- else
- {
- fileExtension = OUString(RTL_CONSTASCII_USTRINGPARAM(""));
- }
- return fileExtension;
-}
-
-//*************************************************************************
-// private method for updating hashmaps
-void
-ScriptStorage::updateMaps( const Datas_vec & vScriptDatas )
-{
-
- Datas_vec::const_iterator it_end = vScriptDatas.end();
- // step through the vector of ScripImplInfos returned from parse
- for ( Datas_vec::const_iterator it = vScriptDatas.begin() ; it != it_end; ++it )
- {
- //find the Datas_vec for this logical name
- ScriptData_hash::iterator h_it = mh_implementations.find( it->language );
-
- if ( h_it == mh_implementations.end() )
- {
- //if it's null, need to create a new Datas_vec
- OSL_TRACE(
- "updateMaps: new language: %s\n", rtl::OUStringToOString(
- it->language, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- OSL_TRACE(
- "updateMaps: adding functionname: %s\n", rtl::OUStringToOString(
- it->functionname, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- ScriptFunction_hash sfh;
- sfh[ it->functionname ] = *it;
- mh_implementations[ it->language ] = sfh;
- }
- else
- {
- OSL_TRACE(
- "updateMaps: adding functionname: %s\n", rtl::OUStringToOString(
- it->functionname, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- OSL_TRACE( " language name: %s\n",
- rtl::OUStringToOString( it->functionname,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- h_it->second[ it->functionname ] = *it;
- }
- }
-}
-
-//*************************************************************************
-// XScriptStorageExport::save
-void
-ScriptStorage::save()
-throw ( RuntimeException )
-{
- ::osl::Guard< osl::Mutex > aGuard( m_mutex );
- Reference< io::XActiveDataSource > xSource;
- Reference< io::XOutputStream > xOS;
-
- // xScriptInvocation = Reference<XScriptInvocation>(xx, UNO_QUERY_THROW);
- Reference< xml::sax::XExtendedDocumentHandler > xHandler;
-
- OUString parcel_suffix(RTL_CONSTASCII_USTRINGPARAM( SCRIPT_PARCEL ));
- OUString ou_parcel(
- RTL_CONSTASCII_USTRINGPARAM( SCRIPT_PARCEL_NAME_ONLY ) );
-
- try
- {
- ScriptData_hash::iterator it_end = mh_implementations.end();
- for ( ScriptData_hash::iterator it = mh_implementations.begin() ; it != it_end; ++it )
- {
- ::rtl::OUString logName = it->first;
- ScriptFunction_hash::iterator it_sfh_end = it->second.end();
- for ( ScriptFunction_hash::iterator it_sfh = it->second.begin();
- it_sfh != it_sfh_end ; ++it_sfh )
- {
- ScriptOutput_hash::const_iterator it_parcels =
- mh_parcels.find( it_sfh->second.parcelURI );
- if ( it_parcels == mh_parcels.end() )
- {
- //create new outputstream
- OUString parcel_xml_path = it_sfh->second.parcelURI.concat(
- parcel_suffix );
- m_xSimpleFileAccess->kill( parcel_xml_path );
- xOS = m_xSimpleFileAccess->openFileWrite( parcel_xml_path );
-
- OSL_TRACE( "saving: %s\n", rtl::OUStringToOString(
- it_sfh->second.parcelURI.concat( OUString(RTL_CONSTASCII_USTRINGPARAM(
- "/parcel.xml" )) ),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- xHandler.set(
- m_xMgr->createInstanceWithContext(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")),
- m_xContext
- ),
- UNO_QUERY_THROW
- );
- xSource.set( xHandler, UNO_QUERY_THROW );
- xSource->setOutputStream( xOS );
-
- writeMetadataHeader( xHandler );
-
- mh_parcels[ it_sfh->second.parcelURI ] = xHandler;
- }
- else
- {
- xHandler = it_parcels->second;
- }
-
- ScriptElement* pSE = new ScriptElement( it_sfh->second );
- // this is to get pSE released correctly
- Reference < xml::sax::XAttributeList > xal( pSE );
- pSE->dump( xHandler );
- }
- }
-
- ScriptOutput_hash::const_iterator out_it_end = mh_parcels.end();
-
- for ( ScriptOutput_hash::const_iterator out_it = mh_parcels.begin();
- out_it != out_it_end; ++out_it )
- {
- out_it->second->ignorableWhitespace( ::rtl::OUString() );
- out_it->second->endDocument();
- xSource.set( out_it->second, UNO_QUERY );
- Reference< io::XOutputStream > xOS = xSource->getOutputStream();
- xOS->closeOutput();
-
- }
-
- // clear the hash map, as all output streams have been closed.
- // need to re-create on next save
- mh_parcels.clear();
- }
- // *** TODO - other exception handling IO etc.
- catch ( RuntimeException & re )
- {
- OSL_TRACE( "caught com::sun::star::uno::RuntimeException in ScriptStorage::save" );
- throw RuntimeException(
- OUSTR( "ScriptStorage::save RuntimeException: " ).concat(
- re.Message ),
- Reference< XInterface > () );
- }
-}
-
-//*************************************************************************
-void
-ScriptStorage::refresh()
-throw (RuntimeException)
-{
- OSL_TRACE("** => ScriptStorage: in refresh()\n");
-
- // guard against concurrent refreshes
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
-
- try
- {
- create();
-
- }
- catch ( RuntimeException & re )
- {
- OSL_TRACE( "caught com::sun::star::uno::RuntimeException in ScriptStorage::refresh" );
- throw RuntimeException(
- OUSTR( "ScriptStorage::refresh RuntimeException: " ).concat( re.Message ),
- Reference< XInterface > () );
- }
- catch ( Exception & ue )
- {
- OSL_TRACE( "caught com::sun::star::uno::Exception in ScriptStorage::refresh" );
- throw RuntimeException(
- OUSTR( "ScriptStorage::refresh Exception: " ).concat( ue.Message ),
- Reference< XInterface > () );
- }
-}
-
-//*************************************************************************
-void
-ScriptStorage::writeMetadataHeader(
- Reference <xml::sax::XExtendedDocumentHandler> & xHandler )
-{
- xHandler->startDocument();
- OUString aDocTypeStr( RTL_CONSTASCII_USTRINGPARAM(
- "<!DOCTYPE parcel SYSTEM \"scripting.dtd\">" ) );
- xHandler->unknown( aDocTypeStr );
- xHandler->ignorableWhitespace( OUString() );
-}
-
-
-//*************************************************************************
-Sequence< ::rtl::OUString >
-ScriptStorage::getScriptLogicalNames()
-throw ( RuntimeException )
-{
- Sequence< ::rtl::OUString > results;
- return results;
-}
-
-//*************************************************************************
-Sequence< Reference< storage::XScriptInfo > >
-ScriptStorage::getImplementations( const ::rtl::OUString & queryURI )
-throw ( lang::IllegalArgumentException,
- RuntimeException )
-{
- ::osl::Guard< osl::Mutex > aGuard( m_mutex );
-// format is script:://[function_name]?language=[languge]&location=[location]
-// LogicalName is now not used anymore, further more the ScriptURI class
-// will be retired also and a new UNO service will be used. Additionally the
-// parcel-description will also need to be modified to remove logical name
-// ScriprtMetaDataImporter has been modified to ignore the Logical name
-// definined in the parcel-desc.xml. As an interim temp solution the Datas_vec
-// structure that is returned from ScriptMetDataImporter sets the logicalname
-// to the function name. ScriptURI class has been changed in the same way.
- Sequence< Reference< storage::XScriptInfo > > results;
- ScriptURI scriptURI( queryURI );
- OSL_TRACE( "getting impl for language %s, function name: %s",
- ::rtl::OUStringToOString( scriptURI.getLanguage(),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer,
- ::rtl::OUStringToOString( scriptURI.getFunctionName(),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- ScriptData_hash::iterator h_itEnd = mh_implementations.end();
- ScriptData_hash::iterator h_it = mh_implementations.begin();
- if ( h_it == h_itEnd )
- {
- OSL_TRACE( "ScriptStorage::getImplementations: EMPTY STORAGE" );
- return results;
- }
-
- //find the implementations for the given language
- h_it = mh_implementations.find( scriptURI.getLanguage() );
-
- if ( h_it == h_itEnd )
- {
- OSL_TRACE( "ScriptStorage::getImplementations: no impls found for %s",
- ::rtl::OUStringToOString( scriptURI.getLanguage(),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- return results;
- }
-
- //find the implementations for the given language
- ScriptFunction_hash::const_iterator it_datas = h_it->second.find(
- scriptURI.getLogicalName() );
- ScriptFunction_hash::const_iterator it_datas_end = h_it->second.end();
-
- if ( it_datas == it_datas_end )
- {
- OSL_TRACE( "ScriptStorage::getImplementations: no impls found for %s",
- ::rtl::OUStringToOString( scriptURI.getFunctionName(),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- return results;
- }
-
- results.realloc( 1 );
- ScriptData scriptData = it_datas->second;
- OSL_TRACE( "ScriptStorage::getImplementations: impls found for %s",
- ::rtl::OUStringToOString( scriptData.functionname,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- Reference< storage::XScriptInfo > xScriptInfo =
- new ScriptInfo ( scriptData, m_scriptStorageID );
- results[ 0 ] = xScriptInfo;
-
- return results;
-}
-
-//*************************************************************************
-Sequence< Reference< storage::XScriptInfo > > SAL_CALL
-ScriptStorage::getAllImplementations() throw ( RuntimeException )
-{
- ::osl::Guard< osl::Mutex > aGuard( m_mutex );
- Sequence< Reference< storage::XScriptInfo > > results;
- ScriptData_hash::iterator h_itEnd = mh_implementations.end();
- ScriptData_hash::iterator h_it = mh_implementations.begin();
- if ( h_it == h_itEnd )
- {
- OSL_TRACE( "ScriptStorage::getImplementations: EMPTY STORAGE" );
- return results;
- }
-
-
- //iterate through each logical name and gather each implementation
- //for that name
- for ( sal_Int32 count = 0; h_it != h_itEnd; ++h_it )
- {
- results.realloc( h_it->second.size() + count );
- OSL_TRACE( "Adding implementations for %s",
- ::rtl::OUStringToOString( h_it->first,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- ScriptFunction_hash::const_iterator it_sfh = h_it->second.begin();
- ScriptFunction_hash::const_iterator it_sfh_end = h_it->second.end();
- OSL_TRACE( "Adding %d to sequence of impls ", h_it->second.size() );
- for ( ; it_sfh != it_sfh_end ; ++it_sfh )
- {
- Reference< storage::XScriptInfo > xScriptInfo = new ScriptInfo (
- it_sfh->second, m_scriptStorageID );
-
- results[ count++ ] = xScriptInfo;
- }
- }
- return results;
-
-}
-
-//*************************************************************************
-OUString SAL_CALL ScriptStorage::getImplementationName( )
-throw( RuntimeException )
-{
- return ss_implName;
-}
-
-//*************************************************************************
-sal_Bool SAL_CALL ScriptStorage::supportsService( const OUString& serviceName )
-throw( RuntimeException )
-{
- OUString const * pNames = ss_serviceNames.getConstArray();
- for ( sal_Int32 nPos = ss_serviceNames.getLength(); nPos--; )
- {
- if ( serviceName.equals( pNames[ nPos ] ) )
- {
- return sal_True;
- }
- }
- return sal_False;
-}
-
-//*************************************************************************
-Sequence<OUString> SAL_CALL ScriptStorage::getSupportedServiceNames( )
-throw( RuntimeException )
-{
- return ss_serviceNames;
-}
-
-} // namespace scripting_impl
-
-
-namespace scripting_runtimemgr
-{
-
-//*************************************************************************
-Reference<XInterface> SAL_CALL ss_create(
- const Reference< XComponentContext > & xCompC )
-{
- return ( cppu::OWeakObject * ) new ::scripting_impl::ScriptStorage( xCompC );
-}
-
-//*************************************************************************
-Sequence<OUString> ss_getSupportedServiceNames( )
-SAL_THROW( () )
-{
- return ::scripting_impl::ss_serviceNames;
-}
-
-//*************************************************************************
-OUString ss_getImplementationName( )
-SAL_THROW( () )
-{
- return ::scripting_impl::ss_implName;
-}
-}//end namespace
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptStorage.hxx b/scripting/source/storage/ScriptStorage.hxx
deleted file mode 100644
index cb39bbadda06..000000000000
--- a/scripting/source/storage/ScriptStorage.hxx
+++ /dev/null
@@ -1,208 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef __SCRIPTING_STORAGE_SCRIPTSTORAGE_HXX_
-#define __SCRIPTING_STORAGE_SCRIPTSTORAGE_HXX_
-
-#include <vector>
-#include <boost/unordered_map.hpp>
-
-#include <osl/mutex.hxx>
-#include <cppuhelper/implbase5.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 <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-
-#include <drafts/com/sun/star/script/framework/storage/XScriptInfoAccess.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptStorageExport.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptStorageRefresh.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptInfo.hpp>
-
-namespace scripting_impl
-{
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-//Typedefs
-//=============================================================================
-typedef ::std::vector< ScriptData > Datas_vec;
-//-----------------------------------------------------------------------------
-// function name -> ScriptData
-typedef ::boost::unordered_map < ::rtl::OUString, ScriptData, ::rtl::OUStringHash,
- ::std::equal_to< ::rtl::OUString > > ScriptFunction_hash;
-//-----------------------------------------------------------------------------
-// language -> hash of function name -> ScriptData
-typedef ::boost::unordered_map < ::rtl::OUString, ScriptFunction_hash,
- ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > >
-ScriptData_hash;
-//-----------------------------------------------------------------------------
-typedef ::boost::unordered_map < ::rtl::OUString,
-css::uno::Reference< css::xml::sax::XExtendedDocumentHandler >,
-::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > >
-ScriptOutput_hash;
-//-----------------------------------------------------------------------------
-typedef ::boost::unordered_map < ::rtl::OUString,
-::rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > >
-ScriptLanguages_hash;
-
-//=============================================================================
-
-class ScriptStorage : public
- ::cppu::WeakImplHelper5<
- css::lang::XServiceInfo,
- css::lang::XInitialization,
- dcsssf::storage::XScriptInfoAccess,
- dcsssf::storage::XScriptStorageExport,
- dcsssf::storage::XScriptStorageRefresh >
-{
-public:
- //Constructors and Destructors
- //=========================================================================
- explicit ScriptStorage(
- const css::uno::Reference< css::uno::XComponentContext > & xContext )
- throw ( css::uno::RuntimeException );
- //-------------------------------------------------------------------------
- virtual ~ScriptStorage() SAL_THROW( () );
- //=========================================================================
-
- // XServiceInfo impl
- //=========================================================================
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw ( css::uno::RuntimeException );
- //-------------------------------------------------------------------------
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString & ServiceName )
- throw ( css::uno::RuntimeException );
- //-------------------------------------------------------------------------
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw ( css::uno::RuntimeException );
- //-------------------------------------------------------------------------
- static css::uno::Sequence< ::rtl::OUString > SAL_CALL
- getSupportedServiceNames_Static();
- //=========================================================================
-
- // XInitialization impl
- //=========================================================================
- virtual void SAL_CALL
- initialize( css::uno::Sequence< css::uno::Any > const & args )
- throw ( css::uno::RuntimeException, css::uno::Exception );
- //=========================================================================
-
- //XScriptInfoAccess
- //=========================================================================
- /**
- * Get the logical names for this storage
- *
- * @return sequence < ::rtl::OUString >
- * The logical names
- */
- virtual css::uno::Sequence< ::rtl::OUString >
- SAL_CALL getScriptLogicalNames()
- throw ( css::uno::RuntimeException );
-
- //=========================================================================
- /**
- * Get the implementations for a given URI
- *
- * @param queryURI
- * The URI to get the implementations for
- *
- * @return sequence < XScriptInfo >
- * The URIs of the implementations
- */
- virtual css::uno::Sequence< css::uno::Reference< dcsssf::storage::XScriptInfo > >
- SAL_CALL getImplementations(
- const ::rtl::OUString& queryURI )
- throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException );
-
- //=========================================================================
- /**
- * Get all script implementations
- *
- *
- * @return sequence < XScriptInfo >
- * script implementations
- */
- virtual css::uno::Sequence< css::uno::Reference< dcsssf::storage::XScriptInfo > >
- SAL_CALL getAllImplementations()
- throw ( css::uno::RuntimeException );
-
- //=========================================================================
-
- /**
- * Save the scripts stored in the ScriptStorage into the corresponding
- * area (document or application)
- */
- void SAL_CALL save()
- throw ( css::uno::RuntimeException );
- //=========================================================================
-
- /**
- * Refresh the ScriptStorage from the data stored in the corresponding area
- * (document or application).
- */
- void SAL_CALL refresh()
- throw ( css::uno::RuntimeException );
- //=========================================================================
-
-private:
-
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::ucb::XSimpleFileAccess > m_xSimpleFileAccess;
- css::uno::Reference< css::lang::XMultiComponentFactory > m_xMgr;
-
- ::std::vector < ::rtl::OUString > mv_logicalNames;
- static ScriptLanguages_hash* mh_scriptLangs;
- ScriptData_hash mh_implementations;
- ScriptOutput_hash mh_parcels;
- sal_Int32 m_scriptStorageID;
- ::rtl::OUString m_stringUri;
-
- osl::Mutex m_mutex;
- bool m_bInitialised;
-
- void updateMaps( const Datas_vec & vScriptDatas );
- void writeMetadataHeader(
- css::uno::Reference < css::xml::sax::XExtendedDocumentHandler > & xExDocHandler );
- void create ()
- throw (css::uno::RuntimeException, css::uno::Exception);
- void createForFilesystem ( const ::rtl::OUString & scriptLanguage )
- throw (css::uno::RuntimeException, css::uno::Exception);
- ::rtl::OUString getFileExtension ( const ::rtl::OUString & stringUri );
-
-}; // class ScriptingStorage
-
-} // namespace scripting_impl
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptStorageManager.cxx b/scripting/source/storage/ScriptStorageManager.cxx
deleted file mode 100644
index c99ad08988e2..000000000000
--- a/scripting/source/storage/ScriptStorageManager.cxx
+++ /dev/null
@@ -1,533 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
-*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-
-#include <stdio.h>
-
-#include <cppuhelper/implementationentry.hxx>
-#include <sal/config.h>
-#include <rtl/uri.hxx>
-
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptInfoAccess.hpp>
-
-#include "ScriptStorageManager.hxx"
-#include <util/util.hxx>
-#include <util/scriptingconstants.hxx>
-#include <tools/diagnose_ex.h>
-
-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
-{
-
-static OUString s_implName(RTL_CONSTASCII_USTRINGPARAM(
- "drafts.com.sun.star.script.framework.storage.ScriptStorageManager" ));
-static OUString s_serviceName(RTL_CONSTASCII_USTRINGPARAM(
- "drafts.com.sun.star.script.framework.storage.ScriptStorageManager" ));
-static Sequence< OUString > s_serviceNames = Sequence< OUString >( &s_serviceName, 1 );
-
-
-//*************************************************************************
-// ScriptStorageManager Constructor
-ScriptStorageManager::ScriptStorageManager( const Reference<
- XComponentContext > & xContext ) SAL_THROW ( ( RuntimeException ) )
- : m_xContext( xContext, UNO_SET_THROW ), m_count( 0 ), m_securityMgr( xContext )
-{
- OSL_TRACE( "< ScriptStorageManager ctor called >\n" );
-
- m_xMgr.set( m_xContext->getServiceManager(), UNO_SET_THROW );
-
- try
- {
- // obtain the macro expander singleton to use in determining the
- // location of the application script storage
- Reference< util::XMacroExpander > xME( m_xContext->getValueByName( OUString::createFromAscii(
- "/singletons/com.sun.star.util.theMacroExpander" ) ), UNO_QUERY_THROW );
-
- OUString base(RTL_CONSTASCII_USTRINGPARAM(
- SAL_CONFIGFILE( "${$BRAND_BASE_DIR/program/bootstrap" )) );
-
- setupAppStorage( xME,
- base.concat( OUString(RTL_CONSTASCII_USTRINGPARAM("::BaseInstallation}/share")) ),
- OUSTR( "SHARE" ) );
- setupAppStorage( xME,
- base.concat( OUString(RTL_CONSTASCII_USTRINGPARAM("::UserInstallation}/user")) ),
- OUSTR( "USER" ) );
-
- }
- catch ( Exception & e )
- {
- throw RuntimeException( OUSTR( "ScriptStorageManager::ScriptStorageManager: " ).concat( e.Message ), Reference< XInterface >() );
- }
- OSL_ASSERT( m_count == 2 );
-}
-
-//*************************************************************************
-// ScriptStorageManager setupAppStorage
-void
-ScriptStorageManager::setupAppStorage(
- const Reference< util::XMacroExpander > & xME,
- const OUString & storageStr,
- const OUString & appStr)
-SAL_THROW ( ( RuntimeException ) )
-{
- try
- {
- Reference< ucb::XSimpleFileAccess > xSFA(
- m_xMgr->createInstanceWithContext(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")),
- m_xContext
- ),
- UNO_QUERY_THROW
- );
-
- setupAnyStorage( xSFA, xME->expandMacros( storageStr ), appStr );
- }
- catch ( Exception & e )
- {
- throw RuntimeException(
- OUSTR( "ScriptStorageManager::setupAppStorage: " ).concat( e.Message ),
- Reference< XInterface >() );
- }
-}
-
-//*************************************************************************
-// ScriptStorageManager setupAnyStorage
-sal_Int32
-ScriptStorageManager::setupAnyStorage(
- const Reference< ucb::XSimpleFileAccess > & xSFA,
- const OUString & storageStr,
- const OUString & origStringURI )
-SAL_THROW ( ( RuntimeException ) )
-{
- // Required for scope of fnc to protect all access read and writes to m_count
- ::osl::Guard< ::osl::Mutex > aGuard( m_mutex );
- try
- {
-
- // create a ScriptingStorage using the SimpleFileAccess, the storageID
- // (from the count), and the URL to the application's shared area
- Sequence < Any > aArgs( 3 );
- aArgs[ 0 ] <<= xSFA;
- aArgs[ 1 ] <<= m_count;
- aArgs[ 2 ] <<= storageStr;
-
- OSL_TRACE( "creating storage for: %s\n",
- ::rtl::OUStringToOString( storageStr,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- Reference< XInterface > xInterface(
- m_xMgr->createInstanceWithArgumentsAndContext(
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "drafts.com.sun.star.script.framework.storage.ScriptStorage" )),
- aArgs,
- m_xContext
- ),
- UNO_QUERY_THROW
- );
-
- // and place it in the boost::unordered_map. Increment the counter
- m_ScriptStorageMap[ m_count++ ] = xInterface;
- sal_Int32 sid = m_count - 1;
-
- // create hash of original uri i.e. file:///home/users/docs/mydoc.sxw
- // and storage id (sid) this will allow us to retrieve
- // the sid based on the url of the document.
- m_StorageIdOrigURIHash [ origStringURI ] = sid;
- OSL_TRACE( "\tcreated with ID=%d\n", m_count - 1 );
-
- }
- catch ( Exception & e )
- {
- throw RuntimeException(
- OUSTR( "ScriptStorageManager::setupAnyStorage: " ).concat(
- e.Message ), Reference< XInterface >() );
- }
-
- return m_count -1;
-}
-
-//*************************************************************************
-// ScriptStorageManager Destructor
-ScriptStorageManager::~ScriptStorageManager()
-SAL_THROW ( () )
-{
- OSL_TRACE( "< ScriptStorageManager dtor called >\n" );
-}
-
-//*************************************************************************
-// This method assumes that the XSimpleFileAccess knows it's on root URL
-// and can be used with relative URLs
-sal_Int32 SAL_CALL
-ScriptStorageManager::createScriptStorage(
- const Reference< ucb::XSimpleFileAccess >& xSFA )
-throw ( RuntimeException )
-{
- OSL_TRACE( "** ==> ScriptStorageManager in createScriptingStorage\n" );
- ENSURE_OR_THROW( xSFA.is(), "ScriptStorageManager::createScriptStorage: XSimpleFileAccess is not valid" );
-
- return setupAnyStorage( xSFA, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")) );
-}
-
-//*************************************************************************
-sal_Int32 SAL_CALL
-ScriptStorageManager::createScriptStorageWithURI(
- const Reference< ucb::XSimpleFileAccess >& xSFA, const OUString & cStringURI )
-throw ( RuntimeException )
-{
- OSL_TRACE( "** ==> ScriptStorageManager in createScriptingStorageWithURI\n" );
- ENSURE_OR_THROW( xSFA.is(), "ScriptStorageManager::createScriptStorage: XSimpleFileAccess is not valid" );
-
- // related to issue 11866
- // warning dialog gets launched when adding binding to script in doc
- // workaround issue: no functionProvider created on doc open
- // if NODIALOG tag, strip from stringURI, set boolean=true
- bool displayDialog = true;
- ::rtl::OUString dialogTag(RTL_CONSTASCII_USTRINGPARAM("NoDialog::"));
- ::rtl::OUString stringURI = cStringURI;
- if( stringURI.indexOf( dialogTag ) == 0 )
- {
- OSL_TRACE( "ScriptStorageManager::createScriptStorage: will not display security dialogs" );
- stringURI = stringURI.copy( dialogTag.getLength() );
- displayDialog = false;
- }
- sal_Int32 returnedID = getScriptStorageID(stringURI);
-
-
- // convert file:///... url to vnd... syntax
- ::rtl::OUString canonicalURI(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.pkg://"));
- canonicalURI = canonicalURI.concat( ::rtl::Uri::encode( stringURI,
- rtl_UriCharClassUricNoSlash, rtl_UriEncodeCheckEscapes,
- RTL_TEXTENCODING_ASCII_US ) );
-
- if (returnedID == -1)
- {
- OSL_TRACE("Creating new storage for %s",
- ::rtl::OUStringToOString( stringURI,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- returnedID = setupAnyStorage( xSFA, canonicalURI, stringURI );
- }
- else
- {
- OSL_TRACE("Using existing storage for %s",
- ::rtl::OUStringToOString( stringURI,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
-
- return returnedID;
-}
-
-//*************************************************************************
-Reference < XInterface > SAL_CALL
-ScriptStorageManager::getScriptStorage( sal_Int32 scriptStorageID )
-throw( RuntimeException )
-{
- OSL_TRACE( "** ==> ScriptStorageManager in getStorageInstance\n" );
- OSL_TRACE( "** ==> request for id=%d",scriptStorageID );
-
- ScriptStorage_map::const_iterator itr =
- m_ScriptStorageMap.find( scriptStorageID );
-
- if ( itr == m_ScriptStorageMap.end() )
- {
- throw RuntimeException(
- OUSTR( "ScriptStorageManager::getScriptStorage: invalid storage ID" ),
- Reference< XInterface >() );
- }
- ENSURE_OR_THROW( itr->second.is(),
- "ScriptStorageManager::getScriptStorage: Cannot get ScriptStorage from ScriptStorageHash" );
- return itr->second;
-}
-
-//*******************************************************************
-sal_Int32 SAL_CALL
-ScriptStorageManager::getScriptStorageID( const ::rtl::OUString& origURI )
- throw (::com::sun::star::uno::RuntimeException)
-{
- StorageId_hash::const_iterator it = m_StorageIdOrigURIHash.find( origURI );
-
- if ( it == m_StorageIdOrigURIHash.end() )
- {
- OUString message = OUSTR( "ScriptStorageManager::getScriptStorageID(): Cannot find storage for " );
- if ( origURI.getLength() == 0 )
- {
- message = message.concat( OUSTR("Empty URI") );
- }
- else
- {
- message = message.concat( origURI );
- }
- OSL_TRACE( ::rtl::OUStringToOString( message,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- return -1;
- }
-
- return it->second;
-}
-
-//*******************************************************************
-void
-ScriptStorageManager::removeScriptDocURIHashEntry( const OUString & origURI )
-{
- StorageId_hash::iterator it = m_StorageIdOrigURIHash.find( origURI );
- if ( it == m_StorageIdOrigURIHash.end() )
- {
- OSL_TRACE( "ScriptStorageManager::removeScriptDocURIHashEntry: no entry to remove" );
- return;
- }
-
- // remove entry for this doc url from orig uri map.
- m_StorageIdOrigURIHash.erase( it );
-}
-
-//*******************************************************************
-void SAL_CALL
-ScriptStorageManager::refreshScriptStorage( const OUString & stringURI )
-throw( RuntimeException )
-{
- OSL_TRACE( "** => ScriptStorageManager in refreshScriptStorage\n" );
- OSL_TRACE( "** => refreshing URI: %s\n",
- ::rtl::OUStringToOString(
- stringURI, RTL_TEXTENCODING_ASCII_US ).pData->buffer);
-
- sal_Int32 storageID = getScriptStorageID( stringURI );
-
- if ( storageID == -1 )
- {
- OSL_TRACE( "** id was -1, no storage");
- // Refreshing noexistent storage - just return
- return;
- }
-
- try
- {
- Reference < storage::XScriptStorageRefresh > xSSR(
- getScriptStorage( storageID ), UNO_QUERY );
-
- xSSR->refresh();
- }
- catch ( RuntimeException & e )
- {
- throw RuntimeException(
- OUSTR( "ScriptStorageManager::refreshScriptStorage: " ).concat(
- e.Message ), Reference< XInterface >() );
- }
- catch ( Exception & e )
- {
- throw RuntimeException(
- OUSTR( "ScriptStorageManager::refreshScriptStorage: " ).concat(
- e.Message ), Reference< XInterface >() );
- }
-}
-
-//*************************************************************************
-void SAL_CALL
-ScriptStorageManager::checkPermission( const OUString &
-scriptStorageURI, const OUString & permissionRequest )
-throw ( RuntimeException, lang::IllegalArgumentException, css::security::AccessControlException )
-{
- try
- {
- m_securityMgr.checkPermission( scriptStorageURI, permissionRequest );
- }
- catch ( css::security::AccessControlException & e )
- {
- throw css::security::AccessControlException(
- OUSTR( "ScriptStorageManager::checkPermission: AccessControlException: " ).concat(
- e.Message ), Reference< XInterface >(), e.LackingPermission );
- }
- catch ( lang::IllegalArgumentException & e )
- {
- throw lang::IllegalArgumentException(
- OUSTR( "ScriptStorageManager::checkPermission: IllegalArgumentException: " ).concat(
- e.Message ), Reference< XInterface >(), e.ArgumentPosition );
- }
- catch ( RuntimeException & e )
- {
- throw RuntimeException(
- OUSTR( "ScriptStorageManager::checkPermission: RuntimeException: " ).concat(
- e.Message ), Reference< XInterface >() );
- }
-}
-
-//*************************************************************************
-OUString SAL_CALL
-ScriptStorageManager::getImplementationName( )
-throw( RuntimeException )
-{
- return s_implName;
-}
-
-//*************************************************************************
-sal_Bool SAL_CALL
-ScriptStorageManager::supportsService( const OUString& serviceName )
-throw( RuntimeException )
-{
- OUString const * pNames = s_serviceNames.getConstArray();
- for ( sal_Int32 nPos = s_serviceNames.getLength(); nPos--; )
- {
- if ( serviceName.equals( pNames[ nPos ] ) )
- {
- return sal_True;
- }
- }
- return sal_False;
-}
-
-//*************************************************************************
-Sequence< OUString > SAL_CALL
-ScriptStorageManager::getSupportedServiceNames( )
-throw( RuntimeException )
-{
- return s_serviceNames;
-}
-
-//*************************************************************************
-void SAL_CALL
-ScriptStorageManager::disposing( const ::com::sun::star::lang::EventObject& Source )
-throw ( ::com::sun::star::uno::RuntimeException )
-{
- OSL_TRACE( "ScriptStorageManager::disposing started" );
- OSL_TRACE( "event object type=%s",
- ::rtl::OUStringToOString( getCppuType( &Source ).getTypeName(),
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- OUString storageURI;
- bool removeSecurityPermission = true;
- try
- {
- Reference< XInterface > xInterface = Source.Source;
- // no UNO_QUERY_THROW since we want a 2nd change to query if it's
- // not a document being disposed
- Reference< frame::XModel > xModel = Reference< frame::XModel > ( xInterface, UNO_QUERY );
- if( xModel.is() )
- {
- storageURI = xModel->getURL();
- }
- else
- {
- // UNO_QURY_THROW here since it's supposed to be either a doc
- // or a XScriptInfo (in the case of a filesys script)
- Reference< storage::XScriptInfo > xScriptInfo = Reference< storage::XScriptInfo > ( xInterface, UNO_QUERY_THROW );
- storageURI = xScriptInfo->getParcelURI().concat( xScriptInfo->getFunctionName() );
- // to save the user seeing the security dialogs every time they
- // run the script we hang on to the permission for a given script
- // for the lifetime of the Office
- removeSecurityPermission = false;
- // possibly need to encode it??
- }
- if ( storageURI.getLength() > 0 )
- {
- OSL_TRACE( "URI disposing is ... %s",
- ::rtl::OUStringToOString( storageURI,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- }
- }
- catch ( RuntimeException& e )
- {
- OUString message =
- OUSTR(
- "ScriptStorageManager::disposing: can't get script context, reason = " );
- message = message.concat( e.Message );
- OSL_TRACE( ::rtl::OUStringToOString( message,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- return;
- }
-
-
- // grab storage id.
- sal_Int32 scriptStorageID = getScriptStorageID( storageURI );
-
- // no need to do anything if there's no doc storage
- if( scriptStorageID == -1 )
- {
- return;
- }
-
- OSL_TRACE( "disposing storageID = %d", scriptStorageID );
-
- // attempt to get the storage from the hash to ensure that we have a
- // valid storageID
- ScriptStorage_map::const_iterator itr =
- m_ScriptStorageMap.find( scriptStorageID );
-
- if ( itr == m_ScriptStorageMap.end() )
- {
- OSL_TRACE( "Entry for storage id %d doesn't exist in map", scriptStorageID );
- return;
- }
-
- // erase the entry from the hash
- m_ScriptStorageMap.erase( scriptStorageID );
- removeScriptDocURIHashEntry( storageURI );
- if ( removeSecurityPermission )
- {
- m_securityMgr.removePermissionSettings ( storageURI );
- }
-}
-} // Namespace
-
-namespace scripting_runtimemgr
-{
-//*************************************************************************
-Reference< XInterface > SAL_CALL
-ssm_create(
- const Reference< XComponentContext > & xCompC )
-{
- return ( cppu::OWeakObject * ) new ::scripting_impl::ScriptStorageManager( xCompC );
-}
-
-//*************************************************************************
-Sequence< OUString >
-ssm_getSupportedServiceNames( )
-SAL_THROW( () )
-{
- return ::scripting_impl::s_serviceNames;
-}
-
-//*************************************************************************
-OUString
-ssm_getImplementationName( )
-SAL_THROW( () )
-{
- return ::scripting_impl::s_implName;
-}
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptStorageManager.hxx b/scripting/source/storage/ScriptStorageManager.hxx
deleted file mode 100644
index c5456a58a7eb..000000000000
--- a/scripting/source/storage/ScriptStorageManager.hxx
+++ /dev/null
@@ -1,228 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGE_SCRIPTSTORAGEMANAGER_HXX_
-#define _DRAFTS_COM_SUN_STAR_SCRIPT_FRAMEWORK_STORAGE_SCRIPTSTORAGEMANAGER_HXX_
-
-#include <boost/unordered_map.hpp>
-#include <map>
-
-#include <osl/mutex.hxx>
-#include <cppuhelper/implbase4.hxx>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/security/AccessControlException.hpp>
-#include <com/sun/star/uno/RuntimeException.hpp>
-
-#include <drafts/com/sun/star/script/framework/storage/XScriptStorageManager.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptStorageRefresh.hpp>
-#include <drafts/com/sun/star/script/framework/storage/XScriptInfo.hpp>
-#include <drafts/com/sun/star/script/framework/security/XScriptSecurity.hpp>
-#include "ScriptSecurityManager.hxx"
-
-
-namespace scripting_impl
-{
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-// Define a map used to store the ScriptingStorages key;d by ID
-typedef ::std::map < sal_Int32, css::uno::Reference < css::uno::XInterface > >
- ScriptStorage_map;
-
-typedef ::boost::unordered_map < ::rtl::OUString, sal_Int32, ::rtl::OUStringHash>
- StorageId_hash;
-
-class ScriptStorageManager : public
- ::cppu::WeakImplHelper4 < dcsssf::storage::XScriptStorageManager,
- dcsssf::security::XScriptSecurity, css::lang::XServiceInfo,
- css::lang::XEventListener >
-{
-public:
- explicit ScriptStorageManager(
- const css::uno::Reference< css::uno::XComponentContext > & xContext )
- SAL_THROW ( ( css::uno::RuntimeException ) );
-
-
- ~ScriptStorageManager() SAL_THROW ( () );
-
- // XServiceInfo implementation
- //======================================================================
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw( css::uno::RuntimeException );
- //----------------------------------------------------------------------
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw( css::uno::RuntimeException );
- //----------------------------------------------------------------------
- virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw( css::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_Int32 SAL_CALL createScriptStorage(
- const css::uno::Reference< css::ucb::XSimpleFileAccess > & xSFA )
- throw ( css::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_Int32 SAL_CALL
- createScriptStorageWithURI(
- const css::uno::Reference< css::ucb::XSimpleFileAccess >& xSFA,
- const ::rtl::OUString& stringURI )
- throw ( css::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 css::uno::Reference< css::uno::XInterface > SAL_CALL getScriptStorage(
- sal_Int32 scriptStorageID )
- throw ( css::uno::RuntimeException );
-
- /**
- get a ScriptStorage ID using storage URI
-
- @param scriptStorageURI
- the file URL for the document will retrieve storage id for the document, special treatment is reserved for the strings "USER"and "SHARE" which
- retrieve storage id for application/user application/share areas respectively.
-
-
- @returns as long ScriptStorage ID (-1 if no storage exists), which can be used in getScriptStorage method.
-
- */
-
- virtual sal_Int32 SAL_CALL getScriptStorageID( const ::rtl::OUString& scriptStorageURI )
- throw (::com::sun::star::uno::RuntimeException);
-
- /**
- refresh a storage component using its URI
-
- @param StringURI
- URI of storage area, for documents, url to document eg, file:///home/user/ADocument.sxw To refresh the storage for user or share area, use USER or SHARE respectively instead or a url.
-
- */
-
- virtual void SAL_CALL refreshScriptStorage(const ::rtl::OUString & stringURI)
- throw ( css::uno::RuntimeException );
- //======================================================================
-
- //XScriptSecurity
- //======================================================================
- //----------------------------------------------------------------------
- /**
- the language independent interface for invocation
-
- @param scriptURI
- a string containing the script URI
-
- @returns
- the value returned from the function being invoked
-
- @throws IllegalArgumentException
- if there is no matching script name
-
- */
- virtual void SAL_CALL ScriptStorageManager::checkPermission(
- const rtl::OUString & scriptStorageURI,
- const rtl::OUString & permissionRequest )
- throw ( css::uno::RuntimeException, css::lang::IllegalArgumentException,
- css::security::AccessControlException );
- //======================================================================
-
- //XEventListener
- //======================================================================
-
- virtual void SAL_CALL disposing( const css::lang::EventObject& Source )
- throw ( css::uno::RuntimeException );
-
-private:
- ScriptStorageManager( const ScriptStorageManager & );
- ScriptStorageManager& operator= ( const ScriptStorageManager & );
-
- void removeScriptDocURIHashEntry( const ::rtl::OUString & origURI );
-
- // to obtain other services if needed
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::lang::XMultiComponentFactory > m_xMgr;
- ::osl::Mutex m_mutex;
- ScriptStorage_map m_ScriptStorageMap;
- StorageId_hash m_StorageIdOrigURIHash;
- sal_Int32 m_count;
- scripting_securitymgr::ScriptSecurityManager m_securityMgr;
-
- void setupAppStorage( const css::uno::Reference< css::util::XMacroExpander > & xME,
- const ::rtl::OUString & storageStr,
- const ::rtl::OUString & appStr)
- SAL_THROW ( ( css::uno::RuntimeException ) );
-
- sal_Int32 setupAnyStorage(
- const css::uno::Reference< css::ucb::XSimpleFileAccess> & xSFA,
- const ::rtl::OUString & storageStr,
- const ::rtl::OUString & origStringURI )
- SAL_THROW ( ( css::uno::RuntimeException ) );
-
-};
-} // scripting_impl
-
-#endif //_COM_SUN_STAR_SCRIPTING_STORAGE_SCRIPTSTORAGEMANAGER_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptURI.cxx b/scripting/source/storage/ScriptURI.cxx
deleted file mode 100644
index 72e91f32c549..000000000000
--- a/scripting/source/storage/ScriptURI.cxx
+++ /dev/null
@@ -1,229 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-#include <osl/diagnose.h>
-#include <osl/file.h>
-
-#ifdef _DEBUG
-#include <stdio.h>
-#endif
-
-//Local headers
-#include "ScriptURI.hxx"
-#include <util/util.hxx>
-
-using namespace ::rtl;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-
-
-namespace scripting_impl {
-
-static const OUString schema(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script://"));
-
-/**
- * Constructor
- *
- * @param scriptURI the string script URI
- */
-ScriptURI::ScriptURI( const ::rtl::OUString& scriptURI )
- throw ( IllegalArgumentException ) : m_uri( scriptURI )
-{
- OSL_TRACE( "received uri: %s\n",::rtl::OUStringToOString( m_uri, RTL_TEXTENCODING_ASCII_US).pData->buffer );
- set_values( parseIt() );
- if( !isValid() )
- {
- OSL_TRACE( "ScriptURI ctor: throwing IllegalArgException" );
- throw IllegalArgumentException(
- OUSTR( "Failed to parse invalid URI: " ).concat( scriptURI ),
- Reference < XInterface > (), 1 );
- }
-}
-
-/**
- * Destuctor
- *
- */
-// dtor should never throw exceptions, so ensure this by specifying it
-ScriptURI::~ScriptURI() SAL_THROW( () )
-{
- OSL_TRACE( "< ScriptURI dtor called >\n" );
-}
-
-/**
- * This function is used to determine if this object represents a valid URI
- *
- */
-bool ScriptURI::isValid( ) {
- return ( m_valid == sal_True );
-}
-
-/**
- * This function returns the location of the script
- *
- */
-::rtl::OUString ScriptURI::getLocation( )
-{
- return m_location;
-}
-
-/**
- * This function returns the language of the script, eg. java, StarBasic,...
- *
- */
-::rtl::OUString ScriptURI::getLanguage( )
-{
- return m_language;
-}
-
-/**
- * This function returns the language dependent function name of the script
- *
- */
-::rtl::OUString ScriptURI::getFunctionName( )
-{
- return m_functionName;
-}
-
-/**
- * This function returns the language independent logical name of the script
- *
- */
-::rtl::OUString ScriptURI::getLogicalName( )
-{
- return m_logicalName;
-}
-
-/**
- * This function returns the full URI
- *
- */
-::rtl::OUString ScriptURI::getURI( )
-{
- return m_uri;
-}
-
-//Private mutex guarded method for setting the members
-void ScriptURI::set_values( scripting_impl::Uri values )
-{
- osl::Guard< ::osl::Mutex > aGuard( m_mutex );
- m_valid = values.valid;
- m_location = values.location;
- m_language = values.language;
-// format is vnd.sun.star.script://[function_name]?language=[languge]&location=[location]
-// LogicalName is now not used anymore, further more the ScriptURI class
-// will be retired also and a new UNO service will be used. Additionally the
-// parcel-description will also need to be modified to remove logical name
-// In order to temporarly support the existing code functionname is
-// set to the logica name parsed by this class. So getLogicalName() and
-// getFunctionName() return identical string.
-
- m_functionName = values.logicalName;
- m_logicalName = values.logicalName;
-
-}
-/**
- * This is a private method used for parsing the URI received by the
- * initialization.
- *
- */
-// rather naive parsing?
-Uri ScriptURI::parseIt()
-{
- sal_Int32 schemaLen = schema.getLength();
- scripting_impl::Uri results;
- results.valid = sal_True;
- //attempt to parse
- // check that it starts vnd.sun.star.script
- // better check for OBO errors here
- if( m_uri.indexOf( schema ) != 0 )
- {
- OSL_TRACE( "wrong schema" );
- results.valid=sal_False;
- return results;
- }
-
- // substr from here to the '?' and set the logical name
- sal_Int32 len = m_uri.indexOf( '?' );
- if( len == -1 )
- {
- // no queries so just set the logical name
- results.logicalName = m_uri.copy( schemaLen );
- return results;
- }
- results.logicalName = m_uri.copy( schemaLen, len-schemaLen );
- OSL_TRACE( "log name: %s\n", ::rtl::OUStringToOString( results.logicalName,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- len++;
- // now get the attributes
- OUString attr;
- do
- {
- attr = m_uri.getToken( 0, '&', len );
- OSL_TRACE( "chunk: %s\n", ::rtl::OUStringToOString( attr,
- RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-
- if( attr.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "language" ) )
- == sal_True )
- {
- sal_Int32 len2 = attr.indexOf('=');
- results.language = attr.copy( len2 + 1 );
- continue;
- }
- else if ( attr.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "location" ) )
- == sal_True )
- {
- sal_Int32 len2 = attr.indexOf( '=' );
- results.location = attr.copy( len2 + 1 );
- continue;
- }
- else if ( attr.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "function" ) )
- == sal_True )
- {
- sal_Int32 len2 = attr.indexOf( '=' );
- results.functionName = attr.copy( len2 + 1 );
- continue;
- }
- else
- {
- OSL_TRACE( "Unknown attribute?\n" );
- }
- }
- while ( len >= 0 );
-
- // parse is good
- return results;
-}
-
-} // namespace script_uri
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/ScriptURI.hxx b/scripting/source/storage/ScriptURI.hxx
deleted file mode 100644
index 24de44a00597..000000000000
--- a/scripting/source/storage/ScriptURI.hxx
+++ /dev/null
@@ -1,123 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __FRAMEWORK_STORAGE_SCRIPTURI_HXX_
-#define __FRAMEWORK_STORAGE_SCRIPTURI_HXX_
-
-#include <osl/mutex.hxx>
-#include <rtl/ustring>
-
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-
-namespace scripting_impl {
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-struct Uri {
- bool valid;
- ::rtl::OUString uri;
- ::rtl::OUString location;
- ::rtl::OUString language;
- ::rtl::OUString functionName;
- ::rtl::OUString logicalName;
-};
-/**
- * Helper class for dealing with script URIs.
- */
-class ScriptURI
-{
-public:
- ScriptURI( const ::rtl::OUString& scriptURI )
- throw ( css::lang::IllegalArgumentException );
- virtual ~ScriptURI() SAL_THROW ( () );
-
- /**
- * This function returns the location of the script
- *
- */
- virtual ::rtl::OUString getLocation();
-
- /**
- * This function returns the language of the script, eg. java,
- * StarBasic,...
- *
- */
- virtual ::rtl::OUString getLanguage();
-
- /**
- * This function returns the language dependent function name of
- * the script
- */
- virtual ::rtl::OUString getFunctionName();
-
- /**
- * This function returns the language independent logical name of
- * the script
- */
- virtual ::rtl::OUString getLogicalName();
-
- /**
- * This function returns the full URI
- *
- */
- virtual ::rtl::OUString getURI();
-
-private:
- ::osl::Mutex m_mutex;
-
- /** @internal */
- sal_Bool m_valid;
-
- //the private strings
- /** the string representation of the this objects URI */
- ::rtl::OUString m_uri;
- /** the location of the script referred to by this URI */
- ::rtl::OUString m_location;
- /** the language of the script referred to by this URI */
- ::rtl::OUString m_language;
- /** the language dependent function name of the script referred to by this URI */
- ::rtl::OUString m_functionName;
- /** the language independent logical name of the script referred to by this URI */
- ::rtl::OUString m_logicalName;
-
- //attempt to parse the URI provided
- /** @internal */
- Uri parseIt();
- //set the members
- /** @internal */
- void set_values( Uri );
- bool isValid();
-}
-; // class ScriptURI
-
-} //namespace script_uri
-
-#endif // define __FRAMEWORK_STORAGE_SCRIPTURI_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/XMLElement.cxx b/scripting/source/storage/XMLElement.cxx
deleted file mode 100644
index b80efd4b2ad5..000000000000
--- a/scripting/source/storage/XMLElement.cxx
+++ /dev/null
@@ -1,174 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_scripting.hxx"
-#include "XMLElement.hxx"
-#include <osl/diagnose.h>
-
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-
-using ::rtl::OUString;
-using ::rtl::OUStringToOString;
-
-namespace scripting_impl
-{
-
-//*************************************************************************
-void XMLElement::addAttribute( OUString const & rAttrName, OUString const & rValue )
-SAL_THROW( () )
-{
- OSL_TRACE( "XMLElement::addAttribute\n" );
-
- _attrNames.push_back( rAttrName );
- _attrValues.push_back( rValue );
-}
-
-//*************************************************************************
-void XMLElement::addSubElement( Reference< xml::sax::XAttributeList > const & xElem )
-SAL_THROW( () )
-{
- OSL_TRACE( "XMLElement::addSubElement\n" );
-
- _subElems.push_back( xElem );
-}
-
-//*************************************************************************
-Reference< xml::sax::XAttributeList > XMLElement::getSubElement( sal_Int32 nIndex )
-SAL_THROW( () )
-{
- OSL_TRACE( "XMLElement::getSubElement\n" );
-
- return _subElems[ ( size_t )nIndex ];
-}
-
-//*************************************************************************
-void XMLElement::dumpSubElements( Reference< xml::sax::XExtendedDocumentHandler > const & xOut )
-{
- OSL_TRACE( "+++++ XMLElement::dumpSubElement\n" );
-
- for ( size_t nPos = 0; nPos < _subElems.size(); ++nPos )
- {
- XMLElement * pElem = static_cast< XMLElement * >( _subElems[ nPos ].get() );
- pElem->dump( xOut );
- }
-}
-
-//*************************************************************************
-void XMLElement::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOut )
-{
- OSL_TRACE( "XMLElement::dump" );
-
- xOut->ignorableWhitespace( OUString() );
- OSL_TRACE( "XMLElement::dump starting %s",::rtl::OUStringToOString(
- _name, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- xOut->startElement( _name, static_cast< xml::sax::XAttributeList * >( this ) );
- // Write out CDATA
- if( _chars.getLength() > 0 )
- {
- xOut->ignorableWhitespace( OUString() );
- xOut->characters( _chars );
- }
- // write sub elements
- dumpSubElements( xOut );
- xOut->ignorableWhitespace( OUString() );
- xOut->endElement( _name );
- OSL_TRACE( "XMLElement::dump ending %s",::rtl::OUStringToOString(
- _name, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
-}
-
-//*************************************************************************
-// XAttributeList
-sal_Int16 XMLElement::getLength()
-throw ( RuntimeException )
-{
- OSL_TRACE( "XMLElement::getLength\n" );
-
- return _attrNames.size();
-}
-
-//*************************************************************************
-OUString XMLElement::getNameByIndex( sal_Int16 nPos )
-throw ( RuntimeException )
-{
- OSL_TRACE( "XMLElement::getNameByIndex\n" );
- OSL_ASSERT( ( size_t )nPos < _attrNames.size() );
-
- return _attrNames[ nPos ];
-}
-
-//*************************************************************************
-OUString XMLElement::getTypeByIndex( sal_Int16 nPos )
-throw ( RuntimeException )
-{
- OSL_TRACE( "XMLElement::getTypeByIndex\n" );
- OSL_ASSERT( (size_t)nPos < _attrNames.size() );
-
- // xxx todo
- return OUString();
-}
-
-//*************************************************************************
-OUString XMLElement::getTypeByName( OUString const & rName )
-throw ( RuntimeException )
-{
- OSL_TRACE( "XMLElement::getTypeByName\n" );
- // xxx todo
- return OUString();
-}
-
-//*************************************************************************
-OUString XMLElement::getValueByIndex( sal_Int16 nPos )
-throw ( RuntimeException )
-{
- OSL_TRACE( "XMLElement::getValueByIndex\n" );
- OSL_ASSERT( ( size_t )nPos < _attrNames.size() );
-
- return _attrValues[ nPos ];
-}
-
-//*************************************************************************
-OUString XMLElement::getValueByName( OUString const & rName )
-throw ( RuntimeException )
-{
- OSL_TRACE( "XMLElement::getValueByName\n" );
-
- for ( size_t nPos = 0; nPos < _attrNames.size(); ++nPos )
- {
- if (_attrNames[ nPos ] == rName)
- {
- return _attrValues[ nPos ];
- }
- }
- return OUString();
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/XMLElement.hxx b/scripting/source/storage/XMLElement.hxx
deleted file mode 100644
index aae705d9b2ea..000000000000
--- a/scripting/source/storage/XMLElement.hxx
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _SCRIPTING_XML_ELEMENT_HXX_
-#define _SCRIPTING_XML_ELEMENT_HXX_
-
-#include <vector>
-
-#include <cppuhelper/implbase1.hxx>
-
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-
-namespace scripting_impl
-{
-// for simplification
-#define css ::com::sun::star
-#define dcsssf ::drafts::com::sun::star::script::framework
-
-/*##################################################################################################
-
- EXPORTING
-
-##################################################################################################*/
-
-//==================================================================================================
-class XMLElement : public ::cppu::WeakImplHelper1< css::xml::sax::XAttributeList >
-{
-public:
- inline XMLElement( ::rtl::OUString const & name, ::rtl::OUString const & chars )
- SAL_THROW( () )
- : _name( name ), _chars( chars )
- {
- }
-
- inline XMLElement( ::rtl::OUString const & name )
- SAL_THROW( () )
- : _name( name )
- {
- }
-
- /** Adds a sub element of element.
-
- @param xElem element reference
- */
- void SAL_CALL addSubElement(
- css::uno::Reference< css::xml::sax::XAttributeList > const & xElem )
- SAL_THROW( () );
-
- /** Gets sub element of given index. The index follows order in which sub elements were added.
-
- @param nIndex index of sub element
- */
- css::uno::Reference< css::xml::sax::XAttributeList > SAL_CALL getSubElement(
- sal_Int32 nIndex )
- SAL_THROW( () );
-
- /** Adds an attribute to elements.
-
- @param rAttrName qname of attribute
- @param rValue value string of element
- */
- void SAL_CALL addAttribute( ::rtl::OUString const & rAttrName,
- ::rtl::OUString const & rValue )
- SAL_THROW( () );
-
- /** Gets the tag name (qname) of element.
-
- @return
- qname of element
- */
- inline ::rtl::OUString SAL_CALL getName() SAL_THROW( () )
- {
- return _name;
- }
-
- /** Dumps out element (and all sub elements).
-
- @param xOut document handler to be written to
- */
- void SAL_CALL dump(
- css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > const & xOut );
- /** Dumps out sub elements (and all further sub elements).
-
- @param xOut document handler to be written to
- */
- void SAL_CALL dumpSubElements(
- css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > const & xOut );
-
- // XAttributeList
- virtual sal_Int16 SAL_CALL getLength()
- throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getNameByIndex( sal_Int16 nPos )
- throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getTypeByIndex( sal_Int16 nPos )
- throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getTypeByName( ::rtl::OUString const & rName )
- throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getValueByIndex( sal_Int16 nPos )
- throw ( css::uno::RuntimeException );
- virtual ::rtl::OUString SAL_CALL getValueByName( ::rtl::OUString const & rName )
- throw ( css::uno::RuntimeException );
-
-protected:
- ::rtl::OUString _name;
-
- ::rtl::OUString _chars;
-
- ::std::vector< ::rtl::OUString > _attrNames;
- ::std::vector< ::rtl::OUString > _attrValues;
-
- ::std::vector< css::uno::Reference<
- css::xml::sax::XAttributeList > > _subElems;
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/scripting/source/storage/exports.dxp b/scripting/source/storage/exports.dxp
deleted file mode 100755
index f0e1c69934bc..000000000000
--- a/scripting/source/storage/exports.dxp
+++ /dev/null
@@ -1,2 +0,0 @@
-component_getImplementationEnvironment
-component_getFactory
diff --git a/scripting/source/storage/makefile.mk b/scripting/source/storage/makefile.mk
deleted file mode 100755
index 7ba35edf0692..000000000000
--- a/scripting/source/storage/makefile.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org 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 version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..
-
-PRJNAME= scripting
-TARGET= storage
-USE_DEFFILE= TRUE
-ENABLE_EXCEPTIONS=TRUE
-COMP1TYPELIST=$(TARGET)
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-# ------------------------------------------------------------------
-
-SLOFILES=\
- $(SLO)$/ScriptURI.obj\
- $(SLO)$/ScriptStorage.obj\
- $(SLO)$/ScriptInfo.obj\
- $(SLO)$/ScriptMetadataImporter.obj\
- $(SLO)$/ScriptElement.obj\
- $(SLO)$/XMLElement.obj\
- $(SLO)$/ScriptStorageManager.obj\
- $(SLO)$/ScriptSecurityManager.obj\
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
diff --git a/scripting/source/storage/storage.xml b/scripting/source/storage/storage.xml
deleted file mode 100755
index 6438dc7006b2..000000000000
--- a/scripting/source/storage/storage.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?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>storage</module-name>
- <component-description>
- <author></author>
- <name>drafts.com.sun.star.script.framework.storage.ScriptStorage</name>
- <description></description>
- <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
- <language>c++</language>
- <status value="draft"/>
- <supported-service>drafts.com.sun.star.script.framework.storage.ScriptingStorage</supported-service>
- <type>com.sun.star.beans.XPropertySet</type>
- <type>com.sun.star.beans.XPropertyContainer</type>
- <type>com.sun.star.uno.Exception</type>
- <type>com.sun.star.uno.XComponentContext</type>
- <type>com.sun.star.uno.XWeak</type>
- <type>com.sun.star.io.IOException</type>
- <type>com.sun.star.io.XStream</type>
- <type>com.sun.star.io.XOutputStream</type>
- <type>com.sun.star.registry.XRegistryKey</type>
- <type>drafts.com.sun.star.script.framework.storage.XScriptInfo</type>
- <type>drafts.com.sun.star.script.framework.storage.XScriptInfoAccess</type>
- <type>drafts.com.sun.star.script.framework.security.XScriptSecurity</type>
- <type>drafts.com.sun.star.script.framework.storage.XScriptStorageExport</type>
- <type>drafts.com.sun.star.script.framework.storage.XScriptStorageRefresh</type>
- <type>com.sun.star.lang.XInitialization</type>
- <type>drafts.com.sun.star.script.framework.storage.XScriptStorageManager</type>
- <type>com.sun.star.xml.sax.XExtendedDocumentHandler</type>
- <type>com.sun.star.xml.sax.XParser</type>
- <type>com.sun.star.io.XInputStream</type>
- <type>com.sun.star.ucb.XSimpleFileAccess2</type>
- <type>com.sun.star.xml.sax.SAXException</type>
- <type>com.sun.star.xml.sax.XAttributeList</type>
- <type>com.sun.star.io.XActiveDataSource</type>
- <type>com.sun.star.security.AccessControlException</type>
- <type>com.sun.star.security.RuntimePermission</type>
- <type>com.sun.star.lang.IllegalArgumentException</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>
- <runtime-module-dependency>ucb</runtime-module-dependency>
-</module-description>