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