1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: itemcontainer.hxx,v $
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_ITEMCONTAINER_HXX_
32 #define __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_
34 //_________________________________________________________________________________________________________________
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 //_________________________________________________________________________________________________________________
46 //_________________________________________________________________________________________________________________
47 #include <com/sun/star/container/XIndexContainer.hpp>
48 #include <com/sun/star/beans/PropertyValue.hpp>
49 #include <com/sun/star/lang/XUnoTunnel.hpp>
51 //_________________________________________________________________________________________________________________
53 //_________________________________________________________________________________________________________________
54 #include <rtl/ustring.hxx>
55 #include <cppuhelper/implbase1.hxx>
62 class ConstItemContainer
;
63 class ItemContainer
: public ::cppu::WeakImplHelper1
< ::com::sun::star::container::XIndexContainer
>
65 friend class ConstItemContainer
;
68 ItemContainer( const ShareableMutex
& );
69 ItemContainer( const ConstItemContainer
& rConstItemContainer
, const ShareableMutex
& rMutex
);
70 ItemContainer( const com::sun::star::uno::Reference
< com::sun::star::container::XIndexAccess
>& rItemAccessContainer
, const ShareableMutex
& rMutex
);
71 virtual ~ItemContainer();
73 //---------------------------------------------------------------------------------------------------------
74 // XInterface, XTypeProvider
75 //---------------------------------------------------------------------------------------------------------
77 static const ::com::sun::star::uno::Sequence
< sal_Int8
>& GetUnoTunnelId() throw();
78 static ItemContainer
* GetImplementation( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& rxIFace
) throw();
79 sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& rIdentifier
) throw(::com::sun::star::uno::RuntimeException
);
82 virtual void SAL_CALL
insertByIndex( 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
);
85 virtual void SAL_CALL
removeByIndex( sal_Int32 Index
)
86 throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
89 virtual void SAL_CALL
replaceByIndex( sal_Int32 Index
, const ::com::sun::star::uno::Any
& Element
)
90 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
93 virtual sal_Int32 SAL_CALL
getCount()
94 throw (::com::sun::star::uno::RuntimeException
);
96 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
97 throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
100 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
101 throw (::com::sun::star::uno::RuntimeException
)
103 return ::getCppuType((com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>*)0);
106 virtual sal_Bool SAL_CALL
hasElements()
107 throw (::com::sun::star::uno::RuntimeException
);
111 void copyItemContainer( const std::vector
< com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
> >& rSourceVector
, const ShareableMutex
& rMutex
);
112 com::sun::star::uno::Reference
< com::sun::star::container::XIndexAccess
> deepCopyContainer( const com::sun::star::uno::Reference
< com::sun::star::container::XIndexAccess
>& rSubContainer
, const ShareableMutex
& rMutex
);
114 mutable ShareableMutex m_aShareMutex
;
115 std::vector
< com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
> > m_aItemVector
;
120 #endif // #ifndef __FRAMEWORK_UIELEMENT_ITEMCONTAINER_HXX_