Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_EDITENG_BRUSHITEM_HXX
20 : #define INCLUDED_EDITENG_BRUSHITEM_HXX
21 :
22 : #include <svl/poolitem.hxx>
23 : #include <vcl/wall.hxx>
24 : #include <tools/link.hxx>
25 : #include <editeng/editengdllapi.h>
26 :
27 : // class SvxBrushItem ----------------------------------------------------
28 :
29 : class Graphic;
30 : class GraphicObject;
31 : class CntWallpaperItem;
32 :
33 : #define BRUSH_GRAPHIC_VERSION ((sal_uInt16)0x0001)
34 :
35 : enum SvxGraphicPosition
36 : {
37 : GPOS_NONE,
38 : GPOS_LT, GPOS_MT, GPOS_RT,
39 : GPOS_LM, GPOS_MM, GPOS_RM,
40 : GPOS_LB, GPOS_MB, GPOS_RB,
41 : GPOS_AREA, GPOS_TILED
42 : };
43 :
44 : #define PARA_DEST_PARA 0
45 : #define PARA_DEST_CHAR 1
46 :
47 : class SvxBrushItem_Impl;
48 : class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem
49 : {
50 : Color aColor;
51 : sal_Int32 nShadingValue;
52 : SvxBrushItem_Impl* pImpl;
53 : OUString maStrLink;
54 : OUString maStrFilter;
55 : SvxGraphicPosition eGraphicPos;
56 : bool bLoadAgain;
57 :
58 : void ApplyGraphicTransparency_Impl();
59 : DECL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void *);
60 : // wird nur von Create benutzt
61 : SvxBrushItem( SvStream& rStrm,
62 : sal_uInt16 nVersion, sal_uInt16 nWhich );
63 :
64 : public:
65 : TYPEINFO_OVERRIDE();
66 :
67 : explicit SvxBrushItem( sal_uInt16 nWhich );
68 : SvxBrushItem( const Color& rColor, sal_uInt16 nWhich );
69 :
70 : SvxBrushItem( const Graphic& rGraphic,
71 : SvxGraphicPosition ePos, sal_uInt16 nWhich );
72 : SvxBrushItem( const GraphicObject& rGraphicObj,
73 : SvxGraphicPosition ePos, sal_uInt16 nWhich );
74 : SvxBrushItem( const OUString& rLink, const OUString& rFilter,
75 : SvxGraphicPosition ePos, sal_uInt16 nWhich );
76 : SvxBrushItem( const SvxBrushItem& );
77 : SvxBrushItem( const CntWallpaperItem&, sal_uInt16 nWhich );
78 :
79 : virtual ~SvxBrushItem();
80 :
81 : public:
82 :
83 : virtual bool GetPresentation( SfxItemPresentation ePres,
84 : SfxMapUnit eCoreMetric,
85 : SfxMapUnit ePresMetric,
86 : OUString &rText, const IntlWrapper * = 0 ) const SAL_OVERRIDE;
87 :
88 : virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
89 : virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
90 : virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) SAL_OVERRIDE;
91 :
92 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
93 : virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const SAL_OVERRIDE;
94 : virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const SAL_OVERRIDE;
95 : virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const SAL_OVERRIDE;
96 :
97 319202 : const Color& GetColor() const { return aColor; }
98 9324 : Color& GetColor() { return aColor; }
99 3472 : void SetColor( const Color& rCol) { aColor = rCol; }
100 :
101 : void SetDoneLink( const Link& rLink );
102 :
103 483399 : SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; }
104 :
105 : void PurgeMedium() const;
106 :
107 2004 : sal_uInt32 GetShadingValue() const { return nShadingValue; }
108 : const Graphic* GetGraphic(OUString const & referer = OUString()/*TODO*/) const;
109 : const GraphicObject* GetGraphicObject(OUString const & referer = OUString()/*TODO*/) const;
110 118 : OUString GetGraphicLink() const { return maStrLink; }
111 0 : OUString GetGraphicFilter() const { return maStrFilter; }
112 :
113 : void SetShadingValue( const sal_uInt32 nNew );
114 :
115 : //UUUU get graphic transparency in percent
116 : sal_Int8 getGraphicTransparency() const;
117 : void setGraphicTransparency(sal_Int8 nNew);
118 :
119 : void SetGraphicPos( SvxGraphicPosition eNew );
120 : void SetGraphic( const Graphic& rNew );
121 : void SetGraphicObject( const GraphicObject& rNewObj );
122 : void SetGraphicLink( const OUString& rNew );
123 : void SetGraphicFilter( const OUString& rNew );
124 :
125 : SvxBrushItem& operator=( const SvxBrushItem& rItem);
126 :
127 : static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle );
128 : static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos );
129 : static sal_Int8 TransparencyToPercent(sal_Int32 nTrans);
130 : };
131 :
132 : #endif // INCLUDED_EDITENG_BRUSHITEM_HXX
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|