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