diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-29 17:20:22 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-29 18:18:28 +0200 |
commit | c2ca6fabd1afc3fc07001721c2069d3c8db7000a (patch) | |
tree | 350741d6d19564bcaf00506bd7d22b4c644e0fdc /xmloff | |
parent | f05d7abf93bbcf443cb0b5759ca19992e2fa85a3 (diff) |
Use comphelper::getComponentContext
...and some further clean up.
Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 31 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLImport.cxx | 18 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTools.cxx | 27 |
3 files changed, 15 insertions, 61 deletions
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 9b2bcb708192..4640b85eda55 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -296,21 +296,6 @@ public: namespace { -Reference< uno::XComponentContext > lcl_getComponentContext() -{ - Reference< uno::XComponentContext > xContext; - try - { - Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY ); - if( xFactProp.is()) - xFactProp->getPropertyValue(OUString( "DefaultContext" )) >>= xContext; - } - catch( const uno::Exception& ) - { - } - - return xContext; -} class lcl_MatchesRole : public ::std::unary_function< Reference< chart2::data::XLabeledDataSequence >, bool > { @@ -400,15 +385,13 @@ Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Referen Reference< chart2::data::XDataSource > lcl_createDataSource( const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aData ) { - Reference< chart2::data::XDataSink > xSink; - Reference< uno::XComponentContext > xContext( lcl_getComponentContext()); - if( xContext.is() ) - xSink.set( - xContext->getServiceManager()->createInstanceWithContext( - OUString( "com.sun.star.chart2.data.DataSource" ), - xContext ), uno::UNO_QUERY_THROW ); - if( xSink.is()) - xSink->setData( aData ); + Reference< uno::XComponentContext > xContext( + comphelper::getProcessComponentContext() ); + Reference< chart2::data::XDataSink > xSink( + xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.chart2.data.DataSource", xContext ), + uno::UNO_QUERY_THROW ); + xSink->setData( aData ); return Reference< chart2::data::XDataSource >( xSink, uno::UNO_QUERY ); } diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index ab0ae4dd5493..729203bdc83b 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -70,21 +70,6 @@ using ::com::sun::star::uno::Sequence; namespace { -Reference< uno::XComponentContext > lcl_getComponentContext() -{ - Reference< uno::XComponentContext > xContext; - try - { - Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY ); - if( xFactProp.is()) - xFactProp->getPropertyValue(OUString( "DefaultContext" )) >>= xContext; - } - catch( uno::Exception& ) - {} - - return xContext; -} - class lcl_MatchesChartType : public ::std::unary_function< Reference< chart2::XChartType >, bool > { public: @@ -489,7 +474,8 @@ Reference< chart2::XDataSeries > SchXMLImportHelper::GetNewDataSeries( xDoc->getFirstDiagram(), uno::UNO_QUERY_THROW ); Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - Reference< uno::XComponentContext > xContext( lcl_getComponentContext()); + Reference< uno::XComponentContext > xContext( + comphelper::getProcessComponentContext() ); if( nCoordinateSystemIndex < aCooSysSeq.getLength()) { diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 524058f42756..948475a21ccf 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -72,20 +72,6 @@ using ::com::sun::star::uno::Sequence; namespace { -Reference< uno::XComponentContext > lcl_getComponentContext() -{ - Reference< uno::XComponentContext > xContext; - try - { - Reference< beans::XPropertySet > xFactProp( comphelper::getProcessServiceFactory(), uno::UNO_QUERY ); - if( xFactProp.is()) - xFactProp->getPropertyValue(OUString( "DefaultContext" )) >>= xContext; - } - catch( uno::Exception& ) - {} - - return xContext; -} rtl::OUString lcl_getGeneratorFromModel( const uno::Reference< frame::XModel >& xChartModel ) { @@ -375,13 +361,12 @@ XMLTokenEnum getTokenByChartType( Reference< chart2::data::XLabeledDataSequence > GetNewLabeledDataSequence() { - Reference< chart2::data::XLabeledDataSequence > xResult; - Reference< uno::XComponentContext > xContext( lcl_getComponentContext()); - if( xContext.is() ) - xResult.set( - xContext->getServiceManager()->createInstanceWithContext( - OUString( "com.sun.star.chart2.data.LabeledDataSequence" ), - xContext ), uno::UNO_QUERY_THROW ); + Reference< uno::XComponentContext > xContext( + comphelper::getProcessComponentContext() ); + Reference< chart2::data::XLabeledDataSequence > xResult( + xContext->getServiceManager()->createInstanceWithContext( + "com.sun.star.chart2.data.LabeledDataSequence", xContext ), + uno::UNO_QUERY_THROW ); return xResult; } |