summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-01-30 16:43:35 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-04-02 10:26:58 +0200
commitad19ec1d08aed974e193978eb3e647a2bcf06767 (patch)
treecd25b7b8702ac6f984fa7e75cde6a5dfb48f9056 /oox/source
parentcbb2863456cc71c44c8df70a4c4743537b0b0af9 (diff)
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
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/vml/vmlshape.cxx23
1 files changed, 18 insertions, 5 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 1b0caf9224b1..6dfa35a5c606 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -295,7 +295,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 );
@@ -318,6 +317,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;
}
@@ -610,10 +611,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);
@@ -621,8 +622,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;
}
// ============================================================================
@@ -860,9 +873,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();
}