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/XText.hpp>
89 #include <officecfg/Office/Common.hxx>
95 #include <rtl/math.hxx>
96 #include <rtl/ustrbuf.hxx>
97 #include <rtl/ustring.hxx>
155 constexpr OUStringLiteral
gsZIndex( u
"ZOrder" );
156 constexpr OUStringLiteral
gsPrintable( u
"Printable" );
157 constexpr OUStringLiteral
gsVisible( u
"Visible" );
158 constexpr OUStringLiteral
gsModel( u
"Model" );
159 constexpr OUStringLiteral
gsStartShape( u
"StartShape" );
160 constexpr OUStringLiteral
gsEndShape( u
"EndShape" );
161 constexpr OUStringLiteral
gsOnClick( u
"OnClick" );
162 constexpr OUStringLiteral
gsEventType( u
"EventType" );
164 constexpr OUStringLiteral
gsMacroName( u
"MacroName" );
165 constexpr OUStringLiteral
gsScript( u
"Script" );
166 constexpr OUStringLiteral
gsLibrary( u
"Library" );
168 constexpr OUStringLiteral
gsBookmark( u
"Bookmark" );
169 constexpr OUStringLiteral
gsEffect( u
"Effect" );
170 constexpr OUStringLiteral
gsPlayFull( u
"PlayFull" );
171 constexpr OUStringLiteral
gsVerb( u
"Verb" );
172 constexpr OUStringLiteral
gsSoundURL( u
"SoundURL" );
173 constexpr OUStringLiteral
gsSpeed( u
"Speed" );
174 constexpr OUStringLiteral
gsStarBasic( u
"StarBasic" );
175 constexpr OUStringLiteral
gsHyperlink( u
"Hyperlink" );
180 maCurrentShapesIter(maShapesInfos.
end()),
181 mbExportLayer(
false ),
183 mbHandleProgressBar(
false )
220 uno::Reference< drawing::XShape > xCustomShapeReplacement;
224 OUString aType( xShape->getShapeType() );
225 if( aType ==
"com.sun.star.drawing.CustomShape" )
227 uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
231 xSet->getPropertyValue(
"CustomShapeEngine") >>= aEngine;
232 if ( aEngine.isEmpty() )
234 aEngine =
"com.sun.star.drawing.EnhancedCustomShapeEngine";
238 if ( !aEngine.isEmpty() )
240 uno::Sequence< beans::PropertyValue > aPropValues{
244 uno::Sequence< uno::Any > aArgument = {
uno::Any(aPropValues) };
245 uno::Reference< uno::XInterface > xInterface(
246 xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aEngine, aArgument, xContext) );
247 if ( xInterface.is() )
249 uno::Reference< drawing::XCustomShapeEngine > xCustomShapeEngine(
250 uno::Reference< drawing::XCustomShapeEngine >( xInterface, uno::UNO_QUERY ) );
251 if ( xCustomShapeEngine.is() )
252 xCustomShapeReplacement = xCustomShapeEngine->render();
258 return xCustomShapeReplacement;
266 OSL_FAIL(
"XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" );
269 sal_Int32 nZIndex = 0;
270 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
272 xPropSet->getPropertyValue(
gsZIndex) >>= nZIndex;
276 if( static_cast<sal_Int32>(aShapeInfoVector.size()) <= nZIndex )
278 OSL_FAIL(
"XMLShapeExport::collectShapeAutoStyles(): no shape info allocated for a given shape" );
285 if ( xCustomShapeReplacement.is() )
293 const bool bObjSupportsText =
296 const bool bObjSupportsStyle =
299 bool bIsEmptyPresObj =
false;
305 if( xPropSet.is() && bObjSupportsText )
307 uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
313 bSkip = xText->getString().isEmpty();
315 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;
757 xSet->getPropertyValue(
gsVisible) >>= bVisible;
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();
976 uno::Reference< drawing::XShape > xShape;
977 const sal_Int32 nShapeCount(xShapes->getCount());
978 for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
980 xShapes->getByIndex(nShapeId) >>= xShape;
981 SAL_WARN_IF( !xShape.is(),
"xmloff",
"Shape without a XShape?" );
997 uno::Reference< drawing::XShape > xShape;
998 const sal_Int32 nShapeCount(xShapes->getCount());
999 for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
1001 xShapes->getByIndex(nShapeId) >>= xShape;
1002 SAL_WARN_IF( !xShape.is(),
"xmloff",
"Shape without a XShape?" );
1014 void FixZOrder(uno::Reference<drawing::XShapes>
const& xShapes,
1015 std::function<
unsigned int (uno::Reference<beans::XPropertySet>
const&)>
const& rGetLayer)
1017 uno::Reference<drawing::XShapes3>
const xShapes3(xShapes, uno::UNO_QUERY);
1018 assert(xShapes3.is());
1023 struct Layer { std::vector<sal_Int32> shapes; sal_Int32 nMin =
SAL_MAX_INT32; sal_Int32 nMax = 0; };
1024 std::vector<Layer> layers;
1026 sal_Int32
const nCount(xShapes->getCount());
1029 uno::Reference<beans::XPropertySet>
const xShape(xShapes->getByIndex(
i), uno::UNO_QUERY);
1032 SAL_WARN(
"xmloff",
"FixZOrder: null shape, cannot sort");
1035 unsigned int const nLayer(rGetLayer(xShape));
1036 if (layers.size() <= nLayer)
1038 layers.resize(nLayer + 1);
1040 layers[nLayer].shapes.emplace_back(
i);
1041 if (
i < layers[nLayer].nMin)
1043 layers[nLayer].nMin =
i;
1045 if (layers[nLayer].nMax <
i)
1047 layers[nLayer].nMax =
i;
1050 layers.erase(std::remove_if(layers.begin(), layers.end(),
1051 [](Layer
const& rLayer) {
return rLayer.shapes.empty(); }),
1053 bool isSorted(
true);
1054 for (
size_t i = 1;
i < layers.size(); ++
i)
1056 assert(layers[
i].nMin != layers[
i-1].nMax);
1057 if (layers[
i].nMin < layers[
i-1].nMax)
1067 uno::Sequence<sal_Int32> aNewOrder(nCount);
1068 auto iterInsert(aNewOrder.getArray());
1069 for (
auto const& rLayer : layers)
1071 assert(rLayer.nMin <= rLayer.nMax);
1072 iterInsert = std::copy(rLayer.shapes.begin(), rLayer.shapes.end(), iterInsert);
1076 xShapes3->sort(aNewOrder);
1078 catch (uno::Exception
const&)
1080 SAL_WARN(
"xmloff",
"FixZOrder: exception");
1090 maCurrentShapesIter = maShapesInfos.find( xShapes );
1091 if( maCurrentShapesIter == maShapesInfos.end() )
1094 aNewInfoVector.resize( static_cast<ShapesInfos::size_type>(xShapes->getCount()) );
1095 maShapesInfos[ xShapes ] = aNewInfoVector;
1097 maCurrentShapesIter = maShapesInfos.find( xShapes );
1099 SAL_WARN_IF( maCurrentShapesIter == maShapesInfos.end(),
"xmloff",
"XMLShapeExport::seekShapes(): insert into stl::map failed" );
1102 SAL_WARN_IF( (*maCurrentShapesIter).second.size() !=
static_cast<ShapesInfos::size_type
>(xShapes->getCount()),
"xmloff",
"XMLShapeExport::seekShapes(): XShapes size varied between calls" );
1107 maCurrentShapesIter = maShapesInfos.end();
1151 OUString aType(xShape->getShapeType());
1153 if(!aType.match(
"com.sun.star."))
1156 if(aType.match(
"drawing.", 13))
1188 else if(aType.match(
"OLE2", 21))
1193 uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1198 if(xPropSet->getPropertyValue(
"CLSID") >>= sCLSID)
1200 #if !ENABLE_WASM_STRIP_CHART
1238 else if(aType.match(
"presentation.", 13))
1246 else if(aType.match(
"OLE2", 26))
1251 uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1253 if(xPropSet.is())
try
1256 if(xPropSet->getPropertyValue(
"CLSID") >>= sCLSID)
1264 catch(
const uno::Exception&)
1266 SAL_WARN(
"xmloff",
"XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" );
1286 uno::Reference< drawing::XGluePointsSupplier > xSupplier( xShape, uno::UNO_QUERY );
1287 if( !xSupplier.is() )
1290 uno::Reference< container::XIdentifierAccess > xGluePoints( xSupplier->getGluePoints(), uno::UNO_QUERY );
1291 if( !xGluePoints.is() )
1294 drawing::GluePoint2 aGluePoint;
1296 const uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() );
1298 for(
const sal_Int32 nIdentifier : aIdSequence )
1300 if( (xGluePoints->getByIdentifier( nIdentifier ) >>= aGluePoint) && aGluePoint.IsUserDefined )
1304 const OUString
sId( OUString::number( nIdentifier ) );
1308 aGluePoint.Position.X);
1312 aGluePoint.Position.Y);
1315 if( !aGluePoint.IsRelative )
1321 if( aGluePoint.Escape != drawing::EscapeDirection_SMART )
1334 uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1336 bool bIsSignatureLine =
false;
1337 xPropSet->getPropertyValue(
"IsSignatureLine") >>= bIsSignatureLine;
1338 if (!bIsSignatureLine)
1341 OUString aSignatureLineId;
1342 xPropSet->getPropertyValue(
"SignatureLineId") >>= aSignatureLineId;
1345 OUString aSuggestedSignerName;
1346 xPropSet->getPropertyValue(
"SignatureLineSuggestedSignerName") >>= aSuggestedSignerName;
1347 if (!aSuggestedSignerName.isEmpty())
1350 OUString aSuggestedSignerTitle;
1351 xPropSet->getPropertyValue(
"SignatureLineSuggestedSignerTitle") >>= aSuggestedSignerTitle;
1352 if (!aSuggestedSignerTitle.isEmpty())
1355 OUString aSuggestedSignerEmail;
1356 xPropSet->getPropertyValue(
"SignatureLineSuggestedSignerEmail") >>= aSuggestedSignerEmail;
1357 if (!aSuggestedSignerEmail.isEmpty())
1360 OUString aSigningInstructions;
1361 xPropSet->getPropertyValue(
"SignatureLineSigningInstructions") >>= aSigningInstructions;
1362 if (!aSigningInstructions.isEmpty())
1365 bool bShowSignDate =
false;
1366 xPropSet->getPropertyValue(
"SignatureLineShowSignDate") >>= bShowSignDate;
1370 bool bCanAddComment =
false;
1371 xPropSet->getPropertyValue(
"SignatureLineCanAddComment") >>= bCanAddComment;
1373 bCanAddComment ?
XML_TRUE : XML_FALSE);
1381 uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1383 uno::Any aAny = xPropSet->getPropertyValue(
"BarCodeProperties");
1385 css::drawing::BarCode aBarCode;
1386 if(!(aAny >>= aBarCode))
1392 switch(aBarCode.ErrorCorrection){
1393 case css::drawing::BarCodeErrorCorrection::LOW :
1396 case css::drawing::BarCodeErrorCorrection::MEDIUM:
1399 case css::drawing::BarCodeErrorCorrection::QUARTILE:
1402 case css::drawing::BarCodeErrorCorrection::HIGH:
1429 uno::Reference< lang::XMultiServiceFactory > xFact(
mrExport.
GetModel(), uno::UNO_QUERY );
1435 uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance(
"com.sun.star.drawing.Defaults"), uno::UNO_QUERY );
1436 if( xDefaults.is() )
1444 catch(
const lang::ServiceNotRegisteredException&)
1476 double fTRShear(0.0);
1477 double fTRRotate(0.0);
1486 const uno::Reference< beans::XPropertySet >& xPropSet)
1501 xPropSet->getPropertySetInfo()->hasPropertyByName(
"TransformationInHoriL2R") )
1503 aAny = xPropSet->getPropertyValue(
"TransformationInHoriL2R");
1507 aAny = xPropSet->getPropertyValue(
"Transformation");
1509 drawing::HomogenMatrix3 aMatrix;
1512 rMatrix.
set(0, 0, aMatrix.Line1.Column1);
1513 rMatrix.
set(0, 1, aMatrix.Line1.Column2);
1514 rMatrix.
set(0, 2, aMatrix.Line1.Column3);
1515 rMatrix.
set(1, 0, aMatrix.Line2.Column1);
1516 rMatrix.
set(1, 1, aMatrix.Line2.Column2);
1517 rMatrix.
set(1, 2, aMatrix.Line2.Column3);
1518 rMatrix.
set(2, 0, aMatrix.Line3.Column1);
1519 rMatrix.
set(2, 1, aMatrix.Line3.Column2);
1520 rMatrix.
set(2, 2, aMatrix.Line3.Column3);
1524 double& fTRShear,
double& fTRRotate, ::
basegfx::B2DTuple& rTRTranslate, css::awt::Point* pRefPoint)
1527 rMatrix.decompose(rTRScale, rTRTranslate, fTRRotate, fTRShear);
1542 OUStringBuffer sStringBuffer;
1552 if( aTRScale.
getX() > 0.0 )
1553 aTRScale.
setX(aTRScale.
getX() - 1.0);
1554 else if( aTRScale.
getX() < 0.0 )
1555 aTRScale.
setX(aTRScale.
getX() + 1.0);
1560 aStr = sStringBuffer.makeStringAndClear();
1570 if( aTRScale.
getY() > 0.0 )
1571 aTRScale.
setY(aTRScale.
getY() - 1.0);
1572 else if( aTRScale.
getY() < 0.0 )
1573 aTRScale.
setY(aTRScale.
getY() + 1.0);
1578 aStr = sStringBuffer.makeStringAndClear();
1582 bool bTransformationIsNecessary(fTRShear != 0.0 || fTRRotate != 0.0);
1584 if(bTransformationIsNecessary)
1589 aTransform.
AddSkewX(atan(fTRShear));
1613 aStr = sStringBuffer.makeStringAndClear();
1622 aStr = sStringBuffer.makeStringAndClear();
1630 bool bIsEmpty =
false;
1637 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1641 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"IsEmptyPresentationObject"))
1643 xPropSet->getPropertyValue(
"IsEmptyPresentationObject") >>= bIsEmpty;
1649 if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"IsPlaceholderDependent"))
1652 xPropSet->getPropertyValue(
"IsPlaceholderDependent") >>= bTemp;
1670 uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
1673 uno::Reference< container::XEnumerationAccess > xEnumAccess( xShape, uno::UNO_QUERY );
1674 if( xEnumAccess.is() && xEnumAccess->hasElements() )
1683 CLICKACTION = 0x0001,
1690 CLICKEVENTTYPE = 0x0080,
1703 uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY );
1704 if( !xEventsSupplier.is() )
1707 uno::Reference< container::XNameAccess > xEvents = xEventsSupplier->getEvents();
1708 SAL_WARN_IF( !xEvents.is(),
"xmloff",
"XEventsSupplier::getEvents() returned NULL" );
1712 Found nFound = Found::NONE;
1714 OUString aClickEventType;
1715 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1716 presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
1717 presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_SLOW;
1718 OUString aStrSoundURL;
1719 bool bPlayFull =
false;
1720 sal_Int32 nVerb = 0;
1722 OUString aStrLibrary;
1723 OUString aStrBookmark;
1725 uno::Sequence< beans::PropertyValue > aClickProperties;
1726 if( xEvents->hasByName(
gsOnClick ) && (xEvents->getByName(
gsOnClick ) >>= aClickProperties) )
1728 for(
const auto& rProperty : std::as_const(aClickProperties) )
1730 if( !( nFound & Found::CLICKEVENTTYPE ) && rProperty.Name ==
gsEventType )
1732 if( rProperty.Value >>= aClickEventType )
1733 nFound |= Found::CLICKEVENTTYPE;
1735 else if( !( nFound & Found::CLICKACTION ) && rProperty.Name ==
gsClickAction )
1737 if( rProperty.Value >>= eClickAction )
1738 nFound |= Found::CLICKACTION;
1740 else if( !( nFound & Found::MACRO ) && ( rProperty.Name ==
gsMacroName || rProperty.Name ==
gsScript ) )
1742 if( rProperty.Value >>= aStrMacro )
1743 nFound |= Found::MACRO;
1745 else if( !( nFound & Found::LIBRARY ) && rProperty.Name ==
gsLibrary )
1747 if( rProperty.Value >>= aStrLibrary )
1748 nFound |= Found::LIBRARY;
1750 else if( !( nFound & Found::EFFECT ) && rProperty.Name ==
gsEffect )
1752 if( rProperty.Value >>= eEffect )
1753 nFound |= Found::EFFECT;
1755 else if( !( nFound & Found::BOOKMARK ) && rProperty.Name ==
gsBookmark )
1757 if( rProperty.Value >>= aStrBookmark )
1758 nFound |= Found::BOOKMARK;
1760 else if( !( nFound & Found::SPEED ) && rProperty.Name ==
gsSpeed )
1762 if( rProperty.Value >>= eSpeed )
1763 nFound |= Found::SPEED;
1765 else if( !( nFound & Found::SOUNDURL ) && rProperty.Name ==
gsSoundURL )
1767 if( rProperty.Value >>= aStrSoundURL )
1768 nFound |= Found::SOUNDURL;
1770 else if( !( nFound & Found::PLAYFULL ) && rProperty.Name ==
gsPlayFull )
1772 if( rProperty.Value >>= bPlayFull )
1773 nFound |= Found::PLAYFULL;
1775 else if( !( nFound & Found::VERB ) && rProperty.Name ==
gsVerb )
1777 if( rProperty.Value >>= nVerb )
1778 nFound |= Found::VERB;
1787 if( !(nFound & Found::CLICKACTION) || (eClickAction == presentation::ClickAction_NONE) )
1794 switch( eClickAction )
1797 case presentation::ClickAction_NEXTPAGE: eStrAction =
XML_NEXT_PAGE;
break;
1798 case presentation::ClickAction_FIRSTPAGE: eStrAction =
XML_FIRST_PAGE;
break;
1799 case presentation::ClickAction_LASTPAGE: eStrAction =
XML_LAST_PAGE;
break;
1800 case presentation::ClickAction_INVISIBLE: eStrAction =
XML_HIDE;
break;
1801 case presentation::ClickAction_STOPPRESENTATION:eStrAction =
XML_STOP;
break;
1802 case presentation::ClickAction_PROGRAM: eStrAction =
XML_EXECUTE;
break;
1803 case presentation::ClickAction_BOOKMARK: eStrAction =
XML_SHOW;
break;
1804 case presentation::ClickAction_DOCUMENT: eStrAction =
XML_SHOW;
break;
1806 case presentation::ClickAction_VERB: eStrAction =
XML_VERB;
break;
1807 case presentation::ClickAction_VANISH: eStrAction =
XML_FADE_OUT;
break;
1808 case presentation::ClickAction_SOUND: eStrAction =
XML_SOUND;
break;
1810 OSL_FAIL(
"unknown presentation::ClickAction found!" );
1814 OUString aEventQName(
1820 if( eClickAction == presentation::ClickAction_VANISH )
1822 if( nFound & Found::EFFECT )
1826 sal_Int16 nStartScale;
1843 if( nStartScale != -1 )
1850 if( nFound & Found::SPEED && eEffect != presentation::AnimationEffect_NONE )
1852 if( eSpeed != presentation::AnimationSpeed_MEDIUM )
1860 if( eClickAction == presentation::ClickAction_PROGRAM ||
1861 eClickAction == presentation::ClickAction_BOOKMARK ||
1862 eClickAction == presentation::ClickAction_DOCUMENT )
1864 if( eClickAction == presentation::ClickAction_BOOKMARK )
1874 if( ( nFound & Found::VERB ) && eClickAction == presentation::ClickAction_VERB )
1882 if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND )
1884 if( ( nFound & Found::SOUNDURL ) && !aStrSoundURL.isEmpty() )
1890 if( nFound & Found::PLAYFULL && bPlayFull )
1899 if( nFound & Found::MACRO )
1907 OUString aEventQName(
1912 if( nFound & Found::LIBRARY )
1915 (aStrLibrary.equalsIgnoreAsciiCase(
"StarOffice") ||
1919 sLocation +
":" + aStrMacro);
1929 else if( aClickEventType ==
gsScript )
1931 if( nFound & Found::MACRO )
1937 OUString aEventQName(
1955 OUString aDescription;
1957 uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
1958 xProps->getPropertyValue(
"Title") >>= aTitle;
1959 xProps->getPropertyValue(
"Description") >>= aDescription;
1961 if(!aTitle.isEmpty())
1967 if(!aDescription.isEmpty())
1973 catch( uno::Exception& )
1981 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
1982 if(!(xShapes.is() && xShapes->getCount()))
1996 awt::Point aUpperLeft;
2001 aUpperLeft = xShape->getPosition();
2002 pRefPoint = &aUpperLeft;
2010 const uno::Reference< drawing::XShape >& xShape,
2013 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2018 bool bIsPresShape(
false);
2019 bool bIsEmptyPresObj(
false);
2027 bIsPresShape =
true;
2033 bIsPresShape =
true;
2039 bIsPresShape =
true;
2045 bIsPresShape =
true;
2051 bIsPresShape =
true;
2057 bIsPresShape =
true;
2063 bIsPresShape =
true;
2069 bIsPresShape =
true;
2087 sal_Int32 nCornerRadius(0);
2088 xPropSet->getPropertyValue(
"CornerRadius") >>= nCornerRadius;
2091 OUStringBuffer sStringBuffer;
2100 if(!bIsEmptyPresObj)
2111 const uno::Reference< drawing::XShape >& xShape,
2114 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2122 sal_Int32 nCornerRadius(0);
2123 xPropSet->getPropertyValue(
"CornerRadius") >>= nCornerRadius;
2126 OUStringBuffer sStringBuffer;
2143 const uno::Reference< drawing::XShape >& xShape,
2146 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2151 OUStringBuffer sStringBuffer;
2152 awt::Point aStart(0,0);
2153 awt::Point aEnd(1,1);
2164 double fTRShear(0.0);
2165 double fTRRotate(0.0);
2172 if (xPropSet->getPropertySetInfo()->hasPropertyByName(
"Geometry"))
2175 uno::Any aAny(xPropSet->getPropertyValue(
"Geometry"));
2176 if (
auto pSourcePolyPolygon
2177 = o3tl::tryAccess<drawing::PointSequenceSequence>(aAny))
2179 if (pSourcePolyPolygon->getLength() > 0)
2181 const drawing::PointSequence& rInnerSequence = (*pSourcePolyPolygon)[0];
2182 if (rInnerSequence.hasElements())
2184 const awt::Point& rPoint = rInnerSequence[0];
2185 aStart = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
2187 if (rInnerSequence.getLength() > 1)
2189 const awt::Point& rPoint = rInnerSequence[1];
2190 aEnd = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
2201 aStr = sStringBuffer.makeStringAndClear();
2214 aStr = sStringBuffer.makeStringAndClear();
2225 aStr = sStringBuffer.makeStringAndClear();
2231 aStr = sStringBuffer.makeStringAndClear();
2246 const uno::Reference< drawing::XShape >& xShape,
2249 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2254 awt::Size aSize = xShape->getSize();
2255 sal_Int32 nRx((aSize.Width + 1) / 2);
2256 sal_Int32 nRy((aSize.Height + 1) / 2);
2257 bool bCircle(nRx == nRy);
2262 drawing::CircleKind eKind = drawing::CircleKind_FULL;
2263 xPropSet->getPropertyValue(
"CircleKind") >>= eKind;
2264 if( eKind != drawing::CircleKind_FULL )
2266 OUStringBuffer sStringBuffer;
2267 sal_Int32 nStartAngle = 0;
2268 sal_Int32 nEndAngle = 0;
2269 xPropSet->getPropertyValue(
"CircleStartAngle") >>= nStartAngle;
2270 xPropSet->getPropertyValue(
"CircleEndAngle") >>= nEndAngle;
2272 const double dStartAngle = nStartAngle / 100.0;
2273 const double dEndAngle = nEndAngle / 100.0;
2293 bCreateNewline,
true);
2303 const uno::Reference< drawing::XShape >& xShape,
2306 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
2319 double fTRShear(0.0);
2320 double fTRRotate(0.0);
2340 uno::Any aAny( xPropSet->getPropertyValue(
"Geometry") );
2341 auto pSourcePolyPolygon = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(aAny);
2342 if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
2346 *pSourcePolyPolygon));
2349 const OUString aPolygonString(
2363 uno::Any aAny( xPropSet->getPropertyValue(
"Geometry") );
2367 if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
2382 const OUString aPolygonString(
2414 OUString 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())
2545 if (aMimeType.isEmpty())
2548 if (!aHref.isEmpty())
2562 "mime-type", aMimeType);
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(
3308 (xStream.is()) ? xStream->getOutputStream() :
nullptr);
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&)
3367 const uno::Reference< drawing::XShape >& xShape,
3370 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3387 xPropSet->getPropertyValue(
"MediaURL") >>= aMediaURL;
3389 xPropSet->getPropertyValue(
"MediaMimeType") >>= sMimeType;
3391 OUString
const persistentURL =
3409 static const OUStringLiteral aLoopStr(
u"Loop" );
3410 xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
3416 static const OUStringLiteral aMuteStr(
u"Mute" );
3417 xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
3422 sal_Int16 nVolumeDB = 0;
3423 xPropSet->getPropertyValue(
"VolumeDB") >>= nVolumeDB;
3428 media::ZoomLevel eZoom;
3429 OUString aZoomValue;
3430 xPropSet->getPropertyValue(
"Zoom") >>= eZoom;
3433 case media::ZoomLevel_ZOOM_1_TO_4 : aZoomValue =
"25%";
break;
3434 case media::ZoomLevel_ZOOM_1_TO_2 : aZoomValue =
"50%";
break;
3435 case media::ZoomLevel_ORIGINAL : aZoomValue =
"100%";
break;
3436 case media::ZoomLevel_ZOOM_2_TO_1 : aZoomValue =
"200%";
break;
3437 case media::ZoomLevel_ZOOM_4_TO_1 : aZoomValue =
"400%";
break;
3438 case media::ZoomLevel_FIT_TO_WINDOW: aZoomValue =
"fit";
break;
3439 case media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT: aZoomValue =
"fixedfit";
break;
3440 case media::ZoomLevel_FULLSCREEN : aZoomValue =
"fullscreen";
break;
3446 if( !aZoomValue.isEmpty() )
3457 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
3458 if(!(xShapes.is() && xShapes->getCount()))
3461 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
3462 SAL_WARN_IF( !xPropSet.is(),
"xmloff",
"XMLShapeExport::ImpExport3DSceneShape can't export a scene without a propertyset" );
3463 if( !xPropSet.is() )
3485 awt::Point aUpperLeft;
3490 aUpperLeft = xShape->getPosition();
3491 pRefPoint = &aUpperLeft;
3499 const uno::Reference< drawing::XShape >& xShape,
3502 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
3507 OUStringBuffer sStringBuffer;
3510 uno::Any aAny = xPropSet->getPropertyValue(
"D3DTransformMatrix");
3511 drawing::HomogenMatrix aHomMat;
3523 aAny = xPropSet->getPropertyValue(
"D3DPosition");
3524 drawing::Position3D aPosition3D;
3525 aAny >>= aPosition3D;
3526 ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
3529 aAny = xPropSet->getPropertyValue(
"D3DSize");
3530 drawing::Direction3D aDirection3D;
3531 aAny >>= aDirection3D;
3532 ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
3535 aDir3D = aPos3D + aDir3D;
3541 aStr = sStringBuffer.makeStringAndClear();
3549 aStr = sStringBuffer.makeStringAndClear();
3563 aAny = xPropSet->getPropertyValue(
"D3DPosition");
3564 drawing::Position3D aPosition3D;
3565 aAny >>= aPosition3D;
3566 ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
3569 aAny = xPropSet->getPropertyValue(
"D3DSize");
3570 drawing::Direction3D aDirection3D;
3571 aAny >>= aDirection3D;
3572 ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
3578 aStr = sStringBuffer.makeStringAndClear();
3586 aStr = sStringBuffer.makeStringAndClear();
3601 aAny = xPropSet->getPropertyValue(
"D3DPolyPolygon3D");
3602 drawing::PolyPolygonShape3D aUnoPolyPolygon3D;
3603 aAny >>= aUnoPolyPolygon3D;
3608 aUnoPolyPolygon3D));
3615 aB3DHomMatrixFor2DConversion));
3622 aPolyPolygonRange.getMinX(),
3623 aPolyPolygonRange.getMinY(),
3624 aPolyPolygonRange.getWidth(),
3625 aPolyPolygonRange.getHeight());
3630 const OUString aPolygonString(
3661 OUStringBuffer sStringBuffer;
3664 uno::Any aAny = xPropSet->getPropertyValue(
"D3DTransformMatrix");
3665 drawing::HomogenMatrix aHomMat;
3673 aAny = xPropSet->getPropertyValue(
"D3DCameraGeometry");
3674 drawing::CameraGeometry aCamGeo;
3677 ::basegfx::B3DVector aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
3681 aStr = sStringBuffer.makeStringAndClear();
3685 ::basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
3689 aStr = sStringBuffer.makeStringAndClear();
3693 ::basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
3697 aStr = sStringBuffer.makeStringAndClear();
3702 aAny = xPropSet->getPropertyValue(
"D3DScenePerspective");
3703 drawing::ProjectionMode aPrjMode;
3705 if(aPrjMode == drawing::ProjectionMode_PARALLEL)
3712 aAny = xPropSet->getPropertyValue(
"D3DSceneDistance");
3713 sal_Int32 nDistance = 0;
3717 aStr = sStringBuffer.makeStringAndClear();
3721 aAny = xPropSet->getPropertyValue(
"D3DSceneFocalLength");
3722 sal_Int32 nFocalLength = 0;
3723 aAny >>= nFocalLength;
3726 aStr = sStringBuffer.makeStringAndClear();
3730 aAny = xPropSet->getPropertyValue(
"D3DSceneShadowSlant");
3731 sal_Int16 nShadowSlant = 0;
3732 aAny >>= nShadowSlant;
3736 aAny = xPropSet->getPropertyValue(
"D3DSceneShadeMode");
3737 drawing::ShadeMode aShadeMode;
3738 if(aAny >>= aShadeMode)
3740 if(aShadeMode == drawing::ShadeMode_FLAT)
3742 else if(aShadeMode == drawing::ShadeMode_PHONG)
3744 else if(aShadeMode == drawing::ShadeMode_SMOOTH)
3757 aAny = xPropSet->getPropertyValue(
"D3DSceneAmbientColor");
3758 sal_Int32 nAmbientColor = 0;
3759 aAny >>= nAmbientColor;
3761 aStr = sStringBuffer.makeStringAndClear();
3765 aAny = xPropSet->getPropertyValue(
"D3DSceneTwoSidedLighting");
3766 bool bTwoSidedLighting =
false;
3767 aAny >>= bTwoSidedLighting;
3769 aStr = sStringBuffer.makeStringAndClear();
3778 OUStringBuffer sStringBuffer;
3780 static const OUStringLiteral aColorPropName(
u"D3DSceneLightColor");
3781 static const OUStringLiteral aDirectionPropName(
u"D3DSceneLightDirection");
3782 static const OUStringLiteral aLightOnPropName(
u"D3DSceneLightOn");
3785 drawing::Direction3D aLightDir;
3786 bool bLightOnOff =
false;
3787 for(sal_Int32 nLamp = 1; nLamp <= 8; nLamp++)
3789 OUString aIndexStr = OUString::number( nLamp );
3792 OUString
aPropName = aColorPropName + aIndexStr;
3793 sal_Int32 nLightColor = 0;
3794 xPropSet->getPropertyValue( aPropName ) >>= nLightColor;
3796 aStr = sStringBuffer.makeStringAndClear();
3800 aPropName = aDirectionPropName + aIndexStr;
3801 xPropSet->getPropertyValue(aPropName) >>= aLightDir;
3802 aLightDirection =
::basegfx::B3DVector(aLightDir.DirectionX, aLightDir.DirectionY, aLightDir.DirectionZ);
3804 aStr = sStringBuffer.makeStringAndClear();
3808 aPropName = aLightOnPropName + aIndexStr;
3809 xPropSet->getPropertyValue(aPropName) >>= bLightOnOff;
3811 aStr = sStringBuffer.makeStringAndClear();
3828 static void ExportParameter( OUStringBuffer& rStrBuffer,
const css::drawing::EnhancedCustomShapeParameter& rParameter )
3830 if ( !rStrBuffer.isEmpty() )
3831 rStrBuffer.append(
' ' );
3832 if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
3834 double fNumber = 0.0;
3835 rParameter.Value >>= fNumber;
3836 ::rtl::math::doubleToUStringBuffer( rStrBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
'.',
true );
3841 rParameter.Value >>= nValue;
3843 switch( rParameter.Type )
3845 case css::drawing::EnhancedCustomShapeParameterType::EQUATION :
3847 rStrBuffer.append(
"?f" + OUString::number( nValue ) );
3851 case css::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT :
3853 rStrBuffer.append(
'$' );
3854 rStrBuffer.append( nValue );
3858 case css::drawing::EnhancedCustomShapeParameterType::BOTTOM :
3860 case css::drawing::EnhancedCustomShapeParameterType::RIGHT :
3862 case css::drawing::EnhancedCustomShapeParameterType::TOP :
3864 case css::drawing::EnhancedCustomShapeParameterType::LEFT :
3866 case css::drawing::EnhancedCustomShapeParameterType::XSTRETCH :
3868 case css::drawing::EnhancedCustomShapeParameterType::YSTRETCH :
3870 case css::drawing::EnhancedCustomShapeParameterType::HASSTROKE :
3872 case css::drawing::EnhancedCustomShapeParameterType::HASFILL :
3874 case css::drawing::EnhancedCustomShapeParameterType::WIDTH :
3876 case css::drawing::EnhancedCustomShapeParameterType::HEIGHT :
3878 case css::drawing::EnhancedCustomShapeParameterType::LOGWIDTH :
3880 case css::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT :
3883 rStrBuffer.append( nValue );
3891 for ( i = 0; i < rEquations.getLength(); i++ )
3893 OUString
aStr=
"f" + OUString::number( i );
3896 aStr = rEquations[ i ];
3900 nIndex = aStr.indexOf(
'?', nIndex );
3903 aStr = OUString::Concat(aStr.subView(0, nIndex + 1)) +
"f"
3904 + aStr.subView(nIndex + 1, aStr.getLength() - nIndex - 1);
3907 }
while( nIndex != -1 );
3915 if ( !rHandles.hasElements() )
3919 OUStringBuffer aStrBuffer;
3921 for (
const uno::Sequence< beans::PropertyValue >& rPropSeq : rHandles )
3923 bool bPosition =
false;
3924 for (
const beans::PropertyValue& rPropVal : rPropSeq )
3926 switch(
EASGet( rPropVal.Name ) )
3930 css::drawing::EnhancedCustomShapeParameterPair aPosition;
3931 if ( rPropVal.Value >>= aPosition )
3935 aStr = aStrBuffer.makeStringAndClear();
3944 if ( rPropVal.Value >>= bMirroredX )
3952 if ( rPropVal.Value >>= bMirroredY )
3960 if ( rPropVal.Value >>= bSwitched )
3967 css::drawing::EnhancedCustomShapeParameterPair aPolar;
3968 if ( rPropVal.Value >>= aPolar )
3972 aStr = aStrBuffer.makeStringAndClear();
3979 css::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
3980 if ( rPropVal.Value >>= aRadiusRangeMinimum )
3983 aStr = aStrBuffer.makeStringAndClear();
3990 css::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
3991 if ( rPropVal.Value >>= aRadiusRangeMaximum )
3994 aStr = aStrBuffer.makeStringAndClear();
4001 css::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
4002 if ( rPropVal.Value >>= aXRangeMinimum )
4005 aStr = aStrBuffer.makeStringAndClear();
4012 css::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
4013 if ( rPropVal.Value >>= aXRangeMaximum )
4016 aStr = aStrBuffer.makeStringAndClear();
4023 css::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
4024 if ( rPropVal.Value >>= aYRangeMinimum )
4027 aStr = aStrBuffer.makeStringAndClear();
4034 css::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
4035 if ( rPropVal.Value >>= aYRangeMaximum )
4038 aStr = aStrBuffer.makeStringAndClear();
4055 const uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair >& rCoordinates,
4056 const uno::Sequence< css::drawing::EnhancedCustomShapeSegment >& rSegments,
4057 bool bExtended =
false )
4061 OUStringBuffer aStrBuffer;
4062 bool bNeedExtended =
false;
4064 sal_Int32
i, j, k, l;
4066 sal_Int32 nCoords = rCoordinates.getLength();
4067 sal_Int32 nSegments = rSegments.getLength();
4068 bool bSimpleSegments = nSegments == 0;
4069 if ( bSimpleSegments )
4071 for ( j = i = 0; j < nSegments; j++ )
4073 css::drawing::EnhancedCustomShapeSegment aSegment;
4074 if ( bSimpleSegments )
4082 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
4087 aSegment.Count =
static_cast<sal_Int16
>(std::min( nCoords - 1, sal_Int32(32767) ));
4088 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
4094 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
4100 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
4106 aSegment = rSegments[ j ];
4108 if ( !aStrBuffer.isEmpty() )
4109 aStrBuffer.append(
' ' );
4111 sal_Int32 nParameter = 0;
4112 switch( aSegment.Command )
4114 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH :
4115 aStrBuffer.append(
'Z' );
break;
4116 case css::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH :
4117 aStrBuffer.append(
'N' );
break;
4118 case css::drawing::EnhancedCustomShapeSegmentCommand::NOFILL :
4119 aStrBuffer.append(
'F' );
break;
4120 case css::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE :
4121 aStrBuffer.append(
'S' );
break;
4123 case css::drawing::EnhancedCustomShapeSegmentCommand::MOVETO :
4124 aStrBuffer.append(
'M' ); nParameter = 1;
break;
4125 case css::drawing::EnhancedCustomShapeSegmentCommand::LINETO :
4126 aStrBuffer.append(
'L' ); nParameter = 1;
break;
4127 case css::drawing::EnhancedCustomShapeSegmentCommand::CURVETO :
4128 aStrBuffer.append(
'C' ); nParameter = 3;
break;
4129 case css::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
4130 aStrBuffer.append(
'T' ); nParameter = 3;
break;
4131 case css::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
4132 aStrBuffer.append(
'U' ); nParameter = 3;
break;
4133 case css::drawing::EnhancedCustomShapeSegmentCommand::ARCTO :
4134 aStrBuffer.append(
'A' ); nParameter = 4;
break;
4135 case css::drawing::EnhancedCustomShapeSegmentCommand::ARC :
4136 aStrBuffer.append(
'B' ); nParameter = 4;
break;
4137 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
4138 aStrBuffer.append(
'W' ); nParameter = 4;
break;
4139 case css::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
4140 aStrBuffer.append(
'V' ); nParameter = 4;
break;
4141 case css::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
4142 aStrBuffer.append(
'X' ); nParameter = 1;
break;
4143 case css::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
4144 aStrBuffer.append(
'Y' ); nParameter = 1;
break;
4145 case css::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO :
4146 aStrBuffer.append(
'Q' ); nParameter = 2;
break;
4147 case css::drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO :
4149 aStrBuffer.append(
'G' );
4152 aStrBuffer.setLength( aStrBuffer.getLength() - 1);
4153 bNeedExtended =
true;
4157 case css::drawing::EnhancedCustomShapeSegmentCommand::DARKEN :
4159 aStrBuffer.append(
'H' );
4161 bNeedExtended =
true;
4163 case css::drawing::EnhancedCustomShapeSegmentCommand::DARKENLESS :
4165 aStrBuffer.append(
'I' );
4167 bNeedExtended =
true;
4169 case css::drawing::EnhancedCustomShapeSegmentCommand::LIGHTEN :
4171 aStrBuffer.append(
'J' );
4173 bNeedExtended =
true;
4175 case css::drawing::EnhancedCustomShapeSegmentCommand::LIGHTENLESS :
4177 aStrBuffer.append(
'K' );
4179 bNeedExtended =
true;
4184 aSegment.Command = css::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
4190 for ( k = 0; k < aSegment.Count; k++ )
4192 if ( ( i + nParameter ) <= nCoords )
4194 for ( l = 0; l < nParameter; l++ )
4208 aStr = aStrBuffer.makeStringAndClear();
4216 bool bEquations =
false;
4217 uno::Sequence< OUString > aEquations;
4219 bool bHandles =
false;
4220 uno::Sequence< beans::PropertyValues > aHandles;
4222 uno::Sequence< css::drawing::EnhancedCustomShapeSegment >
aSegments;
4223 uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
4225 uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues;
4228 OUStringBuffer aStrBuffer;
4231 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
4234 static const OUStringLiteral sCustomShapeGeometry(
u"CustomShapeGeometry" );
4235 if ( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sCustomShapeGeometry ) )
4237 uno::Any aGeoPropSet( xPropSet->getPropertyValue( sCustomShapeGeometry ) );
4238 uno::Sequence< beans::PropertyValue > aGeoPropSeq;
4240 if ( aGeoPropSet >>= aGeoPropSeq )
4242 bool bCoordinates =
false;
4243 OUString aCustomShapeType(
"non-primitive" );
4245 for (
const beans::PropertyValue& rGeoProp : std::as_const(aGeoPropSeq) )
4247 switch(
EASGet( rGeoProp.Name ) )
4251 rGeoProp.Value >>= aCustomShapeType;
4257 if ( rGeoProp.Value >>= bMirroredX )
4265 if ( rGeoProp.Value >>= bMirroredY )
4272 awt::Rectangle aRect;
4273 if ( rGeoProp.Value >>= aRect )
4283 double fTextRotateAngle = 0;
4284 if ( ( rGeoProp.Value >>= fTextRotateAngle ) && fTextRotateAngle != 0 )
4287 aStrBuffer, fTextRotateAngle );
4288 aStr = aStrBuffer.makeStringAndClear();
4295 uno::Sequence< beans::PropertyValue > aExtrusionPropSeq;
4296 if ( rGeoProp.Value >>= aExtrusionPropSeq )
4298 bool bSkewValuesProvided =
false;
4299 for (
const beans::PropertyValue& rProp : std::as_const(aExtrusionPropSeq) )
4301 switch(
EASGet( rProp.Name ) )
4306 if ( rProp.Value >>= bExtrusionOn )
4313 double fExtrusionBrightness = 0;
4314 if ( rProp.Value >>= fExtrusionBrightness )
4318 fExtrusionBrightness,
4320 util::MeasureUnit::PERCENT,
4321 util::MeasureUnit::PERCENT);
4322 aStrBuffer.append(
'%' );
4323 aStr = aStrBuffer.makeStringAndClear();
4330 css::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
4331 if ( rProp.Value >>= aDepthParaPair )
4334 if ( aDepthParaPair.First.Value >>= fDepth )
4338 aStr = aStrBuffer.makeStringAndClear();
4346 double fExtrusionDiffusion = 0;
4347 if ( rProp.Value >>= fExtrusionDiffusion )
4351 fExtrusionDiffusion,
4353 util::MeasureUnit::PERCENT,
4354 util::MeasureUnit::PERCENT);
4355 aStrBuffer.append(
'%' );
4356 aStr = aStrBuffer.makeStringAndClear();
4363 sal_Int32 nExtrusionNumberOfLineSegments = 0;
4364 if ( rProp.Value >>= nExtrusionNumberOfLineSegments )
4370 bool bExtrusionLightFace;
4371 if ( rProp.Value >>= bExtrusionLightFace )
4378 bool bExtrusionFirstLightHarsh;
4379 if ( rProp.Value >>= bExtrusionFirstLightHarsh )
4386 bool bExtrusionSecondLightHarsh;
4387 if ( rProp.Value >>= bExtrusionSecondLightHarsh )
4394 double fExtrusionFirstLightLevel = 0;
4395 if ( rProp.Value >>= fExtrusionFirstLightLevel )
4399 fExtrusionFirstLightLevel,
4401 util::MeasureUnit::PERCENT,
4402 util::MeasureUnit::PERCENT);
4403 aStrBuffer.append(
'%' );
4404 aStr = aStrBuffer.makeStringAndClear();
4411 double fExtrusionSecondLightLevel = 0;
4412 if ( rProp.Value >>= fExtrusionSecondLightLevel )
4416 fExtrusionSecondLightLevel,
4418 util::MeasureUnit::PERCENT,
4419 util::MeasureUnit::PERCENT);
4420 aStrBuffer.append(
'%' );
4421 aStr = aStrBuffer.makeStringAndClear();
4428 drawing::Direction3D aExtrusionFirstLightDirection;
4429 if ( rProp.Value >>= aExtrusionFirstLightDirection )
4431 ::basegfx::B3DVector aVec3D( aExtrusionFirstLightDirection.DirectionX, aExtrusionFirstLightDirection.DirectionY,
4432 aExtrusionFirstLightDirection.DirectionZ );
4434 aStr = aStrBuffer.makeStringAndClear();
4441 drawing::Direction3D aExtrusionSecondLightDirection;
4442 if ( rProp.Value >>= aExtrusionSecondLightDirection )
4444 ::basegfx::B3DVector aVec3D( aExtrusionSecondLightDirection.DirectionX, aExtrusionSecondLightDirection.DirectionY,
4445 aExtrusionSecondLightDirection.DirectionZ );
4447 aStr = aStrBuffer.makeStringAndClear();
4454 bool bExtrusionMetal;
4455 if ( rProp.Value >>= bExtrusionMetal )
4463 sal_Int16 eMetalType;
4464 if (rProp.Value >>= eMetalType)
4470 if (eMetalType == drawing::EnhancedCustomShapeMetalType::MetalMSCompatible)
4471 aStr =
"loext:MetalMSCompatible";
4473 aStr =
"draw:MetalODF";
4482 drawing::ShadeMode eShadeMode;
4483 if( rProp.Value >>= eShadeMode )
4485 if( eShadeMode == drawing::ShadeMode_FLAT )
4487 else if( eShadeMode == drawing::ShadeMode_PHONG )
4489 else if( eShadeMode == drawing::ShadeMode_SMOOTH )
4504 css::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair;
4505 if ( rProp.Value >>= aRotateAngleParaPair )
4509 aStr = aStrBuffer.makeStringAndClear();
4516 drawing::Direction3D aExtrusionRotationCenter;
4517 if ( rProp.Value >>= aExtrusionRotationCenter )
4519 ::basegfx::B3DVector aVec3D( aExtrusionRotationCenter.DirectionX, aExtrusionRotationCenter.DirectionY,
4520 aExtrusionRotationCenter.DirectionZ );
4522 aStr = aStrBuffer.makeStringAndClear();
4529 double fExtrusionShininess = 0;
4530 if ( rProp.Value >>= fExtrusionShininess )
4534 fExtrusionShininess,
4536 util::MeasureUnit::PERCENT,
4537 util::MeasureUnit::PERCENT);
4538 aStrBuffer.append(
'%' );
4539 aStr = aStrBuffer.makeStringAndClear();
4546 css::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
4547 if ( rProp.Value >>= aSkewParaPair )
4549 bSkewValuesProvided =
true;
4552 aStr = aStrBuffer.makeStringAndClear();
4559 double fExtrusionSpecularity = 0;
4560 if ( rProp.Value >>= fExtrusionSpecularity )
4569 fExtrusionSpecularity,
4571 util::MeasureUnit::PERCENT,
4572 util::MeasureUnit::PERCENT);
4573 aStrBuffer.append(
'%' );
4574 aStr = aStrBuffer.makeStringAndClear();
4580 fExtrusionSpecularity = std::clamp<double>(fExtrusionSpecularity, 0.0, 100.0);
4584 fExtrusionSpecularity,
4586 util::MeasureUnit::PERCENT,
4587 util::MeasureUnit::PERCENT);
4588 aStrBuffer.append(
'%' );
4589 aStr = aStrBuffer.makeStringAndClear();
4596 drawing::ProjectionMode eProjectionMode;
4597 if ( rProp.Value >>= eProjectionMode )
4604 drawing::Position3D aExtrusionViewPoint;
4605 if ( rProp.Value >>= aExtrusionViewPoint )
4608 aStr = aStrBuffer.makeStringAndClear();
4615 css::drawing::EnhancedCustomShapeParameterPair aOriginParaPair;
4616 if ( rProp.Value >>= aOriginParaPair )
4620 aStr = aStrBuffer.makeStringAndClear();
4627 bool bExtrusionColor;
4628 if ( rProp.Value >>= bExtrusionColor )
4640 if (!bSkewValuesProvided)
4650 uno::Sequence< beans::PropertyValue > aTextPathPropSeq;
4651 if ( rGeoProp.Value >>= aTextPathPropSeq )
4653 for (
const beans::PropertyValue& rProp : std::as_const(aTextPathPropSeq) )
4655 switch(
EASGet( rProp.Name ) )
4660 if ( rProp.Value >>= bTextPathOn )
4667 css::drawing::EnhancedCustomShapeTextPathMode eTextPathMode;
4668 if ( rProp.Value >>= eTextPathMode )
4670 switch ( eTextPathMode )
4673 case css::drawing::EnhancedCustomShapeTextPathMode_PATH : aStr =
GetXMLToken(
XML_PATH );
break;
4674 case css::drawing::EnhancedCustomShapeTextPathMode_SHAPE : aStr =
GetXMLToken(
XML_SHAPE );
break;
4678 if ( !aStr.isEmpty() )
4686 if ( rProp.Value >>= bScaleX )
4695 bool bSameLetterHeights;
4696 if ( rProp.Value >>= bSameLetterHeights )
4710 uno::Sequence< beans::PropertyValue > aPathPropSeq;
4711 if ( rGeoProp.Value >>= aPathPropSeq )
4713 for (
const beans::PropertyValue& rProp : std::as_const(aPathPropSeq) )
4715 switch(
EASGet( rProp.Name ) )
4724 uno::Sequence< awt::Size > aSubViewSizes;
4725 rProp.Value >>= aSubViewSizes;
4727 for (
int nIdx = 0; nIdx < aSubViewSizes.getLength(); nIdx++ )
4730 aStrBuffer.append(
' ');
4731 aStrBuffer.append( aSubViewSizes[nIdx].
Width );
4732 aStrBuffer.append(
' ');
4733 aStrBuffer.append( aSubViewSizes[nIdx].
Height );
4735 aStr = aStrBuffer.makeStringAndClear();
4741 bool bExtrusionAllowed;
4742 if ( rProp.Value >>= bExtrusionAllowed )
4749 bool bConcentricGradientFillAllowed;
4750 if ( rProp.Value >>= bConcentricGradientFillAllowed )
4757 bool bTextPathAllowed;
4758 if ( rProp.Value >>= bTextPathAllowed )
4765 css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> aGluePoints;
4766 if ( rProp.Value >>= aGluePoints )
4768 if ( aGluePoints.hasElements() )
4770 for(
const auto& rGluePoint : std::as_const(aGluePoints) )
4775 aStr = aStrBuffer.makeStringAndClear();
4783 sal_Int16 nGluePointType = sal_Int16();
4784 if ( rProp.Value >>= nGluePointType )
4786 switch ( nGluePointType )
4788 case css::drawing::EnhancedCustomShapeGluePointType::NONE : aStr =
GetXMLToken(
XML_NONE );
break;
4792 if ( !aStr.isEmpty() )
4799 bCoordinates = ( rProp.Value >>= aCoordinates );
4804 rProp.Value >>= aSegments;
4809 sal_Int32 nStretchPoint = 0;
4810 if ( rProp.Value >>= nStretchPoint )
4816 sal_Int32 nStretchPoint = 0;
4817 if ( rProp.Value >>= nStretchPoint )
4823 css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > aPathTextFrames;
4824 if ( rProp.Value >>= aPathTextFrames )
4826 if ( aPathTextFrames.hasElements() )
4828 for (
const auto& rPathTextFrame : std::as_const(aPathTextFrames) )
4835 aStr = aStrBuffer.makeStringAndClear();
4850 bEquations = ( rGeoProp.Value >>= aEquations );
4855 bHandles = ( rGeoProp.Value >>= aHandles );
4860 rGeoProp.Value >>= aAdjustmentValues;
4870 sal_Int32 nAdjustmentValues = aAdjustmentValues.getLength();
4871 if ( nAdjustmentValues )
4874 for ( i = 0; i < nAdjustmentValues; i++ )
4877 aStrBuffer.append(
' ' );
4879 const css::drawing::EnhancedCustomShapeAdjustmentValue& rAdj = aAdjustmentValues[ i ];
4880 if ( rAdj.State == beans::PropertyState_DIRECT_VALUE )
4882 if ( rAdj.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
4884 double fValue = 0.0;
4885 rAdj.Value >>= fValue;
4890 rAdj.Value >>= nValue;
4891 aStrBuffer.append(nValue);
4897 aStrBuffer.append(
"0");
4900 aStr = aStrBuffer.makeStringAndClear();
4915 const uno::Reference< drawing::XShape >& xShape,
4918 const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
4919 if ( !xPropSet.is() )
4922 uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
4927 if ( xPropSetInfo.is() )
4930 if ( xPropSetInfo->hasPropertyByName(
"CustomShapeEngine" ) )
4932 uno::Any aEngine( xPropSet->getPropertyValue(
"CustomShapeEngine" ) );
4933 if ( ( aEngine >>= aStr ) && !aStr.isEmpty() )
4936 if ( xPropSetInfo->hasPropertyByName(
"CustomShapeData" ) )
4938 uno::Any aData( xPropSet->getPropertyValue(
"CustomShapeData" ) );
4939 if ( (
aData >>= aStr ) && !aStr.isEmpty() )
4955 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
4956 uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
4958 SAL_WARN_IF( !xPropSet.is() || !xNamed.is(),
"xmloff",
"xmloff::XMLShapeExport::ImpExportTableShape(), table shape is not implementing needed interfaces");
4959 if(!(xPropSet.is() && xNamed.is()))
4967 bool bIsEmptyPresObj =
false;
4981 if( !bIsEmptyPresObj )
4983 uno::Reference< container::XNamed > xTemplate( xPropSet->getPropertyValue(
"TableTemplate"), uno::UNO_QUERY );
4984 if( xTemplate.is() )
4986 const OUString sTemplate( xTemplate->getName() );
4987 if( !sTemplate.isEmpty() )
4996 const OUString sAPIPropertyName( pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US );
4998 xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool;
5002 catch( uno::Exception& )
5010 uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue(
gsModel ), uno::UNO_QUERY_THROW );
5015 if( !bIsEmptyPresObj )
5017 uno::Reference< graphic::XGraphic > xGraphic( xPropSet->getPropertyValue(
"ReplacementGraphic"), uno::UNO_QUERY );
5018 if( xGraphic.is() )
try
5022 uno::Reference< embed::XStorage > xPictureStorage;
5023 uno::Reference< embed::XStorage > xStorage;
5024 uno::Reference< io::XStream > xPictureStream;
5026 OUString sPictureName;
5027 if( bExportEmbedded )
5029 xPictureStream.set( xContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.comp.MemoryStream", xContext), uno::UNO_QUERY_THROW );
5033 xStorage.set(
GetExport().GetTargetStorage(), uno::UNO_SET_THROW );
5035 xPictureStorage.set( xStorage->openStorageElement(
"Pictures" , ::embed::ElementModes::READWRITE ), uno::UNO_SET_THROW );
5040 sPictureName =
"TablePreview" + OUString::number( ++nIndex ) +
".svm";
5042 while( xPictureStorage->hasByName( sPictureName ) );
5044 xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, ::embed::ElementModes::READWRITE ), uno::UNO_SET_THROW );
5047 uno::Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) );
5048 uno::Sequence< beans::PropertyValue > aArgs{
5052 xProvider->storeGraphic( xGraphic, aArgs );
5054 if( xPictureStorage.is() )
5056 uno::Reference< embed::XTransactedObject > xTrans( xPictureStorage, uno::UNO_QUERY );
5061 if( !bExportEmbedded )
5063 OUString sURL =
"Pictures/" + sPictureName;
5072 if( bExportEmbedded )
5074 uno::Reference< io::XSeekableInputStream > xSeekable( xPictureStream, uno::UNO_QUERY_THROW );
5081 catch( uno::Exception
const & )
5091 catch( uno::Exception
const & )
css::uno::Reference< css::embed::XStorage > const & GetTargetStorage() const
#define SO3_RPTCH_CLASSID