summaryrefslogtreecommitdiff
path: root/extensions/source/nsplugin
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2004-11-26 15:01:41 +0000
committerKurt Zenker <kz@openoffice.org>2004-11-26 15:01:41 +0000
commitd29e5c0afc7c5f0e0393ad737b1bfad1183ec21b (patch)
tree78dcef3136d72fb50c2acf7917a11d141685e3ea /extensions/source/nsplugin
parent485377ba0c7e13790a69821d5efb44747397c6ba (diff)
INTEGRATION: CWS nsplugin3 (1.2.32); FILE MERGED
2004/11/12 07:29:40 jmeng 1.2.32.5: change the display name from StarOffice to StarOffice/StarSuite 2004/11/12 03:22:45 jmeng 1.2.32.4: change Plugin to Plug-in 2004/11/12 02:05:36 jmeng 1.2.32.3: change product name from StarOffce to StarOffice/StarSuite 2004/10/12 03:40:58 rchen 1.2.32.2: for compile in windows 2004/10/12 03:10:22 jmeng 1.2.32.1: add dynamic OpenOffice.org / StarOffice support
Diffstat (limited to 'extensions/source/nsplugin')
-rw-r--r--extensions/source/nsplugin/source/so_env.cxx78
1 files changed, 76 insertions, 2 deletions
diff --git a/extensions/source/nsplugin/source/so_env.cxx b/extensions/source/nsplugin/source/so_env.cxx
index 1e18a862551b..375e65535a8a 100644
--- a/extensions/source/nsplugin/source/so_env.cxx
+++ b/extensions/source/nsplugin/source/so_env.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: so_env.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: rt $ $Date: 2004-08-20 10:08:00 $
+ * last change: $Author: kz $ $Date: 2004-11-26 16:01:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,6 +69,7 @@
#endif
// For vsnprintf()
#define NSP_vsnprintf vsnprintf
+#include "nsp_func.hxx"
#endif // End UNIX
#ifdef WNT
@@ -88,6 +89,8 @@
#include "so_env.hxx"
#include "ns_debug.hxx"
+#define PLUGIN_NAME "OpenOffice.org"
+
// Tranform all strings like %20 in pPath to one char like space
/*int retoreUTF8(char* pPath)
{
@@ -313,6 +316,77 @@ int UnixToDosPath(char* sPath)
}
+#ifdef UNIX
+char productName[128] = {0};
+char* NSP_getProductName()
+{
+ if(productName[0])
+ return productName;
+ char fullBootstrapIniPath[1024] = {0};
+ const char* pFullFilePath = findProgramDir();
+ if(0 == *pFullFilePath)
+ {
+ strcpy(productName, PLUGIN_NAME);
+ return productName;
+ }
+ sprintf(fullBootstrapIniPath, "%s/%s", pFullFilePath,
+ "bootstraprc");
+
+ FILE* fp = fopen(fullBootstrapIniPath, "r");
+
+ if (NULL == fp)
+ {
+ strcpy(productName, PLUGIN_NAME);
+ return productName;
+ }
+ char line[4096] = {0};
+ char *pStart = 0;
+ char *pEnd = 0;
+ while(!feof(fp))
+ {
+ fgets( line, sizeof(line), fp );
+ if (NULL == (pStart = strstr( line, "ProductKey=" )))
+ continue;
+ pStart += strlen("ProductKey=");
+ if (NULL == (pEnd = strchr( pStart, ' ' )) &&
+ (NULL == (pEnd = strchr( pStart, '\r' ))))
+ continue;
+ *pEnd = 0;
+ strcpy(productName, pStart);
+ }
+ fclose(fp);
+ if ((*productName == 0) ||
+ (0 != STRNICMP(productName, "StarOffice", sizeof("StarOffice"))))
+ {
+ strcpy(productName, PLUGIN_NAME);
+ return productName;
+ }
+ memset(productName, 0, sizeof(productName));
+ strcat(productName, "StarOffice/StarSuite");
+ return productName;
+}
+
+char PluginName[1024] = {0};
+char* NSP_getPluginName()
+{
+ if(*PluginName)
+ return PluginName;
+ sprintf(PluginName, "%s Plug-in", NSP_getProductName());
+ return PluginName;
+}
+
+char PluginDesc[1024] = {0};
+char* NSP_getPluginDesc()
+{
+ if(*PluginDesc)
+ return PluginDesc;
+
+ sprintf(PluginDesc, "%s Plug-in handles all its documents",
+ productName);
+ return PluginDesc;
+}
+#endif //end of UNIX
+
void NSP_WriteLog(int level, const char* pFormat, ...)
{
#ifdef DEBUG