diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-22 09:27:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-22 14:40:58 +0200 |
commit | 5c2b301f031ff8374fcf0e4c2ed8f9bd4300815e (patch) | |
tree | 5a7091c2939a2244dc84548c411f9095b83305bf /extensions/source/propctrlr | |
parent | 690b9b08373dc7cc08517c4273c777154e893bd7 (diff) |
extensions/prop: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: I89d2c8d0b2bf960b3de1853c69fa64ff41b484ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99185
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions/source/propctrlr')
39 files changed, 300 insertions, 821 deletions
diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx index 50adc854e3d0..f015b297ba33 100644 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx +++ b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx @@ -24,12 +24,6 @@ #include "MasterDetailLinkDialog.hxx" #include "formlinkdialog.hxx" #include "modulepcr.hxx" -#include "pcrservices.hxx" - -extern "C" void createRegistryInfo_MasterDetailLinkDialog() -{ - ::pcr::OAutoRegistration< ::pcr::MasterDetailLinkDialog > aAutoRegistration; -} namespace pcr { @@ -50,32 +44,14 @@ namespace pcr } - Reference< XInterface > MasterDetailLinkDialog::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new MasterDetailLinkDialog( _rxContext ) ); - } - - OUString SAL_CALL MasterDetailLinkDialog::getImplementationName() { - return getImplementationName_static(); - } - - - OUString MasterDetailLinkDialog::getImplementationName_static() - { return "org.openoffice.comp.form.ui.MasterDetailLinkDialog"; } css::uno::Sequence<OUString> SAL_CALL MasterDetailLinkDialog::getSupportedServiceNames() { - return getSupportedServiceNames_static(); - } - - - css::uno::Sequence<OUString> MasterDetailLinkDialog::getSupportedServiceNames_static() - { return { "com.sun.star.form.MasterDetailLinkDialog" }; } @@ -149,5 +125,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_MasterDetailLinkDialog_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::MasterDetailLinkDialog(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.hxx b/extensions/source/propctrlr/MasterDetailLinkDialog.hxx index d18560794fc5..f196c755c093 100644 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.hxx +++ b/extensions/source/propctrlr/MasterDetailLinkDialog.hxx @@ -36,13 +36,6 @@ namespace pcr public: explicit MasterDetailLinkDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxContext); - // XServiceInfo - static methods - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static(); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static(); - static css::uno::Reference< css::uno::XInterface > - Create(const css::uno::Reference< css::uno::XComponentContext >&); private: // XTypeProvider virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override; diff --git a/extensions/source/propctrlr/buttonnavigationhandler.cxx b/extensions/source/propctrlr/buttonnavigationhandler.cxx index 5313fafec170..dc5b8d521c94 100644 --- a/extensions/source/propctrlr/buttonnavigationhandler.cxx +++ b/extensions/source/propctrlr/buttonnavigationhandler.cxx @@ -20,17 +20,10 @@ #include "buttonnavigationhandler.hxx" #include "formstrings.hxx" #include "formmetadata.hxx" -#include "pcrservices.hxx" #include "pushbuttonnavigation.hxx" #include <com/sun/star/form/inspection/FormComponentPropertyHandler.hpp> -extern "C" void createRegistryInfo_ButtonNavigationHandler() -{ - ::pcr::ButtonNavigationHandler::registerImplementation(); -} - - namespace pcr { @@ -43,7 +36,7 @@ namespace pcr using namespace ::com::sun::star::inspection; ButtonNavigationHandler::ButtonNavigationHandler( const Reference< XComponentContext >& _rxContext ) - :ButtonNavigationHandler_Base( _rxContext ) + :PropertyHandlerComponent( _rxContext ) { m_xSlaveHandler = css::form::inspection::FormComponentPropertyHandler::create( m_xContext ); @@ -55,22 +48,21 @@ namespace pcr } - OUString ButtonNavigationHandler::getImplementationName_static( ) + OUString ButtonNavigationHandler::getImplementationName( ) { return "com.sun.star.comp.extensions.ButtonNavigationHandler"; } - Sequence< OUString > ButtonNavigationHandler::getSupportedServiceNames_static( ) + Sequence< OUString > ButtonNavigationHandler::getSupportedServiceNames( ) { - Sequence<OUString> aSupported { "com.sun.star.form.inspection.ButtonNavigationHandler" }; - return aSupported; + return { "com.sun.star.form.inspection.ButtonNavigationHandler" }; } void SAL_CALL ButtonNavigationHandler::inspect( const Reference< XInterface >& _rxIntrospectee ) { - ButtonNavigationHandler_Base::inspect( _rxIntrospectee ); + PropertyHandlerComponent::inspect( _rxIntrospectee ); m_xSlaveHandler->inspect( _rxIntrospectee ); } @@ -211,7 +203,7 @@ namespace pcr eReturn = m_xSlaveHandler->onInteractivePropertySelection( _rPropertyName, _bPrimary, _rData, _rxInspectorUI ); break; default: - eReturn = ButtonNavigationHandler_Base::onInteractivePropertySelection( _rPropertyName, _bPrimary, _rData, _rxInspectorUI ); + eReturn = PropertyHandlerComponent::onInteractivePropertySelection( _rPropertyName, _bPrimary, _rData, _rxInspectorUI ); break; } @@ -258,7 +250,7 @@ namespace pcr aReturn = m_xSlaveHandler->describePropertyLine( _rPropertyName, _rxControlFactory ); break; default: - aReturn = ButtonNavigationHandler_Base::describePropertyLine( _rPropertyName, _rxControlFactory ); + aReturn = PropertyHandlerComponent::describePropertyLine( _rPropertyName, _rxControlFactory ); break; } @@ -268,5 +260,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_ButtonNavigationHandler_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::ButtonNavigationHandler(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/buttonnavigationhandler.hxx b/extensions/source/propctrlr/buttonnavigationhandler.hxx index 79ae7910aaf2..86a60c6ea75d 100644 --- a/extensions/source/propctrlr/buttonnavigationhandler.hxx +++ b/extensions/source/propctrlr/buttonnavigationhandler.hxx @@ -26,11 +26,9 @@ namespace pcr { - class ButtonNavigationHandler; - typedef HandlerComponentBase< ButtonNavigationHandler > ButtonNavigationHandler_Base; /** a property handler for any virtual string properties */ - class ButtonNavigationHandler : public ButtonNavigationHandler_Base + class ButtonNavigationHandler : public PropertyHandlerComponent { private: css::uno::Reference< css::inspection::XPropertyHandler > @@ -40,10 +38,6 @@ namespace pcr explicit ButtonNavigationHandler( const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); protected: virtual ~ButtonNavigationHandler() override; @@ -51,6 +45,10 @@ namespace pcr static bool isNavigationCapableButton( const css::uno::Reference< css::beans::XPropertySet >& _rxComponent ); protected: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override; + // XPropertyHandler overriables virtual void SAL_CALL inspect( const css::uno::Reference< css::uno::XInterface >& _rxIntrospectee ) override; virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override; diff --git a/extensions/source/propctrlr/cellbindinghandler.cxx b/extensions/source/propctrlr/cellbindinghandler.cxx index 04a63cd55658..f022f31b99ee 100644 --- a/extensions/source/propctrlr/cellbindinghandler.cxx +++ b/extensions/source/propctrlr/cellbindinghandler.cxx @@ -21,7 +21,6 @@ #include "formstrings.hxx" #include "formmetadata.hxx" #include "cellbindinghelper.hxx" -#include "pcrservices.hxx" #include <com/sun/star/form/binding/XValueBinding.hpp> #include <com/sun/star/lang/NullPointerException.hpp> @@ -31,12 +30,6 @@ #include <tools/diagnose_ex.h> -extern "C" void createRegistryInfo_CellBindingPropertyHandler() -{ - ::pcr::CellBindingPropertyHandler::registerImplementation(); -} - - namespace pcr { @@ -52,22 +45,21 @@ namespace pcr using namespace ::comphelper; CellBindingPropertyHandler::CellBindingPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :CellBindingPropertyHandler_Base( _rxContext ) + :PropertyHandlerComponent( _rxContext ) ,m_pCellExchangeConverter( new DefaultEnumRepresentation( *m_pInfoService, ::cppu::UnoType<sal_Int16>::get(), PROPERTY_ID_CELL_EXCHANGE_TYPE ) ) { } - OUString CellBindingPropertyHandler::getImplementationName_static( ) + OUString CellBindingPropertyHandler::getImplementationName( ) { return "com.sun.star.comp.extensions.CellBindingPropertyHandler"; } - Sequence< OUString > CellBindingPropertyHandler::getSupportedServiceNames_static( ) + Sequence< OUString > CellBindingPropertyHandler::getSupportedServiceNames( ) { - Sequence<OUString> aSupported { "com.sun.star.form.inspection.CellBindingPropertyHandler" }; - return aSupported; + return { "com.sun.star.form.inspection.CellBindingPropertyHandler" }; } @@ -484,5 +476,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_CellBindingPropertyHandler_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::CellBindingPropertyHandler(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/cellbindinghandler.hxx b/extensions/source/propctrlr/cellbindinghandler.hxx index 7814ce5b8ad4..7e247e28a9b3 100644 --- a/extensions/source/propctrlr/cellbindinghandler.hxx +++ b/extensions/source/propctrlr/cellbindinghandler.hxx @@ -34,9 +34,7 @@ namespace pcr class CellBindingHelper; class IPropertyEnumRepresentation; - class CellBindingPropertyHandler; - typedef HandlerComponentBase< CellBindingPropertyHandler > CellBindingPropertyHandler_Base; - class CellBindingPropertyHandler : public CellBindingPropertyHandler_Base + class CellBindingPropertyHandler : public PropertyHandlerComponent { private: std::unique_ptr< CellBindingHelper > m_pHelper; @@ -47,15 +45,14 @@ namespace pcr const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - protected: virtual ~CellBindingPropertyHandler() override; protected: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override; + // XPropertyHandler overriables virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override; virtual void SAL_CALL setPropertyValue( const OUString& _rPropertyName, const css::uno::Any& _rValue ) override; diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx index f6a44d357caf..d534cc66df24 100644 --- a/extensions/source/propctrlr/controlfontdialog.cxx +++ b/extensions/source/propctrlr/controlfontdialog.cxx @@ -26,13 +26,6 @@ #include "formstrings.hxx" #include "modulepcr.hxx" #include "pcrcommon.hxx" -#include "pcrservices.hxx" - -extern "C" void createRegistryInfo_OControlFontDialog() -{ - ::pcr::OAutoRegistration< ::pcr::OControlFontDialog > aAutoRegistration; -} - namespace pcr { @@ -73,34 +66,15 @@ namespace pcr } - Reference< XInterface > OControlFontDialog::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new OControlFontDialog( _rxContext ) ); - } - - OUString SAL_CALL OControlFontDialog::getImplementationName() { - return getImplementationName_static(); - } - - - OUString OControlFontDialog::getImplementationName_static() - { return "org.openoffice.comp.form.ui.OControlFontDialog"; } css::uno::Sequence<OUString> SAL_CALL OControlFontDialog::getSupportedServiceNames() { - return getSupportedServiceNames_static(); - } - - - css::uno::Sequence<OUString> OControlFontDialog::getSupportedServiceNames_static() - { - css::uno::Sequence<OUString> aSupported { "com.sun.star.form.ControlFontDialog" }; - return aSupported; + return { "com.sun.star.form.ControlFontDialog" }; } void OControlFontDialog::initialize( const Sequence< Any >& aArguments ) @@ -168,5 +142,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_OControlFontDialog_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::OControlFontDialog(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/controlfontdialog.hxx b/extensions/source/propctrlr/controlfontdialog.hxx index c48b7fd9b4fa..0f7dba0b1ed5 100644 --- a/extensions/source/propctrlr/controlfontdialog.hxx +++ b/extensions/source/propctrlr/controlfontdialog.hxx @@ -60,14 +60,6 @@ namespace pcr virtual OUString SAL_CALL getImplementationName() override; virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; - // XServiceInfo - static methods - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static(); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static(); - static css::uno::Reference< css::uno::XInterface > - Create(const css::uno::Reference< css::uno::XComponentContext >&); - // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; diff --git a/extensions/source/propctrlr/defaultforminspection.cxx b/extensions/source/propctrlr/defaultforminspection.cxx index 45570c757892..b4f491051f5b 100644 --- a/extensions/source/propctrlr/defaultforminspection.cxx +++ b/extensions/source/propctrlr/defaultforminspection.cxx @@ -19,7 +19,6 @@ #include "defaultforminspection.hxx" #include "pcrcommon.hxx" -#include "pcrservices.hxx" #include <helpids.h> #include <strings.hrc> #include "modulepcr.hxx" @@ -30,12 +29,6 @@ #include <sal/macros.h> -extern "C" void createRegistryInfo_DefaultFormComponentInspectorModel() -{ - ::pcr::OAutoRegistration< ::pcr::DefaultFormComponentInspectorModel > aAutoRegistration; -} - - namespace pcr { @@ -65,32 +58,13 @@ namespace pcr OUString SAL_CALL DefaultFormComponentInspectorModel::getImplementationName( ) { - return getImplementationName_static(); - } - - - Sequence< OUString > SAL_CALL DefaultFormComponentInspectorModel::getSupportedServiceNames( ) - { - return getSupportedServiceNames_static(); - } - - - OUString DefaultFormComponentInspectorModel::getImplementationName_static( ) - { return "org.openoffice.comp.extensions.DefaultFormComponentInspectorModel"; } - Sequence< OUString > DefaultFormComponentInspectorModel::getSupportedServiceNames_static( ) - { - Sequence< OUString > aSupported { "com.sun.star.form.inspection.DefaultFormComponentInspectorModel" }; - return aSupported; - } - - - Reference< XInterface > DefaultFormComponentInspectorModel::Create( const Reference< XComponentContext >& ) + Sequence< OUString > SAL_CALL DefaultFormComponentInspectorModel::getSupportedServiceNames( ) { - return *new DefaultFormComponentInspectorModel(); + return { "com.sun.star.form.inspection.DefaultFormComponentInspectorModel" }; } @@ -231,5 +205,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_DefaultFormComponentInspectorModel_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::DefaultFormComponentInspectorModel(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/defaultforminspection.hxx b/extensions/source/propctrlr/defaultforminspection.hxx index 0fd28b1e4cfd..38865b10f69c 100644 --- a/extensions/source/propctrlr/defaultforminspection.hxx +++ b/extensions/source/propctrlr/defaultforminspection.hxx @@ -55,14 +55,6 @@ namespace pcr virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; public: - // XServiceInfo - static versions - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - static css::uno::Reference< css::uno::XInterface > - Create(const css::uno::Reference< css::uno::XComponentContext >&); - explicit DefaultFormComponentInspectorModel( bool _bUseFormFormComponentHandlers = true ); private: diff --git a/extensions/source/propctrlr/defaulthelpprovider.cxx b/extensions/source/propctrlr/defaulthelpprovider.cxx index 322a04f8926c..0148e6e4a82c 100644 --- a/extensions/source/propctrlr/defaulthelpprovider.cxx +++ b/extensions/source/propctrlr/defaulthelpprovider.cxx @@ -20,7 +20,6 @@ #include "defaulthelpprovider.hxx" #include "pcrcommon.hxx" -#include "pcrservices.hxx" #include "modulepcr.hxx" #include <com/sun/star/ucb/AlreadyInitializedException.hpp> @@ -29,12 +28,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <vcl/window.hxx> #include <tools/diagnose_ex.h> - - -extern "C" void createRegistryInfo_DefaultHelpProvider() -{ - ::pcr::OAutoRegistration< ::pcr::DefaultHelpProvider > aAutoRegistration; -} +#include <cppuhelper/supportsservice.hxx> namespace pcr @@ -67,22 +61,19 @@ namespace pcr } - OUString DefaultHelpProvider::getImplementationName_static( ) + Sequence< OUString > SAL_CALL DefaultHelpProvider::getSupportedServiceNames() { - return "org.openoffice.comp.extensions.DefaultHelpProvider"; + return { "com.sun.star.inspection.DefaultHelpProvider" }; } - - Sequence< OUString > DefaultHelpProvider::getSupportedServiceNames_static( ) + OUString SAL_CALL DefaultHelpProvider::getImplementationName() { - Sequence< OUString > aSupported { "com.sun.star.inspection.DefaultHelpProvider" }; - return aSupported; + return "org.openoffice.comp.extensions.DefaultHelpProvider"; } - - Reference< XInterface > DefaultHelpProvider::Create( const Reference< XComponentContext >& ) + sal_Bool SAL_CALL DefaultHelpProvider::supportsService(const OUString& aServiceName) { - return *new DefaultHelpProvider; + return cppu::supportsService(this, aServiceName); } @@ -183,5 +174,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_DefaultHelpProvider_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::DefaultHelpProvider()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/defaulthelpprovider.hxx b/extensions/source/propctrlr/defaulthelpprovider.hxx index 95ccc1d53d8c..e70ad124912b 100644 --- a/extensions/source/propctrlr/defaulthelpprovider.hxx +++ b/extensions/source/propctrlr/defaulthelpprovider.hxx @@ -22,6 +22,7 @@ #include <com/sun/star/inspection/XPropertyControlObserver.hpp> #include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -38,6 +39,7 @@ namespace pcr typedef ::cppu::WeakImplHelper < css::inspection::XPropertyControlObserver , css::lang::XInitialization + , css::lang::XServiceInfo > DefaultHelpProvider_Base; class DefaultHelpProvider final : public DefaultHelpProvider_Base { @@ -49,17 +51,14 @@ namespace pcr public: DefaultHelpProvider(); - // XServiceInfo - static versions - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - static css::uno::Reference< css::uno::XInterface > - Create(const css::uno::Reference< css::uno::XComponentContext >&); - private: virtual ~DefaultHelpProvider() override; + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override; + // XPropertyControlObserver virtual void SAL_CALL focusGained( const css::uno::Reference< css::inspection::XPropertyControl >& Control ) override; virtual void SAL_CALL valueChanged( const css::uno::Reference< css::inspection::XPropertyControl >& Control ) override; diff --git a/extensions/source/propctrlr/editpropertyhandler.cxx b/extensions/source/propctrlr/editpropertyhandler.cxx index fc088d95a39e..72fc1042ab48 100644 --- a/extensions/source/propctrlr/editpropertyhandler.cxx +++ b/extensions/source/propctrlr/editpropertyhandler.cxx @@ -20,7 +20,6 @@ #include "editpropertyhandler.hxx" #include "formstrings.hxx" #include "formmetadata.hxx" -#include "pcrservices.hxx" #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <com/sun/star/lang/NullPointerException.hpp> @@ -31,12 +30,6 @@ #define TEXTTYPE_RICHTEXT 2 -extern "C" void createRegistryInfo_EditPropertyHandler() -{ - ::pcr::EditPropertyHandler::registerImplementation(); -} - - namespace pcr { @@ -53,7 +46,7 @@ namespace pcr EditPropertyHandler::EditPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :EditPropertyHandler_Base( _rxContext ) + :PropertyHandlerComponent( _rxContext ) { } @@ -63,16 +56,15 @@ namespace pcr } - OUString EditPropertyHandler::getImplementationName_static( ) + OUString EditPropertyHandler::getImplementationName( ) { return "com.sun.star.comp.extensions.EditPropertyHandler"; } - Sequence< OUString > EditPropertyHandler::getSupportedServiceNames_static( ) + Sequence< OUString > EditPropertyHandler::getSupportedServiceNames( ) { - Sequence<OUString> aSupported { "com.sun.star.form.inspection.EditPropertyHandler" }; - return aSupported; + return { "com.sun.star.form.inspection.EditPropertyHandler" }; } @@ -306,5 +298,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_EditPropertyHandler_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::EditPropertyHandler(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/editpropertyhandler.hxx b/extensions/source/propctrlr/editpropertyhandler.hxx index 3e1478efa57f..ccc3d19782c0 100644 --- a/extensions/source/propctrlr/editpropertyhandler.hxx +++ b/extensions/source/propctrlr/editpropertyhandler.hxx @@ -30,25 +30,23 @@ namespace pcr //= EditPropertyHandler class EditPropertyHandler; - typedef HandlerComponentBase< EditPropertyHandler > EditPropertyHandler_Base; /** a property handler for any virtual string properties */ - class EditPropertyHandler : public EditPropertyHandler_Base + class EditPropertyHandler : public PropertyHandlerComponent { public: explicit EditPropertyHandler( const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - protected: virtual ~EditPropertyHandler() override; protected: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override; + // XPropertyHandler overriables virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override; virtual void SAL_CALL setPropertyValue( const OUString& _rPropertyName, const css::uno::Any& _rValue ) override; diff --git a/extensions/source/propctrlr/eformspropertyhandler.cxx b/extensions/source/propctrlr/eformspropertyhandler.cxx index 7b11d1191929..0a972e25697a 100644 --- a/extensions/source/propctrlr/eformspropertyhandler.cxx +++ b/extensions/source/propctrlr/eformspropertyhandler.cxx @@ -20,7 +20,6 @@ #include "eformspropertyhandler.hxx" #include "formstrings.hxx" #include "formmetadata.hxx" -#include "pcrservices.hxx" #include <propctrlr.h> #include "eformshelper.hxx" #include "handlerhelper.hxx" @@ -34,12 +33,6 @@ #include <sal/log.hxx> -extern "C" void createRegistryInfo_EFormsPropertyHandler() -{ - ::pcr::EFormsPropertyHandler::registerImplementation(); -} - - namespace pcr { @@ -59,7 +52,7 @@ namespace pcr EFormsPropertyHandler::EFormsPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :EFormsPropertyHandler_Base( _rxContext ) + :PropertyHandlerComponent( _rxContext ) ,m_bSimulatingModelChange( false ) { } @@ -70,16 +63,15 @@ namespace pcr } - OUString EFormsPropertyHandler::getImplementationName_static( ) + OUString EFormsPropertyHandler::getImplementationName( ) { return "com.sun.star.comp.extensions.EFormsPropertyHandler"; } - Sequence< OUString > EFormsPropertyHandler::getSupportedServiceNames_static( ) + Sequence< OUString > EFormsPropertyHandler::getSupportedServiceNames( ) { - Sequence<OUString> aSupported { "com.sun.star.form.inspection.XMLFormsPropertyHandler" }; - return aSupported; + return { "com.sun.star.form.inspection.XMLFormsPropertyHandler" }; } @@ -270,7 +262,7 @@ namespace pcr void EFormsPropertyHandler::onNewComponent() { - EFormsPropertyHandler_Base::onNewComponent(); + PropertyHandlerComponent::onNewComponent(); Reference< frame::XModel > xDocument( impl_getContextDocument_nothrow() ); DBG_ASSERT( xDocument.is(), "EFormsPropertyHandler::onNewComponent: no document!" ); @@ -339,7 +331,7 @@ namespace pcr break; default: - aReturn = EFormsPropertyHandler_Base::convertToPropertyValue( _rPropertyName, _rControlValue ); + aReturn = PropertyHandlerComponent::convertToPropertyValue( _rPropertyName, _rControlValue ); break; } @@ -373,7 +365,7 @@ namespace pcr break; default: - aReturn = EFormsPropertyHandler_Base::convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType ); + aReturn = PropertyHandlerComponent::convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType ); break; } @@ -531,7 +523,7 @@ namespace pcr void SAL_CALL EFormsPropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) { ::osl::MutexGuard aGuard( m_aMutex ); - EFormsPropertyHandler_Base::addPropertyChangeListener( _rxListener ); + PropertyHandlerComponent::addPropertyChangeListener( _rxListener ); if (m_pHelper) m_pHelper->registerBindingListener( _rxListener ); } @@ -542,7 +534,7 @@ namespace pcr ::osl::MutexGuard aGuard( m_aMutex ); if (m_pHelper) m_pHelper->revokeBindingListener( _rxListener ); - EFormsPropertyHandler_Base::removePropertyChangeListener( _rxListener ); + PropertyHandlerComponent::removePropertyChangeListener( _rxListener ); } @@ -596,5 +588,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_EFormsPropertyHandler_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::EFormsPropertyHandler(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eformspropertyhandler.hxx b/extensions/source/propctrlr/eformspropertyhandler.hxx index b099ead7ec5d..7233edb07cf2 100644 --- a/extensions/source/propctrlr/eformspropertyhandler.hxx +++ b/extensions/source/propctrlr/eformspropertyhandler.hxx @@ -34,8 +34,7 @@ namespace pcr //= EFormsPropertyHandler class EFormsPropertyHandler; - typedef HandlerComponentBase< EFormsPropertyHandler > EFormsPropertyHandler_Base; - class EFormsPropertyHandler : public EFormsPropertyHandler_Base + class EFormsPropertyHandler : public PropertyHandlerComponent { private: std::unique_ptr< EFormsHelper > m_pHelper; @@ -51,15 +50,14 @@ namespace pcr const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - protected: virtual ~EFormsPropertyHandler() override; protected: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override; + // XPropertyHandler overriables virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override; virtual void SAL_CALL setPropertyValue( const OUString& _rPropertyName, const css::uno::Any& _rValue ) override; diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index 9e36427cecdc..45a27113aff5 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -19,7 +19,6 @@ #include "eventhandler.hxx" -#include "pcrservices.hxx" #include <helpids.h> #include <propctrlr.h> #include "formbrowsertools.hxx" @@ -65,11 +64,6 @@ #include <algorithm> #include <iterator> -extern "C" void createRegistryInfo_EventHandler() -{ - ::pcr::OAutoRegistration< ::pcr::EventHandler > aAutoRegistration; -} - namespace pcr { @@ -444,7 +438,7 @@ namespace pcr OUString SAL_CALL EventHandler::getImplementationName( ) { - return getImplementationName_static(); + return "com.sun.star.comp.extensions.EventHandler"; } sal_Bool SAL_CALL EventHandler::supportsService( const OUString& ServiceName ) @@ -454,23 +448,7 @@ namespace pcr Sequence< OUString > SAL_CALL EventHandler::getSupportedServiceNames( ) { - return getSupportedServiceNames_static(); - } - - OUString EventHandler::getImplementationName_static( ) - { - return "com.sun.star.comp.extensions.EventHandler"; - } - - Sequence< OUString > EventHandler::getSupportedServiceNames_static( ) - { - Sequence<OUString> aSupported { "com.sun.star.form.inspection.EventHandler" }; - return aSupported; - } - - Reference< XInterface > EventHandler::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new EventHandler( _rxContext ) ); + return { "com.sun.star.form.inspection.EventHandler" }; } void SAL_CALL EventHandler::inspect( const Reference< XInterface >& _rxIntrospectee ) @@ -1126,4 +1104,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_EventHandler_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::EventHandler(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/eventhandler.hxx b/extensions/source/propctrlr/eventhandler.hxx index bb1b982b4f9b..911380be766f 100644 --- a/extensions/source/propctrlr/eventhandler.hxx +++ b/extensions/source/propctrlr/eventhandler.hxx @@ -94,20 +94,13 @@ namespace pcr sal_Int16 m_nGridColumnType; public: - // XServiceInfo - static versions - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - static css::uno::Reference< css::uno::XInterface > Create( const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); - - private: explicit EventHandler( const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); virtual ~EventHandler() override; + private: // XPropertyHandler overridables virtual void SAL_CALL inspect( const css::uno::Reference< css::uno::XInterface >& _rxIntrospectee ) override; virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override; diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 8094deb95af3..7e44e5dce226 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -19,7 +19,6 @@ #include "controltype.hxx" -#include "pcrservices.hxx" #include <propctrlr.h> #include <helpids.h> #include "fontdialog.hxx" @@ -106,12 +105,6 @@ #include <limits> #include <memory> -extern "C" void createRegistryInfo_FormComponentPropertyHandler() -{ - ::pcr::FormComponentPropertyHandler::registerImplementation(); -} - - namespace pcr { @@ -142,8 +135,8 @@ namespace pcr #define PROPERTY_ID_ROWSET 1 FormComponentPropertyHandler::FormComponentPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :FormComponentPropertyHandler_Base( _rxContext ) - ,::comphelper::OPropertyContainer(FormComponentPropertyHandler_Base::rBHelper) + :PropertyHandlerComponent( _rxContext ) + ,::comphelper::OPropertyContainer(PropertyHandlerComponent::rBHelper) ,m_sDefaultValueString( PcrRes(RID_STR_STANDARD) ) ,m_eComponentClass( eUnknown ) ,m_bComponentIsSubForm( false ) @@ -159,18 +152,17 @@ namespace pcr { } - IMPLEMENT_FORWARD_XINTERFACE2(FormComponentPropertyHandler,FormComponentPropertyHandler_Base,::comphelper::OPropertyContainer) + IMPLEMENT_FORWARD_XINTERFACE2(FormComponentPropertyHandler,PropertyHandlerComponent,::comphelper::OPropertyContainer) - OUString FormComponentPropertyHandler::getImplementationName_static( ) + OUString FormComponentPropertyHandler::getImplementationName( ) { return "com.sun.star.comp.extensions.FormComponentPropertyHandler"; } - Sequence< OUString > FormComponentPropertyHandler::getSupportedServiceNames_static( ) + Sequence< OUString > FormComponentPropertyHandler::getSupportedServiceNames( ) { - Sequence<OUString> aSupported { "com.sun.star.form.inspection.FormComponentPropertyHandler" }; - return aSupported; + return { "com.sun.star.form.inspection.FormComponentPropertyHandler" }; } namespace { @@ -575,7 +567,7 @@ namespace pcr case PROPERTY_ID_WRITING_MODE: { - aPropertyValue = FormComponentPropertyHandler_Base::convertToPropertyValue( _rPropertyName, _rControlValue ); + aPropertyValue = PropertyHandlerComponent::convertToPropertyValue( _rPropertyName, _rControlValue ); sal_Int16 nNormalizedValue( 2 ); if( ! (aPropertyValue >>= nNormalizedValue) ) @@ -598,7 +590,7 @@ namespace pcr break; default: - aPropertyValue = FormComponentPropertyHandler_Base::convertToPropertyValue( _rPropertyName, _rControlValue ); + aPropertyValue = PropertyHandlerComponent::convertToPropertyValue( _rPropertyName, _rControlValue ); break; // default } // switch ( nPropId ) @@ -723,7 +715,7 @@ namespace pcr break; } - aControlValue = FormComponentPropertyHandler_Base::convertToControlValue( _rPropertyName, makeAny( nNormalized ), _rControlValueType ); + aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, makeAny( nNormalized ), _rControlValueType ); } break; @@ -774,7 +766,7 @@ namespace pcr break; default: - aControlValue = FormComponentPropertyHandler_Base::convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType ); + aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, _rPropertyValue, _rControlValueType ); break; } // switch ( nPropId ) @@ -793,7 +785,7 @@ namespace pcr void SAL_CALL FormComponentPropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) { ::osl::MutexGuard aGuard( m_aMutex ); - FormComponentPropertyHandler_Base::addPropertyChangeListener( _rxListener ); + PropertyHandlerComponent::addPropertyChangeListener( _rxListener ); if ( m_xComponent.is() ) m_xComponent->addPropertyChangeListener( OUString(), _rxListener ); } @@ -803,7 +795,7 @@ namespace pcr ::osl::MutexGuard aGuard( m_aMutex ); if ( m_xComponent.is() ) m_xComponent->removePropertyChangeListener( OUString(), _rxListener ); - FormComponentPropertyHandler_Base::removePropertyChangeListener( _rxListener ); + PropertyHandlerComponent::removePropertyChangeListener( _rxListener ); } Sequence< Property > FormComponentPropertyHandler::doDescribeSupportedProperties() const @@ -2012,7 +2004,7 @@ namespace pcr void SAL_CALL FormComponentPropertyHandler::disposing() { - FormComponentPropertyHandler_Base::disposing(); + PropertyHandlerComponent::disposing(); if ( m_xCommandDesigner.is() && m_xCommandDesigner->isActive() ) m_xCommandDesigner->dispose(); } @@ -2028,7 +2020,7 @@ namespace pcr void FormComponentPropertyHandler::onNewComponent() { - FormComponentPropertyHandler_Base::onNewComponent(); + PropertyHandlerComponent::onNewComponent(); if ( !m_xComponentPropertyInfo.is() && m_xComponent.is() ) throw NullPointerException(); @@ -3304,5 +3296,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_FormComponentPropertyHandler_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::FormComponentPropertyHandler(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formcomponenthandler.hxx b/extensions/source/propctrlr/formcomponenthandler.hxx index 019d6ecf8357..8359cdbccc04 100644 --- a/extensions/source/propctrlr/formcomponenthandler.hxx +++ b/extensions/source/propctrlr/formcomponenthandler.hxx @@ -51,11 +51,10 @@ namespace pcr //= FormComponentPropertyHandler class FormComponentPropertyHandler; - typedef HandlerComponentBase< FormComponentPropertyHandler > FormComponentPropertyHandler_Base; typedef ::comphelper::OPropertyArrayUsageHelper<FormComponentPropertyHandler> FormComponentPropertyHandler_PROP; /** default ->XPropertyHandler for all form components. */ - class FormComponentPropertyHandler : public FormComponentPropertyHandler_Base, + class FormComponentPropertyHandler : public PropertyHandlerComponent, public ::comphelper::OPropertyContainer, public FormComponentPropertyHandler_PROP { @@ -99,15 +98,14 @@ namespace pcr // XPropertySet virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - protected: virtual ~FormComponentPropertyHandler() override; protected: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override; + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; // XPropertyHandler overridables diff --git a/extensions/source/propctrlr/formcontroller.cxx b/extensions/source/propctrlr/formcontroller.cxx index 196e6b0c2fa5..41bc6b30318f 100644 --- a/extensions/source/propctrlr/formcontroller.cxx +++ b/extensions/source/propctrlr/formcontroller.cxx @@ -20,7 +20,6 @@ #include "formcontroller.hxx" #include "modulepcr.hxx" #include "pcrcommon.hxx" -#include "pcrservices.hxx" #include "formstrings.hxx" #include "defaultforminspection.hxx" @@ -29,13 +28,6 @@ #include <cppuhelper/typeprovider.hxx> -extern "C" void createRegistryInfo_FormController() -{ - ::pcr::OAutoRegistration< ::pcr::FormController > aFormControllerRegistration; - ::pcr::OAutoRegistration< ::pcr::DialogController > aDialogControllerRegistration; -} - - namespace pcr { @@ -64,11 +56,14 @@ namespace pcr //= FormController - FormController::FormController( const Reference< XComponentContext >& _rxContext, ServiceDescriptor _aServiceDescriptor, + FormController::FormController( const Reference< XComponentContext >& _rxContext, + const OUString& sImplementationName, + const css::uno::Sequence<OUString>& aSupportedServiceNames, bool _bUseFormFormComponentHandlers ) :OPropertyBrowserController( _rxContext ) ,FormController_PropertyBase1( m_aBHelper ) - ,m_aServiceDescriptor( _aServiceDescriptor ) + ,m_sImplementationName( sImplementationName ) + ,m_aSupportedServiceNames( aSupportedServiceNames ) { osl_atomic_increment( &m_refCount ); { @@ -106,40 +101,19 @@ namespace pcr OUString SAL_CALL FormController::getImplementationName( ) { - return m_aServiceDescriptor.GetImplementationName(); + return m_sImplementationName; } Sequence< OUString > SAL_CALL FormController::getSupportedServiceNames( ) { - Sequence< OUString > aSupported( m_aServiceDescriptor.GetSupportedServiceNames() ); + Sequence< OUString > aSupported( m_aSupportedServiceNames ); aSupported.realloc( aSupported.getLength() + 1 ); aSupported[ aSupported.getLength() - 1 ] = "com.sun.star.inspection.ObjectInspector"; return aSupported; } - OUString FormController::getImplementationName_static( ) - { - return "org.openoffice.comp.extensions.FormController"; - } - - - Sequence< OUString > FormController::getSupportedServiceNames_static( ) - { - return { "com.sun.star.form.PropertyBrowserController" }; - } - - - Reference< XInterface > FormController::Create(const Reference< XComponentContext >& _rxContext ) - { - ServiceDescriptor aService; - aService.GetImplementationName = &FormController::getImplementationName_static; - aService.GetSupportedServiceNames = &FormController::getSupportedServiceNames_static; - return *(new FormController( _rxContext, aService, true ) ); - } - - Reference< XPropertySetInfo > SAL_CALL FormController::getPropertySetInfo( ) { return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); @@ -242,31 +216,27 @@ namespace pcr } - //= DialogController - - - OUString DialogController::getImplementationName_static( ) - { - return "org.openoffice.comp.extensions.DialogController"; - } - - - Sequence< OUString > DialogController::getSupportedServiceNames_static( ) - { - return { "com.sun.star.awt.PropertyBrowserController" }; - } - - - Reference< XInterface > DialogController::Create(const Reference< XComponentContext >& _rxContext) - { - ServiceDescriptor aService; - aService.GetImplementationName = &DialogController::getImplementationName_static; - aService.GetSupportedServiceNames = &DialogController::getSupportedServiceNames_static; - return *(new FormController( _rxContext, aService, false ) ); - } - } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_FormController_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::FormController( context, + "org.openoffice.comp.extensions.FormController", + { "com.sun.star.form.PropertyBrowserController" }, + true ) ); +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_DialogController_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::FormController( context, + "org.openoffice.comp.extensions.DialogController", + { "com.sun.star.awt.PropertyBrowserController" }, + false ) ); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formcontroller.hxx b/extensions/source/propctrlr/formcontroller.hxx index 82dd842ef8b4..b66b9de604ca 100644 --- a/extensions/source/propctrlr/formcontroller.hxx +++ b/extensions/source/propctrlr/formcontroller.hxx @@ -30,17 +30,6 @@ namespace pcr { - //= ServiceDescriptor - - struct ServiceDescriptor - { - OUString - ( *GetImplementationName )( void ); - css::uno::Sequence< OUString > - ( *GetSupportedServiceNames )( void ); - }; - - //= FormController class FormController; @@ -57,24 +46,18 @@ namespace pcr ,public FormController_PropertyBase2 { private: - ServiceDescriptor m_aServiceDescriptor; css::uno::Reference< css::beans::XPropertySet > m_xCurrentInspectee; + OUString m_sImplementationName; + css::uno::Sequence<OUString> m_aSupportedServiceNames; public: FormController( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, - ServiceDescriptor _aServiceDescriptor, + const OUString& sImplementName, + const css::uno::Sequence<OUString>& aSupportedServiceNames, bool _bUseFormFormComponentHandlers ); - // XServiceInfo - static versions - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - static css::uno::Reference< css::uno::XInterface > - Create(const css::uno::Reference< css::uno::XComponentContext >&); - protected: virtual ~FormController() override; diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx index 99ff37e2efaa..8f7c04677538 100644 --- a/extensions/source/propctrlr/formgeometryhandler.cxx +++ b/extensions/source/propctrlr/formgeometryhandler.cxx @@ -19,7 +19,6 @@ #include <sal/config.h> -#include "pcrservices.hxx" #include "propertyhandler.hxx" #include "formmetadata.hxx" #include "formstrings.hxx" @@ -211,28 +210,26 @@ namespace pcr } - typedef HandlerComponentBase< FormGeometryHandler > FormGeometryHandler_Base; /** a property handler for any virtual string properties */ namespace { - class FormGeometryHandler : public FormGeometryHandler_Base + class FormGeometryHandler : public PropertyHandlerComponent { public: explicit FormGeometryHandler( const Reference< XComponentContext >& _rxContext ); - /// @throws RuntimeException - static OUString getImplementationName_static( ); - /// @throws RuntimeException - static Sequence< OUString > getSupportedServiceNames_static( ); - protected: virtual ~FormGeometryHandler() override; protected: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override; + // XPropertyHandler overriables virtual Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override; virtual void SAL_CALL setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) override; @@ -268,7 +265,7 @@ namespace pcr FormGeometryHandler::FormGeometryHandler( const Reference< XComponentContext >& _rxContext ) - :FormGeometryHandler_Base( _rxContext ) + :PropertyHandlerComponent( _rxContext ) { } @@ -294,7 +291,7 @@ namespace pcr m_xAssociatedShape.clear(); m_xShapeProperties.clear(); - FormGeometryHandler_Base::onNewComponent(); + PropertyHandlerComponent::onNewComponent(); try { @@ -324,16 +321,15 @@ namespace pcr } - OUString FormGeometryHandler::getImplementationName_static( ) + OUString FormGeometryHandler::getImplementationName( ) { return "com.sun.star.comp.extensions.FormGeometryHandler"; } - Sequence< OUString > FormGeometryHandler::getSupportedServiceNames_static( ) + Sequence< OUString > FormGeometryHandler::getSupportedServiceNames( ) { - Sequence<OUString> aSupported { "com.sun.star.form.inspection.FormGeometryHandler" }; - return aSupported; + return { "com.sun.star.form.inspection.FormGeometryHandler" }; } @@ -576,7 +572,7 @@ namespace pcr void SAL_CALL FormGeometryHandler::disposing() { - FormGeometryHandler_Base::disposing(); + PropertyHandlerComponent::disposing(); if ( m_xChangeNotifier.is() ) { @@ -815,10 +811,11 @@ namespace pcr } // namespace pcr - -extern "C" void createRegistryInfo_FormGeometryHandler() +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_FormGeometryHandler_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) { - ::pcr::FormGeometryHandler::registerImplementation(); + return cppu::acquire(new pcr::FormGeometryHandler(context)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index 6a7d67eae5a5..b8ae6f37bc5f 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -21,7 +21,6 @@ #include "genericpropertyhandler.hxx" #include "handlerhelper.hxx" #include "modulepcr.hxx" -#include "pcrservices.hxx" #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/lang/NullPointerException.hpp> @@ -45,11 +44,6 @@ #include <algorithm> -extern "C" void createRegistryInfo_GenericPropertyHandler() -{ - ::pcr::OAutoRegistration< ::pcr::GenericPropertyHandler > aAutoRegistration; -} - namespace pcr { @@ -278,7 +272,7 @@ namespace pcr OUString SAL_CALL GenericPropertyHandler::getImplementationName( ) { - return getImplementationName_static(); + return "com.sun.star.comp.extensions.GenericPropertyHandler"; } sal_Bool SAL_CALL GenericPropertyHandler::supportsService( const OUString& ServiceName ) @@ -288,23 +282,7 @@ namespace pcr Sequence< OUString > SAL_CALL GenericPropertyHandler::getSupportedServiceNames( ) { - return getSupportedServiceNames_static(); - } - - OUString GenericPropertyHandler::getImplementationName_static( ) - { - return "com.sun.star.comp.extensions.GenericPropertyHandler"; - } - - Sequence< OUString > GenericPropertyHandler::getSupportedServiceNames_static( ) - { - Sequence<OUString> aSupported { "com.sun.star.inspection.GenericPropertyHandler" }; - return aSupported; - } - - Reference< XInterface > GenericPropertyHandler::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new GenericPropertyHandler( _rxContext ) ); + return { "com.sun.star.inspection.GenericPropertyHandler" }; } void SAL_CALL GenericPropertyHandler::inspect( const Reference< XInterface >& _rxIntrospectee ) @@ -632,4 +610,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_GenericPropertyHandler_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::GenericPropertyHandler(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/genericpropertyhandler.hxx b/extensions/source/propctrlr/genericpropertyhandler.hxx index 3f197ffad9b3..c5c676f9c235 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.hxx +++ b/extensions/source/propctrlr/genericpropertyhandler.hxx @@ -80,20 +80,13 @@ namespace pcr bool m_bPropertyMapInitialized : 1; public: - // XServiceInfo - static versions - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - static css::uno::Reference< css::uno::XInterface > Create( const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); - - private: explicit GenericPropertyHandler( const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); virtual ~GenericPropertyHandler() override; + private: // XPropertyHandler overridables virtual void SAL_CALL inspect( const css::uno::Reference< css::uno::XInterface >& _rxIntrospectee ) override; virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override; diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx index 00520029b490..49e876b0a232 100644 --- a/extensions/source/propctrlr/objectinspectormodel.cxx +++ b/extensions/source/propctrlr/objectinspectormodel.cxx @@ -19,7 +19,6 @@ #include "modulepcr.hxx" #include "pcrcommon.hxx" -#include "pcrservices.hxx" #include "inspectormodelbase.hxx" #include <com/sun/star/ucb/AlreadyInitializedException.hpp> @@ -64,14 +63,6 @@ namespace pcr virtual OUString SAL_CALL getImplementationName( ) override; virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - // XServiceInfo - static versions - /// @throws RuntimeException - static OUString getImplementationName_static( ); - /// @throws RuntimeException - static Sequence< OUString > getSupportedServiceNames_static( ); - static Reference< XInterface > - Create(const Reference< XComponentContext >&); - protected: void createDefault(); void createWithHandlerFactories( const Sequence< Any >& _rFactories ); @@ -150,34 +141,16 @@ namespace pcr OUString SAL_CALL ObjectInspectorModel::getImplementationName( ) { - return getImplementationName_static(); - } - - - Sequence< OUString > SAL_CALL ObjectInspectorModel::getSupportedServiceNames( ) - { - return getSupportedServiceNames_static(); - } - - - OUString ObjectInspectorModel::getImplementationName_static( ) - { return "org.openoffice.comp.extensions.ObjectInspectorModel"; } - Sequence< OUString > ObjectInspectorModel::getSupportedServiceNames_static( ) + Sequence< OUString > SAL_CALL ObjectInspectorModel::getSupportedServiceNames( ) { return { "com.sun.star.inspection.ObjectInspectorModel" }; } - Reference< XInterface > ObjectInspectorModel::Create(const Reference< XComponentContext >& /* _rxContext */ ) - { - return *( new ObjectInspectorModel() ); - } - - void ObjectInspectorModel::createDefault() { m_aFactories.realloc( 1 ); @@ -213,10 +186,11 @@ namespace pcr } // namespace pcr - -extern "C" void createRegistryInfo_ObjectInspectorModel() +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_ObjectInspectorModel_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - ::pcr::OAutoRegistration< ::pcr::ObjectInspectorModel > aObjectInspectorModelRegistration; + return cppu::acquire(new pcr::ObjectInspectorModel()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcr.component b/extensions/source/propctrlr/pcr.component index b409293c4c91..3d0214ded4a5 100644 --- a/extensions/source/propctrlr/pcr.component +++ b/extensions/source/propctrlr/pcr.component @@ -18,65 +18,85 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="pcr" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="StringRepresentation"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="StringRepresentation" + constructor="extensions_propctrlr_StringRepresentation_get_implementation"> <service name="com.sun.star.inspection.StringRepresentation"/> </implementation> - <implementation name="com.sun.star.comp.extensions.ButtonNavigationHandler"> + <implementation name="com.sun.star.comp.extensions.ButtonNavigationHandler" + constructor="extensions_propctrlr_ButtonNavigationHandler_get_implementation"> <service name="com.sun.star.form.inspection.ButtonNavigationHandler"/> </implementation> - <implementation name="com.sun.star.comp.extensions.CellBindingPropertyHandler"> + <implementation name="com.sun.star.comp.extensions.CellBindingPropertyHandler" + constructor="extensions_propctrlr_CellBindingPropertyHandler_get_implementation"> <service name="com.sun.star.form.inspection.CellBindingPropertyHandler"/> </implementation> - <implementation name="com.sun.star.comp.extensions.EFormsPropertyHandler"> + <implementation name="com.sun.star.comp.extensions.EFormsPropertyHandler" + constructor="extensions_propctrlr_EFormsPropertyHandler_get_implementation"> <service name="com.sun.star.form.inspection.XMLFormsPropertyHandler"/> </implementation> - <implementation name="com.sun.star.comp.extensions.EditPropertyHandler"> + <implementation name="com.sun.star.comp.extensions.EditPropertyHandler" + constructor="extensions_propctrlr_EditPropertyHandler_get_implementation"> <service name="com.sun.star.form.inspection.EditPropertyHandler"/> </implementation> - <implementation name="com.sun.star.comp.extensions.EventHandler"> + <implementation name="com.sun.star.comp.extensions.EventHandler" + constructor="extensions_propctrlr_EventHandler_get_implementation"> <service name="com.sun.star.form.inspection.EventHandler"/> </implementation> - <implementation name="com.sun.star.comp.extensions.FormComponentPropertyHandler"> + <implementation name="com.sun.star.comp.extensions.FormComponentPropertyHandler" + constructor="extensions_propctrlr_FormComponentPropertyHandler_get_implementation"> <service name="com.sun.star.form.inspection.FormComponentPropertyHandler"/> </implementation> - <implementation name="com.sun.star.comp.extensions.FormGeometryHandler"> + <implementation name="com.sun.star.comp.extensions.FormGeometryHandler" + constructor="extensions_propctrlr_FormGeometryHandler_get_implementation"> <service name="com.sun.star.form.inspection.FormGeometryHandler"/> </implementation> - <implementation name="com.sun.star.comp.extensions.GenericPropertyHandler"> + <implementation name="com.sun.star.comp.extensions.GenericPropertyHandler" + constructor="extensions_propctrlr_GenericPropertyHandler_get_implementation"> <service name="com.sun.star.inspection.GenericPropertyHandler"/> </implementation> - <implementation name="com.sun.star.comp.extensions.SubmissionPropertyHandler"> + <implementation name="com.sun.star.comp.extensions.SubmissionPropertyHandler" + constructor="extensions_propctrlr_SubmissionPropertyHandler_get_implementation"> <service name="com.sun.star.form.inspection.SubmissionPropertyHandler"/> </implementation> - <implementation name="com.sun.star.comp.extensions.XSDValidationPropertyHandler"> + <implementation name="com.sun.star.comp.extensions.XSDValidationPropertyHandler" + constructor="extensions_propctrlr_XSDValidationPropertyHandler_get_implementation"> <service name="com.sun.star.form.inspection.XSDValidationPropertyHandler"/> </implementation> - <implementation name="org.openoffice.comp.extensions.DefaultFormComponentInspectorModel"> + <implementation name="org.openoffice.comp.extensions.DefaultFormComponentInspectorModel" + constructor="extensions_propctrlr_DefaultFormComponentInspectorModel_get_implementation"> <service name="com.sun.star.form.inspection.DefaultFormComponentInspectorModel"/> </implementation> - <implementation name="org.openoffice.comp.extensions.DefaultHelpProvider"> + <implementation name="org.openoffice.comp.extensions.DefaultHelpProvider" + constructor="extensions_propctrlr_DefaultHelpProvider_get_implementation"> <service name="com.sun.star.inspection.DefaultHelpProvider"/> </implementation> - <implementation name="org.openoffice.comp.extensions.DialogController"> + <implementation name="org.openoffice.comp.extensions.DialogController" + constructor="extensions_propctrlr_DialogController_get_implementation"> <service name="com.sun.star.awt.PropertyBrowserController"/> </implementation> - <implementation name="org.openoffice.comp.extensions.FormController"> + <implementation name="org.openoffice.comp.extensions.FormController" + constructor="extensions_propctrlr_FormController_get_implementation"> <service name="com.sun.star.form.PropertyBrowserController"/> </implementation> - <implementation name="org.openoffice.comp.extensions.ObjectInspector"> + <implementation name="org.openoffice.comp.extensions.ObjectInspector" + constructor="extensions_propctrlr_OPropertyBrowserController_get_implementation"> <service name="com.sun.star.inspection.ObjectInspector"/> </implementation> - <implementation name="org.openoffice.comp.extensions.ObjectInspectorModel"> + <implementation name="org.openoffice.comp.extensions.ObjectInspectorModel" + constructor="extensions_propctrlr_ObjectInspectorModel_get_implementation"> <service name="com.sun.star.inspection.ObjectInspectorModel"/> </implementation> - <implementation name="org.openoffice.comp.form.ui.MasterDetailLinkDialog"> + <implementation name="org.openoffice.comp.form.ui.MasterDetailLinkDialog" + constructor="extensions_propctrlr_MasterDetailLinkDialog_get_implementation"> <service name="com.sun.star.form.MasterDetailLinkDialog"/> </implementation> - <implementation name="org.openoffice.comp.form.ui.OControlFontDialog"> + <implementation name="org.openoffice.comp.form.ui.OControlFontDialog" + constructor="extensions_propctrlr_OControlFontDialog_get_implementation"> <service name="com.sun.star.form.ControlFontDialog"/> </implementation> - <implementation name="org.openoffice.comp.form.ui.OTabOrderDialog"> + <implementation name="org.openoffice.comp.form.ui.OTabOrderDialog" + constructor="extensions_propcrltr_OTabOrderDialog_get_implementation"> <service name="com.sun.star.form.ui.TabOrderDialog"/> <service name="com.sun.star.form.TabOrderDialog"/> </implementation> diff --git a/extensions/source/propctrlr/pcrservices.cxx b/extensions/source/propctrlr/pcrservices.cxx deleted file mode 100644 index 18a79e16d837..000000000000 --- a/extensions/source/propctrlr/pcrservices.cxx +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include "modulepcr.hxx" -#include "pcrservices.hxx" -#include <mutex> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -extern "C" { - -static void pcr_initializeModule() -{ - std::once_flag aInit; - std::call_once(aInit, [&]() - { - createRegistryInfo_OPropertyBrowserController(); - createRegistryInfo_FormController(); - createRegistryInfo_DefaultFormComponentInspectorModel(); - createRegistryInfo_DefaultHelpProvider(); - createRegistryInfo_OControlFontDialog(); - createRegistryInfo_OTabOrderDialog(); - createRegistryInfo_CellBindingPropertyHandler(); - createRegistryInfo_ButtonNavigationHandler(); - createRegistryInfo_EditPropertyHandler(); - createRegistryInfo_FormComponentPropertyHandler(); - createRegistryInfo_EFormsPropertyHandler(); - createRegistryInfo_XSDValidationPropertyHandler(); - createRegistryInfo_EventHandler(); - createRegistryInfo_GenericPropertyHandler(); - createRegistryInfo_ObjectInspectorModel(); - createRegistryInfo_SubmissionPropertyHandler(); - createRegistryInfo_StringRepresentation(); - createRegistryInfo_MasterDetailLinkDialog(); - createRegistryInfo_FormGeometryHandler(); - return true; - }); -} - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void* pcr_component_getFactory( - const char* pImplementationName, - void* pServiceManager, - SAL_UNUSED_PARAMETER void* /*pRegistryKey*/) -{ - pcr_initializeModule(); - - Reference< XInterface > xRet; - if (pServiceManager && pImplementationName) - { - xRet = ::pcr::PcrModule::getInstance().getComponentFactory( - OUString::createFromAscii(pImplementationName)); - } - - if (xRet.is()) - xRet->acquire(); - return xRet.get(); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrservices.hxx b/extensions/source/propctrlr/pcrservices.hxx deleted file mode 100644 index f92323889d4a..000000000000 --- a/extensions/source/propctrlr/pcrservices.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRSERVICES_HXX -#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRSERVICES_HXX - -#include <sal/config.h> - -extern "C" { - -void createRegistryInfo_ButtonNavigationHandler(); -void createRegistryInfo_CellBindingPropertyHandler(); -void createRegistryInfo_DefaultFormComponentInspectorModel(); -void createRegistryInfo_DefaultHelpProvider(); -void createRegistryInfo_EFormsPropertyHandler(); -void createRegistryInfo_EditPropertyHandler(); -void createRegistryInfo_EventHandler(); -void createRegistryInfo_FormComponentPropertyHandler(); -void createRegistryInfo_FormController(); -void createRegistryInfo_FormGeometryHandler(); -void createRegistryInfo_GenericPropertyHandler(); -void createRegistryInfo_MasterDetailLinkDialog(); -void createRegistryInfo_OControlFontDialog(); -void createRegistryInfo_OPropertyBrowserController(); -void createRegistryInfo_OTabOrderDialog(); -void createRegistryInfo_ObjectInspectorModel(); -void createRegistryInfo_StringRepresentation(); -void createRegistryInfo_SubmissionPropertyHandler(); -void createRegistryInfo_XSDValidationPropertyHandler(); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrunodialogs.cxx b/extensions/source/propctrlr/pcrunodialogs.cxx index 738e4d933304..29abba01411b 100644 --- a/extensions/source/propctrlr/pcrunodialogs.cxx +++ b/extensions/source/propctrlr/pcrunodialogs.cxx @@ -24,18 +24,12 @@ #include <com/sun/star/awt/XWindow.hpp> #include <vcl/svapp.hxx> #include "modulepcr.hxx" -#include "pcrservices.hxx" #include "pcrunodialogs.hxx" #include "formstrings.hxx" #include "pcrstrings.hxx" #include "taborder.hxx" #include "pcrcommon.hxx" -extern "C" void createRegistryInfo_OTabOrderDialog() -{ - ::pcr::OAutoRegistration< ::pcr::OTabOrderDialog > aAutoRegistration; -} - namespace pcr { @@ -76,34 +70,15 @@ namespace pcr return css::uno::Sequence<sal_Int8>(); } - - Reference< XInterface > OTabOrderDialog::Create( const Reference< XComponentContext >& _rxContext ) - { - return *( new OTabOrderDialog( _rxContext ) ); - } - - OUString SAL_CALL OTabOrderDialog::getImplementationName() { - return getImplementationName_static(); - } - - - OUString OTabOrderDialog::getImplementationName_static() - { return "org.openoffice.comp.form.ui.OTabOrderDialog"; } css::uno::Sequence<OUString> SAL_CALL OTabOrderDialog::getSupportedServiceNames() { - return getSupportedServiceNames_static(); - } - - - css::uno::Sequence<OUString> OTabOrderDialog::getSupportedServiceNames_static() - { - return css::uno::Sequence<OUString>{ "com.sun.star.form.ui.TabOrderDialog", "com.sun.star.form.TabOrderDialog" }; + return { "com.sun.star.form.ui.TabOrderDialog", "com.sun.star.form.TabOrderDialog" }; } @@ -156,8 +131,13 @@ namespace pcr OTabOrderDialog_DBase::initialize(aArguments); } - } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propcrltr_OTabOrderDialog_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::OTabOrderDialog(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/pcrunodialogs.hxx b/extensions/source/propctrlr/pcrunodialogs.hxx index 9ad4387c4463..2d6c0cb813e2 100644 --- a/extensions/source/propctrlr/pcrunodialogs.hxx +++ b/extensions/source/propctrlr/pcrunodialogs.hxx @@ -58,14 +58,6 @@ namespace pcr virtual OUString SAL_CALL getImplementationName() override; virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; - // XServiceInfo - static methods - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static(); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static(); - static css::uno::Reference< css::uno::XInterface > - Create(const css::uno::Reference< css::uno::XComponentContext >&); - // XInitialization virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 76e92f064638..7233d2df6446 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "pcrservices.hxx" #include "propcontroller.hxx" #include "handlerhelper.hxx" #include "standardcontrol.hxx" @@ -50,12 +49,6 @@ #include <algorithm> #include <sal/log.hxx> -// !!! outside the namespace !!! -extern "C" void createRegistryInfo_OPropertyBrowserController() -{ - ::pcr::OAutoRegistration< ::pcr::OPropertyBrowserController > aAutoRegistration; -} - namespace pcr { using namespace ::com::sun::star; @@ -512,7 +505,7 @@ namespace pcr OUString SAL_CALL OPropertyBrowserController::getImplementationName( ) { - return getImplementationName_static(); + return "org.openoffice.comp.extensions.ObjectInspector"; } sal_Bool SAL_CALL OPropertyBrowserController::supportsService( const OUString& ServiceName ) @@ -523,28 +516,10 @@ namespace pcr Sequence< OUString > SAL_CALL OPropertyBrowserController::getSupportedServiceNames( ) { - return getSupportedServiceNames_static(); - } - - - OUString OPropertyBrowserController::getImplementationName_static( ) - { - return "org.openoffice.comp.extensions.ObjectInspector"; - } - - - Sequence< OUString > OPropertyBrowserController::getSupportedServiceNames_static( ) - { return { "com.sun.star.inspection.ObjectInspector" }; } - Reference< XInterface > OPropertyBrowserController::Create(const Reference< XComponentContext >& _rxContext) - { - return *(new OPropertyBrowserController( _rxContext ) ); - } - - void SAL_CALL OPropertyBrowserController::focusGained( const FocusEvent& _rSource ) { Reference< XWindow > xSourceWindow(_rSource.Source, UNO_QUERY); @@ -1658,5 +1633,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_OPropertyBrowserController_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::OPropertyBrowserController(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx index 11b9a7b5cdf6..182c7d1da1a1 100644 --- a/extensions/source/propctrlr/propcontroller.hxx +++ b/extensions/source/propctrlr/propcontroller.hxx @@ -172,16 +172,6 @@ namespace pcr protected: virtual ~OPropertyBrowserController() override; - public: - // XServiceInfo - static versions - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - static css::uno::Reference< css::uno::XInterface > - Create(const css::uno::Reference< css::uno::XComponentContext >&); - - protected: // IPropertyLineListener virtual void Clicked( const OUString& _rName, bool _bPrimary ) override; virtual void Commit( const OUString& _rName, const css::uno::Any& _rVal ) override; diff --git a/extensions/source/propctrlr/propertyhandler.hxx b/extensions/source/propctrlr/propertyhandler.hxx index f09e8bf523b9..b547e9600f9b 100644 --- a/extensions/source/propctrlr/propertyhandler.hxx +++ b/extensions/source/propctrlr/propertyhandler.hxx @@ -361,89 +361,11 @@ namespace pcr // XServiceInfo virtual OUString SAL_CALL getImplementationName( ) override = 0; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) final override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override = 0; }; - //= HandlerComponentBase - - /** a PropertyHandlerComponent implementation which routes XServiceInfo::getImplementationName and - XServiceInfo::getSupportedServiceNames to static versions of those methods, which are part of - the derived class. - - Additionally, a method <member>Create</member> is provided which takes a component context, and returns a new - instance of the derived class. This <member>Create</member> is used to register the implementation - of the derived class at the <type>PcrModule</type>. - - Well, every time we're talking about derived class, we in fact mean the template argument of - <type>HandlerComponentBase</type>. But usually this equals your derived class: - <pre> - class MyHandler; - typedef HandlerComponentBase< MyHandler > MyHandler_Base; - class MyHandler : MyHandler_Base - { - ... - public: - static OUString SAL_CALL getImplementationName_static( ) throw (css::uno::RuntimeException); - static css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_static( ) throw (css::uno::RuntimeException); - }; - </pre> - */ - template < class HANDLER > - class HandlerComponentBase : public PropertyHandlerComponent - { - protected: - explicit HandlerComponentBase( const css::uno::Reference< css::uno::XComponentContext >& _rxContext ) - :PropertyHandlerComponent( _rxContext ) - { - } - - protected: - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - static css::uno::Reference< css::uno::XInterface > SAL_CALL Create( const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); - - public: - /** registers the implementation of HANDLER at the <type>PcrModule</type> - */ - static void registerImplementation(); - }; - - - template < class HANDLER > - OUString SAL_CALL HandlerComponentBase< HANDLER >::getImplementationName( ) - { - return HANDLER::getImplementationName_static(); - } - - - template < class HANDLER > - css::uno::Sequence< OUString > SAL_CALL HandlerComponentBase< HANDLER >::getSupportedServiceNames( ) - { - return HANDLER::getSupportedServiceNames_static(); - } - - - template < class HANDLER > - void HandlerComponentBase< HANDLER >::registerImplementation() - { - PcrModule::getInstance().registerImplementation( - HANDLER::getImplementationName_static(), - HANDLER::getSupportedServiceNames_static(), - HANDLER::Create - ); - } - - - template < class HANDLER > - css::uno::Reference< css::uno::XInterface > SAL_CALL HandlerComponentBase< HANDLER >::Create( const css::uno::Reference< css::uno::XComponentContext >& _rxContext ) - { - return *( new HANDLER( _rxContext ) ); - } - - } // namespace pcr diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index bc37cd8f2ef6..3e28295d7348 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -38,25 +38,11 @@ #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> #include <yesno.hrc> -#include "pcrservices.hxx" #include <comphelper/types.hxx> #include "modulepcr.hxx" #include <algorithm> -// component helper namespace -namespace comp_StringRepresentation { - -using namespace ::com::sun::star; - -// component and service helper functions: -static OUString _getImplementationName(); -static uno::Sequence< OUString > _getSupportedServiceNames(); -static uno::Reference< uno::XInterface > _create( uno::Reference< uno::XComponentContext > const & context ); - -} // closing component helper namespace - - namespace pcr{ using namespace ::com::sun::star; @@ -148,7 +134,7 @@ StringRepresentation::StringRepresentation(uno::Reference< uno::XComponentContex // com.sun.star.uno.XServiceInfo: OUString SAL_CALL StringRepresentation::getImplementationName() { - return comp_StringRepresentation::_getImplementationName(); + return "StringRepresentation"; } sal_Bool SAL_CALL StringRepresentation::supportsService(OUString const & serviceName) @@ -158,7 +144,7 @@ sal_Bool SAL_CALL StringRepresentation::supportsService(OUString const & service uno::Sequence< OUString > SAL_CALL StringRepresentation::getSupportedServiceNames() { - return comp_StringRepresentation::_getSupportedServiceNames(); + return { "com.sun.star.inspection.StringRepresentation" }; } // inspection::XStringRepresentation: @@ -609,36 +595,12 @@ bool StringRepresentation::convertStringToGenericValue( const OUString& _rString } // pcr -// component helper namespace -namespace comp_StringRepresentation { - -OUString _getImplementationName() { - return - "StringRepresentation"; -} - -uno::Sequence< OUString > _getSupportedServiceNames() -{ - uno::Sequence< OUString > s { "com.sun.star.inspection.StringRepresentation" }; - return s; -} - -uno::Reference< uno::XInterface > _create( - const uno::Reference< uno::XComponentContext > & context) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_StringRepresentation_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) { - return static_cast< ::cppu::OWeakObject * >(new pcr::StringRepresentation(context)); + return cppu::acquire(new pcr::StringRepresentation(context)); } -} // closing component helper namespace - - -extern "C" void createRegistryInfo_StringRepresentation() -{ - ::pcr::PcrModule::getInstance().registerImplementation( - comp_StringRepresentation::_getImplementationName(), - comp_StringRepresentation::_getSupportedServiceNames(), - comp_StringRepresentation::_create - ); -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/submissionhandler.cxx b/extensions/source/propctrlr/submissionhandler.cxx index 2d338e966f05..66aeddecc19f 100644 --- a/extensions/source/propctrlr/submissionhandler.cxx +++ b/extensions/source/propctrlr/submissionhandler.cxx @@ -19,7 +19,6 @@ #include <sal/config.h> -#include "pcrservices.hxx" #include "submissionhandler.hxx" #include "formmetadata.hxx" #include "formstrings.hxx" @@ -33,12 +32,6 @@ #include <tools/diagnose_ex.h> -extern "C" void createRegistryInfo_SubmissionPropertyHandler() -{ - ::pcr::SubmissionPropertyHandler::registerImplementation(); -} - - namespace pcr { @@ -90,7 +83,7 @@ namespace pcr SubmissionPropertyHandler::SubmissionPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :EditPropertyHandler_Base( _rxContext ) + :PropertyHandlerComponent( _rxContext ) ,OPropertyChangeListener( m_aMutex ) { } @@ -102,16 +95,15 @@ namespace pcr } - OUString SubmissionPropertyHandler::getImplementationName_static( ) + OUString SubmissionPropertyHandler::getImplementationName( ) { return "com.sun.star.comp.extensions.SubmissionPropertyHandler"; } - Sequence< OUString > SubmissionPropertyHandler::getSupportedServiceNames_static( ) + Sequence< OUString > SubmissionPropertyHandler::getSupportedServiceNames( ) { - Sequence<OUString> aSupported { "com.sun.star.form.inspection.SubmissionPropertyHandler" }; - return aSupported; + return { "com.sun.star.form.inspection.SubmissionPropertyHandler" }; } @@ -240,7 +232,7 @@ namespace pcr m_xPropChangeMultiplexer.clear(); } - EditPropertyHandler_Base::onNewComponent(); + PropertyHandlerComponent::onNewComponent(); Reference< frame::XModel > xDocument( impl_getContextDocument_nothrow() ); DBG_ASSERT( xDocument.is(), "SubmissionPropertyHandler::onNewComponent: no document!" ); @@ -430,5 +422,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_SubmissionPropertyHandler_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::SubmissionPropertyHandler(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/submissionhandler.hxx b/extensions/source/propctrlr/submissionhandler.hxx index cd4328bde221..bfa9c4d06eff 100644 --- a/extensions/source/propctrlr/submissionhandler.hxx +++ b/extensions/source/propctrlr/submissionhandler.hxx @@ -62,11 +62,9 @@ namespace pcr //= SubmissionPropertyHandler - class SubmissionPropertyHandler; - typedef HandlerComponentBase< SubmissionPropertyHandler > EditPropertyHandler_Base; /** a property handler for any virtual string properties */ - class SubmissionPropertyHandler : public EditPropertyHandler_Base, public ::comphelper::OPropertyChangeListener + class SubmissionPropertyHandler : public PropertyHandlerComponent, public ::comphelper::OPropertyChangeListener { private: std::unique_ptr< SubmissionHelper > m_pHelper; @@ -77,14 +75,12 @@ namespace pcr const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - virtual ~SubmissionPropertyHandler() override; - protected: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override; + // XPropertyHandler overriables virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override; virtual void SAL_CALL setPropertyValue( const OUString& _rPropertyName, const css::uno::Any& _rValue ) override; diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx index 7d00e32486d2..190029bd8866 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx @@ -19,7 +19,6 @@ #include <sal/config.h> -#include "pcrservices.hxx" #include "xsdvalidationpropertyhandler.hxx" #include "formstrings.hxx" #include "formmetadata.hxx" @@ -49,12 +48,6 @@ #include <limits> -extern "C" void createRegistryInfo_XSDValidationPropertyHandler() -{ - ::pcr::XSDValidationPropertyHandler::registerImplementation(); -} - - namespace pcr { @@ -74,7 +67,7 @@ namespace pcr //= XSDValidationPropertyHandler XSDValidationPropertyHandler::XSDValidationPropertyHandler( const Reference< XComponentContext >& _rxContext ) - :XSDValidationPropertyHandler_Base( _rxContext ) + :PropertyHandlerComponent( _rxContext ) { } @@ -84,16 +77,15 @@ namespace pcr } - OUString XSDValidationPropertyHandler::getImplementationName_static( ) + OUString XSDValidationPropertyHandler::getImplementationName( ) { return "com.sun.star.comp.extensions.XSDValidationPropertyHandler"; } - Sequence< OUString > XSDValidationPropertyHandler::getSupportedServiceNames_static( ) + Sequence< OUString > XSDValidationPropertyHandler::getSupportedServiceNames( ) { - Sequence<OUString> aSupported { "com.sun.star.form.inspection.XSDValidationPropertyHandler" }; - return aSupported; + return{ "com.sun.star.form.inspection.XSDValidationPropertyHandler" }; } @@ -158,7 +150,7 @@ namespace pcr void XSDValidationPropertyHandler::onNewComponent() { - XSDValidationPropertyHandler_Base::onNewComponent(); + PropertyHandlerComponent::onNewComponent(); Reference< frame::XModel > xDocument( impl_getContextDocument_nothrow() ); DBG_ASSERT( xDocument.is(), "XSDValidationPropertyHandler::onNewComponent: no document!" ); @@ -459,7 +451,7 @@ namespace pcr void SAL_CALL XSDValidationPropertyHandler::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener ) { ::osl::MutexGuard aGuard( m_aMutex ); - XSDValidationPropertyHandler_Base::addPropertyChangeListener( _rxListener ); + PropertyHandlerComponent::addPropertyChangeListener( _rxListener ); if (m_pHelper) m_pHelper->registerBindingListener( _rxListener ); } @@ -470,7 +462,7 @@ namespace pcr ::osl::MutexGuard aGuard( m_aMutex ); if (m_pHelper) m_pHelper->revokeBindingListener( _rxListener ); - XSDValidationPropertyHandler_Base::removePropertyChangeListener( _rxListener ); + PropertyHandlerComponent::removePropertyChangeListener( _rxListener ); } @@ -671,5 +663,11 @@ namespace pcr } // namespace pcr +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +extensions_propctrlr_XSDValidationPropertyHandler_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new pcr::XSDValidationPropertyHandler(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx index 1e192a63e379..d15952c55ccf 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.hxx @@ -33,9 +33,7 @@ namespace pcr //= XSDValidationPropertyHandler - class XSDValidationPropertyHandler; - typedef HandlerComponentBase< XSDValidationPropertyHandler > XSDValidationPropertyHandler_Base; - class XSDValidationPropertyHandler : public XSDValidationPropertyHandler_Base + class XSDValidationPropertyHandler : public PropertyHandlerComponent { private: std::unique_ptr< XSDValidationHelper > m_pHelper; @@ -45,15 +43,13 @@ namespace pcr const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); - /// @throws css::uno::RuntimeException - static OUString getImplementationName_static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); - protected: virtual ~XSDValidationPropertyHandler() override; - protected: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override; + // XPropertyHandler overriables virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override; virtual void SAL_CALL setPropertyValue( const OUString& _rPropertyName, const css::uno::Any& _rValue ) override; |