diff --git a/nvdaHelper/interfaces/nvdaInProcUtils/nvdaInProcUtils.idl b/nvdaHelper/interfaces/nvdaInProcUtils/nvdaInProcUtils.idl index c5840d1f326..8531f9b5bf8 100644 --- a/nvdaHelper/interfaces/nvdaInProcUtils/nvdaInProcUtils.idl +++ b/nvdaHelper/interfaces/nvdaInProcUtils/nvdaInProcUtils.idl @@ -83,6 +83,6 @@ interface NvdaInProcUtils { */ error_status_t outlook_getMAPIProp(const long threadID, [in] IUnknown* mapiObject, const unsigned long mapiPropTag, [out] VARIANT* val); - error_status_t excel_getCellInfos([in] const unsigned long windowHandle,[in] IDispatch* rangeObj, [in] long cellInfoFlags, [in] long cellCount, [out,size_is(cellCount)] EXCEL_CELLINFO* cellInfos, [out] long* numCellsFetched); + error_status_t excel_getCellInfos([in] const unsigned long windowHandle,[in] BSTR rangeAddress, [in] long cellInfoFlags, [in] long cellCount, [out,size_is(cellCount)] EXCEL_CELLINFO* cellInfos, [out] long* numCellsFetched); } diff --git a/nvdaHelper/remote/excel.cpp b/nvdaHelper/remote/excel.cpp index 5144850b956..5ca0c417783 100644 --- a/nvdaHelper/remote/excel.cpp +++ b/nvdaHelper/remote/excel.cpp @@ -16,8 +16,8 @@ This license can be found at: #include #include #include +#include #include -#include #include "inProcess.h" #include "nvdaInProcUtils.h" #include "excel/constants.h" @@ -450,21 +450,32 @@ HRESULT getCellInfo(HWND hwnd, IDispatch* pDispatchRange, long cellInfoFlags, EX return RPC_S_OK; } -error_status_t nvdaInProcUtils_excel_getCellInfos(handle_t bindingHandle, const unsigned long windowHandle, IDispatch* arg_pDispatchRange, long cellInfoFlags, long cellCount, EXCEL_CELLINFO* cellInfos, long* numCellsFetched) { - HWND hwnd=static_cast(UlongToHandle(windowHandle)); - long threadID=GetWindowThreadProcessId(hwnd,nullptr); - nvCOMUtils::InterfaceMarshaller im; - HRESULT res=im.marshal(arg_pDispatchRange); - if(FAILED(res)) { - LOG_ERROR(L"Failed to marshal range object from rpc thread"); +error_status_t nvdaInProcUtils_excel_getCellInfos(handle_t bindingHandle, const unsigned long windowHandle, BSTR arg_rangeAddress, long cellInfoFlags, long cellCount, EXCEL_CELLINFO* cellInfos, long* numCellsFetched) { + if(!arg_rangeAddress) { + LOG_ERROR(L"rangeAddress is NULL"); return E_UNEXPECTED; } + HWND hwnd=static_cast(UlongToHandle(windowHandle)); + long threadID=GetWindowThreadProcessId(hwnd,nullptr); // Execute the following code in Excel's GUI thread. execInThread(threadID,[&](){ - // Unmarshal the IDispatch pointer from the COM global interface table. - CComPtr pDispatchRange=im.unmarshal(); - if(!pDispatchRange) { - LOG_ERROR(L"Failed to unmarshal range object into Excel GUI thread"); + // Fetch the Excel object model and create a range object for the given range address. + CComPtr pDispatchWindow=nullptr; + HRESULT res=AccessibleObjectFromWindow(hwnd,OBJID_NATIVEOM,IID_IDispatch,reinterpret_cast(&pDispatchWindow)); + if(res!=S_OK||!pDispatchWindow) { + LOG_ERROR(L"AccessibleObjectFromWindow failed. Code "< pDispatchApplication=nullptr; + res=_com_dispatch_raw_propget(pDispatchWindow,XLDISPID_WINDOW_APPLICATION,VT_DISPATCH,&pDispatchApplication); + if(res!=S_OK||!pDispatchApplication) { + LOG_ERROR(L"window.application failed. Code "< pDispatchRange=nullptr; + res=_com_dispatch_raw_method(pDispatchApplication,XLDISPID_APPLICATION_RANGE,DISPATCH_PROPERTYGET,VT_DISPATCH,&pDispatchRange,L"\x008",arg_rangeAddress); + if(res!=S_OK||!pDispatchRange) { + LOG_ERROR(L"application.range failed. Code "< GeckoVBufBackend_t::getSelectedItem( IAccessible2* container, const map& attribs ) { if (this->toolkitName.compare(L"Chrome") == 0) { - const auto attribsIt = attribs.find(L"tag"); - if (attribsIt != attribs.end() && - attribsIt->second.compare(L"select") == 0) { - // In a