30 #include <com/sun/star/beans/XPropertyState.hpp>
31 #include <com/sun/star/beans/PropertyValues.hpp>
32 #include <com/sun/star/container/XChild.hpp>
33 #include <com/sun/star/container/XEnumerationAccess.hpp>
34 #include <com/sun/star/container/XIdentifierAccess.hpp>
35 #include <com/sun/star/container/XNamed.hpp>
36 #include <com/sun/star/document/XEventsSupplier.hpp>
37 #include <com/sun/star/drawing/Alignment.hpp>
38 #include <com/sun/star/drawing/CameraGeometry.hpp>
39 #include <com/sun/star/drawing/CircleKind.hpp>
40 #include <com/sun/star/drawing/ConnectorType.hpp>
41 #include <com/sun/star/drawing/Direction3D.hpp>
42 #include <com/sun/star/drawing/EscapeDirection.hpp>
43 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
44 #include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
45 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
46 #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
47 #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
48 #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
49 #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
50 #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
51 #include <com/sun/star/drawing/GluePoint2.hpp>
52 #include <com/sun/star/drawing/HomogenMatrix.hpp>
53 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
54 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
55 #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
56 #include <com/sun/star/drawing/Position3D.hpp>
57 #include <com/sun/star/drawing/ProjectionMode.hpp>
58 #include <com/sun/star/drawing/ShadeMode.hpp>
59 #include <com/sun/star/drawing/XControlShape.hpp>
60 #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
61 #include <com/sun/star/drawing/XGluePointsSupplier.hpp>
62 #include <com/sun/star/drawing/QRCode.hpp>
63 #include <com/sun/star/drawing/QRCodeErrorCorrection.hpp>
64 #include <com/sun/star/embed/ElementModes.hpp>
65 #include <com/sun/star/embed/XStorage.hpp>
66 #include <com/sun/star/embed/XTransactedObject.hpp>
67 #include <com/sun/star/graphic/XGraphic.hpp>
68 #include <com/sun/star/graphic/GraphicProvider.hpp>
69 #include <com/sun/star/graphic/XGraphicProvider.hpp>
70 #include <com/sun/star/io/XSeekableInputStream.hpp>
71 #include <com/sun/star/io/XStream.hpp>
72 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
73 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
74 #include <com/sun/star/media/ZoomLevel.hpp>
75 #include <com/sun/star/presentation/AnimationSpeed.hpp>
76 #include <com/sun/star/presentation/ClickAction.hpp>
77 #include <com/sun/star/style/XStyle.hpp>
78 #include <com/sun/star/table/XColumnRowRange.hpp>
79 #include <com/sun/star/text/XText.hpp>
84 #include <officecfg/Office/Common.hxx>
89 #include <rtl/math.hxx>
90 #include <rtl/ustrbuf.hxx>
91 #include <rtl/ustring.hxx>
126 #define XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE "vnd.sun.star.GraphicObject:"
149 constexpr OUStringLiteral
gsZIndex( u
"ZOrder" );
150 constexpr OUStringLiteral
gsPrintable( u
"Printable" );
151 constexpr OUStringLiteral
gsVisible( u
"Visible" );
152 constexpr OUStringLiteral
gsModel( u
"Model" );
153 constexpr OUStringLiteral
gsStartShape( u
"StartShape" );
154 constexpr OUStringLiteral
gsEndShape( u
"EndShape" );
155 constexpr OUStringLiteral
gsOnClick( u
"OnClick" );
156 constexpr OUStringLiteral
gsEventType( u
"EventType" );
158 constexpr OUStringLiteral
gsMacroName( u
"MacroName" );
159 constexpr OUStringLiteral
gsScript( u
"Script" );
160 constexpr OUStringLiteral
gsLibrary( u
"Library" );
162 constexpr OUStringLiteral
gsBookmark( u
"Bookmark" );
163 constexpr OUStringLiteral
gsEffect( u
"Effect" );
164 constexpr OUStringLiteral
gsPlayFull( u
"PlayFull" );
165 constexpr OUStringLiteral
gsVerb( u
"Verb" );
166 constexpr OUStringLiteral
gsSoundURL( u
"SoundURL" );
167 constexpr OUStringLiteral
gsSpeed( u
"Speed" );
168 constexpr OUStringLiteral
gsStarBasic( u
"StarBasic" );
174 maCurrentShapesIter(maShapesInfos.
end()),
175 mbExportLayer( false ),
177 mbHandleProgressBar( false )
214 uno::Reference< drawing::XShape > xCustomShapeReplacement;
218 OUString aType( xShape->getShapeType() );
219 if( aType ==
"com.sun.star.drawing.CustomShape" )
221 uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
225 xSet->getPropertyValue(
"CustomShapeEngine") >>= aEngine;
226 if ( aEngine.isEmpty() )
228 aEngine =
"com.sun.star.drawing.EnhancedCustomShapeEngine";
232 if ( !aEngine.isEmpty() )
234 uno::Sequence< uno::Any > aArgument( 1 );
235 uno::Sequence< beans::PropertyValue > aPropValues( 2 );
236 aPropValues[ 0 ].Name =
"CustomShape";
237 aPropValues[ 0 ].Value <<= xShape;
238 aPropValues[ 1 ].Name =
"ForceGroupWithText";
239 aPropValues[ 1 ].Value <<=
true;
240 aArgument[ 0 ] <<= aPropValues;
241 uno::Reference< uno::XInterface > xInterface(
242 xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aEngine, aArgument, xContext) );
243 if ( xInterface.is() )
245 uno::Reference< drawing::XCustomShapeEngine > xCustomShapeEngine(
246 uno::Reference< drawing::XCustomShapeEngine >( xInterface, uno::UNO_QUERY ) );
247 if ( xCustomShapeEngine.is() )
248 xCustomShapeReplacement = xCustomShapeEngine->render();
254 return xCustomShapeReplacement;
262 OSL_FAIL(
"XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" );
265 sal_Int32 nZIndex = 0;
266 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
268 xPropSet->getPropertyValue(
gsZIndex) >>= nZIndex;
272 if( static_cast<sal_Int32>(aShapeInfoVector.size()) <= nZIndex )
274 OSL_FAIL(
"XMLShapeExport::collectShapeAutoStyles(): no shape info allocated for a given shape" );
281 if ( xCustomShapeReplacement.is() )
289 const bool bObjSupportsText =
292 const bool bObjSupportsStyle =
295 bool bIsEmptyPresObj =
false;
301 if( xPropSet.is() && bObjSupportsText )
303 uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
309 bSkip = xText->getString().isEmpty();
311 catch (uno::RuntimeException
const&)
321 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
323 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"IsEmptyPresentationObject") )
325 uno::Any aAny = xPropSet->getPropertyValue(
"IsEmptyPresentationObject");
326 aAny >>= bIsEmptyPresObj;
339 uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( xPropSet->getPropertySetInfo() );
341 OUString aParentName;
342 uno::Reference< style::XStyle > xStyle;
344 if( bObjSupportsStyle )
346 if( xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName(
"Style") )
347 xPropSet->getPropertyValue(
"Style") >>= xStyle;
352 uno::Reference< beans::XPropertySet > xStylePropSet(xStyle, uno::UNO_QUERY);
353 SAL_WARN_IF( !xStylePropSet.is(),
"xmloff",
"style without a XPropertySet?" );
356 if(xStylePropSet.is())
358 OUString aFamilyName;
359 xStylePropSet->getPropertyValue(
"Family") >>= aFamilyName;
360 if( !aFamilyName.isEmpty() && aFamilyName !=
"graphics" )
364 catch(
const beans::UnknownPropertyException&)
368 "XMLShapeExport::collectShapeAutoStyles: style has no 'Family' property");
377 aParentName += xStyle->getName();
381 if (aParentName.isEmpty() && xPropertySetInfo->hasPropertyByName(
"TextBox") && xPropSet->getPropertyValue(
"TextBox").hasValue() && xPropSet->getPropertyValue(
"TextBox").get<
bool>())
385 aParentName =
"Frame";
389 std::vector< XMLPropertyState > aPropStates;
399 uno::Reference< drawing::XControlShape > xControl(xShape, uno::UNO_QUERY);
400 DBG_ASSERT(xControl.is(),
"XMLShapeExport::collectShapeAutoStyles: ShapeType control, but no XControlShape!");
403 uno::Reference< beans::XPropertySet > xControlModel(xControl->getControl(), uno::UNO_QUERY);
404 DBG_ASSERT(xControlModel.is(),
"XMLShapeExport::collectShapeAutoStyles: no control model on the control shape!");
407 if (!sNumberStyle.isEmpty())
412 DBG_ASSERT(-1 != nIndex,
"XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!");
415 aPropStates.push_back(aNewState);
420 nCount = std::count_if(aPropStates.cbegin(), aPropStates.cend(),
450 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
451 uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
452 if ( xPropSetInfo.is() && xPropState.is() )
461 if ( xPropSetInfo->hasPropertyByName(
"ParaAdjust" )
462 && ( beans::PropertyState_DEFAULT_VALUE == xPropState->getPropertyState(
"ParaAdjust" ) )
468 DBG_ASSERT(-1 != nIndex,
"XMLShapeExport::collectShapeAutoStyles: could not obtain the index for the ParaAdjust context id!");
470 uno::Any aParaAdjustValue = xPropSet->getPropertyValue(
"ParaAdjust" );
473 aPropStates.push_back( aAlignDefaultState );
478 nCount = std::count_if(aPropStates.cbegin(), aPropStates.cend(),
503 uno::Reference< uno::XInterface > xConnection;
506 xPropSet->getPropertyValue(
gsStartShape ) >>= xConnection;
507 if( xConnection.is() )
510 xPropSet->getPropertyValue(
gsEndShape ) >>= xConnection;
511 if( xConnection.is() )
520 uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue(
gsModel ), uno::UNO_QUERY_THROW );
523 catch(
const uno::Exception&)
538 uno::Reference< drawing::XShapes > xShapes( xCollection, uno::UNO_QUERY );
548 class NewTextListsHelper
554 mrExport.GetTextParagraphExport()->PushNewTextListsHelper();
557 ~NewTextListsHelper()
559 mrExport.GetTextParagraphExport()->PopTextListsHelper();
569 css::awt::Point* pRefPoint ,
572 SAL_INFO(
"xmloff", xShape->getShapeType());
575 SAL_WARN(
"xmloff",
"XMLShapeExport::exportShape(): no auto styles where collected before export" );
578 sal_Int32 nZIndex = 0;
579 uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
581 std::unique_ptr< SvXMLElementExport > pHyperlinkElement;
587 presentation::ClickAction eAction = presentation::ClickAction_NONE;
588 xSet->getPropertyValue(
"OnClick") >>= eAction;
590 if( (eAction == presentation::ClickAction_DOCUMENT) ||
591 (eAction == presentation::ClickAction_BOOKMARK) )
596 if( !sURL.isEmpty() )
605 catch(
const uno::Exception&)
607 TOOLS_WARN_EXCEPTION(
"xmloff",
"XMLShapeExport::exportShape(): exception during hyperlink export");
611 xSet->getPropertyValue(
gsZIndex) >>= nZIndex;
615 if( static_cast<sal_Int32>(aShapeInfoVector.size()) <= nZIndex )
617 SAL_WARN(
"xmloff",
"XMLShapeExport::exportShape(): no shape info collected for a given shape" );
621 NewTextListsHelper aNewTextListsHelper(
mrExport );
627 uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
630 uno::Reference< drawing::XShapes > xParent( xChild->getParent(), uno::UNO_QUERY );
631 SAL_WARN_IF( !xParent.is() && xParent.get() == (*maCurrentShapesIter).first.get(),
"xmloff",
"XMLShapeExport::exportShape(): Wrong call to XMLShapeExport::seekShapes()" );
639 SAL_WARN_IF( eShapeType != aShapeInfo.
meShapeType,
"xmloff",
"exportShape callings do not correspond to collectShapeAutoStyles calls!: " << xShape->getShapeType() );
662 uno::Reference< container::XNamed > xNamed( xShape, uno::UNO_QUERY );
665 const OUString
aName( xNamed->getName() );
666 if( !
aName.isEmpty() )
689 uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
691 if( !rShapeId.isEmpty() )
701 uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY );
706 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
708 xProps->getPropertyValue(
"LayerName") >>= aLayerName;
712 catch(
const uno::Exception&)
727 bool bPrintable =
true;
729 xSet->getPropertyValue(
gsVisible) >>= bVisible;
730 xSet->getPropertyValue(
gsPrintable) >>= bPrintable;
733 const unsigned short nDisplay = (bVisible ? 2 : 0) | (bPrintable ? 1 : 0);
736 case 0: eDisplayToken =
XML_NONE;
break;
745 catch(
const uno::Exception&)
925 OSL_FAIL(
"XMLEXP: WriteShape: unknown or unexpected type of shape in export!");
930 pHyperlinkElement.reset();
948 uno::Reference< drawing::XShape > xShape;
949 const sal_Int32 nShapeCount(xShapes->getCount());
950 for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
952 xShapes->getByIndex(nShapeId) >>= xShape;
953 SAL_WARN_IF( !xShape.is(),
"xmloff",
"Shape without a XShape?" );
969 uno::Reference< drawing::XShape > xShape;
970 const sal_Int32 nShapeCount(xShapes->getCount());
971 for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
973 xShapes->getByIndex(nShapeId) >>= xShape;
974 SAL_WARN_IF( !xShape.is(),
"xmloff",
"Shape without a XShape?" );
988 maCurrentShapesIter = maShapesInfos.find( xShapes );
989 if( maCurrentShapesIter == maShapesInfos.end() )
992 aNewInfoVector.resize( static_cast<ShapesInfos::size_type>(xShapes->getCount()) );
993 maShapesInfos[ xShapes ] = aNewInfoVector;
995 maCurrentShapesIter = maShapesInfos.find( xShapes );
997 SAL_WARN_IF( maCurrentShapesIter == maShapesInfos.end(),
"xmloff",
"XMLShapeExport::seekShapes(): insert into stl::map failed" );
1000 SAL_WARN_IF( (*maCurrentShapesIter).second.size() !=
static_cast<ShapesInfos::size_type
>(xShapes->getCount()),
"xmloff",
"XMLShapeExport::seekShapes(): XShapes size varied between calls" );
1005 maCurrentShapesIter = maShapesInfos.end();
1049 OUString aType(xShape->getShapeType());
1051 if(!aType.match(
"com.sun.star."))
1054 if(aType.match(
"drawing.", 13))
1086 else if(aType.match(
"OLE2", 21))
1091 uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1096 if(xPropSet->getPropertyValue(
"CLSID") >>= sCLSID)
1129 else if(aType.match(
"presentation.", 13))
1137 else if(aType.match(
"OLE2", 26))
1142 uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1144 if(xPropSet.is())
try
1147 if(xPropSet->getPropertyValue(
"CLSID") >>= sCLSID)
1155 catch(
const uno::Exception&)
1157 SAL_WARN(
"xmloff",
"XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" );
1177 uno::Reference< drawing::XGluePointsSupplier > xSupplier( xShape, uno::UNO_QUERY );
1178 if( !xSupplier.is() )
1181 uno::Reference< container::XIdentifierAccess > xGluePoints( xSupplier->getGluePoints(), uno::UNO_QUERY );
1182 if( !xGluePoints.is() )
1185 drawing::GluePoint2 aGluePoint;
1187 uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() );
1189 for(
const sal_Int32 nIdentifier : aIdSequence )
1191 if( (xGluePoints->getByIdentifier( nIdentifier ) >>= aGluePoint) && aGluePoint.IsUserDefined )
1195 const OUString
sId( OUString::number( nIdentifier ) );
1199 aGluePoint.Position.X);
1203 aGluePoint.Position.Y);
1206 if( !aGluePoint.IsRelative )
1212 if( aGluePoint.Escape != drawing::EscapeDirection_SMART )
1225 uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1227 bool bIsSignatureLine =
false;
1228 xPropSet->getPropertyValue(
"IsSignatureLine") >>= bIsSignatureLine;
1229 if (!bIsSignatureLine)
1232 OUString aSignatureLineId;
1233 xPropSet->getPropertyValue(
"SignatureLineId") >>= aSignatureLineId;
1236 OUString aSuggestedSignerName;
1237 xPropSet->getPropertyValue(
"SignatureLineSuggestedSignerName") >>= aSuggestedSignerName;
1238 if (!aSuggestedSignerName.isEmpty())
1241 OUString aSuggestedSignerTitle;
1242 xPropSet->getPropertyValue(
"SignatureLineSuggestedSignerTitle") >>= aSuggestedSignerTitle;
1243 if (!aSuggestedSignerTitle.isEmpty())
1246 OUString aSuggestedSignerEmail;
1247 xPropSet->getPropertyValue(
"SignatureLineSuggestedSignerEmail") >>= aSuggestedSignerEmail;
1248 if (!aSuggestedSignerEmail.isEmpty())
1251 OUString aSigningInstructions;
1252 xPropSet->getPropertyValue(
"SignatureLineSigningInstructions") >>= aSigningInstructions;
1253 if (!aSigningInstructions.isEmpty())
1256 bool bShowSignDate =
false;
1257 xPropSet->getPropertyValue(
"SignatureLineShowSignDate") >>= bShowSignDate;
1261 bool bCanAddComment =
false;
1262 xPropSet->getPropertyValue(
"SignatureLineCanAddComment") >>= bCanAddComment;
1264 bCanAddComment ?
XML_TRUE : XML_FALSE);
1272 uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1274 uno::Any aAny = xPropSet->getPropertyValue(
"QRCodeProperties");
1276 css::drawing::QRCode aQRCode;
1277 if(!(aAny >>= aQRCode))
1283 switch(aQRCode.ErrorCorrection){
1284 case css::drawing::QRCodeErrorCorrection::LOW :
1287 case css::drawing::QRCodeErrorCorrection::MEDIUM:
1290 case css::drawing::QRCodeErrorCorrection::QUARTILE:
1293 case css::drawing::QRCodeErrorCorrection::HIGH:
1319 uno::Reference< lang::XMultiServiceFactory > xFact(
mrExport.
GetModel(), uno::UNO_QUERY );
1325 uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance(
"com.sun.star.drawing.Defaults"), uno::UNO_QUERY );
1326 if( xDefaults.is() )
1334 catch(
const lang::ServiceNotRegisteredException&)
1366 double fTRShear(0.0);
1367 double fTRRotate(0.0);
1376 const uno::Reference< beans::XPropertySet >& xPropSet)
1391 xPropSet->getPropertySetInfo()->hasPropertyByName(
"TransformationInHoriL2R") )
1393 aAny = xPropSet->getPropertyValue(
"TransformationInHoriL2R");
1397 aAny = xPropSet->getPropertyValue(
"Transformation");
1399 drawing::HomogenMatrix3 aMatrix;
1402 rMatrix.
set(0, 0, aMatrix.Line1.Column1);
1403 rMatrix.
set(0, 1, aMatrix.Line1.Column2);
1404 rMatrix.
set(0, 2, aMatrix.Line1.Column3);
1405 rMatrix.
set(1, 0, aMatrix.Line2.Column1);
1406 rMatrix.
set(1, 1, aMatrix.Line2.Column2);
1407 rMatrix.
set(1, 2, aMatrix.Line2.Column3);
1408 rMatrix.
set(2, 0, aMatrix.Line3.Column1);
1409 rMatrix.
set(2, 1, aMatrix.Line3.Column2);
1410 rMatrix.
set(2, 2, aMatrix.Line3.Column3);
1414 double& fTRShear,
double& fTRRotate, ::
basegfx::B2DTuple& rTRTranslate, css::awt::Point* pRefPoint)
1417 rMatrix.decompose(rTRScale, rTRTranslate, fTRRotate, fTRShear);
1432 OUStringBuffer sStringBuffer;
1442 if( aTRScale.
getX() > 0.0 )
1443 aTRScale.
setX(aTRScale.
getX() - 1.0);
1444 else if( aTRScale.
getX() < 0.0 )
1445 aTRScale.
setX(aTRScale.
getX() + 1.0);
1450 aStr = sStringBuffer.makeStringAndClear();
1460 if( aTRScale.
getY() > 0.0 )
1461 aTRScale.
setY(aTRScale.
getY() - 1.0);
1462 else if( aTRScale.
getY() < 0.0 )
1463 aTRScale.
setY(aTRScale.
getY() + 1.0);
1468 aStr = sStringBuffer.makeStringAndClear();
1472 bool bTransformationIsNecessary(fTRShear != 0.0 || fTRRotate != 0.0);
1474 if(bTransformationIsNecessary)
1479 aTransform.
AddSkewX(atan(fTRShear));
1503 aStr = sStringBuffer.makeStringAndClear();
1512 aStr = sStringBuffer.makeStringAndClear();
1520 bool bIsEmpty =
false;
1527 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1531 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"IsEmptyPresentationObject"))
1533 xPropSet->getPropertyValue(
"IsEmptyPresentationObject") >>= bIsEmpty;
1539 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"IsPlaceholderDependent"))
1542 xPropSet->getPropertyValue(
"IsPlaceholderDependent") >>= bTemp;
1560 uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
1563 uno::Reference< container::XEnumerationAccess > xEnumAccess( xShape, uno::UNO_QUERY );
1564 if( xEnumAccess.is() && xEnumAccess->hasElements() )
1573 CLICKACTION = 0x0001,
1580 CLICKEVENTTYPE = 0x0080,
1593 uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY );
1594 if( !xEventsSupplier.is() )
1597 uno::Reference< container::XNameAccess > xEvents = xEventsSupplier->getEvents();
1598 SAL_WARN_IF( !xEvents.is(),
"xmloff",
"XEventsSupplier::getEvents() returned NULL" );
1602 Found nFound = Found::NONE;
1604 OUString aClickEventType;
1605 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1606 presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
1607 presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_SLOW;
1608 OUString aStrSoundURL;
1609 bool bPlayFull =
false;
1610 sal_Int32 nVerb = 0;
1612 OUString aStrLibrary;
1613 OUString aStrBookmark;
1615 uno::Sequence< beans::PropertyValue > aClickProperties;
1616 if( xEvents->hasByName(
gsOnClick ) && (xEvents->getByName(
gsOnClick ) >>= aClickProperties) )
1618 for(
const auto& rProperty : std::as_const(aClickProperties) )
1620 if( !( nFound & Found::CLICKEVENTTYPE ) && rProperty.Name ==
gsEventType )
1622 if( rProperty.Value >>= aClickEventType )
1623 nFound |= Found::CLICKEVENTTYPE;
1625 else if( !( nFound & Found::CLICKACTION ) && rProperty.Name ==
gsClickAction )
1627 if( rProperty.Value >>= eClickAction )
1628 nFound |= Found::CLICKACTION;
1630 else if( !( nFound & Found::MACRO ) && ( rProperty.Name ==
gsMacroName || rProperty.Name ==
gsScript ) )
1632 if( rProperty.Value >>= aStrMacro )
1633 nFound |= Found::MACRO;
1635 else if( !( nFound & Found::LIBRARY ) && rProperty.Name ==
gsLibrary )
1637 if( rProperty.Value >>= aStrLibrary )
1638 nFound |= Found::LIBRARY;
1640 else if( !( nFound & Found::EFFECT ) && rProperty.Name ==
gsEffect )
1642 if( rProperty.Value >>= eEffect )
1643 nFound |= Found::EFFECT;
1645 else if( !( nFound & Found::BOOKMARK ) && rProperty.Name ==
gsBookmark )
1647 if( rProperty.Value >>= aStrBookmark )
1648 nFound |= Found::BOOKMARK;
1650 else if( !( nFound & Found::SPEED ) && rProperty.Name ==
gsSpeed )
1652 if( rProperty.Value >>= eSpeed )
1653 nFound |= Found::SPEED;
1655 else if( !( nFound & Found::SOUNDURL ) && rProperty.Name ==
gsSoundURL )
1657 if( rProperty.Value >>= aStrSoundURL )
1658 nFound |= Found::SOUNDURL;
1660 else if( !( nFound & Found::PLAYFULL ) && rProperty.Name ==
gsPlayFull )
1662 if( rProperty.Value >>= bPlayFull )
1663 nFound |= Found::PLAYFULL;
1665 else if( !( nFound & Found::VERB ) && rProperty.Name ==
gsVerb )
1667 if( rProperty.Value >>= nVerb )
1668 nFound |= Found::VERB;
1677 if( !(nFound & Found::CLICKACTION) || (eClickAction == presentation::ClickAction_NONE) )
1684 switch( eClickAction )
1687 case presentation::ClickAction_NEXTPAGE: eStrAction =
XML_NEXT_PAGE;
break;
1688 case presentation::ClickAction_FIRSTPAGE: eStrAction =
XML_FIRST_PAGE;
break;
1689 case presentation::ClickAction_LASTPAGE: eStrAction =
XML_LAST_PAGE;
break;
1690 case presentation::ClickAction_INVISIBLE: eStrAction =
XML_HIDE;
break;
1691 case presentation::ClickAction_STOPPRESENTATION:eStrAction =
XML_STOP;
break;
1692 case presentation::ClickAction_PROGRAM: eStrAction =
XML_EXECUTE;
break;
1693 case presentation::ClickAction_BOOKMARK: eStrAction =
XML_SHOW;
break;
1694 case presentation::ClickAction_DOCUMENT: eStrAction =
XML_SHOW;
break;
1696 case presentation::ClickAction_VERB: eStrAction =
XML_VERB;
break;
1697 case presentation::ClickAction_VANISH: eStrAction =
XML_FADE_OUT;
break;
1698 case presentation::ClickAction_SOUND: eStrAction =
XML_SOUND;
break;
1700 OSL_FAIL(
"unknown presentation::ClickAction found!" );
1704 OUString aEventQName(
1710 if( eClickAction == presentation::ClickAction_VANISH )
1712 if( nFound & Found::EFFECT )
1716 sal_Int16 nStartScale;
1733 if( nStartScale != -1 )
1740 if( nFound & Found::SPEED && eEffect != presentation::AnimationEffect_NONE )
1742 if( eSpeed != presentation::AnimationSpeed_MEDIUM )
1750 if( eClickAction == presentation::ClickAction_PROGRAM ||
1751 eClickAction == presentation::ClickAction_BOOKMARK ||
1752 eClickAction == presentation::ClickAction_DOCUMENT )
1754 if( eClickAction == presentation::ClickAction_BOOKMARK )
1764 if( ( nFound & Found::VERB ) && eClickAction == presentation::ClickAction_VERB )
1772 if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND )
1774 if( ( nFound & Found::SOUNDURL ) && !aStrSoundURL.isEmpty() )
1780 if( nFound & Found::PLAYFULL && bPlayFull )
1789 if( nFound & Found::MACRO )
1797 OUString aEventQName(
1802 if( nFound & Found::LIBRARY )
1805 (aStrLibrary.equalsIgnoreAsciiCase(
"StarOffice") ||
1809 sLocation +
":" + aStrMacro);
1819 else if( aClickEventType ==
gsScript )
1821 if( nFound & Found::MACRO )
1827 OUString aEventQName(
1845 OUString aDescription;
1847 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
1848 xProps->getPropertyValue(
"Title") >>= aTitle;
1849 xProps->getPropertyValue(
"Description") >>= aDescription;
1851 if(!aTitle.isEmpty())
1857 if(!aDescription.isEmpty())
1863 catch( uno::Exception& )
1871 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
1872 if(!(xShapes.is() && xShapes->getCount()))
1886 awt::Point aUpperLeft;
1891 aUpperLeft = xShape->getPosition();
1892 pRefPoint = &aUpperLeft;
1900 const uno::Reference< drawing::XShape >& xShape,
1903 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1908 bool bIsPresShape(
false);
1909 bool bIsEmptyPresObj(
false);
1917 bIsPresShape =
true;
1923 bIsPresShape =
true;
1929 bIsPresShape =
true;
1935 bIsPresShape =
true;
1941 bIsPresShape =
true;
1947 bIsPresShape =
true;
1953 bIsPresShape =
true;
1959 bIsPresShape =
true;
1977 sal_Int32 nCornerRadius(0);
1978 xPropSet->getPropertyValue(
"CornerRadius") >>= nCornerRadius;
1981 OUStringBuffer sStringBuffer;
1990 if(!bIsEmptyPresObj)
2001 const uno::Reference< drawing::XShape >& xShape,
2004 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2012 sal_Int32 nCornerRadius(0);
2013 xPropSet->getPropertyValue(
"CornerRadius") >>= nCornerRadius;
2016 OUStringBuffer sStringBuffer;
2033 const uno::Reference< drawing::XShape >& xShape,
2036 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2041 OUStringBuffer sStringBuffer;
2042 awt::Point aStart(0,0);
2043 awt::Point aEnd(1,1);
2054 double fTRShear(0.0);
2055 double fTRRotate(0.0);
2063 uno::Any aAny(xPropSet->getPropertyValue(
"Geometry"));
2064 if (
auto pSourcePolyPolygon
2065 = o3tl::tryAccess<drawing::PointSequenceSequence>(aAny))
2067 if (pSourcePolyPolygon->getLength() > 0)
2069 const drawing::PointSequence& rInnerSequence = (*pSourcePolyPolygon)[0];
2070 if (rInnerSequence.hasElements())
2072 const awt::Point& rPoint = rInnerSequence[0];
2073 aStart = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
2075 if (rInnerSequence.getLength() > 1)
2077 const awt::Point& rPoint = rInnerSequence[1];
2078 aEnd = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
2088 aStr = sStringBuffer.makeStringAndClear();
2101 aStr = sStringBuffer.makeStringAndClear();
2112 aStr = sStringBuffer.makeStringAndClear();
2118 aStr = sStringBuffer.makeStringAndClear();
2133 const uno::Reference< drawing::XShape >& xShape,
2136 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2141 awt::Size aSize = xShape->getSize();
2142 sal_Int32 nRx((aSize.Width + 1) / 2);
2143 sal_Int32 nRy((aSize.Height + 1) / 2);
2144 bool bCircle(nRx == nRy);
2149 drawing::CircleKind eKind = drawing::CircleKind_FULL;
2150 xPropSet->getPropertyValue(
"CircleKind") >>= eKind;
2151 if( eKind != drawing::CircleKind_FULL )
2153 OUStringBuffer sStringBuffer;
2154 sal_Int32 nStartAngle = 0;
2155 sal_Int32 nEndAngle = 0;
2156 xPropSet->getPropertyValue(
"CircleStartAngle") >>= nStartAngle;
2157 xPropSet->getPropertyValue(
"CircleEndAngle") >>= nEndAngle;
2159 const double dStartAngle = nStartAngle / 100.0;
2160 const double dEndAngle = nEndAngle / 100.0;
2180 bCreateNewline,
true);
2190 const uno::Reference< drawing::XShape >& xShape,
2193 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2206 double fTRShear(0.0);
2207 double fTRRotate(0.0);
2227 uno::Any aAny( xPropSet->getPropertyValue(
"Geometry") );
2231 if(aPolyPolygon.count())
2234 const OUString aPolygonString(
2248 uno::Any aAny( xPropSet->getPropertyValue(
"Geometry") );
2252 if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
2267 const OUString aPolygonString(
2299 OUString getNameFromStreamURL(OUString
const & rURL)
2301 const OUString sPackageURL(
"vnd.sun.star.Package:");
2305 if (rURL.match(sPackageURL))
2307 OUString sRequestedName = rURL.copy(sPackageURL.getLength());
2308 sal_Int32 nLastIndex = sRequestedName.lastIndexOf(
'/') + 1;
2309 if ((nLastIndex > 0) && (nLastIndex < sRequestedName.getLength()))
2310 sRequestedName = sRequestedName.copy(nLastIndex);
2311 nLastIndex = sRequestedName.lastIndexOf(
'.');
2312 if (nLastIndex >= 0)
2313 sRequestedName = sRequestedName.copy(0, nLastIndex);
2314 if (!sRequestedName.isEmpty())
2315 sResult = sRequestedName;
2324 const uno::Reference< drawing::XShape >& xShape,
2327 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2331 bool bIsEmptyPresObj =
false;
2343 if (!bIsEmptyPresObj)
2345 uno::Reference<graphic::XGraphic>
xGraphic;
2346 OUString sOutMimeType;
2349 OUString aStreamURL;
2350 xPropSet->getPropertyValue(
"GraphicStreamURL") >>= aStreamURL;
2351 OUString sRequestedName = getNameFromStreamURL(aStreamURL);
2353 xPropSet->getPropertyValue(
"Graphic") >>= xGraphic;
2355 OUString sInternalURL;
2360 if (!sInternalURL.isEmpty())
2363 if (!sRequestedName.isEmpty())
2365 OUString newStreamURL =
"vnd.sun.star.Package:";
2366 if (sInternalURL[0] ==
'#')
2368 newStreamURL += sInternalURL.subView(1, sInternalURL.getLength() - 1);
2372 newStreamURL += sInternalURL;
2375 if (newStreamURL != aStreamURL)
2377 xPropSet->setPropertyValue(
"GraphicStreamURL",
uno::Any(newStreamURL));
2391 if (sOutMimeType.isEmpty())
2395 if (!sOutMimeType.isEmpty())
2401 "mime-type", sOutMimeType);
2412 if (!bIsEmptyPresObj)
2418 const bool bAddReplacementImages = officecfg::Office::Common::Save::Graphic::AddReplacementImages::get();
2419 if( !bIsEmptyPresObj && bAddReplacementImages)
2421 uno::Reference<graphic::XGraphic> xReplacementGraphic;
2422 xPropSet->getPropertyValue(
"ReplacementGraphic") >>= xReplacementGraphic;
2425 if (xReplacementGraphic.is())
2430 if (aMimeType.isEmpty())
2433 if (!aHref.isEmpty())
2447 "mime-type", aMimeType);
2474 const uno::Reference< drawing::XShape >& xShape,
2482 const uno::Reference< drawing::XShape >& xShape,
2485 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2492 uno::Reference< drawing::XControlShape > xControl( xShape, uno::UNO_QUERY );
2493 SAL_WARN_IF( !xControl.is(),
"xmloff",
"Control shape is not supporting XControlShape" );
2496 uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY );
2497 SAL_WARN_IF( !xControlModel.is(),
"xmloff",
"Control shape has not XControlModel" );
2498 if( xControlModel.is() )
2512 const uno::Reference< drawing::XShape >& xShape,
2515 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
2518 OUStringBuffer sStringBuffer;
2521 drawing::ConnectorType
eType = drawing::ConnectorType_STANDARD;
2522 uno::Any aAny = xProps->getPropertyValue(
"EdgeKind");
2525 if( eType != drawing::ConnectorType_STANDARD )
2528 aStr = sStringBuffer.makeStringAndClear();
2533 sal_Int32 nDelta1 = 0, nDelta2 = 0, nDelta3 = 0;
2535 aAny = xProps->getPropertyValue(
"EdgeLine1Delta");
2537 aAny = xProps->getPropertyValue(
"EdgeLine2Delta");
2539 aAny = xProps->getPropertyValue(
"EdgeLine3Delta");
2542 if( nDelta1 != 0 || nDelta2 != 0 || nDelta3 != 0 )
2546 if( nDelta2 != 0 || nDelta3 != 0 )
2548 sStringBuffer.append(
' ' );
2553 sStringBuffer.append(
' ' );
2555 sStringBuffer, nDelta3);
2559 aStr = sStringBuffer.makeStringAndClear();
2564 awt::Point aStart(0,0);
2565 awt::Point aEnd(1,1);
2580 xProps->getPropertySetInfo()->hasPropertyByName(
"StartPositionInHoriL2R") &&
2581 xProps->getPropertySetInfo()->hasPropertyByName(
"EndPositionInHoriL2R") )
2583 xProps->getPropertyValue(
"StartPositionInHoriL2R") >>= aStart;
2584 xProps->getPropertyValue(
"EndPositionInHoriL2R") >>= aEnd;
2588 xProps->getPropertyValue(
"StartPosition") >>= aStart;
2589 xProps->getPropertyValue(
"EndPosition") >>= aEnd;
2594 aStart.X -= pRefPoint->X;
2595 aStart.Y -= pRefPoint->Y;
2596 aEnd.X -= pRefPoint->X;
2597 aEnd.Y -= pRefPoint->Y;
2605 aStr = sStringBuffer.makeStringAndClear();
2618 aStr = sStringBuffer.makeStringAndClear();
2628 aStr = sStringBuffer.makeStringAndClear();
2633 aStr = sStringBuffer.makeStringAndClear();
2637 uno::Reference< uno::XInterface > xRefS;
2638 uno::Reference< uno::XInterface > xRefE;
2641 xProps->getPropertyValue(
"StartShape") >>= xRefS;
2647 aAny = xProps->getPropertyValue(
"StartGluePointIndex");
2648 sal_Int32 nGluePointId = 0;
2649 if( aAny >>= nGluePointId )
2651 if( nGluePointId != -1 )
2659 xProps->getPropertyValue(
"EndShape") >>= xRefE;
2665 aAny = xProps->getPropertyValue(
"EndGluePointIndex");
2666 sal_Int32 nGluePointId = 0;
2667 if( aAny >>= nGluePointId )
2669 if( nGluePointId != -1 )
2677 aAny = xProps->getPropertyValue(
"PolyPolygonBezier");
2678 auto pSourcePolyPolygon = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(aAny);
2679 if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
2683 *pSourcePolyPolygon));
2684 const OUString aPolygonString(
2701 double fTRShear(0.0);
2702 double fTRRotate(0.0);
2705 fTRRotate, aTRTranslate, pRefPoint);
2723 const uno::Reference< drawing::XShape >& xShape,
2726 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
2729 OUStringBuffer sStringBuffer;
2732 awt::Point aStart(0,0);
2733 awt::Point aEnd(1,1);
2748 xProps->getPropertySetInfo()->hasPropertyByName(
"StartPositionInHoriL2R") &&
2749 xProps->getPropertySetInfo()->hasPropertyByName(
"EndPositionInHoriL2R") )
2751 xProps->getPropertyValue(
"StartPositionInHoriL2R") >>= aStart;
2752 xProps->getPropertyValue(
"EndPositionInHoriL2R") >>= aEnd;
2756 xProps->getPropertyValue(
"StartPosition") >>= aStart;
2757 xProps->getPropertyValue(
"EndPosition") >>= aEnd;
2762 aStart.X -= pRefPoint->X;
2763 aStart.Y -= pRefPoint->Y;
2764 aEnd.X -= pRefPoint->X;
2765 aEnd.Y -= pRefPoint->Y;
2773 aStr = sStringBuffer.makeStringAndClear();
2786 aStr = sStringBuffer.makeStringAndClear();
2796 aStr = sStringBuffer.makeStringAndClear();
2801 aStr = sStringBuffer.makeStringAndClear();
2812 uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
2818 const uno::Reference< drawing::XShape >& xShape,
2822 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2823 uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
2825 SAL_WARN_IF( !xPropSet.is() || !xNamed.is(),
"xmloff",
"ole shape is not implementing needed interfaces");
2826 if(!(xPropSet.is() && xNamed.is()))
2832 bool bIsEmptyPresObj =
false;
2844 OUString sPersistName;
2848 if (!bIsEmptyPresObj)
2857 bool bInternal =
false;
2858 xPropSet->getPropertyValue(
"IsInternal") >>= bInternal;
2866 xPropSet->getPropertyValue(
"LinkURL") >>= sURL;
2869 xPropSet->getPropertyValue(
"PersistName") >>= sPersistName;
2870 if ( sURL.isEmpty() )
2872 if( !sPersistName.isEmpty() )
2874 sURL =
"vnd.sun.star.EmbeddedObject:" + sPersistName;
2879 xPropSet->getPropertyValue(
"CLSID") >>= sClassId;
2881 if( !sClassId.isEmpty() )
2884 if(!bExportEmbedded)
2887 if( !sURL.isEmpty() )
2906 if (!bIsEmptyPresObj && supportsText(eShapeType))
2912 if(bExportEmbedded && !bIsEmptyPresObj)
2917 uno::Reference< lang::XComponent > xComp;
2918 xPropSet->getPropertyValue(
"Model") >>= xComp;
2919 SAL_WARN_IF( !xComp.is(),
"xmloff",
"no xModel for own OLE format" );
2928 OUString sURLRequest( sURL );
2930 sURLRequest +=
"?oasis=false";
2935 if( !bIsEmptyPresObj )
2938 if( !bExportEmbedded )
2950 if( bExportEmbedded )
2961 const uno::Reference< drawing::XShape >& xShape,
2964 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2972 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
2973 const OUString aPageNumberStr(
"PageNumber");
2974 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
2976 sal_Int32 nPageNumber = 0;
2977 xPropSet->getPropertyValue(aPageNumberStr) >>= nPageNumber;
2997 const uno::Reference< drawing::XShape >& xShape,
3000 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3008 sal_Int32 nCornerRadius(0);
3009 xPropSet->getPropertyValue(
"CornerRadius") >>= nCornerRadius;
3012 OUStringBuffer sStringBuffer;
3018 awt::Point aCaptionPoint;
3019 xPropSet->getPropertyValue(
"CaptionPoint") >>= aCaptionPoint;
3036 bCreateNewline,
true );
3048 const uno::Reference< drawing::XShape >& xShape,
3051 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3064 xPropSet->getPropertyValue(
"FrameURL") >>= aStr;
3071 xPropSet->getPropertyValue(
"FrameName") >>= aStr;
3072 if( !aStr.isEmpty() )
3083 const uno::Reference< drawing::XShape >& xShape,
3086 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3099 xPropSet->getPropertyValue(
"AppletCodeBase") >>= aStr;
3106 xPropSet->getPropertyValue(
"AppletName") >>= aStr;
3107 if( !aStr.isEmpty() )
3111 xPropSet->getPropertyValue(
"AppletCode") >>= aStr;
3115 bool bIsScript =
false;
3116 xPropSet->getPropertyValue(
"AppletIsScript") >>= bIsScript;
3124 uno::Sequence< beans::PropertyValue > aCommands;
3125 xPropSet->getPropertyValue(
"AppletCommands") >>= aCommands;
3126 for(
const auto& rCommand : std::as_const(aCommands) )
3128 rCommand.Value >>= aStr;
3138 const uno::Reference< drawing::XShape >& xShape,
3141 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3154 xPropSet->getPropertyValue(
"PluginURL") >>= aStr;
3161 xPropSet->getPropertyValue(
"PluginMimeType") >>= aStr;
3170 uno::Sequence< beans::PropertyValue > aCommands;
3171 xPropSet->getPropertyValue(
"PluginCommands") >>= aCommands;
3172 for(
const auto& rCommand : std::as_const(aCommands) )
3174 rCommand.Value >>= aStr;
3184 uno::Reference<io::XInputStream>
const& xInStream,
3185 uno::Reference<embed::XStorage>
const& xTarget,
3186 OUString
const& rPath,
const OUString& rMimeType)
3189 uno::Reference<io::XStream>
const xStream(
3191 embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, proxy));
3192 uno::Reference<io::XOutputStream>
const xOutStream(
3193 (xStream.is()) ? xStream->getOutputStream() :
nullptr);
3194 if (!xOutStream.is())
3196 SAL_WARN(
"xmloff",
"no output stream");
3197 throw uno::Exception(
"no output stream",
nullptr);
3199 uno::Reference< beans::XPropertySet >
const xStreamProps(xStream,
3201 if (xStreamProps.is()) {
3202 xStreamProps->setPropertyValue(
"MediaType",
3203 uno::makeAny(rMimeType));
3204 xStreamProps->setPropertyValue(
3206 uno::makeAny(
false));
3209 xOutStream->closeOutput();
3215 uno::Reference<beans::XPropertySet>
const& xPropSet,
3216 OUString
const& rURL,
const OUString& rMimeType)
3219 if (rURL.startsWithIgnoreAsciiCase(
"vnd.sun.star.Package:", &urlPath))
3223 uno::Reference<embed::XStorage>
const xTarget(
3225 uno::Reference<io::XInputStream> xInStream;
3226 xPropSet->getPropertyValue(
"PrivateStream")
3229 if (!xInStream.is())
3231 SAL_WARN(
"xmloff",
"no input stream");
3239 catch (uno::Exception
const&)
3252 const uno::Reference< drawing::XShape >& xShape,
3255 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3272 xPropSet->getPropertyValue(
"MediaURL") >>= aMediaURL;
3274 xPropSet->getPropertyValue(
"MediaMimeType") >>= sMimeType;
3276 OUString
const persistentURL =
3294 const OUString aLoopStr(
"Loop" );
3295 xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
3301 const OUString aMuteStr(
"Mute" );
3302 xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
3307 sal_Int16 nVolumeDB = 0;
3308 xPropSet->getPropertyValue(
"VolumeDB") >>= nVolumeDB;
3313 media::ZoomLevel eZoom;
3314 OUString aZoomValue;
3315 xPropSet->getPropertyValue(
"Zoom") >>= eZoom;
3318 case media::ZoomLevel_ZOOM_1_TO_4 : aZoomValue =
"25%";
break;
3319 case media::ZoomLevel_ZOOM_1_TO_2 : aZoomValue =
"50%";
break;
3320 case media::ZoomLevel_ORIGINAL : aZoomValue =
"100%";
break;
3321 case media::ZoomLevel_ZOOM_2_TO_1 : aZoomValue =
"200%";
break;
3322 case media::ZoomLevel_ZOOM_4_TO_1 : aZoomValue =
"400%";
break;
3323 case media::ZoomLevel_FIT_TO_WINDOW: aZoomValue =
"fit";
break;
3324 case media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT: aZoomValue =
"fixedfit";
break;
3325 case media::ZoomLevel_FULLSCREEN : aZoomValue =
"fullscreen";
break;
3331 if( !aZoomValue.isEmpty() )
3342 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
3343 if(!(xShapes.is() && xShapes->getCount()))
3346 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
3347 SAL_WARN_IF( !xPropSet.is(),
"xmloff",
"XMLShapeExport::ImpExport3DSceneShape can't export a scene without a propertyset" );
3348 if( !xPropSet.is() )
3370 awt::Point aUpperLeft;
3375 aUpperLeft = xShape->getPosition();
3376 pRefPoint = &aUpperLeft;
3384 const uno::Reference< drawing::XShape >& xShape,
3387 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3392 OUStringBuffer sStringBuffer;
3395 uno::Any aAny = xPropSet->getPropertyValue(
"D3DTransformMatrix");
3396 drawing::HomogenMatrix aHomMat;
3408 aAny = xPropSet->getPropertyValue(
"D3DPosition");
3409 drawing::Position3D aPosition3D;
3410 aAny >>= aPosition3D;
3411 ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
3414 aAny = xPropSet->getPropertyValue(
"D3DSize");
3415 drawing::Direction3D aDirection3D;
3416 aAny >>= aDirection3D;
3417 ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
3420 aDir3D = aPos3D + aDir3D;
3426 aStr = sStringBuffer.makeStringAndClear();
3434 aStr = sStringBuffer.makeStringAndClear();
3448 aAny = xPropSet->getPropertyValue(
"D3DPosition");
3449 drawing::Position3D aPosition3D;
3450 aAny >>= aPosition3D;
3451 ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
3454 aAny = xPropSet->getPropertyValue(
"D3DSize");
3455 drawing::Direction3D aDirection3D;
3456 aAny >>= aDirection3D;
3457 ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
3463 aStr = sStringBuffer.makeStringAndClear();
3471 aStr = sStringBuffer.makeStringAndClear();
3486 aAny = xPropSet->getPropertyValue(
"D3DPolyPolygon3D");
3487 drawing::PolyPolygonShape3D aUnoPolyPolygon3D;
3488 aAny >>= aUnoPolyPolygon3D;
3493 aUnoPolyPolygon3D));
3500 aB3DHomMatrixFor2DConversion));
3507 aPolyPolygonRange.getMinX(),
3508 aPolyPolygonRange.getMinY(),
3509 aPolyPolygonRange.getWidth(),
3510 aPolyPolygonRange.getHeight());
3515 const OUString aPolygonString(
3546 OUStringBuffer sStringBuffer;
3549 uno::Any aAny = xPropSet->getPropertyValue(
"D3DTransformMatrix");
3550 drawing::HomogenMatrix aHomMat;
3558 aAny = xPropSet->getPropertyValue(
"D3DCameraGeometry");
3559 drawing::CameraGeometry aCamGeo;
3562 ::basegfx::B3DVector aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
3566 aStr = sStringBuffer.makeStringAndClear();
3570 ::basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
3574 aStr = sStringBuffer.makeStringAndClear();
3578 ::basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
3582 aStr = sStringBuffer.makeStringAndClear();
3587 aAny = xPropSet->getPropertyValue(
"D3DScenePerspective");
3588 drawing::ProjectionMode aPrjMode;
3590 if(aPrjMode == drawing::ProjectionMode_PARALLEL)
3597 aAny = xPropSet->getPropertyValue(
"D3DSceneDistance");
3598 sal_Int32 nDistance = 0;
3602 aStr = sStringBuffer.makeStringAndClear();
3606 aAny = xPropSet->getPropertyValue(
"D3DSceneFocalLength");
3607 sal_Int32 nFocalLength = 0;
3608 aAny >>= nFocalLength;
3611 aStr = sStringBuffer.makeStringAndClear();
3615 aAny = xPropSet->getPropertyValue(
"D3DSceneShadowSlant");
3616 sal_Int16 nShadowSlant = 0;
3617 aAny >>= nShadowSlant;
3621 aAny = xPropSet->getPropertyValue(
"D3DSceneShadeMode");
3622 drawing::ShadeMode aShadeMode;
3623 if(aAny >>= aShadeMode)
3625 if(aShadeMode == drawing::ShadeMode_FLAT)
3627 else if(aShadeMode == drawing::ShadeMode_PHONG)
3629 else if(aShadeMode == drawing::ShadeMode_SMOOTH)
3642 aAny = xPropSet->getPropertyValue(
"D3DSceneAmbientColor");
3643 sal_Int32 nAmbientColor = 0;
3644 aAny >>= nAmbientColor;
3646 aStr = sStringBuffer.makeStringAndClear();
3650 aAny = xPropSet->getPropertyValue(
"D3DSceneTwoSidedLighting");
3651 bool bTwoSidedLighting =
false;
3652 aAny >>= bTwoSidedLighting;
3654 aStr = sStringBuffer.makeStringAndClear();
3663 OUStringBuffer sStringBuffer;
3665 const OUString aColorPropName(
"D3DSceneLightColor");
3666 const OUString aDirectionPropName(
"D3DSceneLightDirection");
3667 const OUString aLightOnPropName(
"D3DSceneLightOn");
3670 drawing::Direction3D aLightDir;
3671 bool bLightOnOff =
false;
3672 for(sal_Int32 nLamp = 1; nLamp <= 8; nLamp++)
3674 OUString aIndexStr = OUString::number( nLamp );
3677 OUString aPropName = aColorPropName + aIndexStr;
3678 sal_Int32 nLightColor = 0;
3679 xPropSet->getPropertyValue( aPropName ) >>= nLightColor;
3681 aStr = sStringBuffer.makeStringAndClear();
3685 aPropName = aDirectionPropName + aIndexStr;
3686 xPropSet->getPropertyValue(aPropName) >>= aLightDir;
3687 aLightDirection =
::basegfx::B3DVector(aLightDir.DirectionX, aLightDir.DirectionY, aLightDir.DirectionZ);
3689 aStr = sStringBuffer.makeStringAndClear();
3693 aPropName = aLightOnPropName + aIndexStr;
3694 xPropSet->getPropertyValue(aPropName) >>= bLightOnOff;
3696 aStr = sStringBuffer.makeStringAndClear();
3713 static void ExportParameter( OUStringBuffer& rStrBuffer,
const css::drawing::EnhancedCustomShapeParameter& rParameter )
3715 if ( !rStrBuffer.isEmpty() )
3716 rStrBuffer.append(
' ' );
3717 if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
3719 double fNumber = 0.0;
3720 rParameter.Value >>= fNumber;
3721 ::rtl::math::doubleToUStringBuffer( rStrBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
'.',
true );
3726 rParameter.Value >>= nValue;
3728 switch( rParameter.Type )
3730 case css::drawing::EnhancedCustomShapeParameterType::EQUATION :
3732 rStrBuffer.append(
"?f" ).append(OUString::number( nValue ) );
3736 case css::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT :
3738 rStrBuffer.append(
'$' );
3739 rStrBuffer.append( OUString::number( nValue ) );
3743 case css::drawing::EnhancedCustomShapeParameterType::BOTTOM :
3745 case css::drawing::EnhancedCustomShapeParameterType::RIGHT :
3747 case css::drawing::EnhancedCustomShapeParameterType::TOP :
3749 case css::drawing::EnhancedCustomShapeParameterType::LEFT :
3751 case css::drawing::EnhancedCustomShapeParameterType::XSTRETCH :
3753 case css::drawing::EnhancedCustomShapeParameterType::YSTRETCH :
3755 case css::drawing::EnhancedCustomShapeParameterType::HASSTROKE :
3757 case css::drawing::EnhancedCustomShapeParameterType::HASFILL :
3759 case css::drawing::EnhancedCustomShapeParameterType::WIDTH :
3761 case css::drawing::EnhancedCustomShapeParameterType::HEIGHT :
3763 case css::drawing::EnhancedCustomShapeParameterType::LOGWIDTH :
3765 case css::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT :
3768 rStrBuffer.append( OUString::number( nValue ) );
3776 for ( i = 0; i < rEquations.getLength(); i++ )
3778 OUString
aStr=
"f" + OUString::number( i );
3781 aStr = rEquations[ i ];
3785 nIndex = aStr.indexOf(
'?', nIndex );
3788 aStr = OUString::Concat(aStr.subView(0, nIndex + 1)) +
"f"
3789 + aStr.subView(nIndex + 1, aStr.getLength() - nIndex - 1);
3792 }
while( nIndex != -1 );
3800 if ( !rHandles.hasElements() )
3804 OUStringBuffer aStrBuffer;
3806 for (
const uno::Sequence< beans::PropertyValue >& rPropSeq : rHandles )
3808 bool bPosition =
false;
3809 for (
const beans::PropertyValue& rPropVal : rPropSeq )
3811 switch(
EASGet( rPropVal.Name ) )
3815 css::drawing::EnhancedCustomShapeParameterPair aPosition;
3816 if ( rPropVal.Value >>= aPosition )
3820 aStr = aStrBuffer.makeStringAndClear();
3829 if ( rPropVal.Value >>= bMirroredX )
3837 if ( rPropVal.Value >>= bMirroredY )
3845 if ( rPropVal.Value >>= bSwitched )
3852 css::drawing::EnhancedCustomShapeParameterPair aPolar;
3853 if ( rPropVal.Value >>= aPolar )
3857 aStr = aStrBuffer.makeStringAndClear();
3864 css::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
3865 if ( rPropVal.Value >>= aRadiusRangeMinimum )
3868 aStr = aStrBuffer.makeStringAndClear();
3875 css::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
3876 if ( rPropVal.Value >>= aRadiusRangeMaximum )
3879 aStr = aStrBuffer.makeStringAndClear();
3886 css::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
3887 if ( rPropVal.Value >>= aXRangeMinimum )
3890 aStr = aStrBuffer.makeStringAndClear();
3897 css::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
3898 if ( rPropVal.Value >>= aXRangeMaximum )
3901 aStr = aStrBuffer.makeStringAndClear();
3908 css::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
3909 if ( rPropVal.Value >>= aYRangeMinimum )
3912 aStr = aStrBuffer.makeStringAndClear();
3919 css::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
3920 if ( rPropVal.Value >>= aYRangeMaximum )
3923 aStr = aStrBuffer.makeStringAndClear();
3940 const uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair >& rCoordinates,
3941 const uno::Sequence< css::drawing::EnhancedCustomShapeSegment >& rSegments,
3942 bool bExtended =
false )
3946 OUStringBuffer aStrBuffer;
3947 bool bNeedExtended =
false;
3949 sal_Int32
i, j, k, l;
3951 sal_Int32 nCoords = rCoordinates.getLength();
3952 sal_Int32 nSegments = rSegments.getLength();
3953 bool bSimpleSegments = nSegments == 0;
3954 if ( bSimpleSegments )
3956 for ( j = i = 0; j < nSegments; j++ )
3958 css::drawing::EnhancedCustomShapeSegment aSegment;
3959 if ( bSimpleSegments )
3967 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
3972 aSegment.Count =
static_cast<sal_Int16
>(std::min( nCoords - 1, sal_Int32(32767) ));
3973 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
3979 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
3985 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
3991 aSegment = rSegments[ j ];
3993 if ( !aStrBuffer.isEmpty() )
3994 aStrBuffer.append(
' ' );
3996 sal_Int32 nParameter = 0;
3997 switch( aSegment.Command )
3999 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH :
4000 aStrBuffer.append(
'Z' );
break;
4001 case css::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH :
4002 aStrBuffer.append(
'N' );
break;
4003 case css::drawing::EnhancedCustomShapeSegmentCommand::NOFILL :
4004 aStrBuffer.append(
'F' );
break;
4005 case css::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE :
4006 aStrBuffer.append(
'S' );
break;
4008 case css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO :
4009 aStrBuffer.append(
'M' ); nParameter = 1;
break;
4010 case css::drawing::EnhancedCustomShapeSegmentCommand::LINETO :
4011 aStrBuffer.append(
'L' ); nParameter = 1;
break;
4012 case css::drawing::EnhancedCustomShapeSegmentCommand::CURVETO :
4013 aStrBuffer.append(
'C' ); nParameter = 3;
break;
4014 case css::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
4015 aStrBuffer.append(
'T' ); nParameter = 3;
break;
4016 case css::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
4017 aStrBuffer.append(
'U' ); nParameter = 3;
break;
4018 case css::drawing::EnhancedCustomShapeSegmentCommand::ARCTO :
4019 aStrBuffer.append(
'A' ); nParameter = 4;
break;
4020 case css::drawing::EnhancedCustomShapeSegmentCommand::ARC :
4021 aStrBuffer.append(
'B' ); nParameter = 4;
break;
4022 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
4023 aStrBuffer.append(
'W' ); nParameter = 4;
break;
4024 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
4025 aStrBuffer.append(
'V' ); nParameter = 4;
break;
4026 case css::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
4027 aStrBuffer.append(
'X' ); nParameter = 1;
break;
4028 case css::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
4029 aStrBuffer.append(
'Y' ); nParameter = 1;
break;
4030 case css::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO :
4031 aStrBuffer.append(
'Q' ); nParameter = 2;
break;
4032 case css::drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO :
4034 aStrBuffer.append(
'G' );
4037 aStrBuffer.setLength( aStrBuffer.getLength() - 1);
4038 bNeedExtended =
true;
4042 case css::drawing::EnhancedCustomShapeSegmentCommand::DARKEN :
4044 aStrBuffer.append(
'H' );
4046 bNeedExtended =
true;
4048 case css::drawing::EnhancedCustomShapeSegmentCommand::DARKENLESS :
4050 aStrBuffer.append(
'I' );
4052 bNeedExtended =
true;
4054 case css::drawing::EnhancedCustomShapeSegmentCommand::LIGHTEN :
4056 aStrBuffer.append(
'J' );
4058 bNeedExtended =
true;
4060 case css::drawing::EnhancedCustomShapeSegmentCommand::LIGHTENLESS :
4062 aStrBuffer.append(
'K' );
4064 bNeedExtended =
true;
4069 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
4075 for ( k = 0; k < aSegment.Count; k++ )
4077 if ( ( i + nParameter ) <= nCoords )
4079 for ( l = 0; l < nParameter; l++ )
4093 aStr = aStrBuffer.makeStringAndClear();
4101 bool bEquations =
false;
4102 uno::Sequence< OUString > aEquations;
4104 bool bHandles =
false;
4105 uno::Sequence< beans::PropertyValues > aHandles;
4107 uno::Sequence< css::drawing::EnhancedCustomShapeSegment >
aSegments;
4108 uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
4110 uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues;
4113 OUStringBuffer aStrBuffer;
4116 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
4119 const OUString sCustomShapeGeometry(
"CustomShapeGeometry" );
4120 if ( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sCustomShapeGeometry ) )
4122 uno::Any aGeoPropSet( xPropSet->getPropertyValue( sCustomShapeGeometry ) );
4123 uno::Sequence< beans::PropertyValue > aGeoPropSeq;
4125 if ( aGeoPropSet >>= aGeoPropSeq )
4127 bool bCoordinates =
false;
4128 OUString aCustomShapeType(
"non-primitive" );
4130 for (
const beans::PropertyValue& rGeoProp : std::as_const(aGeoPropSeq) )
4132 switch(
EASGet( rGeoProp.Name ) )
4136 rGeoProp.Value >>= aCustomShapeType;
4142 if ( rGeoProp.Value >>= bMirroredX )
4150 if ( rGeoProp.Value >>= bMirroredY )
4157 awt::Rectangle aRect;
4158 if ( rGeoProp.Value >>= aRect )
4168 double fTextRotateAngle = 0;
4169 if ( ( rGeoProp.Value >>= fTextRotateAngle ) && fTextRotateAngle != 0 )
4172 aStrBuffer, fTextRotateAngle );
4173 aStr = aStrBuffer.makeStringAndClear();
4180 uno::Sequence< beans::PropertyValue > aExtrusionPropSeq;
4181 if ( rGeoProp.Value >>= aExtrusionPropSeq )
4183 for (
const beans::PropertyValue& rProp : std::as_const(aExtrusionPropSeq) )
4185 switch(
EASGet( rProp.Name ) )
4190 if ( rProp.Value >>= bExtrusionOn )
4197 double fExtrusionBrightness = 0;
4198 if ( rProp.Value >>= fExtrusionBrightness )
4202 fExtrusionBrightness,
4204 util::MeasureUnit::PERCENT,
4205 util::MeasureUnit::PERCENT);
4206 aStrBuffer.append(
'%' );
4207 aStr = aStrBuffer.makeStringAndClear();
4214 css::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
4215 if ( rProp.Value >>= aDepthParaPair )
4218 if ( aDepthParaPair.First.Value >>= fDepth )
4222 aStr = aStrBuffer.makeStringAndClear();
4230 double fExtrusionDiffusion = 0;
4231 if ( rProp.Value >>= fExtrusionDiffusion )
4235 fExtrusionDiffusion,
4237 util::MeasureUnit::PERCENT,
4238 util::MeasureUnit::PERCENT);
4239 aStrBuffer.append(
'%' );
4240 aStr = aStrBuffer.makeStringAndClear();
4247 sal_Int32 nExtrusionNumberOfLineSegments = 0;
4248 if ( rProp.Value >>= nExtrusionNumberOfLineSegments )
4254 bool bExtrusionLightFace;
4255 if ( rProp.Value >>= bExtrusionLightFace )
4262 bool bExtrusionFirstLightHarsh;
4263 if ( rProp.Value >>= bExtrusionFirstLightHarsh )
4270 bool bExtrusionSecondLightHarsh;
4271 if ( rProp.Value >>= bExtrusionSecondLightHarsh )
4278 double fExtrusionFirstLightLevel = 0;
4279 if ( rProp.Value >>= fExtrusionFirstLightLevel )
4283 fExtrusionFirstLightLevel,
4285 util::MeasureUnit::PERCENT,
4286 util::MeasureUnit::PERCENT);
4287 aStrBuffer.append(
'%' );
4288 aStr = aStrBuffer.makeStringAndClear();
4295 double fExtrusionSecondLightLevel = 0;
4296 if ( rProp.Value >>= fExtrusionSecondLightLevel )
4300 fExtrusionSecondLightLevel,
4302 util::MeasureUnit::PERCENT,
4303 util::MeasureUnit::PERCENT);
4304 aStrBuffer.append(
'%' );
4305 aStr = aStrBuffer.makeStringAndClear();
4312 drawing::Direction3D aExtrusionFirstLightDirection;
4313 if ( rProp.Value >>= aExtrusionFirstLightDirection )
4315 ::basegfx::B3DVector aVec3D( aExtrusionFirstLightDirection.DirectionX, aExtrusionFirstLightDirection.DirectionY,
4316 aExtrusionFirstLightDirection.DirectionZ );
4318 aStr = aStrBuffer.makeStringAndClear();
4325 drawing::Direction3D aExtrusionSecondLightDirection;
4326 if ( rProp.Value >>= aExtrusionSecondLightDirection )
4328 ::basegfx::B3DVector aVec3D( aExtrusionSecondLightDirection.DirectionX, aExtrusionSecondLightDirection.DirectionY,
4329 aExtrusionSecondLightDirection.DirectionZ );
4331 aStr = aStrBuffer.makeStringAndClear();
4338 bool bExtrusionMetal;
4339 if ( rProp.Value >>= bExtrusionMetal )
4347 drawing::ShadeMode eShadeMode;
4348 if( rProp.Value >>= eShadeMode )
4350 if( eShadeMode == drawing::ShadeMode_FLAT )
4352 else if( eShadeMode == drawing::ShadeMode_PHONG )
4354 else if( eShadeMode == drawing::ShadeMode_SMOOTH )
4369 css::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair;
4370 if ( rProp.Value >>= aRotateAngleParaPair )
4374 aStr = aStrBuffer.makeStringAndClear();
4381 drawing::Direction3D aExtrusionRotationCenter;
4382 if ( rProp.Value >>= aExtrusionRotationCenter )
4384 ::basegfx::B3DVector aVec3D( aExtrusionRotationCenter.DirectionX, aExtrusionRotationCenter.DirectionY,
4385 aExtrusionRotationCenter.DirectionZ );
4387 aStr = aStrBuffer.makeStringAndClear();
4394 double fExtrusionShininess = 0;
4395 if ( rProp.Value >>= fExtrusionShininess )
4399 fExtrusionShininess,
4401 util::MeasureUnit::PERCENT,
4402 util::MeasureUnit::PERCENT);
4403 aStrBuffer.append(
'%' );
4404 aStr = aStrBuffer.makeStringAndClear();
4411 css::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
4412 if ( rProp.Value >>= aSkewParaPair )
4416 aStr = aStrBuffer.makeStringAndClear();
4423 double fExtrusionSpecularity = 0;
4424 if ( rProp.Value >>= fExtrusionSpecularity )
4428 fExtrusionSpecularity,
4430 util::MeasureUnit::PERCENT,
4431 util::MeasureUnit::PERCENT);
4432 aStrBuffer.append(
'%' );
4433 aStr = aStrBuffer.makeStringAndClear();
4440 drawing::ProjectionMode eProjectionMode;
4441 if ( rProp.Value >>= eProjectionMode )
4448 drawing::Position3D aExtrusionViewPoint;
4449 if ( rProp.Value >>= aExtrusionViewPoint )
4452 aStr = aStrBuffer.makeStringAndClear();
4459 css::drawing::EnhancedCustomShapeParameterPair aOriginParaPair;
4460 if ( rProp.Value >>= aOriginParaPair )
4464 aStr = aStrBuffer.makeStringAndClear();
4471 bool bExtrusionColor;
4472 if ( rProp.Value >>= bExtrusionColor )
4488 uno::Sequence< beans::PropertyValue > aTextPathPropSeq;
4489 if ( rGeoProp.Value >>= aTextPathPropSeq )
4491 for (
const beans::PropertyValue& rProp : std::as_const(aTextPathPropSeq) )
4493 switch(
EASGet( rProp.Name ) )
4498 if ( rProp.Value >>= bTextPathOn )
4505 css::drawing::EnhancedCustomShapeTextPathMode eTextPathMode;
4506 if ( rProp.Value >>= eTextPathMode )
4508 switch ( eTextPathMode )
4511 case css::drawing::EnhancedCustomShapeTextPathMode_PATH : aStr =
GetXMLToken(
XML_PATH );
break;
4512 case css::drawing::EnhancedCustomShapeTextPathMode_SHAPE : aStr =
GetXMLToken(
XML_SHAPE );
break;
4516 if ( !aStr.isEmpty() )
4524 if ( rProp.Value >>= bScaleX )
4533 bool bSameLetterHeights;
4534 if ( rProp.Value >>= bSameLetterHeights )
4548 uno::Sequence< beans::PropertyValue > aPathPropSeq;
4549 if ( rGeoProp.Value >>= aPathPropSeq )
4551 for (
const beans::PropertyValue& rProp : std::as_const(aPathPropSeq) )
4553 switch(
EASGet( rProp.Name ) )
4562 uno::Sequence< awt::Size > aSubViewSizes;
4563 rProp.Value >>= aSubViewSizes;
4565 for (
int nIdx = 0; nIdx < aSubViewSizes.getLength(); nIdx++ )
4568 aStrBuffer.append(
' ');
4569 aStrBuffer.append( aSubViewSizes[nIdx].
Width );
4570 aStrBuffer.append(
' ');
4571 aStrBuffer.append( aSubViewSizes[nIdx].
Height );
4573 aStr = aStrBuffer.makeStringAndClear();
4579 bool bExtrusionAllowed;
4580 if ( rProp.Value >>= bExtrusionAllowed )
4587 bool bConcentricGradientFillAllowed;
4588 if ( rProp.Value >>= bConcentricGradientFillAllowed )
4595 bool bTextPathAllowed;
4596 if ( rProp.Value >>= bTextPathAllowed )
4603 css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> aGluePoints;
4604 if ( rProp.Value >>= aGluePoints )
4606 if ( aGluePoints.hasElements() )
4608 for(
const auto& rGluePoint : std::as_const(aGluePoints) )
4613 aStr = aStrBuffer.makeStringAndClear();
4621 sal_Int16 nGluePointType = sal_Int16();
4622 if ( rProp.Value >>= nGluePointType )
4624 switch ( nGluePointType )
4626 case css::drawing::EnhancedCustomShapeGluePointType::NONE : aStr =
GetXMLToken(
XML_NONE );
break;
4630 if ( !aStr.isEmpty() )
4637 bCoordinates = ( rProp.Value >>= aCoordinates );
4642 rProp.Value >>= aSegments;
4647 sal_Int32 nStretchPoint = 0;
4648 if ( rProp.Value >>= nStretchPoint )
4654 sal_Int32 nStretchPoint = 0;
4655 if ( rProp.Value >>= nStretchPoint )
4661 css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > aPathTextFrames;
4662 if ( rProp.Value >>= aPathTextFrames )
4664 if ( aPathTextFrames.hasElements() )
4666 for (
const auto& rPathTextFrame : std::as_const(aPathTextFrames) )
4673 aStr = aStrBuffer.makeStringAndClear();
4688 bEquations = ( rGeoProp.Value >>= aEquations );
4693 bHandles = ( rGeoProp.Value >>= aHandles );
4698 rGeoProp.Value >>= aAdjustmentValues;
4708 sal_Int32 nAdjustmentValues = aAdjustmentValues.getLength();
4709 if ( nAdjustmentValues )
4712 for ( i = 0; i < nAdjustmentValues; i++ )
4715 aStrBuffer.append(
' ' );
4717 const css::drawing::EnhancedCustomShapeAdjustmentValue& rAdj = aAdjustmentValues[ i ];
4718 if ( rAdj.State == beans::PropertyState_DIRECT_VALUE )
4720 if ( rAdj.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
4722 double fValue = 0.0;
4723 rAdj.Value >>= fValue;
4728 rAdj.Value >>= nValue;
4729 aStrBuffer.append(nValue);
4735 aStrBuffer.append(
"0");
4738 aStr = aStrBuffer.makeStringAndClear();
4753 const uno::Reference< drawing::XShape >& xShape,
4756 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
4757 if ( !xPropSet.is() )
4760 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
4765 if ( xPropSetInfo.is() )
4768 if ( xPropSetInfo->hasPropertyByName(
"CustomShapeEngine" ) )
4770 uno::Any aEngine( xPropSet->getPropertyValue(
"CustomShapeEngine" ) );
4771 if ( ( aEngine >>= aStr ) && !aStr.isEmpty() )
4774 if ( xPropSetInfo->hasPropertyByName(
"CustomShapeData" ) )
4776 uno::Any aData( xPropSet->getPropertyValue(
"CustomShapeData" ) );
4777 if ( (
aData >>= aStr ) && !aStr.isEmpty() )
4793 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
4794 uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
4796 SAL_WARN_IF( !xPropSet.is() || !xNamed.is(),
"xmloff",
"xmloff::XMLShapeExport::ImpExportTableShape(), table shape is not implementing needed interfaces");
4797 if(!(xPropSet.is() && xNamed.is()))
4805 bool bIsEmptyPresObj =
false;
4819 if( !bIsEmptyPresObj )
4821 uno::Reference< container::XNamed > xTemplate( xPropSet->getPropertyValue(
"TableTemplate"), uno::UNO_QUERY );
4822 if( xTemplate.is() )
4824 const OUString sTemplate( xTemplate->getName() );
4825 if( !sTemplate.isEmpty() )
4834 const OUString sAPIPropertyName( pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US );
4836 xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool;
4840 catch( uno::Exception& )
4848 uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue(
gsModel ), uno::UNO_QUERY_THROW );
4853 if( !bIsEmptyPresObj )
4855 uno::Reference< graphic::XGraphic >
xGraphic( xPropSet->getPropertyValue(
"ReplacementGraphic"), uno::UNO_QUERY );
4860 uno::Reference< embed::XStorage > xPictureStorage;
4861 uno::Reference< embed::XStorage > xStorage;
4862 uno::Reference< io::XStream > xPictureStream;
4864 OUString sPictureName;
4865 if( bExportEmbedded )
4867 xPictureStream.set( xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.comp.MemoryStream", xContext), uno::UNO_QUERY_THROW );
4871 xStorage.set(
GetExport().GetTargetStorage(), uno::UNO_SET_THROW );
4873 xPictureStorage.set( xStorage->openStorageElement(
"Pictures" , ::embed::ElementModes::READWRITE ), uno::UNO_SET_THROW );
4878 sPictureName =
"TablePreview" + OUString::number( ++nIndex ) +
".svm";
4880 while( xPictureStorage->hasByName( sPictureName ) );
4882 xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, ::embed::ElementModes::READWRITE ), uno::UNO_SET_THROW );
4885 uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) );
4886 uno::Sequence< beans::PropertyValue > aArgs( 2 );
4887 aArgs[ 0 ].Name =
"MimeType";
4888 aArgs[ 0 ].Value <<= OUString(
"image/x-vclgraphic" );
4889 aArgs[ 1 ].Name =
"OutputStream";
4890 aArgs[ 1 ].Value <<= xPictureStream->getOutputStream();
4891 xProvider->storeGraphic(
xGraphic, aArgs );
4893 if( xPictureStorage.is() )
4895 uno::Reference< embed::XTransactedObject > xTrans( xPictureStorage, uno::UNO_QUERY );
4900 if( !bExportEmbedded )
4902 OUString sURL =
"Pictures/" + sPictureName;
4911 if( bExportEmbedded )
4913 uno::Reference< io::XSeekableInputStream > xSeekable( xPictureStream, uno::UNO_QUERY_THROW );
4920 catch( uno::Exception
const & )
4930 catch( uno::Exception
const & )
css::uno::Reference< css::embed::XStorage > const & GetTargetStorage() const
#define SO3_RPTCH_CLASSID
SAL_DLLPRIVATE void ImpExportPolygonShape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
constexpr OUStringLiteral gsVerb(u"Verb")
void exportShapes(const css::uno::Reference< css::drawing::XShapes > &xShapes, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
static void ExportParameter(OUStringBuffer &rStrBuffer, const css::drawing::EnhancedCustomShapeParameter &rParameter)
constexpr OUStringLiteral gsModel(u"Model")
SAL_DLLPRIVATE void ImpExportCaptionShape(const css::uno::Reference< css::drawing::XShape > &xShape, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
void convertDouble(OUStringBuffer &rBuffer, double fNumber) const
convert double number to string (using ::rtl::math) and DO convert to export MapUnit using meCoreMeas...
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
rtl::Reference< XMLShapeExport > const & GetShapeExport()
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
SAL_DLLPRIVATE void ImpCalcShapeType(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType &eShapeType)
SAL_DLLPRIVATE bool ImpExportPresentationAttributes(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const OUString &rClass)
EnhancedCustomShapeTokenEnum EASGet(const OUString &rShapeType)
ShapesInfos maShapesInfos
constexpr sal_uInt16 XML_NAMESPACE_DR3D
::comphelper::UnoInterfaceToUniqueIdentifierMapper & getInterfaceToIdentifierMapper()
constexpr sal_uInt16 XML_NAMESPACE_DRAW_EXT
SAL_DLLPRIVATE void ImpExportPageShape(const css::uno::Reference< css::drawing::XShape > &xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures=SEF_DEFAULT, css::awt::Point *pRefPoint=nullptr)
static void CopyInputToOutput(const css::uno::Reference< css::io::XInputStream > &xInput, const css::uno::Reference< css::io::XOutputStream > &xOutput)
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
#define XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE
SAL_DLLPRIVATE void ImpExportQRCode(const css::uno::Reference< css::drawing::XShape > &xShape)
constexpr sal_uInt16 XML_NAMESPACE_SCRIPT
constexpr OUStringLiteral gsMacroName(u"MacroName")
SvXMLEnumMapEntry< drawing::ConnectorType > const aXML_ConnectionKind_EnumMap[]
SAL_DLLPRIVATE void ImpExportSignatureLine(const css::uno::Reference< css::drawing::XShape > &xShape)
rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport()
const SvXMLUnitConverter & GetMM100UnitConverter() const
static void ImpExportEnhancedPath(SvXMLExport &rExport, const uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > &rCoordinates, const uno::Sequence< css::drawing::EnhancedCustomShapeSegment > &rSegments, bool bExtended=false)
Reference< XInterface > xTarget
css::uno::Reference< css::drawing::XShape > xCustomShapeReplacement
static bool convertB3DVector(::basegfx::B3DVector &rVector, std::u16string_view rValue)
convert string to basegfx::B3DVector
void export3DSceneAttributes(const css::uno::Reference< css::beans::XPropertySet > &xPropSet)
helper for chart that adds all attributes of a 3d scene element to the export
XMLShapeExport(SvXMLExport &rExp, SvXMLExportPropertyMapper *pExtMapper=nullptr)