Kaydet (Commit) 614e31aa authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, Adapt sdb::TableDefinition UNO service to new style

The service already existed, it just did not have an IDL file

Change-Id: Iaac84da8baa3a060eef339d8e477f86ca49fae08
üst 29f17580
......@@ -31,6 +31,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/sdb/TableDefinition.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
......@@ -158,13 +159,8 @@ void lcl_createDefintionObject(const ::rtl::OUString& _rName
_xTableDefinition.set(_xTableDefinitions->getByName(_rName),UNO_QUERY);
else
{
Sequence< Any > aArguments(1);
PropertyValue aValue;
// set as folder
aValue.Name = PROPERTY_NAME;
aValue.Value <<= _rName;
aArguments[0] <<= aValue;
_xTableDefinition.set(::comphelper::getProcessServiceFactory()->createInstanceWithArguments(SERVICE_SDB_TABLEDEFINITION,aArguments),UNO_QUERY);
_xTableDefinition.set( TableDefinition::createWithName( ::comphelper::getProcessComponentContext(), _rName ), UNO_QUERY);
_xTableDefinitions->insertByName(_rName,makeAny(_xTableDefinition));
::dbaccess::notifyDataSourceModified(_xTableDefinitions,_bModified);
}
......
......@@ -91,6 +91,22 @@ OComponentDefinition_Impl::~OComponentDefinition_Impl()
DBG_NAME(OComponentDefinition)
void OComponentDefinition::initialize( const Sequence< Any >& aArguments ) throw(Exception)
{
OUString rName;
if( (aArguments.getLength() == 1) && (aArguments[0] >>= rName) )
{
Sequence< Any > aNewArgs(1);
PropertyValue aValue;
aValue.Name = PROPERTY_NAME;
aValue.Value <<= rName;
aNewArgs[0] <<= aValue;
OContentHelper::initialize(aNewArgs);
}
else
OContentHelper::initialize(aArguments);
}
void OComponentDefinition::registerProperties()
{
m_xColumnPropertyListener = ::comphelper::ImplementationReference<OColumnPropertyListener,XPropertyChangeListener>(new OColumnPropertyListener(this));
......@@ -161,7 +177,7 @@ OUString OComponentDefinition::getImplementationName_static( ) throw(RuntimeExc
Sequence< ::rtl::OUString > OComponentDefinition::getSupportedServiceNames_static( ) throw(RuntimeException)
{
Sequence< ::rtl::OUString > aServices(2);
aServices.getArray()[0] = SERVICE_SDB_TABLEDEFINITION;
aServices.getArray()[0] = ::rtl::OUString("com.sun.star.sdb.TableDefinition");
aServices.getArray()[1] = ::rtl::OUString("com.sun.star.ucb.Content");
return aServices;
......
......@@ -135,6 +135,9 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
// XInitialization
void initialize( com::sun::star::uno::Sequence< com::sun::star::uno::Any > const & rArguments) throw (com::sun::star::uno::Exception);
// ::com::sun::star::beans::XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
......
......@@ -23,6 +23,7 @@
#include <tools/debug.hxx>
#include "dbastrings.hrc"
#include <com/sun/star/sdb/TableDefinition.hpp>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
......@@ -78,7 +79,10 @@ Reference< XInterface > SAL_CALL OCommandContainer::createInstanceWithArguments(
Reference< XInterface > SAL_CALL OCommandContainer::createInstance( ) throw (Exception, RuntimeException)
{
return m_aContext.createComponent( (::rtl::OUString)( m_bTables ? SERVICE_SDB_TABLEDEFINITION : SERVICE_SDB_COMMAND_DEFINITION ) );
if(m_bTables)
return com::sun::star::sdb::TableDefinition::createDefault( m_aContext.getUNOContext() );
else
return m_aContext.createComponent( (::rtl::OUString)( SERVICE_SDB_COMMAND_DEFINITION ) );
}
OUString OCommandContainer::determineContentType() const
......
......@@ -84,7 +84,7 @@ SvXMLImportContext* OXMLDocuments::CreateChildContext(
{
case XML_TOK_TABLE:
GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
pContext = new OXMLTable( GetOwnImport(), nPrefix, rLocalName,xAttrList,m_xContainer,SERVICE_SDB_TABLEDEFINITION);
pContext = new OXMLTable( GetOwnImport(), nPrefix, rLocalName, xAttrList, m_xContainer, "com.sun.star.sdb.TableDefinition");
break;
case XML_TOK_QUERY:
GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
......
......@@ -372,7 +372,6 @@ DECLARE_CONSTASCII_USTRING(SERVICE_SDB_QUERIES);
DECLARE_CONSTASCII_USTRING(SERVICE_SDBC_DRIVERMANAGER);
DECLARE_CONSTASCII_USTRING(SERVICE_FRAME_DESKTOP);
DECLARE_CONSTASCII_USTRING(SERVICE_UI_FOLDERPICKER);
DECLARE_CONSTASCII_USTRING(SERVICE_SDB_TABLEDEFINITION);
DECLARE_CONSTASCII_USTRING(SERVICE_SDB_COMMAND_DEFINITION);
DECLARE_CONSTASCII_USTRING(SERVICE_NAME_FORM);
DECLARE_CONSTASCII_USTRING(SERVICE_NAME_FORM_COLLECTION);
......
......@@ -208,7 +208,6 @@ IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_TABLES, "com.sun.star.sdbcx.Tables");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_QUERIES, "com.sun.star.sdb.Queries");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_INDEXCOLUMN, "com.sun.star.sdbcx.IndexColumn");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_KEYCOLUMN, "com.sun.star.sdbcx.KeyColumn");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_TABLEDEFINITION, "com.sun.star.sdb.TableDefinition");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_COMMAND_DEFINITION, "com.sun.star.sdb.CommandDefinition");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_DOCUMENTDEFINITION, "com.sun.star.sdb.DocumentDefinition");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_NAME_FORM, "com.sun.star.sdb.Form");
......
......@@ -263,6 +263,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/sdb,\
FilterDialog \
OrderDialog \
ReportDesign \
TableDefinition \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/sdb/application,\
CopyTableWizard \
......
/* -*- 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_TableDefinition_idl__
#define __com_sun_star_sdb_TableDefinition_idl__
#include <com/sun/star/beans/XPropertySet.idl>
module com { module sun { module star { module sdb {
/**
This IDL was created from the service's places of use, so it is probably incomplete.
@since LibreOffice 4.1
*/
service TableDefinition : com::sun::star::beans::XPropertySet
{
createDefault();
createWithName([in] string Name);
};
}; }; }; };
/*===========================================================================
===========================================================================*/
#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