diff options
-rw-r--r-- | sw/source/filter/html/htmlflywriter.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/html/htmlforw.cxx | 49 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.hxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 23 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 3 |
7 files changed, 34 insertions, 55 deletions
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index dfbb5d0db28f..4a3c7d251c9d 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -32,6 +32,7 @@ #include <svtools/imap.hxx> #include <svtools/imapobj.hxx> #include <svtools/htmlcfg.hxx> +#include <svx/svdouno.hxx> #include <svx/xoutbmp.hxx> #include <editeng/boxitem.hxx> #include <editeng/lrspitem.hxx> @@ -490,7 +491,7 @@ void SwHTMLWriter::OutFrmFmt( sal_uInt8 nMode, const SwFrmFmt& rFrmFmt, break; case HTML_OUT_CONTROL: // OK OutHTML_DrawFrmFmtAsControl( *this, - static_cast<const SwDrawFrmFmt &>(rFrmFmt), *pSdrObject, + static_cast<const SwDrawFrmFmt &>(rFrmFmt), dynamic_cast<const SdrUnoObj&>(*pSdrObject), pCntnrStr != 0 ); break; case HTML_OUT_AMARQUEE: diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 2e95323dae21..a73b92ea8df2 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -641,12 +641,9 @@ const SdrObject *SwHTMLWriter::GetHTMLControl( const SwDrawFrmFmt& rFmt ) if( !pObj || FmFormInventor != pObj->GetObjInventor() ) return 0; - const SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pObj ); - assert(pFormObj); - if (!pFormObj) - return 0; + const SdrUnoObj& rFormObj = dynamic_cast<const SdrUnoObj&>(*pObj); uno::Reference< awt::XControlModel > xControlModel = - pFormObj->GetUnoControlModel(); + rFormObj.GetUnoControlModel(); OSL_ENSURE( xControlModel.is(), "UNO-Control ohne Model" ); if( !xControlModel.is() ) @@ -668,22 +665,17 @@ const SdrObject *SwHTMLWriter::GetHTMLControl( const SwDrawFrmFmt& rFmt ) return 0; } -static void GetControlSize( const SdrObject& rSdrObj, Size& rSz, - SwDoc *pDoc ) +static void GetControlSize(const SdrUnoObj& rFormObj, Size& rSz, SwDoc *pDoc) { SwViewShell *pVSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); if( !pVSh ) return; - const SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObj ); - assert(pFormObj); - if (!pFormObj) - return; uno::Reference< awt::XControl > xControl; SdrView* pDrawView = pVSh->GetDrawView(); OSL_ENSURE( pDrawView && pVSh->GetWin(), "no DrawView or window!" ); if ( pDrawView && pVSh->GetWin() ) - xControl = pFormObj->GetUnoControl( *pDrawView, *pVSh->GetWin() ); + xControl = rFormObj.GetUnoControl( *pDrawView, *pVSh->GetWin() ); uno::Reference< awt::XTextLayoutConstrains > xLC( xControl, uno::UNO_QUERY ); OSL_ENSURE( xLC.is(), "kein XTextLayoutConstrains" ); if( !xLC.is() ) @@ -697,17 +689,11 @@ static void GetControlSize( const SdrObject& rSdrObj, Size& rSz, Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, const SwDrawFrmFmt& rFmt, - const SdrObject& rSdrObject, + const SdrUnoObj& rFormObj, bool bInCntnr ) { - SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt); - - const SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObject ); - assert(pFormObj); - if (!pFormObj) - return rWrt; uno::Reference< awt::XControlModel > xControlModel = - pFormObj->GetUnoControlModel(); + rFormObj.GetUnoControlModel(); OSL_ENSURE( xControlModel.is(), "UNO-Control ohne Model" ); if( !xControlModel.is() ) @@ -717,6 +703,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); + SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt); rHTMLWrt.nFormCntrlCnt++; enum Tag { TAG_INPUT, TAG_SELECT, TAG_TEXTAREA, TAG_NONE }; @@ -807,7 +794,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, !*(sal_Bool*)aTmp.getValue() ) { Size aSz( 0, 0 ); - GetControlSize( rSdrObject, aSz, rWrt.pDoc ); + GetControlSize( rFormObj, aSz, rWrt.pDoc ); // wieviele sind sichtbar ?? if( aSz.Height() ) @@ -828,7 +815,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, case form::FormComponentType::TEXTFIELD: { Size aSz( 0, 0 ); - GetControlSize( rSdrObject, aSz, rWrt.pDoc ); + GetControlSize( rFormObj, aSz, rWrt.pDoc ); bool bMultiLine = false; OUString sMultiLine("MultiLine"); @@ -913,7 +900,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, case form::FormComponentType::FILECONTROL: { Size aSz( 0, 0 ); - GetControlSize( rSdrObject, aSz, rWrt.pDoc ); + GetControlSize( rFormObj, aSz, rWrt.pDoc ); eType = TYPE_FILE; if( aSz.Width() ) @@ -989,7 +976,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, sOut = "\""; } - Size aTwipSz( rSdrObject.GetLogicRect().GetSize() ); + Size aTwipSz( rFormObj.GetLogicRect().GetSize() ); Size aPixelSz( 0, 0 ); if( (aTwipSz.Width() || aTwipSz.Height()) && Application::GetDefaultDevice() ) @@ -1152,7 +1139,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, } } - rHTMLWrt.OutCSS1_FrmFmtOptions( rFmt, nFrmOpts, &rSdrObject, + rHTMLWrt.OutCSS1_FrmFmtOptions( rFmt, nFrmOpts, &rFormObj, &aItemSet ); } @@ -1291,15 +1278,11 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, // Ermitteln, ob eine Format zu einem Control gehoert und wenn ja // dessen Form zurueckgeben static void AddControl( HTMLControls& rControls, - const SdrObject *pSdrObj, + const SdrUnoObj& rFormObj, sal_uInt32 nNodeIdx ) { - const SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pSdrObj ); - assert(pFormObj); //Doch kein FormObj - if (!pFormObj) - return; uno::Reference< awt::XControlModel > xControlModel = - pFormObj->GetUnoControlModel(); + rFormObj.GetUnoControlModel(); if( !xControlModel.is() ) return; @@ -1346,7 +1329,7 @@ void SwHTMLWriter::GetControls() if( !pSdrObj ) continue; - AddControl( aHTMLControls, pSdrObj, + AddControl( aHTMLControls, dynamic_cast<const SdrUnoObj&>(*pSdrObj), pPosFlyFrm->GetNdIndex().GetIndex() ); } } @@ -1369,7 +1352,7 @@ void SwHTMLWriter::GetControls() if( !pSdrObj ) continue; - AddControl( aHTMLControls, pSdrObj, pPos->nNode.GetIndex() ); + AddControl( aHTMLControls, dynamic_cast<const SdrUnoObj&>(*pSdrObj), pPos->nNode.GetIndex() ); } } diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 53c25527d19d..b0e92e35df9d 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -48,6 +48,7 @@ class SwNodeIndex; class ImageMap; class SwNumRule; class SdrObject; +class SdrUnoObj; class SvxBrushItem; class SvxFontItem; class SwHTMLNumRuleInfo; @@ -649,7 +650,7 @@ Writer& OutHTML_SwTblNode( Writer& , SwTableNode &, const SwFrmFmt *, const OUString* pCaption=0, bool bTopCaption=false ); Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, const SwDrawFrmFmt& rFmt, - const SdrObject& rSdrObj, bool bInCntnr ); + const SdrUnoObj& rSdrObj, bool bInCntnr ); Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, const SwDrawFrmFmt& rFmt, const SdrObject& rSdrObj ); 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 <editeng/fontitem.hxx> #include <svx/svdobj.hxx> #include <svx/svdotext.hxx> +#include <svx/svdouno.hxx> #include <svx/fmglob.hxx> #include <editeng/frmdiritem.hxx> #include <editeng/lrspitem.hxx> @@ -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<const SdrUnoObj&>(rObj)); rWrt.nTxtTyp = nOldTyp; } else if( rObj.ISA( SdrTextObj ) ) - rWrt.WriteSdrTextObj(rObj, nTTyp); + rWrt.WriteSdrTextObj(dynamic_cast<const SdrTextObj&>(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, |