1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SVX_UNOGALTHEME_HXX
29 #define _SVX_UNOGALTHEME_HXX
30 
31 #include <list>
32 
33 #include <cppuhelper/implbase1.hxx>
34 #include <svl/lstner.hxx>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/gallery/XGalleryTheme.hpp>
37 
38 class Gallery;
39 class GalleryTheme;
40 struct GalleryObject;
41 namespace unogallery { class GalleryItem; }
42 
43 namespace unogallery {
44 
45 // ----------------
46 // - GalleryTheme -
47 // ----------------
48 
49 class GalleryTheme : public ::cppu::WeakImplHelper1< ::com::sun::star::gallery::XGalleryTheme >,
50 					 public SfxListener
51 {
52 	friend class ::unogallery::GalleryItem;
53 
54 public:
55 
56 	GalleryTheme( const ::rtl::OUString& rThemeName );
57 	~GalleryTheme();
58 
59     static ::rtl::OUString getImplementationName_Static() throw();
60     static ::com::sun::star::uno::Sequence< ::rtl::OUString >  getSupportedServiceNames_Static() throw();
61 
62 protected:
63 
64 	// XServiceInfo
65     virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
66     virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
67     virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
68 
69 	// XTypeProvider
70     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
71     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
72 
73 	// XElementAccess
74     virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
75     virtual ::sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException);
76 
77     // XIndexAccess
78 	virtual ::sal_Int32 SAL_CALL getCount(  ) throw (::com::sun::star::uno::RuntimeException);
79     virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
80 
81 	// XGalleryThemes
82     virtual ::rtl::OUString SAL_CALL getName(  ) throw (::com::sun::star::uno::RuntimeException);
83     virtual void SAL_CALL update(  ) throw (::com::sun::star::uno::RuntimeException);
84     virtual ::sal_Int32 SAL_CALL insertURLByIndex( const ::rtl::OUString& URL, ::sal_Int32 Index ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
85     virtual ::sal_Int32 SAL_CALL insertGraphicByIndex( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& Graphic, ::sal_Int32 Index ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
86     virtual ::sal_Int32 SAL_CALL insertDrawingByIndex( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& Drawing, ::sal_Int32 Index ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
87     virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
88 
89 	// SfxListener
90 	virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
91 
92 private:
93 
94 	typedef ::std::list< ::unogallery::GalleryItem* > GalleryItemList;
95 
96 	GalleryItemList	maItemList;
97 	::Gallery*		mpGallery;
98 	::GalleryTheme*	mpTheme;
99 
100 	::GalleryTheme*	implGetTheme() const;
101 
102 	void 			implReleaseItems( GalleryObject* pObj );
103 
104 	void			implRegisterGalleryItem( ::unogallery::GalleryItem& rItem );
105 	void			implDeregisterGalleryItem( ::unogallery::GalleryItem& rItem );
106 };
107 
108 }
109 
110 #endif
111