ooo-build r12617 - in trunk: . patches/dev300 patches/vba



Author: noelpwer
Date: Wed May 21 11:55:49 2008
New Revision: 12617
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12617&view=rev

Log:
2008-05-21  Noel Power  <noel power novell com>

        * patches/dev300/apply:
        * patches/vba/vba-check-for-macro.diff: prep for Object modules
        delegate security check to the basic manager ( while will ignore 
        empty Document modules )



Added:
   trunk/patches/vba/vba-check-for-macro.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Wed May 21 11:55:49 2008
@@ -1546,6 +1546,8 @@
 vba-pagesetup-object.diff, Fong
 #always (try) to set the default property to an SbxUnoObject
 vba-always-set-defaultprop.diff, n#388049, noelpwer
+#clean up the macro security check, prepare for object/form modules
+vba-check-for-macro.diff
 [ VBAUntested ]
 SectionOwner => noelpwer
 # getting there

Added: trunk/patches/vba/vba-check-for-macro.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-check-for-macro.diff	Wed May 21 11:55:49 2008
@@ -0,0 +1,294 @@
+diff -rup /data4/scratch/dev300-ObjectModule/basic/inc/basic/basmgr.hxx basic/inc/basic/basmgr.hxx
+--- /data4/scratch/dev300-ObjectModule/basic/inc/basic/basmgr.hxx	2008-04-11 12:19:33.000000000 +0100
++++ basic/inc/basic/basmgr.hxx	2008-05-20 21:53:30.000000000 +0100
+@@ -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 );
+ 
+diff -rup /data4/scratch/dev300-ObjectModule/basic/inc/basic/sbmod.hxx basic/inc/basic/sbmod.hxx
+--- /data4/scratch/dev300-ObjectModule/basic/inc/basic/sbmod.hxx	2008-05-13 20:13:50.000000000 +0100
++++ basic/inc/basic/sbmod.hxx	2008-05-21 00:53:03.000000000 +0100
+@@ -128,7 +129,8 @@ public:
+ 	BOOL LoadBinaryData( SvStream& );
+ 	BOOL ExceedsLegacyModuleSize();
+ 	void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
+         bool IsVBACompat() { return mbVBACompat; }
++        bool HasExeCode();
+ };
+ 
+ #ifndef __SB_SBMODULEREF_HXX
+diff -rup /data4/scratch/dev300-ObjectModule/basic/source/basmgr/basmgr.cxx basic/source/basmgr/basmgr.cxx
+--- /data4/scratch/dev300-ObjectModule/basic/source/basmgr/basmgr.cxx	2008-05-13 20:13:54.000000000 +0100
++++ basic/source/basmgr/basmgr.cxx	2008-05-20 23:59:41.000000000 +0100
+@@ -1175,7 +1159,26 @@ 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 );
+     {
+diff -rup /data4/scratch/dev300-ObjectModule/basic/source/classes/sbxmod.cxx basic/source/classes/sbxmod.cxx
+--- /data4/scratch/dev300-ObjectModule/basic/source/classes/sbxmod.cxx	2008-05-13 20:13:54.000000000 +0100
++++ basic/source/classes/sbxmod.cxx	2008-05-21 00:33:28.000000000 +0100
+@@ -1280,6 +1289,20 @@ BOOL SbModule::ExceedsLegacyModuleSize()
+ 	return false;
+ }
+ 
++bool SbModule::HasExeCode()
++{
++	// 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 ) )
++	|| StarBASIC::GetErrorCode() )
++		bRes = true;
++	return bRes;
++}
+ 
+ // Store only image, no source
+ BOOL SbModule::StoreBinaryData( SvStream& rStrm )
+diff -rup /data4/scratch/dev300-ObjectModule/basic/source/inc/dlgcont.hxx basic/source/inc/dlgcont.hxx
+--- /data4/scratch/dev300-ObjectModule/basic/source/inc/dlgcont.hxx	2008-04-11 12:54:31.000000000 +0100
++++ basic/source/inc/dlgcont.hxx	2008-05-20 18:23:55.000000000 +0100
+@@ -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 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();
+diff -rup /data4/scratch/dev300-ObjectModule/basic/source/inc/namecont.hxx basic/source/inc/namecont.hxx
+--- /data4/scratch/dev300-ObjectModule/basic/source/inc/namecont.hxx	2008-04-11 12:56:02.000000000 +0100
++++ basic/source/inc/namecont.hxx	2008-05-20 18:17:09.000000000 +0100
+@@ -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>
+@@ -60,6 +61,7 @@
+ 
+ #include <cppuhelper/implbase2.hxx>
+ #include <cppuhelper/compbase6.hxx>
++#include <cppuhelper/compbase7.hxx>
+ #include <cppuhelper/interfacecontainer.hxx>
+ 
+ class BasicManager;
+@@ -67,12 +69,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,
+diff -rup /data4/scratch/dev300-ObjectModule/basic/source/inc/scriptcont.hxx basic/source/inc/scriptcont.hxx
+--- /data4/scratch/dev300-ObjectModule/basic/source/inc/scriptcont.hxx	2008-04-11 12:59:37.000000000 +0100
++++ basic/source/inc/scriptcont.hxx	2008-05-20 18:19:19.000000000 +0100
+@@ -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 HasExecutableCode(const rtl::OUString&)
++        throw (::com::sun::star::uno::RuntimeException);
+     // Methods XServiceInfo
+     virtual ::rtl::OUString SAL_CALL getImplementationName( )
+         throw (::com::sun::star::uno::RuntimeException);
+diff -rup /data4/scratch/dev300-ObjectModule/basic/source/uno/dlgcont.cxx basic/source/uno/dlgcont.cxx
+--- /data4/scratch/dev300-ObjectModule/basic/source/uno/dlgcont.cxx	2008-04-11 13:22:05.000000000 +0100
++++ basic/source/uno/dlgcont.cxx	2008-05-20 18:24:55.000000000 +0100
+@@ -487,7 +487,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
+ 
+diff -rup /data4/scratch/dev300-ObjectModule/basic/source/uno/scriptcont.cxx basic/source/uno/scriptcont.cxx
+--- /data4/scratch/dev300-ObjectModule/basic/source/uno/scriptcont.cxx	2008-04-11 13:24:14.000000000 +0100
++++ basic/source/uno/scriptcont.cxx	2008-05-20 21:55:46.000000000 +0100
+@@ -66,7 +66,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
+ {
+ 
+@@ -137,7 +138,6 @@ sal_Bool SfxScriptLibraryContainer::hasL
+     return pImplLib->mbPasswordProtected;
+ }
+ 
+-
+ // Ctor for service
+ SfxScriptLibraryContainer::SfxScriptLibraryContainer( void )
+     :maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) )
+@@ -1034,6 +1034,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()
+--- /dev/null	2007-05-04 11:54:36.000000000 +0100
++++ offapi/com/sun/star/script/XLibraryQueryExecutable.idl	2008-05-16 17:54:12.000000000 +0100
+@@ -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 
+--- /data4/scratch/dev300-ObjectModule/offapi/com/sun/star/script/makefile.mk	2008-04-11 03:06:32.000000000 +0100
++++ offapi/com/sun/star/script/makefile.mk	2008-05-16 17:53:48.000000000 +0100
+@@ -50,6 +50,7 @@ IDLFILES=\
+ 	XLibraryContainerExport.idl\
+ 	XPersistentLibraryContainer.idl\
+ 	XStorageBasedLibraryContainer.idl\
++	XLibraryQueryExecutable.idl \
+ 	ModuleSizeExceededRequest.idl\
+ 
+ # ------------------------------------------------------------------
+--- /data4/scratch/dev300-noObjectnoUserform/sfx2/source/doc/docmacromode.cxx	2008-05-13 11:47:13.000000000 +0100
++++ sfx2/source/doc/docmacromode.cxx	2008-05-20 18:34:35.000000000 +0100
+@@ -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 );
+ 					    }
+ 				    }
+ 			    }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]