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 #ifndef __ENUMVARIANT_H_
23 #define __ENUMVARIANT_H_
24 
25 #define WNT
26 
27 #include "resource.h"       // main symbols
28 #include <com/sun/star/accessibility/XAccessible.hpp>
29 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
30 #include "UAccCOM2.h"
31 #include <AccObjectManagerAgent.hxx>
32 
33 using namespace com::sun::star::accessibility;
34 using namespace com::sun::star::uno;
35 
36 #include <vector>
37 #include <algorithm>
38 using namespace std;
39 
40 /**
41  * CEnumVariant implements IEnumVARIANT interface.
42  */
43 class ATL_NO_VTABLE CEnumVariant :
44             public CComObjectRootEx<CComMultiThreadModel>,
45             public CComCoClass<CEnumVariant, &CLSID_EnumVariant>,
46             public IDispatchImpl<IEnumVariant, &IID_IEnumVariant, &LIBID_UACCCOMLib>
47 {
48 public:
CEnumVariant()49     CEnumVariant()
50             :m_lLBound(0),
51             pUNOInterface(NULL),
52             m_pXAccessibleSelection(NULL)
53     {
54         m_lCurrent = m_lLBound;
55     }
56 
~CEnumVariant()57 	virtual ~CEnumVariant() {};
58 
59     DECLARE_REGISTRY_RESOURCEID(IDR_ENUMVARIANT)
60 
61     DECLARE_PROTECT_FINAL_CONSTRUCT()
62 
63     BEGIN_COM_MAP(CEnumVariant)
64     COM_INTERFACE_ENTRY(IEnumVariant)
65     COM_INTERFACE_ENTRY(IEnumVARIANT)
66     END_COM_MAP()
67 
68     // IEnumVariant
69 public:
70 
71     STDMETHOD(ClearEnumeration)();
72 
73     // IEnumVARIANT
74 
75     //
76     HRESULT STDMETHODCALLTYPE Next(ULONG cElements,VARIANT __RPC_FAR *pvar,ULONG __RPC_FAR *pcElementFetched);
77 
78     //
79     HRESULT STDMETHODCALLTYPE Skip(ULONG cElements);
80 
81     //
82     HRESULT STDMETHODCALLTYPE Reset( void);
83 
84     //
85     HRESULT STDMETHODCALLTYPE Clone(IEnumVARIANT __RPC_FAR *__RPC_FAR *ppenum);
86 
87     // IEnumVariant
88 
89     //
90     HRESULT STDMETHODCALLTYPE PutSelection(long pXSelection);
91 
92     //
93     static HRESULT STDMETHODCALLTYPE Create(CEnumVariant __RPC_FAR *__RPC_FAR *ppenum);
94 
95     //
96     long GetCountOfElements();
97 
98 private:
99 
100     long m_lCurrent;
101     long m_lLBound;
102     XAccessible* pUNOInterface;						// XAccessible.
103     Reference<XAccessibleSelection> m_pXAccessibleSelection;	// Selection.
104 };
105 
106 #endif //__ENUMVARIANT_H_
107