sdrfillattribute.cxx (4bfbcde8) sdrfillattribute.cxx (035a2f44)
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

--- 10 unchanged lines hidden (view full) ---

19 *
20 *************************************************************/
21
22// MARKER(update_precomp.py): autogen include statement, do not remove
23#include "precompiled_drawinglayer.hxx"
24
25#include <drawinglayer/attribute/sdrfillattribute.hxx>
26#include <basegfx/color/bcolor.hxx>
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

--- 10 unchanged lines hidden (view full) ---

19 *
20 *************************************************************/
21
22// MARKER(update_precomp.py): autogen include statement, do not remove
23#include "precompiled_drawinglayer.hxx"
24
25#include <drawinglayer/attribute/sdrfillattribute.hxx>
26#include <basegfx/color/bcolor.hxx>
27#include <drawinglayer/attribute/sdrfillbitmapattribute.hxx>
27#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
28#include <drawinglayer/attribute/fillhatchattribute.hxx>
29#include <drawinglayer/attribute/fillgradientattribute.hxx>
30
31//////////////////////////////////////////////////////////////////////////////
32
33namespace drawinglayer
34{
35 namespace attribute

--- 4 unchanged lines hidden (view full) ---

40 // refcounter
41 sal_uInt32 mnRefCount;
42
43 // fill definitions
44 double mfTransparence; // [0.0 .. 1.0], 0.0==no transp.
45 basegfx::BColor maColor; // fill color
46 FillGradientAttribute maGradient; // fill gradient (if used)
47 FillHatchAttribute maHatch; // fill hatch (if used)
28#include <drawinglayer/attribute/fillhatchattribute.hxx>
29#include <drawinglayer/attribute/fillgradientattribute.hxx>
30
31//////////////////////////////////////////////////////////////////////////////
32
33namespace drawinglayer
34{
35 namespace attribute

--- 4 unchanged lines hidden (view full) ---

40 // refcounter
41 sal_uInt32 mnRefCount;
42
43 // fill definitions
44 double mfTransparence; // [0.0 .. 1.0], 0.0==no transp.
45 basegfx::BColor maColor; // fill color
46 FillGradientAttribute maGradient; // fill gradient (if used)
47 FillHatchAttribute maHatch; // fill hatch (if used)
48 SdrFillBitmapAttribute maBitmap; // fill bitmap (if used)
48 SdrFillGraphicAttribute maFillGraphic; // fill graphic (if used)
49
50 public:
51 ImpSdrFillAttribute(
52 double fTransparence,
53 const basegfx::BColor& rColor,
54 const FillGradientAttribute& rGradient,
55 const FillHatchAttribute& rHatch,
49
50 public:
51 ImpSdrFillAttribute(
52 double fTransparence,
53 const basegfx::BColor& rColor,
54 const FillGradientAttribute& rGradient,
55 const FillHatchAttribute& rHatch,
56 const SdrFillBitmapAttribute& rBitmap)
56 const SdrFillGraphicAttribute& rFillGraphic)
57 : mnRefCount(0),
58 mfTransparence(fTransparence),
59 maColor(rColor),
60 maGradient(rGradient),
61 maHatch(rHatch),
57 : mnRefCount(0),
58 mfTransparence(fTransparence),
59 maColor(rColor),
60 maGradient(rGradient),
61 maHatch(rHatch),
62 maBitmap(rBitmap)
62 maFillGraphic(rFillGraphic)
63 {
64 }
65
66 // data read access
67 double getTransparence() const { return mfTransparence; }
68 const basegfx::BColor& getColor() const { return maColor; }
69 const FillGradientAttribute& getGradient() const { return maGradient; }
70 const FillHatchAttribute& getHatch() const { return maHatch; }
63 {
64 }
65
66 // data read access
67 double getTransparence() const { return mfTransparence; }
68 const basegfx::BColor& getColor() const { return maColor; }
69 const FillGradientAttribute& getGradient() const { return maGradient; }
70 const FillHatchAttribute& getHatch() const { return maHatch; }
71 const SdrFillBitmapAttribute& getBitmap() const { return maBitmap; }
71 const SdrFillGraphicAttribute& getFillGraphic() const { return maFillGraphic; }
72
73 // compare operator
74 bool operator==(const ImpSdrFillAttribute& rCandidate) const
75 {
76 return(getTransparence() == rCandidate.getTransparence()
77 && getColor() == rCandidate.getColor()
78 && getGradient() == rCandidate.getGradient()
79 && getHatch() == rCandidate.getHatch()
72
73 // compare operator
74 bool operator==(const ImpSdrFillAttribute& rCandidate) const
75 {
76 return(getTransparence() == rCandidate.getTransparence()
77 && getColor() == rCandidate.getColor()
78 && getGradient() == rCandidate.getGradient()
79 && getHatch() == rCandidate.getHatch()
80 && getBitmap() == rCandidate.getBitmap());
80 && getFillGraphic() == rCandidate.getFillGraphic());
81 }
82
83 static ImpSdrFillAttribute* get_global_default()
84 {
85 static ImpSdrFillAttribute* pDefault = 0;
86
87 if(!pDefault)
88 {
89 pDefault = new ImpSdrFillAttribute(
90 0.0,
91 basegfx::BColor(),
92 FillGradientAttribute(),
93 FillHatchAttribute(),
81 }
82
83 static ImpSdrFillAttribute* get_global_default()
84 {
85 static ImpSdrFillAttribute* pDefault = 0;
86
87 if(!pDefault)
88 {
89 pDefault = new ImpSdrFillAttribute(
90 0.0,
91 basegfx::BColor(),
92 FillGradientAttribute(),
93 FillHatchAttribute(),
94 SdrFillBitmapAttribute());
94 SdrFillGraphicAttribute());
95
96 // never delete; start with RefCount 1, not 0
97 pDefault->mnRefCount++;
98 }
99
100 return pDefault;
101 }
102 };
103
104 SdrFillAttribute::SdrFillAttribute(
105 double fTransparence,
106 const basegfx::BColor& rColor,
107 const FillGradientAttribute& rGradient,
108 const FillHatchAttribute& rHatch,
95
96 // never delete; start with RefCount 1, not 0
97 pDefault->mnRefCount++;
98 }
99
100 return pDefault;
101 }
102 };
103
104 SdrFillAttribute::SdrFillAttribute(
105 double fTransparence,
106 const basegfx::BColor& rColor,
107 const FillGradientAttribute& rGradient,
108 const FillHatchAttribute& rHatch,
109 const SdrFillBitmapAttribute& rBitmap)
110 : mpSdrFillAttribute(new ImpSdrFillAttribute(
111 fTransparence, rColor, rGradient, rHatch, rBitmap))
109 const SdrFillGraphicAttribute& rFillGraphic)
110 : mpSdrFillAttribute(
111 new ImpSdrFillAttribute(
112 fTransparence, rColor, rGradient, rHatch, rFillGraphic))
112 {
113 }
114
115 SdrFillAttribute::SdrFillAttribute()
116 : mpSdrFillAttribute(ImpSdrFillAttribute::get_global_default())
117 {
118 mpSdrFillAttribute->mnRefCount++;
119 }

--- 71 unchanged lines hidden (view full) ---

191 return mpSdrFillAttribute->getGradient();
192 }
193
194 const FillHatchAttribute& SdrFillAttribute::getHatch() const
195 {
196 return mpSdrFillAttribute->getHatch();
197 }
198
113 {
114 }
115
116 SdrFillAttribute::SdrFillAttribute()
117 : mpSdrFillAttribute(ImpSdrFillAttribute::get_global_default())
118 {
119 mpSdrFillAttribute->mnRefCount++;
120 }

--- 71 unchanged lines hidden (view full) ---

192 return mpSdrFillAttribute->getGradient();
193 }
194
195 const FillHatchAttribute& SdrFillAttribute::getHatch() const
196 {
197 return mpSdrFillAttribute->getHatch();
198 }
199
199 const SdrFillBitmapAttribute& SdrFillAttribute::getBitmap() const
200 const SdrFillGraphicAttribute& SdrFillAttribute::getFillGraphic() const
200 {
201 {
201 return mpSdrFillAttribute->getBitmap();
202 return mpSdrFillAttribute->getFillGraphic();
202 }
203 } // end of namespace attribute
204} // end of namespace drawinglayer
205
206//////////////////////////////////////////////////////////////////////////////
207// eof
203 }
204 } // end of namespace attribute
205} // end of namespace drawinglayer
206
207//////////////////////////////////////////////////////////////////////////////
208// eof