diff options
author | sb <sb@openoffice.org> | 2010-05-20 15:46:46 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-05-20 15:46:46 +0200 |
commit | de97051d7f82dc7e870c9eaaf009c79609b9c82f (patch) | |
tree | cae26d891be5e705a0c2a7eb94a0e720c4d915b5 /extensions | |
parent | sb120: #i111333# disabled failing tests for now (diff) | |
parent | #i10000# fixed transplanted nativeb (diff) | |
download | core-de97051d7f82dc7e870c9eaaf009c79609b9c82f.tar.gz core-de97051d7f82dc7e870c9eaaf009c79609b9c82f.zip |
sb120: merged in DEV300_m78
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/activex/main/so_activex.cpp | 4 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/nsplugin.rc | 2 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/so_env.cxx | 132 | ||||
-rw-r--r-- | extensions/source/nsplugin/source/so_main.cxx | 2 | ||||
-rw-r--r-- | extensions/source/ole/oleobjw.cxx | 40 | ||||
-rw-r--r-- | extensions/source/ole/oleobjw.hxx | 1 |
6 files changed, 177 insertions, 4 deletions
diff --git a/extensions/source/activex/main/so_activex.cpp b/extensions/source/activex/main/so_activex.cpp index 9c10fadadb06..b5793f6c7274 100644 --- a/extensions/source/activex/main/so_activex.cpp +++ b/extensions/source/activex/main/so_activex.cpp @@ -44,8 +44,10 @@ const REGSAM n32KeyAccess = KEY_ALL_ACCESS; #ifdef _AMD64_ const BOOL bX64 = TRUE; +#define REG_DELETE_KEY_A( key, aPath, nKeyAccess ) RegDeleteKeyExA( key, aPath, nKeyAccess, 0 ) #else const BOOL bX64 = FALSE; +#define REG_DELETE_KEY_A( key, aPath, nKeyAccess ) RegDeleteKeyA( key, aPath ) #endif // 10.11.2009 tkr: MinGW doesn't know anything about RegDeleteKeyExA if WINVER < 0x0502. @@ -363,7 +365,7 @@ HRESULT DeleteKeyTree( HKEY hkey, const char* pPath, REGSAM nKeyAccess ) RegCloseKey( hkey1 ),hkey1= NULL; // delete the key itself - return RegDeleteKeyExA( hkey, pPath, nKeyAccess & ( KEY_WOW64_64KEY | KEY_WOW64_32KEY ), 0 ); + return REG_DELETE_KEY_A( hkey, pPath, nKeyAccess & ( KEY_WOW64_64KEY | KEY_WOW64_32KEY ) ); } STDAPI DllUnregisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess ) diff --git a/extensions/source/nsplugin/source/nsplugin.rc b/extensions/source/nsplugin/source/nsplugin.rc index a97db09665e0..7d4b60b5bdad 100644 --- a/extensions/source/nsplugin/source/nsplugin.rc +++ b/extensions/source/nsplugin/source/nsplugin.rc @@ -26,5 +26,5 @@ ************************************************************************/ #define ADDITIONAL_VERINFO1 value "FileExtents", "sdc|sds|sda|sdd|sdp|smf|vor|sgl|sdw|sxc|stc|sxd|std|sxi|sti|sxm|sxw|sxg|stw|odt|ott|odm|oth|ods|ots|odg|otg|odp|otp|odf\0"\ value "FileOpenName", "StarCalc 3.0 - 5.0|StarChart 3.0 - 5.0|StarDraw 3.0 - 5.0|StarImpress 3.0 - 5.0|StarImpress-packed 3.0 - 5.0|StarMath 3.0 - 5.0|StarWriter Template 3.0 - 5.0|StarWriter Global 3.0 - 5.0|StarWriter 3.0 - 5.0|StarOffice 6.0/7 Spreadsheet|StarOffice 6.0/7 Spreadsheet Template|StarOffice 6.0/7 Drawing|StarOffice 6.0/7 Drawing Template|StarOffice 6.0/7 Presentation|StarOffice 6.0/7 Presentation Template|StarOffice 6.0/7 Formula|StarOffice 6.0/7 Text Document|StarOffice 6.0/7 Master Document|StarOffice 6.0/7 Text Document Template|OpenDocument Text|OpenDocument Text Template|OpenDocument Master Document|HTML Document Template|OpenDocument Spreadsheet|OpenDocument Spreadsheet Template|OpenDocument Drawing|OpenDocument Drawing Template|OpenDocument Presentation|OpenDocument Presentation Template|OpenDocument Formula\0" -#define ADDITIONAL_VERINFO2 value "FileDescription", "StarOffice/StarSuite Plug-in handles all its documents" value "ProductName", "StarOffice/StarSuite Plug-in" value "MIMEType", "application/vnd.stardivision.calc|application/vnd.stardivision.chart|application/vnd.stardivision.draw|application/vnd.stardivision.impress|application/vnd.stardivision.impress-packed|application/vnd.stardivision.math|application/vnd.stardivision.writer|application/vnd.stardivision.writer-global|application/vnd.staroffice.writer|application/vnd.sun.xml.calc|application/vnd.sun.xml.calc.template|application/vnd.sun.xml.draw|application/vnd.sun.xml.draw.template|" +#define ADDITIONAL_VERINFO2 value "FileDescription", "Oracle Open Office Plug-in handles all its documents" value "ProductName", "Oracle Open Office Plug-in" value "MIMEType", "application/vnd.stardivision.calc|application/vnd.stardivision.chart|application/vnd.stardivision.draw|application/vnd.stardivision.impress|application/vnd.stardivision.impress-packed|application/vnd.stardivision.math|application/vnd.stardivision.writer|application/vnd.stardivision.writer-global|application/vnd.staroffice.writer|application/vnd.sun.xml.calc|application/vnd.sun.xml.calc.template|application/vnd.sun.xml.draw|application/vnd.sun.xml.draw.template|" #define ADDITIONAL_VERINFO3 "application/vnd.sun.xml.impress|application/vnd.sun.xml.impress.template|application/vnd.sun.xml.math|application/vnd.sun.xml.writer|application/vnd.sun.xml.writer.global|application/vnd.sun.xml.writer.template|application/vnd.oasis.opendocument.text|application/vnd.oasis.opendocument.text-template|application/vnd.oasis.opendocument.text-master|application/vnd.oasis.opendocument.text-web|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template|application/vnd.oasis.opendocument.graphics|application/vnd.oasis.opendocument.graphics-template|application/vnd.oasis.opendocument.presentation|application/vnd.oasis.opendocument.presentation-template|application/vnd.oasis.opendocument.formula\0" diff --git a/extensions/source/nsplugin/source/so_env.cxx b/extensions/source/nsplugin/source/so_env.cxx index 36a2b3f3abec..4cce0f98cd4f 100644 --- a/extensions/source/nsplugin/source/so_env.cxx +++ b/extensions/source/nsplugin/source/so_env.cxx @@ -31,6 +31,9 @@ #ifdef UNIX #include <sys/types.h> #include <strings.h> +#ifdef LINUX +#include <dlfcn.h> +#endif #include <stdarg.h> // For vsnprintf() #define NSP_vsnprintf vsnprintf @@ -119,6 +122,113 @@ restoreUTF8(char *pPath) return 0; } +#ifdef LINUX +extern int nspluginOOoModuleHook (void** aResult); +int nspluginOOoModuleHook (void** aResult) +{ + void *dl_handle; + + dl_handle = dlopen(NULL, RTLD_NOW); + if (!dl_handle) + { + fprintf (stderr, "Can't open myself '%s'\n", dlerror()); + return 1; + } + + Dl_info dl_info = { 0,0,0,0 }; + if(!dladdr((void *)nspluginOOoModuleHook, &dl_info)) + { + fprintf (stderr, "Can't find my own address '%s'\n", dlerror()); + return 1; + } + + if (!dl_info.dli_fname) + { + fprintf (stderr, "Can't find my own file name\n"); + return 1; + } + + char cwdstr[NPP_PATH_MAX]; + if (!getcwd (cwdstr, sizeof(cwdstr))) + { + fprintf (stderr, "Can't get cwd\n"); + return 1; + } + + char libFileName[NPP_PATH_MAX]; + + if (dl_info.dli_fname[0] != '/') + { + if ((strlen(cwdstr) + 1 + strlen(dl_info.dli_fname)) >= NPP_PATH_MAX) + { + fprintf (stderr, "Plugin path too long\n"); + return 1; + } + strcpy (libFileName, cwdstr); + strcat (libFileName, "/"); + strcat (libFileName, dl_info.dli_fname); + } + else + { + if (strlen(dl_info.dli_fname) >= NPP_PATH_MAX) + { + fprintf (stderr, "Plugin path too long\n"); + return 1; + } + strcpy (libFileName, dl_info.dli_fname); + } + + char *clobber; + static char realFileName[NPP_PATH_MAX] = {0}; +# define SEARCH_SUFFIX "/program/libnpsoplug" + + if (!(clobber = strstr (libFileName, SEARCH_SUFFIX))) + { + ssize_t len = readlink(libFileName, realFileName, NPP_PATH_MAX-1); + if (len == -1) + { + fprintf (stderr, "Couldn't read link '%s'\n", libFileName); + return 1; + } + realFileName[len] = '\0'; + if (!(clobber = strstr (realFileName, SEARCH_SUFFIX))) + { + fprintf (stderr, "Couldn't find suffix in '%s'\n", realFileName); + return 1; + } + *clobber = '\0'; + } + else + { + *clobber = '\0'; + strcpy (realFileName, libFileName); + } + + fprintf (stderr, "OpenOffice path before fixup is '%s'\n", realFileName); + + if (realFileName[0] != '/') { + /* a relative sym-link and we need to get an absolute path */ + char scratch[NPP_PATH_MAX] = {0}; + if (strlen (realFileName) + strlen (libFileName) + 2 >= NPP_PATH_MAX - 1) + { + fprintf (stderr, "Paths too long to fix up.\n"); + return 1; + } + strcpy (scratch, libFileName); + if (strrchr (scratch, '/')) /* remove the last element */ + *(strrchr (scratch, '/') + 1) = '\0'; + strcat (scratch, realFileName); + strcpy (realFileName, scratch); + } + + *aResult = realFileName; + + fprintf (stderr, "OpenOffice path is '%s'\n", realFileName); + + return 0; +} +#endif + // *aResult points the static string holding "/opt/staroffice8" int findReadSversion(void** aResult, int /*bWnt*/, const char* /*tag*/, const char* /*entry*/) { @@ -131,9 +241,29 @@ int findReadSversion(void** aResult, int /*bWnt*/, const char* /*tag*/, const ch // Filename of lnk file, eg. "soffice" char lnkFileName[NPP_PATH_MAX] = {0}; char* pTempZero = NULL; + +#ifdef LINUX + /* try to fetch a 'self' pointer */ + if (!nspluginOOoModuleHook (aResult)) + return 0; + + /* .. now in $HOME */ +#endif sprintf(lnkFileName, "%s/.mozilla/plugins/libnpsoplugin%s", getenv("HOME"), SAL_DLLEXTENSION); +#ifdef LINUX + ssize_t len = readlink(lnkFileName, realFileName, NPP_PATH_MAX-1); + if (-1 == len) + { + *realFileName = 0; + return -1; + } + realFileName[len] = '\0'; + + if (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION))) +#else if ((0 > readlink(lnkFileName, realFileName, NPP_PATH_MAX)) || - (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION)))) + (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION)))) +#endif { *realFileName = 0; return -1; diff --git a/extensions/source/nsplugin/source/so_main.cxx b/extensions/source/nsplugin/source/so_main.cxx index 7932f63d6d4d..c60da777689a 100644 --- a/extensions/source/nsplugin/source/so_main.cxx +++ b/extensions/source/nsplugin/source/so_main.cxx @@ -126,7 +126,7 @@ int find_free_node() return -1; } -int find_cur_node(sal_Int32 cur_id) +int find_cur_node(long cur_id) { for(int i=0; i<MAX_NODE_NUM; i++) { diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index 79baf3c7d8df..ea9377ccf596 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -422,6 +422,46 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName ) { o2u_attachCurrentThread(); ITypeInfo * pInfo = getTypeInfo(); + // I was going to implement an XServiceInfo interface to allow the type + // of the automation object to be exposed.. but it seems + // from looking at comments in the code that it is possible for + // this object to actually wrap an UNO object ( I guess if automation is + // used from MSO to create Openoffice objects ) Therefore, those objects + // will more than likely already have their own XServiceInfo interface. + // Instead here I chose a name that should be illegal both in COM and + // UNO ( from an IDL point of view ) therefore I think this is a safe + // hack + if ( aPropertyName.equals( rtl::OUString::createFromAscii("$GetTypeName") )) + { + if ( pInfo && m_sTypeName.getLength() == 0 ) + { + m_sTypeName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IDispatch") ); + CComBSTR sName; + + if ( SUCCEEDED( pInfo->GetDocumentation( -1, &sName, NULL, NULL, NULL ) ) ) + { + rtl::OUString sTmp( reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName))); + if ( sTmp.indexOf('_') == 0 ) + sTmp = sTmp.copy(1); + // do we own the memory for pTypeLib, msdn doco is vague + // I'll assume we do + CComPtr< ITypeLib > pTypeLib; + unsigned int index; + if ( SUCCEEDED( pInfo->GetContainingTypeLib( &pTypeLib.p, &index )) ) + { + if ( SUCCEEDED( pTypeLib->GetDocumentation( -1, &sName, NULL, NULL, NULL ) ) ) + { + rtl::OUString sLibName( reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName))); + m_sTypeName = sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sTmp ); + + } + } + } + + } + ret <<= m_sTypeName; + return ret; + } FuncDesc aDescGet(pInfo); FuncDesc aDescPut(pInfo); VarDesc aVarDesc(pInfo); diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx index 6d46452eb088..230de2b7dcf8 100644 --- a/extensions/source/ole/oleobjw.hxx +++ b/extensions/source/ole/oleobjw.hxx @@ -234,6 +234,7 @@ protected: Sequence<Type> m_seqTypes; CComPtr<IUnknown> m_spUnknown; CComPtr<IDispatch> m_spDispatch; + rtl::OUString m_sTypeName; // is "" ( not initialised ), "IDispatch" ( we have no idea ) or "SomeLibrary.SomeTypeName" if we managed to get a type /** This value is set dureing XInitialization::initialize. It indicates that the COM interface was transported as VT_DISPATCH in a VARIANT rather then a VT_UNKNOWN */ |