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_UNOGALITEM_HXX
25 #define _SVX_UNOGALITEM_HXX
26 
27 #include <svx/unomodel.hxx>
28 #include <comphelper/servicehelper.hxx>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/gallery/XGalleryItem.hpp>
31 #include <comphelper/propertysethelper.hxx>
32 #ifndef _COMPHELPER_PROPERTYSETINFO_HXX_
33 #include <comphelper/propertysetinfo.hxx>
34 #endif
35 
36 class GalleryTheme;
37 struct GalleryObject;
38 namespace unogallery { class GalleryTheme; }
39 
40 namespace unogallery {
41 
42 // ---------------
43 // - GalleryItem -
44 // ---------------
45 
46 class GalleryItem : public ::cppu::OWeakAggObject,
47 					public ::com::sun::star::lang::XServiceInfo,
48 					public ::com::sun::star::lang::XTypeProvider,
49 					public ::com::sun::star::gallery::XGalleryItem,
50 					public ::comphelper::PropertySetHelper
51 {
52 	friend class ::unogallery::GalleryTheme;
53 
54 public:
55 
56 			GalleryItem( ::unogallery::GalleryTheme& rTheme, const GalleryObject& rObject );
57 			~GalleryItem() throw();
58 
59 	bool	isValid() const;
60 
61     static ::rtl::OUString getImplementationName_Static() throw();
62     static ::com::sun::star::uno::Sequence< ::rtl::OUString >  getSupportedServiceNames_Static() throw();
63 
64 protected:
65 
66 	// XInterface
67 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
68 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
69 	virtual void SAL_CALL acquire() throw();
70 	virtual void SAL_CALL release() throw();
71 
72 	// XServiceInfo
73     virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
74     virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
75     virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
76 
77 	// XTypeProvider
78     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
79     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
80 
81 	// XGalleryItem
82     virtual ::sal_Int8 SAL_CALL getType(  ) throw (::com::sun::star::uno::RuntimeException);
83 
84 	// PropertySetHelper
85     virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
86     virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
87 
88 protected:
89 
90 	::comphelper::PropertySetInfo* createPropertySetInfo();
91 
92 private:
93 
94 	::unogallery::GalleryTheme* mpTheme;
95 	const ::GalleryObject*		mpGalleryObject;
96 
97 	const ::GalleryObject*		implGetObject() const;
98 	void 						implSetInvalid();
99 
100 								// not available
101 								GalleryItem();
102 								GalleryItem( const GalleryItem& );
103 								GalleryItem& operator=( const GalleryItem& );
104 };
105 
106 // -----------------------
107 // - GalleryDrawingModel -
108 // -----------------------
109 
110 class GalleryDrawingModel : public SvxUnoDrawingModel
111 {
112 public:
113 
114 				GalleryDrawingModel( SdrModel* pDoc ) throw();
115 	virtual 	~GalleryDrawingModel() throw();
116 
117 				UNO3_GETIMPLEMENTATION_DECL( GalleryDrawingModel )
118 };
119 
120 }
121 
122 #endif
123