summaryrefslogtreecommitdiff
path: root/svx/source/accessibility
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2019-04-25 10:41:12 +0200
committerXisco FaulĂ­ <xiscofauli@libreoffice.org>2019-04-25 15:22:04 +0200
commit7ec3baef938d62d16558b7ee7fd84eb02b206551 (patch)
tree0e3c8a13938989ae681ddda8c101aa10ec9fef46 /svx/source/accessibility
parent982137545d5263bfcc28e896708ec851b8bcce99 (diff)
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@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
Diffstat (limited to 'svx/source/accessibility')
-rw-r--r--svx/source/accessibility/AccessibleEmptyEditSource.cxx2
-rw-r--r--svx/source/accessibility/AccessibleTextHelper.cxx107
2 files changed, 54 insertions, 55 deletions
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#)