Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Sorry, but I forgot to compile before patching.
Please, push this fix too.

Uray M. János

2012/8/7 Tor Lillqvist <tml@iki.fi>

Thanks, puxhed.

--tml

From aef47b5e204067ae406eca664a504155cc699ef8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Uray=20M.=20J=C3=A1nos"?= <uray.janos@gmail.com>
Date: Tue, 7 Aug 2012 15:22:25 +0200
Subject: [PATCH] IDE: dynamic_cast fix

Change-Id: Ia8826be6e6fe7c09adb4f0104b52ceba6b89163b
---
 .../accessibility/accessibledialogwindow.cxx       |   12 ++++++------
 basctl/source/basicide/baside2b.cxx                |   10 +++++-----
 basctl/source/basicide/basides1.cxx                |    6 +++---
 basctl/source/basicide/basidesh.cxx                |    4 ++--
 basctl/source/basicide/basobj3.cxx                 |    6 +++---
 basctl/source/basicide/bastype3.cxx                |    2 +-
 basctl/source/basicide/localizationmgr.cxx         |    2 +-
 basctl/source/basicide/tbxctl.cxx                  |    5 +++--
 basctl/source/dlged/dlgedobj.cxx                   |    2 +-
 9 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx 
b/basctl/source/accessibility/accessibledialogwindow.cxx
index 2982cda..4621e7e 100644
--- a/basctl/source/accessibility/accessibledialogwindow.cxx
+++ b/basctl/source/accessibility/accessibledialogwindow.cxx
@@ -513,15 +513,15 @@ awt::Rectangle AccessibleDialogWindow::implGetBounds() throw 
(RuntimeException)
 
 void AccessibleDialogWindow::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if (SdrHint* pSdrHint = dynamic_cast<SdrHint*>(&rHint))
+    if (SdrHint const* pSdrHint = dynamic_cast<SdrHint const*>(&rHint))
     {
         switch ( pSdrHint->GetKind() )
         {
             case HINT_OBJINSERTED:
             {
-                if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrHint->GetObject()))
+                if (DlgEdObj const* pDlgEdObj = dynamic_cast<DlgEdObj 
const*>(pSdrHint->GetObject()))
                 {
-                    ChildDescriptor aDesc( pDlgEdObj );
+                    ChildDescriptor aDesc(const_cast<DlgEdObj*>(pDlgEdObj));
                     if ( IsChildVisible( aDesc ) )
                         InsertChild( aDesc );
                 }
@@ -529,14 +529,14 @@ void AccessibleDialogWindow::Notify( SfxBroadcaster&, const SfxHint& rHint )
             break;
             case HINT_OBJREMOVED:
             {
-                if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pSdrHint->GetObject()))
-                    RemoveChild( ChildDescriptor( pDlgEdObj ) );
+                if (DlgEdObj const* pDlgEdObj = dynamic_cast<DlgEdObj 
const*>(pSdrHint->GetObject()))
+                    RemoveChild( ChildDescriptor(const_cast<DlgEdObj*>(pDlgEdObj)) );
             }
             break;
             default: ;
         }
     }
-    else if (DlgEdHint* pDlgEdHint = dynamic_cast<DlgEdHint*>(&rHint))
+    else if (DlgEdHint const* pDlgEdHint = dynamic_cast<DlgEdHint const*>(&rHint))
     {
         switch ( pDlgEdHint->GetKind() )
         {
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index dee5e00..533e759 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -54,10 +54,10 @@ long nVirtToolBoxHeight;    // inited in WatchWindow, used in Stackwindow
 long nHeaderBarHeight;
 
 // Returns pBase converted to SbxVariable if valid and is not an SbxMethod.
-SbxVariable const* IsSbxVariable (SbxBase const* pBase)
+SbxVariable* IsSbxVariable (SbxBase* pBase)
 {
-    if (SbxVariable const* pVar = dynamic_cast<SbxVariable const*>(pBase))
-        if (!dynamic_cast<SbxMethod const*>(pVar))
+    if (SbxVariable* pVar = dynamic_cast<SbxVariable*>(pBase))
+        if (!dynamic_cast<SbxMethod*>(pVar))
             return pVar;
     return 0;
 }
@@ -1933,7 +1933,7 @@ sal_Bool WatchTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& )
     {
         // No out of scope entries
         bool bArrayElement;
-        SbxBase const* pSbx = ImplGetSBXForEntry( pEntry, bArrayElement );
+        SbxBase* pSbx = ImplGetSBXForEntry( pEntry, bArrayElement );
         if (IsSbxVariable(pSbx) || bArrayElement)
         {
             // Accept no objects and only end nodes of arrays for editing
@@ -1970,7 +1970,7 @@ bool WatchTreeListBox::ImplBasicEntryEdited( SvLBoxEntry* pEntry, const 
String&
     bool bArrayElement;
     SbxBase* pSBX = ImplGetSBXForEntry( pEntry, bArrayElement );
 
-    if (SbxVariable const* pVar = IsSbxVariable(pSBX))
+    if (SbxVariable* pVar = IsSbxVariable(pSBX))
     {
         SbxDataType eType = pVar->GetType();
         if ( (sal_uInt8)eType != (sal_uInt8)SbxOBJECT
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index d85e382..7228a6d 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -160,7 +160,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
                             {
                                 IDEBaseWindow* pWin = it->second;
                                 if (!pWin->IsSuspended())
-                                    if (pModulWindow* pMWin = dynamic_cast<ModulWindow*>(pWin))
+                                    if (ModulWindow* pMWin = dynamic_cast<ModulWindow*>(pWin))
                                         nFound += pMWin->StartSearchAndReplace(*pSearchItem);
                             }
                         }
@@ -277,7 +277,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
                     sal_Int32 nLine = xGotoDlg->GetLineNumber();
 
                     if ( nLine )
-                        ((ModulWindow*)pCurWin)->GetEditView()->SetSelection( TextSelection( 
TextPaM( nLine - 1 , 0 ), TextPaM( nLine - 1, 0 ) ) );
+                        pMCurWin->GetEditView()->SetSelection( TextSelection( TextPaM( nLine - 1 , 
0 ), TextPaM( nLine - 1, 0 ) ) );
                 }
             }
         }
@@ -1424,7 +1424,7 @@ void BasicIDEShell::Activate( sal_Bool bMDI )
 
     if ( bMDI )
     {
-        if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow>(pCurWin))
+        if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin))
             pDCurWin->UpdateBrowser();
     }
 }
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index b59882c..b271811 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -530,7 +530,7 @@ void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
 {
     if ( BasicIDEGlobals::GetShell() )
     {
-        if (SfxSimpleHint* pSimpleHint = dynamic_cast<SfxSimpleHint*>(&rHint))
+        if (SfxSimpleHint const* pSimpleHint = dynamic_cast<SfxSimpleHint const*>(&rHint))
         {
             switch (pSimpleHint->GetId())
             {
@@ -542,7 +542,7 @@ void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
                 break;
             }
 
-            if (SbxHint* pSbxHint = dynamic_cast<SbxHint*>(&rHint))
+            if (SbxHint const* pSbxHint = dynamic_cast<SbxHint const*>(&rHint))
             {
                 sal_uLong nHintId = pSbxHint->GetId();
                 if (    ( nHintId == SBX_HINT_BASICSTART ) ||
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
index 61d9c53..7325904 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -244,10 +244,10 @@ bool RemoveDialog( const ScriptDocument& rDocument, const ::rtl::OUString& 
rLibN
 
 StarBASIC* FindBasic( const SbxVariable* pVar )
 {
-    const SbxVariable* pSbx = pVar;
-    while (pSbx && !dynamic_cast<StarBASIC*>(pSbx))
+    SbxVariable const* pSbx = pVar;
+    while (pSbx && !dynamic_cast<StarBASIC const*>(pSbx))
         pSbx = pSbx->GetParent();
-    return static_cast<StarBASIC*>(pSbx);
+    return (StarBASIC*)pSbx;
 }
 
 //----------------------------------------------------------------------------
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 45253e1..bd5f3bc 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -464,7 +464,7 @@ SvLBoxEntry* BasicTreeListBox::FindRootEntry( const ScriptDocument& rDocument, L
     while ( pRootEntry )
     {
         DBG_ASSERT( static_cast<BasicEntry*>(pRootEntry->GetUserData())->GetType() == 
OBJ_TYPE_DOCUMENT, "Kein Shelleintrag?" );
-        BasicDocumentEntry* pBDEntry = static_cast<BasicDocEntry*>(pRootEntry->GetUserData());
+        BasicDocumentEntry* pBDEntry = static_cast<BasicDocumentEntry*>(pRootEntry->GetUserData());
         if (pBDEntry && pBDEntry->GetDocument() == rDocument && pBDEntry->GetLocation() == 
eLocation)
             return pRootEntry;
         pRootEntry = GetEntry( ++nRootPos );
diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx
index 1786e49..ea43931 100644
--- a/basctl/source/basicide/localizationmgr.cxx
+++ b/basctl/source/basicide/localizationmgr.cxx
@@ -815,7 +815,7 @@ DialogWindow* FindDialogWindowForEditor( DlgEditor* pEditor )
             {
                 DlgEditor* pWinEditor = pDlgWin->GetEditor();
                 if( pWinEditor == pEditor )
-                    return pFoundDlgWin;
+                    return pDlgWin;
             }
     }
     return 0;
diff --git a/basctl/source/basicide/tbxctl.cxx b/basctl/source/basicide/tbxctl.cxx
index a80381b..6052b47 100644
--- a/basctl/source/basicide/tbxctl.cxx
+++ b/basctl/source/basicide/tbxctl.cxx
@@ -67,10 +67,11 @@ void TbxControls::StateChanged( sal_uInt16 nSID, SfxItemState eState,
 {
     if( pState )
     {
-        if (SfxAllEnumItem* pItem = dynamic_cast<SfxAllEnumItem*>(pState))
+        if (SfxAllEnumItem const* pItem = dynamic_cast<SfxAllEnumItem const*>(pState))
         {
             sal_uInt16 nTemp = 0;
-            switch (sal_uInt16 nLastEnum = pItem->GetValue())
+            sal_uInt16 nLastEnum = pItem->GetValue();
+            switch (nLastEnum)
             {
                 case SVX_SNAP_PUSHBUTTON:       nTemp = SID_INSERT_PUSHBUTTON; break;
                 case SVX_SNAP_CHECKBOX:         nTemp = SID_INSERT_CHECKBOX; break;
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 41ae1cb..38f4fbc 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -1240,7 +1240,7 @@ void SAL_CALL DlgEdObj::_propertyChange( const  
::com::sun::star::beans::Propert
         // change tabindex
         else if ( evt.PropertyName == DLGED_PROP_TABINDEX )
         {
-            if (!dynamic_cast<DlgEdForm>(this))
+            if (!dynamic_cast<DlgEdForm*>(this))
                 TabIndexChange(evt);
         }
     }
-- 
1.7.7


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.