From 012607dc600d85553f5a1db68ae9c36797000474 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 2 Feb 2015 16:49:39 +0000 Subject: unwind the casts to initial entry points Change-Id: Id8d90569c079a753314ba88b419de9a08b0b6a8b --- sw/source/filter/ww8/wrtw8esh.cxx | 23 +++++++---------------- sw/source/filter/ww8/wrtw8sty.cxx | 5 +++-- sw/source/filter/ww8/wrtww8.hxx | 3 ++- sw/source/filter/ww8/ww8par.hxx | 3 ++- 4 files changed, 14 insertions(+), 20 deletions(-) (limited to 'sw/source/filter/ww8') diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index d5f0ae026ef1..acb862bc6f1f 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1310,13 +1310,8 @@ void MSWord_SdrAttrIter::OutParaAttr(bool bCharAttr) } } -void WW8Export::WriteSdrTextObj(const SdrObject& rObj, sal_uInt8 nTyp) +void WW8Export::WriteSdrTextObj(const SdrTextObj& rTxtObj, sal_uInt8 nTyp) { - const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, &rObj); - OSL_ENSURE(pTxtObj, "That is no SdrTextObj!"); - if (!pTxtObj) - return; - const OutlinerParaObject* pParaObj = 0; bool bOwnParaObj = false; @@ -1325,14 +1320,14 @@ void WW8Export::WriteSdrTextObj(const SdrObject& rObj, sal_uInt8 nTyp) When the object is actively being edited, that text is not set into the objects normal text object, but lives in a separate object. */ - if (pTxtObj->IsTextEditActive()) + if (rTxtObj.IsTextEditActive()) { - pParaObj = pTxtObj->GetEditOutlinerParaObject(); + pParaObj = rTxtObj.GetEditOutlinerParaObject(); bOwnParaObj = true; } else { - pParaObj = pTxtObj->GetOutlinerParaObject(); + pParaObj = rTxtObj.GetOutlinerParaObject(); } if( pParaObj ) @@ -3112,23 +3107,19 @@ bool SwMSConvertControls::ReadOCXStream( SotStorageRef& rSrc1, return bRes; } -bool SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrObject *pObj) +bool SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrUnoObj& rFormObj) { if (!rWW8Wrt.bWrtWW8) return false; - const SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObj); - assert(pFormObj); - if (!pFormObj) - return false; uno::Reference< awt::XControlModel > xControlModel = - pFormObj->GetUnoControlModel(); + rFormObj.GetUnoControlModel(); //Why oh lord do we use so many different units ? //I think I painted myself into a little bit of a //corner by trying to use the uno interface for //controls export - Rectangle aRect = pFormObj->GetLogicRect(); + Rectangle aRect = rFormObj.GetLogicRect(); aRect.SetPos(Point(0,0)); awt::Size aSize; aSize.Width = TWIPS_TO_MM(aRect.Right()); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 74134b364c4e..b46f2b4cd78e 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -2165,11 +2166,11 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, sal_uInt8 nTTyp, { sal_uInt8 nOldTyp = rWrt.nTxtTyp; rWrt.nTxtTyp = nTTyp; - rWrt.GetOCXExp().ExportControl(rWrt,&rObj); + rWrt.GetOCXExp().ExportControl(rWrt, dynamic_cast(rObj)); rWrt.nTxtTyp = nOldTyp; } else if( rObj.ISA( SdrTextObj ) ) - rWrt.WriteSdrTextObj(rObj, nTTyp); + rWrt.WriteSdrTextObj(dynamic_cast(rObj), nTTyp); else { const SwFrmFmt* pFmt = ::FindFrmFmt( &rObj ); diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 347852192e3c..a02906379386 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -61,6 +61,7 @@ class DateTime; namespace vcl { class Font; } class MSWordExportBase; class SdrObject; +class SdrTextObj; class SfxItemSet; class SvStream; class SvxFontItem; @@ -1038,7 +1039,7 @@ public: void AppendFlyInFlys(const sw::Frame& rFrmFmt, const Point& rNdTopLeft); void WriteOutliner(const OutlinerParaObject& rOutliner, sal_uInt8 nTyp); - void WriteSdrTextObj(const SdrObject& rObj, sal_uInt8 nTyp); + void WriteSdrTextObj(const SdrTextObj& rObj, sal_uInt8 nTyp); sal_uInt32 GetSdrOrdNum( const SwFrmFmt& rFmt ) const; void CreateEscher(); diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index da3610bb6e37..ca6b5face7ae 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -89,6 +89,7 @@ class SdrModel; class SdrPage; class SdrObject; class SdrTextObj; +class SdrUnoObj; class Size; class EditEngine; struct SwPosition; @@ -749,7 +750,7 @@ public: const ::com::sun::star::awt::Size& rSize, com::sun::star::uno::Reference < com::sun::star::drawing::XShape > *pShape, bool bFloatingCtrl) SAL_OVERRIDE; - bool ExportControl(WW8Export &rWrt, const SdrObject *pObj); + bool ExportControl(WW8Export &rWrt, const SdrUnoObj& rFormObj); bool ReadOCXStream( SotStorageRef& rSrc1, com::sun::star::uno::Reference< com::sun::star::drawing::XShape > *pShapeRef=0, -- cgit