summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-08-17 15:42:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-08-18 11:03:02 +0200
commit7fc6063914432d58d86cfcbd728d967e7c86ebfd (patch)
treef71fe9f99edaa4e896c78cdf32e34b516194d748 /unotools
parentdb83c41d460103df5d80f5bd99816575c4ead5cd (diff)
use more Reference::query instead of UNO_QUERY_THROW
since querying with exceptions is consideably more expensive Change-Id: I968a9a40766b2abb0d3058549b0ed44011fd5716 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/confignode.cxx9
-rw-r--r--unotools/source/config/lingucfg.cxx8
-rw-r--r--unotools/source/config/useroptions.cxx8
3 files changed, 7 insertions, 18 deletions
diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx
index 93b89532072d..cf5dcb0e64ae 100644
--- a/unotools/source/config/confignode.cxx
+++ b/unotools/source/config/confignode.cxx
@@ -146,15 +146,8 @@ namespace utl
OUString OConfigurationNode::getLocalName() const
{
OUString sLocalName;
- try
- {
- Reference< XNamed > xNamed( m_xDirectAccess, UNO_QUERY_THROW );
+ if (auto xNamed = m_xDirectAccess.query<XNamed>() )
sLocalName = xNamed->getName();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("unotools");
- }
return sLocalName;
}
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index 0b39db9172ef..6c3f625dd76d 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -1016,9 +1016,11 @@ uno::Sequence< OUString > SvtLinguConfig::GetDisabledDictionaries() const
uno::Sequence< OUString > aResult;
try
{
- uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
- xNA->getByName( "DisabledDictionaries" ) >>= aResult;
+ if (auto xNA = GetMainUpdateAccess().query<container::XNameAccess>() )
+ {
+ xNA.set( xNA->getByName("ServiceManager"), uno::UNO_QUERY_THROW );
+ xNA->getByName( "DisabledDictionaries" ) >>= aResult;
+ }
}
catch (uno::Exception &)
{
diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx
index 1e181e8813d6..4cfc3f125358 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -117,14 +117,8 @@ void SvtUserOptions::ChangeListener::changesOccurred (util::ChangesEvent const&
void SvtUserOptions::ChangeListener::disposing (lang::EventObject const& rSource)
{
- try
- {
- uno::Reference<util::XChangesNotifier> xChgNot(rSource.Source, uno::UNO_QUERY_THROW);
+ if (auto xChgNot = rSource.Source.query<util::XChangesNotifier>())
xChgNot->removeChangesListener(this);
- }
- catch (uno::Exception&)
- {
- }
}
SvtUserOptions::Impl::Impl() :