LibreOffice Module editeng (master) 1
brushitem.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <tools/color.hxx>
22#include <svl/poolitem.hxx>
24#include <memory>
26
27class Graphic;
28class GraphicObject;
29
30constexpr sal_uInt16 BRUSH_GRAPHIC_VERSION = 0x0001;
31
33{
39};
40
42{
46 sal_Int32 nShadingValue;
47 mutable std::unique_ptr<GraphicObject> xGraphicObject;
48 sal_Int8 nGraphicTransparency; //contains a percentage value which is
49 //copied to the GraphicObject when necessary
50 OUString maStrLink;
51 OUString maStrFilter;
53 mutable bool bLoadAgain;
54
55 void ApplyGraphicTransparency_Impl();
56
57public:
58 static SfxPoolItem* CreateDefault();
59
60 explicit SvxBrushItem( sal_uInt16 nWhich );
61 SvxBrushItem(Color const& rColor, sal_uInt16 nWhich);
62 SvxBrushItem(Color const& rColor, model::ComplexColor const& rComplexColor, sal_uInt16 nWhich);
63
64 SvxBrushItem( const Graphic& rGraphic,
65 SvxGraphicPosition ePos, sal_uInt16 nWhich );
66 SvxBrushItem( const GraphicObject& rGraphicObj,
67 SvxGraphicPosition ePos, sal_uInt16 nWhich );
68 SvxBrushItem( OUString rLink, OUString aFilter,
69 SvxGraphicPosition ePos, sal_uInt16 nWhich );
70 SvxBrushItem( const SvxBrushItem& );
72
73 virtual ~SvxBrushItem() override;
74
75public:
76 // check if it's used
77 bool isUsed() const;
78
79 virtual bool GetPresentation( SfxItemPresentation ePres,
80 MapUnit eCoreMetric,
81 MapUnit ePresMetric,
82 OUString &rText, const IntlWrapper& ) const override;
83
84 virtual bool operator==( const SfxPoolItem& ) const override;
85 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
86 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
87
88 virtual SvxBrushItem* Clone( SfxItemPool *pPool = nullptr ) const override;
89
90 const Color& GetColor() const { return aColor; }
91 Color& GetColor() { return aColor; }
92 void SetColor( const Color& rCol) { aColor = rCol; }
93
95 {
96 return maComplexColor;
97 }
98
99 void setComplexColor(model::ComplexColor const& rComplexColor)
100 {
101 maComplexColor = rComplexColor;
102 }
103
104 const Color& GetFiltColor() const { return aFilterColor; }
105 void SetFiltColor( const Color& rCol) { aFilterColor = rCol; }
106
107 SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; }
108
109 sal_Int32 GetShadingValue() const { return nShadingValue; }
110 const Graphic* GetGraphic(OUString const & referer = OUString()/*TODO*/) const;
111 const GraphicObject* GetGraphicObject(OUString const & referer = OUString()/*TODO*/) const;
112 const OUString& GetGraphicLink() const { return maStrLink; }
113 const OUString& GetGraphicFilter() const { return maStrFilter; }
114
115 // get graphic transparency in percent
116 sal_Int8 getGraphicTransparency() const { return nGraphicTransparency; }
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 static sal_Int8 TransparencyToPercent(sal_Int32 nTrans);
126
127 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
128};
129
130/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxGraphicPosition
Definition: brushitem.hxx:33
@ GPOS_MT
Definition: brushitem.hxx:35
@ GPOS_LT
Definition: brushitem.hxx:35
@ GPOS_RT
Definition: brushitem.hxx:35
@ GPOS_NONE
Definition: brushitem.hxx:34
@ GPOS_MM
Definition: brushitem.hxx:36
@ GPOS_TILED
Definition: brushitem.hxx:38
@ GPOS_AREA
Definition: brushitem.hxx:38
@ GPOS_MB
Definition: brushitem.hxx:37
@ GPOS_LB
Definition: brushitem.hxx:37
@ GPOS_LM
Definition: brushitem.hxx:36
@ GPOS_RM
Definition: brushitem.hxx:36
@ GPOS_RB
Definition: brushitem.hxx:37
constexpr sal_uInt16 BRUSH_GRAPHIC_VERSION
Definition: brushitem.hxx:30
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
virtual bool operator==(const SfxPoolItem &) const=0
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
void setComplexColor(model::ComplexColor const &rComplexColor)
Definition: brushitem.hxx:99
model::ComplexColor maComplexColor
Definition: brushitem.hxx:44
OUString maStrFilter
Definition: brushitem.hxx:51
sal_Int32 GetShadingValue() const
Definition: brushitem.hxx:109
const Color & GetColor() const
Definition: brushitem.hxx:90
sal_Int8 getGraphicTransparency() const
Definition: brushitem.hxx:116
const Color & GetFiltColor() const
Definition: brushitem.hxx:104
const OUString & GetGraphicFilter() const
Definition: brushitem.hxx:113
Color aColor
Definition: brushitem.hxx:43
void SetColor(const Color &rCol)
Definition: brushitem.hxx:92
SvxGraphicPosition eGraphicPos
Definition: brushitem.hxx:52
const OUString & GetGraphicLink() const
Definition: brushitem.hxx:112
bool bLoadAgain
Definition: brushitem.hxx:53
OUString maStrLink
Definition: brushitem.hxx:50
std::unique_ptr< GraphicObject > xGraphicObject
Definition: brushitem.hxx:47
sal_Int32 nShadingValue
Definition: brushitem.hxx:46
Color aFilterColor
Definition: brushitem.hxx:45
Color & GetColor()
Definition: brushitem.hxx:91
void SetFiltColor(const Color &rCol)
Definition: brushitem.hxx:105
const model::ComplexColor & getComplexColor() const
Definition: brushitem.hxx:94
SvxGraphicPosition GetGraphicPos() const
Definition: brushitem.hxx:107
sal_Int8 nGraphicTransparency
Definition: brushitem.hxx:48
#define EDITENG_DLLPUBLIC
Definition: editengdllapi.h:28
struct _xmlTextWriter * xmlTextWriterPtr
MapUnit
SfxItemPresentation
unsigned char sal_uInt8
signed char sal_Int8