LibreOffice Module comphelper (master)  1
enumhelper.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_COMPHELPER_ENUMHELPER_HXX
21 #define INCLUDED_COMPHELPER_ENUMHELPER_HXX
22 
23 #include <com/sun/star/container/XEnumeration.hpp>
24 #include <com/sun/star/lang/XEventListener.hpp>
25 #include <cppuhelper/implbase.hxx>
26 #include <osl/mutex.hxx>
28 
29 namespace com::sun::star::container { class XIndexAccess; }
30 namespace com::sun::star::container { class XNameAccess; }
31 
32 namespace comphelper
33 {
34 
36 {
37  public:
38  ::osl::Mutex m_aLock;
39 };
40 
45  , public ::cppu::WeakImplHelper< css::container::XEnumeration ,
46  css::lang::XEventListener >
47 {
48  css::uno::Sequence< OUString > const m_aNames;
49  css::uno::Reference< css::container::XNameAccess > m_xAccess;
50  sal_Int32 m_nPos;
52 
53 public:
54  OEnumerationByName(const css::uno::Reference< css::container::XNameAccess >& _rxAccess);
55  OEnumerationByName(const css::uno::Reference< css::container::XNameAccess >& _rxAccess,
56  const css::uno::Sequence< OUString >& _aNames );
57  virtual ~OEnumerationByName() override;
58 
59  virtual sal_Bool SAL_CALL hasMoreElements( ) override;
60  virtual css::uno::Any SAL_CALL nextElement( ) override;
61 
62  virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
63 
64 private:
65  COMPHELPER_DLLPRIVATE void impl_startDisposeListening();
66  COMPHELPER_DLLPRIVATE void impl_stopDisposeListening();
67 };
68 
73  , public ::cppu::WeakImplHelper< css::container::XEnumeration ,
74  css::lang::XEventListener >
75 {
76  css::uno::Reference< css::container::XIndexAccess > m_xAccess;
77  sal_Int32 m_nPos;
79 
80 public:
81  OEnumerationByIndex(const css::uno::Reference< css::container::XIndexAccess >& _rxAccess);
82  virtual ~OEnumerationByIndex() override;
83 
84  virtual sal_Bool SAL_CALL hasMoreElements( ) override;
85  virtual css::uno::Any SAL_CALL nextElement( ) override;
86 
87  virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
88 
89 private:
90  COMPHELPER_DLLPRIVATE void impl_startDisposeListening();
91  COMPHELPER_DLLPRIVATE void impl_stopDisposeListening();
92 };
93 
94 // this is the way that works for ENABLE_LTO with MSVC 2013
95 class SAL_DLLPUBLIC_TEMPLATE OAnyEnumeration_BASE
96  : public ::cppu::WeakImplHelper<css::container::XEnumeration> {};
97 
103  , public OAnyEnumeration_BASE
104 {
105  sal_Int32 m_nPos;
106  css::uno::Sequence< css::uno::Any > m_lItems;
107 
108 public:
109  OAnyEnumeration(const css::uno::Sequence< css::uno::Any >& lItems);
110  virtual ~OAnyEnumeration() override;
111 
112  virtual sal_Bool SAL_CALL hasMoreElements( ) override;
113  virtual css::uno::Any SAL_CALL nextElement( ) override;
114 
115 };
116 
117 }
118 
119 #endif // INCLUDED_COMPHELPER_ENUMHELPER_HXX
120 
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
provides a com.sun.star.container::XEnumeration access based on an object implementing the com...
Definition: enumhelper.hxx:44
provides a com.sun.star.container::XEnumeration for an outside set vector of Any's.
Definition: enumhelper.hxx:102
unsigned char sal_Bool
#define COMPHELPER_DLLPRIVATE
css::uno::Reference< css::container::XNameAccess > m_xAccess
Definition: enumhelper.hxx:49
provides a com.sun.star.container::XEnumeration access based on an object implementing the com...
Definition: enumhelper.hxx:72
css::uno::Sequence< css::uno::Any > m_lItems
Definition: enumhelper.hxx:106
#define COMPHELPER_DLLPUBLIC
css::uno::Sequence< OUString > const m_aNames
Definition: enumhelper.hxx:48
css::uno::Reference< css::container::XIndexAccess > m_xAccess
Definition: enumhelper.hxx:76
AnyEventRef aEvent