xref: /AOO41X/main/svx/source/sdr/primitive2d/sdrtextprimitive2d.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 #include "precompiled_svx.hxx"
29*cdf0e10cSrcweir #include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
30*cdf0e10cSrcweir #include <svx/svdotext.hxx>
31*cdf0e10cSrcweir #include <basegfx/color/bcolor.hxx>
32*cdf0e10cSrcweir #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
33*cdf0e10cSrcweir #include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx>
34*cdf0e10cSrcweir #include <editeng/outlobj.hxx>
35*cdf0e10cSrcweir #include <editeng/editobj.hxx>
36*cdf0e10cSrcweir #include <editeng/flditem.hxx>
37*cdf0e10cSrcweir #include <drawinglayer/geometry/viewinformation2d.hxx>
38*cdf0e10cSrcweir #include <svx/unoapi.hxx>
39*cdf0e10cSrcweir #include <svx/svdpage.hxx>
40*cdf0e10cSrcweir #include <svx/svdmodel.hxx>
41*cdf0e10cSrcweir #include <svx/svdoutl.hxx>
42*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir using namespace com::sun::star;
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir namespace
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir     sal_Int16 getPageNumber(const uno::Reference< drawing::XDrawPage >& rxDrawPage)
53*cdf0e10cSrcweir     {
54*cdf0e10cSrcweir         sal_Int16 nRetval(0);
55*cdf0e10cSrcweir         uno::Reference< beans::XPropertySet > xSet(rxDrawPage, uno::UNO_QUERY);
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir         if (xSet.is())
58*cdf0e10cSrcweir         {
59*cdf0e10cSrcweir             try
60*cdf0e10cSrcweir             {
61*cdf0e10cSrcweir                 const uno::Any aNumber(xSet->getPropertyValue(::rtl::OUString::createFromAscii("Number")));
62*cdf0e10cSrcweir                 aNumber >>= nRetval;
63*cdf0e10cSrcweir             }
64*cdf0e10cSrcweir             catch(const uno::Exception&)
65*cdf0e10cSrcweir             {
66*cdf0e10cSrcweir                 OSL_ASSERT(false);
67*cdf0e10cSrcweir             }
68*cdf0e10cSrcweir         }
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir         return nRetval;
71*cdf0e10cSrcweir     }
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir     sal_Int16 getPageCount(const uno::Reference< drawing::XDrawPage >& rxDrawPage)
74*cdf0e10cSrcweir     {
75*cdf0e10cSrcweir         sal_Int16 nRetval(0);
76*cdf0e10cSrcweir         SdrPage* pPage = GetSdrPageFromXDrawPage(rxDrawPage);
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir         if(pPage && pPage->GetModel())
79*cdf0e10cSrcweir         {
80*cdf0e10cSrcweir 			if( (pPage->GetPageNum() == 0) && !pPage->IsMasterPage() )
81*cdf0e10cSrcweir 			{
82*cdf0e10cSrcweir 				// handout page!
83*cdf0e10cSrcweir 				return pPage->GetModel()->getHandoutPageCount();
84*cdf0e10cSrcweir 			}
85*cdf0e10cSrcweir 			else
86*cdf0e10cSrcweir 			{
87*cdf0e10cSrcweir 				const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount());
88*cdf0e10cSrcweir 				nRetval = ((sal_Int16)nPageCount - 1) / 2;
89*cdf0e10cSrcweir 			}
90*cdf0e10cSrcweir         }
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir         return nRetval;
93*cdf0e10cSrcweir     }
94*cdf0e10cSrcweir } // end of anonymous namespace
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir namespace drawinglayer
99*cdf0e10cSrcweir {
100*cdf0e10cSrcweir 	namespace primitive2d
101*cdf0e10cSrcweir 	{
102*cdf0e10cSrcweir 		// support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments
103*cdf0e10cSrcweir         // for slideshow. This uses TextHierarchyBlockPrimitive2D to mark a text block.
104*cdf0e10cSrcweir         // ATM there is only one text block per SdrObject, this may get more in the future
105*cdf0e10cSrcweir         Primitive2DSequence SdrTextPrimitive2D::encapsulateWithTextHierarchyBlockPrimitive2D(const Primitive2DSequence& rCandidate) const
106*cdf0e10cSrcweir         {
107*cdf0e10cSrcweir             Primitive2DReference xReference(new TextHierarchyBlockPrimitive2D(rCandidate));
108*cdf0e10cSrcweir             Primitive2DSequence xRetval(&xReference, 1);
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir             return xRetval;
111*cdf0e10cSrcweir         }
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir         SdrTextPrimitive2D::SdrTextPrimitive2D(
114*cdf0e10cSrcweir             const SdrText* pSdrText,
115*cdf0e10cSrcweir             const OutlinerParaObject& rOutlinerParaObject)
116*cdf0e10cSrcweir 		:	BufferedDecompositionPrimitive2D(),
117*cdf0e10cSrcweir 			mrSdrText(const_cast< SdrText* >(pSdrText)),
118*cdf0e10cSrcweir             maOutlinerParaObject(rOutlinerParaObject),
119*cdf0e10cSrcweir             mxLastVisualizingPage(),
120*cdf0e10cSrcweir             mnLastPageNumber(0),
121*cdf0e10cSrcweir             mnLastPageCount(0),
122*cdf0e10cSrcweir             maLastTextBackgroundColor(),
123*cdf0e10cSrcweir 			mbContainsPageField(false),
124*cdf0e10cSrcweir 			mbContainsPageCountField(false),
125*cdf0e10cSrcweir             mbContainsOtherFields(false)
126*cdf0e10cSrcweir 		{
127*cdf0e10cSrcweir 			const EditTextObject& rETO = maOutlinerParaObject.GetTextObject();
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir             mbContainsPageField = rETO.HasField(SvxPageField::StaticType());
130*cdf0e10cSrcweir             mbContainsPageCountField = rETO.HasField(SvxPagesField::StaticType());
131*cdf0e10cSrcweir 			mbContainsOtherFields = rETO.HasField(SvxHeaderField::StaticType())
132*cdf0e10cSrcweir 				|| rETO.HasField(SvxFooterField::StaticType())
133*cdf0e10cSrcweir 				|| rETO.HasField(SvxDateTimeField::StaticType())
134*cdf0e10cSrcweir 				|| rETO.HasField(SvxAuthorField::StaticType());
135*cdf0e10cSrcweir 		}
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 		bool SdrTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
138*cdf0e10cSrcweir 		{
139*cdf0e10cSrcweir 			if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
140*cdf0e10cSrcweir 			{
141*cdf0e10cSrcweir 				const SdrTextPrimitive2D& rCompare = (SdrTextPrimitive2D&)rPrimitive;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir                 return (
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir                     // compare OPO and content, but not WrongList
146*cdf0e10cSrcweir                     getOutlinerParaObject() == rCompare.getOutlinerParaObject()
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir                     // also compare WrongList (not-persistent data, but visualized)
149*cdf0e10cSrcweir                     && getOutlinerParaObject().isWrongListEqual(rCompare.getOutlinerParaObject()));
150*cdf0e10cSrcweir 			}
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 			return false;
153*cdf0e10cSrcweir 		}
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 		Primitive2DSequence SdrTextPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
156*cdf0e10cSrcweir         {
157*cdf0e10cSrcweir             uno::Reference< drawing::XDrawPage > xCurrentlyVisualizingPage;
158*cdf0e10cSrcweir 			bool bCurrentlyVisualizingPageIsSet(false);
159*cdf0e10cSrcweir 			Color aNewTextBackgroundColor;
160*cdf0e10cSrcweir 			bool bNewTextBackgroundColorIsSet(false);
161*cdf0e10cSrcweir             sal_Int16 nCurrentlyValidPageNumber(0);
162*cdf0e10cSrcweir             sal_Int16 nCurrentlyValidPageCount(0);
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 			if(getBuffered2DDecomposition().hasElements())
165*cdf0e10cSrcweir             {
166*cdf0e10cSrcweir                 bool bDoDelete(false);
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir                 // check visualized page
169*cdf0e10cSrcweir                 if(mbContainsPageField || mbContainsPageCountField || mbContainsOtherFields)
170*cdf0e10cSrcweir                 {
171*cdf0e10cSrcweir                     // get visualized page and remember
172*cdf0e10cSrcweir                     xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage();
173*cdf0e10cSrcweir 					bCurrentlyVisualizingPageIsSet = true;
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir                     if(xCurrentlyVisualizingPage != mxLastVisualizingPage)
176*cdf0e10cSrcweir                     {
177*cdf0e10cSrcweir                         bDoDelete = true;
178*cdf0e10cSrcweir                     }
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir                     // #i98870# check visualized PageNumber
181*cdf0e10cSrcweir                     if(!bDoDelete && mbContainsPageField)
182*cdf0e10cSrcweir                     {
183*cdf0e10cSrcweir                         nCurrentlyValidPageNumber = getPageNumber(xCurrentlyVisualizingPage);
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir                         if(nCurrentlyValidPageNumber != mnLastPageNumber)
186*cdf0e10cSrcweir                         {
187*cdf0e10cSrcweir                             bDoDelete = true;
188*cdf0e10cSrcweir                         }
189*cdf0e10cSrcweir                     }
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir                     // #i98870# check visualized PageCount, too
192*cdf0e10cSrcweir                     if(!bDoDelete && mbContainsPageCountField)
193*cdf0e10cSrcweir                     {
194*cdf0e10cSrcweir                         nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage);
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir                         if(nCurrentlyValidPageCount != mnLastPageCount)
197*cdf0e10cSrcweir                         {
198*cdf0e10cSrcweir                             bDoDelete = true;
199*cdf0e10cSrcweir                         }
200*cdf0e10cSrcweir                     }
201*cdf0e10cSrcweir                 }
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir                 // #i101443#  check change of TextBackgroundolor
204*cdf0e10cSrcweir                 if(!bDoDelete && getSdrText() && getSdrText()->GetModel())
205*cdf0e10cSrcweir 				{
206*cdf0e10cSrcweir 					SdrOutliner& rDrawOutliner = getSdrText()->GetModel()->GetDrawOutliner(0);
207*cdf0e10cSrcweir 					aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor();
208*cdf0e10cSrcweir 					bNewTextBackgroundColorIsSet = true;
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 					if(aNewTextBackgroundColor != maLastTextBackgroundColor)
211*cdf0e10cSrcweir 					{
212*cdf0e10cSrcweir 						bDoDelete = true;
213*cdf0e10cSrcweir 					}
214*cdf0e10cSrcweir 				}
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 				if(bDoDelete)
217*cdf0e10cSrcweir                 {
218*cdf0e10cSrcweir     			    const_cast< SdrTextPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence());
219*cdf0e10cSrcweir                 }
220*cdf0e10cSrcweir             }
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 			if(!getBuffered2DDecomposition().hasElements())
223*cdf0e10cSrcweir             {
224*cdf0e10cSrcweir 				if(!bCurrentlyVisualizingPageIsSet && mbContainsPageField)
225*cdf0e10cSrcweir 				{
226*cdf0e10cSrcweir                     xCurrentlyVisualizingPage = rViewInformation.getVisualizedPage();
227*cdf0e10cSrcweir 				}
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir                 if(!nCurrentlyValidPageNumber && mbContainsPageField)
230*cdf0e10cSrcweir                 {
231*cdf0e10cSrcweir                     nCurrentlyValidPageNumber = getPageNumber(xCurrentlyVisualizingPage);
232*cdf0e10cSrcweir                 }
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir                 if(!nCurrentlyValidPageCount && mbContainsPageCountField)
235*cdf0e10cSrcweir                 {
236*cdf0e10cSrcweir                     nCurrentlyValidPageCount = getPageCount(xCurrentlyVisualizingPage);
237*cdf0e10cSrcweir                 }
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir                 if(!bNewTextBackgroundColorIsSet && getSdrText() && getSdrText()->GetModel())
240*cdf0e10cSrcweir 				{
241*cdf0e10cSrcweir 					SdrOutliner& rDrawOutliner = getSdrText()->GetModel()->GetDrawOutliner(0);
242*cdf0e10cSrcweir 					aNewTextBackgroundColor = rDrawOutliner.GetBackgroundColor();
243*cdf0e10cSrcweir 				}
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir 	    		const_cast< SdrTextPrimitive2D* >(this)->mxLastVisualizingPage = xCurrentlyVisualizingPage;
246*cdf0e10cSrcweir 	    		const_cast< SdrTextPrimitive2D* >(this)->mnLastPageNumber = nCurrentlyValidPageNumber;
247*cdf0e10cSrcweir 	    		const_cast< SdrTextPrimitive2D* >(this)->mnLastPageCount = nCurrentlyValidPageCount;
248*cdf0e10cSrcweir 	    		const_cast< SdrTextPrimitive2D* >(this)->maLastTextBackgroundColor = aNewTextBackgroundColor;
249*cdf0e10cSrcweir             }
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir             // call parent
252*cdf0e10cSrcweir             return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation);
253*cdf0e10cSrcweir         }
254*cdf0e10cSrcweir 	} // end of namespace primitive2d
255*cdf0e10cSrcweir } // end of namespace drawinglayer
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir namespace drawinglayer
260*cdf0e10cSrcweir {
261*cdf0e10cSrcweir 	namespace primitive2d
262*cdf0e10cSrcweir 	{
263*cdf0e10cSrcweir 		Primitive2DSequence SdrContourTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
264*cdf0e10cSrcweir 		{
265*cdf0e10cSrcweir             Primitive2DSequence aRetval;
266*cdf0e10cSrcweir             getSdrText()->GetObject().impDecomposeContourTextPrimitive(aRetval, *this, aViewInformation);
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 			return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
269*cdf0e10cSrcweir 		}
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 		SdrContourTextPrimitive2D::SdrContourTextPrimitive2D(
272*cdf0e10cSrcweir 			const SdrText* pSdrText,
273*cdf0e10cSrcweir             const OutlinerParaObject& rOutlinerParaObject,
274*cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rUnitPolyPolygon,
275*cdf0e10cSrcweir 			const basegfx::B2DHomMatrix& rObjectTransform)
276*cdf0e10cSrcweir 		:	SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
277*cdf0e10cSrcweir 			maUnitPolyPolygon(rUnitPolyPolygon),
278*cdf0e10cSrcweir 			maObjectTransform(rObjectTransform)
279*cdf0e10cSrcweir 		{
280*cdf0e10cSrcweir 		}
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir 		bool SdrContourTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
283*cdf0e10cSrcweir 		{
284*cdf0e10cSrcweir 			if(SdrTextPrimitive2D::operator==(rPrimitive))
285*cdf0e10cSrcweir 			{
286*cdf0e10cSrcweir 				const SdrContourTextPrimitive2D& rCompare = (SdrContourTextPrimitive2D&)rPrimitive;
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 				return (getUnitPolyPolygon() == rCompare.getUnitPolyPolygon()
289*cdf0e10cSrcweir 					&& getObjectTransform() == rCompare.getObjectTransform());
290*cdf0e10cSrcweir 			}
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 			return false;
293*cdf0e10cSrcweir 		}
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 		SdrTextPrimitive2D* SdrContourTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
296*cdf0e10cSrcweir 		{
297*cdf0e10cSrcweir 			return new SdrContourTextPrimitive2D(
298*cdf0e10cSrcweir                 getSdrText(),
299*cdf0e10cSrcweir                 getOutlinerParaObject(),
300*cdf0e10cSrcweir                 getUnitPolyPolygon(),
301*cdf0e10cSrcweir                 rTransform * getObjectTransform());
302*cdf0e10cSrcweir 		}
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir 		// provide unique ID
305*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(SdrContourTextPrimitive2D, PRIMITIVE2D_ID_SDRCONTOURTEXTPRIMITIVE2D)
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir 	} // end of namespace primitive2d
308*cdf0e10cSrcweir } // end of namespace drawinglayer
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir namespace drawinglayer
313*cdf0e10cSrcweir {
314*cdf0e10cSrcweir 	namespace primitive2d
315*cdf0e10cSrcweir 	{
316*cdf0e10cSrcweir 		Primitive2DSequence SdrPathTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
317*cdf0e10cSrcweir 		{
318*cdf0e10cSrcweir             Primitive2DSequence aRetval;
319*cdf0e10cSrcweir             getSdrText()->GetObject().impDecomposePathTextPrimitive(aRetval, *this, aViewInformation);
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir             return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
322*cdf0e10cSrcweir 		}
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir 		SdrPathTextPrimitive2D::SdrPathTextPrimitive2D(
325*cdf0e10cSrcweir 			const SdrText* pSdrText,
326*cdf0e10cSrcweir             const OutlinerParaObject& rOutlinerParaObject,
327*cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& rPathPolyPolygon,
328*cdf0e10cSrcweir             const attribute::SdrFormTextAttribute& rSdrFormTextAttribute)
329*cdf0e10cSrcweir 		:	SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
330*cdf0e10cSrcweir 			maPathPolyPolygon(rPathPolyPolygon),
331*cdf0e10cSrcweir             maSdrFormTextAttribute(rSdrFormTextAttribute)
332*cdf0e10cSrcweir 		{
333*cdf0e10cSrcweir 		}
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir 		bool SdrPathTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
336*cdf0e10cSrcweir 		{
337*cdf0e10cSrcweir 			if(SdrTextPrimitive2D::operator==(rPrimitive))
338*cdf0e10cSrcweir 			{
339*cdf0e10cSrcweir 				const SdrPathTextPrimitive2D& rCompare = (SdrPathTextPrimitive2D&)rPrimitive;
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 				return (getPathPolyPolygon() == rCompare.getPathPolyPolygon()
342*cdf0e10cSrcweir                     && getSdrFormTextAttribute() == rCompare.getSdrFormTextAttribute());
343*cdf0e10cSrcweir 			}
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir 			return false;
346*cdf0e10cSrcweir 		}
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir 		SdrTextPrimitive2D* SdrPathTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
349*cdf0e10cSrcweir 		{
350*cdf0e10cSrcweir 			basegfx::B2DPolyPolygon aNewPolyPolygon(getPathPolyPolygon());
351*cdf0e10cSrcweir 			aNewPolyPolygon.transform(rTransform);
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir             return new SdrPathTextPrimitive2D(
354*cdf0e10cSrcweir                 getSdrText(),
355*cdf0e10cSrcweir                 getOutlinerParaObject(),
356*cdf0e10cSrcweir                 aNewPolyPolygon,
357*cdf0e10cSrcweir                 getSdrFormTextAttribute());
358*cdf0e10cSrcweir 		}
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 		// provide unique ID
361*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(SdrPathTextPrimitive2D, PRIMITIVE2D_ID_SDRPATHTEXTPRIMITIVE2D)
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 	} // end of namespace primitive2d
364*cdf0e10cSrcweir } // end of namespace drawinglayer
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir namespace drawinglayer
369*cdf0e10cSrcweir {
370*cdf0e10cSrcweir 	namespace primitive2d
371*cdf0e10cSrcweir 	{
372*cdf0e10cSrcweir 		Primitive2DSequence SdrBlockTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
373*cdf0e10cSrcweir 		{
374*cdf0e10cSrcweir             Primitive2DSequence aRetval;
375*cdf0e10cSrcweir             getSdrText()->GetObject().impDecomposeBlockTextPrimitive(aRetval, *this, aViewInformation);
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir             return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
378*cdf0e10cSrcweir 		}
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir 		SdrBlockTextPrimitive2D::SdrBlockTextPrimitive2D(
381*cdf0e10cSrcweir 			const SdrText* pSdrText,
382*cdf0e10cSrcweir             const OutlinerParaObject& rOutlinerParaObject,
383*cdf0e10cSrcweir 			const basegfx::B2DHomMatrix& rTextRangeTransform,
384*cdf0e10cSrcweir             SdrTextHorzAdjust aSdrTextHorzAdjust,
385*cdf0e10cSrcweir             SdrTextVertAdjust aSdrTextVertAdjust,
386*cdf0e10cSrcweir             bool bFixedCellHeight,
387*cdf0e10cSrcweir 			bool bUnlimitedPage,
388*cdf0e10cSrcweir 			bool bCellText,
389*cdf0e10cSrcweir             bool bWordWrap,
390*cdf0e10cSrcweir 			bool bClipOnBounds)
391*cdf0e10cSrcweir 		:	SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
392*cdf0e10cSrcweir 			maTextRangeTransform(rTextRangeTransform),
393*cdf0e10cSrcweir             maSdrTextHorzAdjust(aSdrTextHorzAdjust),
394*cdf0e10cSrcweir             maSdrTextVertAdjust(aSdrTextVertAdjust),
395*cdf0e10cSrcweir             mbFixedCellHeight(bFixedCellHeight),
396*cdf0e10cSrcweir             mbUnlimitedPage(bUnlimitedPage),
397*cdf0e10cSrcweir 			mbCellText(bCellText),
398*cdf0e10cSrcweir             mbWordWrap(bWordWrap),
399*cdf0e10cSrcweir 			mbClipOnBounds(bClipOnBounds)
400*cdf0e10cSrcweir 		{
401*cdf0e10cSrcweir 		}
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir 		bool SdrBlockTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
404*cdf0e10cSrcweir 		{
405*cdf0e10cSrcweir 			if(SdrTextPrimitive2D::operator==(rPrimitive))
406*cdf0e10cSrcweir 			{
407*cdf0e10cSrcweir 				const SdrBlockTextPrimitive2D& rCompare = (SdrBlockTextPrimitive2D&)rPrimitive;
408*cdf0e10cSrcweir 
409*cdf0e10cSrcweir 				return (getTextRangeTransform() == rCompare.getTextRangeTransform()
410*cdf0e10cSrcweir                     && getSdrTextHorzAdjust() == rCompare.getSdrTextHorzAdjust()
411*cdf0e10cSrcweir                     && getSdrTextVertAdjust() == rCompare.getSdrTextVertAdjust()
412*cdf0e10cSrcweir                     && isFixedCellHeight() == rCompare.isFixedCellHeight()
413*cdf0e10cSrcweir 					&& getUnlimitedPage() == rCompare.getUnlimitedPage()
414*cdf0e10cSrcweir 					&& getCellText() == rCompare.getCellText()
415*cdf0e10cSrcweir                     && getWordWrap() == rCompare.getWordWrap()
416*cdf0e10cSrcweir 					&& getClipOnBounds() == rCompare.getClipOnBounds());
417*cdf0e10cSrcweir 			}
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir 			return false;
420*cdf0e10cSrcweir 		}
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir 		SdrTextPrimitive2D* SdrBlockTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
423*cdf0e10cSrcweir 		{
424*cdf0e10cSrcweir 			return new SdrBlockTextPrimitive2D(
425*cdf0e10cSrcweir                 getSdrText(),
426*cdf0e10cSrcweir                 getOutlinerParaObject(),
427*cdf0e10cSrcweir                 rTransform * getTextRangeTransform(),
428*cdf0e10cSrcweir                 getSdrTextHorzAdjust(),
429*cdf0e10cSrcweir                 getSdrTextVertAdjust(),
430*cdf0e10cSrcweir                 isFixedCellHeight(),
431*cdf0e10cSrcweir                 getUnlimitedPage(),
432*cdf0e10cSrcweir                 getCellText(),
433*cdf0e10cSrcweir                 getWordWrap(),
434*cdf0e10cSrcweir 				getClipOnBounds());
435*cdf0e10cSrcweir 		}
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir 		// provide unique ID
438*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(SdrBlockTextPrimitive2D, PRIMITIVE2D_ID_SDRBLOCKTEXTPRIMITIVE2D)
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir 	} // end of namespace primitive2d
441*cdf0e10cSrcweir } // end of namespace drawinglayer
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir namespace drawinglayer
446*cdf0e10cSrcweir {
447*cdf0e10cSrcweir 	namespace primitive2d
448*cdf0e10cSrcweir 	{
449*cdf0e10cSrcweir 		Primitive2DSequence SdrStretchTextPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
450*cdf0e10cSrcweir 		{
451*cdf0e10cSrcweir             Primitive2DSequence aRetval;
452*cdf0e10cSrcweir             getSdrText()->GetObject().impDecomposeStretchTextPrimitive(aRetval, *this, aViewInformation);
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir             return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
455*cdf0e10cSrcweir 		}
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir 		SdrStretchTextPrimitive2D::SdrStretchTextPrimitive2D(
458*cdf0e10cSrcweir 			const SdrText* pSdrText,
459*cdf0e10cSrcweir             const OutlinerParaObject& rOutlinerParaObject,
460*cdf0e10cSrcweir 			const basegfx::B2DHomMatrix& rTextRangeTransform,
461*cdf0e10cSrcweir             bool bFixedCellHeight)
462*cdf0e10cSrcweir 		:	SdrTextPrimitive2D(pSdrText, rOutlinerParaObject),
463*cdf0e10cSrcweir 			maTextRangeTransform(rTextRangeTransform),
464*cdf0e10cSrcweir             mbFixedCellHeight(bFixedCellHeight)
465*cdf0e10cSrcweir 		{
466*cdf0e10cSrcweir 		}
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir 		bool SdrStretchTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
469*cdf0e10cSrcweir 		{
470*cdf0e10cSrcweir 			if(SdrTextPrimitive2D::operator==(rPrimitive))
471*cdf0e10cSrcweir 			{
472*cdf0e10cSrcweir 				const SdrStretchTextPrimitive2D& rCompare = (SdrStretchTextPrimitive2D&)rPrimitive;
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir 				return (getTextRangeTransform() == rCompare.getTextRangeTransform()
475*cdf0e10cSrcweir                     && isFixedCellHeight() == rCompare.isFixedCellHeight());
476*cdf0e10cSrcweir 			}
477*cdf0e10cSrcweir 
478*cdf0e10cSrcweir 			return false;
479*cdf0e10cSrcweir 		}
480*cdf0e10cSrcweir 
481*cdf0e10cSrcweir 		SdrTextPrimitive2D* SdrStretchTextPrimitive2D::createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const
482*cdf0e10cSrcweir 		{
483*cdf0e10cSrcweir 			return new SdrStretchTextPrimitive2D(
484*cdf0e10cSrcweir                 getSdrText(),
485*cdf0e10cSrcweir                 getOutlinerParaObject(),
486*cdf0e10cSrcweir                 rTransform * getTextRangeTransform(),
487*cdf0e10cSrcweir                 isFixedCellHeight());
488*cdf0e10cSrcweir 		}
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir 		// provide unique ID
491*cdf0e10cSrcweir 		ImplPrimitrive2DIDBlock(SdrStretchTextPrimitive2D, PRIMITIVE2D_ID_SDRSTRETCHTEXTPRIMITIVE2D)
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir 	} // end of namespace primitive2d
494*cdf0e10cSrcweir } // end of namespace drawinglayer
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
497*cdf0e10cSrcweir // eof
498