1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <basegfx/matrix/b2dhommatrix.hxx>
21 #include <com/sun/star/drawing/XDrawPage.hpp>
22 #include <com/sun/star/drawing/XShapes.hpp>
23 #include <com/sun/star/frame/XModel.hpp>
24 #include <oox/ppt/timenode.hxx>
25 #include <oox/ppt/pptshape.hxx>
26 #include <oox/ppt/slidepersist.hxx>
27 #include <drawingml/fillproperties.hxx>
28 #include <oox/drawingml/shapepropertymap.hxx>
29 #include <oox/helper/propertymap.hxx>
30 #include <oox/helper/propertyset.hxx>
31 #include <oox/vml/vmldrawing.hxx>
32 #include <oox/token/properties.hxx>
33 #include <oox/token/tokens.hxx>
34 #include <oox/core/xmlfilterbase.hxx>
35 #include <drawingml/textliststyle.hxx>
36 #include <drawingml/textparagraphproperties.hxx>
38 #include <osl/diagnose.h>
40 #include <com/sun/star/style/XStyle.hpp>
41 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
42 #include <com/sun/star/container/XNamed.hpp>
43 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
44 #include <com/sun/star/drawing/XGluePointsSupplier.hpp>
45 #include <com/sun/star/container/XIdentifierContainer.hpp>
46 #include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
47 #include <com/sun/star/drawing/ConnectorType.hpp>
49 #include <svx/svdobj.hxx>
51 using namespace ::com::sun::star
;
52 using namespace ::oox::core
;
53 using namespace ::com::sun::star::uno
;
54 using namespace ::com::sun::star::drawing
;
55 using namespace ::com::sun::star::container
;
56 using namespace ::com::sun::star::animations
;
61 SlidePersist::SlidePersist( XmlFilterBase
& rFilter
, bool bMaster
, bool bNotes
,
62 const css::uno::Reference
< css::drawing::XDrawPage
>& rxPage
,
63 oox::drawingml::ShapePtr pShapesPtr
, drawingml::TextListStylePtr pDefaultTextStyle
)
64 : mpDrawingPtr( std::make_shared
<oox::vml::Drawing
>( rFilter
, rxPage
, oox::vml::VMLDRAWING_POWERPOINT
) )
66 , maShapesPtr(std::move( pShapesPtr
))
67 , mnLayoutValueToken( 0 )
70 , maDefaultTextStylePtr(std::move( pDefaultTextStyle
))
71 , maTitleTextStylePtr( std::make_shared
<oox::drawingml::TextListStyle
>() )
72 , maBodyTextStylePtr( std::make_shared
<oox::drawingml::TextListStyle
>() )
73 , maNotesTextStylePtr( std::make_shared
<oox::drawingml::TextListStyle
>() )
74 , maOtherTextStylePtr( std::make_shared
<oox::drawingml::TextListStyle
>() )
76 #if OSL_DEBUG_LEVEL > 0
81 #if OSL_DEBUG_LEVEL > 0
82 css::uno::WeakReference
< css::drawing::XDrawPage
> SlidePersist::mxDebugPage
;
85 SlidePersist::~SlidePersist()
89 sal_Int16
SlidePersist::getLayoutFromValueToken() const
91 sal_Int16 nLayout
= 20; // 20 == blank (so many magic numbers :-( the description at com.sun.star.presentation.DrawPage.Layout does not help)
92 switch( mnLayoutValueToken
)
94 case XML_blank
: nLayout
= 20; break;
95 case XML_chart
: nLayout
= 2; break;
96 case XML_chartAndTx
: nLayout
= 7; break;
97 case XML_clipArtAndTx
: nLayout
= 9; break;
98 case XML_clipArtAndVertTx
: nLayout
= 24; break;
99 case XML_fourObj
: nLayout
= 18; break;
100 case XML_obj
: nLayout
= 11; break;
101 case XML_objAndTx
: nLayout
= 13; break;
102 case XML_objOverTx
: nLayout
= 14; break;
103 case XML_tbl
: nLayout
= 8; break;
104 case XML_title
: nLayout
= 0; break;
105 case XML_titleOnly
: nLayout
= 19; break;
107 case XML_twoColTx
: nLayout
= 3; break;
108 case XML_twoObjAndObj
:
109 case XML_twoObjAndTx
: nLayout
= 15; break;
110 case XML_twoObjOverTx
: nLayout
= 16; break;
111 case XML_tx
: nLayout
= 1; break;
112 case XML_txAndChart
: nLayout
= 4; break;
113 case XML_txAndClipArt
: nLayout
= 6; break;
114 case XML_txAndMedia
: nLayout
= 6; break;
115 case XML_txAndObj
: nLayout
= 10; break;
116 case XML_objAndTwoObj
:
117 case XML_txAndTwoObj
: nLayout
= 12; break;
118 case XML_txOverObj
: nLayout
= 17; break;
119 case XML_vertTitleAndTx
: nLayout
= 22; break;
120 case XML_vertTitleAndTxOverChart
: nLayout
= 21; break;
121 case XML_vertTx
: nLayout
= 23; break;
122 case XML_objOnly
: nLayout
= 32; break;
124 case XML_twoTxTwoObj
:
137 void SlidePersist::createXShapes( XmlFilterBase
& rFilterBase
)
139 applyTextStyles( rFilterBase
);
141 Reference
< XShapes
> xShapes( getPage() );
142 std::vector
< oox::drawingml::ShapePtr
>& rShapes( maShapesPtr
->getChildren() );
144 for (auto const& shape
: rShapes
)
146 std::vector
< oox::drawingml::ShapePtr
>& rChildren( shape
->getChildren() );
147 for (auto const& child
: rChildren
)
149 PPTShape
* pPPTShape
= dynamic_cast< PPTShape
* >( child
.get() );
150 basegfx::B2DHomMatrix aTransformation
;
153 pPPTShape
->addShape( rFilterBase
, *this, getTheme().get(), xShapes
, aTransformation
, &getShapeMap() );
154 if (pPPTShape
->isConnectorShape())
155 maConnectorShapeId
.push_back(pPPTShape
->getId());
156 if (!pPPTShape
->getChildren().empty())
158 for (size_t i
= 0; i
< pPPTShape
->getChildren().size(); i
++)
160 if (pPPTShape
->getChildren()[i
]->isConnectorShape())
161 maConnectorShapeId
.push_back(pPPTShape
->getChildren()[i
]->getId());
166 child
->addShape( rFilterBase
, getTheme().get(), xShapes
, aTransformation
, maShapesPtr
->getFillProperties(), &getShapeMap() );
170 if (!maConnectorShapeId
.empty())
171 createConnectorShapeConnection();
173 Reference
< XAnimationNodeSupplier
> xNodeSupplier( getPage(), UNO_QUERY
);
174 if( !xNodeSupplier
.is() )
177 Reference
< XAnimationNode
> xNode( xNodeSupplier
->getAnimationNode() );
178 if( xNode
.is() && !maTimeNodeList
.empty() )
180 SlidePersistPtr
pSlidePtr( shared_from_this() );
181 TimeNodePtr
pNode(maTimeNodeList
.front());
182 OSL_ENSURE( pNode
, "pNode" );
184 Reference
<XAnimationNode
> xDummy
;
185 pNode
->setNode(rFilterBase
, xNode
, pSlidePtr
, xDummy
);
189 void SlidePersist::createBackground( const XmlFilterBase
& rFilterBase
)
191 if ( mpBackgroundPropertiesPtr
)
193 ::Color nPhClr
= maBackgroundColor
.isUsed() ?
194 maBackgroundColor
.getColor( rFilterBase
.getGraphicHelper() ) : API_RGB_TRANSPARENT
;
196 css::awt::Size aSize
;
197 Reference
< css::beans::XPropertySet
> xSet(mxPage
, UNO_QUERY
);
198 xSet
->getPropertyValue("Width") >>= aSize
.Width
;
199 xSet
->getPropertyValue("Height") >>= aSize
.Height
;
201 oox::drawingml::ShapePropertyIds aPropertyIds
= oox::drawingml::ShapePropertyInfo::DEFAULT
.mrPropertyIds
;
202 aPropertyIds
[oox::drawingml::ShapeProperty::FillGradient
] = PROP_FillGradientName
;
203 oox::drawingml::ShapePropertyInfo
aPropInfo( aPropertyIds
, true, false, true, false, false );
204 oox::drawingml::ShapePropertyMap
aPropMap( rFilterBase
.getModelObjectHelper(), aPropInfo
);
205 mpBackgroundPropertiesPtr
->pushToPropMap( aPropMap
, rFilterBase
.getGraphicHelper(), 0, nPhClr
, aSize
);
206 PropertySet( mxPage
).setProperty( PROP_Background
, aPropMap
.makePropertySet() );
210 static void setTextStyle( Reference
< beans::XPropertySet
> const & rxPropSet
, const XmlFilterBase
& rFilter
,
211 oox::drawingml::TextListStylePtr
const & pTextListStylePtr
, int nLevel
)
213 ::oox::drawingml::TextParagraphProperties
* pTextParagraphPropertiesPtr( &pTextListStylePtr
->getListStyle()[ nLevel
] );
214 if( pTextParagraphPropertiesPtr
== nullptr )
216 // no properties. return
220 PropertyMap
& rTextParagraphPropertyMap( pTextParagraphPropertiesPtr
->getTextParagraphPropertyMap() );
222 PropertySet
aPropSet( rxPropSet
);
223 aPropSet
.setProperties( rTextParagraphPropertyMap
);
224 pTextParagraphPropertiesPtr
->getTextCharacterProperties().pushToPropSet( aPropSet
, rFilter
);
227 void SlidePersist::applyTextStyles( const XmlFilterBase
& rFilterBase
)
234 Reference
< style::XStyleFamiliesSupplier
> aXStyleFamiliesSupplier( rFilterBase
.getModel(), UNO_QUERY_THROW
);
235 Reference
< container::XNameAccess
> aXNameAccess( aXStyleFamiliesSupplier
->getStyleFamilies() );
236 Reference
< container::XNamed
> aXNamed( mxPage
, UNO_QUERY_THROW
);
238 if ( aXNameAccess
.is() )
240 oox::drawingml::TextListStylePtr pTextListStylePtr
;
244 static constexpr OUStringLiteral
sOutline( u
"outline1" );
245 static constexpr OUString
sTitle( u
"title"_ustr
);
246 static constexpr OUStringLiteral
sStandard( u
"standard" );
247 static constexpr OUStringLiteral
sSubtitle( u
"subtitle" );
249 for( int i
= 0; i
< 4; i
++ ) // todo: aggregation of bodystyle (subtitle)
253 case 0 : // title style
255 pTextListStylePtr
= maTitleTextStylePtr
;
257 aFamily
= aXNamed
->getName();
260 case 1 : // body style
262 pTextListStylePtr
= maBodyTextStylePtr
;
264 aFamily
= aXNamed
->getName();
267 case 3 : // notes style
269 pTextListStylePtr
= maNotesTextStylePtr
;
271 aFamily
= aXNamed
->getName();
274 case 4 : // standard style
276 pTextListStylePtr
= maOtherTextStylePtr
;
278 aFamily
= "graphics";
283 pTextListStylePtr
= maBodyTextStylePtr
;
285 aFamily
= aXNamed
->getName();
289 Reference
< container::XNameAccess
> xFamilies
;
290 if ( aXNameAccess
->hasByName( aFamily
) )
292 if( aXNameAccess
->getByName( aFamily
) >>= xFamilies
)
294 if ( xFamilies
->hasByName( aStyle
) )
296 Reference
< style::XStyle
> aXStyle
;
297 if ( xFamilies
->getByName( aStyle
) >>= aXStyle
)
299 Reference
< beans::XPropertySet
> xPropSet( aXStyle
, UNO_QUERY_THROW
);
300 setTextStyle( xPropSet
, rFilterBase
, maDefaultTextStylePtr
, 0 );
301 setTextStyle( xPropSet
, rFilterBase
, pTextListStylePtr
, 0 );
302 if ( i
== 1 /* BodyStyle */ )
304 for ( int nLevel
= 1; nLevel
< 5; nLevel
++ )
307 char pOutline
[ 9 ] = "outline1";
308 pOutline
[ 7 ] = static_cast< char >( '0' + nLevel
);
309 OUString
sOutlineStyle( OUString::createFromAscii( pOutline
) );
310 if ( xFamilies
->hasByName( sOutlineStyle
) )
312 xFamilies
->getByName( sOutlineStyle
) >>= aXStyle
;
314 xPropSet
.set( aXStyle
, UNO_QUERY_THROW
);
317 setTextStyle( xPropSet
, rFilterBase
, maDefaultTextStylePtr
, nLevel
);
318 setTextStyle( xPropSet
, rFilterBase
, pTextListStylePtr
, nLevel
);
328 catch( const Exception
& )
333 void SlidePersist::hideShapesAsMasterShapes()
335 std::vector
< oox::drawingml::ShapePtr
>& rShapes( maShapesPtr
->getChildren() );
336 for (auto const& shape
: rShapes
)
338 std::vector
< oox::drawingml::ShapePtr
>& rChildren( shape
->getChildren() );
339 for (auto const& child
: rChildren
)
341 PPTShape
* pPPTShape
= dynamic_cast< PPTShape
* >( child
.get() );
344 pPPTShape
->setHiddenMasterShape( true );
349 // This angle determines in the direction of the line
350 static sal_Int32
lcl_GetAngle(uno::Reference
<drawing::XShape
>& rXShape
, awt::Point
& rPt
)
352 SdrObject
* pObj
= SdrObject::getSdrObjectFromXShape(rXShape
);
353 tools::Rectangle
aR(pObj
->GetSnapRect());
354 sal_Int32 nLeftX
= rPt
.X
- aR
.Left();
355 sal_Int32 nTopY
= rPt
.Y
- aR
.Top();
356 sal_Int32 nRightX
= aR
.Right() - rPt
.X
;
357 sal_Int32 nBottomY
= aR
.Bottom() - rPt
.Y
;
358 sal_Int32 nX
= std::min(nLeftX
, nRightX
);
359 sal_Int32 nY
= std::min(nTopY
, nBottomY
);
364 if (nLeftX
< nRightX
)
365 nAngle
= 180; // Left
371 if (nTopY
< nBottomY
)
374 nAngle
= 90; // Bottom
379 Reference
<XAnimationNode
> SlidePersist::getAnimationNode(const OUString
& sId
) const
381 const auto& pIter
= maAnimNodesMap
.find(sId
);
382 if (pIter
!= maAnimNodesMap
.end())
383 return pIter
->second
;
385 Reference
<XAnimationNode
> aResult
;
389 static void lcl_SetEdgeLineValue(uno::Reference
<drawing::XShape
>& rXConnector
,
390 oox::drawingml::ShapePtr
& rShapePtr
)
393 awt::Point aStartPt
, aEndPt
;
394 tools::Rectangle aS
, aE
; // Start, End rectangle
395 uno::Reference
<drawing::XShape
> xStartSp
, xEndSp
;
396 uno::Reference
<beans::XPropertySet
> xPropSet(rXConnector
, uno::UNO_QUERY
);
397 xPropSet
->getPropertyValue("EdgeStartPoint") >>= aStartPt
;
398 xPropSet
->getPropertyValue("EdgeEndPoint") >>= aEndPt
;
399 xPropSet
->getPropertyValue("StartShape") >>= xStartSp
;
400 xPropSet
->getPropertyValue("EndShape") >>= xEndSp
;
401 xPropSet
->setPropertyValue("EdgeNode1HorzDist", Any(sal_Int32(0)));
402 xPropSet
->setPropertyValue("EdgeNode1VertDist", Any(sal_Int32(0)));
403 xPropSet
->setPropertyValue("EdgeNode2HorzDist", Any(sal_Int32(0)));
404 xPropSet
->setPropertyValue("EdgeNode2VertDist", Any(sal_Int32(0)));
406 SdrObject
* pStartObj
= xStartSp
.is() ? SdrObject::getSdrObjectFromXShape(xStartSp
) : nullptr;
407 SdrObject
* pEndObj
= xEndSp
.is() ? SdrObject::getSdrObjectFromXShape(xEndSp
) : nullptr;
409 sal_Int32 nStartA
= -1;
410 sal_Int32 nEndA
= -1;
413 aS
= pStartObj
->GetSnapRect();
414 nStartA
= lcl_GetAngle(xStartSp
, aStartPt
);
418 aE
= pEndObj
->GetSnapRect();
419 nEndA
= lcl_GetAngle(xEndSp
, aEndPt
);
422 // bentConnector3, bentConnector4, bentConnector5
423 if (!rShapePtr
->getConnectorAdjustments().empty())
425 sal_Int32 nAdjustValue
= 0;
426 for (size_t i
= 0; i
< rShapePtr
->getConnectorAdjustments().size(); i
++)
428 bool bVertical
= false;
429 if (xStartSp
.is() || xEndSp
.is())
430 bVertical
= xStartSp
.is() ? ((nStartA
== 90 || nStartA
== 270) ? true : false)
431 : ((nEndA
== 90 || nEndA
== 270) ? true : false);
434 sal_Int32 nAng
= rShapePtr
->getRotation() / 60000;
435 bVertical
= (nAng
== 90 || nAng
== 270) ? true : false;
439 bVertical
= !bVertical
;
441 nAdjustValue
= rShapePtr
->getConnectorAdjustments()[i
].toInt32();
444 sal_Int32 nY
= aStartPt
.Y
+ ((nAdjustValue
* (aEndPt
.Y
- aStartPt
.Y
)) / 100000);
445 if (xStartSp
.is() && xEndSp
.is())
447 if (aS
.Top() <= aE
.Top())
449 if (nStartA
== 270 && i
!= 2)
450 nEdge
= nY
- aS
.Top();
453 if (aS
.Bottom() < aE
.Top() && nEndA
!= 90)
455 nEdge
= nY
- (aS
.Bottom() + ((aE
.Top() - aS
.Bottom()) / 2));
458 nEdge
= nY
- aE
.Bottom();
463 if (nStartA
== 90 && i
!= 2)
464 nEdge
= nY
- aS
.Bottom();
467 if (aE
.Bottom() < aS
.Top() && nEndA
!= 270)
468 nEdge
= nY
- (aS
.Top() + ((aE
.Bottom() - aS
.Top()) / 2));
470 nEdge
= nY
- aE
.Top();
474 else if ((xStartSp
.is() && !xEndSp
.is()) || (!xStartSp
.is() && xEndSp
.is()))
476 if (aStartPt
.Y
< aEndPt
.Y
)
479 nEdge
= (nStartA
== 90)
480 ? nY
- (aEndPt
.Y
- ((aEndPt
.Y
- aS
.Bottom()) / 2))
483 nEdge
= (nEndA
== 90)
485 : nY
- (aStartPt
.Y
+ ((aE
.Top() - aStartPt
.Y
) / 2));
490 nEdge
= (nStartA
== 90) ? nY
- aS
.Bottom()
491 : nY
- (aEndPt
.Y
+ ((aS
.Top() - aEndPt
.Y
) / 2));
493 nEdge
= (nEndA
== 90)
494 ? nY
- (aStartPt
.Y
- ((aStartPt
.Y
- aE
.Bottom()) / 2))
500 nEdge
= (aStartPt
.Y
< aEndPt
.Y
)
501 ? nY
- (aStartPt
.Y
+ (rXConnector
->getSize().Height
/ 2))
502 : nY
- (aStartPt
.Y
- (rXConnector
->getSize().Height
/ 2));
507 sal_Int32 nX
= aStartPt
.X
+ ((nAdjustValue
* (aEndPt
.X
- aStartPt
.X
)) / 100000);
508 if (xStartSp
.is() && xEndSp
.is())
510 if (aS
.Left() <= aE
.Left())
512 if (nStartA
== 180 && i
!= 2)
513 nEdge
= nX
- aS
.Left();
516 if (aS
.Right() < aE
.Left() && nEndA
!= 0)
517 nEdge
= nX
- (aS
.Right() + ((aE
.Left() - aS
.Right()) / 2));
519 nEdge
= nX
- aE
.Right();
524 if (nStartA
== 0 && i
!= 2)
525 nEdge
= nX
- aS
.Right();
528 if (aE
.Right() < aS
.Left() && nEndA
!= 180)
529 nEdge
= nX
- (aS
.Left() + ((aE
.Right() - aS
.Left()) / 2));
531 nEdge
= nX
- aE
.Left();
535 else if ((xStartSp
.is() && !xEndSp
.is()) || (!xStartSp
.is() && xEndSp
.is()))
537 if (aStartPt
.X
< aEndPt
.X
)
540 nEdge
= (nStartA
== 0)
541 ? nX
- (aS
.Right() + ((aEndPt
.X
- aS
.Right()) / 2))
546 : nX
- (aStartPt
.X
+ ((aE
.Left() - aStartPt
.X
) / 2));
551 nEdge
= (nStartA
== 0) ? nX
- aS
.Right()
552 : nX
- (aEndPt
.X
+ ((aS
.Left() - aEndPt
.X
) / 2));
555 ? nX
- (aE
.Right() + ((aStartPt
.X
- aE
.Right()) / 2))
561 nEdge
= (aStartPt
.X
< aEndPt
.X
)
562 ? nX
- (aStartPt
.X
+ (rXConnector
->getSize().Width
/ 2))
563 : nX
- (aStartPt
.X
- (rXConnector
->getSize().Width
/ 2));
566 xPropSet
->setPropertyValue("EdgeLine" + OUString::number(i
+ 1) + "Delta", Any(nEdge
));
571 const OUString sConnectorName
= rShapePtr
->getConnectorName();
572 if (sConnectorName
== "bentConnector2")
574 awt::Size aConnSize
= rXConnector
->getSize();
575 if (xStartSp
.is() || xEndSp
.is())
581 case 0: nEdge
= aEndPt
.X
- aS
.Right(); break;
582 case 180: nEdge
= aEndPt
.X
- aS
.Left(); break;
583 case 90: nEdge
= aEndPt
.Y
- aS
.Bottom(); break;
584 case 270: nEdge
= aEndPt
.Y
- aS
.Top(); break;
589 case 0: nEdge
= aStartPt
.X
- aE
.Right(); break;
590 case 180: nEdge
= aStartPt
.X
- aE
.Left(); break;
591 case 90: nEdge
= aStartPt
.Y
- aE
.Bottom(); break;
592 case 270: nEdge
= aStartPt
.Y
- aE
.Top(); break;
598 bool bFlipH
= rShapePtr
->getFlipH();
599 bool bFlipV
= rShapePtr
->getFlipV();
600 sal_Int32 nConnectorAngle
= rShapePtr
->getRotation() / 60000;
601 if (aConnSize
.Height
< aConnSize
.Width
)
603 if ((nConnectorAngle
== 90 && bFlipH
&& bFlipV
) || (nConnectorAngle
== 180)
604 || (nConnectorAngle
== 270 && bFlipH
))
605 nEdge
-= aConnSize
.Width
;
607 nEdge
+= aConnSize
.Width
;
611 if ((nConnectorAngle
== 180 && bFlipV
) || (nConnectorAngle
== 270 && bFlipV
)
612 || (nConnectorAngle
== 90 && bFlipH
&& bFlipV
)
613 || (nConnectorAngle
== 0 && !bFlipV
))
614 nEdge
-= aConnSize
.Height
;
616 nEdge
+= aConnSize
.Height
;
619 xPropSet
->setPropertyValue("EdgeLine1Delta", Any(nEdge
/ 2));
624 // create connection between two shape with a connector shape.
625 void SlidePersist::createConnectorShapeConnection()
627 sal_Int32 nConnectorShapeCount
= maConnectorShapeId
.size();
628 for (sal_Int32 i
= 0; i
< nConnectorShapeCount
; i
++)
630 const auto& pIt
= maShapeMap
.find(maConnectorShapeId
[i
]);
631 if (pIt
== maShapeMap
.end())
633 oox::drawingml::ConnectorShapePropertiesList aConnectorShapeProperties
634 = pIt
->second
->getConnectorShapeProperties();
635 uno::Reference
<drawing::XShape
> xConnector(pIt
->second
->getXShape(), uno::UNO_QUERY
);
636 uno::Reference
<beans::XPropertySet
> xPropertySet(xConnector
, uno::UNO_QUERY
);
640 sal_Int32 nCount
= aConnectorShapeProperties
.size();
641 for (sal_Int32 j
= 0; j
< nCount
; j
++)
643 OUString aDestShapeId
= aConnectorShapeProperties
[j
].maDestShapeId
;
644 const auto& pShape
= maShapeMap
.find(aDestShapeId
);
645 if (pShape
== maShapeMap
.end())
647 uno::Reference
<drawing::XShape
> xShape(pShape
->second
->getXShape(), uno::UNO_QUERY
);
650 uno::Reference
<drawing::XGluePointsSupplier
> xSupplier(xShape
, uno::UNO_QUERY
);
651 css::uno::Reference
<css::container::XIdentifierContainer
> xGluePoints(
652 xSupplier
->getGluePoints(), uno::UNO_QUERY
);
654 sal_Int32 nCountGluePoints
= xGluePoints
->getIdentifiers().getLength();
655 sal_Int32 nGlueId
= aConnectorShapeProperties
[j
].mnDestGlueId
;
657 // The first 4 glue points belong to the bounding box.
658 if (nCountGluePoints
> 4)
662 bool bFlipH
= pShape
->second
->getFlipH();
663 bool bFlipV
= pShape
->second
->getFlipV();
664 if ((!bFlipH
&& !bFlipV
) || (bFlipH
&& bFlipV
))
666 // change id of the left and right glue points of the bounding box (1 <-> 3)
668 nGlueId
= 3; // Right
669 else if (nGlueId
== 3)
674 bool bStart
= aConnectorShapeProperties
[j
].mbStartShape
;
677 xPropertySet
->setPropertyValue("StartShape", uno::Any(xShape
));
678 xPropertySet
->setPropertyValue("StartGluePointIndex", uno::Any(nGlueId
));
682 xPropertySet
->setPropertyValue("EndShape", uno::Any(xShape
));
683 xPropertySet
->setPropertyValue("EndGluePointIndex", uno::Any(nGlueId
));
687 uno::Reference
<beans::XPropertySetInfo
> xPropInfo
= xPropertySet
->getPropertySetInfo();
688 if (xPropInfo
->hasPropertyByName("EdgeKind"))
690 ConnectorType aConnectorType
;
691 xPropertySet
->getPropertyValue("EdgeKind") >>= aConnectorType
;
692 if (aConnectorType
== ConnectorType_STANDARD
)
693 lcl_SetEdgeLineValue(xConnector
, pIt
->second
);
697 maConnectorShapeId
.clear();
702 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */