Kaydet (Commit) 223bb798 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Some simplifications, using UNO_QUERY_THROW

Change-Id: I1db6d47af232f35a8d8596a7a18c3c3e7a272f4b
Reviewed-on: https://gerrit.libreoffice.org/34253Tested-by: 's avatarStephan Bergmann <sbergman@redhat.com>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 4c02edaf
...@@ -1921,10 +1921,7 @@ void SAL_CALL VCLXToolkit::pause(sal_Int32 nMilliseconds) ...@@ -1921,10 +1921,7 @@ void SAL_CALL VCLXToolkit::pause(sal_Int32 nMilliseconds)
void SAL_CALL VCLXToolkit::keyPress( const css::awt::KeyEvent & aKeyEvent ) void SAL_CALL VCLXToolkit::keyPress( const css::awt::KeyEvent & aKeyEvent )
{ {
css::uno::Reference<css::awt::XWindow> xWindow ( aKeyEvent.Source, css::uno::UNO_QUERY ); css::uno::Reference<css::awt::XWindow> xWindow ( aKeyEvent.Source, css::uno::UNO_QUERY_THROW );
if( !xWindow.is() )
throw css::uno::RuntimeException( "invalid event source" );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow ) if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" ); throw css::uno::RuntimeException( "invalid event source" );
...@@ -1935,10 +1932,7 @@ void SAL_CALL VCLXToolkit::keyPress( const css::awt::KeyEvent & aKeyEvent ) ...@@ -1935,10 +1932,7 @@ void SAL_CALL VCLXToolkit::keyPress( const css::awt::KeyEvent & aKeyEvent )
void SAL_CALL VCLXToolkit::keyRelease( const css::awt::KeyEvent & aKeyEvent ) void SAL_CALL VCLXToolkit::keyRelease( const css::awt::KeyEvent & aKeyEvent )
{ {
css::uno::Reference<css::awt::XWindow> xWindow ( aKeyEvent.Source, css::uno::UNO_QUERY ); css::uno::Reference<css::awt::XWindow> xWindow ( aKeyEvent.Source, css::uno::UNO_QUERY_THROW );
if( !xWindow.is() )
throw css::uno::RuntimeException( "invalid event source" );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow ) if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" ); throw css::uno::RuntimeException( "invalid event source" );
...@@ -1950,10 +1944,7 @@ void SAL_CALL VCLXToolkit::keyRelease( const css::awt::KeyEvent & aKeyEvent ) ...@@ -1950,10 +1944,7 @@ void SAL_CALL VCLXToolkit::keyRelease( const css::awt::KeyEvent & aKeyEvent )
void SAL_CALL VCLXToolkit::mousePress( const css::awt::MouseEvent & aMouseEvent ) void SAL_CALL VCLXToolkit::mousePress( const css::awt::MouseEvent & aMouseEvent )
{ {
css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY ); css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY_THROW );
if( !xWindow.is() )
throw css::uno::RuntimeException( "invalid event source" );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow ) if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" ); throw css::uno::RuntimeException( "invalid event source" );
...@@ -1964,10 +1955,7 @@ void SAL_CALL VCLXToolkit::mousePress( const css::awt::MouseEvent & aMouseEvent ...@@ -1964,10 +1955,7 @@ void SAL_CALL VCLXToolkit::mousePress( const css::awt::MouseEvent & aMouseEvent
void SAL_CALL VCLXToolkit::mouseRelease( const css::awt::MouseEvent & aMouseEvent ) void SAL_CALL VCLXToolkit::mouseRelease( const css::awt::MouseEvent & aMouseEvent )
{ {
css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY ); css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY_THROW );
if( !xWindow.is() )
throw css::uno::RuntimeException( "invalid event source" );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow ) if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" ); throw css::uno::RuntimeException( "invalid event source" );
...@@ -1978,10 +1966,7 @@ void SAL_CALL VCLXToolkit::mouseRelease( const css::awt::MouseEvent & aMouseEven ...@@ -1978,10 +1966,7 @@ void SAL_CALL VCLXToolkit::mouseRelease( const css::awt::MouseEvent & aMouseEven
void SAL_CALL VCLXToolkit::mouseMove( const css::awt::MouseEvent & aMouseEvent ) void SAL_CALL VCLXToolkit::mouseMove( const css::awt::MouseEvent & aMouseEvent )
{ {
css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY ); css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY_THROW );
if( !xWindow.is() )
throw css::uno::RuntimeException( "invalid event source" );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow ) if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" ); throw css::uno::RuntimeException( "invalid event source" );
......
...@@ -704,41 +704,31 @@ void SAL_CALL UnoMultiPageControl::dispose() ...@@ -704,41 +704,31 @@ void SAL_CALL UnoMultiPageControl::dispose()
// css::awt::XSimpleTabController // css::awt::XSimpleTabController
::sal_Int32 SAL_CALL UnoMultiPageControl::insertTab() ::sal_Int32 SAL_CALL UnoMultiPageControl::insertTab()
{ {
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY ); Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
if ( !xMultiPage.is() )
throw RuntimeException();
return xMultiPage->insertTab(); return xMultiPage->insertTab();
} }
void SAL_CALL UnoMultiPageControl::removeTab( ::sal_Int32 ID ) void SAL_CALL UnoMultiPageControl::removeTab( ::sal_Int32 ID )
{ {
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY ); Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
if ( !xMultiPage.is() )
throw RuntimeException();
xMultiPage->removeTab( ID ); xMultiPage->removeTab( ID );
} }
void SAL_CALL UnoMultiPageControl::setTabProps( ::sal_Int32 ID, const Sequence< NamedValue >& Properties ) void SAL_CALL UnoMultiPageControl::setTabProps( ::sal_Int32 ID, const Sequence< NamedValue >& Properties )
{ {
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY ); Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
if ( !xMultiPage.is() )
throw RuntimeException();
xMultiPage->setTabProps( ID, Properties ); xMultiPage->setTabProps( ID, Properties );
} }
Sequence< NamedValue > SAL_CALL UnoMultiPageControl::getTabProps( ::sal_Int32 ID ) Sequence< NamedValue > SAL_CALL UnoMultiPageControl::getTabProps( ::sal_Int32 ID )
{ {
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY ); Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
if ( !xMultiPage.is() )
throw RuntimeException();
return xMultiPage->getTabProps( ID ); return xMultiPage->getTabProps( ID );
} }
void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID ) void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID )
{ {
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY ); Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
if ( !xMultiPage.is() )
throw RuntimeException();
xMultiPage->activateTab( ID ); xMultiPage->activateTab( ID );
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), true ); ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), true );
...@@ -746,9 +736,7 @@ void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID ) ...@@ -746,9 +736,7 @@ void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID )
::sal_Int32 SAL_CALL UnoMultiPageControl::getActiveTabID() ::sal_Int32 SAL_CALL UnoMultiPageControl::getActiveTabID()
{ {
Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY ); Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
if ( !xMultiPage.is() )
throw RuntimeException();
return xMultiPage->getActiveTabID(); return xMultiPage->getActiveTabID();
} }
......
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