xref: /AOO41X/main/svx/source/unogallery/unogaltheme.hxx (revision 3334a7e6acdae9820fa1a6f556bb10129a8de6b2)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVX_UNOGALTHEME_HXX
25 #define _SVX_UNOGALTHEME_HXX
26 
27 #include <list>
28 
29 #include <cppuhelper/implbase1.hxx>
30 #include <svl/lstner.hxx>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/gallery/XGalleryTheme.hpp>
33 
34 class Gallery;
35 class GalleryTheme;
36 struct GalleryObject;
37 namespace unogallery { class GalleryItem; }
38 
39 namespace unogallery {
40 
41 // ----------------
42 // - GalleryTheme -
43 // ----------------
44 
45 class GalleryTheme : public ::cppu::WeakImplHelper1< ::com::sun::star::gallery::XGalleryTheme >,
46                      public SfxListener
47 {
48     friend class ::unogallery::GalleryItem;
49 
50 public:
51 
52     GalleryTheme( const ::rtl::OUString& rThemeName );
53     ~GalleryTheme();
54 
55     static ::rtl::OUString getImplementationName_Static() throw();
56     static ::com::sun::star::uno::Sequence< ::rtl::OUString >  getSupportedServiceNames_Static() throw();
57 
58 protected:
59 
60     // XServiceInfo
61     virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
62     virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
63     virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
64 
65     // XTypeProvider
66     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
67     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
68 
69     // XElementAccess
70     virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
71     virtual ::sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException);
72 
73     // XIndexAccess
74     virtual ::sal_Int32 SAL_CALL getCount(  ) throw (::com::sun::star::uno::RuntimeException);
75     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);
76 
77     // XGalleryThemes
78     virtual ::rtl::OUString SAL_CALL getName(  ) throw (::com::sun::star::uno::RuntimeException);
79     virtual void SAL_CALL update(  ) throw (::com::sun::star::uno::RuntimeException);
80     virtual ::sal_Int32 SAL_CALL insertURLByIndex( const ::rtl::OUString& URL, ::sal_Int32 Index ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
81     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);
82     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);
83     virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
84 
85     // SfxListener
86     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
87 
88 private:
89 
90     typedef ::std::list< ::unogallery::GalleryItem* > GalleryItemList;
91 
92     GalleryItemList maItemList;
93     ::Gallery*      mpGallery;
94     ::GalleryTheme* mpTheme;
95 
96     ::GalleryTheme* implGetTheme() const;
97 
98     void            implReleaseItems( GalleryObject* pObj );
99 
100     void            implRegisterGalleryItem( ::unogallery::GalleryItem& rItem );
101     void            implDeregisterGalleryItem( ::unogallery::GalleryItem& rItem );
102 };
103 
104 }
105 
106 #endif
107