summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-29 17:20:22 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-29 18:18:28 +0200
commitc2ca6fabd1afc3fc07001721c2069d3c8db7000a (patch)
tree350741d6d19564bcaf00506bd7d22b4c644e0fdc /sd
parentf05d7abf93bbcf443cb0b5759ca19992e2fa85a3 (diff)
Use comphelper::getComponentContext
...and some further clean up. Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9
Diffstat (limited to 'sd')
-rw-r--r--sd/source/core/CustomAnimationPreset.cxx20
-rw-r--r--sd/source/core/TransitionPreset.cxx22
2 files changed, 15 insertions, 27 deletions
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index bf8fd5027a2a..8eb74eeaabcf 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -34,7 +34,6 @@
#include <com/sun/star/xml/sax/XParser.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/presentation/EffectPresetClass.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <unotools/streamwrap.hxx>
@@ -316,19 +315,14 @@ void CustomAnimationPresets::importEffects()
{
try
{
- // Get service factory
- Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
- DBG_ASSERT( xServiceFactory.is(), "sd::CustomAnimationPresets::import(), got no service manager" );
- if( !xServiceFactory.is() )
- return;
-
- uno::Reference< beans::XPropertySet > xProps( xServiceFactory, UNO_QUERY );
- uno::Reference< uno::XComponentContext > xContext;
- xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
+ uno::Reference< uno::XComponentContext > xContext(
+ comphelper::getProcessComponentContext() );
+ Reference< XMultiServiceFactory > xServiceFactory(
+ xContext->getServiceManager(), UNO_QUERY_THROW );
- uno::Reference< util::XMacroExpander > xMacroExpander;
- if( xContext.is() )
- xMacroExpander.set( xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"), UNO_QUERY );
+ uno::Reference< util::XMacroExpander > xMacroExpander(
+ xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"),
+ UNO_QUERY );
Reference< XMultiServiceFactory > xConfigProvider(
xServiceFactory->createInstance("com.sun.star.configuration.ConfigurationProvider" ),
diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx
index dd03514cd5d4..3c77ead958fe 100644
--- a/sd/source/core/TransitionPreset.cxx
+++ b/sd/source/core/TransitionPreset.cxx
@@ -31,7 +31,6 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/animations/AnimationNodeType.hpp>
#include <vcl/svapp.hxx>
@@ -152,19 +151,14 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList )
try
{
- // Get service factory
- Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
- DBG_ASSERT( xServiceFactory.is(), "sd::CustomAnimationPresets::import(), got no service manager" );
- if( !xServiceFactory.is() )
- return false;
-
- uno::Reference< beans::XPropertySet > xProps( xServiceFactory, UNO_QUERY );
- uno::Reference< uno::XComponentContext > xContext;
- xProps->getPropertyValue( "DefaultContext" ) >>= xContext;
-
- uno::Reference< util::XMacroExpander > xMacroExpander;
- if( xContext.is() )
- xMacroExpander.set( xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"), UNO_QUERY );
+ uno::Reference< uno::XComponentContext > xContext(
+ comphelper::getProcessComponentContext() );
+ Reference< XMultiServiceFactory > xServiceFactory(
+ xContext->getServiceManager(), UNO_QUERY_THROW );
+
+ uno::Reference< util::XMacroExpander > xMacroExpander(
+ xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"),
+ UNO_QUERY );
// import ui strings
Reference< XMultiServiceFactory > xConfigProvider(