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