1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright IBM Corporation 2010. 6 * Copyright 2000, 2010 Oracle and/or its affiliates. 7 * 8 * OpenOffice.org - a multi-platform office productivity suite 9 * 10 * This file is part of OpenOffice.org. 11 * 12 * OpenOffice.org is free software: you can redistribute it and/or modify 13 * it under the terms of the GNU Lesser General Public License version 3 14 * only, as published by the Free Software Foundation. 15 * 16 * OpenOffice.org is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License version 3 for more details 20 * (a copy is included in the LICENSE file that accompanied this code). 21 * 22 * You should have received a copy of the GNU Lesser General Public License 23 * version 3 along with OpenOffice.org. If not, see 24 * <http://www.openoffice.org/license.html> 25 * for a copy of the LGPLv3 License. 26 * 27 ************************************************************************/ 28 29 #if !defined(AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_) 30 #define AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_ 31 32 #if _MSC_VER > 1000 33 #pragma once 34 #endif // _MSC_VER > 1000 35 36 #include "resource.h" 37 #include <com/sun/star/uno/reference.hxx> 38 #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> 39 #include "UNOXWrapper.h" 40 41 /** 42 * CAccEditableText implements IAccessibleEditableText interface. 43 */ 44 class CAccEditableText : 45 public CComObjectRoot, 46 public CComCoClass<CAccEditableText,&CLSID_AccEditableText>, 47 public IAccessibleEditableText, 48 public CUNOXWrapper 49 { 50 public: 51 CAccEditableText() 52 { 53 54 } 55 virtual ~CAccEditableText() 56 { 57 58 } 59 60 BEGIN_COM_MAP(CAccEditableText) 61 COM_INTERFACE_ENTRY(IAccessibleEditableText) 62 COM_INTERFACE_ENTRY(IUNOXWrapper) 63 COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI) 64 END_COM_MAP() 65 66 static HRESULT WINAPI _SmartQI(void* pv, 67 REFIID iid, void** ppvObject, DWORD) 68 { 69 return ((CAccEditableText*)pv)->SmartQI(iid,ppvObject); 70 } 71 72 HRESULT SmartQI(REFIID iid, void** ppvObject) 73 { 74 if( m_pOuterUnknown ) 75 return OuterQueryInterface(iid,ppvObject); 76 return E_FAIL; 77 } 78 79 DECLARE_REGISTRY_RESOURCEID(IDR_AccEditableText) 80 81 // IAccessibleEditableText 82 public: 83 // IAccessibleEditableText 84 85 // Copys a range of text to the clipboard. 86 STDMETHOD(copyText)(long startOffset, long endOffset); 87 88 // Deletes a range of text. 89 STDMETHOD(deleteText)(long startOffset, long endOffset); 90 91 // Inserts text at a specified offset. 92 STDMETHOD(insertText)(long offset, BSTR * text); 93 94 // Cuts a range of text to the clipboard. 95 STDMETHOD(cutText)(long startOffset, long endOffset); 96 97 // Pastes text from clipboard at specified offset. 98 STDMETHOD(pasteText)(long offset); 99 100 // Replaces range of text with new text. 101 STDMETHOD(replaceText)(long startOffset, long endOffset, BSTR * text); 102 103 104 // Sets attributes of range of text. 105 STDMETHOD(setAttributes)(long startOffset, long endOffset, BSTR * attributes); 106 107 // Overide of IUNOXWrapper. 108 STDMETHOD(put_XInterface)(long pXInterface); 109 110 private: 111 112 com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEditableText> pRXEdtTxt; 113 114 void get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, com::sun::star::uno::Any &rAny); 115 116 inline com::sun::star::accessibility::XAccessibleEditableText* GetXInterface() 117 { 118 return pRXEdtTxt.get(); 119 } 120 }; 121 122 #endif // !defined(AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_) 123