[Libreoffice-commits] core.git: oox/source sw/qa

Miklos Vajna vmiklos at collabora.co.uk
Fri Jan 17 07:35:26 PST 2014


 oox/source/vml/vmlshape.cxx                                  |    2 ++
 sw/qa/extras/ooxmlimport/data/groupshape-child-rotation.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx                     |    4 ++++
 3 files changed, 6 insertions(+)

New commits:
commit 734cf8395d745db73f52fd6d625d7deb77ba6d40
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jan 17 16:09:14 2014 +0100

    VML import: fix height of textboxes when border distance is non-zero
    
    The VML concept is that the height / width of a textbox is absolute, and
    border distances only affect the position of the shape text, not the
    size of it. OTOH, when we set the Text*Distance UNO properties on a
    textbox, the size may change. Make sure that during VML import setting
    those properties doesn't change the size.
    
    Change-Id: I53b328b66572fc05027be344869bc1a78d855558

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 9e6f208..17b8818 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -620,10 +620,12 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
             getTextBox()->convert(xShape);
             if (getTextBox()->borderDistanceSet)
             {
+                awt::Size aSize = xShape->getSize();
                 PropertySet(xShape).setAnyProperty(PROP_TextLeftDistance, makeAny(sal_Int32(getTextBox()->borderDistanceLeft)));
                 PropertySet(xShape).setAnyProperty(PROP_TextUpperDistance, makeAny(sal_Int32(getTextBox()->borderDistanceTop)));
                 PropertySet(xShape).setAnyProperty(PROP_TextRightDistance, makeAny(sal_Int32(getTextBox()->borderDistanceRight)));
                 PropertySet(xShape).setAnyProperty(PROP_TextLowerDistance, makeAny(sal_Int32(getTextBox()->borderDistanceBottom)));
+                xShape->setSize(aSize);
             }
         }
     }
diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-child-rotation.docx b/sw/qa/extras/ooxmlimport/data/groupshape-child-rotation.docx
index 06aa39d..74dd72a 100644
Binary files a/sw/qa/extras/ooxmlimport/data/groupshape-child-rotation.docx and b/sw/qa/extras/ooxmlimport/data/groupshape-child-rotation.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 32e54d2..2e9ff53 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -971,6 +971,10 @@ DECLARE_OOXMLIMPORT_TEST(testGroupshapeChildRotation, "groupshape-child-rotation
     uno::Reference<drawing::XShape> xShape(xGroupShape->getByIndex(0), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getPosition().X);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getPosition().Y);
+
+    xShape.set(xGroupShape->getByIndex(4), uno::UNO_QUERY);
+    // This was 887, i.e. border distances were included in the height.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(686), xShape->getSize().Height);
 }
 
 DECLARE_OOXMLIMPORT_TEST(testN793262, "n793262.docx")


More information about the Libreoffice-commits mailing list