Kaydet (Commit) 3de2e8a3 authored tarafından Mike Kaganski's avatar Mike Kaganski Kaydeden (comit) Tor Lillqvist

tdf#103058: Implement OpenDocuments ActiveX control

Change-Id: I97489090476cd884a122a4b36d3ac62ca86fd886
Reviewed-on: https://gerrit.libreoffice.org/29608Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTor Lillqvist <tml@collabora.com>
üst 75f118da
......@@ -659,6 +659,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,activexbina
$(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,activex, \
$(if $(DISABLE_ACTIVEX),,\
so_activex \
spsupp \
) \
))
......@@ -666,6 +667,7 @@ ifneq ($(BUILD_X64),)
$(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,activexwin64, \
$(if $(DISABLE_ACTIVEX),,\
so_activex_x64 \
spsupp_x64 \
) \
))
endif
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_CustomTarget_CustomTarget,shell/source/win32/spsupp/idl))
spsupp_IDLDIR := $(call gb_CustomTarget_get_workdir,shell/source/win32/spsupp/idl)
$(call gb_CustomTarget_get_target,shell/source/win32/spsupp/idl) : \
$(spsupp_IDLDIR)/spsupp.tlb
$(spsupp_IDLDIR)/spsupp.tlb : \
$(SRCDIR)/shell/source/win32/spsupp/spsupp.idl \
| $(spsupp_IDLDIR)/.dir
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),IDL,1)
$(call gb_Helper_abbreviate_dirs, \
midl.exe \
-tlb $@ \
-h $(spsupp_IDLDIR)/spsupp_h.h \
-iid $(spsupp_IDLDIR)/spsupp_i.c \
$(INCLUDE) \
$(SOLARINC) \
-Oicf \
$<)
# vim:set shiftwidth=4 tabstop=4 noexpandtab:
......@@ -44,6 +44,12 @@ SHELL_PROPERTYHDL_FILES := \
SHELL_XMLPARSER_FILES := \
all/xml_parser
SHELL_SPSUPP_FILES := \
win32/spsupp/COMOpenDocuments \
win32/spsupp/registrar \
win32/spsupp/spsuppClassFactory \
win32/spsupp/spsuppServ
SHELL_HEADERS := \
win32/ooofilereader/autostyletag \
win32/ooofilereader/dummytag \
......@@ -58,7 +64,7 @@ SHELL_HEADERS := \
win32/zipfile/zipexcptn
$(call gb_CustomTarget_get_target,shell/source) : \
$(foreach source,$(SHELL_SHLXTHANDLER_COMMON_FILES) $(SHELL_SHLXTHDL_FILES) $(SHELL_OOOFILT_FILES) $(SHELL_PROPERTYHDL_FILES) $(SHELL_XMLPARSER_FILES),\
$(foreach source,$(SHELL_SHLXTHANDLER_COMMON_FILES) $(SHELL_SHLXTHDL_FILES) $(SHELL_OOOFILT_FILES) $(SHELL_PROPERTYHDL_FILES) $(SHELL_XMLPARSER_FILES) $(SHELL_SPSUPP_FILES),\
$(call gb_CustomTarget_get_workdir,shell/source)/$(source).cxx) \
$(foreach header,$(SHELL_HEADERS),\
$(call gb_CustomTarget_get_workdir,shell/source)/$(header).hxx)
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Library_Library,spsupp))
$(eval $(call gb_Library_use_custom_headers,spsupp,\
shell/source/win32/spsupp/idl \
))
$(eval $(call gb_Library_set_include,spsupp,\
-I$(SRCDIR)/shell/inc/spsupp \
$$(INCLUDE) \
))
$(eval $(call gb_Library_add_defs,spsupp,\
-DUNICODE \
-D_UNICODE \
))
$(eval $(call gb_Library_use_system_win32_libs,spsupp,\
advapi32 \
kernel32 \
ole32 \
oleaut32 \
user32 \
))
$(eval $(call gb_Library_add_nativeres,spsupp,spsupp))
$(eval $(call gb_Library_add_ldflags,spsupp,\
/DEF:$(SRCDIR)/shell/source/win32/spsupp/spsupp.def \
))
$(eval $(call gb_Library_add_exception_objects,spsupp,\
shell/source/win32/spsupp/COMOpenDocuments \
shell/source/win32/spsupp/registrar \
shell/source/win32/spsupp/spsuppClassFactory \
shell/source/win32/spsupp/spsuppServ \
))
# vim: set shiftwidth=4 tabstop=4 noexpandtab:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_Library_Library,spsupp_x64))
$(eval $(call gb_Library_set_x64,spsupp_x64,YES))
$(eval $(call gb_Library_use_custom_headers,spsupp_x64,\
shell/source \
shell/source/win32/spsupp/idl \
))
$(eval $(call gb_Library_set_include,spsupp_x64,\
-I$(SRCDIR)/shell/inc/spsupp \
$$(INCLUDE) \
))
$(eval $(call gb_Library_add_defs,spsupp_x64,\
-DUNICODE \
-D_UNICODE \
))
$(eval $(call gb_Library_use_system_win32_libs,spsupp_x64,\
advapi32 \
kernel32 \
ole32 \
oleaut32 \
user32 \
))
$(eval $(call gb_Library_add_nativeres,spsupp_x64,spsupp))
$(eval $(call gb_Library_add_ldflags,spsupp_x64,\
/DEF:$(SRCDIR)/shell/source/win32/spsupp/spsupp.def \
))
$(eval $(call gb_Library_add_x64_generated_exception_objects,spsupp_x64,\
CustomTarget/shell/source/win32/spsupp/COMOpenDocuments \
CustomTarget/shell/source/win32/spsupp/registrar \
CustomTarget/shell/source/win32/spsupp/spsuppClassFactory \
CustomTarget/shell/source/win32/spsupp/spsuppServ \
))
# vim: set shiftwidth=4 tabstop=4 noexpandtab:
......@@ -61,6 +61,9 @@ $(eval $(call gb_Module_add_targets,shell,\
StaticLibrary_shlxthandler_common \
StaticLibrary_xmlparser \
WinResTarget_shlxthdl \
CustomTarget_spsupp_idl \
Library_spsupp \
WinResTarget_spsupp \
))
$(eval $(call gb_Module_add_check_targets,shell,\
......@@ -76,6 +79,7 @@ $(eval $(call gb_Module_add_targets,shell,\
Library_shlxthdl_x64 \
StaticLibrary_shlxthandler_common_x64 \
StaticLibrary_xmlparser_x64 \
Library_spsupp_x64 \
))
endif
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
$(eval $(call gb_WinResTarget_WinResTarget,spsupp))
$(eval $(call gb_WinResTarget_use_custom_headers,spsupp,\
shell/source/win32/spsupp/idl \
))
$(eval $(call gb_WinResTarget_add_defs,spsupp,\
-DTLB_FILE=\"$(call gb_CustomTarget_get_workdir,shell/source/win32/spsupp/idl)/spsupp.tlb\" \
))
$(eval $(call gb_WinResTarget_set_rcfile,spsupp,shell/source/win32/spsupp/res/spsupp))
# vim: set shiftwidth=4 tabstop=4 noexpandtab:
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef _COMOPENDOCUMENTS_HPP_
#define _COMOPENDOCUMENTS_HPP_
#include "spsupp_h.h"
#include "COMRefCounted.hpp"
#include "Objsafe.h"
#include "assert.h"
class COMOpenDocuments : public COMRefCounted<IOWSNewDocument3>
{
public:
class Error {
public:
Error(HRESULT syserr) : m_nErr(syserr) {}
HRESULT val() const { return m_nErr; }
private:
HRESULT m_nErr;
};
COMOpenDocuments();
virtual ~COMOpenDocuments();
// IUnknown methods
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void **ppvObject) override;
// IDispatch methods
HRESULT STDMETHODCALLTYPE GetTypeInfoCount(
UINT *pctinfo) override;
HRESULT STDMETHODCALLTYPE GetTypeInfo(
UINT iTInfo,
LCID lcid,
ITypeInfo **ppTInfo) override;
HRESULT STDMETHODCALLTYPE GetIDsOfNames(
REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
DISPID *rgDispId) override;
HRESULT STDMETHODCALLTYPE Invoke(
DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
UINT *puArgErr) override;
// IOWSNewDocument methods https://msdn.microsoft.com/en-us/library/cc264316
HRESULT STDMETHODCALLTYPE CreateNewDocument(
BSTR bstrTemplateLocation,
BSTR bstrDefaultSaveLocation,
VARIANT_BOOL *pbResult) override;
HRESULT STDMETHODCALLTYPE EditDocument(
BSTR bstrDocumentLocation,
VARIANT varProgID,
VARIANT_BOOL *pbResult) override;
// IOWSNewDocument2 methods
HRESULT STDMETHODCALLTYPE ViewDocument(
BSTR bstrDocumentLocation,
VARIANT varProgID,
VARIANT_BOOL *pbResult) override;
HRESULT STDMETHODCALLTYPE ViewDocument2(
IDispatch *pdisp,
BSTR bstrDocumentLocation,
VARIANT varProgID,
VARIANT_BOOL *pbResult) override;
HRESULT STDMETHODCALLTYPE EditDocument2(
IDispatch *pdisp,
BSTR bstrDocumentLocation,
VARIANT varProgID,
VARIANT_BOOL *pbResult) override;
HRESULT STDMETHODCALLTYPE CreateNewDocument2(
IDispatch *pdisp,
BSTR bstrTemplateLocation,
BSTR bstrDefaultSaveLocation,
VARIANT_BOOL *pbResult) override;
HRESULT STDMETHODCALLTYPE PromptedOnLastOpen(
VARIANT_BOOL *pbResult) override;
// IOWSNewDocument3 methods
HRESULT STDMETHODCALLTYPE ViewDocument3(
IDispatch *pdisp,
BSTR bstrDocumentLocation,
int OpenType,
VARIANT varProgID,
VARIANT_BOOL *pbResult) override;
HRESULT STDMETHODCALLTYPE CheckinDocument(
BSTR bstrDocumentLocation,
int CheckinType,
BSTR CheckinComment,
VARIANT_BOOL bKeepCheckout,
VARIANT_BOOL *pbResult) override;
HRESULT STDMETHODCALLTYPE DiscardLocalCheckout(
BSTR bstrDocumentLocationRaw,
VARIANT_BOOL *pbResult) override;
HRESULT STDMETHODCALLTYPE ViewInExcel(
BSTR SiteUrl,
BSTR FileName,
BSTR SessionId,
BSTR Cmd,
BSTR Sheet,
int Row,
int Column,
VARIANT varProgID) override;
HRESULT STDMETHODCALLTYPE CheckoutDocumentPrompt(
BSTR bstrDocumentLocationRaw,
VARIANT_BOOL fEditAfterCheckout,
VARIANT varProgID,
VARIANT_BOOL *pbResult) override;
HRESULT STDMETHODCALLTYPE EditDocument3(
IDispatch *pdisp,
BSTR bstrDocumentLocation,
VARIANT_BOOL fUseLocalCopy,
VARIANT varProgID,
VARIANT_BOOL *pbResult) override;
HRESULT STDMETHODCALLTYPE NewBlogPost(
BSTR bstrProviderId,
BSTR bstrBlogUrl,
BSTR bstrBlogName) override;
// Non-COM methods
static long GetObjectCount();
private:
//Aggregated object
class COMObjectSafety : public IObjectSafety
{
public:
COMObjectSafety(IUnknown* pOwner) : m_pOwner(pOwner) { assert(m_pOwner); }
virtual ~COMObjectSafety() {}
// IUnknown members delegate to the outer unknown
// IUnknown members do not control lifetime of object
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void **ppvObject) override
{
return m_pOwner->QueryInterface(riid, ppvObject);
}
ULONG STDMETHODCALLTYPE AddRef() override { return m_pOwner->AddRef(); }
ULONG STDMETHODCALLTYPE Release() override { return m_pOwner->Release(); }
// IObjectSafety methods
HRESULT STDMETHODCALLTYPE GetInterfaceSafetyOptions(
REFIID riid,
DWORD *pdwSupportedOptions,