#83765# solved gpf when exporting lines, catching uno base exception instead of catch ( ... )

This commit is contained in:
Sven Jacobi
2001-03-09 12:53:13 +00:00
parent 586b49b2fa
commit 68e3c99207
2 changed files with 113 additions and 121 deletions

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: escherex.cxx,v $ * $RCSfile: escherex.cxx,v $
* *
* $Revision: 1.15 $ * $Revision: 1.16 $
* *
* last change: $Author: sj $ $Date: 2001-01-26 13:57:57 $ * last change: $Author: sj $ $Date: 2001-03-09 13:52:50 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -997,7 +997,7 @@ sal_Bool EscherPropertyContainer::CreatePolygonProperties(
static String sPolyPolygon ( RTL_CONSTASCII_USTRINGPARAM( "PolyPolygon" ) ); static String sPolyPolygon ( RTL_CONSTASCII_USTRINGPARAM( "PolyPolygon" ) );
sal_Bool bRetValue = sal_True; sal_Bool bRetValue = sal_True;
sal_Bool bNoLine = ( nFlags & ESCHER_CREATEPOLYGON_LINE ) == 0; sal_Bool bLine = ( nFlags & ESCHER_CREATEPOLYGON_LINE ) != 0;
PolyPolygon aPolyPolygon; PolyPolygon aPolyPolygon;
Polygon aPolygon; Polygon aPolygon;
@@ -1074,25 +1074,6 @@ sal_Bool EscherPropertyContainer::CreatePolygonProperties(
bRetValue = pOuterSequence != NULL; bRetValue = pOuterSequence != NULL;
if ( bRetValue ) if ( bRetValue )
{ {
// ist dies ein Polygon oder gar ein PolyPolygon ?
// sogar eine einfache Line wird als Polygon verpackt !!! ????
if ( !bNoLine )
{
::com::sun::star::drawing::PointSequence* pInnerSequence = pOuterSequence++;
bRetValue = pInnerSequence != NULL;
if ( bRetValue )
{
::com::sun::star::awt::Point* pArray = pInnerSequence->getArray();
if ( pArray )
{
::com::sun::star::awt::Point aTopLeft( pArray[ 0 ] );
::com::sun::star::awt::Point aBottomRight( pArray[ 1 ] );
rGeoRect = ::com::sun::star::awt::Rectangle(
aTopLeft.X, aTopLeft.Y, aBottomRight.X - aTopLeft.X, aBottomRight.Y - aTopLeft.Y );
}
}
}
sal_uInt16 a, b, nInnerSequenceCount; sal_uInt16 a, b, nInnerSequenceCount;
::com::sun::star::awt::Point* pArray; ::com::sun::star::awt::Point* pArray;
@@ -1121,104 +1102,120 @@ sal_Bool EscherPropertyContainer::CreatePolygonProperties(
} }
} }
} }
if ( bRetValue && bNoLine ) if ( bRetValue )
{ {
sal_uInt16 i, j, k, nPoints, nBezPoints, nPolyCount = aPolyPolygon.Count(); if ( bLine )
Rectangle aRect( aPolyPolygon.GetBoundRect() );
rGeoRect = ::com::sun::star::awt::Rectangle( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight() );
for ( nBezPoints = nPoints = i = 0; i < nPolyCount; i++ )
{ {
k = aPolyPolygon[ i ].GetSize(); if ( aPolygon.GetSize() == 2 )
nPoints += k;
for ( j = 0; j < k; j++ )
{ {
if ( aPolyPolygon[ i ].GetFlags( j ) != POLY_CONTROL ) rGeoRect = ::com::sun::star::awt::Rectangle(
nBezPoints++; aPolygon[ 0 ].X(),
aPolygon[ 0 ].Y(),
aPolygon[ 1 ].X() - aPolygon[ 0 ].X(),
aPolygon[ 1 ].Y() - aPolygon[ 0 ].Y() );
} }
else
bRetValue = sal_False;
} }
sal_uInt32 nVerticesBufSize = ( nPoints << 2 ) + 6; else
sal_uInt8* pVerticesBuf = new sal_uInt8[ nVerticesBufSize ];
sal_uInt32 nSegmentBufSize = ( ( nBezPoints << 2 ) + 8 );
if ( nPolyCount > 1 )
nSegmentBufSize += ( nPolyCount << 1 );
sal_uInt8* pSegmentBuf = new sal_uInt8[ nSegmentBufSize ];
sal_uInt8* pPtr = pVerticesBuf;
*pPtr++ = (sal_uInt8)( nPoints ); // Little endian
*pPtr++ = (sal_uInt8)( nPoints >> 8 );
*pPtr++ = (sal_uInt8)( nPoints );
*pPtr++ = (sal_uInt8)( nPoints >> 8 );
*pPtr++ = (sal_uInt8)0xf0;
*pPtr++ = (sal_uInt8)0xff;
for ( j = 0; j < nPolyCount; j++ )
{ {
aPolygon = aPolyPolygon[ j ]; sal_uInt16 i, j, k, nPoints, nBezPoints, nPolyCount = aPolyPolygon.Count();
nPoints = aPolygon.GetSize(); Rectangle aRect( aPolyPolygon.GetBoundRect() );
for ( i = 0; i < nPoints; i++ ) // Punkte aus Polygon in Buffer schreiben rGeoRect = ::com::sun::star::awt::Rectangle( aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight() );
for ( nBezPoints = nPoints = i = 0; i < nPolyCount; i++ )
{ {
Point aPoint = aPolygon[ i ]; k = aPolyPolygon[ i ].GetSize();
aPoint.X() -= rGeoRect.X; nPoints += k;
aPoint.Y() -= rGeoRect.Y; for ( j = 0; j < k; j++ )
*pPtr++ = (sal_uInt8)( aPoint.X() );
*pPtr++ = (sal_uInt8)( aPoint.X() >> 8 );
*pPtr++ = (sal_uInt8)( aPoint.Y() );
*pPtr++ = (sal_uInt8)( aPoint.Y() >> 8 );
}
}
pPtr = pSegmentBuf;
*pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 1 );
*pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 9 );
*pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 1 );
*pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 9 );
*pPtr++ = (sal_uInt8)2;
*pPtr++ = (sal_uInt8)0;
for ( j = 0; j < nPolyCount; j++ )
{
*pPtr++ = 0x0; // Polygon start
*pPtr++ = 0x40;
aPolygon = aPolyPolygon[ j ];
nPoints = aPolygon.GetSize();
for ( i = 0; i < nPoints; i++ ) // Polyflags in Buffer schreiben
{
*pPtr++ = 0;
if ( bBezier )
*pPtr++ = 0xb3;
else
*pPtr++ = 0xac;
if ( ( i + 1 ) != nPoints )
{ {
*pPtr++ = 1; if ( aPolyPolygon[ i ].GetFlags( j ) != POLY_CONTROL )
if ( aPolygon.GetFlags( i + 1 ) == POLY_CONTROL ) nBezPoints++;
{
*pPtr++ = 0x20;
i += 2;
}
else
*pPtr++ = 0;
} }
} }
sal_uInt32 nVerticesBufSize = ( nPoints << 2 ) + 6;
sal_uInt8* pVerticesBuf = new sal_uInt8[ nVerticesBufSize ];
sal_uInt32 nSegmentBufSize = ( ( nBezPoints << 2 ) + 8 );
if ( nPolyCount > 1 ) if ( nPolyCount > 1 )
nSegmentBufSize += ( nPolyCount << 1 );
sal_uInt8* pSegmentBuf = new sal_uInt8[ nSegmentBufSize ];
sal_uInt8* pPtr = pVerticesBuf;
*pPtr++ = (sal_uInt8)( nPoints ); // Little endian
*pPtr++ = (sal_uInt8)( nPoints >> 8 );
*pPtr++ = (sal_uInt8)( nPoints );
*pPtr++ = (sal_uInt8)( nPoints >> 8 );
*pPtr++ = (sal_uInt8)0xf0;
*pPtr++ = (sal_uInt8)0xff;
for ( j = 0; j < nPolyCount; j++ )
{ {
*pPtr++ = 1; // end of polygon aPolygon = aPolyPolygon[ j ];
*pPtr++ = 0x60; nPoints = aPolygon.GetSize();
for ( i = 0; i < nPoints; i++ ) // Punkte aus Polygon in Buffer schreiben
{
Point aPoint = aPolygon[ i ];
aPoint.X() -= rGeoRect.X;
aPoint.Y() -= rGeoRect.Y;
*pPtr++ = (sal_uInt8)( aPoint.X() );
*pPtr++ = (sal_uInt8)( aPoint.X() >> 8 );
*pPtr++ = (sal_uInt8)( aPoint.Y() );
*pPtr++ = (sal_uInt8)( aPoint.Y() >> 8 );
}
} }
pPtr = pSegmentBuf;
*pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 1 );
*pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 9 );
*pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 1 );
*pPtr++ = (sal_uInt8)( ( nSegmentBufSize - 6 ) >> 9 );
*pPtr++ = (sal_uInt8)2;
*pPtr++ = (sal_uInt8)0;
for ( j = 0; j < nPolyCount; j++ )
{
*pPtr++ = 0x0; // Polygon start
*pPtr++ = 0x40;
aPolygon = aPolyPolygon[ j ];
nPoints = aPolygon.GetSize();
for ( i = 0; i < nPoints; i++ ) // Polyflags in Buffer schreiben
{
*pPtr++ = 0;
if ( bBezier )
*pPtr++ = 0xb3;
else
*pPtr++ = 0xac;
if ( ( i + 1 ) != nPoints )
{
*pPtr++ = 1;
if ( aPolygon.GetFlags( i + 1 ) == POLY_CONTROL )
{
*pPtr++ = 0x20;
i += 2;
}
else
*pPtr++ = 0;
}
}
if ( nPolyCount > 1 )
{
*pPtr++ = 1; // end of polygon
*pPtr++ = 0x60;
}
}
*pPtr++ = 0;
*pPtr++ = 0x80;
AddOpt( ESCHER_Prop_geoRight, rGeoRect.Width );
AddOpt( ESCHER_Prop_geoBottom, rGeoRect.Height );
AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
AddOpt( ESCHER_Prop_pVertices, TRUE, nVerticesBufSize - 6, (sal_uInt8*)pVerticesBuf, nVerticesBufSize );
AddOpt( ESCHER_Prop_pSegmentInfo, TRUE, nSegmentBufSize, (sal_uInt8*)pSegmentBuf, nSegmentBufSize );
} }
*pPtr++ = 0;
*pPtr++ = 0x80;
AddOpt( ESCHER_Prop_geoRight, rGeoRect.Width );
AddOpt( ESCHER_Prop_geoBottom, rGeoRect.Height );
AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
AddOpt( ESCHER_Prop_pVertices, TRUE, nVerticesBufSize - 6, (sal_uInt8*)pVerticesBuf, nVerticesBufSize );
AddOpt( ESCHER_Prop_pSegmentInfo, TRUE, nSegmentBufSize, (sal_uInt8*)pSegmentBuf, nSegmentBufSize );
} }
return bRetValue; return bRetValue;
} }
@@ -1483,10 +1480,6 @@ sal_Bool EscherPropertyValueHelper::GetPropertyValue(
sal_Bool bTestPropertyAvailability ) sal_Bool bTestPropertyAvailability )
{ {
sal_Bool bRetValue = sal_True; sal_Bool bRetValue = sal_True;
#ifdef UNX
bTestPropertyAvailability = sal_True;
#endif
if ( bTestPropertyAvailability ) if ( bTestPropertyAvailability )
{ {
bRetValue = sal_False; bRetValue = sal_False;
@@ -1497,9 +1490,9 @@ sal_Bool EscherPropertyValueHelper::GetPropertyValue(
if ( aXPropSetInfo.is() ) if ( aXPropSetInfo.is() )
bRetValue = aXPropSetInfo->hasPropertyByName( rString ); bRetValue = aXPropSetInfo->hasPropertyByName( rString );
} }
catch(...) catch( ::com::sun::star::uno::Exception& )
{ {
//... bRetValue = sal_False;
} }
} }
if ( bRetValue ) if ( bRetValue )
@@ -1510,7 +1503,7 @@ sal_Bool EscherPropertyValueHelper::GetPropertyValue(
if ( !rAny.hasValue() ) if ( !rAny.hasValue() )
bRetValue = sal_False; bRetValue = sal_False;
} }
catch(...) catch( ::com::sun::star::uno::Exception& )
{ {
bRetValue = sal_False; bRetValue = sal_False;
} }
@@ -1532,7 +1525,7 @@ sal_Bool EscherPropertyValueHelper::GetPropertyValue(
if ( aXPropState.is() ) if ( aXPropState.is() )
eRetValue = aXPropState->getPropertyState( rPropertyName ); eRetValue = aXPropState->getPropertyState( rPropertyName );
} }
catch(...) catch( ::com::sun::star::uno::Exception& )
{ {
//... //...
} }

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: eschesdo.cxx,v $ * $RCSfile: eschesdo.cxx,v $
* *
* $Revision: 1.9 $ * $Revision: 1.10 $
* *
* last change: $Author: sj $ $Date: 2001-01-22 18:26:02 $ * last change: $Author: sj $ $Date: 2001-03-09 13:53:13 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -1317,7 +1317,7 @@ BOOL ImplEESdrObject::ImplGetPropertyValue( const sal_Unicode* rString )
if( mAny.hasValue() ) if( mAny.hasValue() )
bRetValue = TRUE; bRetValue = TRUE;
} }
catch(...) catch( ::com::sun::star::uno::Exception& )
{ {
bRetValue = FALSE; bRetValue = FALSE;
} }
@@ -1332,17 +1332,16 @@ BOOL ImplEESdrObject::ImplGetPropertyValue( const Reference< XPropertySet >& rXP
BOOL bRetValue = FALSE; BOOL bRetValue = FALSE;
if( mbValid ) if( mbValid )
{ {
TRY try
{ {
mAny = rXPropSet->getPropertyValue( rString ); mAny = rXPropSet->getPropertyValue( rString );
if( 0 != mAny.get() ) if( 0 != mAny.get() )
bRetValue = TRUE; bRetValue = TRUE;
} }
CATCH_ALL() catch( ::com::sun::star::uno::Exception& )
{ {
bRetValue = FALSE; bRetValue = FALSE;
} }
END_CATCH;
} }
return bRetValue; return bRetValue;
} }
@@ -1371,6 +1370,6 @@ UINT32 ImplEESdrObject::ImplGetText()
BOOL ImplEESdrObject::ImplHasText() const BOOL ImplEESdrObject::ImplHasText() const
{ {
Reference< XText > xXText( mXShape, UNO_QUERY ); Reference< XText > xXText( mXShape, UNO_QUERY );
return xXText.is(); return xXText.is() && xXText->getString().getLength();
} }