xref: /AOO41X/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx (revision e7d686686afb4d382768f76e473eb6fb3d4e57e3)
1035a2f44SArmin Le Grand /**************************************************************
2035a2f44SArmin Le Grand  *
3035a2f44SArmin Le Grand  * Licensed to the Apache Software Foundation (ASF) under one
4035a2f44SArmin Le Grand  * or more contributor license agreements.  See the NOTICE file
5035a2f44SArmin Le Grand  * distributed with this work for additional information
6035a2f44SArmin Le Grand  * regarding copyright ownership.  The ASF licenses this file
7035a2f44SArmin Le Grand  * to you under the Apache License, Version 2.0 (the
8035a2f44SArmin Le Grand  * "License"); you may not use this file except in compliance
9035a2f44SArmin Le Grand  * with the License.  You may obtain a copy of the License at
10035a2f44SArmin Le Grand  *
11035a2f44SArmin Le Grand  *   http://www.apache.org/licenses/LICENSE-2.0
12035a2f44SArmin Le Grand  *
13035a2f44SArmin Le Grand  * Unless required by applicable law or agreed to in writing,
14035a2f44SArmin Le Grand  * software distributed under the License is distributed on an
15035a2f44SArmin Le Grand  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16035a2f44SArmin Le Grand  * KIND, either express or implied.  See the License for the
17035a2f44SArmin Le Grand  * specific language governing permissions and limitations
18035a2f44SArmin Le Grand  * under the License.
19035a2f44SArmin Le Grand  *
20035a2f44SArmin Le Grand  *************************************************************/
21035a2f44SArmin Le Grand 
22035a2f44SArmin Le Grand 
23035a2f44SArmin Le Grand 
24035a2f44SArmin Le Grand // MARKER(update_precomp.py): autogen include statement, do not remove
25035a2f44SArmin Le Grand #include "precompiled_drawinglayer.hxx"
26035a2f44SArmin Le Grand 
27035a2f44SArmin Le Grand #include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
28035a2f44SArmin Le Grand #include <drawinglayer/attribute/fillgraphicattribute.hxx>
29035a2f44SArmin Le Grand #include <vcl/graph.hxx>
30035a2f44SArmin Le Grand 
31035a2f44SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
32035a2f44SArmin Le Grand 
33035a2f44SArmin Le Grand namespace drawinglayer
34035a2f44SArmin Le Grand {
35035a2f44SArmin Le Grand 	namespace attribute
36035a2f44SArmin Le Grand 	{
37035a2f44SArmin Le Grand 		class ImpSdrFillGraphicAttribute
38035a2f44SArmin Le Grand 		{
39035a2f44SArmin Le Grand         public:
40035a2f44SArmin Le Grand 		    // refcounter
41035a2f44SArmin Le Grand 		    sal_uInt32								mnRefCount;
42035a2f44SArmin Le Grand 
43035a2f44SArmin Le Grand             // data definitions
44035a2f44SArmin Le Grand 			Graphic                                 maFillGraphic;
45*e7d68668SArmin Le Grand             basegfx::B2DVector                      maGraphicLogicSize;
46035a2f44SArmin Le Grand 			basegfx::B2DVector						maSize;
47035a2f44SArmin Le Grand 			basegfx::B2DVector						maOffset;
48035a2f44SArmin Le Grand 			basegfx::B2DVector						maOffsetPosition;
49035a2f44SArmin Le Grand 			basegfx::B2DVector						maRectPoint;
50035a2f44SArmin Le Grand 
51035a2f44SArmin Le Grand 			// bitfield
52035a2f44SArmin Le Grand 			unsigned								mbTiling : 1;
53035a2f44SArmin Le Grand 			unsigned								mbStretch : 1;
54035a2f44SArmin Le Grand 			unsigned								mbLogSize : 1;
55035a2f44SArmin Le Grand 
ImpSdrFillGraphicAttribute(const Graphic & rFillGraphic,const basegfx::B2DVector & rGraphicLogicSize,const basegfx::B2DVector & rSize,const basegfx::B2DVector & rOffset,const basegfx::B2DVector & rOffsetPosition,const basegfx::B2DVector & rRectPoint,bool bTiling,bool bStretch,bool bLogSize)56035a2f44SArmin Le Grand 			ImpSdrFillGraphicAttribute(
57035a2f44SArmin Le Grand 				const Graphic& rFillGraphic,
58*e7d68668SArmin Le Grand                 const basegfx::B2DVector& rGraphicLogicSize,
59035a2f44SArmin Le Grand                 const basegfx::B2DVector& rSize,
60035a2f44SArmin Le Grand                 const basegfx::B2DVector& rOffset,
61035a2f44SArmin Le Grand 				const basegfx::B2DVector& rOffsetPosition,
62035a2f44SArmin Le Grand                 const basegfx::B2DVector& rRectPoint,
63035a2f44SArmin Le Grand 				bool bTiling,
64035a2f44SArmin Le Grand                 bool bStretch,
65035a2f44SArmin Le Grand                 bool bLogSize)
66035a2f44SArmin Le Grand 		    :	mnRefCount(0),
67035a2f44SArmin Le Grand 		    	maFillGraphic(rFillGraphic),
68*e7d68668SArmin Le Grand                 maGraphicLogicSize(rGraphicLogicSize),
69035a2f44SArmin Le Grand 			    maSize(rSize),
70035a2f44SArmin Le Grand 			    maOffset(rOffset),
71035a2f44SArmin Le Grand 			    maOffsetPosition(rOffsetPosition),
72035a2f44SArmin Le Grand 			    maRectPoint(rRectPoint),
73035a2f44SArmin Le Grand 			    mbTiling(bTiling),
74035a2f44SArmin Le Grand 			    mbStretch(bStretch),
75035a2f44SArmin Le Grand 			    mbLogSize(bLogSize)
76035a2f44SArmin Le Grand 		    {
77035a2f44SArmin Le Grand 		    }
78035a2f44SArmin Le Grand 
79035a2f44SArmin Le Grand 			// data read access
getFillGraphic() const80035a2f44SArmin Le Grand             const Graphic& getFillGraphic() const { return maFillGraphic; }
getGraphicLogicSize() const81*e7d68668SArmin Le Grand             const basegfx::B2DVector& getGraphicLogicSize() const { return maGraphicLogicSize; }
getSize() const82035a2f44SArmin Le Grand             const basegfx::B2DVector& getSize() const { return maSize; }
getOffset() const83035a2f44SArmin Le Grand             const basegfx::B2DVector& getOffset() const { return maOffset; }
getOffsetPosition() const84035a2f44SArmin Le Grand             const basegfx::B2DVector& getOffsetPosition() const { return maOffsetPosition; }
getRectPoint() const85035a2f44SArmin Le Grand             const basegfx::B2DVector& getRectPoint() const { return maRectPoint; }
getTiling() const86035a2f44SArmin Le Grand             bool getTiling() const { return mbTiling; }
getStretch() const87035a2f44SArmin Le Grand             bool getStretch() const { return mbStretch; }
getLogSize() const88035a2f44SArmin Le Grand             bool getLogSize() const { return mbLogSize; }
89035a2f44SArmin Le Grand 
operator ==(const ImpSdrFillGraphicAttribute & rCandidate) const90035a2f44SArmin Le Grand             bool operator==(const ImpSdrFillGraphicAttribute& rCandidate) const
91035a2f44SArmin Le Grand             {
92035a2f44SArmin Le Grand 			    return (getFillGraphic() == rCandidate.getFillGraphic()
93*e7d68668SArmin Le Grand                     && getGraphicLogicSize() == rCandidate.getGraphicLogicSize()
94035a2f44SArmin Le Grand 				    && getSize() == rCandidate.getSize()
95035a2f44SArmin Le Grand 				    && getOffset() == rCandidate.getOffset()
96035a2f44SArmin Le Grand 				    && getOffsetPosition() == rCandidate.getOffsetPosition()
97035a2f44SArmin Le Grand 				    && getRectPoint() == rCandidate.getRectPoint()
98035a2f44SArmin Le Grand 				    && getTiling() == rCandidate.getTiling()
99035a2f44SArmin Le Grand 				    && getStretch() == rCandidate.getStretch()
100035a2f44SArmin Le Grand 				    && getLogSize() == rCandidate.getLogSize());
101035a2f44SArmin Le Grand             }
102035a2f44SArmin Le Grand 
get_global_default()103035a2f44SArmin Le Grand             static ImpSdrFillGraphicAttribute* get_global_default()
104035a2f44SArmin Le Grand             {
105035a2f44SArmin Le Grand                 static ImpSdrFillGraphicAttribute* pDefault = 0;
106035a2f44SArmin Le Grand 
107035a2f44SArmin Le Grand                 if(!pDefault)
108035a2f44SArmin Le Grand                 {
109035a2f44SArmin Le Grand                     pDefault = new ImpSdrFillGraphicAttribute(
110035a2f44SArmin Le Grand 			            Graphic(),
111035a2f44SArmin Le Grand                         basegfx::B2DVector(),
112035a2f44SArmin Le Grand                         basegfx::B2DVector(),
113035a2f44SArmin Le Grand                         basegfx::B2DVector(),
114035a2f44SArmin Le Grand 			            basegfx::B2DVector(),
115*e7d68668SArmin Le Grand                         basegfx::B2DVector(),
116035a2f44SArmin Le Grand 			            false,
117035a2f44SArmin Le Grand                         false,
118035a2f44SArmin Le Grand                         false);
119035a2f44SArmin Le Grand 
120035a2f44SArmin Le Grand                     // never delete; start with RefCount 1, not 0
121035a2f44SArmin Le Grand     			    pDefault->mnRefCount++;
122035a2f44SArmin Le Grand                 }
123035a2f44SArmin Le Grand 
124035a2f44SArmin Le Grand                 return pDefault;
125035a2f44SArmin Le Grand             }
126035a2f44SArmin Le Grand 		};
127035a2f44SArmin Le Grand 
SdrFillGraphicAttribute(const Graphic & rFillGraphic,const basegfx::B2DVector & rGraphicLogicSize,const basegfx::B2DVector & rSize,const basegfx::B2DVector & rOffset,const basegfx::B2DVector & rOffsetPosition,const basegfx::B2DVector & rRectPoint,bool bTiling,bool bStretch,bool bLogSize)128035a2f44SArmin Le Grand         SdrFillGraphicAttribute::SdrFillGraphicAttribute(
129035a2f44SArmin Le Grand 			const Graphic& rFillGraphic,
130*e7d68668SArmin Le Grand             const basegfx::B2DVector& rGraphicLogicSize,
131035a2f44SArmin Le Grand             const basegfx::B2DVector& rSize,
132035a2f44SArmin Le Grand             const basegfx::B2DVector& rOffset,
133035a2f44SArmin Le Grand 			const basegfx::B2DVector& rOffsetPosition,
134035a2f44SArmin Le Grand             const basegfx::B2DVector& rRectPoint,
135035a2f44SArmin Le Grand 			bool bTiling,
136035a2f44SArmin Le Grand             bool bStretch,
137035a2f44SArmin Le Grand             bool bLogSize)
138035a2f44SArmin Le Grand 		:	mpSdrFillGraphicAttribute(
139035a2f44SArmin Le Grand                 new ImpSdrFillGraphicAttribute(
140035a2f44SArmin Le Grand                     rFillGraphic,
141*e7d68668SArmin Le Grand                     rGraphicLogicSize,
142035a2f44SArmin Le Grand                     rSize,
143035a2f44SArmin Le Grand                     rOffset,
144035a2f44SArmin Le Grand                     rOffsetPosition,
145035a2f44SArmin Le Grand                     rRectPoint,
146035a2f44SArmin Le Grand                     bTiling,
147035a2f44SArmin Le Grand                     bStretch,
148035a2f44SArmin Le Grand                     bLogSize))
149035a2f44SArmin Le Grand 		{
150035a2f44SArmin Le Grand 		}
151035a2f44SArmin Le Grand 
SdrFillGraphicAttribute()152035a2f44SArmin Le Grand 		SdrFillGraphicAttribute::SdrFillGraphicAttribute()
153035a2f44SArmin Le Grand         :	mpSdrFillGraphicAttribute(ImpSdrFillGraphicAttribute::get_global_default())
154035a2f44SArmin Le Grand 		{
155035a2f44SArmin Le Grand 			mpSdrFillGraphicAttribute->mnRefCount++;
156035a2f44SArmin Le Grand 		}
157035a2f44SArmin Le Grand 
SdrFillGraphicAttribute(const SdrFillGraphicAttribute & rCandidate)158035a2f44SArmin Le Grand         SdrFillGraphicAttribute::SdrFillGraphicAttribute(const SdrFillGraphicAttribute& rCandidate)
159035a2f44SArmin Le Grand 		:	mpSdrFillGraphicAttribute(rCandidate.mpSdrFillGraphicAttribute)
160035a2f44SArmin Le Grand 		{
161035a2f44SArmin Le Grand 			mpSdrFillGraphicAttribute->mnRefCount++;
162035a2f44SArmin Le Grand 		}
163035a2f44SArmin Le Grand 
~SdrFillGraphicAttribute()164035a2f44SArmin Le Grand 		SdrFillGraphicAttribute::~SdrFillGraphicAttribute()
165035a2f44SArmin Le Grand 		{
166035a2f44SArmin Le Grand 			if(mpSdrFillGraphicAttribute->mnRefCount)
167035a2f44SArmin Le Grand 			{
168035a2f44SArmin Le Grand 				mpSdrFillGraphicAttribute->mnRefCount--;
169035a2f44SArmin Le Grand 			}
170035a2f44SArmin Le Grand 			else
171035a2f44SArmin Le Grand 			{
172035a2f44SArmin Le Grand 				delete mpSdrFillGraphicAttribute;
173035a2f44SArmin Le Grand 			}
174035a2f44SArmin Le Grand 		}
175035a2f44SArmin Le Grand 
isDefault() const176035a2f44SArmin Le Grand         bool SdrFillGraphicAttribute::isDefault() const
177035a2f44SArmin Le Grand         {
178035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute == ImpSdrFillGraphicAttribute::get_global_default();
179035a2f44SArmin Le Grand         }
180035a2f44SArmin Le Grand 
operator =(const SdrFillGraphicAttribute & rCandidate)181035a2f44SArmin Le Grand         SdrFillGraphicAttribute& SdrFillGraphicAttribute::operator=(const SdrFillGraphicAttribute& rCandidate)
182035a2f44SArmin Le Grand 		{
183035a2f44SArmin Le Grand 			if(rCandidate.mpSdrFillGraphicAttribute != mpSdrFillGraphicAttribute)
184035a2f44SArmin Le Grand 			{
185035a2f44SArmin Le Grand 				if(mpSdrFillGraphicAttribute->mnRefCount)
186035a2f44SArmin Le Grand 				{
187035a2f44SArmin Le Grand 					mpSdrFillGraphicAttribute->mnRefCount--;
188035a2f44SArmin Le Grand 				}
189035a2f44SArmin Le Grand 				else
190035a2f44SArmin Le Grand 				{
191035a2f44SArmin Le Grand 					delete mpSdrFillGraphicAttribute;
192035a2f44SArmin Le Grand 				}
193035a2f44SArmin Le Grand 
194035a2f44SArmin Le Grand 				mpSdrFillGraphicAttribute = rCandidate.mpSdrFillGraphicAttribute;
195035a2f44SArmin Le Grand 				mpSdrFillGraphicAttribute->mnRefCount++;
196035a2f44SArmin Le Grand 			}
197035a2f44SArmin Le Grand 
198035a2f44SArmin Le Grand 			return *this;
199035a2f44SArmin Le Grand 		}
200035a2f44SArmin Le Grand 
operator ==(const SdrFillGraphicAttribute & rCandidate) const201035a2f44SArmin Le Grand 		bool SdrFillGraphicAttribute::operator==(const SdrFillGraphicAttribute& rCandidate) const
202035a2f44SArmin Le Grand 		{
203035a2f44SArmin Le Grand 			if(rCandidate.mpSdrFillGraphicAttribute == mpSdrFillGraphicAttribute)
204035a2f44SArmin Le Grand 			{
205035a2f44SArmin Le Grand 				return true;
206035a2f44SArmin Le Grand 			}
207035a2f44SArmin Le Grand 
208035a2f44SArmin Le Grand 			if(rCandidate.isDefault() != isDefault())
209035a2f44SArmin Le Grand 			{
210035a2f44SArmin Le Grand 				return false;
211035a2f44SArmin Le Grand 			}
212035a2f44SArmin Le Grand 
213035a2f44SArmin Le Grand 			return (*rCandidate.mpSdrFillGraphicAttribute == *mpSdrFillGraphicAttribute);
214035a2f44SArmin Le Grand 		}
215035a2f44SArmin Le Grand 
getFillGraphic() const216035a2f44SArmin Le Grand         const Graphic& SdrFillGraphicAttribute::getFillGraphic() const
217035a2f44SArmin Le Grand         {
218035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getFillGraphic();
219035a2f44SArmin Le Grand         }
220035a2f44SArmin Le Grand 
getGraphicLogicSize() const221*e7d68668SArmin Le Grand         const basegfx::B2DVector& SdrFillGraphicAttribute::getGraphicLogicSize() const
222*e7d68668SArmin Le Grand         {
223*e7d68668SArmin Le Grand             return mpSdrFillGraphicAttribute->getGraphicLogicSize();
224*e7d68668SArmin Le Grand         }
225*e7d68668SArmin Le Grand 
getSize() const226035a2f44SArmin Le Grand         const basegfx::B2DVector& SdrFillGraphicAttribute::getSize() const
227035a2f44SArmin Le Grand         {
228035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getSize();
229035a2f44SArmin Le Grand         }
230035a2f44SArmin Le Grand 
getOffset() const231035a2f44SArmin Le Grand         const basegfx::B2DVector& SdrFillGraphicAttribute::getOffset() const
232035a2f44SArmin Le Grand         {
233035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getOffset();
234035a2f44SArmin Le Grand         }
235035a2f44SArmin Le Grand 
getOffsetPosition() const236035a2f44SArmin Le Grand         const basegfx::B2DVector& SdrFillGraphicAttribute::getOffsetPosition() const
237035a2f44SArmin Le Grand         {
238035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getOffsetPosition();
239035a2f44SArmin Le Grand         }
240035a2f44SArmin Le Grand 
getRectPoint() const241035a2f44SArmin Le Grand         const basegfx::B2DVector& SdrFillGraphicAttribute::getRectPoint() const
242035a2f44SArmin Le Grand         {
243035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getRectPoint();
244035a2f44SArmin Le Grand         }
245035a2f44SArmin Le Grand 
getTiling() const246035a2f44SArmin Le Grand         bool SdrFillGraphicAttribute::getTiling() const
247035a2f44SArmin Le Grand         {
248035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getTiling();
249035a2f44SArmin Le Grand         }
250035a2f44SArmin Le Grand 
getStretch() const251035a2f44SArmin Le Grand         bool SdrFillGraphicAttribute::getStretch() const
252035a2f44SArmin Le Grand         {
253035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getStretch();
254035a2f44SArmin Le Grand         }
255035a2f44SArmin Le Grand 
getLogSize() const256035a2f44SArmin Le Grand         bool SdrFillGraphicAttribute::getLogSize() const
257035a2f44SArmin Le Grand         {
258035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getLogSize();
259035a2f44SArmin Le Grand         }
260035a2f44SArmin Le Grand 
createFillGraphicAttribute(const basegfx::B2DRange & rRange) const261035a2f44SArmin Le Grand         FillGraphicAttribute SdrFillGraphicAttribute::createFillGraphicAttribute(const basegfx::B2DRange& rRange) const
262035a2f44SArmin Le Grand 		{
263035a2f44SArmin Le Grand 			// get logical size of bitmap (before expanding eventually)
264035a2f44SArmin Le Grand 			Graphic aGraphic(getFillGraphic());
265035a2f44SArmin Le Grand 
266035a2f44SArmin Le Grand 			// init values with defaults
267035a2f44SArmin Le Grand 			basegfx::B2DPoint aBitmapSize(1.0, 1.0);
268035a2f44SArmin Le Grand 			basegfx::B2DVector aBitmapTopLeft(0.0, 0.0);
269035a2f44SArmin Le Grand 
270035a2f44SArmin Le Grand 			// are changes needed?
271035a2f44SArmin Le Grand 			if(getTiling() || !getStretch())
272035a2f44SArmin Le Grand 			{
273035a2f44SArmin Le Grand 				// init values with range sizes
274035a2f44SArmin Le Grand 				const double fRangeWidth(0.0 != rRange.getWidth() ? rRange.getWidth() : 1.0);
275035a2f44SArmin Le Grand 				const double fRangeHeight(0.0 != rRange.getHeight() ? rRange.getHeight() : 1.0);
276035a2f44SArmin Le Grand 				aBitmapSize = basegfx::B2DPoint(fRangeWidth, fRangeHeight);
277035a2f44SArmin Le Grand 
278035a2f44SArmin Le Grand 				// size changes
279035a2f44SArmin Le Grand 				if(0.0 != getSize().getX())
280035a2f44SArmin Le Grand 				{
281035a2f44SArmin Le Grand 					if(getSize().getX() < 0.0)
282035a2f44SArmin Le Grand 					{
283035a2f44SArmin Le Grand 						aBitmapSize.setX(aBitmapSize.getX() * (getSize().getX() * -0.01));
284035a2f44SArmin Le Grand 					}
285035a2f44SArmin Le Grand 					else
286035a2f44SArmin Le Grand 					{
287035a2f44SArmin Le Grand 						aBitmapSize.setX(getSize().getX());
288035a2f44SArmin Le Grand 					}
289035a2f44SArmin Le Grand 				}
290035a2f44SArmin Le Grand 				else
291035a2f44SArmin Le Grand 				{
292*e7d68668SArmin Le Grand                     // #124002# use GraphicLogicSize directly, do not try to use GetPrefSize
293*e7d68668SArmin Le Grand                     // of the graphic, that may not be adapted to the MapMode of the target
294*e7d68668SArmin Le Grand                     aBitmapSize.setX(getGraphicLogicSize().getX());
295035a2f44SArmin Le Grand 				}
296035a2f44SArmin Le Grand 
297035a2f44SArmin Le Grand 				if(0.0 != getSize().getY())
298035a2f44SArmin Le Grand 				{
299035a2f44SArmin Le Grand 					if(getSize().getY() < 0.0)
300035a2f44SArmin Le Grand 					{
301035a2f44SArmin Le Grand 						aBitmapSize.setY(aBitmapSize.getY() * (getSize().getY() * -0.01));
302035a2f44SArmin Le Grand 					}
303035a2f44SArmin Le Grand 					else
304035a2f44SArmin Le Grand 					{
305035a2f44SArmin Le Grand 						aBitmapSize.setY(getSize().getY());
306035a2f44SArmin Le Grand 					}
307035a2f44SArmin Le Grand 				}
308035a2f44SArmin Le Grand 				else
309035a2f44SArmin Le Grand 				{
310*e7d68668SArmin Le Grand                     // #124002# use GraphicLogicSize directly, do not try to use GetPrefSize
311*e7d68668SArmin Le Grand                     // of the graphic, that may not be adapted to the MapMode of the target
312*e7d68668SArmin Le Grand                     aBitmapSize.setY(getGraphicLogicSize().getY());
313035a2f44SArmin Le Grand 				}
314035a2f44SArmin Le Grand 
315035a2f44SArmin Le Grand 				// get values, force to centered if necessary
316035a2f44SArmin Le Grand 				const basegfx::B2DVector aRectPoint(getTiling() ? getRectPoint() : basegfx::B2DVector(0.0, 0.0));
317035a2f44SArmin Le Grand 
318035a2f44SArmin Le Grand 				// position changes X
319035a2f44SArmin Le Grand 				if(0.0 == aRectPoint.getX())
320035a2f44SArmin Le Grand 				{
321035a2f44SArmin Le Grand 					aBitmapTopLeft.setX((fRangeWidth - aBitmapSize.getX()) * 0.5);
322035a2f44SArmin Le Grand 				}
323035a2f44SArmin Le Grand 				else if(1.0 == aRectPoint.getX())
324035a2f44SArmin Le Grand 				{
325035a2f44SArmin Le Grand 					aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX());
326035a2f44SArmin Le Grand 				}
327035a2f44SArmin Le Grand 
328035a2f44SArmin Le Grand 				if(getTiling() && 0.0 != getOffsetPosition().getX())
329035a2f44SArmin Le Grand 				{
330035a2f44SArmin Le Grand 					aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().getX() * 0.01)));
331035a2f44SArmin Le Grand 				}
332035a2f44SArmin Le Grand 
333035a2f44SArmin Le Grand 				// position changes Y
334035a2f44SArmin Le Grand 				if(0.0 == aRectPoint.getY())
335035a2f44SArmin Le Grand 				{
336035a2f44SArmin Le Grand 					aBitmapTopLeft.setY((fRangeHeight - aBitmapSize.getY()) * 0.5);
337035a2f44SArmin Le Grand 				}
338035a2f44SArmin Le Grand 				else if(1.0 == aRectPoint.getY())
339035a2f44SArmin Le Grand 				{
340035a2f44SArmin Le Grand 					aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY());
341035a2f44SArmin Le Grand 				}
342035a2f44SArmin Le Grand 
343035a2f44SArmin Le Grand 				if(getTiling() && 0.0 != getOffsetPosition().getY())
344035a2f44SArmin Le Grand 				{
345035a2f44SArmin Le Grand 					aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().getY() * 0.01)));
346035a2f44SArmin Le Grand 				}
347035a2f44SArmin Le Grand 
348035a2f44SArmin Le Grand 				// apply bitmap size scaling to unit rectangle
349035a2f44SArmin Le Grand 				aBitmapTopLeft.setX(aBitmapTopLeft.getX() / fRangeWidth);
350035a2f44SArmin Le Grand 				aBitmapTopLeft.setY(aBitmapTopLeft.getY() / fRangeHeight);
351035a2f44SArmin Le Grand 				aBitmapSize.setX(aBitmapSize.getX() / fRangeWidth);
352035a2f44SArmin Le Grand 				aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight);
353035a2f44SArmin Le Grand 			}
354035a2f44SArmin Le Grand 
355035a2f44SArmin Le Grand             // get offset in percent
356035a2f44SArmin Le Grand             const double fOffsetX(basegfx::clamp(getOffset().getX() * 0.01, 0.0, 1.0));
357035a2f44SArmin Le Grand             const double fOffsetY(basegfx::clamp(getOffset().getY() * 0.01, 0.0, 1.0));
358035a2f44SArmin Le Grand 
359035a2f44SArmin Le Grand             // create FillGraphicAttribute
360035a2f44SArmin Le Grand             return FillGraphicAttribute(
361035a2f44SArmin Le Grand                 aGraphic,
362035a2f44SArmin Le Grand                 basegfx::B2DRange(aBitmapTopLeft, aBitmapTopLeft + aBitmapSize),
363035a2f44SArmin Le Grand                 getTiling(),
364035a2f44SArmin Le Grand                 fOffsetX,
365035a2f44SArmin Le Grand                 fOffsetY);
366035a2f44SArmin Le Grand 		}
367035a2f44SArmin Le Grand 	} // end of namespace attribute
368035a2f44SArmin Le Grand } // end of namespace drawinglayer
369035a2f44SArmin Le Grand 
370035a2f44SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
371035a2f44SArmin Le Grand // eof
372