1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: eschesdo.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include "eschesdo.hxx"
34 #include <svx/svdobj.hxx>
36 #include <svx/svdoashp.hxx>
37 #include <svx/unoshape.hxx>
38 #include <vcl/outdev.hxx>
39 #include <tools/poly.hxx>
40 #include <vcl/bitmapex.hxx>
41 #include <vcl/graph.hxx>
42 #include <tools/debug.hxx>
43 #include <svx/fmdpage.hxx>
45 #ifndef _TOOLKIT_UNOHLP_HXX //autogen wg. VCLXBitmap
46 #include <toolkit/unohlp.hxx>
48 #include <com/sun/star/style/VerticalAlignment.hpp>
49 #include <com/sun/star/awt/Gradient.hpp>
50 #include <com/sun/star/drawing/PointSequence.hpp>
51 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
52 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
53 #include <com/sun/star/drawing/FlagSequence.hpp>
54 #include <com/sun/star/drawing/TextAdjust.hpp>
55 #include <com/sun/star/drawing/LineDash.hpp>
56 #include <com/sun/star/text/XText.hpp>
57 #include <com/sun/star/drawing/CircleKind.hpp>
58 #include <com/sun/star/drawing/FillStyle.hpp>
59 #include <com/sun/star/task/XStatusIndicator.hpp>
60 #include <comphelper/extract.hxx>
61 #include <svtools/fltcall.hxx>
62 #include <vcl/cvtgrf.hxx>
64 using ::rtl::OUString
;
65 using namespace ::vos
;
66 using namespace ::com::sun::star
;
67 using namespace ::com::sun::star::beans
;
68 using namespace ::com::sun::star::container
;
69 using namespace ::com::sun::star::uno
;
70 using namespace ::com::sun::star::drawing
;
71 using namespace ::com::sun::star::text
;
72 using namespace ::com::sun::star::task
;
73 using namespace ::com::sun::star::style
;
75 #define EES_MAP_FRACTION 1440 // 1440 dpi
77 // ===================================================================
79 ImplEESdrWriter::ImplEESdrWriter( EscherEx
& rEx
)
82 maMapModeSrc ( MAP_100TH_MM
),
83 // PowerPoint: 576 dpi, WinWord: 1440 dpi, Excel: 1440 dpi
84 maMapModeDest( MAP_INCH
, Point(), Fraction( 1, EES_MAP_FRACTION
), Fraction( 1, EES_MAP_FRACTION
) ),
85 // mXStatusIndicator ( rXStatInd ),
87 mpHostAppData ( NULL
),
89 mnShapeMasterTitle ( 0 ),
90 mnShapeMasterBody ( 0 ),
91 mbStatusIndicator ( FALSE
),
97 // -------------------------------------------------------------------
99 Point
ImplEESdrWriter::ImplMapPoint( const Point
& rPoint
)
101 return OutputDevice::LogicToLogic( rPoint
, maMapModeSrc
, maMapModeDest
);
105 // -------------------------------------------------------------------
107 Size
ImplEESdrWriter::ImplMapSize( const Size
& rSize
)
109 Size
aRetSize( OutputDevice::LogicToLogic( rSize
, maMapModeSrc
, maMapModeDest
) );
111 if ( !aRetSize
.Width() )
113 if ( !aRetSize
.Height() )
118 // -------------------------------------------------------------------
120 void ImplEESdrWriter::ImplFlipBoundingBox( ImplEESdrObject
& rObj
, EscherPropertyContainer
& rPropOpt
)
122 INT32 nAngle
= rObj
.GetAngle();
123 Rectangle
aRect( rObj
.GetRect() );
126 nAngle
= ( 36000 + nAngle
) % 36000;
128 nAngle
= ( 36000 - ( nAngle
% 36000 ) );
130 double fVal
= (double)nAngle
* F_PI18000
;
131 double fCos
= cos( fVal
);
132 double fSin
= sin( fVal
);
134 double nWidthHalf
= (double) aRect
.GetWidth() / 2;
135 double nHeightHalf
= (double) aRect
.GetHeight() / 2;
137 double nXDiff
= fCos
* nWidthHalf
+ fSin
* (-nHeightHalf
);
138 double nYDiff
= - ( fSin
* nWidthHalf
- fCos
* ( -nHeightHalf
) );
140 aRect
.Move( (sal_Int32
)( -( nWidthHalf
- nXDiff
) ), (sal_Int32
)( - ( nHeightHalf
+ nYDiff
) ) );
144 nAngle
&=~0xffff; // nAngle auf volle Gradzahl runden
145 rPropOpt
.AddOpt( ESCHER_Prop_Rotation
, nAngle
);
147 rObj
.SetAngle( nAngle
);
148 rObj
.SetRect( aRect
);
151 // -----------------------------------------------------------------------
153 #define ADD_SHAPE( nType, nFlags ) \
155 nShapeType = nType; \
156 nShapeID = mpEscherEx->GetShapeID(); \
157 rObj.SetShapeId( nShapeID ); \
158 mpEscherEx->AddShape( (UINT32)nType, (UINT32)nFlags, nShapeID ); \
159 rSolverContainer.AddShape( rObj.GetShapeRef(), nShapeID ); \
162 #define SHAPE_TEXT( bFill ) \
164 mpEscherEx->OpenContainer( ESCHER_SpContainer ); \
165 ADD_SHAPE( ESCHER_ShpInst_TextBox, 0xa00 ); \
167 aPropOpt.CreateFillProperties( rObj.mXPropSet, sal_True ); \
168 if( rObj.ImplGetText() ) \
169 aPropOpt.CreateTextProperties( rObj.mXPropSet, \
170 mpEscherEx->QueryTextID( rObj.GetShapeRef(), \
171 rObj.GetShapeId() ) ); \
174 //Map from twips to export units, generally twips as well, only excel and word
175 //export is happening here, so native units are export units, leave as
176 //placeholder if required in future
177 void ImplEESdrWriter::MapRect(ImplEESdrObject
& /* rObj */ )
181 UINT32
ImplEESdrWriter::ImplWriteShape( ImplEESdrObject
& rObj
,
182 EscherSolverContainer
& rSolverContainer
,
183 ImplEESdrPageType ePageType
)
186 UINT16 nShapeType
= 0;
187 BOOL bDontWriteText
= FALSE
; // if a metafile is written as shape replacement, then the text is already part of the metafile
188 BOOL bAdditionalText
= FALSE
;
189 UINT32 nGrpShapeID
= 0;
192 mpHostAppData
= mpEscherEx
->StartShape( rObj
.GetShapeRef() );
193 if ( mpHostAppData
&& mpHostAppData
->DontWriteShape() )
196 // #i51348# get shape name
198 if( const SdrObject
* pSdrObj
= rObj
.GetSdrObject() )
199 if( pSdrObj
->GetName().Len() > 0 )
200 aShapeName
= pSdrObj
->GetName();
204 if( rObj
.GetType().EqualsAscii( "drawing.Group" ))
206 Reference
< XIndexAccess
> xXIndexAccess( rObj
.GetShapeRef(), UNO_QUERY
);
208 if( xXIndexAccess
.is() && 0 != xXIndexAccess
->getCount() )
210 nShapeID
= mpEscherEx
->EnterGroup( aShapeName
, &rObj
.GetRect() );
211 nShapeType
= ESCHER_ShpInst_Min
;
213 for( UINT32 n
= 0, nCnt
= xXIndexAccess
->getCount();
216 ImplEESdrObject
aObj( *this, *(Reference
< XShape
>*)
217 xXIndexAccess
->getByIndex( n
).getValue() );
219 ImplWriteShape( aObj
, rSolverContainer
, ePageType
);
221 mpEscherEx
->LeaveGroup();
225 rObj
.SetAngle( rObj
.ImplGetInt32PropertyValue( ::rtl::OUString::createFromAscii("RotateAngle") ));
227 if( ( rObj
.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("IsFontwork") ) &&
228 ::cppu::any2bool( rObj
.GetUsrAny() ) ) ||
229 rObj
.GetType().EqualsAscii( "drawing.Measure" ) || rObj
.GetType().EqualsAscii( "drawing.Caption" ) )
232 if( rObj.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("BoundRect") ) )
234 ::com::sun::star::awt::Rectangle aRect( *(::com::sun::star::awt::Rectangle*)rObj.GetUsrAny().getValue() );
235 rObj.SetRect( ImplMapPoint( Point( aRect.X, aRect.Y ) ),
236 ImplMapSize( Size( aRect.Width, aRect.Height ) ) );
239 rObj
.SetType( String( RTL_CONSTASCII_STRINGPARAM(
240 "drawing.dontknow" ),
241 RTL_TEXTENCODING_MS_1252
));
244 const ::com::sun::star::awt::Size
aSize100thmm( rObj
.GetShapeRef()->getSize() );
245 const ::com::sun::star::awt::Point
aPoint100thmm( rObj
.GetShapeRef()->getPosition() );
246 Rectangle
aRect100thmm( Point( aPoint100thmm
.X
, aPoint100thmm
.Y
), Size( aSize100thmm
.Width
, aSize100thmm
.Height
) );
248 mpPicStrm
= mpEscherEx
->QueryPicStream();
249 EscherPropertyContainer
aPropOpt( (EscherGraphicProvider
&)*mpEscherEx
, mpPicStrm
, aRect100thmm
);
251 // #i51348# shape name
252 if( aShapeName
.Len() > 0 )
253 aPropOpt
.AddOpt( ESCHER_Prop_wzName
, aShapeName
);
254 if ( InteractionInfo
* pInteraction
= mpHostAppData
? mpHostAppData
->GetInteractionInfo() : 0)
256 const std::auto_ptr
< SvMemoryStream
>& pMemStrm
= pInteraction
->getHyperlinkRecord();
257 if ( pMemStrm
.get() )
259 pMemStrm
->ObjectOwnsMemory( FALSE
);
260 sal_uInt8
* pBuf
= (sal_uInt8
*) pMemStrm
->GetData();
261 sal_uInt32 nSize
= pMemStrm
->Seek( STREAM_SEEK_TO_END
);
262 aPropOpt
.AddOpt( ESCHER_Prop_pihlShape
, sal_False
, nSize
, pBuf
, nSize
);;
264 if ( pInteraction
->hasInteraction() )
265 aPropOpt
.AddOpt( ESCHER_Prop_fPrint
, 0x00080008 );
268 if ( rObj
.GetType().EqualsAscii( "drawing.Custom" ) )
270 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
271 sal_uInt32 nMirrorFlags
;
273 rtl::OUString sCustomShapeType
;
274 MSO_SPT eShapeType
= aPropOpt
.GetCustomShapeType( rObj
.GetShapeRef(), nMirrorFlags
, sCustomShapeType
);
275 if ( sCustomShapeType
.equalsAscii( "col-502ad400" ) || sCustomShapeType
.equalsAscii( "col-60da8460" ) )
277 ADD_SHAPE( ESCHER_ShpInst_PictureFrame
, 0xa00 );
278 if ( aPropOpt
.CreateGraphicProperties( rObj
.mXPropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False
) )
280 aPropOpt
.AddOpt( ESCHER_Prop_LockAgainstGrouping
, 0x800080 );
281 aPropOpt
.AddOpt( ESCHER_Prop_fNoFillHitTest
, 0x100000 ); // no fill
282 aPropOpt
.AddOpt( ESCHER_Prop_fNoLineDrawDash
, 0x90000 ); // no linestyle
283 SdrObject
* pObj
= GetSdrObjectFromXShape( rObj
.GetShapeRef() );
286 Rectangle aBound
= pObj
->GetCurrentBoundRect();
287 Point
aPosition( ImplMapPoint( aBound
.TopLeft() ) );
288 Size
aSize( ImplMapSize( aBound
.GetSize() ) );
289 rObj
.SetRect( Rectangle( aPosition
, aSize
) );
291 bDontWriteText
= sal_True
;
298 sal::static_int_cast
< UINT16
>(eShapeType
),
299 nMirrorFlags
| 0xa00 );
300 aPropOpt
.CreateCustomShapeProperties( eShapeType
, rObj
.GetShapeRef() );
301 aPropOpt
.CreateFillProperties( rObj
.mXPropSet
, sal_True
);
302 if ( rObj
.ImplGetText() )
304 if ( !aPropOpt
.IsFontWork() )
305 aPropOpt
.CreateTextProperties( rObj
.mXPropSet
, mpEscherEx
->QueryTextID(
306 rObj
.GetShapeRef(), rObj
.GetShapeId() ), sal_True
, sal_False
);
310 else if ( rObj
.GetType().EqualsAscii( "drawing.Rectangle" ))
312 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
313 sal_Int32 nRadius
= (sal_Int32
)rObj
.ImplGetInt32PropertyValue(
314 ::rtl::OUString::createFromAscii("CornerRadius"));
317 nRadius
= ImplMapSize( Size( nRadius
, 0 )).Width();
318 ADD_SHAPE( ESCHER_ShpInst_RoundRectangle
, 0xa00 ); // Flags: Connector | HasSpt
319 INT32 nLenght
= rObj
.GetRect().GetWidth();
320 if ( nLenght
> rObj
.GetRect().GetHeight() )
321 nLenght
= rObj
.GetRect().GetHeight();
323 if ( nRadius
>= nLenght
)
324 nRadius
= 0x2a30; // 0x2a30 ist PPTs maximum radius
326 nRadius
= ( 0x2a30 * nRadius
) / nLenght
;
327 aPropOpt
.AddOpt( ESCHER_Prop_adjustValue
, nRadius
);
331 ADD_SHAPE( ESCHER_ShpInst_Rectangle
, 0xa00 ); // Flags: Connector | HasSpt
333 aPropOpt
.CreateFillProperties( rObj
.mXPropSet
, sal_True
);
334 if( rObj
.ImplGetText() )
335 aPropOpt
.CreateTextProperties( rObj
.mXPropSet
,
336 mpEscherEx
->QueryTextID( rObj
.GetShapeRef(),
337 rObj
.GetShapeId() ), sal_False
, sal_False
);
339 else if ( rObj
.GetType().EqualsAscii( "drawing.Ellipse" ))
341 CircleKind eCircleKind
= CircleKind_FULL
;
342 PolyStyle ePolyKind
= PolyStyle();
343 if ( rObj
.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("CircleKind") ) )
345 eCircleKind
= *( (CircleKind
*)rObj
.GetUsrAny().getValue() );
346 switch ( eCircleKind
)
348 case CircleKind_SECTION
:
350 ePolyKind
= POLY_PIE
;
353 case CircleKind_ARC
:
355 ePolyKind
= POLY_ARC
;
359 case CircleKind_CUT
:
361 ePolyKind
= POLY_CHORD
;
366 eCircleKind
= CircleKind_FULL
;
369 if ( eCircleKind
== CircleKind_FULL
)
371 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
372 ADD_SHAPE( ESCHER_ShpInst_Ellipse
, 0xa00 ); // Flags: Connector | HasSpt
373 aPropOpt
.CreateFillProperties( rObj
.mXPropSet
, sal_True
);;
377 INT32 nStartAngle
, nEndAngle
;
378 if ( !rObj
.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("CircleStartAngle") ) )
380 nStartAngle
= *( (INT32
*)rObj
.GetUsrAny().getValue() );
381 if( !rObj
.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("CircleEndAngle") ) )
383 nEndAngle
= *( (INT32
*)rObj
.GetUsrAny().getValue() );
385 Point aStart
, aEnd
, aCenter
;
386 aStart
.X() = (INT32
)( ( cos( (double)( nStartAngle
*
387 F_PI18000
) ) * 100.0 ) );
388 aStart
.Y() = - (INT32
)( ( sin( (double)( nStartAngle
*
389 F_PI18000
) ) * 100.0 ) );
390 aEnd
.X() = (INT32
)( ( cos( (double)( nEndAngle
*
391 F_PI18000
) ) * 100.0 ) );
392 aEnd
.Y() = - (INT32
)( ( sin( (double)( nEndAngle
*
393 F_PI18000
) ) * 100.0 ) );
394 const Rectangle
& rRect
= aRect100thmm
;
395 aCenter
.X() = rRect
.Left() + ( rRect
.GetWidth() / 2 );
396 aCenter
.Y() = rRect
.Top() + ( rRect
.GetHeight() / 2 );
397 aStart
.X() += aCenter
.X();
398 aStart
.Y() += aCenter
.Y();
399 aEnd
.X() += aCenter
.X();
400 aEnd
.Y() += aCenter
.Y();
401 Polygon
aPolygon( rRect
, aStart
, aEnd
, ePolyKind
);
402 if( rObj
.GetAngle() )
404 aPolygon
.Rotate( rRect
.TopLeft(), (sal_uInt16
)( rObj
.GetAngle() / 10 ) );
407 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
408 ADD_SHAPE( ESCHER_ShpInst_NotPrimitive
, 0xa00 ); // Flags: Connector | HasSpt
409 ::com::sun::star::awt::Rectangle aNewRect
;
415 aPropOpt
.CreatePolygonProperties( rObj
.mXPropSet
, ESCHER_CREATEPOLYGON_POLYPOLYGON
, sal_False
, aNewRect
, &aPolygon
);
416 aPropOpt
.CreateFillProperties( rObj
.mXPropSet
, sal_True
);
422 aPropOpt
.CreatePolygonProperties( rObj
.mXPropSet
, ESCHER_CREATEPOLYGON_POLYLINE
, sal_False
, aNewRect
, &aPolygon
);
423 aPropOpt
.CreateLineProperties( rObj
.mXPropSet
, sal_False
);
427 rObj
.SetRect( Rectangle( ImplMapPoint( Point( aNewRect
.X
, aNewRect
.Y
) ),
428 ImplMapSize( Size( aNewRect
.Width
, aNewRect
.Height
) ) ) );
430 if ( rObj
.ImplGetText() )
431 aPropOpt
.CreateTextProperties( rObj
.mXPropSet
,
432 mpEscherEx
->QueryTextID( rObj
.GetShapeRef(),
433 rObj
.GetShapeId() ), sal_False
, sal_False
);
436 else if ( rObj
.GetType().EqualsAscii( "drawing.Control" ))
440 else if ( rObj
.GetType().EqualsAscii( "drawing.Connector" ))
442 sal_uInt16 nSpType
, nSpFlags
;
443 ::com::sun::star::awt::Rectangle aNewRect
;
444 if ( aPropOpt
.CreateConnectorProperties( rObj
.GetShapeRef(),
445 rSolverContainer
, aNewRect
, nSpType
, nSpFlags
) == sal_False
)
447 rObj
.SetRect( Rectangle( ImplMapPoint( Point( aNewRect
.X
, aNewRect
.Y
) ),
448 ImplMapSize( Size( aNewRect
.Width
, aNewRect
.Height
) ) ) );
450 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
451 ADD_SHAPE( nSpType
, nSpFlags
);
453 else if ( rObj
.GetType().EqualsAscii( "drawing.Measure" ))
456 if ( ImplGetPropertyValue( L"MeasureKind" ) )
458 mpEscherEx->EnterGroup( &maRect );
459 mpEscherEx->OpenContainer( ESCHER_SpContainer );
460 ImplWriteAny( ANY_FLAGS_LINE, FALSE );
461 UINT32 nFlags = 0xa00; // Flags: Connector | HasSpt
462 if ( maRect.Top() > maRect.Bottom() )
463 nFlags |= 0x80; // Flags: VertMirror
464 if ( maRect.Left() > maRect.Right() )
465 nFlags |= 0x40; // Flags: HorzMirror
467 ADD_SHAPE( ESCHER_ShpInst_Line, nFlags );
468 aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
469 aPropOpt.CreateLineProperties( rObj.mXPropSet, sal_False );
470 mpEscherEx->EndCount( ESCHER_OPT, 3 );
472 mpEscherEx->AddClientAnchor( maRect );
473 mpEscherEx->CloseContainer(); // ESCHER_SpContainer
475 if ( ImplGetPropertyValue( L"MeasureTextHorizontalPosition" ) )
478 if ( ImplGetPropertyValue( L"MeasureTextVerticalPosition" ) )
481 if ( ImplGetPropertyValue( L"MeasureLineDistance" ) )
484 if ( ImplGetPropertyValue( L"MeasureHelpLineOverhang" ) )
487 if ( ImplGetPropertyValue( L"MeasureHelpLineDistance" ) )
490 if ( ImplGetPropertyValue( L"MeasureHelpLine1Length" ) )
493 if ( ImplGetPropertyValue( L"MeasureHelpLine2Length" ) )
496 if ( ImplGetPropertyValue( L"MeasureBelowReferenceEdge" ) )
499 if ( ImplGetPropertyValue( L"MeasureTextRotate90" ) )
502 if ( ImplGetPropertyValue( L"MeasureTextUpsideDown" ) )
505 if ( ImplGetPropertyValue( L"MeasureOverhang" ) )
508 if ( ImplGetPropertyValue( L"MeasureUnit" ) )
511 if ( ImplGetPropertyValue( L"MeasureScale" ) )
514 if ( ImplGetPropertyValue( L"MeasureShowUnit" ) )
517 if ( ImplGetPropertyValue( L"MeasureFormatString" ) )
520 if ( ImplGetPropertyValue( L"MeasureTextAutoAngle" ) )
523 if ( ImplGetPropertyValue( L"MeasureTextAutoAngleView" ) )
526 if ( ImplGetPropertyValue( L"MeasureTextIsFixedAngle" ) )
529 if ( ImplGetPropertyValue( L"MeasureTextFixedAngle" ) )
532 mpEscherEx->LeaveGroup();
537 else if ( rObj
.GetType().EqualsAscii( "drawing.Line" ))
539 ::com::sun::star::awt::Rectangle aNewRect
;
540 aPropOpt
.CreatePolygonProperties( rObj
.mXPropSet
, ESCHER_CREATEPOLYGON_LINE
, sal_False
, aNewRect
, NULL
);
542 //i27942: Poly/Lines/Bezier do not support text.
544 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
545 UINT32 nFlags
= 0xa00; // Flags: Connector | HasSpt
546 if( aNewRect
.Height
< 0 )
547 nFlags
|= 0x80; // Flags: VertMirror
548 if( aNewRect
.Width
< 0 )
549 nFlags
|= 0x40; // Flags: HorzMirror
551 ADD_SHAPE( ESCHER_ShpInst_Line
, nFlags
);
552 aPropOpt
.AddOpt( ESCHER_Prop_shapePath
, ESCHER_ShapeComplex
);
553 aPropOpt
.CreateLineProperties( rObj
.mXPropSet
, sal_False
);
556 else if ( rObj
.GetType().EqualsAscii( "drawing.PolyPolygon" ))
558 if( rObj
.ImplHasText() )
560 nGrpShapeID
= ImplEnterAdditionalTextGroup( rObj
.GetShapeRef(), &rObj
.GetRect() );
561 bAdditionalText
= TRUE
;
563 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
564 ADD_SHAPE( ESCHER_ShpInst_NotPrimitive
, 0xa00 ); // Flags: Connector | HasSpt
565 ::com::sun::star::awt::Rectangle aNewRect
;
566 aPropOpt
.CreatePolygonProperties( rObj
.mXPropSet
, ESCHER_CREATEPOLYGON_POLYPOLYGON
, sal_False
, aNewRect
, NULL
);
568 aPropOpt
.CreateFillProperties( rObj
.mXPropSet
, sal_True
);
571 else if ( rObj
.GetType().EqualsAscii( "drawing.PolyLine" ))
573 //i27942: Poly/Lines/Bezier do not support text.
575 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
576 ADD_SHAPE( ESCHER_ShpInst_NotPrimitive
, 0xa00 ); // Flags: Connector | HasSpt
577 ::com::sun::star::awt::Rectangle aNewRect
;
578 aPropOpt
.CreatePolygonProperties( rObj
.mXPropSet
, ESCHER_CREATEPOLYGON_POLYLINE
, sal_False
, aNewRect
, NULL
);
580 aPropOpt
.CreateLineProperties( rObj
.mXPropSet
, sal_False
);
583 else if ( rObj
.GetType().EqualsAscii( "drawing.OpenBezier" ) )
585 //i27942: Poly/Lines/Bezier do not support text.
587 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
588 ADD_SHAPE( ESCHER_ShpInst_NotPrimitive
, 0xa00 ); // Flags: Connector | HasSpt
589 ::com::sun::star::awt::Rectangle aNewRect
;
590 aPropOpt
.CreatePolygonProperties( rObj
.mXPropSet
, ESCHER_CREATEPOLYGON_POLYLINE
, sal_True
, aNewRect
, NULL
);
592 aPropOpt
.CreateLineProperties( rObj
.mXPropSet
, sal_False
);
595 else if ( rObj
.GetType().EqualsAscii( "drawing.ClosedBezier" ) )
597 if ( rObj
.ImplHasText() )
599 nGrpShapeID
= ImplEnterAdditionalTextGroup( rObj
.GetShapeRef(), &rObj
.GetRect() );
600 bAdditionalText
= TRUE
;
602 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
603 ADD_SHAPE( ESCHER_ShpInst_NotPrimitive
, 0xa00 ); // Flags: Connector | HasSpt
604 ::com::sun::star::awt::Rectangle aNewRect
;
605 aPropOpt
.CreatePolygonProperties( rObj
.mXPropSet
, ESCHER_CREATEPOLYGON_POLYPOLYGON
, sal_True
, aNewRect
, NULL
);
607 aPropOpt
.CreateFillProperties( rObj
.mXPropSet
, sal_True
);
610 else if ( rObj
.GetType().EqualsAscii( "drawing.GraphicObject" ))
612 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
614 // ein GraphicObject kann auch ein ClickMe Element sein
615 if( rObj
.IsEmptyPresObj() && ( ePageType
== NORMAL
) )
617 ADD_SHAPE( ESCHER_ShpInst_Rectangle
, 0x220 ); // Flags: HaveAnchor | HaveMaster
618 UINT32 nTxtBxId
= mpEscherEx
->QueryTextID( rObj
.GetShapeRef(),
620 aPropOpt
.AddOpt( ESCHER_Prop_lTxid
, nTxtBxId
);
621 aPropOpt
.AddOpt( ESCHER_Prop_fNoFillHitTest
, 0x10001 );
622 aPropOpt
.AddOpt( ESCHER_Prop_fNoLineDrawDash
, 0x10001 );
623 aPropOpt
.AddOpt( ESCHER_Prop_hspMaster
, mnShapeMasterBody
);
627 if( rObj
.ImplGetText() )
629 /* SJ #i34951#: because M. documents are not allowing GraphicObjects containing text, we
630 have to create a simpe Rectangle with fill bitmap instead (while not allowing BitmapMode_Repeat).
632 ADD_SHAPE( ESCHER_ShpInst_Rectangle
, 0xa00 ); // Flags: Connector | HasSpt
633 if ( aPropOpt
.CreateGraphicProperties( rObj
.mXPropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), sal_True
, sal_True
, sal_False
) )
635 aPropOpt
.AddOpt( ESCHER_Prop_WrapText
, ESCHER_WrapNone
);
636 aPropOpt
.AddOpt( ESCHER_Prop_AnchorText
, ESCHER_AnchorMiddle
);
637 aPropOpt
.AddOpt( ESCHER_Prop_fNoFillHitTest
, 0x140014 );
638 aPropOpt
.AddOpt( ESCHER_Prop_fillBackColor
, 0x8000000 );
639 aPropOpt
.AddOpt( ESCHER_Prop_fNoLineDrawDash
, 0x80000 );
640 if ( rObj
.ImplGetText() )
641 aPropOpt
.CreateTextProperties( rObj
.mXPropSet
,
642 mpEscherEx
->QueryTextID( rObj
.GetShapeRef(),
643 rObj
.GetShapeId() ), sal_False
, sal_False
);
648 ADD_SHAPE( ESCHER_ShpInst_PictureFrame
, 0xa00 );
649 if ( aPropOpt
.CreateGraphicProperties( rObj
.mXPropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), sal_False
, sal_True
) )
650 aPropOpt
.AddOpt( ESCHER_Prop_LockAgainstGrouping
, 0x800080 );
654 else if ( rObj
.GetType().EqualsAscii( "drawing.Text" ))
658 else if ( rObj
.GetType().EqualsAscii( "drawing.Page" ))
660 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
661 ADD_SHAPE( ESCHER_ShpInst_Rectangle
, 0xa00 );
662 aPropOpt
.AddOpt( ESCHER_Prop_LockAgainstGrouping
, 0x40004 );
663 aPropOpt
.AddOpt( ESCHER_Prop_fFillOK
, 0x100001 );
664 aPropOpt
.AddOpt( ESCHER_Prop_fNoFillHitTest
, 0x110011 );
665 aPropOpt
.AddOpt( ESCHER_Prop_fNoLineDrawDash
, 0x90008 );
666 aPropOpt
.AddOpt( ESCHER_Prop_fshadowObscured
, 0x10001 );
668 else if ( rObj
.GetType().EqualsAscii( "drawing.Frame" ))
672 else if ( rObj
.GetType().EqualsAscii( "drawing.OLE2" ))
674 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
675 if( rObj
.IsEmptyPresObj() && ( ePageType
== NORMAL
) )
677 ADD_SHAPE( ESCHER_ShpInst_Rectangle
, 0x220 ); // Flags: HaveAnchor | HaveMaster
678 UINT32 nTxtBxId
= mpEscherEx
->QueryTextID( rObj
.GetShapeRef(),
680 aPropOpt
.AddOpt( ESCHER_Prop_lTxid
, nTxtBxId
);
681 aPropOpt
.AddOpt( ESCHER_Prop_fNoFillHitTest
, 0x10001 );
682 aPropOpt
.AddOpt( ESCHER_Prop_fNoLineDrawDash
, 0x10001 );
683 aPropOpt
.AddOpt( ESCHER_Prop_hspMaster
, mnShapeMasterBody
);
687 //2do: could be made an option in HostAppData whether OLE object should be written or not
689 ADD_SHAPE( ESCHER_ShpInst_PictureFrame
,
690 0xa00 | (bAppOLE
? SHAPEFLAG_OLESHAPE
: 0) );
691 if ( aPropOpt
.CreateOLEGraphicProperties( rObj
.GetShapeRef() ) )
694 { // snooped from Xcl hex dump, nobody knows the trouble I have seen
695 aPropOpt
.AddOpt( ESCHER_Prop_FitTextToShape
, 0x00080008 );
696 aPropOpt
.AddOpt( ESCHER_Prop_pictureId
, 0x00000001 );
697 aPropOpt
.AddOpt( ESCHER_Prop_fillColor
, 0x08000041 );
698 aPropOpt
.AddOpt( ESCHER_Prop_fillBackColor
, 0x08000041 );
699 aPropOpt
.AddOpt( ESCHER_Prop_fNoFillHitTest
, 0x00110010 );
700 aPropOpt
.AddOpt( ESCHER_Prop_lineColor
, 0x08000040 );
701 aPropOpt
.AddOpt( ESCHER_Prop_fNoLineDrawDash
,0x00080008 );
702 // aPropOpt.AddOpt( ESCHER_Prop_fshadowObscured,0x00020000 );
703 aPropOpt
.AddOpt( ESCHER_Prop_fPrint
, 0x00080000 );
705 aPropOpt
.AddOpt( ESCHER_Prop_LockAgainstGrouping
, 0x800080 );
709 else if( '3' == rObj
.GetType().GetChar(8 ) &&
710 'D' == rObj
.GetType().GetChar( 9 ) ) // drawing.3D
712 // SceneObject, CubeObject, SphereObject, LatheObject, ExtrudeObject, PolygonObject
713 if ( !rObj
.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("Bitmap") ) )
716 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
717 ADD_SHAPE( ESCHER_ShpInst_PictureFrame
, 0xa00 );
719 if ( aPropOpt
.CreateGraphicProperties( rObj
.mXPropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ) ), sal_False
) )
720 aPropOpt
.AddOpt( ESCHER_Prop_LockAgainstGrouping
, 0x800080 );
722 else if ( rObj
.GetType().EqualsAscii( "drawing.dontknow" ))
725 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
726 ADD_SHAPE( ESCHER_ShpInst_PictureFrame
, 0xa00 );
727 if ( aPropOpt
.CreateGraphicProperties( rObj
.mXPropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False
) )
728 aPropOpt
.AddOpt( ESCHER_Prop_LockAgainstGrouping
, 0x800080 );
734 aPropOpt
.CreateShadowProperties( rObj
.mXPropSet
);
736 if( USHRT_MAX
!= mpEscherEx
->GetHellLayerId() &&
737 rObj
.ImplGetPropertyValue( ::rtl::OUString::createFromAscii("LayerID") ) &&
738 (*((UINT16
*)rObj
.GetUsrAny().getValue()) ) == mpEscherEx
->GetHellLayerId() )
740 aPropOpt
.AddOpt( ESCHER_Prop_fPrint
, 0x200020 );
744 Rectangle
aRect( rObj
.GetRect() );
746 rObj
.SetRect( aRect
);
749 if( rObj
.GetAngle() )
750 ImplFlipBoundingBox( rObj
, aPropOpt
);
752 mpEscherEx
->Commit( aPropOpt
, rObj
.GetRect() );
753 if( mpEscherEx
->GetGroupLevel() > 1 )
754 mpEscherEx
->AddChildAnchor( rObj
.GetRect() );
757 { //! with AdditionalText the App has to control whether these are written or not
758 mpHostAppData
->WriteClientAnchor( *mpEscherEx
, rObj
.GetRect() );
759 mpHostAppData
->WriteClientData( *mpEscherEx
);
760 if ( !bDontWriteText
)
761 mpHostAppData
->WriteClientTextbox( *mpEscherEx
);
763 mpEscherEx
->CloseContainer(); // ESCHER_SpContainer
765 if( bAdditionalText
)
767 mpEscherEx
->EndShape( nShapeType
, nShapeID
);
768 ImplWriteAdditionalText( rObj
, aTextRefPoint
);
773 if ( bAdditionalText
)
774 mpEscherEx
->EndShape( ESCHER_ShpInst_Min
, nGrpShapeID
);
776 mpEscherEx
->EndShape( nShapeType
, nShapeID
);
780 void ImplEESdrWriter::ImplWriteAdditionalText( ImplEESdrObject
& rObj
,
781 const Point
& rTextRefPoint
)
784 UINT16 nShapeType
= 0;
787 mpHostAppData
= mpEscherEx
->StartShape( rObj
.GetShapeRef() );
788 if ( mpHostAppData
&& mpHostAppData
->DontWriteShape() )
791 const ::com::sun::star::awt::Size
aSize100thmm( rObj
.GetShapeRef()->getSize() );
792 const ::com::sun::star::awt::Point
aPoint100thmm( rObj
.GetShapeRef()->getPosition() );
793 Rectangle
aRect100thmm( Point( aPoint100thmm
.X
, aPoint100thmm
.Y
), Size( aSize100thmm
.Width
, aSize100thmm
.Height
) );
795 mpPicStrm
= mpEscherEx
->QueryPicStream();
796 EscherPropertyContainer
aPropOpt( (EscherGraphicProvider
&)*mpEscherEx
, mpPicStrm
, aRect100thmm
);
797 rObj
.SetAngle( rObj
.ImplGetInt32PropertyValue( ::rtl::OUString::createFromAscii("RotateAngle")));
798 INT32 nAngle
= rObj
.GetAngle();
799 if( rObj
.GetType().EqualsAscii( "drawing.Line" ))
801 //2do: this does not work right
802 double fDist
= hypot( rObj
.GetRect().GetWidth(),
803 rObj
.GetRect().GetHeight() );
804 rObj
.SetRect( Rectangle( rTextRefPoint
,
805 Point( (sal_Int32
)( rTextRefPoint
.X() + fDist
), rTextRefPoint
.Y() - 1 ) ) );
807 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
808 mpEscherEx
->AddShape( ESCHER_ShpInst_TextBox
, 0xa00 );
809 if ( rObj
.ImplGetText() )
810 aPropOpt
.CreateTextProperties( rObj
.mXPropSet
,
811 mpEscherEx
->QueryTextID( rObj
.GetShapeRef(),
812 rObj
.GetShapeId() ) );
814 aPropOpt
.AddOpt( ESCHER_Prop_fNoLineDrawDash
, 0x90000 );
815 aPropOpt
.AddOpt( ESCHER_Prop_fNoFillHitTest
, 0x100000 );
816 aPropOpt
.AddOpt( ESCHER_Prop_FitTextToShape
, 0x60006 ); // Size Shape To Fit Text
818 nAngle
= ( 36000 + nAngle
) % 36000;
820 ImplFlipBoundingBox( rObj
, aPropOpt
);
824 mpEscherEx
->OpenContainer( ESCHER_SpContainer
);
825 nShapeID
= mpEscherEx
->GetShapeID();
826 mpEscherEx
->AddShape( nShapeType
= ESCHER_ShpInst_TextBox
, 0xa00, nShapeID
);
827 if ( rObj
.ImplGetText() )
828 aPropOpt
.CreateTextProperties( rObj
.mXPropSet
,
829 mpEscherEx
->QueryTextID( rObj
.GetShapeRef(),
830 rObj
.GetShapeId() ) );
831 aPropOpt
.AddOpt( ESCHER_Prop_fNoLineDrawDash
, 0x90000 );
832 aPropOpt
.AddOpt( ESCHER_Prop_fNoFillHitTest
, 0x100000 );
835 nAngle
= ( 36000 + nAngle
) % 36000;
837 nAngle
= ( 36000 - ( nAngle
% 36000 ) );
841 nAngle
&=~0xffff; // nAngle auf volle Gradzahl runden
842 aPropOpt
.AddOpt( ESCHER_Prop_Rotation
, nAngle
);
843 mpEscherEx
->SetGroupSnapRect( mpEscherEx
->GetGroupLevel(),
845 mpEscherEx
->SetGroupLogicRect( mpEscherEx
->GetGroupLevel(),
848 rObj
.SetAngle( nAngle
);
849 mpEscherEx
->Commit( aPropOpt
, rObj
.GetRect() );
851 // write the childanchor
852 mpEscherEx
->AddChildAnchor( rObj
.GetRect() );
854 #if defined EES_WRITE_EPP
856 mpEscherEx
->AddClientAnchor( maRect
);
858 mpEscherEx
->OpenContainer( ESCHER_ClientTextbox
);
859 mpEscherEx
->AddAtom( 4, EPP_TextHeaderAtom
);
860 *mpStrm
<< (UINT32
)EPP_TEXTTYPE_Other
; // Text in a Shape
861 ImplWriteTextStyleAtom();
862 mpEscherEx
->CloseContainer(); // ESCHER_ClientTextBox
863 #else // !EES_WRITE_EPP
865 { //! the App has to control whether these are written or not
866 mpHostAppData
->WriteClientAnchor( *mpEscherEx
, rObj
.GetRect() );
867 mpHostAppData
->WriteClientData( *mpEscherEx
);
868 mpHostAppData
->WriteClientTextbox( *mpEscherEx
);
870 #endif // EES_WRITE_EPP
871 mpEscherEx
->CloseContainer(); // ESCHER_SpContainer
873 mpEscherEx
->LeaveGroup();
874 mpEscherEx
->EndShape( nShapeType
, nShapeID
);
878 // -------------------------------------------------------------------
880 UINT32
ImplEESdrWriter::ImplEnterAdditionalTextGroup( const Reference
< XShape
>& rShape
,
881 const Rectangle
* pBoundRect
)
883 mpHostAppData
= mpEscherEx
->EnterAdditionalTextGroup();
884 UINT32 nGrpId
= mpEscherEx
->EnterGroup( pBoundRect
);
885 mpHostAppData
= mpEscherEx
->StartShape( rShape
);
890 // -------------------------------------------------------------------
892 BOOL
ImplEESdrWriter::ImplInitPageValues()
895 mnOutlinerCount
= 0; // die gliederungsobjekte muessen dem layout entsprechen,
897 mbIsTitlePossible
= TRUE
; // bei mehr als einem title geht powerpoint in die knie
903 // -------------------------------------------------------------------
905 void ImplEESdrWriter::ImplWritePage(
906 EscherSolverContainer
& rSolverContainer
,
907 ImplEESdrPageType ePageType
, BOOL
/* bBackGround */ )
909 ImplInitPageValues();
911 UINT32 nLastPer
= 0, nShapes
= mXShapes
->getCount();
912 for( UINT32 n
= 0; n
< nShapes
; ++n
)
914 UINT32 nPer
= ( 5 * n
) / nShapes
;
915 if( nPer
!= nLastPer
)
918 UINT32 nValue
= mnPagesWritten
* 5 + nPer
;
919 if( nValue
> mnStatMaxValue
)
920 nValue
= mnStatMaxValue
;
921 if( mbStatusIndicator
)
922 mXStatusIndicator
->setValue( nValue
);
925 ImplEESdrObject
aObj( *this, *(Reference
< XShape
>*)
926 mXShapes
->getByIndex( n
).getValue() );
929 ImplWriteShape( aObj
, rSolverContainer
, ePageType
);
935 // ===================================================================
937 ImplEscherExSdr::ImplEscherExSdr( EscherEx
& rEx
)
939 ImplEESdrWriter( rEx
),
941 mpSolverContainer( NULL
)
946 // -------------------------------------------------------------------
948 ImplEscherExSdr::~ImplEscherExSdr()
950 DBG_ASSERT( !mpSolverContainer
, "ImplEscherExSdr::~ImplEscherExSdr: unwritten SolverContainer" );
951 delete mpSolverContainer
;
955 // -------------------------------------------------------------------
957 SvxDrawPage
* ImplEscherExSdr::ImplInitPage( const SdrPage
& rPage
)
961 SvxDrawPage
* pSvxDrawPage
;
962 if ( mpSdrPage
!= &rPage
|| !mXDrawPage
.is() )
964 // eventually write SolverContainer of current page, deletes the Solver
965 ImplFlushSolverContainer();
968 // why not declare a const parameter if the object will not be modified?
969 // mXDrawPage = pSvxDrawPage = new SvxDrawPage( (SdrPage*) &rPage );
970 mXDrawPage
= pSvxDrawPage
= new SvxFmDrawPage( (SdrPage
*) &rPage
);
971 mXShapes
= Reference
< XShapes
>::query( mXDrawPage
);
972 if ( !mXShapes
.is() )
974 if ( !ImplInitPageValues() ) // ImplEESdrWriter
978 mpSolverContainer
= new EscherSolverContainer
;
981 pSvxDrawPage
= SvxDrawPage::getImplementation(mXDrawPage
);
990 // -------------------------------------------------------------------
992 void ImplEscherExSdr::ImplExitPage()
994 // close all groups before the solver container is written
995 while( mpEscherEx
->GetGroupLevel() )
996 mpEscherEx
->LeaveGroup();
998 ImplFlushSolverContainer();
999 mpSdrPage
= NULL
; // reset page for next init
1003 // -------------------------------------------------------------------
1005 void ImplEscherExSdr::ImplFlushSolverContainer()
1007 if ( mpSolverContainer
)
1009 mpSolverContainer
->WriteSolver( mpEscherEx
->GetStream() );
1010 delete mpSolverContainer
;
1011 mpSolverContainer
= NULL
;
1016 // -------------------------------------------------------------------
1018 void ImplEscherExSdr::ImplWriteCurrentPage()
1020 DBG_ASSERT( mpSolverContainer
, "ImplEscherExSdr::ImplWriteCurrentPage: no SolverContainer" );
1021 ImplWritePage( *mpSolverContainer
, NORMAL
);
1026 // -------------------------------------------------------------------
1028 UINT32
ImplEscherExSdr::ImplWriteTheShape( ImplEESdrObject
& rObj
)
1030 DBG_ASSERT( mpSolverContainer
, "ImplEscherExSdr::ImplWriteShape: no SolverContainer" );
1031 return ImplWriteShape( rObj
, *mpSolverContainer
, NORMAL
);
1035 // ===================================================================
1037 void EscherEx::AddSdrPage( const SdrPage
& rPage
)
1039 if ( mpImplEscherExSdr
->ImplInitPage( rPage
) )
1040 mpImplEscherExSdr
->ImplWriteCurrentPage();
1044 // -------------------------------------------------------------------
1046 UINT32
EscherEx::AddSdrObject( const SdrObject
& rObj
)
1048 ImplEESdrObject
aObj( *mpImplEscherExSdr
, rObj
);
1049 if( aObj
.IsValid() )
1050 return mpImplEscherExSdr
->ImplWriteTheShape( aObj
);
1055 // -------------------------------------------------------------------
1057 void EscherEx::EndSdrObjectPage()
1059 mpImplEscherExSdr
->ImplExitPage();
1062 // -------------------------------------------------------------------
1064 EscherExHostAppData
* EscherEx::StartShape( const Reference
< XShape
>& /* rShape */ )
1069 // -------------------------------------------------------------------
1071 void EscherEx::EndShape( UINT16
/* nShapeType */, UINT32
/* nShapeID */ )
1075 // -------------------------------------------------------------------
1077 SvStream
* EscherEx::QueryPicStream()
1082 // -------------------------------------------------------------------
1084 UINT32
EscherEx::QueryTextID( const Reference
< XShape
>&, UINT32
)
1089 // -------------------------------------------------------------------
1090 // add an dummy rectangle shape into the escher stream
1091 UINT32
EscherEx::AddDummyShape()
1093 OpenContainer( ESCHER_SpContainer
);
1094 UINT32 nShapeID
= GetShapeID();
1095 AddShape( ESCHER_ShpInst_Rectangle
, 0xa00, nShapeID
);
1096 //?? aSolverContainer.AddShape( mXShape, nShapeID );
1102 // -------------------------------------------------------------------
1105 const SdrObject
* EscherEx::GetSdrObject( const Reference
< XShape
>& rShape
)
1107 const SdrObject
* pRet
= 0;
1108 const SvxShape
* pSvxShape
= SvxShape::getImplementation( rShape
);
1109 DBG_ASSERT( pSvxShape
, "EscherEx::GetSdrObject: no SvxShape" );
1112 pRet
= pSvxShape
->GetSdrObject();
1113 DBG_ASSERT( pRet
, "EscherEx::GetSdrObject: no SdrObj" );
1119 // -------------------------------------------------------------------
1121 ImplEESdrObject::ImplEESdrObject( ImplEscherExSdr
& rEx
,
1122 const SdrObject
& rObj
) :
1128 mbEmptyPresObj( FALSE
)
1130 SdrPage
* pPage
= rObj
.GetPage();
1131 DBG_ASSERT( pPage
, "ImplEESdrObject::ImplEESdrObject: no SdrPage" );
1134 SvxDrawPage
* pSvxDrawPage
= rEx
.ImplInitPage( *pPage
);
1137 // why not declare a const parameter if the object will
1139 mXShape
= uno::Reference
< drawing::XShape
>::query( ((SdrObject
*)&rObj
)->getUnoShape() );;
1145 ImplEESdrObject::ImplEESdrObject( ImplEESdrWriter
& rEx
,
1146 const Reference
< XShape
>& rShape
) :
1153 mbEmptyPresObj( FALSE
)
1159 ImplEESdrObject::~ImplEESdrObject()
1163 void ImplEESdrObject::Init( ImplEESdrWriter
& rEx
)
1165 mXPropSet
= Reference
< XPropertySet
>::query( mXShape
);
1166 if( mXPropSet
.is() )
1168 static const sal_Char aPrefix
[] = "com.sun.star.";
1169 static const xub_StrLen nPrefix
= sizeof(aPrefix
)-1;
1170 SetRect( rEx
.ImplMapPoint( Point( mXShape
->getPosition().X
, mXShape
->getPosition().Y
) ),
1171 rEx
.ImplMapSize( Size( mXShape
->getSize().Width
, mXShape
->getSize().Height
) ) );
1172 mType
= String( mXShape
->getShapeType() );
1173 mType
.Erase( 0, nPrefix
); // strip "com.sun.star."
1174 xub_StrLen nPos
= mType
.SearchAscii( "Shape" );
1175 mType
.Erase( nPos
, 5 );
1177 static const OUString
sPresStr(rtl::OUString::createFromAscii("IsPresentationObject"));
1178 static const OUString
sEmptyPresStr(rtl::OUString::createFromAscii("IsEmptyPresentationObject"));
1180 if( ImplGetPropertyValue( sPresStr
) )
1181 mbPresObj
= ::cppu::any2bool( mAny
);
1183 if( mbPresObj
&& ImplGetPropertyValue( sEmptyPresStr
) )
1184 mbEmptyPresObj
= ::cppu::any2bool( mAny
);
1190 //BOOL ImplEESdrObject::ImplGetPropertyValue( const OUString& rString )
1191 BOOL
ImplEESdrObject::ImplGetPropertyValue( const sal_Unicode
* rString
)
1193 BOOL bRetValue
= FALSE
;
1198 mAny
= mXPropSet
->getPropertyValue( rString
);
1199 if( mAny
.hasValue() )
1202 catch( ::com::sun::star::uno::Exception
& )
1211 BOOL
ImplEESdrObject::ImplGetPropertyValue( const Reference
< XPropertySet
>& rXPropSet
,
1212 const OUString
& rString
)
1214 BOOL bRetValue
= FALSE
;
1219 mAny
= rXPropSet
->getPropertyValue( rString
);
1220 if( 0 != mAny
.get() )
1223 catch( ::com::sun::star::uno::Exception
& )
1232 void ImplEESdrObject::SetRect( const Point
& rPos
, const Size
& rSz
)
1234 maRect
= Rectangle( rPos
, rSz
);
1237 const SdrObject
* ImplEESdrObject::GetSdrObject() const
1239 return EscherEx::GetSdrObject( mXShape
);
1242 // laedt und konvertiert text aus shape, ergebnis ist mnTextSize gespeichert
1243 UINT32
ImplEESdrObject::ImplGetText()
1245 Reference
< XText
> xXText( mXShape
, UNO_QUERY
);
1248 mnTextSize
= xXText
->getString().getLength();
1252 BOOL
ImplEESdrObject::ImplHasText() const
1254 Reference
< XText
> xXText( mXShape
, UNO_QUERY
);
1255 return xXText
.is() && xXText
->getString().getLength();