Line data Source code
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_FRAMEWORK_INC_UIELEMENT_ROOTITEMCONTAINER_HXX
21 : #define INCLUDED_FRAMEWORK_INC_UIELEMENT_ROOTITEMCONTAINER_HXX
22 :
23 : #include <macros/generic.hxx>
24 : #include <macros/xinterface.hxx>
25 : #include <macros/xtypeprovider.hxx>
26 : #include <helper/shareablemutex.hxx>
27 :
28 : #include <com/sun/star/container/XIndexContainer.hpp>
29 : #include <com/sun/star/container/XIndexAccess.hpp>
30 : #include <com/sun/star/lang/XSingleComponentFactory.hpp>
31 : #include <com/sun/star/beans/PropertyValue.hpp>
32 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 : #include <com/sun/star/lang/XUnoTunnel.hpp>
34 :
35 : #include <rtl/ustring.hxx>
36 : #include <cppuhelper/basemutex.hxx>
37 : #include <cppuhelper/implbase3.hxx>
38 : #include <cppuhelper/propshlp.hxx>
39 :
40 : #include <vector>
41 : #include <fwidllapi.h>
42 :
43 : namespace framework
44 : {
45 : class ConstItemContainer;
46 :
47 : typedef ::cppu::WeakImplHelper3<
48 : css::container::XIndexContainer,
49 : css::lang::XSingleComponentFactory,
50 : css::lang::XUnoTunnel > RootItemContainer_BASE;
51 :
52 : class RootItemContainer : private cppu::BaseMutex,
53 : public ::cppu::OBroadcastHelper ,
54 : public ::cppu::OPropertySetHelper ,
55 : public RootItemContainer_BASE
56 : {
57 : friend class ConstItemContainer;
58 :
59 : public:
60 : FWI_DLLPUBLIC RootItemContainer();
61 : FWI_DLLPUBLIC RootItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer );
62 : virtual FWI_DLLPUBLIC ~RootItemContainer();
63 :
64 : // XInterface
65 0 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
66 0 : { OWeakObject::acquire(); }
67 0 : virtual void SAL_CALL release() throw () SAL_OVERRIDE
68 0 : { OWeakObject::release(); }
69 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
70 :
71 : // XTypeProvider
72 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 :
74 : // XUnoTunnel
75 : static FWI_DLLPUBLIC const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
76 : static FWI_DLLPUBLIC RootItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
77 : sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
78 :
79 : // XIndexContainer
80 : virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
81 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 :
83 : virtual void SAL_CALL removeByIndex( sal_Int32 Index )
84 : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 :
86 : // XIndexReplace
87 : virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
88 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 :
90 : // XIndexAccess
91 : virtual sal_Int32 SAL_CALL getCount()
92 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 :
94 : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
95 : throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 :
97 : // XElementAccess
98 0 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
99 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
100 : {
101 0 : return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
102 : }
103 :
104 : virtual sal_Bool SAL_CALL hasElements()
105 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 :
107 : // XSingleComponentFactory
108 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 :
111 : protected:
112 : // OPropertySetHelper
113 : virtual sal_Bool SAL_CALL convertFastPropertyValue ( com::sun::star::uno::Any& aConvertedValue ,
114 : com::sun::star::uno::Any& aOldValue ,
115 : sal_Int32 nHandle ,
116 : const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ) SAL_OVERRIDE;
117 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
118 : const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception, std::exception ) SAL_OVERRIDE;
119 : using cppu::OPropertySetHelper::getFastPropertyValue;
120 : virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue ,
121 : sal_Int32 nHandle ) const SAL_OVERRIDE;
122 : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
123 : virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 :
125 : static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor();
126 :
127 : private:
128 : RootItemContainer& operator=( const RootItemContainer& );
129 : RootItemContainer( const RootItemContainer& );
130 :
131 : com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > deepCopyContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSubContainer );
132 :
133 : mutable ShareableMutex m_aShareMutex;
134 : std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector;
135 : OUString m_aUIName;
136 : };
137 :
138 : }
139 :
140 : #endif // INCLUDED_FRAMEWORK_INC_UIELEMENT_ROOTITEMCONTAINER_HXX
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|