Kaydet (Commit) c7b74fd0 authored tarafından Michael Stahl's avatar Michael Stahl

sw: remove CHECK_FOR_DEFUNC macros

Change-Id: I317b5fcd6e5753b4f854930ed4f4ceea53a385c4
üst f135a8bd
......@@ -341,7 +341,8 @@ SwFrameFormat* SwAccessibleCell::GetTableBoxFormat() const
uno::Any SwAccessibleCell::getCurrentValue( )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleValue );
ThrowIfDisposed();
return uno::Any( GetTableBoxFormat()->GetTableBoxValue().GetValue() );
}
......@@ -349,7 +350,8 @@ uno::Any SwAccessibleCell::getCurrentValue( )
sal_Bool SwAccessibleCell::setCurrentValue( const uno::Any& aNumber )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleValue );
ThrowIfDisposed();
double fValue = 0;
bool bValid = (aNumber >>= fValue);
......
......@@ -530,6 +530,15 @@ bool SwAccessibleContext::IsEditableState()
return bRet;
}
void SwAccessibleContext::ThrowIfDisposed()
{
if (!(GetFrame() && GetMap()))
{
throw lang::DisposedException("object is nonfunctional",
static_cast<cppu::OWeakObject*>(this));
}
}
SwAccessibleContext::SwAccessibleContext(std::shared_ptr<SwAccessibleMap> const& pMap,
sal_Int16 const nRole,
const SwFrame *pF )
......@@ -571,7 +580,8 @@ sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleChildCount()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
//Notify the frame is a document
if (m_nRole == AccessibleRole::DOCUMENT_TEXT)
m_bIsAccDocUse = true;
......@@ -584,7 +594,7 @@ uno::Reference< XAccessible> SAL_CALL
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
//Notify the frame is a document
if (m_nRole == AccessibleRole::DOCUMENT_TEXT)
......@@ -631,7 +641,7 @@ uno::Reference< XAccessible> SAL_CALL SwAccessibleContext::getAccessibleParent()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
const SwFrame *pUpper = GetParent();
OSL_ENSURE( pUpper != nullptr || m_isDisposing, "no upper found" );
......@@ -655,7 +665,7 @@ sal_Int32 SAL_CALL SwAccessibleContext::getAccessibleIndexInParent()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
const SwFrame *pUpper = GetParent();
OSL_ENSURE( pUpper != nullptr || m_isDisposing, "no upper found" );
......@@ -696,7 +706,7 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
::utl::AccessibleStateSetHelper *pStateSet =
new ::utl::AccessibleStateSetHelper;
......@@ -776,7 +786,7 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleComponent )
ThrowIfDisposed();
uno::Reference< XAccessible > xAcc;
......@@ -834,7 +844,7 @@ awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(bool bRelative)
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleComponent )
ThrowIfDisposed();
const SwFrame *pParent = GetParent();
OSL_ENSURE( pParent, "no Parent found" );
......@@ -923,7 +933,7 @@ void SAL_CALL SwAccessibleContext::grabFocus()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext );
ThrowIfDisposed();;
if( GetFrame()->IsFlyFrame() )
{
......
......@@ -197,6 +197,8 @@ protected:
}
void RemoveFrameFromAccessibleMap();
void ThrowIfDisposed();
virtual ~SwAccessibleContext() override;
public:
......@@ -351,19 +353,6 @@ public:
const OUString *pArg2 = nullptr );
};
#define CHECK_FOR_DEFUNC_THIS( ifc, ths ) \
if( !(GetFrame() && GetMap()) ) \
{ \
css::uno::Reference < ifc > xThis( ths ); \
css::lang::DisposedException aExcept( \
"object is nonfunctional", \
xThis ); \
throw aExcept; \
}
#define CHECK_FOR_DEFUNC( ifc ) \
CHECK_FOR_DEFUNC_THIS( ifc, this )
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -137,7 +137,7 @@ sal_Int32 SAL_CALL SwAccessibleDocumentBase::getAccessibleChildCount()
{
SolarMutexGuard aGuard;
// CHECK_FOR_DEFUNC is called by parent
// ThrowIfDisposed is called by parent
sal_Int32 nChildren = SwAccessibleContext::getAccessibleChildCount();
if( !IsDisposing() && mpChildWin )
......@@ -153,7 +153,8 @@ uno::Reference< XAccessible> SAL_CALL
if( mpChildWin )
{
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
if ( nIndex == GetChildCount( *(GetMap()) ) )
{
return mpChildWin->GetAccessible();
......@@ -320,7 +321,7 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleDocumentBase::getAccessibleAt
if( mpChildWin )
{
CHECK_FOR_DEFUNC( XAccessibleComponent )
ThrowIfDisposed();
vcl::Window *pWin = GetWindow();
if (!pWin)
......
......@@ -70,7 +70,7 @@ OUString SAL_CALL SwAccessibleFootnote::getAccessibleDescription()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
sal_uInt16 nResId = AccessibleRole::END_NOTE == GetRole()
? STR_ACCESS_ENDNOTE_DESC
......
......@@ -61,7 +61,7 @@ OUString SAL_CALL SwAccessibleHeaderFooter::getAccessibleDescription()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
sal_uInt16 nResId = AccessibleRole::HEADER == GetRole()
? STR_ACCESS_HEADER_DESC
......
......@@ -176,7 +176,7 @@ OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleName()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
if ( !msTitle.isEmpty() )
{
......@@ -190,7 +190,7 @@ OUString SAL_CALL SwAccessibleNoTextFrame::getAccessibleDescription()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
return msDesc;
}
......@@ -294,7 +294,7 @@ sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkCount()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleHypertext );
ThrowIfDisposed();
sal_Int32 nCount = 0;
SwFormatURL aURL( static_cast<const SwLayoutFrame*>(GetFrame())->GetFormat()->GetURL() );
......@@ -309,7 +309,8 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
SwAccessibleNoTextFrame::getHyperLink( sal_Int32 nLinkIndex )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleHypertext );
ThrowIfDisposed();
uno::Reference< XAccessibleHyperlink > xRet;
......
......@@ -158,7 +158,7 @@ Sequence< sal_Int8 > SAL_CALL SwAccessiblePage::getImplementationId()
OUString SwAccessiblePage::getAccessibleDescription( )
{
CHECK_FOR_DEFUNC( css::accessibility::XAccessibleContext );
ThrowIfDisposed();
OUString sArg( GetFormattedPageNumber() );
return GetResource( STR_ACCESS_PAGE_DESC, &sArg );
......
......@@ -909,7 +909,7 @@ OUString SAL_CALL SwAccessibleTable::getAccessibleDescription()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
return m_sDesc;
}
......@@ -918,7 +918,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowCount()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
return GetTableData().GetRowCount();
}
......@@ -927,7 +927,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumnCount( )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
return GetTableData().GetColumnCount();
}
......@@ -1005,7 +1005,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRowExtentAt(
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
UpdateTableData();
GetTableData().CheckRowAndCol( nRow, nColumn, this );
......@@ -1035,7 +1035,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumnExtentAt(
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
UpdateTableData();
GetTableData().CheckRowAndCol( nRow, nColumn, this );
......@@ -1088,7 +1088,7 @@ uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleRows
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
const SwSelBoxes *pSelBoxes = GetSelBoxes();
if( pSelBoxes )
......@@ -1111,7 +1111,7 @@ uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleColu
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
const SwSelBoxes *pSelBoxes = GetSelBoxes();
if( pSelBoxes )
......@@ -1133,7 +1133,7 @@ sal_Bool SAL_CALL SwAccessibleTable::isAccessibleRowSelected( sal_Int32 nRow )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
GetTableData().CheckRowAndCol( nRow, 0, this );
......@@ -1159,7 +1159,7 @@ sal_Bool SAL_CALL SwAccessibleTable::isAccessibleColumnSelected(
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
GetTableData().CheckRowAndCol( 0, nColumn, this );
......@@ -1188,7 +1188,7 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleTable::getAccessibleCellAt(
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
const SwFrame *pCellFrame =
GetTableData().GetCell( nRow, nColumn, this );
......@@ -1217,7 +1217,7 @@ sal_Bool SAL_CALL SwAccessibleTable::isAccessibleSelected(
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
const SwFrame *pFrame =
GetTableData().GetCell( nRow, nColumn, this );
......@@ -1243,7 +1243,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleIndex(
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
SwAccessibleChild aCell( GetTableData().GetCell( nRow, nColumn, this ));
if ( aCell.IsValid() )
......@@ -1260,7 +1260,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleRow( sal_Int32 nChildIndex )
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
// #i77106#
if ( ( nChildIndex < 0 ) ||
......@@ -1297,7 +1297,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getAccessibleColumn(
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable )
ThrowIfDisposed();
// #i77106#
if ( ( nChildIndex < 0 ) ||
......@@ -1461,7 +1461,8 @@ void SAL_CALL SwAccessibleTable::selectAccessibleChild(
sal_Int32 nChildIndex )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable );
ThrowIfDisposed();
if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) ) // #i77106#
throw lang::IndexOutOfBoundsException();
......@@ -1539,7 +1540,8 @@ sal_Bool SAL_CALL SwAccessibleTable::isAccessibleChildSelected(
sal_Int32 nChildIndex )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable );
ThrowIfDisposed();
if( (nChildIndex < 0) || (nChildIndex >= getAccessibleChildCount()) ) // #i77106#
throw lang::IndexOutOfBoundsException();
......@@ -1551,7 +1553,7 @@ void SAL_CALL SwAccessibleTable::clearAccessibleSelection( )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable );
ThrowIfDisposed();
SwCursorShell* pCursorShell = GetCursorShell();
if( pCursorShell != nullptr )
......@@ -1573,7 +1575,8 @@ void SAL_CALL SwAccessibleTable::selectAllAccessibleChildren( )
sal_Int32 SAL_CALL SwAccessibleTable::getSelectedAccessibleChildCount( )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable );
ThrowIfDisposed();
// iterate over all children and count isAccessibleChildSelected()
sal_Int32 nCount = 0;
......@@ -1590,7 +1593,8 @@ uno::Reference<XAccessible> SAL_CALL SwAccessibleTable::getSelectedAccessibleChi
sal_Int32 nSelectedChildIndex )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable );
ThrowIfDisposed();
// parameter checking (part 1): index lower 0
if( nSelectedChildIndex < 0 )
......@@ -1616,7 +1620,8 @@ void SAL_CALL SwAccessibleTable::deselectAccessibleChild(
sal_Int32 nChildIndex )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleTable );
ThrowIfDisposed();
SwCursorShell* pCursorShell = GetCursorShell();
......@@ -1850,7 +1855,7 @@ sal_Int32 SAL_CALL SwAccessibleTableColHeaders::getAccessibleChildCount()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
sal_Int32 nCount = 0;
......
......@@ -244,7 +244,7 @@ OUString SAL_CALL SwAccessibleTextFrame::getAccessibleName()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
if ( !msTitle.isEmpty() )
{
......@@ -258,7 +258,7 @@ OUString SAL_CALL SwAccessibleTextFrame::getAccessibleDescription()
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext )
ThrowIfDisposed();
return msDesc;
......@@ -313,7 +313,8 @@ AccessibleRelation SwAccessibleTextFrame::makeRelation( sal_Int16 nType, const S
uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleTextFrame::getAccessibleRelationSet( )
{
SolarMutexGuard aGuard;
CHECK_FOR_DEFUNC( XAccessibleContext );
ThrowIfDisposed();
// get the frame, and insert prev/next relations into helper
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment