Changeset 2190

Show
Ignore:
Timestamp:
07/06/08 01:49:50 (5 months ago)
Author:
mdcurran
Message:

Put back support for reading embedded objects in some richEdit fields (e.g. Outlook Express and Windows Mail). The code was accidentily removed in r2176. Also reverted r2182 which disabled it to stop errors.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/source/NVDAObjects/IAccessible/edit.py

    r2182 r2190  
    275275                return winUser.sendMessage(self.obj.windowHandle,EM_GETLINECOUNT,0,0) 
    276276 
     277        def _getTextRangeWithEmbeddedObjects(self,start,end): 
     278                ptr=ctypes.POINTER(comInterfaces.tom.ITextDocument)() 
     279                ctypes.windll.oleacc.AccessibleObjectFromWindow(self.obj.windowHandle,-16,ctypes.byref(ptr._iid_),ctypes.byref(ptr)) 
     280                r=ptr.Range(self._startOffset,self._endOffset) 
     281                bufText=r.text 
     282                if bufText is None: 
     283                        bufText="" 
     284                newTextList=[] 
     285                for offset in range(len(bufText)): 
     286                        if ord(bufText[offset])==0xfffc: 
     287                                embedRange=ptr.Range(start+offset,start+offset) 
     288                                o=embedRange.GetEmbeddedObject() 
     289                                o=o.QueryInterface(oleTypes.IOleObject) 
     290                                dataObj=o.GetClipboardData(0) 
     291                                dataObj=pythoncom._univgw.interface(hash(dataObj),pythoncom.IID_IDataObject) 
     292                                format=(win32clipboard.CF_UNICODETEXT, None, pythoncom.DVASPECT_CONTENT, -1, pythoncom.TYMED_HGLOBAL) 
     293                                medium=dataObj.GetData(format) 
     294                                buf=ctypes.create_string_buffer(medium.data) 
     295                                buf=ctypes.cast(buf,ctypes.c_wchar_p) 
     296                                newTextList.append(buf.value) 
     297                        else: 
     298                                newTextList.append(bufText[offset]) 
     299                return "".join(newTextList) 
     300 
    277301        def _getTextRange(self,start,end): 
    278302                if self.obj.editAPIVersion>=2: 
     303                        if self.obj.editAPIHasITextDocument: 
     304                                return self._getTextRangeWithEmbeddedObjects(start,end) 
    279305                        bufLen=((end-start)+1)*2 
    280306                        if self.obj.isWindowUnicode: