merge the formfield patch from ooo-build
[ooovba.git] / basic / source / inc / scriptcont.hxx
blobe9b440937fe9e7c8c368364be722a68d8c391355
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scriptcont.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef BASIC_SCRIPTCONTAINER_HXX
32 #define BASIC_SCRIPTCONTAINER_HXX
34 #include "namecont.hxx"
35 #include <basic/basmgr.hxx>
37 class BasicManager;
39 //============================================================================
41 namespace basic
44 class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword
46 ::rtl::OUString maScriptLanguage;
48 // Methods to distinguish between deffirent library types
49 virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName );
50 virtual SfxLibrary* SAL_CALL implCreateLibraryLink
51 ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
52 const ::rtl::OUString& StorageURL, sal_Bool ReadOnly );
53 virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void );
54 virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
55 virtual void SAL_CALL writeLibraryElement
57 ::com::sun::star::uno::Any aElement,
58 const ::rtl::OUString& aElementName,
59 ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutput
61 throw(::com::sun::star::uno::Exception);
63 virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
64 ( const ::rtl::OUString& aFile,
65 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream );
67 virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile );
69 virtual SfxLibraryContainer* createInstanceImpl( void );
72 // Password encryption
73 virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
74 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage>& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
76 // New variant for library export
77 virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
78 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
79 const ::rtl::OUString& aTargetURL,
80 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
82 virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& Name,
83 sal_Bool bVerifyPasswordOnly=false )
84 throw(::com::sun::star::lang::WrappedTargetException,
85 ::com::sun::star::uno::RuntimeException);
87 virtual void onNewRootStorage();
90 // OldBasicPassword interface
91 virtual void setLibraryPassword( const String& rLibraryName, const String& rPassword );
92 virtual String getLibraryPassword( const String& rLibraryName );
93 virtual void clearLibraryPassword( const String& rLibraryName );
94 virtual sal_Bool hasLibraryPassword( const String& rLibraryName );
96 virtual const sal_Char* SAL_CALL getInfoFileName() const;
97 virtual const sal_Char* SAL_CALL getOldInfoFileName() const;
98 virtual const sal_Char* SAL_CALL getLibElementFileExtension() const;
99 virtual const sal_Char* SAL_CALL getLibrariesDir() const;
101 public:
102 SfxScriptLibraryContainer( void );
103 SfxScriptLibraryContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
106 // Methods XLibraryContainerPassword
107 virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name )
108 throw (::com::sun::star::container::NoSuchElementException,
109 ::com::sun::star::uno::RuntimeException);
110 virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name )
111 throw (::com::sun::star::lang::IllegalArgumentException,
112 ::com::sun::star::container::NoSuchElementException,
113 ::com::sun::star::uno::RuntimeException);
114 virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password )
115 throw (::com::sun::star::lang::IllegalArgumentException,
116 ::com::sun::star::container::NoSuchElementException,
117 ::com::sun::star::uno::RuntimeException);
118 virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name,
119 const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword )
120 throw (::com::sun::star::lang::IllegalArgumentException,
121 ::com::sun::star::container::NoSuchElementException,
122 ::com::sun::star::uno::RuntimeException);
123 // XLibraryQueryExecutable
124 virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
125 throw (::com::sun::star::uno::RuntimeException);
126 // Methods XServiceInfo
127 virtual ::rtl::OUString SAL_CALL getImplementationName( )
128 throw (::com::sun::star::uno::RuntimeException);
129 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
130 throw (::com::sun::star::uno::RuntimeException);
132 // Service
133 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
134 static ::rtl::OUString getImplementationName_static();
135 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create
136 ( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xServiceManager )
137 throw( ::com::sun::star::uno::Exception );
141 //============================================================================
143 class SfxScriptLibrary : public SfxLibrary
145 friend class SfxScriptLibraryContainer;
147 sal_Bool mbLoadedSource;
148 sal_Bool mbLoadedBinary;
150 // Provide modify state including resources
151 virtual sal_Bool isModified( void );
152 virtual void storeResources( void );
153 virtual void storeResourcesAsURL( const ::rtl::OUString& URL, const ::rtl::OUString& NewName );
154 virtual void storeResourcesToURL( const ::rtl::OUString& URL,
155 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
156 virtual void storeResourcesToStorage( const ::com::sun::star::uno::Reference
157 < ::com::sun::star::embed::XStorage >& xStorage );
159 public:
160 SfxScriptLibrary
162 ModifiableHelper& _rModifiable,
163 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
164 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI
167 SfxScriptLibrary
169 ModifiableHelper& _rModifiable,
170 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
171 const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
172 const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly
175 static bool containsValidModule( const ::com::sun::star::uno::Any& _rElement );
177 protected:
178 virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const;
181 } // namespace base
183 #endif