summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-25 10:42:35 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-25 12:30:52 +0200
commitfdb50cd32e98f5e6128eb411ed910684b1fb41f0 (patch)
tree0a2ec6598242e44b73915b2576f6cc87f0afc79c /sw
parentdb960181fe63efa28c2370505b2074d1db485e07 (diff)
SwTextBoxHelper::syncProperty: handle RES_TEXT_VERT_ADJUST
So that vertical text adjustment of the shape is reflected in the textbox layout. Change-Id: I887d51928fe4d37db08864374e0cea54f80953b5
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data/shape-textbox-vertadjust.odtbin0 -> 12076 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx12
-rw-r--r--sw/source/core/doc/textboxhelper.cxx7
3 files changed, 18 insertions, 1 deletions
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 000000000000..dfb26bfa3912
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/shape-textbox-vertadjust.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 9ec5a76d8022..b279e7c9365a 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 90d2b5446beb..5e1b502dcc37 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())