diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-16 09:45:07 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-23 17:44:16 +0200 |
commit | b493b5a284d5a629d16e733197c7840fb33b469c (patch) | |
tree | c863a4e06843816bd1669dcfccfcf809b943a1f3 /framework | |
parent | Revert "add missing dep on translations" (diff) | |
download | core-b493b5a284d5a629d16e733197c7840fb33b469c.tar.gz core-b493b5a284d5a629d16e733197c7840fb33b469c.zip |
fdo#46808, use service constructor for xml::sax::Writer
Change-Id: I2b216a0e3a9694568642e9de2f4f43ecd682555f
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/framework/statusbarconfiguration.hxx | 2 | ||||
-rw-r--r-- | framework/inc/framework/toolboxconfiguration.hxx | 2 | ||||
-rw-r--r-- | framework/inc/services.h | 1 | ||||
-rw-r--r-- | framework/inc/xml/imagesconfiguration.hxx | 2 | ||||
-rw-r--r-- | framework/source/accelerators/acceleratorconfiguration.cxx | 17 | ||||
-rw-r--r-- | framework/source/fwe/xml/menuconfiguration.cxx | 13 | ||||
-rw-r--r-- | framework/source/fwe/xml/statusbarconfiguration.cxx | 27 | ||||
-rw-r--r-- | framework/source/fwe/xml/toolboxconfiguration.cxx | 28 | ||||
-rw-r--r-- | framework/source/uiconfiguration/imagemanagerimpl.cxx | 2 | ||||
-rw-r--r-- | framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 4 | ||||
-rw-r--r-- | framework/source/uiconfiguration/uiconfigurationmanager.cxx | 4 | ||||
-rw-r--r-- | framework/source/xml/imagesconfiguration.cxx | 28 |
12 files changed, 43 insertions, 87 deletions
diff --git a/framework/inc/framework/statusbarconfiguration.hxx b/framework/inc/framework/statusbarconfiguration.hxx index 2c405c797573..5204e670d43b 100644 --- a/framework/inc/framework/statusbarconfiguration.hxx +++ b/framework/inc/framework/statusbarconfiguration.hxx @@ -50,7 +50,7 @@ class FWE_DLLPUBLIC StatusBarConfiguration const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rStatusbarConfiguration ); static sal_Bool StoreStatusBar( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusbarConfiguration ); }; diff --git a/framework/inc/framework/toolboxconfiguration.hxx b/framework/inc/framework/toolboxconfiguration.hxx index 1e31bbb8dbac..b8282bc0b99f 100644 --- a/framework/inc/framework/toolboxconfiguration.hxx +++ b/framework/inc/framework/toolboxconfiguration.hxx @@ -42,7 +42,7 @@ class FWE_DLLPUBLIC ToolBoxConfiguration const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rToolbarConfiguration ); static sal_Bool StoreToolBox( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rToolbarConfiguration ); }; diff --git a/framework/inc/services.h b/framework/inc/services.h index 70956ec6d9e4..0b7921586f78 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -80,7 +80,6 @@ namespace framework{ #define SERVICENAME_GLOBALACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.GlobalAcceleratorConfiguration") #define SERVICENAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration") #define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration") -#define SERVICENAME_SAXWRITER DECLARE_ASCII("com.sun.star.xml.sax.Writer" ) #define SERVICENAME_STORAGEFACTORY DECLARE_ASCII("com.sun.star.embed.StorageFactory" ) #define SERVICENAME_FILESYSTEMSTORAGEFACTORY DECLARE_ASCII("com.sun.star.embed.FileSystemStorageFactory" ) #define SERVICENAME_TEMPFILE DECLARE_ASCII("com.sun.star.io.TempFile" ) diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx index eda31f41571b..d08c3b1cd585 100644 --- a/framework/inc/xml/imagesconfiguration.hxx +++ b/framework/inc/xml/imagesconfiguration.hxx @@ -106,7 +106,7 @@ class ImagesConfiguration ImageListsDescriptor& rItems ); static sal_Bool StoreImages( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, const ImageListsDescriptor& rItems ); }; diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index fa010e7d55bb..8becd7d34b89 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/xml/sax/Parser.hpp> #include <com/sun/star/xml/sax/InputSource.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/io/XSeekable.hpp> @@ -562,12 +563,12 @@ void XMLBasedAcceleratorConfiguration::impl_ts_save(const css::uno::Reference< c xSeek->seek(0); // combine writer/cache/stream etcpp. - css::uno::Reference< css::xml::sax::XDocumentHandler > xWriter (xSMGR->createInstance(SERVICENAME_SAXWRITER), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::io::XActiveDataSource> xDataSource(xWriter , css::uno::UNO_QUERY_THROW); - xDataSource->setOutputStream(xStream); + css::uno::Reference< css::xml::sax::XWriter > xWriter = css::xml::sax::Writer::create(comphelper::getComponentContext(xSMGR)); + xWriter->setOutputStream(xStream); // write into the stream - AcceleratorConfigurationWriter aWriter(aCache, xWriter); + css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler(xWriter, css::uno::UNO_QUERY_THROW); + AcceleratorConfigurationWriter aWriter(aCache, xHandler); aWriter.flush(); // take over all changes into the original container @@ -1111,12 +1112,12 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::storeToStorage(const css::uno::R if (xSeek.is()) xSeek->seek(0); - css::uno::Reference< css::xml::sax::XDocumentHandler > xWriter (m_xSMGR->createInstance(SERVICENAME_SAXWRITER), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::io::XActiveDataSource> xDataSource(xWriter , css::uno::UNO_QUERY_THROW); - xDataSource->setOutputStream(xOut); + css::uno::Reference< css::xml::sax::XWriter > xWriter = css::xml::sax::Writer::create(comphelper::getComponentContext(m_xSMGR)); + xWriter->setOutputStream(xOut); // write into the stream - AcceleratorConfigurationWriter aWriter(aCache, xWriter); + css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler(xWriter, css::uno::UNO_QUERY_THROW); + AcceleratorConfigurationWriter aWriter(aCache, xHandler); aWriter.flush(); } diff --git a/framework/source/fwe/xml/menuconfiguration.cxx b/framework/source/fwe/xml/menuconfiguration.cxx index c47e52d226aa..e5a59220ae61 100644 --- a/framework/source/fwe/xml/menuconfiguration.cxx +++ b/framework/source/fwe/xml/menuconfiguration.cxx @@ -37,6 +37,7 @@ #include <uielement/rootitemcontainer.hxx> #include <com/sun/star/xml/sax/Parser.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <comphelper/processfactory.hxx> @@ -129,17 +130,13 @@ void MenuConfiguration::StoreMenuBarConfigurationToXML( Reference< XOutputStream >& rOutputStream ) throw ( WrappedTargetException ) { - Reference< XDocumentHandler > xWriter; - - xWriter = Reference< XDocumentHandler >( m_rxServiceManager->createInstance( - SERVICENAME_SAXWRITER), UNO_QUERY) ; - - Reference< XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); - xDataSource->setOutputStream( rOutputStream ); + Reference< XWriter > xWriter = Writer::create(comphelper::getComponentContext(m_rxServiceManager)); + xWriter->setOutputStream( rOutputStream ); try { - OWriteMenuDocumentHandler aWriteMenuDocumentHandler( rMenuBarConfiguration, xWriter ); + Reference< XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW); + OWriteMenuDocumentHandler aWriteMenuDocumentHandler( rMenuBarConfiguration, xHandler ); aWriteMenuDocumentHandler.WriteMenuDocument(); } catch ( const RuntimeException& e ) diff --git a/framework/source/fwe/xml/statusbarconfiguration.cxx b/framework/source/fwe/xml/statusbarconfiguration.cxx index 2b24554f4485..521ad095eb6e 100644 --- a/framework/source/fwe/xml/statusbarconfiguration.cxx +++ b/framework/source/fwe/xml/statusbarconfiguration.cxx @@ -33,6 +33,7 @@ #include <services.h> #include <com/sun/star/xml/sax/Parser.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -50,26 +51,12 @@ using namespace ::com::sun::star::container; namespace framework { -static Reference< XParser > GetSaxParser( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext - ) -{ - return Parser::create( xContext ); -} - -static Reference< XDocumentHandler > GetSaxWriter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory - ) -{ - return Reference< XDocumentHandler >( xServiceFactory->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ; -} - sal_Bool StatusBarConfiguration::LoadStatusBar( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& xInputStream, const Reference< XIndexContainer >& rStatusbarConfiguration ) { - Reference< XParser > xParser( GetSaxParser( rxContext ) ); + Reference< XParser > xParser = Parser::create(rxContext); // connect stream to input stream to the parser InputSource aInputSource; @@ -102,17 +89,17 @@ sal_Bool StatusBarConfiguration::LoadStatusBar( } sal_Bool StatusBarConfiguration::StoreStatusBar( - const Reference< XMultiServiceFactory >& xServiceFactory, + const Reference< XComponentContext >& rxContext, const Reference< XOutputStream >& xOutputStream, const Reference< XIndexAccess >& rStatusbarConfiguration ) { - Reference< XDocumentHandler > xWriter( GetSaxWriter( xServiceFactory ) ); - Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); - xDataSource->setOutputStream( xOutputStream ); + Reference< XWriter > xWriter = Writer::create( rxContext ); + xWriter->setOutputStream( xOutputStream ); try { - OWriteStatusBarDocumentHandler aWriteStatusBarDocumentHandler( rStatusbarConfiguration, xWriter ); + Reference< XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW); + OWriteStatusBarDocumentHandler aWriteStatusBarDocumentHandler( rStatusbarConfiguration, xHandler ); aWriteStatusBarDocumentHandler.WriteStatusBarDocument(); return sal_True; } diff --git a/framework/source/fwe/xml/toolboxconfiguration.cxx b/framework/source/fwe/xml/toolboxconfiguration.cxx index dcc7d48d1c51..1fe48cb7b06e 100644 --- a/framework/source/fwe/xml/toolboxconfiguration.cxx +++ b/framework/source/fwe/xml/toolboxconfiguration.cxx @@ -33,6 +33,7 @@ #include <services.h> #include <com/sun/star/xml/sax/Parser.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -50,26 +51,12 @@ using namespace ::com::sun::star::container; namespace framework { -static Reference< XParser > GetSaxParser( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext - ) -{ - return Parser::create(rxContext); -} - -static Reference< XDocumentHandler > GetSaxWriter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory - ) -{ - return Reference< XDocumentHandler >( xServiceFactory->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ; -} - sal_Bool ToolBoxConfiguration::LoadToolBox( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rToolbarConfiguration ) { - Reference< XParser > xParser( GetSaxParser( rxContext ) ); + Reference< XParser > xParser = Parser::create(rxContext); // connect stream to input stream to the parser InputSource aInputSource; @@ -104,18 +91,17 @@ sal_Bool ToolBoxConfiguration::LoadToolBox( sal_Bool ToolBoxConfiguration::StoreToolBox( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rToolbarConfiguration ) { - Reference< XDocumentHandler > xWriter( GetSaxWriter( xServiceFactory ) ); - - Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); - xDataSource->setOutputStream( rOutputStream ); + Reference< XWriter > xWriter = Writer::create(rxContext); + xWriter->setOutputStream( rOutputStream ); try { - OWriteToolBoxDocumentHandler aWriteToolBoxDocumentHandler( rToolbarConfiguration, xWriter ); + Reference< XDocumentHandler > xHandler( xWriter, UNO_QUERY_THROW ); + OWriteToolBoxDocumentHandler aWriteToolBoxDocumentHandler( rToolbarConfiguration, xHandler ); aWriteToolBoxDocumentHandler.WriteToolBoxDocument(); return sal_True; } diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index 3e3b5033290c..c6f3389b2eb9 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -614,7 +614,7 @@ sal_Bool ImageManagerImpl::implts_storeUserImages( xOutputStream = xStream->getOutputStream(); if ( xOutputStream.is() ) - ImagesConfiguration::StoreImages( m_xServiceManager, xOutputStream, aUserImageListInfo ); + ImagesConfiguration::StoreImages( comphelper::getComponentContext(m_xServiceManager), xOutputStream, aUserImageListInfo ); // Commit user image storage xTransaction = uno::Reference< XTransactedObject >( xUserImageStorage, UNO_QUERY ); diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 2a6b451303c3..85a44285bbc3 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -468,7 +468,7 @@ void ModuleUIConfigurationManager::impl_storeElementTypeData( Reference< XStorag { try { - ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings ); + ToolBoxConfiguration::StoreToolBox( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) { @@ -480,7 +480,7 @@ void ModuleUIConfigurationManager::impl_storeElementTypeData( Reference< XStorag { try { - StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings ); + StatusBarConfiguration::StoreStatusBar( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) { diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index f19853f0ed0c..6ca9126caf87 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -397,7 +397,7 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& x { try { - ToolBoxConfiguration::StoreToolBox( m_xServiceManager, xOutputStream, rElement.xSettings ); + ToolBoxConfiguration::StoreToolBox( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) { @@ -409,7 +409,7 @@ void UIConfigurationManager::impl_storeElementTypeData( Reference< XStorage >& x { try { - StatusBarConfiguration::StoreStatusBar( m_xServiceManager, xOutputStream, rElement.xSettings ); + StatusBarConfiguration::StoreStatusBar( comphelper::getComponentContext(m_xServiceManager), xOutputStream, rElement.xSettings ); } catch ( const ::com::sun::star::lang::WrappedTargetException& ) { diff --git a/framework/source/xml/imagesconfiguration.cxx b/framework/source/xml/imagesconfiguration.cxx index 622b45f5eecc..c65c46cebf8d 100644 --- a/framework/source/xml/imagesconfiguration.cxx +++ b/framework/source/xml/imagesconfiguration.cxx @@ -34,6 +34,7 @@ #include <xml/saxnamespacefilter.hxx> #include <com/sun/star/xml/sax/Parser.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -50,26 +51,12 @@ using namespace ::com::sun::star::io; namespace framework { -static Reference< XParser > GetSaxParser( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext - ) -{ - return Parser::create(rxContext); -} - -static Reference< XDocumentHandler > GetSaxWriter( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory - ) -{ - return Reference< XDocumentHandler >( xServiceFactory->createInstance( SERVICENAME_SAXWRITER), UNO_QUERY) ; -} - sal_Bool ImagesConfiguration::LoadImages( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream, ImageListsDescriptor& rItems ) { - Reference< XParser > xParser( GetSaxParser( rxContext ) ); + Reference< XParser > xParser = Parser::create( rxContext ); // connect stream to input stream to the parser InputSource aInputSource; @@ -103,18 +90,17 @@ sal_Bool ImagesConfiguration::LoadImages( } sal_Bool ImagesConfiguration::StoreImages( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, const ImageListsDescriptor& rItems ) { - Reference< XDocumentHandler > xWriter( GetSaxWriter( xServiceFactory ) ); - - Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY ); - xDataSource->setOutputStream( rOutputStream ); + Reference< XWriter > xWriter = Writer::create(rxContext); + xWriter->setOutputStream( rOutputStream ); try { - OWriteImagesDocumentHandler aWriteImagesDocumentHandler( rItems, xWriter ); + Reference< XDocumentHandler > xHandler( xWriter, UNO_QUERY_THROW ); + OWriteImagesDocumentHandler aWriteImagesDocumentHandler( rItems, xHandler ); aWriteImagesDocumentHandler.WriteImagesDocument(); return sal_True; } |