xref: /AOO41X/main/comphelper/source/misc/evtmethodhelper.cxx (revision 79aad27f7f29270c03e208e3d687e8e3850af11d)
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 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_comphelper.hxx"
26 #include "comphelper/evtmethodhelper.hxx"
27 #include "cppuhelper/typeprovider.hxx"
28 
29 using ::com::sun::star::uno::Sequence;
30 using ::com::sun::star::uno::Type;
31 
32 namespace comphelper
33 {
34 
getEventMethodsForType(const Type & type)35     Sequence< ::rtl::OUString> getEventMethodsForType(const Type& type)
36     {
37         typelib_InterfaceTypeDescription *pType=0;
38         type.getDescription( (typelib_TypeDescription**)&pType);
39 
40         if(!pType)
41             return Sequence< ::rtl::OUString>();
42 
43         Sequence< ::rtl::OUString> aNames(pType->nMembers);
44         ::rtl::OUString* pNames = aNames.getArray();
45         for(sal_Int32 i=0;i<pType->nMembers;i++,++pNames)
46         {
47             // the decription reference
48             typelib_TypeDescriptionReference* pMemberDescriptionReference = pType->ppMembers[i];
49             // the description for the reference
50             typelib_TypeDescription* pMemberDescription = NULL;
51             typelib_typedescriptionreference_getDescription(&pMemberDescription, pMemberDescriptionReference);
52             if (pMemberDescription)
53             {
54                 typelib_InterfaceMemberTypeDescription* pRealMemberDescription =
55                 reinterpret_cast<typelib_InterfaceMemberTypeDescription*>(pMemberDescription);
56                 *pNames = pRealMemberDescription->pMemberName;
57             }
58         }
59         typelib_typedescription_release( (typelib_TypeDescription *)pType );
60         return aNames;
61     }
62 
63 }
64 
65 
66 
67 
68 
69 
70 
71