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 _SVX_BRSHITEM_HXX 24 #define _SVX_BRSHITEM_HXX 25 26 // include --------------------------------------------------------------- 27 28 #include <svl/poolitem.hxx> 29 #include <vcl/wall.hxx> 30 #include <tools/link.hxx> 31 #include <editeng/editengdllapi.h> 32 33 // class SvxBrushItem ---------------------------------------------------- 34 35 class Graphic; 36 class GraphicObject; 37 class CntWallpaperItem; 38 namespace rtl 39 { 40 class OUString; 41 } 42 43 #define BRUSH_GRAPHIC_VERSION ((sal_uInt16)0x0001) 44 45 enum SvxGraphicPosition 46 { 47 GPOS_NONE, 48 GPOS_LT, GPOS_MT, GPOS_RT, 49 GPOS_LM, GPOS_MM, GPOS_RM, 50 GPOS_LB, GPOS_MB, GPOS_RB, 51 GPOS_AREA, GPOS_TILED 52 }; 53 54 #define PARA_DEST_PARA 0 55 #define PARA_DEST_CHAR 1 56 57 class SvxBrushItem_Impl; 58 class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem 59 { 60 Color aColor; 61 SvxBrushItem_Impl* pImpl; 62 String* pStrLink; 63 String* pStrFilter; 64 SvxGraphicPosition eGraphicPos; 65 sal_Bool bLoadAgain; 66 67 void ApplyGraphicTransparency_Impl(); 68 DECL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void *); 69 // wird nur von Create benutzt 70 SvxBrushItem( SvStream& rStrm, 71 sal_uInt16 nVersion, sal_uInt16 nWhich ); 72 73 public: 74 TYPEINFO(); 75 76 SvxBrushItem( sal_uInt16 nWhich ); 77 SvxBrushItem( const Color& rColor, sal_uInt16 nWhich ); 78 79 SvxBrushItem( const Graphic& rGraphic, 80 SvxGraphicPosition ePos, sal_uInt16 nWhich ); 81 SvxBrushItem( const GraphicObject& rGraphicObj, 82 SvxGraphicPosition ePos, sal_uInt16 nWhich ); 83 SvxBrushItem( const String& rLink, const String& rFilter, 84 SvxGraphicPosition ePos, sal_uInt16 nWhich ); 85 SvxBrushItem( const SvxBrushItem& ); 86 SvxBrushItem( const CntWallpaperItem&, sal_uInt16 nWhich ); 87 88 ~SvxBrushItem(); 89 90 public: 91 92 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 93 SfxMapUnit eCoreMetric, 94 SfxMapUnit ePresMetric, 95 String &rText, const IntlWrapper * = 0 ) const; 96 97 virtual int operator==( const SfxPoolItem& ) const; 98 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 99 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 100 101 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 102 virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const; 103 virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const; 104 virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; 105 GetColor() const106 const Color& GetColor() const { return aColor; } GetColor()107 Color& GetColor() { return aColor; } SetColor(const Color & rCol)108 void SetColor( const Color& rCol) { aColor = rCol; } 109 110 void SetDoneLink( const Link& rLink ); 111 GetGraphicPos() const112 SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; } 113 114 void PurgeGraphic() const; 115 void PurgeMedium() const; 116 117 const Graphic* GetGraphic() const; 118 const GraphicObject* GetGraphicObject() const; GetGraphicLink() const119 const String* GetGraphicLink() const { return pStrLink; } GetGraphicFilter() const120 const String* GetGraphicFilter() const { return pStrFilter; } 121 122 void SetGraphicPos( SvxGraphicPosition eNew ); 123 void SetGraphic( const Graphic& rNew ); 124 void SetGraphicObject( const GraphicObject& rNewObj ); 125 void SetGraphicLink( const String& rNew ); 126 void SetGraphicFilter( const String& rNew ); 127 128 SvxBrushItem& operator=( const SvxBrushItem& rItem); 129 130 static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle ); 131 static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos ); 132 CntWallpaperItem* CreateCntWallpaperItem() const; 133 }; 134 135 #endif // #ifndef _SVX_BRSHITEM_HXX 136 137