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