diff options
Diffstat (limited to 'patches/vba/vba-check-for-macro.diff')
-rw-r--r-- | patches/vba/vba-check-for-macro.diff | 311 |
1 files changed, 0 insertions, 311 deletions
diff --git a/patches/vba/vba-check-for-macro.diff b/patches/vba/vba-check-for-macro.diff deleted file mode 100644 index 2844bb3fe..000000000 --- a/patches/vba/vba-check-for-macro.diff +++ /dev/null @@ -1,311 +0,0 @@ ---- basic/inc/basic/basmgr.hxx.old 2009-04-02 10:49:18.000000000 +0000 -+++ basic/inc/basic/basmgr.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -237,7 +237,7 @@ public: - takes the names of modules whose size exceeds the legacy limit - */ - bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& _out_rModuleNames ); -- -+ bool HasExeCode( const String& ); - private: - BOOL IsReference( USHORT nLib ); - ---- basic/inc/basic/sbmod.hxx.old 2009-04-06 16:41:58.000000000 +0000 -+++ basic/inc/basic/sbmod.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -128,6 +128,7 @@ public: - BOOL ExceedsLegacyModuleSize(); - void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const; - bool IsVBACompat() { return mbVBACompat; } -+ bool HasExeCode(); - }; - - #ifndef __SB_SBMODULEREF_HXX ---- basic/source/basmgr/basmgr.cxx.old 2009-04-02 10:49:15.000000000 +0000 -+++ basic/source/basmgr/basmgr.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -1127,6 +1127,25 @@ void BasicManager::LegacyDeleteBasicMana - _rpManager = NULL; - } - -+ -+bool BasicManager::HasExeCode( const String& sLib ) -+{ -+ StarBASIC* pLib = GetLib(sLib); -+ if ( pLib ) -+ { -+ SbxArray* pMods = pLib->GetModules(); -+ USHORT nMods = pMods ? pMods->Count() : 0; -+ for( USHORT i = 0; i < nMods; i++ ) -+ { -+ SbModule* p = (SbModule*) pMods->Get( i ); -+ if ( p ) -+ if ( p->HasExeCode() ) -+ return true; -+ } -+ } -+ return false; -+} -+ - void BasicManager::Init() - { - DBG_CHKTHIS( BasicManager, 0 ); ---- basic/source/classes/sbxmod.cxx.old 2009-04-06 16:41:58.000000000 +0000 -+++ basic/source/classes/sbxmod.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -1124,6 +1124,48 @@ BOOL SbModule::ExceedsLegacyModuleSize() - return false; - } - -+class ErrorHdlResetter -+{ -+ Link mErrHandler; -+ bool mbError; -+ public: -+ ErrorHdlResetter() : mbError( false ) -+ { -+ // save error handler -+ mErrHandler = StarBASIC::GetGlobalErrorHdl(); -+ // set new error handler -+ StarBASIC::SetGlobalErrorHdl( LINK( this, ErrorHdlResetter, BasicErrorHdl ) ); -+ } -+ ~ErrorHdlResetter() -+ { -+ // restore error handler -+ StarBASIC::SetGlobalErrorHdl(mErrHandler); -+ } -+ DECL_LINK( BasicErrorHdl, StarBASIC * ); -+ bool HasError() { return mbError; } -+}; -+IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/) -+{ -+ mbError = true; -+ return 0; -+} -+ -+bool SbModule::HasExeCode() -+{ -+ -+ ErrorHdlResetter aGblErrHdl; -+ // And empty Image always has the Global Chain set up -+ static const unsigned char pEmptyImage[] = { 0x45, 0x0 , 0x0, 0x0, 0x0 }; -+ // lets be stricter for the moment than VBA -+ -+ bool bRes = false; -+ if ( !IsCompiled() ) -+ Compile(); -+ if ( pImage && !( pImage->GetCodeSize() == 5 && ( memcmp( pImage->GetCode(), pEmptyImage, pImage->GetCodeSize() ) == 0 ) ) -+ || aGblErrHdl.HasError() ) -+ bRes = true; -+ return bRes; -+} - - // Store only image, no source - BOOL SbModule::StoreBinaryData( SvStream& rStrm ) ---- basic/source/inc/dlgcont.hxx.old 2009-04-02 10:49:15.000000000 +0000 -+++ basic/source/inc/dlgcont.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -96,7 +96,9 @@ public: - throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) - throw (::com::sun::star::uno::RuntimeException); -- -+ // XLibraryQueryExecutable -+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&) -+ throw (::com::sun::star::uno::RuntimeException); - // Service - static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(); - static ::rtl::OUString getImplementationName_static(); ---- basic/source/inc/namecont.hxx.old 2009-04-02 10:49:15.000000000 +0000 -+++ basic/source/inc/namecont.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -38,6 +38,7 @@ - #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp> - #include <com/sun/star/script/XLibraryContainerPassword.hpp> - #include <com/sun/star/script/XLibraryContainerExport.hpp> -+#include <com/sun/star/script/XLibraryQueryExecutable.hpp> - #include <com/sun/star/container/XNameContainer.hpp> - #include <com/sun/star/container/XContainer.hpp> - #include <com/sun/star/ucb/XSimpleFileAccess.hpp> -@@ -61,6 +62,7 @@ - - #include <cppuhelper/implbase2.hxx> - #include <cppuhelper/compbase6.hxx> -+#include <cppuhelper/compbase7.hxx> - #include <cppuhelper/interfacecontainer.hxx> - - class BasicManager; -@@ -68,12 +70,13 @@ class BasicManager; - namespace basic - { - --typedef ::cppu::WeakComponentImplHelper6< -+typedef ::cppu::WeakComponentImplHelper7< - ::com::sun::star::lang::XInitialization, - ::com::sun::star::script::XStorageBasedLibraryContainer, - ::com::sun::star::script::XLibraryContainerPassword, - ::com::sun::star::script::XLibraryContainerExport, - ::com::sun::star::container::XContainer, -+ ::com::sun::star::script::XLibraryQueryExecutable, - ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper; - - typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer, ---- basic/source/inc/scriptcont.hxx.old 2009-04-02 10:49:15.000000000 +0000 -+++ basic/source/inc/scriptcont.hxx 2009-04-06 16:41:59.000000000 +0000 -@@ -120,7 +120,9 @@ public: - throw (::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::container::NoSuchElementException, - ::com::sun::star::uno::RuntimeException); -- -+ // XLibraryQueryExecutable -+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&) -+ throw (::com::sun::star::uno::RuntimeException); - // Methods XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) - throw (::com::sun::star::uno::RuntimeException); ---- basic/source/uno/dlgcont.cxx.old 2009-04-02 10:49:15.000000000 +0000 -+++ basic/source/uno/dlgcont.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -484,7 +484,11 @@ void SfxDialogLibraryContainer::onNewRoo - } - } - -- -+sal_Bool SAL_CALL -+SfxDialogLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException) -+{ -+ return sal_False; // dialog library has no executable code -+} - //============================================================================ - // Service - ---- basic/source/uno/scriptcont.cxx.old 2009-04-02 10:49:15.000000000 +0000 -+++ basic/source/uno/scriptcont.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -67,7 +67,8 @@ - #include <xmlscript/xmlmod_imexp.hxx> - #include <cppuhelper/factory.hxx> - #include <com/sun/star/util/VetoException.hpp> -- -+#include <com/sun/star/script/XLibraryQueryExecutable.hpp> -+#include <cppuhelper/implbase1.hxx> - namespace basic - { - -@@ -138,7 +139,6 @@ sal_Bool SfxScriptLibraryContainer::hasL - return pImplLib->mbPasswordProtected; - } - -- - // Ctor for service - SfxScriptLibraryContainer::SfxScriptLibraryContainer( void ) - :maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) ) -@@ -1050,6 +1050,17 @@ void SfxScriptLibraryContainer::onNewRoo - { - } - -+sal_Bool SAL_CALL -+SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException) -+{ -+ BasicManager* pBasicMgr = getBasicManager(); -+ OSL_ENSURE( pBasicMgr, "we need a basicmanager, really we do" ); -+ if ( pBasicMgr ) -+ return pBasicMgr->HasExeCode( Library ); // need to change this to take name -+ // default to it has code if we can't decide -+ return sal_True; -+} -+ - //============================================================================ - // Service - void createRegistryInfo_SfxScriptLibraryContainer() ---- offapi/com/sun/star/script/XLibraryQueryExecutable.idl.old 1970-01-01 00:00:00.000000000 +0000 -+++ offapi/com/sun/star/script/XLibraryQueryExecutable.idl 2009-04-06 16:41:59.000000000 +0000 -@@ -0,0 +1,51 @@ -+/************************************************************************* -+ * -+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -+ * -+ * Copyright 2008 by Sun Microsystems, Inc. -+ * -+ * OpenOffice.org - a multi-platform office productivity suite -+ * -+ * $RCSfile: XLibraryContainer.idl,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 __com_sun_star_script_XLibraryQueryExecutable_idl__ -+#define __com_sun_star_script_XLibraryQueryExecutable_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+//============================================================================= -+ -+module com { module sun { module star { module script { -+ -+interface XLibraryQueryExecutable: com::sun::star::uno::XInterface -+{ -+ boolean HasExecutableCode( [in] string name ); -+}; -+ -+//============================================================================= -+ -+ -+}; }; }; }; -+ -+#endif ---- offapi/com/sun/star/script/makefile.mk.old 2009-04-02 10:51:40.000000000 +0000 -+++ offapi/com/sun/star/script/makefile.mk 2009-04-06 16:41:59.000000000 +0000 -@@ -51,6 +51,7 @@ IDLFILES=\ - XLibraryContainerExport.idl\ - XPersistentLibraryContainer.idl\ - XStorageBasedLibraryContainer.idl\ -+ XLibraryQueryExecutable.idl \ - ModuleSizeExceededRequest.idl\ - - # ------------------------------------------------------------------ ---- sfx2/source/doc/docmacromode.cxx.old 2009-04-02 10:43:58.000000000 +0000 -+++ sfx2/source/doc/docmacromode.cxx 2009-04-06 16:41:59.000000000 +0000 -@@ -40,6 +40,7 @@ - #include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp> - #include <com/sun/star/task/InteractionClassification.hpp> - #include <com/sun/star/security/XDocumentDigitalSignatures.hpp> -+#include <com/sun/star/script/XLibraryQueryExecutable.hpp> - /** === end UNO includes === **/ - - #include <comphelper/componentcontext.hxx> -@@ -75,8 +76,10 @@ namespace sfx2 - using ::com::sun::star::document::XEmbeddedScripts; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::script::XLibraryContainer; -+ using ::com::sun::star::script::XLibraryQueryExecutable; - using ::com::sun::star::container::XNameAccess; - using ::com::sun::star::uno::UNO_QUERY_THROW; -+ using ::com::sun::star::uno::UNO_QUERY; - /** === end UNO using === **/ - namespace MacroExecMode = ::com::sun::star::document::MacroExecMode; - -@@ -438,11 +441,9 @@ namespace sfx2 - // rid of the "Standard" thingie - this shouldn't be necessary - // anymore, should it? - // 2007-01-25 / frank.schoenheit@sun.com -- Reference < XNameAccess > xLib; -- Any aAny = xContainer->getByName( aStdLibName ); -- aAny >>= xLib; -+ Reference < XLibraryQueryExecutable > xLib( xContainer, UNO_QUERY ); - if ( xLib.is() ) -- bHasMacroLib = xLib->hasElements(); -+ bHasMacroLib = xLib->HasExecutableCode( aStdLibName ); - } - } - } |