[ooo-build-commit] patches/dev300

Pei Feng Lin pflin at kemper.freedesktop.org
Thu Dec 3 01:19:25 PST 2009


 patches/dev300/apply                                    |    2 
 patches/dev300/oox-xlsx-import-fix-connector-shape.diff |   73 ++++++++++++++++
 2 files changed, 75 insertions(+)

New commits:
commit 2d100c43f1cbf66133c78eab245ee42dc50da755
Author: Fong Lin <pflin at novell.com>
Date:   Thu Dec 3 17:19:19 2009 +0800

    Fix for the wrong type and position of connector shape
    
    * patches/dev300/apply:
    * patches/dev300/oox-xlsx-import-fix-connector-shape.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 871f0ff..f05a4a9 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2124,6 +2124,8 @@ oox-fix-list-style-apply.diff, n#485417, rodo
 # FIXME: 2009-09-02: Applies but causes compilation errors. --tml
 # oox-import-shape-textbox-hyperlink.diff, n#480854, janneke
 
+oox-xlsx-import-fix-connector-shape.diff, n#549331, Fong
+
 oox-custom-shape-polygons.diff, n#485418, rodo
 
 # FIXME: 2009-08-12: This stuff seems to be already in dev300-m54
diff --git a/patches/dev300/oox-xlsx-import-fix-connector-shape.diff b/patches/dev300/oox-xlsx-import-fix-connector-shape.diff
new file mode 100644
index 0000000..cf7340a
--- /dev/null
+++ b/patches/dev300/oox-xlsx-import-fix-connector-shape.diff
@@ -0,0 +1,73 @@
+diff --git oox/source/drawingml/shape.cxx oox/source/drawingml/shape.cxx
+index 807b4ad..a10c679 100644
+--- oox/source/drawingml/shape.cxx
++++ oox/source/drawingml/shape.cxx
+@@ -49,6 +49,7 @@
+ #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+ #include <com/sun/star/xml/AttributeData.hpp>
+ #include <com/sun/star/drawing/HomogenMatrix3.hpp>
++#include <com/sun/star/drawing/ConnectorType.hpp>
+ #include <com/sun/star/text/XText.hpp>
+ #include <basegfx/point/b2dpoint.hxx>
+ #include <basegfx/polygon/b2dpolygon.hxx>
+@@ -402,6 +403,17 @@ Reference< XShape > Shape::createAndInsert(
+ 
+         maShapeProperties[ PROP_StartPosition ] <<= aAWTStartPosition;
+         maShapeProperties[ PROP_EndPosition ] <<= aAWTEndPosition;
++
++        // set the connector type
++        rtl::OUString sConnectorType = mpCustomShapePropertiesPtr->getShapePresetType();
++        // FIXME: handle other connector type, should be use XEnhancedCustomShapeDefaulter?
++        ConnectorType eConnectorType = ConnectorType_STANDARD;
++        if( sConnectorType == OUString::createFromAscii("mso-spt32") )
++            eConnectorType = ConnectorType_LINE;
++        else if( sConnectorType == OUString::createFromAscii("mso-spt38") )
++            eConnectorType = ConnectorType_CURVE;
++        
++        maShapeProperties[ PROP_EdgeKind ] <<= eConnectorType;
+     }
+     else
+     {
+diff --git oox/source/token/properties.txt oox/source/token/properties.txt
+index cd57740..064b3ef 100644
+--- oox/source/token/properties.txt
++++ oox/source/token/properties.txt
+@@ -411,3 +411,4 @@ WriteProtectionPassword
+ WritingMode
+ ZoomType
+ ZoomValue
++EdgeKind
+diff --git oox/source/xls/drawingfragment.cxx oox/source/xls/drawingfragment.cxx
+index 3b72126..f410574 100644
+--- oox/source/xls/drawingfragment.cxx
++++ oox/source/xls/drawingfragment.cxx
+@@ -525,10 +525,26 @@ void OoxDrawingFragment::onEndElement( const OUString& rChars )
+         case XDR_TOKEN( absoluteAnchor ):
+         case XDR_TOKEN( oneCellAnchor ):
+         case XDR_TOKEN( twoCellAnchor ):
+-            if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() && mxAnchor->isValidAnchor() )
++            if( mxDrawPage.is() && mxShape.get() )
+             {
+-                Rectangle aLoc = mxAnchor->calcEmuLocation( maEmuSheetSize );
+-                if( (aLoc.X >= 0) && (aLoc.Y >= 0) && (aLoc.Width >= 0) && (aLoc.Height >= 0) )
++                // It seems the position and size are incorrect to use cellAnchor to create the shape
++                // so if the size and position are defined, use them to set the shape postion and size.
++                Rectangle aLoc( -1, -1, -1, -1 );;
++                Size aSize = mxShape->getSize();
++                if( aSize.Width > 0 || aSize.Height > 0 )
++                {
++                    Point aPoint = mxShape->getPosition();
++                    aLoc.X = aPoint.X;
++                    aLoc.Y = aPoint.Y;
++                    aLoc.Width = aSize.Width;
++                    aLoc.Height = aSize.Height;
++                }
++                else if( mxAnchor.get() && mxAnchor->isValidAnchor() )
++                {
++                    aLoc = mxAnchor->calcEmuLocation( maEmuSheetSize );
++                }    
++
++                if( (aLoc.Width >= 0) && (aLoc.Height >= 0) )
+                     mxShape->addShape( getOoxFilter(), getThemeRef(), mxDrawPage, &aLoc );
+             }
+             mxShape.reset();


More information about the ooo-build-commit mailing list