summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-01-09 17:21:03 +0200
committerNoel Grandin <noel@peralex.com>2013-01-28 08:23:11 +0200
commit614e31aa24b51a6e4f5c4f26d51b3d880db643b1 (patch)
treec54e83dd9851c3b3ea036b7786845fcdcba20701
parent29f17580a59421d7dd5f8c6bef980ae30cc63bb6 (diff)
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
-rw-r--r--dbaccess/source/core/api/tablecontainer.cxx8
-rw-r--r--dbaccess/source/core/dataaccess/ComponentDefinition.cxx18
-rw-r--r--dbaccess/source/core/dataaccess/ComponentDefinition.hxx3
-rw-r--r--dbaccess/source/core/dataaccess/commandcontainer.cxx6
-rw-r--r--dbaccess/source/filter/xml/xmlDocuments.cxx2
-rw-r--r--dbaccess/source/inc/stringconstants.hrc1
-rw-r--r--dbaccess/source/inc/stringconstants.inc1
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/sdb/TableDefinition.idl45
9 files changed, 74 insertions, 11 deletions
diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx
index 2a334599f3f1..fc14179d286c 100644
--- a/dbaccess/source/core/api/tablecontainer.cxx
+++ b/dbaccess/source/core/api/tablecontainer.cxx
@@ -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);
}
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
index 5380332f661c..384d98dfc578 100644
--- a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
+++ b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
@@ -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;
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
index d5d297c407d7..2e39196966d1 100644
--- a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
+++ b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
@@ -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);
diff --git a/dbaccess/source/core/dataaccess/commandcontainer.cxx b/dbaccess/source/core/dataaccess/commandcontainer.cxx
index 52583728ab6b..245f98b6c4e6 100644
--- a/dbaccess/source/core/dataaccess/commandcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/commandcontainer.cxx
@@ -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
diff --git a/dbaccess/source/filter/xml/xmlDocuments.cxx b/dbaccess/source/filter/xml/xmlDocuments.cxx
index 2184162bce0f..2b98e8a70e32 100644
--- a/dbaccess/source/filter/xml/xmlDocuments.cxx
+++ b/dbaccess/source/filter/xml/xmlDocuments.cxx
@@ -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 );
diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc
index 1eab01f02c40..5af835046485 100644
--- a/dbaccess/source/inc/stringconstants.hrc
+++ b/dbaccess/source/inc/stringconstants.hrc
@@ -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);
diff --git a/dbaccess/source/inc/stringconstants.inc b/dbaccess/source/inc/stringconstants.inc
index 37627a0a5159..066cc205778b 100644
--- a/dbaccess/source/inc/stringconstants.inc
+++ b/dbaccess/source/inc/stringconstants.inc
@@ -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");
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 59fea6336a6b..5f924a49cfb2 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -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 \
diff --git a/offapi/com/sun/star/sdb/TableDefinition.idl b/offapi/com/sun/star/sdb/TableDefinition.idl
new file mode 100644
index 000000000000..e1ee4f44d26f
--- /dev/null
+++ b/offapi/com/sun/star/sdb/TableDefinition.idl
@@ -0,0 +1,45 @@
+/* -*- 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: */