1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #if !defined(AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_)
23 #define AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_
24 
25 #if _MSC_VER > 1000
26 #pragma once
27 #endif // _MSC_VER > 1000
28 
29 #include "resource.h"
30 #include <com/sun/star/uno/reference.hxx>
31 #include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
32 #include "UNOXWrapper.h"
33 
34 /**
35  * CAccEditableText implements IAccessibleEditableText interface.
36  */
37 class CAccEditableText :
38             public CComObjectRoot,
39             public CComCoClass<CAccEditableText,&CLSID_AccEditableText>,
40             public IAccessibleEditableText,
41             public CUNOXWrapper
42 {
43 public:
CAccEditableText()44     CAccEditableText()
45     {
46 
47     }
~CAccEditableText()48     virtual ~CAccEditableText()
49     {
50 
51     }
52 
53     BEGIN_COM_MAP(CAccEditableText)
COM_INTERFACE_ENTRY(IAccessibleEditableText)54     COM_INTERFACE_ENTRY(IAccessibleEditableText)
55     COM_INTERFACE_ENTRY(IUNOXWrapper)
56     COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
57     END_COM_MAP()
58 
59     static HRESULT WINAPI _SmartQI(void* pv,
60                                    REFIID iid, void** ppvObject, DWORD)
61     {
62         return ((CAccEditableText*)pv)->SmartQI(iid,ppvObject);
63     }
64 
SmartQI(REFIID iid,void ** ppvObject)65     HRESULT SmartQI(REFIID iid, void** ppvObject)
66     {
67         if( m_pOuterUnknown )
68             return OuterQueryInterface(iid,ppvObject);
69         return E_FAIL;
70     }
71 
72     DECLARE_REGISTRY_RESOURCEID(IDR_AccEditableText)
73 
74     // IAccessibleEditableText
75 public:
76     // IAccessibleEditableText
77 
78     // Copys a range of text to the clipboard.
79     STDMETHOD(copyText)(long startOffset, long endOffset);
80 
81     // Deletes a range of text.
82     STDMETHOD(deleteText)(long startOffset, long endOffset);
83 
84     // Inserts text at a specified offset.
85     STDMETHOD(insertText)(long offset, BSTR * text);
86 
87     // Cuts a range of text to the clipboard.
88     STDMETHOD(cutText)(long startOffset, long endOffset);
89 
90     // Pastes text from clipboard at specified offset.
91     STDMETHOD(pasteText)(long offset);
92 
93     // Replaces range of text with new text.
94     STDMETHOD(replaceText)(long startOffset, long endOffset, BSTR * text);
95 
96 
97     // Sets attributes of range of text.
98     STDMETHOD(setAttributes)(long startOffset, long endOffset, BSTR * attributes);
99 
100     // Overide of IUNOXWrapper.
101     STDMETHOD(put_XInterface)(long pXInterface);
102 
103 private:
104 
105     com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEditableText> pRXEdtTxt;
106 
107     void get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, com::sun::star::uno::Any &rAny);
108 
GetXInterface()109     inline com::sun::star::accessibility::XAccessibleEditableText* GetXInterface()
110     {
111         return pRXEdtTxt.get();
112     }
113 };
114 
115 #endif // !defined(AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_)
116