20#include <config_wasm_strip.h>
32#include <com/sun/star/beans/XPropertyState.hpp>
33#include <com/sun/star/beans/PropertyValues.hpp>
34#include <com/sun/star/container/XChild.hpp>
35#include <com/sun/star/container/XEnumerationAccess.hpp>
36#include <com/sun/star/container/XIdentifierAccess.hpp>
37#include <com/sun/star/container/XNamed.hpp>
38#include <com/sun/star/document/XEventsSupplier.hpp>
39#include <com/sun/star/drawing/Alignment.hpp>
40#include <com/sun/star/drawing/CameraGeometry.hpp>
41#include <com/sun/star/drawing/CircleKind.hpp>
42#include <com/sun/star/drawing/ConnectorType.hpp>
43#include <com/sun/star/drawing/Direction3D.hpp>
44#include <com/sun/star/drawing/EscapeDirection.hpp>
45#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
46#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
47#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
48#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
49#include <com/sun/star/drawing/EnhancedCustomShapeMetalType.hpp>
50#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
51#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
52#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
53#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
54#include <com/sun/star/drawing/GluePoint2.hpp>
55#include <com/sun/star/drawing/HomogenMatrix.hpp>
56#include <com/sun/star/drawing/HomogenMatrix3.hpp>
57#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
58#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
59#include <com/sun/star/drawing/Position3D.hpp>
60#include <com/sun/star/drawing/ProjectionMode.hpp>
61#include <com/sun/star/drawing/ShadeMode.hpp>
62#include <com/sun/star/drawing/XControlShape.hpp>
63#include <com/sun/star/drawing/XCustomShapeEngine.hpp>
64#include <com/sun/star/drawing/XGluePointsSupplier.hpp>
65#include <com/sun/star/drawing/BarCode.hpp>
66#include <com/sun/star/drawing/BarCodeErrorCorrection.hpp>
67#include <com/sun/star/drawing/XShapes3.hpp>
68#include <com/sun/star/embed/ElementModes.hpp>
69#include <com/sun/star/embed/XStorage.hpp>
70#include <com/sun/star/embed/XTransactedObject.hpp>
71#include <com/sun/star/graphic/XGraphic.hpp>
72#include <com/sun/star/graphic/GraphicProvider.hpp>
73#include <com/sun/star/graphic/XGraphicProvider.hpp>
74#include <com/sun/star/io/XSeekableInputStream.hpp>
75#include <com/sun/star/io/XStream.hpp>
76#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
77#include <com/sun/star/lang/XMultiServiceFactory.hpp>
78#include <com/sun/star/media/ZoomLevel.hpp>
79#include <com/sun/star/presentation/AnimationSpeed.hpp>
80#include <com/sun/star/presentation/ClickAction.hpp>
81#include <com/sun/star/style/XStyle.hpp>
82#include <com/sun/star/table/XColumnRowRange.hpp>
83#include <com/sun/star/text/WritingMode2.hpp>
84#include <com/sun/star/text/XText.hpp>
90#include <officecfg/Office/Common.hxx>
96#include <rtl/math.hxx>
97#include <rtl/ustrbuf.hxx>
98#include <rtl/ustring.hxx>
173constexpr OUStringLiteral
gsVerb( u
"Verb" );
182 maCurrentShapesIter(maShapesInfos.
end()),
183 mbExportLayer( false ),
185 mbHandleProgressBar( false )
222 uno::Reference< drawing::XShape > xCustomShapeReplacement;
226 OUString aType( xShape->getShapeType() );
227 if( aType ==
"com.sun.star.drawing.CustomShape" )
229 uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
233 xSet->getPropertyValue(
"CustomShapeEngine") >>= aEngine;
234 if ( aEngine.isEmpty() )
236 aEngine =
"com.sun.star.drawing.EnhancedCustomShapeEngine";
238 uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
240 if ( !aEngine.isEmpty() )
242 uno::Sequence< beans::PropertyValue > aPropValues{
246 uno::Sequence< uno::Any > aArgument = {
uno::Any(aPropValues) };
247 uno::Reference< uno::XInterface > xInterface(
248 xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aEngine, aArgument, xContext) );
249 if ( xInterface.is() )
251 uno::Reference< drawing::XCustomShapeEngine > xCustomShapeEngine(
252 uno::Reference< drawing::XCustomShapeEngine >( xInterface, uno::UNO_QUERY ) );
253 if ( xCustomShapeEngine.is() )
254 xCustomShapeReplacement = xCustomShapeEngine->render();
260 return xCustomShapeReplacement;
265 const css::uno::Sequence<OUString>& rAutoStylePropNames )
269 OSL_FAIL(
"XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" );
272 sal_Int32 nZIndex = 0;
273 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
275 xPropSet->getPropertyValue(
gsZIndex) >>= nZIndex;
279 if(
static_cast<sal_Int32
>(aShapeInfoVector.size()) <= nZIndex )
281 OSL_FAIL(
"XMLShapeExport::collectShapeAutoStyles(): no shape info allocated for a given shape" );
288 if ( xCustomShapeReplacement.is() )
296 const bool bObjSupportsText =
299 const bool bObjSupportsStyle =
302 bool bIsEmptyPresObj =
false;
308 if( xPropSet.is() && bObjSupportsText )
310 uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
320 catch (uno::RuntimeException
const&)
325 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
327 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"IsEmptyPresentationObject") )
329 uno::Any aAny = xPropSet->getPropertyValue(
"IsEmptyPresentationObject");
330 aAny >>= bIsEmptyPresObj;
343 uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( xPropSet->getPropertySetInfo() );
345 OUString aParentName;
346 uno::Reference< style::XStyle > xStyle;
348 if( bObjSupportsStyle )
350 if( xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName(
"Style") )
351 xPropSet->getPropertyValue(
"Style") >>= xStyle;
356 uno::Reference< beans::XPropertySet > xStylePropSet(xStyle, uno::UNO_QUERY);
357 SAL_WARN_IF( !xStylePropSet.is(),
"xmloff",
"style without a XPropertySet?" );
360 if(xStylePropSet.is())
362 OUString aFamilyName;
363 xStylePropSet->getPropertyValue(
"Family") >>= aFamilyName;
364 if( !aFamilyName.isEmpty() && aFamilyName !=
"graphics" )
368 catch(
const beans::UnknownPropertyException&)
372 "XMLShapeExport::collectShapeAutoStyles: style has no 'Family' property");
381 aParentName += xStyle->getName();
385 if (aParentName.isEmpty() && xPropertySetInfo->hasPropertyByName(
"TextBox") && xPropSet->getPropertyValue(
"TextBox").hasValue() && xPropSet->getPropertyValue(
"TextBox").get<
bool>())
389 aParentName =
"Frame";
393 std::vector< XMLPropertyState > aPropStates;
403 uno::Reference< drawing::XControlShape > xControl(xShape, uno::UNO_QUERY);
404 DBG_ASSERT(xControl.is(),
"XMLShapeExport::collectShapeAutoStyles: ShapeType control, but no XControlShape!");
407 uno::Reference< beans::XPropertySet > xControlModel(xControl->getControl(), uno::UNO_QUERY);
408 DBG_ASSERT(xControlModel.is(),
"XMLShapeExport::collectShapeAutoStyles: no control model on the control shape!");
411 if (!sNumberStyle.isEmpty())
416 DBG_ASSERT(-1 !=
nIndex,
"XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!");
419 aPropStates.push_back(aNewState);
424 nCount = std::count_if(aPropStates.cbegin(), aPropStates.cend(),
454 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
455 uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
456 if ( xPropSetInfo.is() && xPropState.is() )
465 if ( xPropSetInfo->hasPropertyByName(
"ParaAdjust" )
466 && ( beans::PropertyState_DEFAULT_VALUE == xPropState->getPropertyState(
"ParaAdjust" ) )
472 DBG_ASSERT(-1 !=
nIndex,
"XMLShapeExport::collectShapeAutoStyles: could not obtain the index for the ParaAdjust context id!");
474 uno::Any aParaAdjustValue = xPropSet->getPropertyValue(
"ParaAdjust" );
477 aPropStates.push_back( aAlignDefaultState );
482 nCount = std::count_if(aPropStates.cbegin(), aPropStates.cend(),
507 uno::Reference< uno::XInterface > xConnection;
510 xPropSet->getPropertyValue(
gsStartShape ) >>= xConnection;
511 if( xConnection.is() )
514 xPropSet->getPropertyValue(
gsEndShape ) >>= xConnection;
515 if( xConnection.is() )
524 uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue(
gsModel ), uno::UNO_QUERY_THROW );
527 catch(
const uno::Exception&)
542 uno::Reference< drawing::XShapes > xShapes( xCollection, uno::UNO_QUERY );
552 class NewTextListsHelper
558 mrExport.GetTextParagraphExport()->PushNewTextListsHelper();
561 ~NewTextListsHelper()
563 mrExport.GetTextParagraphExport()->PopTextListsHelper();
573 css::awt::Point* pRefPoint ,
576 SAL_INFO(
"xmloff", xShape->getShapeType());
579 SAL_WARN(
"xmloff",
"XMLShapeExport::exportShape(): no auto styles where collected before export" );
582 sal_Int32 nZIndex = 0;
583 uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
587 xSet->getPropertyValue(
gsHyperlink) >>= sHyperlink;
589 catch (beans::UnknownPropertyException)
593 std::unique_ptr< SvXMLElementExport > pHyperlinkElement;
597 uno::Reference<xml::sax::XAttributeList> xSaveAttribs(
606 presentation::ClickAction eAction = presentation::ClickAction_NONE;
607 xSet->getPropertyValue(
gsOnClick) >>= eAction;
609 if( (eAction == presentation::ClickAction_DOCUMENT) ||
610 (eAction == presentation::ClickAction_BOOKMARK) )
615 if( !sURL.isEmpty() )
624 catch(
const uno::Exception&)
626 TOOLS_WARN_EXCEPTION(
"xmloff",
"XMLShapeExport::exportShape(): exception during hyperlink export");
629 else if (xSet.is() && !sHyperlink.isEmpty())
639 xSet->getPropertyValue(
gsZIndex) >>= nZIndex;
643 if(
static_cast<sal_Int32
>(aShapeInfoVector.size()) <= nZIndex )
645 SAL_WARN(
"xmloff",
"XMLShapeExport::exportShape(): no shape info collected for a given shape" );
649 NewTextListsHelper aNewTextListsHelper(
mrExport );
655 uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
658 uno::Reference< drawing::XShapes > xParent( xChild->getParent(), uno::UNO_QUERY );
659 SAL_WARN_IF( !xParent.is() && xParent.get() == (*maCurrentShapesIter).first.get(),
"xmloff",
"XMLShapeExport::exportShape(): Wrong call to XMLShapeExport::seekShapes()" );
667 SAL_WARN_IF( eShapeType != aShapeInfo.
meShapeType,
"xmloff",
"exportShape callings do not correspond to collectShapeAutoStyles calls!: " << xShape->getShapeType() );
690 uno::Reference< container::XNamed > xNamed( xShape, uno::UNO_QUERY );
693 const OUString
aName( xNamed->getName() );
694 if( !
aName.isEmpty() )
717 uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
719 if( !rShapeId.isEmpty() )
729 uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY );
734 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
736 xProps->getPropertyValue(
"LayerName") >>= aLayerName;
740 catch(
const uno::Exception&)
755 bool bPrintable =
true;
758 xSet->getPropertyValue(
gsPrintable) >>= bPrintable;
761 const unsigned short nDisplay = (
bVisible ? 2 : 0) | (bPrintable ? 1 : 0);
764 case 0: eDisplayToken =
XML_NONE;
break;
773 catch(
const uno::Exception&)
953 OSL_FAIL(
"XMLEXP: WriteShape: unknown or unexpected type of shape in export!");
958 pHyperlinkElement.reset();
972 const uno::Reference < drawing::XShapes >& xShapes,
973 const css::uno::Sequence<OUString>& rAutoStylePropNames)
978 uno::Reference< drawing::XShape > xShape;
979 const sal_Int32 nShapeCount(xShapes->getCount());
980 for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
982 xShapes->getByIndex(nShapeId) >>= xShape;
983 SAL_WARN_IF( !xShape.is(),
"xmloff",
"Shape without a XShape?" );
999 uno::Reference< drawing::XShape > xShape;
1000 const sal_Int32 nShapeCount(xShapes->getCount());
1001 for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
1003 xShapes->getByIndex(nShapeId) >>= xShape;
1004 SAL_WARN_IF( !xShape.is(),
"xmloff",
"Shape without a XShape?" );
1016void FixZOrder(uno::Reference<drawing::XShapes>
const& xShapes,
1017 std::function<
unsigned int (uno::Reference<beans::XPropertySet>
const&)>
const& rGetLayer)
1019 uno::Reference<drawing::XShapes3>
const xShapes3(xShapes, uno::UNO_QUERY);
1020 assert(xShapes3.is());
1025 struct Layer { std::vector<sal_Int32> shapes; sal_Int32 nMin =
SAL_MAX_INT32; sal_Int32 nMax = 0; };
1026 std::vector<Layer> layers;
1028 sal_Int32
const nCount(xShapes->getCount());
1031 uno::Reference<beans::XPropertySet>
const xShape(xShapes->getByIndex(
i), uno::UNO_QUERY);
1034 SAL_WARN(
"xmloff",
"FixZOrder: null shape, cannot sort");
1037 unsigned int const nLayer(rGetLayer(xShape));
1038 if (layers.size() <= nLayer)
1040 layers.resize(nLayer + 1);
1042 layers[nLayer].shapes.emplace_back(
i);
1043 if (
i < layers[nLayer].nMin)
1045 layers[nLayer].nMin =
i;
1047 if (layers[nLayer].nMax <
i)
1049 layers[nLayer].nMax =
i;
1052 layers.erase(std::remove_if(layers.begin(), layers.end(),
1053 [](Layer
const& rLayer) { return rLayer.shapes.empty(); }),
1055 bool isSorted(
true);
1056 for (
size_t i = 1;
i < layers.size(); ++
i)
1058 assert(layers[
i].nMin != layers[
i-1].nMax);
1059 if (layers[
i].nMin < layers[
i-1].nMax)
1069 uno::Sequence<sal_Int32> aNewOrder(
nCount);
1070 auto iterInsert(aNewOrder.getArray());
1071 for (
auto const& rLayer : layers)
1073 assert(rLayer.nMin <= rLayer.nMax);
1074 iterInsert = std::copy(rLayer.shapes.begin(), rLayer.shapes.end(), iterInsert);
1078 xShapes3->sort(aNewOrder);
1080 catch (uno::Exception
const&)
1082 SAL_WARN(
"xmloff",
"FixZOrder: exception");
1092 maCurrentShapesIter = maShapesInfos.find( xShapes );
1093 if( maCurrentShapesIter == maShapesInfos.end() )
1096 aNewInfoVector.resize(
static_cast<ShapesInfos::size_type
>(xShapes->getCount()) );
1097 maShapesInfos[ xShapes ] = aNewInfoVector;
1099 maCurrentShapesIter = maShapesInfos.find( xShapes );
1101 SAL_WARN_IF( maCurrentShapesIter == maShapesInfos.end(),
"xmloff",
"XMLShapeExport::seekShapes(): insert into stl::map failed" );
1104 SAL_WARN_IF( (*maCurrentShapesIter).second.size() !=
static_cast<ShapesInfos::size_type
>(xShapes->getCount()),
"xmloff",
"XMLShapeExport::seekShapes(): XShapes size varied between calls" );
1109 maCurrentShapesIter = maShapesInfos.end();
1153 OUString aType(xShape->getShapeType());
1155 if(!aType.match(
"com.sun.star."))
1158 if(aType.match(
"drawing.", 13))
1190 else if(aType.match(
"OLE2", 21))
1195 uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1200 if(xPropSet->getPropertyValue(
"CLSID") >>= sCLSID)
1202#if !ENABLE_WASM_STRIP_CHART
1225 else if(aType.match(
"Page", 21)) { eShapeType = XmlShapeTypeDrawPageShape; }
1226 else if(aType.match(
"Frame", 21)) { eShapeType = XmlShapeTypeDrawFrameShape; }
1227 else if(aType.match(
"Caption", 21)) { eShapeType = XmlShapeTypeDrawCaptionShape; }
1228 else if(aType.match(
"Plugin", 21)) { eShapeType = XmlShapeTypeDrawPluginShape; }
1229 else if(aType.match(
"Applet", 21)) { eShapeType = XmlShapeTypeDrawAppletShape; }
1230 else if(aType.match(
"MediaShape", 21)) { eShapeType = XmlShapeTypeDrawMediaShape; }
1231 else if(aType.match(
"TableShape", 21)) { eShapeType = XmlShapeTypeDrawTableShape; }
1234 else if(aType.match(
"Scene", 21 + 7)) { eShapeType = XmlShapeTypeDraw3DSceneObject; }
1235 else if(aType.match(
"Cube", 21 + 7)) { eShapeType = XmlShapeTypeDraw3DCubeObject; }
1236 else if(aType.match(
"Sphere", 21 + 7)) { eShapeType = XmlShapeTypeDraw3DSphereObject; }
1237 else if(aType.match(
"Lathe", 21 + 7)) { eShapeType = XmlShapeTypeDraw3DLatheObject; }
1238 else if(aType.match(
"Extrude", 21 + 7)) { eShapeType = XmlShapeTypeDraw3DExtrudeObject; }
1240 else if(aType.match(
"presentation.", 13))
1243 if (aType.match(
"TitleText", 26)) { eShapeType = XmlShapeTypePresTitleTextShape; }
1244 else if(aType.match(
"Outliner", 26)) { eShapeType = XmlShapeTypePresOutlinerShape; }
1245 else if(aType.match(
"Subtitle", 26)) { eShapeType = XmlShapeTypePresSubtitleShape; }
1246 else if(aType.match(
"GraphicObject", 26)) { eShapeType = XmlShapeTypePresGraphicObjectShape; }
1247 else if(aType.match(
"Page", 26)) { eShapeType = XmlShapeTypePresPageShape; }
1248 else if(aType.match(
"OLE2", 26))
1250 eShapeType = XmlShapeTypePresOLE2Shape;
1253 uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1255 if(xPropSet.is()) try
1258 if(xPropSet->getPropertyValue(
"CLSID") >>= sCLSID)
1260 if( sCLSID == SvGlobalName( SO3_SC_CLASSID ).GetHexName() )
1262 eShapeType = XmlShapeTypePresSheetShape;
1266 catch(
const uno::Exception&)
1268 SAL_WARN(
"xmloff",
"XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" );
1271 else if(aType.match(
"Chart", 26)) { eShapeType = XmlShapeTypePresChartShape; }
1272 else if(aType.match(
"OrgChart", 26)) { eShapeType = XmlShapeTypePresOrgChartShape; }
1273 else if(aType.match(
"CalcShape", 26)) { eShapeType = XmlShapeTypePresSheetShape; }
1274 else if(aType.match(
"TableShape", 26)) { eShapeType = XmlShapeTypePresTableShape; }
1275 else if(aType.match(
"Notes", 26)) { eShapeType = XmlShapeTypePresNotesShape; }
1276 else if(aType.match(
"HandoutShape", 26)) { eShapeType = XmlShapeTypeHandoutShape; }
1277 else if(aType.match(
"HeaderShape", 26)) { eShapeType = XmlShapeTypePresHeaderShape; }
1278 else if(aType.match(
"FooterShape", 26)) { eShapeType = XmlShapeTypePresFooterShape; }
1279 else if(aType.match(
"SlideNumberShape", 26)) { eShapeType = XmlShapeTypePresSlideNumberShape; }
1280 else if(aType.match(
"DateTimeShape", 26)) { eShapeType = XmlShapeTypePresDateTimeShape; }
1281 else if(aType.match(
"MediaShape", 26)) { eShapeType = XmlShapeTypePresMediaShape; }
1288 uno::Reference< drawing::XGluePointsSupplier > xSupplier( xShape, uno::UNO_QUERY );
1289 if( !xSupplier.is() )
1292 uno::Reference< container::XIdentifierAccess > xGluePoints( xSupplier->getGluePoints(), uno::UNO_QUERY );
1293 if( !xGluePoints.is() )
1296 drawing::GluePoint2 aGluePoint;
1298 const uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() );
1300 for(
const sal_Int32 nIdentifier : aIdSequence )
1302 if( (xGluePoints->getByIdentifier( nIdentifier ) >>= aGluePoint) && aGluePoint.IsUserDefined )
1306 const OUString
sId( OUString::number( nIdentifier ) );
1310 aGluePoint.Position.X);
1314 aGluePoint.Position.Y);
1317 if( !aGluePoint.IsRelative )
1323 if( aGluePoint.Escape != drawing::EscapeDirection_SMART )
1336 uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1338 bool bIsSignatureLine =
false;
1339 xPropSet->getPropertyValue(
"IsSignatureLine") >>= bIsSignatureLine;
1340 if (!bIsSignatureLine)
1343 OUString aSignatureLineId;
1344 xPropSet->getPropertyValue(
"SignatureLineId") >>= aSignatureLineId;
1347 OUString aSuggestedSignerName;
1348 xPropSet->getPropertyValue(
"SignatureLineSuggestedSignerName") >>= aSuggestedSignerName;
1349 if (!aSuggestedSignerName.isEmpty())
1352 OUString aSuggestedSignerTitle;
1353 xPropSet->getPropertyValue(
"SignatureLineSuggestedSignerTitle") >>= aSuggestedSignerTitle;
1354 if (!aSuggestedSignerTitle.isEmpty())
1357 OUString aSuggestedSignerEmail;
1358 xPropSet->getPropertyValue(
"SignatureLineSuggestedSignerEmail") >>= aSuggestedSignerEmail;
1359 if (!aSuggestedSignerEmail.isEmpty())
1362 OUString aSigningInstructions;
1363 xPropSet->getPropertyValue(
"SignatureLineSigningInstructions") >>= aSigningInstructions;
1364 if (!aSigningInstructions.isEmpty())
1367 bool bShowSignDate =
false;
1368 xPropSet->getPropertyValue(
"SignatureLineShowSignDate") >>= bShowSignDate;
1372 bool bCanAddComment =
false;
1373 xPropSet->getPropertyValue(
"SignatureLineCanAddComment") >>= bCanAddComment;
1383 uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1385 uno::Any aAny = xPropSet->getPropertyValue(
"BarCodeProperties");
1387 css::drawing::BarCode aBarCode;
1388 if(!(aAny >>= aBarCode))
1394 switch(aBarCode.ErrorCorrection){
1395 case css::drawing::BarCodeErrorCorrection::LOW :
1398 case css::drawing::BarCodeErrorCorrection::MEDIUM:
1401 case css::drawing::BarCodeErrorCorrection::QUARTILE:
1404 case css::drawing::BarCodeErrorCorrection::HIGH:
1431 uno::Reference< lang::XMultiServiceFactory > xFact(
mrExport.
GetModel(), uno::UNO_QUERY );
1437 uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance(
"com.sun.star.drawing.Defaults"), uno::UNO_QUERY );
1438 if( xDefaults.is() )
1446 catch(
const lang::ServiceNotRegisteredException&)
1478 double fTRShear(0.0);
1479 double fTRRotate(0.0);
1488 const uno::Reference< beans::XPropertySet >& xPropSet)
1503 xPropSet->getPropertySetInfo()->hasPropertyByName(
"TransformationInHoriL2R") )
1505 aAny = xPropSet->getPropertyValue(
"TransformationInHoriL2R");
1509 aAny = xPropSet->getPropertyValue(
"Transformation");
1511 drawing::HomogenMatrix3 aMatrix;
1514 rMatrix.
set(0, 0, aMatrix.Line1.Column1);
1515 rMatrix.
set(0, 1, aMatrix.Line1.Column2);
1516 rMatrix.
set(0, 2, aMatrix.Line1.Column3);
1517 rMatrix.
set(1, 0, aMatrix.Line2.Column1);
1518 rMatrix.
set(1, 1, aMatrix.Line2.Column2);
1519 rMatrix.
set(1, 2, aMatrix.Line2.Column3);
1520 rMatrix.
set(2, 0, aMatrix.Line3.Column1);
1521 rMatrix.
set(2, 1, aMatrix.Line3.Column2);
1522 rMatrix.
set(2, 2, aMatrix.Line3.Column3);
1526 double& fTRShear,
double& fTRRotate,
::basegfx::B2DTuple& rTRTranslate, css::awt::Point* pRefPoint)
1529 rMatrix.decompose(rTRScale, rTRTranslate, fTRRotate, fTRShear);
1544 OUStringBuffer sStringBuffer;
1554 if( aTRScale.
getX() > 0.0 )
1555 aTRScale.
setX(aTRScale.
getX() - 1.0);
1556 else if( aTRScale.
getX() < 0.0 )
1557 aTRScale.
setX(aTRScale.
getX() + 1.0);
1562 aStr = sStringBuffer.makeStringAndClear();
1572 if( aTRScale.
getY() > 0.0 )
1573 aTRScale.
setY(aTRScale.
getY() - 1.0);
1574 else if( aTRScale.
getY() < 0.0 )
1575 aTRScale.
setY(aTRScale.
getY() + 1.0);
1580 aStr = sStringBuffer.makeStringAndClear();
1584 bool bTransformationIsNecessary(fTRShear != 0.0 || fTRRotate != 0.0);
1586 if(bTransformationIsNecessary)
1591 aTransform.
AddSkewX(atan(fTRShear));
1615 aStr = sStringBuffer.makeStringAndClear();
1624 aStr = sStringBuffer.makeStringAndClear();
1632 bool bIsEmpty =
false;
1639 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1643 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"IsEmptyPresentationObject"))
1645 xPropSet->getPropertyValue(
"IsEmptyPresentationObject") >>= bIsEmpty;
1651 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"IsPlaceholderDependent"))
1654 xPropSet->getPropertyValue(
"IsPlaceholderDependent") >>= bTemp;
1672 uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
1675 uno::Reference< container::XEnumerationAccess > xEnumAccess( xShape, uno::UNO_QUERY );
1676 if( xEnumAccess.is() && xEnumAccess->hasElements() )
1685 CLICKACTION = 0x0001,
1692 CLICKEVENTTYPE = 0x0080,
1705 uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY );
1706 if( !xEventsSupplier.is() )
1709 uno::Reference< container::XNameAccess > xEvents = xEventsSupplier->getEvents();
1710 SAL_WARN_IF( !xEvents.is(),
"xmloff",
"XEventsSupplier::getEvents() returned NULL" );
1714 Found nFound = Found::NONE;
1716 OUString aClickEventType;
1717 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1718 presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
1719 presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_SLOW;
1720 OUString aStrSoundURL;
1721 bool bPlayFull =
false;
1722 sal_Int32 nVerb = 0;
1724 OUString aStrLibrary;
1725 OUString aStrBookmark;
1727 uno::Sequence< beans::PropertyValue > aClickProperties;
1728 if( xEvents->hasByName(
gsOnClick ) && (xEvents->getByName(
gsOnClick ) >>= aClickProperties) )
1730 for(
const auto& rProperty : std::as_const(aClickProperties) )
1732 if( !( nFound & Found::CLICKEVENTTYPE ) && rProperty.Name ==
gsEventType )
1734 if( rProperty.Value >>= aClickEventType )
1735 nFound |= Found::CLICKEVENTTYPE;
1737 else if( !( nFound & Found::CLICKACTION ) && rProperty.Name ==
gsClickAction )
1739 if( rProperty.Value >>= eClickAction )
1740 nFound |= Found::CLICKACTION;
1742 else if( !( nFound & Found::MACRO ) && ( rProperty.Name ==
gsMacroName || rProperty.Name ==
gsScript ) )
1744 if( rProperty.Value >>= aStrMacro )
1745 nFound |= Found::MACRO;
1747 else if( !( nFound & Found::LIBRARY ) && rProperty.Name ==
gsLibrary )
1749 if( rProperty.Value >>= aStrLibrary )
1750 nFound |= Found::LIBRARY;
1752 else if( !( nFound & Found::EFFECT ) && rProperty.Name ==
gsEffect )
1754 if( rProperty.Value >>= eEffect )
1755 nFound |= Found::EFFECT;
1757 else if( !( nFound & Found::BOOKMARK ) && rProperty.Name ==
gsBookmark )
1759 if( rProperty.Value >>= aStrBookmark )
1760 nFound |= Found::BOOKMARK;
1762 else if( !( nFound & Found::SPEED ) && rProperty.Name ==
gsSpeed )
1764 if( rProperty.Value >>= eSpeed )
1765 nFound |= Found::SPEED;
1767 else if( !( nFound & Found::SOUNDURL ) && rProperty.Name ==
gsSoundURL )
1769 if( rProperty.Value >>= aStrSoundURL )
1770 nFound |= Found::SOUNDURL;
1772 else if( !( nFound & Found::PLAYFULL ) && rProperty.Name ==
gsPlayFull )
1774 if( rProperty.Value >>= bPlayFull )
1775 nFound |= Found::PLAYFULL;
1777 else if( !( nFound & Found::VERB ) && rProperty.Name ==
gsVerb )
1779 if( rProperty.Value >>= nVerb )
1780 nFound |= Found::VERB;
1789 if( !(nFound & Found::CLICKACTION) || (eClickAction == presentation::ClickAction_NONE) )
1796 switch( eClickAction )
1799 case presentation::ClickAction_NEXTPAGE: eStrAction =
XML_NEXT_PAGE;
break;
1800 case presentation::ClickAction_FIRSTPAGE: eStrAction =
XML_FIRST_PAGE;
break;
1801 case presentation::ClickAction_LASTPAGE: eStrAction =
XML_LAST_PAGE;
break;
1802 case presentation::ClickAction_INVISIBLE: eStrAction =
XML_HIDE;
break;
1803 case presentation::ClickAction_STOPPRESENTATION:eStrAction =
XML_STOP;
break;
1804 case presentation::ClickAction_PROGRAM: eStrAction =
XML_EXECUTE;
break;
1805 case presentation::ClickAction_BOOKMARK: eStrAction =
XML_SHOW;
break;
1806 case presentation::ClickAction_DOCUMENT: eStrAction =
XML_SHOW;
break;
1808 case presentation::ClickAction_VERB: eStrAction =
XML_VERB;
break;
1809 case presentation::ClickAction_VANISH: eStrAction =
XML_FADE_OUT;
break;
1810 case presentation::ClickAction_SOUND: eStrAction =
XML_SOUND;
break;
1812 OSL_FAIL(
"unknown presentation::ClickAction found!" );
1816 OUString aEventQName(
1822 if( eClickAction == presentation::ClickAction_VANISH )
1824 if( nFound & Found::EFFECT )
1828 sal_Int16 nStartScale;
1845 if( nStartScale != -1 )
1852 if( nFound & Found::SPEED && eEffect != presentation::AnimationEffect_NONE )
1854 if( eSpeed != presentation::AnimationSpeed_MEDIUM )
1862 if( eClickAction == presentation::ClickAction_PROGRAM ||
1863 eClickAction == presentation::ClickAction_BOOKMARK ||
1864 eClickAction == presentation::ClickAction_DOCUMENT )
1866 if( eClickAction == presentation::ClickAction_BOOKMARK )
1876 if( ( nFound & Found::VERB ) && eClickAction == presentation::ClickAction_VERB )
1884 if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND )
1886 if( ( nFound & Found::SOUNDURL ) && !aStrSoundURL.isEmpty() )
1892 if( nFound & Found::PLAYFULL && bPlayFull )
1901 if( nFound & Found::MACRO )
1909 OUString aEventQName(
1914 if( nFound & Found::LIBRARY )
1917 (aStrLibrary.equalsIgnoreAsciiCase(
"StarOffice") ||
1921 sLocation +
":" + aStrMacro);
1931 else if( aClickEventType ==
gsScript )
1933 if( nFound & Found::MACRO )
1939 OUString aEventQName(
1957 OUString aDescription;
1959 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
1960 xProps->getPropertyValue(
"Title") >>= aTitle;
1961 xProps->getPropertyValue(
"Description") >>= aDescription;
1963 if(!aTitle.isEmpty())
1969 if(!aDescription.isEmpty())
1975 catch( uno::Exception& )
1983 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
1984 if(!(xShapes.is() && xShapes->getCount()))
1998 awt::Point aUpperLeft;
2003 aUpperLeft = xShape->getPosition();
2004 pRefPoint = &aUpperLeft;
2012 const uno::Reference< drawing::XShape >& xShape,
2015 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2020 bool bIsPresShape(
false);
2021 bool bIsEmptyPresObj(
false);
2029 bIsPresShape =
true;
2035 bIsPresShape =
true;
2041 bIsPresShape =
true;
2047 bIsPresShape =
true;
2053 bIsPresShape =
true;
2059 bIsPresShape =
true;
2065 bIsPresShape =
true;
2071 bIsPresShape =
true;
2089 sal_Int32 nCornerRadius(0);
2090 xPropSet->getPropertyValue(
"CornerRadius") >>= nCornerRadius;
2093 OUStringBuffer sStringBuffer;
2102 if(!bIsEmptyPresObj)
2113 const uno::Reference< drawing::XShape >& xShape,
2116 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2124 sal_Int32 nCornerRadius(0);
2125 xPropSet->getPropertyValue(
"CornerRadius") >>= nCornerRadius;
2128 OUStringBuffer sStringBuffer;
2145 const uno::Reference< drawing::XShape >& xShape,
2148 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2153 OUStringBuffer sStringBuffer;
2154 awt::Point aStart(0,0);
2155 awt::Point aEnd(1,1);
2166 double fTRShear(0.0);
2167 double fTRRotate(0.0);
2174 if (xPropSet->getPropertySetInfo()->hasPropertyByName(
"Geometry"))
2177 uno::Any aAny(xPropSet->getPropertyValue(
"Geometry"));
2178 if (
auto pSourcePolyPolygon
2179 = o3tl::tryAccess<drawing::PointSequenceSequence>(aAny))
2181 if (pSourcePolyPolygon->getLength() > 0)
2183 const drawing::PointSequence& rInnerSequence = (*pSourcePolyPolygon)[0];
2184 if (rInnerSequence.hasElements())
2186 const awt::Point& rPoint = rInnerSequence[0];
2187 aStart = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
2189 if (rInnerSequence.getLength() > 1)
2191 const awt::Point& rPoint = rInnerSequence[1];
2192 aEnd = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
2203 aStr = sStringBuffer.makeStringAndClear();
2216 aStr = sStringBuffer.makeStringAndClear();
2227 aStr = sStringBuffer.makeStringAndClear();
2233 aStr = sStringBuffer.makeStringAndClear();
2248 const uno::Reference< drawing::XShape >& xShape,
2251 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2256 awt::Size aSize = xShape->getSize();
2257 sal_Int32 nRx((aSize.Width + 1) / 2);
2258 sal_Int32 nRy((aSize.Height + 1) / 2);
2259 bool bCircle(nRx == nRy);
2264 drawing::CircleKind eKind = drawing::CircleKind_FULL;
2265 xPropSet->getPropertyValue(
"CircleKind") >>= eKind;
2266 if( eKind != drawing::CircleKind_FULL )
2268 OUStringBuffer sStringBuffer;
2269 sal_Int32 nStartAngle = 0;
2270 sal_Int32 nEndAngle = 0;
2271 xPropSet->getPropertyValue(
"CircleStartAngle") >>= nStartAngle;
2272 xPropSet->getPropertyValue(
"CircleEndAngle") >>= nEndAngle;
2274 const double dStartAngle = nStartAngle / 100.0;
2275 const double dEndAngle = nEndAngle / 100.0;
2295 bCreateNewline,
true);
2305 const uno::Reference< drawing::XShape >& xShape,
2308 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2321 double fTRShear(0.0);
2322 double fTRRotate(0.0);
2339 uno::Any aAny( xPropSet->getPropertyValue(
"Geometry") );
2346 auto pSourcePolyPolygon = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(aAny);
2348 if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
2355 if(0 == aPolyPolygon.
count())
2357 auto pSourcePolyPolygon = o3tl::tryAccess<drawing::PointSequenceSequence>(aAny);
2359 if(pSourcePolyPolygon)
2365 if(aPolyPolygon.
count())
2382 const OUString aPolygonString(
2414OUString getNameFromStreamURL(std::u16string_view rURL)
2416 static constexpr std::u16string_view sPackageURL(u
"vnd.sun.star.Package:");
2422 std::u16string_view sRequestedName = rURL.substr(sPackageURL.size());
2423 size_t nLastIndex = sRequestedName.rfind(
'/') + 1;
2424 if ((nLastIndex > 0) && (nLastIndex < sRequestedName.size()))
2425 sRequestedName = sRequestedName.substr(nLastIndex);
2426 nLastIndex = sRequestedName.rfind(
'.');
2427 if (nLastIndex != std::u16string_view::npos)
2428 sRequestedName = sRequestedName.substr(0, nLastIndex);
2429 if (!sRequestedName.empty())
2430 sResult = sRequestedName;
2439 const uno::Reference< drawing::XShape >& xShape,
2442 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2446 bool bIsEmptyPresObj =
false;
2458 if (!bIsEmptyPresObj)
2460 uno::Reference<graphic::XGraphic> xGraphic;
2461 OUString sOutMimeType;
2464 OUString aStreamURL;
2465 xPropSet->getPropertyValue(
"GraphicStreamURL") >>= aStreamURL;
2466 OUString sRequestedName = getNameFromStreamURL(aStreamURL);
2468 xPropSet->getPropertyValue(
"Graphic") >>= xGraphic;
2470 OUString sInternalURL;
2475 if (!sInternalURL.isEmpty())
2478 if (!sRequestedName.isEmpty())
2480 OUString newStreamURL =
"vnd.sun.star.Package:";
2481 if (sInternalURL[0] ==
'#')
2483 newStreamURL += sInternalURL.subView(1, sInternalURL.getLength() - 1);
2487 newStreamURL += sInternalURL;
2490 if (newStreamURL != aStreamURL)
2492 xPropSet->setPropertyValue(
"GraphicStreamURL",
uno::Any(newStreamURL));
2506 if (sOutMimeType.isEmpty())
2510 if (!sOutMimeType.isEmpty())
2516 "mime-type", sOutMimeType);
2527 if (!bIsEmptyPresObj)
2533 const bool bAddReplacementImages = officecfg::Office::Common::Save::Graphic::AddReplacementImages::get();
2534 if( !bIsEmptyPresObj && bAddReplacementImages)
2536 uno::Reference<graphic::XGraphic> xReplacementGraphic;
2537 xPropSet->getPropertyValue(
"ReplacementGraphic") >>= xReplacementGraphic;
2540 if (xReplacementGraphic.is())
2548 if (!aHref.isEmpty())
2589 const uno::Reference< drawing::XShape >& xShape,
2597 const uno::Reference< drawing::XShape >& xShape,
2600 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2607 uno::Reference< drawing::XControlShape > xControl( xShape, uno::UNO_QUERY );
2608 SAL_WARN_IF( !xControl.is(),
"xmloff",
"Control shape is not supporting XControlShape" );
2611 uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY );
2612 SAL_WARN_IF( !xControlModel.is(),
"xmloff",
"Control shape has not XControlModel" );
2613 if( xControlModel.is() )
2627 const uno::Reference< drawing::XShape >& xShape,
2630 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
2633 OUStringBuffer sStringBuffer;
2636 drawing::ConnectorType
eType = drawing::ConnectorType_STANDARD;
2637 uno::Any aAny = xProps->getPropertyValue(
"EdgeKind");
2640 if(
eType != drawing::ConnectorType_STANDARD )
2643 aStr = sStringBuffer.makeStringAndClear();
2648 sal_Int32 nDelta1 = 0, nDelta2 = 0, nDelta3 = 0;
2650 aAny = xProps->getPropertyValue(
"EdgeLine1Delta");
2652 aAny = xProps->getPropertyValue(
"EdgeLine2Delta");
2654 aAny = xProps->getPropertyValue(
"EdgeLine3Delta");
2657 if( nDelta1 != 0 || nDelta2 != 0 || nDelta3 != 0 )
2661 if( nDelta2 != 0 || nDelta3 != 0 )
2663 sStringBuffer.append(
' ' );
2668 sStringBuffer.append(
' ' );
2670 sStringBuffer, nDelta3);
2674 aStr = sStringBuffer.makeStringAndClear();
2679 awt::Point aStart(0,0);
2680 awt::Point aEnd(1,1);
2695 xProps->getPropertySetInfo()->hasPropertyByName(
"StartPositionInHoriL2R") &&
2696 xProps->getPropertySetInfo()->hasPropertyByName(
"EndPositionInHoriL2R") )
2698 xProps->getPropertyValue(
"StartPositionInHoriL2R") >>= aStart;
2699 xProps->getPropertyValue(
"EndPositionInHoriL2R") >>= aEnd;
2703 xProps->getPropertyValue(
"StartPosition") >>= aStart;
2704 xProps->getPropertyValue(
"EndPosition") >>= aEnd;
2709 aStart.X -= pRefPoint->X;
2710 aStart.Y -= pRefPoint->Y;
2711 aEnd.X -= pRefPoint->X;
2712 aEnd.Y -= pRefPoint->Y;
2720 aStr = sStringBuffer.makeStringAndClear();
2733 aStr = sStringBuffer.makeStringAndClear();
2743 aStr = sStringBuffer.makeStringAndClear();
2748 aStr = sStringBuffer.makeStringAndClear();
2752 uno::Reference< uno::XInterface > xRefS;
2753 uno::Reference< uno::XInterface > xRefE;
2756 xProps->getPropertyValue(
"StartShape") >>= xRefS;
2762 aAny = xProps->getPropertyValue(
"StartGluePointIndex");
2763 sal_Int32 nGluePointId = 0;
2764 if( aAny >>= nGluePointId )
2766 if( nGluePointId != -1 )
2774 xProps->getPropertyValue(
"EndShape") >>= xRefE;
2780 aAny = xProps->getPropertyValue(
"EndGluePointIndex");
2781 sal_Int32 nGluePointId = 0;
2782 if( aAny >>= nGluePointId )
2784 if( nGluePointId != -1 )
2792 aAny = xProps->getPropertyValue(
"PolyPolygonBezier");
2793 auto pSourcePolyPolygon = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(aAny);
2794 if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
2798 *pSourcePolyPolygon));
2799 const OUString aPolygonString(
2816 double fTRShear(0.0);
2817 double fTRRotate(0.0);
2820 fTRRotate, aTRTranslate, pRefPoint);
2838 const uno::Reference< drawing::XShape >& xShape,
2841 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
2844 OUStringBuffer sStringBuffer;
2847 awt::Point aStart(0,0);
2848 awt::Point aEnd(1,1);
2863 xProps->getPropertySetInfo()->hasPropertyByName(
"StartPositionInHoriL2R") &&
2864 xProps->getPropertySetInfo()->hasPropertyByName(
"EndPositionInHoriL2R") )
2866 xProps->getPropertyValue(
"StartPositionInHoriL2R") >>= aStart;
2867 xProps->getPropertyValue(
"EndPositionInHoriL2R") >>= aEnd;
2871 xProps->getPropertyValue(
"StartPosition") >>= aStart;
2872 xProps->getPropertyValue(
"EndPosition") >>= aEnd;
2877 aStart.X -= pRefPoint->X;
2878 aStart.Y -= pRefPoint->Y;
2879 aEnd.X -= pRefPoint->X;
2880 aEnd.Y -= pRefPoint->Y;
2888 aStr = sStringBuffer.makeStringAndClear();
2901 aStr = sStringBuffer.makeStringAndClear();
2911 aStr = sStringBuffer.makeStringAndClear();
2916 aStr = sStringBuffer.makeStringAndClear();
2927 uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
2933 const uno::Reference< drawing::XShape >& xShape,
2937 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2938 uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
2940 SAL_WARN_IF( !xPropSet.is() || !xNamed.is(),
"xmloff",
"ole shape is not implementing needed interfaces");
2941 if(!(xPropSet.is() && xNamed.is()))
2947 bool bIsEmptyPresObj =
false;
2959 OUString sPersistName;
2963 if (!bIsEmptyPresObj)
2972 bool bInternal =
false;
2973 xPropSet->getPropertyValue(
"IsInternal") >>= bInternal;
2981 xPropSet->getPropertyValue(
"LinkURL") >>= sURL;
2984 xPropSet->getPropertyValue(
"PersistName") >>= sPersistName;
2985 if ( sURL.isEmpty() )
2987 if( !sPersistName.isEmpty() )
2989 sURL =
"vnd.sun.star.EmbeddedObject:" + sPersistName;
2994 xPropSet->getPropertyValue(
"CLSID") >>= sClassId;
2996 if( !sClassId.isEmpty() )
2999 if(!bExportEmbedded)
3002 if( !sURL.isEmpty() )
3021 if (!bIsEmptyPresObj && supportsText(eShapeType))
3027 if(bExportEmbedded && !bIsEmptyPresObj)
3032 uno::Reference< lang::XComponent > xComp;
3033 xPropSet->getPropertyValue(
"Model") >>= xComp;
3034 SAL_WARN_IF( !xComp.is(),
"xmloff",
"no xModel for own OLE format" );
3043 OUString sURLRequest( sURL );
3045 sURLRequest +=
"?oasis=false";
3050 if( !bIsEmptyPresObj )
3053 if( !bExportEmbedded )
3065 if( bExportEmbedded )
3076 const uno::Reference< drawing::XShape >& xShape,
3079 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3087 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
3088 static const OUStringLiteral aPageNumberStr(
u"PageNumber");
3089 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
3091 sal_Int32 nPageNumber = 0;
3092 xPropSet->getPropertyValue(aPageNumberStr) >>= nPageNumber;
3112 const uno::Reference< drawing::XShape >& xShape,
3115 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3123 sal_Int32 nCornerRadius(0);
3124 xPropSet->getPropertyValue(
"CornerRadius") >>= nCornerRadius;
3127 OUStringBuffer sStringBuffer;
3133 awt::Point aCaptionPoint;
3134 xPropSet->getPropertyValue(
"CaptionPoint") >>= aCaptionPoint;
3151 bCreateNewline,
true );
3163 const uno::Reference< drawing::XShape >& xShape,
3166 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3179 xPropSet->getPropertyValue(
"FrameURL") >>=
aStr;
3186 xPropSet->getPropertyValue(
"FrameName") >>=
aStr;
3187 if( !
aStr.isEmpty() )
3198 const uno::Reference< drawing::XShape >& xShape,
3201 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3214 xPropSet->getPropertyValue(
"AppletCodeBase") >>=
aStr;
3221 xPropSet->getPropertyValue(
"AppletName") >>=
aStr;
3222 if( !
aStr.isEmpty() )
3226 xPropSet->getPropertyValue(
"AppletCode") >>=
aStr;
3230 bool bIsScript =
false;
3231 xPropSet->getPropertyValue(
"AppletIsScript") >>= bIsScript;
3239 uno::Sequence< beans::PropertyValue > aCommands;
3240 xPropSet->getPropertyValue(
"AppletCommands") >>= aCommands;
3241 for(
const auto& rCommand : std::as_const(aCommands) )
3243 rCommand.Value >>=
aStr;
3253 const uno::Reference< drawing::XShape >& xShape,
3256 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3269 xPropSet->getPropertyValue(
"PluginURL") >>=
aStr;
3276 xPropSet->getPropertyValue(
"PluginMimeType") >>=
aStr;
3285 uno::Sequence< beans::PropertyValue > aCommands;
3286 xPropSet->getPropertyValue(
"PluginCommands") >>= aCommands;
3287 for(
const auto& rCommand : std::as_const(aCommands) )
3289 rCommand.Value >>=
aStr;
3299 uno::Reference<io::XInputStream>
const& xInStream,
3300 uno::Reference<embed::XStorage>
const& xTarget,
3301 OUString
const& rPath,
const OUString& rMimeType)
3304 uno::Reference<io::XStream>
const xStream(
3306 embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, proxy));
3307 uno::Reference<io::XOutputStream>
const xOutStream(
3309 if (!xOutStream.is())
3311 SAL_WARN(
"xmloff",
"no output stream");
3312 throw uno::Exception(
"no output stream",
nullptr);
3314 uno::Reference< beans::XPropertySet >
const xStreamProps(
xStream,
3316 if (xStreamProps.is()) {
3317 xStreamProps->setPropertyValue(
"MediaType",
3319 xStreamProps->setPropertyValue(
3324 xOutStream->closeOutput();
3330 uno::Reference<beans::XPropertySet>
const& xPropSet,
3331 OUString
const& rURL,
const OUString& rMimeType)
3334 if (rURL.startsWithIgnoreAsciiCase(
"vnd.sun.star.Package:", &urlPath))
3338 uno::Reference<embed::XStorage>
const xTarget(
3340 uno::Reference<io::XInputStream> xInStream;
3341 xPropSet->getPropertyValue(
"PrivateStream")
3344 if (!xInStream.is())
3346 SAL_WARN(
"xmloff",
"no input stream");
3354 catch (uno::Exception
const&)
3368void ExportGraphicPreview(
const uno::Reference<graphic::XGraphic>& xGraphic,
SvXMLExport& rExport,
const std::u16string_view& rPrefix,
const std::u16string_view& rExtension,
const OUString& rMimeType)
3372 if( xGraphic.is() )
try
3376 uno::Reference< embed::XStorage > xPictureStorage;
3377 uno::Reference< embed::XStorage > xStorage;
3378 uno::Reference< io::XStream > xPictureStream;
3380 OUString sPictureName;
3381 if( bExportEmbedded )
3383 xPictureStream.set( xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.comp.MemoryStream", xContext), uno::UNO_QUERY_THROW );
3389 xPictureStorage.set( xStorage->openStorageElement(
"Pictures" , ::embed::ElementModes::READWRITE ), uno::UNO_SET_THROW );
3394 sPictureName = rPrefix + OUString::number( ++nIndex ) + rExtension;
3396 while( xPictureStorage->hasByName( sPictureName ) );
3398 xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, ::embed::ElementModes::READWRITE ), uno::UNO_SET_THROW );
3401 uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) );
3402 uno::Sequence< beans::PropertyValue > aArgs{
3406 xProvider->storeGraphic( xGraphic, aArgs );
3408 if( xPictureStorage.is() )
3410 uno::Reference< embed::XTransactedObject > xTrans( xPictureStorage, uno::UNO_QUERY );
3415 if( !bExportEmbedded )
3417 OUString sURL =
"Pictures/" + sPictureName;
3426 if( bExportEmbedded )
3428 uno::Reference< io::XSeekableInputStream > xSeekable( xPictureStream, uno::UNO_QUERY_THROW );
3432 aBase64Exp.exportOfficeBinaryDataElement( uno::Reference < io::XInputStream >( xPictureStream, uno::UNO_QUERY_THROW ) );
3435 catch( uno::Exception
const & )
3443 const uno::Reference< drawing::XShape >& xShape,
3446 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3463 xPropSet->getPropertyValue(
"MediaURL") >>= aMediaURL;
3465 xPropSet->getPropertyValue(
"MediaMimeType") >>= sMimeType;
3467 OUString
const persistentURL =
3485 static const OUStringLiteral aLoopStr(
u"Loop" );
3486 xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
3492 static const OUStringLiteral aMuteStr(
u"Mute" );
3493 xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
3498 sal_Int16 nVolumeDB = 0;
3499 xPropSet->getPropertyValue(
"VolumeDB") >>= nVolumeDB;
3504 media::ZoomLevel eZoom;
3505 OUString aZoomValue;
3506 xPropSet->getPropertyValue(
"Zoom") >>= eZoom;
3509 case media::ZoomLevel_ZOOM_1_TO_4 : aZoomValue =
"25%";
break;
3510 case media::ZoomLevel_ZOOM_1_TO_2 : aZoomValue =
"50%";
break;
3511 case media::ZoomLevel_ORIGINAL : aZoomValue =
"100%";
break;
3512 case media::ZoomLevel_ZOOM_2_TO_1 : aZoomValue =
"200%";
break;
3513 case media::ZoomLevel_ZOOM_4_TO_1 : aZoomValue =
"400%";
break;
3514 case media::ZoomLevel_FIT_TO_WINDOW: aZoomValue =
"fit";
break;
3515 case media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT: aZoomValue =
"fixedfit";
break;
3516 case media::ZoomLevel_FULLSCREEN : aZoomValue =
"fullscreen";
break;
3522 if( !aZoomValue.isEmpty() )
3531 uno::Reference<graphic::XGraphic> xGraphic;
3532 xPropSet->getPropertyValue(
"Graphic") >>= xGraphic;
3537 ExportGraphicPreview(xGraphic,
mrExport,
u"MediaPreview",
u".png",
"image/png");
3543 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
3544 if(!(xShapes.is() && xShapes->getCount()))
3547 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
3548 SAL_WARN_IF( !xPropSet.is(),
"xmloff",
"XMLShapeExport::ImpExport3DSceneShape can't export a scene without a propertyset" );
3549 if( !xPropSet.is() )
3571 awt::Point aUpperLeft;
3576 aUpperLeft = xShape->getPosition();
3577 pRefPoint = &aUpperLeft;
3585 const uno::Reference< drawing::XShape >& xShape,
3588 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3593 OUStringBuffer sStringBuffer;
3596 uno::Any aAny = xPropSet->getPropertyValue(
"D3DTransformMatrix");
3597 drawing::HomogenMatrix aHomMat;
3609 aAny = xPropSet->getPropertyValue(
"D3DPosition");
3610 drawing::Position3D aPosition3D;
3611 aAny >>= aPosition3D;
3612 ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
3615 aAny = xPropSet->getPropertyValue(
"D3DSize");
3616 drawing::Direction3D aDirection3D;
3617 aAny >>= aDirection3D;
3618 ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
3621 aDir3D = aPos3D + aDir3D;
3627 aStr = sStringBuffer.makeStringAndClear();
3635 aStr = sStringBuffer.makeStringAndClear();
3649 aAny = xPropSet->getPropertyValue(
"D3DPosition");
3650 drawing::Position3D aPosition3D;
3651 aAny >>= aPosition3D;
3652 ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
3655 aAny = xPropSet->getPropertyValue(
"D3DSize");
3656 drawing::Direction3D aDirection3D;
3657 aAny >>= aDirection3D;
3658 ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
3664 aStr = sStringBuffer.makeStringAndClear();
3672 aStr = sStringBuffer.makeStringAndClear();
3687 aAny = xPropSet->getPropertyValue(
"D3DPolyPolygon3D");
3688 drawing::PolyPolygonShape3D aUnoPolyPolygon3D;
3689 aAny >>= aUnoPolyPolygon3D;
3694 aUnoPolyPolygon3D));
3701 aB3DHomMatrixFor2DConversion));
3716 const OUString aPolygonString(
3747 OUStringBuffer sStringBuffer;
3750 uno::Any aAny = xPropSet->getPropertyValue(
"D3DTransformMatrix");
3751 drawing::HomogenMatrix aHomMat;
3759 aAny = xPropSet->getPropertyValue(
"D3DCameraGeometry");
3760 drawing::CameraGeometry aCamGeo;
3763 ::basegfx::B3DVector aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
3767 aStr = sStringBuffer.makeStringAndClear();
3771 ::basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
3775 aStr = sStringBuffer.makeStringAndClear();
3779 ::basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
3783 aStr = sStringBuffer.makeStringAndClear();
3788 aAny = xPropSet->getPropertyValue(
"D3DScenePerspective");
3789 drawing::ProjectionMode aPrjMode;
3791 if(aPrjMode == drawing::ProjectionMode_PARALLEL)
3798 aAny = xPropSet->getPropertyValue(
"D3DSceneDistance");
3799 sal_Int32 nDistance = 0;
3803 aStr = sStringBuffer.makeStringAndClear();
3807 aAny = xPropSet->getPropertyValue(
"D3DSceneFocalLength");
3808 sal_Int32 nFocalLength = 0;
3809 aAny >>= nFocalLength;
3812 aStr = sStringBuffer.makeStringAndClear();
3816 aAny = xPropSet->getPropertyValue(
"D3DSceneShadowSlant");
3817 sal_Int16 nShadowSlant = 0;
3818 aAny >>= nShadowSlant;
3822 aAny = xPropSet->getPropertyValue(
"D3DSceneShadeMode");
3823 drawing::ShadeMode aShadeMode;
3824 if(aAny >>= aShadeMode)
3826 if(aShadeMode == drawing::ShadeMode_FLAT)
3828 else if(aShadeMode == drawing::ShadeMode_PHONG)
3830 else if(aShadeMode == drawing::ShadeMode_SMOOTH)
3843 aAny = xPropSet->getPropertyValue(
"D3DSceneAmbientColor");
3844 sal_Int32 nAmbientColor = 0;
3845 aAny >>= nAmbientColor;
3847 aStr = sStringBuffer.makeStringAndClear();
3851 aAny = xPropSet->getPropertyValue(
"D3DSceneTwoSidedLighting");
3852 bool bTwoSidedLighting =
false;
3853 aAny >>= bTwoSidedLighting;
3855 aStr = sStringBuffer.makeStringAndClear();
3864 OUStringBuffer sStringBuffer;
3866 static const OUStringLiteral aColorPropName(
u"D3DSceneLightColor");
3867 static const OUStringLiteral aDirectionPropName(
u"D3DSceneLightDirection");
3868 static const OUStringLiteral aLightOnPropName(
u"D3DSceneLightOn");
3871 drawing::Direction3D aLightDir;
3872 bool bLightOnOff =
false;
3873 for(sal_Int32 nLamp = 1; nLamp <= 8; nLamp++)
3875 OUString aIndexStr = OUString::number( nLamp );
3878 OUString
aPropName = aColorPropName + aIndexStr;
3879 sal_Int32 nLightColor = 0;
3880 xPropSet->getPropertyValue(
aPropName ) >>= nLightColor;
3882 aStr = sStringBuffer.makeStringAndClear();
3886 aPropName = aDirectionPropName + aIndexStr;
3887 xPropSet->getPropertyValue(
aPropName) >>= aLightDir;
3888 aLightDirection =
::basegfx::B3DVector(aLightDir.DirectionX, aLightDir.DirectionY, aLightDir.DirectionZ);
3890 aStr = sStringBuffer.makeStringAndClear();
3894 aPropName = aLightOnPropName + aIndexStr;
3895 xPropSet->getPropertyValue(
aPropName) >>= bLightOnOff;
3897 aStr = sStringBuffer.makeStringAndClear();
3914static void ExportParameter( OUStringBuffer& rStrBuffer,
const css::drawing::EnhancedCustomShapeParameter& rParameter )
3916 if ( !rStrBuffer.isEmpty() )
3917 rStrBuffer.append(
' ' );
3918 if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
3920 double fNumber = 0.0;
3921 rParameter.Value >>= fNumber;
3922 ::rtl::math::doubleToUStringBuffer( rStrBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
'.',
true );
3927 rParameter.Value >>=
nValue;
3929 switch( rParameter.Type )
3931 case css::drawing::EnhancedCustomShapeParameterType::EQUATION :
3933 rStrBuffer.append(
"?f" + OUString::number(
nValue ) );
3937 case css::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT :
3939 rStrBuffer.append(
'$' );
3940 rStrBuffer.append(
nValue );
3944 case css::drawing::EnhancedCustomShapeParameterType::BOTTOM :
3946 case css::drawing::EnhancedCustomShapeParameterType::RIGHT :
3948 case css::drawing::EnhancedCustomShapeParameterType::TOP :
3950 case css::drawing::EnhancedCustomShapeParameterType::LEFT :
3952 case css::drawing::EnhancedCustomShapeParameterType::XSTRETCH :
3954 case css::drawing::EnhancedCustomShapeParameterType::YSTRETCH :
3956 case css::drawing::EnhancedCustomShapeParameterType::HASSTROKE :
3958 case css::drawing::EnhancedCustomShapeParameterType::HASFILL :
3960 case css::drawing::EnhancedCustomShapeParameterType::WIDTH :
3962 case css::drawing::EnhancedCustomShapeParameterType::HEIGHT :
3964 case css::drawing::EnhancedCustomShapeParameterType::LOGWIDTH :
3966 case css::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT :
3969 rStrBuffer.append(
nValue );
3977 for (
i = 0;
i < rEquations.getLength();
i++ )
3979 OUString
aStr=
"f" + OUString::number(
i );
3982 aStr = rEquations[
i ];
4001 if ( !rHandles.hasElements() )
4005 OUStringBuffer aStrBuffer;
4007 for (
const uno::Sequence< beans::PropertyValue >& rPropSeq : rHandles )
4009 bool bPosition =
false;
4010 for (
const beans::PropertyValue& rPropVal : rPropSeq )
4012 switch(
EASGet( rPropVal.Name ) )
4016 css::drawing::EnhancedCustomShapeParameterPair aPosition;
4017 if ( rPropVal.Value >>= aPosition )
4021 aStr = aStrBuffer.makeStringAndClear();
4030 if ( rPropVal.Value >>= bMirroredX )
4038 if ( rPropVal.Value >>= bMirroredY )
4046 if ( rPropVal.Value >>= bSwitched )
4053 css::drawing::EnhancedCustomShapeParameterPair aPolar;
4054 if ( rPropVal.Value >>= aPolar )
4058 aStr = aStrBuffer.makeStringAndClear();
4065 css::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
4066 if ( rPropVal.Value >>= aRadiusRangeMinimum )
4069 aStr = aStrBuffer.makeStringAndClear();
4076 css::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
4077 if ( rPropVal.Value >>= aRadiusRangeMaximum )
4080 aStr = aStrBuffer.makeStringAndClear();
4087 css::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
4088 if ( rPropVal.Value >>= aXRangeMinimum )
4091 aStr = aStrBuffer.makeStringAndClear();
4098 css::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
4099 if ( rPropVal.Value >>= aXRangeMaximum )
4102 aStr = aStrBuffer.makeStringAndClear();
4109 css::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
4110 if ( rPropVal.Value >>= aYRangeMinimum )
4113 aStr = aStrBuffer.makeStringAndClear();
4120 css::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
4121 if ( rPropVal.Value >>= aYRangeMaximum )
4124 aStr = aStrBuffer.makeStringAndClear();
4141 const uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair >& rCoordinates,
4142 const uno::Sequence< css::drawing::EnhancedCustomShapeSegment >& rSegments,
4143 bool bExtended =
false )
4147 OUStringBuffer aStrBuffer;
4148 bool bNeedExtended =
false;
4150 sal_Int32
i, j, k, l;
4152 sal_Int32 nCoords = rCoordinates.getLength();
4153 sal_Int32 nSegments = rSegments.getLength();
4154 bool bSimpleSegments = nSegments == 0;
4155 if ( bSimpleSegments )
4157 for ( j =
i = 0; j < nSegments; j++ )
4159 css::drawing::EnhancedCustomShapeSegment aSegment;
4160 if ( bSimpleSegments )
4168 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
4173 aSegment.Count =
static_cast<sal_Int16
>(std::min( nCoords - 1, sal_Int32(32767) ));
4174 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
4180 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
4186 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
4192 aSegment = rSegments[ j ];
4194 if ( !aStrBuffer.isEmpty() )
4195 aStrBuffer.append(
' ' );
4197 sal_Int32 nParameter = 0;
4198 switch( aSegment.Command )
4200 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH :
4201 aStrBuffer.append(
'Z' );
break;
4202 case css::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH :
4203 aStrBuffer.append(
'N' );
break;
4204 case css::drawing::EnhancedCustomShapeSegmentCommand::NOFILL :
4205 aStrBuffer.append(
'F' );
break;
4206 case css::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE :
4207 aStrBuffer.append(
'S' );
break;
4209 case css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO :
4210 aStrBuffer.append(
'M' ); nParameter = 1;
break;
4211 case css::drawing::EnhancedCustomShapeSegmentCommand::LINETO :
4212 aStrBuffer.append(
'L' ); nParameter = 1;
break;
4213 case css::drawing::EnhancedCustomShapeSegmentCommand::CURVETO :
4214 aStrBuffer.append(
'C' ); nParameter = 3;
break;
4215 case css::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
4216 aStrBuffer.append(
'T' ); nParameter = 3;
break;
4217 case css::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
4218 aStrBuffer.append(
'U' ); nParameter = 3;
break;
4219 case css::drawing::EnhancedCustomShapeSegmentCommand::ARCTO :
4220 aStrBuffer.append(
'A' ); nParameter = 4;
break;
4221 case css::drawing::EnhancedCustomShapeSegmentCommand::ARC :
4222 aStrBuffer.append(
'B' ); nParameter = 4;
break;
4223 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
4224 aStrBuffer.append(
'W' ); nParameter = 4;
break;
4225 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
4226 aStrBuffer.append(
'V' ); nParameter = 4;
break;
4227 case css::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
4228 aStrBuffer.append(
'X' ); nParameter = 1;
break;
4229 case css::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
4230 aStrBuffer.append(
'Y' ); nParameter = 1;
break;
4231 case css::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO :
4232 aStrBuffer.append(
'Q' ); nParameter = 2;
break;
4233 case css::drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO :
4235 aStrBuffer.append(
'G' );
4238 aStrBuffer.setLength( aStrBuffer.getLength() - 1);
4239 bNeedExtended =
true;
4243 case css::drawing::EnhancedCustomShapeSegmentCommand::DARKEN :
4245 aStrBuffer.append(
'H' );
4247 bNeedExtended =
true;
4249 case css::drawing::EnhancedCustomShapeSegmentCommand::DARKENLESS :
4251 aStrBuffer.append(
'I' );
4253 bNeedExtended =
true;
4255 case css::drawing::EnhancedCustomShapeSegmentCommand::LIGHTEN :
4257 aStrBuffer.append(
'J' );
4259 bNeedExtended =
true;
4261 case css::drawing::EnhancedCustomShapeSegmentCommand::LIGHTENLESS :
4263 aStrBuffer.append(
'K' );
4265 bNeedExtended =
true;
4270 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
4276 for ( k = 0; k < aSegment.Count; k++ )
4278 if ( (
i + nParameter ) <= nCoords )
4280 for ( l = 0; l < nParameter; l++ )
4294 aStr = aStrBuffer.makeStringAndClear();
4302 bool bEquations =
false;
4303 uno::Sequence< OUString > aEquations;
4305 bool bHandles =
false;
4306 uno::Sequence< beans::PropertyValues > aHandles;
4308 uno::Sequence< css::drawing::EnhancedCustomShapeSegment >
aSegments;
4309 uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
4311 uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues;
4314 OUStringBuffer aStrBuffer;
4315 double fTextRotateAngle(0.0);
4316 double fTextPreRotateAngle(0.0);
4319 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
4322 static const OUStringLiteral sCustomShapeGeometry(
u"CustomShapeGeometry" );
4323 if ( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sCustomShapeGeometry ) )
4325 uno::Any aGeoPropSet( xPropSet->getPropertyValue( sCustomShapeGeometry ) );
4326 uno::Sequence< beans::PropertyValue > aGeoPropSeq;
4328 if ( aGeoPropSet >>= aGeoPropSeq )
4330 bool bCoordinates =
false;
4331 OUString aCustomShapeType(
"non-primitive" );
4333 for (
const beans::PropertyValue& rGeoProp : std::as_const(aGeoPropSeq) )
4335 switch(
EASGet( rGeoProp.Name ) )
4339 rGeoProp.Value >>= aCustomShapeType;
4345 if ( rGeoProp.Value >>= bMirroredX )
4353 if ( rGeoProp.Value >>= bMirroredY )
4360 awt::Rectangle aRect;
4361 if ( rGeoProp.Value >>= aRect )
4370 rGeoProp.Value >>= fTextPreRotateAngle;
4375 rGeoProp.Value >>= fTextRotateAngle;
4380 uno::Sequence< beans::PropertyValue > aExtrusionPropSeq;
4381 if ( rGeoProp.Value >>= aExtrusionPropSeq )
4383 bool bSkewValuesProvided =
false;
4384 for (
const beans::PropertyValue& rProp : std::as_const(aExtrusionPropSeq) )
4386 switch(
EASGet( rProp.Name ) )
4391 if ( rProp.Value >>= bExtrusionOn )
4398 double fExtrusionBrightness = 0;
4399 if ( rProp.Value >>= fExtrusionBrightness )
4403 fExtrusionBrightness,
4405 util::MeasureUnit::PERCENT,
4406 util::MeasureUnit::PERCENT);
4407 aStrBuffer.append(
'%' );
4408 aStr = aStrBuffer.makeStringAndClear();
4415 css::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
4416 if ( rProp.Value >>= aDepthParaPair )
4419 if ( aDepthParaPair.First.Value >>= fDepth )
4423 aStr = aStrBuffer.makeStringAndClear();
4431 double fExtrusionDiffusion = 0;
4432 if ( rProp.Value >>= fExtrusionDiffusion )
4436 fExtrusionDiffusion,
4438 util::MeasureUnit::PERCENT,
4439 util::MeasureUnit::PERCENT);
4440 aStrBuffer.append(
'%' );
4441 aStr = aStrBuffer.makeStringAndClear();
4448 sal_Int32 nExtrusionNumberOfLineSegments = 0;
4449 if ( rProp.Value >>= nExtrusionNumberOfLineSegments )
4455 bool bExtrusionLightFace;
4456 if ( rProp.Value >>= bExtrusionLightFace )
4463 bool bExtrusionFirstLightHarsh;
4464 if ( rProp.Value >>= bExtrusionFirstLightHarsh )
4471 bool bExtrusionSecondLightHarsh;
4472 if ( rProp.Value >>= bExtrusionSecondLightHarsh )
4479 double fExtrusionFirstLightLevel = 0;
4480 if ( rProp.Value >>= fExtrusionFirstLightLevel )
4484 fExtrusionFirstLightLevel,
4486 util::MeasureUnit::PERCENT,
4487 util::MeasureUnit::PERCENT);
4488 aStrBuffer.append(
'%' );
4489 aStr = aStrBuffer.makeStringAndClear();
4496 double fExtrusionSecondLightLevel = 0;
4497 if ( rProp.Value >>= fExtrusionSecondLightLevel )
4501 fExtrusionSecondLightLevel,
4503 util::MeasureUnit::PERCENT,
4504 util::MeasureUnit::PERCENT);
4505 aStrBuffer.append(
'%' );
4506 aStr = aStrBuffer.makeStringAndClear();
4513 drawing::Direction3D aExtrusionFirstLightDirection;
4514 if ( rProp.Value >>= aExtrusionFirstLightDirection )
4516 ::basegfx::B3DVector aVec3D( aExtrusionFirstLightDirection.DirectionX, aExtrusionFirstLightDirection.DirectionY,
4517 aExtrusionFirstLightDirection.DirectionZ );
4519 aStr = aStrBuffer.makeStringAndClear();
4526 drawing::Direction3D aExtrusionSecondLightDirection;
4527 if ( rProp.Value >>= aExtrusionSecondLightDirection )
4529 ::basegfx::B3DVector aVec3D( aExtrusionSecondLightDirection.DirectionX, aExtrusionSecondLightDirection.DirectionY,
4530 aExtrusionSecondLightDirection.DirectionZ );
4532 aStr = aStrBuffer.makeStringAndClear();
4539 bool bExtrusionMetal;
4540 if ( rProp.Value >>= bExtrusionMetal )
4548 sal_Int16 eMetalType;
4549 if (rProp.Value >>= eMetalType)
4555 if (eMetalType == drawing::EnhancedCustomShapeMetalType::MetalMSCompatible)
4556 aStr =
"loext:MetalMSCompatible";
4558 aStr =
"draw:MetalODF";
4567 drawing::ShadeMode eShadeMode;
4568 if( rProp.Value >>= eShadeMode )
4570 if( eShadeMode == drawing::ShadeMode_FLAT )
4572 else if( eShadeMode == drawing::ShadeMode_PHONG )
4574 else if( eShadeMode == drawing::ShadeMode_SMOOTH )
4589 css::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair;
4590 if ( rProp.Value >>= aRotateAngleParaPair )
4594 aStr = aStrBuffer.makeStringAndClear();
4601 drawing::Direction3D aExtrusionRotationCenter;
4602 if ( rProp.Value >>= aExtrusionRotationCenter )
4604 ::basegfx::B3DVector aVec3D( aExtrusionRotationCenter.DirectionX, aExtrusionRotationCenter.DirectionY,
4605 aExtrusionRotationCenter.DirectionZ );
4607 aStr = aStrBuffer.makeStringAndClear();
4614 double fExtrusionShininess = 0;
4615 if ( rProp.Value >>= fExtrusionShininess )
4619 fExtrusionShininess,
4621 util::MeasureUnit::PERCENT,
4622 util::MeasureUnit::PERCENT);
4623 aStrBuffer.append(
'%' );
4624 aStr = aStrBuffer.makeStringAndClear();
4631 css::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
4632 if ( rProp.Value >>= aSkewParaPair )
4634 bSkewValuesProvided =
true;
4637 aStr = aStrBuffer.makeStringAndClear();
4644 double fExtrusionSpecularity = 0;
4645 if ( rProp.Value >>= fExtrusionSpecularity )
4654 fExtrusionSpecularity,
4656 util::MeasureUnit::PERCENT,
4657 util::MeasureUnit::PERCENT);
4658 aStrBuffer.append(
'%' );
4659 aStr = aStrBuffer.makeStringAndClear();
4665 fExtrusionSpecularity = std::clamp<double>(fExtrusionSpecularity, 0.0, 100.0);
4669 fExtrusionSpecularity,
4671 util::MeasureUnit::PERCENT,
4672 util::MeasureUnit::PERCENT);
4673 aStrBuffer.append(
'%' );
4674 aStr = aStrBuffer.makeStringAndClear();
4681 drawing::ProjectionMode eProjectionMode;
4682 if ( rProp.Value >>= eProjectionMode )
4689 drawing::Position3D aExtrusionViewPoint;
4690 if ( rProp.Value >>= aExtrusionViewPoint )
4693 aStr = aStrBuffer.makeStringAndClear();
4700 css::drawing::EnhancedCustomShapeParameterPair aOriginParaPair;
4701 if ( rProp.Value >>= aOriginParaPair )
4705 aStr = aStrBuffer.makeStringAndClear();
4712 bool bExtrusionColor;
4713 if ( rProp.Value >>= bExtrusionColor )
4725 if (!bSkewValuesProvided)
4735 uno::Sequence< beans::PropertyValue > aTextPathPropSeq;
4736 if ( rGeoProp.Value >>= aTextPathPropSeq )
4738 for (
const beans::PropertyValue& rProp : std::as_const(aTextPathPropSeq) )
4740 switch(
EASGet( rProp.Name ) )
4745 if ( rProp.Value >>= bTextPathOn )
4752 css::drawing::EnhancedCustomShapeTextPathMode eTextPathMode;
4753 if ( rProp.Value >>= eTextPathMode )
4755 switch ( eTextPathMode )
4763 if ( !
aStr.isEmpty() )
4771 if ( rProp.Value >>= bScaleX )
4780 bool bSameLetterHeights;
4781 if ( rProp.Value >>= bSameLetterHeights )
4795 uno::Sequence< beans::PropertyValue > aPathPropSeq;
4796 if ( rGeoProp.Value >>= aPathPropSeq )
4798 for (
const beans::PropertyValue& rProp : std::as_const(aPathPropSeq) )
4800 switch(
EASGet( rProp.Name ) )
4809 uno::Sequence< awt::Size > aSubViewSizes;
4810 rProp.Value >>= aSubViewSizes;
4812 for (
int nIdx = 0; nIdx < aSubViewSizes.getLength(); nIdx++ )
4815 aStrBuffer.append(
' ');
4816 aStrBuffer.append( aSubViewSizes[nIdx].
Width );
4817 aStrBuffer.append(
' ');
4818 aStrBuffer.append( aSubViewSizes[nIdx].
Height );
4820 aStr = aStrBuffer.makeStringAndClear();
4826 bool bExtrusionAllowed;
4827 if ( rProp.Value >>= bExtrusionAllowed )
4834 bool bConcentricGradientFillAllowed;
4835 if ( rProp.Value >>= bConcentricGradientFillAllowed )
4842 bool bTextPathAllowed;
4843 if ( rProp.Value >>= bTextPathAllowed )
4850 css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> aGluePoints;
4851 if ( rProp.Value >>= aGluePoints )
4853 if ( aGluePoints.hasElements() )
4855 for(
const auto& rGluePoint : std::as_const(aGluePoints) )
4860 aStr = aStrBuffer.makeStringAndClear();