View | Details | Raw Unified | Return to issue 119974
Collapse All | Expand All

(-)main/svx/source/customshapes/EnhancedCustomShape2d.cxx (-3 / +71 lines)
Lines 1511-1520 Link Here
1511
					for ( sal_uInt16 i = 0; ( i < nPntCount ) && ( ( rSrcPt + 2 ) < nCoordSize ); i++ )
1511
					for ( sal_uInt16 i = 0; ( i < nPntCount ) && ( ( rSrcPt + 2 ) < nCoordSize ); i++ )
1512
					{	 
1512
					{	 
1513
						// create a circle
1513
						// create a circle
1514
						Point _aCenter( GetPoint( seqCoordinates[ rSrcPt ], sal_True, sal_True ) );
1514
						Point _aCenter;
1515
						double fWidth, fHeight;
1515
						double fWidth, fHeight;
1516
						GetParameter( fWidth,  seqCoordinates[ rSrcPt + 1 ].First, sal_True, sal_False  );
1516
						MSO_SPT eSpType = mso_sptEllipse;
1517
						GetParameter( fHeight,  seqCoordinates[ rSrcPt + 1 ].Second, sal_False, sal_True );
1517
						const mso_CustomShape* pDefCustomShape = GetCustomShapeContent( eSpType );
1518
						sal_Bool bIsDefaultViewBox = sal_False;
1519
						sal_Bool bIsDefaultPath = sal_False;
1520
						sal_Bool bIsMSEllipse = sal_False;
1521
1522
						if( ( nCoordWidth == pDefCustomShape->nCoordWidth )
1523
							&& ( nCoordHeight == pDefCustomShape->nCoordHeight ) )
1524
							bIsDefaultViewBox = sal_True;
1525
						sal_Int32 j, nCount = pDefCustomShape->nVertices;//==3
1526
						com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> seqCoordinates1, seqCoordinates2;
1527
1528
						seqCoordinates1.realloc( nCount );
1529
						for ( j = 0; j < nCount; j++ )
1530
						{
1531
							seqCoordinates1[j] = seqCoordinates[ rSrcPt + j];
1532
						}
1533
1534
						seqCoordinates2.realloc( nCount );
1535
						for ( j = 0; j < nCount; j++ )
1536
						{
1537
							EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates2[ j ].First, pDefCustomShape->pVertices[ j ].nValA );
1538
							EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( seqCoordinates2[ j ].Second, pDefCustomShape->pVertices[ j ].nValB );
1539
						}
1540
						if(seqCoordinates1 == seqCoordinates2)
1541
							bIsDefaultPath = sal_True;
1542
1543
						const rtl::OUString	sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
1544
						rtl::OUString sShpType;
1545
						SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)(const SdrCustomShapeGeometryItem&)pCustomShapeObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
1546
						Any* pAny = rGeometryItem.GetPropertyValueByName( sType );
1547
						if ( pAny )
1548
							*pAny >>= sShpType;
1549
						if( sShpType.getLength() > 3 &&
1550
							sShpType.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "mso" ))){
1551
								bIsMSEllipse = sal_True;
1552
						}
1553
						if( (! bIsDefaultPath	&& ! bIsDefaultViewBox) || (bIsDefaultViewBox && bIsMSEllipse) /*&& (nGeneratorVersion == SfxObjectShell::Sym_L2)*/ )
1554
						{
1555
							_aCenter = GetPoint( seqCoordinates[ rSrcPt ], sal_True, sal_True );
1556
							GetParameter( fWidth,  seqCoordinates[ rSrcPt + 1 ].First, sal_True, sal_False  );
1557
							GetParameter( fHeight,  seqCoordinates[ rSrcPt + 1 ].Second, sal_False, sal_True );
1558
							fWidth /= 2;
1559
							fHeight /= 2;
1560
						}else if( bIsDefaultPath && !bIsDefaultViewBox /*&& (nGeneratorVersion == SfxObjectShell::Sym_L2)*/ )
1561
						{
1562
							_aCenter.X() = nCoordWidth/2 * fXScale;
1563
							_aCenter.Y() = nCoordHeight/2 * fYScale;
1564
							fWidth = nCoordWidth/2;
1565
							fHeight = nCoordHeight/2;
1566
1567
							const rtl::OUString	sViewBox( RTL_CONSTASCII_USTRINGPARAM ( "ViewBox" ) );
1568
							const Any* pViewBox = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sViewBox );
1569
							com::sun::star::awt::Rectangle aViewBox;
1570
							if ( pViewBox && (*pViewBox >>= aViewBox ) )
1571
							{
1572
								aViewBox.Width = pDefCustomShape->nCoordWidth;
1573
								aViewBox.Height = pDefCustomShape->nCoordHeight;							
1574
							}
1575
							com::sun::star::beans::PropertyValue aPropVal;
1576
							aPropVal.Name = sViewBox;
1577
							aPropVal.Value <<= aViewBox;
1578
							rGeometryItem.SetPropertyValue( aPropVal );
1579
							pCustomShapeObj->SetMergedItem( rGeometryItem );
1580
						}else{
1581
							_aCenter = GetPoint( seqCoordinates[ rSrcPt ], sal_True, sal_True );
1582
							GetParameter( fWidth,  seqCoordinates[ rSrcPt + 1 ].First, sal_True, sal_False  );
1583
							GetParameter( fHeight,  seqCoordinates[ rSrcPt + 1 ].Second, sal_False, sal_True );
1584
						}
1585
1518
						fWidth *= fXScale;
1586
						fWidth *= fXScale;
1519
						fHeight*= fYScale;
1587
						fHeight*= fYScale;
1520
						Point aP( (sal_Int32)( _aCenter.X() - fWidth ), (sal_Int32)( _aCenter.Y() - fHeight ) );
1588
						Point aP( (sal_Int32)( _aCenter.X() - fWidth ), (sal_Int32)( _aCenter.Y() - fHeight ) );

Return to issue 119974