2006-11-08 10:53:37 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 10:59:37 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2006-11-08 10:53:37 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2006-11-08 10:53:37 +00:00
|
|
|
*
|
2008-04-11 10:59:37 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2006-11-08 10:53:37 +00:00
|
|
|
*
|
2008-04-11 10:59:37 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2006-11-08 10:53:37 +00:00
|
|
|
*
|
2008-04-11 10:59:37 +00:00
|
|
|
* 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.
|
2006-11-08 10:53:37 +00:00
|
|
|
*
|
2008-04-11 10:59:37 +00:00
|
|
|
* 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).
|
2006-11-08 10:53:37 +00:00
|
|
|
*
|
2008-04-11 10:59:37 +00:00
|
|
|
* 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.
|
2006-11-08 10:53:37 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef BASIC_SCRIPTCONTAINER_HXX
|
|
|
|
#define BASIC_SCRIPTCONTAINER_HXX
|
|
|
|
|
|
|
|
#include "namecont.hxx"
|
2007-06-27 13:23:39 +00:00
|
|
|
#include <basic/basmgr.hxx>
|
2006-11-08 10:53:37 +00:00
|
|
|
|
|
|
|
class BasicManager;
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
namespace basic
|
|
|
|
{
|
|
|
|
|
|
|
|
class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword
|
|
|
|
{
|
|
|
|
::rtl::OUString maScriptLanguage;
|
|
|
|
|
|
|
|
// Methods to distinguish between deffirent library types
|
2007-01-02 14:40:51 +00:00
|
|
|
virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName );
|
2006-11-08 10:53:37 +00:00
|
|
|
virtual SfxLibrary* SAL_CALL implCreateLibraryLink
|
2007-01-02 14:40:51 +00:00
|
|
|
( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
|
2006-11-08 10:53:37 +00:00
|
|
|
const ::rtl::OUString& StorageURL, sal_Bool ReadOnly );
|
|
|
|
virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void );
|
2008-06-06 12:29:08 +00:00
|
|
|
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
|
2006-11-08 10:53:37 +00:00
|
|
|
virtual void SAL_CALL writeLibraryElement
|
|
|
|
(
|
|
|
|
::com::sun::star::uno::Any aElement,
|
|
|
|
const ::rtl::OUString& aElementName,
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput
|
|
|
|
)
|
|
|
|
throw(::com::sun::star::uno::Exception);
|
|
|
|
|
|
|
|
virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
|
|
|
|
( const ::rtl::OUString& aFile,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream );
|
|
|
|
|
|
|
|
virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile );
|
|
|
|
|
|
|
|
virtual SfxLibraryContainer* createInstanceImpl( void );
|
|
|
|
|
|
|
|
|
|
|
|
// Password encryption
|
|
|
|
virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
|
2007-01-29 14:06:08 +00:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage>& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
|
2006-11-08 10:53:37 +00:00
|
|
|
|
|
|
|
// New variant for library export
|
|
|
|
virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
|
|
|
|
const ::rtl::OUString& aTargetURL,
|
2007-01-29 14:06:08 +00:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
|
2006-11-08 10:53:37 +00:00
|
|
|
|
|
|
|
virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& Name,
|
|
|
|
sal_Bool bVerifyPasswordOnly=false )
|
|
|
|
throw(::com::sun::star::lang::WrappedTargetException,
|
|
|
|
::com::sun::star::uno::RuntimeException);
|
|
|
|
|
2008-03-06 17:53:12 +00:00
|
|
|
virtual void onNewRootStorage();
|
2007-01-02 14:40:51 +00:00
|
|
|
|
|
|
|
|
2006-11-08 10:53:37 +00:00
|
|
|
// OldBasicPassword interface
|
|
|
|
virtual void setLibraryPassword( const String& rLibraryName, const String& rPassword );
|
|
|
|
virtual String getLibraryPassword( const String& rLibraryName );
|
|
|
|
virtual void clearLibraryPassword( const String& rLibraryName );
|
|
|
|
virtual sal_Bool hasLibraryPassword( const String& rLibraryName );
|
|
|
|
|
2007-03-15 14:38:46 +00:00
|
|
|
virtual const sal_Char* SAL_CALL getInfoFileName() const;
|
|
|
|
virtual const sal_Char* SAL_CALL getOldInfoFileName() const;
|
|
|
|
virtual const sal_Char* SAL_CALL getLibElementFileExtension() const;
|
|
|
|
virtual const sal_Char* SAL_CALL getLibrariesDir() const;
|
2006-11-08 10:53:37 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
SfxScriptLibraryContainer( void );
|
2007-03-15 14:38:46 +00:00
|
|
|
SfxScriptLibraryContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
|
2006-11-08 10:53:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Methods XLibraryContainerPassword
|
|
|
|
virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name )
|
|
|
|
throw (::com::sun::star::container::NoSuchElementException,
|
|
|
|
::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name )
|
|
|
|
throw (::com::sun::star::lang::IllegalArgumentException,
|
|
|
|
::com::sun::star::container::NoSuchElementException,
|
|
|
|
::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password )
|
|
|
|
throw (::com::sun::star::lang::IllegalArgumentException,
|
|
|
|
::com::sun::star::container::NoSuchElementException,
|
|
|
|
::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name,
|
|
|
|
const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword )
|
|
|
|
throw (::com::sun::star::lang::IllegalArgumentException,
|
|
|
|
::com::sun::star::container::NoSuchElementException,
|
|
|
|
::com::sun::star::uno::RuntimeException);
|
|
|
|
|
2007-03-15 14:38:46 +00:00
|
|
|
// Methods XServiceInfo
|
|
|
|
virtual ::rtl::OUString SAL_CALL getImplementationName( )
|
|
|
|
throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
|
|
|
|
throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
2006-11-08 10:53:37 +00:00
|
|
|
// Service
|
|
|
|
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
|
|
|
|
static ::rtl::OUString getImplementationName_static();
|
|
|
|
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create
|
|
|
|
( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xServiceManager )
|
|
|
|
throw( ::com::sun::star::uno::Exception );
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
class SfxScriptLibrary : public SfxLibrary
|
|
|
|
{
|
|
|
|
friend class SfxScriptLibraryContainer;
|
|
|
|
|
|
|
|
sal_Bool mbLoadedSource;
|
|
|
|
sal_Bool mbLoadedBinary;
|
|
|
|
|
2007-01-02 14:40:51 +00:00
|
|
|
// Provide modify state including resources
|
|
|
|
virtual sal_Bool isModified( void );
|
|
|
|
virtual void storeResources( void );
|
|
|
|
virtual void storeResourcesAsURL( const ::rtl::OUString& URL, const ::rtl::OUString& NewName );
|
|
|
|
virtual void storeResourcesToURL( const ::rtl::OUString& URL,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
|
|
|
|
virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
|
|
|
|
< ::com::sun::star::embed::XStorage >& xStorage );
|
|
|
|
|
2006-11-08 10:53:37 +00:00
|
|
|
public:
|
|
|
|
SfxScriptLibrary
|
|
|
|
(
|
2007-03-15 14:38:46 +00:00
|
|
|
ModifiableHelper& _rModifiable,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI
|
2006-11-08 10:53:37 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
SfxScriptLibrary
|
|
|
|
(
|
2007-03-15 14:38:46 +00:00
|
|
|
ModifiableHelper& _rModifiable,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
|
2006-11-08 10:53:37 +00:00
|
|
|
const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly
|
|
|
|
);
|
2008-06-06 12:29:08 +00:00
|
|
|
|
|
|
|
static bool containsValidModule( const ::com::sun::star::uno::Any& _rElement );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
|
2006-11-08 10:53:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace base
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|