incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1228136 - in /incubator/ooo/branches/alg/linecap/main/filter/source/msfilter: escherex.cxx msdffimp.cxx
Date Fri, 06 Jan 2012 12:08:14 GMT
Author: alg
Date: Fri Jan  6 12:08:13 2012
New Revision: 1228136

URL: http://svn.apache.org/viewvc?rev=1228136&view=rev
Log:
linecap: Adapted ms format import/export filters

Modified:
    incubator/ooo/branches/alg/linecap/main/filter/source/msfilter/escherex.cxx
    incubator/ooo/branches/alg/linecap/main/filter/source/msfilter/msdffimp.cxx

Modified: incubator/ooo/branches/alg/linecap/main/filter/source/msfilter/escherex.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/linecap/main/filter/source/msfilter/escherex.cxx?rev=1228136&r1=1228135&r2=1228136&view=diff
==============================================================================
--- incubator/ooo/branches/alg/linecap/main/filter/source/msfilter/escherex.cxx (original)
+++ incubator/ooo/branches/alg/linecap/main/filter/source/msfilter/escherex.cxx Fri Jan  6
12:08:13 2012
@@ -51,6 +51,7 @@
 #include <com/sun/star/awt/Gradient.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
 #include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/LineCap.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/drawing/LineDash.hpp>
 #include <com/sun/star/drawing/BezierPoint.hpp>
@@ -853,6 +854,35 @@ void EscherPropertyContainer::CreateLine
         AddOpt( ESCHER_Prop_lineEndArrowhead, eLineEnd );
         nLineFlags |= 0x100010;
 	}
+
+    // support LineCaps
+    if(EscherPropertyValueHelper::GetPropertyValue(aAny, rXPropSet, String(RTL_CONSTASCII_USTRINGPARAM("LineCap")),
sal_False))
+    {
+        ::com::sun::star::drawing::LineCap aLineCap(com::sun::star::drawing::LineCap_BUTT);
+
+        if(aAny >>= aLineCap)
+        {
+            switch (aLineCap)
+            {
+                default: /* com::sun::star::drawing::LineCap_BUTT */
+                {
+                    AddOpt(ESCHER_Prop_lineEndCapStyle, ESCHER_LineEndCapFlat);
+                    break;
+                }
+                case com::sun::star::drawing::LineCap_ROUND:
+                {
+                    AddOpt(ESCHER_Prop_lineEndCapStyle, ESCHER_LineEndCapRound);
+                    break;
+                }
+                case com::sun::star::drawing::LineCap_SQUARE:
+                {
+                    AddOpt(ESCHER_Prop_lineEndCapStyle, ESCHER_LineEndCapSquare);
+                    break;
+                }
+            }
+        }
+    }
+
 	if ( EscherPropertyValueHelper::GetPropertyValue(
 		aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LineStyle"  ) ), sal_False ) )
     {

Modified: incubator/ooo/branches/alg/linecap/main/filter/source/msfilter/msdffimp.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/linecap/main/filter/source/msfilter/msdffimp.cxx?rev=1228136&r1=1228135&r2=1228136&view=diff
==============================================================================
--- incubator/ooo/branches/alg/linecap/main/filter/source/msfilter/msdffimp.cxx (original)
+++ incubator/ooo/branches/alg/linecap/main/filter/source/msfilter/msdffimp.cxx Fri Jan  6
12:08:13 2012
@@ -920,19 +920,41 @@ void DffPropertyReader::ApplyLineAttribu
 		// Linienattribute
 		sal_Int32 nLineWidth = (sal_Int32)GetPropertyValue( DFF_Prop_lineWidth, 9525 );
 
+        // support LineCap
+        const MSO_LineCap eLineCap((MSO_LineCap)GetPropertyValue(DFF_Prop_lineEndCapStyle,
mso_lineEndCapSquare));
+
+        switch(eLineCap)
+        {
+            default: /* case mso_lineEndCapFlat */
+            {
+                // no need to set, it is the default. If this changes, this needs to be activated
+                // rSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_BUTT));
+                break;
+            }
+            case mso_lineEndCapRound:
+            {
+                rSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_ROUND));
+                break;
+            }
+            case mso_lineEndCapSquare:
+            {
+                rSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_SQUARE));
+                break;
+            }
+        }
+
 		MSO_LineDashing eLineDashing = (MSO_LineDashing)GetPropertyValue( DFF_Prop_lineDashing,
mso_lineSolid );
 		if ( eLineDashing == mso_lineSolid )
 			rSet.Put(XLineStyleItem( XLINE_SOLID ) );
 		else
 		{
-//			MSO_LineCap eLineCap = (MSO_LineCap)GetPropertyValue( DFF_Prop_lineEndCapStyle, mso_lineEndCapSquare
);
 
 			XDashStyle  eDash = XDASH_RECT;
 			sal_uInt16	nDots = 1;
 			sal_uInt32	nDotLen	= nLineWidth / 360;
 			sal_uInt16	nDashes = 0;
 			sal_uInt32	nDashLen = ( 8 * nLineWidth ) / 360;
-			sal_uInt32	nDistance = ( 3 * nLineWidth ) / 360;;
+			sal_uInt32	nDistance = ( 3 * nLineWidth ) / 360;
 
 			switch ( eLineDashing )
 			{
@@ -1049,24 +1071,27 @@ void DffPropertyReader::ApplyLineAttribu
 				rSet.Put( XLineEndItem( aArrowName, basegfx::B2DPolyPolygon(aPoly) ) );
 				rSet.Put( XLineEndCenterItem( bArrowCenter ) );
 			}
-			if ( IsProperty( DFF_Prop_lineEndCapStyle ) )
-			{
-				MSO_LineCap eLineCap = (MSO_LineCap)GetPropertyValue( DFF_Prop_lineEndCapStyle );
-				const SfxPoolItem* pPoolItem = NULL;
-				if ( rSet.GetItemState( XATTR_LINEDASH, sal_False, &pPoolItem ) == SFX_ITEM_SET )
-				{
-					XDashStyle eNewStyle = XDASH_RECT;
-					if ( eLineCap == mso_lineEndCapRound )
-						eNewStyle = XDASH_ROUND;
-					const XDash& rOldDash = ( (const XLineDashItem*)pPoolItem )->GetDashValue();
-					if ( rOldDash.GetDashStyle() != eNewStyle )
-					{
-						XDash aNew( rOldDash );
-						aNew.SetDashStyle( eNewStyle );
-						rSet.Put( XLineDashItem( XubString(), aNew ) );
-					}
-				}
-			}
+
+            // this was used to at least adapt the lineDash to the lineCap before lineCap
was
+            // supported, so with supporting lineCap this is no longer needed
+			//if ( IsProperty( DFF_Prop_lineEndCapStyle ) )
+			//{
+			//	MSO_LineCap eLineCap = (MSO_LineCap)GetPropertyValue( DFF_Prop_lineEndCapStyle );
+			//	const SfxPoolItem* pPoolItem = NULL;
+			//	if ( rSet.GetItemState( XATTR_LINEDASH, sal_False, &pPoolItem ) == SFX_ITEM_SET
)
+			//	{
+			//		XDashStyle eNewStyle = XDASH_RECT;
+			//		if ( eLineCap == mso_lineEndCapRound )
+			//			eNewStyle = XDASH_ROUND;
+			//		const XDash& rOldDash = ( (const XLineDashItem*)pPoolItem )->GetDashValue();
+			//		if ( rOldDash.GetDashStyle() != eNewStyle )
+			//		{
+			//			XDash aNew( rOldDash );
+			//			aNew.SetDashStyle( eNewStyle );
+			//			rSet.Put( XLineDashItem( XubString(), aNew ) );
+			//		}
+			//	}
+			//}
 		}
 	}
 	else



Mime
View raw message