diff options
author | Chris Sherlock <chris.sherlock@collabora.com> | 2015-02-28 23:12:43 +1100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-12 08:17:10 +0100 |
commit | 4dafecfe4a72204dd994a3f66c5d886ffcfc965a (patch) | |
tree | 61dab6b3f4c85640399e6bdb3f7c06a3218766e9 /sd/source/ui/unoidl | |
parent | 1714dd654ee04918c0814fd09cd8522493d804b4 (diff) |
sd: convert sd.component to constructor usage
Change-Id: I844a7387253960059855346faa62c4ae51b97b18
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sd/source/ui/unoidl')
-rw-r--r-- | sd/source/ui/unoidl/facreg.cxx | 186 | ||||
-rw-r--r-- | sd/source/ui/unoidl/randomnode.cxx | 34 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodule.cxx | 37 |
3 files changed, 29 insertions, 228 deletions
diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx index cae322031701..014ab4c23366 100644 --- a/sd/source/ui/unoidl/facreg.cxx +++ b/sd/source/ui/unoidl/facreg.cxx @@ -34,10 +34,6 @@ using namespace com::sun::star; using namespace ::sd; -using namespace ::sd::framework; -using namespace ::sd::presenter; -using namespace ::sd::slidesorter; -using namespace ::sd::sidebar; // Declaration and initialization of a map from service names to locally // unique factory identifiers. @@ -46,27 +42,8 @@ enum FactoryId { SdDrawingDocumentFactoryId, SdPresentationDocumentFactoryId, - SdHtmlOptionsDialogFactoryId, - SdUnoModuleFactoryId, - RandomNodeFactoryId, - ConfigurationFactoryId, - ConfigurationControllerFactoryId, ModuleControllerFactoryId, - BasicPaneFactoryFactoryId, - BasicToolBarFactoryFactoryId, - BasicViewFactoryFactoryId, - PanelFactoryFactoryId, - ResourceIdFactoryId, - PresentationFactoryProviderFactoryId, - SlideRendererFactoryId, - PresenterCanvasFactoryId, - PresenterTextViewServiceFactoryId, - PresenterHelperServiceFactoryId, - PresenterPreviewCacheFactoryId, - SlideSorterServiceFactoryId, - SlideLayoutControllerFactoryId, - InsertSlideControllerFactoryId, }; typedef std::unordered_map<OUString, FactoryId, OUStringHash> FactoryMap; @@ -79,26 +56,6 @@ static ::boost::shared_ptr<FactoryMap> spFactoryMap; spFactoryMap.reset(new FactoryMap); (*spFactoryMap)[SdDrawingDocument_getImplementationName()] = SdDrawingDocumentFactoryId; (*spFactoryMap)[SdPresentationDocument_getImplementationName()] = SdPresentationDocumentFactoryId; - (*spFactoryMap)[SdHtmlOptionsDialog_getImplementationName()] = SdHtmlOptionsDialogFactoryId; - (*spFactoryMap)[SdUnoModule_getImplementationName()] = SdUnoModuleFactoryId; - (*spFactoryMap)[RandomNode__getImplementationName()] = RandomNodeFactoryId; - (*spFactoryMap)[Configuration_getImplementationName()] = ConfigurationFactoryId; - (*spFactoryMap)[ConfigurationController_getImplementationName()] = ConfigurationControllerFactoryId; - (*spFactoryMap)[ModuleController_getImplementationName()] = ModuleControllerFactoryId; - (*spFactoryMap)[BasicPaneFactory_getImplementationName()] = BasicPaneFactoryFactoryId; - (*spFactoryMap)[BasicToolBarFactory_getImplementationName()] = BasicToolBarFactoryFactoryId; - (*spFactoryMap)[BasicViewFactory_getImplementationName()] = BasicViewFactoryFactoryId; - (*spFactoryMap)[sidebar::PanelFactory_getImplementationName()] = PanelFactoryFactoryId; - (*spFactoryMap)[ResourceId_getImplementationName()] = ResourceIdFactoryId; - (*spFactoryMap)[PresentationFactoryProvider_getImplementationName()] = PresentationFactoryProviderFactoryId; - (*spFactoryMap)[SlideRenderer_getImplementationName()] = SlideRendererFactoryId; - (*spFactoryMap)[PresenterCanvas_getImplementationName()] = PresenterCanvasFactoryId; - (*spFactoryMap)[PresenterTextViewService_getImplementationName()] = PresenterTextViewServiceFactoryId; - (*spFactoryMap)[PresenterHelperService_getImplementationName()] = PresenterHelperServiceFactoryId; - (*spFactoryMap)[PresenterPreviewCache_getImplementationName()] = PresenterPreviewCacheFactoryId; - (*spFactoryMap)[SlideSorterService_getImplementationName()] = SlideSorterServiceFactoryId; - (*spFactoryMap)[SlideLayoutController_getImplementationName()] = SlideLayoutControllerFactoryId; - (*spFactoryMap)[InsertSlideController_getImplementationName()] = InsertSlideControllerFactoryId; } return spFactoryMap; }; @@ -128,14 +85,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sd_component_getFactory( { switch (iFactory->second) { - case SdHtmlOptionsDialogFactoryId: - xFactory = ::cppu::createSingleFactory( - xMSF, - SdHtmlOptionsDialog_getImplementationName(), - SdHtmlOptionsDialog_CreateInstance, - SdHtmlOptionsDialog_getSupportedServiceNames()); - break; - case SdDrawingDocumentFactoryId: xFactory = ::sfx2::createSfxModelFactory( xMSF, @@ -152,141 +101,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sd_component_getFactory( SdPresentationDocument_getSupportedServiceNames()); break; - case SdUnoModuleFactoryId: - xFactory = ::cppu::createSingleFactory( - xMSF, - SdUnoModule_getImplementationName(), - SdUnoModule_createInstance, - SdUnoModule_getSupportedServiceNames()); - break; - - case RandomNodeFactoryId: - xFactory = ::cppu::createSingleFactory( - xMSF, - sd::RandomNode__getImplementationName(), - sd::RandomNode_createInstance, - sd::RandomNode_getSupportedServiceNames()); - break; - - case ConfigurationFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::framework::Configuration_createInstance, - sd::framework::Configuration_getImplementationName(), - sd::framework::Configuration_getSupportedServiceNames()); - break; - - case ConfigurationControllerFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::framework::ConfigurationController_createInstance, - sd::framework::ConfigurationController_getImplementationName(), - sd::framework::ConfigurationController_getSupportedServiceNames()); - break; - - case ModuleControllerFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::framework::ModuleController_createInstance, - sd::framework::ModuleController_getImplementationName(), - sd::framework::ModuleController_getSupportedServiceNames()); - break; - - case BasicPaneFactoryFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::framework::BasicPaneFactory_createInstance, - sd::framework::BasicPaneFactory_getImplementationName(), - sd::framework::BasicPaneFactory_getSupportedServiceNames()); - break; - - case BasicToolBarFactoryFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::framework::BasicToolBarFactory_createInstance, - sd::framework::BasicToolBarFactory_getImplementationName(), - sd::framework::BasicToolBarFactory_getSupportedServiceNames()); - break; - - case BasicViewFactoryFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::framework::BasicViewFactory_createInstance, - sd::framework::BasicViewFactory_getImplementationName(), - sd::framework::BasicViewFactory_getSupportedServiceNames()); - break; - - case PanelFactoryFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::sidebar::PanelFactory_createInstance, - sd::sidebar::PanelFactory_getImplementationName(), - sd::sidebar::PanelFactory_getSupportedServiceNames()); - break; - - case ResourceIdFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::framework::ResourceId_createInstance, - sd::framework::ResourceId_getImplementationName(), - sd::framework::ResourceId_getSupportedServiceNames()); - break; - - case PresentationFactoryProviderFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::framework::PresentationFactoryProvider_createInstance, - sd::framework::PresentationFactoryProvider_getImplementationName(), - sd::framework::PresentationFactoryProvider_getSupportedServiceNames()); - break; - - case SlideRendererFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::presenter::SlideRenderer_createInstance, - sd::presenter::SlideRenderer_getImplementationName(), - sd::presenter::SlideRenderer_getSupportedServiceNames()); - break; - - case PresenterCanvasFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::presenter::PresenterCanvas_createInstance, - sd::presenter::PresenterCanvas_getImplementationName(), - sd::presenter::PresenterCanvas_getSupportedServiceNames()); - break; - - case PresenterTextViewServiceFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::presenter::PresenterTextViewService_createInstance, - sd::presenter::PresenterTextViewService_getImplementationName(), - sd::presenter::PresenterTextViewService_getSupportedServiceNames()); - break; - - case PresenterHelperServiceFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::presenter::PresenterHelperService_createInstance, - sd::presenter::PresenterHelperService_getImplementationName(), - sd::presenter::PresenterHelperService_getSupportedServiceNames()); - break; - - case PresenterPreviewCacheFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::presenter::PresenterPreviewCache_createInstance, - sd::presenter::PresenterPreviewCache_getImplementationName(), - sd::presenter::PresenterPreviewCache_getSupportedServiceNames()); - break; - - case SlideSorterServiceFactoryId: - xComponentFactory = ::cppu::createSingleComponentFactory( - sd::slidesorter::SlideSorterService_createInstance, - sd::slidesorter::SlideSorterService_getImplementationName(), - sd::slidesorter::SlideSorterService_getSupportedServiceNames()); - break; - - case SlideLayoutControllerFactoryId: - xFactory = ::cppu::createSingleFactory( - xMSF, - sd::SlideLayoutController_getImplementationName(), - sd::SlideLayoutController_createInstance, - sd::SlideLayoutController_getSupportedServiceNames()); - break; - - case InsertSlideControllerFactoryId: - xFactory = ::cppu::createSingleFactory( - xMSF, - sd::InsertSlideController_getImplementationName(), - sd::InsertSlideController_createInstance, - sd::InsertSlideController_getSupportedServiceNames()); default: break; } diff --git a/sd/source/ui/unoidl/randomnode.cxx b/sd/source/ui/unoidl/randomnode.cxx index 9c0285e9f2c3..c9647c0408d6 100644 --- a/sd/source/ui/unoidl/randomnode.cxx +++ b/sd/source/ui/unoidl/randomnode.cxx @@ -159,25 +159,6 @@ Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetCla return xInt; } -Reference< XInterface > SAL_CALL RandomNode_createInstance( const Reference< XMultiServiceFactory > & ) -{ - Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode() ) ); - return xInt; -} - -OUString RandomNode__getImplementationName() throw( RuntimeException ) -{ - return OUString( "sd::RandomAnimationNode" ) ; -} - -Sequence< OUString > SAL_CALL RandomNode_getSupportedServiceNames() throw( RuntimeException ) -{ - Sequence< OUString > aSeq( 2 ); - aSeq[0] = "com.sun.star.animations.ParallelTimeContainer"; - aSeq[1] = "com.sun.star.comp.sd.RandomAnimationNode"; - return aSeq; -} - RandomAnimationNode::RandomAnimationNode( const RandomAnimationNode& rNode ) : RandomAnimationNodeBase(), mnPresetClass( rNode.mnPresetClass ), @@ -568,7 +549,7 @@ Reference< XAnimationNode > SAL_CALL RandomAnimationNode::appendChild( const Ref // XServiceInfo OUString RandomAnimationNode::getImplementationName() throw(std::exception) { - return RandomNode__getImplementationName(); + return OUString( "sd::RandomAnimationNode" ) ; } // XServiceInfo @@ -580,9 +561,20 @@ sal_Bool RandomAnimationNode::supportsService(const OUString& ServiceName) throw // XServiceInfo Sequence< OUString > RandomAnimationNode::getSupportedServiceNames(void) throw(std::exception) { - return RandomNode_getSupportedServiceNames(); + Sequence< OUString > aSeq( 2 ); + aSeq[0] = "com.sun.star.animations.ParallelTimeContainer"; + aSeq[1] = "com.sun.star.comp.sd.RandomAnimationNode"; + return aSeq; +} + } +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_comp_embed_MSOLEObjectSystemCreator_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new sd::RandomAnimationNode()); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/unoidl/unomodule.cxx b/sd/source/ui/unoidl/unomodule.cxx index b62456ea3d8c..57c87e9407f8 100644 --- a/sd/source/ui/unoidl/unomodule.cxx +++ b/sd/source/ui/unoidl/unomodule.cxx @@ -33,25 +33,6 @@ using namespace ::com::sun::star; -OUString SAL_CALL SdUnoModule_getImplementationName() throw( uno::RuntimeException ) -{ - return OUString( "com.sun.star.comp.Draw.DrawingModule" ); -} - -uno::Sequence< OUString > SAL_CALL SdUnoModule_getSupportedServiceNames() throw( uno::RuntimeException ) -{ - uno::Sequence< OUString > aSeq( 1 ); - aSeq[0] = "com.sun.star.drawing.ModuleDispatcher"; - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SdUnoModule_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) -{ - SolarMutexGuard aGuard; - return uno::Reference< uno::XInterface >( static_cast< cppu::OWeakObject* >( new SdUnoModule( rSMgr ) ) ); -} - // XNotifyingDispatch void SAL_CALL SdUnoModule::dispatchWithNotification( const util::URL& aURL, const uno::Sequence< beans::PropertyValue >& aArgs, const uno::Reference< frame::XDispatchResultListener >& xListener ) throw (uno::RuntimeException, std::exception) @@ -132,7 +113,7 @@ uno::Reference< frame::XDispatch > SAL_CALL SdUnoModule::queryDispatch( const ut // XServiceInfo OUString SAL_CALL SdUnoModule::getImplementationName( ) throw(uno::RuntimeException, std::exception) { - return SdUnoModule_getImplementationName(); + return OUString( "com.sun.star.comp.Draw.DrawingModule" ); } sal_Bool SAL_CALL SdUnoModule::supportsService( const OUString& sServiceName ) throw(uno::RuntimeException, std::exception) @@ -142,7 +123,21 @@ sal_Bool SAL_CALL SdUnoModule::supportsService( const OUString& sServiceName ) t uno::Sequence< OUString > SAL_CALL SdUnoModule::getSupportedServiceNames( ) throw(uno::RuntimeException, std::exception) { - return SdUnoModule_getSupportedServiceNames(); + uno::Sequence< OUString > aSeq( 1 ); + aSeq[0] = "com.sun.star.drawing.ModuleDispatcher"; + return aSeq; +} + + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_comp_Draw_DrawingModule_get_implementation(::com::sun::star::uno::XComponentContext* context, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ + SolarMutexGuard aGuard; + + uno::Reference< lang::XMultiServiceFactory> xSM(context->getServiceManager(), uno::UNO_QUERY_THROW); + return cppu::acquire(new SdUnoModule(xSM)); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |