49#include <com/sun/star/beans/PropertyValues.hpp>
50#include <com/sun/star/beans/XPropertySet.hpp>
51#include <com/sun/star/beans/XPropertyState.hpp>
52#include <com/sun/star/awt/GradientStyle.hpp>
53#include <com/sun/star/awt/Gradient.hpp>
54#include <com/sun/star/drawing/LineStyle.hpp>
55#include <com/sun/star/drawing/LineJoint.hpp>
56#include <com/sun/star/drawing/LineCap.hpp>
57#include <com/sun/star/drawing/FillStyle.hpp>
58#include <com/sun/star/drawing/LineDash.hpp>
59#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
60#include <com/sun/star/drawing/ConnectorType.hpp>
61#include <com/sun/star/drawing/CircleKind.hpp>
62#include <com/sun/star/drawing/PointSequence.hpp>
63#include <com/sun/star/drawing/FlagSequence.hpp>
64#include <com/sun/star/drawing/PolygonFlags.hpp>
65#include <com/sun/star/text/WritingMode.hpp>
66#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
67#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
68#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
69#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
70#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
71#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
72#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
73#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
74#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
75#include <com/sun/star/drawing/ProjectionMode.hpp>
76#include <com/sun/star/text/XSimpleText.hpp>
77#include <com/sun/star/drawing/ShadeMode.hpp>
78#include <com/sun/star/drawing/TextFitToSizeType.hpp>
80#include <com/sun/star/awt/FontSlant.hpp>
81#include <com/sun/star/awt/FontWeight.hpp>
82#include <com/sun/star/drawing/ColorMode.hpp>
83#include <com/sun/star/drawing/Position3D.hpp>
84#include <com/sun/star/drawing/Direction3D.hpp>
85#include <com/sun/star/drawing/Hatch.hpp>
86#include <com/sun/star/graphic/XGraphic.hpp>
87#include <com/sun/star/text/GraphicCrop.hpp>
92#include <rtl/strbuf.hxx>
97#include <osl/diagnose.h>
151 pGraphicProvider(pGraphProv),
152 pPicOutStrm(pPiOutStrm),
153 pShapeBoundRect(pBoundRect),
156 bHasComplexData(false)
179 sal_uInt32 nSizeReduction,
183 const sal_uInt64 nSize(rStream.
GetSize());
184 std::vector<sal_uInt8>
aBuf;
187 for(sal_uInt64
a(0);
a < nSize;
a++)
189 aBuf.push_back(*pBuf++);
192 sal_uInt32 nPropValue(
static_cast<sal_uInt32
>(nSize));
194 if(0 != nSizeReduction && nPropValue > nSizeReduction)
196 nPropValue -= nSizeReduction;
204 sal_uInt32 nPropValue,
207 AddOpt(nPropID, bBlib, nPropValue, std::vector<sal_uInt8>());
212 std::u16string_view rString)
214 std::vector<sal_uInt8>
aBuf;
215 aBuf.reserve(rString.size() * 2 + 2);
217 for(
size_t i(0);
i < rString.size();
i++)
233 sal_uInt32 nPropValue,
234 const std::vector<sal_uInt8>& rProp)
238 if ( !rProp.empty() )
243 if ( (
pSortStruct[
i ].nPropId &~0xc000 ) == ( nPropID &~0xc000 ) )
252 if ( !rProp.empty() )
264 if ( !rProp.empty() )
275 if (
GetOpt( nPropId, aPropStruct ) )
287 if ( (
pSortStruct[
i ].nPropId &~0xc000 ) == ( nPropId &~0xc000 ) )
310 else if( nID1 > nID2 )
348 sal_uInt32 nTextPathFlags = 0;
350 return ( nTextPathFlags & 0x4000 ) != 0;
357 sal_uInt32 nColor = nSOColor & 0xff00;
358 nColor |=
static_cast<sal_uInt8>(nSOColor) << 16;
359 nColor |=
static_cast<sal_uInt8>( nSOColor >> 16 );
363 return nSOColor & 0xffffff;
367 const awt::Gradient* pGradient,
368 sal_uInt32 nStartColor )
370 sal_uInt32 nIntensity = 100;
375 if ( nStartColor & 1 )
377 nIntensity = pGradient->StartIntensity;
382 nIntensity = pGradient->EndIntensity;
386 sal_uInt32 nRed = ( aColor.
GetRed() * nIntensity ) / 100;
387 sal_uInt32 nGreen = ( ( aColor.
GetGreen() * nIntensity ) / 100 ) << 8;
388 sal_uInt32 nBlue = ( ( aColor.
GetBlue() * nIntensity ) / 100 ) << 16;
389 return nRed | nGreen | nBlue;
393 const awt::Gradient & rGradient )
396 sal_uInt32 nAngle = 0;
397 sal_uInt32 nFillFocus = 0;
398 sal_uInt32 nFillLR = 0;
399 sal_uInt32 nFillTB = 0;
400 sal_uInt32 nFirstColor = 0;
401 bool bWriteFillTo =
false;
403 switch ( rGradient.Style )
405 case awt::GradientStyle_LINEAR :
406 case awt::GradientStyle_AXIAL :
409 nAngle = (rGradient.Angle * 0x10000) / 10;
410 nFillFocus = (sal::static_int_cast<int>(rGradient.Style) ==
411 sal::static_int_cast<int>(css::awt::GradientStyle_LINEAR)) ? 0 : 50;
414 case awt::GradientStyle_RADIAL :
415 case awt::GradientStyle_ELLIPTICAL :
416 case awt::GradientStyle_SQUARE :
417 case awt::GradientStyle_RECT :
419 nFillLR = (rGradient.XOffset * 0x10000) / 100;
420 nFillTB = (rGradient.YOffset * 0x10000) / 100;
421 if ( ((nFillLR > 0) && (nFillLR < 0x10000)) || ((nFillTB > 0) && (nFillTB < 0x10000)) )
429 case awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE :
break;
446 const uno::Reference<beans::XPropertySet> & rXPropSet ,
bool bTransparentGradient)
449 awt::Gradient
const * pGradient =
nullptr;
452 sal_Int32 nAngle = 0;
453 sal_uInt32 nFillFocus = 0;
454 sal_uInt32 nFillLR = 0;
455 sal_uInt32 nFillTB = 0;
456 sal_uInt32 nFirstColor = 0;
457 bool bWriteFillTo =
false;
461 aAny, rXPropSet,
"FillTransparenceGradient" ) )
463 pGradient = o3tl::doAccess<awt::Gradient>(aAny);
467 aAnyTemp, rXPropSet,
"FillStyle" ) )
469 drawing::FillStyle eFS;
470 if ( ! ( aAnyTemp >>= eFS ) )
471 eFS = drawing::FillStyle_SOLID;
473 if ( eFS == drawing::FillStyle_SOLID)
476 aAnyTemp, rXPropSet,
"FillColor" ) )
478 const_cast<awt::Gradient *
>(pGradient)->StartColor =
ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAnyTemp), false );
479 const_cast<awt::Gradient *
>(pGradient)->EndColor =
ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAnyTemp), false );
483 else if( eFS == drawing::FillStyle_GRADIENT )
486 aAny, rXPropSet,
"FillGradient" ) )
487 pGradient = o3tl::doAccess<awt::Gradient>(aAny);
494 aAny, rXPropSet,
"FillGradient" ) )
496 pGradient = o3tl::doAccess<awt::Gradient>(aAny);
501 switch ( pGradient->Style )
503 case awt::GradientStyle_LINEAR :
504 case awt::GradientStyle_AXIAL :
507 nAngle = pGradient->Angle;
508 while ( nAngle > 0 ) nAngle -= 3600;
509 while ( nAngle <= -3600 ) nAngle += 3600;
511 nAngle = ( nAngle * 0x10000) / 10;
513 nFillFocus = (pGradient->Style == awt::GradientStyle_LINEAR) ?
514 ( pGradient->XOffset + pGradient->YOffset )/2 : -50;
516 nFirstColor=nFirstColor ^ 1;
518 nFirstColor=nFirstColor ^ 1;
521 case awt::GradientStyle_RADIAL :
522 case awt::GradientStyle_ELLIPTICAL :
523 case awt::GradientStyle_SQUARE :
524 case awt::GradientStyle_RECT :
527 nFillLR = (pGradient->XOffset * 0x10000) / 100;
528 nFillTB = (pGradient->YOffset * 0x10000) / 100;
529 if ( ((nFillLR > 0) && (nFillLR < 0x10000)) || ((nFillTB > 0) && (nFillTB < 0x10000)) )
563 aAny, rXPropSet,
"FillTransparenceGradient" ) )
565 pGradient = o3tl::doAccess<awt::Gradient>(aAny);
577 const uno::Reference<beans::XPropertySet> & rXPropSet,
578 bool bEdge ,
const uno::Reference<drawing::XShape> & rXShape )
587 bool bTransparentGradient = ( aAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SfxItemState::SET ) &&
588 aAttr.Get( XATTR_FILLFLOATTRANSPARENCE ).IsEnabled();
595 const uno::Reference<beans::XPropertySet> & rXPropSet,
596 bool bEdge ,
bool bTransparentGradient)
602 static constexpr OUStringLiteral
aPropName( u
"FillStyle" );
605 aAny, rXPropSet, aPropName ) )
607 drawing::FillStyle eFS;
608 if ( ! ( aAny >>= eFS ) )
609 eFS = drawing::FillStyle_SOLID;
610 sal_uInt32 nFillBackColor = 0;
613 case drawing::FillStyle_GRADIENT :
620 case drawing::FillStyle_BITMAP :
627 case drawing::FillStyle_HATCH :
632 case drawing::FillStyle_SOLID :
635 if ( bTransparentGradient )
640 rXPropSet, aPropName );
641 if ( ePropState == beans::PropertyState_DIRECT_VALUE )
645 aAny, rXPropSet,
"FillColor" ) )
647 sal_uInt32 nFillColor =
ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAny) );
648 nFillBackColor = nFillColor ^ 0xffffff;
656 case drawing::FillStyle_NONE :
660 if ( eFS != drawing::FillStyle_NONE )
663 aAny, rXPropSet,
"FillTransparence",
true ) )
664 ? *o3tl::doAccess<sal_Int16>(aAny) : 0;
673 const uno::Reference< beans::XPropertySet > & rXPropSet, sal_uInt32 nTextId,
674 const bool bIsCustomShape,
const bool bIsTextFrame )
677 text::WritingMode eWM( text::WritingMode_LR_TB );
678 drawing::TextVerticalAdjust eVA( drawing::TextVerticalAdjust_TOP );
679 drawing::TextHorizontalAdjust eHA( drawing::TextHorizontalAdjust_LEFT );
681 sal_Int32 nLeft ( 0 );
682 sal_Int32 nTop ( 0 );
683 sal_Int32 nRight ( 0 );
684 sal_Int32 nBottom ( 0 );
687 bool bAutoGrowWidth (
false );
688 const bool bAutoGrowHeight (
false );
690 bool bWordWrap (
false );
691 bool bAutoGrowSize (
false );
699 if ( bIsCustomShape )
704 aAny >>= bAutoGrowSize;
706 else if ( bIsTextFrame )
709 aAny >>= bAutoGrowWidth;
728 sal_uInt32 nTextAttr = 0x40004;
730 if ( eWM == text::WritingMode_TB_RL )
734 case drawing::TextHorizontalAdjust_LEFT :
737 case drawing::TextHorizontalAdjust_CENTER :
741 case drawing::TextHorizontalAdjust_BLOCK :
742 case drawing::TextHorizontalAdjust_RIGHT :
746 if ( eVA == drawing::TextVerticalAdjust_CENTER )
762 if ( bIsCustomShape )
769 nTextAttr |= 0x20002;
773 if ( bAutoGrowHeight )
775 if ( bAutoGrowWidth )
776 nTextAttr |= 0x20002;
785 case drawing::TextVerticalAdjust_CENTER :
789 case drawing::TextVerticalAdjust_BOTTOM :
794 case drawing::TextVerticalAdjust_TOP :
798 if ( eHA == drawing::TextHorizontalAdjust_CENTER )
814 if ( bIsCustomShape )
821 nTextAttr |= 0x20002;
825 if ( bAutoGrowWidth )
827 if ( bAutoGrowHeight )
828 nTextAttr |= 0x20002;
846 if (!bIsTextFrame || bIsCustomShape)
850 aAny, rXPropSet,
"RotateAngle",
true ) ?
851 static_cast<sal_uInt16
>( ( *o3tl::doAccess<sal_Int32>(aAny) ) + 5 ) / 10 : 0;
863 const uno::Reference<beans::XPropertySet> & rXPropSet,
864 ESCHER_LineEnd& reLineEnd, sal_Int32& rnArrowLength, sal_Int32& rnArrowWidth )
866 const OUString sLine ( bLineStart ? OUString(
"LineStart") : OUString(
"LineEnd") );
867 const OUString sLineName ( bLineStart ? OUString(
"LineStartName") : OUString(
"LineEndName") );
869 bool bIsArrow =
false;
875 if ( aPolyPoly.
Count() && aPolyPoly[ 0 ].GetSize() )
885 OUString aArrowStartName = *o3tl::doAccess<OUString>(aAny);
889 sal_Int32
nPos = aArrowStartName.lastIndexOf(
' ');
890 if (
nPos > -1 && aArrowStartName.lastIndexOf(
' ',
nPos) > -1)
891 aArrowStartName = aArrowStartName.copy(0,
nPos);
894 bool bIsMapped =
true;
895 if ( !aApiName.isEmpty() )
899 if ( aApiName ==
"Arrow concave" )
901 else if ( aApiName ==
"Square 45" )
903 else if ( aApiName ==
"Small Arrow" )
905 else if ( aApiName ==
"Dimension Lines" )
911 else if ( aApiName ==
"Double Arrow" )
913 else if ( aApiName ==
"Rounded short Arrow" )
915 else if ( aApiName ==
"Symmetric Arrow" )
917 else if ( aApiName ==
"Line Arrow" )
919 else if ( aApiName ==
"Rounded large Arrow" )
921 else if ( aApiName ==
"Circle" )
923 else if ( aApiName ==
"Square" )
925 else if ( aApiName ==
"Arrow" )
934 std::u16string_view aArrowName(
o3tl::getToken(aArrowStartName, 0,
' ', nIdx ) );
935 if ( aArrowName ==
u"msArrowEnd" )
937 else if ( aArrowName ==
u"msArrowOpenEnd" )
939 else if ( aArrowName ==
u"msArrowStealthEnd" )
941 else if ( aArrowName ==
u"msArrowDiamondEnd" )
943 else if ( aArrowName ==
u"msArrowOvalEnd" )
951 std::u16string_view aArrowSize =
o3tl::getToken(aArrowStartName, 0,
' ', nIdx );
953 rnArrowWidth = ( nArrowSize - 1 ) / 3;
954 rnArrowLength = nArrowSize - ( rnArrowWidth * 3 ) - 1;
964 const uno::Reference<beans::XPropertySet> & rXPropSet,
bool bEdge )
967 sal_uInt32 nLineFlags = 0x80008;
970 sal_Int32 nArrowLength;
971 sal_Int32 nArrowWidth;
973 bool bSwapLineEnds =
false;
976 drawing::CircleKind eCircleKind;
977 if ( aAny >>= eCircleKind )
979 if ( eCircleKind == drawing::CircleKind_ARC )
980 bSwapLineEnds =
true;
983 if (
GetLineArrow( !bSwapLineEnds, rXPropSet, eLineEnd, nArrowLength, nArrowWidth ) )
988 nLineFlags |= 0x100010;
990 if (
GetLineArrow( bSwapLineEnds, rXPropSet, eLineEnd, nArrowLength, nArrowWidth ) )
995 nLineFlags |= 0x100010;
1001 drawing::LineCap aLineCap(drawing::LineCap_BUTT);
1003 if(aAny >>= aLineCap)
1012 case drawing::LineCap_ROUND:
1017 case drawing::LineCap_SQUARE:
1027 ? *o3tl::doAccess<sal_uInt32>(aAny) : 0;
1033 drawing::LineStyle eLS;
1038 case drawing::LineStyle_NONE :
1042 case drawing::LineStyle_DASH :
1047 auto pLineDash = o3tl::doAccess<drawing::LineDash>(aAny);
1048 switch ( pLineDash->Style )
1050 case drawing::DashStyle_ROUND :
1051 case drawing::DashStyle_ROUNDRELATIVE :
1058 bool bIsConverted =
false;
1059 bool bIsRelative = pLineDash->Style == drawing::DashStyle_RECTRELATIVE
1060 || pLineDash->Style == drawing::DashStyle_ROUNDRELATIVE;
1061 sal_Int16 nDashes = pLineDash->Dashes;
1062 sal_Int16 nDots = pLineDash->Dots;
1063 sal_Int32 nDashLen = pLineDash->DashLen;
1064 sal_Int32 nDotLen = pLineDash->DotLen;
1065 sal_Int32 nDistance = pLineDash->Distance;
1071 if (bIsRelative && nDots == 1)
1076 if (nDashes > 0 && nDashLen == 0)
1080 bIsConverted =
true;
1081 if (nDotLen == 100 && nDashes == 0 && nDashLen == 0 && nDistance == 300)
1083 else if (nDotLen == 400 && nDashes == 0 && nDashLen == 0 && nDistance == 300)
1085 else if (nDotLen == 400 && nDashes == 1 && nDashLen == 100 && nDistance == 300)
1087 else if (nDotLen == 800 && nDashes == 0 && nDashLen == 0 && nDistance == 300)
1089 else if (nDotLen == 800 && nDashes == 1 && nDashLen == 100 && nDistance == 300)
1091 else if (nDotLen == 800 && nDashes == 2 && nDashLen == 100 && nDistance == 300)
1093 else if (nDotLen == 100 && nDashes == 0 && nDashLen == 0 && nDistance == 100)
1095 else if (nDotLen == 300 && nDashes == 0 && nDashLen == 0 && nDistance == 100)
1097 else if (nDotLen == 300 && nDashes == 1 && nDashLen == 100 && nDistance == 100)
1099 else if (nDotLen == 300 && nDashes == 2 && nDashLen == 100 && nDistance == 100)
1102 bIsConverted =
false;
1107 if (((!(pLineDash->Dots)) || (!(pLineDash->Dashes)))
1108 || (pLineDash->DotLen == pLineDash->DashLen))
1110 sal_Int32 nLen = pLineDash->DotLen;
1111 if (pLineDash->Dashes)
1112 nLen = pLineDash->DashLen;
1113 if (nLen >= nDistance)
1115 else if (pLineDash->Dots)
1122 if (pLineDash->Dots != pLineDash->Dashes)
1124 if ((pLineDash->DashLen > nDistance) || (pLineDash->DotLen > nDistance))
1131 if ((pLineDash->DashLen > nDistance) || (pLineDash->DotLen > nDistance))
1142 case drawing::LineStyle_SOLID :
1152 sal_uInt32 nLineColor =
ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAny) );
1161 drawing::LineJoint eLJ;
1166 case drawing::LineJoint_NONE :
1167 case drawing::LineJoint_BEVEL :
1171 case drawing::LineJoint_MIDDLE :
1172 case drawing::LineJoint_MITER :
1175 case drawing::LineJoint_ROUND :
1184 aAny, rXPropSet,
"LineTransparence",
true ) )
1186 sal_Int16 nTransparency = 0;
1187 if ( aAny >>= nTransparency )
1202 if (aPrefMapMode.
GetMapUnit() == MapUnit::MapPixel)
1210 sal_uInt32 nBlibId,
bool bCreateCroppingAttributes )
1214 sal_uInt32 nPicFlags = 0;
1215 drawing::ColorMode eColorMode( drawing::ColorMode_STANDARD );
1216 sal_Int16 nLuminance = 0;
1217 sal_Int32 nContrast = 0;
1220 aAny >>= eColorMode;
1222 aAny >>= nLuminance;
1225 sal_Int16 nC = sal_Int16();
1230 if ( eColorMode == drawing::ColorMode_WATERMARK )
1232 eColorMode = drawing::ColorMode_STANDARD;
1234 if ( nLuminance > 100 )
1237 if ( nContrast < -100 )
1240 if ( eColorMode == drawing::ColorMode_GREYS )
1241 nPicFlags |= 0x40004;
1242 else if ( eColorMode == drawing::ColorMode_MONO )
1243 nPicFlags |= 0x60006;
1248 if ( nContrast == 100)
1249 nContrast = 0x10000;
1250 else if ( nContrast < 100 )
1252 nContrast *= 0x10000;
1255 else if ( nContrast < 200 )
1256 nContrast = ( 100 * 0x10000 ) / ( 200 - nContrast );
1258 nContrast = 0x7fffffff;
1281 text::GraphicCrop aGraphCrop;
1282 if ( !(aAny >>= aGraphCrop) )
1285 if ( aGraphCrop.Left )
1287 sal_uInt32 nLeft = ( aGraphCrop.Left * 65536 ) / aCropSize.
Width();
1290 if ( aGraphCrop.Top )
1292 sal_uInt32 nTop = ( aGraphCrop.Top * 65536 ) / aCropSize.
Height();
1295 if ( aGraphCrop.Right )
1297 sal_uInt32 nRight = ( aGraphCrop.Right * 65536 ) / aCropSize.
Width();
1300 if ( aGraphCrop.Bottom )
1302 sal_uInt32 nBottom = ( aGraphCrop.Bottom * 65536 ) / aCropSize.
Height();
1309 uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
1310 if ( !aXPropSet.is() )
1314 bool bPrintable =
false;
1316 sal_uInt32 nShapeAttr = 0;
1320 nShapeAttr |= 0x20002;
1327 nShapeAttr |= 0x10000;
1335 bool bRetValue =
false;
1342 const Graphic* pGraphic = pOle2Obj->GetGraphic();
1355 bool bRetValue =
false;
1357 if ( !aUniqueId.isEmpty() )
1360 uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
1365 std::unique_ptr<awt::Rectangle> pVisArea;
1368 pVisArea.reset(
new awt::Rectangle);
1385 bool bRetValue =
false;
1389 if (
auto pSdrMediaObj =
dynamic_cast<const SdrMediaObj*
>(pSdrObject))
1400 if (rGraphicObject.
GetType() != GraphicType::NONE)
1405 if (aProvider.
GetBlibID( aMemStrm, rGraphicObject))
1415 uno::Reference<awt::XBitmap>
const & rxBitmap, drawing::BitmapMode eBitmapMode )
1417 uno::Reference<graphic::XGraphic> xGraphic(rxBitmap, uno::UNO_QUERY);
1424 if (aGraphicObject.
GetType() == GraphicType::NONE)
1429 bool bRepeat = eBitmapMode == drawing::BitmapMode_REPEAT;
1445 pVDev->SetOutputSizePixel(
Size(2, 2));
1446 pVDev->EnableOutput(
false);
1447 pVDev->SetMapMode(
MapMode(MapUnit::Map100thMM));
1450 pVDev->SetLineColor();
1451 pVDev->SetFillColor(bFillBackground ? rBackColor : COL_TRANSPARENT);
1452 pVDev->DrawRect(rRect);
1468 Graphic aGraphic(lclDrawHatch(rHatch, rBackColor, bFillBackground, aRect));
1476 const OUString& rSource,
1477 const bool bCreateFillBitmap,
1478 const bool bCreateCroppingAttributes,
1479 const bool bFillBitmapModeAllowed,
1480 const bool bOOxmlExport )
1482 bool bRetValue =
false;
1483 bool bCreateFillStyles =
false;
1485 std::unique_ptr<GraphicAttr> pGraphicAttr;
1486 uno::Reference<graphic::XGraphic> xGraphic;
1492 bool bMirrored =
false;
1493 bool bRotate =
true;
1494 bool bIsGraphicMtf =
false;
1495 sal_Int16 nTransparency(0);
1497 sal_Int16 nGreen(0);
1500 drawing::BitmapMode eBitmapMode(drawing::BitmapMode_NO_REPEAT);
1501 OUString aGraphicUrl;
1503 sal_uInt16 nAngle = 0;
1504 if ( rSource ==
"MetaFile" )
1506 auto &
aSeq = *o3tl::doAccess<uno::Sequence<sal_Int8>>(aAny);
1508 sal_uInt32 nArrayLength =
aSeq.getLength();
1513 if (pArray && nArrayLength)
1518 if ( nErrCode == ERRCODE_NONE )
1521 bIsGraphicMtf = aGraphic.
GetType() == GraphicType::GdiMetafile;
1525 else if (rSource ==
"Bitmap" || rSource ==
"FillBitmap")
1527 auto xBitmap = aAny.get<uno::Reference<awt::XBitmap>>();
1530 xGraphic.set(xBitmap, uno::UNO_QUERY);
1532 bIsGraphicMtf = aGraphic.
GetType() == GraphicType::GdiMetafile;
1535 else if ( rSource ==
"Graphic" )
1537 xGraphic = aAny.get<uno::Reference<graphic::XGraphic>>();
1538 bCreateFillStyles =
true;
1540 else if ( rSource ==
"FillHatch" )
1542 drawing::Hatch aHatch;
1543 if ( aAny >>= aHatch )
1548 aBackColor =
Color(ColorTransparency,
ImplGetColor( *o3tl::doAccess<sal_uInt32>(aAny),
false ));
1550 bool bFillBackground =
false;
1553 aAny >>= bFillBackground;
1557 Graphic aGraphic(lclDrawHatch(aHatch, aBackColor, bFillBackground, aRect));
1559 eBitmapMode = drawing::BitmapMode_REPEAT;
1560 bIsGraphicMtf = aGraphic.
GetType() == GraphicType::GdiMetafile;
1571 aAny >>= nTransparency;
1594 if ( bCreateFillBitmap && bFillBitmapModeAllowed )
1597 aAny >>= eBitmapMode;
1602 ?
static_cast<sal_uInt16
>( ( *o3tl::doAccess<sal_Int32>(aAny) ) + 5 ) / 10
1612 if (!aGraphicUrl.isEmpty())
1614 bool bConverted =
false;
1624 (void)aDescriptor.Detect();
1628 if ( bMirrored || nAngle || nTransparency || nRed || nGreen || nBlue || (1.0 != fGamma) ||
1629 (nFormat != GraphicFileFormat::BMP &&
1630 nFormat != GraphicFileFormat::GIF &&
1631 nFormat != GraphicFileFormat::JPG &&
1632 nFormat != GraphicFileFormat::PNG &&
1633 nFormat != GraphicFileFormat::TIF &&
1634 nFormat != GraphicFileFormat::PCT &&
1635 nFormat != GraphicFileFormat::WMF &&
1636 nFormat != GraphicFileFormat::WMZ &&
1637 nFormat != GraphicFileFormat::EMF &&
1638 nFormat != GraphicFileFormat::EMZ) )
1647 if ( nErrCode == ERRCODE_NONE )
1660 if( aBaseURI.GetProtocol() == aTmp.GetProtocol() )
1663 if ( !aRelUrl.isEmpty() )
1664 aGraphicUrl = aRelUrl;
1669 if (!aGraphicUrl.isEmpty() || xGraphic.is())
1671 if(bMirrored || nTransparency || nRed || nGreen || nBlue || (1.0 != fGamma))
1677 pGraphicAttr->SetMirrorFlags(BmpMirrorFlags::Horizontal);
1682 pGraphicAttr->SetAlpha(255 - (nTransparency * 255) / 100);
1687 pGraphicAttr->SetChannelR(nRed);
1692 pGraphicAttr->SetChannelG(nGreen);
1697 pGraphicAttr->SetChannelB(nBlue);
1702 pGraphicAttr->SetGamma(fGamma);
1706 if(nAngle && bIsGraphicMtf)
1711 if ( eBitmapMode == drawing::BitmapMode_REPEAT )
1713 sal_Int32 nSizeX = 0,nSizeY = 0,nOffsetX = 0,nOffsetY = 0,nPosOffsetX = 0,nPosOffsetY = 0;
1732 aAny >>= nPosOffsetX;
1736 aAny >>= nPosOffsetY;
1738 if(nSizeX == -100 && nSizeY == -100 && nOffsetX == 0 && nOffsetY == 0 && nPosOffsetX == 0 && nPosOffsetY == 0)
1752 sal_uInt32 nPibFlags = 0;
1763 if(bCreateFillBitmap)
1782 if (aProvider.
GetBlibID(aMemStrm, aGraphicObject,
nullptr, pGraphicAttr.get(), bOOxmlExport))
1791 pGraphicAttr.reset();
1792 if ( bCreateFillStyles )
1801 uno::Reference< beans::XPropertySet > aXPropSet;
1802 uno::Any aAny( rXShape->queryInterface(
1805 if ( aAny >>= aXPropSet )
1808 if ( !bHasProperty )
1810 if ( !bHasProperty )
1815 return aRetPolyPoly;
1824 if(
auto pBCC = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rAny))
1828 else if(
auto pCC = o3tl::tryAccess<drawing::PointSequenceSequence>(rAny))
1832 else if(
auto pC = o3tl::tryAccess<drawing::PointSequence>(rAny))
1839 for(sal_uInt32
a(0);
a < aRetval.
count();
a++)
1851 const uno::Reference<beans::XPropertySet> & rXPropSet,
1854 awt::Rectangle& rGeoRect,
1859 if(
nullptr != pPolygon)
1861 aPolyPolygon.
Insert(*pPolygon);
1870 bBezier ? OUString(
"PolyPolygonBezier") : OUString(
"PolyPolygon"),
1881 if(0 == aPolyPolygon.
Count())
1888 if((1 == aPolyPolygon.
Count()) && (2 == aPolyPolygon[0].GetSize()))
1892 rGeoRect = awt::Rectangle(
1895 rPoly[1].
X() - rPoly[0].
X(),
1896 rPoly[1].
Y() - rPoly[0].
Y());
1906 rGeoRect = awt::Rectangle(
1912 const sal_uInt16 nPolyCount(aPolyPolygon.
Count());
1913 sal_uInt32 nTotalPoints(0);
1915 std::vector< sal_uInt8 > aVertices
1929 for(sal_uInt16 j(0); j < nPolyCount; ++j)
1932 const sal_uInt16 nPoints(aPolygon.
GetSize());
1943 sal_uInt16 nSegmentIgnoreCounter(0);
1946 for(sal_uInt16
i(0);
i < nPoints; ++
i)
1948 Point aPoint(aPolygon[
i]);
1950 aPoint.
AdjustX(-(rGeoRect.X));
1951 aPoint.
AdjustY(-(rGeoRect.Y));
1953 aVertices.push_back(
static_cast<sal_uInt8>(aPoint.
X()));
1954 aVertices.push_back(
static_cast<sal_uInt8>(aPoint.
X() >> 8));
1955 aVertices.push_back(
static_cast<sal_uInt8>(aPoint.
Y()));
1956 aVertices.push_back(
static_cast<sal_uInt8>(aPoint.
Y() >> 8));
1960 if(0 != nSegmentIgnoreCounter)
1962 nSegmentIgnoreCounter--;
1977 if(
i + 1 == nPoints)
1990 if(PolyFlags::Control == aPolygon.
GetFlags(
i + 1))
1993 nSegmentIgnoreCounter = 2;
2004 if(0 == nTotalPoints ||
aSegments.size() < 6 || aVertices.size() < 6)
2008 aVertices[0] =
static_cast<sal_uInt8>(nTotalPoints);
2009 aVertices[1] =
static_cast<sal_uInt8>(nTotalPoints >> 8);
2010 aVertices[2] =
static_cast<sal_uInt8>(nTotalPoints);
2011 aVertices[3] =
static_cast<sal_uInt8>(nTotalPoints >> 8);
2016 const sal_uInt32 nSegmentBufSize(
aSegments.size() - 6);
2034 aVertices.size() - 6,
2083 sal_uInt16 k = rPoly.
GetSize();
2084 OSL_ASSERT ( k >= ( 3 +
nIndex ) );
2087 Point aStart = rPoly[0];
2088 Point aEnd = rPoly[k-1];
2089 if ( aEnd.
Y() == aStart.
Y() )
2090 aEnd.
setY( aStart.
Y() +4 );
2091 if ( aEnd.
X() == aStart.
X() )
2092 aEnd.
setX( aStart.
X() +4 );
2094 bool bVertical = ( rPoly[1].X()-aStart.
X() ) == 0 ;
2096 if (
nIndex%2 == 1 ) bVertical = !bVertical;
2097 aPt = rPoly[
nIndex + 1];
2099 sal_Int32 nAdjustValue;
2101 nAdjustValue = ( aPt.
Y()-aStart.
Y())* 21600 /(aEnd.
Y()-aStart.
Y());
2103 nAdjustValue = ( aPt.
X()-aStart.
X() )* 21600 /(aEnd.
X()-aStart.
X());
2105 return nAdjustValue;
2114 switch (nAngle.
get())
2147 Point aStart = rPoly[0];
2149 nAngle = ( rPoly[1].X() == aStart.
X() ) ? 9000: 0 ;
2150 Point p1(aStart.
X(),aStart.
Y());
2158 if ( p1.
X() > p2.
X() )
2166 if ( p1.
Y() > p2.
Y() )
2191 const uno::Reference<drawing::XShape> & rXShape,
2193 sal_uInt16& rShapeType,
ShapeFlag& rShapeFlags )
2195 bool bRetValue =
false;
2201 uno::Reference<beans::XPropertySet> aXPropSet;
2202 uno::Reference<drawing::XShape> aShapeA, aShapeB;
2204 if ( aAny >>= aXPropSet )
2208 drawing::ConnectorType eCt;
2212 awt::Point aStartPoint = *o3tl::doAccess<awt::Point>(aAny);
2215 awt::Point aEndPoint = *o3tl::doAccess<awt::Point>(aAny);
2218 rGeoRect = awt::Rectangle( aStartPoint.X, aStartPoint.Y,
2219 ( aEndPoint.X - aStartPoint.X ) + 1, ( aEndPoint.Y - aStartPoint.Y ) + 1 );
2221 if ( eCt != drawing::ConnectorType_STANDARD)
2223 if ( rGeoRect.Height < 0 )
2226 rGeoRect.Y = aEndPoint.Y;
2227 rGeoRect.Height = -rGeoRect.Height;
2229 if ( rGeoRect.Width < 0 )
2232 rGeoRect.X = aEndPoint.X;
2233 rGeoRect.Width = -rGeoRect.Width;
2236 sal_uInt32 nAdjustValue1, nAdjustValue2;
2237 nAdjustValue1 = nAdjustValue2 = 0x2a30;
2243 rSolverContainer.
AddConnector( rXShape, aStartPoint, aShapeA, aEndPoint, aShapeB );
2246 case drawing::ConnectorType_CURVE :
2255 case drawing::ConnectorType_STANDARD :
2261 if ( aPolyPolygon.
Count() > 0 )
2264 aPoly = aPolyPolygon[ 0 ];
2267 for ( sal_Int32
i = 0 ;
i < nAdjCount; ++
i)
2284 case drawing::ConnectorType_LINE :
2285 case drawing::ConnectorType_LINES :
2303 const uno::Reference<beans::XPropertySet> & rXPropSet )
2307 sal_uInt32 nLineFlags = 0;
2308 sal_uInt32 nFillFlags = 0x10;
2316 sal_uInt32 nShadowFlags = 0x20000;
2317 if ( ( nLineFlags & 8 ) || ( nFillFlags & 0x10 ) || bGraphic )
2340 const std::vector< sal_Int32 >& rEquationOrder,
bool bAdjustTrans )
2343 if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
2346 if ( rParameter.Value >>= fValue )
2347 nValue =
static_cast<sal_Int32
>(fValue);
2350 rParameter.Value >>=
nValue;
2352 switch( rParameter.Type )
2354 case drawing::EnhancedCustomShapeParameterType::EQUATION :
2357 OSL_ASSERT(
nIndex < rEquationOrder.size());
2358 if (
nIndex < rEquationOrder.size() )
2360 nValue =
static_cast<sal_uInt16
>(rEquationOrder[
nIndex ]);
2361 nValue |= sal_uInt32(0x80000000);
2365 case drawing::EnhancedCustomShapeParameterType::ADJUSTMENT:
2369 sal_uInt32 nAdjustValue = 0;
2371 if(bGot)
nValue =
static_cast<sal_Int32
>(nAdjustValue);
2375 case drawing::EnhancedCustomShapeParameterType::NORMAL :
2391 bool bSpecial =
false;
2393 if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
2396 if ( rParameter.Value >>= fValue )
2397 nRetValue =
static_cast<sal_Int32
>(fValue);
2400 rParameter.Value >>= nRetValue;
2402 switch( rParameter.Type )
2404 case drawing::EnhancedCustomShapeParameterType::EQUATION :
2410 case drawing::EnhancedCustomShapeParameterType::ADJUSTMENT :
2416 case drawing::EnhancedCustomShapeParameterType::TOP :
2417 case drawing::EnhancedCustomShapeParameterType::LEFT :
2423 case drawing::EnhancedCustomShapeParameterType::RIGHT :
2424 case drawing::EnhancedCustomShapeParameterType::BOTTOM :
2430 case drawing::EnhancedCustomShapeParameterType::NORMAL :
2441 std::vector< EnhancedCustomShapeEquation >& rEquations,
2442 std::vector< sal_Int32 >& rEquationOrder )
2444 uno::Sequence< OUString > sEquationSource;
2449 *pAny >>= sEquationSource;
2450 sal_Int32 nEquationSourceCount = sEquationSource.getLength();
2451 if ( !(nEquationSourceCount && (nEquationSourceCount <= 128)) )
2455 for (
i = 0;
i < nEquationSourceCount;
i++ )
2461 std::shared_ptr< EnhancedCustomShape::ExpressionNode > aExpressNode(
2462 EnhancedCustomShape::FunctionParser::parseFunction(
2463 sEquationSource[
i ], aCustomShape2d));
2464 drawing::EnhancedCustomShapeParameter aPara( aExpressNode->fillNode( rEquations,
nullptr, 0 ) );
2465 if ( aPara.Type != drawing::EnhancedCustomShapeParameterType::EQUATION )
2470 rEquations.push_back( aEquation );
2477 aEquation.
nPara[ 0 ] = 1;
2478 rEquations.push_back( aEquation );
2484 aEquation.
nPara[ 0 ] = 1;
2485 rEquations.push_back( aEquation );
2487 rEquationOrder.push_back( rEquations.size() - 1 );
2490 for (
auto & equation : rEquations)
2492 sal_uInt32 nMask = 0x20000000;
2493 for(
i = 0;
i < 3;
i++ )
2495 if ( equation.nOperation & nMask )
2497 equation.nOperation ^= nMask;
2498 const size_t nIndex(equation.nPara[
i ] & 0x3ff);
2502 if(
nIndex < rEquationOrder.size())
2504 equation.nPara[
i ] = rEquationOrder[
nIndex ] | 0x400;
2508 OSL_ENSURE(
false,
"Attempted out of bound access to rEquationOrder of CustomShape (!)");
2543 if ( !(pDefCustomShape && pDefCustomShape->
nHandles && pDefCustomShape->
pHandles) )
2546 sal_Int32 k, nkCount = pDefCustomShape->
nHandles;
2548 for ( k = 0; k < nkCount; k++,
pData++ )
2550 if (
pData->nFlags & SvxMSDffHandleFlags::POLAR )
2552 if ( (
pData->nPositionY >= 0x256 ) || (
pData->nPositionY <= 0x107 ) )
2553 nAdjustmentsWhichNeedsToBeConverted |= ( 1 << k );
2560 if ( rkProp.State != beans::PropertyState_DIRECT_VALUE )
2563 bool bUseFixedFloat = ( nAdjustmentsWhichNeedsToBeConverted & ( 1 <<
nIndex ) ) != 0;
2564 if ( rkProp.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
2567 rkProp.Value >>= fValue;
2568 if ( bUseFixedFloat )
2570 nValue =
static_cast<sal_Int32
>(fValue);
2575 if ( bUseFixedFloat )
2584 uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
2585 if ( !aXPropSet.is() )
2589 if(!pSdrObjCustomShape)
2595 uno::Any aGeoPropSet = aXPropSet->getPropertyValue(
"CustomShapeGeometry" );
2596 uno::Sequence< beans::PropertyValue > aGeoPropSeq;
2597 if ( !(aGeoPropSet >>= aGeoPropSeq) )
2600 static constexpr OUStringLiteral sViewBox (
u"ViewBox" );
2601 static constexpr OUStringLiteral sTextRotateAngle (
u"TextRotateAngle" );
2602 static constexpr OUStringLiteral sExtrusion (
u"Extrusion" );
2603 static constexpr OUStringLiteral sEquations (
u"Equations" );
2604 static constexpr OUStringLiteral sPath (
u"Path" );
2605 static constexpr OUStringLiteral sTextPath (
u"TextPath" );
2606 static constexpr OUStringLiteral sHandles (
u"Handles" );
2607 static constexpr OUStringLiteral sAdjustmentValues (
u"AdjustmentValues" );
2609 bool bAdjustmentValuesProp =
false;
2611 bool bPathCoordinatesProp =
false;
2614 sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0;
2615 uno::Sequence< beans::PropertyValues > aHandlesPropSeq;
2616 bool bPredefinedHandlesUsed =
true;
2617 const bool bIsDefaultObject(
2623 std::vector< EnhancedCustomShapeEquation > aEquations;
2624 std::vector< sal_Int32 > aEquationOrder;
2630 sal_Int32
i,
nCount = aGeoPropSeq.getLength();
2633 const beans::PropertyValue& rProp = aGeoPropSeq[
i ];
2634 if ( rProp.Name == sViewBox )
2636 if ( !bIsDefaultObject )
2638 awt::Rectangle aViewBox;
2639 if ( rProp.Value >>= aViewBox )
2648 else if ( rProp.Name == sTextRotateAngle )
2651 if ( rProp.Value >>= f )
2653 double fTextRotateAngle = fmod( f, 360.0 );
2654 if ( fTextRotateAngle < 0 )
2655 fTextRotateAngle = 360 + fTextRotateAngle;
2656 if ( ( fTextRotateAngle < 271.0 ) && ( fTextRotateAngle > 269.0 ) )
2658 else if ( ( fTextRotateAngle < 181.0 ) && ( fTextRotateAngle > 179.0 ) )
2660 else if ( ( fTextRotateAngle < 91.0 ) && ( fTextRotateAngle > 79.0 ) )
2664 else if ( rProp.Name == sExtrusion )
2666 uno::Sequence< beans::PropertyValue > aExtrusionPropSeq;
2667 if ( rProp.Value >>= aExtrusionPropSeq )
2669 sal_uInt32 nLightFaceFlagsOrg, nLightFaceFlags;
2670 sal_uInt32 nFillHarshFlagsOrg, nFillHarshFlags;
2671 nLightFaceFlagsOrg = nLightFaceFlags = 0x000001;
2672 nFillHarshFlagsOrg = nFillHarshFlags = 0x00001e;
2674 nLightFaceFlagsOrg = nLightFaceFlags;
2676 nFillHarshFlagsOrg = nFillHarshFlags;
2678 sal_Int32 r, nrCount = aExtrusionPropSeq.getLength();
2679 for ( r = 0; r < nrCount; r++ )
2681 const beans::PropertyValue& rrProp = aExtrusionPropSeq[ r ];
2683 if ( rrProp.Name == sExtrusion )
2686 if ( rrProp.Value >>= bExtrusionOn )
2688 nLightFaceFlags |= 0x80000;
2690 nLightFaceFlags |= 8;
2692 nLightFaceFlags &=~8;
2695 else if ( rrProp.Name ==
"Brightness" )
2697 double fExtrusionBrightness = 0;
2698 if ( rrProp.Value >>= fExtrusionBrightness )
2701 else if ( rrProp.Name ==
"Depth" )
2704 double fFraction = 0;
2705 drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
2706 if ( ( rrProp.Value >>= aDepthParaPair ) && ( aDepthParaPair.First.Value >>= fDepth ) && ( aDepthParaPair.Second.Value >>= fFraction ) )
2708 double fForeDepth = fDepth * fFraction;
2709 double fBackDepth = fDepth - fForeDepth;
2711 fBackDepth *= 360.0;
2714 if ( fForeDepth != 0.0 )
2716 fForeDepth *= 360.0;
2721 else if ( rrProp.Name ==
"Diffusion" )
2723 double fExtrusionDiffusion = 0;
2724 if ( rrProp.Value >>= fExtrusionDiffusion )
2727 else if ( rrProp.Name ==
"NumberOfLineSegments" )
2729 sal_Int32 nExtrusionNumberOfLineSegments = 0;
2730 if ( rrProp.Value >>= nExtrusionNumberOfLineSegments )
2733 else if ( rrProp.Name ==
"LightFace" )
2735 bool bExtrusionLightFace;
2736 if ( rrProp.Value >>= bExtrusionLightFace )
2738 nLightFaceFlags |= 0x10000;
2739 if ( bExtrusionLightFace )
2740 nLightFaceFlags |= 1;
2742 nLightFaceFlags &=~1;
2745 else if ( rrProp.Name ==
"FirstLightHarsh" )
2747 bool bExtrusionFirstLightHarsh;
2748 if ( rrProp.Value >>= bExtrusionFirstLightHarsh )
2750 nFillHarshFlags |= 0x20000;
2751 if ( bExtrusionFirstLightHarsh )
2752 nFillHarshFlags |= 2;
2754 nFillHarshFlags &=~2;
2757 else if ( rrProp.Name ==
"SecondLightHarsh" )
2759 bool bExtrusionSecondLightHarsh;
2760 if ( rrProp.Value >>= bExtrusionSecondLightHarsh )
2762 nFillHarshFlags |= 0x10000;
2763 if ( bExtrusionSecondLightHarsh )
2764 nFillHarshFlags |= 1;
2766 nFillHarshFlags &=~1;
2769 else if ( rrProp.Name ==
"FirstLightLevel" )
2771 double fExtrusionFirstLightLevel = 0;
2772 if ( rrProp.Value >>= fExtrusionFirstLightLevel )
2775 else if ( rrProp.Name ==
"SecondLightLevel" )
2777 double fExtrusionSecondLightLevel = 0;
2778 if ( rrProp.Value >>= fExtrusionSecondLightLevel )
2781 else if ( rrProp.Name ==
"FirstLightDirection" )
2783 drawing::Direction3D aExtrusionFirstLightDirection;
2784 if ( rrProp.Value >>= aExtrusionFirstLightDirection )
2791 else if ( rrProp.Name ==
"SecondLightDirection" )
2793 drawing::Direction3D aExtrusionSecondLightPosition;
2794 if ( rrProp.Value >>= aExtrusionSecondLightPosition )
2801 else if ( rrProp.Name ==
"Metal" )
2803 bool bExtrusionMetal;
2804 if ( rrProp.Value >>= bExtrusionMetal )
2806 nLightFaceFlags |= 0x40000;
2807 if ( bExtrusionMetal )
2808 nLightFaceFlags |= 4;
2810 nLightFaceFlags &=~4;
2813 else if ( rrProp.Name ==
"ShadeMode" )
2815 drawing::ShadeMode eExtrusionShadeMode;
2816 if ( rrProp.Value >>= eExtrusionShadeMode )
2818 sal_uInt32 nRenderMode;
2819 switch( eExtrusionShadeMode )
2822 case drawing::ShadeMode_FLAT :
2823 case drawing::ShadeMode_PHONG :
2824 case drawing::ShadeMode_SMOOTH :
2827 case drawing::ShadeMode_DRAFT :
2836 else if ( rrProp.Name ==
"RotateAngle" )
2838 double fExtrusionAngleX = 0;
2839 double fExtrusionAngleY = 0;
2840 drawing::EnhancedCustomShapeParameterPair aRotateAnglePair;
2841 if ( ( rrProp.Value >>= aRotateAnglePair ) && ( aRotateAnglePair.First.Value >>= fExtrusionAngleX ) && ( aRotateAnglePair.Second.Value >>= fExtrusionAngleY ) )
2843 fExtrusionAngleX *= 65536;
2844 fExtrusionAngleY *= 65536;
2849 else if ( rrProp.Name ==
"RotationCenter" )
2851 drawing::Direction3D aExtrusionRotationCenter;
2852 if ( rrProp.Value >>= aExtrusionRotationCenter )
2858 nFillHarshFlags &=~8;
2861 else if ( rrProp.Name ==
"Shininess" )
2863 double fExtrusionShininess = 0;
2864 if ( rrProp.Value >>= fExtrusionShininess )
2871 else if ( rrProp.Name ==
"Skew" )
2873 double fSkewAmount = 0;
2874 double fSkewAngle = 0;
2875 drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
2876 if ( ( rrProp.Value >>= aSkewParaPair ) && ( aSkewParaPair.First.Value >>= fSkewAmount ) && ( aSkewParaPair.Second.Value >>= fSkewAngle ) )
2882 else if ( rrProp.Name ==
"Specularity" )
2884 double fExtrusionSpecularity = 0;
2885 if ( rrProp.Value >>= fExtrusionSpecularity )
2888 else if ( rrProp.Name ==
"ProjectionMode" )
2890 drawing::ProjectionMode eExtrusionProjectionMode;
2891 if ( rrProp.Value >>= eExtrusionProjectionMode )
2893 nFillHarshFlags |= 0x40000;
2894 if ( eExtrusionProjectionMode == drawing::ProjectionMode_PARALLEL )
2895 nFillHarshFlags |= 4;
2897 nFillHarshFlags &=~4;
2900 else if ( rrProp.Name ==
"ViewPoint" )
2902 drawing::Position3D aExtrusionViewPoint;
2903 if ( rrProp.Value >>= aExtrusionViewPoint )
2905 aExtrusionViewPoint.PositionX *= 360.0;
2906 aExtrusionViewPoint.PositionY *= 360.0;
2907 aExtrusionViewPoint.PositionZ *= 360.0;
2913 else if ( rrProp.Name ==
"Origin" )
2915 double fExtrusionOriginX = 0;
2916 double fExtrusionOriginY = 0;
2917 drawing::EnhancedCustomShapeParameterPair aOriginPair;
2918 if ( ( rrProp.Value >>= aOriginPair ) && ( aOriginPair.First.Value >>= fExtrusionOriginX ) && ( aOriginPair.Second.Value >>= fExtrusionOriginY ) )
2924 else if ( rrProp.Name ==
"Color" )
2926 bool bExtrusionColor;
2927 if ( rrProp.Value >>= bExtrusionColor )
2929 nLightFaceFlags |= 0x20000;
2930 if ( bExtrusionColor )
2932 nLightFaceFlags |= 2;
2936 sal_uInt32 nFillColor =
ImplGetColor( *o3tl::doAccess<sal_uInt32>(aFillColor2) );
2941 nLightFaceFlags &=~2;
2945 if ( nLightFaceFlags != nLightFaceFlagsOrg )
2947 if ( nFillHarshFlags != nFillHarshFlagsOrg )
2951 else if ( rProp.Name == sEquations )
2953 if ( !bIsDefaultObject )
2955 sal_uInt16
nElements =
static_cast<sal_uInt16
>(aEquations.size());
2958 sal_uInt16 nElementSize = 8;
2959 sal_uInt32 nStreamSize = nElementSize *
nElements + 6;
2965 for (
auto const& equation : aEquations)
2990 else if ( rProp.Name == sPath )
2992 uno::Sequence< beans::PropertyValue > aPathPropSeq;
2993 if ( rProp.Value >>= aPathPropSeq )
2995 sal_uInt32 nPathFlags, nPathFlagsOrg;
2996 nPathFlagsOrg = nPathFlags = 0x39;
2998 nPathFlagsOrg = nPathFlags;
3000 sal_Int32 r, nrCount = aPathPropSeq.getLength();
3001 for ( r = 0; r < nrCount; r++ )
3003 const beans::PropertyValue& rrProp = aPathPropSeq[ r ];
3005 if ( rrProp.Name ==
"ExtrusionAllowed" )
3007 bool bExtrusionAllowed;
3008 if ( rrProp.Value >>= bExtrusionAllowed )
3010 nPathFlags |= 0x100000;
3011 if ( bExtrusionAllowed )
3017 else if ( rrProp.Name ==
"ConcentricGradientFillAllowed" )
3019 bool bConcentricGradientFillAllowed;
3020 if ( rrProp.Value >>= bConcentricGradientFillAllowed )
3022 nPathFlags |= 0x20000;
3023 if ( bConcentricGradientFillAllowed )
3029 else if ( rrProp.Name ==
"TextPathAllowed" )
3031 bool bTextPathAllowed;
3032 if ( rrProp.Value >>= bTextPathAllowed )
3034 nPathFlags |= 0x40000;
3035 if ( bTextPathAllowed )
3041 else if ( rrProp.Name ==
"Coordinates" )
3043 if ( !bIsDefaultObject )
3045 aPathCoordinatesProp = rrProp.
Value;
3046 bPathCoordinatesProp =
true;
3049 else if ( rrProp.Name ==
"GluePoints" )
3051 if ( !bIsDefaultObject )
3053 uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aGluePoints;
3054 if ( rrProp.Value >>= aGluePoints )
3057 sal_uInt16
nElements =
static_cast<sal_uInt16
>(aGluePoints.getLength());
3060 sal_uInt16 j, nElementSize = 8;
3061 sal_uInt32 nStreamSize = nElementSize *
nElements + 6;
3083 else if ( rrProp.Name ==
"GluePointType" )
3085 sal_Int16 nGluePointType = sal_Int16();
3086 if ( rrProp.Value >>= nGluePointType )
3089 else if ( rrProp.Name ==
"Segments" )
3091 if ( !bIsDefaultObject )
3093 uno::Sequence<drawing::EnhancedCustomShapeSegment>
aSegments;
3100 sal_uInt16 nElementSize = 2;
3101 sal_uInt32 nStreamSize = nElementSize *
nElements + 6;
3115 sal_uInt16 nVal =
static_cast<sal_uInt16
>(
aSegments[ j ].Count);
3119 case drawing::EnhancedCustomShapeSegmentCommand::LINETO :
3121 case drawing::EnhancedCustomShapeSegmentCommand::MOVETO :
3124 case drawing::EnhancedCustomShapeSegmentCommand::CURVETO :
3129 case drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH :
3135 case drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH :
3140 case drawing::EnhancedCustomShapeSegmentCommand::NOFILL :
3145 case drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE :
3150 case drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
3156 case drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
3162 case drawing::EnhancedCustomShapeSegmentCommand::ARCTO :
3168 case drawing::EnhancedCustomShapeSegmentCommand::ARC :
3174 case drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
3180 case drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
3186 case drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
3191 case drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
3209 else if ( rrProp.Name ==
"StretchX" )
3211 if ( !bIsDefaultObject )
3213 sal_Int32 nStretchX = 0;
3214 if ( rrProp.Value >>= nStretchX )
3218 else if ( rrProp.Name ==
"StretchY" )
3220 if ( !bIsDefaultObject )
3222 sal_Int32 nStretchY = 0;
3223 if ( rrProp.Value >>= nStretchY )
3227 else if ( rrProp.Name ==
"TextFrames" )
3229 if ( !bIsDefaultObject )
3231 uno::Sequence<drawing::EnhancedCustomShapeTextFrame> aPathTextFrames;
3232 if ( rrProp.Value >>= aPathTextFrames )
3234 if ( aPathTextFrames.hasElements() )
3236 sal_uInt16 j,
nElements =
static_cast<sal_uInt16
>(aPathTextFrames.getLength());
3237 sal_uInt16 nElementSize = 16;
3238 sal_uInt32 nStreamSize = nElementSize *
nElements + 6;
3266 if ( nPathFlags != nPathFlagsOrg )
3270 else if ( rProp.Name == sTextPath )
3272 uno::Sequence< beans::PropertyValue > aTextPathPropSeq;
3273 if ( rProp.Value >>= aTextPathPropSeq )
3275 sal_uInt32 nTextPathFlagsOrg, nTextPathFlags;
3276 nTextPathFlagsOrg = nTextPathFlags = 0xffff1000;
3278 nTextPathFlagsOrg = nTextPathFlags;
3280 sal_Int32 r, nrCount = aTextPathPropSeq.getLength();
3281 for ( r = 0; r < nrCount; r++ )
3283 const beans::PropertyValue& rrProp = aTextPathPropSeq[ r ];
3285 if ( rrProp.Name == sTextPath )
3288 if ( rrProp.Value >>= bTextPathOn )
3290 nTextPathFlags |= 0x40000000;
3293 nTextPathFlags |= 0x4000;
3295 sal_uInt32 nPathFlags = 0x39;
3297 nPathFlags |= 0x40004;
3301 nTextPathFlags &=~0x4000;
3304 else if ( rrProp.Name ==
"TextPathMode" )
3306 drawing::EnhancedCustomShapeTextPathMode eTextPathMode;
3307 if ( rrProp.Value >>= eTextPathMode )
3309 nTextPathFlags |= 0x05000000;
3310 nTextPathFlags &=~0x500;
3311 if ( eTextPathMode == drawing::EnhancedCustomShapeTextPathMode_PATH )
3312 nTextPathFlags |= 0x100;
3313 else if ( eTextPathMode == drawing::EnhancedCustomShapeTextPathMode_SHAPE )
3314 nTextPathFlags |= 0x500;
3317 else if ( rrProp.Name ==
"ScaleX" )
3319 bool bTextPathScaleX;
3320 if ( rrProp.Value >>= bTextPathScaleX )
3322 nTextPathFlags |= 0x00400000;
3323 if ( bTextPathScaleX )
3324 nTextPathFlags |= 0x40;
3326 nTextPathFlags &=~0x40;
3329 else if ( rrProp.Name ==
"SameLetterHeights" )
3331 bool bSameLetterHeights;
3332 if ( rrProp.Value >>= bSameLetterHeights )
3334 nTextPathFlags |= 0x00800000;
3335 if ( bSameLetterHeights )
3336 nTextPathFlags |= 0x80;
3338 nTextPathFlags &=~0x80;
3342 if ( nTextPathFlags & 0x4000 )
3346 uno::Reference< text::XSimpleText > xText( rXShape, uno::UNO_QUERY );
3348 aText = xText->getString();
3349 if ( aText.isEmpty() )
3350 aText =
"your text";
3355 uno::Any aAny = aXPropSet->getPropertyValue(
"CharFontName" );
3357 if ( aFontName.isEmpty() )
3358 aFontName =
"Arial Black";
3363 sal_Int16 nCharScaleWidth = 100;
3364 if ( aAny >>= nCharScaleWidth )
3366 if ( nCharScaleWidth != 100 )
3368 sal_Int32 nVal = nCharScaleWidth * 655;
3375 float fCharHeight = 0.0;
3376 if ( aAny >>= fCharHeight )
3378 sal_Int32 nTextSize =
static_cast< sal_Int32
> ( fCharHeight * 65536 );
3384 sal_Int16 nCharKerning = sal_Int16();
3385 if ( aAny >>= nCharKerning )
3387 nTextPathFlags |= 0x10000000;
3389 nTextPathFlags |= 0x1000;
3391 nTextPathFlags &=~0x1000;
3396 awt::FontSlant eFontSlant;
3397 if ( aAny >>= eFontSlant )
3399 nTextPathFlags |= 0x100010;
3400 if ( eFontSlant != awt::FontSlant_NONE )
3401 nTextPathFlags |= 0x10;
3403 nTextPathFlags &=~0x10;
3408 float fFontWidth = 0;
3409 if ( aAny >>= fFontWidth )
3411 nTextPathFlags |= 0x200020;
3412 if ( fFontWidth > awt::FontWeight::NORMAL )
3413 nTextPathFlags |= 0x20;
3415 nTextPathFlags &=~0x20;
3422 drawing::TextHorizontalAdjust eHA( drawing::TextHorizontalAdjust_LEFT );
3426 case drawing::TextHorizontalAdjust_LEFT :
3429 case drawing::TextHorizontalAdjust_CENTER:
3432 case drawing::TextHorizontalAdjust_RIGHT:
3435 case drawing::TextHorizontalAdjust_BLOCK:
3437 drawing::TextFitToSizeType
const eFTS(
3439 if (eFTS == drawing::TextFitToSizeType_ALLLINES ||
3440 eFTS == drawing::TextFitToSizeType_PROPORTIONAL)
3456 if((nTextPathFlags & 0x4000) != 0)
3460 nTextPathFlags |= 0x2000;
3468 if ( nTextPathFlags != nTextPathFlagsOrg )
3472 else if ( rProp.Name == sHandles )
3474 if ( !bIsDefaultObject )
3476 bPredefinedHandlesUsed =
false;
3477 if ( rProp.Value >>= aHandlesPropSeq )
3479 sal_uInt16
nElements =
static_cast<sal_uInt16
>(aHandlesPropSeq.getLength());
3482 sal_uInt16 k, nElementSize = 36;
3483 sal_uInt32 nStreamSize = nElementSize *
nElements + 6;
3491 sal_uInt32 nFlags = 0;
3492 sal_Int32 nXPosition = 0;
3493 sal_Int32 nYPosition = 0;
3494 sal_Int32 nXMap = 0;
3495 sal_Int32 nYMap = 0;
3496 sal_Int32 nXRangeMin = 0x80000000;
3497 sal_Int32 nXRangeMax = 0x7fffffff;
3498 sal_Int32 nYRangeMin = 0x80000000;
3499 sal_Int32 nYRangeMax = 0x7fffffff;
3501 const uno::Sequence< beans::PropertyValue >& rPropSeq = aHandlesPropSeq[ k ];
3502 for (
const beans::PropertyValue& rPropVal: rPropSeq )
3504 if ( rPropVal.Name ==
"Position" )
3506 drawing::EnhancedCustomShapeParameterPair aPosition;
3507 if ( rPropVal.Value >>= aPosition )
3513 else if ( rPropVal.Name ==
"MirroredX" )
3516 if ( rPropVal.Value >>= bMirroredX )
3522 else if ( rPropVal.Name ==
"MirroredY" )
3525 if ( rPropVal.Value >>= bMirroredY )
3531 else if ( rPropVal.Name ==
"Switched" )
3534 if ( rPropVal.Value >>= bSwitched )
3540 else if ( rPropVal.Name ==
"Polar" )
3542 drawing::EnhancedCustomShapeParameterPair aPolar;
3543 if ( rPropVal.Value >>= aPolar )
3552 else if ( rPropVal.Name ==
"RadiusRangeMinimum" )
3554 nYRangeMin = sal_Int32(0xff4c0000);
3555 nYRangeMax = sal_Int32(0x00b40000);
3557 drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
3558 if ( rPropVal.Value >>= aRadiusRangeMinimum )
3565 else if ( rPropVal.Name ==
"RadiusRangeMaximum" )
3567 nYRangeMin = sal_Int32(0xff4c0000);
3568 nYRangeMax = sal_Int32(0x00b40000);
3570 drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
3571 if ( rPropVal.Value >>= aRadiusRangeMaximum )
3578 else if ( rPropVal.Name ==
"RangeXMinimum" )
3580 drawing::EnhancedCustomShapeParameter aXRangeMinimum;
3581 if ( rPropVal.Value >>= aXRangeMinimum )
3588 else if ( rPropVal.Name ==
"RangeXMaximum" )
3590 drawing::EnhancedCustomShapeParameter aXRangeMaximum;
3591 if ( rPropVal.Value >>= aXRangeMaximum )
3598 else if ( rPropVal.Name ==
"RangeYMinimum" )
3600 drawing::EnhancedCustomShapeParameter aYRangeMinimum;
3601 if ( rPropVal.Value >>= aYRangeMinimum )
3608 else if ( rPropVal.Name ==
"RangeYMaximum" )
3610 drawing::EnhancedCustomShapeParameter aYRangeMaximum;
3611 if ( rPropVal.Value >>= aYRangeMaximum )
3630 nAdjustmentsWhichNeedsToBeConverted |= ( 1 << ( nYPosition - 0x100 ) );
3642 else if ( rProp.Name == sAdjustmentValues )
3646 aAdjustmentValuesProp = rProp.
Value;
3647 bAdjustmentValuesProp =
true;
3650 if ( bAdjustmentValuesProp )
3652 uno::Sequence<drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentSeq;
3653 if ( aAdjustmentValuesProp >>= aAdjustmentSeq )
3655 if ( bPredefinedHandlesUsed )
3658 sal_Int32 k,
nValue = 0, nAdjustmentValues = aAdjustmentSeq.getLength();
3659 for ( k = 0; k < nAdjustmentValues; k++ )
3664 if( !bPathCoordinatesProp )
3667 uno::Sequence<drawing::EnhancedCustomShapeParameterPair> aCoordinates;
3668 if ( !(aPathCoordinatesProp >>= aCoordinates) )
3672 if (aCoordinates.hasElements())
3674 sal_uInt16 j,
nElements =
static_cast<sal_uInt16
>(aCoordinates.getLength());
3675 sal_uInt16 nElementSize = 8;
3676 sal_uInt32 nStreamSize = nElementSize *
nElements + 6;
3701 uno::Reference< beans::XPropertySet > aXPropSet( rXShape, uno::UNO_QUERY );
3702 if ( aXPropSet.is() )
3706 uno::Any aGeoPropSet = aXPropSet->getPropertyValue(
"CustomShapeGeometry" );
3707 uno::Sequence< beans::PropertyValue > aGeoPropSeq;
3708 if ( aGeoPropSet >>= aGeoPropSeq )
3710 sal_Int32
i,
nCount = aGeoPropSeq.getLength();
3713 const beans::PropertyValue& rProp = aGeoPropSeq[
i ];
3714 if ( rProp.Name ==
"Type" )
3716 if ( rProp.Value >>= rShapeType )
3731 else if ( rProp.Name ==
"MirroredX" )
3734 if ( ( rProp.Value >>= bMirroredX ) && bMirroredX )
3737 else if ( rProp.Name ==
"MirroredY" )
3740 if ( ( rProp.Value >>= bMirroredY ) && bMirroredY )
3746 catch(
const uno::Exception& )
3756 const uno::Reference<drawing::XShape> & rXShape)
3793 [&nID](
const auto& rxEntry) { return rxEntry->mnID == nID; });
3798 maPersistTable.push_back( std::make_unique<EscherPersistEntry>( nID, nOfs ) );
3804 [&nID](
const std::unique_ptr<EscherPersistEntry>& rxEntry) { return rxEntry->mnID == nID; });
3812 if ( pPtr->mnID == nID ) {
3813 return pPtr->mnOffset;
3822 if ( pPtr->mnID == nID ) {
3823 pPtr->mnOffset = nOfs;
3832 if ( pPtr->mnID == nID ) {
3833 pPtr->mnOffset = nOfs;
3842 const uno::Reference<beans::XPropertySet> & rXPropSet,
3843 const OUString& rString,
3844 bool bTestPropertyAvailability)
3846 bool bRetValue =
true;
3847 if ( bTestPropertyAvailability )
3852 uno::Reference<beans::XPropertySetInfo>
3853 aXPropSetInfo( rXPropSet->getPropertySetInfo() );
3854 if ( aXPropSetInfo.is() )
3855 bRetValue = aXPropSetInfo->hasPropertyByName( rString );
3857 catch(
const uno::Exception& )
3866 rAny = rXPropSet->getPropertyValue( rString );
3870 catch(
const uno::Exception& )
3879 const uno::Reference<beans::XPropertySet> & rXPropSet,
3880 const OUString& rPropertyName )
3882 beans::PropertyState eRetValue = beans::PropertyState_AMBIGUOUS_VALUE;
3885 uno::Reference<beans::XPropertyState> aXPropState
3886 ( rXPropSet, uno::UNO_QUERY );
3887 if ( aXPropState.is() )
3888 eRetValue = aXPropState->getPropertyState( rPropertyName );
3890 catch(
const uno::Exception& )
3898 maPrefMapMode ( rObject.GetPrefMapMode() ),
3899 maPrefSize ( rObject.GetPrefSize() ),
3900 mnPictureOffset ( nPictureOffset ),
3909 sal_uInt32 nLen =
static_cast<sal_uInt32
>(rId.getLength());
3910 const char*
pData = rId.getStr();
3912 if (!(nLen && (
eType != GraphicType::NONE)))
3948 sal_uInt32
i, nTmp,
n1,
n2;
3950 for (
i = 0;
i < nLen;
i++ )
3966 sal_uInt32 nPictureOffset = bWritePictureOffset ?
mnPictureOffset : 0;
3996 for (
int i = 0;
i < 3;
i++ )
4023 mvBlibEntrys.push_back( std::unique_ptr<EscherBlibEntry>(p_EscherBlibEntry) );
4030 if ( pMergePicStreamBSE )
4039 sal_uInt32 nBlipId, sal_uInt32 nResize)
4043 mvBlibEntrys[nBlipId-1]->WriteBlibEntry(rSt,
true, nResize);
4055 if ( pMergePicStreamBSE )
4057 sal_uInt32 nBlipSize, nOldPos = pMergePicStreamBSE->
Tell();
4058 const sal_uInt32 nBuf = 0x40000;
4059 std::unique_ptr<sal_uInt8[]> pBuf(
new sal_uInt8[ nBuf ]);
4078 DBG_ASSERT( n16 ==
ESCHER_BlipFirst + nBlibType ,
"EscherGraphicProvider::WriteBlibStoreContainer: BLIP record types differ" );
4084 DBG_ASSERT( nBlipSize == n32,
"EscherGraphicProvider::WriteBlibStoreContainer: BLIP sizes differ" );
4088 sal_uInt32 nBytes = std::min( nBlipSize, nBuf );
4089 pMergePicStreamBSE->
ReadBytes(pBuf.get(), nBytes);
4091 nBlipSize -= nBytes;
4094 pMergePicStreamBSE->
Seek( nOldPos );
4105 bool bInRange = nBlibId && ( ( nBlibId - 1 ) <
mvBlibEntrys.size() );
4116 const awt::Rectangle* pVisArea,
4117 const GraphicAttr* pGraphicAttr,
const bool bOOxmlExport )
4119 sal_uInt32 nBlibId = 0;
4121 std::unique_ptr<EscherBlibEntry> p_EscherBlibEntry(
new EscherBlibEntry( rPicOutStrm.
Tell(), rGraphicObject, rGraphicObject.
GetUniqueID(), pGraphicAttr ) );
4122 if ( !p_EscherBlibEntry->IsEmpty() )
4133 bool bUseNativeGraphic(
false );
4141 if ( p_EscherBlibEntry->mbIsNativeGraphicPossible && aGraphic.
IsGfxLink() )
4145 p_EscherBlibEntry->mnSize = aGraphicLink.
GetDataSize();
4146 pGraphicAry = aGraphicLink.
GetData();
4148 if ( p_EscherBlibEntry->mnSize && pGraphicAry )
4150 switch ( aGraphicLink.
GetType() )
4152 case GfxLinkType::NativeJpg : p_EscherBlibEntry->meBlibType =
PEG;
break;
4153 case GfxLinkType::NativePng : p_EscherBlibEntry->meBlibType =
PNG;
break;
4163 case GfxLinkType::NativeWmf :
4165 if ( aGraphicLink.
IsEMF() )
4167 p_EscherBlibEntry->meBlibType =
EMF;
4169 else if ( pGraphicAry && ( p_EscherBlibEntry->mnSize > 0x2c ) )
4171 p_EscherBlibEntry->meBlibType =
WMF;
4172 if ( ( pGraphicAry[ 0 ] == 0xd7 ) && ( pGraphicAry[ 1 ] == 0xcd )
4173 && ( pGraphicAry[ 2 ] == 0xc6 ) && ( pGraphicAry[ 3 ] == 0x9a ) )
4176 p_EscherBlibEntry->mnSize -= 22;
4183 if ( p_EscherBlibEntry->meBlibType !=
UNKNOWN )
4184 bUseNativeGraphic =
true;
4187 if ( !bUseNativeGraphic )
4190 if ( ( eGraphicType == GraphicType::Bitmap ) || ( eGraphicType == GraphicType::GdiMetafile ) )
4194 nErrCode =
GraphicConverter::Export( aStream, aGraphic, ( eGraphicType == GraphicType::Bitmap ) ? ConvertDataFormat::PNG : ConvertDataFormat::EMF );
4199 const char*
const pString =
"MSOFFICE9.0";
4200 aGIFStream.
WriteBytes(pString, strlen(pString));
4205 "ExportGraphic to GIF failed with " << nErrCode);
4208 sal_uInt32 nGIFSreamLen = aGIFStream.
Tell();
4209 uno::Sequence<sal_Int8> aGIFSeq( nGIFSreamLen );
4210 sal_Int8* pSeq = aGIFSeq.getArray();
4212 aGIFStream.
ReadBytes(pSeq, nGIFSreamLen);
4213 beans::PropertyValue aChunkProp, aFilterProp;
4214 aChunkProp.Name =
"msOG";
4215 aChunkProp.Value <<= aGIFSeq;
4216 uno::Sequence<beans::PropertyValue> aAdditionalChunkSequence{ aChunkProp };
4217 aFilterProp.Name =
"AdditionalChunks";
4218 aFilterProp.Value <<= aAdditionalChunkSequence;
4219 uno::Sequence<beans::PropertyValue> aFilterData{ aFilterProp };
4226 p_EscherBlibEntry->meBlibType = ( eGraphicType == GraphicType::Bitmap ) ?
PNG :
EMF;
4227 p_EscherBlibEntry->mnSize = aStream.
TellEnd();
4234 if ( p_EscherBlibEntry->mnSize && pGraphicAry && ( eBlibType !=
UNKNOWN ) )
4236 sal_uInt32 nExtra, nAtomSize = 0;
4237 sal_uInt32 nInstance, nUncompressedSize = p_EscherBlibEntry->mnSize;
4243 nAtomSize = rPicOutStrm.
Tell();
4244 if ( eBlibType ==
PNG )
4246 else if ( eBlibType ==
WMF )
4248 else if ( eBlibType ==
EMF )
4250 else if ( eBlibType ==
PEG )
4255 if ( ( eBlibType ==
PEG ) || ( eBlibType ==
PNG )
4256 || ( ( ( eBlibType ==
WMF ) || ( eBlibType ==
EMF ) ) && bOOxmlExport ) )
4259 p_EscherBlibEntry->mnSizeExtra = nExtra + 8;
4264 if( eBlibType ==
PNG )
4266 nInstance = 0xf01e6e00;
4270 nInstance = 0xf01d46a0;
4282 rPicOutStrm.
WriteBytes(p_EscherBlibEntry->mnIdentifier, 16);
4284 rPicOutStrm.
WriteBytes(pGraphicAry, p_EscherBlibEntry->mnSize);
4288 ZCodec aZCodec( 0x8000, 0x8000 );
4291 aZCodec.
Write( aDestStrm, pGraphicAry, p_EscherBlibEntry->mnSize );
4293 p_EscherBlibEntry->mnSize = aDestStrm.
TellEnd();
4295 if ( p_EscherBlibEntry->mnSize && pGraphicAry )
4297 nExtra = eBlibType ==
WMF ? 0x42 : 0x32;
4298 p_EscherBlibEntry->mnSizeExtra = nExtra + 8;
4299 nInstance = ( eBlibType ==
WMF ) ? 0xf01b2170 : 0xf01a3d40;
4301 if ( eBlibType ==
WMF )
4302 rPicOutStrm.
WriteBytes(p_EscherBlibEntry->mnIdentifier, 16);
4303 rPicOutStrm.
WriteBytes(p_EscherBlibEntry->mnIdentifier, 16);
4316 sal_uInt32 nPrefWidth = p_EscherBlibEntry->maPrefSize.Width();
4317 sal_uInt32 nPrefHeight = p_EscherBlibEntry->maPrefSize.Height();
4318 sal_uInt32 nWidth, nHeight;
4321 nWidth = pVisArea->Width * 360;
4322 nHeight = pVisArea->Height * 360;
4326 Size aPrefSize(
lcl_SizeToEmu(p_EscherBlibEntry->maPrefSize, p_EscherBlibEntry->maPrefMapMode));
4327 nWidth = aPrefSize.
Width() * 360;
4328 nHeight = aPrefSize.
Height() * 360;
4339 rPicOutStrm.
WriteBytes(pGraphicAry, p_EscherBlibEntry->mnSize);
4344 sal_uInt32
nPos = rPicOutStrm.
Tell();
4345 rPicOutStrm.
Seek( nAtomSize - 4 );
4357struct EscherConnectorRule
4383 sal_uInt16 nClosest =
nCount;
4384 double fDist = sal_uInt32(0xffffffff);
4387 double fDistance = hypot( rPoint.X - rPoly[
nCount ].X(), rPoint.Y - rPoly[
nCount ].Y() );
4388 if ( fDistance < fDist )
4407 sal_uInt32 nRule = 0;
4411 uno::Reference<drawing::XShape>
4414 OUString aString(aXShape->getShapeType());
4416 aBuf.remove( 0, 13 );
4417 sal_Int16
nPos =
aBuf.toString().indexOf(
"Shape");
4419 OString aType =
aBuf.makeStringAndClear();
4421 uno::Reference<beans::XPropertySet>
4422 aPropertySet( aXShape, uno::UNO_QUERY );
4424 if ((aType ==
"drawing.PolyPolygon") || (aType ==
"drawing.PolyLine"))
4426 if ( aPropertySet.is() )
4430 auto pSourcePolyPolygon =
4431 o3tl::doAccess<drawing::PointSequenceSequence>(aAny);
4432 sal_Int32 nOuterSequenceCount = pSourcePolyPolygon->getLength();
4433 drawing::PointSequence
const * pOuterSequence = pSourcePolyPolygon->getConstArray();
4435 if ( pOuterSequence )
4438 sal_uInt32 nDistance = 0xffffffff;
4439 for(
a = 0;
a < nOuterSequenceCount;
a++ )
4441 drawing::PointSequence
const * pInnerSequence = pOuterSequence++;
4442 if ( pInnerSequence )
4444 awt::Point
const * pArray = pInnerSequence->getConstArray();
4447 for ( b = 0; b < pInnerSequence->getLength(); b++,
nIndex++, pArray++ )
4449 sal_uInt32 nDist =
static_cast<sal_uInt32
>(hypot( aRefPoint.X - pArray->X, aRefPoint.Y - pArray->Y ));
4450 if ( nDist < nDistance )
4463 else if ((aType ==
"drawing.OpenBezier") || (aType ==
"drawing.OpenFreeHand") || (aType ==
"drawing.PolyLinePath")
4464 || (aType ==
"drawing.ClosedBezier") || ( aType ==
"drawing.ClosedFreeHand") || (aType ==
"drawing.PolyPolygonPath") )
4466 uno::Reference<beans::XPropertySet>
4467 aPropertySet2( aXShape, uno::UNO_QUERY );
4468 if ( aPropertySet2.is() )
4472 auto pSourcePolyPolygon =
4473 o3tl::doAccess<drawing::PolyPolygonBezierCoords>(aAny);
4474 sal_Int32 nOuterSequenceCount = pSourcePolyPolygon->Coordinates.getLength();
4477 drawing::PointSequence
const * pOuterSequence =
4478 pSourcePolyPolygon->Coordinates.getConstArray();
4479 drawing::FlagSequence
const * pOuterFlags =
4480 pSourcePolyPolygon->Flags.getConstArray();
4482 if ( pOuterSequence && pOuterFlags )
4485 sal_uInt32 nDistance = 0xffffffff;
4487 for (
a = 0;
a < nOuterSequenceCount;
a++ )
4489 drawing::PointSequence
const * pInnerSequence = pOuterSequence++;
4490 drawing::FlagSequence
const * pInnerFlags = pOuterFlags++;
4491 if ( pInnerSequence && pInnerFlags )
4493 awt::Point
const * pArray = pInnerSequence->getConstArray();
4494 drawing::PolygonFlags
const * pFlags = pInnerFlags->getConstArray();
4495 if ( pArray && pFlags )
4497 for ( b = 0; b < pInnerSequence->getLength(); b++, pArray++ )
4499 drawing::PolygonFlags ePolyFlags = *pFlags++;
4500 if ( ePolyFlags == drawing::PolygonFlags_CONTROL )
4502 sal_uInt32 nDist =
static_cast<sal_uInt32
>(hypot( aRefPoint.X - pArray->X, aRefPoint.Y - pArray->Y ));
4503 if ( nDist < nDistance )
4519 bool bRectangularConnection =
true;
4521 if (aType ==
"drawing.Custom")
4528 OUString sShapeType;
4531 *pType >>= sShapeType;
4536 sal_Int16 nGluePointType = sal_Int16();
4537 if ( !( pGluePointType &&
4538 ( *pGluePointType >>= nGluePointType ) ) )
4541 if ( nGluePointType == drawing::EnhancedCustomShapeGluePointType::CUSTOM )
4547 sal_uInt16 nNum, nCnt = pList->
GetCount();
4550 for ( nNum = 0; nNum < nCnt; nNum++ )
4557 bRectangularConnection =
false;
4561 else if ( nGluePointType == drawing::EnhancedCustomShapeGluePointType::SEGMENTS )
4575 pTemporaryConvertResultObject.clear();
4576 pSdrPathObj =
nullptr;
4578 if(0 != aPolyPoly.
Count())
4582 sal_uInt32 nDistance = 0xffffffff;
4584 for (
a = 0;
a < aPolyPoly.
Count();
a++ )
4587 for ( b = 0; b < rPoly.
GetSize(); b++ )
4589 if ( rPoly.
GetFlags( b ) != PolyFlags::Normal )
4591 const Point& rPt = rPoly[ b ];
4592 sal_uInt32 nDist =
static_cast<sal_uInt32
>(hypot( aRefPoint.X - rPt.
X(), aRefPoint.Y - rPt.
Y() ));
4593 if ( nDist < nDistance )
4602 if ( nDistance != 0xffffffff )
4603 bRectangularConnection =
false;
4608 if ( bRectangularConnection )
4610 awt::Point aPoint( aXShape->getPosition() );
4611 awt::Size aSize( aXShape->getSize() );
4617 aPoly[ 0 ] =
Point( aCenter.
X(), aRect.
Top() );
4618 aPoly[ 1 ] =
Point( aRect.
Left(), aCenter.
Y() );
4623 ? *o3tl::doAccess<sal_Int32>(aAny) : 0;
4628 if (aType ==
"drawing.Ellipse")
4645 maShapeList.push_back( std::make_unique<EscherShapeListEntry>( rXShape,
nId ) );
4649 const uno::Reference<drawing::XShape> & rConnector,
4650 const awt::Point& rPA,
4651 uno::Reference<drawing::XShape>
const & rConA,
4652 const awt::Point& rPB,
4653 uno::Reference<drawing::XShape>
const & rConB
4656 maConnectorList.push_back( std::make_unique<EscherConnectorListEntry>( rConnector, rPA, rConA, rPB, rConB ) );
4663 if ( rXShape == pPtr->aXShape )
4664 return pPtr->n_EscherId;
4675 sal_uInt32 nRecHdPos, nCurrentPos, nSize;
4682 EscherConnectorRule aConnectorRule;
4683 aConnectorRule.nRuleId = 2;
4686 aConnectorRule.ncptiA = aConnectorRule.ncptiB = 0xffffffff;
4687 aConnectorRule.nShapeC =
GetShapeId( pPtr->mXConnector );
4688 aConnectorRule.nShapeA =
GetShapeId( pPtr->mXConnectToA );
4689 aConnectorRule.nShapeB =
GetShapeId( pPtr->mXConnectToB );
4691 if ( aConnectorRule.nShapeC )
4693 if ( aConnectorRule.nShapeA )
4694 aConnectorRule.ncptiA = pPtr->GetConnectorRule(
true );
4695 if ( aConnectorRule.nShapeB )
4696 aConnectorRule.ncptiB = pPtr->GetConnectorRule(
false );
4707 aConnectorRule.nRuleId += 2;
4711 nSize = ( nCurrentPos - nRecHdPos ) - 4;
4719 mpPicStrm( nullptr ),
4720 mbHasDggCont( false ),
4721 mbPicStrmQueried( false )
4732 sal_uInt32 nClusterId =
static_cast< sal_uInt32
>(
maClusterTable.size() + 1 );
4734 sal_uInt32 nDrawingId =
static_cast< sal_uInt32
>(
maDrawingInfos.size() + 1 );
4746 if ( nDrawingId == 0 )
4749 size_t nDrawingIdx = nDrawingId - 1;
4750 OSL_ENSURE( nDrawingIdx <
maDrawingInfos.size(),
"EscherExGlobal::GenerateShapeId - invalid drawing ID" );
4783 size_t nDrawingIdx = nDrawingId - 1;
4784 OSL_ENSURE( nDrawingIdx <
maDrawingInfos.size(),
"EscherExGlobal::GetDrawingShapeCount - invalid drawing ID" );
4790 size_t nDrawingIdx = nDrawingId - 1;
4791 OSL_ENSURE( nDrawingIdx <
maDrawingInfos.size(),
"EscherExGlobal::GetLastShapeId - invalid drawing ID" );
4798 return static_cast< sal_uInt32
>( 24 + 8 *
maClusterTable.size() );
4809 sal_uInt32 nShapeCount = 0;
4810 sal_uInt32 nLastShapeId = 0;
4813 nShapeCount += drawingInfo.mnShapeCount;
4814 nLastShapeId = ::std::max( nLastShapeId, drawingInfo.mnLastShapeId );
4817 sal_uInt32 nClusterCount =
static_cast< sal_uInt32
>(
maClusterTable.size() + 1 );
4818 sal_uInt32 nDrawingCount =
static_cast< sal_uInt32
>(
maDrawingInfos.size() );
4848class SvNullStream :
public SvStream
4851 virtual std::size_t
GetData(
void* pData, std::size_t nSize )
override { memset( pData, 0, nSize );
return nSize; }
4852 virtual std::size_t
PutData(
const void*, std::size_t nSize )
override {
return nSize; }
4853 virtual sal_uInt64
SeekPos( sal_uInt64 nPos )
override {
return nPos; }
4854 virtual void SetSize( sal_uInt64 )
override {}
4864 : mxGlobal(
std::move(xGlobal))
4865 , mpOutStrm(pOutStrm)
4870 , mbEscherSpgr(false)
4876 mxOwnStrm = std::make_unique<SvNullStream>();
4889 if ( !
mxGlobal->HasDggContainer() )
4906 sal_uInt32 nBSCSize =
mxGlobal->GetBlibStoreContainerSize( pPicStreamMergeBSE );
4928 sal_uInt32 nOfs = pPtr->mnOffset;
4929 if ( nOfs >= nCurPos ) {
4930 pPtr->mnOffset += nBytes;
4940 bool bContainer = (
nType & 0x0F) == 0x0F;
4944 if ( (nCurPos < nEndOfRecord) || ((nCurPos == nEndOfRecord) && bContainer) )
4956 if ( offset > nCurPos )
4960 nToCopy = nSource - nCurPos;
4961 std::unique_ptr<sal_uInt8[]> pBuf(
new sal_uInt8[ 0x40000 ]);
4964 nBufSize = ( nToCopy >= 0x40000 ) ? 0x40000 : nToCopy;
4965 nToCopy -= nBufSize;
4966 nSource -= nBufSize;
5029 mRecTypes.push_back( nEscherContainer );
5030 switch( nEscherContainer )
5134void EscherEx::AddAtom( sal_uInt32 nAtomSize, sal_uInt16 nRecType,
int nRecVersion,
int nRecInstance )
5166 aRect = *pBoundRect;
5190 if( rShapeName.getLength() > 0 )
5193 Commit( aPropOpt, aRect );
5274 sal_uInt32 nColor = nSOColor & 0xff00;
5275 nColor |=
static_cast<sal_uInt8>(nSOColor) << 16;
5276 nColor |=
static_cast<sal_uInt8>( nSOColor >> 16 );
5282 sal_uInt32 nColor = ( rSOColor.
GetRed() << 16 );
5283 nColor |= ( rSOColor.
GetGreen() << 8 );
SVXCORE_DLLPUBLIC sal_Int16 GetCustomShapeConnectionTypeDefault(MSO_SPT eSpType)
SVXCORE_DLLPUBLIC const mso_CustomShape * GetCustomShapeContent(MSO_SPT eSpType)
static OutputDevice * GetDefaultDevice()
sal_uInt8 GetBlue() const
sal_uInt8 GetGreen() const
EscherBlibEntry(sal_uInt32 nPictureOffset, const GraphicObject &rObj, const OString &rId, const GraphicAttr *pAttr)
sal_uInt32 mnPictureOffset
bool mbIsNativeGraphicPossible
sal_uInt32 mnIdentifier[4]
void WriteBlibEntry(SvStream &rSt, bool bWritePictureOffset, sal_uInt32 nResize=0)
bool operator==(const EscherBlibEntry &) const
ESCHER_BlibType meBlibType
virtual ~EscherExClientAnchor_Base()
virtual ~EscherExClientRecord_Base()
bool mbPicStrmQueried
True = the DGGCONTAINER has been initialized.
sal_uInt32 GetLastShapeId(sal_uInt32 nDrawingId) const
Returns the last shape identifier generated by the GenerateShapeId() function.
void WriteDggAtom(SvStream &rStrm) const
Writes the complete DGG atom to the passed stream (overwrites existing data!).
sal_uInt32 GenerateDrawingId()
Returns a new drawing ID for a new drawing container (DGCONTAINER).
sal_uInt32 GetDggAtomSize() const
Returns the total size of the DGG atom (including header).
virtual ~EscherExGlobal() override
DrawingInfoVector maDrawingInfos
List with cluster IDs (used object IDs in drawings).
SvStream * mpPicStrm
Data about all used drawings.
sal_uInt32 GenerateShapeId(sal_uInt32 nDrawingId, bool bIsInSpgr)
Creates and returns a new shape identifier, updates the internal shape counters and registers the ide...
sal_uInt32 GetDrawingShapeCount(sal_uInt32 nDrawingId) const
Returns the number of shapes in the current drawing, based on number of calls to the GenerateShapeId(...
SvStream * QueryPictureStream()
Called if a picture shall be written and no picture stream is set at class ImplEESdrWriter.
virtual SvStream * ImplQueryPictureStream()
Derived classes may implement to create a new stream used to store the picture data.
std::vector< ClusterEntry > maClusterTable
void WriteClientAnchor(EscherEx &rEx, const tools::Rectangle &rRect)
void WriteClientData(EscherEx &rEx)
void SetGroupLogicRect(sal_uInt32 nGroupLevel, const tools::Rectangle &rRect)
sal_uInt32 GetPersistOffset(sal_uInt32 nKey)
virtual sal_uInt32 EnterGroup(const OUString &rShapeName, const tools::Rectangle *pBoundRect)
bool SeekToPersistOffset(sal_uInt32 nKey)
virtual void AddShape(sal_uInt32 nShpInstance, ShapeFlag nFlagIds, sal_uInt32 nShapeID=0)
void AddAtom(sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion=0, int nRecInstance=0)
virtual EscherExHostAppData * EnterAdditionalTextGroup()
Called before an AdditionalText EnterGroup occurs.
bool DoSeek(sal_uInt32 nKey)
void SetGroupSnapRect(sal_uInt32 nGroupLevel, const tools::Rectangle &rRect)
static sal_uInt32 GetColor(const sal_uInt32 nColor)
void EndAtom(sal_uInt16 nRecType, int nRecVersion=0, int nRecInstance=0)
void AddChildAnchor(const tools::Rectangle &rRectangle)
virtual sal_uInt32 GenerateShapeId()
Creates and returns a new shape identifier, updates the internal shape counters and registers the ide...
sal_uInt32 mnStrmStartOfs
virtual ~EscherEx() override
std::shared_ptr< EscherExGlobal > mxGlobal
void SetEditAs(const OUString &rEditAs)
virtual void OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance=0)
std::unique_ptr< ImplEESdrWriter > mpImplEESdrWriter
void Flush(SvStream *pPicStreamMergeBSE=nullptr)
Inserts internal data into the EscherStream, this process may and has to be executed only once If pPi...
void ReplacePersistOffset(sal_uInt32 nKey, sal_uInt32 nOffset)
void InsertAtCurrentPos(sal_uInt32 nBytes)
Inserts the passed number of bytes at the current position of the output stream.
void InsertPersistOffset(sal_uInt32 nKey, sal_uInt32 nOffset)
virtual void Commit(EscherPropertyContainer &rProps, const tools::Rectangle &rRect)
EscherEx(std::shared_ptr< EscherExGlobal > xGlobal, SvStream *pOutStrm, bool bOOXML=false)
void InsertAtPersistOffset(sal_uInt32 nKey, sal_uInt32 nValue)
SvStream & GetStream() const
std::vector< sal_uInt32 > mOffsets
std::unique_ptr< SvStream > mxOwnStrm
std::vector< sal_uInt16 > mRecTypes
virtual void LeaveGroup()
void AddClientAnchor(const tools::Rectangle &rRectangle)
virtual void CloseContainer()
EscherGraphicProvider(EscherGraphicProviderFlags nFlags=EscherGraphicProviderFlags::NONE)
bool GetPrefSize(const sal_uInt32 nBlibId, Size &rSize, MapMode &rMapMode)
void WriteBlibStoreContainer(SvStream &rStrm, SvStream *pMergePicStreamBSE=nullptr)
void SetNewBlipStreamOffset(sal_Int32 nOffset)
sal_uInt32 ImplInsertBlib(EscherBlibEntry *p_EscherBlibEntry)
const OUString & GetBaseURI() const
sal_uInt32 GetBlibStoreContainerSize(SvStream const *pMergePicStreamBSE=nullptr) const
virtual ~EscherGraphicProvider()
EscherGraphicProviderFlags mnFlags
std::vector< std::unique_ptr< EscherBlibEntry > > mvBlibEntrys
sal_uInt32 GetBlibID(SvStream &rPicOutStream, GraphicObject const &pGraphicObject, const css::awt::Rectangle *pVisArea=nullptr, const GraphicAttr *pGrafikAttr=nullptr, const bool ooxmlExport=false)
void WriteBlibStoreEntry(SvStream &rStrm, sal_uInt32 nBlipId, sal_uInt32 nResize)
void PtDelete(sal_uInt32 nID)
bool PtIsID(sal_uInt32 nID)
void PtInsert(sal_uInt32 nID, sal_uInt32 nOfs)
sal_uInt32 PtGetOffsetByID(sal_uInt32 nID)
::std::vector< std::unique_ptr< EscherPersistEntry > > maPersistTable
virtual ~EscherPersistTable()
void PtReplace(sal_uInt32 nID, sal_uInt32 nOfs)
void PtReplaceOrInsert(sal_uInt32 nID, sal_uInt32 nOfs)
bool CreateGraphicProperties(const css::uno::Reference< css::drawing::XShape > &rXShape, const GraphicObject &rGraphicObj)
void CreateShapeProperties(const css::uno::Reference< css::drawing::XShape > &rXShape)
static sal_uInt32 ImplGetColor(const sal_uInt32 rColor, bool bSwap=true)
bool CreateBlipPropertiesforOLEControl(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const css::uno::Reference< css::drawing::XShape > &rXShape)
static void LookForPolarHandles(const MSO_SPT eShapeType, sal_Int32 &nAdjustmentsWhichNeedsToBeConverted)
static MSO_SPT GetCustomShapeType(const css::uno::Reference< css::drawing::XShape > &rXShape, ShapeFlag &nMirrorFlags, OUString &rShapeType, bool bOOXML=false)
void CreateShadowProperties(const css::uno::Reference< css::beans::XPropertySet > &)
tools::Rectangle * pShapeBoundRect
~EscherPropertyContainer()
bool CreateOLEGraphicProperties(const css::uno::Reference< css::drawing::XShape > &rXOleObject)
bool CreateMediaGraphicProperties(const css::uno::Reference< css::drawing::XShape > &rXMediaObject)
void AddOpt(sal_uInt16 nPropID, bool bBlib, sal_uInt32 nSizeReduction, SvMemoryStream &rStream)
void ImplCreateGraphicAttributes(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, sal_uInt32 nBlibId, bool bCreateCroppingAttributes)
EscherPropertyContainer()
std::vector< EscherPropSortStruct > pSortStruct
bool CreatePolygonProperties(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, sal_uInt32 nFlags, bool bBezier, css::awt::Rectangle &rGeoRect, tools::Polygon const *pPolygon=nullptr)
void CreateGradientProperties(const css::awt::Gradient &rGradient)
static tools::PolyPolygon GetPolyPolygon(const css::uno::Reference< css::drawing::XShape > &rXShape)
EscherGraphicProvider * pGraphicProvider
static sal_uInt32 GetGradientColor(const css::awt::Gradient *pGradient, sal_uInt32 nStartColor)
void CreateEmbeddedHatchProperties(const css::drawing::Hatch &rHatch, const Color &rBackColor, bool bFillBackground)
Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts).
bool CreateConnectorProperties(const css::uno::Reference< css::drawing::XShape > &rXShape, EscherSolverContainer &rSolver, css::awt::Rectangle &rGeoRect, sal_uInt16 &rShapeType, ShapeFlag &rShapeFlags)
void CreateLineProperties(const css::uno::Reference< css::beans::XPropertySet > &, bool bEdge)
sal_Int32 GetValueForEnhancedCustomShapeParameter(const css::drawing::EnhancedCustomShapeParameter &rParameter, const std::vector< sal_Int32 > &rEquationOrder, bool bAdjustTrans=false)
static bool GetAdjustmentValue(const css::drawing::EnhancedCustomShapeAdjustmentValue &rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32 &nValue)
bool GetOpt(sal_uInt16 nPropertyID, sal_uInt32 &rPropValue) const
bool ImplCreateEmbeddedBmp(GraphicObject const &rGraphicObject)
void CreateTextProperties(const css::uno::Reference< css::beans::XPropertySet > &, sal_uInt32 nText, const bool bIsCustomShape=false, const bool bIsTextFrame=true)
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 > &)
void Commit(SvStream &rSt, sal_uInt16 nVersion=3, sal_uInt16 nRecType=ESCHER_OPT)
const EscherProperties & GetOpts() const
static bool GetLineArrow(const bool bLineStart, const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, ESCHER_LineEnd &reLineEnd, sal_Int32 &rnArrowLength, sal_Int32 &rnArrowWidth)
void CreateEmbeddedBitmapProperties(css::uno::Reference< css::awt::XBitmap > const &rxBitmap, css::drawing::BitmapMode eBitmapMode)
Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts).
static bool IsDefaultObject(const SdrObjCustomShape &rSdrObjCustomShape, const MSO_SPT eShapeType)
sal_uInt32 GetShapeId(const css::uno::Reference< css::drawing::XShape > &rShape) const
::std::vector< std::unique_ptr< EscherConnectorListEntry > > maConnectorList
::std::vector< std::unique_ptr< EscherShapeListEntry > > maShapeList
void AddShape(const css::uno::Reference< css::drawing::XShape > &, sal_uInt32 nId)
void WriteSolver(SvStream &)
void AddConnector(const css::uno::Reference< css::drawing::XShape > &, const css::awt::Point &rA, css::uno::Reference< css::drawing::XShape > const &, const css::awt::Point &rB, css::uno::Reference< css::drawing::XShape > const &rConB)
const sal_uInt8 * GetData() const
sal_uInt32 GetDataSize() const
GfxLinkType GetType() const
Degree10 GetRotation() const
short GetContrast() const
short GetChannelB() const
tools::Long GetTopCrop() const
bool IsTransparent() const
bool IsSpecialDrawMode() const
tools::Long GetBottomCrop() const
tools::Long GetRightCrop() const
GraphicDrawMode GetDrawMode() const
BmpMirrorFlags GetMirrorFlags() const
sal_uInt8 GetAlpha() const
short GetChannelG() const
short GetChannelR() const
tools::Long GetLeftCrop() const
short GetLuminance() const
static ErrCode Import(SvStream &rIStm, Graphic &rGraphic, ConvertDataFormat nFormat=ConvertDataFormat::Unknown)
static ErrCode Export(SvStream &rOStm, const Graphic &rGraphic, ConvertDataFormat nFormat)
sal_uInt16 GetExportFormatNumberForShortName(std::u16string_view rShortName)
static GraphicFilter & GetGraphicFilter()
ErrCode ExportGraphic(const Graphic &rGraphic, const INetURLObject &rPath, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData=nullptr)
GraphicType GetType() const
Graphic GetTransformedGraphic(const Size &rDestSize, const MapMode &rDestMap, const GraphicAttr &rAttr) const
OString GetUniqueID() const
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
OUString getOriginURL() const
GraphicType GetType() const
GfxLink GetGfxLink() const
static OUString GetRelURL(std::u16string_view rTheBaseURIRef, OUString const &rTheAbsURIRef, EncodeMechanism eEncodeMechanism=EncodeMechanism::WasEncoded, DecodeMechanism eDecodeMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
MapUnit GetMapUnit() const
bool IsEffectivelyVertical() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
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
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
static Graphic GetObjGraphic(const SdrObject &rSdrObject, bool bSVG=false)
sal_uInt16 GetCount() const
Point GetAbsolutePos(const SdrObject &rObj) const
bool IsDefaultGeometry(const DefaultType eDefaultType) const
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
const SfxItemSet & GetMergedItemSet() const
const basegfx::B2DPolyPolygon & GetPathPoly() const
virtual OutlinerParaObject * GetOutlinerParaObject() const override
constexpr tools::Long Height() const
constexpr tools::Long Width() const
virtual sal_uInt64 TellEnd() override
SvStream & WriteDouble(const double &rDouble)
SvStream & WriteInt32(sal_Int32 nInt32)
virtual sal_uInt64 TellEnd()
virtual sal_uInt64 SeekPos(sal_uInt64 nPos)
virtual void SetSize(sal_uInt64 nSize)
std::size_t WriteBytes(const void *pData, std::size_t nSize)
SvStream & WriteBool(bool b)
SvStream & WriteInt16(sal_Int16 nInt16)
SvStream & WriteUChar(unsigned char nChar)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
virtual std::size_t GetData(void *pData, std::size_t nSize)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
sal_uInt64 Seek(sal_uInt64 nPos)
std::size_t ReadBytes(void *pData, std::size_t nSize)
virtual std::size_t PutData(const void *pData, std::size_t nSize)
sal_uInt64 SeekRel(sal_Int64 nPos)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
sal_uInt16 GetSize() const
tools::Long EndCompression()
void BeginCompression(int nCompressLevel=ZCODEC_DEFAULT_COMPRESSION, bool gzLib=false)
void Write(SvStream &rOStm, const sal_uInt8 *pData, sal_uInt32 nSize)
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
#define DBG_ASSERT(sCon, aError)
EmbeddedObjectRef * pObject
static sal_Int32 lcl_GetConnectorAdjustValue(const XPolygon &rPoly, sal_uInt16 nIndex)
static void ConvertEnhancedCustomShapeEquation(const SdrObjCustomShape &rSdrObjCustomShape, std::vector< EnhancedCustomShapeEquation > &rEquations, std::vector< sal_Int32 > &rEquationOrder)
static bool lcl_GetAngle(tools::Polygon &rPoly, ShapeFlag &rShapeFlags, sal_Int32 &nAngle)
static sal_Int32 lcl_GetAdjustValueCount(const XPolygon &rPoly)
static void lcl_Rotate(Degree100 nAngle, Point center, Point &pt)
static int EscherPropSortFunc(const void *p1, const void *p2)
static bool GetValueForEnhancedCustomShapeHandleParameter(sal_Int32 &nRetValue, const drawing::EnhancedCustomShapeParameter &rParameter)
static Size lcl_SizeToEmu(Size aPrefSize, const MapMode &aPrefMapMode)
#define ESCHER_Prop_cropFromRight
#define ESCHER_Prop_pictureActive
#define ESCHER_CREATEPOLYGON_LINE
#define ESCHER_Prop_lineColor
@ ESCHER_AnchorMiddleCentered
@ ESCHER_AnchorTopCentered
@ ESCHER_AnchorBottomCentered
#define ESCHER_Prop_shapePath
#define ESCHER_Prop_fillFocus
std::vector< EscherPropSortStruct > EscherProperties
#define ESCHER_Prop_fillAngle
#define ESCHER_Prop_pibName
#define ESCHER_ConnectorRule
#define ESCHER_Prop_LockAgainstGrouping
#define ESCHER_Prop_lineStartArrowWidth
#define ESCHER_Prop_fNoFillHitTest
#define ESCHER_ShpInst_StraightConnector1
#define ESCHER_Prop_lineJoinStyle
#define ESCHER_Prop_fshadowObscured
#define ESCHER_Prop_geoRight
#define ESCHER_Prop_FitTextToShape
#define ESCHER_Prop_fNoLineDrawDash
#define ESCHER_Prop_wzName
#define ESCHER_Prop_lineStartArrowhead
#define ESCHER_ChildAnchor
@ ESCHER_LineEndCapSquare
#define ESCHER_Prop_fillToTop
#define ESCHER_Prop_AnchorText
#define ESCHER_Prop_shadowColor
#define ESCHER_Prop_adjust2Value
#define ESCHER_Prop_fillToLeft
#define ESCHER_Prop_WrapText
#define ESCHER_BstoreContainer
@ ESCHER_BlipFlagLinkToFile
@ ESCHER_BlipFlagDoNotSave
#define ESCHER_Prop_lineStartArrowLength
#define ESCHER_Prop_txflTextFlow
#define ESCHER_Prop_gtextSize
#define ESCHER_Persist_CurrentPosition
#define ESCHER_DgContainer
#define ESCHER_Prop_fillToBottom
#define ESCHER_ShpInst_Min
#define ESCHER_Persist_PrivateEntry
#define ESCHER_Prop_Rotation
const sal_uInt32 DFF_DGG_CLUSTER_SIZE
#define ESCHER_Prop_cropFromTop
#define ESCHER_Prop_dxWrapDistLeft
#define ESCHER_ShpInst_BentConnector2
#define ESCHER_Persist_Grouping_Snap
#define ESCHER_Prop_lineOpacity
#define ESCHER_Prop_pictureBrightness
#define ESCHER_Prop_shadowOffsetY
#define ESCHER_SolverContainer
#define ESCHER_Prop_fillToRight
#define ESCHER_Prop_lineEndCapStyle
#define ESCHER_Prop_lineBackColor
#define ESCHER_Prop_dxWrapDistRight
@ ESCHER_LineLongDashDotDotGEL
@ ESCHER_LineDashDotDotSys
@ ESCHER_LineLongDashDotGEL
#define ESCHER_Prop_dxTextLeft
#define ESCHER_ClientAnchor
#define ESCHER_Prop_lineWidth
#define ESCHER_Prop_pibFlags
#define ESCHER_Persist_Grouping_Logic
#define ESCHER_Prop_pSegmentInfo
#define ESCHER_SpgrContainer
#define ESCHER_Prop_geoBottom
#define ESCHER_Prop_dyTextTop
#define ESCHER_Prop_cropFromLeft
#define ESCHER_Prop_fillBackColor
#define ESCHER_Prop_cxstyle
#define ESCHER_Prop_pVertices
#define ESCHER_Prop_fillBlip
#define ESCHER_ShpInst_BentConnector3
#define ESCHER_Prop_lineEndArrowLength
#define ESCHER_Prop_lineEndArrowWidth
#define ESCHER_Persist_Dgg
#define ESCHER_Prop_cropFromBottom
#define ESCHER_Prop_fFillOK
#define ESCHER_Prop_dyTextBottom
#define ESCHER_Prop_fPrint
EscherGraphicProviderFlags
#define ESCHER_Persist_Dg
#define ESCHER_Prop_lTxid
#define ESCHER_ShpInst_CurvedConnector3
#define ESCHER_Prop_shadowOffsetX
#define ESCHER_Prop_fillType
#define ESCHER_Prop_adjustValue
#define ESCHER_Prop_shadowOpacity
#define ESCHER_Prop_fillOpacity
#define ESCHER_Prop_pictureContrast
#define ESCHER_SpContainer
#define ESCHER_Prop_lineEndArrowhead
@ ESCHER_LineArrowOvalEnd
@ ESCHER_LineArrowStealthEnd
@ ESCHER_LineArrowOpenEnd
@ ESCHER_LineArrowDiamondEnd
#define ESCHER_Prop_dxTextRight
#define ESCHER_DggContainer
#define ESCHER_Prop_fillBackOpacity
#define ESCHER_Prop_fillColor
#define ESCHER_Prop_lineDashing
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
std::unique_ptr< sal_Int32[]> pData
#define DFF_Prop_fc3DFillHarsh
#define DFF_Prop_pibFlags
#define DFF_Prop_cdirFont
#define DFF_Prop_c3DOriginY
#define DFF_Prop_c3DOriginX
#define DFF_Prop_gtextUNICODE
#define DFF_Prop_c3DExtrusionColor
#define DFF_Prop_pFormulas
#define DFF_Prop_c3DTolerance
#define DFF_Prop_pSegmentInfo
#define DFF_Prop_stretchPointX
#define DFF_Prop_c3DXViewpoint
#define DFF_Prop_c3DDiffuseAmt
#define DFF_Prop_geoRight
#define DFF_Prop_c3DRotationCenterY
#define DFF_Prop_c3DFillZ
#define DFF_Prop_c3DShininess
#define DFF_Prop_c3DYRotationAngle
#define DFF_Prop_connectorPoints
#define DFF_Prop_c3DExtrudeBackward
#define DFF_Prop_c3DRenderMode
#define DFF_Prop_gtextFont
#define DFF_Prop_c3DSkewAmount
#define DFF_Prop_c3DYViewpoint
#define DFF_Prop_stretchPointY
#define DFF_Prop_c3DAmbientIntensity
#define DFF_Prop_c3DFillIntensity
#define DFF_Prop_adjustValue
#define DFF_Prop_c3DRotationCenterZ
#define DFF_Prop_connectorType
#define DFF_Prop_geoBottom
#define DFF_Prop_fc3DLightFace
#define DFF_Prop_gtextFStrikethrough
#define DFF_Prop_c3DRotationCenterX
#define DFF_Prop_c3DXRotationAngle
#define DFF_Prop_pVertices
#define DFF_Prop_c3DFillX
#define DFF_Prop_c3DSkewAngle
#define DFF_Prop_gtextAlign
#define DFF_Prop_gtextSpacing
#define DFF_Prop_c3DKeyIntensity
#define DFF_Prop_c3DZViewpoint
#define DFF_Prop_c3DExtrudeForward
#define DFF_Prop_c3DSpecularAmt
#define DFF_Prop_c3DFillY
#define DFF_Prop_textRectangles
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
SVXCORE_DLLPUBLIC void FillEquationParameter(const css::drawing::EnhancedCustomShapeParameter &, const sal_Int32, EnhancedCustomShapeEquation &)
B2DPolygon UnoPointSequenceToB2DPolygon(const css::drawing::PointSequence &rPointSequenceSource)
B2DPolyPolygon UnoPointSequenceSequenceToB2DPolyPolygon(const css::drawing::PointSequenceSequence &rPointSequenceSequenceSource)
B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon(const css::drawing::PolyPolygonBezierCoords &rPolyPolygonBezierCoordsSource)
B2IRange fround(const B2DRange &rRange)
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
MSO_SPT GETVMLShapeType(std::u16string_view aType)
Similar to EnhancedCustomShapeTypeNames::Get(), but returns an MSO_SPT (binary / VML type).
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
#define STREAM_SEEK_TO_BEGIN
sal_uInt32 GetConnectorRule(bool bFirst)
css::uno::Reference< css::drawing::XShape > mXConnectToB
css::uno::Reference< css::drawing::XShape > mXConnectToA
static sal_uInt32 GetClosestPoint(const tools::Polygon &rPoly, const css::awt::Point &rP)
EscherExAtom(SvStream &rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance=0, const sal_uInt8 nVersion=0)
EscherExContainer(SvStream &rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance=0)
sal_uInt32 mnNextShapeId
Identifier of drawing this cluster belongs to (one-based index into maDrawingInfos).
sal_uInt32 mnShapeCount
Currently used cluster (one-based index into maClusterTable).
sal_uInt32 mnLastShapeId
Current number of shapes in this drawing.
static css::beans::PropertyState GetPropertyState(const css::uno::Reference< css::beans::XPropertySet > &, const OUString &rPropertyName)
static bool GetPropertyValue(css::uno::Any &rAny, const css::uno::Reference< css::beans::XPropertySet > &, const OUString &rPropertyName, bool bTestPropertyAvailability=false)
EscherShapeListEntry(uno::Reference< drawing::XShape > xShape, sal_uInt32 nId)
uno::Reference< drawing::XShape > aXShape
SvxMSDffHandle * pHandles
UNDERLYING_TYPE get() const
constexpr TypedWhichId< SdrTextFitToSizeTypeItem > SDRATTR_TEXT_FITTOSIZE(SDRATTR_MISC_FIRST+3)
constexpr TypedWhichId< SdrCustomShapeGeometryItem > SDRATTR_CUSTOMSHAPE_GEOMETRY(SDRATTR_CUSTOMSHAPE_FIRST+2)
SVXCORE_DLLPUBLIC Degree100 NormAngle36000(Degree100 a)
constexpr SdrLayerID SDRLAYER_NOTFOUND(-1)
SVXCORE_DLLPUBLIC OUString SvxUnogetApiNameForItem(const sal_uInt16 nWhich, const OUString &rInternalName)
std::vector< ISegmentProgressBarRef > aSegments
constexpr TypedWhichId< XLineEndItem > XATTR_LINEEND(XATTR_LINE_FIRST+5)
constexpr TypedWhichId< XLineStartItem > XATTR_LINESTART(XATTR_LINE_FIRST+4)