[Libreoffice-commits] core.git: filter/source include/svx sc/source sd/source svx/source sw/source

Noel Grandin noel at peralex.com
Mon May 25 04:03:26 PDT 2015


 filter/source/msfilter/svdfppt.cxx  |    4 ++--
 include/svx/svdpntv.hxx             |   13 -------------
 sc/source/ui/drawfunc/fuconrec.cxx  |    2 --
 sd/source/ui/app/sdxfer.cxx         |    4 ++--
 sd/source/ui/func/fuconrec.cxx      |    2 --
 svx/source/svdraw/sdrpagewindow.cxx |    4 ++--
 svx/source/svdraw/svdcrtv.cxx       |    2 +-
 svx/source/svdraw/svdoashp.cxx      |    2 +-
 svx/source/svdraw/svdocirc.cxx      |    2 +-
 svx/source/svdraw/svdorect.cxx      |    4 ++--
 svx/source/svdraw/svdotxdr.cxx      |    2 +-
 svx/source/svdraw/svdpage.cxx       |    4 ++--
 sw/source/core/draw/dflyobj.cxx     |    2 +-
 sw/source/core/draw/dview.cxx       |    2 +-
 sw/source/core/text/porfly.cxx      |    2 +-
 sw/source/uibase/docvw/edtdd.cxx    |    2 +-
 16 files changed, 18 insertions(+), 35 deletions(-)

New commits:
commit d3714207b1d8cc323a639a942121b6c1aa4cd61b
Author: Noel Grandin <noel at peralex.com>
Date:   Mon May 25 11:03:10 2015 +0200

    remove some unnecessary casts and convert some to const_cast
    
    Change-Id: I590a87c832bc59947ae04e52d3ac5ea71574bb11
    Reviewed-on: https://gerrit.libreoffice.org/15888
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 4536cda..75faa09 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -2582,7 +2582,7 @@ bool SdrPowerPointImport::SeekToShape( SvStream& rSt, void* pClientData, sal_uIn
                         DffRecordList* pCList = maShapeRecords.pCList;              // we got a backup of the current position
                         if ( pCList )
                             nCurrent = pCList->nCurrent;
-                        if ( ((SdrEscherImport*)this )->maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
+                        if ( const_cast<SdrPowerPointImport*>(this)->maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
                         {
                             sal_uInt32 nStreamPos = rSt.Tell();
                             PPTTextObj aTextObj( rSt, (SdrPowerPointImport&)*this, rPersistEntry, NULL );
@@ -2615,7 +2615,7 @@ bool SdrPowerPointImport::SeekToShape( SvStream& rSt, void* pClientData, sal_uIn
                         }
                         if ( pCList )                                               // restoring
                             pCList->nCurrent = nCurrent;
-                        ((SdrEscherImport*)this )->maShapeRecords.pCList = pCList;
+                        const_cast<SdrPowerPointImport*>(this)->maShapeRecords.pCList = pCList;
                     }
                 }
             }
diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx
index 1b36032..ee4ba06c 100644
--- a/include/svx/svdpntv.hxx
+++ b/include/svx/svdpntv.hxx
@@ -334,21 +334,8 @@ public:
     virtual void HideSdrPage();
 
     // Iterieren ueber alle angemeldeten PageViews
-//  sal_uInt16 GetPageViewCount() const { return sal_uInt16(aPagV.Count()); }
-//  SdrPageView* GetPageViewByIndex(sal_uInt16 nPvNum) const { return ((SdrPageView*)aPagV.GetObject(nPvNum)); }
     SdrPageView* GetSdrPageView() const { return mpPageView; }
 
-    // Pageview einer bestimmten Seite ermitteln
-//  SdrPageView* GetPageViewByPage(const SdrPage* pPage) const;
-//  sal_uInt16 GetIndexByPageView(const SdrPageView* pPV) const;
-
-    // Test, ob eine Seite getroffen
-//  SdrPageView* HitPage(const Point& rPnt) const;
-
-    // Die Seite, die dem Punkt am naechsten ist. Liefert nur NULL,
-    // wenn absolut keine Seite angemeldet ist.
-//  SdrPageView* GetPageViewByPosition(const Point& rPnt) const;
-
     // Eine SdrView kann auf mehreren Fenstern gleichzeitig abgebiltet sein:
     virtual void AddWindowToPaintView(OutputDevice* pNewWin);
     virtual void DeleteWindowFromPaintView(OutputDevice* pOldWin);
diff --git a/sc/source/ui/drawfunc/fuconrec.cxx b/sc/source/ui/drawfunc/fuconrec.cxx
index e933227..a39f12fc 100644
--- a/sc/source/ui/drawfunc/fuconrec.cxx
+++ b/sc/source/ui/drawfunc/fuconrec.cxx
@@ -267,8 +267,6 @@ SdrObject* FuConstRectangle::CreateDefaultObject(const sal_uInt16 nID, const Rec
                     //  don't set default text, start edit mode instead
                     //  (Edit mode is started in ScTabViewShell::ExecDraw, because
                     //  it must be handled by FuText)
-                    // String aText(ScResId(STR_CAPTION_DEFAULT_TEXT));
-                    // ((SdrCaptionObj*)pObj)->SetText(aText);
 
                     static_cast<SdrCaptionObj*>(pObj)->SetLogicRect(aRect);
                     static_cast<SdrCaptionObj*>(pObj)->SetTailPos(
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index f90cac3..27c72a3 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -268,7 +268,7 @@ void SdTransferable::CreateData()
         mpSdViewIntern->EndListening(*mpSdDrawDocumentIntern );
         mpSdViewIntern->hideMarkHandles();
         SdrPageView* pPageView = mpSdViewIntern->ShowSdrPage(pPage);
-        ((SdrMarkView*)mpSdViewIntern)->MarkAllObj(pPageView);
+        mpSdViewIntern->MarkAllObj(pPageView);
     }
     else if( mpSdView && !mpSdDrawDocumentIntern )
     {
@@ -723,7 +723,7 @@ void SdTransferable::SetPageBookmarks( const std::vector<OUString> &rPageBookmar
 
             if( pPage )
             {
-                ( (SdrMarkView*) mpSdViewIntern )->MarkAllObj( mpSdViewIntern->ShowSdrPage( pPage ) );
+                mpSdViewIntern->MarkAllObj( mpSdViewIntern->ShowSdrPage( pPage ) );
             }
         }
 
diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx
index d8ee5dd..9dec246 100644
--- a/sd/source/ui/func/fuconrec.cxx
+++ b/sd/source/ui/func/fuconrec.cxx
@@ -907,8 +907,6 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const
                     }
 
                     // The default text is not inserted anymore.
-                    //  String aText(SdResId(STR_POOLSHEET_TEXT));
-                    //  ((SdrCaptionObj*)pObj)->SetText(aText);
 
                     static_cast<SdrCaptionObj*>(pObj)->SetLogicRect(aRect);
                     static_cast<SdrCaptionObj*>(pObj)->SetTailPos(
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx
index f62a81a..68f4b5a 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -264,7 +264,7 @@ namespace
 
             if(pObjA && pObjA->ISA(SdrPathObj))
             {
-                basegfx::B2DPolyPolygon aPolyA(((SdrPathObj*)pObjA)->GetPathPoly());
+                basegfx::B2DPolyPolygon aPolyA(pObjA->GetPathPoly());
                 aPolyA = basegfx::tools::correctOrientations(aPolyA);
 
                 basegfx::B2DPolyPolygon aPolyB;
@@ -275,7 +275,7 @@ namespace
 
                     if(pObjB && pObjB->ISA(SdrPathObj))
                     {
-                        basegfx::B2DPolyPolygon aCandidate(((SdrPathObj*)pObjB)->GetPathPoly());
+                        basegfx::B2DPolyPolygon aCandidate(pObjB->GetPathPoly());
                         aCandidate = basegfx::tools::correctOrientations(aCandidate);
                         aPolyB.append(aCandidate);
                     }
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index cd9f888..2e97cb7 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -477,7 +477,7 @@ bool SdrCreateView::ImpBegCreateObj(sal_uInt32 nInvent, sal_uInt16 nIdent, const
                 if (!rLogRect.IsEmpty()) pAktCreate->NbcSetLogicRect(rLogRect);
 
                 // make sure drag start point is inside WorkArea
-                const Rectangle& rWorkArea = ((SdrDragView*)this)->GetWorkArea();
+                const Rectangle& rWorkArea = GetWorkArea();
 
                 if(!rWorkArea.IsEmpty())
                 {
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 4ea4c4d..c314edf 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -1923,7 +1923,7 @@ SdrHdl* SdrObjCustomShape::GetHdl( sal_uInt32 nHdlNum ) const
                     com::sun::star::awt::Point aPosition( aInteractionHandles[ nCustomShapeHdlNum ].xInteraction->getPosition() );
                     pH = new SdrHdl( Point( aPosition.X, aPosition.Y ), HDL_CUSTOMSHAPE1 );
                     pH->SetPointNum( nCustomShapeHdlNum );
-                    pH->SetObj( (SdrObject*)this );
+                    pH->SetObj( const_cast<SdrObjCustomShape*>(this) );
                 }
                 catch ( const uno::RuntimeException& )
                 {
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index c0677cc..1468008 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -464,7 +464,7 @@ SdrHdl* SdrCircObj::GetHdl(sal_uInt32 nHdlNum) const
     {
         pH = new SdrHdl(aPnt,eLocalKind);
         pH->SetPointNum(nPNum);
-        pH->SetObj((SdrObject*)this);
+        pH->SetObj(const_cast<SdrCircObj*>(this));
         pH->SetRotationAngle(aGeo.nRotationAngle);
     }
 
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 19e87c9..24be46e 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -337,7 +337,7 @@ SdrHdl* SdrRectObj::GetHdl(sal_uInt32 nHdlNum) const
             // hack for calc grid sync to ensure the hatched area
             // for a textbox is displayed at correct position
             pH = new ImpTextframeHdl(maRect + GetGridOffset() );
-            pH->SetObj((SdrObject*)this);
+            pH->SetObj(const_cast<SdrRectObj*>(this));
             pH->SetRotationAngle(aGeo.nRotationAngle);
             break;
         }
@@ -375,7 +375,7 @@ SdrHdl* SdrRectObj::GetHdl(sal_uInt32 nHdlNum) const
         }
 
         pH = new SdrHdl(aPnt,eKind);
-        pH->SetObj((SdrObject*)this);
+        pH->SetObj(const_cast<SdrRectObj*>(this));
         pH->SetRotationAngle(aGeo.nRotationAngle);
     }
 
diff --git a/svx/source/svdraw/svdotxdr.cxx b/svx/source/svdraw/svdotxdr.cxx
index d28fc2e..36de7ba 100644
--- a/svx/source/svdraw/svdotxdr.cxx
+++ b/svx/source/svdraw/svdotxdr.cxx
@@ -56,7 +56,7 @@ SdrHdl* SdrTextObj::GetHdl(sal_uInt32 nHdlNum) const
     if (aGeo.nRotationAngle!=0) RotatePoint(aPnt,maRect.TopLeft(),aGeo.nSin,aGeo.nCos);
     if (eKind!=HDL_MOVE) {
         pH=new SdrHdl(aPnt,eKind);
-        pH->SetObj((SdrObject*)this);
+        pH->SetObj(const_cast<SdrTextObj*>(this));
         pH->SetRotationAngle(aGeo.nRotationAngle);
     }
     return pH;
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 8fe3df1..7d2d701 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1573,10 +1573,10 @@ sal_uInt16 SdrPage::GetPageNum() const
 
     if (mbMaster) {
         if (pModel && pModel->IsMPgNumsDirty())
-            ((SdrModel*)pModel)->RecalcPageNums(true);
+            pModel->RecalcPageNums(true);
     } else {
         if (pModel && pModel->IsPagNumsDirty())
-            ((SdrModel*)pModel)->RecalcPageNums(false);
+            pModel->RecalcPageNums(false);
     }
     return nPageNum;
 }
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 2df0aa0..cc81412 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -461,7 +461,7 @@ void SwVirtFlyDrawObj::wrap_DoPaintObject(
     {
         bool bDrawObject(true);
 
-        if ( !SwFlyFrm::IsPaint( (SdrObject*)this, pShell ) )
+        if ( !SwFlyFrm::IsPaint( const_cast<SwVirtFlyDrawObj*>(this), pShell ) )
         {
             bDrawObject = false;
         }
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 0f005b8..3e109c7 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -931,7 +931,7 @@ void SwDrawView::DeleteMarked()
         SdrPageView* pDrawPageView = rImp.GetPageView();
         if ( pDrawPageView )
         {
-            SdrMarkView* pMarkView = PTR_CAST( SdrMarkView, &(pDrawPageView->GetView()) );
+            SdrMarkView* pMarkView = &(pDrawPageView->GetView());
             if ( pMarkView )
             {
                 ReplaceMarkedDrawVirtObjs( *pMarkView );
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index ac84ea7..aefa9d4 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -228,7 +228,7 @@ void SwFlyCntPortion::Paint( const SwTextPaintInfo &rInf ) const
 
         if( (GetFlyFrm()->IsCompletePaint() ||
              GetFlyFrm()->Frm().IsOver( aRepaintRect )) &&
-             SwFlyFrm::IsPaint( (SdrObject*)GetFlyFrm()->GetVirtDrawObj(),
+             SwFlyFrm::IsPaint( const_cast<SwVirtFlyDrawObj*>(GetFlyFrm()->GetVirtDrawObj()),
                                 GetFlyFrm()->getRootFrm()->GetCurrShell() ))
         {
             SwRect aRect( GetFlyFrm()->Frm() );
diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx
index 044d201..92c5764 100644
--- a/sw/source/uibase/docvw/edtdd.cxx
+++ b/sw/source/uibase/docvw/edtdd.cxx
@@ -434,7 +434,7 @@ sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt )
                  EXCHG_IN_ACTION_LINK == m_nDropAction) ||
                  SotClipboardFormatId::SBA_CTRLDATAEXCHANGE == m_nDropFormat  )
             {
-                SdrMarkView* pMView = PTR_CAST( SdrMarkView, rSh.GetDrawView() );
+                SdrMarkView* pMView = rSh.GetDrawView();
                 if( pMView && !pMView->IsDesignMode() )
                     return DND_ACTION_NONE;
             }


More information about the Libreoffice-commits mailing list