[Libreoffice-commits] core.git: sc/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 25 16:22:42 UTC 2019


 sc/source/ui/view/drawvie3.cxx |   14 +++++++-------
 sc/source/ui/view/prevwsh2.cxx |   16 ++++++++--------
 2 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit f9fef3b54a474f756aa06f156f5c61fea609c07e
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Apr 25 11:38:52 2019 +0200
Commit:     Xisco FaulĂ­ <xiscofauli at libreoffice.org>
CommitDate: Thu Apr 25 18:21:51 2019 +0200

    Re-arrange the conditions to avoid the dynamic_cast
    
    Similar to 88be8aa14d52ad102dc6b01c1c962d4e6cac4941
    
    Change-Id: Ia6f725fd6c6cee3135191a998ea43c1e6f90fc23
    Reviewed-on: https://gerrit.libreoffice.org/71287
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Jenkins
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>

diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx
index 6fcf91da5542..a1b02bdc265f 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -176,7 +176,13 @@ void adjustAnchoredPosition(const SdrHint& rHint, const ScDocument& rDoc, SCTAB
 
 void ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 {
-    if (dynamic_cast<const ScTabDeletedHint*>(&rHint))                        // Sheet has been deleted
+    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
+    {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint );
+        adjustAnchoredPosition(*pSdrHint, *pDoc, nTab);
+        FmFormView::Notify( rBC,rHint );
+    }
+    else if (dynamic_cast<const ScTabDeletedHint*>(&rHint))                        // Sheet has been deleted
     {
         SCTAB nDelTab = static_cast<const ScTabDeletedHint&>(rHint).GetTab();
         if (ValidTab(nDelTab))
@@ -191,12 +197,6 @@ void ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
         if ( nTab == static_cast<const ScTabSizeChangedHint&>(rHint).GetTab() )
             UpdateWorkArea();
     }
-    else if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
-    {
-        const SdrHint* pSdrHint = static_cast<const SdrHint*>( &rHint );
-        adjustAnchoredPosition(*pSdrHint, *pDoc, nTab);
-        FmFormView::Notify( rBC,rHint );
-    }
     else
         FmFormView::Notify( rBC,rHint );
 }
diff --git a/sc/source/ui/view/prevwsh2.cxx b/sc/source/ui/view/prevwsh2.cxx
index b1066328816f..8a4e5212b512 100644
--- a/sc/source/ui/view/prevwsh2.cxx
+++ b/sc/source/ui/view/prevwsh2.cxx
@@ -30,7 +30,14 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
     bool bDataChanged = false;
 
-    if (const ScPaintHint* pPaintHint = dynamic_cast<const ScPaintHint*>(&rHint))
+    if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
+    {
+        const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
+        // SdrHints are no longer used for invalidating, thus react on objectchange instead
+        if(SdrHintKind::ObjectChange == pSdrHint->GetKind())
+            bDataChanged = true;
+    }
+    else if (const ScPaintHint* pPaintHint = dynamic_cast<const ScPaintHint*>(&rHint))
     {
         if ( pPaintHint->GetPrintFlag() )
         {
@@ -39,13 +46,6 @@ void ScPreviewShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                 bDataChanged = true;
         }
     }
-    else if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
-    {
-        const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
-        // SdrHints are no longer used for invalidating, thus react on objectchange instead
-        if(SdrHintKind::ObjectChange == pSdrHint->GetKind())
-            bDataChanged = true;
-    }
     else
     {
         switch ( rHint.GetId() )


More information about the Libreoffice-commits mailing list