summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-05-14 19:15:59 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2019-06-19 17:26:19 +0200
commita0d0fb29cd13113be614050987e70889e98912b7 (patch)
treeb5dcb37a9437cd68262b0f7bfe7e9982f649e2b5 /shell
parent14a31bd4e39672187c95a37e0f6535643d3da04b (diff)
Use proper VARIANT_BOOL values: VARIANT_TRUE is actually -1
Who was that idiot who initially used wrong values??? Hmm... oh damn, that was me :-( Change-Id: I3bfde7511bcf8adfa38ae68372f21511f21efca1 Reviewed-on: https://gerrit.libreoffice.org/72308 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 31cc28ca7c02f28b64e9d757c9fc17e2a81ba352) Reviewed-on: https://gerrit.libreoffice.org/74363
Diffstat (limited to 'shell')
-rw-r--r--shell/source/win32/spsupp/COMOpenDocuments.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/shell/source/win32/spsupp/COMOpenDocuments.cxx b/shell/source/win32/spsupp/COMOpenDocuments.cxx
index 319cd8c1751a..4d00b8de6c46 100644
--- a/shell/source/win32/spsupp/COMOpenDocuments.cxx
+++ b/shell/source/win32/spsupp/COMOpenDocuments.cxx
@@ -16,8 +16,11 @@
#include <spsuppServ.hpp>
#include <stdio.h>
+namespace
+{
+
// Display confirmation dialog, return false on negative answer
-static bool SecurityWarning(const wchar_t* sProgram, const wchar_t* sDocument)
+bool SecurityWarning(const wchar_t* sProgram, const wchar_t* sDocument)
{
// TODO: change wording (currently taken from MS Office), use LO localization
wchar_t sBuf[65536];
@@ -30,7 +33,7 @@ static bool SecurityWarning(const wchar_t* sProgram, const wchar_t* sDocument)
}
// Returns S_OK if successful
-static HRESULT LOStart(const wchar_t* sModeArg, const wchar_t* sFilePath, bool bDoSecurityWarning)
+HRESULT LOStart(const wchar_t* sModeArg, const wchar_t* sFilePath, bool bDoSecurityWarning)
{
const wchar_t* sProgram = GetLOPath();
if (bDoSecurityWarning && !SecurityWarning(sProgram, sFilePath))
@@ -76,6 +79,10 @@ static HRESULT LOStart(const wchar_t* sModeArg, const wchar_t* sFilePath, bool b
return S_OK;
}
+VARIANT_BOOL toVBool(bool b) { return b ? VARIANT_TRUE : VARIANT_FALSE; }
+
+} // namespace
+
// IObjectSafety methods
void COMOpenDocuments::COMObjectSafety::SetMaskedOptions(DWORD iMask, DWORD iOptions)
@@ -309,7 +316,7 @@ STDMETHODIMP COMOpenDocuments::CreateNewDocument2(
{
// TODO: resolve the program from varProgID (nullptr -> default?)
HRESULT hr = LOStart(L"-n", bstrTemplateLocation, m_aObjectSafety.GetSafe_forUntrustedCaller() || m_aObjectSafety.GetSafe_forUntrustedData());
- *pbResult = VARIANT_BOOL(SUCCEEDED(hr));
+ *pbResult = toVBool(SUCCEEDED(hr));
return hr;
}
@@ -360,7 +367,7 @@ STDMETHODIMP COMOpenDocuments::ViewDocument3(
{
// TODO: resolve the program from varProgID (nullptr -> default?)
HRESULT hr = LOStart(L"--view", bstrDocumentLocation, m_aObjectSafety.GetSafe_forUntrustedCaller() || m_aObjectSafety.GetSafe_forUntrustedData());
- *pbResult = VARIANT_BOOL(SUCCEEDED(hr));
+ *pbResult = toVBool(SUCCEEDED(hr));
return hr;
}
@@ -422,7 +429,7 @@ STDMETHODIMP COMOpenDocuments::EditDocument3(
{
// TODO: resolve the program from varProgID (nullptr -> default?)
HRESULT hr = LOStart(L"-o", bstrDocumentLocation, m_aObjectSafety.GetSafe_forUntrustedCaller() || m_aObjectSafety.GetSafe_forUntrustedData());
- *pbResult = VARIANT_BOOL(SUCCEEDED(hr));
+ *pbResult = toVBool(SUCCEEDED(hr));
return hr;
}