dbaccess/source/core/dataaccess/ComponentDefinition.cxx | 45 ++-------- dbaccess/source/core/dataaccess/ComponentDefinition.hxx | 18 +--- dbaccess/source/core/dataaccess/databasedocument.cxx | 66 ++++------------ dbaccess/source/core/dataaccess/databasedocument.hxx | 6 - dbaccess/source/core/inc/services.hxx | 2 dbaccess/source/core/misc/services.cxx | 2 dbaccess/util/dba.component | 6 - 7 files changed, 40 insertions(+), 105 deletions(-)
New commits: commit f229b9b04a9267f7f277304c0ebed7f8b2582a5d Author: Matúš Kukan <matus.ku...@gmail.com> Date: Sat Nov 21 00:39:35 2015 +0100 tdf#74608 dbaccess: Constructor feature for ODatabaseDocument Change-Id: Id524a1a717c350cb0558ef5ff11da3e6c941c203 diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 3b07612..e25b714 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -22,8 +22,6 @@ #include "datasource.hxx" #include "databasedocument.hxx" #include "dbastrings.hrc" -#include "module_dba.hxx" -#include "services.hxx" #include "documenteventexecutor.hxx" #include "databasecontext.hxx" #include "documentcontainer.hxx" @@ -52,7 +50,6 @@ #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp> -#include <com/sun/star/ucb/XContent.hpp> #include <com/sun/star/ui/UIConfigurationManager.hpp> #include <com/sun/star/ui/XUIConfigurationStorage.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> @@ -111,11 +108,6 @@ using namespace ::com::sun::star::script; using namespace ::com::sun::star::script::provider; using namespace ::com::sun::star::ui; using namespace ::cppu; -using namespace ::osl; - -using ::com::sun::star::awt::XWindow; -using ::com::sun::star::ucb::XContent; -using ::com::sun::star::sdb::application::XDatabaseDocumentUI; namespace dbaccess { @@ -147,17 +139,6 @@ bool ViewMonitor::onSetCurrentController( const Reference< XController >& _rxCon return bLoadFinished; } -} // namespace dbaccess - -// ODatabaseDocument - -extern "C" void SAL_CALL createRegistryInfo_ODatabaseDocument() -{ - static ::dba::OAutoRegistration< ::dbaccess::ODatabaseDocument > aAutoRegistration; -} - -namespace dbaccess -{ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference<ODatabaseModelImpl>& _pImpl ) :ModelDependentComponent( _pImpl ) @@ -611,7 +592,7 @@ namespace { bool lcl_hasAnyModifiedSubComponent_throw( const Reference< XController >& i_rController ) { - Reference< XDatabaseDocumentUI > xDatabaseUI( i_rController, UNO_QUERY_THROW ); + Reference< css::sdb::application::XDatabaseDocumentUI > xDatabaseUI( i_rController, UNO_QUERY_THROW ); Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() ); const Reference< XComponent >* component = aComponents.getConstArray(); @@ -1900,37 +1881,14 @@ void SAL_CALL ODatabaseDocument::removeEventListener( const Reference< lang::XEv } // XServiceInfo -OUString ODatabaseDocument::getImplementationName( ) throw(RuntimeException, std::exception) -{ - return getImplementationName_static(); -} - -OUString ODatabaseDocument::getImplementationName_static( ) throw(RuntimeException) +OUString ODatabaseDocument::getImplementationName() throw(RuntimeException, std::exception) { return OUString("com.sun.star.comp.dba.ODatabaseDocument"); } -Sequence< OUString > ODatabaseDocument::getSupportedServiceNames( ) throw (RuntimeException, std::exception) +Sequence< OUString > ODatabaseDocument::getSupportedServiceNames() throw (RuntimeException, std::exception) { - return getSupportedServiceNames_static(); -} - -Reference< XInterface > ODatabaseDocument::Create( const Reference< XComponentContext >& _rxContext ) -{ - Reference< XUnoTunnel > xDBContextTunnel( DatabaseContext::create(_rxContext), UNO_QUERY_THROW ); - ODatabaseContext* pContext = reinterpret_cast< ODatabaseContext* >( xDBContextTunnel->getSomething( ODatabaseContext::getUnoTunnelImplementationId() ) ); - - ::rtl::Reference<ODatabaseModelImpl> pImpl( new ODatabaseModelImpl( _rxContext, *pContext ) ); - Reference< XModel > xModel( pImpl->createNewModel_deliverOwnership( false ) ); - return xModel.get(); -} - -Sequence< OUString > ODatabaseDocument::getSupportedServiceNames_static( ) throw (RuntimeException) -{ - Sequence< OUString > aSNS( 2 ); - aSNS[0] = "com.sun.star.sdb.OfficeDatabaseDocument"; - aSNS[1] = "com.sun.star.document.OfficeDocument"; - return aSNS; + return { "com.sun.star.sdb.OfficeDatabaseDocument", "com.sun.star.document.OfficeDocument" }; } sal_Bool ODatabaseDocument::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception) @@ -2252,4 +2210,20 @@ OUString SAL_CALL ODatabaseDocument::getUntitledPrefix() throw (uno::RuntimeE } // namespace dbaccess +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL +com_sun_star_comp_dba_ODatabaseDocument(css::uno::XComponentContext* context, + css::uno::Sequence<css::uno::Any> const &) +{ + Reference<XUnoTunnel> xDBContextTunnel(DatabaseContext::create(context), UNO_QUERY_THROW); + dbaccess::ODatabaseContext* pContext = reinterpret_cast<dbaccess::ODatabaseContext*>( + xDBContextTunnel->getSomething( + dbaccess::ODatabaseContext::getUnoTunnelImplementationId())); + + rtl::Reference<dbaccess::ODatabaseModelImpl> pImpl( + new dbaccess::ODatabaseModelImpl(context, *pContext)); + css::uno::Reference<XInterface> inst(pImpl->createNewModel_deliverOwnership(false)); + inst->acquire(); + return inst.get(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 0212387..89d1b17 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -294,12 +294,6 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(css::uno::RuntimeException, std::exception) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(css::uno::RuntimeException, std::exception) override; - // css::lang::XServiceInfo - static methods - static css::uno::Sequence< OUString > getSupportedServiceNames_static() throw( css::uno::RuntimeException ); - static OUString getImplementationName_static() throw( css::uno::RuntimeException ); - static css::uno::Reference< css::uno::XInterface > - SAL_CALL Create(const css::uno::Reference< css::uno::XComponentContext >&); - // XInterface virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) throw (css::uno::RuntimeException, std::exception) override; virtual void SAL_CALL acquire( ) throw () override; diff --git a/dbaccess/source/core/inc/services.hxx b/dbaccess/source/core/inc/services.hxx index 78c6913..4e40c48 100644 --- a/dbaccess/source/core/inc/services.hxx +++ b/dbaccess/source/core/inc/services.hxx @@ -25,7 +25,6 @@ #include <sal/types.h> extern "C" void SAL_CALL createRegistryInfo_DataAccessDescriptorFactory(); -extern "C" void SAL_CALL createRegistryInfo_ODatabaseDocument(); #endif diff --git a/dbaccess/source/core/misc/services.cxx b/dbaccess/source/core/misc/services.cxx index ca8b4c6..3624225 100644 --- a/dbaccess/source/core/misc/services.cxx +++ b/dbaccess/source/core/misc/services.cxx @@ -58,7 +58,6 @@ extern "C" void SAL_CALL createRegistryInfo_DBA() static bool bInit = false; if (!bInit) { - createRegistryInfo_ODatabaseDocument(); createRegistryInfo_DataAccessDescriptorFactory(); bInit = true; } diff --git a/dbaccess/util/dba.component b/dbaccess/util/dba.component index d393912..3a4ac35 100644 --- a/dbaccess/util/dba.component +++ b/dbaccess/util/dba.component @@ -37,7 +37,8 @@ <implementation name="com.sun.star.comp.dba.ODatabaseContext"> <service name="com.sun.star.sdb.DatabaseContext"/> </implementation> - <implementation name="com.sun.star.comp.dba.ODatabaseDocument"> + <implementation name="com.sun.star.comp.dba.ODatabaseDocument" + constructor="com_sun_star_comp_dba_ODatabaseDocument"> <service name="com.sun.star.document.OfficeDocument"/> <service name="com.sun.star.sdb.OfficeDatabaseDocument"/> </implementation> commit 970f518989d8984089a5ee2be95d0a178b314d4c Author: Matúš Kukan <matus.ku...@gmail.com> Date: Sat Nov 21 00:27:24 2015 +0100 tdf#74608 dbaccess: Constructor feature for OComponentDefinition Change-Id: I150cdaa46a0d86e1a4b6598ac580a10b2e8f071f diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx index 2b1913d..b6f0230 100644 --- a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx +++ b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx @@ -20,34 +20,22 @@ #include "ComponentDefinition.hxx" #include "apitools.hxx" #include "dbastrings.hrc" -#include "module_dba.hxx" -#include "services.hxx" #include <boost/noncopyable.hpp> #include <tools/debug.hxx> #include <osl/diagnose.h> #include <comphelper/sequence.hxx> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <comphelper/property.hxx> #include "definitioncolumn.hxx" -#include <cppuhelper/implbase.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; -using namespace ::osl; -using namespace ::comphelper; using namespace ::cppu; -extern "C" void SAL_CALL createRegistryInfo_OComponentDefinition() -{ - static ::dba::OAutoRegistration< ::dbaccess::OComponentDefinition > aAutoRegistration; -} - namespace dbaccess { @@ -159,33 +147,14 @@ css::uno::Sequence<sal_Int8> OComponentDefinition::getImplementationId() IMPLEMENT_GETTYPES3(OComponentDefinition,ODataSettings,OContentHelper,OComponentDefinition_BASE); IMPLEMENT_FORWARD_XINTERFACE3( OComponentDefinition,OContentHelper,ODataSettings,OComponentDefinition_BASE) -OUString OComponentDefinition::getImplementationName_static( ) throw(RuntimeException) +OUString SAL_CALL OComponentDefinition::getImplementationName() throw(RuntimeException, std::exception) { return OUString("com.sun.star.comp.dba.OComponentDefinition"); } -OUString SAL_CALL OComponentDefinition::getImplementationName( ) throw(RuntimeException, std::exception) +Sequence< OUString > SAL_CALL OComponentDefinition::getSupportedServiceNames() throw(RuntimeException, std::exception) { - return getImplementationName_static(); -} - -Sequence< OUString > OComponentDefinition::getSupportedServiceNames_static( ) throw(RuntimeException) -{ - Sequence< OUString > aServices(2); - aServices[0] = "com.sun.star.sdb.TableDefinition"; - aServices[1] = "com.sun.star.ucb.Content"; - - return aServices; -} - -Sequence< OUString > SAL_CALL OComponentDefinition::getSupportedServiceNames( ) throw(RuntimeException, std::exception) -{ - return getSupportedServiceNames_static(); -} - -Reference< XInterface > OComponentDefinition::Create( const Reference< XComponentContext >& _rxContext ) -{ - return *(new OComponentDefinition( _rxContext, nullptr, TContentPtr( new OComponentDefinition_Impl ) ) ); + return { "com.sun.star.sdb.TableDefinition", "com.sun.star.ucb.Content" }; } void SAL_CALL OComponentDefinition::disposing() @@ -300,4 +269,12 @@ void OComponentDefinition::columnAppended( const Reference< XPropertySet >& _rxS } // namespace dbaccess +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL +com_sun_star_comp_dba_OComponentDefinition(css::uno::XComponentContext* context, + css::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new dbaccess::OComponentDefinition( + context, nullptr, dbaccess::TContentPtr(new dbaccess::OComponentDefinition_Impl))); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx index 01e829b..9856351 100644 --- a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx +++ b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx @@ -85,8 +85,6 @@ class OComponentDefinition :public OContentHelper ,public OComponentDefinition_BASE ,public ::comphelper::OPropertyArrayUsageHelper< OComponentDefinition > { - OComponentDefinition(); - protected: css::uno::Reference< OColumns > m_xColumns; rtl::Reference<OColumnPropertyListener> m_xColumnPropertyListener; @@ -95,15 +93,14 @@ protected: virtual ~OComponentDefinition(); virtual void SAL_CALL disposing() override; -protected: - OComponentDefinition(const css::uno::Reference< css::uno::XComponentContext >& - ,const css::uno::Reference< css::uno::XInterface >& _xParentContainer - ,const TContentPtr& _pImpl - ,bool _bTable = true); - const OComponentDefinition_Impl& getDefinition() const { return dynamic_cast< const OComponentDefinition_Impl& >( *m_pImpl.get() ); } OComponentDefinition_Impl& getDefinition() { return dynamic_cast< OComponentDefinition_Impl& >( *m_pImpl.get() ); } public: + OComponentDefinition( + const css::uno::Reference< css::uno::XComponentContext >&, + const css::uno::Reference< css::uno::XInterface >& _xParentContainer, + const TContentPtr& _pImpl, + bool _bTable = true); OComponentDefinition( const css::uno::Reference< css::uno::XInterface >& _rxContainer @@ -125,11 +122,6 @@ public: virtual OUString SAL_CALL getImplementationName( ) throw(css::uno::RuntimeException, std::exception) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(css::uno::RuntimeException, std::exception) override; - static css::uno::Sequence< OUString > getSupportedServiceNames_static() throw( css::uno::RuntimeException ); - static OUString getImplementationName_static() throw( css::uno::RuntimeException ); - static css::uno::Reference< css::uno::XInterface > SAL_CALL - Create(const css::uno::Reference< css::uno::XComponentContext >&); - // XInitialization virtual void SAL_CALL initialize( css::uno::Sequence< css::uno::Any > const & rArguments) throw (css::uno::Exception, std::exception) override; diff --git a/dbaccess/source/core/inc/services.hxx b/dbaccess/source/core/inc/services.hxx index d861f2c8..78c6913 100644 --- a/dbaccess/source/core/inc/services.hxx +++ b/dbaccess/source/core/inc/services.hxx @@ -25,7 +25,6 @@ #include <sal/types.h> extern "C" void SAL_CALL createRegistryInfo_DataAccessDescriptorFactory(); -extern "C" void SAL_CALL createRegistryInfo_OComponentDefinition(); extern "C" void SAL_CALL createRegistryInfo_ODatabaseDocument(); #endif diff --git a/dbaccess/source/core/misc/services.cxx b/dbaccess/source/core/misc/services.cxx index 18850d9..ca8b4c6 100644 --- a/dbaccess/source/core/misc/services.cxx +++ b/dbaccess/source/core/misc/services.cxx @@ -58,7 +58,6 @@ extern "C" void SAL_CALL createRegistryInfo_DBA() static bool bInit = false; if (!bInit) { - createRegistryInfo_OComponentDefinition(); createRegistryInfo_ODatabaseDocument(); createRegistryInfo_DataAccessDescriptorFactory(); bInit = true; diff --git a/dbaccess/util/dba.component b/dbaccess/util/dba.component index 7312e8d..d393912 100644 --- a/dbaccess/util/dba.component +++ b/dbaccess/util/dba.component @@ -30,7 +30,8 @@ <service name="com.sun.star.sdb.CommandDefinition"/> <service name="com.sun.star.sdb.QueryDefinition"/> </implementation> - <implementation name="com.sun.star.comp.dba.OComponentDefinition"> + <implementation name="com.sun.star.comp.dba.OComponentDefinition" + constructor="com_sun_star_comp_dba_OComponentDefinition"> <service name="com.sun.star.sdb.TableDefinition"/> </implementation> <implementation name="com.sun.star.comp.dba.ODatabaseContext">
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits