[Libreoffice-commits] core.git: 2 commits - toolkit/source uui/source
Stephan Bergmann
sbergman at redhat.com
Wed Feb 15 14:17:04 UTC 2017
toolkit/source/awt/vclxtoolkit.cxx | 25 +++++--------------------
toolkit/source/controls/dialogcontrol.cxx | 24 ++++++------------------
uui/source/iahndl.cxx | 12 ++----------
3 files changed, 13 insertions(+), 48 deletions(-)
New commits:
commit 223bb798f6f1917b926aa2fb293709ef63725a64
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Feb 14 16:09:42 2017 +0100
Some simplifications, using UNO_QUERY_THROW
Change-Id: I1db6d47af232f35a8d8596a7a18c3c3e7a272f4b
Reviewed-on: https://gerrit.libreoffice.org/34253
Tested-by: Stephan Bergmann <sbergman at redhat.com>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 5feba060..2b4f3f8 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1921,10 +1921,7 @@ void SAL_CALL VCLXToolkit::pause(sal_Int32 nMilliseconds)
void SAL_CALL VCLXToolkit::keyPress( const css::awt::KeyEvent & aKeyEvent )
{
- css::uno::Reference<css::awt::XWindow> xWindow ( aKeyEvent.Source, css::uno::UNO_QUERY );
- if( !xWindow.is() )
- throw css::uno::RuntimeException( "invalid event source" );
-
+ css::uno::Reference<css::awt::XWindow> xWindow ( aKeyEvent.Source, css::uno::UNO_QUERY_THROW );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" );
@@ -1935,10 +1932,7 @@ void SAL_CALL VCLXToolkit::keyPress( 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 );
- if( !xWindow.is() )
- throw css::uno::RuntimeException( "invalid event source" );
-
+ css::uno::Reference<css::awt::XWindow> xWindow ( aKeyEvent.Source, css::uno::UNO_QUERY_THROW );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" );
@@ -1950,10 +1944,7 @@ void SAL_CALL VCLXToolkit::keyRelease( const css::awt::KeyEvent & aKeyEvent )
void SAL_CALL VCLXToolkit::mousePress( const css::awt::MouseEvent & aMouseEvent )
{
- css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY );
- if( !xWindow.is() )
- throw css::uno::RuntimeException( "invalid event source" );
-
+ css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY_THROW );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" );
@@ -1964,10 +1955,7 @@ void SAL_CALL VCLXToolkit::mousePress( 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 );
- if( !xWindow.is() )
- throw css::uno::RuntimeException( "invalid event source" );
-
+ css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY_THROW );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" );
@@ -1978,10 +1966,7 @@ void SAL_CALL VCLXToolkit::mouseRelease( const css::awt::MouseEvent & aMouseEven
void SAL_CALL VCLXToolkit::mouseMove( const css::awt::MouseEvent & aMouseEvent )
{
- css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY );
- if( !xWindow.is() )
- throw css::uno::RuntimeException( "invalid event source" );
-
+ css::uno::Reference<css::awt::XWindow> xWindow ( aMouseEvent.Source, css::uno::UNO_QUERY_THROW );
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
if( !pWindow )
throw css::uno::RuntimeException( "invalid event source" );
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index ba0d503..b7f7193 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -704,41 +704,31 @@ void SAL_CALL UnoMultiPageControl::dispose()
// css::awt::XSimpleTabController
::sal_Int32 SAL_CALL UnoMultiPageControl::insertTab()
{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
return xMultiPage->insertTab();
}
void SAL_CALL UnoMultiPageControl::removeTab( ::sal_Int32 ID )
{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
xMultiPage->removeTab( ID );
}
void SAL_CALL UnoMultiPageControl::setTabProps( ::sal_Int32 ID, const Sequence< NamedValue >& Properties )
{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
xMultiPage->setTabProps( ID, Properties );
}
Sequence< NamedValue > SAL_CALL UnoMultiPageControl::getTabProps( ::sal_Int32 ID )
{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
return xMultiPage->getTabProps( ID );
}
void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID )
{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
xMultiPage->activateTab( ID );
ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE ), uno::makeAny( ID ), true );
@@ -746,9 +736,7 @@ void SAL_CALL UnoMultiPageControl::activateTab( ::sal_Int32 ID )
::sal_Int32 SAL_CALL UnoMultiPageControl::getActiveTabID()
{
- Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY );
- if ( !xMultiPage.is() )
- throw RuntimeException();
+ Reference< XSimpleTabController > xMultiPage( getPeer(), UNO_QUERY_THROW );
return xMultiPage->getActiveTabID();
}
commit 4c02edafa2fb5dcd52c9dae62c5b4ce285e28961
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Feb 14 16:09:37 2017 +0100
Some simplifications, using UNO_QUERY_THROW
Change-Id: Ieae74cca9d156503b7b75cc2da49b831b17f9633
Reviewed-on: https://gerrit.libreoffice.org/34252
Tested-by: Stephan Bergmann <sbergman at redhat.com>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index fe4aebb..e97be34 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -894,11 +894,7 @@ UUIInteractionHelper::getInteractionHandlerList(
throw uno::RuntimeException("unable to instanciate config access");
uno::Reference< container::XNameAccess > xNameAccess(
- xInterface, uno::UNO_QUERY );
- if ( !xNameAccess.is() )
- throw uno::RuntimeException(
- "config access does not implement XNameAccess");
-
+ xInterface, uno::UNO_QUERY_THROW );
uno::Sequence< OUString > aElems = xNameAccess->getElementNames();
const OUString* pElems = aElems.getConstArray();
sal_Int32 nCount = aElems.getLength();
@@ -906,11 +902,7 @@ UUIInteractionHelper::getInteractionHandlerList(
if ( nCount > 0 )
{
uno::Reference< container::XHierarchicalNameAccess >
- xHierNameAccess( xInterface, uno::UNO_QUERY );
-
- if ( !xHierNameAccess.is() )
- throw uno::RuntimeException(
- "config access does not implement XHierarchicalNameAccess");
+ xHierNameAccess( xInterface, uno::UNO_QUERY_THROW );
// Iterate over children.
for ( sal_Int32 n = 0; n < nCount; ++n )
More information about the Libreoffice-commits
mailing list