Kaydet (Commit) a789a2fc authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Fridrich Štrba

fdo#46808, convert sdb::QueryDesigner to new style

Change-Id: I694dd16920304d0f07369e97c87a4a97b92eadeb
üst 63f00101
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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;
......
......@@ -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( );
......
......@@ -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);
......
......@@ -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");
......
......@@ -292,6 +292,7 @@ $(eval $(call gb_ZipUnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/sdb,\
InteractionHandler \
FilterDialog \
OrderDialog \
QueryDefinition \
ReportDesign \
TableDefinition \
TextConnectionSettings \
......@@ -1042,7 +1043,6 @@ $(eval $(call gb_ZipUnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/sdb,
OrderColumn \
PreparedStatement \
Query \
QueryDefinition \
QueryDescriptor \
QueryDesign \
RelationDesign \
......@@ -3125,6 +3125,7 @@ $(eval $(call gb_ZipUnoApi_add_idlfiles,offapi,offapi/com/sun/star/sdb,\
XOfficeDatabaseDocument \
XParametersSupplier \
XQueriesSupplier \
XQueryDefinition \
XQueryDefinitionsSupplier \
XReportDocumentsSupplier \
XResultSetAccess \
......
......@@ -19,7 +19,7 @@
#ifndef __com_sun_star_sdb_QueryDefinition_idl__
#define __com_sun_star_sdb_QueryDefinition_idl__
#include <com/sun/star/beans/XPropertySet.idl>
#include <com/sun/star/sdb/XQueryDefinition.idl>
module com { module sun { module star { module sdb {
......@@ -30,44 +30,7 @@
It can be used, if there is a need to execute SQL statement more than once.
</p>
*/
published service QueryDefinition
{
/** access to the owning database definition object.
*/
interface com::sun::star::beans::XPropertySet;
/** is the name of the definition.
*/
[readonly, property] string Name;
/** is the command of the query, this is typically a select statement.
*/
[property] string Command;
/** should we use escape processing for the query.
*/
[property] boolean EscapeProcessing;
/** is the name of the table which should be updated. This is usually used
for queries which relate on more than one table.
*/
[property] string UpdateTableName;
/** is the name of the update table catalog.
*/
[property] string UpdateCatalogName;
/** is the name of the update table schema.
*/
[property] string UpdateSchemaName;
};
published service QueryDefinition : XQueryDefinition;
}; }; }; };
......
/* -*- 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 __com_sun_star_sdb_XQueryDefinition_idl__
#define __com_sun_star_sdb_XQueryDefinition_idl__
#include <com/sun/star/beans/XPropertySet.idl>
#include <com/sun/star/ucb/XContent.idl>
#include <com/sun/star/lang/XComponent.idl>
module com { module sun { module star { module sdb {
/**
@since LibreOffice 4.1
*/
published interface XQueryDefinition
{
/** access to the owning database definition object.
*/
interface com::sun::star::beans::XPropertySet;
interface com::sun::star::ucb::XContent;
interface com::sun::star::lang::XComponent;
};
}; }; }; };
/*===========================================================================
===========================================================================*/
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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