Kaydet (Commit) f7c94c5b authored tarafından Matúš Kukan's avatar Matúš Kukan

tdf#74608 dbaccess: Constructor feature for OCommandDefinition

Change-Id: Ibaa1fd8310fdba073190a7721891ebb835eb0e6e
üst 8ac2b6d0
......@@ -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: */
......@@ -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
......
......@@ -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();
......
......@@ -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();
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment