diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-14 12:58:00 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-21 10:57:09 +0200 |
commit | bb121c864cc3c101ef733a4088c7ba3e36eced14 (patch) | |
tree | 2d528ca830aace6e563b7cdc93eb8f8d6c4f70cf /filter | |
parent | 6d818ed651aaafcfb12ebc21449d35947d2e85a9 (diff) |
fdo#46808, Convert frame::Desktop to new style service.
I had to drop XEventBroadcaster from the merged interface
because it introduced method name conflicts (addEventListener).
Shouldn't be an issue since it was scheduled to be dropped anyhow,
and the service implementation still implements it, so existing clients
will be fine.
I dropped the interface XPropertySet from the combined IDL because nobody
seems to be using it, and it's primary purpose appears to be to set weird
flags.
I dropped the optional interfaces
XStatusIndicatorFactory
XDispatchInformationProvider
from the combined IDL because the service does not implement them, and
nobody seems to be using them. I suspect they were mistakenly copied
from XFrame.
I also did not convert the Title, UserDefinedAttributes and LayoutManager
properties to attributes, again because no-one is using them.
Change-Id: I678a00006ed2cca2d6c37c4e39465811442c33af
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/flash/swffilter.cxx | 7 | ||||
-rw-r--r-- | filter/source/svg/svgexport.cxx | 2 | ||||
-rw-r--r-- | filter/source/svg/svgfilter.cxx | 8 | ||||
-rw-r--r-- | filter/source/svg/svgfilter.hxx | 2 | ||||
-rw-r--r-- | filter/source/svg/svgimport.cxx | 4 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfilterdialogcomponent.cxx | 12 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertestdialog.cxx | 79 |
7 files changed, 50 insertions, 64 deletions
diff --git a/filter/source/flash/swffilter.cxx b/filter/source/flash/swffilter.cxx index 2b4ecac979bb..7f5037cf9865 100644 --- a/filter/source/flash/swffilter.cxx +++ b/filter/source/flash/swffilter.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/document/XExporter.hpp> @@ -31,6 +31,7 @@ #include <com/sun/star/io/XOutputStream.hpp> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase4.hxx> +#include <comphelper/processfactory.hxx> #include <osl/file.hxx> #include "swfexporter.hxx" @@ -263,9 +264,7 @@ sal_Bool FlashExportFilter::ExportAsMultipleFiles(const Sequence< PropertyValue if(!xDrawPages.is()) return sal_False; - Reference< XDesktop > rDesktop( mxMSF->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY); - if (!rDesktop.is()) - return sal_False; + Reference< XDesktop2 > rDesktop = Desktop::create( comphelper::getComponentContext(mxMSF) ); Reference< XStorable > xStorable(rDesktop->getCurrentComponent(), UNO_QUERY); if (!xStorable.is()) diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 4289a30abb67..2bf32d0ce995 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -2018,7 +2018,7 @@ sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XDrawPage > & r sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage >& rxDrawPage ) { - Reference< XExporter > xExporter( mxMSF->createInstance( B2UCONST( "com.sun.star.drawing.GraphicExportFilter" ) ), UNO_QUERY ); + Reference< XExporter > xExporter( mxContext->getServiceManager()->createInstanceWithContext( B2UCONST( "com.sun.star.drawing.GraphicExportFilter" ), mxContext ), UNO_QUERY ); sal_Bool bRet = sal_False; if( xExporter.is() ) diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx index bbe2a3c35dfd..2570fee33b30 100644 --- a/filter/source/svg/svgfilter.cxx +++ b/filter/source/svg/svgfilter.cxx @@ -24,7 +24,7 @@ #include <uno/environment.h> #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawView.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/drawing/XDrawSubController.hpp> @@ -52,8 +52,7 @@ using namespace ::com::sun::star; // ------------- SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) : - mxMSF( rxCtx->getServiceManager(), - uno::UNO_QUERY_THROW ), + mxContext( rxCtx ), mpSVGDoc( NULL ), mpSVGExport( NULL ), mpSVGFontExport( NULL ), @@ -97,8 +96,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto { if( !mbExportAll && !mSelectedPages.hasElements() ) { - uno::Reference< frame::XDesktop > xDesktop(mxMSF->createInstance( "com.sun.star.frame.Desktop" ), - uno::UNO_QUERY_THROW); + uno::Reference< frame::XDesktop2 > xDesktop(frame::Desktop::create(mxContext)); uno::Reference< frame::XFrame > xFrame(xDesktop->getCurrentFrame(), uno::UNO_QUERY_THROW); uno::Reference<frame::XController > xController(xFrame->getController(), diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 975b7c6f226e..86694f217a23 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -277,7 +277,7 @@ public: private: - Reference< XMultiServiceFactory > mxMSF; + Reference< XComponentContext > mxContext; SvXMLElementExport* mpSVGDoc; SVGExport* mpSVGExport; SVGFontExport* mpSVGFontExport; diff --git a/filter/source/svg/svgimport.cxx b/filter/source/svg/svgimport.cxx index 15e1fe1b89c7..e3e7a7b7ee2b 100644 --- a/filter/source/svg/svgimport.cxx +++ b/filter/source/svg/svgimport.cxx @@ -64,13 +64,13 @@ sal_Bool SVGFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) return sal_False; rtl::OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) ); - Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY ); + Reference < XDocumentHandler > xInternalHandler( mxContext->getServiceManager()->createInstanceWithContext( sXMLImportService, mxContext ), UNO_QUERY ); // The XImporter sets up an empty target document for XDocumentHandler to write to.. uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY); xImporter->setTargetDocument(mxDstDoc); - SVGReader aReader(mxMSF, xInputStream, xInternalHandler); + SVGReader aReader(uno::Reference<lang::XMultiServiceFactory>(mxContext->getServiceManager(), uno::UNO_QUERY_THROW), xInputStream, xInternalHandler); return aReader.parseAndConvert(); } diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index 0c1cbfd30176..3bf4119c00b3 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -25,7 +25,7 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/component.hxx> #include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> #include <cppuhelper/implbase4.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -36,6 +36,7 @@ #include <tools/resmgr.hxx> #include <vcl/svapp.hxx> #include <rtl/instance.hxx> +#include <comphelper/processfactory.hxx> #include <svl/solar.hrc> @@ -125,12 +126,9 @@ XMLFilterDialogComponent::XMLFilterDialogComponent( const com::sun::star::uno::R mxMSF( rxMSF ), mpDialog( NULL ) { - Reference< XDesktop > xDesktop( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); - if( xDesktop.is() ) - { - Reference< XTerminateListener > xListener( this ); - xDesktop->addTerminateListener( xListener ); - } + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(mxMSF) ); + Reference< XTerminateListener > xListener( this ); + xDesktop->addTerminateListener( xListener ); } //------------------------------------------------------------------------- diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 64932a96aaff..0c04cad42b1c 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -26,7 +26,7 @@ #include <com/sun/star/document/XEmbeddedObjectResolver.hpp> #include <com/sun/star/frame/GlobalEventBroadcaster.hpp> #include <com/sun/star/frame/XConfigManager.hpp> -#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> @@ -415,19 +415,16 @@ void XMLFilterTestDialog::onExportBrowse() { m_sExportRecentFile = aDlg.GetPath(); - Reference< XComponentLoader > xLoader( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); + Reference< XDesktop2 > xLoader = Desktop::create( comphelper::getComponentContext(mxMSF) ); Reference< XInteractionHandler2 > xInter( InteractionHandler::createWithParent(comphelper::getComponentContext(mxMSF), 0) ); - if( xLoader.is() ) + OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); + Sequence< PropertyValue > aArguments(1); + aArguments[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); + aArguments[0].Value <<= xInter; + Reference< XComponent > xComp( xLoader->loadComponentFromURL( m_sExportRecentFile, aFrame, 0, aArguments ) ); + if( xComp.is() ) { - OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); - Sequence< PropertyValue > aArguments(1); - aArguments[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); - aArguments[0].Value <<= xInter; - Reference< XComponent > xComp( xLoader->loadComponentFromURL( m_sExportRecentFile, aFrame, 0, aArguments ) ); - if( xComp.is() ) - { - doExport( xComp ); - } + doExport( xComp ); } } } @@ -603,20 +600,17 @@ void XMLFilterTestDialog::import( const OUString& rURL ) { try { - Reference< XComponentLoader > xLoader( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); + Reference< XDesktop2 > xLoader = Desktop::create( comphelper::getComponentContext(mxMSF) ); Reference< XInteractionHandler2 > xInter( InteractionHandler::createWithParent(comphelper::getComponentContext(mxMSF), 0) ); - if( xLoader.is() ) - { - OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); - Sequence< PropertyValue > aArguments(2); - aArguments[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" )); - aArguments[0].Value <<= m_pFilterInfo->maFilterName; - aArguments[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); - aArguments[1].Value <<= xInter; + OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); + Sequence< PropertyValue > aArguments(2); + aArguments[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" )); + aArguments[0].Value <<= m_pFilterInfo->maFilterName; + aArguments[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); + aArguments[1].Value <<= xInter; - xLoader->loadComponentFromURL( rURL, aFrame, 0, aArguments ); - } + xLoader->loadComponentFromURL( rURL, aFrame, 0, aArguments ); if( m_pCBXDisplaySource->IsChecked() ) { @@ -700,39 +694,36 @@ Reference< XComponent > XMLFilterTestDialog::getFrontMostDocument( const OUStrin try { - Reference< XDesktop > xDesktop( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); - if( xDesktop.is() ) + Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(mxMSF) ); + Reference< XComponent > xTest( mxLastFocusModel ); + if( checkComponent( xTest, rServiceName ) ) + { + xRet = xTest; + } + else { - Reference< XComponent > xTest( mxLastFocusModel ); + xTest = (Reference< XComponent >)xDesktop->getCurrentComponent(); + if( checkComponent( xTest, rServiceName ) ) { xRet = xTest; } else { - xTest = (Reference< XComponent >)xDesktop->getCurrentComponent(); - - if( checkComponent( xTest, rServiceName ) ) - { - xRet = xTest; - } - else + Reference< XEnumerationAccess > xAccess( xDesktop->getComponents() ); + if( xAccess.is() ) { - Reference< XEnumerationAccess > xAccess( xDesktop->getComponents() ); - if( xAccess.is() ) + Reference< XEnumeration > xEnum( xAccess->createEnumeration() ); + if( xEnum.is() ) { - Reference< XEnumeration > xEnum( xAccess->createEnumeration() ); - if( xEnum.is() ) + while( xEnum->hasMoreElements() ) { - while( xEnum->hasMoreElements() ) + if( (xEnum->nextElement() >>= xTest) && xTest.is() ) { - if( (xEnum->nextElement() >>= xTest) && xTest.is() ) + if( checkComponent( xTest, rServiceName ) ) { - if( checkComponent( xTest, rServiceName ) ) - { - xRet = xTest; - break; - } + xRet = xTest; + break; } } } |