Kaydet (Commit) 10d91ef9 authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst 483a4b54
...@@ -45,6 +45,7 @@ public: ...@@ -45,6 +45,7 @@ public:
void testShapeTextboxDelete(); void testShapeTextboxDelete();
void testCp1000071(); void testCp1000071();
void testShapeTextboxVertadjust(); void testShapeTextboxVertadjust();
void testShapeTextboxAutosize();
CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST_SUITE(SwUiWriterTest);
CPPUNIT_TEST(testReplaceForward); CPPUNIT_TEST(testReplaceForward);
...@@ -60,6 +61,7 @@ public: ...@@ -60,6 +61,7 @@ public:
CPPUNIT_TEST(testShapeTextboxDelete); CPPUNIT_TEST(testShapeTextboxDelete);
CPPUNIT_TEST(testCp1000071); CPPUNIT_TEST(testCp1000071);
CPPUNIT_TEST(testShapeTextboxVertadjust); CPPUNIT_TEST(testShapeTextboxVertadjust);
CPPUNIT_TEST(testShapeTextboxAutosize);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
...@@ -372,6 +374,22 @@ void SwUiWriterTest::testShapeTextboxVertadjust() ...@@ -372,6 +374,22 @@ void SwUiWriterTest::testShapeTextboxVertadjust()
CPPUNIT_ASSERT_EQUAL(SDRTEXTVERTADJUST_CENTER, pFmt->GetTextVertAdjust().GetValue()); 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_TEST_SUITE_REGISTRATION(SwUiWriterTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -95,6 +95,7 @@ void SwTextBoxHelper::create(SwFrmFmt* pShape) ...@@ -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_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_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_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));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment