SwTextBoxHelper::syncProperty: handle RES_TEXT_VERT_ADJUST

So that vertical text adjustment of the shape is reflected in the
textbox layout.

Change-Id: I887d51928fe4d37db08864374e0cea54f80953b5
This commit is contained in:
Miklos Vajna
2014-06-25 10:42:35 +02:00
parent db960181fe
commit fdb50cd32e
3 changed files with 18 additions and 1 deletions

View File

@@ -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();

View File

@@ -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())