[Libreoffice-commits] .: Branch 'distro/suse/suse-3.6' - oox/inc oox/source

Miklos Vajna vmiklos at suse.cz
Thu Jan 31 03:59:51 PST 2013


 oox/inc/oox/vml/vmlshape.hxx |   15 ++++++---------
 oox/source/vml/vmlshape.cxx  |   23 ++++++++++++++++++-----
 2 files changed, 24 insertions(+), 14 deletions(-)

New commits:
commit d10f549943ba416065c754576a2eb8bc90e1e960
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jan 30 16:43:35 2013 +0100

    n#792778 oox: implement import of v:line inside v:group
    
    The problem was that in ShapeBase::convertAndInsert(), the rectangle
    calculated for a line was zero, that's why it wasn't imported. Fix this
    by overriding the get*Rectangle() methods in LineShape, instead of doing
    so with implConvertAndInsert().
    
    (cherry picked from commit 7877638814de86202d33b5653a0f91d63341e98c)
    
    Conflicts:
    	oox/source/vml/vmlshape.cxx
    
    Change-Id: Ie4bb2f7964b438cb56e4f5ee7a4ebe9f8f8eb734

diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx
index 68ae1cd..7216941 100644
--- a/oox/inc/oox/vml/vmlshape.hxx
+++ b/oox/inc/oox/vml/vmlshape.hxx
@@ -136,12 +136,10 @@ protected:
     ::com::sun::star::awt::Rectangle getCoordSystem() const;
     /** Returns the absolute shape rectangle according to the passed anchor. */
     ::com::sun::star::awt::Rectangle getRectangle( const ShapeParentAnchor* pParentAnchor ) const;
-
-private:
     /** Returns the absolute shape rectangle. */
-    ::com::sun::star::awt::Rectangle getAbsRectangle() const;
+    virtual ::com::sun::star::awt::Rectangle getAbsRectangle() const;
     /** Returns the rectangle relative to the parent coordinate system. */
-    ::com::sun::star::awt::Rectangle getRelRectangle() const;
+    virtual ::com::sun::star::awt::Rectangle getRelRectangle() const;
 
 protected:
     Drawing&            mrDrawing;          /// The VML drawing page that contains this shape.
@@ -346,11 +344,10 @@ public:
     explicit            LineShape( Drawing& rDrawing );
 
 protected:
-    /** Creates the corresponding XShape and inserts it into the passed container. */
-    virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
-                        implConvertAndInsert(
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
-                            const ::com::sun::star::awt::Rectangle& rShapeRect ) const;
+    /** Returns the absolute shape rectangle. */
+    virtual ::com::sun::star::awt::Rectangle getAbsRectangle() const;
+    /** Returns the rectangle relative to the parent coordinate system. */
+    virtual ::com::sun::star::awt::Rectangle getRelRectangle() const;
 };
 // ============================================================================
 
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index e3f2c62..e61820c 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -298,7 +298,6 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
             according to some imported shape client data (e.g. Excel cell anchor). */
         Rectangle aShapeRect = calcShapeRectangle( pParentAnchor );
 
-        // convert the shape, if the calculated rectangle is not empty
         if( ((aShapeRect.Width > 0) || (aShapeRect.Height > 0)) && rxShapes.is() )
         {
             xShape = implConvertAndInsert( rxShapes, aShapeRect );
@@ -321,6 +320,8 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
                 mrDrawing.notifyXShapeInserted( xShape, aShapeRect, *this, bGroupChild );
             }
         }
+        else
+            SAL_WARN("oox", "not converting shape, as calculated rectangle is empty");
     }
     return xShape;
 }
@@ -609,10 +610,10 @@ LineShape::LineShape(Drawing& rDrawing)
 {
 }
 
-Reference<XShape> LineShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const Rectangle& rShapeRect) const
+awt::Rectangle LineShape::getAbsRectangle() const
 {
     const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper();
-    Rectangle aShapeRect(rShapeRect);
+    awt::Rectangle aShapeRect;
     sal_Int32 nIndex = 0;
 
     aShapeRect.X = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maFrom.getToken(0, ',', nIndex), 0, true, true);
@@ -620,8 +621,20 @@ Reference<XShape> LineShape::implConvertAndInsert(const Reference<XShapes>& rxSh
     nIndex = 0;
     aShapeRect.Width = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maTo.getToken(0, ',', nIndex), 0, true, true) - aShapeRect.X;
     aShapeRect.Height = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maTo.getToken(0, ',', nIndex), 0, false, true) - aShapeRect.Y;
+    return aShapeRect;
+}
 
-    return SimpleShape::implConvertAndInsert(rxShapes, aShapeRect);
+awt::Rectangle LineShape::getRelRectangle() const
+{
+    awt::Rectangle aShapeRect;
+    sal_Int32 nIndex = 0;
+
+    aShapeRect.X = maShapeModel.maFrom.getToken(0, ',', nIndex).toInt32();
+    aShapeRect.Y = maShapeModel.maFrom.getToken(0, ',', nIndex).toInt32();
+    nIndex = 0;
+    aShapeRect.Width = maShapeModel.maTo.getToken(0, ',', nIndex).toInt32() - aShapeRect.X;
+    aShapeRect.Height = maShapeModel.maTo.getToken(0, ',', nIndex).toInt32() - aShapeRect.Y;
+    return aShapeRect;
 }
 
 // ============================================================================
@@ -776,9 +789,9 @@ Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes >
         xGroupShape = mrDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.GroupShape" ), rxShapes, rShapeRect );
         Reference< XShapes > xChildShapes( xGroupShape, UNO_QUERY_THROW );
         mxChildren->convertAndInsert( xChildShapes, &aParentAnchor );
-        // no child shape has been created - delete the group shape
         if( !xChildShapes->hasElements() )
         {
+            SAL_WARN("oox", "no child shape has been created - deleting the group shape");
             rxShapes->remove( xGroupShape );
             xGroupShape.clear();
         }


More information about the Libreoffice-commits mailing list