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_ACCVALUE_H__CBA4972C_4188_4A18_A3CD_4A1FA3DDED38__INCLUDED_)
23 #define AFX_ACCVALUE_H__CBA4972C_4188_4A18_A3CD_4A1FA3DDED38__INCLUDED_
24 
25 #if _MSC_VER > 1000
26 #pragma once
27 #endif // _MSC_VER > 1000
28 
29 #include "resource.h"           // main symbols
30 
31 
32 #include <com/sun/star/uno/reference.hxx>
33 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
34 #include "UNOXWrapper.h"
35 
36 /**
37  * CAccValue implements IAccessibleValue interface.
38  */
39 class CAccValue :
40             public CComObjectRoot,
41             public CComCoClass<CAccValue,&CLSID_AccValue>,
42             public IAccessibleValue,
43             public CUNOXWrapper
44 {
45 public:
CAccValue()46     CAccValue()
47     {
48             }
~CAccValue()49     virtual ~CAccValue()
50     {
51             }
52 
53     BEGIN_COM_MAP(CAccValue)
COM_INTERFACE_ENTRY(IAccessibleValue)54     COM_INTERFACE_ENTRY(IAccessibleValue)
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 ((CAccValue*)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_AccValue)
73 
74     // IAccessibleValue
75 public:
76     // IAccessibleValue
77 
78     // Returns the value of this object as a number.
79     STDMETHOD(get_currentValue)(VARIANT *currentValue);
80 
81     // Sets the value of this object to the given number.
82     STDMETHOD(setCurrentValue)(VARIANT value);
83 
84     // Returns the maximal value that can be represented by this object.
85     STDMETHOD(get_maximumValue)(VARIANT *maximumValue);
86 
87     // Returns the minimal value that can be represented by this object.
88     STDMETHOD(get_minimumValue)(VARIANT *mininumValue);
89 
90     // Overide of IUNOXWrapper.
91     STDMETHOD(put_XInterface)(long pXInterface);
92 
93 private:
94 
95     com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleValue> pRXVal;
96 
GetXInterface()97     inline com::sun::star::accessibility::XAccessibleValue* GetXInterface()
98     {
99         return pRXVal.get();
100     }
101 
102 };
103 
104 #endif // !defined(AFX_ACCVALUE_H__CBA4972C_4188_4A18_A3CD_4A1FA3DDED38__INCLUDED_)
105