summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-27 17:34:02 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-27 18:02:23 +0200
commit10d91ef984ae54eb688cbfe39acaf0f131964634 (patch)
tree2ef0c40d8b66e44fe7f39e322a33e1b2dc2bd6e1 /sw
parent483a4b546c850e82a2d1d304238d4830ac6b441f (diff)
SwTextBoxHelper::create: handle TextAutoGrowHeight
Without this, in case TextAutoGrowHeight is set before TextBox, the textbox of the shape won't have automatic height. Change-Id: I2ebf77eacbe1f1d10ccf64ef833c39ee965245d3
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data/shape-textbox-autosize.odtbin0 -> 12362 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx18
-rw-r--r--sw/source/core/doc/textboxhelper.cxx1
3 files changed, 19 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/shape-textbox-autosize.odt b/sw/qa/extras/uiwriter/data/shape-textbox-autosize.odt
new file mode 100644
index 000000000000..8877c7215426
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/shape-textbox-autosize.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index b279e7c9365a..47aba1ecad62 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -45,6 +45,7 @@ public:
void testShapeTextboxDelete();
void testCp1000071();
void testShapeTextboxVertadjust();
+ void testShapeTextboxAutosize();
CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward);
@@ -60,6 +61,7 @@ public:
CPPUNIT_TEST(testShapeTextboxDelete);
CPPUNIT_TEST(testCp1000071);
CPPUNIT_TEST(testShapeTextboxVertadjust);
+ CPPUNIT_TEST(testShapeTextboxAutosize);
CPPUNIT_TEST_SUITE_END();
private:
@@ -372,6 +374,22 @@ void SwUiWriterTest::testShapeTextboxVertadjust()
CPPUNIT_ASSERT_EQUAL(SDRTEXTVERTADJUST_CENTER, pFmt->GetTextVertAdjust().GetValue());
}
+void SwUiWriterTest::testShapeTextboxAutosize()
+{
+ SwDoc* pDoc = createDoc("shape-textbox-autosize.odt");
+ SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+ SdrObject* pFirst = pPage->GetObj(0);
+ CPPUNIT_ASSERT_EQUAL(OUString("1st"), pFirst->GetName());
+
+ SdrObject* pSecond = pPage->GetObj(1);
+ CPPUNIT_ASSERT_EQUAL(OUString("2nd"), pSecond->GetName());
+
+ // Shape -> textbox synchronization was missing, the second shape had the
+ // same height as the first, even though the first contained 1 paragraph
+ // and the other 2 ones.
+ CPPUNIT_ASSERT(pFirst->GetSnapRect().getHeight() < pSecond->GetSnapRect().getHeight());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index e93aae789a9b..cc044d7ecb36 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -95,6 +95,7 @@ void SwTextBoxHelper::create(SwFrmFmt* pShape)
syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION));
syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION));
syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION));
+ syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT));
}
}