1 --- basic/inc/basic/basmgr.hxx.old 2009-04-02 10:49:18.000000000 +0000
2 +++ basic/inc/basic/basmgr.hxx 2009-04-06 16:41:59.000000000 +0000
3 @@ -237,7 +237,7 @@ public:
4 takes the names of modules whose size exceeds the legacy limit
6 bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& _out_rModuleNames );
8 + bool HasExeCode( const String& );
10 BOOL IsReference( USHORT nLib );
12 --- basic/inc/basic/sbmod.hxx.old 2009-04-06 16:41:58.000000000 +0000
13 +++ basic/inc/basic/sbmod.hxx 2009-04-06 16:41:59.000000000 +0000
14 @@ -128,6 +128,7 @@ public:
15 BOOL ExceedsLegacyModuleSize();
16 void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
17 bool IsVBACompat() { return mbVBACompat; }
21 #ifndef __SB_SBMODULEREF_HXX
22 --- basic/source/basmgr/basmgr.cxx.old 2009-04-02 10:49:15.000000000 +0000
23 +++ basic/source/basmgr/basmgr.cxx 2009-04-06 16:41:59.000000000 +0000
24 @@ -1127,6 +1127,25 @@ void BasicManager::LegacyDeleteBasicMana
29 +bool BasicManager::HasExeCode( const String& sLib )
31 + StarBASIC* pLib = GetLib(sLib);
34 + SbxArray* pMods = pLib->GetModules();
35 + USHORT nMods = pMods ? pMods->Count() : 0;
36 + for( USHORT i = 0; i < nMods; i++ )
38 + SbModule* p = (SbModule*) pMods->Get( i );
40 + if ( p->HasExeCode() )
47 void BasicManager::Init()
49 DBG_CHKTHIS( BasicManager, 0 );
50 --- basic/source/classes/sbxmod.cxx.old 2009-04-06 16:41:58.000000000 +0000
51 +++ basic/source/classes/sbxmod.cxx 2009-04-06 16:41:59.000000000 +0000
52 @@ -1124,6 +1124,48 @@ BOOL SbModule::ExceedsLegacyModuleSize()
56 +class ErrorHdlResetter
61 + ErrorHdlResetter() : mbError( false )
63 + // save error handler
64 + mErrHandler = StarBASIC::GetGlobalErrorHdl();
65 + // set new error handler
66 + StarBASIC::SetGlobalErrorHdl( LINK( this, ErrorHdlResetter, BasicErrorHdl ) );
70 + // restore error handler
71 + StarBASIC::SetGlobalErrorHdl(mErrHandler);
73 + DECL_LINK( BasicErrorHdl, StarBASIC * );
74 + bool HasError() { return mbError; }
76 +IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/)
82 +bool SbModule::HasExeCode()
85 + ErrorHdlResetter aGblErrHdl;
86 + // And empty Image always has the Global Chain set up
87 + static const unsigned char pEmptyImage[] = { 0x45, 0x0 , 0x0, 0x0, 0x0 };
88 + // lets be stricter for the moment than VBA
91 + if ( !IsCompiled() )
93 + if ( pImage && !( pImage->GetCodeSize() == 5 && ( memcmp( pImage->GetCode(), pEmptyImage, pImage->GetCodeSize() ) == 0 ) )
94 + || aGblErrHdl.HasError() )
99 // Store only image, no source
100 BOOL SbModule::StoreBinaryData( SvStream& rStrm )
101 --- basic/source/inc/dlgcont.hxx.old 2009-04-02 10:49:15.000000000 +0000
102 +++ basic/source/inc/dlgcont.hxx 2009-04-06 16:41:59.000000000 +0000
103 @@ -96,7 +96,9 @@ public:
104 throw (::com::sun::star::uno::RuntimeException);
105 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
106 throw (::com::sun::star::uno::RuntimeException);
108 + // XLibraryQueryExecutable
109 + virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
110 + throw (::com::sun::star::uno::RuntimeException);
112 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
113 static ::rtl::OUString getImplementationName_static();
114 --- basic/source/inc/namecont.hxx.old 2009-04-02 10:49:15.000000000 +0000
115 +++ basic/source/inc/namecont.hxx 2009-04-06 16:41:59.000000000 +0000
117 #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
118 #include <com/sun/star/script/XLibraryContainerPassword.hpp>
119 #include <com/sun/star/script/XLibraryContainerExport.hpp>
120 +#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
121 #include <com/sun/star/container/XNameContainer.hpp>
122 #include <com/sun/star/container/XContainer.hpp>
123 #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
126 #include <cppuhelper/implbase2.hxx>
127 #include <cppuhelper/compbase6.hxx>
128 +#include <cppuhelper/compbase7.hxx>
129 #include <cppuhelper/interfacecontainer.hxx>
132 @@ -68,12 +70,13 @@ class BasicManager;
136 -typedef ::cppu::WeakComponentImplHelper6<
137 +typedef ::cppu::WeakComponentImplHelper7<
138 ::com::sun::star::lang::XInitialization,
139 ::com::sun::star::script::XStorageBasedLibraryContainer,
140 ::com::sun::star::script::XLibraryContainerPassword,
141 ::com::sun::star::script::XLibraryContainerExport,
142 ::com::sun::star::container::XContainer,
143 + ::com::sun::star::script::XLibraryQueryExecutable,
144 ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
146 typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
147 --- basic/source/inc/scriptcont.hxx.old 2009-04-02 10:49:15.000000000 +0000
148 +++ basic/source/inc/scriptcont.hxx 2009-04-06 16:41:59.000000000 +0000
149 @@ -120,7 +120,9 @@ public:
150 throw (::com::sun::star::lang::IllegalArgumentException,
151 ::com::sun::star::container::NoSuchElementException,
152 ::com::sun::star::uno::RuntimeException);
154 + // XLibraryQueryExecutable
155 + virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
156 + throw (::com::sun::star::uno::RuntimeException);
157 // Methods XServiceInfo
158 virtual ::rtl::OUString SAL_CALL getImplementationName( )
159 throw (::com::sun::star::uno::RuntimeException);
160 --- basic/source/uno/dlgcont.cxx.old 2009-04-02 10:49:15.000000000 +0000
161 +++ basic/source/uno/dlgcont.cxx 2009-04-06 16:41:59.000000000 +0000
162 @@ -484,7 +484,11 @@ void SfxDialogLibraryContainer::onNewRoo
168 +SfxDialogLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
170 + return sal_False; // dialog library has no executable code
172 //============================================================================
175 --- basic/source/uno/scriptcont.cxx.old 2009-04-02 10:49:15.000000000 +0000
176 +++ basic/source/uno/scriptcont.cxx 2009-04-06 16:41:59.000000000 +0000
178 #include <xmlscript/xmlmod_imexp.hxx>
179 #include <cppuhelper/factory.hxx>
180 #include <com/sun/star/util/VetoException.hpp>
182 +#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
183 +#include <cppuhelper/implbase1.hxx>
187 @@ -138,7 +139,6 @@ sal_Bool SfxScriptLibraryContainer::hasL
188 return pImplLib->mbPasswordProtected;
193 SfxScriptLibraryContainer::SfxScriptLibraryContainer( void )
194 :maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) )
195 @@ -1050,6 +1050,17 @@ void SfxScriptLibraryContainer::onNewRoo
200 +SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
202 + BasicManager* pBasicMgr = getBasicManager();
203 + OSL_ENSURE( pBasicMgr, "we need a basicmanager, really we do" );
205 + return pBasicMgr->HasExeCode( Library ); // need to change this to take name
206 + // default to it has code if we can't decide
210 //============================================================================
212 void createRegistryInfo_SfxScriptLibraryContainer()
213 --- offapi/com/sun/star/script/XLibraryQueryExecutable.idl.old 1970-01-01 00:00:00.000000000 +0000
214 +++ offapi/com/sun/star/script/XLibraryQueryExecutable.idl 2009-04-06 16:41:59.000000000 +0000
216 +/*************************************************************************
218 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
220 + * Copyright 2008 by Sun Microsystems, Inc.
222 + * OpenOffice.org - a multi-platform office productivity suite
224 + * $RCSfile: XLibraryContainer.idl,v $
227 + * This file is part of OpenOffice.org.
229 + * OpenOffice.org is free software: you can redistribute it and/or modify
230 + * it under the terms of the GNU Lesser General Public License version 3
231 + * only, as published by the Free Software Foundation.
233 + * OpenOffice.org is distributed in the hope that it will be useful,
234 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
235 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
236 + * GNU Lesser General Public License version 3 for more details
237 + * (a copy is included in the LICENSE file that accompanied this code).
239 + * You should have received a copy of the GNU Lesser General Public License
240 + * version 3 along with OpenOffice.org. If not, see
241 + * <http://www.openoffice.org/license.html>
242 + * for a copy of the LGPLv3 License.
244 + ************************************************************************/
245 +#ifndef __com_sun_star_script_XLibraryQueryExecutable_idl__
246 +#define __com_sun_star_script_XLibraryQueryExecutable_idl__
248 +#ifndef __com_sun_star_uno_XInterface_idl__
249 +#include <com/sun/star/uno/XInterface.idl>
252 +//=============================================================================
254 +module com { module sun { module star { module script {
256 +interface XLibraryQueryExecutable: com::sun::star::uno::XInterface
258 + boolean HasExecutableCode( [in] string name );
261 +//=============================================================================
267 --- offapi/com/sun/star/script/makefile.mk.old 2009-04-02 10:51:40.000000000 +0000
268 +++ offapi/com/sun/star/script/makefile.mk 2009-04-06 16:41:59.000000000 +0000
269 @@ -51,6 +51,7 @@ IDLFILES=\
270 XLibraryContainerExport.idl\
271 XPersistentLibraryContainer.idl\
272 XStorageBasedLibraryContainer.idl\
273 + XLibraryQueryExecutable.idl \
274 ModuleSizeExceededRequest.idl\
276 # ------------------------------------------------------------------
277 --- sfx2/source/doc/docmacromode.cxx.old 2009-04-02 10:43:58.000000000 +0000
278 +++ sfx2/source/doc/docmacromode.cxx 2009-04-06 16:41:59.000000000 +0000
280 #include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
281 #include <com/sun/star/task/InteractionClassification.hpp>
282 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
283 +#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
284 /** === end UNO includes === **/
286 #include <comphelper/componentcontext.hxx>
287 @@ -75,8 +76,10 @@ namespace sfx2
288 using ::com::sun::star::document::XEmbeddedScripts;
289 using ::com::sun::star::uno::UNO_SET_THROW;
290 using ::com::sun::star::script::XLibraryContainer;
291 + using ::com::sun::star::script::XLibraryQueryExecutable;
292 using ::com::sun::star::container::XNameAccess;
293 using ::com::sun::star::uno::UNO_QUERY_THROW;
294 + using ::com::sun::star::uno::UNO_QUERY;
295 /** === end UNO using === **/
296 namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
298 @@ -438,11 +441,9 @@ namespace sfx2
299 // rid of the "Standard" thingie - this shouldn't be necessary
300 // anymore, should it?
301 // 2007-01-25 / frank.schoenheit@sun.com
302 - Reference < XNameAccess > xLib;
303 - Any aAny = xContainer->getByName( aStdLibName );
305 + Reference < XLibraryQueryExecutable > xLib( xContainer, UNO_QUERY );
307 - bHasMacroLib = xLib->hasElements();
308 + bHasMacroLib = xLib->HasExecutableCode( aStdLibName );