sw/qa/extras/uiwriter/data/shape-textbox-vertadjust.odt |binary sw/qa/extras/uiwriter/uiwriter.cxx | 12 ++++++++++++ sw/source/core/doc/textboxhelper.cxx | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-)
New commits: commit fdb50cd32e98f5e6128eb411ed910684b1fb41f0 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jun 25 10:42:35 2014 +0200 SwTextBoxHelper::syncProperty: handle RES_TEXT_VERT_ADJUST So that vertical text adjustment of the shape is reflected in the textbox layout. Change-Id: I887d51928fe4d37db08864374e0cea54f80953b5 diff --git a/sw/qa/extras/uiwriter/data/shape-textbox-vertadjust.odt b/sw/qa/extras/uiwriter/data/shape-textbox-vertadjust.odt new file mode 100644 index 0000000..dfb26bf Binary files /dev/null and b/sw/qa/extras/uiwriter/data/shape-textbox-vertadjust.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 9ec5a76..b279e7c 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -44,6 +44,7 @@ public: void testShapeTextboxSelect(); void testShapeTextboxDelete(); void testCp1000071(); + void testShapeTextboxVertadjust(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -58,6 +59,7 @@ public: CPPUNIT_TEST(testShapeTextboxSelect); CPPUNIT_TEST(testShapeTextboxDelete); CPPUNIT_TEST(testCp1000071); + CPPUNIT_TEST(testShapeTextboxVertadjust); CPPUNIT_TEST_SUITE_END(); private: @@ -360,6 +362,16 @@ void SwUiWriterTest::testCp1000071() CPPUNIT_ASSERT_EQUAL( redlineEnd1Index, rTbl[ 1 ]->End()->nContent.GetIndex()); } +void SwUiWriterTest::testShapeTextboxVertadjust() +{ + SwDoc* pDoc = createDoc("shape-textbox-vertadjust.odt"); + SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + SdrObject* pObject = pPage->GetObj(1); + SwFrmFmt* pFmt = static_cast<SwDrawContact*>(pObject->GetUserCall())->GetFmt(); + // This was SDRTEXTVERTADJUST_TOP. + CPPUNIT_ASSERT_EQUAL(SDRTEXTVERTADJUST_CENTER, pFmt->GetTextVertAdjust().GetValue()); +} + 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 90d2b54..5e1b502 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -279,7 +279,7 @@ Rectangle SwTextBoxHelper::getTextRectangle(SwFrmFmt* pShape, bool bAbsolute) return aRet; } -void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, const OUString& rPropertyName, const css::uno::Any& /*rValue*/) +void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, const OUString& rPropertyName, const css::uno::Any& rValue) { if (rPropertyName == "CustomShapeGeometry") { @@ -294,6 +294,8 @@ void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, const OUString& rPropertyNa syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, uno::makeAny(static_cast<sal_Int32>(convertTwipToMm100(aRectangle.Top())))); } } + else if (rPropertyName == UNO_NAME_TEXT_VERT_ADJUST) + syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0, rValue); } void SwTextBoxHelper::getProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 nMemberId, css::uno::Any& rValue) @@ -412,6 +414,9 @@ void SwTextBoxHelper::syncProperty(SwFrmFmt* pShape, sal_uInt16 nWID, sal_uInt8 break; } break; + case RES_TEXT_VERT_ADJUST: + aPropertyName = UNO_NAME_TEXT_VERT_ADJUST; + break; } if (!aPropertyName.isEmpty()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits