summaryrefslogtreecommitdiff
path: root/sd
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 /sd
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 'sd')
-rw-r--r--sd/source/console/PresenterHelper.cxx15
-rw-r--r--sd/source/console/PresenterScreen.cxx4
-rw-r--r--sd/source/console/PresenterSlideShowView.cxx4
-rw-r--r--sd/source/core/stlsheet.cxx6
-rw-r--r--sd/source/filter/eppt/epptso.cxx8
-rw-r--r--sd/source/ui/annotations/annotationmanager.cxx22
-rw-r--r--sd/source/ui/slideshow/slideshowviewimpl.cxx7
7 files changed, 22 insertions, 44 deletions
diff --git a/sd/source/console/PresenterHelper.cxx b/sd/source/console/PresenterHelper.cxx
index 76bec0ecee7d..9bdd580460f8 100644
--- a/sd/source/console/PresenterHelper.cxx
+++ b/sd/source/console/PresenterHelper.cxx
@@ -36,17 +36,10 @@ Reference<presentation::XSlideShowController> PresenterHelper::GetSlideShowContr
{
Reference<presentation::XSlideShowController> xSlideShowController;
- if( rxController.is() ) try
- {
- Reference<XPresentationSupplier> xPS ( rxController->getModel(), UNO_QUERY_THROW);
-
- Reference<XPresentation2> xPresentation(xPS->getPresentation(), UNO_QUERY_THROW);
-
- xSlideShowController = xPresentation->getController();
- }
- catch(RuntimeException&)
- {
- }
+ if( rxController.is() )
+ if (auto xPS = rxController->getModel().query<XPresentationSupplier>())
+ if (auto xPresentation = xPS->getPresentation().query<XPresentation2>())
+ xSlideShowController = xPresentation->getController();
return xSlideShowController;
}
diff --git a/sd/source/console/PresenterScreen.cxx b/sd/source/console/PresenterScreen.cxx
index cd6c20d38cc5..dcf0cb93a564 100644
--- a/sd/source/console/PresenterScreen.cxx
+++ b/sd/source/console/PresenterScreen.cxx
@@ -411,8 +411,8 @@ void PresenterScreen::SwitchMonitors()
nNewScreen++; // otherwise we store screens offset by one.
// Set the new presentation display
- Reference<beans::XPropertySet> xProperties (xPresentation, UNO_QUERY_THROW);
- xProperties->setPropertyValue("Display", Any(nNewScreen));
+ if (auto xProperties = xPresentation.query<beans::XPropertySet>())
+ xProperties->setPropertyValue("Display", Any(nNewScreen));
} catch (const uno::Exception &) {
}
}
diff --git a/sd/source/console/PresenterSlideShowView.cxx b/sd/source/console/PresenterSlideShowView.cxx
index 32693f116410..002bc217d659 100644
--- a/sd/source/console/PresenterSlideShowView.cxx
+++ b/sd/source/console/PresenterSlideShowView.cxx
@@ -799,8 +799,8 @@ Reference<awt::XWindow> PresenterSlideShowView::CreateViewWindow (
xViewWindow.set( xToolkit->createWindow(aWindowDescriptor),UNO_QUERY_THROW);
// Make the background transparent. The slide show paints its own background.
- Reference<awt::XWindowPeer> xPeer (xViewWindow, UNO_QUERY_THROW);
- xPeer->setBackground(0xff000000);
+ if (auto xPeer = xViewWindow.query<awt::XWindowPeer>())
+ xPeer->setBackground(0xff000000);
xViewWindow->setVisible(true);
}
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 2038604861df..d7384ed53b9d 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -309,9 +309,9 @@ bool SdStyleSheet::IsUsed() const
Reference< XStyle > xStyle( rListener, UNO_QUERY );
try
{
- Reference<XPropertySet> xPropertySet(xStyle, UNO_QUERY_THROW);
- if (xPropertySet->getPropertyValue("IsPhysical").get<bool>())
- return true;
+ if (auto xPropertySet = xStyle.query<XPropertySet>() )
+ if (xPropertySet->getPropertyValue("IsPhysical").get<bool>())
+ return true;
}
catch (const Exception&)
{
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index e794d9600e06..219cf9ebf785 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1944,8 +1944,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
try
{
// try to get the aspect when available
- css::uno::Reference< css::beans::XPropertySet > xShapeProps( mXShape, css::uno::UNO_QUERY_THROW );
- xShapeProps->getPropertyValue("Aspect") >>= nAspect;
+ if (auto xShapeProps = mXShape.query<css::beans::XPropertySet>() )
+ xShapeProps->getPropertyValue("Aspect") >>= nAspect;
}
catch( css::uno::Exception& )
{}
@@ -2527,8 +2527,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
try
{
// try to get the aspect when available
- css::uno::Reference< css::beans::XPropertySet > xShapeProps( mXShape, css::uno::UNO_QUERY_THROW );
- xShapeProps->getPropertyValue("Aspect") >>= nAspect;
+ if (auto xShapeProps = mXShape.query<css::beans::XPropertySet>() )
+ xShapeProps->getPropertyValue("Aspect") >>= nAspect;
}
catch( css::uno::Exception& )
{}
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index 81d6b3c0176b..4f3b6a85048b 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -183,29 +183,15 @@ void AnnotationManagerImpl::init()
TOOLS_WARN_EXCEPTION( "sd", "sd::AnnotationManagerImpl::AnnotationManagerImpl()" );
}
- try
- {
- Reference<XEventBroadcaster> xModel (mrBase.GetDocShell()->GetModel(), UNO_QUERY_THROW );
- Reference<XEventListener> xListener( this );
- xModel->addEventListener( xListener );
- }
- catch( Exception& )
- {
- }
+ if (auto xModel = mrBase.GetDocShell()->GetModel().query<XEventBroadcaster>() )
+ xModel->addEventListener( Reference<XEventListener>( this ) );
}
// WeakComponentImplHelper
void AnnotationManagerImpl::disposing (std::unique_lock<std::mutex>&)
{
- try
- {
- Reference<XEventBroadcaster> xModel (mrBase.GetDocShell()->GetModel(), UNO_QUERY_THROW );
- Reference<XEventListener> xListener( this );
- xModel->removeEventListener( xListener );
- }
- catch( Exception& )
- {
- }
+ if (auto xModel = mrBase.GetDocShell()->GetModel().query<XEventBroadcaster>() )
+ xModel->removeEventListener( Reference<XEventListener>( this ) );
removeListener();
DisposeTags();
diff --git a/sd/source/ui/slideshow/slideshowviewimpl.cxx b/sd/source/ui/slideshow/slideshowviewimpl.cxx
index d6addc3f87fe..4b476812a8d8 100644
--- a/sd/source/ui/slideshow/slideshowviewimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowviewimpl.cxx
@@ -125,10 +125,9 @@ SlideShowView::SlideShowView( ShowWindow& rOutputWindow,
{
try
{
- Reference< beans::XPropertySet > xCanvasProps( getCanvas(),
- uno::UNO_QUERY_THROW );
- xCanvasProps->setPropertyValue("UnsafeScrolling",
- uno::Any( true ) );
+ if (auto xCanvasProps = getCanvas().query<beans::XPropertySet>() )
+ xCanvasProps->setPropertyValue("UnsafeScrolling",
+ uno::Any( true ) );
}
catch( uno::Exception& )
{