summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOcke Janssen [oj] <Ocke.Janssen@sun.com>2010-02-11 07:55:30 +0100
committerOcke Janssen [oj] <Ocke.Janssen@sun.com>2010-02-11 07:55:30 +0100
commit55aca7c428f0e9ee71a42d773d7df9036b4c8210 (patch)
treeb878ae289c8a4dbea20bd71d38ade6eb018a12d2
parent66a73b89dffcc55836e4da5f0d9450d89d692a07 (diff)
parentdf47580367cd8a021233ef23ab9b0e1d65b54d83 (diff)
automated merge from dba33e
-rw-r--r--dbaccess/inc/dbaccess_helpid.hrc2
-rw-r--r--dbaccess/qa/complex/dbaccess/DatabaseDocument.java2
-rwxr-xr-xdbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java2
-rw-r--r--dbaccess/source/core/api/BookmarkSet.cxx4
-rw-r--r--dbaccess/source/core/api/BookmarkSet.hxx2
-rw-r--r--dbaccess/source/core/api/CRowSetColumn.cxx4
-rw-r--r--dbaccess/source/core/api/CRowSetColumn.hxx1
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.cxx4
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.hxx2
-rw-r--r--dbaccess/source/core/api/CacheSet.cxx2
-rw-r--r--dbaccess/source/core/api/CacheSet.hxx2
-rw-r--r--dbaccess/source/core/api/KeySet.cxx94
-rw-r--r--dbaccess/source/core/api/KeySet.hxx8
-rw-r--r--dbaccess/source/core/api/RowSet.cxx89
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx15
-rw-r--r--dbaccess/source/core/api/RowSetCache.hxx3
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx230
-rw-r--r--dbaccess/source/core/api/definitioncolumn.cxx14
-rw-r--r--dbaccess/source/core/api/query.cxx26
-rw-r--r--dbaccess/source/core/api/querycomposer.cxx19
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx1
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx1
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx8
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.hxx2
-rw-r--r--dbaccess/source/core/inc/SingleSelectQueryComposer.hxx12
-rw-r--r--dbaccess/source/core/inc/definitioncolumn.hxx3
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx6
-rw-r--r--dbaccess/source/inc/dsntypes.hxx3
-rw-r--r--dbaccess/source/inc/stringconstants.hrc2
-rw-r--r--dbaccess/source/inc/stringconstants.inc1
-rw-r--r--dbaccess/source/ui/app/AppController.cxx2
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx148
-rw-r--r--dbaccess/source/ui/browser/dbexchange.cxx222
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx25
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx15
-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/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/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/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.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx124
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx2
-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.cxx15
-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
-rw-r--r--dbaccess/util/hidother.src2
-rw-r--r--reportdesign/source/core/api/Section.cxx2
-rw-r--r--reportdesign/source/filter/xml/xmlGroup.cxx4
-rw-r--r--reportdesign/source/ui/dlg/AddField.cxx57
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.cxx49
-rw-r--r--reportdesign/source/ui/inc/ColumnInfo.hxx57
-rw-r--r--reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx1
-rw-r--r--reportdesign/source/ui/inc/GroupsSorting.hxx1
-rw-r--r--reportdesign/source/ui/inc/ReportController.hxx5
-rw-r--r--reportdesign/source/ui/report/FormattedFieldBeautifier.cxx50
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx35
-rw-r--r--reportdesign/source/ui/report/SectionWindow.cxx19
74 files changed, 1417 insertions, 823 deletions
diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc
index ec30ff3d3d1d..9ca34ebc9eae 100644
--- a/dbaccess/inc/dbaccess_helpid.hrc
+++ b/dbaccess/inc/dbaccess_helpid.hrc
@@ -330,7 +330,7 @@
#define HID_APP_VIEW_PREVIEW_CB (HID_DBACCESS_START + 276)
#define HID_APP_VIEW_PREVIEW_1 (HID_DBACCESS_START + 277)
#define HID_APP_VIEW_PREVIEW_2 (HID_DBACCESS_START + 278)
-// free
+#define HID_TABDESIGN_HELPTEXT (HID_DBACCESS_START + 279)
#define UID_APP_VIEW_HORZ_SPLIT (HID_DBACCESS_START + 280)
#define UID_APP_VIEW_PREVIEW_1 (HID_DBACCESS_START + 281)
#define HID_APP_VIEW_PREVIEW_3 (HID_DBACCESS_START + 282)
diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
index 8ce063bcdb2a..abb34aa5b05f 100644
--- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
+++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
@@ -842,8 +842,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
final String otherURL = copyToTempFile(databaseDoc.getURL());
final XModel otherDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
loader.loadComponentFromURL(otherURL, _BLANK, 0, impl_getDefaultLoadArgs()));
- impl_waitForEvent(m_globalEvents, "OnLoad", 5000, previousOnLoadEventPos + 1);
impl_raise(otherDoc);
+ impl_waitForEvent(m_globalEvents, "OnLoad", 5000, previousOnLoadEventPos + 1);
// ... and switch between the two
impl_startObservingEvents(context);
diff --git a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
index 7b0aed460dc8..40ce60699c05 100755
--- a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
+++ b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
@@ -263,7 +263,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
filter.addProperty("Type", PropertyAttribute.MAYBEVOID, Integer.valueOf(DataType.LONGVARCHAR));
final XPropertySet column = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,filter);
- m_composer.appendFilterByColumn(column, true);
+ m_composer.appendFilterByColumn(column, true,SQLFilterOperator.LIKE);
assure("At least one row should exist",m_database.getConnection().createStatement().executeQuery(m_composer.getQuery()).next());
}
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx
index 127ee83aaf2c..4f8a97604e57 100644
--- a/dbaccess/source/core/api/BookmarkSet.cxx
+++ b/dbaccess/source/core/api/BookmarkSet.cxx
@@ -62,10 +62,10 @@ using namespace ::com::sun::star::lang;
// using namespace ::cppu;
using namespace ::osl;
-void OBookmarkSet::construct(const Reference< XResultSet>& _xDriverSet)
+void OBookmarkSet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OBookmarkSet::construct" );
- OCacheSet::construct(_xDriverSet);
+ OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
m_xRowLocate.set(_xDriverSet,UNO_QUERY);
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/core/api/BookmarkSet.hxx b/dbaccess/source/core/api/BookmarkSet.hxx
index 4204afd59827..3433e0a5ea6b 100644
--- a/dbaccess/source/core/api/BookmarkSet.hxx
+++ b/dbaccess/source/core/api/BookmarkSet.hxx
@@ -54,7 +54,7 @@ namespace dbaccess
m_xRowLocate = NULL;
}
- virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
+ virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter);
virtual void fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition);
// ::com::sun::star::sdbcx::XRowLocate
virtual ::com::sun::star::uno::Any SAL_CALL getBookmark() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/api/CRowSetColumn.cxx b/dbaccess/source/core/api/CRowSetColumn.cxx
index 0974963dfd72..20e3c639eb88 100644
--- a/dbaccess/source/core/api/CRowSetColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetColumn.cxx
@@ -53,8 +53,8 @@ namespace dbaccess
//------------------------------------------------------------------------------
ORowSetColumn::ORowSetColumn( const Reference < XResultSetMetaData >& _xMetaData, const Reference < XRow >& _xRow, sal_Int32 _nPos,
- const Reference< XDatabaseMetaData >& _rxDBMeta, const ::rtl::OUString& _rDescription, ORowSetCacheIterator& _rColumnValue )
- :ORowSetDataColumn( _xMetaData, _xRow, NULL, _nPos, _rxDBMeta, _rDescription, _rColumnValue )
+ const Reference< XDatabaseMetaData >& _rxDBMeta, const ::rtl::OUString& _rDescription, const ::rtl::OUString& i_sLabel,ORowSetCacheIterator& _rColumnValue )
+ :ORowSetDataColumn( _xMetaData, _xRow, NULL, _nPos, _rxDBMeta, _rDescription, i_sLabel,_rColumnValue )
{
}
diff --git a/dbaccess/source/core/api/CRowSetColumn.hxx b/dbaccess/source/core/api/CRowSetColumn.hxx
index 45d71d8e513a..317a28f15db1 100644
--- a/dbaccess/source/core/api/CRowSetColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetColumn.hxx
@@ -56,6 +56,7 @@ namespace dbaccess
sal_Int32 _nPos,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMeta,
const ::rtl::OUString& _rDescription,
+ const ::rtl::OUString& i_sLabel,
ORowSetCacheIterator& _rColumnValue);
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.cxx b/dbaccess/source/core/api/CRowSetDataColumn.cxx
index ae78b8af7817..4b1c3649bf6a 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.cxx
@@ -74,9 +74,11 @@ ORowSetDataColumn::ORowSetDataColumn( const Reference < XResultSetMetaData >&
sal_Int32 _nPos,
const Reference< XDatabaseMetaData >& _rxDBMeta,
const ::rtl::OUString& _rDescription,
+ const ::rtl::OUString& i_sLabel,
const ORowSetCacheIterator& _rColumnValue)
:ODataColumn(_xMetaData,_xRow,_xRowUpdate,_nPos,_rxDBMeta)
,m_aColumnValue(_rColumnValue)
+ ,m_sLabel(i_sLabel)
,m_aDescription(_rDescription)
{
DBG_CTOR(ORowSetDataColumn,NULL);
@@ -149,6 +151,8 @@ void SAL_CALL ORowSetDataColumn::getFastPropertyValue( Any& rValue, sal_Int32 nH
rValue = ((*m_aColumnValue)->get())[m_nPos].makeAny();
}
}
+ else if ( PROPERTY_ID_LABEL == nHandle && m_sLabel.getLength() )
+ rValue <<= m_sLabel;
else
ODataColumn::getFastPropertyValue( rValue, nHandle );
}
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.hxx b/dbaccess/source/core/api/CRowSetDataColumn.hxx
index ceec7344737c..f6a3446755df 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.hxx
@@ -51,6 +51,7 @@ namespace dbaccess
ORowSetCacheIterator m_aColumnValue;
::com::sun::star::uno::Any m_aOldValue;
+ ::rtl::OUString m_sLabel;
::rtl::OUString m_aDescription; // description
ORowSetBase* m_pRowSet;
@@ -62,6 +63,7 @@ namespace dbaccess
sal_Int32 _nPos,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMeta,
const ::rtl::OUString& _rDescription,
+ const ::rtl::OUString& i_sLabel,
const ORowSetCacheIterator& _rColumnValue);
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index f7be322caa1a..cdff43ca52af 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -129,7 +129,7 @@ OCacheSet::OCacheSet()
return sQuote;
}
// -------------------------------------------------------------------------
-void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet)
+void OCacheSet::construct( const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& /*i_sRowSetFilter*/)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OCacheSet::construct" );
OSL_ENSURE(_xDriverSet.is(),"Invalid resultSet");
diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx
index 057c843fe871..e0fcf981f2ba 100644
--- a/dbaccess/source/core/api/CacheSet.hxx
+++ b/dbaccess/source/core/api/CacheSet.hxx
@@ -110,7 +110,7 @@ namespace dbaccess
public:
// late constructor
- virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
+ virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter);
virtual void fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition);
// ::com::sun::star::sdbc::XRow
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index c4fa68b12505..193aef7e8e77 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -162,6 +162,7 @@ OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
:m_aParameterValueForCache(_aParameterValueForCache)
,m_pKeyColumnNames(NULL)
,m_pColumnNames(NULL)
+ ,m_pParameterNames(NULL)
,m_pForeignColumnNames(NULL)
,m_xTable(_xTable)
,m_xTableKeys(_xTableKeys)
@@ -191,26 +192,40 @@ OKeySet::~OKeySet()
m_xComposer = NULL;
delete m_pKeyColumnNames;
delete m_pColumnNames;
+ delete m_pParameterNames;
delete m_pForeignColumnNames;
DBG_DTOR(OKeySet,NULL);
}
// -----------------------------------------------------------------------------
-void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
+void OKeySet::construct(const Reference< XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::construct" );
- OCacheSet::construct(_xDriverSet);
+ OCacheSet::construct(_xDriverSet,i_sRowSetFilter);
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
bool bCase = (xMeta.is() && xMeta->storesMixedCaseQuotedIdentifiers()) ? true : false;
- m_pKeyColumnNames = new SelectColumnsMetaData(bCase);
- m_pColumnNames = new SelectColumnsMetaData(bCase);
- m_pForeignColumnNames = new SelectColumnsMetaData(bCase);
+ m_pKeyColumnNames = new SelectColumnsMetaData(bCase);
+ m_pColumnNames = new SelectColumnsMetaData(bCase);
+ m_pParameterNames = new SelectColumnsMetaData(bCase);
+ m_pForeignColumnNames = new SelectColumnsMetaData(bCase);
Reference<XNameAccess> xKeyColumns = getKeyColumns();
Reference<XColumnsSupplier> xSup(m_xComposer,UNO_QUERY);
Reference<XNameAccess> xSourceColumns = m_xTable->getColumns();
+ // locate parameter in select columns
+ Reference<XParametersSupplier> xParaSup(m_xComposer,UNO_QUERY);
+ Reference<XIndexAccess> xQueryParameters = xParaSup->getParameters();
+ const sal_Int32 nParaCount = xQueryParameters->getCount();
+ Sequence< ::rtl::OUString> aParameterColumns(nParaCount);
+ for(sal_Int32 i = 0; i< nParaCount;++i)
+ {
+ Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW);
+ xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i];
+ }
+
+
::rtl::OUString sCatalog,sSchema,sTable;
Reference<XPropertySet> xTableProp(m_xTable,UNO_QUERY);
@@ -238,6 +253,8 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
::dbaccess::getColumnPositions(xSup->getColumns(),aBestColumnNames,m_sUpdateTableName,(*m_pKeyColumnNames));
::dbaccess::getColumnPositions(xSup->getColumns(),xSourceColumns->getElementNames(),m_sUpdateTableName,(*m_pColumnNames));
+ ::dbaccess::getColumnPositions(xSup->getColumns(),aParameterColumns,m_sUpdateTableName,(*m_pParameterNames));
+
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
@@ -284,9 +301,10 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
aFilter.append(aAnd);
}
+ Reference< XSingleSelectQueryComposer> xSourceComposer(m_xComposer,UNO_QUERY);
Reference< XMultiServiceFactory > xFactory(m_xConnection, UNO_QUERY_THROW);
Reference<XSingleSelectQueryComposer> xAnalyzer(xFactory->createInstance(SERVICE_NAME_SINGLESELECTQUERYCOMPOSER),UNO_QUERY);
- xAnalyzer->setQuery(m_xComposer->getQuery());
+ xAnalyzer->setElementaryQuery(xSourceComposer->getElementaryQuery());
Reference<XTablesSupplier> xTabSup(xAnalyzer,uno::UNO_QUERY);
Reference<XNameAccess> xSelectTables(xTabSup->getTables(),uno::UNO_QUERY);
const Sequence< ::rtl::OUString> aSeq = xSelectTables->getElementNames();
@@ -323,11 +341,11 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet)
}
}
} // if ( aSeq.getLength() > 1 ) // special handling for join
- const ::rtl::OUString sOldFilter = xAnalyzer->getFilter();
- if ( sOldFilter.getLength() )
+ //const ::rtl::OUString sOldFilter = xAnalyzer->getFilter();
+ if ( i_sRowSetFilter.getLength() )
{
FilterCreator aFilterCreator;
- aFilterCreator.append( sOldFilter );
+ aFilterCreator.append( i_sRowSetFilter );
aFilterCreator.append( aFilter.makeStringAndClear() );
aFilter = aFilterCreator.getComposedAndClear();
}
@@ -624,10 +642,10 @@ void SAL_CALL OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow
m_bUpdated = xPrep->executeUpdate() > 0;
if(m_bUpdated)
{
- m_aKeyIter = m_aKeyMap.find(::comphelper::getINT32((_rInsertRow->get())[0].getAny()));
- OSL_ENSURE(m_aKeyIter != m_aKeyMap.end(),"New inserted row not found!");
+ const sal_Int32 nBookmark = ::comphelper::getINT32((_rInsertRow->get())[0].getAny());
+ m_aKeyIter = m_aKeyMap.find(nBookmark);
m_aKeyIter->second.second = 2;
- copyRowValue(_rInsertRow,m_aKeyIter->second.first);
+ copyRowValue(_rInsertRow,m_aKeyIter->second.first,nBookmark);
}
}
// -------------------------------------------------------------------------
@@ -788,21 +806,47 @@ void SAL_CALL OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivi
}
if ( m_bInserted )
{
- ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >((*m_pKeyColumnNames).size());
- copyRowValue(_rInsertRow,aKeyRow);
-
OKeySetMatrix::iterator aKeyIter = m_aKeyMap.end();
--aKeyIter;
+ ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >((*m_pKeyColumnNames).size());
+ copyRowValue(_rInsertRow,aKeyRow,aKeyIter->first + 1);
+
m_aKeyIter = m_aKeyMap.insert(OKeySetMatrix::value_type(aKeyIter->first + 1,OKeySetValue(aKeyRow,1))).first;
// now we set the bookmark for this row
(_rInsertRow->get())[0] = makeAny((sal_Int32)m_aKeyIter->first);
}
}
// -----------------------------------------------------------------------------
-void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow)
+void OKeySet::copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sal_Int32 i_nBookmark)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OKeySet::copyRowValue" );
connectivity::ORowVector< ORowSetValue >::Vector::iterator aIter = _rKeyRow->get().begin();
+
+ // check the if the parameter values have been changed
+ OSL_ENSURE((m_aParameterValueForCache.get().size()-1) == m_pParameterNames->size(),"OKeySet::copyRowValue: Parameter values and names differ!");
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaValuesIter = m_aParameterValueForCache.get().begin() +1;
+
+ bool bChanged = false;
+ SelectColumnsMetaData::const_iterator aParaIter = (*m_pParameterNames).begin();
+ SelectColumnsMetaData::const_iterator aParaEnd = (*m_pParameterNames).end();
+ for(sal_Int32 i = 1;aParaIter != aParaEnd;++aParaIter,++aParaValuesIter,++i)
+ {
+ ORowSetValue aValue(*aParaValuesIter);
+ aValue.setSigned(m_aSignedFlags[aParaIter->second.nPosition]);
+ if ( (_rInsertRow->get())[aParaIter->second.nPosition] != aValue )
+ {
+ ORowSetValueVector aCopy(m_aParameterValueForCache);
+ (aCopy.get())[i] = (_rInsertRow->get())[aParaIter->second.nPosition];
+ m_aUpdatedParameter[i_nBookmark] = aCopy;
+ bChanged = true;
+ }
+ }
+ if ( !bChanged )
+ {
+ m_aUpdatedParameter.erase(i_nBookmark);
+ }
+
+ // update the key values
SelectColumnsMetaData::const_iterator aPosIter = (*m_pKeyColumnNames).begin();
SelectColumnsMetaData::const_iterator aPosEnd = (*m_pKeyColumnNames).end();
for(;aPosIter != aPosEnd;++aPosIter,++aIter)
@@ -1152,9 +1196,23 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException)
Reference< XParameters > xParameter(m_xStatement,UNO_QUERY);
OSL_ENSURE(xParameter.is(),"No Parameter interface!");
xParameter->clearParameters();
+
sal_Int32 nPos=1;
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaIter = m_aParameterValueForCache.get().begin();
- connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd = m_aParameterValueForCache.get().end();
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaIter;
+ connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aParaEnd;
+ OUpdatedParameter::iterator aUpdateFind = m_aUpdatedParameter.find(m_aKeyIter->first);
+ if ( aUpdateFind == m_aUpdatedParameter.end() )
+ {
+
+ aParaIter = m_aParameterValueForCache.get().begin();
+ aParaEnd = m_aParameterValueForCache.get().end();
+ }
+ else
+ {
+ aParaIter = aUpdateFind->second.get().begin();
+ aParaEnd = aUpdateFind->second.get().end();
+ }
+
for(++aParaIter;aParaIter != aParaEnd;++aParaIter,++nPos)
{
::dbtools::setObjectWithInfo( xParameter, nPos, aParaIter->makeAny(), aParaIter->getTypeKind() );
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 3a73487c2c3d..7db5c176e9ff 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -89,6 +89,7 @@ namespace dbaccess
typedef ::std::pair<ORowSetRow,sal_Int32> OKeySetValue;
typedef ::std::map<sal_Int32,OKeySetValue > OKeySetMatrix;
+ typedef ::std::map<sal_Int32,ORowSetValueVector > OUpdatedParameter;
// is used when the source supports keys
class OKeySet : public OCacheSet
{
@@ -97,9 +98,11 @@ namespace dbaccess
::std::vector< ::rtl::OUString > m_aAutoColumns; // contains all columns which are autoincrement ones
+ OUpdatedParameter m_aUpdatedParameter; // contains all parameter which have been updated and are needed for refetching
ORowSetValueVector m_aParameterValueForCache;
SelectColumnsMetaData* m_pKeyColumnNames; // contains all key column names
SelectColumnsMetaData* m_pColumnNames; // contains all column names
+ SelectColumnsMetaData* m_pParameterNames; // contains all parameter names
SelectColumnsMetaData* m_pForeignColumnNames; // contains all column names of the rest
connectivity::OSQLTable m_xTable; // reference to our table
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xTableKeys;
@@ -128,8 +131,9 @@ namespace dbaccess
*
* \param _rInsertRow the row which was inserted
* \param _rKeyRow The current key row of the row set.
+ + \param i_nBookmark The bookmark is used to update the parameter
*/
- void copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow);
+ void copyRowValue(const ORowSetRow& _rInsertRow,ORowSetRow& _rKeyRow,sal_Int32 i_nBookmark);
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getKeyColumns() const;
void fillAllRows();
@@ -146,7 +150,7 @@ namespace dbaccess
const ORowSetValueVector& _aParameterValueForCache);
// late ctor which can throw exceptions
- virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet);
+ virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter);
// ::com::sun::star::sdbc::XRow
virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 617ecbfdfe59..1531f232e5e7 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -201,6 +201,7 @@ ORowSet::ORowSet( const Reference< ::com::sun::star::lang::XMultiServiceFactory
registerProperty(PROPERTY_PRIVILEGES, PROPERTY_ID_PRIVILEGES, nRT, &m_nPrivileges, ::getCppuType(reinterpret_cast< sal_Int32*>(NULL)));
registerProperty(PROPERTY_ISMODIFIED, PROPERTY_ID_ISMODIFIED, nBT, &m_bModified, ::getBooleanCppuType());
registerProperty(PROPERTY_ISNEW, PROPERTY_ID_ISNEW, nRBT, &m_bNew, ::getBooleanCppuType());
+ registerProperty(PROPERTY_SINGLESELECTQUERYCOMPOSER,PROPERTY_ID_SINGLESELECTQUERYCOMPOSER, nRT, &m_xComposer, ::getCppuType(reinterpret_cast< Reference< XSingleSelectQueryComposer >* >(NULL)));
// sdbcx.ResultSet Properties
registerProperty(PROPERTY_ISBOOKMARKABLE, PROPERTY_ID_ISBOOKMARKABLE, nRT, &m_bIsBookmarable, ::getBooleanCppuType());
@@ -993,7 +994,7 @@ void SAL_CALL ORowSet::updateRow( ) throw(SQLException, RuntimeException)
fireProperty(PROPERTY_ID_ISMODIFIED,sal_False,sal_True);
OSL_ENSURE( !m_bModified, "ORowSet::updateRow: just updated, but _still_ modified?" );
}
- else // the update went rong
+ else if ( !m_bAfterLast ) // the update went rong
{
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_UPDATE_FAILED ), SQL_INVALID_CURSOR_POSITION, *this );
}
@@ -1778,7 +1779,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "frank.schoenheit@sun.com", "ORowSet::execute_NoApprove_NoNewConn: creating cache" );
- m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache );
+ m_pCache = new ORowSetCache( xResultSet, m_xComposer.get(), m_aContext, aComposedUpdateTableName, m_bModified, m_bNew,m_aParameterValueForCache,m_aFilter );
if ( m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
{
m_nPrivileges = Privilege::SELECT;
@@ -1842,6 +1843,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
i+1,
m_xActiveConnection->getMetaData(),
aDescription,
+ ::rtl::OUString(),
m_aCurrentRow);
aColumnMap.insert(StringMap::value_type(sName,0));
aColumns->get().push_back(pColumn);
@@ -1900,6 +1902,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
{
xColumn = NULL;
bReFetchName = sal_True;
+ sColumnLabel = ::rtl::OUString();
}
if(!xColumn.is())
{
@@ -1931,14 +1934,22 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
if(xInfo.is() && xInfo->hasPropertyByName(PROPERTY_DESCRIPTION))
aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION));
+ ::rtl::OUString sParseLabel;
+ if ( xColumn.is() )
+ {
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sParseLabel;
+ }
ORowSetDataColumn* pColumn = new ORowSetDataColumn( getMetaData(),
this,
this,
i,
m_xActiveConnection->getMetaData(),
aDescription,
+ sParseLabel,
m_aCurrentRow);
aColumns->get().push_back(pColumn);
+
+
if(!sColumnLabel.getLength())
{
if(xColumn.is())
@@ -2225,7 +2236,8 @@ sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecu
if ( !m_xComposer.is() )
m_xComposer = new OSingleSelectQueryComposer( impl_getTables_throw(), m_xActiveConnection, m_aContext );
- m_xComposer->setElementaryQuery( m_aActiveCommand );
+ m_xComposer->setCommand( m_aCommand,m_nCommandType );
+ m_aActiveCommand = m_xComposer->getQuery();
m_xComposer->setFilter( m_bApplyFilter ? m_aFilter : ::rtl::OUString() );
m_xComposer->setHavingClause( m_bApplyFilter ? m_aHavingClause : ::rtl::OUString() );
@@ -2251,6 +2263,7 @@ sal_Bool ORowSet::impl_initComposer_throw( ::rtl::OUString& _out_rCommandToExecu
impl_initParametersContainer_nothrow();
_out_rCommandToExecute = m_xComposer->getQueryWithSubstitution();
+
return bUseEscapeProcessing;
}
@@ -2273,41 +2286,52 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw()
case CommandType::TABLE:
{
impl_resetTables_nothrow();
-
- Reference< XNameAccess > xTables( impl_getTables_throw() );
- if ( xTables->hasByName(m_aCommand) )
+ if ( bDoEscapeProcessing )
{
- Reference< XPropertySet > xTable;
- try
+ Reference< XNameAccess > xTables( impl_getTables_throw() );
+ if ( xTables->hasByName(m_aCommand) )
{
- xTables->getByName( m_aCommand ) >>= xTable;
- }
- catch(const WrappedTargetException& e)
- {
- SQLException e2;
- if ( e.TargetException >>= e2 )
- throw e2;
+/*
+ Reference< XPropertySet > xTable;
+ try
+ {
+ xTables->getByName( m_aCommand ) >>= xTable;
+ }
+ catch(const WrappedTargetException& e)
+ {
+ SQLException e2;
+ if ( e.TargetException >>= e2 )
+ throw e2;
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ Reference<XColumnsSupplier> xSup(xTable,UNO_QUERY);
+ if ( xSup.is() )
+ m_xColumns = xSup->getColumns();
+
+ sCommand = rtl::OUString::createFromAscii("SELECT * FROM ");
+ ::rtl::OUString sCatalog, sSchema, sTable;
+ ::dbtools::qualifiedNameComponents( m_xActiveConnection->getMetaData(), m_aCommand, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation );
+ sCommand += ::dbtools::composeTableNameForSelect( m_xActiveConnection, sCatalog, sSchema, sTable );
+*/
}
- catch(Exception&)
+ else
{
- DBG_UNHANDLED_EXCEPTION();
+ String sMessage( DBACORE_RESSTRING( RID_STR_TABLE_DOES_NOT_EXIST ) );
+ sMessage.SearchAndReplaceAscii( "$table$", m_aCommand );
+ throwGenericSQLException(sMessage,*this);
}
-
- Reference<XColumnsSupplier> xSup(xTable,UNO_QUERY);
- if ( xSup.is() )
- m_xColumns = xSup->getColumns();
-
+ }
+ else
+ {
sCommand = rtl::OUString::createFromAscii("SELECT * FROM ");
::rtl::OUString sCatalog, sSchema, sTable;
::dbtools::qualifiedNameComponents( m_xActiveConnection->getMetaData(), m_aCommand, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation );
sCommand += ::dbtools::composeTableNameForSelect( m_xActiveConnection, sCatalog, sSchema, sTable );
}
- else
- {
- String sMessage( DBACORE_RESSTRING( RID_STR_TABLE_DOES_NOT_EXIST ) );
- sMessage.SearchAndReplaceAscii( "$table$", m_aCommand );
- throwGenericSQLException(sMessage,*this);
- }
}
break;
@@ -2338,10 +2362,11 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw()
xQuery->getPropertyValue(PROPERTY_UPDATE_TABLENAME) >>= aTable;
if(aTable.getLength())
m_aUpdateTableName = composeTableName( m_xActiveConnection->getMetaData(), aCatalog, aSchema, aTable, sal_False, ::dbtools::eInDataManipulation );
-
+/*
Reference<XColumnsSupplier> xSup(xQuery,UNO_QUERY);
if(xSup.is())
m_xColumns = xSup->getColumns();
+*/
}
}
else
@@ -2363,7 +2388,7 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw()
m_aActiveCommand = sCommand;
- if ( !m_aActiveCommand.getLength() )
+ if ( !m_aActiveCommand.getLength() && !bDoEscapeProcessing )
::dbtools::throwSQLException( DBACORE_RESSTRING( RID_STR_NO_SQL_COMMAND ), SQL_FUNCTION_SEQUENCE_ERROR, *this );
return bDoEscapeProcessing;
@@ -2745,11 +2770,15 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo
rParent.m_pColumns->getByName(*pIter) >>= xColumn;
if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION))
aDescription = comphelper::getString(xColumn->getPropertyValue(PROPERTY_DESCRIPTION));
+
+ ::rtl::OUString sParseLabel;
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sParseLabel;
ORowSetColumn* pColumn = new ORowSetColumn( rParent.getMetaData(),
this,
i,
rParent.m_xActiveConnection->getMetaData(),
aDescription,
+ sParseLabel,
m_aCurrentRow);
aColumns->get().push_back(pColumn);
pColumn->setName(*pIter);
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 3dd4dad67441..924fd881346e 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -138,7 +138,8 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
const ::rtl::OUString& _rUpdateTableName,
sal_Bool& _bModified,
sal_Bool& _bNew,
- const ORowSetValueVector& _aParameterValueForCache)
+ const ORowSetValueVector& _aParameterValueForCache,
+ const ::rtl::OUString& i_sRowSetFilter)
:m_xSet(_xRs)
,m_xMetaData(Reference< XResultSetMetaDataSupplier >(_xRs,UNO_QUERY)->getMetaData())
,m_aContext( _rContext )
@@ -260,7 +261,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
{
m_pCacheSet = new OBookmarkSet();
m_xCacheSet = m_pCacheSet;
- m_pCacheSet->construct(_xRs);
+ m_pCacheSet->construct(_xRs,i_sRowSetFilter);
// check privileges
m_nPrivileges = Privilege::SELECT;
@@ -294,7 +295,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
{
m_pCacheSet = new OStaticSet();
m_xCacheSet = m_pCacheSet;
- m_pCacheSet->construct(_xRs);
+ m_pCacheSet->construct(_xRs,i_sRowSetFilter);
m_nPrivileges = Privilege::SELECT;
}
else
@@ -335,7 +336,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
{
m_pCacheSet = pKeySet;
m_xCacheSet = m_pCacheSet;
- pKeySet->construct(_xRs);
+ pKeySet->construct(_xRs,i_sRowSetFilter);
if(Reference<XResultSetUpdate>(_xRs,UNO_QUERY).is()) // this interface is optional so we have to check it
{
@@ -359,7 +360,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
m_xCacheSet = NULL;
m_pCacheSet = new OStaticSet();
m_xCacheSet = m_pCacheSet;
- m_pCacheSet->construct(_xRs);
+ m_pCacheSet->construct(_xRs,i_sRowSetFilter);
m_nPrivileges = Privilege::SELECT;
}
}
@@ -1284,9 +1285,7 @@ void ORowSetCache::updateRow( ORowSetMatrix::iterator& _rUpdateRow )
// refetch the whole row
(*m_aMatrixIter) = NULL;
- if ( !moveToBookmark(aBookmark) )
- m_aMatrixIter = m_pMatrix->end();
-
+ moveToBookmark(aBookmark);
// moveToBookmark((*(*m_aInsertRow))[0].makeAny());
// if(m_pCacheSet->rowUpdated())
// *m_aMatrixIter = m_aInsertRow;
diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx
index 1f5be3113f8b..268c32294824 100644
--- a/dbaccess/source/core/api/RowSetCache.hxx
+++ b/dbaccess/source/core/api/RowSetCache.hxx
@@ -195,7 +195,8 @@ namespace dbaccess
const ::rtl::OUString& _rUpdateTableName,
sal_Bool& _bModified,
sal_Bool& _bNew,
- const ORowSetValueVector& _aParameterValueForCache);
+ const ORowSetValueVector& _aParameterValueForCache,
+ const ::rtl::OUString& i_sRowSetFilter);
~ORowSetCache();
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index e302e38fe588..1a1f9bc1d679 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -46,6 +46,8 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/sdb/BooleanComparisonMode.hpp>
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdbc/ColumnSearch.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
@@ -190,6 +192,53 @@ namespace
if ( _bDispose )
_rIterator.dispose();
}
+ void lcl_addFilterCriteria_throw(sal_Int32 i_nFilterOperator,const ::rtl::OUString& i_sValue,::rtl::OUStringBuffer& o_sRet)
+ {
+ switch( i_nFilterOperator )
+ {
+ case SQLFilterOperator::EQUAL:
+ o_sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" = ")));
+ o_sRet.append(i_sValue);
+ break;
+ case SQLFilterOperator::NOT_EQUAL:
+ o_sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <> ")));
+ o_sRet.append(i_sValue);
+ break;
+ case SQLFilterOperator::LESS:
+ o_sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" < ")));
+ o_sRet.append(i_sValue);
+ break;
+ case SQLFilterOperator::GREATER:
+ o_sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" > ")));
+ o_sRet.append(i_sValue);
+ break;
+ case SQLFilterOperator::LESS_EQUAL:
+ o_sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <= ")));
+ o_sRet.append(i_sValue);
+ break;
+ case SQLFilterOperator::GREATER_EQUAL:
+ o_sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" >= ")));
+ o_sRet.append(i_sValue);
+ break;
+ case SQLFilterOperator::LIKE:
+ o_sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" LIKE ")));
+ o_sRet.append(i_sValue);
+ break;
+ case SQLFilterOperator::NOT_LIKE:
+ o_sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT LIKE ")));
+ o_sRet.append(i_sValue);
+ break;
+ case SQLFilterOperator::SQLNULL:
+ o_sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")) );
+ break;
+ case SQLFilterOperator::NOT_SQLNULL:
+ o_sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NOT NULL")) );
+ break;
+ default:
+ throw SQLException();
+ }
+ }
+
}
DBG_NAME(OSingleSelectQueryComposer)
@@ -209,6 +258,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc
,m_aContext( _rContext )
,m_pTables(NULL)
,m_nBoolCompareMode( BooleanComparisonMode::EQUAL_INTEGER )
+ ,m_nCommandType(CommandType::COMMAND)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::OSingleSelectQueryComposer" );
DBG_CTOR(OSingleSelectQueryComposer,NULL);
@@ -235,6 +285,9 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc
{
OSL_VERIFY( aValue >>= m_nBoolCompareMode );
}
+ Reference< XQueriesSupplier > xQueriesAccess(m_xConnection, UNO_QUERY);
+ if (xQueriesAccess.is())
+ m_xConnectionQueries = xQueriesAccess->getQueries();
}
catch(Exception&)
{
@@ -306,6 +359,7 @@ void SAL_CALL OSingleSelectQueryComposer::setQuery( const ::rtl::OUString& comma
::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed);
::osl::MutexGuard aGuard( m_aMutex );
+ m_nCommandType = CommandType::COMMAND;
// first clear the tables and columns
clearCurrentCollections();
// now set the new one
@@ -319,6 +373,85 @@ void SAL_CALL OSingleSelectQueryComposer::setQuery( const ::rtl::OUString& comma
for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) )
m_aElementaryParts[ eLoopParts ] = ::rtl::OUString();
}
+// -------------------------------------------------------------------------
+void SAL_CALL OSingleSelectQueryComposer::setCommand( const ::rtl::OUString& Command,sal_Int32 _nCommandType ) throw(SQLException, RuntimeException)
+{
+ ::rtl::OUStringBuffer sSQL;
+ switch(_nCommandType)
+ {
+ case CommandType::COMMAND:
+ setElementaryQuery(Command);
+ return;
+ break;
+ case CommandType::TABLE:
+ if ( m_xConnectionTables->hasByName(Command) )
+ {
+ sSQL.appendAscii("SELECT * FROM ");
+ Reference< XPropertySet > xTable;
+ try
+ {
+ m_xConnectionTables->getByName( Command ) >>= xTable;
+ }
+ catch(const WrappedTargetException& e)
+ {
+ SQLException e2;
+ if ( e.TargetException >>= e2 )
+ throw e2;
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ sSQL.append(dbtools::composeTableNameForSelect(m_xConnection,xTable));
+ }
+ else
+ {
+ String sMessage( DBACORE_RESSTRING( RID_STR_TABLE_DOES_NOT_EXIST ) );
+ sMessage.SearchAndReplaceAscii( "$table$", Command );
+ throwGenericSQLException(sMessage,*this);
+ }
+ break;
+ case CommandType::QUERY:
+ if ( m_xConnectionQueries->hasByName(Command) )
+ {
+
+ Reference<XPropertySet> xQuery(m_xConnectionQueries->getByName(Command),UNO_QUERY);
+ ::rtl::OUString sCommand;
+ xQuery->getPropertyValue(PROPERTY_COMMAND) >>= sCommand;
+ sSQL.append(sCommand);
+ }
+ else
+ {
+ String sMessage( DBACORE_RESSTRING( RID_STR_QUERY_DOES_NOT_EXIST ) );
+ sMessage.SearchAndReplaceAscii( "$table$", Command );
+ throwGenericSQLException(sMessage,*this);
+ }
+
+ break;
+ default:
+ break;
+ }
+ ::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed);
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_nCommandType = _nCommandType;
+ m_sCommand = Command;
+ // first clear the tables and columns
+ clearCurrentCollections();
+ // now set the new one
+ ::rtl::OUString sCommand = sSQL.makeStringAndClear();
+ setElementaryQuery(sCommand);
+ m_sOrignal = sCommand;
+/*
+ // reset the additive iterator to the same statement
+ parseAndCheck_throwError( m_aSqlParser, m_sOrignal, m_aAdditiveIterator, *this );
+
+ // we have no "elementary" parts anymore (means filter/groupby/having/order clauses)
+ for ( SQLPart eLoopParts = Where; eLoopParts != SQLPartCount; incSQLPart( eLoopParts ) )
+ m_aElementaryParts[ eLoopParts ] = ::rtl::OUString();
+*/
+}
// -----------------------------------------------------------------------------
void OSingleSelectQueryComposer::setQuery_Impl( const ::rtl::OUString& command )
{
@@ -350,18 +483,18 @@ Sequence< Sequence< PropertyValue > > SAL_CALL OSingleSelectQueryComposer::getSt
return getStructuredCondition(F_tmp);
}
// -----------------------------------------------------------------------------
-void SAL_CALL OSingleSelectQueryComposer::appendHavingClauseByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ) throw (SQLException, RuntimeException)
+void SAL_CALL OSingleSelectQueryComposer::appendHavingClauseByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria,sal_Int32 filterOperator ) throw (SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::appendHavingClauseByColumn" );
::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString> F_tmp(&OSingleSelectQueryComposer::implSetHavingClause);
- setConditionByColumn(column,andCriteria,F_tmp);
+ setConditionByColumn(column,andCriteria,F_tmp,filterOperator);
}
// -----------------------------------------------------------------------------
-void SAL_CALL OSingleSelectQueryComposer::appendFilterByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ) throw(SQLException, RuntimeException)
+void SAL_CALL OSingleSelectQueryComposer::appendFilterByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria,sal_Int32 filterOperator ) throw(SQLException, RuntimeException)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::appendFilterByColumn" );
::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString> F_tmp(&OSingleSelectQueryComposer::implSetFilter);
- setConditionByColumn(column,andCriteria,F_tmp);
+ setConditionByColumn(column,andCriteria,F_tmp,filterOperator);
}
// -----------------------------------------------------------------------------
::rtl::OUString OSingleSelectQueryComposer::impl_getColumnName_throw(const Reference< XPropertySet >& column)
@@ -659,6 +792,13 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
::std::vector< ::rtl::OUString> aNames;
::vos::ORef< OSQLColumns> aSelectColumns;
sal_Bool bCase = sal_True;
+ Reference< XNameAccess> xQueryColumns;
+ if ( m_nCommandType == CommandType::QUERY )
+ {
+ Reference<XColumnsSupplier> xSup(m_xConnectionQueries->getByName(m_sCommand),UNO_QUERY);
+ if(xSup.is())
+ xQueryColumns = xSup->getColumns();
+ }
do {
@@ -725,7 +865,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
{
// This is a valid case. If we can syntactically parse the query, but not semantically
// (e.g. because it is based on a table we do not know), then there will be no SelectColumns
- aSelectColumns = ::connectivity::parse::OParseColumn::createColumnsForResultSet( xResultSetMeta, m_xMetaData );
+ aSelectColumns = ::connectivity::parse::OParseColumn::createColumnsForResultSet( xResultSetMeta, m_xMetaData ,xQueryColumns);
break;
}
@@ -733,13 +873,21 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
const ::comphelper::TStringMixEqualFunctor aCaseCompareFunctor( bCase );
typedef ::std::set< size_t > SizeTSet;
SizeTSet aUsedSelectColumns;
+ ::connectivity::parse::OParseColumn::StringMap aColumnNames;
sal_Int32 nCount = xResultSetMeta->getColumnCount();
OSL_ENSURE( (size_t) nCount == aSelectColumns->get().size(), "OSingleSelectQueryComposer::getColumns: inconsistent column counts, this might result in wrong columns!" );
for(sal_Int32 i=1;i<=nCount;++i)
{
::rtl::OUString sColumnName = xResultSetMeta->getColumnName(i);
- ::rtl::OUString sColumnLabel = xResultSetMeta->getColumnLabel(i);
+ ::rtl::OUString sColumnLabel;
+ if ( xQueryColumns.is() && xQueryColumns->hasByName(sColumnName) )
+ {
+ Reference<XPropertySet> xQueryColumn(xQueryColumns->getByName(sColumnName),UNO_QUERY_THROW);
+ xQueryColumn->getPropertyValue(PROPERTY_LABEL) >>= sColumnLabel;
+ }
+ else
+ sColumnLabel = xResultSetMeta->getColumnLabel(i);
sal_Bool bFound = sal_False;
OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),sColumnLabel,aCaseCompare);
size_t nFoundSelectColumnPos = aFind - aSelectColumns->get().begin();
@@ -775,7 +923,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
if ( i > static_cast< sal_Int32>( aSelectColumns->get().size() ) )
{
aSelectColumns->get().push_back(
- ::connectivity::parse::OParseColumn::createColumnForResultSet( xResultSetMeta, m_xMetaData, i )
+ ::connectivity::parse::OParseColumn::createColumnForResultSet( xResultSetMeta, m_xMetaData, i ,aColumnNames)
);
OSL_ENSURE( aSelectColumns->get().size() == (size_t)i, "OSingleSelectQueryComposer::getColumns: inconsistency!" );
}
@@ -1371,49 +1519,7 @@ namespace
sRet.append(pAndIter->Name);
::rtl::OUString sValue;
pAndIter->Value >>= sValue;
- switch( pAndIter->Handle )
- {
- case SQLFilterOperator::EQUAL:
- sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" = ")));
- sRet.append(sValue);
- break;
- case SQLFilterOperator::NOT_EQUAL:
- sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <> ")));
- sRet.append(sValue);
- break;
- case SQLFilterOperator::LESS:
- sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" < ")));
- sRet.append(sValue);
- break;
- case SQLFilterOperator::GREATER:
- sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" > ")));
- sRet.append(sValue);
- break;
- case SQLFilterOperator::LESS_EQUAL:
- sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" <= ")));
- sRet.append(sValue);
- break;
- case SQLFilterOperator::GREATER_EQUAL:
- sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" >= ")));
- sRet.append(sValue);
- break;
- case SQLFilterOperator::LIKE:
- sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" LIKE ")));
- sRet.append(sValue);
- break;
- case SQLFilterOperator::NOT_LIKE:
- sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT LIKE ")));
- sRet.append(sValue);
- break;
- case SQLFilterOperator::SQLNULL:
- sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NULL")) );
- break;
- case SQLFilterOperator::NOT_SQLNULL:
- sRet.append(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IS NOT NULL")) );
- break;
- default:
- throw IllegalArgumentException();
- }
+ lcl_addFilterCriteria_throw(pAndIter->Handle,sValue,sRet);
++pAndIter;
if ( pAndIter != pAndEnd )
sRet.append(STR_AND);
@@ -1440,7 +1546,7 @@ void SAL_CALL OSingleSelectQueryComposer::setStructuredHavingClause( const Seque
setHavingClause(lcl_getCondition(filter));
}
// -----------------------------------------------------------------------------
-void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor)
+void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropertySet >& column, sal_Bool andCriteria ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor,sal_Int32 filterOperator)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OSingleSelectQueryComposer::setConditionByColumn" );
::connectivity::checkDisposed(OSubComponent::rBHelper.bDisposed);
@@ -1505,18 +1611,24 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
aSQL.append( ::dbtools::quoteName( aQuote, aName ) );
}
+
if ( aValue.hasValue() )
{
if( !m_xTypeConverter.is() )
m_aContext.createComponent( "com.sun.star.script.Converter", m_xTypeConverter );
OSL_ENSURE(m_xTypeConverter.is(),"NO typeconverter!");
+ if ( nType != DataType::BOOLEAN && DataType::BIT != nType )
+ {
+ ::rtl::OUString sEmpty;
+ lcl_addFilterCriteria_throw(filterOperator,sEmpty,aSQL);
+ }
+
switch(nType)
{
case DataType::VARCHAR:
case DataType::CHAR:
case DataType::LONGVARCHAR:
- aSQL.append( STR_LIKE );
aSQL.append( DBTypeConversion::toSQLString( nType, aValue, sal_True, m_xTypeConverter ) );
break;
case DataType::CLOB:
@@ -1527,7 +1639,6 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
const ::sal_Int64 nLength = xClob->length();
if ( sal_Int64(nLength + aSQL.getLength() + STR_LIKE.getLength() ) < sal_Int64(SAL_MAX_INT32) )
{
- aSQL.append( STR_LIKE );
aSQL.appendAscii("'");
aSQL.append( xClob->getSubString(1,(sal_Int32)nLength) );
aSQL.appendAscii("'");
@@ -1535,7 +1646,6 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
}
else
{
- aSQL.append( STR_LIKE );
aSQL.append( DBTypeConversion::toSQLString( nType, aValue, sal_True, m_xTypeConverter ) );
}
}
@@ -1549,11 +1659,8 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
{
if(nSearchable == ColumnSearch::CHAR)
{
- aSQL.append( STR_LIKE );
aSQL.appendAscii( "\'" );
}
- else
- aSQL.append( STR_EQUAL );
aSQL.appendAscii( "0x" );
const sal_Int8* pBegin = aSeq.getConstArray();
const sal_Int8* pEnd = pBegin + aSeq.getLength();
@@ -1579,13 +1686,18 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
}
break;
default:
- aSQL.append( STR_EQUAL );
aSQL.append( DBTypeConversion::toSQLString( nType, aValue, sal_True, m_xTypeConverter ) );
break;
}
}
else
- aSQL.appendAscii( " IS NULL" ) ;
+ {
+ sal_Int32 nFilterOp = filterOperator;
+ if ( filterOperator != SQLFilterOperator::SQLNULL && filterOperator != SQLFilterOperator::NOT_SQLNULL )
+ nFilterOp = SQLFilterOperator::SQLNULL;
+ ::rtl::OUString sEmpty;
+ lcl_addFilterCriteria_throw(nFilterOp,sEmpty,aSQL);
+ }
// filter anhaengen
// select ohne where und order by aufbauen
diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx
index 77a29812b105..af40ac5667d2 100644
--- a/dbaccess/source/core/api/definitioncolumn.cxx
+++ b/dbaccess/source/core/api/definitioncolumn.cxx
@@ -192,14 +192,16 @@ rtl::OUString OTableColumn::getImplementationName( ) throw (RuntimeException)
DBG_NAME( OQueryColumn );
// -------------------------------------------------------------------------
-OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection,const ::rtl::OUString& _sNewName )
+OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection,const ::rtl::OUString i_sLabel )
:OTableColumnDescriptor( false /* do not act as descriptor */ )
+ ,m_sLabel(i_sLabel)
{
const sal_Int32 nPropAttr = PropertyAttribute::READONLY;
registerProperty( PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, nPropAttr, &m_sCatalogName, ::getCppuType( &m_sCatalogName ) );
registerProperty( PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, nPropAttr, &m_sSchemaName, ::getCppuType( &m_sSchemaName ) );
registerProperty( PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, nPropAttr, &m_sTableName, ::getCppuType( &m_sTableName ) );
registerProperty( PROPERTY_REALNAME, PROPERTY_ID_REALNAME, nPropAttr, &m_sRealName, ::getCppuType( &m_sRealName ) );
+ registerProperty( PROPERTY_LABEL, PROPERTY_ID_LABEL, nPropAttr, &m_sLabel, ::getCppuType( &m_sLabel ) );
DBG_CTOR( OQueryColumn, NULL );
@@ -210,14 +212,8 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co
OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_TYPE ) >>= m_nType );
OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISAUTOINCREMENT ) >>= m_bAutoIncrement );
OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISCURRENCY ) >>= m_bCurrency );
- if ( _sNewName.getLength() )
- {
- m_sName = _sNewName;
- }
- else
- {
- OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName );
- }
+ OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName );
+
m_bRowVersion = sal_False;
Reference< XPropertySetInfo > xPSI( _rxParserColumn->getPropertySetInfo(), UNO_SET_THROW );
diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx
index 3f3ccc57db2e..ad5ccbc2aee3 100644
--- a/dbaccess/source/core/api/query.cxx
+++ b/dbaccess/source/core/api/query.cxx
@@ -229,7 +229,7 @@ void OQuery::rebuildColumns()
Reference< XDatabaseMetaData > xDBMeta( m_xConnection->getMetaData(), UNO_QUERY_THROW );
::vos::ORef< OSQLColumns > aParseColumns(
- ::connectivity::parse::OParseColumn::createColumnsForResultSet( xResultSetMeta, xDBMeta ) );
+ ::connectivity::parse::OParseColumn::createColumnsForResultSet( xResultSetMeta, xDBMeta,xColumnDefinitions ) );
xColumns = OPrivateColumns::createWithIntrinsicNames(
aParseColumns, xDBMeta->storesMixedCaseQuotedIdentifiers(), *this, m_aMutex );
if ( !xColumns.is() )
@@ -237,29 +237,25 @@ void OQuery::rebuildColumns()
}
Sequence< ::rtl::OUString> aNames = xColumns->getElementNames();
- Sequence< ::rtl::OUString> aDefintionNames;
- bool bApplyDefinitionNames = false;
- //if ( xColumnDefinitions.is() )
- //{
- // aDefintionNames = xColumnDefinitions->getElementNames();
- // bApplyDefinitionNames = aDefintionNames.getLength() == aNames.getLength();
- //}
-
- ::rtl::OUString sEmpty;
const ::rtl::OUString* pIter = aNames.getConstArray();
- const ::rtl::OUString* pEnd = pIter + aNames.getLength();
+ const ::rtl::OUString* pEnd = pIter + aNames.getLength();
for ( sal_Int32 i = 0;pIter != pEnd; ++pIter,++i)
{
Reference<XPropertySet> xSource(xColumns->getByName( *pIter ),UNO_QUERY);
- OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection, bApplyDefinitionNames ? aDefintionNames[i] : sEmpty);
+ ::rtl::OUString sLabel = *pIter;
+ if ( xColumnDefinitions.is() && xColumnDefinitions->hasByName(*pIter) )
+ {
+ Reference<XPropertySet> xCommandColumn(xColumnDefinitions->getByName( *pIter ),UNO_QUERY);
+ xCommandColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+ }
+ OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection, sLabel);
Reference< XChild > xChild( *pColumn, UNO_QUERY_THROW );
xChild->setParent( *this );
- ::rtl::OUString sNewName = bApplyDefinitionNames ? aDefintionNames[i] : *pIter;
- implAppendColumn( sNewName, pColumn );
+ implAppendColumn( *pIter, pColumn );
Reference< XPropertySet > xDest( *pColumn, UNO_QUERY_THROW );
if ( m_pColumnMediator.is() )
- m_pColumnMediator->notifyElementCreated( sNewName, xDest );
+ m_pColumnMediator->notifyElementCreated( *pIter, xDest );
}
}
catch( const SQLContext& e )
diff --git a/dbaccess/source/core/api/querycomposer.cxx b/dbaccess/source/core/api/querycomposer.cxx
index 6b17ad97e12a..ce0a389407aa 100644
--- a/dbaccess/source/core/api/querycomposer.cxx
+++ b/dbaccess/source/core/api/querycomposer.cxx
@@ -91,6 +91,7 @@
#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
#include <com/sun/star/container/XChild.hpp>
#endif
+#include <com/sun/star/sdb/SQLFilterOperator.hpp>
#ifndef DBACCESS_CORE_API_QUERYCOMPOSER_HXX
#include "querycomposer.hxx"
#endif
@@ -285,7 +286,23 @@ void SAL_CALL OQueryComposer::appendFilterByColumn( const Reference< XPropertySe
m_xComposerHelper->setQuery(getQuery());
m_xComposerHelper->setFilter(::rtl::OUString());
- m_xComposerHelper->appendFilterByColumn(column,sal_True);
+ sal_Int32 nOp = SQLFilterOperator::EQUAL;
+ if ( column.is() )
+ {
+ sal_Int32 nType = 0;
+ column->getPropertyValue(PROPERTY_TYPE) >>= nType;
+ switch(nType)
+ {
+ case DataType::VARCHAR:
+ case DataType::CHAR:
+ case DataType::LONGVARCHAR:
+ nOp = SQLFilterOperator::LIKE;
+ break;
+ default:
+ nOp = SQLFilterOperator::EQUAL;
+ }
+ }
+ m_xComposerHelper->appendFilterByColumn(column,sal_True,nOp);
FilterCreator aFilterCreator;
aFilterCreator.append(getFilter());
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 0283757ad7c9..bb18dd4979c4 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -1167,6 +1167,7 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
AsciiPropertyValue( "ImplicitCatalogRestriction", ::cppu::UnoType< ::rtl::OUString >::get() ),
AsciiPropertyValue( "ImplicitSchemaRestriction", ::cppu::UnoType< ::rtl::OUString >::get() ),
AsciiPropertyValue( "PrimaryKeySupport", ::cppu::UnoType< sal_Bool >::get() ),
+ AsciiPropertyValue( "ShowColumnDescription", makeAny( (sal_Bool)sal_False ) ),
// known SDB level settings
AsciiPropertyValue( "NoNameLengthLimit", makeAny( (sal_Bool)sal_False ) ),
AsciiPropertyValue( "AppendTableAliasName", makeAny( (sal_Bool)sal_False ) ),
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 141c8cdc2448..99c982f4f5fb 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -77,6 +77,7 @@
#include <tools/urlobj.hxx>
#include <ucbhelper/content.hxx>
#include <unotools/confignode.hxx>
+#include <unotools/pathoptions.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <list>
#include <boost/bind.hpp>
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index f4426025c6fa..8c3ace1cd15c 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -697,7 +697,7 @@ void ODocumentDefinition::impl_removeFrameFromDesktop_throw( const ::comphelper:
}
// -----------------------------------------------------------------------------
-void ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow()
+void ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow( const bool i_bReactivated )
{
try
{
@@ -724,7 +724,7 @@ void ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow()
LifetimeCoupler::couple( *this, xFrame.get() );
// init the edit view
- if ( m_bForm && m_bOpenInDesign )
+ if ( m_bForm && m_bOpenInDesign && !i_bReactivated )
impl_initFormEditView( xController );
}
catch( const RuntimeException& )
@@ -1034,7 +1034,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
if ( _bActivate && !bOpenHidden )
{
m_xEmbeddedObject->changeState( EmbedStates::ACTIVE );
- ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow();
+ ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow( false );
}
else
{
@@ -1091,7 +1091,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co
if ( bIsActive && !bIsAliveNewStyleReport )
{
- ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow();
+ ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow( true );
return makeAny( getComponent() );
}
}
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx
index c48d20ad58a3..cb520ab5fef8 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.hxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx
@@ -200,7 +200,7 @@ public:
private:
/** does necessary initializations after our embedded object has been switched to ACTIVE
*/
- void impl_onActivateEmbeddedObject_nothrow();
+ void impl_onActivateEmbeddedObject_nothrow( const bool i_bReactivated );
/** initializes a newly created view/controller of a form which is displaying our embedded object
diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
index 88be29d9240d..3240a269bd53 100644
--- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
+++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
@@ -130,6 +130,7 @@ namespace dbaccess
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xMetaData;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xConnectionTables;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xConnectionQueries;
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xNumberFormatsSupplier;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns;
::comphelper::ComponentContext m_aContext;
@@ -140,8 +141,10 @@ namespace dbaccess
::rtl::OUString m_aPureSelectSQL; // the pure select statement, without filter/order/groupby/having
::rtl::OUString m_sDecimalSep;
+ ::rtl::OUString m_sCommand;
::com::sun::star::lang::Locale m_aLocale;
sal_Int32 m_nBoolCompareMode; // how to compare bool values
+ sal_Int32 m_nCommandType;
// <properties>
::rtl::OUString m_sOrignal;
@@ -172,8 +175,8 @@ namespace dbaccess
void setConditionByColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& column
, sal_Bool andCriteria
- ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor);
-
+ ,::std::mem_fun1_t<bool,OSingleSelectQueryComposer,::rtl::OUString>& _aSetFunctor
+ ,sal_Int32 filterOperator);
/** getStructuredCondition returns the structured condition for the where or having clause
@param _aGetFunctor
@@ -249,18 +252,19 @@ namespace dbaccess
virtual void SAL_CALL setElementaryQuery( const ::rtl::OUString& _rElementary ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setFilter( const ::rtl::OUString& filter ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setStructuredFilter( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& filter ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL appendFilterByColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& column, sal_Bool andCriteria ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL appendFilterByColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& column, sal_Bool andCriteria,sal_Int32 filterOperator ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL appendGroupByColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& column ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setGroup( const ::rtl::OUString& group ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setHavingClause( const ::rtl::OUString& filter ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setStructuredHavingClause( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& filter ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL appendHavingClauseByColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& column, sal_Bool andCriteria ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL appendHavingClauseByColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& column, sal_Bool andCriteria,sal_Int32 filterOperator ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL appendOrderByColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& column, sal_Bool ascending ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setOrder( const ::rtl::OUString& order ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// XSingleSelectQueryAnalyzer
virtual ::rtl::OUString SAL_CALL getQuery( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setQuery( const ::rtl::OUString& command ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCommand( const ::rtl::OUString& command,sal_Int32 CommandType ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getFilter( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > SAL_CALL getStructuredFilter( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getGroup( ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/dbaccess/source/core/inc/definitioncolumn.hxx b/dbaccess/source/core/inc/definitioncolumn.hxx
index b67b0de70c59..8d5f0d4b3f04 100644
--- a/dbaccess/source/core/inc/definitioncolumn.hxx
+++ b/dbaccess/source/core/inc/definitioncolumn.hxx
@@ -157,6 +157,7 @@ namespace dbaccess
::rtl::OUString m_sSchemaName;
::rtl::OUString m_sTableName;
::rtl::OUString m_sRealName;
+ ::rtl::OUString m_sLabel;
// </properties>
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xOriginalTableColumn;
@@ -168,7 +169,7 @@ namespace dbaccess
OQueryColumn(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxParserColumn,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
- const ::rtl::OUString& _sNewName
+ const ::rtl::OUString i_sLabel
);
// XTypeProvider
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 23eda6049d24..3b5f0fc6ee7c 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -287,6 +287,12 @@ sal_Bool ODsnTypeCollection::supportsTableCreation(const ::rtl::OUString& _sURL)
return aFeatures.getOrDefault("SupportsTableCreation",sal_False);
}
// -----------------------------------------------------------------------------
+sal_Bool ODsnTypeCollection::supportsColumnDescription(const ::rtl::OUString& _sURL) const
+{
+ const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
+ return aFeatures.getOrDefault("SupportsColumnDescription",sal_False);
+}
+// -----------------------------------------------------------------------------
sal_Bool ODsnTypeCollection::supportsBrowsing(const ::rtl::OUString& _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index 4e9153a6a216..b294ef20d1a9 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -162,6 +162,9 @@ public:
/// check if the given data source allows creation of tables
sal_Bool supportsTableCreation(const ::rtl::OUString& _sURL) const;
+ /// check if the given data source allows to show column description.
+ sal_Bool supportsColumnDescription(const ::rtl::OUString& _sURL) const;
+
// check if a Browse button may be shown to insert connection url
sal_Bool supportsBrowsing(const ::rtl::OUString& _sURL) const;
diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc
index 6a58ba1ddd0d..2b00a4c5af14 100644
--- a/dbaccess/source/inc/stringconstants.hrc
+++ b/dbaccess/source/inc/stringconstants.hrc
@@ -183,6 +183,7 @@
#define PROPERTY_ID_THOUSAND_DELIMITER 140
#define PROPERTY_ID_ENCODING 141
#define PROPERTY_ID_HELP_URL 142
+#define PROPERTY_ID_SINGLESELECTQUERYCOMPOSER 143
//============================================================
//= property names
@@ -339,6 +340,7 @@ DECLARE_CONSTASCII_USTRING(PROPERTY_AS_TEMPLATE);
DECLARE_CONSTASCII_USTRING(PROPERTY_HAVING_CLAUSE);
DECLARE_CONSTASCII_USTRING(PROPERTY_GROUP_BY);
DECLARE_CONSTASCII_USTRING(PROPERTY_EDIT_WIDTH);
+DECLARE_CONSTASCII_USTRING(PROPERTY_SINGLESELECTQUERYCOMPOSER);
//============================================================
//= service names
diff --git a/dbaccess/source/inc/stringconstants.inc b/dbaccess/source/inc/stringconstants.inc
index 8803d0e0edc7..08168f859870 100644
--- a/dbaccess/source/inc/stringconstants.inc
+++ b/dbaccess/source/inc/stringconstants.inc
@@ -185,6 +185,7 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_AS_TEMPLATE, "AsTemplate");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HAVING_CLAUSE, "HavingClause");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_GROUP_BY, "GroupBy");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EDIT_WIDTH, "EditWidth");
+IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SINGLESELECTQUERYCOMPOSER,"SingleSelectQueryComposer");
//============================================================
//= service names
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index e29ce4e6901a..78b72eeb271e 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -85,7 +85,6 @@
#include <svl/urihelper.hxx>
#include <svl/filenotation.hxx>
-
#include <svtools/svtreebx.hxx>
#include <svtools/transfer.hxx>
#include <svtools/cliplistener.hxx>
@@ -127,7 +126,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 1caae8c6bf11..0be12a01c49b 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -67,6 +67,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>
@@ -734,6 +735,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() )
{
@@ -1205,31 +1211,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);
}
@@ -1421,14 +1427,15 @@ void SbaXDataBrowserController::disposing()
OSL_ENSURE(0,"Exception thrown by dispose");
}
}
- try
- {
- ::comphelper::disposeComponent(m_xParser);
- }
- catch(Exception&)
- {
- OSL_ENSURE(0,"Exception thrown by dispose");
- }
+ m_xParser.clear();
+ //try
+ //{
+ // ::comphelper::disposeComponent(m_xParser);
+ //}
+ //catch(Exception&)
+ //{
+ // OSL_ENSURE(0,"Exception thrown by dispose");
+ //}
}
//------------------------------------------------------------------------------
void SbaXDataBrowserController::frameAction(const ::com::sun::star::frame::FrameActionEvent& aEvent) throw( RuntimeException )
@@ -1825,7 +1832,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);
@@ -1839,7 +1846,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&)
@@ -1849,7 +1856,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
{
@@ -1868,7 +1875,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);
@@ -1884,8 +1891,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);
@@ -1915,7 +1922,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)
{
@@ -1927,29 +1953,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();
@@ -1966,23 +1993,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);
}
//------------------------------------------------------------------------------
@@ -2175,17 +2203,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;
@@ -2215,8 +2244,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));
@@ -2224,16 +2254,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 !"
@@ -2242,7 +2288,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 !"
@@ -2250,7 +2296,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);
@@ -2736,11 +2782,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() )
{
@@ -2749,6 +2798,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&)
{
@@ -2783,6 +2833,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);
@@ -2791,6 +2842,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 70caccc10a3e..0aa4074806ec 100644
--- a/dbaccess/source/ui/browser/dbexchange.cxx
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
@@ -31,36 +31,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"
@@ -78,23 +58,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 );
}
}
@@ -111,13 +85,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 );
}
@@ -132,47 +104,50 @@ 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() )
- {
- Reference< XNumberFormatter > xFormatter( getNumberFormatter( xConnection, _rxORB ) );
- 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 );
- }
- }
+ 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, i_rORB ) );
+ if ( xFormatter.is() )
+ {
+ m_pHtml.set( new OHTMLImportExport( getDescriptor(), i_rORB, xFormatter ) );
+ m_pRtf.set( new ORTFImportExport( getDescriptor(), i_rORB, xFormatter ) );
+ }
+ }
osl_decrementInterlockedCount( &m_refCount );
}
@@ -195,13 +170,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();
}
@@ -213,13 +186,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 );
@@ -228,59 +202,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) )
-
- if ( getDescriptor().has(daColumnObject) )
- getDescriptor().erase(daColumnObject);
+ ODataAccessDescriptor& rDescriptor( getDescriptor() );
- 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 46f6c576c022..c3da97bfae7a 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -1443,39 +1443,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 1e10e9421047..eda9fc01a3e4 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -650,7 +650,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 );
@@ -681,8 +686,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
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx
index 3889d091f737..59d5843689f1 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -87,8 +87,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();
@@ -127,14 +128,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;
}
@@ -144,8 +146,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;
@@ -157,12 +160,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 2449b1dc072a..ecf6415704eb 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -34,6 +34,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 c1b9ddbd33c5..05b88a9e1870 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.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 "dsselect.hxx"
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index 286236be75c6..96426b96a9b4 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -38,6 +38,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/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index 1d9dfba5623e..0691b24440de 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -220,7 +220,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 568ce0922c72..f39b562a2457 100644
--- a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
+++ b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
@@ -122,12 +122,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);
@@ -208,7 +209,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);
@@ -250,51 +251,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 c77942cd71c0..e7828590c53b 100644
--- a/dbaccess/source/ui/inc/FieldDescControl.hxx
+++ b/dbaccess/source/ui/inc/FieldDescControl.hxx
@@ -50,22 +50,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 ee473b032853..4273ea9d62ff 100644
--- a/dbaccess/source/ui/inc/FieldDescriptions.hxx
+++ b/dbaccess/source/ui/inc/FieldDescriptions.hxx
@@ -67,6 +67,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
@@ -89,6 +90,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);
@@ -113,6 +115,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/TableCopyHelper.hxx b/dbaccess/source/ui/inc/TableCopyHelper.hxx
index c0b5e77cc403..6261286b6d06 100644
--- a/dbaccess/source/ui/inc/TableCopyHelper.hxx
+++ b/dbaccess/source/ui/inc/TableCopyHelper.hxx
@@ -194,30 +194,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 27a103e1af8a..90bbb4c37862 100644
--- a/dbaccess/source/ui/inc/TokenWriter.hxx
+++ b/dbaccess/source/ui/inc/TokenWriter.hxx
@@ -30,51 +30,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 {
@@ -98,13 +72,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 d94f76b8dcc9..eab8e3ad82b0 100644
--- a/dbaccess/source/ui/inc/brwctrlr.hxx
+++ b/dbaccess/source/ui/inc/brwctrlr.hxx
@@ -344,14 +344,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 6627e3b2af1d..ea2fc3494221 100644
--- a/dbaccess/source/ui/inc/dbexchange.hxx
+++ b/dbaccess/source/ui/inc/dbexchange.hxx
@@ -56,20 +56,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(
@@ -90,15 +89,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 4f8e99655d76..1f2ba31a0eb8 100644
--- a/dbaccess/source/ui/inc/dbu_tbl.hrc
+++ b/dbaccess/source/ui/inc/dbu_tbl.hrc
@@ -44,7 +44,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
@@ -89,6 +89,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 dd132206bfed..415c34b65813 100644
--- a/dbaccess/source/ui/inc/indexfieldscontrol.hxx
+++ b/dbaccess/source/ui/inc/indexfieldscontrol.hxx
@@ -70,9 +70,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/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx
index 4b1258677037..f0ac851b58b7 100644
--- a/dbaccess/source/ui/misc/TableCopyHelper.cxx
+++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx
@@ -163,21 +163,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;
@@ -185,11 +179,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;
@@ -200,14 +194,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 );
@@ -230,72 +225,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) )
@@ -329,22 +314,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 )
@@ -367,7 +350,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)
@@ -380,7 +362,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) )
@@ -413,10 +394,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);
@@ -427,7 +407,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 d872590b3763..c8c06d2b8fcb 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -103,7 +103,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)
@@ -133,7 +134,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)
@@ -187,6 +189,7 @@ void ODatabaseImportExport::dispose()
m_xResultSetMetaData.clear();
m_xResultSet.clear();
m_xRow.clear();
+ m_xRowLocate.clear();
m_xFormatter.clear();
}
// -----------------------------------------------------------------------------
@@ -231,20 +234,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();
@@ -314,19 +334,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& )
@@ -375,7 +390,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);
@@ -570,22 +586,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 8d7e24e2792c..6fde27636be9 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -892,6 +892,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 b178947bf5f9..988baa48b1fd 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -371,7 +371,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 f482c99c5bb4..c7b073a2500e 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -610,14 +610,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)
@@ -625,8 +627,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))
{
@@ -647,7 +649,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;
@@ -657,7 +669,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,
@@ -1099,53 +1111,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;
}
}
}
@@ -1943,7 +1978,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;
}
}
@@ -3130,6 +3165,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/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index ca1bc56f01ef..91c30370d26a 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -1679,7 +1679,7 @@ void OQueryController::impl_reset()
m_pSqlIterator->traverseAll();
if ( m_pSqlIterator->hasErrors() )
{
- if ( !editingView() )
+ if ( m_bGraphicalDesign && !editingView() )
{
impl_showAutoSQLViewError( makeAny( m_pSqlIterator->getErrors() ) );
}
diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
index 6e90ebed7e88..ae3e3ba7a3b8 100644
--- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
+++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx
@@ -157,6 +157,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) );
@@ -288,6 +294,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
@@ -504,6 +525,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) )
@@ -657,8 +686,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 347a19ca60ad..8ddb588dd951 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -108,6 +108,7 @@
#ifndef DBAUI_TABLEFIELDCONTROL_HXX
#include "TableFieldControl.hxx"
#endif
+#include "dsntypes.hxx"
using namespace ::dbaui;
using namespace ::comphelper;
@@ -202,13 +203,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();
@@ -232,6 +241,7 @@ OTableEditorCtrl::OTableEditorCtrl(Window* pWindow)
:OTableRowView(pWindow)
,pNameCell(NULL)
,pTypeCell(NULL)
+ ,pHelpTextCell(NULL)
,pDescrCell(NULL)
,pDescrWin(NULL)
,nIndexEvent(0)
@@ -345,12 +355,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) );
@@ -368,6 +382,7 @@ void OTableEditorCtrl::ClearModified()
DBG_CHKTHIS(OTableEditorCtrl,NULL);
pNameCell->ClearModifyFlag();
pDescrCell->ClearModifyFlag();
+ pHelpTextCell->ClearModifyFlag();
pTypeCell->SaveValue();
}
@@ -399,6 +414,7 @@ OTableEditorCtrl::~OTableEditorCtrl()
delete pNameCell;
delete pTypeCell;
delete pDescrCell;
+ delete pHelpTextCell;
}
//------------------------------------------------------------------------------
@@ -474,10 +490,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;
}
@@ -519,7 +541,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 );
@@ -579,7 +607,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
@@ -604,7 +633,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();
@@ -678,7 +708,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
@@ -814,7 +857,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;
}
@@ -1179,7 +1223,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;
@@ -1268,9 +1312,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();
@@ -1350,16 +1397,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();
@@ -1375,8 +1430,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)
@@ -1438,9 +1495,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)
@@ -1458,7 +1524,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();
}
@@ -1480,6 +1548,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())
@@ -1496,16 +1572,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());
}
//------------------------------------------------------------------------------
@@ -1936,7 +2002,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 c28d525d6450..120b548e8e6d 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx
@@ -59,6 +59,7 @@ namespace dbaui
{
enum ChildFocusState
{
+ HELPTEXT,
DESCRIPTION,
NAME,
ROW,
@@ -70,6 +71,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 1eed02543cda..df01b15dc6cf 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -871,7 +871,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
@@ -883,10 +883,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))
@@ -912,6 +913,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);
@@ -1120,13 +1122,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& )
@@ -1145,6 +1148,7 @@ void OTableController::alterColumns()
(nPrecision != pField->GetPrecision() && nPrecision ) ||
nScale != pField->GetScale() ||
nNullable != pField->GetIsNullable() ||
+ sDescription != pField->GetDescription() ||
bAutoIncrement != pField->IsAutoIncrement())&&
xColumnFactory.is())
{
@@ -1264,7 +1268,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 cc7ad2c4a8bf..bf45ccda6689 100644
--- a/dbaccess/source/ui/tabledesign/TableRow.cxx
+++ b/dbaccess/source/ui/tabledesign/TableRow.cxx
@@ -140,6 +140,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 )
@@ -184,6 +185,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 9fa0b0743ef4..5616f7f4101f 100644
--- a/dbaccess/source/ui/tabledesign/table.src
+++ b/dbaccess/source/ui/tabledesign/table.src
@@ -106,10 +106,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 aa2b87fca329..8642250c45c6 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -261,6 +261,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)
@@ -302,7 +313,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
@@ -345,8 +356,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;
@@ -393,13 +405,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" );
}
//-------------------------------------------------------------------------
@@ -415,7 +427,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?
}
@@ -462,7 +474,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;
}
@@ -470,7 +481,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 )
@@ -495,7 +505,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;
}
@@ -503,7 +512,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;
}
@@ -511,7 +519,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;
}
@@ -519,7 +526,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 ) )
@@ -546,7 +552,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 );
@@ -555,7 +560,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 );
@@ -564,7 +568,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 );
}
@@ -572,7 +575,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;
@@ -586,7 +588,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 );
@@ -596,7 +597,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 ) );
@@ -606,7 +606,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);
@@ -617,7 +616,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();
@@ -692,7 +690,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;
@@ -745,32 +742,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;
}
}
@@ -790,17 +774,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
);
@@ -860,10 +842,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!" );
@@ -957,7 +977,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 ) );
@@ -1062,7 +1081,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
{
@@ -1141,7 +1159,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 );
@@ -1153,16 +1170,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() );
@@ -1180,9 +1188,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;
@@ -1198,7 +1208,7 @@ void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSou
{
if ( m_bSourceSelectionBookmarks )
{
- xRowLocate->moveToBookmark( *pSelectedRow );
+ bContinue = xRowLocate->moveToBookmark( *pSelectedRow );
}
else
{
@@ -1358,7 +1368,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
@@ -1399,26 +1408,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;
@@ -1458,7 +1482,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();
@@ -1496,7 +1520,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 );
@@ -1525,7 +1548,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 );
@@ -1549,14 +1574,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 );
@@ -1565,7 +1588,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
@@ -1588,7 +1610,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 )
diff --git a/dbaccess/util/hidother.src b/dbaccess/util/hidother.src
index 2f97d1918fd3..e564f01ded61 100644
--- a/dbaccess/util/hidother.src
+++ b/dbaccess/util/hidother.src
@@ -149,6 +149,8 @@ hidspecial HID_CTL_TABLEEDIT { HelpId = HID_CTL_TABLE
hidspecial HID_TABDESIGN_NAMECELL { HelpId = HID_TABDESIGN_NAMECELL; };
hidspecial HID_TABDESIGN_TYPECELL { HelpId = HID_TABDESIGN_TYPECELL; };
hidspecial HID_TABDESIGN_COMMENTCELL { HelpId = HID_TABDESIGN_COMMENTCELL; };
+hidspecial HID_TABDESIGN_HELPTEXT { HelpId = HID_TABDESIGN_HELPTEXT; };
+
hidspecial SID_TABLEDESIGN_INSERTROWS { HelpId = SID_TABLEDESIGN_INSERTROWS; };
hidspecial SID_TABLEDESIGN_TABED_PRIMARYKEY { HelpId = SID_TABLEDESIGN_TABED_PRIMARYKEY; };
hidspecial HID_TLB_TABLEDESIGN { HelpId = HID_TLB_TABLEDESIGN; };
diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx
index 14118e0baaad..8fa311c5d6ed 100644
--- a/reportdesign/source/core/api/Section.cxx
+++ b/reportdesign/source/core/api/Section.cxx
@@ -459,7 +459,7 @@ uno::Reference< report::XReportDefinition > SAL_CALL OSection::getReportDefiniti
uno::Reference< report::XGroup > xGroup = m_xGroup;
if ( !xRet.is() && xGroup.is() )
{
- uno::Reference< report::XGroups> xGroups(xGroup->getParent(),uno::UNO_QUERY);
+ uno::Reference< report::XGroups> xGroups(xGroup->getGroups());
if ( xGroups.is() )
xRet = xGroups->getReportDefinition();
}
diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx
index 741adba34974..48c5d8fe6255 100644
--- a/reportdesign/source/filter/xml/xmlGroup.cxx
+++ b/reportdesign/source/filter/xml/xmlGroup.cxx
@@ -145,9 +145,9 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport
sInterval = sInterval.getToken(0,')',nIndex);
m_xGroup->setGroupInterval(sInterval.toInt32());
}
- else if ( sFormula ==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:YEAR")))
+ else if ( sFormula == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:YEAR")))
nGroupOn = report::GroupOn::YEAR;
- else if ( sFormula ==::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:MONTH")))
+ else if ( sFormula == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:MONTH")))
{
nGroupOn = report::GroupOn::MONTH;
}
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx
index 6beebfcb30c8..b0e284b6960d 100644
--- a/reportdesign/source/ui/dlg/AddField.cxx
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -50,6 +50,8 @@
#include "CondFormat.hrc"
#include "ModuleHelper.hxx"
#include "uistrings.hrc"
+#include "ColumnInfo.hxx"
+
#include <comphelper/property.hxx>
#include <svtools/imgdef.hxx>
@@ -69,6 +71,7 @@ using namespace beans;
using namespace lang;
using namespace container;
using namespace ::svx;
+
class OAddFieldWindowListBox : public SvTreeListBox
{
OAddFieldWindow* m_pTabWin;
@@ -229,6 +232,15 @@ OAddFieldWindow::OAddFieldWindow(Window* pParent
//-----------------------------------------------------------------------
OAddFieldWindow::~OAddFieldWindow()
{
+ if ( m_pListBox.get() )
+ {
+ SvLBoxTreeList* pModel = m_pListBox->GetModel();
+ ULONG nCount = pModel->GetEntryCount();
+ for(ULONG i = 0; i< nCount;++i)
+ {
+ delete pModel->GetEntry(i)->GetUserData();
+ }
+ }
if (m_pChangeListener.is())
m_pChangeListener->dispose();
if ( m_pContainerListener.is() )
@@ -284,7 +296,24 @@ namespace
const ::rtl::OUString* pEntries = _rEntries.getConstArray();
sal_Int32 nEntries = _rEntries.getLength();
for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
- _rListBox.InsertEntry( *pEntries );
+ _rListBox.InsertEntry( *pEntries,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries) );
+ }
+ void lcl_addToList( OAddFieldWindowListBox& _rListBox, const uno::Reference< container::XNameAccess>& i_xColumns )
+ {
+ uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames();
+ const ::rtl::OUString* pEntries = aEntries.getConstArray();
+ sal_Int32 nEntries = aEntries.getLength();
+ for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),UNO_QUERY_THROW);
+ ::rtl::OUString sLabel;
+ if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+ if ( sLabel.getLength() )
+ _rListBox.InsertEntry( sLabel,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) );
+ else
+ _rListBox.InsertEntry( *pEntries,NULL,FALSE,LIST_APPEND,new ColumnInfo(*pEntries,sLabel) );
+ }
}
}
@@ -331,7 +360,7 @@ void OAddFieldWindow::Update()
m_xColumns = dbtools::getFieldsByCommandDescriptor( xCon, GetCommandType(), GetCommand(), m_xHoldAlive );
if ( m_xColumns.is() )
{
- lcl_addToList( *m_pListBox, m_xColumns->getElementNames() );
+ lcl_addToList( *m_pListBox, m_xColumns );
uno::Reference< container::XContainer> xContainer(m_xColumns,uno::UNO_QUERY);
if ( xContainer.is() )
m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer);
@@ -429,10 +458,11 @@ void OAddFieldWindow::fillDescriptor(SvLBoxEntry* _pSelected,::svx::ODataAccessD
_rDescriptor[ ::svx::daEscapeProcessing ] <<= GetEscapeProcessing();
_rDescriptor[ ::svx::daConnection ] <<= getConnection();
- ::rtl::OUString sColumnName = m_pListBox->GetEntryText( _pSelected );
- _rDescriptor[ ::svx::daColumnName ] <<= sColumnName;
- if ( m_xColumns->hasByName( sColumnName ) )
- _rDescriptor[ ::svx::daColumnObject ] <<= m_xColumns->getByName(sColumnName);
+ ColumnInfo* pInfo = static_cast<ColumnInfo*>(_pSelected->GetUserData());
+ // ::rtl::OUString sColumnName = m_pListBox->GetEntryText( _pSelected );
+ _rDescriptor[ ::svx::daColumnName ] <<= pInfo->sColumnName;
+ if ( m_xColumns->hasByName( pInfo->sColumnName ) )
+ _rDescriptor[ ::svx::daColumnObject ] <<= m_xColumns->getByName(pInfo->sColumnName);
}
}
// -----------------------------------------------------------------------------
@@ -441,8 +471,17 @@ void OAddFieldWindow::_elementInserted( const container::ContainerEvent& _rEvent
if ( m_pListBox.get() )
{
::rtl::OUString sName;
- if ( _rEvent.Accessor >>= sName )
- m_pListBox->InsertEntry(sName);
+ if ( (_rEvent.Accessor >>= sName) && m_xColumns->hasByName(sName) )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(m_xColumns->getByName(sName),UNO_QUERY_THROW);
+ ::rtl::OUString sLabel;
+ if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+ if ( sLabel.getLength() )
+ m_pListBox->InsertEntry( sLabel,NULL,FALSE,LIST_APPEND,new ColumnInfo(sName,sLabel) );
+ else
+ m_pListBox->InsertEntry( sName,NULL,FALSE,LIST_APPEND,new ColumnInfo(sName,sLabel) );
+ }
}
}
// -----------------------------------------------------------------------------
@@ -452,7 +491,7 @@ void OAddFieldWindow::_elementRemoved( const container::ContainerEvent& /*_rEven
{
m_pListBox->Clear();
if ( m_xColumns.is() )
- lcl_addToList( *m_pListBox, m_xColumns->getElementNames() );
+ lcl_addToList( *m_pListBox, m_xColumns );
}
}
// -----------------------------------------------------------------------------
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index 2f20d75c3fa4..5af42bf61a0d 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -52,6 +52,7 @@
#include "UndoActions.hxx"
#include "uistrings.hrc"
#include "ReportController.hxx"
+#include "ColumnInfo.hxx"
#include <cppuhelper/implbase1.hxx>
#include <comphelper/property.hxx>
@@ -73,6 +74,25 @@ using namespace ::com::sun::star;
using namespace svt;
using namespace ::comphelper;
+ void lcl_addToList_throw( ComboBoxControl& _rListBox, ::std::vector<ColumnInfo>& o_aColumnList,const uno::Reference< container::XNameAccess>& i_xColumns )
+ {
+ uno::Sequence< ::rtl::OUString > aEntries = i_xColumns->getElementNames();
+ const ::rtl::OUString* pEntries = aEntries.getConstArray();
+ sal_Int32 nEntries = aEntries.getLength();
+ for ( sal_Int32 i = 0; i < nEntries; ++i, ++pEntries )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(i_xColumns->getByName(*pEntries),uno::UNO_QUERY_THROW);
+ ::rtl::OUString sLabel;
+ if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+ o_aColumnList.push_back( ColumnInfo(*pEntries,sLabel) );
+ if ( sLabel.getLength() )
+ _rListBox.InsertEntry( sLabel );
+ else
+ _rListBox.InsertEntry( *pEntries );
+ }
+ }
+
typedef ::svt::EditBrowseBox OFieldExpressionControl_Base;
typedef ::cppu::WeakImplHelper1< container::XContainerListener > TContainerListenerBase;
class OFieldExpressionControl : public TContainerListenerBase
@@ -80,6 +100,7 @@ class OFieldExpressionControl : public TContainerListenerBase
{
::osl::Mutex m_aMutex;
::std::vector<sal_Int32> m_aGroupPositions;
+ ::std::vector<ColumnInfo> m_aColumnInfo;
::svt::ComboBoxControl* m_pComboCell;
sal_Int32 m_nDataPos;
sal_Int32 m_nCurrentPos;
@@ -335,13 +356,7 @@ void OFieldExpressionControl::fillColumns(const uno::Reference< container::XName
{
m_pComboCell->Clear();
if ( _xColumns.is() )
- {
- uno::Sequence< ::rtl::OUString> aColumnNames = _xColumns->getElementNames();
- const ::rtl::OUString* pIter = aColumnNames.getConstArray();
- const ::rtl::OUString* pEnd = pIter + aColumnNames.getLength();
- for(;pIter != pEnd;++pIter)
- m_pComboCell->InsertEntry(*pIter);
- } // if ( _xColumns.is() )
+ lcl_addToList_throw(*m_pComboCell,m_aColumnInfo,_xColumns);
}
//------------------------------------------------------------------------------
void OFieldExpressionControl::lateInit()
@@ -480,7 +495,7 @@ BOOL OFieldExpressionControl::SaveModified(bool _bAppendRow)
sExpression = m_pComboCell->GetText();
else
{
- sExpression = m_pComboCell->GetEntry(nPos);
+ sExpression = m_aColumnInfo[nPos].sColumnName;
}
xGroup->setExpression( sExpression );
@@ -519,7 +534,18 @@ String OFieldExpressionControl::GetCellText( long nRow, USHORT /*nColId*/ ) cons
try
{
uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
- sText = xGroup->getExpression();
+ ::rtl::OUString sExpression = xGroup->getExpression();
+
+ for(::std::vector<ColumnInfo>::const_iterator aIter = m_aColumnInfo.begin(); aIter != m_aColumnInfo.end();++aIter)
+ {
+ if ( aIter->sColumnName == sExpression )
+ {
+ if ( aIter->sLabel.getLength() )
+ sExpression = aIter->sLabel;
+ break;
+ }
+ }
+ sText = sExpression;
}
catch(uno::Exception&)
{
@@ -1311,10 +1337,7 @@ void OGroupsSortingDialog::_propertyChanged(const beans::PropertyChangeEvent& _r
// -----------------------------------------------------------------------------
void OGroupsSortingDialog::fillColumns()
{
- m_xColumns.clear();
- uno::Reference< report::XReportDefinition> xReport = m_pController->getReportDefinition();
- if ( xReport->getCommand().getLength() )
- m_xColumns = dbtools::getFieldsByCommandDescriptor(m_pController->getConnection(),xReport->getCommandType(),xReport->getCommand(),m_xHoldAlive);
+ m_xColumns = m_pController->getColumns();
m_pFieldExpression->fillColumns(m_xColumns);
}
// -----------------------------------------------------------------------------
diff --git a/reportdesign/source/ui/inc/ColumnInfo.hxx b/reportdesign/source/ui/inc/ColumnInfo.hxx
new file mode 100644
index 000000000000..392a141e6382
--- /dev/null
+++ b/reportdesign/source/ui/inc/ColumnInfo.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AddField.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef RPTUI_COLUMNINFO_HXX
+#define RPTUI_COLUMNINFO_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace rptui
+{
+ struct ColumnInfo
+ {
+ ::rtl::OUString sColumnName;
+ ::rtl::OUString sLabel;
+ bool bColumn;
+ ColumnInfo(const ::rtl::OUString& i_sColumnName,const ::rtl::OUString& i_sLabel)
+ : sColumnName(i_sColumnName)
+ , sLabel(i_sLabel)
+ , bColumn(true)
+ {
+ }
+ ColumnInfo(const ::rtl::OUString& i_sColumnName)
+ : sColumnName(i_sColumnName)
+ , bColumn(false)
+ {
+ }
+ };
+// =============================================================================
+} // namespace rptui
+// =============================================================================
+#endif // RPTUI_COLUMNINFO_HXX
diff --git a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx
index 5c835d983ff3..46599b76ace6 100644
--- a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx
+++ b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx
@@ -36,7 +36,6 @@
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <com/sun/star/report/XReportComponent.hpp>
-#include <com/sun/star/report/XFormattedField.hpp>
/** === end UNO includes === **/
//#include <boost/noncopyable.hpp>
diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx
index fc26581ba37d..441121d7a471 100644
--- a/reportdesign/source/ui/inc/GroupsSorting.hxx
+++ b/reportdesign/source/ui/inc/GroupsSorting.hxx
@@ -105,7 +105,6 @@ class OGroupsSortingDialog : public FloatingWindow
::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups> m_xGroups;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xHoldAlive;
sal_Bool m_bReadOnly;
private:
DECL_LINK( OnControlFocusLost, Control* );
diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx
index 03ccda9d2209..28b64f2adf02 100644
--- a/reportdesign/source/ui/inc/ReportController.hxx
+++ b/reportdesign/source/ui/inc/ReportController.hxx
@@ -116,6 +116,8 @@ namespace rptui
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > m_xRowSetMediator;
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; // a number formatter working with the report's NumberFormatsSupplier
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xHoldAlive;
+ mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns;
::com::sun::star::awt::Size m_aVisualAreaSize;
::boost::shared_ptr<rptui::OReportModel>
@@ -474,6 +476,9 @@ namespace rptui
::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const;
+ ::rtl::OUString getColumnLabel_throw(const ::rtl::OUString& i_sColumnName) const;
+
private:
virtual void onLoadedMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager );
virtual void impl_initialize( );
diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
index b0c5922556ab..0e5b0ebb45a9 100644
--- a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
+++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx
@@ -91,39 +91,41 @@ namespace rptui
void FormattedFieldBeautifier::setPlaceholderText( const uno::Reference< uno::XInterface >& _rxComponent )
{
::rtl::OUString sDataField;
- uno::Reference< report::XReportComponent > xComponent;
+ uno::Reference< report::XReportComponent > xComponent( _rxComponent, uno::UNO_QUERY );
try
{
- // is it a formatted field?
- uno::Reference< report::XFormattedField > xFormattedField( _rxComponent, uno::UNO_QUERY );
- if ( xFormattedField.is() )
+ uno::Reference< report::XReportControlModel > xControlModel( xComponent, uno::UNO_QUERY );
+ if ( xControlModel.is() )
{
- sDataField = xFormattedField->getDataField();
- xComponent.set( xFormattedField.get() );
- }
- else
- {
- // perhaps an image control?
- uno::Reference< report::XImageControl > xImageControl( _rxComponent, uno::UNO_QUERY );
- if ( xImageControl.is() )
+ sDataField = xControlModel->getDataField();
+
+ if ( sDataField.getLength() )
{
- sDataField = xImageControl->getDataField();
- xComponent.set( xImageControl.get() );
+ ReportFormula aFormula( sDataField );
+ bool bSet = true;
+ if ( aFormula.getType() == ReportFormula::Field )
+ {
+ const ::rtl::OUString sColumnName = aFormula.getFieldName();
+ ::rtl::OUString sLabel = m_rReportController.getColumnLabel_throw(sColumnName);
+ if ( sLabel.getLength() )
+ {
+ ::rtl::OUStringBuffer aBuffer;
+ aBuffer.appendAscii( "=" );
+ aBuffer.append( sLabel );
+ sDataField = aBuffer.makeStringAndClear();
+ bSet = false;
+ }
+ }
+ if ( bSet )
+ sDataField = aFormula.getEqualUndecoratedContent();
}
}
- if ( !xComponent.is() )
- return;
-
- if ( sDataField.getLength() )
- {
- ReportFormula aFormula( sDataField );
- sDataField = aFormula.getEqualUndecoratedContent();
- }
- setPlaceholderText( getVclWindowPeer( xComponent ), sDataField );
+ if ( xComponent.is() )
+ setPlaceholderText( getVclWindowPeer( xComponent ), sDataField );
}
- catch (uno::Exception e)
+ catch (uno::Exception)
{
DBG_UNHANDLED_EXCEPTION();
}
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 817f88adf3cb..556f94818c70 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -354,6 +354,8 @@ void OReportController::disposing()
try
{
+ m_xHoldAlive.clear();
+ m_xColumns.clear();
::comphelper::disposeComponent( m_xRowSet );
::comphelper::disposeComponent( m_xRowSetMediator );
::comphelper::disposeComponent( m_xFormatter );
@@ -2303,6 +2305,8 @@ void SAL_CALL OReportController::propertyChange( const beans::PropertyChangeEven
|| evt.PropertyName.equals( PROPERTY_FILTER )
)
{
+ m_xColumns.clear();
+ m_xHoldAlive.clear();
InvalidateFeature(SID_FM_ADD_FIELD);
if ( !m_pMyOwnView->isAddFieldVisible() && isUiVisible() )
m_pMyOwnView->toggleAddField();
@@ -3567,6 +3571,10 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
aPos.Y += xShapeProp->getHeight();
aPos.X += nShapeWidth;
}
+ ::rtl::OUString sLabel;
+ if ( xField->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
+ xField->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+
if (pSectionViews[0] != pSectionViews[1] &&
nOBJID == OBJ_DLG_FORMATTEDFIELD) // we want this nice feature only at FORMATTEDFIELD
{
@@ -3574,6 +3582,8 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
// pSectionViews[1].position.x = pSectionViews[0].position.x
uno::Reference< report::XReportComponent> xShapePropLabel(pObjs[0]->getUnoShape(),uno::UNO_QUERY_THROW);
uno::Reference< report::XReportComponent> xShapePropTextField(pObjs[1]->getUnoShape(),uno::UNO_QUERY_THROW);
+ if ( sLabel.getLength() )
+ xShapePropTextField->setName(sLabel);
awt::Point aPosLabel = xShapePropLabel->getPosition();
awt::Point aPosTextField = xShapePropTextField->getPosition();
aPosTextField.X = aPosLabel.X;
@@ -3592,7 +3602,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
xShapePropLabel->setPosition(aPosLabel);
}
OUnoObject* pObj = dynamic_cast<OUnoObject*>(pControl[0]);
- uno::Reference< report::XReportComponent> xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY_THROW);
+ uno::Reference< report::XFixedText> xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY_THROW);
xShapeProp->setName(xShapeProp->getName() + sDefaultName );
for(i = 0; i < sizeof(pControl)/sizeof(pControl[0]);++i) // insert controls
@@ -4378,3 +4388,26 @@ embed::VisualRepresentation SAL_CALL OReportController::getPreferredVisualRepres
{
return embed::EmbedMapUnits::ONE_100TH_MM;
}
+// -----------------------------------------------------------------------------
+uno::Reference< container::XNameAccess > OReportController::getColumns() const
+{
+ if ( !m_xColumns.is() && m_xReportDefinition.is() && m_xReportDefinition->getCommand().getLength() )
+ {
+ m_xColumns = dbtools::getFieldsByCommandDescriptor(getConnection(),m_xReportDefinition->getCommandType(),m_xReportDefinition->getCommand(),m_xHoldAlive);
+ }
+ return m_xColumns;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString OReportController::getColumnLabel_throw(const ::rtl::OUString& i_sColumnName) const
+{
+ ::rtl::OUString sLabel;
+ uno::Reference< container::XNameAccess > xColumns = getColumns();
+ if ( xColumns.is() && xColumns->hasByName(i_sColumnName) )
+ {
+ uno::Reference< beans::XPropertySet> xColumn(xColumns->getByName(i_sColumnName),uno::UNO_QUERY_THROW);
+ if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
+ xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
+ }
+ return sLabel;
+}
+// -----------------------------------------------------------------------------
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx
index a781a9f654d7..686a6515854a 100644
--- a/reportdesign/source/ui/report/SectionWindow.cxx
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -32,7 +32,6 @@
#include "ReportWindow.hxx"
#include "ReportRuler.hxx"
#include "rptui_slotid.hrc"
-#include <svtools/colorcfg.hxx>
#include "ReportController.hxx"
#include "SectionView.hxx"
#include "RptDef.hxx"
@@ -41,13 +40,16 @@
#include "uistrings.hrc"
#include "helpids.hrc"
#include "RptResId.hrc"
+#include "StartMarker.hxx"
+#include "EndMarker.hxx"
+#include "ViewsWindow.hxx"
+
+#include <svtools/colorcfg.hxx>
#include <boost/bind.hpp>
#include <functional>
#include <algorithm>
#include <vcl/svapp.hxx>
-#include "StartMarker.hxx"
-#include "EndMarker.hxx"
-#include "ViewsWindow.hxx"
+#include <connectivity/dbtools.hxx>
namespace rptui
{
@@ -195,8 +197,15 @@ bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>&
const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection.getSection() ;
if ( bRet )
{
+ ::rtl::OUString sExpression = _xGroup->getExpression();
+ ::rtl::OUString sLabel = getViewsWindow()->getView()->getReportView()->getController().getColumnLabel_throw(sExpression);
+ if ( sLabel.getLength() )
+ {
+ sExpression = sLabel;
+ }
+
String sTitle = String(ModuleRes(_nResId));
- sTitle.SearchAndReplace('#',_xGroup->getExpression());
+ sTitle.SearchAndReplace('#',sExpression);
m_aStartMarker.setTitle(sTitle);
m_aStartMarker.Invalidate(INVALIDATE_CHILDREN);
} // if ( _pIsSectionOn(&aGroupHelper) )