[PATCH] impress ms import filter avoid b2dpolygon with 0 b2dpoints
Pierre-André Jacquod
pjacquod at alumni.ethz.ch
Sat Apr 28 09:57:02 PDT 2012
when the lineEnd value is mso_lineNoEnd, the created polygon was
incomplete and with no points, then disabling it.
---
filter/source/msfilter/msdffimp.cxx | 44 +++++++++++++++++++---------------
1 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 80785fa..f208dd9 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1329,17 +1329,20 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
if ( IsProperty( DFF_Prop_lineStartArrowhead ) )
{
MSO_LineEnd eLineEnd = (MSO_LineEnd)GetPropertyValue( DFF_Prop_lineStartArrowhead );
- MSO_LineEndWidth eWidth = (MSO_LineEndWidth)GetPropertyValue( DFF_Prop_lineStartArrowWidth, mso_lineMediumWidthArrow );
- MSO_LineEndLength eLenght = (MSO_LineEndLength)GetPropertyValue( DFF_Prop_lineStartArrowLength, mso_lineMediumLenArrow );
- sal_Int32 nArrowWidth;
- sal_Bool bArrowCenter;
- rtl::OUString aArrowName;
- basegfx::B2DPolygon aPoly(GetLineArrow( nLineWidth, eLineEnd, eWidth, eLenght, nArrowWidth, bArrowCenter, aArrowName, bScaleArrows ));
+ if ( eLineEnd != mso_lineNoEnd )
+ {
+ MSO_LineEndWidth eWidth = (MSO_LineEndWidth)GetPropertyValue( DFF_Prop_lineStartArrowWidth, mso_lineMediumWidthArrow );
+ MSO_LineEndLength eLenght = (MSO_LineEndLength)GetPropertyValue( DFF_Prop_lineStartArrowLength, mso_lineMediumLenArrow );
+ sal_Int32 nArrowWidth;
+ sal_Bool bArrowCenter;
+ rtl::OUString aArrowName;
+ basegfx::B2DPolygon aPoly(GetLineArrow( nLineWidth, eLineEnd, eWidth, eLenght, nArrowWidth, bArrowCenter, aArrowName, bScaleArrows ));
- rSet.Put( XLineStartWidthItem( nArrowWidth ) );
- rSet.Put( XLineStartItem( aArrowName, basegfx::B2DPolyPolygon(aPoly) ) );
- rSet.Put( XLineStartCenterItem( bArrowCenter ) );
+ rSet.Put( XLineStartWidthItem( nArrowWidth ) );
+ rSet.Put( XLineStartItem( aArrowName, basegfx::B2DPolyPolygon(aPoly) ) );
+ rSet.Put( XLineStartCenterItem( bArrowCenter ) );
+ }
}
/////////////
// LineEnd //
@@ -1347,17 +1350,20 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
if ( IsProperty( DFF_Prop_lineEndArrowhead ) )
{
MSO_LineEnd eLineEnd = (MSO_LineEnd)GetPropertyValue( DFF_Prop_lineEndArrowhead );
- MSO_LineEndWidth eWidth = (MSO_LineEndWidth)GetPropertyValue( DFF_Prop_lineEndArrowWidth, mso_lineMediumWidthArrow );
- MSO_LineEndLength eLenght = (MSO_LineEndLength)GetPropertyValue( DFF_Prop_lineEndArrowLength, mso_lineMediumLenArrow );
+ if ( eLineEnd != mso_lineNoEnd)
+ {
+ MSO_LineEndWidth eWidth = (MSO_LineEndWidth)GetPropertyValue( DFF_Prop_lineEndArrowWidth, mso_lineMediumWidthArrow );
+ MSO_LineEndLength eLenght = (MSO_LineEndLength)GetPropertyValue( DFF_Prop_lineEndArrowLength, mso_lineMediumLenArrow );
- sal_Int32 nArrowWidth;
- sal_Bool bArrowCenter;
- rtl::OUString aArrowName;
- basegfx::B2DPolygon aPoly(GetLineArrow( nLineWidth, eLineEnd, eWidth, eLenght, nArrowWidth, bArrowCenter, aArrowName, bScaleArrows ));
+ sal_Int32 nArrowWidth;
+ sal_Bool bArrowCenter;
+ rtl::OUString aArrowName;
+ basegfx::B2DPolygon aPoly(GetLineArrow( nLineWidth, eLineEnd, eWidth, eLenght, nArrowWidth, bArrowCenter, aArrowName, bScaleArrows ));
- rSet.Put( XLineEndWidthItem( nArrowWidth ) );
- rSet.Put( XLineEndItem( aArrowName, basegfx::B2DPolyPolygon(aPoly) ) );
- rSet.Put( XLineEndCenterItem( bArrowCenter ) );
+ rSet.Put( XLineEndWidthItem( nArrowWidth ) );
+ rSet.Put( XLineEndItem( aArrowName, basegfx::B2DPolyPolygon(aPoly) ) );
+ rSet.Put( XLineEndCenterItem( bArrowCenter ) );
+ }
}
if ( IsProperty( DFF_Prop_lineEndCapStyle ) )
{
@@ -4600,7 +4606,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
aSet.Put( SvxWeightItem( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x0020 ) != 0 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
// SJ TODO: Vertical Writing is not correct, instead this should be
- // replaced through "CharacterRotation" by 90�, therefore a new Item has to be
+ // replaced through "CharacterRotation" by 90°, therefore a new Item has to be
// supported by svx core, api and xml file format
((SdrObjCustomShape*)pRet)->SetVerticalWriting( ( GetPropertyValue( DFF_Prop_gtextFStrikethrough, 0 ) & 0x2000 ) != 0 );
--
1.7.7
--------------020209080402060501080203--
More information about the LibreOffice
mailing list