diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-03-24 17:34:47 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-03-24 18:00:45 +0100 |
commit | c1f5339c169c893e63c0de25d0cad3029b475d1b (patch) | |
tree | 1d847c4a17f8c46debedfa8be10e548163e93324 /sw | |
parent | a18fa6973fbfac8f9da738a2fbc5da3cb698d108 (diff) |
sw: remove CHECK_FOR_WINDOW macro
Change-Id: Ie375b199e055a01b0888a6efe56ef3a2801412b2
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/access/acccontext.cxx | 19 | ||||
-rw-r--r-- | sw/source/core/access/acccontext.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/access/accdoc.cxx | 35 | ||||
-rw-r--r-- | sw/source/core/access/accpara.cxx | 20 |
4 files changed, 56 insertions, 23 deletions
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index c125729c0bec..f93cc5d2c1e0 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -787,7 +787,10 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint uno::Reference< XAccessible > xAcc; vcl::Window *pWin = GetWindow(); - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ) + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to parent if( !GetFrame()->IsRootFrame() ) @@ -843,7 +846,14 @@ awt::Rectangle SAL_CALL SwAccessibleContext::getBoundsImpl(bool bRelative) OSL_ENSURE( pParent, "no Parent found" ); vcl::Window *pWin = GetWindow(); - CHECK_FOR_WINDOW( XAccessibleComponent, pWin && pParent ) + if (!pParent) + { + throw uno::RuntimeException("no Parent", static_cast<cppu::OWeakObject*>(this)); + } + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip rel to doc root Rectangle aPixBounds( 0, 0, 0, 0 ); @@ -896,7 +906,10 @@ awt::Point SAL_CALL SwAccessibleContext::getLocationOnScreen() Point aPixPos(aRect.X, aRect.Y); vcl::Window *pWin = GetWindow(); - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ) + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } aPixPos = pWin->OutputToAbsoluteScreenPixel(aPixPos); awt::Point aPoint(aPixPos.getX(), aPixPos.getY()); diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx index b87f00ae6f00..a9aeffec8550 100644 --- a/sw/source/core/access/acccontext.hxx +++ b/sw/source/core/access/acccontext.hxx @@ -380,11 +380,6 @@ public: #define CHECK_FOR_DEFUNC( ifc ) \ CHECK_FOR_DEFUNC_THIS( ifc, this ) -#define CHECK_FOR_WINDOW( i, w ) \ - if( !(w) ) \ - { \ - THROW_RUNTIME_EXCEPTION( i, "window is missing" ); \ - } #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index c332ea858d31..9b5558f295c6 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -230,8 +230,10 @@ awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds() SolarMutexGuard aGuard; vcl::Window *pWin = GetWindow(); - - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ) + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) ); awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(), @@ -250,8 +252,10 @@ awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation() SolarMutexGuard aGuard; vcl::Window *pWin = GetWindow(); - - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ) + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } Point aPixPos( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ).TopLeft() ); awt::Point aLoc( aPixPos.getX(), aPixPos.getY() ); @@ -264,8 +268,10 @@ css::awt::Point SAL_CALL SwAccessibleDocumentBase::getLocationOnScreen() SolarMutexGuard aGuard; vcl::Window *pWin = GetWindow(); - - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ) + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } Point aPixPos( pWin->GetWindowExtentsRelative( nullptr ).TopLeft() ); awt::Point aLoc( aPixPos.getX(), aPixPos.getY() ); @@ -278,8 +284,10 @@ css::awt::Size SAL_CALL SwAccessibleDocumentBase::getSize() SolarMutexGuard aGuard; vcl::Window *pWin = GetWindow(); - - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ) + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } Size aPixSize( pWin->GetWindowExtentsRelative( nullptr ).GetSize() ); awt::Size aSize( aPixSize.Width(), aPixSize.Height() ); @@ -293,8 +301,10 @@ sal_Bool SAL_CALL SwAccessibleDocumentBase::containsPoint( SolarMutexGuard aGuard; vcl::Window *pWin = GetWindow(); - - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ) + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } Rectangle aPixBounds( pWin->GetWindowExtentsRelative( nullptr ) ); aPixBounds.Move(-aPixBounds.Left(), -aPixBounds.Top()); @@ -313,7 +323,10 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleDocumentBase::getAccessibleAt CHECK_FOR_DEFUNC( XAccessibleComponent ) vcl::Window *pWin = GetWindow(); - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ) + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to window if( mpChildWin->GetWindowExtentsRelative( pWin ).IsInside( aPixPoint ) ) diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 0c4e43ef46b1..358472664edf 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1381,7 +1381,10 @@ css::uno::Sequence< css::style::TabStop > SwAccessibleParagraph::GetCurrentTabSt { // translate core coordinates into accessibility coordinates vcl::Window *pWin = GetWindow(); - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ); + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } SwRect aTmpRect(0, 0, tabs[0].Position, 0); @@ -2360,7 +2363,10 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds( // translate core coordinates into accessibility coordinates vcl::Window *pWin = GetWindow(); - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ); + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } Rectangle aScreenRect( GetMap()->CoreToPixel( aCoreRect.SVRect() )); SwRect aFrameLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root @@ -2396,7 +2402,10 @@ sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint ) // construct Point (translate into layout coordinates) vcl::Window *pWin = GetWindow(); - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ); + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } Point aPoint( rPoint.X, rPoint.Y ); SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip rel to doc root Point aPixPos( GetMap()->CoreToPixel( aLogBounds.SVRect() ).TopLeft() ); @@ -3527,7 +3536,10 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret() const SwRect& aCursorCoreRect = pCursorShell->GetCharRect(); // translate core coordinates into accessibility coordinates vcl::Window *pWin = GetWindow(); - CHECK_FOR_WINDOW( XAccessibleComponent, pWin ); + if (!pWin) + { + throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this)); + } Rectangle aScreenRect( GetMap()->CoreToPixel( aCursorCoreRect.SVRect() )); |