summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/misc
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/misc')
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx5
-rw-r--r--dbaccess/source/ui/misc/WCPage.cxx17
-rw-r--r--dbaccess/source/ui/misc/WColumnSelect.cxx1
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx104
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx2
-rw-r--r--dbaccess/source/ui/misc/WizardPages.src10
6 files changed, 98 insertions, 41 deletions
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 6c750f40ee61..a1b29faf1afa 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -479,6 +479,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl
case NumberFormat::DATETIME:
case NumberFormat::TEXT:
case NumberFormat::DATE:
+ nNumberFormat = _nOldNumberFormat;
break;
case NumberFormat::ALL:
nNumberFormat = NumberFormat::DATE;
@@ -494,6 +495,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl
case NumberFormat::DATETIME:
case NumberFormat::TEXT:
case NumberFormat::TIME:
+ nNumberFormat = _nOldNumberFormat;
break;
case NumberFormat::ALL:
nNumberFormat = NumberFormat::TIME;
@@ -510,6 +512,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl
nNumberFormat = NumberFormat::CURRENCY;
break;
case NumberFormat::CURRENCY:
+ nNumberFormat = _nOldNumberFormat;
break;
case NumberFormat::ALL:
nNumberFormat = NumberFormat::CURRENCY;
@@ -526,6 +529,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl
switch(_nOldNumberFormat)
{
case NumberFormat::NUMBER:
+ nNumberFormat = _nOldNumberFormat;
break;
case NumberFormat::CURRENCY:
nNumberFormat = NumberFormat::CURRENCY;
@@ -549,6 +553,7 @@ sal_Int16 ODatabaseExport::CheckString(const String& aCheckToken, sal_Int16 _nOl
case NumberFormat::DATETIME:
case NumberFormat::TEXT:
case NumberFormat::TIME:
+ nNumberFormat = _nOldNumberFormat;
break;
case NumberFormat::ALL:
nNumberFormat = NumberFormat::DATETIME;
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index 63a910929836..85804dec9d0c 100644
--- a/dbaccess/source/ui/misc/WCPage.cxx
+++ b/dbaccess/source/ui/misc/WCPage.cxx
@@ -227,7 +227,8 @@ sal_Bool OCopyTable::LeavePage()
if ( !aNameCheck.isNameValid( m_edTableName.GetText(), aErrorInfo ) )
{
aErrorInfo.append( SQLExceptionInfo::SQL_CONTEXT, String( ModuleRes( STR_SUGGEST_APPEND_TABLE_DATA ) ) );
- ::dbaui::showError( aErrorInfo, m_pParent, m_pParent->m_xFactory );
+ m_pParent->showError(aErrorInfo.get());
+
return sal_False;
}
@@ -245,7 +246,8 @@ sal_Bool OCopyTable::LeavePage()
sal_Int32 nMaxLength = xMeta->getMaxTableNameLength();
if ( nMaxLength && sTable.getLength() > nMaxLength )
{
- ErrorBox(this, ModuleRes(ERROR_INVALID_TABLE_NAME_LENGTH)).Execute();
+ String sError(ModuleRes(STR_INVALID_TABLE_NAME_LENGTH));
+ m_pParent->showError(sError);
return sal_False;
}
@@ -256,8 +258,7 @@ sal_Bool OCopyTable::LeavePage()
String aInfoString( ModuleRes(STR_WIZ_PKEY_ALREADY_DEFINED) );
aInfoString += String(' ');
aInfoString += String(m_pParent->m_aKeyName);
- InfoBox aNameInfoBox( this, aInfoString );
- aNameInfoBox.Execute();
+ m_pParent->showError(aInfoString);
return sal_False;
}
}
@@ -288,7 +289,8 @@ sal_Bool OCopyTable::LeavePage()
if(!m_pParent->m_sName.getLength())
{
- ErrorBox(this, ModuleRes(ERROR_INVALID_TABLE_NAME)).Execute();
+ String sError(ModuleRes(STR_INVALID_TABLE_NAME));
+ m_pParent->showError(sError);
return sal_False;
}
@@ -367,9 +369,8 @@ sal_Bool OCopyTable::checkAppendData()
if ( !xTable.is() )
{
- ErrorBox( this, ModuleRes( ERROR_INVALID_TABLE_NAME ) ).Execute();
- // TODO: shouldn't this be some kind of showError? In case of the UNO service for this wizard,
- // shouldn't this even be a usage of the service's interaction handler?
+ String sError(ModuleRes(STR_INVALID_TABLE_NAME));
+ m_pParent->showError(sError);
return sal_False;
}
return sal_True;
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index 69d5c3bad4fd..12173965f739 100644
--- a/dbaccess/source/ui/misc/WColumnSelect.cxx
+++ b/dbaccess/source/ui/misc/WColumnSelect.cxx
@@ -140,6 +140,7 @@ void OWizColumnSelect::Reset()
clearListBox(m_lbOrgColumnNames);
clearListBox(m_lbNewColumnNames);
+ m_pParent->m_mNameMapping.clear();
// insert the source columns in the left listbox
const ODatabaseExport::TColumnVector* pSrcColumns = m_pParent->getSrcVector();
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 2b664c02f7e2..b178947bf5f9 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -46,6 +46,7 @@
/** === begin UNO includes === **/
#include <com/sun/star/sdb/application/CopyTableOperation.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
@@ -62,8 +63,10 @@
#include <comphelper/extract.hxx>
#include <comphelper/types.hxx>
+#include <comphelper/interaction.hxx>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbmetadata.hxx>
+#include <connectivity/dbexception.hxx>
#include <rtl/logfile.hxx>
#include <rtl/ustrbuf.hxx>
@@ -80,9 +83,12 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::task;
+using namespace dbtools;
namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOperation;
@@ -566,7 +572,8 @@ namespace
//------------------------------------------------------------------------
OCopyTableWizard::OCopyTableWizard( Window * pParent, const ::rtl::OUString& _rDefaultName, sal_Int16 _nOperation,
const ICopyTableSourceObject& _rSourceObject, const Reference< XConnection >& _xSourceConnection,
- const Reference< XConnection >& _xConnection, const Reference< XMultiServiceFactory >& _rxORB )
+ const Reference< XConnection >& _xConnection, const Reference< XMultiServiceFactory >& _rxORB,
+ const Reference< XInteractionHandler>& _xInteractionHandler)
: WizardDialog( pParent, ModuleRes(WIZ_RTFCOPYTABLE))
,m_pbHelp( this , ModuleRes(PB_HELP))
,m_pbCancel( this , ModuleRes(PB_CANCEL))
@@ -578,6 +585,7 @@ OCopyTableWizard::OCopyTableWizard( Window * pParent, const ::rtl::OUString& _rD
,m_rSourceObject( _rSourceObject )
,m_xFormatter( getNumberFormatter( _xConnection, _rxORB ) )
,m_xFactory(_rxORB)
+ ,m_xInteractionHandler(_xInteractionHandler)
,m_sTypeNames(ModuleRes(STR_TABLEDESIGN_DBFIELDTYPES))
,m_nPageCount(0)
,m_bDeleteSourceColumns(sal_True)
@@ -701,6 +709,8 @@ OCopyTableWizard::OCopyTableWizard( Window* pParent, const ::rtl::OUString& _rDe
::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aTypeInfo, m_aTypeInfoIndex );
::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aDestTypeInfo, m_aDestTypeInfoIndex );
+ m_xInteractionHandler.set( m_xFactory->createInstance( SERVICE_SDB_INTERACTION_HANDLER ), UNO_QUERY);
+
OCopyTable* pPage1( new OCopyTable( this ) );
pPage1->disallowViews();
pPage1->setCreateStyleAction();
@@ -924,6 +934,7 @@ IMPL_LINK( OCopyTableWizard, ImplOKHdl, OKButton*, EMPTYARG )
OWizTypeSelect* pPage = static_cast<OWizTypeSelect*>(GetPage(3));
if ( pPage )
{
+ m_mNameMapping.clear();
pPage->setDisplayRow(nBreakPos);
ShowPage(3);
return 0;
@@ -935,33 +946,37 @@ IMPL_LINK( OCopyTableWizard, ImplOKHdl, OKButton*, EMPTYARG )
{
ODatabaseExport::TColumns::iterator aFind = ::std::find_if(m_vDestColumns.begin(),m_vDestColumns.end()
,::std::compose1(::std::mem_fun(&OFieldDescription::IsPrimaryKey),::std::select2nd<ODatabaseExport::TColumns::value_type>()));
- if ( aFind == m_vDestColumns.end() )
+ if ( aFind == m_vDestColumns.end() && m_xInteractionHandler.is() )
{
+
String sTitle(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY_HEAD));
String sMsg(ModuleRes(STR_TABLEDESIGN_NO_PRIM_KEY));
- OSQLMessageBox aBox(this, sTitle,sMsg, WB_YES_NO_CANCEL | WB_DEF_YES);
-
- INT16 nReturn = aBox.Execute();
-
- switch(nReturn )
+ SQLContext aError;
+ aError.Message = sMsg;
+ ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) );
+ ::rtl::Reference< ::comphelper::OInteractionApprove > xYes = new ::comphelper::OInteractionApprove;
+ xRequest->addContinuation( xYes.get() );
+ xRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
+ ::rtl::Reference< ::comphelper::OInteractionAbort > xAbort = new ::comphelper::OInteractionAbort;
+ xRequest->addContinuation( xAbort.get() );
+
+ m_xInteractionHandler->handle( xRequest.get() );
+
+ if ( xYes->wasSelected() )
{
- case RET_YES:
- {
- OCopyTable* pPage = static_cast<OCopyTable*>(GetPage(0));
- m_bCreatePrimaryKeyColumn = sal_True;
- m_aKeyName = pPage->GetKeyName();
- if ( !m_aKeyName.getLength() )
- m_aKeyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) );
- m_aKeyName = createUniqueName( m_aKeyName );
- sal_Int32 nBreakPos2 = 0;
- CheckColumns(nBreakPos2);
- break;
- }
- case RET_CANCEL:
- ShowPage(3);
- return 0;
- default:
- ;
+ OCopyTable* pPage = static_cast<OCopyTable*>(GetPage(0));
+ m_bCreatePrimaryKeyColumn = sal_True;
+ m_aKeyName = pPage->GetKeyName();
+ if ( !m_aKeyName.getLength() )
+ m_aKeyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) );
+ m_aKeyName = createUniqueName( m_aKeyName );
+ sal_Int32 nBreakPos2 = 0;
+ CheckColumns(nBreakPos2);
+ }
+ else if ( xAbort->wasSelected() )
+ {
+ ShowPage(3);
+ return 0;
}
}
}
@@ -1601,6 +1616,22 @@ TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType,sal_Bool&
if ( supportsType(DataType::CLOB,nDefaultType) )
break;
break;
+ case DataType::BINARY:
+ if ( supportsType(DataType::VARBINARY,nDefaultType) )
+ break;
+ break;
+ case DataType::VARBINARY:
+ if ( supportsType(DataType::LONGVARBINARY,nDefaultType) )
+ break;
+ break;
+ case DataType::LONGVARBINARY:
+ if ( supportsType(DataType::BLOB,nDefaultType) )
+ break;
+ if ( supportsType(DataType::LONGVARCHAR,nDefaultType) )
+ break;
+ if ( supportsType(DataType::CLOB,nDefaultType) )
+ break;
+ break;
default:
nDefaultType = DataType::VARCHAR;
}
@@ -1646,7 +1677,28 @@ void OCopyTableWizard::showColumnTypeNotSupported(const ::rtl::OUString& _rColum
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OCopyTableWizard::showColumnTypeNotSupported" );
String sMessage( ModuleRes( STR_UNKNOWN_TYPE_FOUND ) );
sMessage.SearchAndReplaceAscii("#1",_rColumnName);
-
- OSQLWarningBox( this, sMessage ).Execute();
+ showError(sMessage);
+}
+//-------------------------------------------------------------------------------
+void OCopyTableWizard::showError(const ::rtl::OUString& _sErrorMesage)
+{
+ SQLExceptionInfo aInfo(_sErrorMesage);
+ showError(aInfo.get());
}
//-------------------------------------------------------------------------------
+void OCopyTableWizard::showError(const Any& _aError)
+{
+ if ( _aError.hasValue() && m_xInteractionHandler.is() )
+ {
+ try
+ {
+ ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( _aError ) );
+ m_xInteractionHandler->handle( xRequest.get() );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index ceeb058528df..a964b0e13d38 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -178,7 +178,7 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId )
{
String strMessage = String(ModuleRes(STR_TABLEDESIGN_DUPLICATE_NAME));
strMessage.SearchAndReplaceAscii("$column$", sNewName);
- OSQLWarningBox( this, strMessage ).Execute();
+ pWiz->showError(strMessage);
pCurFieldDescr->SetName(sName);
DisplayData(pCurFieldDescr);
static_cast<OWizTypeSelect*>(GetParent())->setDuplicateName(sal_True);
diff --git a/dbaccess/source/ui/misc/WizardPages.src b/dbaccess/source/ui/misc/WizardPages.src
index 638feb92e54c..329f08b222d9 100644
--- a/dbaccess/source/ui/misc/WizardPages.src
+++ b/dbaccess/source/ui/misc/WizardPages.src
@@ -552,20 +552,18 @@ String STR_COPYTABLE_TITLE_COPY
Text [ en-US ] = "Copy table" ;
};
-ErrorBox ERROR_INVALID_TABLE_NAME
+String STR_INVALID_TABLE_NAME
{
- Buttons = WB_OK;
- Message [ en-US ] = "This table name is not valid in the current database.";
+ Text [ en-US ] = "This table name is not valid in the current database.";
};
String STR_SUGGEST_APPEND_TABLE_DATA
{
Text [ en-US ] = "Choose the option 'Append data' on the first page to append data to an existing table.";
};
-ErrorBox ERROR_INVALID_TABLE_NAME_LENGTH
+String STR_INVALID_TABLE_NAME_LENGTH
{
- Buttons = WB_OK;
- Message [ en-US ] = "Please change the table name. It is too long.";
+ Text [ en-US ] = "Please change the table name. It is too long.";
};
Image IMG_SORTUP_H