Kaydet (Commit) d8425458 authored tarafından Sven Jacobi's avatar Sven Jacobi

also importing an mso_sptArc when just default adjustment values were used

üst 0907acfc
......@@ -2,9 +2,9 @@
*
* $RCSfile: msashape.cxx,v $
*
* $Revision: 1.6 $
* $Revision: 1.7 $
*
* last change: $Author: sj $ $Date: 2000-11-14 15:36:47 $
* last change: $Author: sj $ $Date: 2000-11-16 13:06:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -184,6 +184,21 @@ static const sal_Int32 mso_sptDefault10800[] =
1, 10800
};
static const sal_Int32 mso_sptArcDefault[] =
{
2, 270 << 16, 0
};
static const mso_AutoShape msoArc =
{
NULL, 0,
NULL, 0,
NULL, 0,
(sal_Int32*)mso_sptArcDefault,
NULL,
NULL,
0x80000000, 0x80000000
};
static const mso_AutoShape msoRectangle =
{
NULL, 0,
......@@ -3412,6 +3427,7 @@ SvxMSDffAutoShape::SvxMSDffAutoShape( const DffPropertyReader& rPropReader, SvSt
switch( eSpType )
{
case mso_sptArc : pDefAutoShape = &msoArc; break;
case mso_sptRectangle : pDefAutoShape = &msoRectangle; break;
case mso_sptParallelogram : pDefAutoShape = &msoParallelogram; break;
case mso_sptTrapezoid : pDefAutoShape = &msoTrapezoid; break;
......@@ -3570,6 +3586,7 @@ SvxMSDffAutoShape::SvxMSDffAutoShape( const DffPropertyReader& rPropReader, SvSt
}
if ( pDefAutoShape )
{
bIsEmpty = FALSE;
nNumElemVert = pDefAutoShape->nVertices;
pVertData = pDefAutoShape->pVertices;
nNumElemSeg = pDefAutoShape->nElements;
......@@ -3588,6 +3605,7 @@ SvxMSDffAutoShape::SvxMSDffAutoShape( const DffPropertyReader& rPropReader, SvSt
rSt >> nTmp16 >> nNumElemMemVert >> nElemSizeVert;
if ( nTmp16 )
{
bIsEmpty = FALSE;
nNumElemVert = nTmp16;
sal_uInt32 i = nNumElemVert << 1;
bVertAlloc = TRUE;
......@@ -3611,9 +3629,8 @@ SvxMSDffAutoShape::SvxMSDffAutoShape( const DffPropertyReader& rPropReader, SvSt
}
}
}
if ( pVertData || pDefAutoShape )
if ( !bIsEmpty ) // we can import an autoshape if either pVertData or pDefAutoShape is set
{
bIsEmpty = FALSE;
if ( rPropReader.SeekToContent( DFF_Prop_pSegmentInfo, rSt ) )
{
sal_uInt16 nTmp16, nNumElemMemSeg, nElemSizeSeg;
......@@ -4074,39 +4091,30 @@ SdrObject* SvxMSDffAutoShape::GetObject( SdrModel* pSdrModel, SfxItemSet& rSet,
}
else if ( eSpType == mso_sptEllipse )
pRet = new SdrCircObj( OBJ_CIRC, aSnapRect );
if ( pRet )
{
pRet->SetModel( pSdrModel );
pRet->SetItemSet(rSet);
}
else
else if ( eSpType == mso_sptArc )
{ // the arc is something special, because sometimes the snaprect does not match
Rectangle aPolyBoundRect;
if ( nNumElemVert )
{
// Header auswerten
XPolygon aXP( (sal_uInt16)nNumElemVert );
const sal_Int32* pTmp = pVertData;
sal_uInt32 nVal32, nPtNum, nPtCount = nNumElemVert << 1;
sal_Bool bScale = ( eSpType != mso_sptArc );
for ( nPtNum = 0; nPtNum < nPtCount; nPtNum++ )
{
nVal32 = GetValue( *pTmp++, bScale, ( nPtNum & 1 ) != 1 );
nVal32 = GetValue( *pTmp++, FALSE, ( nPtNum & 1 ) != 1 );
if ( nPtNum & 1 )
aXP[ (sal_uInt16)( nPtNum >> 1 ) ].Y() = nVal32;
else
aXP[ (sal_uInt16)( nPtNum >> 1 ) ].X() = nVal32;
}
Rectangle aPolyBoundRect( aXP.GetBoundRect() );
// the arc is something special, because sometimes the snaprect does not match
if ( eSpType == mso_sptArc )
{
// Groesse des Polygons mit allen Punkten korrigieren
aPolyBoundRect = Rectangle( aXP.GetBoundRect() );
}
else
aPolyBoundRect = aSnapRect;
sal_Int32 nEndAngle = Fix16ToAngle( GetAdjustValue( 0, 270 << 16 ) );
sal_Int32 nStartAngle = Fix16ToAngle( GetAdjustValue( 1, 0 ) );
sal_Int32 nEndAngle = Fix16ToAngle( GetAdjustValue( 0 ) );
sal_Int32 nStartAngle = Fix16ToAngle( GetAdjustValue( 1 ) );
if ( nStartAngle == nEndAngle )
return NULL;
......@@ -4172,14 +4180,32 @@ SdrObject* SvxMSDffAutoShape::GetObject( SdrModel* pSdrModel, SfxItemSet& rSet,
}
pRet = new SdrCircObj( OBJ_CARC, aPolyBoundRect, nStartAngle, nEndAngle );
}
pRet->NbcSetSnapRect( aSnapRect );
}
if ( pRet )
{
pRet->SetModel( pSdrModel );
pRet->SetItemSet(rSet);
}
if ( !pRet )
else if ( nNumElemVert )
{
// Header auswerten
XPolygon aXP( (sal_uInt16)nNumElemVert );
const sal_Int32* pTmp = pVertData;
sal_uInt32 nVal32, nPtNum, nPtCount = nNumElemVert << 1;
for ( nPtNum = 0; nPtNum < nPtCount; nPtNum++ )
{
nVal32 = GetValue( *pTmp++, TRUE, ( nPtNum & 1 ) != 1 );
if ( nPtNum & 1 )
aXP[ (sal_uInt16)( nPtNum >> 1 ) ].Y() = nVal32;
else
aXP[ (sal_uInt16)( nPtNum >> 1 ) ].X() = nVal32;
}
Rectangle aPolyBoundRect( aXP.GetBoundRect() );
if ( aPolyBoundRect.GetSize() != aSnapRect.GetSize() )
{
double fXScale = (double)aSnapRect.GetWidth() / (double)aPolyBoundRect.GetWidth();
......@@ -4321,14 +4347,6 @@ SdrObject* SvxMSDffAutoShape::GetObject( SdrModel* pSdrModel, SfxItemSet& rSet,
case 5 :
{
sal_uInt16 nDstPt = aPoly.GetPointCount();
// if ( nDstPt > 1 )
// {
// if ( bClosed )
// aPoly[ aPoly.GetPointCount() ] = aPoly[ 0 ];
// aPolyPoly.Insert( aPoly );
// aPoly = aEmptyPoly;
// nDstPt = 0;
// }
if ( nPntCount == 2 )
{ // create a circle
Rectangle aRect( aXP[ nSrcPt ], aXP[ nSrcPt + 1 ] );
......@@ -4533,7 +4551,6 @@ SdrObject* SvxMSDffAutoShape::GetObject( SdrModel* pSdrModel, SfxItemSet& rSet,
}
}
}
}
if ( pRet )
{
if ( nFix16Angle )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment