summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2016-01-19 10:58:07 +0100
committerOliver Specht <oliver.specht@cib.de>2016-01-19 14:39:24 +0000
commit442a022cf7baefbd5519ea55c7978cf839e1f44d (patch)
treeb847bc44a14988bb4f6252e8bfa9e4cf22e67bdd /include
parent802564e036db1ee3df8b19593b7f9f1be0deec54 (diff)
Make LibreOffice kit usable on windows
Uses Ascii variants of LoadLibrary,Get/SetEnvironmentVariable_A_ and adds a freeError function includes windows.h instead of pre/postwin.h Change-Id: I88b7e3ed3818078efec5688e207da47dc4049b98 Reviewed-on: https://gerrit.libreoffice.org/21600 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Diffstat (limited to 'include')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h2
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx9
-rw-r--r--include/LibreOfficeKit/LibreOfficeKitInit.h18
3 files changed, 20 insertions, 9 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 7d4210e5f43b..8057d75ccc50 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -51,6 +51,7 @@ struct _LibreOfficeKitClass
const char* pURL);
char* (*getError) (LibreOfficeKit* pThis);
+ void (*freeError) (const char *pfree);
LibreOfficeKitDocument* (*documentLoadWithOptions) (LibreOfficeKit* pThis,
const char* pURL,
@@ -82,6 +83,7 @@ struct _LibreOfficeKitDocumentClass
const char* pUrl,
const char* pFormat,
const char* pFilterOptions);
+ void (*freeError) (const char *pfree);
#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
/// @see lok::Document::getDocumentType().
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 9396f1e39bc7..5623fad8c0e2 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -56,6 +56,10 @@ public:
/// Gives access to the underlying C pointer.
inline LibreOfficeKitDocument *get() { return mpDoc; }
+ inline void freeError(const char *pfree)
+ {
+ mpDoc->pClass->freeError(pfree);
+ }
#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
/**
@@ -434,6 +438,11 @@ public:
{
return mpThis->pClass->getError(mpThis);
}
+ inline void freeError(const char *pfree)
+ {
+ mpThis->pClass->freeError(pfree);
+ }
+
#if defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
/**
diff --git a/include/LibreOfficeKit/LibreOfficeKitInit.h b/include/LibreOfficeKit/LibreOfficeKitInit.h
index 880f11e2391e..23e5772a2e79 100644
--- a/include/LibreOfficeKit/LibreOfficeKitInit.h
+++ b/include/LibreOfficeKit/LibreOfficeKitInit.h
@@ -76,8 +76,7 @@ extern "C"
#else
- #include "prewin.h"
- #include "postwin.h"
+ #include <windows.h>
#define TARGET_LIB "sofficeapp" ".dll"
#define TARGET_MERGED_LIB "mergedlo" ".dll"
#define SEPARATOR '\\'
@@ -85,7 +84,7 @@ extern "C"
void *lok_loadlib(const char *pFN)
{
- return (void *) LoadLibrary(pFN);
+ return (void *) LoadLibraryA(pFN);
}
char *lok_dlerror(void)
@@ -111,11 +110,11 @@ extern "C"
return;
char* sEnvPath = NULL;
- DWORD cChars = GetEnvironmentVariable("PATH", sEnvPath, 0);
+ DWORD cChars = GetEnvironmentVariableA("PATH", sEnvPath, 0);
if (cChars > 0)
{
sEnvPath = new char[cChars];
- cChars = GetEnvironmentVariable("PATH", sEnvPath, cChars);
+ cChars = GetEnvironmentVariableA("PATH", sEnvPath, cChars);
//If PATH is not set then it is no error
if (cChars == 0 && GetLastError() != ERROR_ENVVAR_NOT_FOUND)
{
@@ -125,17 +124,18 @@ extern "C"
}
//prepare the new PATH. Add the Ure/bin directory at the front.
//note also adding ';'
- char * sNewPath = new char[strlen(sEnvPath) + strlen(pPath) + strlen(UNOPATH) + 2];
+ char * sNewPath = new char[strlen(sEnvPath) + strlen(pPath) * 2 + strlen(UNOPATH) + 4];
sNewPath[0] = L'\0';
- strcat(sNewPath, pPath);
- strcat(sNewPath, UNOPATH);
+ strcat(sNewPath, pPath); // program to PATH
+ strcat(sNewPath, ";");
+ strcat(sNewPath, UNOPATH); // UNO to PATH
if (strlen(sEnvPath))
{
strcat(sNewPath, ";");
strcat(sNewPath, sEnvPath);
}
- SetEnvironmentVariable("PATH", sNewPath);
+ SetEnvironmentVariableA("PATH", sNewPath);
delete[] sEnvPath;
delete[] sNewPath;