xref: /aoo41x/main/sfx2/inc/sfx2/styfitem.hxx (revision 353d8f4d)
1*353d8f4dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*353d8f4dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*353d8f4dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*353d8f4dSAndrew Rist  * distributed with this work for additional information
6*353d8f4dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*353d8f4dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*353d8f4dSAndrew Rist  * "License"); you may not use this file except in compliance
9*353d8f4dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*353d8f4dSAndrew Rist  *
11*353d8f4dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*353d8f4dSAndrew Rist  *
13*353d8f4dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*353d8f4dSAndrew Rist  * software distributed under the License is distributed on an
15*353d8f4dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*353d8f4dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*353d8f4dSAndrew Rist  * specific language governing permissions and limitations
18*353d8f4dSAndrew Rist  * under the License.
19*353d8f4dSAndrew Rist  *
20*353d8f4dSAndrew Rist  *************************************************************/
21*353d8f4dSAndrew Rist 
22*353d8f4dSAndrew Rist 
23cdf0e10cSrcweir #ifndef _SFX_STYFITEM_HXX
24cdf0e10cSrcweir #define _SFX_STYFITEM_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "sal/config.h"
27cdf0e10cSrcweir #include "sfx2/dllapi.h"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #ifndef _BITMAP_HXX //autogen
30cdf0e10cSrcweir #include <vcl/bitmap.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef _IMAGE_HXX //autogen
33cdf0e10cSrcweir #include <vcl/image.hxx>
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #include <tools/list.hxx>
36cdf0e10cSrcweir #ifndef _RC_HXX //autogen
37cdf0e10cSrcweir #include <tools/rc.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #include <rsc/rscsfx.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #ifndef _SFX_STYFITEM_HXX_NOLIST
42cdf0e10cSrcweir struct SfxFilterTupel {
43cdf0e10cSrcweir 	String aName;
44cdf0e10cSrcweir 	sal_uInt16 nFlags;
45cdf0e10cSrcweir };
46cdf0e10cSrcweir 
47cdf0e10cSrcweir DECLARE_LIST(SfxStyleFilter, SfxFilterTupel*)
48cdf0e10cSrcweir #else
49cdf0e10cSrcweir typedef List SfxStyleFilter;
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir 
52cdf0e10cSrcweir // CLASS -----------------------------------------------------------------
53cdf0e10cSrcweir 
54cdf0e10cSrcweir class SfxStyleFamilyItem: public Resource
55cdf0e10cSrcweir {
56cdf0e10cSrcweir 	Image           aImage;
57cdf0e10cSrcweir 	Bitmap          aBitmap;
58cdf0e10cSrcweir 	String          aText;
59cdf0e10cSrcweir 	String          aHelpText;
60cdf0e10cSrcweir 	sal_uInt16          nFamily;
61cdf0e10cSrcweir 	SfxStyleFilter  aFilterList;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir public:
64cdf0e10cSrcweir 					SfxStyleFamilyItem( const ResId &rId );
65cdf0e10cSrcweir 					~SfxStyleFamilyItem();
66cdf0e10cSrcweir 
GetBitmap() const67cdf0e10cSrcweir 	const Bitmap&   GetBitmap() const { return aBitmap; }
GetText() const68cdf0e10cSrcweir 	const String&   GetText() const { return aText; }
GetHelpText() const69cdf0e10cSrcweir 	const String&   GetHelpText() const { return aHelpText; }
GetFamily() const70cdf0e10cSrcweir 	SfxStyleFamily  GetFamily() const { return (SfxStyleFamily)nFamily; }
GetFilterList() const71cdf0e10cSrcweir 	const SfxStyleFilter& GetFilterList() const { return aFilterList; }
GetImage() const72cdf0e10cSrcweir 	const Image&    GetImage() const { return aImage; }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	// --------------------------------------------------------------------
75cdf0e10cSrcweir 	class GrantAccess { friend class SfxStyleFamilies; };
SetImage(const Image & _rImg)76cdf0e10cSrcweir 	void			SetImage( const Image& _rImg ) { aImage = _rImg; }
77cdf0e10cSrcweir };
78cdf0e10cSrcweir 
79cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE
80cdf0e10cSrcweir DECLARE_LIST(SfxStyleFamilyList, SfxStyleFamilyItem*)
81cdf0e10cSrcweir //#else
82cdf0e10cSrcweir //typedef List SfxStyleFamilyList;
83cdf0e10cSrcweir //#endif
84cdf0e10cSrcweir 
85cdf0e10cSrcweir class SFX2_DLLPUBLIC SfxStyleFamilies: public Resource
86cdf0e10cSrcweir {
87cdf0e10cSrcweir 	SfxStyleFamilyList  aEntryList;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir public:
90cdf0e10cSrcweir 	/** ctor
91cdf0e10cSrcweir 		<p>Will automatically call updateImages with BMP_COLOR_NORMAL.</p>
92cdf0e10cSrcweir 	*/
93cdf0e10cSrcweir 						SfxStyleFamilies( const ResId &);
SfxStyleFamilies()94cdf0e10cSrcweir 						SfxStyleFamilies( ) {};
95cdf0e10cSrcweir 						~SfxStyleFamilies();
96cdf0e10cSrcweir 
Count() const97cdf0e10cSrcweir 	sal_uInt16              Count() const
98cdf0e10cSrcweir 						{ return (sal_uInt16)aEntryList.Count(); }
99cdf0e10cSrcweir 
GetObject(sal_uIntPtr nIdx) const100cdf0e10cSrcweir 	const SfxStyleFamilyItem* GetObject(sal_uIntPtr nIdx) const
101cdf0e10cSrcweir 						{ return (SfxStyleFamilyItem*)aEntryList.GetObject(nIdx); }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	/** updates the images of all single SfxStyleFamilyItems with new images from the given resource
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 		<p>The resource must contain a local image lists, with the id beeing the integer equivalent for the
106cdf0e10cSrcweir 		requested bitmap mode, incremented by 1.</p>
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 		<p>Usually, you will use the same resource which originally constructed the object.</p>
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 		@return
111cdf0e10cSrcweir 			<TRUE/> if an image list for the requested mode could be found in the given resource.
112cdf0e10cSrcweir 	*/
113cdf0e10cSrcweir 	sal_Bool	updateImages( const ResId& _rId, const BmpColorMode _eMode );
114cdf0e10cSrcweir };
115cdf0e10cSrcweir 
116cdf0e10cSrcweir #endif
117cdf0e10cSrcweir 
118