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.cxx2
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx141
-rw-r--r--dbaccess/source/ui/browser/dbexchange.cxx214
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx25
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx21
-rw-r--r--dbaccess/source/ui/control/sqledit.cxx28
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx5
-rw-r--r--dbaccess/source/ui/dlg/adminpages.cxx3
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx3
-rw-r--r--dbaccess/source/ui/dlg/dlgsave.cxx1
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx2
-rw-r--r--dbaccess/source/ui/dlg/indexfieldscontrol.cxx62
-rw-r--r--dbaccess/source/ui/inc/FieldDescControl.hxx33
-rw-r--r--dbaccess/source/ui/inc/FieldDescriptions.hxx3
-rw-r--r--dbaccess/source/ui/inc/RTableConnectionData.hxx6
-rw-r--r--dbaccess/source/ui/inc/TableCopyHelper.hxx31
-rw-r--r--dbaccess/source/ui/inc/TokenWriter.hxx50
-rw-r--r--dbaccess/source/ui/inc/brwctrlr.hxx5
-rw-r--r--dbaccess/source/ui/inc/dbexchange.hxx23
-rw-r--r--dbaccess/source/ui/inc/dbu_tbl.hrc3
-rw-r--r--dbaccess/source/ui/inc/indexfieldscontrol.hxx3
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx1
-rw-r--r--dbaccess/source/ui/misc/TableCopyHelper.cxx122
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx89
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx1
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx20
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx124
-rw-r--r--dbaccess/source/ui/querydesign/TableWindow.cxx28
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx2
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnectionData.cxx37
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx5
-rw-r--r--dbaccess/source/ui/tabledesign/FieldDescriptions.cxx33
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx146
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.hxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx49
-rw-r--r--dbaccess/source/ui/tabledesign/TableRow.cxx3
-rw-r--r--dbaccess/source/ui/tabledesign/table.src6
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx183
38 files changed, 814 insertions, 701 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index ecc39c7aa169..1905193a4f04 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -83,7 +83,6 @@
#include <svl/urihelper.hxx>
#include <svl/filenotation.hxx>
-
#include <svtools/svtreebx.hxx>
#include <svtools/transfer.hxx>
#include <svtools/cliplistener.hxx>
@@ -125,7 +124,6 @@
#include <svx/svxdlg.hxx>
#include <vos/mutex.hxx>
-
#include "AppView.hxx"
#include "browserids.hxx"
#include "dbu_reghelper.hxx"
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index 7246a312d5e9..c14e5a514298 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -64,6 +64,7 @@
#include <com/sun/star/sdb/XInteractionSupplyParameters.hpp>
#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#include <com/sun/star/sdb/SQLFilterOperator.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
#include <com/sun/star/sdbc/XRowSetListener.hpp>
@@ -731,6 +732,11 @@ sal_Bool SbaXDataBrowserController::reloadForm( const Reference< XLoadable >& _r
else
_rxLoadable->load();
+ m_xParser.clear();
+ const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
+ if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)))
+ xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser;
+
Reference< XWarningsSupplier > xWarnings( _rxLoadable, UNO_QUERY );
if ( xWarnings.is() )
{
@@ -1202,31 +1208,31 @@ void SbaXDataBrowserController::propertyChange(const PropertyChangeEvent& evt) t
// the filter or the sort criterias have changed ? -> update our parser
if (evt.PropertyName.equals(PROPERTY_ACTIVECOMMAND))
{
- if (m_xParser.is())
- DO_SAFE( m_xParser->setElementaryQuery(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new query to my parser !" );
+ // if (m_xParser.is())
+ //DO_SAFE( m_xParser->setElementaryQuery(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new query to my parser !" );
}
else if (evt.PropertyName.equals(PROPERTY_FILTER))
{
- if ( m_xParser.is() && m_xParser->getFilter() != ::comphelper::getString(evt.NewValue))
- {
- DO_SAFE( m_xParser->setFilter(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" );
- }
+ // if ( m_xParser.is() && m_xParser->getFilter() != ::comphelper::getString(evt.NewValue))
+ //{
+ // DO_SAFE( m_xParser->setFilter(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" );
+ //}
InvalidateFeature(ID_BROWSER_REMOVEFILTER);
}
else if (evt.PropertyName.equals(PROPERTY_HAVING_CLAUSE))
{
- if ( m_xParser.is() && m_xParser->getHavingClause() != ::comphelper::getString(evt.NewValue))
- {
- DO_SAFE( m_xParser->setHavingClause(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" );
- }
+ //if ( m_xParser.is() && m_xParser->getHavingClause() != ::comphelper::getString(evt.NewValue))
+ //{
+ // DO_SAFE( m_xParser->setHavingClause(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new filter to my parser !" );
+ //}
InvalidateFeature(ID_BROWSER_REMOVEFILTER);
}
else if (evt.PropertyName.equals(PROPERTY_ORDER))
{
- if ( m_xParser.is() && m_xParser->getOrder() != ::comphelper::getString(evt.NewValue))
- {
- DO_SAFE( m_xParser->setOrder(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new order to my parser !" );
- }
+ //if ( m_xParser.is() && m_xParser->getOrder() != ::comphelper::getString(evt.NewValue))
+ //{
+ // DO_SAFE( m_xParser->setOrder(::comphelper::getString(evt.NewValue)), "SbaXDataBrowserController::propertyChange : could not forward the new order to my parser !" );
+ //}
InvalidateFeature(ID_BROWSER_REMOVEFILTER);
}
@@ -1362,14 +1368,8 @@ void SbaXDataBrowserController::disposing()
{
DBG_UNHANDLED_EXCEPTION();
}
- try
- {
- ::comphelper::disposeComponent(m_xParser);
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
+ m_xParser.clear();
+ // don't dispose, just reset - it's owned by the RowSet
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController::frameAction(const ::com::sun::star::frame::FrameActionEvent& aEvent) throw( RuntimeException )
@@ -1781,7 +1781,7 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const
}
//------------------------------------------------------------------------------
-void SbaXDataBrowserController::applyParserOrder(const ::rtl::OUString& _rOldOrder)
+void SbaXDataBrowserController::applyParserOrder(const ::rtl::OUString& _rOldOrder,const Reference< XSingleSelectQueryComposer >& _xParser)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::applyParserOrder" );
Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
@@ -1795,7 +1795,7 @@ void SbaXDataBrowserController::applyParserOrder(const ::rtl::OUString& _rOldOrd
sal_Bool bSuccess = sal_False;
try
{
- xFormSet->setPropertyValue(PROPERTY_ORDER, makeAny(m_xParser->getOrder()));
+ xFormSet->setPropertyValue(PROPERTY_ORDER, makeAny(_xParser->getOrder()));
bSuccess = reloadForm(m_xLoadable);
}
catch(Exception&)
@@ -1805,7 +1805,7 @@ void SbaXDataBrowserController::applyParserOrder(const ::rtl::OUString& _rOldOrd
if (!bSuccess)
{
xFormSet->setPropertyValue(PROPERTY_ORDER, makeAny(_rOldOrder));
- DO_SAFE( m_xParser->setOrder(_rOldOrder), "SbaXDataBrowserController::applyParserOrder: could not restore the old order of my parser !" );
+ //DO_SAFE( _xParser->setOrder(_rOldOrder), "SbaXDataBrowserController::applyParserOrder: could not restore the old order of my parser !" );
try
{
@@ -1824,7 +1824,7 @@ void SbaXDataBrowserController::applyParserOrder(const ::rtl::OUString& _rOldOrd
}
//------------------------------------------------------------------------------
-void SbaXDataBrowserController::applyParserFilter(const ::rtl::OUString& _rOldFilter, sal_Bool _bOldFilterApplied,const ::rtl::OUString& _sOldHaving)
+void SbaXDataBrowserController::applyParserFilter(const ::rtl::OUString& _rOldFilter, sal_Bool _bOldFilterApplied,const ::rtl::OUString& _sOldHaving,const Reference< XSingleSelectQueryComposer >& _xParser)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::applyParserFilter" );
Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
@@ -1840,8 +1840,8 @@ void SbaXDataBrowserController::applyParserFilter(const ::rtl::OUString& _rOldFi
try
{
FormErrorHelper aError(this);
- xFormSet->setPropertyValue(PROPERTY_FILTER, makeAny(m_xParser->getFilter()));
- xFormSet->setPropertyValue(PROPERTY_HAVING_CLAUSE, makeAny(m_xParser->getHavingClause()));
+ xFormSet->setPropertyValue(PROPERTY_FILTER, makeAny(_xParser->getFilter()));
+ xFormSet->setPropertyValue(PROPERTY_HAVING_CLAUSE, makeAny(_xParser->getHavingClause()));
xFormSet->setPropertyValue(PROPERTY_APPLYFILTER, ::comphelper::makeBoolAny(sal_Bool(sal_True)));
bSuccess = reloadForm(m_xLoadable);
@@ -1871,7 +1871,26 @@ void SbaXDataBrowserController::applyParserFilter(const ::rtl::OUString& _rOldFi
setCurrentColumnPosition(nPos);
}
-
+//------------------------------------------------------------------------------
+Reference< XSingleSelectQueryComposer > SbaXDataBrowserController::createParser_nothrow()
+{
+ Reference< XSingleSelectQueryComposer > xRet;
+ try
+ {
+ Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY_THROW);
+ const Reference<XMultiServiceFactory> xFactory(::dbtools::getConnection(getRowSet()),UNO_QUERY_THROW);
+ xRet.set(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY_THROW);
+ xRet->setElementaryQuery(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ACTIVECOMMAND)));
+ xRet->setFilter(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_FILTER)));
+ xRet->setHavingClause(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_HAVING_CLAUSE)));
+ xRet->setOrder(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ORDER)));
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xRet;
+}
//------------------------------------------------------------------------------
void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter)
{
@@ -1883,29 +1902,30 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter)
const ::rtl::OUString sOldVal = bFilter ? m_xParser->getFilter() : m_xParser->getOrder();
const ::rtl::OUString sOldHaving = m_xParser->getHavingClause();
+ Reference< XSingleSelectQueryComposer > xParser = createParser_nothrow();
try
{
Reference< ::com::sun::star::sdbcx::XColumnsSupplier> xSup = getColumnsSupplier();
Reference< XConnection> xCon(xFormSet->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY);
if(bFilter)
{
- DlgFilterCrit aDlg( getBrowserView(), getORB(), xCon, m_xParser, xSup->getColumns() );
+ DlgFilterCrit aDlg( getBrowserView(), getORB(), xCon, xParser, xSup->getColumns() );
String aFilter;
if(!aDlg.Execute())
{
- m_xParser->setFilter(sOldVal);
- m_xParser->setHavingClause(sOldHaving);
+ //m_xParser->setFilter(sOldVal);
+ //m_xParser->setHavingClause(sOldHaving);
return; // if so we don't need to actualize the grid
}
aDlg.BuildWherePart();
}
else
{
- DlgOrderCrit aDlg( getBrowserView(),xCon,m_xParser,xSup->getColumns() );
+ DlgOrderCrit aDlg( getBrowserView(),xCon,xParser,xSup->getColumns() );
String aOrder;
if(!aDlg.Execute())
{
- m_xParser->setOrder(sOldVal);
+ //m_xParser->setOrder(sOldVal);
return; // if so we don't need to actualize the grid
}
aDlg.BuildOrderPart();
@@ -1922,23 +1942,24 @@ void SbaXDataBrowserController::ExecuteFilterSortCrit(sal_Bool bFilter)
return;
}
- ::rtl::OUString sNewVal = bFilter ? m_xParser->getFilter() : m_xParser->getOrder();
+ ::rtl::OUString sNewVal = bFilter ? xParser->getFilter() : xParser->getOrder();
sal_Bool bOldFilterApplied(sal_False);
if (bFilter)
{
try { bOldFilterApplied = ::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_APPLYFILTER)); } catch(Exception&) { } ;
}
- ::rtl::OUString sNewHaving = m_xParser->getHavingClause();
+ ::rtl::OUString sNewHaving = xParser->getHavingClause();
if ( sOldVal.equals(sNewVal) && (!bFilter || sOldHaving.equals(sNewHaving)) )
// nothing to be done
return;
if (bFilter)
- applyParserFilter(sOldVal, bOldFilterApplied,sOldHaving);
+ applyParserFilter(sOldVal, bOldFilterApplied,sOldHaving,xParser);
else
- applyParserOrder(sOldVal);
+ applyParserOrder(sOldVal,xParser);
+ ::comphelper::disposeComponent(xParser);
}
//------------------------------------------------------------------------------
@@ -2131,17 +2152,18 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
if (!xField.is())
break;
- const ::rtl::OUString sOldSort = m_xParser->getOrder();
+ Reference< XSingleSelectQueryComposer > xParser = createParser_nothrow();
+ const ::rtl::OUString sOldSort = xParser->getOrder();
sal_Bool bParserSuccess = sal_False;
HANDLE_SQL_ERRORS(
- m_xParser->setOrder(::rtl::OUString()); m_xParser->appendOrderByColumn(xField, bSortUp),
+ xParser->setOrder(::rtl::OUString()); xParser->appendOrderByColumn(xField, bSortUp),
bParserSuccess,
UniString(ModuleRes(SBA_BROWSER_SETTING_ORDER)),
"SbaXDataBrowserController::Execute : caught an exception while composing the new filter !"
)
if (bParserSuccess)
- applyParserOrder(sOldSort);
+ applyParserOrder(sOldSort,xParser);
}
break;
@@ -2171,8 +2193,9 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
xProp->getPropertyValue(sAgg) >>= bHaving;
}
- const ::rtl::OUString sOldFilter = m_xParser->getFilter();
- const ::rtl::OUString sOldHaving = m_xParser->getHavingClause();
+ Reference< XSingleSelectQueryComposer > xParser = createParser_nothrow();
+ const ::rtl::OUString sOldFilter = xParser->getFilter();
+ const ::rtl::OUString sOldHaving = xParser->getHavingClause();
Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY);
sal_Bool bApplied = ::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_APPLYFILTER));
@@ -2180,16 +2203,32 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
// -> completely overwrite it, else append one
if (!bApplied)
{
- DO_SAFE( (bHaving ? m_xParser->setHavingClause(::rtl::OUString()) : m_xParser->setFilter(::rtl::OUString())), "SbaXDataBrowserController::Execute : caught an exception while resetting the new filter !" );
+ DO_SAFE( (bHaving ? xParser->setHavingClause(::rtl::OUString()) : xParser->setFilter(::rtl::OUString())), "SbaXDataBrowserController::Execute : caught an exception while resetting the new filter !" );
}
sal_Bool bParserSuccess = sal_False;
+ sal_Int32 nOp = SQLFilterOperator::EQUAL;
+ if ( xField.is() )
+ {
+ sal_Int32 nType = 0;
+ xField->getPropertyValue(PROPERTY_TYPE) >>= nType;
+ switch(nType)
+ {
+ case DataType::VARCHAR:
+ case DataType::CHAR:
+ case DataType::LONGVARCHAR:
+ nOp = SQLFilterOperator::LIKE;
+ break;
+ default:
+ nOp = SQLFilterOperator::EQUAL;
+ }
+ }
if ( bHaving )
{
HANDLE_SQL_ERRORS(
- m_xParser->appendHavingClauseByColumn(xField,sal_True),
+ xParser->appendHavingClauseByColumn(xField,sal_True,nOp),
bParserSuccess,
UniString(ModuleRes(SBA_BROWSER_SETTING_FILTER)),
"SbaXDataBrowserController::Execute : caught an exception while composing the new filter !"
@@ -2198,7 +2237,7 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
else
{
HANDLE_SQL_ERRORS(
- m_xParser->appendFilterByColumn(xField,sal_True),
+ xParser->appendFilterByColumn(xField,sal_True,nOp),
bParserSuccess,
UniString(ModuleRes(SBA_BROWSER_SETTING_FILTER)),
"SbaXDataBrowserController::Execute : caught an exception while composing the new filter !"
@@ -2206,7 +2245,7 @@ void SbaXDataBrowserController::Execute(sal_uInt16 nId, const Sequence< Property
}
if (bParserSuccess)
- applyParserFilter(sOldFilter, bApplied,sOldHaving);
+ applyParserFilter(sOldFilter, bApplied,sOldHaving,xParser);
InvalidateFeature(ID_BROWSER_REMOVEFILTER);
InvalidateFeature(ID_BROWSER_FILTERED);
@@ -2667,11 +2706,14 @@ void SbaXDataBrowserController::initializeParser() const
if (::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)))
{ // (only if the statement isn't native)
// (it is allowed to use the PROPERTY_ISPASSTHROUGH : _after_ loading a form it is valid)
+ xFormSet->getPropertyValue(PROPERTY_SINGLESELECTQUERYCOMPOSER) >>= m_xParser;
+/*
const Reference<XMultiServiceFactory> xFactory(::dbtools::getConnection(getRowSet()),UNO_QUERY);
if ( xFactory.is() )
m_xParser.set(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY);
+*/
}
-
+/*
// initialize the parser with the current sql-statement of the form
if ( m_xParser.is() )
{
@@ -2680,6 +2722,7 @@ void SbaXDataBrowserController::initializeParser() const
m_xParser->setHavingClause(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_HAVING_CLAUSE)));
m_xParser->setOrder(::comphelper::getString(xFormSet->getPropertyValue(PROPERTY_ORDER)));
}
+*/
}
catch(Exception&)
{
@@ -2714,6 +2757,7 @@ void SbaXDataBrowserController::unloaded(const EventObject& /*aEvent*/) throw( R
// change as a reaction on that event. as we have no chance to be notified of this change (which is
// the one we're interested in) we give them time to do what they want to before invalidating our
// bound-field-dependent slots ....
+ /*
try
{
::comphelper::disposeComponent(m_xParser);
@@ -2722,6 +2766,7 @@ void SbaXDataBrowserController::unloaded(const EventObject& /*aEvent*/) throw( R
{
OSL_ENSURE(0,"Exception thrown by dispose");
}
+ */
}
//------------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx
index c30856a7083e..972f9be83934 100644
--- a/dbaccess/source/ui/browser/dbexchange.cxx
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
@@ -28,36 +28,16 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef DBAUI_DBEXCHANGE_HXX
#include "dbexchange.hxx"
-#endif
-#ifndef _SOT_FORMATS_HXX
#include <sot/formats.hxx>
-#endif
-#ifndef _SOT_STORAGE_HXX
#include <sot/storage.hxx>
-#endif
-#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
-#endif
-#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
#include <com/sun/star/sdb/CommandType.hpp>
-#endif
-#ifndef DBAUI_TOKENWRITER_HXX
+#include <com/sun/star/sdb/XResultSetAccess.hpp>
#include "TokenWriter.hxx"
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
-#endif
-//#ifndef _COMPHELPER_EXTRACT_HXX_
-//#include <comphelper/extract.hxx>
-//#endif
-#ifndef _COMPHELPER_UNO3_HXX_
#include <comphelper/uno3.hxx>
-#endif
-#ifndef _SVX_DATACCESSDESCRIPTOR_HXX_
#include <svx/dataaccessdescriptor.hxx>
-#endif
#include "UITools.hxx"
@@ -75,23 +55,17 @@ namespace dbaui
namespace
{
- template<class T > void lcl_addListener(const Reference<T>& _xComponent,ODataClipboard* _pListener)
+ template<class T > void lcl_setListener(const Reference<T>& _xComponent, const Reference< XEventListener >& i_rListener, const bool i_bAdd )
{
- if ( _xComponent.is() )
- {
- Reference< XComponent> xCom(_xComponent,UNO_QUERY);
- if ( xCom.is() )
- xCom->addEventListener(Reference< XEventListener>((::cppu::OWeakObject*)_pListener,UNO_QUERY));
- }
- }
- template<class T > void lcl_removeListener(const Reference<T>& _xComponent,ODataClipboard* _pListener)
- {
- if ( _xComponent.is() )
- {
- Reference< XComponent> xCom(_xComponent,UNO_QUERY);
- if ( xCom.is() )
- xCom->removeEventListener(Reference< XEventListener>((::cppu::OWeakObject*)_pListener,UNO_QUERY));
- }
+ if ( !_xComponent.is() )
+ return;
+
+ Reference< XComponent> xCom( _xComponent, UNO_QUERY );
+ OSL_ENSURE( xCom.is(), "lcl_setListener: no component!" );
+ if ( !xCom.is() )
+ return;
+
+ i_bAdd ? xCom->addEventListener( i_rListener ) : xCom->removeEventListener( i_rListener );
}
}
@@ -108,13 +82,11 @@ namespace dbaui
,m_pRtf(NULL)
{
osl_incrementInterlockedCount( &m_refCount );
- lcl_addListener(_rxConnection,this);
+ lcl_setListener( _rxConnection, this, true );
- m_pHtml = new OHTMLImportExport(getDescriptor(), _rxORB, _rxFormatter);
- m_aEventListeners.push_back(m_pHtml);
+ m_pHtml.set( new OHTMLImportExport( getDescriptor(), _rxORB, _rxFormatter ) );
+ m_pRtf.set( new ORTFImportExport( getDescriptor(), _rxORB, _rxFormatter ) );
- m_pRtf = new ORTFImportExport(getDescriptor(), _rxORB, _rxFormatter);
- m_aEventListeners.push_back(m_pRtf);
osl_decrementInterlockedCount( &m_refCount );
}
@@ -129,48 +101,51 @@ namespace dbaui
,m_pHtml(NULL)
,m_pRtf(NULL)
{
- m_pHtml = new OHTMLImportExport(getDescriptor(),_rxORB, _rxFormatter);
- m_aEventListeners.push_back(m_pHtml);
-
- m_pRtf = new ORTFImportExport(getDescriptor(),_rxORB, _rxFormatter);
- m_aEventListeners.push_back(m_pRtf);
+ m_pHtml.set( new OHTMLImportExport( getDescriptor(),_rxORB, _rxFormatter ) );
+ m_pRtf.set( new ORTFImportExport( getDescriptor(),_rxORB, _rxFormatter ) );
}
// -----------------------------------------------------------------------------
- ODataClipboard::ODataClipboard( const Reference< XPropertySet >& _rxLivingForm,
- const Sequence< Any >& _rSelectedRows,
- const Reference< XResultSet>& _rxResultSet,
- const Reference< XMultiServiceFactory >& _rxORB)
- :ODataAccessObjectTransferable( _rxLivingForm )
+ ODataClipboard::ODataClipboard( const Reference< XPropertySet >& i_rAliveForm,
+ const Sequence< Any >& i_rSelectedRows,
+ const sal_Bool i_bBookmarkSelection,
+ const Reference< XMultiServiceFactory >& i_rORB )
+ :ODataAccessObjectTransferable( i_rAliveForm )
,m_pHtml(NULL)
,m_pRtf(NULL)
{
+ OSL_PRECOND( i_rORB.is(), "ODataClipboard::ODataClipboard: having no factory is not good ..." );
+
osl_incrementInterlockedCount( &m_refCount );
Reference<XConnection> xConnection;
- getDescriptor()[daConnection] >>= xConnection;
- lcl_addListener(xConnection,this);
- lcl_addListener(_rxResultSet,this);
-
- getDescriptor()[daSelection] <<= _rSelectedRows;
- getDescriptor()[daBookmarkSelection]<<= sal_False; // by definition, it's the indicies
- getDescriptor()[daCursor] <<= _rxResultSet;
- addCompatibleSelectionDescription( _rSelectedRows );
-
- if ( xConnection.is() && _rxORB.is() )
+ getDescriptor()[ daConnection ] >>= xConnection;
+ lcl_setListener( xConnection, this, true );
+
+ // do not pass the form itself as source result set, since the client might operate on the form, which
+ // might lead to undesired effects. Instead, use a clone.
+ Reference< XResultSet > xResultSetClone;
+ Reference< XResultSetAccess > xResultSetAccess( i_rAliveForm, UNO_QUERY );
+ if ( xResultSetAccess.is() )
+ xResultSetClone = xResultSetAccess->createResultSet();
+ OSL_ENSURE( xResultSetClone.is(), "ODataClipboard::ODataClipboard: could not clone the form's result set" );
+ lcl_setListener( xResultSetClone, this, true );
+
+ getDescriptor()[daCursor] <<= xResultSetClone;
+ getDescriptor()[daSelection] <<= i_rSelectedRows;
+ getDescriptor()[daBookmarkSelection]<<= i_bBookmarkSelection;
+ addCompatibleSelectionDescription( i_rSelectedRows );
+
+ if ( xConnection.is() && i_rORB.is() )
{
- Reference< XNumberFormatter > xFormatter( getNumberFormatter( xConnection, _rxORB ) );
+ Reference< XNumberFormatter > xFormatter( getNumberFormatter( xConnection, i_rORB ) );
if ( xFormatter.is() )
{
- m_pHtml = new OHTMLImportExport( getDescriptor(),_rxORB, xFormatter );
- m_aEventListeners.push_back( m_pHtml );
-
- m_pRtf = new ORTFImportExport( getDescriptor(),_rxORB, xFormatter );
- m_aEventListeners.push_back( m_pRtf );
+ m_pHtml.set( new OHTMLImportExport( getDescriptor(), i_rORB, xFormatter ) );
+ m_pRtf.set( new ORTFImportExport( getDescriptor(), i_rORB, xFormatter ) );
}
}
-
osl_decrementInterlockedCount( &m_refCount );
}
@@ -192,13 +167,11 @@ namespace dbaui
// -----------------------------------------------------------------------------
void ODataClipboard::AddSupportedFormats()
{
- // RTF?
- if (m_pRtf)
- AddFormat(SOT_FORMAT_RTF);
+ if ( m_pRtf.is() )
+ AddFormat( SOT_FORMAT_RTF );
- // HTML?
- if (m_pHtml)
- AddFormat(SOT_FORMATSTR_ID_HTML);
+ if ( m_pHtml.is() )
+ AddFormat( SOT_FORMATSTR_ID_HTML );
ODataAccessObjectTransferable::AddSupportedFormats();
}
@@ -210,13 +183,14 @@ namespace dbaui
switch (nFormat)
{
case SOT_FORMAT_RTF:
- if ( m_pRtf )
+ if ( m_pRtf.is() )
m_pRtf->initialize(getDescriptor());
- return m_pRtf && SetObject(m_pRtf, SOT_FORMAT_RTF, rFlavor);
+ return m_pRtf.is() && SetObject( m_pRtf.get(), SOT_FORMAT_RTF, rFlavor );
+
case SOT_FORMATSTR_ID_HTML:
- if ( m_pHtml )
+ if ( m_pHtml.is() )
m_pHtml->initialize(getDescriptor());
- return m_pHtml && SetObject(m_pHtml, SOT_FORMATSTR_ID_HTML, rFlavor);
+ return m_pHtml.is() && SetObject( m_pHtml.get(), SOT_FORMATSTR_ID_HTML, rFlavor );
}
return ODataAccessObjectTransferable::GetData( rFlavor );
@@ -225,59 +199,65 @@ namespace dbaui
// -----------------------------------------------------------------------------
void ODataClipboard::ObjectReleased()
{
- if ( m_pHtml )
+ if ( m_pHtml.is() )
{
m_pHtml->dispose();
- m_pHtml = NULL;
- } // if ( m_pHtml )
- if ( m_pRtf )
+ m_pHtml.clear();
+ }
+
+ if ( m_pRtf.is() )
{
m_pRtf->dispose();
- m_pRtf = NULL;
+ m_pRtf.clear();
+ }
+
+ if ( getDescriptor().has( daConnection ) )
+ {
+ Reference<XConnection> xConnection( getDescriptor()[daConnection], UNO_QUERY );
+ lcl_setListener( xConnection, this, false );
+ }
+
+ if ( getDescriptor().has( daCursor ) )
+ {
+ Reference< XResultSet > xResultSet( getDescriptor()[ daCursor ], UNO_QUERY );
+ lcl_setListener( xResultSet, this, false );
}
- m_aEventListeners.clear();
- Reference<XConnection> xConnection;
- Reference<XResultSet> xProp;
- if ( getDescriptor().has(daConnection) && (getDescriptor()[daConnection] >>= xConnection) )
- lcl_removeListener(xConnection,this);
- if ( getDescriptor().has(daCursor) && (getDescriptor()[daCursor] >>= xProp) )
- lcl_removeListener(xProp,this);
ODataAccessObjectTransferable::ObjectReleased( );
}
+
// -----------------------------------------------------------------------------
- void SAL_CALL ODataClipboard::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+ void SAL_CALL ODataClipboard::disposing( const ::com::sun::star::lang::EventObject& i_rSource ) throw (::com::sun::star::uno::RuntimeException)
{
- Reference<XConnection> xConnection;
- Reference<XResultSet> xProp;
- if ( getDescriptor().has(daConnection) && (getDescriptor()[daConnection] >>= xConnection) )
- {
- lcl_removeListener(xConnection,this);
- getDescriptor().erase(daConnection);
- } // if ( getDescriptor().has(daConnection) && (getDescriptor()[daConnection] >>= xConnection) )
- if ( getDescriptor().has(daCursor) && (getDescriptor()[daCursor] >>= xProp) )
- {
- lcl_removeListener(xProp,this);
- getDescriptor().erase(daCursor);
- } // if ( getDescriptor().has(daCursor) && (getDescriptor()[daCursor] >>= xProp) )
+ ODataAccessDescriptor& rDescriptor( getDescriptor() );
- if ( getDescriptor().has(daColumnObject) )
- getDescriptor().erase(daColumnObject);
-
- if ( getDescriptor().has(daComponent) )
- getDescriptor().erase(daComponent);
+ if ( rDescriptor.has( daConnection ) )
+ {
+ Reference< XConnection > xConnection( rDescriptor[daConnection], UNO_QUERY );
+ if ( xConnection == i_rSource.Source )
+ {
+ rDescriptor.erase( daConnection );
+ }
+ }
+ if ( rDescriptor.has( daCursor ) )
+ {
+ Reference< XResultSet > xResultSet( rDescriptor[ daCursor ], UNO_QUERY );
+ if ( xResultSet == i_rSource.Source )
+ {
+ rDescriptor.erase( daCursor );
+ // Selection and BookmarkSelection are meaningless without a result set
+ if ( rDescriptor.has( daSelection ) )
+ rDescriptor.erase( daSelection );
+ if ( rDescriptor.has( daBookmarkSelection ) )
+ rDescriptor.erase( daBookmarkSelection );
+ }
+ }
+ // no matter whether it was the source connection or the source result set which died,
+ // we cannot provide the data anymore.
ClearFormats();
- //getDescriptor().clear();
- AddSupportedFormats();
-
- /*m_pHtml = NULL;
- m_pRtf = NULL;
- m_aEventListeners.clear();*/
}
- // -----------------------------------------------------------------------------
- IMPLEMENT_FORWARD_XINTERFACE2( ODataClipboard, ODataAccessObjectTransferable, TDataClipboard_BASE )
}
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 60bed33b48ae..bb0784c0ce53 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -1440,39 +1440,30 @@ void SbaGridControl::DoRowDrag( sal_Int16 nRowPos )
// -----------------------------------------------------------------------
void SbaGridControl::implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfClipboardFalseIfDrag )
{
- Reference< XPropertySet > xDataSource(getDataSource(), UNO_QUERY);
- DBG_ASSERT(xDataSource.is(), "SbaGridControl::implTransferSelectedRows : invalid data source !");
+ Reference< XPropertySet > xForm( getDataSource(), UNO_QUERY );
+ DBG_ASSERT( xForm.is(), "SbaGridControl::implTransferSelectedRows: invalid form!" );
// build the sequence of numbers of selected rows
Sequence< Any > aSelectedRows;
+ sal_Bool bSelectionBookmarks = sal_True;
// collect the affected rows
if ((GetSelectRowCount() == 0) && (nRowPos >= 0))
{
- aSelectedRows.realloc(1);
+ aSelectedRows.realloc( 1 );
aSelectedRows[0] <<= (sal_Int32)(nRowPos + 1);
+ bSelectionBookmarks = sal_False;
}
else if ( !IsAllSelected() && GetSelectRowCount() )
{
- aSelectedRows.realloc(GetSelectRowCount());
- Any* pSelectedRows = aSelectedRows.getArray();
-
- for (long nIdx = FirstSelectedRow();
- nIdx >= 0;
- nIdx = NextSelectedRow(), ++pSelectedRows)
- {
- (*pSelectedRows) <<= (sal_Int32)(nIdx + 1);
- }
+ aSelectedRows = getSelectionBookmarks();
+ bSelectionBookmarks = sal_True;
}
Reference< XResultSet> xRowSetClone;
try
{
- Reference< XResultSetAccess > xResultSetAccess(xDataSource,UNO_QUERY);
- if ( xResultSetAccess.is() )
- xRowSetClone = xResultSetAccess->createResultSet();
-
- ODataClipboard* pTransfer = new ODataClipboard(xDataSource, aSelectedRows,xRowSetClone, getServiceManager());
+ ODataClipboard* pTransfer = new ODataClipboard( xForm, aSelectedRows, bSelectionBookmarks, getServiceManager() );
Reference< XTransferable > xEnsureDelete = pTransfer;
if ( _bTrueIfClipboardFalseIfDrag )
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index f5880cf804de..46d0c847b503 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -647,7 +647,12 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
}
aInitialValues.push_back( NamedValue( PROPERTY_CONTROLSOURCE, makeAny( *pIter ) ) );
- aInitialValues.push_back( NamedValue( PROPERTY_LABEL, makeAny( *pIter ) ) );
+ ::rtl::OUString sLabel;
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+ if ( sLabel.getLength() )
+ aInitialValues.push_back( NamedValue( PROPERTY_LABEL, makeAny( sLabel ) ) );
+ else
+ aInitialValues.push_back( NamedValue( PROPERTY_LABEL, makeAny( *pIter ) ) );
Reference< XPropertySet > xGridCol( xColFactory->createColumn( aCurrentModelType ), UNO_SET_THROW );
Reference< XPropertySetInfo > xGridColPSI( xGridCol->getPropertySetInfo(), UNO_SET_THROW );
@@ -678,8 +683,12 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun::
Any aDescription;
if ( xColPSI->hasPropertyByName( PROPERTY_HELPTEXT ) )
aDescription = xColumn->getPropertyValue( PROPERTY_HELPTEXT );
- if ( !aDescription.hasValue() )
- aDescription <<= ::rtl::OUString();
+ ::rtl::OUString sTemp;
+ aDescription >>= sTemp;
+ if ( !sTemp.getLength() )
+ xColumn->getPropertyValue( PROPERTY_DESCRIPTION ) >>= sTemp;
+
+ aDescription <<= sTemp;
aInitialValues.push_back( NamedValue( PROPERTY_HELPTEXT, aDescription ) );
// ... horizontal justify
@@ -1096,7 +1105,11 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS
{
// expand if required so
if (_bExpandAncestors)
+ {
+ m_sToBeLoaded = _rCommand;
m_pTreeView->getListBox().Expand(pCommandType);
+ m_sToBeLoaded = ::rtl::OUString();
+ }
// look for the object
::rtl::OUString sCommand = _rCommand;
@@ -2041,7 +2054,7 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce
const ::rtl::OUString* pEnd = pIter + aNames.getLength();
for (; pIter != pEnd; ++pIter)
{
- if(!m_pTreeView->getListBox().GetEntryPosByName(*pIter,_pParent))
+ if( (!m_sToBeLoaded.getLength() || m_sToBeLoaded == *pIter) && !m_pTreeView->getListBox().GetEntryPosByName(*pIter,_pParent))
{
Reference<XNameAccess> xChild(_xNameAccess->getByName(*pIter),UNO_QUERY);
DBTreeListUserData* pEntryData = new DBTreeListUserData;
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx
index 1945557c2999..89cdc855a0cd 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -84,8 +84,9 @@ OSqlEdit::~OSqlEdit()
void OSqlEdit::KeyInput( const KeyEvent& rKEvt )
{
DBG_CHKTHIS(OSqlEdit,NULL);
- m_pView->getContainerWindow()->getDesignView()->getController().InvalidateFeature(SID_CUT);
- m_pView->getContainerWindow()->getDesignView()->getController().InvalidateFeature(SID_COPY);
+ OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
+ rController.InvalidateFeature(SID_CUT);
+ rController.InvalidateFeature(SID_COPY);
// Ist dies ein Cut, Copy, Paste Event?
KeyFuncType aKeyFunc = rKEvt.GetKeyCode().GetFunction();
@@ -124,14 +125,15 @@ IMPL_LINK(OSqlEdit, OnUndoActionTimer, void*, EMPTYARG)
String aText =GetText();
if(aText != m_strOrigText)
{
- SfxUndoManager* pUndoMgr = m_pView->getContainerWindow()->getDesignView()->getController().getUndoMgr();
+ OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
+ SfxUndoManager* pUndoMgr = rController.getUndoMgr();
OSqlEditUndoAct* pUndoAct = new OSqlEditUndoAct( this );
pUndoAct->SetOriginalText( m_strOrigText );
pUndoMgr->AddUndoAction( pUndoAct );
- m_pView->getContainerWindow()->getDesignView()->getController().InvalidateFeature(SID_UNDO);
- m_pView->getContainerWindow()->getDesignView()->getController().InvalidateFeature(SID_REDO);
+ rController.InvalidateFeature(SID_UNDO);
+ rController.InvalidateFeature(SID_REDO);
m_strOrigText =aText;
}
@@ -141,8 +143,9 @@ IMPL_LINK(OSqlEdit, OnUndoActionTimer, void*, EMPTYARG)
//------------------------------------------------------------------------------
IMPL_LINK(OSqlEdit, OnInvalidateTimer, void*, EMPTYARG)
{
- m_pView->getContainerWindow()->getDesignView()->getController().InvalidateFeature(SID_CUT);
- m_pView->getContainerWindow()->getDesignView()->getController().InvalidateFeature(SID_COPY);
+ OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
+ rController.InvalidateFeature(SID_CUT);
+ rController.InvalidateFeature(SID_COPY);
if(!m_bStopTimer)
m_timerInvalidate.Start();
return 0L;
@@ -154,12 +157,13 @@ IMPL_LINK(OSqlEdit, ModifyHdl, void*, /*EMPTYTAG*/)
m_timerUndoActionCreation.Stop();
m_timerUndoActionCreation.Start();
- if (!m_pView->getContainerWindow()->getDesignView()->getController().isModified())
- m_pView->getContainerWindow()->getDesignView()->getController().setModified( sal_True );
+ OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
+ if (!rController.isModified())
+ rController.setModified( sal_True );
- m_pView->getContainerWindow()->getDesignView()->getController().InvalidateFeature(SID_SBA_QRY_EXECUTE);
- m_pView->getContainerWindow()->getDesignView()->getController().InvalidateFeature(SID_CUT);
- m_pView->getContainerWindow()->getDesignView()->getController().InvalidateFeature(SID_COPY);
+ rController.InvalidateFeature(SID_SBA_QRY_EXECUTE);
+ rController.InvalidateFeature(SID_CUT);
+ rController.InvalidateFeature(SID_COPY);
m_lnkTextModifyHdl.Call(NULL);
return 0;
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index a4e06a640bff..57443342489c 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -31,6 +31,11 @@
#include "DbAdminImpl.hxx"
#include "dsmeta.hxx"
+#include <svl/poolitem.hxx>
+#include <svl/itempool.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
#include "DriverSettings.hxx"
#include "IItemSetHelper.hxx"
#include "UITools.hxx"
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index bf4b691cac55..087b817dd07e 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.cxx
@@ -32,6 +32,9 @@
#include "dbadmin.hrc"
#include "dbadmin.hxx"
#include "dbu_dlg.hrc"
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
#include "dbustrings.hrc"
#include "dsitems.hxx"
#include "dsselect.hxx"
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 14cf09d8b0f2..1d5bb1cb167c 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -35,6 +35,9 @@
#include "dbadmin.hrc"
#include "dbadmin.hxx"
#include "dbu_dlg.hrc"
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
#include "dbustrings.hrc"
#include "dsitems.hxx"
#include "dsnItem.hxx"
diff --git a/dbaccess/source/ui/dlg/dlgsave.cxx b/dbaccess/source/ui/dlg/dlgsave.cxx
index ee6b853b5eed..7a287829057d 100644
--- a/dbaccess/source/ui/dlg/dlgsave.cxx
+++ b/dbaccess/source/ui/dlg/dlgsave.cxx
@@ -322,6 +322,7 @@ OSaveAsDlg::OSaveAsDlg( Window * pParent,
}
else
m_pImpl->m_aTitle.SetText(m_pImpl->m_aName);
+ m_pImpl->m_aTitle.SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
m_pImpl->m_aPB_OK.SetPosPixel(Point(m_pImpl->m_aPB_OK.GetPosPixel().X(),aPos.Y()));
m_pImpl->m_aPB_CANCEL.SetPosPixel(Point(m_pImpl->m_aPB_CANCEL.GetPosPixel().X(),aPos.Y()));
diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index bf14c186afcc..b9a0b0e75bfc 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -217,7 +217,7 @@ DBG_NAME(DbaIndexDialog)
,m_aDescription (this, ModuleRes(FT_DESCRIPTION))
,m_aUnique (this, ModuleRes(CB_UNIQUE))
,m_aFieldsLabel (this, ModuleRes(FT_FIELDS))
- ,m_pFields(new IndexFieldsControl (this, ModuleRes(CTR_FIELDS),_nMaxColumnsInIndex))
+ ,m_pFields(new IndexFieldsControl (this, ModuleRes(CTR_FIELDS),_nMaxColumnsInIndex,::dbtools::getBooleanDataSourceSetting( m_xConnection, "AddIndexAppendix" )))
,m_aClose (this, ModuleRes(PB_CLOSE))
,m_aHelp (this, ModuleRes(HB_HELP))
,m_pIndexes(NULL)
diff --git a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
index ef715d8061cd..55457a36ae64 100644
--- a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
+++ b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
@@ -119,12 +119,13 @@ namespace dbaui
//==================================================================
DBG_NAME(IndexFieldsControl)
//------------------------------------------------------------------
- IndexFieldsControl::IndexFieldsControl( Window* _pParent, const ResId& _rId ,sal_Int32 _nMaxColumnsInIndex)
+ IndexFieldsControl::IndexFieldsControl( Window* _pParent, const ResId& _rId ,sal_Int32 _nMaxColumnsInIndex,sal_Bool _bAddIndexAppendix)
:EditBrowseBox(_pParent, _rId, EBBF_SMART_TAB_TRAVEL | EBBF_ACTIVATE_ON_BUTTONDOWN, BROWSER_STANDARD_FLAGS)
,m_aSeekRow(m_aFields.end())
,m_pSortingCell(NULL)
,m_pFieldNameCell(NULL)
,m_nMaxColumnsInIndex(_nMaxColumnsInIndex)
+ ,m_bAddIndexAppendix(_bAddIndexAppendix)
{
DBG_CTOR(IndexFieldsControl,NULL);
@@ -205,7 +206,7 @@ DBG_NAME(IndexFieldsControl)
RowInserted(GetRowCount(), m_aFields.size(), sal_False);
// insert an additional row for a new field for that index
// if(!m_nMaxColumnsInIndex || GetRowCount() < m_nMaxColumnsInIndex )
- RowInserted(GetRowCount(), 1, sal_False);
+ RowInserted(GetRowCount(), 1, sal_False);
SetUpdateMode(sal_True);
GoToRowColumnId(0, COLUMN_ID_FIELDNAME);
@@ -247,51 +248,52 @@ DBG_NAME(IndexFieldsControl)
{
RemoveColumns();
- m_sAscendingText = String(ModuleRes(STR_ORDER_ASCENDING));
- m_sDescendingText = String(ModuleRes(STR_ORDER_DESCENDING));
-
- // the "sort order" column
- String sColumnName = String(ModuleRes(STR_TAB_INDEX_SORTORDER));
- // the width of the order column is the maximum widths of the texts used
- // (the title of the column)
- sal_Int32 nSortOrderColumnWidth = GetTextWidth(sColumnName);
- // ("ascending" + scrollbar width)
- sal_Int32 nOther = GetTextWidth(m_sAscendingText) + GetSettings().GetStyleSettings().GetScrollBarSize();
- nSortOrderColumnWidth = nSortOrderColumnWidth > nOther ? nSortOrderColumnWidth : nOther;
- // ("descending" + scrollbar width)
- nOther = GetTextWidth(m_sDescendingText) + GetSettings().GetStyleSettings().GetScrollBarSize();
- nSortOrderColumnWidth = nSortOrderColumnWidth > nOther ? nSortOrderColumnWidth : nOther;
- // (plus some additional space)
- nSortOrderColumnWidth += GetTextWidth('0') * 2;
- InsertDataColumn(COLUMN_ID_ORDER, sColumnName, nSortOrderColumnWidth, HIB_STDSTYLE, 1);
-
// for the width: both columns together should be somewhat smaller than the whole window (without the scrollbar)
sal_Int32 nFieldNameWidth = GetSizePixel().Width();
- nFieldNameWidth -= nSortOrderColumnWidth;
+ if ( m_bAddIndexAppendix )
+ {
+ m_sAscendingText = String(ModuleRes(STR_ORDER_ASCENDING));
+ m_sDescendingText = String(ModuleRes(STR_ORDER_DESCENDING));
+
+ // the "sort order" column
+ String sColumnName = String(ModuleRes(STR_TAB_INDEX_SORTORDER));
+ // the width of the order column is the maximum widths of the texts used
+ // (the title of the column)
+ sal_Int32 nSortOrderColumnWidth = GetTextWidth(sColumnName);
+ // ("ascending" + scrollbar width)
+ sal_Int32 nOther = GetTextWidth(m_sAscendingText) + GetSettings().GetStyleSettings().GetScrollBarSize();
+ nSortOrderColumnWidth = nSortOrderColumnWidth > nOther ? nSortOrderColumnWidth : nOther;
+ // ("descending" + scrollbar width)
+ nOther = GetTextWidth(m_sDescendingText) + GetSettings().GetStyleSettings().GetScrollBarSize();
+ nSortOrderColumnWidth = nSortOrderColumnWidth > nOther ? nSortOrderColumnWidth : nOther;
+ // (plus some additional space)
+ nSortOrderColumnWidth += GetTextWidth('0') * 2;
+ InsertDataColumn(COLUMN_ID_ORDER, sColumnName, nSortOrderColumnWidth, HIB_STDSTYLE, 1);
+
+ m_pSortingCell = new ListBoxControl(&GetDataWindow());
+ m_pSortingCell->InsertEntry(m_sAscendingText);
+ m_pSortingCell->InsertEntry(m_sDescendingText);
+ m_pSortingCell->SetHelpId( HID_DLGINDEX_INDEXDETAILS_SORTORDER );
+
+ nFieldNameWidth -= nSortOrderColumnWidth;
+ }
StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings();
nFieldNameWidth -= aSystemStyle.GetScrollBarSize();
nFieldNameWidth -= 8;
-
// the "field name" column
- sColumnName = String(ModuleRes(STR_TAB_INDEX_FIELD));
+ String sColumnName = String(ModuleRes(STR_TAB_INDEX_FIELD));
InsertDataColumn(COLUMN_ID_FIELDNAME, sColumnName, nFieldNameWidth, HIB_STDSTYLE, 0);
// create the cell controllers
// for the field name cell
m_pFieldNameCell = new ListBoxControl(&GetDataWindow());
m_pFieldNameCell->InsertEntry(String());
+ m_pFieldNameCell->SetHelpId( HID_DLGINDEX_INDEXDETAILS_FIELD );
const ::rtl::OUString* pFields = _rAvailableFields.getConstArray();
const ::rtl::OUString* pFieldsEnd = pFields + _rAvailableFields.getLength();
for (;pFields < pFieldsEnd; ++pFields)
m_pFieldNameCell->InsertEntry(*pFields);
- // for the sort cell
- m_pSortingCell = new ListBoxControl(&GetDataWindow());
- m_pSortingCell->InsertEntry(m_sAscendingText);
- m_pSortingCell->InsertEntry(m_sDescendingText);
-
- m_pFieldNameCell->SetHelpId( HID_DLGINDEX_INDEXDETAILS_FIELD );
- m_pSortingCell->SetHelpId( HID_DLGINDEX_INDEXDETAILS_SORTORDER );
}
//------------------------------------------------------------------
diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx
index a384ad23cb04..f71d33792c99 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -47,22 +47,23 @@
// die Spalten einer Feld-Beschreibung einer Tabelle
#define FIELD_NAME 1
#define FIELD_TYPE 2
-#define FIELD_DESCR 3
-
-#define FIELD_FIRST_VIRTUAL_COLUMN 4
-
-#define FIELD_PROPERTY_REQUIRED 4
-#define FIELD_PROPERTY_NUMTYPE 5
-#define FIELD_PROPERTY_AUTOINC 6
-#define FIELD_PROPERTY_DEFAULT 7
-#define FIELD_PROPERTY_TEXTLEN 8
-#define FIELD_PROPERTY_LENGTH 9
-#define FIELD_PROPERTY_SCALE 10
-#define FIELD_PROPERTY_BOOL_DEFAULT 11
-#define FIELD_PROPERTY_FORMAT 12
-#define FIELD_PRPOERTY_COLUMNNAME 13
-#define FIELD_PRPOERTY_TYPE 14
-#define FIELD_PRPOERTY_AUTOINCREMENT 15
+#define HELP_TEXT 3
+#define COLUMN_DESCRIPTION 4
+
+#define FIELD_FIRST_VIRTUAL_COLUMN 5
+
+#define FIELD_PROPERTY_REQUIRED 5
+#define FIELD_PROPERTY_NUMTYPE 6
+#define FIELD_PROPERTY_AUTOINC 7
+#define FIELD_PROPERTY_DEFAULT 8
+#define FIELD_PROPERTY_TEXTLEN 9
+#define FIELD_PROPERTY_LENGTH 10
+#define FIELD_PROPERTY_SCALE 11
+#define FIELD_PROPERTY_BOOL_DEFAULT 12
+#define FIELD_PROPERTY_FORMAT 13
+#define FIELD_PRPOERTY_COLUMNNAME 14
+#define FIELD_PRPOERTY_TYPE 15
+#define FIELD_PRPOERTY_AUTOINCREMENT 16
class FixedText;
class PushButton;
diff --git a/dbaccess/source/ui/inc/FieldDescriptions.hxx b/dbaccess/source/ui/inc/FieldDescriptions.hxx
index 5bac9873e921..ef98ef61492b 100644
--- a/dbaccess/source/ui/inc/FieldDescriptions.hxx
+++ b/dbaccess/source/ui/inc/FieldDescriptions.hxx
@@ -64,6 +64,7 @@ namespace dbaui
::rtl::OUString m_sName;
::rtl::OUString m_sTypeName;
::rtl::OUString m_sDescription;
+ ::rtl::OUString m_sHelpText;
::rtl::OUString m_sAutoIncrementValue;
sal_Int32 m_nType; // only used when m_pType is null
@@ -86,6 +87,7 @@ namespace dbaui
void SetName(const ::rtl::OUString& _rName);
void SetDescription(const ::rtl::OUString& _rDescription);
+ void SetHelpText(const ::rtl::OUString& _sHelptext);
void SetDefaultValue(const ::com::sun::star::uno::Any& _rDefaultValue);
void SetControlDefault(const ::com::sun::star::uno::Any& _rControlDefault);
void SetAutoIncrementValue(const ::rtl::OUString& _sAutoIncValue);
@@ -110,6 +112,7 @@ namespace dbaui
::rtl::OUString GetName() const;
::rtl::OUString GetDescription() const;
+ ::rtl::OUString GetHelpText() const;
::com::sun::star::uno::Any GetControlDefault() const;
::rtl::OUString GetAutoIncrementValue() const;
sal_Int32 GetType() const;
diff --git a/dbaccess/source/ui/inc/RTableConnectionData.hxx b/dbaccess/source/ui/inc/RTableConnectionData.hxx
index caf4c293d1b2..866472ab50a0 100644
--- a/dbaccess/source/ui/inc/RTableConnectionData.hxx
+++ b/dbaccess/source/ui/inc/RTableConnectionData.hxx
@@ -61,9 +61,9 @@ namespace dbaui
sal_Int32 m_nDeleteRules;
sal_Int32 m_nCardinality;
- BOOL checkPrimaryKey(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xKeys,EConnectionSide _eEConnectionSide) const;
- BOOL IsSourcePrimKey() const { return checkPrimaryKey(getReferencingTable()->getKeys(),JTCS_FROM); }
- BOOL IsDestPrimKey() const { return checkPrimaryKey(getReferencedTable()->getKeys(),JTCS_TO); }
+ BOOL checkPrimaryKey(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& i_xTable,EConnectionSide _eEConnectionSide) const;
+ BOOL IsSourcePrimKey() const { return checkPrimaryKey(getReferencingTable()->getTable(),JTCS_FROM); }
+ BOOL IsDestPrimKey() const { return checkPrimaryKey(getReferencedTable()->getTable(),JTCS_TO); }
protected:
virtual OConnectionLineDataRef CreateLineDataObj();
diff --git a/dbaccess/source/ui/inc/TableCopyHelper.hxx b/dbaccess/source/ui/inc/TableCopyHelper.hxx
index 014322ebced8..9b56d0729fa4 100644
--- a/dbaccess/source/ui/inc/TableCopyHelper.hxx
+++ b/dbaccess/source/ui/inc/TableCopyHelper.hxx
@@ -191,30 +191,17 @@ namespace dbaui
);
/** insert a table into the data source. The source can eihter be a table or a query
- @param _nCommandType
- The command type.
- @param _xSrcConnection
- The connection of the source.
- @param _aSelection
- The selection of the rows to copy.
- @param _bBookmarkSelection
- If <TRUE/> the selection is bookmark selection.
- @param _sCommand
- The name of the query or table.
- @param _sSrcDataSourceName
- The name of the source data source.
- @param _sDestDataSourceName
- The name of the dest data source.
*/
void insertTable(
- sal_Int32 _nCommandType,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xSrcConnection,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _aSelection,
- sal_Bool _bBookmarkSelection,
- const ::rtl::OUString& _sCommand,
- const ::rtl::OUString& _sSrcDataSourceName,
- const ::rtl::OUString& _sDestDataSourceName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xDestConnection
+ const ::rtl::OUString& i_rSourceDataSource,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& i_rSourceConnection,
+ const ::rtl::OUString& i_rCommand,
+ const sal_Int32 i_nCommandType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& i_rSourceRows,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& i_rSelection,
+ const sal_Bool i_bBookmarkSelection,
+ const ::rtl::OUString& i_rDestDataSource,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& i_rDestConnection
);
};
diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx
index a2ebb994e702..f5f073f8e4b3 100644
--- a/dbaccess/source/ui/inc/TokenWriter.hxx
+++ b/dbaccess/source/ui/inc/TokenWriter.hxx
@@ -27,51 +27,25 @@
#ifndef DBAUI_TOKENWRITER_HXX
#define DBAUI_TOKENWRITER_HXX
-#ifndef DBAUI_DATABASEEXPORT_HXX
#include "DExport.hxx"
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
#include "moduledbu.hxx"
-#endif
-#ifndef _STREAM_HXX //autogen
-#include <tools/stream.hxx>
-#endif
-#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_
+#include "commontypes.hxx"
+
#include <com/sun/star/awt/FontDescriptor.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
#include <com/sun/star/sdbc/XResultSet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
#include <com/sun/star/sdbc/XRow.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
#include <com/sun/star/lang/XEventListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
#include <com/sun/star/frame/XModel.hpp>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE1_HXX_
-#include <cppuhelper/implbase1.hxx>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
#include <com/sun/star/sdb/CommandType.hpp>
-#endif
-#ifndef _SVX_DATACCESSDESCRIPTOR_HXX_
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <tools/stream.hxx>
#include <svx/dataaccessdescriptor.hxx>
-#endif
-#ifndef _DBAUI_COMMON_TYPES_HXX_
-#include "commontypes.hxx"
-#endif
+
#include <memory>
namespace com { namespace sun { namespace star {
@@ -95,13 +69,15 @@ namespace dbaui
protected:
::com::sun::star::lang::Locale m_aLocale;
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> m_aSelection;
+ sal_Bool m_bBookmarkSelection;
SvStream* m_pStream;
::com::sun::star::awt::FontDescriptor m_aFont;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xObject; // table/query
- SharedConnection m_xConnection; //
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_xResultSet; //
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > m_xRow; //
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xResultSetMetaData; //
+ SharedConnection m_xConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_xResultSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > m_xRow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XRowLocate > m_xRowLocate;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xResultSetMetaData;
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xRowSetColumns;
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xFactory;
diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx
index 4cf229677acb..962bc75bb7f9 100644
--- a/dbaccess/source/ui/inc/brwctrlr.hxx
+++ b/dbaccess/source/ui/inc/brwctrlr.hxx
@@ -338,14 +338,15 @@ namespace dbaui
void ExecuteSearch();
void initializeParser() const; // changes the mutable member m_xParser
- void applyParserFilter(const ::rtl::OUString& _rOldFilter, sal_Bool _bOldFilterApplied,const ::rtl::OUString& _sOldHaving = ::rtl::OUString());
- void applyParserOrder(const ::rtl::OUString& _rOldOrder);
+ void applyParserFilter(const ::rtl::OUString& _rOldFilter, sal_Bool _bOldFilterApplied,const ::rtl::OUString& _sOldHaving,const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >& _xParser);
+ void applyParserOrder(const ::rtl::OUString& _rOldOrder,const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >& _xParser);
sal_Int16 getCurrentColumnPosition();
void setCurrentColumnPosition( sal_Int16 _nPos );
void addColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & _xGridControlModel);
void impl_checkForCannotSelectUnfiltered( const ::dbtools::SQLExceptionInfo& _rError );
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > createParser_nothrow();
// time to check the CUT/COPY/PASTE-slot-states
DECL_LINK( OnInvalidateClipboard, AutoTimer* );
diff --git a/dbaccess/source/ui/inc/dbexchange.hxx b/dbaccess/source/ui/inc/dbexchange.hxx
index f8c0a7f6d5d4..7d7d0bf8cab0 100644
--- a/dbaccess/source/ui/inc/dbexchange.hxx
+++ b/dbaccess/source/ui/inc/dbexchange.hxx
@@ -53,20 +53,19 @@
#endif
#include <vector>
+#include <rtl/ref.hxx>
+
namespace dbaui
{
class ORTFImportExport;
class OHTMLImportExport;
- typedef ::cppu::ImplHelper1< ::com::sun::star::lang::XEventListener > TDataClipboard_BASE;
- class ODataClipboard : public ::svx::ODataAccessObjectTransferable
- , public TDataClipboard_BASE
+ class ODataClipboard : public ::svx::ODataAccessObjectTransferable
{
- ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener> > m_aEventListeners;
- OHTMLImportExport* m_pHtml;
- ORTFImportExport* m_pRtf;
+ ::rtl::Reference< OHTMLImportExport > m_pHtml;
+ ::rtl::Reference< ORTFImportExport > m_pRtf;
public:
ODataClipboard(
@@ -87,15 +86,15 @@ namespace dbaui
);
ODataClipboard(
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxLivingForm,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rSelectedRows,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _rxResultSet,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_rAliveForm,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& i_rSelectedRows,
+ const sal_Bool i_bBookmarkSelection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rORB
);
- DECLARE_XINTERFACE( )
-
+ // XEventListener
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
protected:
virtual void AddSupportedFormats();
virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
diff --git a/dbaccess/source/ui/inc/dbu_tbl.hrc b/dbaccess/source/ui/inc/dbu_tbl.hrc
index fcba8ac828f7..a0a6b2eb8736 100644
--- a/dbaccess/source/ui/inc/dbu_tbl.hrc
+++ b/dbaccess/source/ui/inc/dbu_tbl.hrc
@@ -41,7 +41,7 @@
#define STR_TAB_FIELD_NAME RID_STR_TBL_START + 7
#define STR_TAB_FIELD_DATATYPE RID_STR_TBL_START + 8
#define STR_TAB_FIELD_LENGTH RID_STR_TBL_START + 9
-#define STR_TAB_FIELD_DESCR RID_STR_TBL_START + 10
+#define STR_TAB_HELP_TEXT RID_STR_TBL_START + 10
#define STR_TAB_FIELD_NULLABLE RID_STR_TBL_START + 11
#define STR_FIELD_AUTOINCREMENT RID_STR_TBL_START + 12
#define STR_TAB_PROPERTIES RID_STR_TBL_START + 13
@@ -86,6 +86,7 @@
#define STR_CHANGE_COLUMN_ATTRIBUTE RID_STR_TBL_START + 52
#define STR_TABLEDESIGN_SAVE_ERROR RID_STR_TBL_START + 53
#define STR_TABLEDESIGN_COULD_NOT_DROP_COL RID_STR_TBL_START + 54
+#define STR_COLUMN_DESCRIPTION RID_STR_TBL_START + 55
// please adjust checking before insert new strings
diff --git a/dbaccess/source/ui/inc/indexfieldscontrol.hxx b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
index 2cf2d88fbbba..634a19cc0f42 100644
--- a/dbaccess/source/ui/inc/indexfieldscontrol.hxx
+++ b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
@@ -67,9 +67,10 @@ namespace dbaui
String m_sDescendingText;
sal_Int32 m_nMaxColumnsInIndex;
+ sal_Bool m_bAddIndexAppendix;
public:
- IndexFieldsControl( Window* _pParent, const ResId& _rId ,sal_Int32 _nMaxColumnsInIndex);
+ IndexFieldsControl( Window* _pParent, const ResId& _rId ,sal_Int32 _nMaxColumnsInIndex,sal_Bool _bAddIndexAppendix);
~IndexFieldsControl();
void Init(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rAvailableFields);
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index d271b0b907ee..448764b641e4 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -157,6 +157,7 @@ namespace dbaui
OTableCopyHelper m_aTableCopyHelper;
::rtl::OUString m_sQueryCommand; // the command of the query currently loaded (if any)
+ ::rtl::OUString m_sToBeLoaded; // contains the element name which should be loaded if any
DBTreeView* m_pTreeView;
Splitter* m_pSplitter;
diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx
index 44cc71b31c57..cd03b3dab803 100644
--- a/dbaccess/source/ui/misc/TableCopyHelper.cxx
+++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx
@@ -160,21 +160,15 @@ using namespace ::com::sun::star::ucb;
OTableCopyHelper::OTableCopyHelper(OGenericUnoController* _pControler)
:m_pController(_pControler)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::OTableCopyHelper" );
}
// -----------------------------------------------------------------------------
-void OTableCopyHelper::insertTable(sal_Int32 _nCommandType
- ,const Reference<XConnection>& _xSrcConnection
- ,const Sequence< Any >& _aSelection
- ,sal_Bool _bBookmarkSelection
- ,const ::rtl::OUString& _sCommand
- ,const ::rtl::OUString& _sSrcDataSourceName
- ,const ::rtl::OUString& _sDestDataSourceName
- ,const Reference<XConnection>& _xDestConnection)
+void OTableCopyHelper::insertTable( const ::rtl::OUString& i_rSourceDataSource, const Reference<XConnection>& i_rSourceConnection,
+ const ::rtl::OUString& i_rCommand, const sal_Int32 i_nCommandType,
+ const Reference< XResultSet >& i_rSourceRows, const Sequence< Any >& i_rSelection, const sal_Bool i_bBookmarkSelection,
+ const ::rtl::OUString& i_rDestDataSource, const Reference<XConnection>& i_rDestConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::insertTable" );
- if ( CommandType::QUERY != _nCommandType && CommandType::TABLE != _nCommandType )
+ if ( CommandType::QUERY != i_nCommandType && CommandType::TABLE != i_nCommandType )
{
DBG_ERROR( "OTableCopyHelper::insertTable: invalid call (no supported format found)!" );
return;
@@ -182,11 +176,11 @@ void OTableCopyHelper::insertTable(sal_Int32 _nCommandType
try
{
- Reference<XConnection> xSrcConnection( _xSrcConnection );
- if ( _sSrcDataSourceName == _sDestDataSourceName )
- xSrcConnection = _xDestConnection;
+ Reference<XConnection> xSrcConnection( i_rSourceConnection );
+ if ( i_rSourceDataSource == i_rDestDataSource )
+ xSrcConnection = i_rDestConnection;
- if ( !xSrcConnection.is() || !_xDestConnection.is() )
+ if ( !xSrcConnection.is() || !i_rDestConnection.is() )
{
OSL_ENSURE( false, "OTableCopyHelper::insertTable: no connection/s!" );
return;
@@ -197,14 +191,15 @@ void OTableCopyHelper::insertTable(sal_Int32 _nCommandType
Reference< XDataAccessDescriptorFactory > xFactory( DataAccessDescriptorFactory::get( aContext.getUNOContext() ) );
Reference< XPropertySet > xSource( xFactory->createDataAccessDescriptor(), UNO_SET_THROW );
- xSource->setPropertyValue( PROPERTY_COMMAND_TYPE, makeAny( _nCommandType ) );
- xSource->setPropertyValue( PROPERTY_COMMAND, makeAny( _sCommand ) );
+ xSource->setPropertyValue( PROPERTY_COMMAND_TYPE, makeAny( i_nCommandType ) );
+ xSource->setPropertyValue( PROPERTY_COMMAND, makeAny( i_rCommand ) );
xSource->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( xSrcConnection ) );
- xSource->setPropertyValue( PROPERTY_SELECTION, makeAny( _aSelection ) );
- xSource->setPropertyValue( PROPERTY_BOOKMARK_SELECTION, makeAny( _bBookmarkSelection ) );
+ xSource->setPropertyValue( PROPERTY_RESULT_SET, makeAny( i_rSourceRows ) );
+ xSource->setPropertyValue( PROPERTY_SELECTION, makeAny( i_rSelection ) );
+ xSource->setPropertyValue( PROPERTY_BOOKMARK_SELECTION, makeAny( i_bBookmarkSelection ) );
Reference< XPropertySet > xDest( xFactory->createDataAccessDescriptor(), UNO_SET_THROW );
- xDest->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( _xDestConnection ) );
+ xDest->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( i_rDestConnection ) );
Reference< XCopyTableWizard > xWizard( CopyTableWizard::create( aContext.getUNOContext(), xSource, xDest ), UNO_SET_THROW );
@@ -227,72 +222,62 @@ void OTableCopyHelper::insertTable(sal_Int32 _nCommandType
}
// -----------------------------------------------------------------------------
-void OTableCopyHelper::pasteTable( const ::svx::ODataAccessDescriptor& _rPasteData, const ::rtl::OUString& _sDestDataSourceName,
- const SharedConnection& _xDestConnection )
+void OTableCopyHelper::pasteTable( const ::svx::ODataAccessDescriptor& _rPasteData, const ::rtl::OUString& i_rDestDataSourceName,
+ const SharedConnection& i_rDestConnection )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::pasteTable" );
- Reference<XConnection> xSrcConnection;
- ::rtl::OUString sCommand,
- sSrcDataSourceName = _rPasteData.getDataSource();
+ ::rtl::OUString sSrcDataSourceName = _rPasteData.getDataSource();
+
+ ::rtl::OUString sCommand;
+ _rPasteData[ daCommand ] >>= sCommand;
- _rPasteData[daCommand] >>= sCommand;
+ Reference<XConnection> xSrcConnection;
if ( _rPasteData.has(daConnection) )
- _rPasteData[daConnection] >>= xSrcConnection;
-#if OSL_DEBUG_LEVEL > 0
+ {
+ OSL_VERIFY( _rPasteData[daConnection] >>= xSrcConnection );
+ }
+
+ Reference< XResultSet > xResultSet;
if ( _rPasteData.has(daCursor) )
{
- Reference< XResultSet > xSrcRs;
- _rPasteData[daCursor] >>= xSrcRs;
- OSL_ENSURE( !xSrcRs.is(), "OTableCopyHelper::pasteTable: source result set not supported anymore!" );
- // There was a time where we supported passing a result set as shortcut to the source
- // object. That is, we do not need to create an own result set we already have one.
- // Since we UNOized the Copy Table Wizard (#i81658#), we removed this support, since it
- // contradicted the semantics of DataAccessDescriptor.ResultSet.
- //
- // This shouldn't be a problem, since there seems to be no client which actually
- // passed a result set here.
- // However, if there still is, we probably need to introduce an (undocumented?) property
- // at the DataAccessDescriptor, which takes this "source result set".
+ OSL_VERIFY( _rPasteData[ daCursor ] >>= xResultSet );
}
- if ( _rPasteData.has( daSelection ) || _rPasteData.has( daBookmarkSelection ) )
+ Sequence< Any > aSelection;
+ if ( _rPasteData.has( daSelection ) )
{
- OSL_ENSURE( false, "OTableCopyHelper::pasteTable: bookmark/selection not supported anymore!" );
- // similar notes here: Selection and BookmarkSelection are not supported in the UNOized
- // copy table wizard anymore (it doesn't make sense without support for a source result set),
- // and there seem to be no clients which actually use it. So, instead of implementing an
- // unused case, we dropped this here.
+ OSL_VERIFY( _rPasteData[ daSelection ] >>= aSelection );
+ OSL_ENSURE( _rPasteData.has( daBookmarkSelection ), "OTableCopyHelper::pasteTable: you should specify BookmarkSelection, too, to be on the safe side!" );
}
-#endif
- // paste into the tables
+
+ sal_Bool bBookmarkSelection( sal_True );
+ if ( _rPasteData.has( daBookmarkSelection ) )
+ {
+ OSL_VERIFY( _rPasteData[ daBookmarkSelection ] >>= bBookmarkSelection );
+ }
+ OSL_ENSURE( bBookmarkSelection, "OTableCopyHelper::pasteTable: working with selection-indicies (instead of bookmarks) is error-prone, and thus deprecated!" );
+
sal_Int32 nCommandType = CommandType::COMMAND;
if ( _rPasteData.has(daCommandType) )
_rPasteData[daCommandType] >>= nCommandType;
- insertTable( nCommandType
- ,xSrcConnection
- ,Sequence< Any >()
- ,sal_False
- ,sCommand
- ,sSrcDataSourceName
- ,_sDestDataSourceName
- ,_xDestConnection);
+ insertTable( sSrcDataSourceName, xSrcConnection, sCommand, nCommandType,
+ xResultSet, aSelection, bBookmarkSelection,
+ i_rDestDataSourceName, i_rDestConnection );
}
// -----------------------------------------------------------------------------
void OTableCopyHelper::pasteTable( SotFormatStringId _nFormatId
,const TransferableDataHelper& _rTransData
- ,const ::rtl::OUString& _sDestDataSourceName
+ ,const ::rtl::OUString& i_rDestDataSource
,const SharedConnection& _xConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::pasteTable" );
if ( _nFormatId == SOT_FORMATSTR_ID_DBACCESS_TABLE || _nFormatId == SOT_FORMATSTR_ID_DBACCESS_QUERY )
{
if ( ODataAccessObjectTransferable::canExtractObjectDescriptor(_rTransData.GetDataFlavorExVector()) )
{
::svx::ODataAccessDescriptor aPasteData = ODataAccessObjectTransferable::extractObjectDescriptor(_rTransData);
- pasteTable( aPasteData,_sDestDataSourceName,_xConnection);
+ pasteTable( aPasteData,i_rDestDataSource,_xConnection);
}
}
else if ( _rTransData.HasFormat(_nFormatId) )
@@ -326,22 +311,20 @@ void OTableCopyHelper::pasteTable( SotFormatStringId _nFormatId
// -----------------------------------------------------------------------------
void OTableCopyHelper::pasteTable( const TransferableDataHelper& _rTransData
- ,const ::rtl::OUString& _sDestDataSourceName
+ ,const ::rtl::OUString& i_rDestDataSource
,const SharedConnection& _xConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::pasteTable" );
if ( _rTransData.HasFormat(SOT_FORMATSTR_ID_DBACCESS_TABLE) || _rTransData.HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY) )
- pasteTable( SOT_FORMATSTR_ID_DBACCESS_TABLE,_rTransData,_sDestDataSourceName,_xConnection);
+ pasteTable( SOT_FORMATSTR_ID_DBACCESS_TABLE,_rTransData,i_rDestDataSource,_xConnection);
else if ( _rTransData.HasFormat(SOT_FORMATSTR_ID_HTML) )
- pasteTable( SOT_FORMATSTR_ID_HTML,_rTransData,_sDestDataSourceName,_xConnection);
+ pasteTable( SOT_FORMATSTR_ID_HTML,_rTransData,i_rDestDataSource,_xConnection);
else if ( _rTransData.HasFormat(SOT_FORMAT_RTF) )
- pasteTable( SOT_FORMAT_RTF,_rTransData,_sDestDataSourceName,_xConnection);
+ pasteTable( SOT_FORMAT_RTF,_rTransData,i_rDestDataSource,_xConnection);
}
// -----------------------------------------------------------------------------
sal_Bool OTableCopyHelper::copyTagTable(OTableCopyHelper::DropDescriptor& _rDesc, sal_Bool _bCheck,const SharedConnection& _xConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::copyTagTable" );
Reference<XEventListener> xEvt;
ODatabaseImportExport* pImport = NULL;
if ( _rDesc.bHtml )
@@ -364,7 +347,6 @@ sal_Bool OTableCopyHelper::copyTagTable(OTableCopyHelper::DropDescriptor& _rDesc
// -----------------------------------------------------------------------------
sal_Bool OTableCopyHelper::isTableFormat(const TransferableDataHelper& _rClipboard) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::isTableFormat" );
sal_Bool bTableFormat = _rClipboard.HasFormat(SOT_FORMATSTR_ID_DBACCESS_TABLE)
|| _rClipboard.HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY)
|| _rClipboard.HasFormat(SOT_FORMAT_RTF)
@@ -377,7 +359,6 @@ sal_Bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedD
,DropDescriptor& _rAsyncDrop
,const SharedConnection& _xConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::copyTagTable" );
sal_Bool bRet = sal_False;
sal_Bool bHtml = _aDroppedData.HasFormat(SOT_FORMATSTR_ID_HTML);
if ( bHtml || _aDroppedData.HasFormat(SOT_FORMAT_RTF) )
@@ -410,10 +391,9 @@ sal_Bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedD
}
// -----------------------------------------------------------------------------
void OTableCopyHelper::asyncCopyTagTable( DropDescriptor& _rDesc
- ,const ::rtl::OUString& _sDestDataSourceName
+ ,const ::rtl::OUString& i_rDestDataSource
,const SharedConnection& _xConnection)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "OTableCopyHelper::asyncCopyTagTable" );
if ( _rDesc.aHtmlRtfStorage.Is() )
{
copyTagTable(_rDesc,sal_False,_xConnection);
@@ -424,7 +404,7 @@ void OTableCopyHelper::asyncCopyTagTable( DropDescriptor& _rDesc
::utl::UCBContentHelper::Kill(aURL.GetMainURL(INetURLObject::NO_DECODE));
}
else if ( !_rDesc.bError )
- pasteTable(_rDesc.aDroppedData,_sDestDataSourceName,_xConnection);
+ pasteTable(_rDesc.aDroppedData,i_rDestDataSource,_xConnection);
else
m_pController->showError(SQLException(String(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE)),*m_pController,::rtl::OUString::createFromAscii("S1000") ,0,Any()));
}
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 0e949c975065..7c41a0fbfa04 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -100,7 +100,8 @@ ODatabaseImportExport::ODatabaseImportExport(const ::svx::ODataAccessDescriptor&
const Reference< XMultiServiceFactory >& _rM,
const Reference< ::com::sun::star::util::XNumberFormatter >& _rxNumberF,
const String& rExchange)
- :m_xFormatter(_rxNumberF)
+ :m_bBookmarkSelection( NULL )
+ ,m_xFormatter(_rxNumberF)
,m_xFactory(_rM)
,m_nCommandType(CommandType::TABLE)
,m_bNeedToReInitialize(sal_False)
@@ -130,7 +131,8 @@ ODatabaseImportExport::ODatabaseImportExport(const ::svx::ODataAccessDescriptor&
// import data
ODatabaseImportExport::ODatabaseImportExport( const ::dbtools::SharedConnection& _rxConnection,
const Reference< XNumberFormatter >& _rxNumberF, const Reference< XMultiServiceFactory >& _rM )
- :m_xConnection(_rxConnection)
+ :m_bBookmarkSelection( NULL )
+ ,m_xConnection(_rxConnection)
,m_xFormatter(_rxNumberF)
,m_xFactory(_rM)
,m_nCommandType(::com::sun::star::sdb::CommandType::TABLE)
@@ -184,6 +186,7 @@ void ODatabaseImportExport::dispose()
m_xResultSetMetaData.clear();
m_xResultSet.clear();
m_xRow.clear();
+ m_xRowLocate.clear();
m_xFormatter.clear();
}
// -----------------------------------------------------------------------------
@@ -228,20 +231,37 @@ void ODatabaseImportExport::impl_initFromDescriptor( const ODataAccessDescriptor
if (xComponent.is() && xEvt.is())
xComponent->addEventListener(xEvt);
}
- if(_aDataDescriptor.has(daSelection))
- _aDataDescriptor[daSelection] >>= m_aSelection;
- sal_Bool bBookmarkSelection = sal_True; // the default if not present
+ if ( _aDataDescriptor.has( daSelection ) )
+ _aDataDescriptor[ daSelection ] >>= m_aSelection;
+
if ( _aDataDescriptor.has( daBookmarkSelection ) )
+ _aDataDescriptor[ daBookmarkSelection ] >>= m_bBookmarkSelection;
+
+ if ( _aDataDescriptor.has( daCursor ) )
{
- _aDataDescriptor[ daBookmarkSelection ] >>= bBookmarkSelection;
- DBG_ASSERT( !bBookmarkSelection, "ODatabaseImportExport::ODatabaseImportExport: bookmarked selection not yet supported!" );
+ _aDataDescriptor[ daCursor ] >>= m_xResultSet;
+ m_xRowLocate.set( m_xResultSet, UNO_QUERY );
}
+ if ( m_aSelection.getLength() != 0 )
+ {
+ if ( !m_xResultSet.is() )
+ {
+ OSL_ENSURE( false, "ODatabaseImportExport::impl_initFromDescriptor: selection without result set is nonsense!" );
+ m_aSelection.realloc( 0 );
+ }
+ }
- if(_aDataDescriptor.has(daCursor))
- _aDataDescriptor[daCursor] >>= m_xResultSet;
- } // if ( !_bPlusDefaultInit )
+ if ( m_aSelection.getLength() != 0 )
+ {
+ if ( m_bBookmarkSelection && !m_xRowLocate.is() )
+ {
+ OSL_ENSURE( false, "ODatabaseImportExport::impl_initFromDescriptor: no XRowLocate -> no bookmars!" );
+ m_aSelection.realloc( 0 );
+ }
+ }
+ }
else
initialize();
@@ -311,19 +331,14 @@ void ODatabaseImportExport::initialize()
// the result set may be already set with the datadescriptor
if ( !m_xResultSet.is() )
{
- m_xResultSet.set(m_xFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdb.RowSet")),UNO_QUERY);
- Reference<XPropertySet > xProp(m_xResultSet,UNO_QUERY);
- if(xProp.is())
- {
- xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( m_xConnection.getTyped() ) );
- xProp->setPropertyValue(PROPERTY_COMMAND_TYPE,makeAny(m_nCommandType));
- xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(m_sName));
- Reference<XRowSet> xRowSet(xProp,UNO_QUERY);
- xRowSet->execute();
- }
- else
- OSL_ENSURE(sal_False, "ODatabaseImportExport::initialize: could not instantiate a rowset!");
- } // if ( !m_xResultSet.is() )
+ m_xResultSet.set( m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.sdb.RowSet" ) ), UNO_QUERY );
+ Reference< XPropertySet > xProp( m_xResultSet, UNO_QUERY_THROW );
+ xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( m_xConnection.getTyped() ) );
+ xProp->setPropertyValue( PROPERTY_COMMAND_TYPE, makeAny( m_nCommandType ) );
+ xProp->setPropertyValue( PROPERTY_COMMAND, makeAny( m_sName ) );
+ Reference< XRowSet > xRowSet( xProp, UNO_QUERY );
+ xRowSet->execute();
+ }
impl_initializeRowMember_throw();
}
catch(Exception& )
@@ -372,7 +387,8 @@ void ODatabaseImportExport::impl_initializeRowMember_throw()
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "misc", "Ocke.Janssen@sun.com", "ODatabaseImportExport::impl_initializeRowMember_throw" );
if ( !m_xRow.is() && m_xResultSet.is() )
{
- m_xRow.set(m_xResultSet,UNO_QUERY);
+ m_xRow.set( m_xResultSet, UNO_QUERY );
+ m_xRowLocate.set( m_xResultSet, UNO_QUERY );
m_xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(m_xRow,UNO_QUERY)->getMetaData();
Reference<XColumnsSupplier> xSup(m_xResultSet,UNO_QUERY_THROW);
m_xRowSetColumns.set(xSup->getColumns(),UNO_QUERY_THROW);
@@ -567,22 +583,29 @@ BOOL ORTFImportExport::Write()
Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
sal_Int32 k=1;
sal_Int32 kk=0;
- if(m_aSelection.getLength())
+ if ( m_aSelection.getLength() )
{
const Any* pSelIter = m_aSelection.getConstArray();
const Any* pEnd = pSelIter + m_aSelection.getLength();
+
sal_Bool bContinue = sal_True;
- for(;pSelIter != pEnd && bContinue;++pSelIter)
+ for( ; pSelIter != pEnd && bContinue; ++pSelIter )
{
- sal_Int32 nPos = -1;
- *pSelIter >>= nPos;
- OSL_ENSURE(nPos != -1,"Invalid posiotion!");
- bContinue = (m_xResultSet->absolute(nPos));
- if ( bContinue )
- appendRow(pHorzChar,nCount,k,kk);
+ if ( m_bBookmarkSelection )
+ {
+ bContinue = m_xRowLocate->moveToBookmark( *pSelIter );
+ }
+ else
+ {
+ sal_Int32 nPos = -1;
+ OSL_VERIFY( *pSelIter >>= nPos );
+ bContinue = ( m_xResultSet->absolute( nPos ) );
+ }
+ if ( bContinue )
+ appendRow( pHorzChar, nCount, k, kk );
}
- } // if(m_aSelection.getLength())
+ }
else
{
m_xResultSet->beforeFirst(); // set back before the first row
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 930dd089951a..142da37eb892 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -889,6 +889,7 @@ void setColumnProperties(const Reference<XPropertySet>& _rxColumn,const OFieldDe
_rxColumn->setPropertyValue(PROPERTY_SCALE,makeAny(_pFieldDesc->GetScale()));
_rxColumn->setPropertyValue(PROPERTY_ISNULLABLE, makeAny(_pFieldDesc->GetIsNullable()));
_rxColumn->setPropertyValue(PROPERTY_ISAUTOINCREMENT,::cppu::bool2any(_pFieldDesc->IsAutoIncrement()));
+ _rxColumn->setPropertyValue(PROPERTY_DESCRIPTION,makeAny(_pFieldDesc->GetDescription()));
if ( _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISCURRENCY) && _pFieldDesc->IsCurrency() )
_rxColumn->setPropertyValue(PROPERTY_ISCURRENCY,::cppu::bool2any(_pFieldDesc->IsCurrency()));
// set autoincrement value when available
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 5670ff86b60e..48258db321cc 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -230,22 +230,10 @@ Sequence< ::rtl::OUString > ObjectCopySource::getColumnNames() const
//------------------------------------------------------------------------
Sequence< ::rtl::OUString > ObjectCopySource::getPrimaryKeyColumnNames() const
{
- Reference<XKeysSupplier> xSup(m_xObject,UNO_QUERY);
- Reference< XIndexAccess> xKeys;
- if(xSup.is() )
- xKeys = xSup->getKeys();
-
- ::std::vector< Reference< XNameAccess > > aPrimaryKeyColumns( ::dbaui::getKeyColumns( xKeys, KeyType::PRIMARY ) );
- OSL_ENSURE( ( aPrimaryKeyColumns.size() == 1 ) || aPrimaryKeyColumns.empty(),
- "ObjectCopySource::getPrimaryKeyColumnNames: more than one primary key?!" );
-
- Reference< XNameAccess > xKeyCols;
- if ( !aPrimaryKeyColumns.empty() )
- xKeyCols = aPrimaryKeyColumns[0];
-
+ const Reference<XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(m_xObject);
Sequence< ::rtl::OUString > aKeyColNames;
- if ( xKeyCols.is() )
- aKeyColNames = xKeyCols->getElementNames();
+ if ( xPrimaryKeyColumns.is() )
+ aKeyColNames = xPrimaryKeyColumns->getElementNames();
return aKeyColNames;
}
@@ -368,7 +356,7 @@ void NamedTableCopySource::impl_ensureColumnInfo_throw()
OFieldDescription aDesc;
aDesc.SetName( xStatementMeta->getColumnName( i ) );
- aDesc.SetDescription( xStatementMeta->getColumnLabel( i ) );
+ aDesc.SetHelpText( xStatementMeta->getColumnLabel( i ) );
aDesc.SetTypeValue( xStatementMeta->getColumnType( i ) );
aDesc.SetTypeName( xStatementMeta->getColumnTypeName( i ) );
aDesc.SetPrecision( xStatementMeta->getPrecision( i ) );
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 8eab04d85edf..0eb7c09f29e9 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -607,14 +607,16 @@ namespace
//------------------------------------------------------------------------------
SqlParseError InsertJoinConnection( const OQueryDesignView* _pView,
const ::connectivity::OSQLParseNode *pNode,
- const EJoinType& _eJoinType)
+ const EJoinType& _eJoinType,
+ const ::connectivity::OSQLParseNode *pLeftTable,
+ const ::connectivity::OSQLParseNode *pRightTable)
{
SqlParseError eErrorCode = eOk;
if (pNode->count() == 3 && // Ausdruck is geklammert
SQL_ISPUNCTUATION(pNode->getChild(0),"(") &&
SQL_ISPUNCTUATION(pNode->getChild(2),")"))
{
- eErrorCode = InsertJoinConnection(_pView,pNode->getChild(1), _eJoinType);
+ eErrorCode = InsertJoinConnection(_pView,pNode->getChild(1), _eJoinType,pLeftTable,pRightTable);
}
else if (SQL_ISRULEOR2(pNode,search_condition,boolean_term) && // AND/OR-Verknuepfung:
pNode->count() == 3)
@@ -622,8 +624,8 @@ namespace
// nur AND Verknpfung zulassen
if (!SQL_ISTOKEN(pNode->getChild(1),AND))
eErrorCode = eIllegalJoinCondition;
- else if ( eOk == (eErrorCode = InsertJoinConnection(_pView,pNode->getChild(0), _eJoinType)) )
- eErrorCode = InsertJoinConnection(_pView,pNode->getChild(2), _eJoinType);
+ else if ( eOk == (eErrorCode = InsertJoinConnection(_pView,pNode->getChild(0), _eJoinType,pLeftTable,pRightTable)) )
+ eErrorCode = InsertJoinConnection(_pView,pNode->getChild(2), _eJoinType,pLeftTable,pRightTable);
}
else if (SQL_ISRULE(pNode,comparison_predicate))
{
@@ -644,7 +646,17 @@ namespace
eOk != ( eErrorCode = FillDragInfo(_pView,pNode->getChild(2),aDragRight)))
return eErrorCode;
- insertConnection(_pView,_eJoinType,aDragLeft,aDragRight);
+ if ( pLeftTable )
+ {
+ OQueryTableWindow* pLeftWindow = static_cast<OQueryTableView*>(_pView->getTableView())->FindTable( getTableRange(_pView,pLeftTable->getByRule(OSQLParseNode::table_ref) ));
+ // OQueryTableWindow* pRightWindow = static_cast<OQueryTableView*>(_pView->getTableView())->FindTable( getTableRange(_pView,pRightTable->getByRule(OSQLParseNode::table_ref) ));
+ if ( pLeftWindow == aDragLeft->GetTabWindow() )
+ insertConnection(_pView,_eJoinType,aDragLeft,aDragRight);
+ else
+ insertConnection(_pView,_eJoinType,aDragRight,aDragLeft);
+ }
+ else
+ insertConnection(_pView,_eJoinType,aDragLeft,aDragRight);
}
else
eErrorCode = eIllegalJoin;
@@ -654,7 +666,7 @@ namespace
sal_Bool GetInnerJoinCriteria( const OQueryDesignView* _pView,
const ::connectivity::OSQLParseNode *pCondition)
{
- return InsertJoinConnection(_pView,pCondition, INNER_JOIN) != eOk;
+ return InsertJoinConnection(_pView,pCondition, INNER_JOIN,NULL,NULL) != eOk;
}
//------------------------------------------------------------------------------
::rtl::OUString GenerateSelectList( const OQueryDesignView* _pView,
@@ -1096,53 +1108,76 @@ namespace
{
::std::vector<OTableConnection*>::const_iterator aIter = pConnList->begin();
::std::vector<OTableConnection*>::const_iterator aEnd = pConnList->end();
+ ::std::map<OTableWindow*,sal_Int32> aConnectionCount;
for(;aIter != aEnd;++aIter)
+ {
static_cast<OQueryTableConnection*>(*aIter)->SetVisited(sal_False);
+ if ( aConnectionCount.find((*aIter)->GetSourceWin()) == aConnectionCount.end() )
+ aConnectionCount.insert(::std::map<OTableWindow*,sal_Int32>::value_type((*aIter)->GetSourceWin(),0));
+ else
+ aConnectionCount[(*aIter)->GetSourceWin()]++;
+ if ( aConnectionCount.find((*aIter)->GetDestWin()) == aConnectionCount.end() )
+ aConnectionCount.insert(::std::map<OTableWindow*,sal_Int32>::value_type((*aIter)->GetDestWin(),0));
+ else
+ aConnectionCount[(*aIter)->GetDestWin()]++;
+ }
+ ::std::multimap<sal_Int32 , OTableWindow*> aMulti;
+ ::std::map<OTableWindow*,sal_Int32>::iterator aCountIter = aConnectionCount.begin();
+ ::std::map<OTableWindow*,sal_Int32>::iterator aCountEnd = aConnectionCount.end();
+ for(;aCountIter != aCountEnd;++aCountIter)
+ {
+ aMulti.insert(::std::multimap<sal_Int32 , OTableWindow*>::value_type(aCountIter->second,aCountIter->first));
+ }
- aIter = pConnList->begin();
const sal_Bool bUseEscape = ::dbtools::getBooleanDataSourceSetting( _xConnection, PROPERTY_OUTERJOINESCAPE );
- for(;aIter != aEnd;++aIter)
+ ::std::multimap<sal_Int32 , OTableWindow*>::reverse_iterator aRIter = aMulti.rbegin();
+ ::std::multimap<sal_Int32 , OTableWindow*>::reverse_iterator aREnd = aMulti.rend();
+ for(;aRIter != aREnd;++aRIter)
{
- OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>(*aIter);
- if(!pEntryConn->IsVisited())
+ ::std::vector<OTableConnection*>::const_iterator aConIter = aRIter->second->getTableView()->getTableConnections(aRIter->second);
+ for(;aConIter != aEnd;++aConIter)
{
- ::rtl::OUString aJoin;
- GetNextJoin(_xConnection,pEntryConn,static_cast<OQueryTableWindow*>(pEntryConn->GetDestWin()),aJoin);
-
- if(aJoin.getLength())
+ OQueryTableConnection* pEntryConn = static_cast<OQueryTableConnection*>(*aConIter);
+ if(!pEntryConn->IsVisited() && pEntryConn->GetSourceWin() == aRIter->second )
{
- // insert tables into table list to avoid double entries
- OQueryTableWindow* pEntryTabFrom = static_cast<OQueryTableWindow*>(pEntryConn->GetSourceWin());
- OQueryTableWindow* pEntryTabTo = static_cast<OQueryTableWindow*>(pEntryConn->GetDestWin());
-
- ::rtl::OUString sTabName(BuildTable(_xConnection,pEntryTabFrom));
- if(aTableNames.find(sTabName) == aTableNames.end())
- aTableNames[sTabName] = sal_True;
- sTabName = BuildTable(_xConnection,pEntryTabTo);
- if(aTableNames.find(sTabName) == aTableNames.end())
- aTableNames[sTabName] = sal_True;
-
- ::rtl::OUString aStr;
- switch(static_cast<OQueryTableConnectionData*>(pEntryConn->GetData().get())->GetJoinType())
+ ::rtl::OUString aJoin;
+ GetNextJoin(_xConnection,pEntryConn,static_cast<OQueryTableWindow*>(pEntryConn->GetDestWin()),aJoin);
+
+ if(aJoin.getLength())
{
- case LEFT_JOIN:
- case RIGHT_JOIN:
- case FULL_JOIN:
- {
- // create outer join
- if ( bUseEscape )
- aStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("{ OJ "));
+ // insert tables into table list to avoid double entries
+ OQueryTableWindow* pEntryTabFrom = static_cast<OQueryTableWindow*>(pEntryConn->GetSourceWin());
+ OQueryTableWindow* pEntryTabTo = static_cast<OQueryTableWindow*>(pEntryConn->GetDestWin());
+
+ ::rtl::OUString sTabName(BuildTable(_xConnection,pEntryTabFrom));
+ if(aTableNames.find(sTabName) == aTableNames.end())
+ aTableNames[sTabName] = sal_True;
+ sTabName = BuildTable(_xConnection,pEntryTabTo);
+ if(aTableNames.find(sTabName) == aTableNames.end())
+ aTableNames[sTabName] = sal_True;
+
+ ::rtl::OUString aStr;
+ switch(static_cast<OQueryTableConnectionData*>(pEntryConn->GetData().get())->GetJoinType())
+ {
+ case LEFT_JOIN:
+ case RIGHT_JOIN:
+ case FULL_JOIN:
+ {
+ // create outer join
+ if ( bUseEscape )
+ aStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("{ OJ "));
+ aStr += aJoin;
+ if ( bUseEscape )
+ aStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" }"));
+ }
+ break;
+ default:
aStr += aJoin;
- if ( bUseEscape )
- aStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" }"));
- }
- break;
- default:
- aStr += aJoin;
- break;
+ break;
+ }
+ aStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
+ aTableListStr += aStr;
}
- aStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(","));
- aTableListStr += aStr;
}
}
}
@@ -1940,7 +1975,7 @@ namespace
}
if ( SQL_ISRULE(pNode->getChild(4),join_condition) )
{
- if ( InsertJoinConnection(_pView,pNode->getChild(4)->getChild(1), eJoinType) != eOk )
+ if ( InsertJoinConnection(_pView,pNode->getChild(4)->getChild(1), eJoinType,pNode->getChild(0),pRightTableRef) != eOk )
return sal_False;
}
}
@@ -3128,6 +3163,7 @@ OSQLParseNode* OQueryDesignView::getPredicateTreeFromEntry(OTableFieldDescRef pE
parse::OParseColumn* pColumn = new parse::OParseColumn( pEntry->GetField(),
::rtl::OUString(),
::rtl::OUString(),
+ ::rtl::OUString(),
ColumnValue::NULLABLE_UNKNOWN,
0,
0,
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index b88c93cbfb5d..25653e8ec7d1 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -59,8 +59,6 @@
#endif
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
-#include <com/sun/star/sdbcx/KeyType.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
@@ -73,6 +71,7 @@
#include "UITools.hxx"
#include "TableWindowAccess.hxx"
#include "browserids.hxx"
+#include <connectivity/dbtools.hxx>
using namespace dbaui;
@@ -221,30 +220,7 @@ BOOL OTableWindow::FillListBox()
Reference<XNameAccess> xPKeyColumns;
try
{
- // first we need the keys from the table
- Reference< XIndexAccess> xKeyIndex = m_pData->getKeys();
- // search the one and only primary key
- if ( xKeyIndex.is() )
- {
- Reference<XColumnsSupplier> xColumnsSupplier;
- for(sal_Int32 i=0;i< xKeyIndex->getCount();++i)
- {
- Reference<XPropertySet> xProp;
- xKeyIndex->getByIndex(i) >>= xProp;
- if ( xProp.is() )
- {
- sal_Int32 nKeyType = 0;
- xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
- if(KeyType::PRIMARY == nKeyType)
- {
- xColumnsSupplier.set(xProp,UNO_QUERY);
- break;
- }
- }
- }
- if ( xColumnsSupplier.is() )
- xPKeyColumns = xColumnsSupplier->getColumns();
- }
+ xPKeyColumns = dbtools::getPrimaryKeyColumns_throw(m_pData->getTable());
}
catch(Exception&)
{
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 549c098c297b..06b6804fa9be 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -1748,7 +1748,7 @@ void OQueryController::impl_reset( const bool i_bForceCurrentControllerSettings
m_pSqlIterator->traverseAll();
if ( m_pSqlIterator->hasErrors() )
{
- if ( !i_bForceCurrentControllerSettings && !editingView() )
+ if ( !i_bForceCurrentControllerSettings && m_bGraphicalDesign && !editingView() )
{
impl_showAutoSQLViewError( makeAny( m_pSqlIterator->getErrors() ) );
}
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index 058dd31f0212..a8e34493e320 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -42,6 +42,7 @@
#include "UITools.hxx"
#include "moduledbu.hxx"
#include <connectivity/dbexception.hxx>
+#include <connectivity/dbtools.hxx>
using namespace dbaui;
using namespace ::com::sun::star::sdbc;
@@ -173,35 +174,29 @@ void ORelationTableConnectionData::SetCardinality()
}
// -----------------------------------------------------------------------------
-BOOL ORelationTableConnectionData::checkPrimaryKey(const Reference< XIndexAccess>& _xKeys,EConnectionSide _eEConnectionSide) const
+BOOL ORelationTableConnectionData::checkPrimaryKey(const Reference< XPropertySet>& i_xTable,EConnectionSide _eEConnectionSide) const
{
// check if Table has the primary key column dependig on _eEConnectionSide
USHORT nPrimKeysCount = 0,
nValidLinesCount = 0;
- ::std::vector<Reference<XNameAccess> > vKeyColumns = ::dbaui::getKeyColumns(_xKeys,KeyType::PRIMARY);
- if ( vKeyColumns.size() == 1 )
+ const Reference< XNameAccess> xKeyColumns = dbtools::getPrimaryKeyColumns_throw(i_xTable);
+ if ( xKeyColumns.is() )
{
-// OSL_ENSURE(vKeyColumns.size()==1,"There can be only one primary key in a table!");
- Sequence< ::rtl::OUString> aKeyColumns;
- Reference<XNameAccess> xKeyColumns = *vKeyColumns.begin();
- if ( xKeyColumns.is() )
- {
- aKeyColumns = xKeyColumns->getElementNames();
- const ::rtl::OUString* pKeyIter = aKeyColumns.getConstArray();
- const ::rtl::OUString* pKeyEnd = pKeyIter + aKeyColumns.getLength();
+ Sequence< ::rtl::OUString> aKeyColumns = xKeyColumns->getElementNames();
+ const ::rtl::OUString* pKeyIter = aKeyColumns.getConstArray();
+ const ::rtl::OUString* pKeyEnd = pKeyIter + aKeyColumns.getLength();
- for(;pKeyIter != pKeyEnd;++pKeyIter)
+ for(;pKeyIter != pKeyEnd;++pKeyIter)
+ {
+ OConnectionLineDataVec::const_iterator aIter = m_vConnLineData.begin();
+ OConnectionLineDataVec::const_iterator aEnd = m_vConnLineData.end();
+ for(;aIter != aEnd;++aIter)
{
- OConnectionLineDataVec::const_iterator aIter = m_vConnLineData.begin();
- OConnectionLineDataVec::const_iterator aEnd = m_vConnLineData.end();
- for(;aIter != aEnd;++aIter)
+ ++nValidLinesCount;
+ if ( (*aIter)->GetFieldName(_eEConnectionSide) == *pKeyIter )
{
- ++nValidLinesCount;
- if ( (*aIter)->GetFieldName(_eEConnectionSide) == *pKeyIter )
- {
- ++nPrimKeysCount;
- break;
- }
+ ++nPrimKeysCount;
+ break;
}
}
}
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index e14c234cc5d3..0c9d0cc1a456 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -225,9 +225,8 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const
::rtl::OUString sDestFieldName = jxdDest.pListBox->GetEntryText(jxdDest.pEntry);
// die Anzahl der PKey-Felder in der Quelle
-
- ::std::vector< Reference< XNameAccess> > aPkeys = ::dbaui::getKeyColumns(pSourceWin->GetData()->getKeys(),KeyType::PRIMARY);
- bool bAskUser = aPkeys.size() == 1 && Reference< XIndexAccess>(aPkeys[0],UNO_QUERY)->getCount() > 1;
+ const Reference< XNameAccess> xPrimaryKeyColumns = getPrimaryKeyColumns_throw(pSourceWin->GetData()->getTable());
+ bool bAskUser = xPrimaryKeyColumns.is() && Reference< XIndexAccess>(xPrimaryKeyColumns,UNO_QUERY)->getCount() > 1;
pTabConnData->SetConnLine( 0, sSourceFieldName, sDestFieldName );
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index bd2a83d87364..bb0231ba30b0 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
@@ -154,6 +154,12 @@ OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedC
SetName(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_NAME)));
if(xPropSetInfo->hasPropertyByName(PROPERTY_DESCRIPTION))
SetDescription(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_DESCRIPTION)));
+ if(xPropSetInfo->hasPropertyByName(PROPERTY_HELPTEXT))
+ {
+ ::rtl::OUString sHelpText;
+ xAffectedCol->getPropertyValue(PROPERTY_HELPTEXT) >>= sHelpText;
+ SetHelpText(sHelpText);
+ }
if(xPropSetInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE))
SetDefaultValue( xAffectedCol->getPropertyValue(PROPERTY_DEFAULTVALUE) );
@@ -285,6 +291,21 @@ void OFieldDescription::SetName(const ::rtl::OUString& _rName)
}
}
// -----------------------------------------------------------------------------
+void OFieldDescription::SetHelpText(const ::rtl::OUString& _sHelpText)
+{
+ try
+ {
+ if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
+ m_xDest->setPropertyValue(PROPERTY_HELPTEXT,makeAny(_sHelpText));
+ else
+ m_sHelpText = _sHelpText;
+ }
+ catch(const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+// -----------------------------------------------------------------------------
void OFieldDescription::SetDescription(const ::rtl::OUString& _rDescription)
{
try
@@ -501,6 +522,14 @@ void OFieldDescription::SetCurrency(sal_Bool _bIsCurrency)
return m_sDescription;
}
// -----------------------------------------------------------------------------
+::rtl::OUString OFieldDescription::GetHelpText() const
+{
+ if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
+ return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_HELPTEXT));
+ else
+ return m_sHelpText;
+}
+// -----------------------------------------------------------------------------
::com::sun::star::uno::Any OFieldDescription::GetControlDefault() const
{
if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
@@ -654,8 +683,8 @@ void OFieldDescription::copyColumnSettingsTo(const Reference< XPropertySet >& _r
_rxColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(GetFormatKey()));
if ( GetHorJustify() != SVX_HOR_JUSTIFY_STANDARD && xInfo->hasPropertyByName(PROPERTY_ALIGN) )
_rxColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAllign(GetHorJustify())));
- if ( GetDescription().getLength() && xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
- _rxColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(GetDescription()));
+ if ( GetHelpText().getLength() && xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
+ _rxColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(GetHelpText()));
if ( GetControlDefault().hasValue() && xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
_rxColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,GetControlDefault());
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 40741ac02bb7..2910380070c5 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -105,6 +105,7 @@
#ifndef DBAUI_TABLEFIELDCONTROL_HXX
#include "TableFieldControl.hxx"
#endif
+#include "dsntypes.hxx"
using namespace ::dbaui;
using namespace ::comphelper;
@@ -199,13 +200,21 @@ void OTableEditorCtrl::Init()
//////////////////////////////////////////////////////////////////////
// Spalten einfuegen
String aColumnName( ModuleRes(STR_TAB_FIELD_COLUMN_NAME) );
- InsertDataColumn( 1, aColumnName, FIELDNAME_WIDTH );
+ InsertDataColumn( FIELD_NAME, aColumnName, FIELDNAME_WIDTH );
aColumnName = String( ModuleRes(STR_TAB_FIELD_COLUMN_DATATYPE) );
- InsertDataColumn( 2, aColumnName, FIELDTYPE_WIDTH );
+ InsertDataColumn( FIELD_TYPE, aColumnName, FIELDTYPE_WIDTH );
- aColumnName = String( ModuleRes(STR_TAB_FIELD_DESCR) );
- InsertDataColumn( 3, aColumnName, FIELDDESCR_WIDTH );
+ ::dbaccess::ODsnTypeCollection aDsnTypes(GetView()->getController().getORB());
+ sal_Bool bShowColumnDescription = aDsnTypes.supportsColumnDescription(::comphelper::getString(GetView()->getController().getDataSource()->getPropertyValue(PROPERTY_URL)));
+ aColumnName = String( ModuleRes(STR_TAB_HELP_TEXT) );
+ InsertDataColumn( HELP_TEXT, aColumnName, bShowColumnDescription ? FIELDTYPE_WIDTH : FIELDDESCR_WIDTH );
+
+ if ( bShowColumnDescription )
+ {
+ aColumnName = String( ModuleRes(STR_COLUMN_DESCRIPTION) );
+ InsertDataColumn( COLUMN_DESCRIPTION, aColumnName, FIELDTYPE_WIDTH );
+ }
InitCellController();
@@ -229,6 +238,7 @@ OTableEditorCtrl::OTableEditorCtrl(Window* pWindow)
:OTableRowView(pWindow)
,pNameCell(NULL)
,pTypeCell(NULL)
+ ,pHelpTextCell(NULL)
,pDescrCell(NULL)
,pDescrWin(NULL)
,nIndexEvent(0)
@@ -342,12 +352,16 @@ void OTableEditorCtrl::InitCellController()
pDescrCell = new Edit( &GetDataWindow(), WB_LEFT );
pDescrCell->SetMaxTextLen( MAX_DESCR_LEN );
+ pHelpTextCell = new Edit( &GetDataWindow(), WB_LEFT );
+ pHelpTextCell->SetMaxTextLen( MAX_DESCR_LEN );
+
pNameCell->SetHelpId(HID_TABDESIGN_NAMECELL);
pTypeCell->SetHelpId(HID_TABDESIGN_TYPECELL);
pDescrCell->SetHelpId(HID_TABDESIGN_COMMENTCELL);
+ pHelpTextCell->SetHelpId(HID_TABDESIGN_HELPTEXT);
Size aHeight;
- const Control* pControls[] = { pTypeCell,pDescrCell,pNameCell};
+ const Control* pControls[] = { pTypeCell,pDescrCell,pNameCell,pHelpTextCell};
for(sal_Size i= 0; i < sizeof(pControls)/sizeof(pControls[0]);++i)
{
const Size aTemp( pControls[i]->GetOptimalSize(WINDOWSIZE_PREFERRED) );
@@ -365,6 +379,7 @@ void OTableEditorCtrl::ClearModified()
DBG_CHKTHIS(OTableEditorCtrl,NULL);
pNameCell->ClearModifyFlag();
pDescrCell->ClearModifyFlag();
+ pHelpTextCell->ClearModifyFlag();
pTypeCell->SaveValue();
}
@@ -396,6 +411,7 @@ OTableEditorCtrl::~OTableEditorCtrl()
delete pNameCell;
delete pTypeCell;
delete pDescrCell;
+ delete pHelpTextCell;
}
//------------------------------------------------------------------------------
@@ -471,10 +487,16 @@ CellController* OTableEditorCtrl::GetController(long nRow, sal_uInt16 nColumnId)
if (pActFieldDescr && (pActFieldDescr->GetName().getLength() != 0))
return new ListBoxCellController( pTypeCell );
else return NULL;
- case FIELD_DESCR:
+ case HELP_TEXT:
+ if (pActFieldDescr && (pActFieldDescr->GetName().getLength() != 0))
+ return new EditCellController( pHelpTextCell );
+ else
+ return NULL;
+ case COLUMN_DESCRIPTION:
if (pActFieldDescr && (pActFieldDescr->GetName().getLength() != 0))
return new EditCellController( pDescrCell );
- else return NULL;
+ else
+ return NULL;
default:
return NULL;
}
@@ -516,7 +538,13 @@ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16
}
break;
- case FIELD_DESCR:
+ case HELP_TEXT:
+ if( pActFieldDescr )
+ aInitString = pActFieldDescr->GetHelpText();
+ pHelpTextCell->SetText( aInitString );
+ pHelpTextCell->SaveValue();
+ break;
+ case COLUMN_DESCRIPTION:
if( pActFieldDescr )
aInitString = pActFieldDescr->GetDescription();
pDescrCell->SetText( aInitString );
@@ -576,7 +604,8 @@ void OTableEditorCtrl::DisplayData(long nRow, sal_Bool bGrabFocus)
CellControllerRef aTemp;
InitController(aTemp, nRow, FIELD_NAME);
InitController(aTemp, nRow, FIELD_TYPE);
- InitController(aTemp, nRow, FIELD_DESCR);
+ InitController(aTemp, nRow, COLUMN_DESCRIPTION);
+ InitController(aTemp, nRow, HELP_TEXT);
GoToRow(nRow);
// das Description-Window aktualisieren
@@ -601,7 +630,8 @@ void OTableEditorCtrl::CursorMoved()
CellControllerRef aTemp;
InitController(aTemp,m_nDataPos,FIELD_NAME);
InitController(aTemp,m_nDataPos,FIELD_TYPE);
- InitController(aTemp,m_nDataPos,FIELD_DESCR);
+ InitController(aTemp,m_nDataPos,COLUMN_DESCRIPTION);
+ InitController(aTemp,m_nDataPos,HELP_TEXT);
}
OTableRowView::CursorMoved();
@@ -675,7 +705,20 @@ sal_Bool OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId)
//////////////////////////////////////////////////////////////
// Speichern Inhalt DescrCell
- case FIELD_DESCR:
+ case HELP_TEXT:
+ {
+ //////////////////////////////////////////////////////////////
+ // Wenn aktuelle Feldbeschreibung NULL, Default setzen
+ if( !pActFieldDescr )
+ {
+ pHelpTextCell->SetText(String());
+ pHelpTextCell->ClearModifyFlag();
+ }
+ else
+ pActFieldDescr->SetHelpText( pHelpTextCell->GetText() );
+ break;
+ }
+ case COLUMN_DESCRIPTION:
{
//////////////////////////////////////////////////////////////
// Wenn aktuelle Feldbeschreibung NULL, Default setzen
@@ -811,7 +854,8 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId )
{
case FIELD_NAME: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_NAME ) ); break;
case FIELD_TYPE: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_TYPE ) ); break;
- case FIELD_DESCR: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_DESCRIPTION ) ); break;
+ case HELP_TEXT:
+ case COLUMN_DESCRIPTION: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_DESCRIPTION ) ); break;
default: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_ATTRIBUTE ) ); break;
}
@@ -1176,7 +1220,7 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const ::com::s
OSL_ENSURE(sal_False, "OTableEditorCtrl::SetCellData: invalid column!");
break;
- case FIELD_DESCR:
+ case COLUMN_DESCRIPTION:
pFieldDescr->SetDescription( sValue = ::comphelper::getString(_rNewData) );
break;
@@ -1265,9 +1309,12 @@ Any OTableEditorCtrl::GetCellData( long nRow, sal_uInt16 nColId )
sValue = pFieldDescr->getTypeInfo()->aUIName;
break;
- case FIELD_DESCR:
+ case COLUMN_DESCRIPTION:
sValue = pFieldDescr->GetDescription();
break;
+ case HELP_TEXT:
+ sValue = pFieldDescr->GetHelpText();
+ break;
case FIELD_PROPERTY_DEFAULT:
return pFieldDescr->GetControlDefault();
@@ -1347,16 +1394,24 @@ sal_Bool OTableEditorCtrl::IsCutAllowed( long nRow )
if(bIsCutAllowed)
{
- if(m_eChildFocus == DESCRIPTION)
- bIsCutAllowed = pDescrCell->GetSelected().Len() != 0;
- else if(m_eChildFocus == NAME)
- bIsCutAllowed = pNameCell->GetSelected().Len() != 0;
- else if(m_eChildFocus == ROW)
- // only rows are selected for cutting so we look if all rows are valid
- // wwe don't waant to copy empty rows here
- bIsCutAllowed = IsCopyAllowed(nRow);
- else
- bIsCutAllowed = sal_False;
+ switch(m_eChildFocus)
+ {
+ case DESCRIPTION:
+ bIsCutAllowed = pDescrCell->GetSelected().Len() != 0;
+ break;
+ case HELPTEXT:
+ bIsCutAllowed = pHelpTextCell->GetSelected().Len() != 0;
+ break;
+ case NAME:
+ bIsCutAllowed = pNameCell->GetSelected().Len() != 0;
+ break;
+ case ROW:
+ bIsCutAllowed = IsCopyAllowed(nRow);
+ break;
+ default:
+ bIsCutAllowed = sal_False;
+ break;
+ }
}
// Reference<XPropertySet> xTable = GetView()->getController().getTable();
@@ -1372,8 +1427,10 @@ sal_Bool OTableEditorCtrl::IsCopyAllowed( long /*nRow*/ )
{
DBG_CHKTHIS(OTableEditorCtrl,NULL);
sal_Bool bIsCopyAllowed = sal_False;
- if(m_eChildFocus == DESCRIPTION)
+ if(m_eChildFocus == DESCRIPTION )
bIsCopyAllowed = pDescrCell->GetSelected().Len() != 0;
+ else if(HELPTEXT == m_eChildFocus )
+ bIsCopyAllowed = pHelpTextCell->GetSelected().Len() != 0;
else if(m_eChildFocus == NAME)
bIsCopyAllowed = pNameCell->GetSelected().Len() != 0;
else if(m_eChildFocus == ROW)
@@ -1435,9 +1492,18 @@ void OTableEditorCtrl::cut()
{
if(GetView()->getController().isAlterAllowed())
{
- SaveData(-1,FIELD_DESCR);
+ SaveData(-1,COLUMN_DESCRIPTION);
pDescrCell->Cut();
- CellModified(-1,FIELD_DESCR);
+ CellModified(-1,COLUMN_DESCRIPTION);
+ }
+ }
+ else if(HELPTEXT == m_eChildFocus )
+ {
+ if(GetView()->getController().isAlterAllowed())
+ {
+ SaveData(-1,HELP_TEXT);
+ pHelpTextCell->Cut();
+ CellModified(-1,HELP_TEXT);
}
}
else if(m_eChildFocus == ROW)
@@ -1455,7 +1521,9 @@ void OTableEditorCtrl::copy()
OTableRowView::copy();
else if(m_eChildFocus == NAME)
pNameCell->Copy();
- else if(m_eChildFocus == DESCRIPTION)
+ else if(HELPTEXT == m_eChildFocus )
+ pHelpTextCell->Copy();
+ else if(m_eChildFocus == DESCRIPTION )
pDescrCell->Copy();
}
@@ -1477,6 +1545,14 @@ void OTableEditorCtrl::paste()
CellModified();
}
}
+ else if(HELPTEXT == m_eChildFocus )
+ {
+ if(GetView()->getController().isAlterAllowed())
+ {
+ pHelpTextCell->Paste();
+ CellModified();
+ }
+ }
else if(m_eChildFocus == DESCRIPTION)
{
if(GetView()->getController().isAlterAllowed())
@@ -1493,16 +1569,6 @@ sal_Bool OTableEditorCtrl::IsDeleteAllowed( long /*nRow*/ )
DBG_CHKTHIS(OTableEditorCtrl,NULL);
return GetSelectRowCount() != 0 && GetView()->getController().isDropAllowed();
-// Reference<XPropertySet> xTable = GetView()->getController().getTable();
-// if( !GetSelectRowCount() || (xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == ::rtl::OUString::createFromAscii("VIEW")))
-// return sal_False;
-//
-// // Wenn nur Felder hinzugefuegt werden duerfen, Delete nur auf neuen Feldern
-// Reference<XConnection> xCon = GetView()->getController().getConnection();
-// Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : NULL;
-//
-// return !(xTable.is() && xTable->getPropertySetInfo()->getPropertyByName(PROPERTY_NAME).Attributes & PropertyAttribute::READONLY) ||
-// ( xMetaData.is() && xMetaData->supportsAlterTableWithAddColumn() && xMetaData->supportsAlterTableWithDropColumn());
}
//------------------------------------------------------------------------------
@@ -1933,7 +1999,9 @@ long OTableEditorCtrl::PreNotify( NotifyEvent& rNEvt )
{
if (rNEvt.GetType() == EVENT_GETFOCUS)
{
- if( pDescrCell && pDescrCell->HasChildPathFocus() )
+ if( pHelpTextCell && pHelpTextCell->HasChildPathFocus() )
+ m_eChildFocus = HELPTEXT;
+ else if( pDescrCell && pDescrCell->HasChildPathFocus() )
m_eChildFocus = DESCRIPTION;
else if(pNameCell && pNameCell->HasChildPathFocus() )
m_eChildFocus = NAME;
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx
index 1b930af6aaba..2a7a36f3a051 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx
@@ -56,6 +56,7 @@ namespace dbaui
{
enum ChildFocusState
{
+ HELPTEXT,
DESCRIPTION,
NAME,
ROW,
@@ -67,6 +68,7 @@ namespace dbaui
OSQLNameEdit* pNameCell;
::svt::ListBoxControl* pTypeCell;
+ Edit* pHelpTextCell;
Edit* pDescrCell;
OTableFieldDescWin* pDescrWin; // properties of one column
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index e8f4ca9a0b99..542096508337 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -868,7 +868,7 @@ void OTableController::loadData()
sal_Int32 nAlign = 0;
sal_Bool bIsAutoIncrement = false, bIsCurrency = false;
- ::rtl::OUString sName,sDescription,sTypeName;
+ ::rtl::OUString sName,sDescription,sTypeName,sHelpText;
Any aControlDefault;
// get the properties from the column
@@ -880,10 +880,11 @@ void OTableController::loadData()
xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
xColumn->getPropertyValue(PROPERTY_SCALE) >>= nScale;
xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision;
-
+ xColumn->getPropertyValue(PROPERTY_DESCRIPTION) >>= sDescription;
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_HELPTEXT))
- xColumn->getPropertyValue(PROPERTY_HELPTEXT) >>= sDescription;
+ xColumn->getPropertyValue(PROPERTY_HELPTEXT) >>= sHelpText;
+
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
aControlDefault = xColumn->getPropertyValue(PROPERTY_CONTROLDEFAULT);
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
@@ -909,6 +910,7 @@ void OTableController::loadData()
pActFieldDescr->SetFormatKey(nFormatKey);
// pActFieldDescr->SetPrimaryKey(pPrimary->GetValue());
pActFieldDescr->SetDescription(sDescription);
+ pActFieldDescr->SetHelpText(sHelpText);
pActFieldDescr->SetAutoIncrement(bIsAutoIncrement);
pActFieldDescr->SetHorJustify(dbaui::mapTextJustify(nAlign));
pActFieldDescr->SetCurrency(bIsCurrency);
@@ -966,39 +968,7 @@ void OTableController::loadData()
// -----------------------------------------------------------------------------
Reference<XNameAccess> OTableController::getKeyColumns() const
{
- // use keys and indexes for excat postioning
- // first the keys
- Reference<XKeysSupplier> xKeySup(m_xTable,UNO_QUERY);
- Reference<XIndexAccess> xKeys;
- if(xKeySup.is())
- xKeys = xKeySup->getKeys();
-
- Reference<XColumnsSupplier> xKeyColsSup;
- Reference<XNameAccess> xKeyColumns;
- if(xKeys.is())
- {
- Reference<XPropertySet> xProp;
- sal_Int32 nCount = xKeys->getCount();
- for(sal_Int32 i=0;i< nCount;++i)
- {
- xKeys->getByIndex(i) >>= xProp;
- OSL_ENSURE(xProp.is(),"Key is invalid: NULL!");
- if ( xProp.is() )
- {
- sal_Int32 nKeyType = 0;
- xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
- if(KeyType::PRIMARY == nKeyType)
- {
- xKeyColsSup.set(xProp,UNO_QUERY);
- OSL_ENSURE(xKeyColsSup.is(),"Columnsupplier is null!");
- xKeyColumns = xKeyColsSup->getColumns();
- break;
- }
- }
- }
- }
-
- return xKeyColumns;
+ return getPrimaryKeyColumns_throw(m_xTable);
}
// -----------------------------------------------------------------------------
sal_Bool OTableController::checkColumns(sal_Bool _bNew) throw(::com::sun::star::sdbc::SQLException)
@@ -1117,13 +1087,14 @@ void OTableController::alterColumns()
sal_Int32 nType=0,nPrecision=0,nScale=0,nNullable=0;
sal_Bool bAutoIncrement = false;
- ::rtl::OUString sTypeName;
+ ::rtl::OUString sTypeName,sDescription;
xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision;
xColumn->getPropertyValue(PROPERTY_SCALE) >>= nScale;
xColumn->getPropertyValue(PROPERTY_ISNULLABLE) >>= nNullable;
xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT) >>= bAutoIncrement;
+ xColumn->getPropertyValue(PROPERTY_DESCRIPTION) >>= sDescription;
try { xColumn->getPropertyValue(PROPERTY_TYPENAME) >>= sTypeName; }
catch( const Exception& )
@@ -1142,6 +1113,7 @@ void OTableController::alterColumns()
(nPrecision != pField->GetPrecision() && nPrecision ) ||
nScale != pField->GetScale() ||
nNullable != pField->GetIsNullable() ||
+ sDescription != pField->GetDescription() ||
bAutoIncrement != pField->IsAutoIncrement())&&
xColumnFactory.is())
{
@@ -1261,7 +1233,8 @@ void OTableController::alterColumns()
xColumns->getByName(pField->GetName()) >>= xColumn;
Reference<XPropertySetInfo> xInfo = xColumn->getPropertySetInfo();
if ( xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
- xColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(pField->GetDescription()));
+ xColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(pField->GetHelpText()));
+
if(xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
xColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,pField->GetControlDefault());
if(xInfo->hasPropertyByName(PROPERTY_FORMATKEY))
diff --git a/dbaccess/source/ui/tabledesign/TableRow.cxx b/dbaccess/source/ui/tabledesign/TableRow.cxx
index 7130c081f209..33f358b6e408 100644
--- a/dbaccess/source/ui/tabledesign/TableRow.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRow.cxx
@@ -137,6 +137,7 @@ namespace dbaui
_rStr << (sal_Int32)1;
_rStr.WriteByteString(pFieldDesc->GetName());
_rStr.WriteByteString(pFieldDesc->GetDescription());
+ _rStr.WriteByteString(pFieldDesc->GetHelpText());
double nValue = 0.0;
Any aValue = pFieldDesc->GetControlDefault();
if ( aValue >>= nValue )
@@ -181,6 +182,8 @@ namespace dbaui
_rStr.ReadByteString(sValue);
pFieldDesc->SetDescription(sValue);
+ _rStr.ReadByteString(sValue);
+ pFieldDesc->SetHelpText(sValue);
_rStr >> nValue;
Any aControlDefault;
diff --git a/dbaccess/source/ui/tabledesign/table.src b/dbaccess/source/ui/tabledesign/table.src
index d40da4e3c358..e2a73292ec8d 100644
--- a/dbaccess/source/ui/tabledesign/table.src
+++ b/dbaccess/source/ui/tabledesign/table.src
@@ -103,10 +103,14 @@ String STR_TAB_FIELD_LENGTH
{
Text [ en-US ] = "Field length" ;
};
-String STR_TAB_FIELD_DESCR
+String STR_TAB_HELP_TEXT
{
Text [ en-US ] = "Description" ;
};
+String STR_COLUMN_DESCRIPTION
+{
+ Text [ en-US ] = "Column Description" ;
+};
String STR_TAB_FIELD_NULLABLE
{
Text [ en-US ] = "Input required" ;
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index 578b8fa55350..be1cf5288b21 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -258,6 +258,17 @@ namespace dbaui
sal_Int32& _out_rCommandType
) const;
+ /** extracts the result set to copy records from, and the selection-related aspects, if any.
+
+ Effectively, this method extracts m_xSourceResultSet, m_aSourceSelection, and m_bSourceSelectionBookmarks.
+
+ If an inconsistent/insufficent sub set of those properties is present in the descriptor, and exception
+ is thrown.
+ */
+ void impl_extractSourceResultSet_throw(
+ const Reference< XPropertySet >& i_rDescriptor
+ );
+
/** checks whether the given copy source descriptor contains settings which are not
supported (yet)
@@ -299,7 +310,7 @@ namespace dbaui
/** creates the INSERT INTO statement
@param _xTable The destination table.
*/
- ::rtl::OUString impl_getSelectStatement_nothrow(const Reference< XPropertySet >& _xTable);
+ ::rtl::OUString impl_getServerSideCopyStatement_throw( const Reference< XPropertySet >& _xTable );
/** creates the statement which, when executed, will produce the source data to copy
@@ -342,8 +353,9 @@ private:
sal_Int32 m_nCommandType;
::std::auto_ptr< ICopyTableSourceObject >
m_pSourceObject;
+ Reference< XResultSet > m_xSourceResultSet;
Sequence< Any > m_aSourceSelection;
- bool m_bSourceSelectionBookmarks;
+ sal_Bool m_bSourceSelectionBookmarks;
// destination
SharedConnection m_xDestConnection;
@@ -390,13 +402,13 @@ CopyTableWizard::CopyTableWizard( const Reference< XMultiServiceFactory >& _rxOR
,m_xSourceConnection()
,m_nCommandType( CommandType::COMMAND )
,m_pSourceObject()
+ ,m_xSourceResultSet()
,m_aSourceSelection()
- ,m_bSourceSelectionBookmarks( true )
+ ,m_bSourceSelectionBookmarks( sal_True )
,m_xDestConnection()
,m_aCopyTableListeners( m_aMutex )
,m_nOverrideExecutionResult( -1 )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::CopyTableWizard" );
}
//-------------------------------------------------------------------------
@@ -412,7 +424,7 @@ CopyTableWizard::~CopyTableWizard()
// TODO: shouldn't we have explicit disposal support? If a listener is registered
// at our instance, and perhaps holds this our instance by a hard ref, then we'll never
- // destroyed.
+ // be destroyed.
// However, adding XComponent support to the GenericUNODialog probably requires
// some thinking - would it break existing clients which do not call a dispose, then?
}
@@ -459,7 +471,6 @@ Reference< XPropertySetInfo > SAL_CALL CopyTableWizard::getPropertySetInfo() thr
//--------------------------------------------------------------------
::sal_Int16 SAL_CALL CopyTableWizard::getOperation() throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::getOperation" );
CopyTableAccessGuard aGuard( *this );
return m_nOperation;
}
@@ -467,7 +478,6 @@ Reference< XPropertySetInfo > SAL_CALL CopyTableWizard::getPropertySetInfo() thr
//--------------------------------------------------------------------
void SAL_CALL CopyTableWizard::setOperation( ::sal_Int16 _operation ) throw (IllegalArgumentException, RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::setOperation" );
CopyTableAccessGuard aGuard( *this );
if ( ( _operation != CopyTableOperation::CopyDefinitionAndData )
@@ -492,7 +502,6 @@ void SAL_CALL CopyTableWizard::setOperation( ::sal_Int16 _operation ) throw (Ill
//--------------------------------------------------------------------
::rtl::OUString SAL_CALL CopyTableWizard::getDestinationTableName() throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::getDestinationTableName" );
CopyTableAccessGuard aGuard( *this );
return m_sDestinationTable;
}
@@ -500,7 +509,6 @@ void SAL_CALL CopyTableWizard::setOperation( ::sal_Int16 _operation ) throw (Ill
//--------------------------------------------------------------------
void SAL_CALL CopyTableWizard::setDestinationTableName( const ::rtl::OUString& _destinationTableName ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::setDestinationTableName" );
CopyTableAccessGuard aGuard( *this );
m_sDestinationTable = _destinationTableName;
}
@@ -508,7 +516,6 @@ void SAL_CALL CopyTableWizard::setDestinationTableName( const ::rtl::OUString& _
//--------------------------------------------------------------------
Optional< ::rtl::OUString > SAL_CALL CopyTableWizard::getCreatePrimaryKey() throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::getCreatePrimaryKey" );
CopyTableAccessGuard aGuard( *this );
return m_aPrimaryKeyName;
}
@@ -516,7 +523,6 @@ Optional< ::rtl::OUString > SAL_CALL CopyTableWizard::getCreatePrimaryKey() thro
//--------------------------------------------------------------------
void SAL_CALL CopyTableWizard::setCreatePrimaryKey( const Optional< ::rtl::OUString >& _newPrimaryKey ) throw (IllegalArgumentException, RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::setCreatePrimaryKey" );
CopyTableAccessGuard aGuard( *this );
if ( _newPrimaryKey.IsPresent && !OCopyTableWizard::supportsPrimaryKey( m_xDestConnection ) )
@@ -543,7 +549,6 @@ void SAL_CALL CopyTableWizard::setUseHeaderLineAsColumnNames( sal_Bool _bUseHead
//--------------------------------------------------------------------
void SAL_CALL CopyTableWizard::addCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::addCopyTableListener" );
CopyTableAccessGuard aGuard( *this );
if ( _rxListener.is() )
m_aCopyTableListeners.addInterface( _rxListener );
@@ -552,7 +557,6 @@ void SAL_CALL CopyTableWizard::addCopyTableListener( const Reference< XCopyTable
//--------------------------------------------------------------------
void SAL_CALL CopyTableWizard::removeCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::removeCopyTableListener" );
CopyTableAccessGuard aGuard( *this );
if ( _rxListener.is() )
m_aCopyTableListeners.removeInterface( _rxListener );
@@ -561,7 +565,6 @@ void SAL_CALL CopyTableWizard::removeCopyTableListener( const Reference< XCopyTa
//--------------------------------------------------------------------
void SAL_CALL CopyTableWizard::setTitle( const ::rtl::OUString& _rTitle ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::setTitle" );
CopyTableAccessGuard aGuard( *this );
CopyTableWizard_DialogBase::setTitle( _rTitle );
}
@@ -569,7 +572,6 @@ void SAL_CALL CopyTableWizard::setTitle( const ::rtl::OUString& _rTitle ) throw
//--------------------------------------------------------------------
::sal_Int16 SAL_CALL CopyTableWizard::execute( ) throw (RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::execute" );
CopyTableAccessGuard aGuard( *this );
m_nOverrideExecutionResult = -1;
@@ -583,7 +585,6 @@ void SAL_CALL CopyTableWizard::setTitle( const ::rtl::OUString& _rTitle ) throw
//-------------------------------------------------------------------------
OCopyTableWizard& CopyTableWizard::impl_getDialog_throw()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_getDialog_throw" );
OCopyTableWizard* pWizard = dynamic_cast< OCopyTableWizard* >( m_pDialog );
if ( !pWizard )
throw DisposedException( ::rtl::OUString(), *this );
@@ -593,7 +594,6 @@ OCopyTableWizard& CopyTableWizard::impl_getDialog_throw()
//-------------------------------------------------------------------------
const OCopyTableWizard& CopyTableWizard::impl_getDialog_throw() const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_getDialog_throw" );
const OCopyTableWizard* pWizard = dynamic_cast< const OCopyTableWizard* >( m_pDialog );
if ( !pWizard )
throw DisposedException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) );
@@ -603,7 +603,6 @@ const OCopyTableWizard& CopyTableWizard::impl_getDialog_throw() const
//-------------------------------------------------------------------------
void CopyTableWizard::impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialog ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_attributesToDialog_nothrow" );
// primary key column
_rDialog.setCreatePrimaryKey( m_aPrimaryKeyName.IsPresent, m_aPrimaryKeyName.Value );
_rDialog.setUseHeaderLine(m_bUseHeaderLineAsColumnNames);
@@ -614,7 +613,6 @@ void CopyTableWizard::impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialo
//-------------------------------------------------------------------------
void CopyTableWizard::impl_dialogToAttributes_nothrow( const OCopyTableWizard& _rDialog )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_dialogToAttributes_nothrow" );
m_aPrimaryKeyName.IsPresent = _rDialog.shouldCreatePrimaryKey();
if ( m_aPrimaryKeyName.IsPresent )
m_aPrimaryKeyName.Value = _rDialog.getPrimaryKeyName();
@@ -689,7 +687,6 @@ Reference< XPropertySet > CopyTableWizard::impl_ensureDataAccessDescriptor_throw
const Sequence< Any >& _rAllArgs, const sal_Int16 _nArgPos, SharedConnection& _out_rxConnection,
InteractionHandler& _out_rxDocInteractionHandler ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_ensureDataAccessDescriptor_throw" );
Reference< XPropertySet > xDescriptor;
_rAllArgs[ _nArgPos ] >>= xDescriptor;
@@ -742,32 +739,19 @@ namespace
//-------------------------------------------------------------------------
void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< XPropertySet >& _rxSourceDescriptor ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_checkForUnsupportedSettings_throw" );
OSL_PRECOND( _rxSourceDescriptor.is(), "CopyTableWizard::impl_checkForUnsupportedSettings_throw: illegal argument!" );
Reference< XPropertySetInfo > xPSI( _rxSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW );
::rtl::OUString sUnsupportedSetting;
- // in theory, we could allow to use a mere result set as copy source. However, since this is currently
- // not implemented at all, we report this in the initialization phase already
- if ( xPSI->hasPropertyByName( PROPERTY_RESULT_SET ) )
- {
- Reference< XResultSet > xSource( _rxSourceDescriptor->getPropertyValue( PROPERTY_RESULT_SET ), UNO_QUERY );
- if ( xSource.is() )
- sUnsupportedSetting = PROPERTY_RESULT_SET;
- }
-
- if ( sUnsupportedSetting.getLength() == 0 )
+ const ::rtl::OUString aSettings[] = {
+ PROPERTY_FILTER, PROPERTY_ORDER, PROPERTY_HAVING_CLAUSE, PROPERTY_GROUP_BY
+ };
+ for ( size_t i=0; i < sizeof( aSettings ) / sizeof( aSettings[0] ); ++i )
{
- const ::rtl::OUString aSettings[] = {
- PROPERTY_FILTER, PROPERTY_ORDER, PROPERTY_HAVING_CLAUSE, PROPERTY_GROUP_BY
- };
- for ( size_t i=0; i < sizeof( aSettings ) / sizeof( aSettings[0] ); ++i )
+ if ( lcl_hasNonEmptyStringValue_throw( _rxSourceDescriptor, xPSI, aSettings[i] ) )
{
- if ( lcl_hasNonEmptyStringValue_throw( _rxSourceDescriptor, xPSI, aSettings[i] ) )
- {
- sUnsupportedSetting = aSettings[i];
- break;
- }
+ sUnsupportedSetting = aSettings[i];
+ break;
}
}
@@ -787,17 +771,15 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X
//-------------------------------------------------------------------------
::std::auto_ptr< ICopyTableSourceObject > CopyTableWizard::impl_extractSourceObject_throw( const Reference< XPropertySet >& _rxDescriptor, sal_Int32& _out_rCommandType ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_extractSourceObject_throw" );
OSL_PRECOND( _rxDescriptor.is() && m_xSourceConnection.is(), "CopyTableWizard::impl_extractSourceObject_throw: illegal arguments!" );
- impl_checkForUnsupportedSettings_throw( _rxDescriptor );
-
Reference< XPropertySetInfo > xPSI( _rxDescriptor->getPropertySetInfo(), UNO_SET_THROW );
if ( !xPSI->hasPropertyByName( PROPERTY_COMMAND )
|| !xPSI->hasPropertyByName( PROPERTY_COMMAND_TYPE )
)
throw IllegalArgumentException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Expecting a table or query specification." ) ),
+ // TODO: resource
*const_cast< CopyTableWizard* >( this ),
1
);
@@ -857,10 +839,48 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X
}
//-------------------------------------------------------------------------
+void CopyTableWizard::impl_extractSourceResultSet_throw( const Reference< XPropertySet >& i_rDescriptor )
+{
+ Reference< XPropertySetInfo > xPSI( i_rDescriptor->getPropertySetInfo(), UNO_SET_THROW );
+
+ // extract relevant settings
+ if ( xPSI->hasPropertyByName( PROPERTY_RESULT_SET ) )
+ m_xSourceResultSet.set( i_rDescriptor->getPropertyValue( PROPERTY_RESULT_SET ), UNO_QUERY );
+
+ if ( xPSI->hasPropertyByName( PROPERTY_SELECTION ) )
+ OSL_VERIFY( i_rDescriptor->getPropertyValue( PROPERTY_SELECTION ) >>= m_aSourceSelection );
+
+ if ( xPSI->hasPropertyByName( PROPERTY_BOOKMARK_SELECTION ) )
+ OSL_VERIFY( i_rDescriptor->getPropertyValue( PROPERTY_BOOKMARK_SELECTION ) >>= m_bSourceSelectionBookmarks );
+
+ // sanity checks
+ const bool bHasResultSet = m_xSourceResultSet.is();
+ const bool bHasSelection = ( m_aSourceSelection.getLength() != 0 );
+ if ( bHasSelection && !bHasResultSet )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "A result set is needed when specifying a selection to copy." ) ),
+ // TODO: resource
+ *this,
+ 1
+ );
+
+ if ( bHasSelection && m_bSourceSelectionBookmarks )
+ {
+ Reference< XRowLocate > xRowLocate( m_xSourceResultSet, UNO_QUERY );
+ if ( !xRowLocate.is() )
+ {
+ ::dbtools::throwGenericSQLException(
+ String( ModuleRes( STR_CTW_COPY_SOURCE_NEEDS_BOOKMARKS ) ),
+ *this
+ );
+ }
+ }
+}
+
+//-------------------------------------------------------------------------
SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< XPropertySet >& _rxDataSourceDescriptor,
InteractionHandler& _out_rxDocInteractionHandler ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_extractConnection_throw" );
SharedConnection xConnection;
OSL_PRECOND( _rxDataSourceDescriptor.is(), "CopyTableWizard::impl_extractConnection_throw: no descriptor!" );
@@ -954,7 +974,6 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference<
//-------------------------------------------------------------------------
::utl::SharedUNOComponent< XPreparedStatement > CopyTableWizard::impl_createSourceStatement_throw() const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_createSourceStatement_throw" );
OSL_PRECOND( m_xSourceConnection.is(), "CopyTableWizard::impl_createSourceStatement_throw: illegal call!" );
if ( !m_xSourceConnection.is() )
throw RuntimeException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) );
@@ -1059,7 +1078,6 @@ namespace
//-------------------------------------------------------------------------
bool CopyTableWizard::impl_processCopyError_nothrow( const CopyTableRowEvent& _rEvent )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_processCopyError_nothrow" );
Reference< XCopyTableListener > xListener;
try
{
@@ -1138,7 +1156,6 @@ bool CopyTableWizard::impl_processCopyError_nothrow( const CopyTableRowEvent& _r
void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSourceResultSet,
const Reference< XPropertySet >& _rxDestTable )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_copyRows_throw" );
OSL_PRECOND( m_xDestConnection.is(), "CopyTableWizard::impl_copyRows_throw: illegal call!" );
if ( !m_xDestConnection.is() )
throw RuntimeException( ::rtl::OUString(), *this );
@@ -1150,16 +1167,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
bool bAutoIncrement = rWizard.shouldCreatePrimaryKey();
Reference< XRow > xRow ( _rxSourceResultSet, UNO_QUERY_THROW );
- Reference< XRowLocate > xRowLocate ( _rxSourceResultSet, UNO_QUERY );
-
- bool bSelectedRecordsOnly = m_aSourceSelection.getLength() > 0;
- if ( bSelectedRecordsOnly && m_bSourceSelectionBookmarks && !xRowLocate.is() )
- {
- ::dbtools::throwGenericSQLException(
- String( ModuleRes( STR_CTW_COPY_SOURCE_NEEDS_BOOKMARKS ) ),
- *this
- );
- }
+ Reference< XRowLocate > xRowLocate ( _rxSourceResultSet, UNO_QUERY_THROW );
Reference< XResultSetMetaDataSupplier > xSuppResMeta( _rxSourceResultSet, UNO_QUERY_THROW );
Reference< XResultSetMetaData> xMeta( xSuppResMeta->getMetaData() );
@@ -1177,9 +1185,11 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
Reference< XPreparedStatement > xStatement( ODatabaseExport::createPreparedStatment( xDestMetaData, _rxDestTable, aColumnMapping ), UNO_SET_THROW );
Reference< XParameters > xStatementParams( xStatement, UNO_QUERY_THROW );
+ const bool bSelectedRecordsOnly = m_aSourceSelection.getLength() != 0;
+ const Any* pSelectedRow = m_aSourceSelection.getConstArray();
+ const Any* pSelEnd = pSelectedRow + m_aSourceSelection.getLength();
+
sal_Int32 nRowCount = 0;
- const Any* pSelectedRow = m_aSourceSelection.getConstArray();
- const Any* pSelEnd = pSelectedRow + m_aSourceSelection.getLength();
bool bContinue = false;
CopyTableRowEvent aCopyEvent;
@@ -1195,7 +1205,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
{
if ( m_bSourceSelectionBookmarks )
{
- xRowLocate->moveToBookmark( *pSelectedRow );
+ bContinue = xRowLocate->moveToBookmark( *pSelectedRow );
}
else
{
@@ -1355,7 +1365,6 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
//-------------------------------------------------------------------------
void CopyTableWizard::impl_doCopy_nothrow()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::impl_doCopy_nothrow" );
Any aError;
try
@@ -1396,26 +1405,41 @@ void CopyTableWizard::impl_doCopy_nothrow()
}
}
- bool bServerCopy = CommandType::TABLE == m_nCommandType && m_xSourceConnection.getTyped() == m_xDestConnection.getTyped() && !m_aSourceSelection.getLength();
- try
+ ::utl::SharedUNOComponent< XPreparedStatement > xSourceStatement;
+ ::utl::SharedUNOComponent< XResultSet > xSourceResultSet;
+
+ if ( m_xSourceResultSet.is() )
{
- if ( bServerCopy )
- {
- m_xDestConnection->createStatement()->executeUpdate( impl_getSelectStatement_nothrow(xTable) );
- }
+ xSourceResultSet.reset( m_xSourceResultSet, ::utl::SharedUNOComponent< XResultSet >::NoTakeOwnership );
}
- catch( const Exception& e )
+ else
{
- (void)e;
- bServerCopy = false;
+ const bool bIsSameConnection = ( m_xSourceConnection.getTyped() == m_xDestConnection.getTyped() );
+ const bool bIsTable = ( CommandType::TABLE == m_nCommandType );
+ bool bDone = false;
+ if ( bIsSameConnection && bIsTable )
+ {
+ // try whether the server supports copying via SQL
+ try
+ {
+ m_xDestConnection->createStatement()->executeUpdate( impl_getServerSideCopyStatement_throw(xTable) );
+ bDone = true;
+ }
+ catch( const Exception& )
+ {
+ // this is allowed.
+ }
+ }
+
+ if ( !bDone )
+ {
+ xSourceStatement.set( impl_createSourceStatement_throw(), UNO_SET_THROW );
+ xSourceResultSet.set( xSourceStatement->executeQuery(), UNO_SET_THROW );
+ }
}
- if ( !bServerCopy )
- {
- ::utl::SharedUNOComponent< XPreparedStatement > xStatement( impl_createSourceStatement_throw(), UNO_SET_THROW );
- Reference< XResultSet > xSourceResultSet( xStatement->executeQuery() );
+ if ( xSourceResultSet.is() )
impl_copyRows_throw( xSourceResultSet, xTable );
- }
}
break;
@@ -1455,7 +1479,7 @@ void CopyTableWizard::impl_doCopy_nothrow()
}
}
// -----------------------------------------------------------------------------
-::rtl::OUString CopyTableWizard::impl_getSelectStatement_nothrow(const Reference< XPropertySet >& _xTable)
+::rtl::OUString CopyTableWizard::impl_getServerSideCopyStatement_throw(const Reference< XPropertySet >& _xTable)
{
const Reference<XColumnsSupplier> xDestColsSup(_xTable,UNO_QUERY_THROW);
const Sequence< ::rtl::OUString> aDestColumnNames = xDestColsSup->getColumns()->getElementNames();
@@ -1493,7 +1517,6 @@ void CopyTableWizard::impl_doCopy_nothrow()
//-------------------------------------------------------------------------
void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::initialize" );
::osl::MutexGuard aGuard( m_aMutex );
if ( isInitialized() )
throw AlreadyInitializedException( ::rtl::OUString(), *this );
@@ -1522,7 +1545,9 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments )
InteractionHandler xSourceDocHandler;
Reference< XPropertySet > xSourceDescriptor( impl_ensureDataAccessDescriptor_throw( _rArguments, 0, m_xSourceConnection, xSourceDocHandler ) );
+ impl_checkForUnsupportedSettings_throw( xSourceDescriptor );
m_pSourceObject = impl_extractSourceObject_throw( xSourceDescriptor, m_nCommandType );
+ impl_extractSourceResultSet_throw( xSourceDescriptor );
InteractionHandler xDestDocHandler;
impl_ensureDataAccessDescriptor_throw( _rArguments, 1, m_xDestConnection, xDestDocHandler );
@@ -1546,14 +1571,12 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments )
//-------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& CopyTableWizard::getInfoHelper()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::getInfoHelper" );
return *getArrayHelper();
}
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* CopyTableWizard::createArrayHelper( ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::createArrayHelper" );
Sequence< Property > aProps;
describeProperties( aProps );
return new ::cppu::OPropertyArrayHelper( aProps );
@@ -1562,7 +1585,6 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments )
//------------------------------------------------------------------------------
Dialog* CopyTableWizard::createDialog( Window* _pParent )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::createDialog" );
OSL_PRECOND( isInitialized(), "CopyTableWizard::createDialog: not initialized!" );
// this should have been prevented in ::execute already
@@ -1585,7 +1607,6 @@ Dialog* CopyTableWizard::createDialog( Window* _pParent )
//------------------------------------------------------------------------------
void CopyTableWizard::executedDialog( sal_Int16 _nExecutionResult )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "uno", "Ocke.Janssen@sun.com", "CopyTableWizard::executedDialog" );
CopyTableWizard_DialogBase::executedDialog( _nExecutionResult );
if ( _nExecutionResult == RET_OK )