summaryrefslogtreecommitdiff
path: root/svx/source/accessibility
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-10-26 14:59:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-10-27 06:09:29 +0000
commit883172375dbf5c0a79cbda5b615ff26ed27c78be (patch)
tree5d81ab1b28e7509a26148b602fd14f8c5c83642f /svx/source/accessibility
parenta7ea18ffe715776cb0e2b39e98569c75605ee332 (diff)
loplugin:expandablemethods in svx
Change-Id: I0d193ddf07cc0ddc89b6ce2df6eb71d44e49b631 Reviewed-on: https://gerrit.libreoffice.org/30295 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/accessibility')
-rw-r--r--svx/source/accessibility/AccessibleControlShape.cxx7
-rw-r--r--svx/source/accessibility/AccessibleFrameSelector.cxx12
-rw-r--r--svx/source/accessibility/AccessibleShape.cxx22
-rw-r--r--svx/source/accessibility/AccessibleTextHelper.cxx3
-rw-r--r--svx/source/accessibility/GraphCtlAccessibleContext.cxx7
-rw-r--r--svx/source/accessibility/charmapacc.cxx12
-rw-r--r--svx/source/accessibility/svxpixelctlaccessiblecontext.cxx31
-rw-r--r--svx/source/accessibility/svxrectctaccessiblecontext.cxx25
8 files changed, 28 insertions, 91 deletions
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx
index cec02252bf76..faa18daad23b 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -138,11 +138,6 @@ AccessibleControlShape::~AccessibleControlShape()
// ourself) to this proxy, and thus delete it
}
-SdrObject* AccessibleControlShape::getSdrObject() const
-{
- return GetSdrObjectFromXShape (mxShape);
-}
-
namespace {
Reference< XContainer > lcl_getControlContainer( const vcl::Window* _pWin, const SdrView* _pView )
{
@@ -188,7 +183,7 @@ void AccessibleControlShape::Init()
// get the control which belongs to our model (relative to our view)
const vcl::Window* pViewWindow = maShapeTreeInfo.GetWindow();
- SdrUnoObj* pUnoObjectImpl = dynamic_cast<SdrUnoObj*>( getSdrObject() );
+ SdrUnoObj* pUnoObjectImpl = dynamic_cast<SdrUnoObj*>( GetSdrObjectFromXShape(mxShape) );
SdrView* pView = maShapeTreeInfo.GetSdrView();
OSL_ENSURE( pView && pViewWindow && pUnoObjectImpl, "AccessibleControlShape::Init: no view, or no view window, no SdrUnoObj!" );
diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx
index 6ecb7978f64d..26ae123968d0 100644
--- a/svx/source/accessibility/AccessibleFrameSelector.cxx
+++ b/svx/source/accessibility/AccessibleFrameSelector.cxx
@@ -483,16 +483,10 @@ IMPL_LINK( AccFrameSelector, WindowEventListener, VclWindowEvent&, rEvent, void
{
vcl::Window* pWindow = rEvent.GetWindow();
DBG_ASSERT( pWindow, "AccFrameSelector::WindowEventListener: no window!" );
- if ( !pWindow->IsAccessibilityEventsSuppressed() || ( rEvent.GetId() == VCLEVENT_OBJECT_DYING ) )
- {
- ProcessWindowEvent( rEvent );
- }
-}
+ if ( pWindow->IsAccessibilityEventsSuppressed() && ( rEvent.GetId() != VCLEVENT_OBJECT_DYING ) )
+ return;
-
-void AccFrameSelector::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
-{
- switch ( rVclWindowEvent.GetId() )
+ switch ( rEvent.GetId() )
{
case VCLEVENT_WINDOW_GETFOCUS:
{
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index ca132f96520f..c1c39beb4cb4 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -485,7 +485,12 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
xStateSet.set( new ::utl::AccessibleStateSetHelper (*pStateSet));
}
}
- UpdateDocumentAllSelState(xStateSet);
+ if (mpParent && mpParent->IsDocumentSelAll())
+ {
+ ::utl::AccessibleStateSetHelper* pStateSet =
+ static_cast< ::utl::AccessibleStateSetHelper*>(xStateSet.get());
+ pStateSet->AddState (AccessibleStateType::SELECTED);
+ }
return xStateSet;
}
@@ -1332,21 +1337,6 @@ sal_Int16 SAL_CALL AccessibleShape::getAccessibleRole()
}
-void AccessibleShape::UpdateDocumentAllSelState(Reference<XAccessibleStateSet> &xStateSet)
-{
- if (mpParent && mpParent->IsDocumentSelAll())
- {
- ::utl::AccessibleStateSetHelper* pStateSet =
- static_cast< ::utl::AccessibleStateSetHelper*>(xStateSet.get());
- pStateSet->AddState (AccessibleStateType::SELECTED);
-
- //uno::Any NewValue;
- //NewValue <<= AccessibleStateType::SELECTED;
-
- //CommitChange(AccessibleEventId::STATE_CHANGED,NewValue,uno::Any());
- }
-}
-
//sort the drawing objects from up to down, from left to right
struct XShapePosCompareHelper
{
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
index f0bdc4c67b37..7bfce1f59169 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -171,7 +171,6 @@ namespace accessibility
// syntactic sugar for FireEvent
void GotPropertyEvent( const uno::Any& rNewValue, const sal_Int16 nEventId ) const { FireEvent( nEventId, rNewValue ); }
- void LostPropertyEvent( const uno::Any& rOldValue, const sal_Int16 nEventId ) const { FireEvent( nEventId, uno::Any(), rOldValue ); }
// shutdown usage of current edit source on myself and the children.
void ShutdownEditSource();
@@ -437,7 +436,7 @@ namespace accessibility
{
AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() );
if ( !pAccessibleCell )
- LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
+ FireEvent( AccessibleEventId::STATE_CHANGED, uno::Any(), uno::makeAny(AccessibleStateType::FOCUSED) );
else
{
AccessibleTableShape* pAccTable = pAccessibleCell->GetParentTable();
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index 7e6b09cdbfda..261bb8cc1579 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -276,17 +276,10 @@ void SvxGraphCtrlAccessibleContext::CommitChange (
rNewValue,
rOldValue);
- FireEvent (aEvent);
-}
-
-/** sends an AccessibleEventObject to all added XAccessibleEventListeners */
-void SvxGraphCtrlAccessibleContext::FireEvent (const AccessibleEventObject& aEvent)
-{
if (mnClientId)
comphelper::AccessibleEventNotifier::addEvent( mnClientId, aEvent );
}
-
Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleChild( sal_Int32 nIndex )
throw( RuntimeException, lang::IndexOutOfBoundsException, std::exception )
{
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx
index 076179960179..97f523c5b552 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -236,7 +236,8 @@ SvxShowCharSetItem::~SvxShowCharSetItem()
if ( m_xAcc.is() )
{
m_pItem->ParentDestroyed();
- ClearAccessible();
+ m_pItem = nullptr;
+ m_xAcc = nullptr;
}
}
@@ -253,15 +254,6 @@ uno::Reference< css::accessibility::XAccessible > const & SvxShowCharSetItem::Ge
}
-void SvxShowCharSetItem::ClearAccessible()
-{
- if ( m_xAcc.is() )
- {
- m_pItem = nullptr;
- m_xAcc = nullptr;
- }
-}
-
SvxShowCharSetAcc::SvxShowCharSetAcc( SvxShowCharSetVirtualAcc* _pParent ) : OAccessibleSelectionHelper(new VCLExternalSolarLock())
,m_pParent( _pParent )
diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
index 4aa8168f91a2..83dd81b2242f 100644
--- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
+++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
@@ -222,7 +222,8 @@ uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoin
throw (uno::RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
- ensureIsAlive();
+ if( !IsAlive() )
+ throw lang::DisposedException();
uno::Reference <XAccessible> xAcc;
Point childPoint;
@@ -364,14 +365,6 @@ void SAL_CALL SvxPixelCtlAccessible::deselectAccessibleChild( sal_Int32 ) throw
{
}
-// Added by lq
-void SvxPixelCtlAccessible::ensureIsAlive() const
- throw ( lang::DisposedException )
-{
- if( !IsAlive() )
- throw lang::DisposedException();
-}
-
//XAccessibleEventBroadcaster
void SAL_CALL SvxPixelCtlAccessible::addAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw( RuntimeException, std::exception )
{
@@ -399,17 +392,13 @@ void SAL_CALL SvxPixelCtlAccessible::removeAccessibleEventListener( const uno::R
}
}
}
-void SvxPixelCtlAccessible::CommitChange( const AccessibleEventObject& rEvent )
-{
- if (mnClientId)
- comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
-}
//Solution:Add the event handling method
void SvxPixelCtlAccessible::FireAccessibleEvent (short nEventId, const css::uno::Any& rOld, const css::uno::Any& rNew)
{
const uno::Reference< XInterface > xSource( *this );
- CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) );
+ if (mnClientId)
+ comphelper::AccessibleEventNotifier::addEvent( mnClientId, AccessibleEventObject( xSource, nEventId, rNew,rOld ) );
}
void SAL_CALL SvxPixelCtlAccessible::disposing()
@@ -543,7 +532,8 @@ void SvxPixelCtlAccessibleChild::FireAccessibleEvent (
const css::uno::Any& rNew)
{
const uno::Reference< XInterface > xSource( *this );
- CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) );
+ if (mnClientId)
+ comphelper::AccessibleEventNotifier::addEvent( mnClientId, AccessibleEventObject( xSource, nEventId, rNew,rOld ) );
}
SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild(
@@ -788,13 +778,6 @@ Sequence< OUString > SAL_CALL SvxPixelCtlAccessibleChild::getSupportedServiceNam
return aRet;
}
-// internal
-void SvxPixelCtlAccessibleChild::CommitChange( const AccessibleEventObject& rEvent )
-{
- if (mnClientId)
- comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
-}
-
void SAL_CALL SvxPixelCtlAccessibleChild::disposing()
{
if( !rBHelper.bDisposed )
@@ -816,7 +799,7 @@ void SAL_CALL SvxPixelCtlAccessibleChild::disposing()
void SvxPixelCtlAccessibleChild::ThrowExceptionIfNotAlive() throw( lang::DisposedException )
{
- if( IsNotAlive() )
+ if( rBHelper.bDisposed || rBHelper.bInDispose )
throw lang::DisposedException();
}
diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
index 828166bf767f..64734aecff9e 100644
--- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx
+++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
@@ -529,7 +529,9 @@ Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getSelectedAccess
{
::osl::MutexGuard aGuard( m_aMutex );
- checkChildIndexOnSelection( nIndex );
+ if( nIndex || mnSelectedChild == NOCHILDSELECTED )
+ // in our case only for the first (0) _selected_ child this is a valid request
+ throw lang::IndexOutOfBoundsException();
return getAccessibleChild( mnSelectedChild );
}
@@ -550,13 +552,6 @@ void SvxRectCtlAccessibleContext::checkChildIndex( long nIndex ) throw( lang::In
throw lang::IndexOutOfBoundsException();
}
-void SvxRectCtlAccessibleContext::checkChildIndexOnSelection( long nIndex ) throw( lang::IndexOutOfBoundsException )
-{
- if( nIndex || mnSelectedChild == NOCHILDSELECTED )
- // in our case only for the first (0) _selected_ child this is a valid request
- throw lang::IndexOutOfBoundsException();
-}
-
void SvxRectCtlAccessibleContext::FireChildFocus( RectPoint eButton )
{
::osl::MutexGuard aGuard( m_aMutex );
@@ -580,7 +575,9 @@ void SvxRectCtlAccessibleContext::FireChildFocus( RectPoint eButton )
Any aOld;
Any aNew;
aNew <<= AccessibleStateType::FOCUSED;
- CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
+ if (mnClientId)
+ comphelper::AccessibleEventNotifier::addEvent( mnClientId,
+ AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
}
}
else
@@ -623,12 +620,6 @@ void SvxRectCtlAccessibleContext::selectChild(RectPoint eButton )
selectChild(PointToIndex( eButton, mbAngleMode ));
}
-void SvxRectCtlAccessibleContext::CommitChange( const AccessibleEventObject& rEvent )
-{
- if (mnClientId)
- comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
-}
-
void SAL_CALL SvxRectCtlAccessibleContext::disposing()
{
if( !rBHelper.bDisposed )
@@ -690,7 +681,7 @@ Rectangle SvxRectCtlAccessibleContext::GetBoundingBox() throw( RuntimeException
void SvxRectCtlAccessibleContext::ThrowExceptionIfNotAlive() throw( lang::DisposedException )
{
- if( IsNotAlive() )
+ if( rBHelper.bDisposed || rBHelper.bInDispose )
throw lang::DisposedException();
}
@@ -1046,7 +1037,7 @@ void SAL_CALL SvxRectCtlChildAccessibleContext::disposing()
void SvxRectCtlChildAccessibleContext::ThrowExceptionIfNotAlive() throw( lang::DisposedException )
{
- if( IsNotAlive() )
+ if( rBHelper.bDisposed || rBHelper.bInDispose )
throw lang::DisposedException();
}