1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_filter.hxx"
26 #include <vcl/bitmapex.hxx>
27 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
28 #include <com/sun/star/drawing/LineStyle.hpp>
29 #include <com/sun/star/drawing/LineDash.hpp>
30 #include <com/sun/star/drawing/FillStyle.hpp>
31 #include <com/sun/star/drawing/Hatch.hpp>
32 #include <com/sun/star/awt/FontDescriptor.hpp>
33 #include <com/sun/star/awt/FontWeight.hpp>
34 #include <com/sun/star/awt/FontUnderline.hpp>
35 #include <com/sun/star/drawing/XShapeGrouper.hpp>
36 #include <com/sun/star/drawing/CircleKind.hpp>
37 #include <com/sun/star/awt/XBitmap.hpp>
38 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
39 #include <com/sun/star/drawing/PointSequence.hpp>
40 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
41 #include <com/sun/star/drawing/FlagSequence.hpp>
42 #include <com/sun/star/drawing/TextAdjust.hpp>
43 #include <com/sun/star/text/XText.hpp>
44 #include <com/sun/star/text/XTextRange.hpp>
45 #include <com/sun/star/style/HorizontalAlignment.hpp>
46 
47 #include <unotools/processfactory.hxx>
48 #include <toolkit/helper/vclunohelper.hxx>
49 
50 //#include <toolkit/helper/vclunohelper.hxx>
51 
52 #include "main.hxx"
53 #include "outact.hxx"
54 
55 using namespace ::com::sun::star;
56 
57 // ---------------------------------------------------------------
58 // ---------------------------------------------------------------
59 // ---------------------------------------------------------------
60 // ---------------------------------------------------------------
61 
CGMImpressOutAct(CGM & rCGM,const uno::Reference<frame::XModel> & rModel)62 CGMImpressOutAct::CGMImpressOutAct( CGM& rCGM, const uno::Reference< frame::XModel > & rModel ) :
63 		CGMOutAct		( rCGM ),
64 		nFinalTextCount ( 0 )
65 {
66 	sal_Bool bStatRet = sal_False;
67 
68 	if ( mpCGM->mbStatus )
69 	{
70 		uno::Reference< drawing::XDrawPagesSupplier >  aDrawPageSup( rModel, uno::UNO_QUERY );
71 		if( aDrawPageSup.is() )
72 		{
73 			maXDrawPages = aDrawPageSup->getDrawPages();
74 			if ( maXDrawPages.is() )
75 			{
76 				maXServiceManagerSC = utl::getProcessServiceFactory();
77 				if ( maXServiceManagerSC.is() )
78 				{
79 					uno::Any aAny( rModel->queryInterface( ::getCppuType((const uno::Reference< lang::XMultiServiceFactory >*)0) ));
80 					if( aAny >>= maXMultiServiceFactory )
81 					{
82 						maXDrawPage = *(uno::Reference< drawing::XDrawPage > *)maXDrawPages->getByIndex( 0 ).getValue();
83 						if ( ImplInitPage() )
84 							bStatRet = sal_True;
85 					}
86 				}
87 			}
88 		}
89 		mpCGM->mbStatus = bStatRet;
90 	}
91 };
92 
93 // ---------------------------------------------------------------
94 
ImplInitPage()95 sal_Bool CGMImpressOutAct::ImplInitPage()
96 {
97 	sal_Bool	bStatRet = sal_False;
98 	if( maXDrawPage.is() )
99 	{
100 		maXShapes = uno::Reference< drawing::XShapes >( maXDrawPage, uno::UNO_QUERY );
101 		if ( maXShapes.is() )
102 		{
103 			bStatRet = sal_True;
104 		}
105 	}
106 	return bStatRet;
107 }
108 
109 // ---------------------------------------------------------------
110 
ImplCreateShape(const::rtl::OUString & rType)111 sal_Bool CGMImpressOutAct::ImplCreateShape( const ::rtl::OUString& rType )
112 {
113 	uno::Reference< uno::XInterface > xNewShape( maXMultiServiceFactory->createInstance( rType ) );
114 	maXShape = uno::Reference< drawing::XShape >( xNewShape, uno::UNO_QUERY );
115 	maXPropSet = uno::Reference< beans::XPropertySet >( xNewShape, uno::UNO_QUERY );
116 	if ( maXShape.is() && maXPropSet.is() )
117 	{
118 		maXShapes->add( maXShape );
119 		return sal_True;
120 	}
121 	return sal_False;
122 }
123 
124 // ---------------------------------------------------------------
125 
ImplSetOrientation(FloatPoint & rRefPoint,double & rOrientation)126 void CGMImpressOutAct::ImplSetOrientation( FloatPoint& rRefPoint, double& rOrientation )
127 {
128 	uno::Any aAny;
129 	aAny <<= (sal_Int32)rRefPoint.X;
130 	maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointX"), aAny );
131 	aAny <<= (sal_Int32)rRefPoint.Y;
132 	maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointY"), aAny );
133 	aAny <<= (sal_Int32)( rOrientation * 100.0 );
134 	maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotateAngle"), aAny );
135 }
136 
137 // ---------------------------------------------------------------
138 
ImplSetLineBundle()139 void CGMImpressOutAct::ImplSetLineBundle()
140 {
141 	uno::Any			aAny;
142 	drawing::LineStyle	eLS;
143 
144 	sal_uInt32			nLineColor;
145 	LineType			eLineType;
146 	double				fLineWidth;
147 
148 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINECOLOR )
149 		nLineColor = mpCGM->pElement->pLineBundle->GetColor();
150 	else
151 		nLineColor = mpCGM->pElement->aLineBundle.GetColor();
152 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINETYPE )
153 		eLineType = mpCGM->pElement->pLineBundle->eLineType;
154 	else
155 		eLineType = mpCGM->pElement->aLineBundle.eLineType;
156 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINEWIDTH )
157 		fLineWidth = mpCGM->pElement->pLineBundle->nLineWidth;
158 	else
159 		fLineWidth = mpCGM->pElement->aLineBundle.nLineWidth;
160 
161 	aAny <<= (sal_Int32)nLineColor;
162 	maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineColor"), aAny );
163 
164 	aAny <<= (sal_Int32)fLineWidth;
165 	maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineWidth"), aAny );
166 
167 	switch( eLineType )
168 	{
169 		case LT_NONE :
170 			eLS = drawing::LineStyle_NONE;
171 		break;
172 		case LT_DASH :
173 		case LT_DOT :
174 		case LT_DASHDOT :
175 		case LT_DOTDOTSPACE :
176 		case LT_LONGDASH :
177 		case LT_DASHDASHDOT :
178 			eLS = drawing::LineStyle_DASH;
179 		break;
180 		case LT_SOLID :
181 		default:
182 			eLS = drawing::LineStyle_SOLID;
183 		break;
184 	}
185 	aAny <<= eLS;
186 	maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineStyle"), aAny );
187 	if ( eLS == drawing::LineStyle_DASH )
188 	{
189 		drawing::LineDash aLineDash( drawing::DashStyle_RECTRELATIVE, 1, 50, 3, 33, 100 );
190 		aAny <<= aLineDash;
191 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineDash"), aAny );
192 	}
193 };
194 
195 // ---------------------------------------------------------------
196 
ImplSetFillBundle()197 void CGMImpressOutAct::ImplSetFillBundle()
198 {
199 
200 	uno::Any				aAny;
201 	drawing::LineStyle		eLS;
202 	drawing::FillStyle		eFS;
203 
204 	sal_uInt32				nEdgeColor = 0;
205 	EdgeType				eEdgeType;
206 	double					fEdgeWidth = 0;
207 
208 	sal_uInt32				nFillColor;
209 	FillInteriorStyle		eFillStyle;
210 	long					nPatternIndex;
211 	sal_uInt32				nHatchIndex;
212 
213 	if ( mpCGM->pElement->eEdgeVisibility == EV_ON )
214 	{
215 		if ( mpCGM->pElement->nAspectSourceFlags & ASF_EDGETYPE )
216 			eEdgeType = mpCGM->pElement->pEdgeBundle->eEdgeType;
217 		else
218 			eEdgeType = mpCGM->pElement->aEdgeBundle.eEdgeType;
219 		if ( mpCGM->pElement->nAspectSourceFlags & ASF_EDGEWIDTH )
220 			fEdgeWidth = mpCGM->pElement->pEdgeBundle->nEdgeWidth;
221 		else
222 			fEdgeWidth = mpCGM->pElement->aEdgeBundle.nEdgeWidth;
223 		if ( mpCGM->pElement->nAspectSourceFlags & ASF_EDGECOLOR )
224 			nEdgeColor = mpCGM->pElement->pEdgeBundle->GetColor();
225 		else
226 			nEdgeColor = mpCGM->pElement->aEdgeBundle.GetColor();
227 	}
228 	else
229 		eEdgeType = ET_NONE;
230 
231 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_FILLINTERIORSTYLE )
232 		eFillStyle = mpCGM->pElement->pFillBundle->eFillInteriorStyle;
233 	else
234 		eFillStyle = mpCGM->pElement->aFillBundle.eFillInteriorStyle;
235 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_FILLCOLOR )
236 		nFillColor = mpCGM->pElement->pFillBundle->GetColor();
237 	else
238 		nFillColor = mpCGM->pElement->aFillBundle.GetColor();
239 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_HATCHINDEX )
240 		nHatchIndex = (sal_uInt32)mpCGM->pElement->pFillBundle->nFillHatchIndex;
241 	else
242 		nHatchIndex = (sal_uInt32)mpCGM->pElement->aFillBundle.nFillHatchIndex;
243 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_PATTERNINDEX )
244 		nPatternIndex = mpCGM->pElement->pFillBundle->nFillPatternIndex;
245 	else
246 		nPatternIndex = mpCGM->pElement->aFillBundle.nFillPatternIndex;
247 
248 	aAny <<= (sal_Int32)nFillColor;
249 	maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillColor"), aAny );
250 
251 	switch ( eFillStyle )
252 	{
253 		case FIS_HATCH   :
254 		{
255 			if ( nHatchIndex == 0 )
256 				eFS = drawing::FillStyle_NONE;
257 			else
258 				eFS = drawing::FillStyle_HATCH;
259 		}
260 		break;
261 		case FIS_PATTERN :
262 		case FIS_SOLID :
263 		{
264 			eFS = drawing::FillStyle_SOLID;
265 		}
266 		break;
267 
268 		case FIS_GEOPATTERN :
269 		{
270 			if ( mpCGM->pElement->eTransparency == T_ON )
271 				nFillColor = mpCGM->pElement->nAuxiliaryColor;
272 			eFS = drawing::FillStyle_NONE;
273 		}
274 		break;
275 
276 		case FIS_INTERPOLATED :
277 		case FIS_GRADIENT :
278 		{
279 			eFS = drawing::FillStyle_GRADIENT;
280 		}
281 		break;
282 
283 		case FIS_HOLLOW :
284 		case FIS_EMPTY :
285 		default:
286 		{
287 			eFS = drawing::FillStyle_NONE;
288 		}
289 	}
290 
291 	if ( mpCGM->mnAct4PostReset & ACT4_GRADIENT_ACTION )
292 		eFS = drawing::FillStyle_GRADIENT;
293 
294 	if ( eFS == drawing::FillStyle_GRADIENT )
295 	{
296 		aAny <<= *mpGradient;
297 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillGradient"), aAny );
298 	}
299 	aAny <<= eFS;
300 	maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), aAny );
301 
302 	eLS = drawing::LineStyle_NONE;
303 	if ( eFillStyle == FIS_HOLLOW )
304 	{
305 		eLS = drawing::LineStyle_SOLID;
306 		aAny <<= (sal_Int32)nFillColor;
307 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineColor"), aAny );
308 		aAny <<= (sal_Int32)0;
309 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineWidth"), aAny );
310 	}
311 	else if ( eEdgeType != ET_NONE )
312 	{
313 		aAny <<= (sal_Int32)nEdgeColor;
314 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineColor"), aAny );
315 
316 		aAny <<= (sal_Int32)fEdgeWidth;
317 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineWidth"), aAny );
318 
319 		switch( eEdgeType )
320 		{
321 			case ET_DASH :
322 			case ET_DOT :
323 			case ET_DASHDOT :
324 			case ET_DASHDOTDOT :
325 			case ET_DOTDOTSPACE :
326 			case ET_LONGDASH :
327 			case ET_DASHDASHDOT :
328 //			{
329 //				eLS = LineStyle_DASH;
330 //				aAny.setValue( &eLS, ::getCppuType((const drawing::LineStyle*)0) );
331 //				maXPropSet->setPropertyValue( L"LineStyle", aAny );
332 //				drawing::LineDash	aLineDash( DashStyle_RECTRELATIVE, 1, 160, 1, 160, 190 );
333 //				aAny.setValue( &aLineDash, ::getCppuType((const drawing::LineDash*)0) );
334 //				maXPropSet->setPropertyValue( L"DashStyle", aAny );
335 //			}
336 //			break;
337 			default:			// case ET_SOLID :
338 			{
339 				eLS = drawing::LineStyle_SOLID;
340 			}
341 			break;
342 		}
343 	}
344 
345 	aAny <<= eLS;
346 	maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("LineStyle"), aAny );
347 
348 	if ( eFS == drawing::FillStyle_HATCH )
349 	{
350 		drawing::Hatch aHatch;
351 
352 		if ( mpCGM->pElement->nAspectSourceFlags & ASF_LINECOLOR )
353 			aHatch.Color = nFillColor;
354 		else
355 			aHatch.Color = nFillColor;
356 		HatchEntry*		pHatchEntry = (HatchEntry*)mpCGM->pElement->aHatchTable.Get( nHatchIndex );
357 		if ( pHatchEntry )
358 		{
359 			switch ( pHatchEntry->HatchStyle )
360 			{
361 			case 0 : aHatch.Style = drawing::HatchStyle_SINGLE; break;
362 			case 1 : aHatch.Style = drawing::HatchStyle_DOUBLE; break;
363 			case 2 : aHatch.Style = drawing::HatchStyle_TRIPLE; break;
364 			}
365 			aHatch.Distance = pHatchEntry->HatchDistance;
366 			aHatch.Angle = pHatchEntry->HatchAngle;
367 		}
368 		else
369 		{
370 			aHatch.Style = drawing::HatchStyle_TRIPLE;
371 			aHatch.Distance = 10 * ( nHatchIndex & 0x1f ) | 100;
372 			aHatch.Angle = 15 * ( ( nHatchIndex & 0x1f ) - 5 );
373 		}
374 		aAny <<= aHatch;
375 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillHatch"), aAny );
376 	}
377 };
378 
379 // ---------------------------------------------------------------
380 
ImplSetTextBundle(const uno::Reference<beans::XPropertySet> & rProperty)381 void CGMImpressOutAct::ImplSetTextBundle( const uno::Reference< beans::XPropertySet > & rProperty )
382 {
383 	uno::Any		aAny;
384 	TextPrecision	eTextPrecision;
385 	sal_uInt32		nTextFontIndex;
386 	sal_uInt32		nTextColor;
387 	double			fCharacterExpansion;
388 	double			fCharacterSpacing;
389 
390 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTFONTINDEX )
391 		nTextFontIndex = mpCGM->pElement->pTextBundle->nTextFontIndex;
392 	else
393 		nTextFontIndex = mpCGM->pElement->aTextBundle.nTextFontIndex;
394 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTPRECISION )
395 		eTextPrecision = mpCGM->pElement->pTextBundle->eTextPrecision;
396 	else
397 		eTextPrecision = mpCGM->pElement->aTextBundle.eTextPrecision;
398 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_CHARACTEREXPANSION )
399 		fCharacterExpansion = mpCGM->pElement->pTextBundle->nCharacterExpansion;
400 	else
401 		fCharacterExpansion = mpCGM->pElement->aTextBundle.nCharacterExpansion;
402 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_CHARACTERSPACING )
403 		fCharacterSpacing = mpCGM->pElement->pTextBundle->nCharacterSpacing;
404 	else
405 		fCharacterSpacing = mpCGM->pElement->aTextBundle.nCharacterSpacing;
406 	if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTCOLOR )
407 		nTextColor = mpCGM->pElement->pTextBundle->GetColor();
408 	else
409 		nTextColor = mpCGM->pElement->aTextBundle.GetColor();
410 
411 	aAny <<= (sal_Int32)nTextColor;
412 	rProperty->setPropertyValue( rtl::OUString::createFromAscii("CharColor"), aAny );
413 
414 	sal_uInt32 nFontType = 0;
415 	awt::FontDescriptor aFontDescriptor;
416 	FontEntry* pFontEntry = mpCGM->pElement->aFontList.GetFontEntry( nTextFontIndex );
417 	if ( pFontEntry )
418 	{
419 		nFontType = pFontEntry->nFontType;
420 		aFontDescriptor.Name = String::CreateFromAscii( (char*)pFontEntry->pFontName );
421 	}
422 	aFontDescriptor.Height = ( sal_Int16 )( ( mpCGM->pElement->nCharacterHeight * (double)1.50 ) );
423 	if ( nFontType & 1 )
424 		aFontDescriptor.Slant = awt::FontSlant_ITALIC;
425 	if ( nFontType & 2 )
426 		aFontDescriptor.Weight = awt::FontWeight::BOLD;
427 	else
428 		aFontDescriptor.Weight = awt::FontWeight::NORMAL;
429 
430 	if ( mpCGM->pElement->eUnderlineMode != UM_OFF )
431 	{
432 		aFontDescriptor.Underline = awt::FontUnderline::SINGLE;
433 	}
434 	aAny <<= aFontDescriptor;
435 	rProperty->setPropertyValue( rtl::OUString::createFromAscii("FontDescriptor"), aAny );
436 };
437 
438 // ---------------------------------------------------------------
439 
InsertPage()440 void CGMImpressOutAct::InsertPage()
441 {
442 	if ( mnCurrentPage )	// eine seite ist immer vorhanden, deshalb wird die erste Seite ausgelassen
443 	{
444 		uno::Reference< drawing::XDrawPage > xPage( maXDrawPages->insertNewByIndex( 0xffff ), uno::UNO_QUERY );
445 		maXDrawPage = xPage;
446 		if ( ImplInitPage() == sal_False )
447 			mpCGM->mbStatus = sal_False;
448 	}
449 	mnCurrentPage++;
450 };
451 
452 // ---------------------------------------------------------------
453 
BeginGroup()454 void CGMImpressOutAct::BeginGroup()
455 {
456 	if ( mnGroupLevel < CGM_OUTACT_MAX_GROUP_LEVEL )
457 	{
458 		mpGroupLevel[ mnGroupLevel ] = maXShapes->getCount();
459 	}
460 	mnGroupLevel++;
461 	mnGroupActCount = mpCGM->mnActCount;
462 };
463 
464 // ---------------------------------------------------------------
465 
EndGroup()466 void CGMImpressOutAct::EndGroup()
467 {
468 	if ( mnGroupLevel )		// preserve overflow
469 		mnGroupLevel--;
470 	if ( mnGroupLevel < CGM_OUTACT_MAX_GROUP_LEVEL )
471 	{
472 		sal_uInt32 mnFirstIndex = mpGroupLevel[ mnGroupLevel ];
473 		if ( mnFirstIndex == 0xffffffff )
474 			mnFirstIndex = 0;
475 		sal_uInt32 mnCurrentCount = maXShapes->getCount();
476 		if ( ( mnCurrentCount - mnFirstIndex ) > 1 )
477 		{
478 			uno::Reference< drawing::XShapeGrouper > aXShapeGrouper;
479 			uno::Any aAny( maXDrawPage->queryInterface( ::getCppuType(((const uno::Reference< drawing::XShapeGrouper >*)0) )));
480 			if( aAny >>= aXShapeGrouper )
481 			{
482 				uno::Reference< drawing::XShapes >  aXShapes;
483 //				if ( maXServiceManagerSC->createInstance( L"stardiv.one.drawing.ShapeCollection" )->queryInterface( ::getCppuType((const Reference< drawing::XShapes >*)0), aXShapes ) )
484 
485 				uno::Reference< drawing::XShape >  aXShapeCollection( maXServiceManagerSC->createInstance( rtl::OUString::createFromAscii("com.sun.star.drawing.ShapeCollection") ), uno::UNO_QUERY );
486 				if ( aXShapeCollection.is() )
487 				{
488 					aXShapes = uno::Reference< drawing::XShapes >( aXShapeCollection, uno::UNO_QUERY );
489 					if( aXShapes.is() )
490 					{
491 						for ( sal_uInt32 i = mnFirstIndex; i < mnCurrentCount; i++ )
492 						{
493 							uno::Reference< drawing::XShape >  aXShape = *(uno::Reference< drawing::XShape > *)maXShapes->getByIndex( i ).getValue();
494 							if (aXShape.is() )
495 							{
496 								aXShapes->add( aXShape );
497 							}
498 						}
499 					}
500 				}
501 				uno::Reference< drawing::XShapeGroup >  aXShapeGroup = aXShapeGrouper->group( aXShapes );
502 			}
503 		}
504 	}
505 };
506 
507 // ---------------------------------------------------------------
508 
EndGrouping()509 void CGMImpressOutAct::EndGrouping()
510 {
511 	while ( mnGroupLevel )
512 	{
513 		EndGroup();
514 	}
515 }
516 
517 // ---------------------------------------------------------------
518 
DrawRectangle(FloatRect & rFloatRect)519 void CGMImpressOutAct::DrawRectangle( FloatRect& rFloatRect )
520 {
521 	if ( mnGroupActCount != ( mpCGM->mnActCount - 1 ) )			// POWERPOINT HACK !!!
522 	{
523 		if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.RectangleShape") ) )
524 		{
525 			awt::Size aSize( (long)(rFloatRect.Right - rFloatRect.Left ), (long)(rFloatRect.Bottom-rFloatRect.Top ) );
526 			maXShape->setSize( aSize );
527 			maXShape->setPosition( awt::Point( (long)rFloatRect.Left, (long)rFloatRect.Top ) );
528 			ImplSetFillBundle();
529 		}
530 	}
531 };
532 
533 // ---------------------------------------------------------------
534 
DrawEllipse(FloatPoint & rCenter,FloatPoint & rSize,double & rOrientation)535 void CGMImpressOutAct::DrawEllipse( FloatPoint& rCenter, FloatPoint& rSize, double& rOrientation )
536 {
537 	if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.EllipseShape") ) )
538 	{
539 		drawing::CircleKind eCircleKind = drawing::CircleKind_FULL;
540 		uno::Any aAny( &eCircleKind, ::getCppuType((const drawing::CircleKind*)0) );
541 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleKind"), aAny );
542 
543 		long nXSize = (long)( rSize.X * 2.0 );		// Merkwuerdigkes Verhalten bei einer awt::Size von 0
544 		long nYSize = (long)( rSize.Y * 2.0 );
545 		if ( nXSize < 1 )
546 			nXSize = 1;
547 		if ( nYSize < 1 )
548 			nYSize = 1;
549 		maXShape->setSize( awt::Size( nXSize, nYSize ) );
550 		maXShape->setPosition( awt::Point( (long)( rCenter.X - rSize.X ), (long)( rCenter.Y - rSize.Y ) ) );
551 
552 		if ( rOrientation != 0 )
553 		{
554 			ImplSetOrientation( rCenter, rOrientation );
555 		}
556 		ImplSetFillBundle();
557 	}
558 };
559 
560 // ---------------------------------------------------------------
561 
DrawEllipticalArc(FloatPoint & rCenter,FloatPoint & rSize,double & rOrientation,sal_uInt32 nType,double & fStartAngle,double & fEndAngle)562 void CGMImpressOutAct::DrawEllipticalArc( FloatPoint& rCenter, FloatPoint& rSize, double& rOrientation,
563 			sal_uInt32 nType, double& fStartAngle, double& fEndAngle )
564 {
565 	if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.EllipseShape") ) )
566 	{
567 		uno::Any aAny;
568 		drawing::CircleKind eCircleKind;
569 
570 
571 		long nXSize = (long)( rSize.X * 2.0 );		// Merkwuerdigkes Verhalten bei einer awt::Size von 0
572 		long nYSize = (long)( rSize.Y * 2.0 );
573 		if ( nXSize < 1 )
574 			nXSize = 1;
575 		if ( nYSize < 1 )
576 			nYSize = 1;
577 
578 		maXShape->setSize( awt::Size ( nXSize, nYSize ) );
579 
580 		if ( rOrientation != 0 )
581 		{
582 			fStartAngle += rOrientation;
583 			if ( fStartAngle >= 360 )
584 				fStartAngle -= 360;
585 			fEndAngle += rOrientation;
586 			if ( fEndAngle >= 360 )
587 				fEndAngle -= 360;
588 		}
589 		switch( nType )
590 		{
591 			case 0 : eCircleKind = drawing::CircleKind_SECTION; break;
592 			case 1 : eCircleKind = drawing::CircleKind_CUT; break;
593 			case 2 : eCircleKind = drawing::CircleKind_ARC; break;
594 			default : eCircleKind = drawing::CircleKind_FULL; break;
595 		}
596 		if ( (long)fStartAngle == (long)fEndAngle )
597 		{
598 			eCircleKind = drawing::CircleKind_FULL;
599 			aAny.setValue( &eCircleKind, ::getCppuType((const drawing::CircleKind*)0) );
600 		}
601 		else
602 		{
603 			aAny.setValue( &eCircleKind, ::getCppuType((const drawing::CircleKind*)0) );
604 			maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleKind"), aAny );
605 			aAny <<= (sal_Int32)( (long)( fStartAngle * 100 ) );
606 			maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleStartAngle"), aAny );
607 			aAny <<= (sal_Int32)( (long)( fEndAngle * 100 ) );
608 			maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("CircleEndAngle"), aAny );
609 		}
610 		maXShape->setPosition( awt::Point( (long)( rCenter.X - rSize.X ), (long)( rCenter.Y - rSize.Y ) ) );
611 		if ( rOrientation != 0 )
612 		{
613 			ImplSetOrientation( rCenter, rOrientation );
614 		}
615 		if ( eCircleKind == drawing::CircleKind_ARC )
616 		{
617 			ImplSetLineBundle();
618 		}
619 		else
620 		{
621 			ImplSetFillBundle();
622 			if ( nType == 2 )
623 			{
624 				ImplSetLineBundle();
625 				drawing::FillStyle eFillStyle = drawing::FillStyle_NONE;
626 				aAny.setValue( &eFillStyle, ::getCppuType((const drawing::FillStyle*)0) );
627 				maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), aAny );
628 			}
629 		}
630 	}
631 };
632 
633 // ---------------------------------------------------------------
634 
DrawBitmap(CGMBitmapDescriptor * pBmpDesc)635 void CGMImpressOutAct::DrawBitmap( CGMBitmapDescriptor* pBmpDesc )
636 {
637 	if ( pBmpDesc->mbStatus && pBmpDesc->mpBitmap )
638 	{
639 		FloatPoint aOrigin = pBmpDesc->mnOrigin;
640 		double fdx = pBmpDesc->mndx;
641 		double fdy = pBmpDesc->mndy;
642 
643 		sal_uInt32	nMirr = BMP_MIRROR_NONE;
644 		if ( pBmpDesc->mbVMirror )
645 			nMirr |= BMP_MIRROR_VERT;
646 		if ( pBmpDesc->mbHMirror )
647 			nMirr |= BMP_MIRROR_HORZ;
648 		if ( nMirr != BMP_MIRROR_NONE )
649 			pBmpDesc->mpBitmap->Mirror( nMirr );
650 
651 		mpCGM->ImplMapPoint( aOrigin );
652 		mpCGM->ImplMapX( fdx );
653 		mpCGM->ImplMapY( fdy );
654 
655 		if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.GraphicObjectShape") ) )
656 		{
657 			maXShape->setSize( awt::Size( (long)fdx, (long)fdy ) );
658 			maXShape->setPosition( awt::Point( (long)aOrigin.X, (long)aOrigin.Y ) );
659 
660 			if ( pBmpDesc->mnOrientation != 0 )
661 			{
662 				ImplSetOrientation( aOrigin, pBmpDesc->mnOrientation );
663 			}
664 
665 			uno::Reference< awt::XBitmap > xBitmap( VCLUnoHelper::CreateBitmap( BitmapEx( *( pBmpDesc->mpBitmap ) ) ) );
666 			uno::Any aAny;
667 			aAny <<= xBitmap;
668 			maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("GraphicObjectFillBitmap"), aAny );
669 
670 		}
671 	}
672 };
673 
674 // ---------------------------------------------------------------
675 
DrawPolygon(Polygon & rPoly)676 void CGMImpressOutAct::DrawPolygon( Polygon& rPoly )
677 {
678 	sal_uInt16 nPoints = rPoly.GetSize();
679 
680 	if ( ( nPoints > 1 ) && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.PolyPolygonShape") ) )
681 	{
682 		drawing::PointSequenceSequence aRetval;
683 
684 		// Polygone innerhalb vrobereiten
685 		aRetval.realloc( 1 );
686 
687 		// Zeiger auf aeussere Arrays holen
688 		drawing::PointSequence* pOuterSequence = aRetval.getArray();
689 
690 		// Platz in Arrays schaffen
691 		pOuterSequence->realloc((sal_Int32)nPoints);
692 
693 		// Pointer auf arrays holen
694 		awt::Point* pInnerSequence = pOuterSequence->getArray();
695 
696 		for( sal_uInt16 n = 0; n < nPoints; n++ )
697 			*pInnerSequence++ = awt::Point( rPoly[ n ].X(), rPoly[n].Y() );
698 
699 		uno::Any aParam;
700 		aParam <<= aRetval;
701 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygon"), aParam );
702 		ImplSetFillBundle();
703 	}
704 };
705 
706 
707 // ---------------------------------------------------------------
708 
DrawPolyLine(Polygon & rPoly)709 void CGMImpressOutAct::DrawPolyLine( Polygon& rPoly )
710 {
711 	sal_uInt16 nPoints = rPoly.GetSize();
712 
713 	if ( ( nPoints > 1 ) && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.PolyLineShape") ) )
714 	{
715 		drawing::PointSequenceSequence aRetval;
716 
717 		// Polygone innerhalb vrobereiten
718 		aRetval.realloc( 1 );
719 
720 		// Zeiger auf aeussere Arrays holen
721 		drawing::PointSequence* pOuterSequence = aRetval.getArray();
722 
723 		// Platz in Arrays schaffen
724 		pOuterSequence->realloc((sal_Int32)nPoints);
725 
726 		// Pointer auf arrays holen
727 		awt::Point* pInnerSequence = pOuterSequence->getArray();
728 
729 		for( sal_uInt16 n = 0; n < nPoints; n++ )
730 			*pInnerSequence++ = awt::Point( rPoly[ n ].X(), rPoly[n].Y() );
731 
732 		uno::Any aParam;
733 		aParam <<= aRetval;
734 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygon"), aParam );
735 		ImplSetLineBundle();
736 	}
737 };
738 
739 // ---------------------------------------------------------------
740 
DrawPolybezier(Polygon & rPolygon)741 void CGMImpressOutAct::DrawPolybezier( Polygon& rPolygon )
742 {
743 	sal_uInt16 nPoints = rPolygon.GetSize();
744 	if ( ( nPoints > 1 ) && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.OpenBezierShape") ) )
745 	{
746 		drawing::PolyPolygonBezierCoords aRetval;
747 
748 		aRetval.Coordinates.realloc( 1 );
749 		aRetval.Flags.realloc( 1 );
750 
751 		// Zeiger auf aeussere Arrays holen
752 		drawing::PointSequence* pOuterSequence = aRetval.Coordinates.getArray();
753 		drawing::FlagSequence* pOuterFlags = aRetval.Flags.getArray();
754 
755 		// Platz in Arrays schaffen
756 		pOuterSequence->realloc( nPoints );
757 		pOuterFlags->realloc( nPoints );
758 
759 		awt::Point* pInnerSequence = pOuterSequence->getArray();
760 		drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
761 
762 		for( sal_uInt16 i = 0; i < nPoints; i++ )
763 		{
764 			*pInnerSequence++ = awt::Point( rPolygon[ i ].X(), rPolygon[ i ].Y() );
765 			*pInnerFlags++ = (drawing::PolygonFlags)rPolygon.GetFlags( i );
766 		}
767 		uno::Any aParam;
768 		aParam <<= aRetval;
769 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygonBezier"), aParam );
770 		ImplSetLineBundle();
771 	}
772 };
773 
774 // ---------------------------------------------------------------
775 
DrawPolyPolygon(PolyPolygon & rPolyPolygon)776 void CGMImpressOutAct::DrawPolyPolygon( PolyPolygon& rPolyPolygon )
777 {
778 	sal_uInt32 nNumPolys = rPolyPolygon.Count();
779 	if ( nNumPolys && ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.ClosedBezierShape") ) )
780 	{
781 		drawing::PolyPolygonBezierCoords aRetval;
782 
783 		// Polygone innerhalb vrobereiten
784 		aRetval.Coordinates.realloc((sal_Int32)nNumPolys);
785 		aRetval.Flags.realloc((sal_Int32)nNumPolys);
786 
787 		// Zeiger auf aeussere Arrays holen
788 		drawing::PointSequence* pOuterSequence = aRetval.Coordinates.getArray();
789 		drawing::FlagSequence* pOuterFlags = aRetval.Flags.getArray();
790 
791 		for( sal_uInt16 a = 0; a < nNumPolys; a++ )
792 		{
793 			Polygon aPolygon( rPolyPolygon.GetObject( a ) );
794 			sal_uInt32 nNumPoints = aPolygon.GetSize();
795 
796 			// Platz in Arrays schaffen
797 			pOuterSequence->realloc((sal_Int32)nNumPoints);
798 			pOuterFlags->realloc((sal_Int32)nNumPoints);
799 
800 			// Pointer auf arrays holen
801 			awt::Point* pInnerSequence = pOuterSequence->getArray();
802 			drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray();
803 
804 			for( sal_uInt16 b = 0; b < nNumPoints; b++ )
805 			{
806 				*pInnerSequence++ = awt::Point( aPolygon.GetPoint( b ).X(), aPolygon.GetPoint( b ).Y() ) ;
807 				*pInnerFlags++ = (drawing::PolygonFlags)aPolygon.GetFlags( b );
808 			}
809 			pOuterSequence++;
810 			pOuterFlags++;
811 		}
812 		uno::Any aParam;
813 		aParam <<= aRetval;
814 		maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("PolyPolygonBezier"), aParam);
815 		ImplSetFillBundle();
816 	}
817 };
818 
819 // ---------------------------------------------------------------
820 
DrawText(awt::Point & rTextPos,awt::Size & rTextSize,char * pString,sal_uInt32,FinalFlag eFlag)821 void CGMImpressOutAct::DrawText( awt::Point& rTextPos, awt::Size& rTextSize, char* pString, sal_uInt32 /*nSize*/, FinalFlag eFlag )
822 {
823 	if ( ImplCreateShape( rtl::OUString::createFromAscii("com.sun.star.drawing.TextShape") ) )
824 	{
825 		uno::Any	aAny;
826 		long	nWidth = rTextSize.Width;
827 		long	nHeight = rTextSize.Height;
828 
829 		awt::Point aTextPos( rTextPos );
830 		switch ( mpCGM->pElement->eTextAlignmentV )
831 		{
832 			case TAV_HALF :
833 			{
834 				aTextPos.Y -= static_cast<sal_Int32>( ( mpCGM->pElement->nCharacterHeight * 1.5 ) / 2 );
835 			}
836 			break;
837 
838 			case TAV_BASE :
839 			case TAV_BOTTOM :
840 			case TAV_NORMAL :
841 				aTextPos.Y -= static_cast<sal_Int32>( mpCGM->pElement->nCharacterHeight * 1.5 );
842 			case TAV_TOP :
843 				break;
844 			case TAV_CAP:
845 			case TAV_CONT:
846 				break;  // -Wall these two were not here.
847 		}
848 
849 		if ( nWidth < 0 )
850 		{
851 			nWidth = -nWidth;
852 		}
853 		else if ( nWidth == 0 )
854 		{
855 			nWidth = -1;
856 		}
857 		if ( nHeight < 0 )
858 		{
859 			nHeight = -nHeight;
860 		}
861 		else if ( nHeight == 0 )
862 		{
863 			nHeight = -1;
864 		}
865 		maXShape->setPosition( aTextPos );
866 		maXShape->setSize( awt::Size( nWidth, nHeight ) );
867 		double nX = mpCGM->pElement->nCharacterOrientation[ 2 ];
868 		double nY = mpCGM->pElement->nCharacterOrientation[ 3 ];
869 		double nOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
870 		if ( nY < 0 )
871 			nOrientation = 360 - nOrientation;
872 
873 		if ( nOrientation )
874 		{
875 			aAny <<= (sal_Int32)( aTextPos.X );
876 			maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointX"), aAny );
877 			aAny <<= (sal_Int32)( aTextPos.Y + nHeight );
878 			maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotationPointY"), aAny );
879 			aAny <<= (sal_Int32)( (sal_Int32)( nOrientation * 100 ) );
880 			maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("RotateAngle"), aAny );
881 		}
882 		if ( nWidth == -1 )
883 		{
884 			sal_Bool bTrue( sal_True );
885 			aAny.setValue( &bTrue, ::getCppuType((const sal_Bool*)0 ));
886 			maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextAutoGrowWidth"), aAny );
887 
888 			drawing::TextAdjust eTextAdjust;
889 			switch ( mpCGM->pElement->eTextAlignmentH )
890 			{
891 				case TAH_RIGHT :
892 					eTextAdjust = drawing::TextAdjust_RIGHT;
893 				break;
894 				case TAH_LEFT :
895 				case TAH_CONT :
896 				case TAH_NORMAL :
897 					eTextAdjust = drawing::TextAdjust_LEFT;
898 				break;
899 				case TAH_CENTER :
900 					eTextAdjust = drawing::TextAdjust_CENTER;
901 				break;
902 			}
903 			aAny <<= eTextAdjust;
904 			maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextHorizontalAdjust"), aAny );
905 		}
906 		if ( nHeight == -1 )
907 		{
908 			sal_Bool bTrue = sal_True;
909 			aAny.setValue( &bTrue, ::getCppuType((const sal_Bool*)0) );
910 			maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextAutoGrowHeight"), aAny );
911 		}
912 		uno::Reference< text::XText >  xText;
913 		uno::Any aFirstQuery( maXShape->queryInterface( ::getCppuType((const uno::Reference< text::XText >*)0) ));
914 		if( aFirstQuery >>= xText )
915 		{
916 			String aStr( String::CreateFromAscii( pString ) );
917 
918 			uno::Reference< text::XTextCursor >  aXTextCursor( xText->createTextCursor() );
919 			{
920 				aXTextCursor->gotoEnd( sal_False );
921 				uno::Reference< text::XTextRange >  aCursorText;
922 				uno::Any aSecondQuery( aXTextCursor->queryInterface( ::getCppuType((const uno::Reference< text::XTextRange >*)0) ));
923 				if ( aSecondQuery >>= aCursorText )
924 				{
925 					uno::Reference< beans::XPropertySet >  aCursorPropSet;
926 
927 					uno::Any aQuery( aCursorText->queryInterface( ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) ));
928 					if( aQuery >>= aCursorPropSet )
929 					{
930 						if ( nWidth != -1 )		// paragraph adjusting in a valid textbox ?
931 						{
932 							switch ( mpCGM->pElement->eTextAlignmentH )
933 							{
934 								case TAH_RIGHT :
935 									aAny <<= (sal_Int16)style::HorizontalAlignment_RIGHT;
936 								break;
937 								case TAH_LEFT :
938 								case TAH_CONT :
939 								case TAH_NORMAL :
940 									aAny <<= (sal_Int16)style::HorizontalAlignment_LEFT;
941 								break;
942 								case TAH_CENTER :
943 									aAny <<= (sal_Int16)style::HorizontalAlignment_CENTER;
944 								break;
945 							}
946 							aCursorPropSet->setPropertyValue( rtl::OUString::createFromAscii("ParaAdjust"), aAny );
947 						}
948 						if ( nWidth > 0 && nHeight > 0 )	// restricted text
949 						{
950 							sal_Bool bTrue = sal_True;
951 							aAny.setValue( &bTrue, ::getCppuType((const sal_Bool*)0));
952 							maXPropSet->setPropertyValue( rtl::OUString::createFromAscii("TextFitToSize"), aAny );
953 						}
954 						aCursorText->setString( aStr );
955 						aXTextCursor->gotoEnd( sal_True );
956 						ImplSetTextBundle( aCursorPropSet );
957 					}
958 				}
959 			}
960 		}
961 		if ( eFlag == FF_NOT_FINAL )
962 		{
963 			nFinalTextCount = maXShapes->getCount();
964 		}
965 	}
966 };
967 
968 // ---------------------------------------------------------------
969 
AppendText(char * pString,sal_uInt32,FinalFlag)970 void CGMImpressOutAct::AppendText( char* pString, sal_uInt32 /*nSize*/, FinalFlag /*eFlag*/ )
971 {
972 	if ( nFinalTextCount )
973 	{
974 		uno::Reference< drawing::XShape >  aShape = *(uno::Reference< drawing::XShape > *)maXShapes->getByIndex( nFinalTextCount - 1 ).getValue();
975 		if ( aShape.is() )
976 		{
977 			uno::Reference< text::XText >  xText;
978 			uno::Any aFirstQuery(  aShape->queryInterface( ::getCppuType((const uno::Reference< text::XText >*)0)) );
979 			if( aFirstQuery >>= xText )
980 			{
981 				String aStr( String::CreateFromAscii( pString ) );
982 
983 				uno::Reference< text::XTextCursor >  aXTextCursor( xText->createTextCursor() );
984 				if ( aXTextCursor.is() )
985 				{
986 					aXTextCursor->gotoEnd( sal_False );
987 					uno::Reference< text::XTextRange >  aCursorText;
988 					uno::Any aSecondQuery(aXTextCursor->queryInterface( ::getCppuType((const uno::Reference< text::XTextRange >*)0) ));
989 					if ( aSecondQuery >>= aCursorText )
990 					{
991 						uno::Reference< beans::XPropertySet >  aPropSet;
992 						uno::Any aQuery(aCursorText->queryInterface( ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) ));
993 						if( aQuery >>= aPropSet )
994 						{
995 							aCursorText->setString( aStr );
996 							aXTextCursor->gotoEnd( sal_True );
997 							ImplSetTextBundle( aPropSet );
998 						}
999 					}
1000 				}
1001 			}
1002 		}
1003 	}
1004 }
1005 
1006 // ---------------------------------------------------------------
1007 // nCount != 0 -> Append Text
DrawText(TextEntry *,NodeFrameSet &,sal_uInt32)1008 sal_uInt32 CGMImpressOutAct::DrawText( TextEntry* /*pTextEntry*/, NodeFrameSet& /*rNodeFrameSet*/, sal_uInt32 /*nObjCount*/ )
1009 {
1010 
1011 return 0;
1012 
1013 /*
1014 	uno::Reference< drawing::XShape >  aShape;
1015 
1016 	if ( nObjCount )
1017 	{
1018 		 aShape = (drawing::XShape*) maXShapes->getElementByIndex( nObjCount - 1 )->queryInterface( ::getCppuType((const Reference< drawing::XShape >*)0) );
1019 	}
1020 	else
1021 	{
1022 		aShape = maXShapes->insertShape( maXShapeFactory->createShape( L"ShapeText", rNodeFrameSet.nSize ), rNodeFrameSet.nTopLeft );
1023 	}
1024 	if ( aShape.is() )
1025 	{
1026 		uno::Reference< text::XText >  xText = (text::XText*)aShape->queryInterface( ::getCppuType((const Reference< text::XText >*)0) );
1027 		if ( xText.is() )
1028 		{
1029 			uno::Reference< text::XTextCursor >  aXTextCursor = (text::XTextCursor*)xText->createTextCursor()->queryInterface( ::getCppuType((const Reference< text::XTextCursor >*)0) );
1030 			if ( aXTextCursor.is() )
1031 			{
1032 				uno::Any	aAny;
1033 				sal_uInt32	nTextOfs = 0;
1034 				TextAttribute* pTAttr = pTextEntry->pAttribute;
1035 				do
1036 				{
1037 					if ( pTAttr->nTextAttribSize > 0.3 )	// is text readable
1038 					{
1039 						aXTextCursor->gotoEnd( sal_False );
1040 						char nPushedChar = pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ];
1041 						pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ] = 0;
1042 						UString aStr( StringToOUString( pTextEntry->pText +  nTextOfs, CHARSET_SYSTEM ) );
1043 
1044 						uno::Reference< text::XText >  aCursorText = (text::XText*)aXTextCursor->queryInterface( ::getCppuType((const Reference< text::XText >*)0) );
1045 						if ( aCursorText.is() )
1046 						{
1047 							uno::Reference< beans::XPropertySet >  aPropSet = (beans::XPropertySet*)aCursorText->queryInterface( ::getCppuType((const Reference< beans::XPropertySet >*)0) );
1048 							if ( aPropSet.is() )
1049 							{
1050 								if ( pTextEntry->nRowOrLineNum )
1051 								{
1052 									uno::Reference< XControlCharacterInsertable >  aCRef = (XControlCharacterInsertable*)aXTextCursor->queryInterface( ::getCppuType((const Reference< XControlCharacterInsertable >*)0) );
1053 									if ( aCRef.is() )
1054 									{
1055 										aCRef->insertControlCharacter( TEXTCONTROLCHAR_PARAGRAPH_BREAK );
1056 									}
1057 								}
1058 								aCursorText->setText( aStr );
1059 								aXTextCursor->gotoEnd( sal_True );
1060 								double nSize = mpCGM->mnOutdx;
1061 								if ( mpCGM->mnOutdx < mpCGM->mnOutdy )
1062 									nSize = mpCGM->mnOutdy;
1063 								nSize = ( nSize * (double)pTAttr->nTextAttribSize * (double)1.5 ) / 100;
1064 
1065 								aAny <<= (sal_Int32)( (sal_Int32)nSize );
1066 								aPropSet->setPropertyValue( L"CharHeight", aAny );
1067 
1068 								sal_uInt32 nTextColor = pTAttr->nTextColorIndex;
1069 								if ( nTextColor == 0xff )
1070 								{
1071 									nTextColor = ( pTAttr->nTextColorBlue << 16 ) + ( pTAttr->nTextColorGreen << 8 ) + pTAttr->nTextColorRed;
1072 								}
1073 								else
1074 								{
1075 									nTextColor = mpCGM->pElement->aColorTable[ nTextColor ];
1076 								}
1077 
1078 								sal_uInt32 nFontType = 0;
1079 
1080 								if (  pTAttr->nTextFontType == 0xff )
1081 								{
1082 									FontEntry* pFontEntry = mpCGM->pElement->aFontList.GetFontEntry( pTAttr->nTextFontFamily );
1083 									if ( pFontEntry )
1084 									{
1085 										nFontType = pFontEntry->nFontType;
1086 										if ( mpCGM->pElement->nAspectSourceFlags & ASF_TEXTCOLOR )
1087 											nTextColor = mpCGM->pElement->pTextBundle->GetColor();
1088 										else
1089 											nTextColor = mpCGM->pElement->aTextBundle.GetColor();
1090 									}
1091 									FontItalic eFontItalic = ITALIC_NONE;
1092 									if ( nFontType & 1 )
1093 										eFontItalic = ITALIC_NORMAL;
1094 									aAny.setValue( &eFontItalic, ::getCppuType((const FontItalic*)0) );
1095 									aPropSet->setPropertyValue( L"CharPosture", aAny );
1096 								}
1097 								aAny <<= (sal_Int32)( (sal_Int32)nTextColor );
1098 								aPropSet->setPropertyValue( L"CharColor", aAny );
1099 
1100 								awt::FontWeight eFontWeight = WEIGHT_NORMAL;
1101 								if ( nFontType & 2 )
1102 									eFontWeight = WEIGHT_BOLD;
1103 								aAny.setValue( &eFontWeight, ::getCppuType((const awt::FontWeight*)0) );
1104 								aPropSet->setPropertyValue( L"CharWeight", aAny );
1105 
1106 								if ( pTAttr->nTextAttribBits & 0x4000 )
1107 								{
1108 									awt::FontUnderline eUnderline = UNDERLINE_SINGLE;
1109 									aAny.setValue( &eUnderline, ::getCppuType((const awt::FontUnderline*)0) );
1110 									aPropSet->setPropertyValue( L"CharUnderline", aAny );
1111 								}
1112 							}
1113 						}
1114 						pTextEntry->pText[ nTextOfs + pTAttr->nTextAttribCount ] = nPushedChar;
1115 					}
1116 					nTextOfs += pTAttr->nTextAttribCount;
1117 				}
1118 				while ( ( ( pTAttr = pTAttr->pNextAttribute ) != NULL ) );
1119 			}
1120 		}
1121 	}
1122 	return ( nObjCount ) ? nObjCount : maXShapes->getCount();
1123 */
1124 }
1125 
1126 // ---------------------------------------------------------------
1127 
DrawChart()1128 void CGMImpressOutAct::DrawChart()
1129 {
1130 }
1131