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