xref: /AOO41X/main/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx (revision 035a2f44eca4e31ced924464e6584eacbf3e9114)
1*035a2f44SArmin Le Grand /**************************************************************
2*035a2f44SArmin Le Grand  *
3*035a2f44SArmin Le Grand  * Licensed to the Apache Software Foundation (ASF) under one
4*035a2f44SArmin Le Grand  * or more contributor license agreements.  See the NOTICE file
5*035a2f44SArmin Le Grand  * distributed with this work for additional information
6*035a2f44SArmin Le Grand  * regarding copyright ownership.  The ASF licenses this file
7*035a2f44SArmin Le Grand  * to you under the Apache License, Version 2.0 (the
8*035a2f44SArmin Le Grand  * "License"); you may not use this file except in compliance
9*035a2f44SArmin Le Grand  * with the License.  You may obtain a copy of the License at
10*035a2f44SArmin Le Grand  *
11*035a2f44SArmin Le Grand  *   http://www.apache.org/licenses/LICENSE-2.0
12*035a2f44SArmin Le Grand  *
13*035a2f44SArmin Le Grand  * Unless required by applicable law or agreed to in writing,
14*035a2f44SArmin Le Grand  * software distributed under the License is distributed on an
15*035a2f44SArmin Le Grand  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*035a2f44SArmin Le Grand  * KIND, either express or implied.  See the License for the
17*035a2f44SArmin Le Grand  * specific language governing permissions and limitations
18*035a2f44SArmin Le Grand  * under the License.
19*035a2f44SArmin Le Grand  *
20*035a2f44SArmin Le Grand  *************************************************************/
21*035a2f44SArmin Le Grand 
22*035a2f44SArmin Le Grand 
23*035a2f44SArmin Le Grand 
24*035a2f44SArmin Le Grand // MARKER(update_precomp.py): autogen include statement, do not remove
25*035a2f44SArmin Le Grand #include "precompiled_drawinglayer.hxx"
26*035a2f44SArmin Le Grand 
27*035a2f44SArmin Le Grand #include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
28*035a2f44SArmin Le Grand #include <drawinglayer/attribute/fillgraphicattribute.hxx>
29*035a2f44SArmin Le Grand #include <vcl/graph.hxx>
30*035a2f44SArmin Le Grand 
31*035a2f44SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
32*035a2f44SArmin Le Grand 
33*035a2f44SArmin Le Grand namespace drawinglayer
34*035a2f44SArmin Le Grand {
35*035a2f44SArmin Le Grand 	namespace attribute
36*035a2f44SArmin Le Grand 	{
37*035a2f44SArmin Le Grand 		class ImpSdrFillGraphicAttribute
38*035a2f44SArmin Le Grand 		{
39*035a2f44SArmin Le Grand         public:
40*035a2f44SArmin Le Grand 		    // refcounter
41*035a2f44SArmin Le Grand 		    sal_uInt32								mnRefCount;
42*035a2f44SArmin Le Grand 
43*035a2f44SArmin Le Grand             // data definitions
44*035a2f44SArmin Le Grand 			Graphic                                 maFillGraphic;
45*035a2f44SArmin Le Grand 			basegfx::B2DVector						maSize;
46*035a2f44SArmin Le Grand 			basegfx::B2DVector						maOffset;
47*035a2f44SArmin Le Grand 			basegfx::B2DVector						maOffsetPosition;
48*035a2f44SArmin Le Grand 			basegfx::B2DVector						maRectPoint;
49*035a2f44SArmin Le Grand 
50*035a2f44SArmin Le Grand 			// bitfield
51*035a2f44SArmin Le Grand 			unsigned								mbTiling : 1;
52*035a2f44SArmin Le Grand 			unsigned								mbStretch : 1;
53*035a2f44SArmin Le Grand 			unsigned								mbLogSize : 1;
54*035a2f44SArmin Le Grand 
55*035a2f44SArmin Le Grand 			ImpSdrFillGraphicAttribute(
56*035a2f44SArmin Le Grand 				const Graphic& rFillGraphic,
57*035a2f44SArmin Le Grand                 const basegfx::B2DVector& rSize,
58*035a2f44SArmin Le Grand                 const basegfx::B2DVector& rOffset,
59*035a2f44SArmin Le Grand 				const basegfx::B2DVector& rOffsetPosition,
60*035a2f44SArmin Le Grand                 const basegfx::B2DVector& rRectPoint,
61*035a2f44SArmin Le Grand 				bool bTiling,
62*035a2f44SArmin Le Grand                 bool bStretch,
63*035a2f44SArmin Le Grand                 bool bLogSize)
64*035a2f44SArmin Le Grand 		    :	mnRefCount(0),
65*035a2f44SArmin Le Grand 		    	maFillGraphic(rFillGraphic),
66*035a2f44SArmin Le Grand 			    maSize(rSize),
67*035a2f44SArmin Le Grand 			    maOffset(rOffset),
68*035a2f44SArmin Le Grand 			    maOffsetPosition(rOffsetPosition),
69*035a2f44SArmin Le Grand 			    maRectPoint(rRectPoint),
70*035a2f44SArmin Le Grand 			    mbTiling(bTiling),
71*035a2f44SArmin Le Grand 			    mbStretch(bStretch),
72*035a2f44SArmin Le Grand 			    mbLogSize(bLogSize)
73*035a2f44SArmin Le Grand 		    {
74*035a2f44SArmin Le Grand 		    }
75*035a2f44SArmin Le Grand 
76*035a2f44SArmin Le Grand 			// data read access
77*035a2f44SArmin Le Grand             const Graphic& getFillGraphic() const { return maFillGraphic; }
78*035a2f44SArmin Le Grand             const basegfx::B2DVector& getSize() const { return maSize; }
79*035a2f44SArmin Le Grand             const basegfx::B2DVector& getOffset() const { return maOffset; }
80*035a2f44SArmin Le Grand             const basegfx::B2DVector& getOffsetPosition() const { return maOffsetPosition; }
81*035a2f44SArmin Le Grand             const basegfx::B2DVector& getRectPoint() const { return maRectPoint; }
82*035a2f44SArmin Le Grand             bool getTiling() const { return mbTiling; }
83*035a2f44SArmin Le Grand             bool getStretch() const { return mbStretch; }
84*035a2f44SArmin Le Grand             bool getLogSize() const { return mbLogSize; }
85*035a2f44SArmin Le Grand 
86*035a2f44SArmin Le Grand             bool operator==(const ImpSdrFillGraphicAttribute& rCandidate) const
87*035a2f44SArmin Le Grand             {
88*035a2f44SArmin Le Grand 			    return (getFillGraphic() == rCandidate.getFillGraphic()
89*035a2f44SArmin Le Grand 				    && getSize() == rCandidate.getSize()
90*035a2f44SArmin Le Grand 				    && getOffset() == rCandidate.getOffset()
91*035a2f44SArmin Le Grand 				    && getOffsetPosition() == rCandidate.getOffsetPosition()
92*035a2f44SArmin Le Grand 				    && getRectPoint() == rCandidate.getRectPoint()
93*035a2f44SArmin Le Grand 				    && getTiling() == rCandidate.getTiling()
94*035a2f44SArmin Le Grand 				    && getStretch() == rCandidate.getStretch()
95*035a2f44SArmin Le Grand 				    && getLogSize() == rCandidate.getLogSize());
96*035a2f44SArmin Le Grand             }
97*035a2f44SArmin Le Grand 
98*035a2f44SArmin Le Grand             static ImpSdrFillGraphicAttribute* get_global_default()
99*035a2f44SArmin Le Grand             {
100*035a2f44SArmin Le Grand                 static ImpSdrFillGraphicAttribute* pDefault = 0;
101*035a2f44SArmin Le Grand 
102*035a2f44SArmin Le Grand                 if(!pDefault)
103*035a2f44SArmin Le Grand                 {
104*035a2f44SArmin Le Grand                     pDefault = new ImpSdrFillGraphicAttribute(
105*035a2f44SArmin Le Grand 			            Graphic(),
106*035a2f44SArmin Le Grand                         basegfx::B2DVector(),
107*035a2f44SArmin Le Grand                         basegfx::B2DVector(),
108*035a2f44SArmin Le Grand 			            basegfx::B2DVector(),
109*035a2f44SArmin Le Grand                         basegfx::B2DVector(),
110*035a2f44SArmin Le Grand 			            false,
111*035a2f44SArmin Le Grand                         false,
112*035a2f44SArmin Le Grand                         false);
113*035a2f44SArmin Le Grand 
114*035a2f44SArmin Le Grand                     // never delete; start with RefCount 1, not 0
115*035a2f44SArmin Le Grand     			    pDefault->mnRefCount++;
116*035a2f44SArmin Le Grand                 }
117*035a2f44SArmin Le Grand 
118*035a2f44SArmin Le Grand                 return pDefault;
119*035a2f44SArmin Le Grand             }
120*035a2f44SArmin Le Grand 		};
121*035a2f44SArmin Le Grand 
122*035a2f44SArmin Le Grand         SdrFillGraphicAttribute::SdrFillGraphicAttribute(
123*035a2f44SArmin Le Grand 			const Graphic& rFillGraphic,
124*035a2f44SArmin Le Grand             const basegfx::B2DVector& rSize,
125*035a2f44SArmin Le Grand             const basegfx::B2DVector& rOffset,
126*035a2f44SArmin Le Grand 			const basegfx::B2DVector& rOffsetPosition,
127*035a2f44SArmin Le Grand             const basegfx::B2DVector& rRectPoint,
128*035a2f44SArmin Le Grand 			bool bTiling,
129*035a2f44SArmin Le Grand             bool bStretch,
130*035a2f44SArmin Le Grand             bool bLogSize)
131*035a2f44SArmin Le Grand 		:	mpSdrFillGraphicAttribute(
132*035a2f44SArmin Le Grand                 new ImpSdrFillGraphicAttribute(
133*035a2f44SArmin Le Grand                     rFillGraphic,
134*035a2f44SArmin Le Grand                     rSize,
135*035a2f44SArmin Le Grand                     rOffset,
136*035a2f44SArmin Le Grand                     rOffsetPosition,
137*035a2f44SArmin Le Grand                     rRectPoint,
138*035a2f44SArmin Le Grand                     bTiling,
139*035a2f44SArmin Le Grand                     bStretch,
140*035a2f44SArmin Le Grand                     bLogSize))
141*035a2f44SArmin Le Grand 		{
142*035a2f44SArmin Le Grand 		}
143*035a2f44SArmin Le Grand 
144*035a2f44SArmin Le Grand 		SdrFillGraphicAttribute::SdrFillGraphicAttribute()
145*035a2f44SArmin Le Grand         :	mpSdrFillGraphicAttribute(ImpSdrFillGraphicAttribute::get_global_default())
146*035a2f44SArmin Le Grand 		{
147*035a2f44SArmin Le Grand 			mpSdrFillGraphicAttribute->mnRefCount++;
148*035a2f44SArmin Le Grand 		}
149*035a2f44SArmin Le Grand 
150*035a2f44SArmin Le Grand         SdrFillGraphicAttribute::SdrFillGraphicAttribute(const SdrFillGraphicAttribute& rCandidate)
151*035a2f44SArmin Le Grand 		:	mpSdrFillGraphicAttribute(rCandidate.mpSdrFillGraphicAttribute)
152*035a2f44SArmin Le Grand 		{
153*035a2f44SArmin Le Grand 			mpSdrFillGraphicAttribute->mnRefCount++;
154*035a2f44SArmin Le Grand 		}
155*035a2f44SArmin Le Grand 
156*035a2f44SArmin Le Grand 		SdrFillGraphicAttribute::~SdrFillGraphicAttribute()
157*035a2f44SArmin Le Grand 		{
158*035a2f44SArmin Le Grand 			if(mpSdrFillGraphicAttribute->mnRefCount)
159*035a2f44SArmin Le Grand 			{
160*035a2f44SArmin Le Grand 				mpSdrFillGraphicAttribute->mnRefCount--;
161*035a2f44SArmin Le Grand 			}
162*035a2f44SArmin Le Grand 			else
163*035a2f44SArmin Le Grand 			{
164*035a2f44SArmin Le Grand 				delete mpSdrFillGraphicAttribute;
165*035a2f44SArmin Le Grand 			}
166*035a2f44SArmin Le Grand 		}
167*035a2f44SArmin Le Grand 
168*035a2f44SArmin Le Grand         bool SdrFillGraphicAttribute::isDefault() const
169*035a2f44SArmin Le Grand         {
170*035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute == ImpSdrFillGraphicAttribute::get_global_default();
171*035a2f44SArmin Le Grand         }
172*035a2f44SArmin Le Grand 
173*035a2f44SArmin Le Grand         SdrFillGraphicAttribute& SdrFillGraphicAttribute::operator=(const SdrFillGraphicAttribute& rCandidate)
174*035a2f44SArmin Le Grand 		{
175*035a2f44SArmin Le Grand 			if(rCandidate.mpSdrFillGraphicAttribute != mpSdrFillGraphicAttribute)
176*035a2f44SArmin Le Grand 			{
177*035a2f44SArmin Le Grand 				if(mpSdrFillGraphicAttribute->mnRefCount)
178*035a2f44SArmin Le Grand 				{
179*035a2f44SArmin Le Grand 					mpSdrFillGraphicAttribute->mnRefCount--;
180*035a2f44SArmin Le Grand 				}
181*035a2f44SArmin Le Grand 				else
182*035a2f44SArmin Le Grand 				{
183*035a2f44SArmin Le Grand 					delete mpSdrFillGraphicAttribute;
184*035a2f44SArmin Le Grand 				}
185*035a2f44SArmin Le Grand 
186*035a2f44SArmin Le Grand 				mpSdrFillGraphicAttribute = rCandidate.mpSdrFillGraphicAttribute;
187*035a2f44SArmin Le Grand 				mpSdrFillGraphicAttribute->mnRefCount++;
188*035a2f44SArmin Le Grand 			}
189*035a2f44SArmin Le Grand 
190*035a2f44SArmin Le Grand 			return *this;
191*035a2f44SArmin Le Grand 		}
192*035a2f44SArmin Le Grand 
193*035a2f44SArmin Le Grand 		bool SdrFillGraphicAttribute::operator==(const SdrFillGraphicAttribute& rCandidate) const
194*035a2f44SArmin Le Grand 		{
195*035a2f44SArmin Le Grand 			if(rCandidate.mpSdrFillGraphicAttribute == mpSdrFillGraphicAttribute)
196*035a2f44SArmin Le Grand 			{
197*035a2f44SArmin Le Grand 				return true;
198*035a2f44SArmin Le Grand 			}
199*035a2f44SArmin Le Grand 
200*035a2f44SArmin Le Grand 			if(rCandidate.isDefault() != isDefault())
201*035a2f44SArmin Le Grand 			{
202*035a2f44SArmin Le Grand 				return false;
203*035a2f44SArmin Le Grand 			}
204*035a2f44SArmin Le Grand 
205*035a2f44SArmin Le Grand 			return (*rCandidate.mpSdrFillGraphicAttribute == *mpSdrFillGraphicAttribute);
206*035a2f44SArmin Le Grand 		}
207*035a2f44SArmin Le Grand 
208*035a2f44SArmin Le Grand         const Graphic& SdrFillGraphicAttribute::getFillGraphic() const
209*035a2f44SArmin Le Grand         {
210*035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getFillGraphic();
211*035a2f44SArmin Le Grand         }
212*035a2f44SArmin Le Grand 
213*035a2f44SArmin Le Grand         const basegfx::B2DVector& SdrFillGraphicAttribute::getSize() const
214*035a2f44SArmin Le Grand         {
215*035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getSize();
216*035a2f44SArmin Le Grand         }
217*035a2f44SArmin Le Grand 
218*035a2f44SArmin Le Grand         const basegfx::B2DVector& SdrFillGraphicAttribute::getOffset() const
219*035a2f44SArmin Le Grand         {
220*035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getOffset();
221*035a2f44SArmin Le Grand         }
222*035a2f44SArmin Le Grand 
223*035a2f44SArmin Le Grand         const basegfx::B2DVector& SdrFillGraphicAttribute::getOffsetPosition() const
224*035a2f44SArmin Le Grand         {
225*035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getOffsetPosition();
226*035a2f44SArmin Le Grand         }
227*035a2f44SArmin Le Grand 
228*035a2f44SArmin Le Grand         const basegfx::B2DVector& SdrFillGraphicAttribute::getRectPoint() const
229*035a2f44SArmin Le Grand         {
230*035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getRectPoint();
231*035a2f44SArmin Le Grand         }
232*035a2f44SArmin Le Grand 
233*035a2f44SArmin Le Grand         bool SdrFillGraphicAttribute::getTiling() const
234*035a2f44SArmin Le Grand         {
235*035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getTiling();
236*035a2f44SArmin Le Grand         }
237*035a2f44SArmin Le Grand 
238*035a2f44SArmin Le Grand         bool SdrFillGraphicAttribute::getStretch() const
239*035a2f44SArmin Le Grand         {
240*035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getStretch();
241*035a2f44SArmin Le Grand         }
242*035a2f44SArmin Le Grand 
243*035a2f44SArmin Le Grand         bool SdrFillGraphicAttribute::getLogSize() const
244*035a2f44SArmin Le Grand         {
245*035a2f44SArmin Le Grand             return mpSdrFillGraphicAttribute->getLogSize();
246*035a2f44SArmin Le Grand         }
247*035a2f44SArmin Le Grand 
248*035a2f44SArmin Le Grand         FillGraphicAttribute SdrFillGraphicAttribute::createFillGraphicAttribute(const basegfx::B2DRange& rRange) const
249*035a2f44SArmin Le Grand 		{
250*035a2f44SArmin Le Grand 			// get logical size of bitmap (before expanding eventually)
251*035a2f44SArmin Le Grand 			Graphic aGraphic(getFillGraphic());
252*035a2f44SArmin Le Grand 			const basegfx::B2DVector aLogicalSize(aGraphic.GetPrefSize().getWidth(), aGraphic.GetPrefSize().getHeight());
253*035a2f44SArmin Le Grand 
254*035a2f44SArmin Le Grand 			// init values with defaults
255*035a2f44SArmin Le Grand 			basegfx::B2DPoint aBitmapSize(1.0, 1.0);
256*035a2f44SArmin Le Grand 			basegfx::B2DVector aBitmapTopLeft(0.0, 0.0);
257*035a2f44SArmin Le Grand 
258*035a2f44SArmin Le Grand 			// are changes needed?
259*035a2f44SArmin Le Grand 			if(getTiling() || !getStretch())
260*035a2f44SArmin Le Grand 			{
261*035a2f44SArmin Le Grand 				// init values with range sizes
262*035a2f44SArmin Le Grand 				const double fRangeWidth(0.0 != rRange.getWidth() ? rRange.getWidth() : 1.0);
263*035a2f44SArmin Le Grand 				const double fRangeHeight(0.0 != rRange.getHeight() ? rRange.getHeight() : 1.0);
264*035a2f44SArmin Le Grand 				aBitmapSize = basegfx::B2DPoint(fRangeWidth, fRangeHeight);
265*035a2f44SArmin Le Grand 
266*035a2f44SArmin Le Grand 				// size changes
267*035a2f44SArmin Le Grand 				if(0.0 != getSize().getX())
268*035a2f44SArmin Le Grand 				{
269*035a2f44SArmin Le Grand 					if(getSize().getX() < 0.0)
270*035a2f44SArmin Le Grand 					{
271*035a2f44SArmin Le Grand 						aBitmapSize.setX(aBitmapSize.getX() * (getSize().getX() * -0.01));
272*035a2f44SArmin Le Grand 					}
273*035a2f44SArmin Le Grand 					else
274*035a2f44SArmin Le Grand 					{
275*035a2f44SArmin Le Grand 						aBitmapSize.setX(getSize().getX());
276*035a2f44SArmin Le Grand 					}
277*035a2f44SArmin Le Grand 				}
278*035a2f44SArmin Le Grand 				else
279*035a2f44SArmin Le Grand 				{
280*035a2f44SArmin Le Grand 					aBitmapSize.setX(aLogicalSize.getX());
281*035a2f44SArmin Le Grand 				}
282*035a2f44SArmin Le Grand 
283*035a2f44SArmin Le Grand 				if(0.0 != getSize().getY())
284*035a2f44SArmin Le Grand 				{
285*035a2f44SArmin Le Grand 					if(getSize().getY() < 0.0)
286*035a2f44SArmin Le Grand 					{
287*035a2f44SArmin Le Grand 						aBitmapSize.setY(aBitmapSize.getY() * (getSize().getY() * -0.01));
288*035a2f44SArmin Le Grand 					}
289*035a2f44SArmin Le Grand 					else
290*035a2f44SArmin Le Grand 					{
291*035a2f44SArmin Le Grand 						aBitmapSize.setY(getSize().getY());
292*035a2f44SArmin Le Grand 					}
293*035a2f44SArmin Le Grand 				}
294*035a2f44SArmin Le Grand 				else
295*035a2f44SArmin Le Grand 				{
296*035a2f44SArmin Le Grand 					aBitmapSize.setY(aLogicalSize.getY());
297*035a2f44SArmin Le Grand 				}
298*035a2f44SArmin Le Grand 
299*035a2f44SArmin Le Grand 				// get values, force to centered if necessary
300*035a2f44SArmin Le Grand 				const basegfx::B2DVector aRectPoint(getTiling() ? getRectPoint() : basegfx::B2DVector(0.0, 0.0));
301*035a2f44SArmin Le Grand 
302*035a2f44SArmin Le Grand 				// position changes X
303*035a2f44SArmin Le Grand 				if(0.0 == aRectPoint.getX())
304*035a2f44SArmin Le Grand 				{
305*035a2f44SArmin Le Grand 					aBitmapTopLeft.setX((fRangeWidth - aBitmapSize.getX()) * 0.5);
306*035a2f44SArmin Le Grand 				}
307*035a2f44SArmin Le Grand 				else if(1.0 == aRectPoint.getX())
308*035a2f44SArmin Le Grand 				{
309*035a2f44SArmin Le Grand 					aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX());
310*035a2f44SArmin Le Grand 				}
311*035a2f44SArmin Le Grand 
312*035a2f44SArmin Le Grand 				if(getTiling() && 0.0 != getOffsetPosition().getX())
313*035a2f44SArmin Le Grand 				{
314*035a2f44SArmin Le Grand 					aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().getX() * 0.01)));
315*035a2f44SArmin Le Grand 				}
316*035a2f44SArmin Le Grand 
317*035a2f44SArmin Le Grand 				// position changes Y
318*035a2f44SArmin Le Grand 				if(0.0 == aRectPoint.getY())
319*035a2f44SArmin Le Grand 				{
320*035a2f44SArmin Le Grand 					aBitmapTopLeft.setY((fRangeHeight - aBitmapSize.getY()) * 0.5);
321*035a2f44SArmin Le Grand 				}
322*035a2f44SArmin Le Grand 				else if(1.0 == aRectPoint.getY())
323*035a2f44SArmin Le Grand 				{
324*035a2f44SArmin Le Grand 					aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY());
325*035a2f44SArmin Le Grand 				}
326*035a2f44SArmin Le Grand 
327*035a2f44SArmin Le Grand 				if(getTiling() && 0.0 != getOffsetPosition().getY())
328*035a2f44SArmin Le Grand 				{
329*035a2f44SArmin Le Grand 					aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().getY() * 0.01)));
330*035a2f44SArmin Le Grand 				}
331*035a2f44SArmin Le Grand 
332*035a2f44SArmin Le Grand 				// apply bitmap size scaling to unit rectangle
333*035a2f44SArmin Le Grand 				aBitmapTopLeft.setX(aBitmapTopLeft.getX() / fRangeWidth);
334*035a2f44SArmin Le Grand 				aBitmapTopLeft.setY(aBitmapTopLeft.getY() / fRangeHeight);
335*035a2f44SArmin Le Grand 				aBitmapSize.setX(aBitmapSize.getX() / fRangeWidth);
336*035a2f44SArmin Le Grand 				aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight);
337*035a2f44SArmin Le Grand 			}
338*035a2f44SArmin Le Grand 
339*035a2f44SArmin Le Grand             // get offset in percent
340*035a2f44SArmin Le Grand             const double fOffsetX(basegfx::clamp(getOffset().getX() * 0.01, 0.0, 1.0));
341*035a2f44SArmin Le Grand             const double fOffsetY(basegfx::clamp(getOffset().getY() * 0.01, 0.0, 1.0));
342*035a2f44SArmin Le Grand 
343*035a2f44SArmin Le Grand             // create FillGraphicAttribute
344*035a2f44SArmin Le Grand             return FillGraphicAttribute(
345*035a2f44SArmin Le Grand                 aGraphic,
346*035a2f44SArmin Le Grand                 basegfx::B2DRange(aBitmapTopLeft, aBitmapTopLeft + aBitmapSize),
347*035a2f44SArmin Le Grand                 getTiling(),
348*035a2f44SArmin Le Grand                 fOffsetX,
349*035a2f44SArmin Le Grand                 fOffsetY);
350*035a2f44SArmin Le Grand 		}
351*035a2f44SArmin Le Grand 	} // end of namespace attribute
352*035a2f44SArmin Le Grand } // end of namespace drawinglayer
353*035a2f44SArmin Le Grand 
354*035a2f44SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
355*035a2f44SArmin Le Grand // eof
356