[Libreoffice-commits] core.git: sw/qa sw/source

Stephan Bergmann sbergman at redhat.com
Tue Oct 14 02:08:02 PDT 2014


 sw/qa/extras/uiwriter/uiwriter.cxx |    4 ++--
 sw/source/core/frmedt/feshview.cxx |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 7c7958ef455d09a0c02683519fb766696904a103
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Oct 14 11:07:09 2014 +0200

    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

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 6f99e9b..3165de7 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -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());
 }
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index bf88617..4505d3a 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -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())
         {


More information about the Libreoffice-commits mailing list