Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hello,
back again after a while.


On 02/15/2012 11:30 AM, Thorsten Behrens wrote:
Fixed with d37abad97d72bae0fd0269de12e94c7a7d3fd7e1 - but, if you
like, would be cool to chase down why in the first place the ppt
import creates polygons with empty sub-paths, that looks like a
worthwhile optimization - code is around
filter/source/msfilter/msdffimp.cxx probably.

It happens that basegfx::GetLineArrow(...) (also defined within msdffimp.cxx, line 1102) does not create a valid polygon when eLineEnd has the value mso_lineNoEnd...
In the switch(eLineEnd), this goes to
>  default: break;
without creating any polygon, letting the return value undefined.

So I propose to skip the creation these incorrect polygons if eLineEnd has the value mso_lineNoEnd. But since I do not understand well the import / translation from msformat, I may also have missed a big point. Hence thanks for reviewing this patch, before I push it.

I hope it helps.

Regards
Pierre-André
From ec4bf50361f3d2c75e2de20fdb1ddebddba8d406 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre-Andr=C3=A9=20Jacquod?= <pjacquod@alumni.ethz.ch>
Date: Sat, 28 Apr 2012 18:57:02 +0200
Subject: [PATCH] impress ms import filter avoid b2dpolygon with 0 b2dpoints

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


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.