xref: /AOO41X/main/svx/source/table/viewcontactoftableobj.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "viewcontactoftableobj.hxx"
32*cdf0e10cSrcweir #include <svx/svdotable.hxx>
33*cdf0e10cSrcweir #include <com/sun/star/table/XTable.hpp>
34*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
35*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
36*cdf0e10cSrcweir #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
37*cdf0e10cSrcweir #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
38*cdf0e10cSrcweir #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
39*cdf0e10cSrcweir #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
40*cdf0e10cSrcweir #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
41*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
42*cdf0e10cSrcweir #include <svx/sdr/attribute/sdrtextattribute.hxx>
43*cdf0e10cSrcweir #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
44*cdf0e10cSrcweir #include <editeng/borderline.hxx>
45*cdf0e10cSrcweir #include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
46*cdf0e10cSrcweir #include <svx/sdr/attribute/sdrfilltextattribute.hxx>
47*cdf0e10cSrcweir #include <drawinglayer/attribute/sdrlineattribute.hxx>
48*cdf0e10cSrcweir #include <drawinglayer/attribute/sdrshadowattribute.hxx>
49*cdf0e10cSrcweir #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
50*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx>
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #include "cell.hxx"
53*cdf0e10cSrcweir #include "tablelayouter.hxx"
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir using namespace com::sun::star;
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir namespace drawinglayer
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir 	namespace primitive2d
64*cdf0e10cSrcweir 	{
65*cdf0e10cSrcweir 		class SdrCellPrimitive2D : public BufferedDecompositionPrimitive2D
66*cdf0e10cSrcweir 		{
67*cdf0e10cSrcweir 		private:
68*cdf0e10cSrcweir 			basegfx::B2DHomMatrix						maTransform;
69*cdf0e10cSrcweir 			attribute::SdrFillTextAttribute				maSdrFTAttribute;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 		protected:
72*cdf0e10cSrcweir 			// local decomposition.
73*cdf0e10cSrcweir 			virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir 		public:
76*cdf0e10cSrcweir 			SdrCellPrimitive2D(
77*cdf0e10cSrcweir 				const basegfx::B2DHomMatrix& rTransform,
78*cdf0e10cSrcweir 				const attribute::SdrFillTextAttribute& rSdrFTAttribute)
79*cdf0e10cSrcweir 			:	BufferedDecompositionPrimitive2D(),
80*cdf0e10cSrcweir 				maTransform(rTransform),
81*cdf0e10cSrcweir 				maSdrFTAttribute(rSdrFTAttribute)
82*cdf0e10cSrcweir 			{
83*cdf0e10cSrcweir 			}
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 			// data access
86*cdf0e10cSrcweir 			const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
87*cdf0e10cSrcweir 			const attribute::SdrFillTextAttribute& getSdrFTAttribute() const { return maSdrFTAttribute; }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 			// compare operator
90*cdf0e10cSrcweir 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 			// provide unique ID
93*cdf0e10cSrcweir 			DeclPrimitrive2DIDBlock()
94*cdf0e10cSrcweir 		};
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 		Primitive2DSequence SdrCellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
97*cdf0e10cSrcweir 		{
98*cdf0e10cSrcweir 			// prepare unit polygon
99*cdf0e10cSrcweir 			Primitive2DSequence aRetval;
100*cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon());
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 			// add fill
103*cdf0e10cSrcweir 			if(!getSdrFTAttribute().getFill().isDefault())
104*cdf0e10cSrcweir 			{
105*cdf0e10cSrcweir 				appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
106*cdf0e10cSrcweir 					createPolyPolygonFillPrimitive(
107*cdf0e10cSrcweir 						aUnitPolyPolygon,
108*cdf0e10cSrcweir 						getTransform(),
109*cdf0e10cSrcweir 						getSdrFTAttribute().getFill(),
110*cdf0e10cSrcweir 						getSdrFTAttribute().getFillFloatTransGradient()));
111*cdf0e10cSrcweir 			}
112*cdf0e10cSrcweir             else
113*cdf0e10cSrcweir             {
114*cdf0e10cSrcweir                 // if no fill create one for HitTest and BoundRect fallback
115*cdf0e10cSrcweir                 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
116*cdf0e10cSrcweir                     createHiddenGeometryPrimitives2D(
117*cdf0e10cSrcweir                         true,
118*cdf0e10cSrcweir                         aUnitPolyPolygon,
119*cdf0e10cSrcweir                         getTransform()));
120*cdf0e10cSrcweir             }
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 			// add text
123*cdf0e10cSrcweir 			if(!getSdrFTAttribute().getText().isDefault())
124*cdf0e10cSrcweir 			{
125*cdf0e10cSrcweir 				appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
126*cdf0e10cSrcweir 					createTextPrimitive(
127*cdf0e10cSrcweir 						aUnitPolyPolygon,
128*cdf0e10cSrcweir 						getTransform(),
129*cdf0e10cSrcweir 						getSdrFTAttribute().getText(),
130*cdf0e10cSrcweir 						attribute::SdrLineAttribute(),
131*cdf0e10cSrcweir 						true,
132*cdf0e10cSrcweir 						false,
133*cdf0e10cSrcweir 						false));
134*cdf0e10cSrcweir 			}
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir 			return aRetval;
137*cdf0e10cSrcweir 		}
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 		bool SdrCellPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
140*cdf0e10cSrcweir 		{
141*cdf0e10cSrcweir 			if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
142*cdf0e10cSrcweir 			{
143*cdf0e10cSrcweir 				const SdrCellPrimitive2D& rCompare = (SdrCellPrimitive2D&)rPrimitive;
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 				return (getTransform() == rCompare.getTransform()
146*cdf0e10cSrcweir 					&& getSdrFTAttribute() == rCompare.getSdrFTAttribute());
147*cdf0e10cSrcweir 			}
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 			return false;
150*cdf0e10cSrcweir 		}
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 		// provide unique ID
153*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(SdrCellPrimitive2D, PRIMITIVE2D_ID_SDRCELLPRIMITIVE2D)
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 	} // end of namespace primitive2d
156*cdf0e10cSrcweir } // end of namespace drawinglayer
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir namespace drawinglayer
161*cdf0e10cSrcweir {
162*cdf0e10cSrcweir 	namespace primitive2d
163*cdf0e10cSrcweir 	{
164*cdf0e10cSrcweir 		class SdrBorderlinePrimitive2D : public BufferedDecompositionPrimitive2D
165*cdf0e10cSrcweir 		{
166*cdf0e10cSrcweir 		private:
167*cdf0e10cSrcweir 			basegfx::B2DHomMatrix						maTransform;
168*cdf0e10cSrcweir 			SvxBorderLine								maLeftLine;
169*cdf0e10cSrcweir 			SvxBorderLine								maBottomLine;
170*cdf0e10cSrcweir 			SvxBorderLine								maRightLine;
171*cdf0e10cSrcweir 			SvxBorderLine								maTopLine;
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 			// bitfield
174*cdf0e10cSrcweir 			unsigned									mbLeftIsOutside : 1;
175*cdf0e10cSrcweir 			unsigned									mbBottomIsOutside : 1;
176*cdf0e10cSrcweir 			unsigned									mbRightIsOutside : 1;
177*cdf0e10cSrcweir 			unsigned									mbTopIsOutside : 1;
178*cdf0e10cSrcweir 			unsigned									mbInTwips : 1;
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 		protected:
181*cdf0e10cSrcweir 			// local decomposition.
182*cdf0e10cSrcweir 			virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 		public:
185*cdf0e10cSrcweir 			SdrBorderlinePrimitive2D(
186*cdf0e10cSrcweir 				const basegfx::B2DHomMatrix& rTransform,
187*cdf0e10cSrcweir 				const SvxBorderLine& rLeftLine,
188*cdf0e10cSrcweir 				const SvxBorderLine& rBottomLine,
189*cdf0e10cSrcweir 				const SvxBorderLine& rRightLine,
190*cdf0e10cSrcweir 				const SvxBorderLine& rTopLine,
191*cdf0e10cSrcweir 				bool bLeftIsOutside,
192*cdf0e10cSrcweir 				bool bBottomIsOutside,
193*cdf0e10cSrcweir 				bool bRightIsOutside,
194*cdf0e10cSrcweir 				bool bTopIsOutside,
195*cdf0e10cSrcweir 				bool bInTwips)
196*cdf0e10cSrcweir 			:	BufferedDecompositionPrimitive2D(),
197*cdf0e10cSrcweir 				maTransform(rTransform),
198*cdf0e10cSrcweir 				maLeftLine(rLeftLine),
199*cdf0e10cSrcweir 				maBottomLine(rBottomLine),
200*cdf0e10cSrcweir 				maRightLine(rRightLine),
201*cdf0e10cSrcweir 				maTopLine(rTopLine),
202*cdf0e10cSrcweir 				mbLeftIsOutside(bLeftIsOutside),
203*cdf0e10cSrcweir 				mbBottomIsOutside(bBottomIsOutside),
204*cdf0e10cSrcweir 				mbRightIsOutside(bRightIsOutside),
205*cdf0e10cSrcweir 				mbTopIsOutside(bTopIsOutside),
206*cdf0e10cSrcweir 				mbInTwips(bInTwips)
207*cdf0e10cSrcweir 			{
208*cdf0e10cSrcweir 			}
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 			// data access
212*cdf0e10cSrcweir 			const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
213*cdf0e10cSrcweir 			const SvxBorderLine& getLeftLine() const { return maLeftLine; }
214*cdf0e10cSrcweir 			const SvxBorderLine& getBottomLine() const { return maBottomLine; }
215*cdf0e10cSrcweir 			const SvxBorderLine& getRightLine() const { return maRightLine; }
216*cdf0e10cSrcweir 			const SvxBorderLine& getTopLine() const { return maTopLine; }
217*cdf0e10cSrcweir 			bool getLeftIsOutside() const { return mbLeftIsOutside; }
218*cdf0e10cSrcweir 			bool getBottomIsOutside() const { return mbBottomIsOutside; }
219*cdf0e10cSrcweir 			bool getRightIsOutside() const { return mbRightIsOutside; }
220*cdf0e10cSrcweir 			bool getTopIsOutside() const { return mbTopIsOutside; }
221*cdf0e10cSrcweir 			bool getInTwips() const { return mbInTwips; }
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir 			// compare operator
224*cdf0e10cSrcweir 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 			// provide unique ID
227*cdf0e10cSrcweir 			DeclPrimitrive2DIDBlock()
228*cdf0e10cSrcweir 		};
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 		sal_uInt16 getBorderLineOutWidth(const SvxBorderLine& rLineA)
231*cdf0e10cSrcweir 		{
232*cdf0e10cSrcweir 			return (1 == rLineA.GetOutWidth() ? 0 : rLineA.GetOutWidth());
233*cdf0e10cSrcweir 		}
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir 		sal_uInt16 getBorderLineDistance(const SvxBorderLine& rLineA)
236*cdf0e10cSrcweir 		{
237*cdf0e10cSrcweir 			return (1 == rLineA.GetDistance() ? 0 : rLineA.GetDistance());
238*cdf0e10cSrcweir 		}
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 		sal_uInt16 getBorderLineInWidth(const SvxBorderLine& rLineA)
241*cdf0e10cSrcweir 		{
242*cdf0e10cSrcweir 			return (1 == rLineA.GetInWidth() ? 0 : rLineA.GetInWidth());
243*cdf0e10cSrcweir 		}
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir 		sal_uInt16 getBorderLineWidth(const SvxBorderLine& rLineA)
246*cdf0e10cSrcweir 		{
247*cdf0e10cSrcweir 			return getBorderLineOutWidth(rLineA) + getBorderLineDistance(rLineA) + getBorderLineInWidth(rLineA);
248*cdf0e10cSrcweir 		}
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 		double getInnerExtend(const SvxBorderLine& rLineA, bool bSideToUse)
251*cdf0e10cSrcweir 		{
252*cdf0e10cSrcweir 			if(!rLineA.isEmpty())
253*cdf0e10cSrcweir 			{
254*cdf0e10cSrcweir 				if(rLineA.isDouble())
255*cdf0e10cSrcweir 				{
256*cdf0e10cSrcweir 					// reduce to inner edge of associated matching line
257*cdf0e10cSrcweir 					return -((getBorderLineWidth(rLineA) / 2.0) - (bSideToUse ? getBorderLineOutWidth(rLineA) : getBorderLineInWidth(rLineA)));
258*cdf0e10cSrcweir 				}
259*cdf0e10cSrcweir 				else
260*cdf0e10cSrcweir 				{
261*cdf0e10cSrcweir 					// extend to overlap with single line
262*cdf0e10cSrcweir 					return getBorderLineWidth(rLineA) / 2.0;
263*cdf0e10cSrcweir 				}
264*cdf0e10cSrcweir 			}
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 			return 0.0;
267*cdf0e10cSrcweir 		}
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir 		double getOuterExtend(const SvxBorderLine& rLineA)
270*cdf0e10cSrcweir 		{
271*cdf0e10cSrcweir 			if(!rLineA.isEmpty())
272*cdf0e10cSrcweir 			{
273*cdf0e10cSrcweir 				// extend to overlap with single line
274*cdf0e10cSrcweir 				return getBorderLineWidth(rLineA) / 2.0;
275*cdf0e10cSrcweir 			}
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir 			return 0.0;
278*cdf0e10cSrcweir 		}
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 		double getChangedValue(sal_uInt16 nValue, bool bChangeToMM)
281*cdf0e10cSrcweir 		{
282*cdf0e10cSrcweir 			if(1 == nValue)
283*cdf0e10cSrcweir 				return 1.0;
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir 			if(bChangeToMM)
286*cdf0e10cSrcweir 				return nValue * (127.0 / 72.0);
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 			return (double)nValue;
289*cdf0e10cSrcweir 		}
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir 		Primitive2DSequence SdrBorderlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
292*cdf0e10cSrcweir 		{
293*cdf0e10cSrcweir 			Primitive2DSequence xRetval(4);
294*cdf0e10cSrcweir 			sal_uInt32 nInsert(0);
295*cdf0e10cSrcweir 			const double fTwipsToMM(getInTwips() ? (127.0 / 72.0) : 1.0);
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir 			if(!getLeftLine().isEmpty())
298*cdf0e10cSrcweir 			{
299*cdf0e10cSrcweir 				// create left line from top to bottom
300*cdf0e10cSrcweir 				const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(0.0, 0.0));
301*cdf0e10cSrcweir 				const basegfx::B2DPoint aEnd(getTransform() * basegfx::B2DPoint(0.0, 1.0));
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 				if(!aStart.equal(aEnd))
304*cdf0e10cSrcweir 				{
305*cdf0e10cSrcweir 					const double fExtendIS(getInnerExtend(getTopLine(), false));
306*cdf0e10cSrcweir 					const double fExtendIE(getInnerExtend(getBottomLine(), true));
307*cdf0e10cSrcweir 					double fExtendOS(0.0);
308*cdf0e10cSrcweir 					double fExtendOE(0.0);
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir 					if(getLeftIsOutside())
311*cdf0e10cSrcweir 					{
312*cdf0e10cSrcweir 						if(getTopIsOutside())
313*cdf0e10cSrcweir 						{
314*cdf0e10cSrcweir 							fExtendOS = getOuterExtend(getTopLine());
315*cdf0e10cSrcweir 						}
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir 						if(getBottomIsOutside())
318*cdf0e10cSrcweir 						{
319*cdf0e10cSrcweir 							fExtendOE = getOuterExtend(getBottomLine());
320*cdf0e10cSrcweir 						}
321*cdf0e10cSrcweir 					}
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir 					xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
324*cdf0e10cSrcweir 						aStart,
325*cdf0e10cSrcweir 						aEnd,
326*cdf0e10cSrcweir 						getChangedValue(getLeftLine().GetOutWidth(), getInTwips()),
327*cdf0e10cSrcweir 						getChangedValue(getLeftLine().GetDistance(), getInTwips()),
328*cdf0e10cSrcweir 						getChangedValue(getLeftLine().GetInWidth(), getInTwips()),
329*cdf0e10cSrcweir 						fExtendIS * fTwipsToMM,
330*cdf0e10cSrcweir 						fExtendIE * fTwipsToMM,
331*cdf0e10cSrcweir 						fExtendOS * fTwipsToMM,
332*cdf0e10cSrcweir 						fExtendOE * fTwipsToMM,
333*cdf0e10cSrcweir 						true,
334*cdf0e10cSrcweir 						getLeftIsOutside(),
335*cdf0e10cSrcweir 						getLeftLine().GetColor().getBColor()));
336*cdf0e10cSrcweir 				}
337*cdf0e10cSrcweir 			}
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 			if(!getBottomLine().isEmpty())
340*cdf0e10cSrcweir 			{
341*cdf0e10cSrcweir 				// create bottom line from left to right
342*cdf0e10cSrcweir 				const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(0.0, 1.0));
343*cdf0e10cSrcweir 				const basegfx::B2DPoint aEnd(getTransform() * basegfx::B2DPoint(1.0, 1.0));
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir 				if(!aStart.equal(aEnd))
346*cdf0e10cSrcweir 				{
347*cdf0e10cSrcweir 					const double fExtendIS(getInnerExtend(getLeftLine(), true));
348*cdf0e10cSrcweir 					const double fExtendIE(getInnerExtend(getRightLine(), false));
349*cdf0e10cSrcweir 					double fExtendOS(0.0);
350*cdf0e10cSrcweir 					double fExtendOE(0.0);
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 					if(getBottomIsOutside())
353*cdf0e10cSrcweir 					{
354*cdf0e10cSrcweir 						if(getLeftIsOutside())
355*cdf0e10cSrcweir 						{
356*cdf0e10cSrcweir 							fExtendOS = getOuterExtend(getLeftLine());
357*cdf0e10cSrcweir 						}
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir 						if(getRightIsOutside())
360*cdf0e10cSrcweir 						{
361*cdf0e10cSrcweir 							fExtendOE = getOuterExtend(getRightLine());
362*cdf0e10cSrcweir 						}
363*cdf0e10cSrcweir 					}
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir 					xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
366*cdf0e10cSrcweir 						aStart,
367*cdf0e10cSrcweir 						aEnd,
368*cdf0e10cSrcweir 						getChangedValue(getBottomLine().GetOutWidth(), getInTwips()),
369*cdf0e10cSrcweir 						getChangedValue(getBottomLine().GetDistance(), getInTwips()),
370*cdf0e10cSrcweir 						getChangedValue(getBottomLine().GetInWidth(), getInTwips()),
371*cdf0e10cSrcweir 						fExtendIS * fTwipsToMM,
372*cdf0e10cSrcweir 						fExtendIE * fTwipsToMM,
373*cdf0e10cSrcweir 						fExtendOS * fTwipsToMM,
374*cdf0e10cSrcweir 						fExtendOE * fTwipsToMM,
375*cdf0e10cSrcweir 						true,
376*cdf0e10cSrcweir 						getBottomIsOutside(),
377*cdf0e10cSrcweir 						getBottomLine().GetColor().getBColor()));
378*cdf0e10cSrcweir 				}
379*cdf0e10cSrcweir 			}
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 			if(!getRightLine().isEmpty())
382*cdf0e10cSrcweir 			{
383*cdf0e10cSrcweir 				// create right line from top to bottom
384*cdf0e10cSrcweir 				const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(1.0, 0.0));
385*cdf0e10cSrcweir 				const basegfx::B2DPoint aEnd(getTransform() * basegfx::B2DPoint(1.0, 1.0));
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir 				if(!aStart.equal(aEnd))
388*cdf0e10cSrcweir 				{
389*cdf0e10cSrcweir 					const double fExtendIS(getInnerExtend(getTopLine(), false));
390*cdf0e10cSrcweir 					const double fExtendIE(getInnerExtend(getBottomLine(), true));
391*cdf0e10cSrcweir 					double fExtendOS(0.0);
392*cdf0e10cSrcweir 					double fExtendOE(0.0);
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir 					if(getRightIsOutside())
395*cdf0e10cSrcweir 					{
396*cdf0e10cSrcweir 						if(getTopIsOutside())
397*cdf0e10cSrcweir 						{
398*cdf0e10cSrcweir 							fExtendOS = getOuterExtend(getTopLine());
399*cdf0e10cSrcweir 						}
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir 						if(getBottomIsOutside())
402*cdf0e10cSrcweir 						{
403*cdf0e10cSrcweir 							fExtendOE = getOuterExtend(getBottomLine());
404*cdf0e10cSrcweir 						}
405*cdf0e10cSrcweir 					}
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 					xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
408*cdf0e10cSrcweir 						aStart,
409*cdf0e10cSrcweir 						aEnd,
410*cdf0e10cSrcweir 						getChangedValue(getRightLine().GetOutWidth(), getInTwips()),
411*cdf0e10cSrcweir 						getChangedValue(getRightLine().GetDistance(), getInTwips()),
412*cdf0e10cSrcweir 						getChangedValue(getRightLine().GetInWidth(), getInTwips()),
413*cdf0e10cSrcweir 						fExtendOS * fTwipsToMM,
414*cdf0e10cSrcweir 						fExtendOE * fTwipsToMM,
415*cdf0e10cSrcweir 						fExtendIS * fTwipsToMM,
416*cdf0e10cSrcweir 						fExtendIE * fTwipsToMM,
417*cdf0e10cSrcweir 						getRightIsOutside(),
418*cdf0e10cSrcweir 						true,
419*cdf0e10cSrcweir 						getRightLine().GetColor().getBColor()));
420*cdf0e10cSrcweir 				}
421*cdf0e10cSrcweir 			}
422*cdf0e10cSrcweir 
423*cdf0e10cSrcweir 			if(!getTopLine().isEmpty())
424*cdf0e10cSrcweir 			{
425*cdf0e10cSrcweir 				// create top line from left to right
426*cdf0e10cSrcweir 				const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(0.0, 0.0));
427*cdf0e10cSrcweir 				const basegfx::B2DPoint aEnd(getTransform() * basegfx::B2DPoint(1.0, 0.0));
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir 				if(!aStart.equal(aEnd))
430*cdf0e10cSrcweir 				{
431*cdf0e10cSrcweir 					const double fExtendIS(getInnerExtend(getLeftLine(), true));
432*cdf0e10cSrcweir 					const double fExtendIE(getInnerExtend(getRightLine(), false));
433*cdf0e10cSrcweir 					double fExtendOS(0.0);
434*cdf0e10cSrcweir 					double fExtendOE(0.0);
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir 					if(getTopIsOutside())
437*cdf0e10cSrcweir 					{
438*cdf0e10cSrcweir 						if(getLeftIsOutside())
439*cdf0e10cSrcweir 						{
440*cdf0e10cSrcweir 							fExtendOS = getOuterExtend(getLeftLine());
441*cdf0e10cSrcweir 						}
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir 						if(getRightIsOutside())
444*cdf0e10cSrcweir 						{
445*cdf0e10cSrcweir 							fExtendOE = getOuterExtend(getRightLine());
446*cdf0e10cSrcweir 						}
447*cdf0e10cSrcweir 					}
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir 					xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
450*cdf0e10cSrcweir 						aStart,
451*cdf0e10cSrcweir 						aEnd,
452*cdf0e10cSrcweir 						getChangedValue(getTopLine().GetOutWidth(), getInTwips()),
453*cdf0e10cSrcweir 						getChangedValue(getTopLine().GetDistance(), getInTwips()),
454*cdf0e10cSrcweir 						getChangedValue(getTopLine().GetInWidth(), getInTwips()),
455*cdf0e10cSrcweir 						fExtendOS * fTwipsToMM,
456*cdf0e10cSrcweir 						fExtendOE * fTwipsToMM,
457*cdf0e10cSrcweir 						fExtendIS * fTwipsToMM,
458*cdf0e10cSrcweir 						fExtendIE * fTwipsToMM,
459*cdf0e10cSrcweir 						getTopIsOutside(),
460*cdf0e10cSrcweir 						true,
461*cdf0e10cSrcweir 						getTopLine().GetColor().getBColor()));
462*cdf0e10cSrcweir 				}
463*cdf0e10cSrcweir 			}
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir 			xRetval.realloc(nInsert);
466*cdf0e10cSrcweir 			return xRetval;
467*cdf0e10cSrcweir 		}
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir 		bool SdrBorderlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
470*cdf0e10cSrcweir 		{
471*cdf0e10cSrcweir 			if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
472*cdf0e10cSrcweir 			{
473*cdf0e10cSrcweir 				const SdrBorderlinePrimitive2D& rCompare = (SdrBorderlinePrimitive2D&)rPrimitive;
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir 				return (getTransform() == rCompare.getTransform()
476*cdf0e10cSrcweir 					&& getLeftLine() == rCompare.getLeftLine()
477*cdf0e10cSrcweir 					&& getBottomLine() == rCompare.getBottomLine()
478*cdf0e10cSrcweir 					&& getRightLine() == rCompare.getRightLine()
479*cdf0e10cSrcweir 					&& getTopLine() == rCompare.getTopLine()
480*cdf0e10cSrcweir 					&& getLeftIsOutside() == rCompare.getLeftIsOutside()
481*cdf0e10cSrcweir 					&& getBottomIsOutside() == rCompare.getBottomIsOutside()
482*cdf0e10cSrcweir 					&& getRightIsOutside() == rCompare.getRightIsOutside()
483*cdf0e10cSrcweir 					&& getTopIsOutside() == rCompare.getTopIsOutside()
484*cdf0e10cSrcweir 					&& getInTwips() == rCompare.getInTwips());
485*cdf0e10cSrcweir 			}
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir 			return false;
488*cdf0e10cSrcweir 		}
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir 		// provide unique ID
491*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(SdrBorderlinePrimitive2D, PRIMITIVE2D_ID_SDRBORDERLINEPRIMITIVE2D)
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir 	} // end of namespace primitive2d
494*cdf0e10cSrcweir } // end of namespace drawinglayer
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir namespace sdr
499*cdf0e10cSrcweir {
500*cdf0e10cSrcweir 	namespace contact
501*cdf0e10cSrcweir 	{
502*cdf0e10cSrcweir 		void impGetLine(SvxBorderLine& aLine, const sdr::table::TableLayouter& rLayouter, sal_Int32 nX, sal_Int32 nY, bool bHorizontal, sal_Int32 nColCount, sal_Int32 nRowCount, bool bIsRTL)
503*cdf0e10cSrcweir 		{
504*cdf0e10cSrcweir 			if(nX >= 0 && nX <= nColCount && nY >= 0 && nY <= nRowCount)
505*cdf0e10cSrcweir 			{
506*cdf0e10cSrcweir 				const SvxBorderLine* pLine = rLayouter.getBorderLine(nX, nY, bHorizontal);
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir 				if(pLine)
509*cdf0e10cSrcweir 				{
510*cdf0e10cSrcweir 					// copy line content
511*cdf0e10cSrcweir 					aLine = *pLine;
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir 					// check for mirroring. This shall always be done when it is
514*cdf0e10cSrcweir 					// not a top- or rightmost line
515*cdf0e10cSrcweir 					bool bMirror(aLine.isDouble());
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir 					if(bMirror)
518*cdf0e10cSrcweir 					{
519*cdf0e10cSrcweir 						if(bHorizontal)
520*cdf0e10cSrcweir 						{
521*cdf0e10cSrcweir 							// mirror all bottom lines
522*cdf0e10cSrcweir 							bMirror = (0 != nY);
523*cdf0e10cSrcweir 						}
524*cdf0e10cSrcweir 						else
525*cdf0e10cSrcweir 						{
526*cdf0e10cSrcweir 							// mirror all left lines
527*cdf0e10cSrcweir 							bMirror = (bIsRTL ? 0 != nX : nX != nColCount);
528*cdf0e10cSrcweir 						}
529*cdf0e10cSrcweir 					}
530*cdf0e10cSrcweir 
531*cdf0e10cSrcweir 					if(bMirror)
532*cdf0e10cSrcweir 					{
533*cdf0e10cSrcweir 						aLine.SetOutWidth(pLine->GetInWidth());
534*cdf0e10cSrcweir 						aLine.SetInWidth(pLine->GetOutWidth());
535*cdf0e10cSrcweir 					}
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir 					return;
538*cdf0e10cSrcweir 				}
539*cdf0e10cSrcweir 			}
540*cdf0e10cSrcweir 
541*cdf0e10cSrcweir 			// no success, copy empty line
542*cdf0e10cSrcweir 			const SvxBorderLine aEmptyLine;
543*cdf0e10cSrcweir 			aLine = aEmptyLine;
544*cdf0e10cSrcweir 		}
545*cdf0e10cSrcweir 
546*cdf0e10cSrcweir 		drawinglayer::primitive2d::Primitive2DSequence ViewContactOfTableObj::createViewIndependentPrimitive2DSequence() const
547*cdf0e10cSrcweir         {
548*cdf0e10cSrcweir 			const sdr::table::SdrTableObj& rTableObj = GetTableObj();
549*cdf0e10cSrcweir             const uno::Reference< com::sun::star::table::XTable > xTable = rTableObj.getTable();
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir             if(xTable.is())
552*cdf0e10cSrcweir             {
553*cdf0e10cSrcweir                 // create primitive representation for table
554*cdf0e10cSrcweir 	            drawinglayer::primitive2d::Primitive2DSequence xRetval;
555*cdf0e10cSrcweir                 const sal_Int32 nRowCount(xTable->getRowCount());
556*cdf0e10cSrcweir                 const sal_Int32 nColCount(xTable->getColumnCount());
557*cdf0e10cSrcweir                 const sal_Int32 nAllCount(nRowCount * nColCount);
558*cdf0e10cSrcweir 
559*cdf0e10cSrcweir                 if(nAllCount)
560*cdf0e10cSrcweir                 {
561*cdf0e10cSrcweir 					const sdr::table::TableLayouter& rTableLayouter = rTableObj.getTableLayouter();
562*cdf0e10cSrcweir 					const bool bIsRTL(com::sun::star::text::WritingMode_RL_TB == rTableObj.GetWritingMode());
563*cdf0e10cSrcweir                 	sdr::table::CellPos aCellPos;
564*cdf0e10cSrcweir 					sdr::table::CellRef xCurrentCell;
565*cdf0e10cSrcweir 					basegfx::B2IRectangle aCellArea;
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir 		            // create range using the model data directly. This is in SdrTextObj::aRect which i will access using
568*cdf0e10cSrcweir                     // GetGeoRect() to not trigger any calculations. It's the unrotated geometry.
569*cdf0e10cSrcweir 		            const Rectangle& rObjectRectangle(rTableObj.GetGeoRect());
570*cdf0e10cSrcweir 		            const basegfx::B2DRange aObjectRange(rObjectRectangle.Left(), rObjectRectangle.Top(), rObjectRectangle.Right(), rObjectRectangle.Bottom());
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir 					// for each cell we need potentially a cell primitive and a border primitive
573*cdf0e10cSrcweir 					// (e.g. single cell). Prepare sequences and input counters
574*cdf0e10cSrcweir 					drawinglayer::primitive2d::Primitive2DSequence xCellSequence(nAllCount);
575*cdf0e10cSrcweir 					drawinglayer::primitive2d::Primitive2DSequence xBorderSequence(nAllCount);
576*cdf0e10cSrcweir 					sal_uInt32 nCellInsert(0);
577*cdf0e10cSrcweir 					sal_uInt32 nBorderInsert(0);
578*cdf0e10cSrcweir 
579*cdf0e10cSrcweir 					// variables for border lines
580*cdf0e10cSrcweir 					SvxBorderLine aLeftLine;
581*cdf0e10cSrcweir 					SvxBorderLine aBottomLine;
582*cdf0e10cSrcweir 					SvxBorderLine aRightLine;
583*cdf0e10cSrcweir 					SvxBorderLine aTopLine;
584*cdf0e10cSrcweir 
585*cdf0e10cSrcweir 					// create single primitives per cell
586*cdf0e10cSrcweir 					for(aCellPos.mnRow = 0; aCellPos.mnRow < nRowCount; aCellPos.mnRow++)
587*cdf0e10cSrcweir                     {
588*cdf0e10cSrcweir 		                for(aCellPos.mnCol = 0; aCellPos.mnCol < nColCount; aCellPos.mnCol++)
589*cdf0e10cSrcweir                         {
590*cdf0e10cSrcweir 							xCurrentCell.set(dynamic_cast< sdr::table::Cell* >(xTable->getCellByPosition(aCellPos.mnCol, aCellPos.mnRow).get()));
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir 							if(xCurrentCell.is() && !xCurrentCell->isMerged())
593*cdf0e10cSrcweir 							{
594*cdf0e10cSrcweir 								if(rTableLayouter.getCellArea(aCellPos, aCellArea))
595*cdf0e10cSrcweir 								{
596*cdf0e10cSrcweir 									// create cell transformation matrix
597*cdf0e10cSrcweir 									basegfx::B2DHomMatrix aCellMatrix;
598*cdf0e10cSrcweir 									aCellMatrix.set(0, 0, (double)aCellArea.getWidth());
599*cdf0e10cSrcweir 									aCellMatrix.set(1, 1, (double)aCellArea.getHeight());
600*cdf0e10cSrcweir 									aCellMatrix.set(0, 2, (double)aCellArea.getMinX() + aObjectRange.getMinX());
601*cdf0e10cSrcweir 									aCellMatrix.set(1, 2, (double)aCellArea.getMinY() + aObjectRange.getMinY());
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir 									// handle cell fillings and text
604*cdf0e10cSrcweir 									const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet();
605*cdf0e10cSrcweir 									const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol);
606*cdf0e10cSrcweir 									const SdrText* pSdrText = rTableObj.getText(nTextIndex);
607*cdf0e10cSrcweir 									drawinglayer::attribute::SdrFillTextAttribute aAttribute;
608*cdf0e10cSrcweir 
609*cdf0e10cSrcweir 									if(pSdrText)
610*cdf0e10cSrcweir 									{
611*cdf0e10cSrcweir 										// #i101508# take cell's local text frame distances into account
612*cdf0e10cSrcweir 										const sal_Int32 nLeft(xCurrentCell->GetTextLeftDistance());
613*cdf0e10cSrcweir 										const sal_Int32 nRight(xCurrentCell->GetTextRightDistance());
614*cdf0e10cSrcweir 										const sal_Int32 nUpper(xCurrentCell->GetTextUpperDistance());
615*cdf0e10cSrcweir 										const sal_Int32 nLower(xCurrentCell->GetTextLowerDistance());
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir 										aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute(
618*cdf0e10cSrcweir 											rCellItemSet,
619*cdf0e10cSrcweir 											pSdrText,
620*cdf0e10cSrcweir 											&nLeft,
621*cdf0e10cSrcweir 											&nUpper,
622*cdf0e10cSrcweir 											&nRight,
623*cdf0e10cSrcweir 											&nLower);
624*cdf0e10cSrcweir 									}
625*cdf0e10cSrcweir 									else
626*cdf0e10cSrcweir 									{
627*cdf0e10cSrcweir 										aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute(
628*cdf0e10cSrcweir 											rCellItemSet,
629*cdf0e10cSrcweir 											pSdrText);
630*cdf0e10cSrcweir 									}
631*cdf0e10cSrcweir 
632*cdf0e10cSrcweir                                     // always create cell primitives for BoundRect and HitTest
633*cdf0e10cSrcweir 									{
634*cdf0e10cSrcweir 										const drawinglayer::primitive2d::Primitive2DReference xCellReference(
635*cdf0e10cSrcweir 											new drawinglayer::primitive2d::SdrCellPrimitive2D(
636*cdf0e10cSrcweir 												aCellMatrix, aAttribute));
637*cdf0e10cSrcweir 										xCellSequence[nCellInsert++] = xCellReference;
638*cdf0e10cSrcweir 									}
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir 									// handle cell borders
641*cdf0e10cSrcweir 									const sal_Int32 nX(bIsRTL ? nColCount - aCellPos.mnCol : aCellPos.mnCol);
642*cdf0e10cSrcweir 									const sal_Int32 nY(aCellPos.mnRow);
643*cdf0e10cSrcweir 
644*cdf0e10cSrcweir 									// get access values for X,Y at the cell's end
645*cdf0e10cSrcweir 									const sal_Int32 nXSpan(xCurrentCell->getColumnSpan());
646*cdf0e10cSrcweir 									const sal_Int32 nYSpan(xCurrentCell->getRowSpan());
647*cdf0e10cSrcweir 									const sal_Int32 nXRight(bIsRTL ? nX - nXSpan : nX + nXSpan);
648*cdf0e10cSrcweir 									const sal_Int32 nYBottom(nY + nYSpan);
649*cdf0e10cSrcweir 
650*cdf0e10cSrcweir 									// get basic lines
651*cdf0e10cSrcweir 									impGetLine(aLeftLine, rTableLayouter, nX, nY, false, nColCount, nRowCount, bIsRTL);
652*cdf0e10cSrcweir 									impGetLine(aBottomLine, rTableLayouter, nX, nYBottom, true, nColCount, nRowCount, bIsRTL);
653*cdf0e10cSrcweir 									impGetLine(aRightLine, rTableLayouter, nXRight, nY, false, nColCount, nRowCount, bIsRTL);
654*cdf0e10cSrcweir 									impGetLine(aTopLine, rTableLayouter, nX, nY, true, nColCount, nRowCount, bIsRTL);
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir 									// create the primtive containing all data for one cell with borders
657*cdf0e10cSrcweir 									xBorderSequence[nBorderInsert++] = drawinglayer::primitive2d::Primitive2DReference(
658*cdf0e10cSrcweir 										new drawinglayer::primitive2d::SdrBorderlinePrimitive2D(
659*cdf0e10cSrcweir 											aCellMatrix,
660*cdf0e10cSrcweir 											aLeftLine,
661*cdf0e10cSrcweir 											aBottomLine,
662*cdf0e10cSrcweir 											aRightLine,
663*cdf0e10cSrcweir 											aTopLine,
664*cdf0e10cSrcweir 											bIsRTL ? nX == nColCount : 0 == nX,
665*cdf0e10cSrcweir 											nRowCount == nYBottom,
666*cdf0e10cSrcweir 											bIsRTL ? 0 == nXRight : nXRight == nColCount,
667*cdf0e10cSrcweir 											0 == nY,
668*cdf0e10cSrcweir 											true));
669*cdf0e10cSrcweir 								}
670*cdf0e10cSrcweir 							}
671*cdf0e10cSrcweir                         }
672*cdf0e10cSrcweir 					}
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir 					// no empty references; reallocate sequences by used count
675*cdf0e10cSrcweir 					xCellSequence.realloc(nCellInsert);
676*cdf0e10cSrcweir 					xBorderSequence.realloc(nBorderInsert);
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir 					// append to target. We want fillings and text first
679*cdf0e10cSrcweir 					xRetval = xCellSequence;
680*cdf0e10cSrcweir 					drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xBorderSequence);
681*cdf0e10cSrcweir 				}
682*cdf0e10cSrcweir 
683*cdf0e10cSrcweir 				if(xRetval.hasElements())
684*cdf0e10cSrcweir 				{
685*cdf0e10cSrcweir 					// check and create evtl. shadow for created content
686*cdf0e10cSrcweir 	           		const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet();
687*cdf0e10cSrcweir 					const drawinglayer::attribute::SdrShadowAttribute aNewShadowAttribute(
688*cdf0e10cSrcweir 						drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet));
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir 					if(!aNewShadowAttribute.isDefault())
691*cdf0e10cSrcweir 					{
692*cdf0e10cSrcweir 						xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, aNewShadowAttribute);
693*cdf0e10cSrcweir 					}
694*cdf0e10cSrcweir 				}
695*cdf0e10cSrcweir 
696*cdf0e10cSrcweir 				return xRetval;
697*cdf0e10cSrcweir 			}
698*cdf0e10cSrcweir 			else
699*cdf0e10cSrcweir 			{
700*cdf0e10cSrcweir 				// take unrotated snap rect (direct model data) for position and size
701*cdf0e10cSrcweir 				const Rectangle& rRectangle = rTableObj.GetGeoRect();
702*cdf0e10cSrcweir 				const basegfx::B2DRange aObjectRange(
703*cdf0e10cSrcweir 					rRectangle.Left(), rRectangle.Top(),
704*cdf0e10cSrcweir 					rRectangle.Right(), rRectangle.Bottom());
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir 				// create object matrix
707*cdf0e10cSrcweir 				const GeoStat& rGeoStat(rTableObj.GetGeoStat());
708*cdf0e10cSrcweir 				const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0);
709*cdf0e10cSrcweir 				const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0);
710*cdf0e10cSrcweir 				const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
711*cdf0e10cSrcweir 					aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate,
712*cdf0e10cSrcweir 					aObjectRange.getMinX(), aObjectRange.getMinY()));
713*cdf0e10cSrcweir 
714*cdf0e10cSrcweir 				// credate an invisible outline for the cases where no visible content exists
715*cdf0e10cSrcweir 	            const drawinglayer::primitive2d::Primitive2DReference xReference(
716*cdf0e10cSrcweir 					drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
717*cdf0e10cSrcweir 						false,
718*cdf0e10cSrcweir 						aObjectMatrix));
719*cdf0e10cSrcweir 
720*cdf0e10cSrcweir 				return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
721*cdf0e10cSrcweir 			}
722*cdf0e10cSrcweir         }
723*cdf0e10cSrcweir 
724*cdf0e10cSrcweir 		ViewContactOfTableObj::ViewContactOfTableObj(::sdr::table::SdrTableObj& rTableObj)
725*cdf0e10cSrcweir 		:	ViewContactOfSdrObj(rTableObj)
726*cdf0e10cSrcweir 		{
727*cdf0e10cSrcweir 		}
728*cdf0e10cSrcweir 
729*cdf0e10cSrcweir 		ViewContactOfTableObj::~ViewContactOfTableObj()
730*cdf0e10cSrcweir 		{
731*cdf0e10cSrcweir 		}
732*cdf0e10cSrcweir 	} // end of namespace contact
733*cdf0e10cSrcweir } // end of namespace sdr
734*cdf0e10cSrcweir 
735*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
736*cdf0e10cSrcweir // eof
737