summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-03-20 09:12:24 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2013-04-02 12:54:41 +0200
commita789a2fc94ec84d34dafb328c53dd0eaaa8ca4a0 (patch)
tree0c6001af3e19544bbf83cba1a24a83674e3fe56a /dbaccess
parent63f00101c578d019efc5d5f6b9008077e559144f (diff)
fdo#46808, convert sdb::QueryDesigner to new style
Change-Id: I694dd16920304d0f07369e97c87a4a97b92eadeb
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/query.cxx2
-rw-r--r--dbaccess/source/core/api/querycontainer.cxx10
-rw-r--r--dbaccess/source/core/dataaccess/commandcontainer.cxx3
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.cxx58
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.hxx60
-rw-r--r--dbaccess/source/inc/stringconstants.hrc1
-rw-r--r--dbaccess/source/inc/stringconstants.inc1
7 files changed, 117 insertions, 18 deletions
diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx
index ed1f073066ae..2d10f929978d 100644
--- a/dbaccess/source/core/api/query.cxx
+++ b/dbaccess/source/core/api/query.cxx
@@ -217,7 +217,7 @@ void OQuery::rebuildColumns()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO3(OQuery, "com.sun.star.sdb.dbaccess.OQuery", SERVICE_SDB_DATASETTINGS.ascii, SERVICE_SDB_QUERY.ascii, SERVICE_SDB_QUERYDEFINITION.ascii)
+IMPLEMENT_SERVICE_INFO3(OQuery, "com.sun.star.sdb.dbaccess.OQuery", SERVICE_SDB_DATASETTINGS.ascii, SERVICE_SDB_QUERY.ascii, "com.sun.star.sdb.QueryDefinition")
// ::com::sun::star::beans::XPropertyChangeListener
void SAL_CALL OQuery::propertyChange( const PropertyChangeEvent& _rSource ) throw(RuntimeException)
diff --git a/dbaccess/source/core/api/querycontainer.cxx b/dbaccess/source/core/api/querycontainer.cxx
index 6ffb4740307b..984b9e8fe006 100644
--- a/dbaccess/source/core/api/querycontainer.cxx
+++ b/dbaccess/source/core/api/querycontainer.cxx
@@ -27,8 +27,9 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/container/XContainerApproveBroadcaster.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdb/QueryDefinition.hpp>
#include <connectivity/dbexception.hxx>
@@ -154,10 +155,9 @@ void SAL_CALL OQueryContainer::appendByDescriptor( const Reference< XPropertySet
throw DisposedException( ::rtl::OUString(), *this );
// first clone this object's CommandDefinition part
- Reference< XPropertySet > xCommandDefinitionPart(
- m_aContext->getServiceManager()->createInstanceWithContext( SERVICE_SDB_QUERYDEFINITION, m_aContext),
- UNO_QUERY_THROW );
- ::comphelper::copyProperties( _rxDesc, xCommandDefinitionPart );
+ Reference< css::sdb::XQueryDefinition > xCommandDefinitionPart = css::sdb::QueryDefinition::create(m_aContext);
+
+ ::comphelper::copyProperties( _rxDesc, Reference<XPropertySet>(xCommandDefinitionPart, UNO_QUERY_THROW) );
// TODO : the columns part of the descriptor has to be copied
// create a wrapper for the object (*before* inserting into our command definition container)
diff --git a/dbaccess/source/core/dataaccess/commandcontainer.cxx b/dbaccess/source/core/dataaccess/commandcontainer.cxx
index 5052af60e759..eb4700052c5c 100644
--- a/dbaccess/source/core/dataaccess/commandcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/commandcontainer.cxx
@@ -70,7 +70,8 @@ Reference< XContent > OCommandContainer::createObject( const ::rtl::OUString& _r
const TContentPtr& pElementContent( rDefinitions.find( _rName )->second );
if ( m_bTables )
return new OComponentDefinition( *this, _rName, m_aContext, pElementContent, m_bTables );
- return new OCommandDefinition( *this, _rName, m_aContext, pElementContent );
+ else
+ return static_cast< css::sdb::XQueryDefinition * > ( new OCommandDefinition( *this, _rName, m_aContext, pElementContent ) );
}
Reference< XInterface > SAL_CALL OCommandContainer::createInstanceWithArguments(const Sequence< Any >& /*aArguments*/ ) throw (Exception, RuntimeException)
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.cxx b/dbaccess/source/core/dataaccess/commanddefinition.cxx
index 8278bffe9fda..ba0016be5811 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.cxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.cxx
@@ -72,6 +72,62 @@ void OCommandDefinition::registerProperties()
&rCommandDefinition.m_aLayoutInformation, ::getCppuType(&rCommandDefinition.m_aLayoutInformation));
}
+rtl::OUString OCommandDefinition::getName() throw( ::com::sun::star::uno::RuntimeException )
+{
+ return getDefinition().m_aProps.aTitle;
+}
+
+rtl::OUString OCommandDefinition::getCommand() throw( ::com::sun::star::uno::RuntimeException )
+{
+ return getCommandDefinition().m_sCommand;
+}
+
+void OCommandDefinition::setCommand(const rtl::OUString& p1) throw( ::com::sun::star::uno::RuntimeException )
+{
+ setPropertyValue(PROPERTY_COMMAND, Any(p1) );
+}
+
+sal_Bool OCommandDefinition::getEscapeProcessing() throw( ::com::sun::star::uno::RuntimeException )
+{
+ return getCommandDefinition().m_bEscapeProcessing;
+}
+
+void OCommandDefinition::setEscapeProcessing(sal_Bool p1) throw( ::com::sun::star::uno::RuntimeException )
+{
+ setPropertyValue(PROPERTY_ESCAPE_PROCESSING, Any(p1) );
+}
+
+rtl::OUString OCommandDefinition::getUpdateTableName() throw( ::com::sun::star::uno::RuntimeException )
+{
+ return getCommandDefinition().m_sUpdateTableName;
+}
+
+void OCommandDefinition::setUpdateTableName(const rtl::OUString& p1) throw( ::com::sun::star::uno::RuntimeException )
+{
+ setPropertyValue(PROPERTY_UPDATE_TABLENAME, Any(p1) );
+}
+
+rtl::OUString OCommandDefinition::getUpdateCatalogName() throw( ::com::sun::star::uno::RuntimeException )
+{
+ return getCommandDefinition().m_sUpdateCatalogName;
+}
+
+void OCommandDefinition::setUpdateCatalogName(const rtl::OUString& p1) throw( ::com::sun::star::uno::RuntimeException )
+{
+ setPropertyValue(PROPERTY_UPDATE_CATALOGNAME, Any(p1) );
+}
+
+rtl::OUString OCommandDefinition::getUpdateSchemaName() throw( ::com::sun::star::uno::RuntimeException )
+{
+ return getCommandDefinition().m_sUpdateSchemaName;
+}
+
+void OCommandDefinition::setUpdateSchemaName(const rtl::OUString& p1) throw( ::com::sun::star::uno::RuntimeException )
+{
+ setPropertyValue(PROPERTY_UPDATE_SCHEMANAME, Any(p1) );
+}
+
+
OCommandDefinition::OCommandDefinition(const Reference< XComponentContext >& _xORB
,const Reference< XInterface >& _rxContainer
,const TContentPtr& _pImpl)
@@ -114,7 +170,7 @@ OUString OCommandDefinition::getImplementationName_static( ) throw(RuntimeExcep
Sequence< OUString > OCommandDefinition::getSupportedServiceNames_static( ) throw(RuntimeException)
{
Sequence< OUString > aServices(3);
- aServices.getArray()[0] = SERVICE_SDB_QUERYDEFINITION;
+ 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;
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.hxx b/dbaccess/source/core/dataaccess/commanddefinition.hxx
index f2a469bb7c22..ccc956b0c22f 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.hxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.hxx
@@ -21,17 +21,19 @@
#define _DBA_COREDATAACESS_COMMANDDEFINITION_HXX_
#include "commandbase.hxx"
-#include <comphelper/propertycontainer.hxx>
#include "apitools.hxx"
-#include <comphelper/uno3.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/sdbcx/XRename.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <comphelper/proparrhlp.hxx>
+#include <com/sun/star/sdb/XQueryDefinition.hpp>
#include "datasettings.hxx"
-#include <com/sun/star/container/XNameAccess.hpp>
#include "ContentHelper.hxx"
#include "ComponentDefinition.hxx"
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase2.hxx>
+
//........................................................................
namespace dbaccess
@@ -42,18 +44,19 @@ namespace dbaccess
//= OCommandDefinition - a database "document" which describes a query
//=========================================================================
class OCommandDefinition_Impl : public OComponentDefinition_Impl
- ,public OCommandBase
+ ,public OCommandBase
{
public:
};
-typedef ::cppu::ImplHelper1 < ::com::sun::star::sdbcx::XRename
+typedef ::cppu::ImplHelper2 < ::com::sun::star::sdbcx::XRename,
+ ::com::sun::star::sdb::XQueryDefinition
> OCommandDefinition_Base;
class OCommandDefinition;
typedef ::comphelper::OPropertyArrayUsageHelper< OCommandDefinition >
OCommandDefinition_PROP;
-class OCommandDefinition :public OComponentDefinition
+class OCommandDefinition : public OComponentDefinition
,public OCommandDefinition_Base
,public OCommandDefinition_PROP
{
@@ -96,6 +99,47 @@ public:
// XRename
virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ // overrides to resolve ambiguity
+ virtual void SAL_CALL setPropertyValue(const rtl::OUString& p1, const com::sun::star::uno::Any& p2) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { OComponentDefinition::setPropertyValue(p1, p2); }
+ virtual com::sun::star::uno::Any SAL_CALL getPropertyValue(const rtl::OUString& p1) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { return OComponentDefinition::getPropertyValue(p1); }
+ virtual void SAL_CALL addPropertyChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener>& p2) throw( ::com::sun::star::uno::RuntimeException )
+ { OComponentDefinition::addPropertyChangeListener(p1, p2); }
+ virtual void SAL_CALL removePropertyChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertyChangeListener>& p2) throw( ::com::sun::star::uno::RuntimeException )
+ { OComponentDefinition::removePropertyChangeListener(p1, p2); }
+ virtual void SAL_CALL addVetoableChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener>& p2) throw( ::com::sun::star::uno::RuntimeException )
+ { OComponentDefinition::addVetoableChangeListener(p1, p2); }
+ virtual void SAL_CALL removeVetoableChangeListener(const rtl::OUString& p1, const com::sun::star::uno::Reference<com::sun::star::beans::XVetoableChangeListener>& p2) throw( ::com::sun::star::uno::RuntimeException )
+ { OComponentDefinition::removeVetoableChangeListener(p1, p2); }
+ virtual com::sun::star::uno::Reference<com::sun::star::ucb::XContentIdentifier> SAL_CALL getIdentifier() throw( ::com::sun::star::uno::RuntimeException )
+ { return OComponentDefinition::getIdentifier(); }
+ virtual rtl::OUString SAL_CALL getContentType() throw( ::com::sun::star::uno::RuntimeException )
+ { return OComponentDefinition::getContentType(); }
+ virtual void SAL_CALL addContentEventListener(const com::sun::star::uno::Reference<com::sun::star::ucb::XContentEventListener>& p1) throw( ::com::sun::star::uno::RuntimeException )
+ { OComponentDefinition::addContentEventListener(p1); }
+ virtual void SAL_CALL removeContentEventListener(const com::sun::star::uno::Reference<com::sun::star::ucb::XContentEventListener>& p1) throw( ::com::sun::star::uno::RuntimeException )
+ { OComponentDefinition::removeContentEventListener(p1); }
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException )
+ { OComponentDefinition::dispose(); }
+ virtual void SAL_CALL addEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& p1) throw( ::com::sun::star::uno::RuntimeException )
+ { OComponentDefinition::addEventListener(p1); }
+ virtual void SAL_CALL removeEventListener(const com::sun::star::uno::Reference<com::sun::star::lang::XEventListener>& p1) throw( ::com::sun::star::uno::RuntimeException )
+ { OComponentDefinition::removeEventListener(p1); }
+
+ // XQueryDefinition properties
+ virtual rtl::OUString getName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString getCommand() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void setCommand(const rtl::OUString&) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool getEscapeProcessing() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void setEscapeProcessing(sal_Bool) throw( ::com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString getUpdateTableName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void setUpdateTableName(const rtl::OUString&) throw( ::com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString getUpdateCatalogName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void setUpdateCatalogName(const rtl::OUString&) throw( ::com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString getUpdateSchemaName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void setUpdateSchemaName(const rtl::OUString&) throw( ::com::sun::star::uno::RuntimeException );
+
// OPropertySetHelper
DECLARE_PROPERTYCONTAINER_DEFAULTS( );
diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc
index 8c60d05f2978..07849694b862 100644
--- a/dbaccess/source/inc/stringconstants.hrc
+++ b/dbaccess/source/inc/stringconstants.hrc
@@ -365,7 +365,6 @@ DECLARE_CONSTASCII_USTRING(SERVICE_SDB_SQLQUERYCOMPOSER);
DECLARE_CONSTASCII_USTRING(SERVICE_SDB_DATASETTINGS);
DECLARE_CONSTASCII_USTRING(SERVICE_SDB_QUERYDESCRIPTOR);
DECLARE_CONSTASCII_USTRING(SERVICE_SDB_QUERY);
-DECLARE_CONSTASCII_USTRING(SERVICE_SDB_QUERYDEFINITION);
DECLARE_CONSTASCII_USTRING(SERVICE_SDB_COLUMNSETTINGS);
DECLARE_CONSTASCII_USTRING(SERVICE_SDBCX_COLUMNS);
DECLARE_CONSTASCII_USTRING(SERVICE_SDBCX_TABLES);
diff --git a/dbaccess/source/inc/stringconstants.inc b/dbaccess/source/inc/stringconstants.inc
index 3ce49a0d27e2..e72c373275ee 100644
--- a/dbaccess/source/inc/stringconstants.inc
+++ b/dbaccess/source/inc/stringconstants.inc
@@ -202,7 +202,6 @@ IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_SQLQUERYCOMPOSER, "com.sun.star.sdb.SQL
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_DATASETTINGS, "com.sun.star.sdb.DefinitionSettings");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_QUERYDESCRIPTOR, "com.sun.star.sdb.QueryDescriptor");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_QUERY, "com.sun.star.sdb.Query");
-IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_QUERYDEFINITION, "com.sun.star.sdb.QueryDefinition");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_COLUMNS, "com.sun.star.sdbcx.Columns");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_TABLES, "com.sun.star.sdbcx.Tables");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_QUERIES, "com.sun.star.sdb.Queries");