summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2015-11-21 00:10:07 +0100
committerMatúš Kukan <matus.kukan@gmail.com>2015-12-05 07:08:46 +0100
commitf7c94c5b8a7de7f24bea8c612eb2b15a26c2a61a (patch)
tree142b8dc96868606257a701a344520847b3fbf40d
parent8ac2b6d077f4e7b1c5a010c2960fb08c0132da5f (diff)
tdf#74608 dbaccess: Constructor feature for OCommandDefinition
Change-Id: Ibaa1fd8310fdba073190a7721891ebb835eb0e6e
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.cxx49
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.hxx20
-rw-r--r--dbaccess/source/core/inc/services.hxx1
-rw-r--r--dbaccess/source/core/misc/services.cxx1
-rw-r--r--dbaccess/util/dba.component3
5 files changed, 25 insertions, 49 deletions
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.cxx b/dbaccess/source/core/dataaccess/commanddefinition.cxx
index 6fd3dc08118e..e05b10f34a6e 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.cxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.cxx
@@ -20,29 +20,17 @@
#include "commanddefinition.hxx"
#include "apitools.hxx"
#include "dbastrings.hrc"
-#include "module_dba.hxx"
-#include "services.hxx"
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <tools/debug.hxx>
-#include <comphelper/sequence.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;
-
-// OCommandDefinition
-extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition()
-{
- static ::dba::OAutoRegistration< ::dbaccess::OCommandDefinition > aAutoRegistration;
-}
namespace dbaccess
{
@@ -99,33 +87,18 @@ IMPLEMENT_GETTYPES2(OCommandDefinition,OCommandDefinition_Base,OComponentDefinit
IMPLEMENT_FORWARD_XINTERFACE2( OCommandDefinition,OComponentDefinition,OCommandDefinition_Base)
IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2(OCommandDefinition,OCommandDefinition_PROP)
-OUString OCommandDefinition::getImplementationName_static( ) throw(RuntimeException)
+OUString SAL_CALL OCommandDefinition::getImplementationName() throw(RuntimeException, std::exception)
{
return OUString("com.sun.star.comp.dba.OCommandDefinition");
}
-OUString SAL_CALL OCommandDefinition::getImplementationName( ) throw(RuntimeException, std::exception)
-{
- return getImplementationName_static();
-}
-
-Sequence< OUString > OCommandDefinition::getSupportedServiceNames_static( ) throw(RuntimeException)
+css::uno::Sequence<OUString> SAL_CALL OCommandDefinition::getSupportedServiceNames() throw(RuntimeException, std::exception)
{
- Sequence< OUString > aServices(3);
- aServices.getArray()[0] = "com.sun.star.sdb.QueryDefinition";
- aServices.getArray()[1] = "com.sun.star.sdb.CommandDefinition";
- aServices.getArray()[2] = "com.sun.star.ucb.Content";
- return aServices;
-}
-
-Sequence< OUString > SAL_CALL OCommandDefinition::getSupportedServiceNames( ) throw(RuntimeException, std::exception)
-{
- return getSupportedServiceNames_static();
-}
-
-Reference< XInterface > OCommandDefinition::Create(const Reference< XComponentContext >& _rxContext)
-{
- return *(new OCommandDefinition( _rxContext, nullptr, TContentPtr( new OCommandDefinition_Impl ) ) );
+ return {
+ "com.sun.star.sdb.QueryDefinition",
+ "com.sun.star.sdb.CommandDefinition",
+ "com.sun.star.ucb.Content"
+ };
}
void SAL_CALL OCommandDefinition::rename( const OUString& newName ) throw (SQLException, ElementExistException, RuntimeException, std::exception)
@@ -150,4 +123,12 @@ void SAL_CALL OCommandDefinition::rename( const OUString& newName ) throw (SQLEx
} // namespace dbaccess
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
+com_sun_star_comp_dba_OCommandDefinition(css::uno::XComponentContext* context,
+ css::uno::Sequence<css::uno::Any> const &)
+{
+ return cppu::acquire(new dbaccess::OCommandDefinition(
+ context, nullptr, dbaccess::TContentPtr( new dbaccess::OCommandDefinition_Impl )));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.hxx b/dbaccess/source/core/dataaccess/commanddefinition.hxx
index 1769142f1622..d885b270b7af 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.hxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.hxx
@@ -58,15 +58,13 @@ class OCommandDefinition : public OComponentDefinition
protected:
virtual ~OCommandDefinition();
- OCommandDefinition(const css::uno::Reference< css::uno::XComponentContext >&
- ,const css::uno::Reference< css::uno::XInterface >& _xParentContainer
- ,const TContentPtr& _pImpl
- );
-
inline const OCommandDefinition_Impl& getCommandDefinition() const { return dynamic_cast< const OCommandDefinition_Impl& >( *m_pImpl.get() ); }
inline OCommandDefinition_Impl& getCommandDefinition() { return dynamic_cast< OCommandDefinition_Impl& >( *m_pImpl.get() ); }
public:
+ OCommandDefinition(const css::uno::Reference< css::uno::XComponentContext >& ,
+ const css::uno::Reference< css::uno::XInterface >& _xParentContainer,
+ const TContentPtr& _pImpl);
OCommandDefinition(
const css::uno::Reference< css::uno::XInterface >& _rxContainer
@@ -87,12 +85,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;
-// 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 >&);
-
// XRename
virtual void SAL_CALL rename( const OUString& newName ) throw (css::sdbc::SQLException, css::container::ElementExistException, css::uno::RuntimeException, std::exception) override;
@@ -125,7 +117,11 @@ public:
{ OComponentDefinition::removeEventListener(p1); }
// OPropertySetHelper
- DECLARE_PROPERTYCONTAINER_DEFAULTS( );
+ virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo()
+ throw(css::uno::RuntimeException, std::exception) override;
+ virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ virtual cppu::IPropertyArrayHelper* createArrayHelper() const override;
+
private:
// helper
diff --git a/dbaccess/source/core/inc/services.hxx b/dbaccess/source/core/inc/services.hxx
index 1919ff843269..d861f2c8c4a9 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_OCommandDefinition();
extern "C" void SAL_CALL createRegistryInfo_OComponentDefinition();
extern "C" void SAL_CALL createRegistryInfo_ODatabaseDocument();
diff --git a/dbaccess/source/core/misc/services.cxx b/dbaccess/source/core/misc/services.cxx
index 2118576dd1e4..18850d9bedc8 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_OCommandDefinition();
createRegistryInfo_OComponentDefinition();
createRegistryInfo_ODatabaseDocument();
createRegistryInfo_DataAccessDescriptorFactory();
diff --git a/dbaccess/util/dba.component b/dbaccess/util/dba.component
index 4448f72d8a86..7312e8dc087b 100644
--- a/dbaccess/util/dba.component
+++ b/dbaccess/util/dba.component
@@ -25,7 +25,8 @@
<implementation name="com.sun.star.comp.dba.DataAccessDescriptorFactory">
<singleton name="com.sun.star.sdb.DataAccessDescriptorFactory"/>
</implementation>
- <implementation name="com.sun.star.comp.dba.OCommandDefinition">
+ <implementation name="com.sun.star.comp.dba.OCommandDefinition"
+ constructor="com_sun_star_comp_dba_OCommandDefinition">
<service name="com.sun.star.sdb.CommandDefinition"/>
<service name="com.sun.star.sdb.QueryDefinition"/>
</implementation>