svtools/Library_svt.mk | 1 svtools/source/control/filectrl.cxx | 54 +++++++++++++++ svtools/source/control/filectrl2.cxx | 75 ---------------------- svtools/source/graphic/descriptor.hxx | 4 - svtools/source/graphic/graphic.cxx | 4 - svtools/source/graphic/graphic.hxx | 6 - svtools/source/graphic/provider.cxx | 53 +++++---------- svtools/source/graphic/renderer.cxx | 50 ++++---------- svtools/source/hatchwindow/hatchwindowfactory.cxx | 58 ++++++++++------- svtools/source/inc/hatchwindowfactory.hxx | 39 ----------- svtools/source/inc/provider.hxx | 9 -- svtools/source/inc/renderer.hxx | 9 -- svtools/source/uno/fpicker.cxx | 68 +++++-------------- svtools/source/uno/fpicker.hxx | 47 ------------- svtools/source/uno/miscservices.cxx | 42 ------------ svtools/util/svt.component | 15 ++-- 16 files changed, 159 insertions(+), 375 deletions(-)
New commits: commit 732c0f929fc0229b6da37d4ec4b6de8994fcea46 Author: Matúš Kukan <matus.ku...@collabora.com> Date: Mon Dec 23 10:07:43 2013 +0100 svt: Use constructor feature for GraphicProvider. Change-Id: I0cb66814c3dcbe38a92ada0dfcc0374313784a2b diff --git a/svtools/source/graphic/descriptor.hxx b/svtools/source/graphic/descriptor.hxx index 906c4aa..5d4e7b9 100644 --- a/svtools/source/graphic/descriptor.hxx +++ b/svtools/source/graphic/descriptor.hxx @@ -60,10 +60,6 @@ class Graphic; namespace unographic { -// ------------------- -// - GraphicProvider - -// ------------------- - class GraphicDescriptor : public ::cppu::OWeakAggObject, public ::com::sun::star::lang::XServiceInfo, public ::com::sun::star::lang::XTypeProvider, diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx index da0a9de..f81a019 100644 --- a/svtools/source/graphic/graphic.cxx +++ b/svtools/source/graphic/graphic.cxx @@ -31,10 +31,6 @@ using namespace com::sun::star; namespace unographic { -// ------------------- -// - GraphicProvider - -// ------------------- - Graphic::Graphic() : mpGraphic( NULL ) { diff --git a/svtools/source/graphic/graphic.hxx b/svtools/source/graphic/graphic.hxx index 645269c..9ab6fc0 100644 --- a/svtools/source/graphic/graphic.hxx +++ b/svtools/source/graphic/graphic.hxx @@ -28,14 +28,8 @@ #include "descriptor.hxx" #include "transformer.hxx" -class Graphic; - namespace unographic { -// ------------------- -// - GraphicProvider - -// ------------------- - class Graphic : public ::com::sun::star::graphic::XGraphic, public ::com::sun::star::awt::XBitmap, public ::com::sun::star::lang::XUnoTunnel, diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index cf5113b..2bc31a6 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -43,19 +43,10 @@ using namespace com::sun::star; -namespace unographic { +namespace { #define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" -// ------------------- -// - GraphicProvider - -// ------------------- - -uno::Reference< uno::XInterface > SAL_CALL GraphicProvider_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& ) -{ - return (static_cast< ::cppu::OWeakObject* >(new GraphicProvider )); -} - GraphicProvider::GraphicProvider() { } @@ -68,30 +59,10 @@ GraphicProvider::~GraphicProvider() // ------------------------------------------------------------------------------ -OUString GraphicProvider::getImplementationName_Static() - throw() -{ - return OUString( "com.sun.star.comp.graphic.GraphicProvider" ); -} - -// ------------------------------------------------------------------------------ - -uno::Sequence< OUString > GraphicProvider::getSupportedServiceNames_Static() - throw() -{ - uno::Sequence< OUString > aSeq( 1 ); - - aSeq.getArray()[ 0 ] = "com.sun.star.graphic.GraphicProvider"; - - return aSeq; -} - -// ------------------------------------------------------------------------------ - OUString SAL_CALL GraphicProvider::getImplementationName() throw( uno::RuntimeException ) { - return getImplementationName_Static(); + return OUString( "com.sun.star.comp.graphic.GraphicProvider" ); } // ------------------------------------------------------------------------------ @@ -114,7 +85,9 @@ sal_Bool SAL_CALL GraphicProvider::supportsService( const OUString& ServiceName uno::Sequence< OUString > SAL_CALL GraphicProvider::getSupportedServiceNames() throw( uno::RuntimeException ) { - return getSupportedServiceNames_Static(); + uno::Sequence< OUString > aSeq( 1 ); + aSeq.getArray()[ 0 ] = "com.sun.star.graphic.GraphicProvider"; + return aSeq; } // ------------------------------------------------------------------------------ @@ -384,7 +357,7 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc if( xIStm.is() ) { - GraphicDescriptor* pDescriptor = new GraphicDescriptor; + unographic::GraphicDescriptor* pDescriptor = new unographic::GraphicDescriptor; pDescriptor->init( xIStm, aURL ); xRet = pDescriptor; } @@ -408,7 +381,7 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc } else { - GraphicDescriptor* pDescriptor = new GraphicDescriptor; + unographic::GraphicDescriptor* pDescriptor = new unographic::GraphicDescriptor; pDescriptor->init( aURL ); xRet = pDescriptor; } @@ -898,4 +871,16 @@ void SAL_CALL GraphicProvider::storeGraphic( const uno::Reference< ::graphic::XG } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_graphic_GraphicProvider_get_implementation( + SAL_UNUSED_PARAMETER css::uno::XComponentContext *, + uno_Sequence * arguments) +{ + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new GraphicProvider)); + x->acquire(); + return x.get(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/provider.hxx b/svtools/source/inc/provider.hxx index ba69554..9b20050 100644 --- a/svtools/source/inc/provider.hxx +++ b/svtools/source/inc/provider.hxx @@ -25,11 +25,7 @@ #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/awt/XBitmap.hpp> -namespace unographic { - -// ------------------- -// - GraphicProvider - -// ------------------- +namespace { class GraphicProvider : public ::cppu::WeakImplHelper1< ::com::sun::star::graphic::XGraphicProvider > { @@ -38,9 +34,6 @@ public: GraphicProvider(); ~GraphicProvider(); - static OUString getImplementationName_Static() throw(); - static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(); - protected: // XServiceInfo diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index 62f60cb..4a7ec73 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -28,7 +28,6 @@ #include <uno/mapping.hxx> #include "documentcloser.hxx" #include "hatchwindow.hxx" -#include "provider.hxx" #include "unowizard.hxx" #include "comphelper/servicedecl.hxx" @@ -39,7 +38,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::registry; using namespace ::com::sun::star::lang; -using namespace unographic; namespace sdecl = comphelper::service_decl; @@ -74,7 +72,6 @@ namespace DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) DECLARE_CREATEINSTANCE( SvFilterOptionsDialog ) -DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicProvider ) extern "C" { @@ -112,13 +109,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory ( SvFilterOptionsDialog_CreateInstance, aServiceNames); } - else if( GraphicProvider::getImplementationName_Static().equalsAscii( pImplementationName ) ) - { - xFactory = ::cppu::createOneInstanceFactory(xSMgr, - GraphicProvider::getImplementationName_Static(), - GraphicProvider_CreateInstance, - GraphicProvider::getSupportedServiceNames_Static() ); - } else if (rtl_str_compare (pImplementationName, "com.sun.star.comp.embed.DocumentCloser") == 0) { xFactory = ::cppu::createOneInstanceFactory(xSMgr, @@ -132,7 +122,7 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory ( pImplementationName, static_cast<css::lang::XMultiServiceFactory *>(_pServiceManager), static_cast<css::registry::XRegistryKey *>(pRegistryKey), - serviceDecl ); + unographic::serviceDecl ); if ( !pResult ) pResult = cppu::component_getFactoryHelper(pImplementationName, _pServiceManager, diff --git a/svtools/util/svt.component b/svtools/util/svt.component index dbba9e7..bd359af 100644 --- a/svtools/util/svt.component +++ b/svtools/util/svt.component @@ -19,7 +19,8 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" prefix="svt" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.graphic.GraphicProvider"> + <implementation name="com.sun.star.comp.graphic.GraphicProvider" + constructor="com_sun_star_comp_graphic_GraphicProvider_get_implementation"> <service name="com.sun.star.graphic.GraphicProvider"/> </implementation> <implementation name="com.sun.star.comp.graphic.GraphicRendererVCL" commit c04f3c0f794e8c608fade8c6142db13c32e6f4e7 Author: Matúš Kukan <matus.ku...@collabora.com> Date: Mon Dec 23 09:40:48 2013 +0100 svt: use constructor feature for HatchWindowFactory. Change-Id: I0881c0994342816b8f0ac0281d884ce618d5e285 diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index f728add..ea87180 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -17,34 +17,33 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "hatchwindowfactory.hxx" -#include "hatchwindow.hxx" -#include "cppuhelper/factory.hxx" +#include <com/sun/star/embed/XHatchWindowFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase2.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> -#include "documentcloser.hxx" +#include <hatchwindow.hxx> using namespace ::com::sun::star; -uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::impl_staticGetSupportedServiceNames() -{ - uno::Sequence< OUString > aRet(2); - aRet[0] = "com.sun.star.embed.HatchWindowFactory"; - aRet[1] = "com.sun.star.comp.embed.HatchWindowFactory"; - return aRet; -} +namespace { -OUString SAL_CALL OHatchWindowFactory::impl_staticGetImplementationName() +class OHatchWindowFactory : public ::cppu::WeakImplHelper2< + embed::XHatchWindowFactory, + lang::XServiceInfo > { - return OUString( "com.sun.star.comp.embed.HatchWindowFactory" ); -} +public: + OHatchWindowFactory() {} -uno::Reference< uno::XInterface > SAL_CALL OHatchWindowFactory::impl_staticCreateSelfInstance( - const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) -{ - return uno::Reference< uno::XInterface >( *new OHatchWindowFactory( xServiceManager ) ); -} + // XHatchWindowFactory + virtual uno::Reference< embed::XHatchWindow > SAL_CALL createHatchWindowInstance( const uno::Reference< awt::XWindowPeer >& xParent, const awt::Rectangle& aBounds, const awt::Size& aSize ) throw (uno::RuntimeException); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw (uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (uno::RuntimeException); + virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (uno::RuntimeException); +}; uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchWindowInstance( const uno::Reference< awt::XWindowPeer >& xParent, @@ -64,7 +63,7 @@ uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchW OUString SAL_CALL OHatchWindowFactory::getImplementationName() throw ( uno::RuntimeException ) { - return impl_staticGetImplementationName(); + return OUString( "com.sun.star.comp.embed.HatchWindowFactory" ); } sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceName ) @@ -76,7 +75,24 @@ sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceN uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames() throw ( uno::RuntimeException ) { - return impl_staticGetSupportedServiceNames(); + uno::Sequence< OUString > aRet(2); + aRet[0] = "com.sun.star.embed.HatchWindowFactory"; + aRet[1] = "com.sun.star.comp.embed.HatchWindowFactory"; + return aRet; +} + +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_embed_HatchWindowFactory_get_implementation( + SAL_UNUSED_PARAMETER css::uno::XComponentContext *, + uno_Sequence * arguments) +{ + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new OHatchWindowFactory)); + x->acquire(); + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/hatchwindowfactory.hxx b/svtools/source/inc/hatchwindowfactory.hxx index ed8d35c..af11bd0 100644 --- a/svtools/source/inc/hatchwindowfactory.hxx +++ b/svtools/source/inc/hatchwindowfactory.hxx @@ -20,45 +20,6 @@ #ifndef INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_HATCHWINDOWFACTORY_HXX #define INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_HATCHWINDOWFACTORY_HXX -#include <com/sun/star/embed/XHatchWindowFactory.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> - - -#include <cppuhelper/implbase2.hxx> - - -class OHatchWindowFactory : public ::cppu::WeakImplHelper2< - ::com::sun::star::embed::XHatchWindowFactory, - ::com::sun::star::lang::XServiceInfo > -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; - -public: - OHatchWindowFactory( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) - : m_xFactory( xFactory ) - { - OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" ); - } - - static ::com::sun::star::uno::Sequence< OUString > SAL_CALL impl_staticGetSupportedServiceNames(); - - static OUString SAL_CALL impl_staticGetImplementationName(); - - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - impl_staticCreateSelfInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - - - // XHatchWindowFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XHatchWindow > SAL_CALL createHatchWindowInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent, const ::com::sun::star::awt::Rectangle& aBounds, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); - -}; #endif diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index 6015493..62f60cb 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -27,7 +27,6 @@ #include <osl/diagnose.h> #include <uno/mapping.hxx> #include "documentcloser.hxx" -#include "hatchwindowfactory.hxx" #include "hatchwindow.hxx" #include "provider.hxx" #include "unowizard.hxx" @@ -127,13 +126,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory ( ODocumentCloser::impl_staticCreateSelfInstance, ODocumentCloser::impl_staticGetSupportedServiceNames()); } - else if (rtl_str_compare (pImplementationName, "com.sun.star.comp.embed.HatchWindowFactory") == 0) - { - xFactory = ::cppu::createOneInstanceFactory(xSMgr, - OHatchWindowFactory::impl_staticGetImplementationName(), - OHatchWindowFactory::impl_staticCreateSelfInstance, - OHatchWindowFactory::impl_staticGetSupportedServiceNames()); - } else { pResult = comphelper::service_decl::component_getFactoryHelper( diff --git a/svtools/util/svt.component b/svtools/util/svt.component index 021d23f..dbba9e7 100644 --- a/svtools/util/svt.component +++ b/svtools/util/svt.component @@ -49,7 +49,8 @@ <implementation name="com.sun.star.comp.embed.DocumentCloser"> <service name="com.sun.star.embed.DocumentCloser"/> </implementation> - <implementation name="com.sun.star.comp.embed.HatchWindowFactory"> + <implementation name="com.sun.star.comp.embed.HatchWindowFactory" + constructor="com_sun_star_comp_embed_HatchWindowFactory_get_implementation"> <service name="com.sun.star.comp.embed.HatchWindowFactory"/> <service name="com.sun.star.embed.HatchWindowFactory"/> </implementation> commit a587899cb340d2a5bc05392e1817ba72718706f1 Author: Matúš Kukan <matus.ku...@collabora.com> Date: Mon Dec 23 09:21:14 2013 +0100 svt: Use constructor feature for GraphicRendererVCL. Change-Id: Idb4cdfcdc8e06dca070bda5dd63e4291bb582e0f diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx index 412bb57..38b87bb 100644 --- a/svtools/source/graphic/renderer.cxx +++ b/svtools/source/graphic/renderer.cxx @@ -38,17 +38,7 @@ using namespace ::com::sun::star; -namespace unographic { - -// --------------------- -// - GraphicRendererVCL - -// --------------------- - -uno::Reference< uno::XInterface > SAL_CALL GraphicRendererVCL_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& ) -{ - return (static_cast< ::cppu::OWeakObject* >(new GraphicRendererVCL )); -} - +namespace { GraphicRendererVCL::GraphicRendererVCL() : ::comphelper::PropertySetHelper( createPropertySetInfo() ), @@ -65,26 +55,6 @@ GraphicRendererVCL::~GraphicRendererVCL() // ------------------------------------------------------------------------------ -OUString GraphicRendererVCL::getImplementationName_Static() - throw() -{ - return OUString( "com.sun.star.comp.graphic.GraphicRendererVCL" ); -} - -// ------------------------------------------------------------------------------ - -uno::Sequence< OUString > GraphicRendererVCL::getSupportedServiceNames_Static() - throw( ) -{ - uno::Sequence< OUString > aSeq( 1 ); - - aSeq.getArray()[ 0 ] = "com.sun.star.graphic.GraphicRendererVCL"; - - return aSeq; -} - -// ------------------------------------------------------------------------------ - uno::Any SAL_CALL GraphicRendererVCL::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException ) { @@ -137,7 +107,7 @@ void SAL_CALL GraphicRendererVCL::release() OUString SAL_CALL GraphicRendererVCL::getImplementationName() throw( uno::RuntimeException ) { - return getImplementationName_Static(); + return OUString( "com.sun.star.comp.graphic.GraphicRendererVCL" ); } sal_Bool SAL_CALL GraphicRendererVCL::supportsService( const OUString& ServiceName ) @@ -151,7 +121,9 @@ sal_Bool SAL_CALL GraphicRendererVCL::supportsService( const OUString& ServiceNa uno::Sequence< OUString > SAL_CALL GraphicRendererVCL::getSupportedServiceNames() throw( uno::RuntimeException ) { - return getSupportedServiceNames_Static(); + uno::Sequence< OUString > aSeq( 1 ); + aSeq.getArray()[ 0 ] = "com.sun.star.graphic.GraphicRendererVCL"; + return aSeq; } // ------------------------------------------------------------------------------ @@ -319,4 +291,16 @@ void SAL_CALL GraphicRendererVCL::render( const uno::Reference< graphic::XGraphi } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_graphic_GraphicRendererVCL_get_implementation( + SAL_UNUSED_PARAMETER css::uno::XComponentContext *, + uno_Sequence * arguments) +{ + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new GraphicRendererVCL)); + x->acquire(); + return x.get(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/inc/renderer.hxx b/svtools/source/inc/renderer.hxx index d03b4b8..a69bac7 100644 --- a/svtools/source/inc/renderer.hxx +++ b/svtools/source/inc/renderer.hxx @@ -29,11 +29,7 @@ class OutputDevice; -namespace unographic { - -// ------------------- -// - GraphicRenderer - -// ------------------- +namespace { class GraphicRendererVCL : public ::cppu::OWeakAggObject, public ::com::sun::star::lang::XServiceInfo, @@ -46,9 +42,6 @@ public: GraphicRendererVCL(); ~GraphicRendererVCL() throw(); - static OUString getImplementationName_Static() throw(); - static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(); - protected: static ::comphelper::PropertySetInfo* createPropertySetInfo(); diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index a963236..6015493 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -30,7 +30,6 @@ #include "hatchwindowfactory.hxx" #include "hatchwindow.hxx" #include "provider.hxx" -#include "renderer.hxx" #include "unowizard.hxx" #include "comphelper/servicedecl.hxx" @@ -77,7 +76,6 @@ namespace DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) DECLARE_CREATEINSTANCE( SvFilterOptionsDialog ) DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicProvider ) -DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicRendererVCL ) extern "C" { @@ -122,13 +120,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory ( GraphicProvider_CreateInstance, GraphicProvider::getSupportedServiceNames_Static() ); } - else if( GraphicRendererVCL::getImplementationName_Static().equalsAscii( pImplementationName ) ) - { - xFactory = ::cppu::createOneInstanceFactory(xSMgr, - GraphicRendererVCL::getImplementationName_Static(), - GraphicRendererVCL_CreateInstance, - GraphicRendererVCL::getSupportedServiceNames_Static() ); - } else if (rtl_str_compare (pImplementationName, "com.sun.star.comp.embed.DocumentCloser") == 0) { xFactory = ::cppu::createOneInstanceFactory(xSMgr, diff --git a/svtools/util/svt.component b/svtools/util/svt.component index e389e2a..021d23f 100644 --- a/svtools/util/svt.component +++ b/svtools/util/svt.component @@ -22,7 +22,8 @@ <implementation name="com.sun.star.comp.graphic.GraphicProvider"> <service name="com.sun.star.graphic.GraphicProvider"/> </implementation> - <implementation name="com.sun.star.comp.graphic.GraphicRendererVCL"> + <implementation name="com.sun.star.comp.graphic.GraphicRendererVCL" + constructor="com_sun_star_comp_graphic_GraphicRendererVCL_get_implementation"> <service name="com.sun.star.graphic.GraphicRendererVCL"/> </implementation> <implementation name="com.sun.star.comp.svtools.OAddressBookSourceDialogUno"> commit 2fbb47156773b2e300fc987efc2da85c66e567d1 Author: Matúš Kukan <matus.ku...@collabora.com> Date: Mon Dec 23 08:57:47 2013 +0100 svt: Use constructor feature for FilePicker and FolderPicker services. Change-Id: Idb14acb8fdb737b592a358eaa221ca9b1e14e589 diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx index 397f661..a9d06ad 100644 --- a/svtools/source/uno/fpicker.cxx +++ b/svtools/source/uno/fpicker.cxx @@ -53,18 +53,16 @@ static OUString FilePicker_getSystemPickerServiceName() #endif } -Reference< css::uno::XInterface > FilePicker_CreateInstance ( - Reference< css::uno::XComponentContext > const & rxContext) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_svt_FilePicker_get_implementation( + css::uno::XComponentContext *context, uno_Sequence * arguments) { + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; Reference< css::uno::XInterface > xResult; - - if (!rxContext.is()) - return xResult; - - Reference< css::lang::XMultiComponentFactory > xFactory (rxContext->getServiceManager()); + Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager()); if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog()) { - xResult = Reference< css::uno::XInterface >( Application::createFilePicker( rxContext ) ); + xResult = Reference< css::uno::XInterface >( Application::createFilePicker( context ) ); if (!xResult.is()) { @@ -72,7 +70,7 @@ Reference< css::uno::XInterface > FilePicker_CreateInstance ( { xResult = xFactory->createInstanceWithContext ( FilePicker_getSystemPickerServiceName(), - rxContext); + context); } catch (css::uno::Exception const &) { @@ -87,27 +85,15 @@ Reference< css::uno::XInterface > FilePicker_CreateInstance ( // Always fall back to OfficeFilePicker. xResult = xFactory->createInstanceWithContext ( OUString( "com.sun.star.ui.dialogs.OfficeFilePicker"), - rxContext); + context); } if (xResult.is()) { // Add to FilePicker history. svt::addFilePicker (xResult); } - return xResult; -} - -OUString SAL_CALL FilePicker_getImplementationName() -{ - return OUString("com.sun.star.comp.svt.FilePicker"); -} - -Sequence< OUString > FilePicker_getSupportedServiceNames() -{ - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString( "com.sun.star.ui.dialogs.FilePicker"); - return aServiceNames; + xResult->acquire(); + return xResult.get(); } /* @@ -127,25 +113,23 @@ static OUString FolderPicker_getSystemPickerServiceName() return OUString("com.sun.star.ui.dialogs.SystemFolderPicker"); } -Reference< css::uno::XInterface > FolderPicker_CreateInstance ( - Reference< css::uno::XComponentContext > const & rxContext) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_svt_FolderPicker_get_implementation( + css::uno::XComponentContext *context, uno_Sequence * arguments) { + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; Reference< css::uno::XInterface > xResult; - - if (!rxContext.is()) - return xResult; - - Reference< css::lang::XMultiComponentFactory > xFactory (rxContext->getServiceManager()); + Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager()); if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog()) { - xResult = Reference< css::uno::XInterface >( Application::createFolderPicker( rxContext ) ); + xResult = Reference< css::uno::XInterface >( Application::createFolderPicker( context ) ); if (!xResult.is()) { try { xResult = xFactory->createInstanceWithContext ( FolderPicker_getSystemPickerServiceName(), - rxContext); + context); } catch (css::uno::Exception const &) { @@ -158,27 +142,15 @@ Reference< css::uno::XInterface > FolderPicker_CreateInstance ( // Always fall back to OfficeFolderPicker. xResult = xFactory->createInstanceWithContext ( OUString( "com.sun.star.ui.dialogs.OfficeFolderPicker"), - rxContext); + context); } if (xResult.is()) { // Add to FolderPicker history. svt::addFolderPicker (xResult); } - return xResult; -} - -OUString SAL_CALL FolderPicker_getImplementationName() -{ - return OUString("com.sun.star.comp.svt.FolderPicker"); -} - -Sequence< OUString > FolderPicker_getSupportedServiceNames() -{ - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString( "com.sun.star.ui.dialogs.FolderPicker"); - return aServiceNames; + xResult->acquire(); + return xResult.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/fpicker.hxx b/svtools/source/uno/fpicker.hxx deleted file mode 100644 index e465ee7..0000000 --- a/svtools/source/uno/fpicker.hxx +++ /dev/null @@ -1,47 +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_SVTOOLS_SOURCE_UNO_FPICKER_HXX -#define INCLUDED_SVTOOLS_SOURCE_UNO_FPICKER_HXX - -#include "sal/config.h" - -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/Sequence.hxx" -#include "rtl/ustring.hxx" -#include "sal/types.h" - -namespace com { namespace sun { namespace star { -namespace lang { class XMultiServiceFactory; } -namespace uno { class XInterface; } -} } } - -css::uno::Reference<css::uno::XInterface> SAL_CALL FilePicker_CreateInstance( -css::uno::Reference< css::uno::XComponentContext > const & context); -css::uno::Sequence<OUString> FilePicker_getSupportedServiceNames(); -OUString FilePicker_getImplementationName(); - -css::uno::Reference<css::uno::XInterface> SAL_CALL FolderPicker_CreateInstance( -css::uno::Reference< css::uno::XComponentContext > const & context); -css::uno::Sequence<OUString> FolderPicker_getSupportedServiceNames(); -OUString FolderPicker_getImplementationName(); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index 38f2900..a963236 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -29,7 +29,6 @@ #include "documentcloser.hxx" #include "hatchwindowfactory.hxx" #include "hatchwindow.hxx" -#include "fpicker.hxx" #include "provider.hxx" #include "renderer.hxx" #include "unowizard.hxx" @@ -71,18 +70,6 @@ namespace ::svt::uno::Wizard::getSupportedServiceNames_static, ::cppu::createSingleComponentFactory, NULL, 0 }, - { - FilePicker_CreateInstance, - FilePicker_getImplementationName, - FilePicker_getSupportedServiceNames, - ::cppu::createSingleComponentFactory, 0, 0 - }, - { - FolderPicker_CreateInstance, - FolderPicker_getImplementationName, - FolderPicker_getSupportedServiceNames, - ::cppu::createSingleComponentFactory, 0, 0 - }, { 0, 0, 0, 0, 0, 0 } }; } diff --git a/svtools/util/svt.component b/svtools/util/svt.component index ee1298f..e389e2a 100644 --- a/svtools/util/svt.component +++ b/svtools/util/svt.component @@ -37,10 +37,12 @@ <implementation name="com.sun.star.svtools.SvFilterOptionsDialog"> <service name="com.sun.star.ui.dialogs.FilterOptionsDialog"/> </implementation> - <implementation name="com.sun.star.comp.svt.FilePicker"> + <implementation name="com.sun.star.comp.svt.FilePicker" + constructor="com_sun_star_comp_svt_FilePicker_get_implementation"> <service name="com.sun.star.ui.dialogs.FilePicker"/> </implementation> - <implementation name="com.sun.star.comp.svt.FolderPicker"> + <implementation name="com.sun.star.comp.svt.FolderPicker" + constructor="com_sun_star_comp_svt_FolderPicker_get_implementation"> <service name="com.sun.star.ui.dialogs.FolderPicker"/> </implementation> <implementation name="com.sun.star.comp.embed.DocumentCloser"> commit 3982ce50f9845189373dac48d52d6070f6366a4f Author: Matúš Kukan <matus.ku...@collabora.com> Date: Mon Dec 23 08:29:44 2013 +0100 svt: All files are compiled with enabled exception handling. So, merge these files. Change-Id: Icc8e221a40c70dc24a9fb048e06cf4fe7635fd02 diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 915c5b8..4762808 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -111,7 +111,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/control/ctrlbox \ svtools/source/control/ctrltool \ svtools/source/control/filectrl \ - svtools/source/control/filectrl2 \ svtools/source/control/fileurlbox \ svtools/source/control/fmtfield \ svtools/source/control/headbar \ diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx index f605f8a..8b9aedc 100644 --- a/svtools/source/control/filectrl.cxx +++ b/svtools/source/control/filectrl.cxx @@ -17,10 +17,21 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <svtools/svtresid.hxx> #include <svtools/filectrl.hxx> + +#include <com/sun/star/ui/dialogs/FilePicker.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <comphelper/processfactory.hxx> +#include <osl/file.h> +#include <svtools/svtresid.hxx> +#include <tools/urlobj.hxx> +#include <vcl/stdtext.hxx> #include <filectrl.hrc> +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::ui; + // ======================================================================= FileControl::FileControl( Window* pParent, WinBits nStyle, FileControlMode nFlags ) : @@ -197,4 +208,45 @@ void FileControl::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize GetEdit().SetStyle( nOldEditStyle ); } +void FileControl::ImplBrowseFile( ) +{ + try + { + Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + Reference < dialogs::XFilePicker3 > xFilePicker = dialogs::FilePicker::createWithMode( xContext, dialogs::TemplateDescription::FILEOPEN_SIMPLE ); + // transform the system notation text into a file URL + OUString sSystemNotation = GetText(), sFileURL; + oslFileError nError = osl_getFileURLFromSystemPath( sSystemNotation.pData, &sFileURL.pData ); + if ( nError == osl_File_E_INVAL ) + sFileURL = GetText(); // #97709# Maybe URL is already a file URL... + + //#90430# Check if URL is really a file URL + OUString aTmp; + if ( osl_getSystemPathFromFileURL( sFileURL.pData, &aTmp.pData ) == osl_File_E_None ) + { + // initially set this directory + xFilePicker->setDisplayDirectory( sFileURL ); + } + + if ( xFilePicker->execute() ) + { + Sequence < OUString > aPathSeq = xFilePicker->getFiles(); + + if ( aPathSeq.getLength() ) + { + OUString aNewText = aPathSeq[0]; + INetURLObject aObj( aNewText ); + if ( aObj.GetProtocol() == INET_PROT_FILE ) + aNewText = aObj.PathToFileName(); + SetText( aNewText ); + maEdit.GetModifyHdl().Call( &maEdit ); + } + } + } + catch( const Exception& ) + { + OSL_FAIL( "FileControl::ImplBrowseFile: caught an exception while executing the file picker!" ); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/filectrl2.cxx b/svtools/source/control/filectrl2.cxx deleted file mode 100644 index 01a2162..0000000 --- a/svtools/source/control/filectrl2.cxx +++ /dev/null @@ -1,75 +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 . - */ - - -// this file contains code from filectrl.cxx which needs to be compiled with enabled exception hanling -#include <svtools/filectrl.hxx> -#include <com/sun/star/ui/dialogs/FilePicker.hpp> -#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> -#include <comphelper/processfactory.hxx> -#include <tools/urlobj.hxx> -#include <osl/file.h> -#include <vcl/stdtext.hxx> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ui; - -void FileControl::ImplBrowseFile( ) -{ - try - { - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - Reference < dialogs::XFilePicker3 > xFilePicker = dialogs::FilePicker::createWithMode( xContext, dialogs::TemplateDescription::FILEOPEN_SIMPLE ); - // transform the system notation text into a file URL - OUString sSystemNotation = GetText(), sFileURL; - oslFileError nError = osl_getFileURLFromSystemPath( sSystemNotation.pData, &sFileURL.pData ); - if ( nError == osl_File_E_INVAL ) - sFileURL = GetText(); // #97709# Maybe URL is already a file URL... - - //#90430# Check if URL is really a file URL - OUString aTmp; - if ( osl_getSystemPathFromFileURL( sFileURL.pData, &aTmp.pData ) == osl_File_E_None ) - { - // initially set this directory - xFilePicker->setDisplayDirectory( sFileURL ); - } - - if ( xFilePicker->execute() ) - { - Sequence < OUString > aPathSeq = xFilePicker->getFiles(); - - if ( aPathSeq.getLength() ) - { - OUString aNewText = aPathSeq[0]; - INetURLObject aObj( aNewText ); - if ( aObj.GetProtocol() == INET_PROT_FILE ) - aNewText = aObj.PathToFileName(); - SetText( aNewText ); - maEdit.GetModifyHdl().Call( &maEdit ); - } - } - } - catch( const Exception& ) - { - OSL_FAIL( "FileControl::ImplBrowseFile: caught an exception while executing the file picker!" ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits