[Libreoffice-commits] core.git: chart2/source svx/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 25 13:23:00 UTC 2019


 chart2/source/controller/drawinglayer/DrawViewWrapper.cxx |    2 
 svx/source/accessibility/AccessibleEmptyEditSource.cxx    |    2 
 svx/source/accessibility/AccessibleTextHelper.cxx         |  107 ++++++--------
 svx/source/svdraw/svdoedge.cxx                            |    3 
 4 files changed, 57 insertions(+), 57 deletions(-)

New commits:
commit 7ec3baef938d62d16558b7ee7fd84eb02b206551
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Apr 25 10:41:12 2019 +0200
Commit:     Xisco FaulĂ­ <xiscofauli at libreoffice.org>
CommitDate: Thu Apr 25 15:22:04 2019 +0200

    Convert remaining SdrHint to static_cast
    
    follow-up of 10c934147d469965dba6abc78efd02759a010b8e
    
    Change-Id: I2085173dffd71dbbc68a0574400bebe132626dd9
    Reviewed-on: https://gerrit.libreoffice.org/71284
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Jenkins
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>

diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 99201f1d748f..e0fdacb4665f 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -323,7 +323,7 @@ void DrawViewWrapper::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     if( pSdrModel && pSdrModel->isLocked() )
         return;
 
-    const SdrHint* pSdrHint = dynamic_cast< const SdrHint* >( &rHint );
+    const SdrHint* pSdrHint = ( rHint.GetId() == SfxHintId::ThisIsAnSdrHint ? static_cast<const SdrHint*>(&rHint) : nullptr );
 
     //#i76053# do nothing when only changes on the hidden draw page were made ( e.g. when the symbols for the dialogs are created )
     SdrPageView* pSdrPageView = GetPageView();
diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx
index 88fb69043cc1..dea02a4fc359 100644
--- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx
+++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx
@@ -298,7 +298,7 @@ namespace accessibility
 
     void AccessibleEmptyEditSource::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
     {
-        const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
+        const SdrHint* pSdrHint = ( rHint.GetId() == SfxHintId::ThisIsAnSdrHint ? static_cast<const SdrHint*>(&rHint) : nullptr );
 
         if( pSdrHint && pSdrHint->GetKind() == SdrHintKind::BeginEdit &&
             &mrObj == pSdrHint->GetObject() && mpEditSource.get() )
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
index 8eae723f0653..f48771522017 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -1132,17 +1132,49 @@ namespace accessibility
             {
                 const SfxHint& rHint = *pHint;
 
-                // determine hint type
-                const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint );
-                const TextHint* pTextHint = dynamic_cast<const TextHint*>( &rHint );
-                const SvxViewChangedHint* pViewHint = dynamic_cast<const SvxViewChangedHint*>( &rHint );
-                const SvxEditSourceHint* pEditSourceHint = dynamic_cast<const SvxEditSourceHint*>( &rHint );
 
                 try
                 {
-                    const sal_Int32 nParas = GetTextForwarder().GetParagraphCount();
 
-                    if( pEditSourceHint )
+                    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
+                    {
+                        const SdrHint* pSdrHint = static_cast< const SdrHint* >( &rHint );
+
+                        switch( pSdrHint->GetKind() )
+                        {
+                            case SdrHintKind::BeginEdit:
+                            {
+                                if(!IsActive())
+                                {
+                                    break;
+                                }
+                                // change children state
+                                maParaManager.SetActive();
+
+                                // per definition, edit mode text has the focus
+                                SetFocus( true );
+                                break;
+                            }
+
+                            case SdrHintKind::EndEdit:
+                            {
+                                // focused child now loses focus
+                                ESelection aSelection;
+                                if( GetEditViewForwarder().GetSelection( aSelection ) )
+                                    SetChildFocus( aSelection.nEndPara, false );
+
+                                // change children state
+                                maParaManager.SetActive( false );
+
+                                maLastSelection = ESelection( EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND,
+                                                              EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
+                                break;
+                            }
+                            default:
+                                break;
+                        }
+                    }
+                    else if( const SvxEditSourceHint* pEditSourceHint = dynamic_cast<const SvxEditSourceHint*>( &rHint ) )
                     {
                         switch( pEditSourceHint->GetId() )
                         {
@@ -1176,8 +1208,10 @@ namespace accessibility
                             default: break;
                         }
                     }
-                    else if( pTextHint )
+                    else if( const TextHint* pTextHint = dynamic_cast<const TextHint*>( &rHint ) )
                     {
+                        const sal_Int32 nParas = GetTextForwarder().GetParagraphCount();
+
                         switch( pTextHint->GetId() )
                         {
                             case SfxHintId::TextModified:
@@ -1226,48 +1260,12 @@ namespace accessibility
                         UpdateVisibleChildren();
                         UpdateBoundRect();
                     }
-                    else if( pViewHint )
+                    else if ( dynamic_cast<const SvxViewChangedHint*>( &rHint ) )
                     {
                         // just check visibility
                         UpdateVisibleChildren();
                         UpdateBoundRect();
                     }
-                    else if( pSdrHint )
-                    {
-                        switch( pSdrHint->GetKind() )
-                        {
-                            case SdrHintKind::BeginEdit:
-                            {
-                                if(!IsActive())
-                                {
-                                    break;
-                                }
-                                // change children state
-                                maParaManager.SetActive();
-
-                                // per definition, edit mode text has the focus
-                                SetFocus( true );
-                                break;
-                            }
-
-                            case SdrHintKind::EndEdit:
-                            {
-                                // focused child now loses focus
-                                ESelection aSelection;
-                                if( GetEditViewForwarder().GetSelection( aSelection ) )
-                                    SetChildFocus( aSelection.nEndPara, false );
-
-                                // change children state
-                                maParaManager.SetActive( false );
-
-                                maLastSelection = ESelection( EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND,
-                                                              EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
-                                break;
-                            }
-                            default:
-                                break;
-                        }
-                    }
                     // it's VITAL to keep the SfxSimpleHint last! It's the base of some classes above!
                     else if( rHint.GetId() == SfxHintId::Dying)
                     {
@@ -1306,22 +1304,23 @@ namespace accessibility
             // occurrence to avoid unnecessary dynamic_cast. Note that
             // SvxEditSourceHint is derived from TextHint, so has to be checked
             // before that.
-            if( const SvxViewChangedHint* pViewHint = dynamic_cast<const SvxViewChangedHint*>( &rHint ) )
-            {
-                // process visibility right away, if not within an
-                // open EE notification frame. Otherwise, event
-                // processing would be delayed until next EE
-                // notification sequence.
-                maEventQueue.Append( *pViewHint );
-            }
-            else if( const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>( &rHint ) )
+            if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
             {
+                const SdrHint* pSdrHint = static_cast< const SdrHint* >( &rHint );
                 // process drawing layer events right away, if not
                 // within an open EE notification frame. Otherwise,
                 // event processing would be delayed until next EE
                 // notification sequence.
                 maEventQueue.Append( *pSdrHint );
             }
+            else if( const SvxViewChangedHint* pViewHint = dynamic_cast<const SvxViewChangedHint*>( &rHint ) )
+            {
+                // process visibility right away, if not within an
+                // open EE notification frame. Otherwise, event
+                // processing would be delayed until next EE
+                // notification sequence.
+                maEventQueue.Append( *pViewHint );
+            }
             else if( const SvxEditSourceHint* pEditSourceHint = dynamic_cast<const SvxEditSourceHint*>( &rHint ) )
             {
                 // EditEngine should emit TEXT_SELECTION_CHANGED events (#i27299#)
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 1538caf3af4e..0e2d11846d0c 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -1609,7 +1609,8 @@ void SdrEdgeObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     SdrTextObj::Notify(rBC,rHint);
     if (nNotifyingCount==0) { // a locking flag
         nNotifyingCount++;
-        const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
+        const SdrHint* pSdrHint = ( rHint.GetId() == SfxHintId::ThisIsAnSdrHint ? static_cast<const SdrHint*>(&rHint) : nullptr );
+
         if (bDataChg) { // StyleSheet changed
             ImpSetAttrToEdgeInfo(); // when changing templates, copy values from Pool to aEdgeInfo
         }


More information about the Libreoffice-commits mailing list