summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2015-09-01 10:46:42 +0200
committerAndras Timar <andras.timar@collabora.com>2015-09-02 13:31:11 +0000
commitcc88a88caad591270760d947848ad0a032d32bdb (patch)
tree725fa8eee3184bf7ae7cf574f6bb2772d6c0df05
parentb9bf1123f35d78fb98964fd56b50f330ee3efd71 (diff)
tdf#93830 txXfrm offset workaround works in rounded rectangle case as well
Change-Id: I5d8df5c0d55e8dfd7c978b16b2b220c127f3dac9 Reviewed-on: https://gerrit.libreoffice.org/18226 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--oox/source/drawingml/transform2dcontext.cxx3
-rw-r--r--sd/qa/unit/data/pptx/tdf93830.pptxbin0 -> 64463 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx25
3 files changed, 27 insertions, 1 deletions
diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx
index 10bd727ac902..3f4b35f33639 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -66,7 +66,8 @@ ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken,
{
const OUString sXValue = rAttribs.getString( XML_x ).get();
const OUString sYValue = rAttribs.getString( XML_y ).get();
- if( !sXValue.isEmpty() && nType == XML_rect )
+
+ if( !sXValue.isEmpty() )
mrShape.getTextBody()->getTextProperties().moTextOffLeft = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X );
if( !sYValue.isEmpty() )
mrShape.getTextBody()->getTextProperties().moTextOffUpper = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y );
diff --git a/sd/qa/unit/data/pptx/tdf93830.pptx b/sd/qa/unit/data/pptx/tdf93830.pptx
new file mode 100644
index 000000000000..8415daff3521
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf93830.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 42144ecc8146..7eb940372c02 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -103,6 +103,7 @@ public:
void testBulletSuffix();
void testBnc910045();
void testRowHeight();
+ void testTdf93830();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -142,6 +143,7 @@ public:
CPPUNIT_TEST(testBulletSuffix);
CPPUNIT_TEST(testBnc910045);
CPPUNIT_TEST(testRowHeight);
+ CPPUNIT_TEST(testTdf93830);
CPPUNIT_TEST_SUITE_END();
};
@@ -1199,6 +1201,29 @@ void SdImportTest::testRowHeight()
CPPUNIT_ASSERT_EQUAL( sal_Int32(508), nHeight);
}
+void SdImportTest::testTdf93830()
+{
+ // Text shape offset was ignored
+ sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/tdf93830.pptx"), PPTX);
+
+ uno::Reference< drawing::XDrawPagesSupplier > xDoc(
+ xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< drawing::XDrawPage > xPage(
+ xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
+
+ // Get the first text box from group shape
+ uno::Reference< container::XIndexAccess > xShape( xPage->getByIndex(0), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xPropSet( xShape->getByIndex(2), uno::UNO_QUERY );
+ CPPUNIT_ASSERT_MESSAGE( "no textbox shape", xPropSet.is() );
+
+ sal_Int32 nTextLeftDistance = 0;
+ xPropSet->getPropertyValue( "TextLeftDistance" ) >>= nTextLeftDistance;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4152), nTextLeftDistance);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();