LibreOffice Module filter (master) 1
eschesdo.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <memory>
21#include "eschesdo.hxx"
22#include <o3tl/any.hxx>
23#include <svx/svdobj.hxx>
24#include <tools/poly.hxx>
25#include <tools/debug.hxx>
27#include <svx/fmdpage.hxx>
28#include <com/sun/star/awt/Rectangle.hpp>
29#include <com/sun/star/beans/PropertyValue.hpp>
30#include <com/sun/star/beans/XPropertySet.hpp>
31#include <com/sun/star/beans/XPropertySetInfo.hpp>
32#include <com/sun/star/text/XText.hpp>
33#include <com/sun/star/text/TextContentAnchorType.hpp>
34#include <com/sun/star/drawing/CircleKind.hpp>
35#include <com/sun/star/drawing/FillStyle.hpp>
37#include <com/sun/star/drawing/HomogenMatrix3.hpp>
39
40using namespace ::com::sun::star;
41using namespace ::com::sun::star::beans;
42using namespace ::com::sun::star::container;
43using namespace ::com::sun::star::uno;
44using namespace ::com::sun::star::drawing;
45using namespace ::com::sun::star::text;
46using namespace ::com::sun::star::task;
47
49// PowerPoint: 576 dpi, WinWord: 1440 dpi, Excel: 1440 dpi
51
53 : mpEscherEx(&rEx)
54 , mpPicStrm(nullptr)
55 , mpHostAppData(nullptr)
56 , mbIsTitlePossible(false)
57 , mpSdrPage( nullptr )
58{
59}
60
61
62
64{
65 return o3tl::convert( rPoint, geUnitsSrc, geUnitsDest );
66}
67
69{
70 Size aRetSize( o3tl::convert( rSize, geUnitsSrc, geUnitsDest ) );
71
72 if ( !aRetSize.Width() )
73 aRetSize.AdjustWidth( 1 );
74 if ( !aRetSize.Height() )
75 aRetSize.AdjustHeight( 1 );
76 return aRetSize;
77}
78
80{
81 sal_Int32 nAngle = rObj.GetAngle();
82 tools::Rectangle aRect( rObj.GetRect() );
83
84 // for position calculations, we normalize the angle between 0 and 90 degrees
85 if ( nAngle < 0 )
86 nAngle = ( 36000 + nAngle ) % 36000;
87 if ( nAngle % 18000 == 0 )
88 nAngle = 0;
89 while ( nAngle > 9000 )
90 nAngle = ( 18000 - ( nAngle % 18000 ) );
91
92 double fVal = basegfx::deg2rad<100>(nAngle);
93 double fCos = cos( fVal );
94 double fSin = sin( fVal );
95
96 double nWidthHalf = static_cast<double>(aRect.GetWidth()) / 2;
97 double nHeightHalf = static_cast<double>(aRect.GetHeight()) / 2;
98
99 // fdo#70838:
100 // when you rotate an object, the top-left corner of its bounding box is moved
101 // nXDiff and nYDiff pixels. To get their values we use these equations:
102 //
103 // fSin * nHeightHalf + fCos * nWidthHalf == nXDiff + nWidthHalf
104 // fSin * nWidthHalf + fCos * nHeightHalf == nYDiff + nHeightHalf
105
106 double nXDiff = fSin * nHeightHalf + fCos * nWidthHalf - nWidthHalf;
107 double nYDiff = fSin * nWidthHalf + fCos * nHeightHalf - nHeightHalf;
108
109 aRect.Move( static_cast<sal_Int32>(nXDiff), static_cast<sal_Int32>(nYDiff) );
110
111 // calculate the proper angle value to be saved
112 nAngle = rObj.GetAngle();
113 if ( nAngle < 0 )
114 nAngle = ( 36000 + nAngle ) % 36000;
115 else
116 nAngle = ( 36000 - ( nAngle % 36000 ) );
117
118 nAngle *= 655;
119 nAngle += 0x8000;
120 nAngle &=~0xffff; // nAngle round to full degrees
121 rPropOpt.AddOpt( ESCHER_Prop_Rotation, nAngle );
122
123 rObj.SetAngle( nAngle );
124 rObj.SetRect( aRect );
125}
126
127
129 EscherSolverContainer& rSolverContainer,
130 const bool bOOxmlExport )
131{
132 sal_uInt32 nShapeID = 0;
133 sal_uInt16 nShapeType = 0;
134 bool bDontWriteText = false; // if a metafile is written as shape replacement, then the text is already part of the metafile
135 bool bAdditionalText = false;
136 sal_uInt32 nGrpShapeID = 0;
137 auto addShape = [this, &rObj, &rSolverContainer, &nShapeID, &nShapeType](sal_uInt16 nType, ShapeFlag nFlags)
138 {
139 nShapeType = nType;
140 nShapeID = mpEscherEx->GenerateShapeId();
141 rObj.SetShapeId( nShapeID );
142 mpEscherEx->AddShape( nType, nFlags, nShapeID );
143 rSolverContainer.AddShape( rObj.GetShapeRef(), nShapeID );
144 };
145
146 do {
147 mpHostAppData = mpEscherEx->StartShape( rObj.GetShapeRef(), (mpEscherEx->GetGroupLevel() > 1) ? &rObj.GetRect() : nullptr );
149 break;
150
151 // #i51348# get shape name
152 OUString aShapeName;
153 if( const SdrObject* pSdrObj = rObj.GetSdrObject() )
154 if (!pSdrObj->GetName().isEmpty())
155 aShapeName = pSdrObj->GetName();
156 uno::Reference< drawing::XShape> xShape = rObj.GetShapeRef();
157 if (xShape.is())
158 {
159 uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
160 if (xPropertySet.is())
161 {
162 uno::Sequence<beans::PropertyValue> aGrabBag;
163 uno::Reference< XPropertySetInfo > xPropInfo = xPropertySet->getPropertySetInfo();
164 if ( xPropInfo.is() && xPropInfo->hasPropertyByName( "InteropGrabBag" ) )
165 {
166 xPropertySet->getPropertyValue( "InteropGrabBag" ) >>= aGrabBag;
167 for (const beans::PropertyValue& rProp : std::as_const(aGrabBag))
168 {
169 if (rProp.Name == "mso-edit-as")
170 {
171 OUString rEditAs;
172 rProp.Value >>= rEditAs;
173 mpEscherEx->SetEditAs(rEditAs);
174 break;
175 }
176 }
177 }
178 }
179 }
180
181 if( rObj.GetType() == "drawing.Group" )
182 {
183 Reference< XIndexAccess > xXIndexAccess( rObj.GetShapeRef(), UNO_QUERY );
184
185 if( xXIndexAccess.is() && 0 != xXIndexAccess->getCount() )
186 {
187 nShapeID = mpEscherEx->EnterGroup( aShapeName, &rObj.GetRect() );
188 nShapeType = ESCHER_ShpInst_Min;
189
190 for( sal_uInt32 n = 0, nCnt = xXIndexAccess->getCount();
191 n < nCnt; ++n )
192 {
193 ImplEESdrObject aObj( *o3tl::doAccess<Reference<XShape>>(
194 xXIndexAccess->getByIndex( n )) );
195 if( aObj.IsValid() )
196 {
197 aObj.SetOOXML(bOOxmlExport);
198 ImplWriteShape( aObj, rSolverContainer, bOOxmlExport );
199 }
200 }
202 }
203 break;
204 }
205 rObj.SetAngle( rObj.ImplGetInt32PropertyValue( "RotateAngle" ));
206
207 if( ( rObj.ImplGetPropertyValue( "IsFontwork" ) &&
208 ::cppu::any2bool( rObj.GetUsrAny() ) ) ||
209 rObj.GetType() == "drawing.Measure" )
210 {
211 rObj.SetType("drawing.dontknow");
212 }
213
214 const css::awt::Size aSize100thmm( rObj.GetShapeRef()->getSize() );
215 const css::awt::Point aPoint100thmm( rObj.GetShapeRef()->getPosition() );
216 tools::Rectangle aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
217 if ( !mpPicStrm )
220
221 // #i51348# shape name
222 if (!aShapeName.isEmpty())
223 aPropOpt.AddOpt( ESCHER_Prop_wzName, aShapeName );
224 if ( InteractionInfo* pInteraction = mpHostAppData ? mpHostAppData->GetInteractionInfo():nullptr )
225 {
226 const std::unique_ptr< SvMemoryStream >& pMemStrm = pInteraction->getHyperlinkRecord();
227 if (pMemStrm)
228 {
229 aPropOpt.AddOpt(ESCHER_Prop_pihlShape, false, 0, *pMemStrm);
230 }
231 aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x00080008 );
232 }
233
234 if ( rObj.GetType() == "drawing.Custom" )
235 {
237 ShapeFlag nMirrorFlags;
238
239 OUString sCustomShapeType;
240 MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType( rObj.GetShapeRef(), nMirrorFlags, sCustomShapeType, rObj.GetOOXML() );
241 if ( sCustomShapeType == "col-502ad400" || sCustomShapeType == "col-60da8460" )
242 {
244
245 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, "MetaFile", false ) )
246 {
247 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
248 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 ); // no fill
249 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 ); // no linestyle
251 if ( pObj )
252 {
253 tools::Rectangle aBound = pObj->GetCurrentBoundRect();
254 Point aPosition( ImplMapPoint( aBound.TopLeft() ) );
255 Size aSize( ImplMapSize( aBound.GetSize() ) );
256 rObj.SetRect( tools::Rectangle( aPosition, aSize ) );
257 rObj.SetAngle( 0 );
258 bDontWriteText = true;
259 }
260 }
261 }
262 else
263 {
264 const Reference< XPropertySet > xPropSet = rObj.mXPropSet;
265 drawing::FillStyle eFS = drawing::FillStyle_NONE;
266 if(xPropSet.is())
267 {
268 uno::Reference< XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo();
269 if ( xPropInfo.is() && xPropInfo->hasPropertyByName("FillStyle"))
270 xPropSet->getPropertyValue("FillStyle") >>= eFS;
271 }
272
273 if (eFS == drawing::FillStyle_BITMAP && eShapeType == mso_sptMax)
274 {
275 // We can't map this custom shape to a DOC preset and it has a bitmap fill.
276 // Make sure that at least the bitmap fill is not lost.
278 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, "Bitmap", false, true, true, bOOxmlExport ) )
279 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
280 }
281 else
282 {
283 addShape(sal::static_int_cast< sal_uInt16 >(eShapeType),
285 aPropOpt.CreateCustomShapeProperties( eShapeType, rObj.GetShapeRef() );
286 aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
287 if ( rObj.ImplGetText() )
288 {
289 if ( !aPropOpt.IsFontWork() )
291 rObj.GetShapeRef(), rObj.GetShapeId() ), true, false );
292 }
293 }
294 }
295 }
296 else if ( rObj.GetType() == "drawing.Rectangle" )
297 {
299 sal_Int32 nRadius = rObj.ImplGetInt32PropertyValue("CornerRadius");
300 if( nRadius )
301 {
302 nRadius = ImplMapSize( Size( nRadius, 0 )).Width();
304 sal_Int32 nLength = rObj.GetRect().GetWidth();
305 if ( nLength > rObj.GetRect().GetHeight() )
306 nLength = rObj.GetRect().GetHeight();
307 nLength >>= 1;
308 if ( nRadius >= nLength || nLength == 0 )
309 nRadius = 0x2a30; // 0x2a30 is PPTs maximum radius
310 else
311 nRadius = ( 0x2a30 * nRadius ) / nLength;
312 aPropOpt.AddOpt( ESCHER_Prop_adjustValue, nRadius );
313 }
314 else
315 {
317 }
318 aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
319 if( rObj.ImplGetText() )
320 aPropOpt.CreateTextProperties( rObj.mXPropSet,
322 rObj.GetShapeId() ), false, false );
323 }
324 else if ( rObj.GetType() == "drawing.Ellipse" )
325 {
326 CircleKind eCircleKind = CircleKind_FULL;
327 PolyStyle ePolyKind = PolyStyle();
328 if ( rObj.ImplGetPropertyValue( "CircleKind" ) )
329 {
330 eCircleKind = *o3tl::doAccess<CircleKind>(rObj.GetUsrAny());
331 switch ( eCircleKind )
332 {
333 case CircleKind_SECTION :
334 {
335 ePolyKind = PolyStyle::Pie;
336 }
337 break;
338 case CircleKind_ARC :
339 {
340 ePolyKind = PolyStyle::Arc;
341 }
342 break;
343
344 case CircleKind_CUT :
345 {
346 ePolyKind = PolyStyle::Chord;
347 }
348 break;
349
350 default:
351 eCircleKind = CircleKind_FULL;
352 }
353 }
354 if ( eCircleKind == CircleKind_FULL )
355 {
358 aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
359 }
360 else
361 {
362 sal_Int32 nStartAngle, nEndAngle;
363 if ( !rObj.ImplGetPropertyValue( "CircleStartAngle" ) )
364 break;
365 nStartAngle = *o3tl::doAccess<sal_Int32>(rObj.GetUsrAny());
366 if( !rObj.ImplGetPropertyValue( "CircleEndAngle" ) )
367 break;
368 nEndAngle = *o3tl::doAccess<sal_Int32>(rObj.GetUsrAny());
369
370 Point aStart, aEnd, aCenter;
371 aStart.setX( static_cast<sal_Int32>( cos( basegfx::deg2rad<100>(nStartAngle) ) * 100.0 ) );
372 aStart.setY( - static_cast<sal_Int32>( sin( basegfx::deg2rad<100>(nStartAngle) ) * 100.0 ) );
373 aEnd.setX( static_cast<sal_Int32>( cos( basegfx::deg2rad<100>(nEndAngle) ) * 100.0 ) );
374 aEnd.setY( - static_cast<sal_Int32>( sin( basegfx::deg2rad<100>(nEndAngle) ) * 100.0 ) );
375 const tools::Rectangle& rRect = aRect100thmm;
376 aCenter.setX( rRect.Left() + ( rRect.GetWidth() / 2 ) );
377 aCenter.setY( rRect.Top() + ( rRect.GetHeight() / 2 ) );
378 aStart.AdjustX(aCenter.X() );
379 aStart.AdjustY(aCenter.Y() );
380 aEnd.AdjustX(aCenter.X() );
381 aEnd.AdjustY(aCenter.Y() );
382 tools::Polygon aPolygon( rRect, aStart, aEnd, ePolyKind );
383 if( rObj.GetAngle() )
384 {
385 aPolygon.Rotate( rRect.TopLeft(), Degree10(static_cast<sal_Int16>( rObj.GetAngle() / 10 )) );
386 rObj.SetAngle( 0 );
387 }
390 css::awt::Rectangle aNewRect;
391 switch ( ePolyKind )
392 {
393 case PolyStyle::Pie :
394 case PolyStyle::Chord :
395 {
396 aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, false, aNewRect, &aPolygon );
397 aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
398 }
399 break;
400
401 case PolyStyle::Arc :
402 {
403 aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, false, aNewRect, &aPolygon );
404 aPropOpt.CreateLineProperties( rObj.mXPropSet, false );
405 }
406 break;
407 }
408 rObj.SetRect( tools::Rectangle( ImplMapPoint( Point( aNewRect.X, aNewRect.Y ) ),
409 ImplMapSize( Size( aNewRect.Width, aNewRect.Height ) ) ) );
410 }
411 if ( rObj.ImplGetText() )
412 aPropOpt.CreateTextProperties( rObj.mXPropSet,
414 rObj.GetShapeId() ), false, false );
415
416 }
417 else if ( rObj.GetType() == "drawing.Control" )
418 {
419 const Reference< XPropertySet > xPropSet = rObj.mXPropSet;
420 const Reference<XPropertySetInfo> xPropInfo = xPropSet.is() ? xPropSet->getPropertySetInfo() : Reference<XPropertySetInfo>();
421 // This code is expected to be called only for DOCX/XLSX formats.
422 if (xPropInfo.is() && bOOxmlExport)
423 {
424 bool bInline = false;
425 if (xPropInfo->hasPropertyByName("AnchorType"))
426 {
427 text::TextContentAnchorType eAnchorType;
428 xPropSet->getPropertyValue("AnchorType") >>= eAnchorType;
429 bInline = eAnchorType == text::TextContentAnchorType_AS_CHARACTER;
430 }
431
435 nShapeID = rObj.GetShapeId();
436 if (nShapeID)
437 {
438 mpEscherEx->AddShape(nShapeType, nFlags, nShapeID );
439 rSolverContainer.AddShape(rObj.GetShapeRef(), nShapeID);
440 }
441 else
442 {
443 addShape(nShapeType, nFlags);
444 }
445 }
446 else
447 break;
448 }
449 else if ( rObj.GetType() == "drawing.Connector" )
450 {
451 sal_uInt16 nSpType;
452 ShapeFlag nSpFlags;
453 css::awt::Rectangle aNewRect;
454 if ( ! aPropOpt.CreateConnectorProperties( rObj.GetShapeRef(),
455 rSolverContainer, aNewRect, nSpType, nSpFlags ) )
456 break;
457 rObj.SetRect( tools::Rectangle( ImplMapPoint( Point( aNewRect.X, aNewRect.Y ) ),
458 ImplMapSize( Size( aNewRect.Width, aNewRect.Height ) ) ) );
459
461 addShape( nSpType, nSpFlags );
462 }
463 else if ( rObj.GetType() == "drawing.Measure" )
464 {
465 break;
466 }
467 else if ( rObj.GetType() == "drawing.Line" )
468 {
469 css::awt::Rectangle aNewRect;
470 aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_LINE, false, aNewRect );
471 //i27942: Poly/Lines/Bezier do not support text.
472
475 if( aNewRect.Height < 0 )
476 nFlags |= ShapeFlag::FlipV;
477 if( aNewRect.Width < 0 )
478 nFlags |= ShapeFlag::FlipH;
479
480 addShape( ESCHER_ShpInst_Line, nFlags );
482 aPropOpt.CreateLineProperties( rObj.mXPropSet, false );
483 rObj.SetAngle( 0 );
484 }
485 else if ( rObj.GetType() == "drawing.PolyPolygon" )
486 {
487 if( rObj.ImplHasText() )
488 {
489 nGrpShapeID = ImplEnterAdditionalTextGroup( rObj.GetShapeRef(), &rObj.GetRect() );
490 bAdditionalText = true;
491 }
494 css::awt::Rectangle aNewRect;
495 aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, false, aNewRect );
496 aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
497 rObj.SetAngle( 0 );
498 }
499 else if ( rObj.GetType() == "drawing.PolyLine" )
500 {
501 //i27942: Poly/Lines/Bezier do not support text.
502
505 css::awt::Rectangle aNewRect;
506 aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, false, aNewRect );
507 aPropOpt.CreateLineProperties( rObj.mXPropSet, false );
508 rObj.SetAngle( 0 );
509 }
510 else if ( rObj.GetType() == "drawing.OpenBezier" )
511 {
512 //i27942: Poly/Lines/Bezier do not support text.
513
516 css::awt::Rectangle aNewRect;
517 aPropOpt.CreatePolygonProperties( rObj.mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, true, aNewRect );
518 aPropOpt.CreateLineProperties( rObj.mXPropSet, false );
519 rObj.SetAngle( 0 );
520 }
521 else if ( rObj.GetType() == "drawing.ClosedBezier" )
522 {
523 if ( rObj.ImplHasText() )
524 {
525 nGrpShapeID = ImplEnterAdditionalTextGroup( rObj.GetShapeRef(), &rObj.GetRect() );
526 bAdditionalText = true;
527 }
530 css::awt::Rectangle aNewRect;
532 aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
533 rObj.SetAngle( 0 );
534 }
535 else if ( rObj.GetType() == "drawing.GraphicObject" )
536 {
538
539 // a GraphicObject can also be a ClickMe element
540 if( rObj.IsEmptyPresObj() )
541 {
543 sal_uInt32 nTxtBxId = mpEscherEx->QueryTextID( rObj.GetShapeRef(),
544 rObj.GetShapeId() );
545 aPropOpt.AddOpt( ESCHER_Prop_lTxid, nTxtBxId );
546 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
547 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
548 aPropOpt.AddOpt( ESCHER_Prop_hspMaster, 0 );
549 }
550 else
551 {
552 if( rObj.ImplGetText() )
553 {
554 /* SJ #i34951#: because M. documents are not allowing GraphicObjects containing text, we
555 have to create a simple Rectangle with fill bitmap instead (while not allowing BitmapMode_Repeat).
556 */
558 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, "Graphic", true, true, false ) )
559 {
562 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
563 aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x8000000 );
564 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
565 if ( rObj.ImplGetText() )
566 aPropOpt.CreateTextProperties( rObj.mXPropSet,
568 rObj.GetShapeId() ), false, false );
569 }
570 }
571 else
572 {
574 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, "Graphic", false, true, true, bOOxmlExport ) )
575 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
576 }
577 }
578 }
579 else if ( rObj.GetType() == "drawing.Text" )
580 {
583 aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
584 if( rObj.ImplGetText() )
585 aPropOpt.CreateTextProperties( rObj.mXPropSet,
587 rObj.GetShapeId() ) );
588 }
589 else if ( rObj.GetType() == "drawing.Page" )
590 {
593 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x40004 );
594 aPropOpt.AddOpt( ESCHER_Prop_fFillOK, 0x100001 );
595 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110011 );
596 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90008 );
597 aPropOpt.AddOpt( ESCHER_Prop_fshadowObscured, 0x10001 );
598 }
599 else if ( rObj.GetType() == "drawing.Frame" )
600 {
601 break;
602 }
603 else if ( rObj.GetType() == "drawing.OLE2" )
604 {
606 if( rObj.IsEmptyPresObj() )
607 {
609 sal_uInt32 nTxtBxId = mpEscherEx->QueryTextID( rObj.GetShapeRef(),
610 rObj.GetShapeId() );
611 aPropOpt.AddOpt( ESCHER_Prop_lTxid, nTxtBxId );
612 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
613 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
614 aPropOpt.AddOpt( ESCHER_Prop_hspMaster, 0 );
615 }
616 else
617 {
618 //2do: could be made an option in HostAppData whether OLE object should be written or not
619 const bool bAppOLE = true;
622 if ( aPropOpt.CreateOLEGraphicProperties( rObj.GetShapeRef() ) )
623 {
624 if ( bAppOLE )
625 { // snooped from Xcl hex dump, nobody knows the trouble I have seen
626 aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 );
627 aPropOpt.AddOpt( ESCHER_Prop_pictureId, 0x00000001 );
628 aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0x08000041 );
629 aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x08000041 );
630 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x00110010 );
631 aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x08000040 );
632 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash,0x00080008 );
633 aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x00080000 );
634 }
635 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
636 }
637 }
638 }
639 else if( '3' == rObj.GetType()[8] &&
640 'D' == rObj.GetType()[9] ) // drawing.3D
641 {
642 // SceneObject, CubeObject, SphereObject, LatheObject, ExtrudeObject, PolygonObject
643 if ( !rObj.ImplGetPropertyValue( "Bitmap" ) )
644 break;
645
648
649 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, "Bitmap", false ) )
650 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
651 }
652 else if ( rObj.GetType() == "drawing.Caption" )
653 {
654 rObj.SetAngle( 0 );
657 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, "MetaFile", false ) )
658 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
659 }
660 else if ( rObj.GetType() == "drawing.dontknow" )
661 {
662 rObj.SetAngle( 0 );
665 if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, "MetaFile", false ) )
666 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
667 }
668 else
669 {
670 break;
671 }
672 aPropOpt.CreateShadowProperties( rObj.mXPropSet );
673
675 rObj.ImplGetPropertyValue( "LayerID" ) &&
676 *o3tl::doAccess<sal_Int16>(rObj.GetUsrAny()) == mpEscherEx->GetHellLayerId().get() )
677 {
678 aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x200020 );
679 }
680
681 {
682 tools::Rectangle aRect( rObj.GetRect() );
683 aRect.Normalize();
684 rObj.SetRect( aRect );
685 }
686
687 if( rObj.GetAngle() )
688 ImplFlipBoundingBox( rObj, aPropOpt );
689
690 aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
691 const SdrObject* sdrObj = rObj.GetSdrObject();
693 mpEscherEx->Commit( aPropOpt, rObj.GetRect());
694 if( mpEscherEx->GetGroupLevel() > 1 )
696
697 if ( mpHostAppData )
698 {
701 if ( !bDontWriteText )
703 }
704 mpEscherEx->CloseContainer(); // ESCHER_SpContainer
705
706 if( bAdditionalText )
707 {
708 mpEscherEx->EndShape( nShapeType, nShapeID );
710 }
711
712 } while ( false );
713
714 if ( bAdditionalText )
715 mpEscherEx->EndShape( ESCHER_ShpInst_Min, nGrpShapeID );
716 else
717 mpEscherEx->EndShape( nShapeType, nShapeID );
718 return nShapeID;
719}
720
722{
723 sal_uInt32 nShapeID = 0;
724 sal_uInt16 nShapeType = 0;
725 do
726 {
727 mpHostAppData = mpEscherEx->StartShape( rObj.GetShapeRef(), (mpEscherEx->GetGroupLevel() > 1) ? &rObj.GetRect() : nullptr );
729 break;
730
731 const css::awt::Size aSize100thmm( rObj.GetShapeRef()->getSize() );
732 const css::awt::Point aPoint100thmm( rObj.GetShapeRef()->getPosition() );
733 tools::Rectangle aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
734 if ( !mpPicStrm )
737 rObj.SetAngle( rObj.ImplGetInt32PropertyValue( "RotateAngle" ));
738 sal_Int32 nAngle = rObj.GetAngle();
739 if( rObj.GetType() == "drawing.Line" )
740 {
741//2do: this does not work right
742 double fDist = hypot( rObj.GetRect().GetWidth(),
743 rObj.GetRect().GetHeight() );
745 Point( static_cast<sal_Int32>( fDist ), -1 ) ) );
746
749 if ( rObj.ImplGetText() )
750 aPropOpt.CreateTextProperties( rObj.mXPropSet,
752 rObj.GetShapeId() ) );
753
754 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
755 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
756 aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x60006 ); // Size Shape To Fit Text
757 if ( nAngle < 0 )
758 nAngle = ( 36000 + nAngle ) % 36000;
759 if ( nAngle )
760 ImplFlipBoundingBox( rObj, aPropOpt );
761 }
762 else
763 {
765 nShapeID = mpEscherEx->GenerateShapeId();
766 nShapeType = ESCHER_ShpInst_TextBox;
768 if ( rObj.ImplGetText() )
769 aPropOpt.CreateTextProperties( rObj.mXPropSet,
771 rObj.GetShapeId() ) );
772 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
773 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
774
775 if( nAngle < 0 )
776 nAngle = ( 36000 + nAngle ) % 36000;
777 else
778 nAngle = ( 36000 - ( nAngle % 36000 ) );
779
780 nAngle *= 655;
781 nAngle += 0x8000;
782 nAngle &=~0xffff; // nAngle round to full degrees
783 aPropOpt.AddOpt( ESCHER_Prop_Rotation, nAngle );
785 rObj.GetRect() );
787 rObj.GetRect() );
788 }
789 rObj.SetAngle( nAngle );
790 aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
791 const SdrObject* sdrObj = rObj.GetSdrObject();
793 mpEscherEx->Commit( aPropOpt, rObj.GetRect());
794
795 // write the childanchor
797
798#if defined EES_WRITE_EPP
799 // ClientAnchor
800 mpEscherEx->AddClientAnchor( maRect );
801 // ClientTextbox
804 *mpStrm << (sal_uInt32)EPP_TEXTTYPE_Other; // Text in a Shape
805 ImplWriteTextStyleAtom();
806 mpEscherEx->CloseContainer(); // ESCHER_ClientTextBox
807#else // !EES_WRITE_EPP
808 if ( mpHostAppData )
809 {
813 }
814#endif // EES_WRITE_EPP
815 mpEscherEx->CloseContainer(); // ESCHER_SpContainer
816 } while ( false );
818 mpEscherEx->EndShape( nShapeType, nShapeID );
819}
820
821
822sal_uInt32 ImplEESdrWriter::ImplEnterAdditionalTextGroup( const Reference< XShape >& rShape,
823 const tools::Rectangle* pBoundRect )
824{
826 sal_uInt32 nGrpId = mpEscherEx->EnterGroup( pBoundRect );
827 mpHostAppData = mpEscherEx->StartShape( rShape, pBoundRect );
828 return nGrpId;
829}
830
831
833{
834 mbIsTitlePossible = true; // With more than one title PowerPoint will fail.
835}
836
838 EscherSolverContainer& rSolverContainer, bool ooxmlExport )
839{
841
842 const sal_uInt32 nShapes = mXShapes->getCount();
843 for( sal_uInt32 n = 0; n < nShapes; ++n )
844 {
845 ImplEESdrObject aObj( *o3tl::doAccess<Reference<XShape>>(
846 mXShapes->getByIndex( n )) );
847 if( aObj.IsValid() )
848 {
849 ImplWriteShape( aObj, rSolverContainer, ooxmlExport );
850 }
851 }
852}
853
855{
856 DBG_ASSERT( !mpSolverContainer, "ImplEESdrWriter::~ImplEESdrWriter: unwritten SolverContainer" );
857 Reference<css::lang::XComponent> xComp(mXDrawPage, UNO_QUERY);
858 if (xComp.is())
859 xComp->dispose();
860}
861
862
864{
865 rtl::Reference<SvxDrawPage> pSvxDrawPage;
866 if ( mpSdrPage != &rPage || !mXDrawPage.is() )
867 {
868 // eventually write SolverContainer of current page, deletes the Solver
870
871 mpSdrPage = nullptr;
872 Reference<css::lang::XComponent> xOldDrawPage(mXDrawPage, UNO_QUERY);
873 if (xOldDrawPage.is())
874 xOldDrawPage->dispose();
875 mXDrawPage = pSvxDrawPage = new SvxFmDrawPage( const_cast<SdrPage*>(&rPage) );
877 if ( !mXShapes.is() )
878 return false;
880 mpSdrPage = &rPage;
881
883 }
884 else
885 pSvxDrawPage = comphelper::getFromUnoTunnel<SvxDrawPage>(mXDrawPage);
886
887 return pSvxDrawPage != nullptr;
888}
889
890bool ImplEESdrWriter::ImplInitUnoShapes( const Reference< XShapes >& rxShapes )
891{
892 // eventually write SolverContainer of current page, deletes the Solver
894
895 if( !rxShapes.is() )
896 return false;
897
898 mpSdrPage = nullptr;
899 mXDrawPage.clear();
900 mXShapes = rxShapes;
901
903
905 return true;
906}
907
909{
910 // close all groups before the solver container is written
911 while( mpEscherEx->GetGroupLevel() )
913
915 mpSdrPage = nullptr; // reset page for next init
916}
917
918
920{
921 if ( mpSolverContainer )
922 {
923 mpSolverContainer->WriteSolver( mpEscherEx->GetStream() );
924 mpSolverContainer.reset();
925 }
926}
927
929{
930 assert(mpSolverContainer && "ImplEESdrWriter::ImplWriteCurrentPage: no SolverContainer");
931 ImplWritePage( *mpSolverContainer, ooxmlExport );
932 ImplExitPage();
933}
934
935sal_uInt32 ImplEESdrWriter::ImplWriteTheShape( ImplEESdrObject& rObj , bool ooxmlExport )
936{
937 assert(mpSolverContainer && "ImplEESdrWriter::ImplWriteShape: no SolverContainer");
938 return ImplWriteShape( rObj, *mpSolverContainer, ooxmlExport );
939}
940
941void EscherEx::AddSdrPage( const SdrPage& rPage, bool ooxmlExport )
942{
943 if ( mpImplEESdrWriter->ImplInitPage( rPage ) )
944 mpImplEESdrWriter->ImplWriteCurrentPage(ooxmlExport);
945}
946
947void EscherEx::AddUnoShapes( const Reference< XShapes >& rxShapes, bool ooxmlExport )
948{
949 if ( mpImplEESdrWriter->ImplInitUnoShapes( rxShapes ) )
950 mpImplEESdrWriter->ImplWriteCurrentPage(ooxmlExport);
951}
952
953sal_uInt32 EscherEx::AddSdrObject(const SdrObject& rObj, bool ooxmlExport, sal_uInt32 nId)
954{
956 if( aObj.IsValid() )
957 return mpImplEESdrWriter->ImplWriteTheShape( aObj, ooxmlExport );
958 return 0;
959}
960
961
963{
964 mpImplEESdrWriter->ImplExitPage();
965}
966
967EscherExHostAppData* EscherEx::StartShape( const Reference< XShape >& /* rShape */, const tools::Rectangle* /*pChildAnchor*/ )
968{
969 return nullptr;
970}
971
972void EscherEx::EndShape( sal_uInt16 /* nShapeType */, sal_uInt32 /* nShapeID */ )
973{
974}
975
976sal_uInt32 EscherEx::QueryTextID( const Reference< XShape >&, sal_uInt32 )
977{
978 return 0;
979}
980
981// add a dummy rectangle shape into the escher stream
983{
985 sal_uInt32 nShapeID = GenerateShapeId();
988
989 return nShapeID;
990}
991
992// static
993const SdrObject* EscherEx::GetSdrObject( const Reference< XShape >& rShape )
994{
995 const SdrObject* pRet = SdrObject::getSdrObjectFromXShape( rShape );
996 DBG_ASSERT( pRet, "EscherEx::GetSdrObject: no SdrObj" );
997 return pRet;
998}
999
1000
1002 const SdrObject& rObj, bool bOOXML, sal_uInt32 nId) :
1003 mnShapeId(nId),
1004 mnTextSize( 0 ),
1005 mnAngle( 0 ),
1006 mbValid( false ),
1007 mbPresObj( false ),
1008 mbEmptyPresObj( false ),
1009 mbOOXML(bOOXML)
1010{
1011 SdrPage* pPage = rObj.getSdrPageFromSdrObject();
1012 DBG_ASSERT( pPage, "ImplEESdrObject::ImplEESdrObject: no SdrPage" );
1013 if( pPage && rEx.ImplInitPage( *pPage ) )
1014 {
1015 // why not declare a const parameter if the object will
1016 // not be modified?
1017 mXShape.set( const_cast<SdrObject*>(&rObj)->getUnoShape(), UNO_QUERY );
1018 Init();
1019 }
1020}
1021
1022ImplEESdrObject::ImplEESdrObject( const Reference< XShape >& rShape ) :
1023 mXShape( rShape ),
1024 mnShapeId( 0 ),
1025 mnTextSize( 0 ),
1026 mnAngle( 0 ),
1027 mbValid( false ),
1028 mbPresObj( false ),
1029 mbEmptyPresObj( false ),
1030 mbOOXML(false)
1031{
1032 Init();
1033}
1034
1035
1037{
1038}
1039
1040static basegfx::B2DRange getUnrotatedGroupBoundRange(const Reference< XShape >& rxShape)
1041{
1042 basegfx::B2DRange aRetval;
1043
1044 try
1045 {
1046 if(rxShape.is())
1047 {
1048 if(rxShape->getShapeType() == "com.sun.star.drawing.GroupShape")
1049 {
1050 // it's a group shape, iterate over children
1051 const Reference< XIndexAccess > xXIndexAccess(rxShape, UNO_QUERY);
1052
1053 if(xXIndexAccess.is())
1054 {
1055 for(sal_uInt32 n(0), nCnt = xXIndexAccess->getCount(); n < nCnt; ++n)
1056 {
1057 const Reference< XShape > axShape(xXIndexAccess->getByIndex(n), UNO_QUERY);
1058
1059 if(axShape.is())
1060 {
1061 // we are calculating the bound for a group, correct rotation for sub-objects
1062 // to get the unrotated bounds for the group
1063 const basegfx::B2DRange aExtend(getUnrotatedGroupBoundRange(axShape));
1064
1065 aRetval.expand(aExtend);
1066 }
1067 }
1068 }
1069 }
1070 else
1071 {
1072 // iT#s a xShape, get its transformation
1073 const Reference< XPropertySet > xPropSet(rxShape, UNO_QUERY);
1074
1075 if(xPropSet.is())
1076 {
1077 const Any aAny = xPropSet->getPropertyValue("Transformation");
1078
1079 if(aAny.hasValue())
1080 {
1081 HomogenMatrix3 aMatrix;
1082
1083 if(aAny >>= aMatrix)
1084 {
1085 basegfx::B2DHomMatrix aHomogenMatrix;
1086
1087 aHomogenMatrix.set(0, 0, aMatrix.Line1.Column1);
1088 aHomogenMatrix.set(0, 1, aMatrix.Line1.Column2);
1089 aHomogenMatrix.set(0, 2, aMatrix.Line1.Column3);
1090 aHomogenMatrix.set(1, 0, aMatrix.Line2.Column1);
1091 aHomogenMatrix.set(1, 1, aMatrix.Line2.Column2);
1092 aHomogenMatrix.set(1, 2, aMatrix.Line2.Column3);
1093 // For this to be a valid 2D transform matrix, the last row must be [0,0,1]
1094 assert( aMatrix.Line3.Column1 == 0 );
1095 assert( aMatrix.Line3.Column2 == 0 );
1096 assert( aMatrix.Line3.Column3 == 1 );
1097
1098 basegfx::B2DVector aScale, aTranslate;
1099 double fRotate, fShearX;
1100
1101 // decompose transformation
1102 aHomogenMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
1103
1104 // check if rotation needs to be corrected
1105 if(!basegfx::fTools::equalZero(fRotate))
1106 {
1107 // to correct, keep in mind that ppt graphics are rotated around their center
1108 const basegfx::B2DPoint aCenter(aHomogenMatrix * basegfx::B2DPoint(0.5, 0.5));
1109
1110 aHomogenMatrix.translate(-aCenter.getX(), -aCenter.getY());
1111 aHomogenMatrix.rotate(-fRotate);
1112 aHomogenMatrix.translate(aCenter.getX(), aCenter.getY());
1113 }
1114
1115
1116 // check if shear needs to be corrected (always correct shear,
1117 // ppt does not know about it)
1118 if(!basegfx::fTools::equalZero(fShearX))
1119 {
1120 const basegfx::B2DPoint aMinimum(aHomogenMatrix * basegfx::B2DPoint(0.0, 0.0));
1121
1122 aHomogenMatrix.translate(-aMinimum.getX(), -aMinimum.getY());
1123 aHomogenMatrix.shearX(-fShearX);
1124 aHomogenMatrix.translate(aMinimum.getX(), aMinimum.getY());
1125 }
1126
1127 // create range. It's no longer rotated (or sheared), so use
1128 // minimum and maximum values
1129 aRetval.expand(aHomogenMatrix * basegfx::B2DPoint(0.0, 0.0));
1130 aRetval.expand(aHomogenMatrix * basegfx::B2DPoint(1.0, 1.0));
1131 }
1132 }
1133 }
1134 }
1135 }
1136 }
1137 catch(css::uno::Exception&)
1138 {
1139 }
1140
1141 return aRetval;
1142}
1143
1145{
1146 mXPropSet.set( mXShape, UNO_QUERY );
1147 if( !mXPropSet.is() )
1148 return;
1149
1150 // detect name first to make below test (is group) work
1151 mType = mXShape->getShapeType();
1152 (void)mType.startsWith( "com.sun.star.", &mType ); // strip "com.sun.star."
1153 (void)mType.endsWith( "Shape", &mType ); // strip "Shape"
1154
1155 if(GetType() == "drawing.Group")
1156 {
1157 // if it's a group, the unrotated range is needed for that group
1159 const Point aNewP(basegfx::fround(aUnrotatedRange.getMinX()), basegfx::fround(aUnrotatedRange.getMinY()));
1160 const Size aNewS(basegfx::fround(aUnrotatedRange.getWidth()), basegfx::fround(aUnrotatedRange.getHeight()));
1161
1163 }
1164 else
1165 {
1166 // if it's no group, use position and size directly, rotated/sheared or not
1167 const Point aOldP(mXShape->getPosition().X, mXShape->getPosition().Y);
1168 const Size aOldS(mXShape->getSize().Width, mXShape->getSize().Height);
1169
1171 }
1172
1173 if( ImplGetPropertyValue( "IsPresentationObject" ) )
1174 mbPresObj = ::cppu::any2bool( mAny );
1175
1176 if( mbPresObj && ImplGetPropertyValue( "IsEmptyPresentationObject" ) )
1177 mbEmptyPresObj = ::cppu::any2bool( mAny );
1178
1179 mbValid = true;
1180}
1181
1182bool ImplEESdrObject::ImplGetPropertyValue( const OUString& rString )
1183{
1184 bool bRetValue = false;
1185 if( mbValid )
1186 {
1187 try
1188 {
1189 mAny = mXPropSet->getPropertyValue( rString );
1190 if( mAny.hasValue() )
1191 bRetValue = true;
1192 }
1193 catch( const css::uno::Exception& )
1194 {
1195 bRetValue = false;
1196 }
1197 }
1198 return bRetValue;
1199}
1200
1201void ImplEESdrObject::SetRect( const Point& rPos, const Size& rSz )
1202{
1203 maRect = tools::Rectangle( rPos, rSz );
1204}
1205
1207{
1209}
1210
1211// loads and converts text from shape, result is saved in mnTextSize
1213{
1214 Reference< XText > xXText( mXShape, UNO_QUERY );
1215 mnTextSize = 0;
1216 if (xXText.is())
1217 {
1218 try
1219 {
1220 mnTextSize = xXText->getString().getLength();
1221 }
1222 catch (const uno::RuntimeException&)
1223 {
1224 TOOLS_WARN_EXCEPTION("filter.ms", "ImplGetText");
1225 }
1226 }
1227 return mnTextSize;
1228}
1229
1231{
1232 Reference< XText > xXText( mXShape, UNO_QUERY );
1233 return xXText.is() && !xXText->getString().isEmpty();
1234}
1235
1236
1238{
1239 mbOOXML = bOOXML;
1240}
1241
1242/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool DontWriteShape() const
Definition: escherex.hxx:964
void WriteClientAnchor(EscherEx &rEx, const tools::Rectangle &rRect)
Definition: escherex.hxx:957
void WriteClientTextbox(EscherEx &rEx)
Definition: escherex.hxx:961
InteractionInfo * GetInteractionInfo() const
Definition: escherex.hxx:950
void WriteClientData(EscherEx &rEx)
Definition: escherex.hxx:959
void SetGroupLogicRect(sal_uInt32 nGroupLevel, const tools::Rectangle &rRect)
Definition: escherex.cxx:5231
bool mbOOXML
Definition: escherex.hxx:1068
virtual sal_uInt32 EnterGroup(const OUString &rShapeName, const tools::Rectangle *pBoundRect)
Definition: escherex.cxx:5162
void EndSdrObjectPage()
If objects are written through AddSdrObject the SolverContainer has to be written,...
Definition: eschesdo.cxx:962
void AddSdrPage(const SdrPage &rPage, bool ooxmlExport=false)
Definition: eschesdo.cxx:941
SdrLayerID GetHellLayerId() const
Definition: escherex.hxx:1213
sal_uInt32 AddDummyShape()
Definition: eschesdo.cxx:982
sal_uInt32 AddSdrObject(const SdrObject &rObj, bool ooxmlExport=false, sal_uInt32 nId=0)
returns the ShapeID
Definition: eschesdo.cxx:953
virtual void EndShape(sal_uInt16 nShapeType, sal_uInt32 nShapeID)
Called after a shape is written to inform the application of the resulted shape type and ID.
Definition: eschesdo.cxx:972
virtual void AddShape(sal_uInt32 nShpInstance, ShapeFlag nFlagIds, sal_uInt32 nShapeID=0)
Definition: escherex.cxx:5252
void AddAtom(sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion=0, int nRecInstance=0)
Definition: escherex.cxx:5134
virtual EscherExHostAppData * EnterAdditionalTextGroup()
Called before an AdditionalText EnterGroup occurs.
Definition: escherex.cxx:5157
void SetGroupSnapRect(sal_uInt32 nGroupLevel, const tools::Rectangle &rRect)
Definition: escherex.cxx:5215
void AddChildAnchor(const tools::Rectangle &rRectangle)
Definition: escherex.cxx:5139
virtual sal_uInt32 GenerateShapeId()
Creates and returns a new shape identifier, updates the internal shape counters and registers the ide...
Definition: escherex.hxx:1080
void SetEditAs(const OUString &rEditAs)
Definition: escherex.cxx:4985
virtual void OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance=0)
Definition: escherex.cxx:5025
std::unique_ptr< ImplEESdrWriter > mpImplEESdrWriter
Definition: escherex.hxx:1053
static const SdrObject * GetSdrObject(const css::uno::Reference< css::drawing::XShape > &rXShape)
Definition: eschesdo.cxx:993
virtual void AddSdrObjectVMLObject(const SdrObject &)
Definition: escherex.hxx:1166
virtual void Commit(EscherPropertyContainer &rProps, const tools::Rectangle &rRect)
Definition: escherex.cxx:5267
SvStream & GetStream() const
Definition: escherex.hxx:1125
void AddUnoShapes(const css::uno::Reference< css::drawing::XShapes > &rxShapes, bool ooxmlExport=false)
Definition: eschesdo.cxx:947
EscherGraphicProvider & GetGraphicProvider()
Returns the graphic provider from the global object that has been passed to the constructor.
Definition: escherex.hxx:1085
SvStream * QueryPictureStream()
Called if a picture shall be written and no picture stream is set at class ImplEESdrWriter.
Definition: escherex.hxx:1090
virtual void LeaveGroup()
Definition: escherex.cxx:5244
void AddClientAnchor(const tools::Rectangle &rRectangle)
Definition: escherex.cxx:5148
sal_uInt32 GetGroupLevel() const
Definition: escherex.hxx:1146
virtual EscherExHostAppData * StartShape(const css::uno::Reference< css::drawing::XShape > &rShape, const tools::Rectangle *pChildAnchor)
Called before a shape is written, application supplies ClientRecords.
Definition: eschesdo.cxx:967
virtual sal_uInt32 QueryTextID(const css::uno::Reference< css::drawing::XShape > &, sal_uInt32 nShapeId)
Called if an ESCHER_Prop_lTxid shall be written.
Definition: eschesdo.cxx:976
virtual void CloseContainer()
Definition: escherex.cxx:5081
bool CreateGraphicProperties(const css::uno::Reference< css::drawing::XShape > &rXShape, const GraphicObject &rGraphicObj)
void CreateShapeProperties(const css::uno::Reference< css::drawing::XShape > &rXShape)
Definition: escherex.cxx:1307
static MSO_SPT GetCustomShapeType(const css::uno::Reference< css::drawing::XShape > &rXShape, ShapeFlag &nMirrorFlags, OUString &rShapeType, bool bOOXML=false)
Definition: escherex.cxx:3697
void CreateShadowProperties(const css::uno::Reference< css::beans::XPropertySet > &)
Definition: escherex.cxx:2302
bool CreateOLEGraphicProperties(const css::uno::Reference< css::drawing::XShape > &rXOleObject)
Definition: escherex.cxx:1333
void AddOpt(sal_uInt16 nPropID, bool bBlib, sal_uInt32 nSizeReduction, SvMemoryStream &rStream)
Definition: escherex.cxx:176
bool IsFontWork() const
Definition: escherex.cxx:346
bool CreatePolygonProperties(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, sal_uInt32 nFlags, bool bBezier, css::awt::Rectangle &rGeoRect, tools::Polygon const *pPolygon=nullptr)
Definition: escherex.cxx:1850
bool CreateConnectorProperties(const css::uno::Reference< css::drawing::XShape > &rXShape, EscherSolverContainer &rSolver, css::awt::Rectangle &rGeoRect, sal_uInt16 &rShapeType, ShapeFlag &rShapeFlags)
Definition: escherex.cxx:2190
void CreateLineProperties(const css::uno::Reference< css::beans::XPropertySet > &, bool bEdge)
Definition: escherex.cxx:963
void CreateTextProperties(const css::uno::Reference< css::beans::XPropertySet > &, sal_uInt32 nText, const bool bIsCustomShape=false, const bool bIsTextFrame=true)
Definition: escherex.cxx:672
void CreateFillProperties(const css::uno::Reference< css::beans::XPropertySet > &, bool bEdge, bool bTransparentGradient=false)
void CreateCustomShapeProperties(const MSO_SPT eShapeType, const css::uno::Reference< css::drawing::XShape > &)
Definition: escherex.cxx:2582
void AddShape(const css::uno::Reference< css::drawing::XShape > &, sal_uInt32 nId)
Definition: escherex.cxx:4643
void SetAngle(sal_Int32 nVal)
Definition: eschesdo.hxx:68
css::uno::Any mAny
Definition: eschesdo.hxx:33
css::uno::Reference< css::beans::XPropertySet > mXPropSet
Definition: eschesdo.hxx:46
void SetShapeId(sal_uInt32 nVal)
Definition: eschesdo.hxx:74
sal_Int32 GetAngle() const
Definition: eschesdo.hxx:67
const css::uno::Reference< css::drawing::XShape > & GetShapeRef() const
Definition: eschesdo.hxx:57
bool GetOOXML() const
Definition: eschesdo.hxx:80
void SetOOXML(bool bOOXML)
Definition: eschesdo.cxx:1237
void SetType(const OUString &rS)
Definition: eschesdo.hxx:60
bool ImplHasText() const
Definition: eschesdo.cxx:1230
void SetRect(const Point &rPos, const Size &rSz)
Definition: eschesdo.cxx:1201
const SdrObject * GetSdrObject() const
Definition: eschesdo.cxx:1206
bool mbEmptyPresObj
Definition: eschesdo.hxx:41
bool IsEmptyPresObj() const
Definition: eschesdo.hxx:72
OUString mType
Definition: eschesdo.hxx:35
ImplEESdrObject(ImplEESdrWriter &rEx, const SdrObject &rObj, bool bOOXML, sal_uInt32 nId=0)
Definition: eschesdo.cxx:1001
sal_uInt32 ImplGetText()
Definition: eschesdo.cxx:1212
bool IsValid() const
Definition: eschesdo.hxx:70
sal_Int32 ImplGetInt32PropertyValue(const OUString &rStr)
Definition: eschesdo.hxx:54
bool ImplGetPropertyValue(const OUString &rString)
Definition: eschesdo.cxx:1182
sal_uInt32 GetShapeId() const
Definition: eschesdo.hxx:73
const OUString & GetType() const
Definition: eschesdo.hxx:59
const tools::Rectangle & GetRect() const
Definition: eschesdo.hxx:62
css::uno::Reference< css::drawing::XShape > mXShape
Definition: eschesdo.hxx:32
tools::Rectangle maRect
Definition: eschesdo.hxx:34
sal_uInt32 mnTextSize
Definition: eschesdo.hxx:37
const css::uno::Any & GetUsrAny() const
Definition: eschesdo.hxx:58
bool ImplInitUnoShapes(const css::uno::Reference< css::drawing::XShapes > &rxShapes)
Definition: eschesdo.cxx:890
static void ImplFlipBoundingBox(ImplEESdrObject &rObj, EscherPropertyContainer &rPropOpt)
Definition: eschesdo.cxx:79
EscherEx * mpEscherEx
Definition: eschesdo.hxx:101
static Point ImplMapPoint(const Point &rPoint)
Definition: eschesdo.cxx:63
static Size ImplMapSize(const Size &rSize)
Definition: eschesdo.cxx:68
std::unique_ptr< EscherSolverContainer > mpSolverContainer
Definition: eschesdo.hxx:109
css::uno::Reference< css::drawing::XDrawPage > mXDrawPage
Definition: eschesdo.hxx:102
EscherExHostAppData * mpHostAppData
Definition: eschesdo.hxx:106
ImplEESdrWriter(EscherEx &rEx)
Definition: eschesdo.cxx:52
void ImplExitPage()
Definition: eschesdo.cxx:908
bool ImplInitPage(const SdrPage &rPage)
Definition: eschesdo.cxx:863
SvStream * mpPicStrm
Definition: eschesdo.hxx:104
const SdrPage * mpSdrPage
Definition: eschesdo.hxx:108
void ImplWriteCurrentPage(bool ooxmlExport)
Definition: eschesdo.cxx:928
void ImplFlushSolverContainer()
Definition: eschesdo.cxx:919
void ImplWritePage(EscherSolverContainer &rSolver, bool ooxmlExport)
Definition: eschesdo.cxx:837
sal_uInt32 ImplWriteShape(ImplEESdrObject &rObj, EscherSolverContainer &rSolver, const bool bOOxmlExport=false)
Definition: eschesdo.cxx:128
void ImplInitPageValues()
Definition: eschesdo.cxx:832
void ImplWriteAdditionalText(ImplEESdrObject &rObj)
Definition: eschesdo.cxx:721
bool mbIsTitlePossible
Definition: eschesdo.hxx:107
sal_uInt32 ImplEnterAdditionalTextGroup(const css::uno::Reference< css::drawing::XShape > &rShape, const tools::Rectangle *pBoundRect)
Definition: eschesdo.cxx:822
sal_uInt32 ImplWriteTheShape(ImplEESdrObject &rObj, bool ooxmlExport)
Definition: eschesdo.cxx:935
css::uno::Reference< css::drawing::XShapes > mXShapes
Definition: eschesdo.hxx:103
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
virtual const tools::Rectangle & GetCurrentBoundRect() const
SdrPage * getSdrPageFromSdrObject() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
tools::Long AdjustWidth(tools::Long n)
constexpr tools::Long Width() const
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
void shearX(double fSx)
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
void rotate(double fRadiant)
void translate(double fX, double fY)
TYPE getWidth() const
TYPE getMinX() const
TYPE getMinY() const
void expand(const Tuple2D< TYPE > &rTuple)
TYPE getHeight() const
TYPE getX() const
TYPE getY() const
void Rotate(const Point &rCenter, double fSin, double fCos)
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr Size GetSize() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long GetHeight() const
constexpr tools::Long Left() const
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define EPP_TEXTTYPE_Other
#define EPP_TextHeaderAtom
@ ESCHER_ShapeComplex
Definition: escherex.hxx:177
#define ESCHER_CREATEPOLYGON_LINE
Definition: escherex.hxx:647
#define ESCHER_Prop_lineColor
Definition: escherex.hxx:393
#define ESCHER_ShpInst_RoundRectangle
Definition: escherex.hxx:108
@ ESCHER_AnchorMiddle
Definition: escherex.hxx:211
#define ESCHER_Prop_shapePath
Definition: escherex.hxx:370
#define ESCHER_Prop_hspMaster
Definition: escherex.hxx:417
#define ESCHER_Prop_LockAgainstGrouping
Definition: escherex.hxx:337
#define ESCHER_Prop_fNoFillHitTest
Definition: escherex.hxx:391
@ ESCHER_WrapNone
Definition: escherex.hxx:185
#define ESCHER_ShpInst_HostControl
Definition: escherex.hxx:120
#define ESCHER_Prop_fshadowObscured
Definition: escherex.hxx:413
#define ESCHER_Prop_FitTextToShape
Definition: escherex.hxx:348
#define ESCHER_Prop_fNoLineDrawDash
Definition: escherex.hxx:407
#define ESCHER_Prop_wzName
Definition: escherex.hxx:422
#define ESCHER_Prop_AnchorText
Definition: escherex.hxx:345
#define ESCHER_Prop_WrapText
Definition: escherex.hxx:344
#define ESCHER_CREATEPOLYGON_POLYLINE
Definition: escherex.hxx:648
#define ESCHER_ShpInst_TextBox
Definition: escherex.hxx:121
#define ESCHER_ShpInst_Min
Definition: escherex.hxx:105
#define ESCHER_Prop_Rotation
Definition: escherex.hxx:335
#define ESCHER_ShpInst_NotPrimitive
Definition: escherex.hxx:106
#define ESCHER_Prop_fillBackColor
Definition: escherex.hxx:380
#define ESCHER_ShpInst_Ellipse
Definition: escherex.hxx:109
#define ESCHER_Prop_pictureId
Definition: escherex.hxx:363
#define ESCHER_Prop_fFillOK
Definition: escherex.hxx:375
#define ESCHER_Prop_fPrint
Definition: escherex.hxx:432
#define ESCHER_Prop_lTxid
Definition: escherex.hxx:339
#define ESCHER_ShpInst_Rectangle
Definition: escherex.hxx:107
#define ESCHER_Prop_pihlShape
Definition: escherex.hxx:424
#define ESCHER_Prop_adjustValue
Definition: escherex.hxx:373
#define ESCHER_CREATEPOLYGON_POLYPOLYGON
Definition: escherex.hxx:649
ShapeFlag
Definition: escherex.hxx:85
@ HaveShapeProperty
#define ESCHER_SpContainer
Definition: escherex.hxx:72
#define ESCHER_ClientTextbox
Definition: escherex.hxx:76
#define ESCHER_Prop_fillColor
Definition: escherex.hxx:378
#define ESCHER_ShpInst_Line
Definition: escherex.hxx:111
#define ESCHER_ShpInst_PictureFrame
Definition: escherex.hxx:116
static basegfx::B2DRange getUnrotatedGroupBoundRange(const Reference< XShape > &rxShape)
Definition: eschesdo.cxx:1040
constexpr o3tl::Length geUnitsSrc(o3tl::Length::mm100)
constexpr o3tl::Length geUnitsDest(o3tl::Length::twip)
sal_Int64 n
MSO_SPT
mso_sptMax
bool equalZero(const T &rfVal)
B2IRange fround(const B2DRange &rRange)
Shape IDs per cluster in DGG atom.
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
detail::Optional< T >::type doAccess(css::uno::Any const &any)
sal_Int16 nId
PolyStyle
QPRO_FUNC_TYPE nType
bool mbValid
UNDERLYING_TYPE get() const
constexpr SdrLayerID SDRLAYER_NOTFOUND(-1)
sal_Int32 mnAngle
sal_Int32 nLength