diff options
author | Joerg Skottke [jsk] <jsk@openoffice.org> | 2010-08-13 07:28:35 +0200 |
---|---|---|
committer | Joerg Skottke [jsk] <jsk@openoffice.org> | 2010-08-13 07:28:35 +0200 |
commit | 6b138d543f14768f64fa4985b8397f533e99c97c (patch) | |
tree | b84e12f30e9aadeb5e71f726428551cbd40e025b | |
parent | e179ae411850392669048a7c319a647b1d6360f9 (diff) | |
parent | 7172f697ab5c114ba5b2201e72116085db857642 (diff) |
jl154: Local merge
-rw-r--r-- | basctl/source/basicide/basides2.cxx | 1 | ||||
-rw-r--r-- | basctl/source/basicide/bastype2.cxx | 9 | ||||
-rw-r--r-- | basctl/source/basicide/scriptdocument.cxx | 12 | ||||
-rwxr-xr-x[-rw-r--r--] | extensions/source/ole/oleobjw.cxx | 88 | ||||
-rw-r--r-- | extensions/source/ole/oleobjw.hxx | 11 | ||||
-rw-r--r-- | extensions/source/ole/unoconversionutilities.hxx | 52 | ||||
-rwxr-xr-x | setup_native/source/java/javaversion.dat | 26 | ||||
-rw-r--r-- | setup_native/source/java/javaversion2.dat | 26 | ||||
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx | 180 | ||||
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/exports.dxp | 1 | ||||
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/makefile.mk | 1 |
11 files changed, 337 insertions, 70 deletions
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx index bef969db9266..3a3a162f5b5e 100644 --- a/basctl/source/basicide/basides2.cxx +++ b/basctl/source/basicide/basides2.cxx @@ -51,7 +51,6 @@ #include <tools/diagnose_ex.h> #include <sfx2/sfxdefs.hxx> #include <sfx2/signaturestate.hxx> -#include <com/sun/star/script/XVBAModuleInfo.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index 0709fe38cbe2..79f3cdb84c6b 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -52,9 +52,8 @@ #include <comphelper/componentcontext.hxx> #include <map> #include <com/sun/star/script/ModuleType.hpp> -#include <com/sun/star/script/XVBAModuleInfo.hpp> +#include <com/sun/star/script/vba/XVBAModuleInfo.hpp> #include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/script/XVBAModuleInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XNamed.hpp> @@ -65,7 +64,7 @@ void ModuleInfoHelper::getObjectName( const uno::Reference< container::XNameCont { try { - uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY ); + uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY ); if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) ) { script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName ); @@ -86,8 +85,8 @@ void ModuleInfoHelper::getObjectName( const uno::Reference< container::XNameCont sal_Int32 ModuleInfoHelper::getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName ) { - sal_Int32 nType = com::sun::star::script::ModuleType::NORMAL; - uno::Reference< script::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY ); + sal_Int32 nType = script::ModuleType::NORMAL; + uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY ); if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) ) { script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName ); diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index 1f1d8ab6145b..6b16316d889c 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -53,8 +53,8 @@ #include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> -#include <com/sun/star/script/XVBAModuleInfo.hpp> -#include <com/sun/star/script/XVBACompat.hpp> +#include <com/sun/star/script/vba/XVBACompatibility.hpp> +#include <com/sun/star/script/vba/XVBAModuleInfo.hpp> /** === end UNO includes === **/ #include <sfx2/objsh.hxx> @@ -142,8 +142,8 @@ namespace basctl using ::com::sun::star::document::XEventBroadcaster; using ::com::sun::star::document::XEmbeddedScripts; using ::com::sun::star::script::ModuleInfo; - using ::com::sun::star::script::XVBAModuleInfo; - using ::com::sun::star::script::XVBACompat; + using ::com::sun::star::script::vba::XVBACompatibility; + using ::com::sun::star::script::vba::XVBAModuleInfo; /** === end UNO using === **/ namespace MacroExecMode = ::com::sun::star::document::MacroExecMode; namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag; @@ -456,9 +456,9 @@ namespace basctl #ifdef FUTURE_VBA_CWS if ( !isApplication() ) { - Reference< XVBACompat > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); + Reference< XVBACompatibility > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); if ( xVBACompat.is() ) - bResult = xVBACompat->getVBACompatModeOn(); + bResult = xVBACompat->getVBACompatibilityMode(); } #endif return bResult; diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index ea9377ccf596..89cb5625bca3 100644..100755 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -69,6 +69,7 @@ using namespace boost; using namespace osl; using namespace rtl; using namespace cppu; +using namespace com::sun::star::script; using namespace com::sun::star::lang; using namespace com::sun::star::bridge; using namespace com::sun::star::bridge::oleautomation; @@ -108,7 +109,7 @@ IUnknownWrapper_Impl::IUnknownWrapper_Impl( Reference<XMultiServiceFactory>& xFa sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass): UnoConversionUtilities<IUnknownWrapper_Impl>( xFactory, unoWrapperClass, comWrapperClass), m_pxIdlClass( NULL), m_eJScript( JScriptUndefined), - m_bComTlbIndexInit(false) + m_bComTlbIndexInit(false), m_bHasDfltMethod(false), m_bHasDfltProperty(false) { } @@ -147,17 +148,15 @@ IUnknownWrapper_Impl::~IUnknownWrapper_Impl() Any IUnknownWrapper_Impl::queryInterface(const Type& t) throw (RuntimeException) { - if (t == getCppuType(static_cast<Reference<XInvocation>*>( 0))) - { - if (m_spDispatch) - return WeakImplHelper4<XInvocation, XBridgeSupplier2, - XInitialization, XAutomationObject>::queryInterface(t); - else - return Any(); - } - - return WeakImplHelper4<XInvocation, XBridgeSupplier2, - XInitialization, XAutomationObject>::queryInterface(t); + if (t == getCppuType(static_cast<Reference<XDefaultMethod>*>( 0)) && !m_bHasDfltMethod ) + return Any(); + if (t == getCppuType(static_cast<Reference<XDefaultProperty>*>( 0)) && !m_bHasDfltProperty ) + return Any(); + if (t == getCppuType(static_cast<Reference<XInvocation>*>( 0)) && !m_spDispatch) + return Any(); + + return WeakImplHelper6<XInvocation, XBridgeSupplier2, + XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>::queryInterface(t); } Reference<XIntrospectionAccess> SAL_CALL IUnknownWrapper_Impl::getIntrospection(void) @@ -1194,6 +1193,68 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument aArguments[1] >>= m_bOriginalDispatch; aArguments[2] >>= m_seqTypes; + + ITypeInfo* pType = NULL; + try + { + // a COM object implementation that has no TypeInfo is still a legal COM object; + // such objects can at least be transported through UNO using the bridge + // so we should allow to create wrappers for them as well + pType = getTypeInfo(); + } + catch( BridgeRuntimeError& ) + {} + catch( Exception& ) + {} + + if ( pType ) + { + try + { + // Get Default member + CComBSTR defaultMemberName; + if ( SUCCEEDED( pType->GetDocumentation(0, &defaultMemberName, 0, 0, 0 ) ) ) + { + OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(defaultMemberName))); + FuncDesc aDescGet(pType); + FuncDesc aDescPut(pType); + VarDesc aVarDesc(pType); + // see if this is a property first ( more likely to be a property then a method ) + getPropDesc( usName, & aDescGet, & aDescPut, & aVarDesc); + + if ( !aDescGet && !aDescPut ) + { + getFuncDesc( usName, &aDescGet ); + if ( !aDescGet ) + throw BridgeRuntimeError( OUSTR("[automation bridge]IUnknownWrapper_Impl::initialize() Failed to get Function or Property desc. for " ) + usName ); + } + // now for some funny heuristics to make basic understand what to do + // a single aDescGet ( that doesn't take any params ) would be + // a read only ( defaultmember ) property e.g. this object + // should implement XDefaultProperty + // a single aDescGet ( that *does* ) take params is basically a + // default method e.g. implement XDefaultMethod + + // a DescPut ( I guess we only really support a default param with '1' param ) as a setValue ( but I guess we can leave it through, the object will fail if we don't get it right anyway ) + if ( aDescPut || ( aDescGet && aDescGet->cParams == 0 ) ) + m_bHasDfltProperty = true; + if ( aDescGet->cParams > 0 ) + m_bHasDfltMethod = true; + if ( m_bHasDfltProperty || m_bHasDfltMethod ) + m_sDefaultMember = usName; + } + } + catch ( BridgeRuntimeError & e ) + { + throw RuntimeException( e.message, Reference<XInterface>() ); + } + catch( Exception& e ) + { + throw RuntimeException( + OUSTR("[automation bridge] unexpected exception in IUnknownWrapper_Impl::initialiase() error message: \n") + e.Message, + Reference<XInterface>() ); + } + } } // UnoConversionUtilities -------------------------------------------------------------------------------- @@ -1445,6 +1506,9 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(const OUString& sFuncName, arDispidNamedArgs.reset(new DISPID[nSizeAr]); HRESULT hr = getTypeInfo()->GetIDsOfNames(arNames, nSizeAr, arDispidNamedArgs.get()); + if ( hr == E_NOTIMPL ) + hr = m_spDispatch->GetIDsOfNames(IID_NULL, arNames, nSizeAr, LOCALE_USER_DEFAULT, arDispidNamedArgs.get() ); + if (hr == S_OK) { // In a "property put" operation, the property value is a named param with the diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx index 230de2b7dcf8..b990ac3af17d 100644 --- a/extensions/source/ole/oleobjw.hxx +++ b/extensions/source/ole/oleobjw.hxx @@ -50,11 +50,14 @@ #endif #include <cppuhelper/implbase3.hxx> #include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase6.hxx> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp> #include <rtl/ustring.hxx> +#include <com/sun/star/script/XDefaultProperty.hpp> +#include <com/sun/star/script/XDefaultMethod.hpp> #include <typelib/typedescription.hxx> #include "unoconversionutilities.hxx" @@ -78,7 +81,8 @@ typedef hash_multimap<OUString, unsigned int, hashOUString_Impl, equalOUString_I // This class wraps an IDispatch and maps XInvocation calls to IDispatch calls on the wrapped object. // If m_TypeDescription is set then this class represents an UNO interface implemented in a COM component. // The interface is not a real interface in terms of an abstract class but is realized through IDispatch. -class IUnknownWrapper_Impl : public WeakImplHelper4<XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject>, +class IUnknownWrapper_Impl : public WeakImplHelper6<XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod>, + public UnoConversionUtilities<IUnknownWrapper_Impl> { @@ -126,7 +130,9 @@ public: // XInitialization virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException); + virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; } protected: + virtual ::rtl::OUString SAL_CALL getDefaultMethodName( ) throw (::com::sun::star::uno::RuntimeException) { return m_sDefaultMember; } // ---------------------------------------------------------------------------- virtual Any invokeWithDispIdUnoTlb(const OUString& sFunctionName, @@ -253,6 +259,9 @@ protected: bool m_bComTlbIndexInit; // Keeps the ITypeInfo obtained from IDispatch::GetTypeInfo CComPtr< ITypeInfo > m_spTypeInfo; + rtl::OUString m_sDefaultMember; + bool m_bHasDfltMethod; + bool m_bHasDfltProperty; }; } // end namespace diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index 9eb47166ca82..da95b9950427 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -1324,33 +1324,47 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq) typelib_TypeDescription* pSeqElementDesc= NULL; TYPELIB_DANGER_GET( &pSeqElementDesc, pSeqElementTypeRef); - sal_Int32 nElementSize= pSeqElementDesc->nSize; - n= punoSeq->nElements; - SAFEARRAYBOUND rgsabound[1]; - rgsabound[0].lLbound = 0; - rgsabound[0].cElements = n; - VARIANT oleElement; - long safeI[1]; + // try to find VARIANT type that is related to the UNO type of the sequence elements + // the sequence as a sequence element should be handled in a special way + VARTYPE eTargetElementType = VT_EMPTY; + if ( pSeqElementDesc->eTypeClass != TypeClass_SEQUENCE ) + eTargetElementType = mapTypeClassToVartype( static_cast< TypeClass >( pSeqElementDesc->eTypeClass ) ); - pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound); + if ( eTargetElementType != VT_EMPTY ) + pArray = createUnoSequenceWrapper( rSeq, eTargetElementType ); - Any unoElement; - // sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->pElements; - sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements; - - for (sal_uInt32 i = 0; i < n; i++) + if ( !pArray ) { - unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc); - VariantInit(&oleElement); + sal_Int32 nElementSize= pSeqElementDesc->nSize; + n= punoSeq->nElements; + + SAFEARRAYBOUND rgsabound[1]; + rgsabound[0].lLbound = 0; + rgsabound[0].cElements = n; + VARIANT oleElement; + long safeI[1]; + + pArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound); + + Any unoElement; + // sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->pElements; + sal_uInt8 * pSeqData= (sal_uInt8*) punoSeq->elements; - anyToVariant(&oleElement, unoElement); + for (sal_uInt32 i = 0; i < n; i++) + { + unoElement.setValue( pSeqData + i * nElementSize, pSeqElementDesc); + VariantInit(&oleElement); + + anyToVariant(&oleElement, unoElement); - safeI[0] = i; - SafeArrayPutElement(pArray, safeI, &oleElement); + safeI[0] = i; + SafeArrayPutElement(pArray, safeI, &oleElement); - VariantClear(&oleElement); + VariantClear(&oleElement); + } } + TYPELIB_DANGER_RELEASE( pSeqElementDesc); return pArray; diff --git a/setup_native/source/java/javaversion.dat b/setup_native/source/java/javaversion.dat index a629a4037269..bb935ac2ce58 100755 --- a/setup_native/source/java/javaversion.dat +++ b/setup_native/source/java/javaversion.dat @@ -26,30 +26,30 @@ #************************************************************************* # GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})") -JAVAVERSION=Java 6 Update 20 -WINDOWSJAVAVERSION=Java 6 Update 20 +JAVAVERSION=Java 6 Update 21 +WINDOWSJAVAVERSION=Java 6 Update 21 # Windows (scp2 and downloadtemplate.nsi) -WINDOWSJAVAFILENAME=jre-6u20-windows-i586.exe -WINDOWSJAVAREGISTRYENTRY=1.6.0_20 +WINDOWSJAVAFILENAME=jre-6u21-windows-i586.exe +WINDOWSJAVAREGISTRYENTRY=1.6.0_21 # Linux (scp2) -LINUXJAVAFILENAME=jre-6u20-linux-i586.rpm +LINUXJAVAFILENAME=jre-6u21-linux-i586.rpm # Linux (rpmUnit.xml, rpm -qp <filename> ) -LINUXJAVANAME=jre-1.6.0_20-fcs +LINUXJAVANAME=jre-1.6.0_21-fcs # Linux-x64 (scp2) -LINUXX64JAVAFILENAME=jre-6u20-linux-amd64.rpm +LINUXX64JAVAFILENAME=jre-6u21-linux-amd64.rpm # Solaris Sparc (scp2) -SOLSJAVARTPACKED=SUNWj6rt_1_6_0_20_sparc.tar.gz -SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_20_sparc.tar.gz -SOLSJAVAMANPACKED=SUNWj6man_1_6_0_20_sparc.tar.gz +SOLSJAVARTPACKED=SUNWj6rt_1_6_0_21_sparc.tar.gz +SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_21_sparc.tar.gz +SOLSJAVAMANPACKED=SUNWj6man_1_6_0_21_sparc.tar.gz # Solaris x86 (scp2) -SOLIJAVARTPACKED=SUNWj6rt_1_6_0_20_x86.tar.gz -SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_20_x86.tar.gz -SOLIJAVAMANPACKED=SUNWj6man_1_6_0_20_x86.tar.gz +SOLIJAVARTPACKED=SUNWj6rt_1_6_0_21_x86.tar.gz +SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_21_x86.tar.gz +SOLIJAVAMANPACKED=SUNWj6man_1_6_0_21_x86.tar.gz # Solaris (pkgUnit.xml, needs only to be changed in major changes) SOLARISJAVART=SUNWj6rt diff --git a/setup_native/source/java/javaversion2.dat b/setup_native/source/java/javaversion2.dat index a629a4037269..bb935ac2ce58 100644 --- a/setup_native/source/java/javaversion2.dat +++ b/setup_native/source/java/javaversion2.dat @@ -26,30 +26,30 @@ #************************************************************************* # GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})") -JAVAVERSION=Java 6 Update 20 -WINDOWSJAVAVERSION=Java 6 Update 20 +JAVAVERSION=Java 6 Update 21 +WINDOWSJAVAVERSION=Java 6 Update 21 # Windows (scp2 and downloadtemplate.nsi) -WINDOWSJAVAFILENAME=jre-6u20-windows-i586.exe -WINDOWSJAVAREGISTRYENTRY=1.6.0_20 +WINDOWSJAVAFILENAME=jre-6u21-windows-i586.exe +WINDOWSJAVAREGISTRYENTRY=1.6.0_21 # Linux (scp2) -LINUXJAVAFILENAME=jre-6u20-linux-i586.rpm +LINUXJAVAFILENAME=jre-6u21-linux-i586.rpm # Linux (rpmUnit.xml, rpm -qp <filename> ) -LINUXJAVANAME=jre-1.6.0_20-fcs +LINUXJAVANAME=jre-1.6.0_21-fcs # Linux-x64 (scp2) -LINUXX64JAVAFILENAME=jre-6u20-linux-amd64.rpm +LINUXX64JAVAFILENAME=jre-6u21-linux-amd64.rpm # Solaris Sparc (scp2) -SOLSJAVARTPACKED=SUNWj6rt_1_6_0_20_sparc.tar.gz -SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_20_sparc.tar.gz -SOLSJAVAMANPACKED=SUNWj6man_1_6_0_20_sparc.tar.gz +SOLSJAVARTPACKED=SUNWj6rt_1_6_0_21_sparc.tar.gz +SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_21_sparc.tar.gz +SOLSJAVAMANPACKED=SUNWj6man_1_6_0_21_sparc.tar.gz # Solaris x86 (scp2) -SOLIJAVARTPACKED=SUNWj6rt_1_6_0_20_x86.tar.gz -SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_20_x86.tar.gz -SOLIJAVAMANPACKED=SUNWj6man_1_6_0_20_x86.tar.gz +SOLIJAVARTPACKED=SUNWj6rt_1_6_0_21_x86.tar.gz +SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_21_x86.tar.gz +SOLIJAVAMANPACKED=SUNWj6man_1_6_0_21_x86.tar.gz # Solaris (pkgUnit.xml, needs only to be changed in major changes) SOLARISJAVART=SUNWj6rt diff --git a/setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx b/setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx new file mode 100644 index 000000000000..7d09e79b9ec7 --- /dev/null +++ b/setup_native/source/win32/customactions/shellextensions/completeinstallpath.cxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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. + * + ************************************************************************/ + +#define _WIN32_WINDOWS 0x0410 +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> + +#ifdef UNICODE +#define _UNICODE +#define _tstring wstring +#else +#define _tstring string +#endif +#include <tchar.h> +#include <string> + +using namespace std; + +namespace +{ + std::_tstring GetMsiProperty( MSIHANDLE handle, const std::_tstring& sProperty ) + { + std::_tstring result; + TCHAR szDummy[1] = TEXT(""); + DWORD nChars = 0; + + if ( MsiGetProperty( handle, sProperty.c_str(), szDummy, &nChars ) == ERROR_MORE_DATA ) + { + DWORD nBytes = ++nChars * sizeof(TCHAR); + LPTSTR buffer = reinterpret_cast<LPTSTR>(_alloca(nBytes)); + ZeroMemory( buffer, nBytes ); + MsiGetProperty(handle, sProperty.c_str(), buffer, &nChars); + result = buffer; + } + + return result; + } +} // namespace + +extern "C" UINT __stdcall CompleteInstallPath( MSIHANDLE handle ) +{ + // This CustomAction is necessary for updates from OOo 3.0, OOo 3.1 and OOo 3.2 to versions + // OOo 3.3 or later. This is caused by a change of INSTALLLOCATION, that starting with OOo 3.3 + // contains the name of the product again (instead of only "c:\program files"). Unfortunately + // this causes in an update installation, that INSTALLLOCATION is set to "c:\program files", + // so that in an OOo 3.3 or later, the directory "program" or "share" are directly created + // below "c:\program files". + + TCHAR szValue[8192]; + DWORD nValueSize = sizeof(szValue); + HKEY hKey; + std::_tstring sInstDir; + std::_tstring mystr; + + // Reading property OFFICEDIRHOSTNAME_, that contains the part of the path behind + // the program files folder. + + std::_tstring sInstallLocation = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); + std::_tstring sOfficeDirHostname = GetMsiProperty( handle, TEXT("OFFICEDIRHOSTNAME_") ); + + // If sInstallLocation ends with (contains) the string sOfficeDirHostname, + // INSTALLLOCATION is good and nothing has to be done here. + + bool pathCompletionRequired = true; + + if ( _tcsstr( sInstallLocation.c_str(), sOfficeDirHostname.c_str() ) ) + { + pathCompletionRequired = false; // nothing to do + // mystr = "Nothing to do, officedir is included into installlocation"; + // MessageBox( NULL, mystr.c_str(), "It is part of installlocation", MB_OK ); + } + + // If the path INSTALLLOCATION does not end with this string, INSTALLLOCATION is maybe + // transfered from an OOo 3.0, OOo 3.1 and OOo 3.2 and need to be changed therefore. + + if ( pathCompletionRequired ) + { + std::_tstring sManufacturer = GetMsiProperty( handle, TEXT("Manufacturer") ); + std::_tstring sDefinedName = GetMsiProperty( handle, TEXT("DEFINEDPRODUCT") ); + std::_tstring sUpgradeCode = GetMsiProperty( handle, TEXT("UpgradeCode") ); + + // sUpdateVersion can be "3.0", "3.1" or "3.2" + + std::_tstring sProductKey30 = "Software\\" + sManufacturer + "\\" + sDefinedName + + "\\" + "3.0" + "\\" + sUpgradeCode; + + std::_tstring sProductKey31 = "Software\\" + sManufacturer + "\\" + sDefinedName + + "\\" + "3.1" + "\\" + sUpgradeCode; + + std::_tstring sProductKey32 = "Software\\" + sManufacturer + "\\" + sDefinedName + + "\\" + "3.2" + "\\" + sUpgradeCode; + + // mystr = "ProductKey: " + sProductKey; + // MessageBox( NULL, mystr.c_str(), "ProductKey", MB_OK ); + + // mystr = "Checking registry"; + // MessageBox( NULL, mystr.c_str(), "registry search", MB_OK ); + + bool oldVersionExists = false; + + if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey30.c_str(), &hKey ) ) + { + oldVersionExists = true; + RegCloseKey( hKey ); + } + else if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey31.c_str(), &hKey ) ) + { + oldVersionExists = true; + RegCloseKey( hKey ); + } + else if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey32.c_str(), &hKey ) ) + { + oldVersionExists = true; + RegCloseKey( hKey ); + } + else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey30.c_str(), &hKey ) ) + { + oldVersionExists = true; + RegCloseKey( hKey ); + } + else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey31.c_str(), &hKey ) ) + { + oldVersionExists = true; + RegCloseKey( hKey ); + } + else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey32.c_str(), &hKey ) ) + { + oldVersionExists = true; + RegCloseKey( hKey ); + } + + if ( oldVersionExists ) + { + // Adding the new path content sOfficeDirHostname + sInstallLocation = sInstallLocation + sOfficeDirHostname; + // Setting the new property value + MsiSetProperty(handle, TEXT("INSTALLLOCATION"), sInstallLocation.c_str()); + // mystr = "Setting path to: " + sInstallLocation; + // MessageBox( NULL, mystr.c_str(), "sInstallLocation", MB_OK ); + } + } + + // mystr = "Ending with INSTALLLOCATION: " + sInstallLocation; + // MessageBox( NULL, mystr.c_str(), "END", MB_OK ); + + return ERROR_SUCCESS; +} diff --git a/setup_native/source/win32/customactions/shellextensions/exports.dxp b/setup_native/source/win32/customactions/shellextensions/exports.dxp index 8194ddc8b9c5..5826d339274a 100644 --- a/setup_native/source/win32/customactions/shellextensions/exports.dxp +++ b/setup_native/source/win32/customactions/shellextensions/exports.dxp @@ -5,6 +5,7 @@ DeinstallStartmenuFolderIcon SetProductInstallMode RebuildShellIconCache ExecutePostUninstallScript +CompleteInstallPath MigrateInstallPath RegisterExtensions RemoveExtensions diff --git a/setup_native/source/win32/customactions/shellextensions/makefile.mk b/setup_native/source/win32/customactions/shellextensions/makefile.mk index 220ac727b774..23fe24bb6ceb 100644 --- a/setup_native/source/win32/customactions/shellextensions/makefile.mk +++ b/setup_native/source/win32/customactions/shellextensions/makefile.mk @@ -58,6 +58,7 @@ SLOFILES = \ $(SLO)$/iconcache.obj \ $(SLO)$/postuninstall.obj \ $(SLO)$/migrateinstallpath.obj \ + $(SLO)$/completeinstallpath.obj \ $(SLO)$/checkdirectory.obj \ $(SLO)$/setadmininstall.obj \ $(SLO)$/layerlinks.obj \ |