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 #ifndef _SFX_STYFITEM_HXX 24 #define _SFX_STYFITEM_HXX 25 26 #include "sal/config.h" 27 #include "sfx2/dllapi.h" 28 29 #ifndef _BITMAP_HXX //autogen 30 #include <vcl/bitmap.hxx> 31 #endif 32 #ifndef _IMAGE_HXX //autogen 33 #include <vcl/image.hxx> 34 #endif 35 #include <tools/list.hxx> 36 #ifndef _RC_HXX //autogen 37 #include <tools/rc.hxx> 38 #endif 39 #include <rsc/rscsfx.hxx> 40 41 #ifndef _SFX_STYFITEM_HXX_NOLIST 42 struct SfxFilterTupel { 43 String aName; 44 sal_uInt16 nFlags; 45 }; 46 47 DECLARE_LIST(SfxStyleFilter, SfxFilterTupel*) 48 #else 49 typedef List SfxStyleFilter; 50 #endif 51 52 // CLASS ----------------------------------------------------------------- 53 54 class SfxStyleFamilyItem: public Resource 55 { 56 Image aImage; 57 Bitmap aBitmap; 58 String aText; 59 String aHelpText; 60 sal_uInt16 nFamily; 61 SfxStyleFilter aFilterList; 62 63 public: 64 SfxStyleFamilyItem( const ResId &rId ); 65 ~SfxStyleFamilyItem(); 66 GetBitmap() const67 const Bitmap& GetBitmap() const { return aBitmap; } GetText() const68 const String& GetText() const { return aText; } GetHelpText() const69 const String& GetHelpText() const { return aHelpText; } GetFamily() const70 SfxStyleFamily GetFamily() const { return (SfxStyleFamily)nFamily; } GetFilterList() const71 const SfxStyleFilter& GetFilterList() const { return aFilterList; } GetImage() const72 const Image& GetImage() const { return aImage; } 73 74 // -------------------------------------------------------------------- 75 class GrantAccess { friend class SfxStyleFamilies; }; SetImage(const Image & _rImg)76 void SetImage( const Image& _rImg ) { aImage = _rImg; } 77 }; 78 79 //#if 0 // _SOLAR__PRIVATE 80 DECLARE_LIST(SfxStyleFamilyList, SfxStyleFamilyItem*) 81 //#else 82 //typedef List SfxStyleFamilyList; 83 //#endif 84 85 class SFX2_DLLPUBLIC SfxStyleFamilies: public Resource 86 { 87 SfxStyleFamilyList aEntryList; 88 89 public: 90 /** ctor 91 <p>Will automatically call updateImages with BMP_COLOR_NORMAL.</p> 92 */ 93 SfxStyleFamilies( const ResId &); SfxStyleFamilies()94 SfxStyleFamilies( ) {}; 95 ~SfxStyleFamilies(); 96 Count() const97 sal_uInt16 Count() const 98 { return (sal_uInt16)aEntryList.Count(); } 99 GetObject(sal_uIntPtr nIdx) const100 const SfxStyleFamilyItem* GetObject(sal_uIntPtr nIdx) const 101 { return (SfxStyleFamilyItem*)aEntryList.GetObject(nIdx); } 102 103 /** updates the images of all single SfxStyleFamilyItems with new images from the given resource 104 105 <p>The resource must contain a local image lists, with the id beeing the integer equivalent for the 106 requested bitmap mode, incremented by 1.</p> 107 108 <p>Usually, you will use the same resource which originally constructed the object.</p> 109 110 @return 111 <TRUE/> if an image list for the requested mode could be found in the given resource. 112 */ 113 sal_Bool updateImages( const ResId& _rId, const BmpColorMode _eMode ); 114 }; 115 116 #endif 117 118