2010-10-27 12:33:13 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +01:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2013-11-05 02:18:53 +01:00
|
|
|
#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_WCOPYTABLE_HXX
|
|
|
|
#define INCLUDED_DBACCESS_SOURCE_UI_INC_WCOPYTABLE_HXX
|
2001-02-23 13:59:32 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XConnection.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XResultSet.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
|
2012-12-04 13:18:35 +02:00
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
2001-02-23 13:59:32 +00:00
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#include <comphelper/stl_types.hxx>
|
|
|
|
#include "TypeInfo.hxx"
|
2019-09-05 12:22:38 +01:00
|
|
|
#include <vcl/roadmapwizard.hxx>
|
2001-02-23 13:59:32 +00:00
|
|
|
#include "DExport.hxx"
|
|
|
|
#include "WTabPage.hxx"
|
|
|
|
#include "FieldDescriptions.hxx"
|
|
|
|
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
|
|
|
|
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
|
2009-11-25 13:48:21 +01:00
|
|
|
#include <com/sun/star/task/XInteractionHandler.hpp>
|
2013-12-06 10:17:37 +01:00
|
|
|
#include <map>
|
2015-05-04 10:47:12 +09:00
|
|
|
#include <algorithm>
|
2001-10-26 13:45:22 +00:00
|
|
|
|
2001-02-23 13:59:32 +00:00
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
|
2017-06-28 21:48:22 +02:00
|
|
|
class TColumnFindFunctor
|
2001-10-18 05:52:55 +00:00
|
|
|
{
|
|
|
|
public:
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual bool operator()(const OUString& _sColumnName) const = 0;
|
2012-03-14 13:27:56 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
~TColumnFindFunctor() {}
|
2001-10-18 05:52:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TExportColumnFindFunctor : public TColumnFindFunctor
|
|
|
|
{
|
|
|
|
ODatabaseExport::TColumns* m_pColumns;
|
|
|
|
public:
|
|
|
|
TExportColumnFindFunctor(ODatabaseExport::TColumns* _pColumns)
|
|
|
|
{
|
|
|
|
m_pColumns = _pColumns;
|
|
|
|
}
|
2012-03-14 13:27:56 +01:00
|
|
|
|
|
|
|
virtual ~TExportColumnFindFunctor() {}
|
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
bool operator()(const OUString& _sColumnName) const override
|
2001-10-18 05:52:55 +00:00
|
|
|
{
|
|
|
|
return m_pColumns->find(_sColumnName) != m_pColumns->end();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class TMultiListBoxEntryFindFunctor : public TColumnFindFunctor
|
|
|
|
{
|
2013-12-06 14:27:53 +01:00
|
|
|
::comphelper::UStringMixEqual m_aCase;
|
2017-02-17 19:06:24 +02:00
|
|
|
std::vector< OUString>* m_pVector;
|
2001-10-18 05:52:55 +00:00
|
|
|
public:
|
2017-02-17 19:06:24 +02:00
|
|
|
TMultiListBoxEntryFindFunctor(std::vector< OUString>* _pVector,
|
2013-12-06 14:27:53 +01:00
|
|
|
const ::comphelper::UStringMixEqual& _aCase)
|
2001-10-18 05:52:55 +00:00
|
|
|
:m_aCase(_aCase)
|
|
|
|
,m_pVector(_pVector)
|
|
|
|
{
|
|
|
|
}
|
2012-03-14 13:27:56 +01:00
|
|
|
|
|
|
|
virtual ~TMultiListBoxEntryFindFunctor() {}
|
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
bool operator()(const OUString& _sColumnName) const override
|
2001-10-18 05:52:55 +00:00
|
|
|
{
|
2017-02-17 19:06:24 +02:00
|
|
|
return std::any_of(m_pVector->begin(),m_pVector->end(),
|
2017-07-05 01:32:48 +02:00
|
|
|
[this, &_sColumnName](const OUString& lhs)
|
|
|
|
{ return m_aCase(lhs, _sColumnName); });
|
2001-10-18 05:52:55 +00:00
|
|
|
}
|
|
|
|
};
|
2008-01-30 07:48:35 +00:00
|
|
|
|
|
|
|
// ICopyTableSourceObject
|
|
|
|
/** interface to an object to copy to another DB, using the OCopyTableWizard
|
|
|
|
|
|
|
|
when the wizard is used to copy an object to another DB, it usually requires
|
|
|
|
a sdbcx-level or sdb-level object (a css.sdbcx.Table or css.sdb.Query, that is).
|
|
|
|
|
|
|
|
However, to also support copying tables from sdbc-level connections, we allow to
|
|
|
|
work with the object name only. This implies some less features (like copying the
|
|
|
|
UI settings of a table is not done), but still allows to copy definition and data.
|
|
|
|
*/
|
|
|
|
class ICopyTableSourceObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// retrieves the fully qualified name of the object to copy
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual OUString getQualifiedObjectName() const = 0;
|
2008-01-30 07:48:35 +00:00
|
|
|
/// determines whether the object is a view
|
|
|
|
virtual bool isView() const = 0;
|
|
|
|
/** copies the UI settings of the object to the given target object. Might be
|
|
|
|
ignored by implementations which do not have Ui settings.
|
|
|
|
*/
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual void copyUISettingsTo( const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const = 0;
|
2008-01-30 07:48:35 +00:00
|
|
|
/// retrieves the column names of the to-be-copied object
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual css::uno::Sequence< OUString >
|
2008-01-30 07:48:35 +00:00
|
|
|
getColumnNames() const = 0;
|
|
|
|
/// retrieves the names of the primary keys of the to-be-copied object
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual css::uno::Sequence< OUString >
|
2008-01-30 07:48:35 +00:00
|
|
|
getPrimaryKeyColumnNames() const = 0;
|
|
|
|
/// creates a OFieldDescription for the given column of the to-be-copied object
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual OFieldDescription* createFieldDescription( const OUString& _rColumnName ) const = 0;
|
2008-01-30 07:48:35 +00:00
|
|
|
/// returns the SELECT statement which can be used to retrieve the data of the to-be-copied object
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual OUString getSelectStatement() const = 0;
|
2008-01-30 07:48:35 +00:00
|
|
|
|
|
|
|
/** copies the filter and sorting
|
|
|
|
*
|
|
|
|
* \return
|
|
|
|
*/
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual void copyFilterAndSortingTo(const css::uno::Reference< css::sdbc::XConnection >& _xConnection,const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const = 0;
|
2008-01-30 07:48:35 +00:00
|
|
|
|
|
|
|
/** returns the prepared statement which can be used to retrieve the data of the to-be-copied object
|
|
|
|
|
|
|
|
The default implementation of this method will simply prepare a statement with the return value
|
|
|
|
of ->getSelectStatement.
|
|
|
|
*/
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual ::utl::SharedUNOComponent< css::sdbc::XPreparedStatement >
|
2008-01-30 07:48:35 +00:00
|
|
|
getPreparedSelectStatement() const = 0;
|
|
|
|
|
|
|
|
virtual ~ICopyTableSourceObject();
|
|
|
|
};
|
|
|
|
|
|
|
|
// ObjectCopySource
|
|
|
|
class ObjectCopySource : public ICopyTableSourceObject
|
|
|
|
{
|
|
|
|
private:
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::sdbc::XConnection > m_xConnection;
|
|
|
|
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
|
|
|
|
css::uno::Reference< css::beans::XPropertySet > m_xObject;
|
|
|
|
css::uno::Reference< css::beans::XPropertySetInfo > m_xObjectPSI;
|
|
|
|
css::uno::Reference< css::container::XNameAccess > m_xObjectColumns;
|
2008-01-30 07:48:35 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
ObjectCopySource(
|
2015-08-03 09:14:58 +02:00
|
|
|
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
|
|
|
|
const css::uno::Reference< css::beans::XPropertySet >& _rxObject
|
2008-01-30 07:48:35 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// ICopyTableSourceObject overridables
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual OUString getQualifiedObjectName() const override;
|
|
|
|
virtual bool isView() const override;
|
|
|
|
virtual void copyUISettingsTo( const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const override;
|
|
|
|
virtual void copyFilterAndSortingTo(const css::uno::Reference< css::sdbc::XConnection >& _xConnection, const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const override;
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual css::uno::Sequence< OUString >
|
2015-10-12 16:04:04 +02:00
|
|
|
getColumnNames() const override;
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual css::uno::Sequence< OUString >
|
2015-10-12 16:04:04 +02:00
|
|
|
getPrimaryKeyColumnNames() const override;
|
|
|
|
virtual OFieldDescription* createFieldDescription( const OUString& _rColumnName ) const override;
|
|
|
|
virtual OUString getSelectStatement() const override;
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual ::utl::SharedUNOComponent< css::sdbc::XPreparedStatement >
|
2015-10-12 16:04:04 +02:00
|
|
|
getPreparedSelectStatement() const override;
|
2008-01-30 07:48:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// NamedTableCopySource
|
|
|
|
class NamedTableCopySource : public ICopyTableSourceObject
|
|
|
|
{
|
|
|
|
private:
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::sdbc::XConnection > m_xConnection;
|
|
|
|
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData;
|
|
|
|
OUString m_sTableName;
|
|
|
|
OUString m_sTableCatalog;
|
|
|
|
OUString m_sTableSchema;
|
|
|
|
OUString m_sTableBareName;
|
2017-02-17 19:06:24 +02:00
|
|
|
std::vector< OFieldDescription > m_aColumnInfo;
|
2015-08-03 09:14:58 +02:00
|
|
|
::utl::SharedUNOComponent< css::sdbc::XPreparedStatement > m_xStatement;
|
2008-01-30 07:48:35 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
NamedTableCopySource(
|
2015-08-03 09:14:58 +02:00
|
|
|
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& _rTableName
|
2008-01-30 07:48:35 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// ICopyTableSourceObject overridables
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual OUString getQualifiedObjectName() const override;
|
|
|
|
virtual bool isView() const override;
|
|
|
|
virtual void copyUISettingsTo( const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const override;
|
|
|
|
virtual void copyFilterAndSortingTo(const css::uno::Reference< css::sdbc::XConnection >& _xConnection,const css::uno::Reference< css::beans::XPropertySet >& _rxObject ) const override;
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual css::uno::Sequence< OUString >
|
2015-10-12 16:04:04 +02:00
|
|
|
getColumnNames() const override;
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual css::uno::Sequence< OUString >
|
2015-10-12 16:04:04 +02:00
|
|
|
getPrimaryKeyColumnNames() const override;
|
|
|
|
virtual OFieldDescription* createFieldDescription( const OUString& _rColumnName ) const override;
|
|
|
|
virtual OUString getSelectStatement() const override;
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual ::utl::SharedUNOComponent< css::sdbc::XPreparedStatement >
|
2015-10-12 16:04:04 +02:00
|
|
|
getPreparedSelectStatement() const override;
|
2008-01-30 07:48:35 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void impl_ensureColumnInfo_throw();
|
2016-07-18 09:22:27 +02:00
|
|
|
::utl::SharedUNOComponent< css::sdbc::XPreparedStatement > const &
|
2008-01-30 07:48:35 +00:00
|
|
|
impl_ensureStatement_throw();
|
|
|
|
};
|
|
|
|
|
2001-02-23 13:59:32 +00:00
|
|
|
// Wizard Dialog
|
2019-09-05 12:22:38 +01:00
|
|
|
class OCopyTableWizard : public vcl::RoadmapWizardMachine
|
2001-02-23 13:59:32 +00:00
|
|
|
{
|
|
|
|
friend class OWizColumnSelect;
|
|
|
|
friend class OWizTypeSelect;
|
|
|
|
friend class OWizTypeSelectControl;
|
|
|
|
friend class OCopyTable;
|
|
|
|
friend class OWizNameMatching;
|
2006-06-20 02:15:28 +00:00
|
|
|
|
2001-02-23 13:59:32 +00:00
|
|
|
public:
|
2013-12-06 10:17:37 +01:00
|
|
|
typedef std::map<OUString, OUString, ::comphelper::UStringMixLess> TNameMapping;
|
2006-06-20 02:15:28 +00:00
|
|
|
|
|
|
|
enum Wizard_Button_Style
|
|
|
|
{
|
|
|
|
WIZARD_NEXT,
|
|
|
|
WIZARD_PREV,
|
|
|
|
WIZARD_FINISH,
|
|
|
|
|
|
|
|
WIZARD_NONE
|
|
|
|
};
|
|
|
|
|
2001-02-23 13:59:32 +00:00
|
|
|
private:
|
|
|
|
ODatabaseExport::TColumns m_vDestColumns; // contains the columns
|
|
|
|
ODatabaseExport::TColumnVector m_aDestVec; // the order to insert the columns
|
|
|
|
ODatabaseExport::TColumns m_vSourceColumns;
|
|
|
|
ODatabaseExport::TColumnVector m_vSourceVec;
|
|
|
|
|
2006-06-20 02:15:28 +00:00
|
|
|
OTypeInfoMap m_aTypeInfo;
|
2017-02-17 19:06:24 +02:00
|
|
|
std::vector<OTypeInfoMap::iterator> m_aTypeInfoIndex;
|
2006-06-20 02:15:28 +00:00
|
|
|
OTypeInfoMap m_aDestTypeInfo;
|
2017-02-17 19:06:24 +02:00
|
|
|
std::vector<OTypeInfoMap::iterator> m_aDestTypeInfoIndex;
|
2006-06-20 02:15:28 +00:00
|
|
|
TNameMapping m_mNameMapping;
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2017-12-15 09:28:52 +02:00
|
|
|
ODatabaseExport::TPositions m_vColumnPositions;
|
2017-02-17 19:06:24 +02:00
|
|
|
std::vector<sal_Int32> m_vColumnTypes;
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::sdbc::XConnection > m_xDestConnection;
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
const ICopyTableSourceObject& m_rSourceObject;
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::util::XNumberFormatter > m_xFormatter;
|
|
|
|
css::uno::Reference< css::uno::XComponentContext> m_xContext;
|
|
|
|
css::uno::Reference< css::task::XInteractionHandler> m_xInteractionHandler;
|
2006-06-20 02:15:28 +00:00
|
|
|
|
2013-09-26 12:17:53 +02:00
|
|
|
OUString m_sTypeNames; // these type names are the ones out of the resource file
|
2006-06-20 02:15:28 +00:00
|
|
|
sal_uInt32 m_nPageCount;
|
2014-04-17 11:16:55 +02:00
|
|
|
bool m_bDeleteSourceColumns;
|
2008-01-30 07:48:35 +00:00
|
|
|
bool m_bInterConnectionCopy; // are we copying between different connections?
|
2006-06-20 02:15:28 +00:00
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
css::lang::Locale m_aLocale;
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString m_sName; // for a table the name is composed
|
|
|
|
OUString m_sSourceName;
|
|
|
|
OUString m_aKeyName;
|
2014-04-17 11:16:55 +02:00
|
|
|
TOTypeInfoSP m_pTypeInfo; // default type
|
|
|
|
bool m_bAddPKFirstTime;
|
|
|
|
sal_Int16 m_nOperation;
|
|
|
|
Wizard_Button_Style m_ePressed;
|
|
|
|
bool m_bCreatePrimaryKeyColumn;
|
|
|
|
bool m_bUseHeaderLine;
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2006-06-20 02:15:28 +00:00
|
|
|
private:
|
2019-09-05 12:22:38 +01:00
|
|
|
DECL_LINK( ImplPrevHdl, weld::Button&, void );
|
|
|
|
DECL_LINK( ImplNextHdl, weld::Button&, void);
|
|
|
|
DECL_LINK( ImplOKHdl, weld::Button&, void );
|
2014-04-17 11:16:55 +02:00
|
|
|
bool CheckColumns(sal_Int32& _rnBreakPos);
|
2008-01-30 07:48:35 +00:00
|
|
|
void loadData( const ICopyTableSourceObject& _rSourceObject,
|
|
|
|
ODatabaseExport::TColumns& _rColumns,
|
|
|
|
ODatabaseExport::TColumnVector& _rColVector );
|
2006-06-20 02:15:28 +00:00
|
|
|
void construct();
|
|
|
|
// need for table creation
|
2017-07-31 12:26:12 +02:00
|
|
|
static void appendColumns( css::uno::Reference< css::sdbcx::XColumnsSupplier> const & _rxColSup, const ODatabaseExport::TColumnVector* _pVec, bool _bKeyColumns = false );
|
|
|
|
static void appendKey(css::uno::Reference< css::sdbcx::XKeysSupplier> const & _rxSup,const ODatabaseExport::TColumnVector* _pVec);
|
2006-06-20 02:15:28 +00:00
|
|
|
// checks if the type is supported in the destination database
|
2014-04-17 11:16:55 +02:00
|
|
|
bool supportsType(sal_Int32 _nDataType,sal_Int32& _rNewDataType);
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2019-09-20 20:29:36 +01:00
|
|
|
virtual std::unique_ptr<BuilderPage> createPage(vcl::WizardTypes::WizardState /*nState*/) override
|
2019-09-05 12:22:38 +01:00
|
|
|
{
|
|
|
|
assert(false);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void ActivatePage() override;
|
|
|
|
|
|
|
|
sal_uInt16 GetCurLevel() const { return getCurrentState(); }
|
|
|
|
|
2019-09-24 14:10:48 +01:00
|
|
|
weld::Container* CreatePageContainer();
|
2019-09-05 12:22:38 +01:00
|
|
|
|
2001-02-23 13:59:32 +00:00
|
|
|
public:
|
|
|
|
// used for copy tables or queries
|
2008-01-30 07:48:35 +00:00
|
|
|
OCopyTableWizard(
|
2019-09-05 12:22:38 +01:00
|
|
|
weld::Window * pParent,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& _rDefaultName,
|
2008-01-30 07:48:35 +00:00
|
|
|
sal_Int16 _nOperation,
|
|
|
|
const ICopyTableSourceObject& _rSourceObject,
|
2015-08-03 09:14:58 +02:00
|
|
|
const css::uno::Reference< css::sdbc::XConnection >& _xSourceConnection,
|
|
|
|
const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
|
|
|
|
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
|
|
|
|
const css::uno::Reference< css::task::XInteractionHandler>& _xInteractionHandler
|
2008-01-30 07:48:35 +00:00
|
|
|
);
|
2001-02-23 13:59:32 +00:00
|
|
|
|
|
|
|
// used for importing rtf/html sources
|
2008-01-30 07:48:35 +00:00
|
|
|
OCopyTableWizard(
|
2019-09-05 12:22:38 +01:00
|
|
|
weld::Window* pParent,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& _rDefaultName,
|
2008-01-30 07:48:35 +00:00
|
|
|
sal_Int16 _nOperation,
|
|
|
|
const ODatabaseExport::TColumns& _rDestColumns,
|
|
|
|
const ODatabaseExport::TColumnVector& _rSourceColVec,
|
2015-08-03 09:14:58 +02:00
|
|
|
const css::uno::Reference< css::sdbc::XConnection >& _xConnection,
|
|
|
|
const css::uno::Reference< css::util::XNumberFormatter >& _xFormatter,
|
2008-01-30 07:48:35 +00:00
|
|
|
TypeSelectionPageFactory _pTypeSelectionPageFactory,
|
|
|
|
SvStream& _rTypeSelectionPageArg,
|
2015-08-03 09:14:58 +02:00
|
|
|
const css::uno::Reference< css::uno::XComponentContext >& _rxContext
|
2008-01-30 07:48:35 +00:00
|
|
|
);
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~OCopyTableWizard() override;
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual bool DeactivatePage() override;
|
2019-09-05 12:22:38 +01:00
|
|
|
weld::Button& GetOKButton() { return *m_xFinish; }
|
2006-06-20 02:15:28 +00:00
|
|
|
Wizard_Button_Style GetPressedButton() const { return m_ePressed; }
|
2016-03-08 17:04:25 +02:00
|
|
|
void EnableNextButton(bool bEnable);
|
2019-09-20 20:29:36 +01:00
|
|
|
void AddWizardPage(std::unique_ptr<OWizardPage> xPage); // delete page from OCopyTableWizard
|
2001-02-23 13:59:32 +00:00
|
|
|
void CheckButtons(); // checks which button can be disabled, enabled
|
2003-03-19 16:57:12 +00:00
|
|
|
|
2001-02-23 13:59:32 +00:00
|
|
|
// returns a vector where the position of a column and if the column is in the selection
|
2017-12-15 09:34:24 +02:00
|
|
|
// when not the value is COLUMN_POSITION_NOT_FOUND.
|
2017-12-15 09:28:52 +02:00
|
|
|
const ODatabaseExport::TPositions& GetColumnPositions() const { return m_vColumnPositions; }
|
2017-02-17 19:06:24 +02:00
|
|
|
const std::vector<sal_Int32>& GetColumnTypes() const { return m_vColumnTypes; }
|
2014-04-17 11:16:55 +02:00
|
|
|
bool UseHeaderLine() const { return m_bUseHeaderLine; }
|
|
|
|
void setUseHeaderLine(bool _bUseHeaderLine) { m_bUseHeaderLine = _bUseHeaderLine; }
|
2001-02-23 13:59:32 +00:00
|
|
|
|
|
|
|
void insertColumn(sal_Int32 _nPos,OFieldDescription* _pField);
|
|
|
|
|
2004-08-02 14:55:21 +00:00
|
|
|
/** replaces a field description with another one. The name must not be known so far.
|
|
|
|
@param _nPos
|
|
|
|
The pos inside the vector, 0 based.
|
|
|
|
@param _pField
|
|
|
|
The field to set.
|
|
|
|
@param _sOldName
|
|
|
|
The name of column to be replaced.
|
|
|
|
*/
|
2013-04-07 12:06:47 +02:00
|
|
|
void replaceColumn(sal_Int32 _nPos,OFieldDescription* _pField,const OUString& _sOldName);
|
2004-08-02 14:55:21 +00:00
|
|
|
|
2008-01-30 07:48:35 +00:00
|
|
|
/** returns whether a primary key should be created in the target database
|
2002-11-14 06:58:31 +00:00
|
|
|
*/
|
2014-06-09 10:09:42 +02:00
|
|
|
bool shouldCreatePrimaryKey() const { return m_bCreatePrimaryKeyColumn;}
|
2013-04-07 12:06:47 +02:00
|
|
|
void setCreatePrimaryKey( bool _bDoCreate, const OUString& _rSuggestedName );
|
2008-01-30 07:48:35 +00:00
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
static bool supportsPrimaryKey( const css::uno::Reference< css::sdbc::XConnection >& _rxConnection );
|
2008-01-30 07:48:35 +00:00
|
|
|
bool supportsPrimaryKey() const { return supportsPrimaryKey( m_xDestConnection ); }
|
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
static bool supportsViews( const css::uno::Reference< css::sdbc::XConnection >& _rxConnection );
|
2008-01-30 07:48:35 +00:00
|
|
|
bool supportsViews() const { return supportsViews( m_xDestConnection ); }
|
2002-12-10 08:19:22 +00:00
|
|
|
|
|
|
|
/** returns the name of the primary key
|
|
|
|
@return
|
2008-01-30 07:48:35 +00:00
|
|
|
The name of the primary key.
|
2002-12-10 08:19:22 +00:00
|
|
|
*/
|
2016-04-13 10:44:57 +02:00
|
|
|
const OUString& getPrimaryKeyName() const { return m_aKeyName; }
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
const OTypeInfoMap& getTypeInfo() const { return m_aTypeInfo; }
|
2001-11-15 14:15:05 +00:00
|
|
|
|
2017-12-30 14:36:04 +02:00
|
|
|
TOTypeInfoSP const & getDestTypeInfo(sal_Int32 _nPos) const { return m_aDestTypeInfoIndex[_nPos]->second; }
|
2014-06-18 12:14:29 +02:00
|
|
|
const OTypeInfoMap& getDestTypeInfo() const { return m_aDestTypeInfo; }
|
2001-11-15 14:15:05 +00:00
|
|
|
|
2016-04-13 10:44:57 +02:00
|
|
|
const css::lang::Locale& GetLocale() const { return m_aLocale; }
|
|
|
|
const css::uno::Reference< css::util::XNumberFormatter >& GetFormatter() const { return m_xFormatter; }
|
|
|
|
const css::uno::Reference< css::uno::XComponentContext>& GetComponentContext() const { return m_xContext; }
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2014-06-18 12:14:29 +02:00
|
|
|
const ODatabaseExport::TColumns& getSourceColumns() const{ return m_vSourceColumns; }
|
|
|
|
const ODatabaseExport::TColumnVector& getSrcVector() const { return m_vSourceVec; }
|
|
|
|
ODatabaseExport::TColumns& getDestColumns() { return m_vDestColumns; }
|
|
|
|
const ODatabaseExport::TColumnVector& getDestVector() const { return m_aDestVec; }
|
2016-04-13 10:44:57 +02:00
|
|
|
const OUString& getName() const { return m_sName; }
|
2001-02-23 13:59:32 +00:00
|
|
|
|
2002-03-21 06:16:02 +00:00
|
|
|
/** clears the dest vectors
|
|
|
|
*/
|
2001-02-23 13:59:32 +00:00
|
|
|
void clearDestColumns();
|
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::beans::XPropertySet > createTable();
|
|
|
|
css::uno::Reference< css::beans::XPropertySet > createView() const;
|
2001-07-02 12:22:11 +00:00
|
|
|
sal_Int32 getMaxColumnNameLength() const;
|
|
|
|
|
2008-01-30 07:48:35 +00:00
|
|
|
void setOperation( const sal_Int16 _nOperation );
|
2014-06-09 10:09:42 +02:00
|
|
|
sal_Int16 getOperation() const { return m_nOperation;}
|
2001-10-18 05:52:55 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString convertColumnName( const TColumnFindFunctor& _rCmpFunctor,
|
|
|
|
const OUString& _sColumnName,
|
|
|
|
const OUString& _sExtraChars,
|
2001-10-18 05:52:55 +00:00
|
|
|
sal_Int32 _nMaxNameLen);
|
2014-04-17 11:16:55 +02:00
|
|
|
TOTypeInfoSP convertType(const TOTypeInfoSP&_pType, bool& _bNotConvert);
|
2002-12-10 08:19:22 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString createUniqueName(const OUString& _sName);
|
2003-04-01 13:02:49 +00:00
|
|
|
|
2019-05-08 10:13:43 +00:00
|
|
|
// displays an error message that a column type is not supported
|
2013-04-07 12:06:47 +02:00
|
|
|
void showColumnTypeNotSupported(const OUString& _rColumnName);
|
2006-04-19 12:21:37 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void removeColumnNameFromNameMap(const OUString& _sName);
|
2014-08-25 07:16:18 -04:00
|
|
|
void showError(const OUString& _sErrorMessage);
|
2015-08-03 09:14:58 +02:00
|
|
|
void showError(const css::uno::Any& _aError);
|
2001-02-23 13:59:32 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2013-11-05 02:18:53 +01:00
|
|
|
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WCOPYTABLE_HXX
|
2010-10-27 12:33:13 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|