Update ooo320-m1
[ooovba.git] / framework / inc / uielement / rootitemcontainer.hxx
blob0853c40d341086340560fe56e93ebd760a52c401
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rootitemcontainer.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_UIELEMENT_ROOTITEMCONTAINER_HXX_
32 #define __FRAMEWORK_UIELEMENT_ROOTITEMCONTAINER_HXX_
34 //_________________________________________________________________________________________________________________
35 // my own includes
36 //_________________________________________________________________________________________________________________
38 #include <threadhelp/threadhelpbase.hxx>
39 #include <macros/generic.hxx>
40 #include <macros/xinterface.hxx>
41 #include <macros/xtypeprovider.hxx>
42 #include <helper/shareablemutex.hxx>
44 //_________________________________________________________________________________________________________________
45 // interface includes
46 //_________________________________________________________________________________________________________________
47 #include <com/sun/star/container/XIndexContainer.hpp>
48 #include <com/sun/star/container/XIndexAccess.hpp>
49 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
50 #include <com/sun/star/beans/PropertyValue.hpp>
51 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
52 #include <com/sun/star/lang/XUnoTunnel.hpp>
54 //_________________________________________________________________________________________________________________
55 // other includes
56 //_________________________________________________________________________________________________________________
57 #include <rtl/ustring.hxx>
58 #include <cppuhelper/weak.hxx>
59 #include <cppuhelper/propshlp.hxx>
60 #include <cppuhelper/interfacecontainer.hxx>
62 #include <vector>
64 namespace framework
67 class ConstItemContainer;
68 class ItemContainer;
69 class RootItemContainer : public ::com::sun::star::lang::XTypeProvider ,
70 public ::com::sun::star::container::XIndexContainer ,
71 public ::com::sun::star::lang::XSingleComponentFactory ,
72 public ::com::sun::star::lang::XUnoTunnel ,
73 protected ThreadHelpBase ,
74 public ::cppu::OBroadcastHelper ,
75 public ::cppu::OPropertySetHelper ,
76 public ::cppu::OWeakObject
78 friend class ConstItemContainer;
80 public:
81 RootItemContainer();
82 RootItemContainer( const ConstItemContainer& rConstItemContainer );
83 RootItemContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccessContainer );
84 virtual ~RootItemContainer();
86 //---------------------------------------------------------------------------------------------------------
87 // XInterface, XTypeProvider
88 //---------------------------------------------------------------------------------------------------------
89 FWK_DECLARE_XINTERFACE
90 FWK_DECLARE_XTYPEPROVIDER
92 // XUnoTunnel
93 static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
94 static RootItemContainer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
95 sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
97 // XIndexContainer
98 virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
99 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
101 virtual void SAL_CALL removeByIndex( sal_Int32 Index )
102 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
104 // XIndexReplace
105 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element )
106 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
108 // XIndexAccess
109 virtual sal_Int32 SAL_CALL getCount()
110 throw (::com::sun::star::uno::RuntimeException);
112 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
113 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
115 // XElementAccess
116 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
117 throw (::com::sun::star::uno::RuntimeException)
119 return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
122 virtual sal_Bool SAL_CALL hasElements()
123 throw (::com::sun::star::uno::RuntimeException);
125 // XSingleComponentFactory
126 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);
127 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);
129 protected:
130 // OPropertySetHelper
131 virtual sal_Bool SAL_CALL convertFastPropertyValue ( com::sun::star::uno::Any& aConvertedValue ,
132 com::sun::star::uno::Any& aOldValue ,
133 sal_Int32 nHandle ,
134 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException );
135 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
136 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception );
137 using cppu::OPropertySetHelper::getFastPropertyValue;
138 virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue ,
139 sal_Int32 nHandle ) const;
140 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
141 virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException);
143 static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor();
145 private:
146 RootItemContainer& operator=( const RootItemContainer& );
147 RootItemContainer( const RootItemContainer& );
149 void copyItemContainer( const std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rSourceVector );
150 com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > deepCopyContainer( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rSubContainer );
152 mutable ShareableMutex m_aShareMutex;
153 std::vector< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > m_aItemVector;
154 rtl::OUString m_aUIName;
159 #endif // #ifndef __FRAMEWORK_UIELEMENT_ROOTITEMCONTAINER_HXX_