summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r--dbaccess/source/ui/app/AppController.cxx176
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx43
-rw-r--r--dbaccess/source/ui/app/app.src8
-rw-r--r--dbaccess/source/ui/app/dbu_app.hrc5
-rw-r--r--dbaccess/source/ui/browser/dsEntriesNoExp.cxx2
-rw-r--r--dbaccess/source/ui/inc/QueryDesignView.hxx4
-rw-r--r--dbaccess/source/ui/inc/TableFieldDescription.hxx1
-rw-r--r--dbaccess/source/ui/inc/WCopyTable.hxx40
-rw-r--r--dbaccess/source/ui/inc/dbu_misc.hrc4
-rw-r--r--dbaccess/source/ui/inc/dbu_resource.hrc4
-rw-r--r--dbaccess/source/ui/inc/dbu_uno.hrc5
-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
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx75
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx125
-rw-r--r--dbaccess/source/ui/querydesign/TableFieldDescription.cxx44
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx15
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.src12
22 files changed, 322 insertions, 380 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 57f38d324b5c..20671471d863 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -80,159 +80,70 @@
#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
/** === end UNO includes === **/
-#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
#include <tools/diagnose_ex.h>
-#endif
-#ifndef SVTOOLS_URIHELPER_HXX
+#include <tools/string.hxx>
+
#include <svl/urihelper.hxx>
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
+#include <svl/filenotation.hxx>
+
+#include <svtools/svtreebx.hxx>
+#include <svtools/transfer.hxx>
+#include <svtools/cliplistener.hxx>
+#include <svtools/svlbitm.hxx>
+#include <svtools/insdlg.hxx>
+
+#include <comphelper/sequence.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/string.hxx>
#include <comphelper/types.hxx>
-#endif
-#ifndef _COMPHELPER_INTERACTION_HXX_
#include <comphelper/interaction.hxx>
-#endif
-#ifndef COMPHELPER_COMPONENTCONTEXT_HXX
#include <comphelper/componentcontext.hxx>
-#endif
-#ifndef _SV_MSGBOX_HXX
+
#include <vcl/msgbox.hxx>
-#endif
-#ifndef _VCL_STDTEXT_HXX
#include <vcl/stdtext.hxx>
-#endif
-#ifndef _FILEDLGHELPER_HXX
+#include <vcl/svapp.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/lstbox.hxx>
+
+#include <unotools/pathoptions.hxx>
+#include <unotools/tempfile.hxx>
+#include <unotools/internaloptions.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/historyoptions.hxx>
+
+#include <sfx2/mailmodelapi.hxx>
#include <sfx2/filedlghelper.hxx>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <sfx2/docfilt.hxx>
+#include <sfx2/QuerySaveDocument.hxx>
+
#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _CPPUHELPER_EXC_HLP_HXX_
#include <cppuhelper/exc_hlp.hxx>
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+
#include <connectivity/dbtools.hxx>
-#endif
-#ifndef DBAUI_APPVIEW_HXX
+#include <connectivity/dbexception.hxx>
+
+#include <svx/dbaexchange.hxx>
+#include <svx/dbaobjectex.hxx>
+#include <svx/svxdlg.hxx>
+
+#include <vos/mutex.hxx>
+
#include "AppView.hxx"
-#endif
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
#include "browserids.hxx"
-#endif
-#ifndef _DBAU_REGHELPER_HXX_
#include "dbu_reghelper.hxx"
-#endif
-#ifndef _DBU_APP_HRC_
#include "dbu_app.hrc"
-#endif
-#ifndef DBACCESS_SOURCE_UI_MISC_DEFAULTOBJECTNAMECHECK_HXX
#include "defaultobjectnamecheck.hxx"
-#endif
-#ifndef _SV_MENU_HXX
-#include <vcl/menu.hxx>
-#endif
-#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX
-#include <unotools/pathoptions.hxx>
-#endif
-#ifndef INCLUDED_SVTOOLS_INTERNALOPTIONS_HXX
-#include <unotools/internaloptions.hxx>
-#endif
-#ifndef _COMPHELPER_UNO3_HXX_
-#include <comphelper/uno3.hxx>
-#endif
-#ifndef DBACCESS_DATABASE_OBJECT_VIEW_HXX
#include "databaseobjectview.hxx"
-#endif
-#ifndef _SV_SVAPP_HXX //autogen
-#include <vcl/svapp.hxx>
-#endif
-#ifndef _SVLBOXITM_HXX
-#include <svtools/svlbitm.hxx>
-#endif
-#ifndef _DBAUI_LISTVIEWITEMS_HXX_
#include "listviewitems.hxx"
-#endif
-
-#ifndef DBAUI_APPDETAILVIEW_HXX
#include "AppDetailView.hxx"
-#endif
-#ifndef _DBAUI_LINKEDDOCUMENTS_HXX_
#include "linkeddocuments.hxx"
-#endif
-#ifndef _SV_LSTBOX_HXX
-#include <vcl/lstbox.hxx>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
-#include <connectivity/dbexception.hxx>
-#endif
-#ifndef _DBAUI_SQLMESSAGE_HXX_
#include "sqlmessage.hxx"
-#endif
-#ifndef _STRING_HXX
-#include <tools/string.hxx>
-#endif
-#ifndef INCLUDED_SFX_MAILMODELAPI_HXX
-#include <sfx2/mailmodelapi.hxx>
-#endif
-#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
-#include <unotools/moduleoptions.hxx>
-#endif
-#ifndef _SVTREEBOX_HXX
-#include <svtools/svtreebx.hxx>
-#endif
-#ifndef _TRANSFER_HXX
-#include <svtools/transfer.hxx>
-#endif
-#ifndef _CLIPLISTENER_HXX
-#include <svtools/cliplistener.hxx>
-#endif
-#ifndef _SVX_DBAEXCHANGE_HXX_
-#include <svx/dbaexchange.hxx>
-#endif
-#ifndef SVX_DBAOBJECTEX_HXX
-#include <svx/dbaobjectex.hxx>
-#endif
-#ifndef DBAUI_TOOLS_HXX
#include "UITools.hxx"
-#endif
-#ifndef _DBAUI_DSNTYPES_HXX_
#include "dsntypes.hxx"
-#endif
-#include <svx/svxdlg.hxx>
-#include <svtools/insdlg.hxx>
-#ifndef _UNOTOOLS_TEMPFILE_HXX
-#include <unotools/tempfile.hxx>
-#endif
-#ifndef _DBA_DBACCESS_HELPID_HRC_
#include "dbaccess_helpid.hrc"
-#endif
-#ifndef DBAUI_DLGSAVE_HXX
#include "dlgsave.hxx"
-#endif
-#ifndef _SFX_DOCFILT_HACK_HXX
-#include <sfx2/docfilt.hxx>
-#endif
-#ifndef SFX_QUERYSAVEDOCUMENT_HXX
-#include <sfx2/QuerySaveDocument.hxx>
-#endif
-#ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX
-#include <unotools/historyoptions.hxx>
-#endif
-#ifndef SVTOOLS_FILENOTATION_HXX_
-#include <svl/filenotation.hxx>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
-#include <comphelper/sequence.hxx>
-#endif
-#ifndef _VOS_MUTEX_HXX_
-#include <vos/mutex.hxx>
-#endif
-#ifndef _DBACCESS_SLOTID_HRC_
#include "dbaccess_slotid.hrc"
-#endif
#include <algorithm>
#include <functional>
@@ -2955,8 +2866,7 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer
case DatabaseObjectContainer::REPORTS:
if ( eSelectedCategory != E_NONE )
throw IllegalArgumentException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "You cannot select different categories." ) ),
- // TODO: resource
+ String(ModuleRes(RID_STR_NO_DIFF_CAT)),
*this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) );
eSelectedCategory =
( pObject->Type == DatabaseObjectContainer::TABLES ) ? E_TABLE
@@ -2969,13 +2879,9 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer
default:
case DatabaseObjectContainer::DATA_SOURCE:
{
- ::rtl::OUStringBuffer aMessage;
- aMessage.appendAscii( "Unsupported object type found (" );
- aMessage.append ( sal_Int32( pObject->Type ) );
- aMessage.appendAscii( ")." );
- // TODO: resource
- throw IllegalArgumentException(
- aMessage.makeStringAndClear(), *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) );
+ ::rtl::OUString sMessage = String(ModuleRes( RID_STR_UNSUPPORTED_OBJECT_TYPE ));
+ ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$type$", ::rtl::OUString::valueOf(sal_Int32( pObject->Type )) );
+ throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ));
}
}
}
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 50e357b687b8..fbc5b8d0c359 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -93,9 +93,6 @@
#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/helper/vclunohelper.hxx>
#endif
-#ifndef _COM_SUN_STAR_UCB_XCONTENTCREATOR_HPP_
-#include <com/sun/star/ucb/XContentCreator.hpp>
-#endif
#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#endif
@@ -256,7 +253,7 @@ namespace
EnableInput(FALSE);
return 0L;
}
- // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
void OTablePreviewWindow::DataChanged( const DataChangedEvent& rDCEvt )
{
Window::DataChanged( rDCEvt );
@@ -268,7 +265,7 @@ namespace
Invalidate();
}
}
- // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
void OTablePreviewWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
@@ -634,13 +631,13 @@ sal_Bool OAppDetailPageHelper::isCutAllowed()
// -----------------------------------------------------------------------------
sal_Bool OAppDetailPageHelper::isCopyAllowed()
{
- // int nPos = getVisibleControlIndex();
+ //int nPos = getVisibleControlIndex();
return sal_True;
}
// -----------------------------------------------------------------------------
sal_Bool OAppDetailPageHelper::isPasteAllowed()
{
- // int nPos = getVisibleControlIndex();
+ //int nPos = getVisibleControlIndex();
return sal_True;
}
// -----------------------------------------------------------------------------
@@ -658,6 +655,8 @@ void OAppDetailPageHelper::paste()
// -----------------------------------------------------------------------------
bool OAppDetailPageHelper::isLeaf(SvLBoxEntry* _pEntry) const
{
+ if ( !_pEntry )
+ return false;
sal_Int32 nEntryType = reinterpret_cast< sal_IntPtr >( _pEntry->GetUserData() );
if ( ( nEntryType == DatabaseObjectContainer::TABLES )
|| ( nEntryType == DatabaseObjectContainer::CATALOG )
@@ -1099,8 +1098,8 @@ void OAppDetailPageHelper::Resize()
//////////////////////////////////////////////////////////////////////
// Abmessungen parent window
Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
+ long nOutputWidth = aOutputSize.Width();
+ long nOutputHeight = aOutputSize.Height();
Window* pWindow = getCurrentView();
if ( pWindow )
@@ -1115,12 +1114,12 @@ void OAppDetailPageHelper::Resize()
String sText = m_aTBPreview.GetItemText(SID_DB_APP_DISABLE_PREVIEW);
Size aTBSize = m_aTBPreview.CalcWindowSizePixel();
- m_aTBPreview.SetPosSizePixel( Point(nOutputWidth - aTBSize.getWidth(), 0 ),
- aTBSize );
+ m_aTBPreview.SetPosSizePixel(Point(nOutputWidth - aTBSize.getWidth(), 0 ),
+ aTBSize );
- m_aBorder.SetPosSizePixel( Point(nHalfOutputWidth + aFLSize.Width() + n6PPT, aTBSize.getHeight() + n6PPT ),
- Size(nHalfOutputWidth - aFLSize.Width() - n6PPT, nOutputHeight - 2*n6PPT - aTBSize.getHeight()) );
- m_aPreview.SetPosSizePixel( Point(0,0),m_aBorder.GetSizePixel() );
+ m_aBorder.SetPosSizePixel(Point(nHalfOutputWidth + aFLSize.Width() + n6PPT, aTBSize.getHeight() + n6PPT ),
+ Size(nHalfOutputWidth - aFLSize.Width() - n6PPT, nOutputHeight - 2*n6PPT - aTBSize.getHeight()) );
+ m_aPreview.SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() );
m_aDocumentInfo.SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() );
m_pTablePreview->SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() );
}
@@ -1237,9 +1236,9 @@ void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent)
// Why the below code? It might have side effects, as the tree view needs to know
// its current selection for other purposes than the preview, too.
-// DBTreeListBox* pTreeView = getCurrentView();
-// if ( pTreeView )
-// pTreeView->clearCurrentSelection();
+// DBTreeListBox* pTreeView = getCurrentView();
+// if ( pTreeView )
+// pTreeView->clearCurrentSelection();
}
}
catch( const Exception& )
@@ -1386,7 +1385,7 @@ void OAppDetailPageHelper::DataChanged( const DataChangedEvent& rDCEvt )
{
Window::DataChanged( rDCEvt );
- if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
+ if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
(rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
(rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
@@ -1445,9 +1444,9 @@ OPreviewWindow::OPreviewWindow(Window* _pParent)
// -----------------------------------------------------------------------------
BOOL OPreviewWindow::ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const
{
- const Size aWinSize( GetOutputSizePixel() );
- Size aNewSize( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) );
- BOOL bRet = FALSE;
+ const Size aWinSize( GetOutputSizePixel() );
+ Size aNewSize( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) );
+ BOOL bRet = FALSE;
if( aNewSize.Width() && aNewSize.Height() )
{
@@ -1505,7 +1504,7 @@ void OPreviewWindow::DataChanged( const DataChangedEvent& rDCEvt )
Invalidate();
}
}
-// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
void OPreviewWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
diff --git a/dbaccess/source/ui/app/app.src b/dbaccess/source/ui/app/app.src
index c913d16ebd2d..9aff7f73d992 100644
--- a/dbaccess/source/ui/app/app.src
+++ b/dbaccess/source/ui/app/app.src
@@ -469,3 +469,11 @@ String RID_STR_EMBEDDED_DATABASE
{
Text [ en-US ] = "Embedded database";
};
+String RID_STR_NO_DIFF_CAT
+{
+ Text [ en-US ] = "You cannot select different categories.";
+};
+String RID_STR_UNSUPPORTED_OBJECT_TYPE
+{
+ Text [ en-US ] = "Unsupported object type found ($type$).";
+};
diff --git a/dbaccess/source/ui/app/dbu_app.hrc b/dbaccess/source/ui/app/dbu_app.hrc
index 63aa923ce30f..5b4aee52304e 100644
--- a/dbaccess/source/ui/app/dbu_app.hrc
+++ b/dbaccess/source/ui/app/dbu_app.hrc
@@ -68,11 +68,12 @@
#define RID_STR_FORMS_HELP_TEXT_WIZARD RID_STR_APP_START + 29
#define RID_STR_REPORT_HELP_TEXT RID_STR_APP_START + 30
#define RID_STR_EMBEDDED_DATABASE RID_STR_APP_START + 31
-
+#define RID_STR_NO_DIFF_CAT RID_STR_APP_START + 32
+#define RID_STR_UNSUPPORTED_OBJECT_TYPE RID_STR_APP_START + 33
// please adjust checking before insert new strings
-#if RID_STR_EMBEDDED_DATABASE > RID_STR_APP_END
+#if RID_STR_UNSUPPORTED_OBJECT_TYPE > RID_STR_APP_END
#error Resource-Id Ueberlauf in #file, #line
#endif
diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
index 16859283c9b7..51121b022e88 100644
--- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
+++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
@@ -166,7 +166,7 @@ void SbaTableQueryBrowser::SelectionChanged()
InvalidateFeature(ID_BROWSER_INSERTCONTENT);
InvalidateFeature(ID_BROWSER_FORMLETTER);
} // if ( !m_bShowMenu )
- InvalidateFeature(ID_BROWSER_COPY);
+ InvalidateFeature(ID_BROWSER_COPY);
InvalidateFeature(ID_BROWSER_CUT);
}
//------------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/inc/QueryDesignView.hxx b/dbaccess/source/ui/inc/QueryDesignView.hxx
index 60dfb7bdec79..6a97719e0c27 100644
--- a/dbaccess/source/ui/inc/QueryDesignView.hxx
+++ b/dbaccess/source/ui/inc/QueryDesignView.hxx
@@ -171,6 +171,10 @@ namespace dbaui
const String& _sCriteria,
::rtl::OUString& _rsErrorMessage,
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn) const;
+
+ void fillFunctionInfo( const ::connectivity::OSQLParseNode* pNode
+ ,const ::rtl::OUString& sFunctionTerm
+ ,OTableFieldDescRef& aInfo);
protected:
// return the Rectangle where I can paint myself
virtual void resizeDocumentView(Rectangle& rRect);
diff --git a/dbaccess/source/ui/inc/TableFieldDescription.hxx b/dbaccess/source/ui/inc/TableFieldDescription.hxx
index 80eeeff20dfa..9230bef621c3 100644
--- a/dbaccess/source/ui/inc/TableFieldDescription.hxx
+++ b/dbaccess/source/ui/inc/TableFieldDescription.hxx
@@ -83,6 +83,7 @@ namespace dbaui
inline sal_Bool IsEmpty() const;
+ OTableFieldDesc& operator=( const OTableFieldDesc& _aField );
sal_Bool operator==( const OTableFieldDesc& rDesc );
sal_Bool IsVisible() const { return m_bVisible;}
diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx
index 37d0d870f538..741e6f67e590 100644
--- a/dbaccess/source/ui/inc/WCopyTable.hxx
+++ b/dbaccess/source/ui/inc/WCopyTable.hxx
@@ -31,55 +31,23 @@
#ifndef DBAUI_WIZ_COPYTABLEDIALOG_HXX
#define DBAUI_WIZ_COPYTABLEDIALOG_HXX
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
#include <com/sun/star/sdbc/XResultSet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _COMPHELPER_STLTYPES_HXX_
#include <comphelper/stl_types.hxx>
-#endif
-#ifndef DBAUI_TYPEINFO_HXX
#include "TypeInfo.hxx"
-#endif
-#ifndef _SV_BUTTON_HXX
#include <vcl/button.hxx>
-#endif
-#ifndef _SVT_WIZDLG_HXX
#include <svtools/wizdlg.hxx>
-#endif
-#ifndef DBAUI_DATABASEEXPORT_HXX
#include "DExport.hxx"
-#endif
-#ifndef DBAUI_WIZ_TABBPAGE_HXX
#include "WTabPage.hxx"
-#endif
-#ifndef DBAUI_FIELDDESCRIPTIONS_HXX
#include "FieldDescriptions.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
-#endif
-#ifndef _SV_LSTBOX_HXX
+#include <com/sun/star/task/XInteractionHandler.hpp>
#include <vcl/lstbox.hxx>
-#endif
-
#include <functional>
namespace dbaui
@@ -299,6 +267,7 @@ namespace dbaui
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> m_xInteractionHandler;
String m_sTypeNames; // these type names are the ones out of the resource file
sal_uInt32 m_nPageCount;
@@ -343,7 +312,8 @@ namespace dbaui
const ICopyTableSourceObject& _rSourceObject,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xSourceConnection,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler>& _xInteractionHandler
);
// used for importing rtf/html sources
@@ -445,6 +415,8 @@ namespace dbaui
void showColumnTypeNotSupported(const ::rtl::OUString& _rColumnName);
void removeColumnNameFromNameMap(const ::rtl::OUString& _sName);
+ void showError(const ::rtl::OUString& _sErrorMesage);
+ void showError(const ::com::sun::star::uno::Any& _aError);
};
}
diff --git a/dbaccess/source/ui/inc/dbu_misc.hrc b/dbaccess/source/ui/inc/dbu_misc.hrc
index 0ee803edec10..6aeb5b1331ab 100644
--- a/dbaccess/source/ui/inc/dbu_misc.hrc
+++ b/dbaccess/source/ui/inc/dbu_misc.hrc
@@ -50,10 +50,12 @@
#define STR_FILE_DOES_NOT_EXIST RID_STR_MISC_START + 13
#define STR_WARNINGS_DURING_CONNECT RID_STR_MISC_START + 14
#define STR_NAMED_OBJECT_ALREADY_EXISTS RID_STR_MISC_START + 15
+#define STR_INVALID_TABLE_NAME RID_STR_MISC_START + 16
+#define STR_INVALID_TABLE_NAME_LENGTH RID_STR_MISC_START + 17
// please adjust checking before insert new strings
-#if STR_NAMED_OBJECT_ALREADY_EXISTS > RID_STR_MISC_END
+#if STR_INVALID_TABLE_NAME_LENGTH > RID_STR_MISC_END
#error Resource-Id Ueberlauf in #file, #line
#endif
diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc
index e537f51df6bb..7d72e16f0f2f 100644
--- a/dbaccess/source/ui/inc/dbu_resource.hrc
+++ b/dbaccess/source/ui/inc/dbu_resource.hrc
@@ -182,13 +182,13 @@
// error boxes
#define ERR_NOREGISTEREDDATASOURCES RID_ERRORBOX_START + 0
-#define ERROR_INVALID_TABLE_NAME_LENGTH RID_ERRORBOX_START + 1
+// free
#define ERR_QRY_CRITERIA_ON_ASTERISK RID_ERRORBOX_START + 2
#define ERR_QRY_ORDERBY_ON_ASTERISK RID_ERRORBOX_START + 3
#define ERR_QRY_AMB_FIELD RID_ERRORBOX_START + 4
// FREE
#define ERR_INVALID_LISTBOX_ENTRY RID_ERRORBOX_START + 6
-#define ERROR_INVALID_TABLE_NAME RID_ERRORBOX_START + 7
+// FREE
#define ERR_NEED_INDEX_FIELDS RID_ERRORBOX_START + 8
#define ERR_QRY_NOSTATEMENT RID_ERRORBOX_START + 9
#define ERR_QRY_NOCRITERIA RID_ERRORBOX_START + 10
diff --git a/dbaccess/source/ui/inc/dbu_uno.hrc b/dbaccess/source/ui/inc/dbu_uno.hrc
index acd15c94c7ef..6aec13955ac0 100644
--- a/dbaccess/source/ui/inc/dbu_uno.hrc
+++ b/dbaccess/source/ui/inc/dbu_uno.hrc
@@ -43,9 +43,12 @@
#define STR_CTW_UNSUPPORTED_COLUMN_TYPE ( RID_STR_UNO_START + 6 )
#define STR_CTW_ILLEGAL_PARAMETER_COUNT ( RID_STR_UNO_START + 7 )
#define STR_CTW_ERROR_DURING_INITIALIZATION ( RID_STR_UNO_START + 8 )
+#define STR_CTW_ERROR_UNSUPPORTED_SETTING ( RID_STR_UNO_START + 9 )
+#define STR_CTW_ERROR_NO_QUERY ( RID_STR_UNO_START + 10 )
+#define STR_CTW_ERROR_INVALID_INTERACTIONHANDLER ( RID_STR_UNO_START + 11 )
// please adjust when inserting new strings:
-#define RID_STR_UNO_LAST_USED STR_CTW_ERROR_DURING_INITIALIZATION
+#define RID_STR_UNO_LAST_USED STR_CTW_ERROR_INVALID_INTERACTIONHANDLER
#if RID_STR_UNO_LAST_USED >= RID_STR_UNO_END
#error too many resources in uno ....
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
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index b8fd1f5f972f..83ed283a4836 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -186,11 +186,6 @@ namespace
sal_Bool bHaving,
bool _bAddOrOnOneLine);
- void fillFunctionInfo( OQueryDesignView* _pView
- ,const ::connectivity::OSQLParseNode* pNode
- ,const ::rtl::OUString& sFunctionTerm
- ,OTableFieldDescRef& aInfo);
-
//------------------------------------------------------------------------------
::rtl::OUString quoteTableAlias(sal_Bool _bQuote, const ::rtl::OUString& _sAliasName, const ::rtl::OUString& _sQuote)
{
@@ -2180,35 +2175,6 @@ namespace
return eErrorCode;
}
//------------------------------------------------------------------------------
- void fillFunctionInfo( OQueryDesignView* _pView
- ,const ::connectivity::OSQLParseNode* pNode
- ,const ::rtl::OUString& sFunctionTerm
- ,OTableFieldDescRef& aInfo)
- {
- // get the type out of the funtion name
- OQueryController& rController = static_cast<OQueryController&>(_pView->getController());
- sal_Int32 nDataType = DataType::DOUBLE;
- ::rtl::OUString sFieldName = sFunctionTerm;
- OSQLParseNode* pFunctionName = pNode->getChild(0);
- if ( !SQL_ISPUNCTUATION(pFunctionName,"{") )
- {
- if ( SQL_ISRULEOR2(pNode,length_exp,char_value_fct) )
- pFunctionName = pFunctionName->getChild(0);
-
- ::rtl::OUString sFunctionName = pFunctionName->getTokenValue();
- if ( !sFunctionName.getLength() )
- sFunctionName = ::rtl::OStringToOUString(OSQLParser::TokenIDToStr(pFunctionName->getTokenID()),RTL_TEXTENCODING_UTF8);
-
- nDataType = OSQLParser::getFunctionReturnType(
- sFunctionName
- ,&rController.getParser().getContext());
- }
- aInfo->SetDataType(nDataType);
- aInfo->SetFieldType(TAB_NORMAL_FIELD);
- aInfo->SetField(sFieldName);
- aInfo->SetTabWindow(NULL);
- }
- //------------------------------------------------------------------------------
SqlParseError InstallFields(OQueryDesignView* _pView,
const ::connectivity::OSQLParseNode* pNode,
OJoinTableView::OTableWindowMap* pTabList )
@@ -2216,7 +2182,7 @@ namespace
if( pNode==0 || !SQL_ISRULE(pNode,select_statement))
return eNoSelectStatement;
- ::connectivity::OSQLParseNode* pParseTree = pNode->getChild(2);
+ ::connectivity::OSQLParseNode* pParseTree = pNode->getChild(2); // selection
sal_Bool bFirstField = sal_True; // bei der Initialisierung muß auf alle Faelle das erste Feld neu aktiviert werden
SqlParseError eErrorCode = eOk;
@@ -2247,9 +2213,6 @@ namespace
if ( SQL_ISRULE(pColumnRef,derived_column) )
{
- if ( !xConnection.is() )
- break;
-
::rtl::OUString aColumnAlias(rController.getParseIterator().getColumnAlias(pColumnRef)); // kann leer sein
pColumnRef = pColumnRef->getChild(0);
OTableFieldDescRef aInfo = new OTableFieldDesc();
@@ -2330,7 +2293,7 @@ namespace
}
else
{
- fillFunctionInfo(_pView,pColumnRef,aColumns,aInfo);
+ _pView->fillFunctionInfo(pColumnRef,aColumns,aInfo);
aInfo->SetFieldAlias(aColumnAlias);
}
@@ -2451,7 +2414,7 @@ namespace
_pView->getLocale(),
static_cast<sal_Char>(_pView->getDecimalSeparator().toChar()),
&rController.getParser().getContext());
- fillFunctionInfo(_pView,pArgument,sCondition,aDragLeft);
+ _pView->fillFunctionInfo(pArgument,sCondition,aDragLeft);
aDragLeft->SetFunctionType(FKT_OTHER);
aDragLeft->SetOrderDir(eOrderDir);
aDragLeft->SetVisible(sal_False);
@@ -2483,7 +2446,7 @@ namespace
const ::connectivity::OSQLParseNode* pSelectRoot )
{
SqlParseError eErrorCode = eOk;
- if (!pSelectRoot->getChild(3)->getChild(2)->isLeaf())
+ if (!pSelectRoot->getChild(3)->getChild(2)->isLeaf()) // opt_group_by_clause
{
OQueryController& rController = static_cast<OQueryController&>(_pView->getController());
::connectivity::OSQLParseNode* pGroupBy = pSelectRoot->getChild(3)->getChild(2)->getChild(2);
@@ -2518,7 +2481,7 @@ namespace
&rController.getParser().getContext(),
sal_True,
sal_True); // quote is to true because we need quoted elements inside the function
- fillFunctionInfo(_pView,pArgument,sGroupByExpression,aDragInfo);
+ _pView->fillFunctionInfo(pArgument,sGroupByExpression,aDragInfo);
aDragInfo->SetFunctionType(FKT_OTHER);
aDragInfo->SetGroupBy(sal_True);
aDragInfo->SetVisible(sal_False);
@@ -3242,4 +3205,32 @@ bool OQueryDesignView::initByParseIterator( ::dbtools::SQLExceptionInfo* _pError
}
return eErrorCode == eOk;
}
+//------------------------------------------------------------------------------
+void OQueryDesignView::fillFunctionInfo( const ::connectivity::OSQLParseNode* pNode
+ ,const ::rtl::OUString& sFunctionTerm
+ ,OTableFieldDescRef& aInfo)
+{
+ // get the type out of the funtion name
+ OQueryController& rController = static_cast<OQueryController&>(getController());
+ sal_Int32 nDataType = DataType::DOUBLE;
+ ::rtl::OUString sFieldName = sFunctionTerm;
+ OSQLParseNode* pFunctionName = pNode->getChild(0);
+ if ( !SQL_ISPUNCTUATION(pFunctionName,"{") )
+ {
+ if ( SQL_ISRULEOR2(pNode,length_exp,char_value_fct) )
+ pFunctionName = pFunctionName->getChild(0);
+
+ ::rtl::OUString sFunctionName = pFunctionName->getTokenValue();
+ if ( !sFunctionName.getLength() )
+ sFunctionName = ::rtl::OStringToOUString(OSQLParser::TokenIDToStr(pFunctionName->getTokenID()),RTL_TEXTENCODING_UTF8);
+
+ nDataType = OSQLParser::getFunctionReturnType(
+ sFunctionName
+ ,&rController.getParser().getContext());
+ }
+ aInfo->SetDataType(nDataType);
+ aInfo->SetFieldType(TAB_NORMAL_FIELD);
+ aInfo->SetField(sFieldName);
+ aInfo->SetTabWindow(NULL);
+}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 27ad175c071c..1b468b2a69c9 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -890,78 +890,56 @@ sal_Bool OSelectionBrowseBox::saveField(const String& _sFieldName,OTableFieldDes
OSL_ENSURE(0,"Unsupported function inserted!");
}
- else if( SQL_ISRULEOR2(pColumnRef,position_exp,extract_exp) ||
- SQL_ISRULEOR2(pColumnRef,fold,char_substring_fct) ||
- SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct) )
- // a calculation has been found ( can be calc and function )
+ else
{
- // append the whole text as field name
// so we first clear the function field
clearEntryFunctionField(_sFieldName,aSelEntry,_bListAction,nColumnId);
- sal_Bool bQuote = sal_True;
- sal_Int32 nDataType = DataType::DOUBLE;
- OSQLParseNode* pFunctionName = pColumnRef->getChild(0);
- if ( !SQL_ISPUNCTUATION(pFunctionName,"{") )
+ ::rtl::OUString sFunction;
+ pColumnRef->parseNodeToStr( sFunction,
+ xConnection,
+ &rController.getParser().getContext(),
+ sal_True,
+ sal_True); // quote is to true because we need quoted elements inside the function
+
+ getDesignView()->fillFunctionInfo(pColumnRef,sFunction,aSelEntry);
+
+ if( SQL_ISRULEOR2(pColumnRef,position_exp,extract_exp) ||
+ SQL_ISRULEOR2(pColumnRef,fold,char_substring_fct) ||
+ SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct) )
+ // a calculation has been found ( can be calc and function )
{
- if ( SQL_ISRULEOR2(pColumnRef,length_exp,char_value_fct) )
- pFunctionName = pFunctionName->getChild(0);
+ // now parse the whole statement
+ sal_uInt32 nFunCount = pColumnRef->count();
+ ::rtl::OUString sParameters;
+ for(sal_uInt32 function = 0; function < nFunCount; ++function)
+ pColumnRef->getChild(function)->parseNodeToStr( sParameters, xConnection, &rParser.getContext(), sal_True, sal_True );
- if ( pFunctionName )
+ sOldAlias = aSelEntry->GetAlias();
+ sal_Int32 nNewFunctionType = aSelEntry->GetFunctionType() | FKT_NUMERIC | FKT_OTHER;
+ aSelEntry->SetFunctionType(nNewFunctionType);
+ aSelEntry->SetField(sParameters);
+ }
+ else
+ {
+ aSelEntry->SetFieldAlias(sColumnAlias);
+ if ( SQL_ISRULE(pColumnRef,set_fct_spec) )
+ aSelEntry->SetFunctionType(/*FKT_NUMERIC | */FKT_OTHER);
+ else
{
- ::rtl::OUString sFunctionName = pFunctionName->getTokenValue();
- if ( !sFunctionName.getLength() )
- sFunctionName = ::rtl::OStringToOUString(OSQLParser::TokenIDToStr(pFunctionName->getTokenID()),RTL_TEXTENCODING_MS_1252);
-
- nDataType = OSQLParser::getFunctionReturnType(
- sFunctionName
- ,&rController.getParser().getContext());
- aSelEntry->SetDataType(nDataType);
+ if ( SQL_ISRULEOR2(pColumnRef,num_value_exp,term) || SQL_ISRULE(pColumnRef,factor) )
+ aSelEntry->SetDataType(DataType::DOUBLE);
+ else if ( SQL_ISRULE(pColumnRef,value_exp) )
+ aSelEntry->SetDataType(DataType::TIMESTAMP);
+ else
+ aSelEntry->SetDataType(DataType::VARCHAR);
+ aSelEntry->SetFunctionType(FKT_NUMERIC | FKT_OTHER);
}
}
-
- // now parse the whole statement
- sal_uInt32 nFunCount = pColumnRef->count();
- ::rtl::OUString sParameters;
- for(sal_uInt32 function = 0; function < nFunCount; ++function)
- pColumnRef->getChild(function)->parseNodeToStr( sParameters, xConnection, &rParser.getContext(), sal_True, bQuote );
-
- ::rtl::OUString aSelectionAlias = aSelEntry->GetAlias();
aSelEntry->SetAlias(::rtl::OUString());
-
- sal_Int32 nNewFunctionType = aSelEntry->GetFunctionType() | FKT_NUMERIC | FKT_OTHER;
- aSelEntry->SetFunctionType(nNewFunctionType);
-
-
- aSelEntry->SetFieldType(TAB_NORMAL_FIELD);
-
- aSelEntry->SetTabWindow(NULL);
-
- aSelEntry->SetField(sParameters);
- notifyTableFieldChanged(aSelectionAlias,aSelEntry->GetAlias(),_bListAction, nColumnId);
- }
- else
- {
- clearEntryFunctionField(_sFieldName,aSelEntry,_bListAction,nColumnId);
-
- ::rtl::OUString aColumns;
- pColumnRef->parseNodeToStr( aColumns,
- xConnection,
- &rController.getParser().getContext(),
- sal_True,
- sal_True);
- // get the type out of the funtion name
- sal_Int32 nDataType = DataType::DOUBLE;
- aSelEntry->SetDataType(nDataType);
- aSelEntry->SetField(aColumns);
- aSelEntry->SetFieldType(TAB_NORMAL_FIELD);
- aSelEntry->SetTabWindow(NULL);
- aSelEntry->SetAlias(::rtl::OUString());
- aSelEntry->SetFieldAlias(sColumnAlias);
- aSelEntry->SetFunctionType(FKT_NUMERIC | FKT_OTHER);
-
notifyTableFieldChanged(sOldAlias,aSelEntry->GetAlias(),_bListAction, nColumnId);
}
+
}
if ( i > 0 && InsertField(aSelEntry,BROWSER_INVALIDID,sal_True,sal_False).isEmpty() ) // may we have to append more than one field
{ // the field could not be isnerted
@@ -1807,25 +1785,23 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo , sal_uInt
pEntry->GetFunctionType() == rInfo->GetFunctionType() &&
pEntry->GetFunction() == rInfo->GetFunction())
{
- /*sal_uInt32 nPos = aIter - rFields.begin();
- bAppend = _nCurrentPos > nPos && (rInfo->IsGroupBy() != pEntry->IsGroupBy());
- if ( bAppend )
+ if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
+ {
+ pEntry->SetGroupBy(sal_False);
aIter = rFields.end();
- else*/
+ break;
+ }
+ else
{
- if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
- {
- pEntry->SetGroupBy(sal_False);
- aIter = rFields.end();
- }
- else
+ if ( !pEntry->IsGroupBy() && !pEntry->HasCriteria() ) // here we have a where condition which is no having clause
{
pEntry->SetGroupBy(rInfo->IsGroupBy());
if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
pEntry->SetVisible(sal_True);
+ break;
}
}
- break;
+
}
}
@@ -1887,13 +1863,14 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const S
if (bCase(aField,rInfo->GetField()) &&
bCase(aAlias,rInfo->GetAlias()) &&
pEntry->GetFunctionType() == rInfo->GetFunctionType() &&
- pEntry->GetFunction() == rInfo->GetFunction())
+ pEntry->GetFunction() == rInfo->GetFunction() &&
+ pEntry->IsGroupBy() == rInfo->IsGroupBy() )
{
if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
pEntry->SetGroupBy(sal_False);
else
{
- pEntry->SetGroupBy(rInfo->IsGroupBy());
+// pEntry->SetGroupBy(rInfo->IsGroupBy());
if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
pEntry->SetVisible(sal_True);
}
@@ -2890,7 +2867,7 @@ bool OSelectionBrowseBox::HasFieldByAliasName(const ::rtl::OUString& rFieldName,
{
if ( (*aIter)->GetFieldAlias() == rFieldName )
{
- rInfo = *aIter;
+ rInfo.getBody() = (*aIter).getBody();
break;
}
}
diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
index 0949c8f5dc11..a00bc3dbd54c 100644
--- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
+++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx
@@ -69,24 +69,10 @@ OTableFieldDesc::OTableFieldDesc()
//------------------------------------------------------------------------------
OTableFieldDesc::OTableFieldDesc(const OTableFieldDesc& rRS)
: ::vos::OReference()
- ,m_vecCriteria( rRS.m_vecCriteria)
- ,m_aTableName(rRS.GetTable())
- ,m_aAliasName(rRS.GetAlias()) // table range
- ,m_aFieldName(rRS.GetField()) // column
- ,m_aFieldAlias(rRS.GetFieldAlias()) // column alias
- ,m_aFunctionName(rRS.GetFunction()) // Funktionsname
- ,m_pTabWindow(rRS.GetTabWindow())
- ,m_eDataType(rRS.GetDataType())
- ,m_eFunctionType( rRS.GetFunctionType() )
- ,m_eFieldType(rRS.GetFieldType())
- ,m_eOrderDir(rRS.GetOrderDir())
- ,m_nIndex(rRS.GetFieldIndex())
- ,m_nColWidth(rRS.GetColWidth())
- ,m_nColumnId( rRS.m_nColumnId)
- ,m_bGroupBy(rRS.IsGroupBy())
- ,m_bVisible(rRS.IsVisible())
+
{
DBG_CTOR(OTableFieldDesc,NULL);
+ *this = rRS;
}
//------------------------------------------------------------------------------
@@ -107,7 +93,31 @@ OTableFieldDesc::~OTableFieldDesc()
{
DBG_DTOR(OTableFieldDesc,NULL);
}
-
+//------------------------------------------------------------------------------
+OTableFieldDesc& OTableFieldDesc::operator=( const OTableFieldDesc& rRS )
+{
+ if (&rRS == this)
+ return *this;
+
+ m_vecCriteria = rRS.m_vecCriteria;
+ m_aTableName = rRS.GetTable();
+ m_aAliasName = rRS.GetAlias(); // table range
+ m_aFieldName = rRS.GetField(); // column
+ m_aFieldAlias = rRS.GetFieldAlias(); // column alias
+ m_aFunctionName = rRS.GetFunction(); // Funktionsname
+ m_pTabWindow = rRS.GetTabWindow();
+ m_eDataType = rRS.GetDataType();
+ m_eFunctionType = rRS.GetFunctionType();
+ m_eFieldType = rRS.GetFieldType();
+ m_eOrderDir = rRS.GetOrderDir();
+ m_nIndex = rRS.GetFieldIndex();
+ m_nColWidth = rRS.GetColWidth();
+ m_nColumnId = rRS.m_nColumnId;
+ m_bGroupBy = rRS.IsGroupBy();
+ m_bVisible = rRS.IsVisible();
+
+ return *this;
+}
//------------------------------------------------------------------------------
sal_Bool OTableFieldDesc::operator==( const OTableFieldDesc& rDesc )
{
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index ce79281f0cac..aa2b87fca329 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -70,6 +70,7 @@
#include <comphelper/interaction.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/proparrhlp.hxx>
+#include <comphelper/string.hxx>
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -775,9 +776,8 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X
if ( sUnsupportedSetting.getLength() != 0 )
{
- ::rtl::OUString sMessage( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported setting in the copy source descriptor: $name$." ) ) );
- // TODO: resource
- sMessage = sMessage.replaceAt( sMessage.indexOfAsciiL( "$name$", 6 ), 6, sUnsupportedSetting );
+ ::rtl::OUString sMessage( String(ModuleRes( STR_CTW_ERROR_UNSUPPORTED_SETTING )) );
+ ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$name$", sUnsupportedSetting );
throw IllegalArgumentException(
sMessage,
*const_cast< CopyTableWizard* >( this ),
@@ -849,8 +849,7 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X
if ( _out_rCommandType == CommandType::QUERY )
// we cannot copy a query if the connection cannot provide it ...
throw IllegalArgumentException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "To copy a query, your connection must be able to provide queries." ) ),
- // TODO: resource
+ String(ModuleRes( STR_CTW_ERROR_NO_QUERY )),
*const_cast< CopyTableWizard* >( this ),
1
);
@@ -1516,8 +1515,7 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments )
{ // ->createWithInteractionHandler
if ( !( _rArguments[2] >>= m_xInteractionHandler ) )
throw IllegalArgumentException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The given interaction handler is invalid." ) ),
- // TODO: resource
+ String(ModuleRes( STR_CTW_ERROR_INVALID_INTERACTIONHANDLER )),
*this,
3
);
@@ -1578,7 +1576,8 @@ Dialog* CopyTableWizard::createDialog( Window* _pParent )
*m_pSourceObject,
m_xSourceConnection.getTyped(),
m_xDestConnection.getTyped(),
- m_aContext.getLegacyServiceFactory()
+ m_aContext.getLegacyServiceFactory(),
+ m_xInteractionHandler
);
impl_attributesToDialog_nothrow( *pWizard );
diff --git a/dbaccess/source/ui/uno/copytablewizard.src b/dbaccess/source/ui/uno/copytablewizard.src
index 07db51196ce2..4bb6efc839cc 100644
--- a/dbaccess/source/ui/uno/copytablewizard.src
+++ b/dbaccess/source/ui/uno/copytablewizard.src
@@ -69,3 +69,15 @@ String STR_CTW_ERROR_DURING_INITIALIZATION
{
Text [ en-US ] = "An error occurred during initialization.";
};
+String STR_CTW_ERROR_UNSUPPORTED_SETTING
+{
+ Text [ en-US ] = "Unsupported setting in the copy source descriptor: $name$.";
+};
+String STR_CTW_ERROR_NO_QUERY
+{
+ Text [ en-US ] = "To copy a query, your connection must be able to provide queries.";
+};
+String STR_CTW_ERROR_INVALID_INTERACTIONHANDLER
+{
+ Text [ en-US ] = "The given interaction handler is invalid.";
+};