1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_EDITENG_BRUSHITEM_HXX
20 #define INCLUDED_EDITENG_BRUSHITEM_HXX
22 #include <tools/color.hxx>
23 #include <svl/poolitem.hxx>
24 #include <unotools/securityoptions.hxx>
25 #include <editeng/editengdllapi.h>
28 // class SvxBrushItem ----------------------------------------------------
33 constexpr sal_uInt16 BRUSH_GRAPHIC_VERSION
= 0x0001;
35 enum SvxGraphicPosition
38 GPOS_LT
, GPOS_MT
, GPOS_RT
,
39 GPOS_LM
, GPOS_MM
, GPOS_RM
,
40 GPOS_LB
, GPOS_MB
, GPOS_RB
,
44 class EDITENG_DLLPUBLIC SvxBrushItem final
: public SfxPoolItem
47 sal_Int32 nShadingValue
;
48 mutable std::unique_ptr
<GraphicObject
> xGraphicObject
;
49 sal_Int8 nGraphicTransparency
; //contains a percentage value which is
50 //copied to the GraphicObject when necessary
51 SvtSecurityOptions maSecOptions
;
54 SvxGraphicPosition eGraphicPos
;
55 mutable bool bLoadAgain
;
57 void ApplyGraphicTransparency_Impl();
60 static SfxPoolItem
* CreateDefault();
62 explicit SvxBrushItem( sal_uInt16 nWhich
);
63 SvxBrushItem( const Color
& rColor
, sal_uInt16 nWhich
);
65 SvxBrushItem( const Graphic
& rGraphic
,
66 SvxGraphicPosition ePos
, sal_uInt16 nWhich
);
67 SvxBrushItem( const GraphicObject
& rGraphicObj
,
68 SvxGraphicPosition ePos
, sal_uInt16 nWhich
);
69 SvxBrushItem( const OUString
& rLink
, const OUString
& rFilter
,
70 SvxGraphicPosition ePos
, sal_uInt16 nWhich
);
71 SvxBrushItem( const SvxBrushItem
& );
72 SvxBrushItem(SvxBrushItem
&&);
74 virtual ~SvxBrushItem() override
;
80 virtual bool GetPresentation( SfxItemPresentation ePres
,
83 OUString
&rText
, const IntlWrapper
& ) const override
;
85 virtual bool operator==( const SfxPoolItem
& ) const override
;
86 virtual bool QueryValue( css::uno::Any
& rVal
, sal_uInt8 nMemberId
= 0 ) const override
;
87 virtual bool PutValue( const css::uno::Any
& rVal
, sal_uInt8 nMemberId
) override
;
89 virtual SvxBrushItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
91 const Color
& GetColor() const { return aColor
; }
92 Color
& GetColor() { return aColor
; }
93 void SetColor( const Color
& rCol
) { aColor
= rCol
; }
95 SvxGraphicPosition
GetGraphicPos() const { return eGraphicPos
; }
97 sal_Int32
GetShadingValue() const { return nShadingValue
; }
98 const Graphic
* GetGraphic(OUString
const & referer
= OUString()/*TODO*/) const;
99 const GraphicObject
* GetGraphicObject(OUString
const & referer
= OUString()/*TODO*/) const;
100 const OUString
& GetGraphicLink() const { return maStrLink
; }
101 const OUString
& GetGraphicFilter() const { return maStrFilter
; }
103 // get graphic transparency in percent
104 sal_Int8
getGraphicTransparency() const { return nGraphicTransparency
; }
105 void setGraphicTransparency(sal_Int8 nNew
);
107 void SetGraphicPos( SvxGraphicPosition eNew
);
108 void SetGraphic( const Graphic
& rNew
);
109 void SetGraphicObject( const GraphicObject
& rNewObj
);
110 void SetGraphicLink( const OUString
& rNew
);
111 void SetGraphicFilter( const OUString
& rNew
);
113 static sal_Int8
TransparencyToPercent(sal_Int32 nTrans
);
115 void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
118 #endif // INCLUDED_EDITENG_BRUSHITEM_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */