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