Kaydet (Commit) 7c7958ef authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Wrong unnecessarily deep downcasts

...to SwDrawContact instead of SwContact, ingoring that some objects involved
in e.g. CppunitTest_sw_uiwriter are of type SwFlyDrawContact.

Change-Id: Ie3b7726b3d47106db00b8aa11b702d505c369e00
üst 58a96d3c
......@@ -313,7 +313,7 @@ void SwUiWriterTest::testShapeTextboxSelect()
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
SdrObject* pObject = pPage->GetObj(1);
SwDrawContact* pTextBox = static_cast<SwDrawContact*>(pObject->GetUserCall());
SwContact* pTextBox = static_cast<SwContact*>(pObject->GetUserCall());
// First, make sure that pTextBox is a fly frame (textbox of a shape).
CPPUNIT_ASSERT_EQUAL(RES_FLYFRMFMT, static_cast<RES_FMT>(pTextBox->GetFmt()->Which()));
......@@ -386,7 +386,7 @@ 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();
SwFrmFmt* pFmt = static_cast<SwContact*>(pObject->GetUserCall())->GetFmt();
// This was SDRTEXTVERTADJUST_TOP.
CPPUNIT_ASSERT_EQUAL(SDRTEXTVERTADJUST_CENTER, pFmt->GetTextVertAdjust().GetValue());
}
......
......@@ -230,7 +230,7 @@ bool SwFEShell::SelectObj( const Point& rPt, sal_uInt8 nFlag, SdrObject *pObj )
for (size_t i = 0; i < rMrkList.GetMarkCount(); ++i)
{
SdrObject* pObject = rMrkList.GetMark(i)->GetMarkedSdrObj();
SwDrawContact* pDrawContact = static_cast<SwDrawContact*>(GetUserCall(pObject));
SwContact* pDrawContact = static_cast<SwContact*>(GetUserCall(pObject));
SwFrmFmt* pFmt = pDrawContact->GetFmt();
if (aTextBoxShapes.find(pFmt) != aTextBoxShapes.end())
{
......
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