summaryrefslogtreecommitdiff
path: root/dbaccess/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/core')
-rw-r--r--dbaccess/source/core/api/BookmarkSet.cxx36
-rw-r--r--dbaccess/source/core/api/BookmarkSet.hxx4
-rw-r--r--dbaccess/source/core/api/CIndexes.cxx3
-rw-r--r--dbaccess/source/core/api/CIndexes.hxx10
-rw-r--r--dbaccess/source/core/api/CRowSetColumn.cxx53
-rw-r--r--dbaccess/source/core/api/CRowSetColumn.hxx5
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.cxx69
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.hxx13
-rw-r--r--dbaccess/source/core/api/CacheSet.cxx12
-rw-r--r--dbaccess/source/core/api/CacheSet.hxx4
-rw-r--r--dbaccess/source/core/api/FilteredContainer.cxx46
-rw-r--r--dbaccess/source/core/api/HelperCollections.cxx9
-rw-r--r--dbaccess/source/core/api/HelperCollections.hxx17
-rw-r--r--dbaccess/source/core/api/KeySet.cxx84
-rw-r--r--dbaccess/source/core/api/KeySet.hxx19
-rw-r--r--dbaccess/source/core/api/OptimisticSet.cxx32
-rw-r--r--dbaccess/source/core/api/OptimisticSet.hxx6
-rw-r--r--dbaccess/source/core/api/PrivateRow.cxx27
-rw-r--r--dbaccess/source/core/api/PrivateRow.hxx6
-rw-r--r--dbaccess/source/core/api/RowSet.cxx237
-rw-r--r--dbaccess/source/core/api/RowSet.hxx32
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx107
-rw-r--r--dbaccess/source/core/api/RowSetBase.hxx33
-rw-r--r--dbaccess/source/core/api/RowSetCache.cxx39
-rw-r--r--dbaccess/source/core/api/RowSetCache.hxx4
-rw-r--r--dbaccess/source/core/api/RowSetCacheIterator.hxx9
-rw-r--r--dbaccess/source/core/api/RowSetRow.hxx9
-rw-r--r--dbaccess/source/core/api/SingleSelectQueryComposer.cxx165
-rw-r--r--dbaccess/source/core/api/StaticSet.cxx20
-rw-r--r--dbaccess/source/core/api/StaticSet.hxx4
-rw-r--r--dbaccess/source/core/api/TableDeco.cxx60
-rw-r--r--dbaccess/source/core/api/View.cxx2
-rw-r--r--dbaccess/source/core/api/WrappedResultSet.cxx38
-rw-r--r--dbaccess/source/core/api/WrappedResultSet.hxx4
-rw-r--r--dbaccess/source/core/api/callablestatement.cxx51
-rw-r--r--dbaccess/source/core/api/column.cxx9
-rw-r--r--dbaccess/source/core/api/columnsettings.cxx18
-rw-r--r--dbaccess/source/core/api/datacolumn.cxx3
-rw-r--r--dbaccess/source/core/api/datacolumn.hxx9
-rw-r--r--dbaccess/source/core/api/datasettings.cxx2
-rw-r--r--dbaccess/source/core/api/definitioncolumn.cxx88
-rw-r--r--dbaccess/source/core/api/preparedstatement.cxx70
-rw-r--r--dbaccess/source/core/api/query.cxx43
-rw-r--r--dbaccess/source/core/api/query.hxx7
-rw-r--r--dbaccess/source/core/api/querycomposer.cxx7
-rw-r--r--dbaccess/source/core/api/querycontainer.cxx28
-rw-r--r--dbaccess/source/core/api/querydescriptor.cxx36
-rw-r--r--dbaccess/source/core/api/querydescriptor.hxx19
-rw-r--r--dbaccess/source/core/api/resultcolumn.cxx58
-rw-r--r--dbaccess/source/core/api/resultcolumn.hxx4
-rw-r--r--dbaccess/source/core/api/resultset.cxx32
-rw-r--r--dbaccess/source/core/api/resultset.hxx8
-rw-r--r--dbaccess/source/core/api/statement.cxx71
-rw-r--r--dbaccess/source/core/api/table.cxx56
-rw-r--r--dbaccess/source/core/api/tablecontainer.cxx78
-rw-r--r--dbaccess/source/core/api/viewcontainer.cxx26
-rw-r--r--dbaccess/source/core/dataaccess/ComponentDefinition.cxx18
-rw-r--r--dbaccess/source/core/dataaccess/ComponentDefinition.hxx7
-rw-r--r--dbaccess/source/core/dataaccess/ContentHelper.cxx98
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx206
-rw-r--r--dbaccess/source/core/dataaccess/SharedConnection.cxx71
-rw-r--r--dbaccess/source/core/dataaccess/SharedConnection.hxx16
-rw-r--r--dbaccess/source/core/dataaccess/bookmarkcontainer.cxx30
-rw-r--r--dbaccess/source/core/dataaccess/commandcontainer.cxx12
-rw-r--r--dbaccess/source/core/dataaccess/commandcontainer.hxx5
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.cxx33
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.hxx5
-rw-r--r--dbaccess/source/core/dataaccess/connection.cxx17
-rw-r--r--dbaccess/source/core/dataaccess/connection.hxx9
-rw-r--r--dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx70
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx82
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx196
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.hxx33
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.cxx66
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.hxx12
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx207
-rw-r--r--dbaccess/source/core/dataaccess/datasource.hxx12
-rw-r--r--dbaccess/source/core/dataaccess/definitioncontainer.cxx34
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx90
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.hxx5
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx187
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.hxx7
-rw-r--r--dbaccess/source/core/dataaccess/documenteventexecutor.cxx34
-rw-r--r--dbaccess/source/core/dataaccess/documenteventexecutor.hxx14
-rw-r--r--dbaccess/source/core/dataaccess/documenteventnotifier.cxx38
-rw-r--r--dbaccess/source/core/dataaccess/documenteventnotifier.hxx5
-rw-r--r--dbaccess/source/core/dataaccess/documentevents.cxx62
-rw-r--r--dbaccess/source/core/dataaccess/intercept.cxx44
-rw-r--r--dbaccess/source/core/dataaccess/intercept.hxx9
-rw-r--r--dbaccess/source/core/dataaccess/myucp_datasupplier.cxx150
-rw-r--r--dbaccess/source/core/dataaccess/myucp_datasupplier.hxx46
-rw-r--r--dbaccess/source/core/dataaccess/myucp_resultset.cxx9
-rw-r--r--dbaccess/source/core/dataaccess/myucp_resultset.hxx7
-rw-r--r--dbaccess/source/core/inc/ContainerMediator.hxx5
-rw-r--r--dbaccess/source/core/inc/ContentHelper.hxx20
-rw-r--r--dbaccess/source/core/inc/DatabaseDataProvider.hxx21
-rw-r--r--dbaccess/source/core/inc/FilteredContainer.hxx5
-rw-r--r--dbaccess/source/core/inc/ModelImpl.hxx109
-rw-r--r--dbaccess/source/core/inc/PropertyForward.hxx7
-rw-r--r--dbaccess/source/core/inc/RefreshListener.hxx5
-rw-r--r--dbaccess/source/core/inc/SingleSelectQueryComposer.hxx10
-rw-r--r--dbaccess/source/core/inc/TableDeco.hxx14
-rw-r--r--dbaccess/source/core/inc/View.hxx5
-rw-r--r--dbaccess/source/core/inc/bookmarkcontainer.hxx13
-rw-r--r--dbaccess/source/core/inc/callablestatement.hxx8
-rw-r--r--dbaccess/source/core/inc/column.hxx18
-rw-r--r--dbaccess/source/core/inc/columnsettings.hxx5
-rw-r--r--dbaccess/source/core/inc/commandbase.hxx5
-rw-r--r--dbaccess/source/core/inc/composertools.hxx5
-rw-r--r--dbaccess/source/core/inc/containerapprove.hxx5
-rw-r--r--dbaccess/source/core/inc/databasecontext.hxx24
-rw-r--r--dbaccess/source/core/inc/datasettings.hxx5
-rw-r--r--dbaccess/source/core/inc/definitioncolumn.hxx8
-rw-r--r--dbaccess/source/core/inc/definitioncontainer.hxx8
-rw-r--r--dbaccess/source/core/inc/documentevents.hxx19
-rw-r--r--dbaccess/source/core/inc/migrwarndlg.hxx5
-rw-r--r--dbaccess/source/core/inc/object.hxx33
-rw-r--r--dbaccess/source/core/inc/objectnameapproval.hxx11
-rw-r--r--dbaccess/source/core/inc/preparedstatement.hxx8
-rw-r--r--dbaccess/source/core/inc/querycomposer.hxx8
-rw-r--r--dbaccess/source/core/inc/querycontainer.hxx5
-rw-r--r--dbaccess/source/core/inc/recovery/dbdocrecovery.hxx9
-rw-r--r--dbaccess/source/core/inc/sdbcoretools.hxx5
-rw-r--r--dbaccess/source/core/inc/statement.hxx9
-rw-r--r--dbaccess/source/core/inc/table.hxx12
-rw-r--r--dbaccess/source/core/inc/tablecontainer.hxx8
-rw-r--r--dbaccess/source/core/inc/veto.hxx7
-rw-r--r--dbaccess/source/core/inc/viewcontainer.hxx8
-rw-r--r--dbaccess/source/core/misc/ContainerMediator.cxx5
-rw-r--r--dbaccess/source/core/misc/DatabaseDataProvider.cxx89
-rw-r--r--dbaccess/source/core/misc/PropertyForward.cxx7
-rw-r--r--dbaccess/source/core/misc/apitools.cxx95
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx84
-rw-r--r--dbaccess/source/core/misc/objectnameapproval.cxx20
-rw-r--r--dbaccess/source/core/misc/sdbcoretools.cxx18
-rw-r--r--dbaccess/source/core/misc/services.cxx59
-rw-r--r--dbaccess/source/core/misc/veto.cxx5
-rw-r--r--dbaccess/source/core/recovery/dbdocrecovery.cxx50
-rw-r--r--dbaccess/source/core/recovery/settingsimport.cxx8
-rw-r--r--dbaccess/source/core/recovery/settingsimport.hxx7
-rw-r--r--dbaccess/source/core/recovery/storagestream.cxx3
-rw-r--r--dbaccess/source/core/recovery/storagestream.hxx5
-rw-r--r--dbaccess/source/core/recovery/storagetextstream.cxx22
-rw-r--r--dbaccess/source/core/recovery/storagetextstream.hxx12
-rw-r--r--dbaccess/source/core/recovery/storagexmlstream.cxx56
-rw-r--r--dbaccess/source/core/recovery/storagexmlstream.hxx20
-rw-r--r--dbaccess/source/core/recovery/subcomponentloader.cxx2
-rw-r--r--dbaccess/source/core/recovery/subcomponentloader.hxx5
-rw-r--r--dbaccess/source/core/recovery/subcomponentrecovery.cxx18
-rw-r--r--dbaccess/source/core/recovery/subcomponentrecovery.hxx10
-rw-r--r--dbaccess/source/core/recovery/subcomponents.hxx5
-rw-r--r--dbaccess/source/core/resource/core_resource.cxx22
152 files changed, 2213 insertions, 2753 deletions
diff --git a/dbaccess/source/core/api/BookmarkSet.cxx b/dbaccess/source/core/api/BookmarkSet.cxx
index b21d7cbbb666..75b369885e3b 100644
--- a/dbaccess/source/core/api/BookmarkSet.cxx
+++ b/dbaccess/source/core/api/BookmarkSet.cxx
@@ -27,12 +27,8 @@ using namespace dbaccess;
using namespace ::connectivity;
using namespace ::dbtools;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace ::osl;
void OBookmarkSet::construct(const Reference< XResultSet>& _xDriverSet,const OUString& i_sRowSetFilter)
{
@@ -142,56 +138,56 @@ void OBookmarkSet::updateColumn(sal_Int32 nPos, const Reference< XRowUpdate >& _
break;
case DataType::CHAR:
case DataType::VARCHAR:
- _xParameter->updateString(nPos,_rValue);
+ _xParameter->updateString(nPos,_rValue.getString());
break;
case DataType::BIGINT:
if ( _rValue.isSigned() )
- _xParameter->updateLong(nPos,_rValue);
+ _xParameter->updateLong(nPos,_rValue.getLong());
else
- _xParameter->updateString(nPos,_rValue);
+ _xParameter->updateString(nPos,_rValue.getString());
break;
case DataType::BIT:
case DataType::BOOLEAN:
- _xParameter->updateBoolean(nPos,bool(_rValue));
+ _xParameter->updateBoolean(nPos,_rValue.getBool());
break;
case DataType::TINYINT:
if ( _rValue.isSigned() )
- _xParameter->updateByte(nPos,_rValue);
+ _xParameter->updateByte(nPos,_rValue.getInt8());
else
- _xParameter->updateShort(nPos,_rValue);
+ _xParameter->updateShort(nPos,_rValue.getInt16());
break;
case DataType::SMALLINT:
if ( _rValue.isSigned() )
- _xParameter->updateShort(nPos,_rValue);
+ _xParameter->updateShort(nPos,_rValue.getInt16());
else
- _xParameter->updateInt(nPos,_rValue);
+ _xParameter->updateInt(nPos,_rValue.getInt32());
break;
case DataType::INTEGER:
if ( _rValue.isSigned() )
- _xParameter->updateInt(nPos,_rValue);
+ _xParameter->updateInt(nPos,_rValue.getInt32());
else
- _xParameter->updateLong(nPos,_rValue);
+ _xParameter->updateLong(nPos,_rValue.getLong());
break;
case DataType::FLOAT:
- _xParameter->updateFloat(nPos,_rValue);
+ _xParameter->updateFloat(nPos,_rValue.getFloat());
break;
case DataType::DOUBLE:
case DataType::REAL:
- _xParameter->updateDouble(nPos,_rValue);
+ _xParameter->updateDouble(nPos,_rValue.getDouble());
break;
case DataType::DATE:
- _xParameter->updateDate(nPos,_rValue);
+ _xParameter->updateDate(nPos,_rValue.getDate());
break;
case DataType::TIME:
- _xParameter->updateTime(nPos,_rValue);
+ _xParameter->updateTime(nPos,_rValue.getTime());
break;
case DataType::TIMESTAMP:
- _xParameter->updateTimestamp(nPos,_rValue);
+ _xParameter->updateTimestamp(nPos,_rValue.getDateTime());
break;
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
- _xParameter->updateBytes(nPos,_rValue);
+ _xParameter->updateBytes(nPos,_rValue.getSequence());
break;
case DataType::BLOB:
case DataType::CLOB:
diff --git a/dbaccess/source/core/api/BookmarkSet.hxx b/dbaccess/source/core/api/BookmarkSet.hxx
index 6567d50b75b6..9863a80ecb82 100644
--- a/dbaccess/source/core/api/BookmarkSet.hxx
+++ b/dbaccess/source/core/api/BookmarkSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_BOOKMARKSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_BOOKMARKSET_HXX
+#pragma once
#include "CacheSet.hxx"
#include <com/sun/star/sdbcx/XRowLocate.hpp>
@@ -54,6 +53,5 @@ namespace dbaccess
virtual void deleteRow(const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_BOOKMARKSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/CIndexes.cxx b/dbaccess/source/core/api/CIndexes.cxx
index 409d877288b8..9b3dd5aefa83 100644
--- a/dbaccess/source/core/api/CIndexes.cxx
+++ b/dbaccess/source/core/api/CIndexes.cxx
@@ -25,11 +25,8 @@ using namespace connectivity::sdbcx;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace dbaccess;
-using namespace cppu;
ObjectType OIndexes::createObject(const OUString& _rName)
diff --git a/dbaccess/source/core/api/CIndexes.hxx b/dbaccess/source/core/api/CIndexes.hxx
index 0ee3d5ced152..d8dbeb82a8f6 100644
--- a/dbaccess/source/core/api/CIndexes.hxx
+++ b/dbaccess/source/core/api/CIndexes.hxx
@@ -17,10 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_CINDEXES_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_CINDEXES_HXX
+#pragma once
#include <connectivity/TIndexes.hxx>
+#include <utility>
namespace dbaccess
{
@@ -36,15 +36,13 @@ namespace dbaccess
OIndexes(connectivity::OTableHelper* _pTable,
::osl::Mutex& _rMutex,
const std::vector< OUString> &_rVector,
- const css::uno::Reference< css::container::XNameAccess >& _rxIndexes
+ css::uno::Reference< css::container::XNameAccess > _rxIndexes
) : connectivity::OIndexesHelper(_pTable,_rMutex,_rVector)
- ,m_xIndexes(_rxIndexes)
+ ,m_xIndexes(std::move(_rxIndexes))
{}
virtual void disposing() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_CINDEXES_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/CRowSetColumn.cxx b/dbaccess/source/core/api/CRowSetColumn.cxx
index cef90a8e8521..98435b7c4498 100644
--- a/dbaccess/source/core/api/CRowSetColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetColumn.cxx
@@ -19,9 +19,11 @@
#include <stringconstants.hxx>
-#include <apitools.hxx>
+#include <strings.hxx>
#include "CRowSetColumn.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
@@ -42,31 +44,30 @@ ORowSetColumn::ORowSetColumn( const Reference < XResultSetMetaData >& _xMetaData
::cppu::IPropertyArrayHelper* ORowSetColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_SEQUENCE(21)
-
- DECL_PROP1( CATALOGNAME, OUString, READONLY );
- DECL_PROP1( DISPLAYSIZE, sal_Int32, READONLY );
- DECL_PROP1_BOOL( ISAUTOINCREMENT, READONLY );
- DECL_PROP1_BOOL( ISCASESENSITIVE, READONLY );
- DECL_PROP1_BOOL( ISCURRENCY, READONLY );
- DECL_PROP1_BOOL( ISDEFINITELYWRITABLE, READONLY );
- DECL_PROP1( ISNULLABLE, sal_Int32, READONLY );
- DECL_PROP1_BOOL( ISREADONLY, BOUND );
- DECL_PROP1_BOOL( ISROWVERSION, READONLY );
- DECL_PROP1_BOOL( ISSEARCHABLE, READONLY );
- DECL_PROP1_BOOL( ISSIGNED, READONLY );
- DECL_PROP1_BOOL( ISWRITABLE, READONLY );
- DECL_PROP1( LABEL, OUString, READONLY );
- DECL_PROP1( PRECISION, sal_Int32, READONLY );
- DECL_PROP1( SCALE, sal_Int32, READONLY );
- DECL_PROP1( SCHEMANAME, OUString, READONLY );
- DECL_PROP1( SERVICENAME, OUString, READONLY );
- DECL_PROP1( TABLENAME, OUString, READONLY );
- DECL_PROP1( TYPE, sal_Int32, READONLY );
- DECL_PROP1( TYPENAME, OUString, READONLY );
- DECL_PROP2( VALUE, Any, READONLY, BOUND );
-
- END_PROPERTY_SEQUENCE()
+ css::uno::Sequence< css::beans::Property> aDescriptor
+ {
+ { PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_DISPLAYSIZE, PROPERTY_ID_DISPLAYSIZE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCASESENSITIVE, PROPERTY_ID_ISCASESENSITIVE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISDEFINITELYWRITABLE, PROPERTY_ID_ISDEFINITELYWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISREADONLY, PROPERTY_ID_ISREADONLY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSEARCHABLE, PROPERTY_ID_ISSEARCHABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSIGNED, PROPERTY_ID_ISSIGNED, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISWRITABLE, PROPERTY_ID_ISWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_LABEL, PROPERTY_ID_LABEL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_PRECISION, PROPERTY_ID_PRECISION, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCALE, PROPERTY_ID_SCALE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SERVICENAME, PROPERTY_ID_SERVICENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPE, PROPERTY_ID_TYPE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_VALUE, PROPERTY_ID_VALUE, cppu::UnoType<Any>::get(), css::beans::PropertyAttribute::READONLY | css::beans::PropertyAttribute::BOUND}
+ };
Sequence< Property > aRegisteredProperties;
describeProperties( aRegisteredProperties );
diff --git a/dbaccess/source/core/api/CRowSetColumn.hxx b/dbaccess/source/core/api/CRowSetColumn.hxx
index 25c4b3310705..bc0ae7eedf5a 100644
--- a/dbaccess/source/core/api/CRowSetColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetColumn.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_CROWSETCOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_CROWSETCOLUMN_HXX
+#pragma once
#include "RowSetRow.hxx"
#include <connectivity/CommonTools.hxx>
@@ -47,6 +46,4 @@ namespace dbaccess
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_CROWSETCOLUMN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.cxx b/dbaccess/source/core/api/CRowSetDataColumn.cxx
index f1d845e11517..693e1ad3dd75 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.cxx
@@ -20,11 +20,12 @@
#include "CRowSetDataColumn.hxx"
#include <stringconstants.hxx>
-#include <apitools.hxx>
+#include <strings.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
+#include <utility>
using namespace dbaccess;
using namespace comphelper;
@@ -34,7 +35,6 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
using namespace cppu;
using namespace osl;
@@ -44,13 +44,13 @@ ORowSetDataColumn::ORowSetDataColumn( const Reference < XResultSetMetaData >& _x
const Reference < XRowUpdate >& _xRowUpdate,
sal_Int32 _nPos,
const Reference< XDatabaseMetaData >& _rxDBMeta,
- const OUString& _rDescription,
- const OUString& i_sLabel,
- const std::function<const ORowSetValue& (sal_Int32)> &_getValue)
+ OUString i_sDescription,
+ OUString i_sLabel,
+ std::function<const ORowSetValue& (sal_Int32)> _getValue)
:ODataColumn(_xMetaData,_xRow,_xRowUpdate,_nPos,_rxDBMeta)
- ,m_pGetValue(_getValue)
- ,m_sLabel(i_sLabel)
- ,m_aDescription(_rDescription)
+ ,m_pGetValue(std::move(_getValue))
+ ,m_sLabel(std::move(i_sLabel))
+ ,m_aDescription(std::move(i_sDescription))
{
OColumnSettings::registerProperties( *this );
registerProperty( PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, PropertyAttribute::READONLY, &m_aDescription, cppu::UnoType<decltype(m_aDescription)>::get() );
@@ -63,31 +63,30 @@ ORowSetDataColumn::~ORowSetDataColumn()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* ORowSetDataColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_SEQUENCE(21)
-
- DECL_PROP1( CATALOGNAME, OUString, READONLY );
- DECL_PROP1( DISPLAYSIZE, sal_Int32, READONLY );
- DECL_PROP1_BOOL( ISAUTOINCREMENT, READONLY );
- DECL_PROP1_BOOL( ISCASESENSITIVE, READONLY );
- DECL_PROP1_BOOL( ISCURRENCY, READONLY );
- DECL_PROP1_BOOL( ISDEFINITELYWRITABLE, READONLY );
- DECL_PROP1( ISNULLABLE, sal_Int32, READONLY );
- DECL_PROP1_BOOL( ISREADONLY, BOUND );
- DECL_PROP1_BOOL( ISROWVERSION, READONLY );
- DECL_PROP1_BOOL( ISSEARCHABLE, READONLY );
- DECL_PROP1_BOOL( ISSIGNED, READONLY );
- DECL_PROP1_BOOL( ISWRITABLE, READONLY );
- DECL_PROP1( LABEL, OUString, READONLY );
- DECL_PROP1( PRECISION, sal_Int32, READONLY );
- DECL_PROP1( SCALE, sal_Int32, READONLY );
- DECL_PROP1( SCHEMANAME, OUString, READONLY );
- DECL_PROP1( SERVICENAME, OUString, READONLY );
- DECL_PROP1( TABLENAME, OUString, READONLY );
- DECL_PROP1( TYPE, sal_Int32, READONLY );
- DECL_PROP1( TYPENAME, OUString, READONLY );
- DECL_PROP1( VALUE, Any, BOUND );
-
- END_PROPERTY_SEQUENCE()
+ css::uno::Sequence< css::beans::Property> aDescriptor
+ {
+ { PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_DISPLAYSIZE, PROPERTY_ID_DISPLAYSIZE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCASESENSITIVE, PROPERTY_ID_ISCASESENSITIVE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISDEFINITELYWRITABLE, PROPERTY_ID_ISDEFINITELYWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISREADONLY, PROPERTY_ID_ISREADONLY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSEARCHABLE, PROPERTY_ID_ISSEARCHABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSIGNED, PROPERTY_ID_ISSIGNED, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISWRITABLE, PROPERTY_ID_ISWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_LABEL, PROPERTY_ID_LABEL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_PRECISION, PROPERTY_ID_PRECISION, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCALE, PROPERTY_ID_SCALE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SERVICENAME, PROPERTY_ID_SERVICENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPE, PROPERTY_ID_TYPE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_VALUE, PROPERTY_ID_VALUE, cppu::UnoType<Any>::get(), css::beans::PropertyAttribute::BOUND }
+ };
Sequence< Property > aRegisteredProperties;
describeProperties( aRegisteredProperties );
@@ -193,12 +192,12 @@ void ORowSetDataColumn::fireValueChange(const ORowSetValue& _rOldValue)
ORowSetDataColumns::ORowSetDataColumns(
bool _bCase,
- const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
+ ::rtl::Reference< ::connectivity::OSQLColumns> _xColumns,
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const std::vector< OUString> &_rVector
) : connectivity::sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
- ,m_aColumns(_rColumns)
+ ,m_aColumns(std::move(_xColumns))
{
}
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.hxx b/dbaccess/source/core/api/CRowSetDataColumn.hxx
index 24863cb0a2ce..a19aad8497e5 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.hxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_CROWSETDATACOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_CROWSETDATACOLUMN_HXX
+#pragma once
#include "datacolumn.hxx"
#include "RowSetRow.hxx"
@@ -50,9 +49,9 @@ namespace dbaccess
const css::uno::Reference < css::sdbc::XRowUpdate >& _xRowUpdate,
sal_Int32 _nPos,
const css::uno::Reference< css::sdbc::XDatabaseMetaData >& _rxDBMeta,
- const OUString& _rDescription,
- const OUString& i_sLabel,
- const std::function<const ::connectivity::ORowSetValue& (sal_Int32)> &_getValue);
+ OUString i_sDescription,
+ OUString i_sLabel,
+ std::function<const ::connectivity::ORowSetValue& (sal_Int32)> _getValue);
// css::lang::XTypeProvider
@@ -85,7 +84,7 @@ namespace dbaccess
public:
ORowSetDataColumns(
bool _bCase,
- const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
+ ::rtl::Reference< ::connectivity::OSQLColumns> _xColumns,
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const std::vector< OUString> &_rVector
@@ -97,6 +96,4 @@ namespace dbaccess
};
}
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index 92c1484edd75..dd266949cb7f 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -36,6 +36,7 @@
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace comphelper;
@@ -49,7 +50,6 @@ using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::io;
-using namespace ::osl;
OCacheSet::OCacheSet(sal_Int32 i_nMaxRows)
@@ -120,7 +120,7 @@ OCacheSet::~OCacheSet()
}
catch(Exception&)
{
- SAL_WARN("dbaccess", "Exception occurred");
+ TOOLS_WARN_EXCEPTION("dbaccess", "");
}
catch(...)
{
@@ -159,14 +159,14 @@ void OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQ
connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->end();
for(; aIter != aEnd;++aIter)
{
- aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) ).append(",");
+ aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) + ",");
aValues.append("?,");
}
aSql[aSql.getLength() - 1] = ')';
aValues[aValues.getLength() - 1] = ')';
- aSql.append(aValues.makeStringAndClear());
+ aSql.append(aValues);
// now create end execute the prepared statement
{
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(aSql.makeStringAndClear()));
@@ -260,7 +260,7 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow
}
if(aIter->isModified())
{
- _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) ).append("?,");
+ _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) + "?,");
}
}
}
@@ -281,7 +281,7 @@ void OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOri
{
aCondition.setLength(aCondition.getLength()-5);
- aSql.append(" WHERE " ).append( aCondition.makeStringAndClear());
+ aSql.append(" WHERE " + aCondition);
}
else
::dbtools::throwSQLException(
diff --git a/dbaccess/source/core/api/CacheSet.hxx b/dbaccess/source/core/api/CacheSet.hxx
index 522d77fafc01..1006b9662f01 100644
--- a/dbaccess/source/core/api/CacheSet.hxx
+++ b/dbaccess/source/core/api/CacheSet.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_CACHESET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_CACHESET_HXX
+#pragma once
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
@@ -169,6 +168,5 @@ namespace dbaccess
virtual void fillMissingValues(ORowSetValueVector::Vector& io_aRow) const;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_CACHESET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx
index 0e8b2926c37e..955a7f1c222f 100644
--- a/dbaccess/source/core/api/FilteredContainer.cxx
+++ b/dbaccess/source/core/api/FilteredContainer.cxx
@@ -26,7 +26,7 @@
#include <comphelper/types.hxx>
#include <connectivity/dbtools.hxx>
#include <tools/wldcrd.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <optional>
#include <sal/log.hxx>
@@ -34,12 +34,8 @@ namespace dbaccess
{
using namespace dbtools;
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
- using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::util;
using namespace ::com::sun::star::container;
using namespace ::osl;
using namespace ::comphelper;
@@ -117,8 +113,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
TableInfo( const OUString& _catalog, const OUString& _schema, const OUString& _name,
const OUString& _type )
- :sComposedName()
- ,sType( _type )
+ :sType( _type )
,sCatalog( _catalog )
,sSchema( _schema )
,sName( _name )
@@ -133,7 +128,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
static void lcl_ensureComposedName( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData )
{
if ( !_metaData.is() )
- throw RuntimeException();
+ throw RuntimeException("lcl_ensureComposedName: _metaData cannot be null!");
if ( !_io_tableInfo.sComposedName )
{
@@ -154,7 +149,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
lcl_ensureComposedName( _io_tableInfo, _metaData );
if ( !_masterContainer.is() )
- throw RuntimeException();
+ throw RuntimeException("lcl_ensureType: _masterContainer cannot be null!");
OUString sTypeName;
try
@@ -169,7 +164,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
_io_tableInfo.sType = OptionalString( sTypeName );
}
- static ::std::vector< OUString> lcl_filter( const TableInfos& _unfilteredTables,
+ static ::std::vector< OUString> lcl_filter( TableInfos&& _unfilteredTables,
const Sequence< OUString >& _tableFilter, const Sequence< OUString >& _tableTypeFilter,
const Reference< XDatabaseMetaData >& _metaData, const Reference< XNameAccess >& _masterContainer )
{
@@ -180,7 +175,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
bool dontFilterTableNames = ( ( nTableFilterCount == 1 ) && _tableFilter[0] == "%" );
if( dontFilterTableNames )
{
- aFilteredTables = _unfilteredTables;
+ aFilteredTables = std::move(_unfilteredTables);
}
else
{
@@ -190,7 +185,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
Sequence< OUString > aNonWildCardTableFilter = _tableFilter;
nTableFilterCount = createWildCardVector( aNonWildCardTableFilter, aWildCardTableFilter );
- TableInfos aUnfilteredTables( _unfilteredTables );
+ TableInfos aUnfilteredTables( std::move(_unfilteredTables) );
aUnfilteredTables.reserve( nTableFilterCount + ( aWildCardTableFilter.size() * 10 ) );
for (auto & unfilteredTable : aUnfilteredTables)
@@ -278,7 +273,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
for ( ; name != nameEnd; ++name )
aUnfilteredTables.emplace_back( *name );
- reFill( lcl_filter( aUnfilteredTables,
+ reFill( lcl_filter( std::move(aUnfilteredTables),
_rTableFilter, _rTableTypeFilter, m_xMetaData, m_xMasterContainer ) );
m_bConstructed = true;
@@ -327,8 +322,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
return;
}
}
- aTableTypeFilter.realloc( 1 );
- aTableTypeFilter[0] = sInherentTableTypeRestriction;
+ aTableTypeFilter = { sInherentTableTypeRestriction };
}
else
{
@@ -343,7 +337,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
}
}
- static const char sAll[] = "%";
+ static constexpr OUString sAll = u"%"_ustr;
Reference< XResultSet > xTables = m_xMetaData->getTables( Any(), sAll, sAll, aTableTypeFilter );
Reference< XRow > xCurrentRow( xTables, UNO_QUERY_THROW );
@@ -360,7 +354,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
aUnfilteredTables.emplace_back( sCatalog, sSchema, sName, sType );
}
- reFill( lcl_filter( aUnfilteredTables,
+ reFill( lcl_filter( std::move(aUnfilteredTables),
_rTableFilter, aTableTypeFilter, m_xMetaData, nullptr ) );
disposeComponent( xTables );
@@ -432,9 +426,9 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
OSL_VERIFY( aFilterModeSetting >>= nFilterMode );
}
- const OUString sAll( "%" );
- const OUString sView( "VIEW" );
- const OUString sTable( "TABLE" );
+ static constexpr OUString sAll( u"%"_ustr );
+ static constexpr OUString sView( u"VIEW"_ustr );
+ static constexpr OUString sTable( u"TABLE"_ustr );
switch ( nFilterMode )
{
@@ -442,19 +436,13 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::
SAL_WARN("dbaccess", "OTableContainer::getAllTableTypeFilter: unknown TableTypeFilterMode!" );
[[fallthrough]];
case FILTER_MODE_MIX_ALL:
- _rFilter.realloc( 3 );
- _rFilter[0] = sView;
- _rFilter[1] = sTable;
- _rFilter[2] = sAll;
+ _rFilter = { sView, sTable, sAll };
break;
case FILTER_MODE_FIXED:
- _rFilter.realloc( 2 );
- _rFilter[0] = sView;
- _rFilter[1] = sTable;
+ _rFilter = { sView, sTable };
break;
case FILTER_MODE_WILDCARD:
- _rFilter.realloc( 1 );
- _rFilter[0] = sAll;
+ _rFilter = { sAll };
break;
case FILTER_MODE_STANDARD:
_rFilter.realloc( 0 );
diff --git a/dbaccess/source/core/api/HelperCollections.cxx b/dbaccess/source/core/api/HelperCollections.cxx
index dfc18badc688..2a04b632a7ce 100644
--- a/dbaccess/source/core/api/HelperCollections.cxx
+++ b/dbaccess/source/core/api/HelperCollections.cxx
@@ -20,6 +20,7 @@
#include "HelperCollections.hxx"
#include <strings.hxx>
+#include <utility>
#include <osl/diagnose.h>
@@ -30,23 +31,19 @@ namespace dbaccess
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::script;
using namespace ::cppu;
using namespace ::osl;
- OPrivateColumns::OPrivateColumns(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
+ OPrivateColumns::OPrivateColumns(::rtl::Reference< ::connectivity::OSQLColumns> _xColumns,
bool _bCase,
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const std::vector< OUString> &_rVector,
bool _bUseAsIndex
) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector,_bUseAsIndex)
- ,m_aColumns(_rColumns)
+ ,m_aColumns(std::move(_xColumns))
{
}
diff --git a/dbaccess/source/core/api/HelperCollections.hxx b/dbaccess/source/core/api/HelperCollections.hxx
index c2406dc492aa..2c066064de54 100644
--- a/dbaccess/source/core/api/HelperCollections.hxx
+++ b/dbaccess/source/core/api/HelperCollections.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_HELPERCOLLECTIONS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_HELPERCOLLECTIONS_HXX
+#pragma once
#include <connectivity/sdbcx/VCollection.hxx>
#include <connectivity/dbconversion.hxx>
@@ -26,15 +25,10 @@
namespace dbaccess
{
using namespace dbtools;
- using namespace comphelper;
using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
- using namespace ::com::sun::star::sdbcx;
- using namespace ::com::sun::star::container;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::script;
using namespace ::cppu;
using namespace ::osl;
@@ -51,7 +45,7 @@ namespace dbaccess
return nullptr;
}
public:
- OPrivateColumns(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
+ OPrivateColumns(::rtl::Reference< ::connectivity::OSQLColumns> _xColumns,
bool _bCase,
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
@@ -84,13 +78,13 @@ namespace dbaccess
return nullptr;
}
public:
- OPrivateTables( const OSQLTables& _rTables,
+ OPrivateTables( OSQLTables _rTables,
bool _bCase,
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
- const std::vector< OUString> &_rVector
+ std::vector< OUString> && _rVector
) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
- ,m_aTables(_rTables)
+ ,m_aTables(std::move(_rTables))
{
}
virtual void disposing() override
@@ -103,6 +97,5 @@ namespace dbaccess
}
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_HELPERCOLLECTIONS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index c9f9ac8a3e22..4ef85e0ce1af 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -18,6 +18,8 @@
*/
#include <memory>
+#include <string_view>
+
#include "KeySet.hxx"
#include <sal/log.hxx>
#include <core_resource.hxx>
@@ -38,13 +40,13 @@
#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
#include <comphelper/types.hxx>
-#include <com/sun/star/sdbcx/KeyType.hpp>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbexception.hxx>
#include <algorithm>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#include <composertools.hxx>
+#include <utility>
#include "PrivateRow.hxx"
using namespace dbaccess;
@@ -61,7 +63,6 @@ using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star;
using namespace ::cppu;
-using namespace ::osl;
using std::vector;
namespace
@@ -102,17 +103,17 @@ namespace
}
-OKeySet::OKeySet(const connectivity::OSQLTable& _xTable,
- const OUString& _rUpdateTableName, // this can be the alias or the full qualified name
+OKeySet::OKeySet(connectivity::OSQLTable _xTable,
+ OUString _sUpdateTableName, // this can be the alias or the full qualified name
const Reference< XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
sal_Int32 i_nMaxRows,
sal_Int32& o_nRowCount)
:OCacheSet(i_nMaxRows)
,m_aParameterValueForCache(new ORowSetValueVector(_aParameterValueForCache))
- ,m_xTable(_xTable)
+ ,m_xTable(std::move(_xTable))
,m_xComposer(_xComposer)
- ,m_sUpdateTableName(_rUpdateTableName)
+ ,m_sUpdateTableName(std::move(_sUpdateTableName))
,m_rRowCount(o_nRowCount)
,m_bRowCountFinal(false)
{
@@ -160,10 +161,11 @@ void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable,
Reference<XIndexAccess> xQueryParameters = xParaSup->getParameters();
const sal_Int32 nParaCount = xQueryParameters->getCount();
Sequence< OUString> aParameterColumns(nParaCount);
+ auto aParameterColumnsRange = asNonConstRange(aParameterColumns);
for(sal_Int32 i = 0; i< nParaCount;++i)
{
Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW);
- xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i];
+ xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumnsRange[i];
}
OUString sUpdateTableName( i_rUpdateTableName );
@@ -210,20 +212,20 @@ void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable,
namespace
{
- void appendOneKeyColumnClause( const OUString &tblName, const OUString &colName, const connectivity::ORowSetValue &_rValue, OUStringBuffer &o_buf )
+ void appendOneKeyColumnClause( std::u16string_view tblName, const OUString &colName, const connectivity::ORowSetValue &_rValue, OUStringBuffer &o_buf )
{
OUString fullName;
- if (tblName.isEmpty())
+ if (tblName.empty())
fullName = colName;
else
- fullName = tblName + "." + colName;
+ fullName = OUString::Concat(tblName) + "." + colName;
if ( _rValue.isNull() )
{
- o_buf.append(fullName).append(" IS NULL ");
+ o_buf.append(fullName + " IS NULL ");
}
else
{
- o_buf.append(fullName).append(" = ? ");
+ o_buf.append(fullName + " = ? ");
}
}
}
@@ -280,7 +282,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet, const OUStrin
Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData();
Reference<XColumnsSupplier> xQueryColSup(m_xComposer, UNO_QUERY);
const Reference<XNameAccess> xQueryColumns = xQueryColSup->getColumns();
- findTableColumnsMatching_throw( makeAny(m_xTable), m_sUpdateTableName, xMeta, xQueryColumns, m_pKeyColumnNames );
+ findTableColumnsMatching_throw( Any(m_xTable), m_sUpdateTableName, xMeta, xQueryColumns, m_pKeyColumnNames );
Reference< XSingleSelectQueryComposer> xSourceComposer(m_xComposer,UNO_QUERY);
Reference< XMultiServiceFactory > xFactory(m_xConnection, UNO_QUERY_THROW);
@@ -404,7 +406,7 @@ Any OKeySet::getBookmark()
{
OSL_ENSURE(m_aKeyIter != m_aKeyMap.end() && m_aKeyIter != m_aKeyMap.begin(),
"getBookmark is only possible when we stand on a valid row!");
- return makeAny(m_aKeyIter->first);
+ return Any(m_aKeyIter->first);
}
bool OKeySet::moveToBookmark( const Any& bookmark )
@@ -442,9 +444,9 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
OUStringBuffer aSql = "UPDATE " + m_aComposedTableName + " SET ";
// list all columns that should be set
- static OUString aPara(" = ?,");
+ constexpr OUStringLiteral aPara(u" = ?,");
OUString aQuote = getIdentifierQuoteString();
- static OUString aAnd(" AND ");
+ constexpr OUString aAnd(u" AND "_ustr);
OUString sIsNull(" IS NULL");
OUString sParam(" = ?");
@@ -461,7 +463,6 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
std::vector<sal_Int32> aIndexColumnPositions;
const sal_Int32 nOldLength = aSql.getLength();
- sal_Int32 i = 1;
// here we build the condition part for the update statement
for (auto const& columnName : *m_pColumnNames)
{
@@ -495,9 +496,8 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
}
if((*_rInsertRow)[columnName.second.nPosition].isModified())
{
- aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName)).append(aPara);
+ aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName) + aPara);
}
- ++i;
}
if( aSql.getLength() != nOldLength )
@@ -512,15 +512,15 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
aSql.append(" WHERE ");
if(!sKeyCondition.isEmpty() && !sIndexCondition.isEmpty())
{
- aSql.append(sKeyCondition.makeStringAndClear()).append(sIndexCondition.makeStringAndClear());
+ aSql.append(sKeyCondition + sIndexCondition);
}
else if(!sKeyCondition.isEmpty())
{
- aSql.append(sKeyCondition.makeStringAndClear());
+ aSql.append(sKeyCondition);
}
else if(!sIndexCondition.isEmpty())
{
- aSql.append(sIndexCondition.makeStringAndClear());
+ aSql.append(sIndexCondition);
}
aSql.setLength(aSql.getLength()-5); // remove the last AND
}
@@ -528,22 +528,21 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
::dbtools::throwSQLException( DBA_RES( RID_STR_NO_CONDITION_FOR_PK ), StandardSQLState::GENERAL_ERROR, m_xConnection );
// now create end execute the prepared statement
- executeUpdate(_rInsertRow ,_rOriginalRow,aSql.makeStringAndClear(),"",aIndexColumnPositions);
+ executeUpdate(_rInsertRow ,_rOriginalRow,aSql.makeStringAndClear(),u"",aIndexColumnPositions);
}
-void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOriginalRow,const OUString& i_sSQL,const OUString& i_sTableName,const std::vector<sal_Int32>& _aIndexColumnPositions)
+void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOriginalRow,const OUString& i_sSQL,std::u16string_view i_sTableName,const std::vector<sal_Int32>& _aIndexColumnPositions)
{
// now create end execute the prepared statement
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
Reference< XParameters > xParameter(xPrep,UNO_QUERY);
bool bRefetch = true;
- Reference<XRow> xRow;
sal_Int32 i = 1;
// first the set values
for (auto const& columnName : *m_pColumnNames)
{
- if ( i_sTableName.isEmpty() || columnName.second.sTableName == i_sTableName )
+ if ( i_sTableName.empty() || columnName.second.sTableName == i_sTableName )
{
sal_Int32 nPos = columnName.second.nPosition;
if((*_rInsertRow)[nPos].isModified())
@@ -561,7 +560,7 @@ void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rO
// and then the values of the where condition
for (auto const& keyColumnName : *m_pKeyColumnNames)
{
- if ( i_sTableName.isEmpty() || keyColumnName.second.sTableName == i_sTableName )
+ if ( i_sTableName.empty() || keyColumnName.second.sTableName == i_sTableName )
{
setParameter(i++,xParameter,(*_rOriginalRow)[keyColumnName.second.nPosition],keyColumnName.second.nType,keyColumnName.second.nScale);
}
@@ -582,8 +581,9 @@ void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rO
{
const sal_Int32 nBookmark = ::comphelper::getINT32((*_rInsertRow)[0].getAny());
m_aKeyIter = m_aKeyMap.find(nBookmark);
+ assert(m_aKeyIter != m_aKeyMap.end());
m_aKeyIter->second.second.first = 2;
- m_aKeyIter->second.second.second = xRow;
+ m_aKeyIter->second.second.second.clear();
copyRowValue(_rInsertRow,m_aKeyIter->second.first,nBookmark);
tryRefetch(_rInsertRow,bRefetch);
}
@@ -610,7 +610,7 @@ void OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLT
{
bRefetch = std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),columnName.second.sRealName) == m_aFilterColumns.end();
}
- aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName)).append(",");
+ aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName) + ",");
aValues.append("?,");
bModified = true;
}
@@ -620,12 +620,12 @@ void OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLT
aSql[aSql.getLength() - 1] = ')';
aValues[aValues.getLength() - 1] = ')';
- aSql.append(aValues.makeStringAndClear());
+ aSql.append(aValues);
// now create,fill and execute the prepared statement
- executeInsert(_rInsertRow,aSql.makeStringAndClear(),"",bRefetch);
+ executeInsert(_rInsertRow,aSql.makeStringAndClear(),u"",bRefetch);
}
-void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQL,const OUString& i_sTableName,bool bRefetch )
+void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQL,std::u16string_view i_sTableName,bool bRefetch )
{
// now create,fill and execute the prepared statement
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
@@ -634,7 +634,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ
sal_Int32 i = 1;
for (auto const& columnName : *m_pColumnNames)
{
- if ( i_sTableName.isEmpty() || columnName.second.sTableName == i_sTableName )
+ if ( i_sTableName.empty() || columnName.second.sTableName == i_sTableName )
{
const sal_Int32 nPos = columnName.second.nPosition;
if((*_rInsertRow)[nPos].isModified())
@@ -704,7 +704,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ
::comphelper::disposeComponent(xPrep);
- if ( i_sTableName.isEmpty() && !bAutoValuesFetched && m_bInserted )
+ if ( i_sTableName.empty() && !bAutoValuesFetched && m_bInserted )
{
// first check if all key column values were set
const OUString sQuote = getIdentifierQuoteString();
@@ -716,14 +716,14 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ
SelectColumnsMetaData::const_iterator aFind = m_pKeyColumnNames->find(autoColumn);
if ( aFind != aEnd )
{
- sMaxStmt.append(" MAX(").append(::dbtools::quoteName( sQuote,aFind->second.sRealName)).append("),");
+ sMaxStmt.append(" MAX(" + ::dbtools::quoteName( sQuote,aFind->second.sRealName) + "),");
}
}
if(!sMaxStmt.isEmpty())
{
sMaxStmt[sMaxStmt.getLength()-1] = ' ';
- OUString sStmt = "SELECT " + sMaxStmt.makeStringAndClear() + "FROM ";
+ OUString sStmt = "SELECT " + sMaxStmt + "FROM ";
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(m_xConnection->getMetaData(),m_sUpdateTableName,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
sStmt += ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable );
@@ -761,7 +761,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ
m_aKeyIter = m_aKeyMap.emplace( aKeyIter->first + 1, OKeySetValue(aKeyRow,std::pair<sal_Int32,Reference<XRow> >(1,Reference<XRow>())) ).first;
// now we set the bookmark for this row
- (*_rInsertRow)[0] = makeAny(static_cast<sal_Int32>(m_aKeyIter->first));
+ (*_rInsertRow)[0] = Any(static_cast<sal_Int32>(m_aKeyIter->first));
tryRefetch(_rInsertRow,bRefetch);
}
}
@@ -781,7 +781,7 @@ void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch)
}
if ( !bRefetch )
{
- m_aKeyIter->second.second.second = new OPrivateRow(*_rInsertRow);
+ m_aKeyIter->second.second.second = new OPrivateRow(std::vector(*_rInsertRow));
}
}
@@ -884,7 +884,7 @@ void OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTa
}
}
}
- aSql.append(sIndexCondition.makeStringAndClear());
+ aSql.append(sIndexCondition);
aSql.setLength(aSql.getLength()-5);
// now create end execute the prepared statement
@@ -910,7 +910,9 @@ void OKeySet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::OSQLTa
if(m_bDeleted)
{
sal_Int32 nBookmark = ::comphelper::getINT32((*_rDeleteRow)[0].getAny());
- if(m_aKeyIter == m_aKeyMap.find(nBookmark) && m_aKeyIter != m_aKeyMap.end())
+ const auto iter = m_aKeyMap.find(nBookmark);
+ assert(iter != m_aKeyMap.end());
+ if(m_aKeyIter == iter && m_aKeyIter != m_aKeyMap.end())
++m_aKeyIter;
m_aKeyMap.erase(nBookmark);
m_bDeleted = true;
@@ -1379,7 +1381,7 @@ namespace dbaccess
void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns,
const css::uno::Sequence< OUString >& _aColumnNames,
- const OUString& _rsUpdateTableName,
+ std::u16string_view _rsUpdateTableName,
SelectColumnsMetaData& o_rColumnNames,
bool i_bAppendTableName)
{
diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx
index 417774cae70f..bd30f3960eb3 100644
--- a/dbaccess/source/core/api/KeySet.hxx
+++ b/dbaccess/source/core/api/KeySet.hxx
@@ -17,13 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_KEYSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_KEYSET_HXX
+#pragma once
#include "CacheSet.hxx"
#include <memory>
#include <map>
+#include <utility>
#include <vector>
#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
@@ -50,8 +50,8 @@ namespace dbaccess
{
}
- SelectColumnDescription( sal_Int32 _nPosition, sal_Int32 _nType, sal_Int32 _nScale,bool _bNullable, const OUString& _rDefaultValue )
- :sDefaultValue( _rDefaultValue )
+ SelectColumnDescription( sal_Int32 _nPosition, sal_Int32 _nType, sal_Int32 _nScale, bool _bNullable, OUString _sDefaultValue )
+ :sDefaultValue(std::move( _sDefaultValue ))
,nPosition( _nPosition )
,nType( _nType )
,nScale( _nScale )
@@ -64,7 +64,7 @@ namespace dbaccess
// the elements of _rxQueryColumns must have the properties PROPERTY_REALNAME and PROPERTY_TABLENAME
void getColumnPositions(const css::uno::Reference< css::container::XNameAccess >& _rxQueryColumns,
const css::uno::Sequence< OUString >& _rColumnNames,
- const OUString& _rsUpdateTableName,
+ std::u16string_view _rsUpdateTableName,
SelectColumnsMetaData& o_rColumnNames /* out */,
bool i_bAppendTableName = false);
@@ -137,14 +137,14 @@ namespace dbaccess
/// @throws css::uno::RuntimeException
bool doTryRefetch_throw();
void tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch);
- void executeUpdate(const ORowSetRow& _rInsertRow, const ORowSetRow& _rOriginalRow, const OUString& i_sSQL, const OUString& i_sTableName,const std::vector<sal_Int32>& _aIndexColumnPositions = std::vector<sal_Int32>());
- void executeInsert( const ORowSetRow& _rInsertRow, const OUString& i_sSQL, const OUString& i_sTableName, bool bRefetch = false);
+ void executeUpdate(const ORowSetRow& _rInsertRow, const ORowSetRow& _rOriginalRow, const OUString& i_sSQL, std::u16string_view i_sTableName,const std::vector<sal_Int32>& _aIndexColumnPositions = std::vector<sal_Int32>());
+ void executeInsert( const ORowSetRow& _rInsertRow, const OUString& i_sSQL, std::u16string_view i_sTableName, bool bRefetch = false);
void executeStatement(OUStringBuffer& io_aFilter, css::uno::Reference< css::sdb::XSingleSelectQueryComposer>& io_xAnalyzer);
virtual ~OKeySet() override;
public:
- OKeySet(const connectivity::OSQLTable& _xTable,
- const OUString& _rUpdateTableName,
+ OKeySet(connectivity::OSQLTable _aTable,
+ OUString _sUpdateTableName,
const css::uno::Reference< css::sdb::XSingleSelectQueryAnalyzer >& _xComposer,
const ORowSetValueVector& _aParameterValueForCache,
sal_Int32 i_nMaxRows,
@@ -213,6 +213,5 @@ namespace dbaccess
virtual void insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_KEYSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index 67fd18aaaea7..df09d7b77588 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -41,22 +41,18 @@ using namespace dbaccess;
using namespace ::connectivity;
using namespace ::dbtools;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star;
-using namespace ::cppu;
-using namespace ::osl;
typedef std::map<OUString, OUStringBuffer> TSQLStatements;
namespace
{
- void lcl_fillKeyCondition(const OUString& i_sTableName,const OUString& i_sQuotedColumnName,const ORowSetValue& i_aValue,TSQLStatements& io_aKeyConditions)
+ void lcl_fillKeyCondition(const OUString& i_sTableName,std::u16string_view i_sQuotedColumnName,const ORowSetValue& i_aValue,TSQLStatements& io_aKeyConditions)
{
OUStringBuffer& rKeyCondition = io_aKeyConditions[i_sTableName];
if ( !rKeyCondition.isEmpty() )
@@ -188,7 +184,7 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _
OUStringBuffer& rPart = aSql[columnName.second.sTableName];
if ( !rPart.isEmpty() )
rPart.append(", ");
- rPart.append(sQuotedColumnName).append(" = ?");
+ rPart.append(sQuotedColumnName + " = ?");
}
}
@@ -208,10 +204,10 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(xMetaData,elem.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
OUStringBuffer sSql("UPDATE " + ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable ) +
- " SET " + elem.second.toString());
+ " SET " + elem.second);
OUStringBuffer& rCondition = aKeyConditions[elem.first];
if ( !rCondition.isEmpty() )
- sSql.append(" WHERE ").append( rCondition.toString() );
+ sSql.append(" WHERE " + rCondition );
executeUpdate(_rInsertRow ,_rOriginalRow,sSql.makeStringAndClear(),elem.first);
}
@@ -266,14 +262,14 @@ void OptimisticSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity:
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(xMetaData,elem.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
OUString sComposedTableName = ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable );
- OUString sSql("INSERT INTO " + sComposedTableName + " ( " + elem.second.toString() +
- ") VALUES ( " + aParameter[elem.first].toString() + " )");
+ OUString sSql("INSERT INTO " + sComposedTableName + " ( " + elem.second +
+ ") VALUES ( " + aParameter[elem.first] + " )");
OUStringBuffer& rCondition = aKeyConditions[elem.first];
if ( !rCondition.isEmpty() )
{
- OUString sQuery("SELECT " + elem.second.toString() + " FROM " + sComposedTableName +
- " WHERE " + rCondition.toString());
+ OUString sQuery("SELECT " + elem.second + " FROM " + sComposedTableName +
+ " WHERE " + rCondition);
try
{
@@ -330,13 +326,13 @@ void OptimisticSet::deleteRow(const ORowSetRow& _rDeleteRow,const connectivity::
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(xMetaData,keyCondition.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
OUString sSql("DELETE FROM " + ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable ) +
- " WHERE " + rCondition.toString() );
+ " WHERE " + rCondition );
executeDelete(_rDeleteRow, sSql, keyCondition.first);
}
}
}
-void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const OUString& i_sSQL,const OUString& i_sTableName)
+void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const OUString& i_sSQL,std::u16string_view i_sTableName)
{
// now create and execute the prepared statement
Reference< XPreparedStatement > xPrep(m_xConnection->prepareStatement(i_sSQL));
@@ -353,7 +349,9 @@ void OptimisticSet::executeDelete(const ORowSetRow& _rDeleteRow,const OUString&
if(m_bDeleted)
{
sal_Int32 nBookmark = ::comphelper::getINT32((*_rDeleteRow)[0].getAny());
- if(m_aKeyIter == m_aKeyMap.find(nBookmark) && m_aKeyIter != m_aKeyMap.end())
+ const auto iter = m_aKeyMap.find(nBookmark);
+ assert(iter != m_aKeyMap.end());
+ if(m_aKeyIter == iter && m_aKeyIter != m_aKeyMap.end())
++m_aKeyIter;
m_aKeyMap.erase(nBookmark);
m_bDeleted = true;
@@ -544,8 +542,8 @@ void OptimisticSet::fillMissingValues(ORowSetValueVector::Vector& io_aRow) const
OUString sCatalog,sSchema,sTable;
::dbtools::qualifiedNameComponents(xMetaData,elem.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
OUString sComposedTableName = ::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable );
- OUString sQuery("SELECT " + elem.second.toString() + " FROM " + sComposedTableName + " WHERE " +
- rCondition.makeStringAndClear());
+ OUString sQuery("SELECT " + elem.second + " FROM " + sComposedTableName + " WHERE " + rCondition);
+ rCondition.setLength(0);
try
{
diff --git a/dbaccess/source/core/api/OptimisticSet.hxx b/dbaccess/source/core/api/OptimisticSet.hxx
index db380d071041..bf5e3a80370a 100644
--- a/dbaccess/source/core/api/OptimisticSet.hxx
+++ b/dbaccess/source/core/api/OptimisticSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_OPTIMISTICSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_OPTIMISTICSET_HXX
+#pragma once
#include "KeySet.hxx"
@@ -40,7 +39,7 @@ namespace dbaccess
mutable bool m_bResultSetChanged;
- void executeDelete(const ORowSetRow& _rDeleteRow,const OUString& i_sSQL,const OUString& i_sTableName);
+ void executeDelete(const ORowSetRow& _rDeleteRow,const OUString& i_sSQL,std::u16string_view i_sTableName);
void fillJoinedColumns_throw(const std::vector< ::connectivity::TNodePair>& i_aJoinColumns);
void fillJoinedColumns_throw(const OUString& i_sLeftColumn,const OUString& i_sRightColumn);
protected:
@@ -73,6 +72,5 @@ namespace dbaccess
const std::map<sal_Int32,sal_Int32>& getJoinedKeyColumns() const { return m_aJoinedKeyColumns; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_OPTIMISTICSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/PrivateRow.cxx b/dbaccess/source/core/api/PrivateRow.cxx
index 22adc74f138a..7e2df82aaeed 100644
--- a/dbaccess/source/core/api/PrivateRow.cxx
+++ b/dbaccess/source/core/api/PrivateRow.cxx
@@ -21,12 +21,9 @@
using namespace dbaccess;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star;
@@ -37,62 +34,62 @@ sal_Bool SAL_CALL OPrivateRow::wasNull( )
OUString SAL_CALL OPrivateRow::getString( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getString();
}
sal_Bool SAL_CALL OPrivateRow::getBoolean( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return bool(m_aRow[m_nPos]);
+ return m_aRow[m_nPos].getBool();
}
::sal_Int8 SAL_CALL OPrivateRow::getByte( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getInt8();
}
::sal_Int16 SAL_CALL OPrivateRow::getShort( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getInt16();
}
::sal_Int32 SAL_CALL OPrivateRow::getInt( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getInt32();
}
::sal_Int64 SAL_CALL OPrivateRow::getLong( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getLong();
}
float SAL_CALL OPrivateRow::getFloat( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getFloat();
}
double SAL_CALL OPrivateRow::getDouble( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getDouble();
}
Sequence< ::sal_Int8 > SAL_CALL OPrivateRow::getBytes( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getSequence();
}
css::util::Date SAL_CALL OPrivateRow::getDate( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getDate();
}
css::util::Time SAL_CALL OPrivateRow::getTime( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getTime();
}
css::util::DateTime SAL_CALL OPrivateRow::getTimestamp( ::sal_Int32 columnIndex )
{
m_nPos = columnIndex;
- return m_aRow[m_nPos];
+ return m_aRow[m_nPos].getDateTime();
}
Reference< css::io::XInputStream > SAL_CALL OPrivateRow::getBinaryStream( ::sal_Int32 columnIndex )
{
diff --git a/dbaccess/source/core/api/PrivateRow.hxx b/dbaccess/source/core/api/PrivateRow.hxx
index 3f8edf0bc7b9..c5ce74f15f43 100644
--- a/dbaccess/source/core/api/PrivateRow.hxx
+++ b/dbaccess/source/core/api/PrivateRow.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_PRIVATEROW_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_PRIVATEROW_HXX
+#pragma once
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -30,7 +29,7 @@ namespace dbaccess
ORowSetValueVector::Vector m_aRow;
sal_Int32 m_nPos;
public:
- explicit OPrivateRow(const ORowSetValueVector::Vector& i_aRow) : m_aRow(i_aRow),m_nPos(0)
+ explicit OPrivateRow(ORowSetValueVector::Vector&& i_aRow) : m_aRow(std::move(i_aRow)),m_nPos(0)
{
}
virtual sal_Bool SAL_CALL wasNull( ) override;
@@ -55,6 +54,5 @@ namespace dbaccess
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( ::sal_Int32 columnIndex ) override;
};
} // dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_PRIVATEROW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 62383ecd5479..d9904071d64b 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -31,11 +31,13 @@
#include "CRowSetDataColumn.hxx"
#include "RowSetCache.hxx"
#include <strings.hrc>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <tablecontainer.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/ErrorCondition.hpp>
@@ -68,9 +70,8 @@
#include <i18nlangtag/languagetag.hxx>
#include <o3tl/safeint.hxx>
#include <unotools/syslocale.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
-using namespace utl;
using namespace dbaccess;
using namespace connectivity;
using namespace comphelper;
@@ -95,24 +96,6 @@ com_sun_star_comp_dba_ORowSet_get_implementation(css::uno::XComponentContext* co
return cppu::acquire(new ORowSet(context));
}
-#define NOTIFY_LISTENERS_CHECK(_rListeners,T,method) \
- std::vector< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \
- \
- _rGuard.clear(); \
- bool bCheck = std::all_of(aListenerSeq.rbegin(), aListenerSeq.rend(), \
- [&aEvt](Reference<XInterface>& rxItem) { \
- try \
- { \
- return static_cast<bool>(static_cast<T*>(rxItem.get())->method(aEvt)); \
- } \
- catch( RuntimeException& ) \
- { \
- return true; \
- } \
- }); \
- _rGuard.reset();
-
-
namespace dbaccess
{
ORowSet::ORowSet( const Reference< css::uno::XComponentContext >& _rxContext )
@@ -123,6 +106,7 @@ ORowSet::ORowSet( const Reference< css::uno::XComponentContext >& _rxContext )
,m_aRowsetListeners(*m_pMutex)
,m_aApproveListeners(*m_pMutex)
,m_aRowsChangeListener(*m_pMutex)
+ ,m_sErrorString(ResourceManager::loadString(RID_STR_COMMAND_LEADING_TO_ERROR))
,m_nFetchDirection(FetchDirection::FORWARD)
,m_nFetchSize(50)
,m_nMaxFieldSize(0)
@@ -424,32 +408,16 @@ Any SAL_CALL ORowSet::queryInterface( const Type & rType )
return ORowSet_BASE1::queryInterface( rType);
}
-void SAL_CALL ORowSet::acquire() throw()
+void SAL_CALL ORowSet::acquire() noexcept
{
ORowSet_BASE1::acquire();
}
-void SAL_CALL ORowSet::release() throw()
+void SAL_CALL ORowSet::release() noexcept
{
ORowSet_BASE1::release();
}
-// css::XUnoTunnel
-sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId )
-{
- if (isUnoTunnelId<ORowSet>(rId))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
-
-Sequence< sal_Int8 > ORowSet::getUnoTunnelId()
-{
- static ::cppu::OImplementationId s_Id;
-
- return s_Id.getImplementationId();
-}
-
// css::XAggregation
Any SAL_CALL ORowSet::queryAggregation( const Type& rType )
{
@@ -637,7 +605,7 @@ void SAL_CALL ORowSet::close( )
MutexGuard aGuard( m_aMutex );
::connectivity::checkDisposed(ORowSet_BASE1::rBHelper.bDisposed);
}
- // additionals things to set
+ // additional things to set
freeResources( true );
}
@@ -664,7 +632,7 @@ void ORowSet::updateValue(sal_Int32 columnIndex,const ORowSetValue& x)
checkUpdateIterator();
ORowSetValueVector::Vector& rRow = **m_aCurrentRow;
- ORowSetNotifier aNotify(this,rRow);
+ ORowSetNotifier aNotify(this, std::vector(rRow));
m_pCache->updateValue(columnIndex,x,rRow,aNotify.getChangedColumns());
m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
@@ -680,7 +648,7 @@ void SAL_CALL ORowSet::updateNull( sal_Int32 columnIndex )
checkUpdateIterator();
ORowSetValueVector::Vector& rRow = **m_aCurrentRow;
- ORowSetNotifier aNotify(this,rRow);
+ ORowSetNotifier aNotify(this, std::vector(rRow));
m_pCache->updateNull(columnIndex,rRow,aNotify.getChangedColumns());
m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
@@ -768,7 +736,7 @@ void SAL_CALL ORowSet::updateCharacterStream( sal_Int32 columnIndex, const Refer
checkUpdateConditions(columnIndex);
checkUpdateIterator();
ORowSetValueVector::Vector& rRow = **m_aCurrentRow;
- ORowSetNotifier aNotify(this,rRow);
+ ORowSetNotifier aNotify(this, std::vector(rRow));
m_pCache->updateCharacterStream(columnIndex,x,length,rRow,aNotify.getChangedColumns());
m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
@@ -812,7 +780,7 @@ void SAL_CALL ORowSet::updateObject( sal_Int32 columnIndex, const Any& x )
if (!::dbtools::implUpdateObject(this, columnIndex, aNewValue))
{ // there is no other updateXXX call which can handle the value in x
ORowSetValueVector::Vector& rRow = **m_aCurrentRow;
- ORowSetNotifier aNotify(this,rRow);
+ ORowSetNotifier aNotify(this, std::vector(rRow));
m_pCache->updateObject(columnIndex,aNewValue,rRow,aNotify.getChangedColumns());
m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
@@ -826,7 +794,7 @@ void SAL_CALL ORowSet::updateNumericObject( sal_Int32 columnIndex, const Any& x,
checkUpdateConditions(columnIndex);
checkUpdateIterator();
ORowSetValueVector::Vector& rRow = **m_aCurrentRow;
- ORowSetNotifier aNotify(this,rRow);
+ ORowSetNotifier aNotify(this, std::vector(rRow));
m_pCache->updateNumericObject(columnIndex,x,rRow,aNotify.getChangedColumns());
m_bModified = m_bModified || !aNotify.getChangedColumns().empty();
aNotify.firePropertyChange();
@@ -993,7 +961,7 @@ void SAL_CALL ORowSet::deleteRow( )
// this call position the cache indirect
Any aBookmarkToDelete( m_aBookmark );
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
sal_Int32 nDeletePosition = m_pCache->getRow();
notifyRowSetAndClonesRowDelete( aBookmarkToDelete );
@@ -1040,7 +1008,7 @@ void ORowSet::implCancelRowUpdates( bool _bNotifyModified )
if ( m_bNew || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
throwFunctionSequenceException(*this);
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
ORowSetRow aOldValues;
if ( !m_bModified && _bNotifyModified && !m_aCurrentRow.isNull() )
@@ -1112,13 +1080,40 @@ void ORowSet::notifyAllListenersRowChanged(::osl::ResettableMutexGuard& _rGuard,
bool ORowSet::notifyAllListenersCursorBeforeMove(::osl::ResettableMutexGuard& _rGuard)
{
EventObject aEvt(*m_pMySelf);
- NOTIFY_LISTENERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveCursorMove);
+ std::vector< Reference< css::sdb::XRowSetApproveListener > > aListenerSeq = m_aApproveListeners.getElements();
+ _rGuard.clear();
+ bool bCheck = std::all_of(aListenerSeq.rbegin(), aListenerSeq.rend(),
+ [&aEvt](Reference<css::sdb::XRowSetApproveListener>& rxItem) {
+ try
+ {
+ return static_cast<bool>(rxItem->approveCursorMove(aEvt));
+ }
+ catch( RuntimeException& )
+ {
+ return true;
+ }
+ });
+ _rGuard.reset();
return bCheck;
}
void ORowSet::notifyAllListenersRowBeforeChange(::osl::ResettableMutexGuard& _rGuard,const RowChangeEvent &aEvt)
{
- NOTIFY_LISTENERS_CHECK(m_aApproveListeners,XRowSetApproveListener,approveRowChange);
+ std::vector< Reference< css::sdb::XRowSetApproveListener > > aListenerSeq = m_aApproveListeners.getElements();
+ _rGuard.clear();
+ bool bCheck = std::all_of(aListenerSeq.rbegin(), aListenerSeq.rend(),
+ [&aEvt](Reference<css::sdb::XRowSetApproveListener>& rxItem) {
+ try
+ {
+ return static_cast<bool>(rxItem->approveRowChange(aEvt));
+ }
+ catch( RuntimeException& )
+ {
+ return true;
+ }
+ });
+ _rGuard.reset();
+
if ( !bCheck )
m_aErrors.raiseTypedException( sdb::ErrorCondition::ROW_SET_OPERATION_VETOED, *this, ::cppu::UnoType< RowSetVetoException >::get() );
}
@@ -1163,12 +1158,12 @@ void SAL_CALL ORowSet::moveToInsertRow( )
ORowSetRow aOldValues;
if ( rowDeleted() )
{
- positionCache( MOVE_FORWARD );
+ positionCache( CursorMoveDirection::Forward );
m_pCache->next();
setCurrentRow( true, false, aOldValues, aGuard);
}
else
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
// check before because the resultset could be empty
if ( !m_bBeforeFirst
@@ -1218,18 +1213,18 @@ void ORowSet::impl_setDataColumnsWriteable_throw()
dataColumn->getPropertyValue(PROPERTY_ISREADONLY) >>= bReadOnly;
*aReadIter = bReadOnly;
- dataColumn->setPropertyValue(PROPERTY_ISREADONLY,makeAny(false));
+ dataColumn->setPropertyValue(PROPERTY_ISREADONLY,Any(false));
++aReadIter;
}
}
void ORowSet::impl_restoreDataColumnsWriteable_throw()
{
- assert(m_aDataColumns.size() == m_aReadOnlyDataColumns.size() || m_aReadOnlyDataColumns.size() == 0 );
+ assert(m_aDataColumns.size() == m_aReadOnlyDataColumns.size() || m_aReadOnlyDataColumns.empty());
TDataColumns::const_iterator aIter = m_aDataColumns.begin();
for (bool readOnlyDataColumn : m_aReadOnlyDataColumns)
{
- (*aIter)->setPropertyValue(PROPERTY_ISREADONLY, makeAny(readOnlyDataColumn) );
+ (*aIter)->setPropertyValue(PROPERTY_ISREADONLY, Any(readOnlyDataColumn) );
++aIter;
}
m_aReadOnlyDataColumns.clear();
@@ -1257,7 +1252,7 @@ void SAL_CALL ORowSet::moveToCurrentRow( )
if ( !notifyAllListenersCursorBeforeMove( aGuard ) )
return;
- positionCache( MOVE_NONE_REFRESH );
+ positionCache( CursorMoveDirection::CurrentRefresh );
ORowSetNotifier aNotifier( this );
@@ -1294,74 +1289,73 @@ const ORowSetValue& ORowSet::getInsertValue(sal_Int32 columnIndex)
OUString SAL_CALL ORowSet::getString( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getString();
}
sal_Bool SAL_CALL ORowSet::getBoolean( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- // the extra cast is to recognise the "true" or "false" strings
- return static_cast<bool>(getInsertValue(columnIndex));
+ return getInsertValue(columnIndex).getBool();
}
sal_Int8 SAL_CALL ORowSet::getByte( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getInt8();
}
sal_Int16 SAL_CALL ORowSet::getShort( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getInt16();
}
sal_Int32 SAL_CALL ORowSet::getInt( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getInt32();
}
sal_Int64 SAL_CALL ORowSet::getLong( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getLong();
}
float SAL_CALL ORowSet::getFloat( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getFloat();
}
double SAL_CALL ORowSet::getDouble( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getDouble();
}
Sequence< sal_Int8 > SAL_CALL ORowSet::getBytes( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getSequence();
}
css::util::Date SAL_CALL ORowSet::getDate( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getDate();
}
css::util::Time SAL_CALL ORowSet::getTime( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getTime();
}
css::util::DateTime SAL_CALL ORowSet::getTimestamp( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getInsertValue(columnIndex);
+ return getInsertValue(columnIndex).getDateTime();
}
Reference< css::io::XInputStream > SAL_CALL ORowSet::getBinaryStream( sal_Int32 columnIndex )
@@ -1504,7 +1498,7 @@ Reference< XIndexAccess > SAL_CALL ORowSet::getParameters( )
// our caller could change our parameters at any time
m_bParametersDirty = true;
- return m_pParameters.get();
+ return m_pParameters;
}
void ORowSet::approveExecution()
@@ -1512,13 +1506,13 @@ void ORowSet::approveExecution()
::osl::MutexGuard aGuard( m_aColumnsMutex );
EventObject aEvt(*this);
- OInterfaceIteratorHelper2 aApproveIter( m_aApproveListeners );
+ OInterfaceIteratorHelper3 aApproveIter( m_aApproveListeners );
while ( aApproveIter.hasMoreElements() )
{
- Reference< XRowSetApproveListener > xListener( static_cast< XRowSetApproveListener* >( aApproveIter.next() ) );
+ Reference< XRowSetApproveListener > xListener( aApproveIter.next() );
try
{
- if ( xListener.is() && !xListener->approveRowSetChange( aEvt ) )
+ if ( !xListener->approveRowSetChange( aEvt ) )
throw RowSetVetoException();
}
catch ( const DisposedException& e )
@@ -1609,8 +1603,8 @@ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxSta
}
}
- _rxStatement->setPropertyValue( PROPERTY_RESULTSETTYPE, makeAny( nResultSetType ) );
- _rxStatement->setPropertyValue( PROPERTY_RESULTSETCONCURRENCY, makeAny( nResultSetConcurrency ) );
+ _rxStatement->setPropertyValue( PROPERTY_RESULTSETTYPE, Any( nResultSetType ) );
+ _rxStatement->setPropertyValue( PROPERTY_RESULTSETCONCURRENCY, Any( nResultSetConcurrency ) );
}
void ORowSet::impl_ensureStatement_throw()
@@ -1637,8 +1631,8 @@ void ORowSet::impl_ensureStatement_throw()
// set the result set type and concurrency
try
{
- xStatementProps->setPropertyValue( PROPERTY_USEBOOKMARKS, makeAny( true ) );
- xStatementProps->setPropertyValue( PROPERTY_MAXROWS, makeAny( m_nMaxRows ) );
+ xStatementProps->setPropertyValue( PROPERTY_USEBOOKMARKS, Any( true ) );
+ xStatementProps->setPropertyValue( PROPERTY_MAXROWS, Any( m_nMaxRows ) );
setStatementResultSetType( xStatementProps, m_nResultSetType, m_nResultSetConcurrency );
}
@@ -1648,21 +1642,17 @@ void ORowSet::impl_ensureStatement_throw()
// then the driver doesn't support this feature
}
}
- catch( const SQLException& )
+ catch (SQLException& rException)
{
- SQLExceptionInfo aError( ::cppu::getCaughtException() );
- OSL_ENSURE( aError.isValid(), "ORowSet::impl_makeNewStatement_throw: caught an SQLException which we cannot analyze!" );
+ css::sdbc::SQLException* pLastExceptionInChain = SQLExceptionInfo::getLastException(&rException);
+ assert(pLastExceptionInChain && "will at least be &rException");
// append information about what we were actually going to execute
- try
- {
- OUString sInfo(DBA_RES_PARAM( RID_STR_COMMAND_LEADING_TO_ERROR, "$command$", sCommandToExecute ) );
- aError.append( SQLExceptionInfo::TYPE::SQLContext, sInfo );
- }
- catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION("dbaccess"); }
+ OUString sInfo(m_sErrorString.replaceFirst("$command$", sCommandToExecute));
+ pLastExceptionInChain->NextException = SQLExceptionInfo::createException(SQLExceptionInfo::TYPE::SQLContext, sInfo, OUString(), 0);
// propagate
- aError.doThrow();
+ throw;
}
}
@@ -1716,8 +1706,8 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS
// a number of properties is plain copied
const OUString aPropertyNames[] = {
- OUString(PROPERTY_ALIGN), OUString(PROPERTY_RELATIVEPOSITION), OUString(PROPERTY_WIDTH), OUString(PROPERTY_HIDDEN), OUString(PROPERTY_CONTROLMODEL),
- OUString(PROPERTY_HELPTEXT), OUString(PROPERTY_CONTROLDEFAULT)
+ PROPERTY_ALIGN, PROPERTY_RELATIVEPOSITION, PROPERTY_WIDTH, PROPERTY_HIDDEN, PROPERTY_CONTROLMODEL,
+ PROPERTY_HELPTEXT, PROPERTY_CONTROLDEFAULT
};
for (const auto & aPropertyName : aPropertyNames)
{
@@ -1737,7 +1727,7 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS
}
if ( !nFormatKey && m_xNumberFormatTypes.is() )
nFormatKey = ::dbtools::getDefaultNumberFormat( _rxTemplateColumn, m_xNumberFormatTypes, SvtSysLocale().GetLanguageTag().getLocale() );
- _rxRowSetColumn->setPropertyValue( PROPERTY_NUMBERFORMAT, makeAny( nFormatKey ) );
+ _rxRowSetColumn->setPropertyValue( PROPERTY_NUMBERFORMAT, Any( nFormatKey ) );
}
catch(Exception&)
{
@@ -1853,7 +1843,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
}
sName = sAlias;
}
- ORowSetDataColumn* pColumn = new ORowSetDataColumn( getMetaData(),
+ rtl::Reference<ORowSetDataColumn> pColumn = new ORowSetDataColumn( getMetaData(),
this,
this,
i+1,
@@ -1867,9 +1857,9 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
aColumns->emplace_back(pColumn);
pColumn->setName(sName);
aNames.push_back(sName);
- m_aDataColumns.push_back(pColumn);
+ m_aDataColumns.push_back(pColumn.get());
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,makeAny(rKeyColumns.find(i+1) != rKeyColumns.end()));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,Any(rKeyColumns.find(i+1) != rKeyColumns.end()));
try
{
@@ -1878,10 +1868,10 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
nFormatKey = ::dbtools::getDefaultNumberFormat(pColumn,m_xNumberFormatTypes,aLocale);
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey));
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,makeAny(sal_Int32(i+1)));
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,makeAny(sal_Int32(227)));
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,makeAny(sal_Int32(0)));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,Any(nFormatKey));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,Any(sal_Int32(i+1)));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,Any(sal_Int32(227)));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,Any(sal_Int32(0)));
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN, css::uno::Any(false));
}
catch(Exception&)
@@ -1957,7 +1947,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
{
xColumn->getPropertyValue(PROPERTY_LABEL) >>= sParseLabel;
}
- ORowSetDataColumn* pColumn = new ORowSetDataColumn( getMetaData(),
+ rtl::Reference<ORowSetDataColumn> pColumn = new ORowSetDataColumn( getMetaData(),
this,
this,
i,
@@ -1969,7 +1959,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
});
aColumns->emplace_back(pColumn);
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,makeAny(rKeyColumns.find(i) != rKeyColumns.end()));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ISREADONLY,Any(rKeyColumns.find(i) != rKeyColumns.end()));
if(sColumnLabel.isEmpty())
{
@@ -1980,7 +1970,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi
}
pColumn->setName(sColumnLabel);
aNames.push_back(sColumnLabel);
- m_aDataColumns.push_back(pColumn);
+ m_aDataColumns.push_back(pColumn.get());
if ( xColumn.is() )
impl_initializeColumnSettings_nothrow( xColumn, pColumn );
@@ -2066,10 +2056,9 @@ Reference< XResultSet > SAL_CALL ORowSet::createResultSet( )
if(m_xStatement.is())
{
- ORowSetClone* pClone = new ORowSetClone( m_aContext, *this, m_pMutex );
- Reference< XResultSet > xRet(pClone);
- m_aClones.emplace_back(xRet);
- return xRet;
+ rtl::Reference<ORowSetClone> pClone = new ORowSetClone( m_aContext, *this, m_pMutex );
+ m_aClones.emplace_back(css::uno::Reference< css::uno::XWeak >(pClone));
+ return pClone;
}
return Reference< XResultSet >();
}
@@ -2142,7 +2131,7 @@ void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark )
// notify the clones
for (auto const& elem : m_aClones)
{
- auto pClone = comphelper::getUnoTunnelImplementation<ORowSetClone>(elem.get());
+ rtl::Reference<ORowSetClone> pClone = dynamic_cast<ORowSetClone*>(elem.get().get());
if(pClone)
pClone->onDeleteRow( _rBookmark );
}
@@ -2155,7 +2144,7 @@ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32
// notify the clones
for (auto const& clone : m_aClones)
{
- auto pClone = comphelper::getUnoTunnelImplementation<ORowSetClone>(clone.get());
+ rtl::Reference<ORowSetClone> pClone = dynamic_cast<ORowSetClone*>(clone.get().get());
if(pClone)
pClone->onDeletedRow( _rBookmark, _nPos );
}
@@ -2232,7 +2221,7 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw()
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- m_xTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend);
+ m_xTables.reset(new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend));
xTables = m_xTables.get();
Sequence<OUString> aTableFilter { "%" };
m_xTables->construct(aTableFilter,Sequence< OUString>());
@@ -2255,7 +2244,7 @@ void ORowSet::impl_resetTables_nothrow()
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- m_xTables.clear();
+ m_xTables.reset();
}
void ORowSet::impl_initComposer_throw( OUString& _out_rCommandToExecute )
@@ -2404,7 +2393,7 @@ void ORowSet::impl_initParametersContainer_nothrow()
{
OSL_PRECOND( !m_pParameters.is(), "ORowSet::impl_initParametersContainer_nothrow: already initialized the parameters!" );
- m_pParameters = new param::ParameterWrapperContainer( m_xComposer.get() );
+ m_pParameters = new param::ParameterWrapperContainer( m_xComposer );
// copy the premature parameters into the final ones
size_t nParamCount( std::min( m_pParameters->size(), m_aPrematureParamValues->size() ) );
for ( size_t i=0; i<nParamCount; ++i )
@@ -2698,7 +2687,7 @@ void ORowSet::checkUpdateConditions(sal_Int32 columnIndex)
if ( m_aCurrentRow.isNull() )
::dbtools::throwSQLException( DBA_RES( RID_STR_INVALID_CURSOR_STATE ), StandardSQLState::INVALID_CURSOR_STATE, *this );
- if ( columnIndex <= 0 || sal_Int32((*m_aCurrentRow)->size()) <= columnIndex )
+ if ( columnIndex <= 0 || (*m_aCurrentRow)->size() <= o3tl::make_unsigned(columnIndex) )
::dbtools::throwSQLException( DBA_RES( RID_STR_INVALID_INDEX ), StandardSQLState::INVALID_DESCRIPTOR_INDEX, *this );
}
@@ -2734,7 +2723,7 @@ void ORowSet::impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard)
ORowSetClone::ORowSetClone( const Reference<XComponentContext>& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex )
:OSubComponent(m_aMutex, rParent)
- ,ORowSetBase( _rContext, OComponentHelper::rBHelper, _pMutex )
+ ,ORowSetBase( _rContext, WeakComponentImplHelper::rBHelper, _pMutex )
,m_pParent(&rParent)
,m_nFetchDirection(rParent.m_nFetchDirection)
,m_nFetchSize(rParent.m_nFetchSize)
@@ -2775,7 +2764,7 @@ ORowSetClone::ORowSetClone( const Reference<XComponentContext>& _rContext, ORowS
OUString sParseLabel;
xColumn->getPropertyValue(PROPERTY_LABEL) >>= sParseLabel;
- ORowSetColumn* pColumn = new ORowSetColumn( rParent.getMetaData(),
+ rtl::Reference<ORowSetColumn> pColumn = new ORowSetColumn( rParent.getMetaData(),
this,
i,
rParent.m_xActiveConnection->getMetaData(),
@@ -2787,14 +2776,14 @@ ORowSetClone::ORowSetClone( const Reference<XComponentContext>& _rContext, ORowS
aColumns->emplace_back(pColumn);
pColumn->setName(*pIter);
aNames.push_back(*pIter);
- m_aDataColumns.push_back(pColumn);
+ m_aDataColumns.push_back(pColumn.get());
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_ALIGN,xColumn->getPropertyValue(PROPERTY_ALIGN));
sal_Int32 nFormatKey = 0;
xColumn->getPropertyValue(PROPERTY_NUMBERFORMAT) >>= nFormatKey;
if(!nFormatKey && xColumn.is() && m_xNumberFormatTypes.is())
nFormatKey = ::dbtools::getDefaultNumberFormat(xColumn,m_xNumberFormatTypes,aLocale);
- pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,makeAny(nFormatKey));
+ pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_NUMBERFORMAT,Any(nFormatKey));
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_RELATIVEPOSITION,xColumn->getPropertyValue(PROPERTY_RELATIVEPOSITION));
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_WIDTH,xColumn->getPropertyValue(PROPERTY_WIDTH));
pColumn->setFastPropertyValue_NoBroadcast(PROPERTY_ID_HIDDEN,xColumn->getPropertyValue(PROPERTY_HIDDEN));
@@ -2838,12 +2827,12 @@ Any ORowSetClone::queryInterface( const Type & rType )
return aRet;
}
-void ORowSetClone::acquire() throw()
+void ORowSetClone::acquire() noexcept
{
OSubComponent::acquire();
}
-void ORowSetClone::release() throw()
+void ORowSetClone::release() noexcept
{
OSubComponent::release();
}
@@ -2880,8 +2869,8 @@ void ORowSetClone::close()
{
{
MutexGuard aGuard( m_aMutex );
- if (OComponentHelper::rBHelper.bDisposed)
- throw DisposedException();
+ if (WeakComponentImplHelper::rBHelper.bDisposed)
+ return;
}
dispose();
}
@@ -2900,22 +2889,6 @@ void ORowSetClone::close()
return *::comphelper::OPropertyArrayUsageHelper<ORowSetClone>::getArrayHelper();
}
-Sequence< sal_Int8 > ORowSetClone::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
-// css::XUnoTunnel
-sal_Int64 SAL_CALL ORowSetClone::getSomething( const Sequence< sal_Int8 >& rId )
-{
- if (isUnoTunnelId<ORowSetClone>(rId))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
-
void SAL_CALL ORowSetClone::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)
{
if ( nHandle == PROPERTY_ID_FETCHSIZE )
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index effbdb87a8df..3cf6fe690193 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
+#pragma once
#include <sal/config.h>
@@ -45,7 +44,7 @@
#include <cppuhelper/compbase12.hxx>
#include <cppuhelper/basemutex.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <connectivity/paramwrapper.hxx>
#include <connectivity/FValue.hxx>
#include <connectivity/warningscontainer.hxx>
@@ -95,13 +94,14 @@ namespace dbaccess
std::vector<bool> m_aParametersSet;
std::vector<bool> m_aReadOnlyDataColumns;
- ::comphelper::OInterfaceContainerHelper2 m_aRowsetListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aApproveListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aRowsChangeListener;
+ ::comphelper::OInterfaceContainerHelper3<css::sdbc::XRowSetListener> m_aRowsetListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::sdb::XRowSetApproveListener> m_aApproveListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::sdb::XRowsChangeListener> m_aRowsChangeListener;
::dbtools::WarningsContainer m_aWarnings;
- rtl::Reference<OTableContainer> m_xTables;
+ // no Reference! see OCollection::acquire
+ std::unique_ptr<OTableContainer> m_xTables;
OUString m_aCommand;
OUString m_aDataSourceName;
@@ -116,6 +116,7 @@ namespace dbaccess
OUString m_aUpdateCatalogName; // is set by a query
OUString m_aUpdateSchemaName; // is set by a query
OUString m_aUpdateTableName; // is set by a query
+ OUString m_sErrorString;
sal_Int32 m_nFetchDirection;
sal_Int32 m_nFetchSize;
@@ -251,12 +252,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
-
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::uno::XAggregation
virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
@@ -478,18 +475,14 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
// OComponentHelper
virtual void SAL_CALL disposing() override;
@@ -522,6 +515,5 @@ namespace dbaccess
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 0bbe5e80ae0a..042f1fabc2d0 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -34,6 +34,7 @@
#include <comphelper/seqstream.hxx>
#include <connectivity/dbexception.hxx>
#include <o3tl/safeint.hxx>
+#include <comphelper/diagnose_ex.hxx>
using namespace dbaccess;
using namespace connectivity;
@@ -93,7 +94,7 @@ ORowSetBase::ORowSetBase( const Reference<XComponentContext>& _rContext, ::cppu:
{
sal_Int32 nRBT = PropertyAttribute::READONLY | PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT;
- registerPropertyNoMember( PROPERTY_ROWCOUNT, PROPERTY_ID_ROWCOUNT, nRBT, cppu::UnoType<sal_Int32>::get(), css::uno::makeAny<sal_Int32>(0) );
+ registerPropertyNoMember( PROPERTY_ROWCOUNT, PROPERTY_ID_ROWCOUNT, nRBT, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)) );
registerPropertyNoMember( PROPERTY_ISROWCOUNTFINAL, PROPERTY_ID_ISROWCOUNTFINAL, nRBT, cppu::UnoType<bool>::get(), css::uno::Any(false) );
}
@@ -206,7 +207,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
if ( !bValidCurrentRow )
{
// currentrow is null when the clone moves the window
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
m_aCurrentRow = m_pCache->m_aMatrixIter;
m_bIsInsertRow = false;
OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getValue: we don't stand on a valid row! Row is null.");
@@ -227,14 +228,19 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
for (; k != m_pCache->getEnd(); ++k)
{
ORowSetValueVector* pTemp = k->get();
- OSL_ENSURE( pTemp != reinterpret_cast<void*>(0xfeeefeee),"HALT!" );
+ OSL_ENSURE( pTemp != reinterpret_cast<void*>(sal_uIntPtr(0xfeeefeee)),"HALT!" );
}
OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow < m_pCache->getEnd() && aCacheIter != m_pCache->m_aCacheIterators.end(),"Invalid iterator set for currentrow!");
- ORowSetRow rRow = *m_aCurrentRow;
- OSL_ENSURE(rRow.is() && o3tl::make_unsigned(columnIndex) < rRow->size(),"Invalid size of vector!");
#endif
+ ORowSetRow rRow = *m_aCurrentRow;
+ bool bValidPosition = rRow.is() && o3tl::make_unsigned(columnIndex) < rRow->size();
+ if (!bValidPosition)
+ {
+ SAL_WARN("dbaccess", "ORowSetBase::getValue: Invalid size of vector!");
+ ::dbtools::throwSQLException( DBA_RES( RID_STR_CURSOR_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf );
+ }
m_nLastColumnIndex = columnIndex;
- return (**m_aCurrentRow)[m_nLastColumnIndex];
+ return (*rRow)[m_nLastColumnIndex];
}
// we should normally never reach this
@@ -244,73 +250,73 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
OUString SAL_CALL ORowSetBase::getString( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getString();
}
sal_Bool SAL_CALL ORowSetBase::getBoolean( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return bool(getValue(columnIndex));
+ return getValue(columnIndex).getBool();
}
sal_Int8 SAL_CALL ORowSetBase::getByte( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt8();
}
sal_Int16 SAL_CALL ORowSetBase::getShort( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt16();
}
sal_Int32 SAL_CALL ORowSetBase::getInt( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getInt32();
}
sal_Int64 SAL_CALL ORowSetBase::getLong( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getLong();
}
float SAL_CALL ORowSetBase::getFloat( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getFloat();
}
double SAL_CALL ORowSetBase::getDouble( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getDouble();
}
Sequence< sal_Int8 > SAL_CALL ORowSetBase::getBytes( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getSequence();
}
css::util::Date SAL_CALL ORowSetBase::getDate( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getDate();
}
css::util::Time SAL_CALL ORowSetBase::getTime( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getTime();
}
css::util::DateTime SAL_CALL ORowSetBase::getTimestamp( sal_Int32 columnIndex )
{
::osl::MutexGuard aGuard( *m_pMutex );
- return getValue(columnIndex);
+ return getValue(columnIndex).getDateTime();
}
Reference< css::io::XInputStream > SAL_CALL ORowSetBase::getBinaryStream( sal_Int32 columnIndex )
@@ -332,7 +338,7 @@ Reference< css::io::XInputStream > SAL_CALL ORowSetBase::getBinaryStream( sal_In
bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != m_pCache->getEnd() && m_aCurrentRow->is() );
if ( !bValidCurrentRow )
{
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
m_aCurrentRow = m_pCache->m_aMatrixIter;
m_bIsInsertRow = false;
OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we don't stand on a valid row! Row is null.");
@@ -573,7 +579,7 @@ sal_Bool SAL_CALL ORowSetBase::next( )
ORowSetRow aOldValues = getOldRow(bWasNew);
- positionCache( MOVE_FORWARD );
+ positionCache( CursorMoveDirection::Forward );
bool bAfterLast = m_pCache->isAfterLast();
bRet = m_pCache->next();
doCancelModification( );
@@ -656,7 +662,7 @@ sal_Bool SAL_CALL ORowSetBase::isFirst( )
if ( impl_rowDeleted() )
return ( m_nDeletedPosition == 1 );
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
bool bIsFirst = m_pCache->isFirst();
SAL_INFO("dbaccess", "ORowSetBase::isFirst() = " << bIsFirst << " Clone = " << m_bClone);
@@ -686,7 +692,7 @@ sal_Bool SAL_CALL ORowSetBase::isLast( )
return ( m_nDeletedPosition == impl_getRowCount() );
}
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
bool bIsLast = m_pCache->isLast();
SAL_INFO("dbaccess", "ORowSetBase::isLast() = " << bIsLast << " Clone = " << m_bClone);
@@ -858,7 +864,7 @@ sal_Int32 ORowSetBase::impl_getRow()
nPos = 0;
else
{
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
nPos = m_pCache->getRow();
}
SAL_INFO("dbaccess", "ORowSetBase::impl_getRow() = " << nPos << " Clone = " << m_bClone);
@@ -938,7 +944,7 @@ sal_Bool SAL_CALL ORowSetBase::relative( sal_Int32 rows )
ORowSetRow aOldValues = getOldRow(bWasNew);
- positionCache( rows > 0 ? MOVE_FORWARD : MOVE_BACKWARD );
+ positionCache( rows > 0 ? CursorMoveDirection::Forward : CursorMoveDirection::Backward );
bRet = m_pCache->relative(rows);
doCancelModification( );
@@ -986,7 +992,7 @@ sal_Bool SAL_CALL ORowSetBase::previous( )
ORowSetRow aOldValues = getOldRow(bWasNew);
- positionCache( MOVE_BACKWARD );
+ positionCache( CursorMoveDirection::Backward );
bRet = m_pCache->previous();
doCancelModification( );
@@ -1089,7 +1095,7 @@ void SAL_CALL ORowSetBase::refreshRow( )
{
bool bWasNew = m_pCache->m_bNew || impl_rowDeleted();
ORowSetRow aOldValues = getOldRow(bWasNew);
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
m_pCache->refreshRow();
firePropertyChange(aOldValues);
}
@@ -1174,7 +1180,7 @@ void ORowSetBase::firePropertyChange(const ORowSetRow& _rOldRow)
}
catch (const Exception&)
{
- SAL_WARN("dbaccess", "firePropertyChange: Exception on column " << i);
+ TOOLS_WARN_EXCEPTION("dbaccess", "firePropertyChange: Exception on column " << i);
}
++i;
}
@@ -1207,8 +1213,8 @@ bool ORowSetBase::isPropertyChangeNotificationEnabled() const
void ORowSetBase::fireProperty( sal_Int32 _nProperty, bool _bNew, bool _bOld )
{
- Any aNew = css::uno::makeAny( _bNew );
- Any aOld = css::uno::makeAny( _bOld );
+ Any aNew( _bNew );
+ Any aOld( _bOld );
fire( &_nProperty, &aNew, &aOld, 1, false );
}
@@ -1219,7 +1225,7 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
bool bSuccess = false;
if ( m_aBookmark.hasValue() )
{
- if (_ePrepareForDirection == MOVE_NONE_REFRESH ||
+ if (_ePrepareForDirection == CursorMoveDirection::CurrentRefresh ||
(m_pCache->isAfterLast() != bool(isAfterLast())) || ( m_pCache->isBeforeFirst() != bool(isBeforeFirst()) ) ||
m_pCache->compareBookmarks( m_aBookmark, m_pCache->getBookmark() ) != CompareBookmark::EQUAL )
bSuccess = m_pCache->moveToBookmark( m_aBookmark );
@@ -1243,7 +1249,7 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
OSL_ENSURE( m_nDeletedPosition >= 1, "ORowSetBase::positionCache: no bookmark, and no valid 'deleted position'!" );
switch ( _ePrepareForDirection )
{
- case MOVE_FORWARD:
+ case CursorMoveDirection::Forward:
if ( m_nDeletedPosition > 1 )
bSuccess = m_pCache->absolute( m_nDeletedPosition - 1 );
else
@@ -1253,7 +1259,7 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
}
break;
- case MOVE_BACKWARD:
+ case CursorMoveDirection::Backward:
if ( m_pCache->m_bRowCountFinal && ( m_nDeletedPosition == impl_getRowCount() ) )
{
m_pCache->afterLast();
@@ -1263,8 +1269,8 @@ void ORowSetBase::positionCache( CursorMoveDirection _ePrepareForDirection )
bSuccess = m_pCache->absolute( m_nDeletedPosition );
break;
- case MOVE_NONE:
- case MOVE_NONE_REFRESH:
+ case CursorMoveDirection::Current:
+ case CursorMoveDirection::CurrentRefresh:
bSuccess = false; // will be asserted below
break;
}
@@ -1318,7 +1324,7 @@ void ORowSetBase::onDeleteRow( const Any& _rBookmark )
//OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::onDeleteRow: Bookmark isn't valid!" );
if ( compareBookmarks( _rBookmark, m_aBookmark ) == CompareBookmark::EQUAL )
{
- positionCache( MOVE_NONE );
+ positionCache( CursorMoveDirection::Current );
m_nDeletedPosition = m_pCache->getRow();
}
}
@@ -1352,12 +1358,6 @@ sal_Int32 ORowSetBase::impl_getRowCount() const
return nRowCount;
}
-struct ORowSetNotifierImpl
-{
- std::vector<sal_Int32> aChangedColumns;
- ORowSetValueVector::Vector aRow;
-};
-
ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet )
:m_pRowSet( _pRowSet )
@@ -1376,15 +1376,13 @@ ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet )
m_pRowSet->doCancelModification( ORowSetBase::GrantNotifierAccess() );
}
-ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet,const ORowSetValueVector::Vector& i_aRow )
- :m_pImpl(new ORowSetNotifierImpl)
- ,m_pRowSet( _pRowSet )
+ORowSetNotifier::ORowSetNotifier( ORowSetBase* _pRowSet, ORowSetValueVector::Vector&& i_aRow )
+ :m_pRowSet( _pRowSet )
,m_bWasNew( false )
,m_bWasModified( false )
{
-
OSL_ENSURE( m_pRowSet, "ORowSetNotifier::ORowSetNotifier: invalid row set. This will crash." );
- m_pImpl->aRow = i_aRow; // yes, create a copy to store the old values
+ aRow = std::move(i_aRow); // yes, create a copy to store the old values
}
ORowSetNotifier::~ORowSetNotifier( )
@@ -1407,24 +1405,19 @@ void ORowSetNotifier::fire()
m_pRowSet->fireProperty( PROPERTY_ID_ISNEW, false, true, ORowSetBase::GrantNotifierAccess() );
}
-std::vector<sal_Int32>& ORowSetNotifier::getChangedColumns() const
+std::vector<sal_Int32>& ORowSetNotifier::getChangedColumns()
{
- OSL_ENSURE(m_pImpl, "Illegal CTor call, use the other one!");
- return m_pImpl->aChangedColumns;
+ return aChangedColumns;
}
void ORowSetNotifier::firePropertyChange()
{
- OSL_ENSURE(m_pImpl, "Illegal CTor call, use the other one!");
- if (m_pImpl)
+ for (auto const& changedColumn : aChangedColumns)
{
- for (auto const& changedColumn : m_pImpl->aChangedColumns)
- {
- m_pRowSet->firePropertyChange(changedColumn-1 ,m_pImpl->aRow[changedColumn-1], ORowSetBase::GrantNotifierAccess());
- }
- if ( !m_pImpl->aChangedColumns.empty() )
- m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,true,false, ORowSetBase::GrantNotifierAccess());
+ m_pRowSet->firePropertyChange(changedColumn-1, aRow[changedColumn-1], ORowSetBase::GrantNotifierAccess());
}
+ if ( !aChangedColumns.empty() )
+ m_pRowSet->fireProperty(PROPERTY_ID_ISMODIFIED,true,false, ORowSetBase::GrantNotifierAccess());
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/api/RowSetBase.hxx b/dbaccess/source/core/api/RowSetBase.hxx
index 1031ed5dcce7..13d6464cddbf 100644
--- a/dbaccess/source/core/api/RowSetBase.hxx
+++ b/dbaccess/source/core/api/RowSetBase.hxx
@@ -16,11 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETBASE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETBASE_HXX
+#pragma once
#include <memory>
-#include <cppuhelper/implbase10.hxx>
+#include <cppuhelper/implbase9.hxx>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XColumnLocate.hpp>
@@ -29,7 +28,6 @@
#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <cppuhelper/interfacecontainer.h>
#include <connectivity/sqlerror.hxx>
#include <connectivity/CommonTools.hxx>
@@ -52,7 +50,7 @@ namespace dbaccess
{
class OEmptyCollection;
- typedef ::cppu::ImplHelper10< css::sdbcx::XRowLocate,
+ typedef ::cppu::ImplHelper9< css::sdbcx::XRowLocate,
css::sdbc::XRow,
css::sdbc::XResultSetMetaDataSupplier,
css::sdbc::XWarningsSupplier,
@@ -60,8 +58,7 @@ namespace dbaccess
css::sdbcx::XColumnsSupplier,
css::lang::XServiceInfo,
css::sdbc::XRowSet,
- css::sdbc::XCloseable,
- css::lang::XUnoTunnel> ORowSetBase_BASE;
+ css::sdbc::XCloseable> ORowSetBase_BASE;
class ORowSetCache;
class ORowSetDataColumns;
@@ -144,16 +141,16 @@ namespace dbaccess
virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, css::uno::Any& _rDefault ) const override;
virtual void SAL_CALL getFastPropertyValue(css::uno::Any& rValue,sal_Int32 nHandle) const override;
- enum CursorMoveDirection
+ enum class CursorMoveDirection
{
/// denotes a cursor move forward
- MOVE_FORWARD,
+ Forward,
/// denotes a cursor move backwards
- MOVE_BACKWARD,
+ Backward,
/// denotes no cursor move at all, but move cache to current row (if it is not there already)
- MOVE_NONE,
+ Current,
/// denotes no cursor move at all, but force the cache to move to current row (and refresh the row)
- MOVE_NONE_REFRESH
+ CurrentRefresh
};
/** positions the cache in preparation of a cursor move
@@ -348,11 +345,11 @@ namespace dbaccess
<p>The class can only be used on the stack, within a method of ORowSetBase (or derivees)</p>
*/
- struct ORowSetNotifierImpl;
class ORowSetNotifier
{
private:
- std::unique_ptr<ORowSetNotifierImpl> m_pImpl;
+ std::vector<sal_Int32> aChangedColumns;
+ ORowSetValueVector::Vector aRow;
ORowSetBase* m_pRowSet;
// not acquired! This is not necessary because this class here is to be used on the stack within
// a method of ORowSetBase (or derivees)
@@ -368,7 +365,7 @@ namespace dbaccess
/** use this one to construct a vector for change value notification
*/
- ORowSetNotifier( ORowSetBase* m_pRowSet,const ORowSetValueVector::Vector& i_aRow );
+ ORowSetNotifier( ORowSetBase* m_pRowSet, ORowSetValueVector::Vector&& i_aRow );
// destructs the object. <member>fire</member> has to be called before.
~ORowSetNotifier( );
@@ -392,14 +389,12 @@ namespace dbaccess
*/
void firePropertyChange();
- /** use this one to store the inde of the changed column values
+ /** use this one to store the index of the changed column values
*/
- std::vector<sal_Int32>& getChangedColumns() const;
+ std::vector<sal_Int32>& getChangedColumns();
};
} // end of namespace
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETBASE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSetCache.cxx b/dbaccess/source/core/api/RowSetCache.cxx
index 21098ccacdfb..a41d9e991964 100644
--- a/dbaccess/source/core/api/RowSetCache.cxx
+++ b/dbaccess/source/core/api/RowSetCache.cxx
@@ -45,7 +45,7 @@
#include <connectivity/sqlnode.hxx>
#include <connectivity/sqlparse.hxx>
#include <sqlbison.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
@@ -60,11 +60,7 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
using namespace ::cppu;
-using namespace ::osl;
-
-#define CHECK_MATRIX_POS(M) OSL_ENSURE(((M) >= static_cast<ORowSetMatrix::difference_type>(0)) && ((M) < static_cast<sal_Int32>(m_pMatrix->size())),"Position is invalid!")
// This class calls m_pCacheSet->FOO_checked(..., sal_False)
// (where FOO is absolute, last, previous)
@@ -165,7 +161,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
if ( aTableNames.getLength() > 1 && _rUpdateTableName.isEmpty() && bNeedKeySet )
{// here we have a join or union and nobody told us which table to update, so we update them all
m_nPrivileges = Privilege::SELECT|Privilege::DELETE|Privilege::INSERT|Privilege::UPDATE;
- OptimisticSet* pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
+ rtl::Reference<OptimisticSet> pCursor = new OptimisticSet(m_aContext,xConnection,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
m_xCacheSet = pCursor;
try
{
@@ -209,7 +205,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
SelectColumnsMetaData aColumnNames(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers());
::dbaccess::getColumnPositions(xSelColumns,xPrimaryKeyColumns->getElementNames(),aUpdateTableName,aColumnNames);
- bAllKeysFound = !aColumnNames.empty() && sal_Int32(aColumnNames.size()) == xPrimaryKeyColumns->getElementNames().getLength();
+ bAllKeysFound = !aColumnNames.empty() && aColumnNames.size() == o3tl::make_unsigned(xPrimaryKeyColumns->getElementNames().getLength());
}
}
}
@@ -302,7 +298,7 @@ ORowSetCache::ORowSetCache(const Reference< XResultSet >& _xRs,
}
}
- OKeySet* pKeySet = new OKeySet(m_aUpdateTable, aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
+ rtl::Reference<OKeySet> pKeySet = new OKeySet(m_aUpdateTable, aUpdateTableName ,_xAnalyzer,_aParameterValueForCache,i_nMaxRows,m_nRowCount);
try
{
m_xCacheSet = pKeySet;
@@ -406,7 +402,7 @@ void ORowSetCache::setFetchSize(sal_Int32 _nSize)
{
if ( rPosChange.second )
{
- CHECK_MATRIX_POS(*aIter);
+ OSL_ENSURE((*aIter >= static_cast<ORowSetMatrix::difference_type>(0)) && (*aIter < static_cast<sal_Int32>(m_pMatrix->size())),"Position is invalid!");
if ( *aIter < _nSize )
aCacheIter->second.aIterator = m_pMatrix->begin() + *aIter++;
else
@@ -457,7 +453,7 @@ static Any lcl_getBookmark(ORowSetValue& i_aValue,OCacheSet* i_pCacheSet)
case DataType::TINYINT:
case DataType::SMALLINT:
case DataType::INTEGER:
- return makeAny(static_cast<sal_Int32>(i_aValue));
+ return Any(i_aValue.getInt32());
default:
if ( i_pCacheSet && i_aValue.isNull())
i_aValue = i_pCacheSet->getBookmark();
@@ -593,7 +589,7 @@ void ORowSetCache::updateCharacterStream( sal_Int32 columnIndex, const Reference
rInsert[columnIndex].setBound(true);
rInsert[columnIndex] = aSeq;
rInsert[columnIndex].setModified(true);
- io_aRow[columnIndex] = makeAny(x);
+ io_aRow[columnIndex] = Any(x);
m_xCacheSet->mergeColumnValues(columnIndex,rInsert,io_aRow,o_ChangedColumns);
impl_updateRowFromCache_throw(io_aRow,o_ChangedColumns);
@@ -882,13 +878,13 @@ void ORowSetCache::moveWindow()
ORowSetMatrix::iterator aNewEnd (aEnd + nStartPosOffset);
// *m_pMatrix now looks like:
// [0; nOverlapSize) i.e. [begin(); aEnd): data kept
- // [nOverlapSize; nOverlapSize + nStartPosOffet) i.e. [aEnd, aNewEnd): new data of positions < old m_nStartPos
- // [nOverlapSize + nStartPosOffet; size()) i.e. [aNewEnd, end()): unused
- // Note that nOverlapSize + nStartPosOffet == m_nEndPos - m_nStartPos (new values)
+ // [nOverlapSize; nOverlapSize + nStartPosOffset) i.e. [aEnd, aNewEnd): new data of positions < old m_nStartPos
+ // [nOverlapSize + nStartPosOffset; size()) i.e. [aNewEnd, end()): unused
+ // Note that nOverlapSize + nStartPosOffset == m_nEndPos - m_nStartPos (new values)
// When we are finished:
// [0; nStartPosOffset) i.e. [begin(); aEnd): new data of positions < old m_nStartPos
- // [nStartPosOffset; nOverlapSize + nStartPosOffet) i.e. [aEnd, aNewEnd): kept
- // [nOverlapSize + nStartPosOffet; size()) i.e. [aNewEnd, end()): unused
+ // [nStartPosOffset; nOverlapSize + nStartPosOffset) i.e. [aEnd, aNewEnd): kept
+ // [nOverlapSize + nStartPosOffset; size()) i.e. [aNewEnd, end()): unused
if ( bCheck )
{
@@ -917,7 +913,8 @@ void ORowSetCache::moveWindow()
else
{
// Inside overlap area: move to correct position
- CHECK_MATRIX_POS( (nDist + nStartPosOffset) );
+ OSL_ENSURE(((nDist + nStartPosOffset) >= static_cast<ORowSetMatrix::difference_type>(0)) &&
+ ((nDist + nStartPosOffset) < static_cast<sal_Int32>(m_pMatrix->size())),"Position is invalid!");
rCacheIter.second.aIterator += nStartPosOffset;
OSL_ENSURE(rCacheIter.second.aIterator >= m_pMatrix->begin()
&& rCacheIter.second.aIterator < m_pMatrix->end(),"Iterator out of area!");
@@ -947,7 +944,7 @@ void ORowSetCache::moveWindow()
if ( nRowsInCache < m_nFetchSize )
{
// There is some unused space in *m_pMatrix; fill it
- CHECK_MATRIX_POS(nRowsInCache);
+ OSL_ENSURE((nRowsInCache >= static_cast<ORowSetMatrix::difference_type>(0)) && (o3tl::make_unsigned(nRowsInCache) < m_pMatrix->size()),"Position is invalid!");
sal_Int32 nPos = m_nEndPos + 1;
bool bCheck = m_xCacheSet->absolute(nPos);
ORowSetMatrix::iterator aIter = m_pMatrix->begin() + nRowsInCache;
@@ -965,7 +962,7 @@ void ORowSetCache::moveWindow()
// The rows behind this can be reused
ORowSetMatrix::iterator aIter = m_pMatrix->begin();
const sal_Int32 nNewStartPosInMatrix = nNewStartPos - m_nStartPos;
- CHECK_MATRIX_POS( nNewStartPosInMatrix );
+ OSL_ENSURE((nNewStartPosInMatrix >= static_cast<ORowSetMatrix::difference_type>(0)) && (o3tl::make_unsigned(nNewStartPosInMatrix) < m_pMatrix->size()),"Position is invalid!");
// first position we reuse
const ORowSetMatrix::const_iterator aEnd = m_pMatrix->begin() + nNewStartPosInMatrix;
// End of used portion of the matrix. Is < m_pMatrix->end() if less data than window size
@@ -1624,8 +1621,8 @@ void ORowSetCache::clearInsertRow()
ORowSetMatrix::iterator ORowSetCache::calcPosition() const
{
sal_Int32 nValue = (m_nPosition - m_nStartPos) - 1;
- CHECK_MATRIX_POS(nValue);
- return ( nValue < 0 || nValue >= static_cast<sal_Int32>(m_pMatrix->size()) ) ? m_pMatrix->end() : (m_pMatrix->begin() + nValue);
+ OSL_ENSURE((nValue >= static_cast<ORowSetMatrix::difference_type>(0)) && (o3tl::make_unsigned(nValue) < m_pMatrix->size()),"Position is invalid!");
+ return ( nValue < 0 || o3tl::make_unsigned(nValue) >= m_pMatrix->size() ) ? m_pMatrix->end() : (m_pMatrix->begin() + nValue);
}
TORowSetOldRowHelperRef ORowSetCache::registerOldRow()
diff --git a/dbaccess/source/core/api/RowSetCache.hxx b/dbaccess/source/core/api/RowSetCache.hxx
index 082b6522c098..01ed6394dc47 100644
--- a/dbaccess/source/core/api/RowSetCache.hxx
+++ b/dbaccess/source/core/api/RowSetCache.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETCACHE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETCACHE_HXX
+#pragma once
#include <connectivity/CommonTools.hxx>
#include <com/sun/star/io/XInputStream.hpp>
@@ -187,6 +186,5 @@ namespace dbaccess
void reset(const css::uno::Reference< css::sdbc::XResultSet>& _xDriverSet);
};
}
-#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSetCacheIterator.hxx b/dbaccess/source/core/api/RowSetCacheIterator.hxx
index 39f139c276cf..f5d5e6783b65 100644
--- a/dbaccess/source/core/api/RowSetCacheIterator.hxx
+++ b/dbaccess/source/core/api/RowSetCacheIterator.hxx
@@ -16,12 +16,12 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETCACHEITERATOR_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETCACHEITERATOR_HXX
+#pragma once
#include <sal/config.h>
#include <map>
+#include <utility>
#include "RowSetRow.hxx"
@@ -44,8 +44,8 @@ namespace dbaccess
ORowSetCache* m_pCache;
ORowSetBase* m_pRowSet;
- ORowSetCacheIterator(const ORowSetCacheMap::iterator& _rIter,ORowSetCache* _pCache,ORowSetBase* _pRowSet)
- : m_aIter(_rIter)
+ ORowSetCacheIterator(ORowSetCacheMap::iterator _aIter, ORowSetCache* _pCache,ORowSetBase* _pRowSet)
+ : m_aIter(std::move(_aIter))
,m_pCache(_pCache)
,m_pRowSet(_pRowSet)
{
@@ -69,6 +69,5 @@ namespace dbaccess
const ORowSetCacheMap::iterator& getIter() const { return m_aIter; }
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETCACHEITERATOR_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSetRow.hxx b/dbaccess/source/core/api/RowSetRow.hxx
index 11337dec7cb6..a847399dd1e9 100644
--- a/dbaccess/source/core/api/RowSetRow.hxx
+++ b/dbaccess/source/core/api/RowSetRow.hxx
@@ -16,13 +16,13 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
+#pragma once
#include <rtl/ref.hxx>
#include <connectivity/CommonTools.hxx>
#include <connectivity/FValue.hxx>
#include <salhelper/simplereferenceobject.hxx>
+#include <utility>
namespace dbaccess
{
@@ -37,8 +37,8 @@ namespace dbaccess
ORowSetOldRowHelper& operator=(const ORowSetOldRowHelper& _rRH) = delete;
ORowSetOldRowHelper(const ORowSetOldRowHelper& _rRh) = delete;
public:
- explicit ORowSetOldRowHelper(const ORowSetRow& _rRow)
- : m_aRow(_rRow)
+ explicit ORowSetOldRowHelper(ORowSetRow _aRow)
+ : m_aRow(std::move(_aRow))
{}
const ORowSetRow& getRow() const { return m_aRow; }
@@ -49,6 +49,5 @@ namespace dbaccess
typedef ::rtl::Reference< ORowSetOldRowHelper > TORowSetOldRowHelperRef;
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSETROW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 9f96f84295c7..f6dffbd1314a 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -21,6 +21,7 @@
#include <sal/log.hxx>
#include <composertools.hxx>
#include <strings.hrc>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <stringconstants.hxx>
#include "HelperCollections.hxx"
@@ -48,11 +49,12 @@
#include <connectivity/dbtools.hxx>
#include <connectivity/PColumn.hxx>
#include <connectivity/predicateinput.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <unotools/sharedunocomponent.hxx>
#include <memory>
+#include <string_view>
using namespace ::dbaccess;
using namespace ::dbtools;
@@ -76,18 +78,18 @@ namespace dbaccess {
namespace BooleanComparisonMode = ::com::sun::star::sdb::BooleanComparisonMode;
}
-#define STR_SELECT "SELECT "
-#define STR_FROM " FROM "
-#define STR_WHERE " WHERE "
-#define STR_GROUP_BY " GROUP BY "
-#define STR_HAVING " HAVING "
-#define STR_ORDER_BY " ORDER BY "
-#define STR_AND " AND "
-#define STR_OR " OR "
-#define STR_LIKE OUString(" LIKE ")
-#define L_BRACKET "("
-#define R_BRACKET ")"
-#define COMMA ","
+constexpr OUStringLiteral STR_SELECT = u"SELECT ";
+constexpr OUStringLiteral STR_FROM = u" FROM ";
+constexpr OUString STR_WHERE = u" WHERE "_ustr;
+constexpr OUStringLiteral STR_GROUP_BY = u" GROUP BY ";
+constexpr OUStringLiteral STR_HAVING = u" HAVING ";
+constexpr OUStringLiteral STR_ORDER_BY = u" ORDER BY ";
+constexpr OUString STR_AND = u" AND "_ustr;
+constexpr OUString STR_OR = u" OR "_ustr;
+constexpr OUStringLiteral STR_LIKE = u" LIKE ";
+constexpr OUString L_BRACKET = u"("_ustr;
+constexpr OUString R_BRACKET = u")"_ustr;
+constexpr OUStringLiteral COMMA = u",";
namespace
{
@@ -104,8 +106,8 @@ namespace
{
OUString sSQLStateGeneralError( getStandardSQLState( StandardSQLState::GENERAL_ERROR ) );
SQLException aError2( aErrorMsg, _rxContext, sSQLStateGeneralError, 1000, Any() );
- SQLException aError1( _rStatement, _rxContext, sSQLStateGeneralError, 1000, makeAny( aError2 ) );
- throw SQLException(_rParser.getContext().getErrorMessage(OParseContext::ErrorCode::General),_rxContext,sSQLStateGeneralError,1000,makeAny(aError1));
+ SQLException aError1( _rStatement, _rxContext, sSQLStateGeneralError, 1000, Any( aError2 ) );
+ throw SQLException(_rParser.getContext().getErrorMessage(OParseContext::ErrorCode::General),_rxContext,sSQLStateGeneralError,1000,Any(aError1));
}
return pNewSqlParseNode;
}
@@ -131,7 +133,7 @@ namespace
// and now really ...
SQLException aError1( _rOriginatingCommand, _rxContext, getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 1000, Any() );
throw SQLException( DBA_RES( RID_STR_ONLY_QUERY ), _rxContext,
- getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 1000, makeAny( aError1 ) );
+ getStandardSQLState( StandardSQLState::GENERAL_ERROR ), 1000, Any( aError1 ) );
}
delete pOldNode;
@@ -168,33 +170,33 @@ namespace
delete pSqlParseNode;
_rIterator.dispose();
}
- void lcl_addFilterCriteria_throw(sal_Int32 i_nFilterOperator,const OUString& i_sValue,OUStringBuffer& o_sRet)
+ void lcl_addFilterCriteria_throw(sal_Int32 i_nFilterOperator,std::u16string_view i_sValue,OUStringBuffer& o_sRet)
{
switch( i_nFilterOperator )
{
case SQLFilterOperator::EQUAL:
- o_sRet.append(" = " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" = ") + i_sValue);
break;
case SQLFilterOperator::NOT_EQUAL:
- o_sRet.append(" <> " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" <> ") + i_sValue);
break;
case SQLFilterOperator::LESS:
- o_sRet.append(" < " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" < ") + i_sValue);
break;
case SQLFilterOperator::GREATER:
- o_sRet.append(" > " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" > ") + i_sValue);
break;
case SQLFilterOperator::LESS_EQUAL:
- o_sRet.append(" <= " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" <= ") + i_sValue);
break;
case SQLFilterOperator::GREATER_EQUAL:
- o_sRet.append(" >= " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" >= ") + i_sValue);
break;
case SQLFilterOperator::LIKE:
- o_sRet.append(" LIKE " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" LIKE ") + i_sValue);
break;
case SQLFilterOperator::NOT_LIKE:
- o_sRet.append(" NOT LIKE " ).append( i_sValue);
+ o_sRet.append(OUString::Concat(" NOT LIKE ") + i_sValue);
break;
case SQLFilterOperator::SQLNULL:
o_sRet.append(" IS NULL");
@@ -215,7 +217,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc
const Reference<XComponentContext>& _rContext )
:OSubComponent(m_aMutex,_xConnection)
,OPropertyContainer(m_aBHelper)
- ,m_aSqlParser( _rContext, &m_aParseContext )
+ ,m_aSqlParser( _rContext, &m_aParseContext, &m_aNeutralContext )
,m_aSqlIterator( _xConnection, _rxTables, m_aSqlParser )
,m_aAdditiveIterator( _xConnection, _rxTables, m_aSqlParser )
,m_aElementaryParts( size_t(SQLPartCount) )
@@ -243,7 +245,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc
{
Any aValue;
Reference<XInterface> xDs = dbaccess::getDataSource(_xConnection);
- if ( dbtools::getDataSourceSetting(xDs,static_cast <OUString> (PROPERTY_BOOLEANCOMPARISONMODE),aValue) )
+ if ( dbtools::getDataSourceSetting(xDs,PROPERTY_BOOLEANCOMPARISONMODE,aValue) )
{
OSL_VERIFY( aValue >>= m_nBoolCompareMode );
}
@@ -277,15 +279,54 @@ void SAL_CALL OSingleSelectQueryComposer::disposing()
}
IMPLEMENT_FORWARD_XINTERFACE3(OSingleSelectQueryComposer,OSubComponent,OSingleSelectQueryComposer_BASE,OPropertyContainer)
-IMPLEMENT_SERVICE_INFO1(OSingleSelectQueryComposer,"org.openoffice.comp.dba.OSingleSelectQueryComposer",SERVICE_NAME_SINGLESELECTQUERYCOMPOSER)
+OUString SAL_CALL OSingleSelectQueryComposer::getImplementationName()
+ {
+ return "org.openoffice.comp.dba.OSingleSelectQueryComposer";
+ }
+sal_Bool SAL_CALL OSingleSelectQueryComposer::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OSingleSelectQueryComposer::getSupportedServiceNames()
+{
+ return { SERVICE_NAME_SINGLESELECTQUERYCOMPOSER };
+}
css::uno::Sequence<sal_Int8> OSingleSelectQueryComposer::getImplementationId()
{
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES3(OSingleSelectQueryComposer,OSubComponent,OSingleSelectQueryComposer_BASE,OPropertyContainer)
-IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OSingleSelectQueryComposer)
+css::uno::Sequence< css::uno::Type > OSingleSelectQueryComposer::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OSubComponent::getTypes( ),
+ OSingleSelectQueryComposer_BASE::getTypes( ),
+ OPropertyContainer::getTypes( )
+ );
+}
+
+css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OSingleSelectQueryComposer::getPropertySetInfo()
+{
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+::cppu::IPropertyArrayHelper& OSingleSelectQueryComposer::getInfoHelper()
+{
+ return *OSingleSelectQueryComposer::getArrayHelper();
+}
+::cppu::IPropertyArrayHelper* OSingleSelectQueryComposer::createArrayHelper( ) const
+{
+ css::uno::Sequence< css::beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
// XSingleSelectQueryAnalyzer
OUString SAL_CALL OSingleSelectQueryComposer::getQuery( )
@@ -430,11 +471,11 @@ OUString OSingleSelectQueryComposer::impl_getColumnRealName_throw(const Referenc
|| !m_aCurrentColumns[SelectColumns]
|| !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME)
)
- {
- OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP));
- SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() );
- throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) );
- }
+ {
+ OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP));
+ SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() );
+ throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,Any(aErr) );
+ }
OUString aName, aNewName;
column->getPropertyValue(PROPERTY_NAME) >>= aName;
@@ -470,9 +511,9 @@ OUString OSingleSelectQueryComposer::impl_getColumnRealName_throw(const Referenc
{
if(sTableName.indexOf('.') != -1)
{
- OUString aCatlog,aSchema,aTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,sTableName,aCatlog,aSchema,aTable,::dbtools::EComposeRule::InDataManipulation);
- sTableName = ::dbtools::composeTableName( m_xMetaData, aCatlog, aSchema, aTable, true, ::dbtools::EComposeRule::InDataManipulation );
+ OUString aCatalog,aSchema,aTable;
+ ::dbtools::qualifiedNameComponents(m_xMetaData,sTableName,aCatalog,aSchema,aTable,::dbtools::EComposeRule::InDataManipulation);
+ sTableName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, true, ::dbtools::EComposeRule::InDataManipulation );
}
else if (!sTableName.isEmpty())
sTableName = ::dbtools::quoteName(aQuote,sTableName);
@@ -500,11 +541,11 @@ OUString OSingleSelectQueryComposer::impl_getColumnNameOrderBy_throw(const Refer
|| !m_aCurrentColumns[SelectColumns]
|| !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME)
)
- {
- OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP));
- SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() );
- throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) );
- }
+ {
+ OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP));
+ SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() );
+ throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,Any(aErr) );
+ }
OUString aName;
column->getPropertyValue(PROPERTY_NAME) >>= aName;
@@ -610,7 +651,7 @@ void SAL_CALL OSingleSelectQueryComposer::setElementaryQuery( const OUString& _r
namespace
{
OUString getComposedClause( const OUString& _rElementaryClause, const OUString& _rAdditionalClause,
- TokenComposer& _rComposer, const OUString& _rKeyword )
+ TokenComposer& _rComposer, std::u16string_view _rKeyword )
{
_rComposer.clear();
_rComposer.append( _rElementaryClause );
@@ -716,7 +757,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getTables( )
for (auto const& elem : aTables)
aNames.push_back(elem.first);
- m_pTables.reset( new OPrivateTables(aTables,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,aNames) );
+ m_pTables.reset( new OPrivateTables(aTables,m_xMetaData->supportsMixedCaseQuotedIdentifiers(),*this,m_aMutex,std::move(aNames)) );
}
return m_pTables.get();
@@ -751,14 +792,14 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( )
bCase = m_xMetaData->supportsMixedCaseQuotedIdentifiers();
aSelectColumns = m_aSqlIterator.getSelectColumns();
- OUStringBuffer aSQL( m_aPureSelectSQL + STR_WHERE " ( 0 = 1 )");
+ OUStringBuffer aSQL( m_aPureSelectSQL + STR_WHERE + " ( 0 = 1 )");
// preserve the original WHERE clause
// #i102234#
OUString sOriginalWhereClause = getSQLPart( Where, m_aSqlIterator, false );
if ( !sOriginalWhereClause.isEmpty() )
{
- aSQL.append( " AND ( " ).append( sOriginalWhereClause ).append( " ) " );
+ aSQL.append( " AND ( " + sOriginalWhereClause + " ) " );
}
OUString sGroupBy = getSQLPart( Group, m_aSqlIterator, true );
@@ -806,7 +847,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( )
{
xStatement.reset( Reference< XStatement >( m_xConnection->createStatement(), UNO_SET_THROW ) );
Reference< XPropertySet > xStatementProps( xStatement, UNO_QUERY_THROW );
- try { xStatementProps->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( false ) ); }
+ try { xStatementProps->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, Any( false ) ); }
catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION("dbaccess"); }
xResMetaDataSup.set( xStatement->executeQuery( sSQL ), UNO_QUERY_THROW );
xResultSetMeta.set( xResMetaDataSup->getMetaData(), UNO_SET_THROW );
@@ -889,7 +930,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( )
if ( !xProp.is() || !xProp->getPropertySetInfo()->hasPropertyByName( PROPERTY_REALNAME ) )
continue;
- ::connectivity::parse::OParseColumn* pColumn = new ::connectivity::parse::OParseColumn(xProp,bCase);
+ rtl::Reference<::connectivity::parse::OParseColumn> pColumn = new ::connectivity::parse::OParseColumn(xProp,bCase);
pColumn->setFunction(::comphelper::getBOOL(xProp->getPropertyValue("Function")));
pColumn->setAggregateFunction(::comphelper::getBOOL(xProp->getPropertyValue("AggregateFunction")));
@@ -1313,7 +1354,7 @@ OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet
OUString sReturn;
if(m_pTables && m_pTables->getCount() > 1)
{
- OUString aCatalog,aSchema,aTable,aComposedName,aColumnName;
+ OUString aCatalog,aSchema,aTable,aColumnName;
if(column->getPropertySetInfo()->hasPropertyByName(PROPERTY_CATALOGNAME))
column->getPropertyValue(PROPERTY_CATALOGNAME) >>= aCatalog;
if(column->getPropertySetInfo()->hasPropertyByName(PROPERTY_SCHEMANAME))
@@ -1342,7 +1383,7 @@ OUString OSingleSelectQueryComposer::getTableAlias(const Reference< XPropertySet
}
else
{
- aComposedName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, false, ::dbtools::EComposeRule::InDataManipulation );
+ OUString aComposedName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, false, ::dbtools::EComposeRule::InDataManipulation );
// Is this the right case for the table name?
// Else, look for it with different case, if applicable.
@@ -1483,9 +1524,9 @@ OUString OSingleSelectQueryComposer::getStatementPart( TGetParseNode const & _aG
namespace
{
- OUString lcl_getDecomposedColumnName(const OUString& rComposedName, const OUString& rQuoteString)
+ OUString lcl_getDecomposedColumnName(const OUString& rComposedName, std::u16string_view rQuoteString)
{
- const sal_Int32 nQuoteLength = rQuoteString.getLength();
+ const size_t nQuoteLength = rQuoteString.size();
OUString sName = rComposedName.trim();
OUString sColumnName;
sal_Int32 nPos, nRPos = 0;
@@ -1498,7 +1539,7 @@ namespace
nRPos = sName.indexOf( rQuoteString, nPos + nQuoteLength );
if ( nRPos > nPos )
{
- if ( nRPos + nQuoteLength < sName.getLength() )
+ if ( static_cast<sal_Int32>(nRPos + nQuoteLength) < sName.getLength() )
{
nRPos += nQuoteLength; // -1 + 1 skip dot
}
@@ -1520,7 +1561,7 @@ namespace
OUString lcl_getCondition(const Sequence< Sequence< PropertyValue > >& filter,
const OPredicateInputController& i_aPredicateInputController,
const Reference< XNameAccess >& i_xSelectColumns,
- const OUString& rQuoteString)
+ std::u16string_view rQuoteString)
{
OUStringBuffer sRet;
const Sequence< PropertyValue >* pOrIter = filter.getConstArray();
@@ -1619,9 +1660,9 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
xColumn->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName;
if(sTableName.indexOf('.') != -1)
{
- OUString aCatlog,aSchema,aTable;
- ::dbtools::qualifiedNameComponents(m_xMetaData,sTableName,aCatlog,aSchema,aTable,::dbtools::EComposeRule::InDataManipulation);
- sTableName = ::dbtools::composeTableName( m_xMetaData, aCatlog, aSchema, aTable, true, ::dbtools::EComposeRule::InDataManipulation );
+ OUString aCatalog,aSchema,aTable;
+ ::dbtools::qualifiedNameComponents(m_xMetaData,sTableName,aCatalog,aSchema,aTable,::dbtools::EComposeRule::InDataManipulation);
+ sTableName = ::dbtools::composeTableName( m_xMetaData, aCatalog, aSchema, aTable, true, ::dbtools::EComposeRule::InDataManipulation );
}
else
sTableName = ::dbtools::quoteName(aQuote,sTableName);
@@ -1646,7 +1687,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
if ( nType != DataType::BOOLEAN && DataType::BIT != nType )
{
- lcl_addFilterCriteria_throw(filterOperator,"",aSQL);
+ lcl_addFilterCriteria_throw(filterOperator,u"",aSQL);
}
switch(nType)
@@ -1664,7 +1705,7 @@ 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("'").append(xClob->getSubString(1,static_cast<sal_Int32>(nLength))).append("'");
+ aSQL.append("'" + xClob->getSubString(1,static_cast<sal_Int32>(nLength)) + "'");
}
}
else
@@ -1715,7 +1756,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
sal_Int32 nFilterOp = filterOperator;
if ( filterOperator != SQLFilterOperator::SQLNULL && filterOperator != SQLFilterOperator::NOT_SQLNULL )
nFilterOp = SQLFilterOperator::SQLNULL;
- lcl_addFilterCriteria_throw(nFilterOp,"",aSQL);
+ lcl_addFilterCriteria_throw(nFilterOp,u"",aSQL);
}
// Attach filter
@@ -1725,7 +1766,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
if ( !sFilter.isEmpty() && !aSQL.isEmpty() )
{
sFilter = L_BRACKET + sFilter + R_BRACKET +
- (andCriteria ? OUStringLiteral(STR_AND) : OUStringLiteral(STR_OR));
+ (andCriteria ? std::u16string_view(STR_AND) : std::u16string_view(STR_OR));
}
sFilter += aSQL;
diff --git a/dbaccess/source/core/api/StaticSet.cxx b/dbaccess/source/core/api/StaticSet.cxx
index 0a5bd2c2d5fe..57eea66f34cf 100644
--- a/dbaccess/source/core/api/StaticSet.cxx
+++ b/dbaccess/source/core/api/StaticSet.cxx
@@ -23,17 +23,14 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <connectivity/CommonTools.hxx>
#include <comphelper/types.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
using namespace dbaccess;
using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace ::osl;
void OStaticSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 /*_nPosition*/)
{
@@ -43,7 +40,7 @@ void OStaticSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 /*_nPosition*/)
// css::sdbcx::XRowLocate
Any OStaticSet::getBookmark()
{
- return makeAny(getRow());
+ return Any(getRow());
}
bool OStaticSet::moveToBookmark( const Any& bookmark )
@@ -80,7 +77,7 @@ bool OStaticSet::fetchRow()
m_aSet.push_back(new connectivity::ORowVector< connectivity::ORowSetValue >(m_xSetMetaData->getColumnCount()));
m_aSetIter = m_aSet.end() - 1;
(**m_aSetIter)[0] = getRow();
- OCacheSet::fillValueRow(*m_aSetIter,(**m_aSetIter)[0]);
+ OCacheSet::fillValueRow(*m_aSetIter,(**m_aSetIter)[0].getInt32());
}
else
m_bEnd = true;
@@ -99,7 +96,7 @@ void OStaticSet::fillAllRows()
m_aSet.push_back(pRow);
m_aSetIter = m_aSet.end() - 1;
(*pRow)[0] = getRow();
- OCacheSet::fillValueRow(pRow,(*pRow)[0]);
+ OCacheSet::fillValueRow(pRow,(*pRow)[0].getInt32());
}
m_bEnd = true;
}
@@ -193,7 +190,7 @@ bool OStaticSet::absolute( sal_Int32 row )
}
else if(row > 0)
{
- if(row >= static_cast<sal_Int32>(m_aSet.size()))
+ if(o3tl::make_unsigned(row) >= m_aSet.size())
{
if(!m_bEnd)
{
@@ -202,7 +199,7 @@ bool OStaticSet::absolute( sal_Int32 row )
bNext = fetchRow();
}
- if(row > static_cast<sal_Int32>(m_aSet.size()))
+ if(o3tl::make_unsigned(row) > m_aSet.size())
m_aSetIter = m_aSet.end(); // check again
else
m_aSetIter = m_aSet.begin() + row;
@@ -270,10 +267,7 @@ void OStaticSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OS
void OStaticSet::reset(const Reference< XResultSet> &_xDriverSet)
{
OCacheSet::construct(_xDriverSet, m_sRowSetFilter);
- {
- ORowSetMatrix t;
- m_aSet.swap(t);
- }
+ ORowSetMatrix().swap(m_aSet);
m_aSetIter = m_aSet.end();
m_bEnd = false;
m_aSet.emplace_back(nullptr); // this is the beforefirst record
diff --git a/dbaccess/source/core/api/StaticSet.hxx b/dbaccess/source/core/api/StaticSet.hxx
index 8c466d29e208..9f765996b860 100644
--- a/dbaccess/source/core/api/StaticSet.hxx
+++ b/dbaccess/source/core/api/StaticSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_STATICSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_STATICSET_HXX
+#pragma once
#include "CacheSet.hxx"
@@ -72,6 +71,5 @@ namespace dbaccess
virtual void deleteRow(const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_STATICSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx
index b8a8da27371e..92821750f9dc 100644
--- a/dbaccess/source/core/api/TableDeco.cxx
+++ b/dbaccess/source/core/api/TableDeco.cxx
@@ -18,15 +18,14 @@
*/
#include <TableDeco.hxx>
-#include <apitools.hxx>
#include <definitioncolumn.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
#include <osl/diagnose.h>
#include <sal/log.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <comphelper/property.hxx>
#include <comphelper/servicehelper.hxx>
#include <com/sun/star/sdbc/SQLException.hpp>
@@ -311,7 +310,7 @@ void ODBTableDecorator::construct()
Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo();
Sequence< Property > aTableProps = xInfo->getProperties();
- for (Property & prop : aTableProps)
+ for (Property & prop : asNonConstRange(aTableProps))
{
if (prop.Name == PROPERTY_CATALOGNAME)
prop.Handle = PROPERTY_ID_CATALOGNAME;
@@ -351,7 +350,24 @@ void ODBTableDecorator::construct()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO1(ODBTableDecorator, "com.sun.star.sdb.dbaccess.ODBTableDecorator", SERVICE_SDBCX_TABLE)
+OUString SAL_CALL ODBTableDecorator::getImplementationName()
+ {
+ return "com.sun.star.sdb.dbaccess.ODBTableDecorator";
+ }
+sal_Bool SAL_CALL ODBTableDecorator::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL ODBTableDecorator::getSupportedServiceNames()
+{
+ return { SERVICE_SDBCX_TABLE };
+}
+
Any SAL_CALL ODBTableDecorator::queryInterface( const Type & rType )
{
@@ -451,8 +467,8 @@ OUString SAL_CALL ODBTableDecorator::getName()
sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& rId )
{
- if (isUnoTunnelId<ODBTableDecorator>(rId))
- return reinterpret_cast<sal_Int64>(this);
+ if (comphelper::isUnoTunnelId<ODBTableDecorator>(rId))
+ return comphelper::getSomething_cast(this);
sal_Int64 nRet = 0;
Reference<XUnoTunnel> xTunnel(m_xTable,UNO_QUERY);
@@ -461,11 +477,10 @@ sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >&
return nRet;
}
-Sequence< sal_Int8 > ODBTableDecorator::getUnoTunnelId()
+const Sequence< sal_Int8 > & ODBTableDecorator::getUnoTunnelId()
{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
}
void ODBTableDecorator::fillPrivileges() const
@@ -534,11 +549,8 @@ void ODBTableDecorator::refreshColumns()
xNames = m_xTable->getColumns();
if(xNames.is())
{
- Sequence< OUString> aNames = xNames->getElementNames();
- const OUString* pIter = aNames.getConstArray();
- const OUString* pEnd = pIter + aNames.getLength();
- for(;pIter != pEnd;++pIter)
- aVector.push_back(*pIter);
+ const Sequence< OUString> aNames = xNames->getElementNames();
+ aVector.insert(aVector.end(), aNames.begin(), aNames.end());
}
}
if(!m_pColumns)
@@ -549,18 +561,18 @@ void ODBTableDecorator::refreshColumns()
m_xMetaData.is() && m_xMetaData->supportsAlterTableWithDropColumn());
pCol->setParent(*this);
- OContainerMediator* pMediator = new OContainerMediator( pCol, m_xColumnDefinitions );
+ rtl::Reference<OContainerMediator> pMediator = new OContainerMediator( pCol, m_xColumnDefinitions );
m_xColumnMediator = pMediator;
- pCol->setMediator( pMediator );
+ pCol->setMediator( pMediator.get() );
m_pColumns.reset(pCol);
}
else
m_pColumns->reFill(aVector);
}
-OColumn* ODBTableDecorator::createColumn(const OUString& _rName) const
+rtl::Reference<OColumn> ODBTableDecorator::createColumn(const OUString& _rName) const
{
- OColumn* pReturn = nullptr;
+ rtl::Reference<OColumn> pReturn;
Reference<XNameAccess> xNames;
if ( m_xTable.is() )
@@ -571,11 +583,11 @@ OColumn* ODBTableDecorator::createColumn(const OUString& _rName) const
{
Reference<XPropertySet> xProp(xNames->getByName(_rName),UNO_QUERY);
- Reference<XPropertySet> xColumnDefintion;
+ Reference<XPropertySet> xColumnDefinition;
if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName))
- xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
+ xColumnDefinition.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
- pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
+ pReturn = new OTableColumnWrapper( xProp, xColumnDefinition, false );
}
}
return pReturn;
@@ -604,12 +616,12 @@ Reference< XPropertySet > ODBTableDecorator::createColumnDescriptor()
return xRet;
}
-void SAL_CALL ODBTableDecorator::acquire() throw()
+void SAL_CALL ODBTableDecorator::acquire() noexcept
{
OTableDescriptor_BASE::acquire();
}
-void SAL_CALL ODBTableDecorator::release() throw()
+void SAL_CALL ODBTableDecorator::release() noexcept
{
OTableDescriptor_BASE::release();
}
diff --git a/dbaccess/source/core/api/View.cxx b/dbaccess/source/core/api/View.cxx
index c52c4885c757..ce813b29ee82 100644
--- a/dbaccess/source/core/api/View.cxx
+++ b/dbaccess/source/core/api/View.cxx
@@ -24,7 +24,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
diff --git a/dbaccess/source/core/api/WrappedResultSet.cxx b/dbaccess/source/core/api/WrappedResultSet.cxx
index a0999e5f32aa..a4ad9f363cae 100644
--- a/dbaccess/source/core/api/WrappedResultSet.cxx
+++ b/dbaccess/source/core/api/WrappedResultSet.cxx
@@ -23,12 +23,8 @@
using namespace dbaccess;
using namespace ::connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace ::osl;
void WrappedResultSet::construct(const Reference< XResultSet>& _xDriverSet,const OUString& i_sRowSetFilter)
{
@@ -49,7 +45,7 @@ Any WrappedResultSet::getBookmark()
{
return m_xRowLocate->getBookmark( );
}
- return makeAny(m_xDriverSet->getRow());
+ return Any(m_xDriverSet->getRow());
}
bool WrappedResultSet::moveToBookmark( const Any& bookmark )
@@ -122,56 +118,56 @@ void WrappedResultSet::updateColumn(sal_Int32 nPos, const Reference< XRowUpdate
break;
case DataType::CHAR:
case DataType::VARCHAR:
- _xParameter->updateString(nPos,_rValue);
+ _xParameter->updateString(nPos,_rValue.getString());
break;
case DataType::BIGINT:
if ( _rValue.isSigned() )
- _xParameter->updateLong(nPos,_rValue);
+ _xParameter->updateLong(nPos,_rValue.getLong());
else
- _xParameter->updateString(nPos,_rValue);
+ _xParameter->updateString(nPos,_rValue.getString());
break;
case DataType::BIT:
case DataType::BOOLEAN:
- _xParameter->updateBoolean(nPos,static_cast<bool>(_rValue));
+ _xParameter->updateBoolean(nPos,_rValue.getBool());
break;
case DataType::TINYINT:
if ( _rValue.isSigned() )
- _xParameter->updateByte(nPos,_rValue);
+ _xParameter->updateByte(nPos,_rValue.getInt8());
else
- _xParameter->updateShort(nPos,_rValue);
+ _xParameter->updateShort(nPos,_rValue.getInt16());
break;
case DataType::SMALLINT:
if ( _rValue.isSigned() )
- _xParameter->updateShort(nPos,_rValue);
+ _xParameter->updateShort(nPos,_rValue.getInt16());
else
- _xParameter->updateInt(nPos,_rValue);
+ _xParameter->updateInt(nPos,_rValue.getInt32());
break;
case DataType::INTEGER:
if ( _rValue.isSigned() )
- _xParameter->updateInt(nPos,_rValue);
+ _xParameter->updateInt(nPos,_rValue.getInt32());
else
- _xParameter->updateLong(nPos,_rValue);
+ _xParameter->updateLong(nPos,_rValue.getLong());
break;
case DataType::FLOAT:
- _xParameter->updateFloat(nPos,_rValue);
+ _xParameter->updateFloat(nPos,_rValue.getFloat());
break;
case DataType::DOUBLE:
case DataType::REAL:
- _xParameter->updateDouble(nPos,_rValue);
+ _xParameter->updateDouble(nPos,_rValue.getDouble());
break;
case DataType::DATE:
- _xParameter->updateDate(nPos,_rValue);
+ _xParameter->updateDate(nPos,_rValue.getDate());
break;
case DataType::TIME:
- _xParameter->updateTime(nPos,_rValue);
+ _xParameter->updateTime(nPos,_rValue.getTime());
break;
case DataType::TIMESTAMP:
- _xParameter->updateTimestamp(nPos,_rValue);
+ _xParameter->updateTimestamp(nPos,_rValue.getDateTime());
break;
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
- _xParameter->updateBytes(nPos,_rValue);
+ _xParameter->updateBytes(nPos,_rValue.getSequence());
break;
case DataType::BLOB:
case DataType::CLOB:
diff --git a/dbaccess/source/core/api/WrappedResultSet.hxx b/dbaccess/source/core/api/WrappedResultSet.hxx
index 8f0b07953605..58b2d704102a 100644
--- a/dbaccess/source/core/api/WrappedResultSet.hxx
+++ b/dbaccess/source/core/api/WrappedResultSet.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_WRAPPEDRESULTSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_WRAPPEDRESULTSET_HXX
+#pragma once
#include "CacheSet.hxx"
#include <com/sun/star/sdbcx/XRowLocate.hpp>
@@ -57,6 +56,5 @@ namespace dbaccess
virtual void deleteRow(const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_WRAPPEDRESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/callablestatement.cxx b/dbaccess/source/core/api/callablestatement.cxx
index cfddeac19139..25f3f405f8c1 100644
--- a/dbaccess/source/core/api/callablestatement.cxx
+++ b/dbaccess/source/core/api/callablestatement.cxx
@@ -24,10 +24,7 @@
using namespace dbaccess;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
using namespace ::cppu;
using namespace ::osl;
@@ -58,12 +55,12 @@ Any OCallableStatement::queryInterface( const Type & rType )
return aIface;
}
-void OCallableStatement::acquire() throw ()
+void OCallableStatement::acquire() noexcept
{
OPreparedStatement::acquire();
}
-void OCallableStatement::release() throw ()
+void OCallableStatement::release() noexcept
{
OPreparedStatement::release();
}
@@ -84,7 +81,7 @@ void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY_THROW)->registerOutParameter( parameterIndex, sqlType, typeName );
}
@@ -92,7 +89,7 @@ void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex
void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XOutParameters >(m_xAggregateAsSet, UNO_QUERY_THROW)->registerNumericOutParameter( parameterIndex, sqlType, scale );
}
@@ -101,7 +98,7 @@ void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 paramet
sal_Bool SAL_CALL OCallableStatement::wasNull( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->wasNull();
}
@@ -109,7 +106,7 @@ sal_Bool SAL_CALL OCallableStatement::wasNull( )
OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getString( columnIndex );
}
@@ -117,7 +114,7 @@ OUString SAL_CALL OCallableStatement::getString( sal_Int32 columnIndex )
sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBoolean( columnIndex );
}
@@ -125,7 +122,7 @@ sal_Bool SAL_CALL OCallableStatement::getBoolean( sal_Int32 columnIndex )
sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getByte( columnIndex );
}
@@ -133,63 +130,63 @@ sal_Int8 SAL_CALL OCallableStatement::getByte( sal_Int32 columnIndex )
sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getShort( columnIndex );
}
sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getInt( columnIndex );
}
sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getLong( columnIndex );
}
float SAL_CALL OCallableStatement::getFloat( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getFloat( columnIndex );
}
double SAL_CALL OCallableStatement::getDouble( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getDouble( columnIndex );
}
Sequence< sal_Int8 > SAL_CALL OCallableStatement::getBytes( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBytes( columnIndex );
}
css::util::Date SAL_CALL OCallableStatement::getDate( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getDate( columnIndex );
}
css::util::Time SAL_CALL OCallableStatement::getTime( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getTime( columnIndex );
}
css::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getTimestamp( columnIndex );
}
@@ -197,7 +194,7 @@ css::util::DateTime SAL_CALL OCallableStatement::getTimestamp( sal_Int32 columnI
Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBinaryStream( columnIndex );
}
@@ -205,7 +202,7 @@ Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getBinaryStream(
Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStream( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getCharacterStream( columnIndex );
}
@@ -213,7 +210,7 @@ Reference< css::io::XInputStream > SAL_CALL OCallableStatement::getCharacterStre
Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Reference< css::container::XNameAccess >& typeMap )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getObject( columnIndex, typeMap );
}
@@ -221,28 +218,28 @@ Any SAL_CALL OCallableStatement::getObject( sal_Int32 columnIndex, const Referen
Reference< XRef > SAL_CALL OCallableStatement::getRef( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getRef( columnIndex );
}
Reference< XBlob > SAL_CALL OCallableStatement::getBlob( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getBlob( columnIndex );
}
Reference< XClob > SAL_CALL OCallableStatement::getClob( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getClob( columnIndex );
}
Reference< XArray > SAL_CALL OCallableStatement::getArray( sal_Int32 columnIndex )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XRow >(m_xAggregateAsSet, UNO_QUERY_THROW)->getArray( columnIndex );
}
diff --git a/dbaccess/source/core/api/column.cxx b/dbaccess/source/core/api/column.cxx
index 5bc70affbce0..ad205c3248fa 100644
--- a/dbaccess/source/core/api/column.cxx
+++ b/dbaccess/source/core/api/column.cxx
@@ -34,19 +34,16 @@
#include <connectivity/TTableHelper.hxx>
#include <connectivity/dbexception.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <utility>
#include <osl/diagnose.h>
using namespace dbaccess;
using namespace connectivity;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::io;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -147,7 +144,7 @@ OColumns::OColumns(::cppu::OWeakObject& _rParent,
}
OColumns::OColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
- const css::uno::Reference< css::container::XNameAccess >& _rxDrvColumns,
+ css::uno::Reference< css::container::XNameAccess > _xDrvColumns,
bool _bCaseSensitive,const std::vector< OUString> &_rVector,
IColumnFactory* _pColFactory,
::connectivity::sdbcx::IRefreshableColumns* _pRefresh,
@@ -156,7 +153,7 @@ OColumns::OColumns(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
bool _bUseHardRef)
: OColumns_BASE(_rParent,_bCaseSensitive,_rMutex,_rVector,_bUseHardRef)
,m_pMediator(nullptr)
- ,m_xDrvColumns(_rxDrvColumns)
+ ,m_xDrvColumns(std::move(_xDrvColumns))
,m_pColFactoryImpl(_pColFactory)
,m_pRefreshColumns(_pRefresh)
,m_bInitialized(false)
diff --git a/dbaccess/source/core/api/columnsettings.cxx b/dbaccess/source/core/api/columnsettings.cxx
index 3f62a5a691fe..505e0d36b98f 100644
--- a/dbaccess/source/core/api/columnsettings.cxx
+++ b/dbaccess/source/core/api/columnsettings.cxx
@@ -24,7 +24,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <comphelper/property.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -121,14 +121,14 @@ namespace dbaccess
};
const PropertyDescriptor aProps[] =
{
- { OUString(PROPERTY_ALIGN), PROPERTY_ID_ALIGN },
- { OUString(PROPERTY_NUMBERFORMAT), PROPERTY_ID_NUMBERFORMAT },
- { OUString(PROPERTY_RELATIVEPOSITION), PROPERTY_ID_RELATIVEPOSITION },
- { OUString(PROPERTY_WIDTH), PROPERTY_ID_WIDTH },
- { OUString(PROPERTY_HELPTEXT), PROPERTY_ID_HELPTEXT },
- { OUString(PROPERTY_CONTROLDEFAULT), PROPERTY_ID_CONTROLDEFAULT },
- { OUString(PROPERTY_CONTROLMODEL), PROPERTY_ID_CONTROLMODEL },
- { OUString(PROPERTY_HIDDEN), PROPERTY_ID_HIDDEN }
+ { PROPERTY_ALIGN, PROPERTY_ID_ALIGN },
+ { PROPERTY_NUMBERFORMAT, PROPERTY_ID_NUMBERFORMAT },
+ { PROPERTY_RELATIVEPOSITION, PROPERTY_ID_RELATIVEPOSITION },
+ { PROPERTY_WIDTH, PROPERTY_ID_WIDTH },
+ { PROPERTY_HELPTEXT, PROPERTY_ID_HELPTEXT },
+ { PROPERTY_CONTROLDEFAULT, PROPERTY_ID_CONTROLDEFAULT },
+ { PROPERTY_CONTROLMODEL, PROPERTY_ID_CONTROLMODEL },
+ { PROPERTY_HIDDEN, PROPERTY_ID_HIDDEN }
};
for (const auto & aProp : aProps)
diff --git a/dbaccess/source/core/api/datacolumn.cxx b/dbaccess/source/core/api/datacolumn.cxx
index c597a40649bf..e0953449154a 100644
--- a/dbaccess/source/core/api/datacolumn.cxx
+++ b/dbaccess/source/core/api/datacolumn.cxx
@@ -25,12 +25,9 @@
using namespace dbaccess;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::osl;
-using namespace ::comphelper;
using namespace ::cppu;
diff --git a/dbaccess/source/core/api/datacolumn.hxx b/dbaccess/source/core/api/datacolumn.hxx
index fa40e0765cc1..46512d94559c 100644
--- a/dbaccess/source/core/api/datacolumn.hxx
+++ b/dbaccess/source/core/api/datacolumn.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_DATACOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_DATACOLUMN_HXX
+#pragma once
#include <com/sun/star/sdbc/XRowUpdate.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -52,8 +51,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override { OResultColumn::acquire(); }
- virtual void SAL_CALL release() throw() override { OResultColumn::release(); }
+ virtual void SAL_CALL acquire() noexcept override { OResultColumn::acquire(); }
+ virtual void SAL_CALL release() noexcept override { OResultColumn::release(); }
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -105,6 +104,4 @@ namespace dbaccess
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_DATACOLUMN_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/datasettings.cxx b/dbaccess/source/core/api/datasettings.cxx
index 28167184442f..f810f8669917 100644
--- a/dbaccess/source/core/api/datasettings.cxx
+++ b/dbaccess/source/core/api/datasettings.cxx
@@ -27,7 +27,6 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::comphelper;
using namespace ::cppu;
@@ -95,7 +94,6 @@ void ODataSettings::registerPropertiesFor(ODataSettings_Base* _pItem)
ODataSettings::ODataSettings(OBroadcastHelper& _rBHelper,bool _bQuery)
:OPropertyStateContainer(_rBHelper)
- ,ODataSettings_Base()
,m_bQuery(_bQuery)
{
}
diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx
index 84d1197bda20..b952edca2e7a 100644
--- a/dbaccess/source/core/api/definitioncolumn.cxx
+++ b/dbaccess/source/core/api/definitioncolumn.cxx
@@ -19,8 +19,8 @@
#include <bitset>
-#include <apitools.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <definitioncolumn.hxx>
#include <sdbcoretools.hxx>
@@ -30,13 +30,13 @@
#include <comphelper/property.hxx>
#include <connectivity/dbtools.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::cppu;
using namespace ::comphelper;
@@ -89,7 +89,7 @@ OUString OTableColumnDescriptor::getImplementationName( )
Sequence< OUString > OTableColumnDescriptor::getSupportedServiceNames( )
{
- return { m_bActAsDescriptor? OUString(SERVICE_SDBCX_COLUMNDESCRIPTOR) : OUString(SERVICE_SDBCX_COLUMN),
+ return { m_bActAsDescriptor? SERVICE_SDBCX_COLUMNDESCRIPTOR : SERVICE_SDBCX_COLUMN,
SERVICE_SDB_COLUMNSETTINGS };
}
@@ -156,9 +156,9 @@ OUString OTableColumn::getImplementationName( )
// OQueryColumn
-OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection, const OUString &i_sLabel )
+OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection, OUString i_sLabel )
:OTableColumnDescriptor( false /* do not act as descriptor */ )
- ,m_sLabel(i_sLabel)
+ ,m_sLabel(std::move(i_sLabel))
{
const sal_Int32 nPropAttr = PropertyAttribute::READONLY;
registerProperty( PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, nPropAttr, &m_sCatalogName, cppu::UnoType<decltype(m_sCatalogName)>::get() );
@@ -169,35 +169,35 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_TYPENAME ) >>= m_aTypeName) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_TYPENAME);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_TYPENAME);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_ISNULLABLE ) >>= m_nIsNullable) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_ISNULLABLE);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_ISNULLABLE);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_PRECISION ) >>= m_nPrecision) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_PRECISION);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_PRECISION);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_SCALE ) >>= m_nScale) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_SCALE);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_SCALE);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_TYPE ) >>= m_nType) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_TYPE);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_TYPE);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_ISAUTOINCREMENT ) >>= m_bAutoIncrement) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_ISAUTOINCREMENT);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_ISAUTOINCREMENT);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_ISCURRENCY ) >>= m_bCurrency) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_ISCURRENCY);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_ISCURRENCY);
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_NAME);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_NAME);
m_bRowVersion = false;
Reference< XPropertySetInfo > xPSI( _rxParserColumn->getPropertySetInfo(), UNO_SET_THROW );
if ( xPSI->hasPropertyByName( PROPERTY_DEFAULTVALUE ) )
if( ! (_rxParserColumn->getPropertyValue( PROPERTY_DEFAULTVALUE ) >>= m_aDefaultValue) )
- SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " PROPERTY_DEFAULTVALUE);
+ SAL_WARN("dbaccess.core", "OQueryColumn: unable to get property " + PROPERTY_DEFAULTVALUE);
// copy some optional properties from the parser column
struct PropertyDescriptor
@@ -207,10 +207,10 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co
};
const PropertyDescriptor aProps[] =
{
- { OUString(PROPERTY_CATALOGNAME), PROPERTY_ID_CATALOGNAME },
- { OUString(PROPERTY_SCHEMANAME), PROPERTY_ID_SCHEMANAME },
- { OUString(PROPERTY_TABLENAME), PROPERTY_ID_TABLENAME },
- { OUString(PROPERTY_REALNAME), PROPERTY_ID_REALNAME }
+ { PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME },
+ { PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME },
+ { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME },
+ { PROPERTY_REALNAME, PROPERTY_ID_REALNAME }
};
for (const auto & aProp : aProps)
{
@@ -243,11 +243,11 @@ Reference< XPropertySet > OQueryColumn::impl_determineOriginalTableColumn( const
// respective properties
OUString sCatalog, sSchema, sTable;
if( ! (getPropertyValue( PROPERTY_CATALOGNAME ) >>= sCatalog) )
- SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " PROPERTY_CATALOGNAME);
+ SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_CATALOGNAME);
if( ! (getPropertyValue( PROPERTY_SCHEMANAME ) >>= sSchema) )
- SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " PROPERTY_SCHEMANAME);
+ SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_SCHEMANAME);
if( ! (getPropertyValue( PROPERTY_TABLENAME ) >>= sTable) )
- SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " PROPERTY_TABLENAME);
+ SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_TABLENAME);
if ( sCatalog.isEmpty() && sSchema.isEmpty() && sTable.isEmpty() )
return nullptr;
@@ -265,7 +265,7 @@ Reference< XPropertySet > OQueryColumn::impl_determineOriginalTableColumn( const
OUString sColumn;
if( ! (getPropertyValue( PROPERTY_REALNAME ) >>= sColumn) )
- SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " PROPERTY_REALNAME);
+ SAL_WARN("dbaccess.core", "impl_determineOriginalTableColumn: unable to get property " + PROPERTY_REALNAME);
if ( !xColumns->hasByName( sColumn ) )
return nullptr;
@@ -444,50 +444,52 @@ Sequence< OUString > OTableColumnDescriptorWrapper::getSupportedServiceNames( )
// Which optional properties are contained?
const sal_Int32 nHaveOptionally (std::bitset<7>(nId).count());
- BEGIN_PROPERTY_SEQUENCE( nHaveAlways + nHaveOptionally )
+ css::uno::Sequence< css::beans::Property> aDescriptor(nHaveAlways + nHaveOptionally);
+ css::beans::Property* pDesc = aDescriptor.getArray();
+ sal_Int32 nPos = 0;
- DECL_PROP0_BOOL( ISAUTOINCREMENT );
- DECL_PROP0_BOOL( ISCURRENCY );
- DECL_PROP0( ISNULLABLE, sal_Int32 );
- DECL_PROP0( PRECISION, sal_Int32 );
- DECL_PROP0( SCALE, sal_Int32 );
- DECL_PROP0( TYPE, sal_Int32 );
- DECL_PROP0( TYPENAME, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, cppu::UnoType<bool>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, cppu::UnoType<bool>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, cppu::UnoType<sal_Int32>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_PRECISION, PROPERTY_ID_PRECISION, cppu::UnoType<sal_Int32>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_SCALE, PROPERTY_ID_SCALE, cppu::UnoType<sal_Int32>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_TYPE, PROPERTY_ID_TYPE, cppu::UnoType<sal_Int32>::get(), 0);
+ pDesc[nPos++] = css::beans::Property(PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, cppu::UnoType<OUString >::get(), 0);
if ( nId & HAS_AUTOINCREMENT_CREATION )
{
- DECL_PROP1( AUTOINCREMENTCREATION, OUString, MAYBEVOID );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_AUTOINCREMENTCREATION, PROPERTY_ID_AUTOINCREMENTCREATION, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID );
}
if ( nId & HAS_DEFAULTVALUE )
{
- DECL_PROP0( DEFAULTVALUE, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_DEFAULTVALUE, PROPERTY_ID_DEFAULTVALUE, cppu::UnoType<OUString >::get(), 0);
}
if ( nId & HAS_DESCRIPTION )
{
- DECL_PROP0( DESCRIPTION, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_DESCRIPTION, PROPERTY_ID_DESCRIPTION, cppu::UnoType<OUString >::get(), 0);
}
if ( nId & HAS_ROWVERSION )
{
- DECL_PROP0_BOOL( ISROWVERSION );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, cppu::UnoType<bool>::get(), 0);
}
if ( nId & HAS_CATALOGNAME )
{
- DECL_PROP0( CATALOGNAME, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, cppu::UnoType<OUString >::get(), 0);
}
if ( nId & HAS_SCHEMANAME )
{
- DECL_PROP0( SCHEMANAME, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, cppu::UnoType<OUString >::get(), 0);
}
if ( nId & HAS_TABLENAME )
{
- DECL_PROP0( TABLENAME, OUString );
+ pDesc[nPos++] = css::beans::Property(PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, cppu::UnoType<OUString >::get(), 0);
}
- END_PROPERTY_SEQUENCE()
+ OSL_ENSURE(nPos == aDescriptor.getLength(), "forgot to adjust the count ?");
if ( !m_bIsDescriptor )
{
- for ( auto & prop : aDescriptor )
+ for ( auto & prop : asNonConstRange(aDescriptor) )
{
prop.Attributes |= PropertyAttribute::READONLY;
}
@@ -559,16 +561,16 @@ void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast(
}
// OTableColumnWrapper
-OTableColumnWrapper::OTableColumnWrapper( const Reference< XPropertySet >& rCol, const Reference< XPropertySet >& _xColDefintion,
+OTableColumnWrapper::OTableColumnWrapper( const Reference< XPropertySet >& rCol, const Reference< XPropertySet >& _xColDefinition,
const bool _bPureWrap )
:OTableColumnDescriptorWrapper( rCol, _bPureWrap, false )
{
osl_atomic_increment( &m_refCount );
- if ( _xColDefintion.is() )
+ if ( _xColDefinition.is() )
{
try
{
- ::comphelper::copyProperties( _xColDefintion, this );
+ ::comphelper::copyProperties( _xColDefinition, this );
}
catch( const Exception& )
{
diff --git a/dbaccess/source/core/api/preparedstatement.cxx b/dbaccess/source/core/api/preparedstatement.cxx
index d65ea616d8c7..e7ec79a2ca87 100644
--- a/dbaccess/source/core/api/preparedstatement.cxx
+++ b/dbaccess/source/core/api/preparedstatement.cxx
@@ -28,13 +28,13 @@
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <preparedstatement.hxx>
+#include <strings.hxx>
#include "resultcolumn.hxx"
#include "resultset.hxx"
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::cppu;
@@ -93,12 +93,12 @@ Any OPreparedStatement::queryInterface( const Type & rType )
return aIface;
}
-void OPreparedStatement::acquire() throw ()
+void OPreparedStatement::acquire() noexcept
{
OStatementBase::acquire();
}
-void OPreparedStatement::release() throw ()
+void OPreparedStatement::release() noexcept
{
OStatementBase::release();
}
@@ -116,7 +116,7 @@ sal_Bool OPreparedStatement::supportsService( const OUString& _rServiceName )
Sequence< OUString > OPreparedStatement::getSupportedServiceNames( )
{
- return { SERVICE_SDBC_PREPAREDSTATEMENT, SERVICE_SDB_PREPAREDSTATMENT };
+ return { SERVICE_SDBC_PREPAREDSTATEMENT, SERVICE_SDB_PREPAREDSTATEMENT };
}
// OComponentHelper
@@ -134,7 +134,7 @@ void OPreparedStatement::disposing()
Reference< css::container::XNameAccess > OPreparedStatement::getColumns()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// do we have to populate the columns
if (!m_pColumns->isInitialized())
@@ -151,14 +151,14 @@ Reference< css::container::XNameAccess > OPreparedStatement::getColumns()
{
// retrieve the name of the column
OUString aName = xMetaData->getColumnName(i + 1);
- OResultColumn* pColumn = new OResultColumn(xMetaData, i + 1, xDBMeta);
+ rtl::Reference<OResultColumn> pColumn = new OResultColumn(xMetaData, i + 1, xDBMeta);
// don't silently assume that the name is unique - preparedStatement implementations
// are allowed to return duplicate names, but we are required to have
// unique column names
if ( m_pColumns->hasByName( aName ) )
aName = ::dbtools::createUniqueName( m_pColumns.get(), aName );
- m_pColumns->append(aName, pColumn);
+ m_pColumns->append(aName, pColumn.get());
}
}
catch (const SQLException& )
@@ -174,7 +174,7 @@ Reference< css::container::XNameAccess > OPreparedStatement::getColumns()
Reference< XResultSetMetaData > OPreparedStatement::getMetaData()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XResultSetMetaDataSupplier >( m_xAggregateAsSet, UNO_QUERY_THROW )->getMetaData();
}
@@ -182,7 +182,7 @@ Reference< XResultSetMetaData > OPreparedStatement::getMetaData()
Reference< XResultSet > OPreparedStatement::executeQuery()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@@ -201,7 +201,7 @@ Reference< XResultSet > OPreparedStatement::executeQuery()
sal_Int32 OPreparedStatement::executeUpdate()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@@ -211,7 +211,7 @@ sal_Int32 OPreparedStatement::executeUpdate()
sal_Bool OPreparedStatement::execute()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@@ -227,7 +227,7 @@ Reference< XConnection > OPreparedStatement::getConnection()
void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setNull(parameterIndex, sqlType);
}
@@ -235,7 +235,7 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s
void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& typeName )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setObjectNull(parameterIndex, sqlType, typeName);
}
@@ -243,7 +243,7 @@ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_I
void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBoolean(parameterIndex, x);
}
@@ -251,7 +251,7 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool
void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setByte(parameterIndex, x);
}
@@ -259,7 +259,7 @@ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x
void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setShort(parameterIndex, x);
}
@@ -267,7 +267,7 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16
void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setInt(parameterIndex, x);
}
@@ -275,7 +275,7 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x
void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setLong(parameterIndex, x);
}
@@ -283,7 +283,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x
void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setFloat(parameterIndex, x);
}
@@ -291,7 +291,7 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setDouble(parameterIndex, x);
}
@@ -299,7 +299,7 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x
void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const OUString& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setString(parameterIndex, x);
}
@@ -307,7 +307,7 @@ void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const OUS
void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBytes(parameterIndex, x);
}
@@ -315,7 +315,7 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ
void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const css::util::Date& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setDate(parameterIndex, x);
}
@@ -323,7 +323,7 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const css::
void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const css::util::Time& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setTime(parameterIndex, x);
}
@@ -331,7 +331,7 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const css::
void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setTimestamp(parameterIndex, x);
}
@@ -339,7 +339,7 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const
void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< css::io::XInputStream >& x, sal_Int32 length )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBinaryStream(parameterIndex, x, length);
}
@@ -347,7 +347,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, con
void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< css::io::XInputStream >& x, sal_Int32 length )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setCharacterStream(parameterIndex, x, length);
}
@@ -355,7 +355,7 @@ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex,
void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setObject(parameterIndex, x);
}
@@ -363,7 +363,7 @@ void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any
void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 scale )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setObjectWithInfo(parameterIndex, x, targetSqlType, scale);
}
@@ -371,7 +371,7 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setRef(parameterIndex, x);
}
@@ -379,7 +379,7 @@ void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Refere
void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setBlob(parameterIndex, x);
}
@@ -387,7 +387,7 @@ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Refer
void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setClob(parameterIndex, x);
}
@@ -395,7 +395,7 @@ void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Refer
void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->setArray(parameterIndex, x);
}
@@ -403,7 +403,7 @@ void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Refe
void SAL_CALL OPreparedStatement::clearParameters( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
m_xAggregateAsParameters->clearParameters();
}
diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx
index 051c11148075..c8e723853a7a 100644
--- a/dbaccess/source/core/api/query.cxx
+++ b/dbaccess/source/core/api/query.cxx
@@ -25,9 +25,9 @@
#include "HelperCollections.hxx"
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -40,6 +40,7 @@
#include <definitioncolumn.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <ContainerMediator.hxx>
using namespace dbaccess;
@@ -48,7 +49,6 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::comphelper;
@@ -105,7 +105,15 @@ css::uno::Sequence<sal_Int8> OQuery::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES3(OQuery,OQueryDescriptor_Base,ODataSettings,OContentHelper);
+css::uno::Sequence< css::uno::Type > OQuery::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OQueryDescriptor_Base::getTypes( ),
+ ODataSettings::getTypes( ),
+ OContentHelper::getTypes( )
+ );
+}
+
IMPLEMENT_FORWARD_XINTERFACE3( OQuery,OContentHelper,OQueryDescriptor_Base,ODataSettings)
void OQuery::rebuildColumns()
@@ -173,11 +181,10 @@ void OQuery::rebuildColumns()
Reference<XPropertySet> xCommandColumn(xColumnDefinitions->getByName( rName ),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::Reference<OQueryColumn> pColumn = new OQueryColumn( xSource, m_xConnection, sLabel);
+ pColumn->setParent( *this );
- implAppendColumn( rName, pColumn );
+ implAppendColumn( rName, pColumn.get() );
Reference< XPropertySet > xDest( *pColumn, UNO_QUERY_THROW );
if ( m_pColumnMediator.is() )
m_pColumnMediator->notifyElementCreated( rName, xDest );
@@ -205,7 +212,23 @@ void OQuery::rebuildColumns()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO3(OQuery, "com.sun.star.sdb.dbaccess.OQuery", SERVICE_SDB_DATASETTINGS, SERVICE_SDB_QUERY, "com.sun.star.sdb.QueryDefinition")
+OUString SAL_CALL OQuery::getImplementationName()
+ {
+ return "com.sun.star.sdb.dbaccess.OQuery";
+ }
+sal_Bool SAL_CALL OQuery::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OQuery::getSupportedServiceNames( )
+{
+ return { SERVICE_SDB_DATASETTINGS, SERVICE_SDB_QUERY, "com.sun.star.sdb.QueryDefinition" };
+}
// css::beans::XPropertyChangeListener
void SAL_CALL OQuery::propertyChange( const PropertyChangeEvent& _rSource )
@@ -309,7 +332,7 @@ Reference< XPropertySetInfo > SAL_CALL OQuery::getPropertySetInfo( )
return new ::cppu::OPropertyArrayHelper(aProps);
}
-OColumn* OQuery::createColumn(const OUString& /*_rName*/) const
+rtl::Reference<OColumn> OQuery::createColumn(const OUString& /*_rName*/) const
{
return nullptr;
}
diff --git a/dbaccess/source/core/api/query.hxx b/dbaccess/source/core/api/query.hxx
index 536b2d2208c7..fefcb94b47e7 100644
--- a/dbaccess/source/core/api/query.hxx
+++ b/dbaccess/source/core/api/query.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_QUERY_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_QUERY_HXX
+#pragma once
#include "querydescriptor.hxx"
#include <cppuhelper/implbase3.hxx>
@@ -132,7 +131,7 @@ public:
protected:
virtual void SAL_CALL disposing() override;
- virtual OColumn* createColumn(const OUString& _rName) const override;
+ virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
virtual void rebuildColumns( ) override;
@@ -145,6 +144,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_QUERY_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/querycomposer.cxx b/dbaccess/source/core/api/querycomposer.cxx
index 043b0c083a17..9c41f344ccf5 100644
--- a/dbaccess/source/core/api/querycomposer.cxx
+++ b/dbaccess/source/core/api/querycomposer.cxx
@@ -18,6 +18,7 @@
*/
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdbc/ColumnSearch.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <comphelper/sequence.hxx>
@@ -26,6 +27,7 @@
#include <comphelper/types.hxx>
#include <com/sun/star/sdb/SQLFilterOperator.hpp>
#include <querycomposer.hxx>
+#include <strings.hxx>
#include <composertools.hxx>
#include <algorithm>
@@ -41,7 +43,6 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::cppu;
using namespace ::osl;
-using namespace ::utl;
OQueryComposer::OQueryComposer(const Reference< XConnection>& _xConnection)
@@ -250,12 +251,12 @@ Reference< XIndexAccess > SAL_CALL OQueryComposer::getParameters( )
return Reference<XParametersSupplier>(m_xComposer,UNO_QUERY_THROW)->getParameters();
}
-void SAL_CALL OQueryComposer::acquire() throw()
+void SAL_CALL OQueryComposer::acquire() noexcept
{
OSubComponent::acquire();
}
-void SAL_CALL OQueryComposer::release() throw()
+void SAL_CALL OQueryComposer::release() noexcept
{
OSubComponent::release();
}
diff --git a/dbaccess/source/core/api/querycontainer.cxx b/dbaccess/source/core/api/querycontainer.cxx
index 27ecf51ef5c1..8e386dc411cd 100644
--- a/dbaccess/source/core/api/querycontainer.cxx
+++ b/dbaccess/source/core/api/querycontainer.cxx
@@ -19,6 +19,7 @@
#include <querycontainer.hxx>
#include "query.hxx"
+#include <strings.hxx>
#include <objectnameapproval.hxx>
#include <veto.hxx>
@@ -43,7 +44,6 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
using namespace ::osl;
@@ -131,7 +131,23 @@ void OQueryContainer::disposing()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO2(OQueryContainer, "com.sun.star.sdb.dbaccess.OQueryContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDB_QUERIES)
+OUString SAL_CALL OQueryContainer::getImplementationName()
+ {
+ return "com.sun.star.sdb.dbaccess.OQueryContainer";
+ }
+sal_Bool SAL_CALL OQueryContainer::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OQueryContainer::getSupportedServiceNames()
+{
+ return { SERVICE_SDBCX_CONTAINER, SERVICE_SDB_QUERIES };
+}
// XDataDescriptorFactory
Reference< XPropertySet > SAL_CALL OQueryContainer::createDataDescriptor( )
@@ -179,7 +195,7 @@ void SAL_CALL OQueryContainer::appendByDescriptor( const Reference< XPropertySet
{
m_eDoingCurrently = AggregateAction::Inserting;
OAutoActionReset aAutoReset(*this);
- m_xCommandDefinitions->insertByName(sNewObjectName, makeAny(xCommandDefinitionPart));
+ m_xCommandDefinitions->insertByName(sNewObjectName, Any(xCommandDefinitionPart));
}
implAppend( sNewObjectName, xNewObject );
@@ -244,7 +260,7 @@ void SAL_CALL OQueryContainer::elementInserted( const css::container::ContainerE
// insert an own new element
xNewElement = implCreateWrapper(sElementName);
}
- insertByName(sElementName,makeAny(xNewElement));
+ insertByName(sElementName,Any(xNewElement));
}
void SAL_CALL OQueryContainer::elementRemoved( const css::container::ContainerEvent& _rEvent )
@@ -276,7 +292,7 @@ void SAL_CALL OQueryContainer::elementReplaced( const css::container::ContainerE
xNewElement = implCreateWrapper(sAccessor);
}
- replaceByName(sAccessor,makeAny(xNewElement));
+ replaceByName(sAccessor,Any(xNewElement));
}
Reference< XVeto > SAL_CALL OQueryContainer::approveInsertElement( const ContainerEvent& Event )
@@ -352,7 +368,7 @@ Reference< XContent > OQueryContainer::implCreateWrapper(const Reference< XConte
}
else
{
- OQuery* pNewObject = new OQuery( Reference< XPropertySet >( _rxCommandDesc, UNO_QUERY ), m_xConnection, m_aContext );
+ rtl::Reference<OQuery> pNewObject = new OQuery( Reference< XPropertySet >( _rxCommandDesc, UNO_QUERY ), m_xConnection, m_aContext );
xReturn = pNewObject;
pNewObject->setWarningsContainer( m_pWarnings );
diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx
index c52febb5db6c..0aff2b0aaba1 100644
--- a/dbaccess/source/core/api/querydescriptor.cxx
+++ b/dbaccess/source/core/api/querydescriptor.cxx
@@ -18,19 +18,15 @@
*/
#include "querydescriptor.hxx"
-#include <apitools.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::osl;
using namespace ::cppu;
@@ -64,7 +60,14 @@ css::uno::Sequence<sal_Int8> OQueryDescriptor::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES2(OQueryDescriptor,OQueryDescriptor_Base,ODataSettings);
+css::uno::Sequence< css::uno::Type > OQueryDescriptor::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OQueryDescriptor_Base::getTypes( ),
+ ODataSettings::getTypes( )
+ );
+}
+
IMPLEMENT_FORWARD_XINTERFACE3( OQueryDescriptor,OWeakObject,OQueryDescriptor_Base,ODataSettings)
void OQueryDescriptor::registerProperties()
@@ -138,25 +141,6 @@ OQueryDescriptor_Base::~OQueryDescriptor_Base()
m_pColumns->disposing();
}
-sal_Int64 SAL_CALL OQueryDescriptor_Base::getSomething( const Sequence< sal_Int8 >& _rIdentifier )
-{
- if (isUnoTunnelId<OQueryDescriptor_Base>(_rIdentifier))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
-
-css::uno::Sequence<sal_Int8> OQueryDescriptor_Base::getUnoTunnelId()
-{
- static cppu::OImplementationId aId;
- return aId.getImplementationId();
-}
-
-css::uno::Sequence<sal_Int8> OQueryDescriptor_Base::getImplementationId()
-{
- return css::uno::Sequence<sal_Int8>();
-}
-
void OQueryDescriptor_Base::setColumnsOutOfDate( bool _bOutOfDate )
{
m_bColumnsOutOfDate = _bOutOfDate;
@@ -255,7 +239,7 @@ void OQueryDescriptor_Base::refreshColumns()
rebuildColumns();
}
-OColumn* OQueryDescriptor_Base::createColumn( const OUString& /*_rName*/ ) const
+rtl::Reference<OColumn> OQueryDescriptor_Base::createColumn( const OUString& /*_rName*/ ) const
{
// creating a column/descriptor for a query/descriptor does not make sense at all
return nullptr;
diff --git a/dbaccess/source/core/api/querydescriptor.hxx b/dbaccess/source/core/api/querydescriptor.hxx
index 077792906126..181b8e4d436d 100644
--- a/dbaccess/source/core/api/querydescriptor.hxx
+++ b/dbaccess/source/core/api/querydescriptor.hxx
@@ -17,16 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_QUERYDESCRIPTOR_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_QUERYDESCRIPTOR_HXX
+#pragma once
-#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <comphelper/proparrhlp.hxx>
#include <osl/mutex.hxx>
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <apitools.hxx>
#include <column.hxx>
@@ -39,9 +37,8 @@ namespace dbaccess
{
// OQueryDescriptor_Base - a query descriptor (as the name suggests :)
-typedef ::cppu::ImplHelper3<
+typedef ::cppu::ImplHelper2<
css::sdbcx::XColumnsSupplier,
- css::lang::XUnoTunnel,
css::lang::XServiceInfo > OQueryDescriptor_BASE;
class OQueryDescriptor_Base
@@ -76,12 +73,6 @@ public:
// css::sdbcx::XColumnsSupplier
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override;
-// css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
-
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
@@ -90,7 +81,7 @@ public:
protected:
// IColumnFactory
- virtual OColumn* createColumn(const OUString& _rName) const override;
+ virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
virtual void columnDropped(const OUString& _sName) override;
@@ -141,6 +132,4 @@ public:
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_QUERYDESCRIPTOR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/resultcolumn.cxx b/dbaccess/source/core/api/resultcolumn.cxx
index afb2e3f574b5..fbc8cb8a343f 100644
--- a/dbaccess/source/core/api/resultcolumn.cxx
+++ b/dbaccess/source/core/api/resultcolumn.cxx
@@ -18,19 +18,18 @@
*/
#include "resultcolumn.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <stringconstants.hxx>
-#include <apitools.hxx>
+#include <strings.hxx>
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -67,7 +66,7 @@ void OResultColumn::impl_determineIsRowVersion_nothrow()
try
{
Reference< XResultSet > xVersionColumns = m_xDBMetaData->getVersionColumns(
- makeAny( sCatalog ), sSchema, sTable );
+ Any( sCatalog ), sSchema, sTable );
if ( xVersionColumns.is() ) // allowed to be NULL
{
Reference< XRow > xResultRow( xVersionColumns, UNO_QUERY_THROW );
@@ -124,29 +123,32 @@ void OResultColumn::disposing()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* OResultColumn::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(21)
- DECL_PROP1(CATALOGNAME, OUString, READONLY);
- DECL_PROP1(DISPLAYSIZE, sal_Int32, READONLY);
- DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
- DECL_PROP1_BOOL(ISCASESENSITIVE, READONLY);
- DECL_PROP1_BOOL(ISCURRENCY, READONLY);
- DECL_PROP1_BOOL(ISDEFINITELYWRITABLE, READONLY);
- DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
- DECL_PROP1_BOOL(ISREADONLY, READONLY);
- DECL_PROP1_BOOL(ISROWVERSION, READONLY);
- DECL_PROP1_BOOL(ISSEARCHABLE, READONLY);
- DECL_PROP1_BOOL(ISSIGNED, READONLY);
- DECL_PROP1_BOOL(ISWRITABLE, READONLY);
- DECL_PROP1(LABEL, OUString, READONLY);
- DECL_PROP1(NAME, OUString, READONLY);
- DECL_PROP1(PRECISION, sal_Int32, READONLY);
- DECL_PROP1(SCALE, sal_Int32, READONLY);
- DECL_PROP1(SCHEMANAME, OUString, READONLY);
- DECL_PROP1(SERVICENAME, OUString, READONLY);
- DECL_PROP1(TABLENAME, OUString, READONLY);
- DECL_PROP1(TYPE, sal_Int32, READONLY);
- DECL_PROP1(TYPENAME, OUString, READONLY);
- END_PROPERTY_HELPER();
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ { PROPERTY_CATALOGNAME, PROPERTY_ID_CATALOGNAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_DISPLAYSIZE, PROPERTY_ID_DISPLAYSIZE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISAUTOINCREMENT, PROPERTY_ID_ISAUTOINCREMENT, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCASESENSITIVE, PROPERTY_ID_ISCASESENSITIVE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISCURRENCY, PROPERTY_ID_ISCURRENCY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISDEFINITELYWRITABLE, PROPERTY_ID_ISDEFINITELYWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISNULLABLE, PROPERTY_ID_ISNULLABLE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISREADONLY, PROPERTY_ID_ISREADONLY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISROWVERSION, PROPERTY_ID_ISROWVERSION, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSEARCHABLE, PROPERTY_ID_ISSEARCHABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISSIGNED, PROPERTY_ID_ISSIGNED, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_ISWRITABLE, PROPERTY_ID_ISWRITABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_LABEL, PROPERTY_ID_LABEL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_NAME, PROPERTY_ID_NAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_PRECISION, PROPERTY_ID_PRECISION, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCALE, PROPERTY_ID_SCALE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SCHEMANAME, PROPERTY_ID_SCHEMANAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SERVICENAME, PROPERTY_ID_SERVICENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TABLENAME, PROPERTY_ID_TABLENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPE, PROPERTY_ID_TYPE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_TYPENAME, PROPERTY_ID_TYPENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY }
+ }
+ };
}
// cppu::OPropertySetHelper
diff --git a/dbaccess/source/core/api/resultcolumn.hxx b/dbaccess/source/core/api/resultcolumn.hxx
index f5b150eaa1d6..53803bac8c8f 100644
--- a/dbaccess/source/core/api/resultcolumn.hxx
+++ b/dbaccess/source/core/api/resultcolumn.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTCOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTCOLUMN_HXX
+#pragma once
#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
@@ -84,6 +83,5 @@ namespace dbaccess
using ::cppu::OPropertySetHelper::getFastPropertyValue;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTCOLUMN_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/resultset.cxx b/dbaccess/source/core/api/resultset.cxx
index ee93aa42ac53..cc6a6fe018f4 100644
--- a/dbaccess/source/core/api/resultset.cxx
+++ b/dbaccess/source/core/api/resultset.cxx
@@ -20,14 +20,15 @@
#include "resultset.hxx"
#include <sal/log.hxx>
#include <stringconstants.hxx>
-#include <apitools.hxx>
+#include <strings.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/types.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include "datacolumn.hxx"
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
@@ -119,12 +120,12 @@ Any OResultSet::queryInterface( const Type & rType )
return aIface;
}
-void OResultSet::acquire() throw ()
+void OResultSet::acquire() noexcept
{
OResultSetBase::acquire();
}
-void OResultSet::release() throw ()
+void OResultSet::release() noexcept
{
OResultSetBase::release();
}
@@ -185,14 +186,17 @@ Reference< XPropertySetInfo > OResultSet::getPropertySetInfo()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(6)
- DECL_PROP1(CURSORNAME, OUString, READONLY);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP1_BOOL(ISBOOKMARKABLE, READONLY);
- DECL_PROP1(RESULTSETCONCURRENCY, sal_Int32, READONLY);
- DECL_PROP1(RESULTSETTYPE, sal_Int32, READONLY);
- END_PROPERTY_HELPER();
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ { PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_ISBOOKMARKABLE, PROPERTY_ID_ISBOOKMARKABLE, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::READONLY }
+ }
+ };
}
// cppu::OPropertySetHelper
@@ -330,7 +334,7 @@ Reference< css::container::XNameAccess > OResultSet::getColumns()
{
// retrieve the name of the column
OUString sName = xMetaData->getColumnName(i + 1);
- ODataColumn* pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData);
+ rtl::Reference<ODataColumn> pColumn = new ODataColumn(xMetaData, m_xDelegatorRow, m_xDelegatorRowUpdate, i + 1, xDBMetaData);
// don't silently assume that the name is unique - result set implementations
// are allowed to return duplicate names, but we are required to have
@@ -338,7 +342,7 @@ Reference< css::container::XNameAccess > OResultSet::getColumns()
if ( m_pColumns->hasByName( sName ) )
sName = ::dbtools::createUniqueName( m_pColumns.get(), sName );
- m_pColumns->append( sName, pColumn );
+ m_pColumns->append( sName, pColumn.get() );
}
}
catch ( const SQLException& )
diff --git a/dbaccess/source/core/api/resultset.hxx b/dbaccess/source/core/api/resultset.hxx
index 34f13a14d8bf..b2da0f2483e5 100644
--- a/dbaccess/source/core/api/resultset.hxx
+++ b/dbaccess/source/core/api/resultset.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTSET_HXX
+#pragma once
#include <column.hxx>
#include <connectivity/warningscontainer.hxx>
@@ -87,8 +86,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -218,6 +217,5 @@ namespace dbaccess
using ::cppu::OPropertySetHelper::getFastPropertyValue;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_API_RESULTSET_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/statement.cxx b/dbaccess/source/core/api/statement.cxx
index 812d91c64a47..1a20823ab9dd 100644
--- a/dbaccess/source/core/api/statement.cxx
+++ b/dbaccess/source/core/api/statement.cxx
@@ -20,6 +20,8 @@
#include <statement.hxx>
#include "resultset.hxx"
#include <stringconstants.hxx>
+#include <strings.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <cppuhelper/queryinterface.hxx>
@@ -27,7 +29,7 @@
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/property.hxx>
#include <comphelper/types.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <connectivity/dbexception.hxx>
using namespace ::com::sun::star::sdb;
@@ -44,7 +46,7 @@ using namespace dbtools;
OStatementBase::OStatementBase(const Reference< XConnection > & _xConn,
const Reference< XInterface > & _xStatement)
:OSubComponent(m_aMutex, _xConn)
- ,OPropertySetHelper(OComponentHelper::rBHelper)
+ ,OPropertySetHelper(WeakComponentImplHelper::rBHelper)
,m_bUseBookmarks( false )
,m_bEscapeProcessing( true )
@@ -106,12 +108,12 @@ Any OStatementBase::queryInterface( const Type & rType )
return aIface;
}
-void OStatementBase::acquire() throw ()
+void OStatementBase::acquire() noexcept
{
OSubComponent::acquire();
}
-void OStatementBase::release() throw ()
+void OStatementBase::release() noexcept
{
OSubComponent::release();
}
@@ -122,7 +124,7 @@ void OStatementBase::disposeResultSet()
Reference< XComponent > xComp(m_aResultSet.get(), UNO_QUERY);
if (xComp.is())
xComp->dispose();
- m_aResultSet = nullptr;
+ m_aResultSet.clear();
}
// OComponentHelper
@@ -162,7 +164,7 @@ void OStatementBase::close()
{
{
MutexGuard aGuard( m_aMutex );
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
}
dispose();
}
@@ -176,18 +178,21 @@ Reference< XPropertySetInfo > OStatementBase::getPropertySetInfo()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* OStatementBase::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(10)
- DECL_PROP0(CURSORNAME, OUString);
- DECL_PROP0_BOOL(ESCAPE_PROCESSING);
- DECL_PROP0(FETCHDIRECTION, sal_Int32);
- DECL_PROP0(FETCHSIZE, sal_Int32);
- DECL_PROP0(MAXFIELDSIZE, sal_Int32);
- DECL_PROP0(MAXROWS, sal_Int32);
- DECL_PROP0(QUERYTIMEOUT, sal_Int32);
- DECL_PROP0(RESULTSETCONCURRENCY, sal_Int32);
- DECL_PROP0(RESULTSETTYPE, sal_Int32);
- DECL_PROP0_BOOL(USEBOOKMARKS);
- END_PROPERTY_HELPER();
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ { PROPERTY_CURSORNAME, PROPERTY_ID_CURSORNAME, cppu::UnoType<OUString>::get(), 0 },
+ { PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, cppu::UnoType<bool>::get(), 0 },
+ { PROPERTY_FETCHDIRECTION, PROPERTY_ID_FETCHDIRECTION, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_FETCHSIZE, PROPERTY_ID_FETCHSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_MAXFIELDSIZE, PROPERTY_ID_MAXFIELDSIZE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_MAXROWS, PROPERTY_ID_MAXROWS, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_QUERYTIMEOUT, PROPERTY_ID_QUERYTIMEOUT, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_RESULTSETCONCURRENCY, PROPERTY_ID_RESULTSETCONCURRENCY, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_RESULTSETTYPE, PROPERTY_ID_RESULTSETTYPE, cppu::UnoType<sal_Int32>::get(), 0 },
+ { PROPERTY_USEBOOKMARKS, PROPERTY_ID_USEBOOKMARKS, cppu::UnoType<bool>::get(), 0 }
+ }
+ };
}
// cppu::OPropertySetHelper
@@ -288,7 +293,7 @@ void OStatementBase::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) cons
Any OStatementBase::getWarnings()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
return Reference< XWarningsSupplier >(m_xAggregateAsSet, UNO_QUERY_THROW)->getWarnings();
}
@@ -296,7 +301,7 @@ Any OStatementBase::getWarnings()
void OStatementBase::clearWarnings()
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XWarningsSupplier >(m_xAggregateAsSet, UNO_QUERY_THROW)->clearWarnings();
}
@@ -315,7 +320,7 @@ void OStatementBase::cancel()
Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -328,7 +333,7 @@ Reference< XResultSet > SAL_CALL OStatementBase::getResultSet( )
sal_Int32 SAL_CALL OStatementBase::getUpdateCount( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -341,7 +346,7 @@ sal_Int32 SAL_CALL OStatementBase::getUpdateCount( )
sal_Bool SAL_CALL OStatementBase::getMoreResults( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -358,7 +363,7 @@ sal_Bool SAL_CALL OStatementBase::getMoreResults( )
void SAL_CALL OStatementBase::addBatch( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -371,7 +376,7 @@ void SAL_CALL OStatementBase::addBatch( )
void SAL_CALL OStatementBase::clearBatch( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -384,7 +389,7 @@ void SAL_CALL OStatementBase::clearBatch( )
Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -400,7 +405,7 @@ Sequence< sal_Int32 > SAL_CALL OStatementBase::executeBatch( )
Reference< XResultSet > SAL_CALL OStatementBase::getGeneratedValues( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY);
if ( xGRes.is() )
@@ -441,7 +446,7 @@ Sequence< OUString > OStatement::getSupportedServiceNames( )
Reference< XResultSet > OStatement::executeQuery( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
Reference< XResultSet > xResultSet;
@@ -467,7 +472,7 @@ Reference< XResultSet > OStatement::executeQuery( const OUString& _rSQL )
sal_Int32 OStatement::executeUpdate( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@@ -478,7 +483,7 @@ sal_Int32 OStatement::executeUpdate( const OUString& _rSQL )
sal_Bool OStatement::execute( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
disposeResultSet();
@@ -489,7 +494,7 @@ sal_Bool OStatement::execute( const OUString& _rSQL )
void OStatement::addBatch( const OUString& _rSQL )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
@@ -503,7 +508,7 @@ void OStatement::addBatch( const OUString& _rSQL )
void OStatement::clearBatch( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
if (!xMeta.is() || !xMeta->supportsBatchUpdates())
@@ -515,7 +520,7 @@ void OStatement::clearBatch( )
Sequence< sal_Int32 > OStatement::executeBatch( )
{
MutexGuard aGuard(m_aMutex);
- ::connectivity::checkDisposed(OComponentHelper::rBHelper.bDisposed);
+ ::connectivity::checkDisposed(WeakComponentImplHelper::rBHelper.bDisposed);
// first check the meta data
Reference<XDatabaseMetaData> xMeta = Reference< XConnection > (m_xParent, UNO_QUERY_THROW)->getMetaData();
if (!xMeta.is() || !xMeta->supportsBatchUpdates())
diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx
index d9b8f4484f5e..bb2a6f832dea 100644
--- a/dbaccess/source/core/api/table.cxx
+++ b/dbaccess/source/core/api/table.cxx
@@ -17,20 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <apitools.hxx>
#include <table.hxx>
#include <definitioncolumn.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
#include "CIndexes.hxx"
#include <osl/diagnose.h>
-#include <cppuhelper/typeprovider.hxx>
#include <comphelper/servicehelper.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
-#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdb/tools/XTableRename.hpp>
#include <com/sun/star/sdb/tools/XTableAlteration.hpp>
@@ -42,7 +40,6 @@
using namespace dbaccess;
using namespace connectivity;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
@@ -85,10 +82,8 @@ ODBTable::~ODBTable()
{
}
-OColumn* ODBTable::createColumn(const OUString& _rName) const
+rtl::Reference<OColumn> ODBTable::createColumn(const OUString& _rName) const
{
- OColumn* pReturn = nullptr;
-
Reference<XPropertySet> xProp;
if ( m_xDriverColumns.is() && m_xDriverColumns->hasByName(_rName) )
{
@@ -100,12 +95,10 @@ OColumn* ODBTable::createColumn(const OUString& _rName) const
xProp.set(pColumns->createBaseObject(_rName),UNO_QUERY);
}
- Reference<XPropertySet> xColumnDefintion;
+ Reference<XPropertySet> xColumnDefinition;
if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName) )
- xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
- pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
-
- return pReturn;
+ xColumnDefinition.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
+ return new OTableColumnWrapper( xProp, xColumnDefinition, false );
}
void ODBTable::columnAppended( const Reference< XPropertySet >& /*_rxSourceDescriptor*/ )
@@ -216,7 +209,7 @@ void ODBTable::construct()
describeProperties(aProps);
if(!_nId)
{
- for(Property & prop : aProps)
+ for(Property & prop : asNonConstRange(aProps))
{
if (prop.Name == PROPERTY_CATALOGNAME)
prop.Attributes = PropertyAttribute::READONLY;
@@ -238,7 +231,24 @@ void ODBTable::construct()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO1(ODBTable, "com.sun.star.sdb.dbaccess.ODBTable", SERVICE_SDBCX_TABLE)
+OUString SAL_CALL ODBTable::getImplementationName()
+ {
+ return "com.sun.star.sdb.dbaccess.ODBTable";
+ }
+sal_Bool SAL_CALL ODBTable::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL ODBTable::getSupportedServiceNames()
+{
+ return { SERVICE_SDBCX_TABLE };
+}
+
Any SAL_CALL ODBTable::queryInterface( const Type & rType )
{
@@ -298,24 +308,6 @@ void SAL_CALL ODBTable::alterColumnByName( const OUString& _rName, const Referen
m_xColumns->refresh();
}
-sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId )
-{
- sal_Int64 nRet(0);
- if (isUnoTunnelId<ODBTable>(rId))
- nRet = reinterpret_cast<sal_Int64>(this);
- else
- nRet = OTable_Base::getSomething(rId);
-
- return nRet;
-}
-
-Sequence< sal_Int8 > ODBTable::getUnoTunnelId()
-{
- static ::cppu::OImplementationId s_Id;
-
- return s_Id.getImplementationId();
-}
-
Reference< XPropertySet > ODBTable::createColumnDescriptor()
{
return new OTableColumnDescriptor( true );
diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx
index bc32774fd891..1a7e2a261609 100644
--- a/dbaccess/source/core/api/tablecontainer.cxx
+++ b/dbaccess/source/core/api/tablecontainer.cxx
@@ -17,14 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <apitools.hxx>
#include <tablecontainer.hxx>
#include <table.hxx>
-#include <sal/log.hxx>
#include <comphelper/property.hxx>
#include <comphelper/processfactory.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
@@ -41,7 +40,7 @@
#include <sdbcoretools.hxx>
#include <ContainerMediator.hxx>
#include <objectnameapproval.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
using namespace dbaccess;
using namespace dbtools;
@@ -52,7 +51,6 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -63,26 +61,24 @@ namespace
bool lcl_isPropertySetDefaulted(const Sequence< OUString>& _aNames,const Reference<XPropertySet>& _xProp)
{
Reference<XPropertyState> xState(_xProp,UNO_QUERY);
- if ( xState.is() )
+ if ( !xState )
+ return false;
+ const OUString* pIter = _aNames.getConstArray();
+ const OUString* pEnd = pIter + _aNames.getLength();
+ for(;pIter != pEnd;++pIter)
{
- const OUString* pIter = _aNames.getConstArray();
- const OUString* pEnd = pIter + _aNames.getLength();
- for(;pIter != pEnd;++pIter)
+ try
{
- try
- {
- PropertyState aState = xState->getPropertyState(*pIter);
- if ( aState != PropertyState_DEFAULT_VALUE )
- break;
- }
- catch(const Exception&)
- {
- SAL_WARN("dbaccess", "lcl_isPropertySetDefaulted: Exception caught!" );
- }
+ PropertyState aState = xState->getPropertyState(*pIter);
+ if ( aState != PropertyState_DEFAULT_VALUE )
+ break;
+ }
+ catch(const Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("dbaccess", "" );
}
- return ( pIter == pEnd );
}
- return false;
+ return ( pIter == pEnd );
}
}
@@ -124,11 +120,28 @@ OUString OTableContainer::getTableTypeRestriction() const
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO2(OTableContainer, "com.sun.star.sdb.dbaccess.OTableContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES)
+OUString SAL_CALL OTableContainer::getImplementationName()
+ {
+ return "com.sun.star.sdb.dbaccess.OTableContainer";
+ }
+sal_Bool SAL_CALL OTableContainer::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OTableContainer::getSupportedServiceNames()
+{
+ return { SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES };
+}
+
namespace
{
-void lcl_createDefintionObject(const OUString& _rName
+void lcl_createDefinitionObject(const OUString& _rName
,const Reference< XNameContainer >& _xTableDefinitions
,Reference<XPropertySet>& _xTableDefinition
,Reference<XNameAccess>& _xColumnDefinitions)
@@ -142,7 +155,7 @@ void lcl_createDefintionObject(const OUString& _rName
{
// set as folder
_xTableDefinition = TableDefinition::createWithName( ::comphelper::getProcessComponentContext(), _rName );
- _xTableDefinitions->insertByName(_rName,makeAny(_xTableDefinition));
+ _xTableDefinitions->insertByName(_rName,Any(_xTableDefinition));
}
Reference<XColumnsSupplier> xColumnsSupplier(_xTableDefinition,UNO_QUERY);
if ( xColumnsSupplier.is() )
@@ -162,11 +175,11 @@ connectivity::sdbcx::ObjectType OTableContainer::createObject(const OUString& _r
{
Reference<XPropertySet> xTableDefinition;
Reference<XNameAccess> xColumnDefinitions;
- lcl_createDefintionObject(_rName,m_xTableDefinitions,xTableDefinition,xColumnDefinitions);
+ lcl_createDefinitionObject(_rName,m_xTableDefinitions,xTableDefinition,xColumnDefinitions);
if ( xSup.is() )
{
- ODBTableDecorator* pTable = new ODBTableDecorator( m_xConnection, xSup, ::dbtools::getNumberFormats( m_xConnection ) ,xColumnDefinitions);
+ rtl::Reference<ODBTableDecorator> pTable = new ODBTableDecorator( m_xConnection, xSup, ::dbtools::getNumberFormats( m_xConnection ) ,xColumnDefinitions);
xRet = pTable;
pTable->construct();
}
@@ -199,7 +212,7 @@ connectivity::sdbcx::ObjectType OTableContainer::createObject(const OUString& _r
}
}
::comphelper::disposeComponent(xRes);
- ODBTable* pTable = new ODBTable(this
+ rtl::Reference<ODBTable> pTable = new ODBTable(this
,m_xConnection
,sCatalog
,sSchema
@@ -216,7 +229,7 @@ connectivity::sdbcx::ObjectType OTableContainer::createObject(const OUString& _r
if ( !m_pTableMediator.is() )
m_pTableMediator = new OContainerMediator(
- this, m_xTableDefinitions.get() );
+ this, m_xTableDefinitions );
if ( m_pTableMediator.is() )
m_pTableMediator->notifyElementCreated(_rName,xDest);
}
@@ -235,13 +248,13 @@ Reference< XPropertySet > OTableContainer::createDescriptor()
if ( xDataFactory.is() && m_xMetaData.is() )
{
xMasterColumnsSup.set( xDataFactory->createDataDescriptor(), UNO_QUERY );
- ODBTableDecorator* pTable = new ODBTableDecorator( m_xConnection, xMasterColumnsSup, ::dbtools::getNumberFormats( m_xConnection ) ,nullptr);
+ rtl::Reference<ODBTableDecorator> pTable = new ODBTableDecorator( m_xConnection, xMasterColumnsSup, ::dbtools::getNumberFormats( m_xConnection ) ,nullptr);
xRet = pTable;
pTable->construct();
}
else
{
- ODBTable* pTable = new ODBTable(this, m_xConnection);
+ rtl::Reference<ODBTable> pTable = new ODBTable(this, m_xConnection);
xRet = pTable;
pTable->construct();
}
@@ -288,7 +301,7 @@ ObjectType OTableContainer::appendObject( const OUString& _rForName, const Refer
Reference<XPropertySet> xTableDefinition;
Reference<XNameAccess> xColumnDefinitions;
- lcl_createDefintionObject(getNameForObject(descriptor),m_xTableDefinitions,xTableDefinition,xColumnDefinitions);
+ lcl_createDefinitionObject(getNameForObject(descriptor),m_xTableDefinitions,xTableDefinition,xColumnDefinitions);
Reference<XColumnsSupplier> xSup(descriptor,UNO_QUERY);
Reference<XDataDescriptorFactory> xFac(xColumnDefinitions,UNO_QUERY);
Reference<XAppend> xAppend(xColumnDefinitions,UNO_QUERY);
@@ -335,12 +348,13 @@ void OTableContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
xDrop->dropByName(_sElementName);
else
{
- OUString sCatalog,sSchema,sTable,sComposedName;
+ OUString sComposedName;
bool bIsView = false;
Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
if ( xTable.is() && m_xMetaData.is() )
{
+ OUString sSchema,sCatalog,sTable;
if (m_xMetaData->supportsCatalogsInTableDefinitions())
xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
if (m_xMetaData->supportsSchemasInTableDefinitions())
@@ -393,7 +407,7 @@ void SAL_CALL OTableContainer::elementInserted( const ContainerEvent& Event )
ObjectType xName = createObject(sName);
insertElement(sName,xName);
// and notify our listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(sName), makeAny(xName), Any());
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(sName), Any(xName), Any());
m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
}
}
diff --git a/dbaccess/source/core/api/viewcontainer.cxx b/dbaccess/source/core/api/viewcontainer.cxx
index 690df713923d..7e170b86d43a 100644
--- a/dbaccess/source/core/api/viewcontainer.cxx
+++ b/dbaccess/source/core/api/viewcontainer.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <apitools.hxx>
+#include <strings.hxx>
#include <viewcontainer.hxx>
#include <View.hxx>
@@ -34,9 +34,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::container;
using namespace ::osl;
using namespace ::comphelper;
@@ -61,7 +59,24 @@ OViewContainer::~OViewContainer()
}
// XServiceInfo
-IMPLEMENT_SERVICE_INFO2(OViewContainer, "com.sun.star.sdb.dbaccess.OViewContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES)
+OUString SAL_CALL OViewContainer::getImplementationName()
+ {
+ return "com.sun.star.sdb.dbaccess.OViewContainer";
+ }
+sal_Bool SAL_CALL OViewContainer::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OViewContainer::getSupportedServiceNames()
+{
+ return { SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES };
+}
+
ObjectType OViewContainer::createObject(const OUString& _rName)
{
@@ -154,11 +169,12 @@ void OViewContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
xDrop->dropByName(_sElementName);
else
{
- OUString sCatalog,sSchema,sTable,sComposedName;
+ OUString sComposedName;
Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
if ( xTable.is() )
{
+ OUString sCatalog,sSchema,sTable;
xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
xTable->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
xTable->getPropertyValue(PROPERTY_NAME) >>= sTable;
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
index a6110bdb2dab..19076507e0b3 100644
--- a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
+++ b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
@@ -18,18 +18,17 @@
*/
#include "ComponentDefinition.hxx"
-#include <apitools.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <osl/diagnose.h>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <cppuhelper/interfacecontainer.hxx>
+//#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/property.hxx>
#include <comphelper/propertysequence.hxx>
#include <definitioncolumn.hxx>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
@@ -142,7 +141,14 @@ css::uno::Sequence<sal_Int8> OComponentDefinition::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES3(OComponentDefinition,ODataSettings,OContentHelper,OComponentDefinition_BASE);
+css::uno::Sequence< css::uno::Type > OComponentDefinition::getTypes()
+{
+ return ::comphelper::concatSequences(
+ ODataSettings::getTypes( ),
+ OContentHelper::getTypes( ),
+ OComponentDefinition_BASE::getTypes( )
+ );
+}
IMPLEMENT_FORWARD_XINTERFACE3( OComponentDefinition,OContentHelper,ODataSettings,OComponentDefinition_BASE)
OUString SAL_CALL OComponentDefinition::getImplementationName()
@@ -213,13 +219,13 @@ Reference< XNameAccess> OComponentDefinition::getColumns()
return m_pColumns.get();
}
-OColumn* OComponentDefinition::createColumn(const OUString& _rName) const
+rtl::Reference<OColumn> OComponentDefinition::createColumn(const OUString& _rName) const
{
const OComponentDefinition_Impl& rDefinition( getDefinition() );
OComponentDefinition_Impl::const_iterator aFind = rDefinition.find( _rName );
if ( aFind != rDefinition.end() )
{
- aFind->second->addPropertyChangeListener(OUString(),m_xColumnPropertyListener.get());
+ aFind->second->addPropertyChangeListener(OUString(),m_xColumnPropertyListener);
return new OTableColumnWrapper( aFind->second, aFind->second, true );
}
OSL_FAIL( "OComponentDefinition::createColumn: is this a valid case?" );
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
index 8753d51c47e5..4c10a5354b30 100644
--- a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
+++ b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMPONENTDEFINITION_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMPONENTDEFINITION_HXX
+#pragma once
#include <commandbase.hxx>
#include <com/sun/star/sdbcx/XRename.hpp>
@@ -134,7 +133,7 @@ public:
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
// IColumnFactory
- virtual OColumn* createColumn(const OUString& _rName) const override;
+ virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
virtual void columnDropped(const OUString& _sName) override;
@@ -157,6 +156,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMPONENTDEFINITION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index 7ad1d22ba2f4..7dd40092fe52 100644
--- a/dbaccess/source/core/dataaccess/ContentHelper.cxx
+++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx
@@ -31,14 +31,14 @@
#include <com/sun/star/container/ElementExistException.hpp>
#include <ucbhelper/propertyvalueset.hxx>
#include <ucbhelper/contentidentifier.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/servicehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <apitools.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <sdbcoretools.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <map>
+#include <utility>
namespace dbaccess
{
@@ -48,8 +48,6 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::container;
using namespace ::cppu;
@@ -64,13 +62,13 @@ OContentHelper_Impl::~OContentHelper_Impl()
OContentHelper::OContentHelper(const Reference< XComponentContext >& _xORB
,const Reference< XInterface >& _xParentContainer
- ,const TContentPtr& _pImpl)
+ ,TContentPtr _pImpl)
: OContentHelper_COMPBASE(m_aMutex)
,m_aContentListeners(m_aMutex)
,m_aPropertyChangeListeners(m_aMutex)
,m_xParentContainer( _xParentContainer )
,m_aContext( _xORB )
- ,m_pImpl(_pImpl)
+ ,m_pImpl(std::move(_pImpl))
,m_nCommandId(0)
{
}
@@ -86,14 +84,25 @@ void SAL_CALL OContentHelper::disposing()
m_xParentContainer = nullptr;
}
-IMPLEMENT_SERVICE_INFO1(OContentHelper,"com.sun.star.comp.sdb.Content","com.sun.star.ucb.Content");
+OUString SAL_CALL OContentHelper::getImplementationName()
+ {
+ return "com.sun.star.comp.sdb.Content";
+ }
+sal_Bool SAL_CALL OContentHelper::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
-css::uno::Sequence<sal_Int8> OContentHelper::getUnoTunnelId()
+ return false;
+ }
+css::uno::Sequence< OUString > SAL_CALL OContentHelper::getSupportedServiceNames()
{
- static cppu::OImplementationId aId;
- return aId.getImplementationId();
+ return { "com.sun.star.ucb.Content" };
}
+
css::uno::Sequence<sal_Int8> OContentHelper::getImplementationId()
{
return css::uno::Sequence<sal_Int8>();
@@ -122,7 +131,7 @@ OUString OContentHelper::impl_getHierarchicalName( bool _includingRootContainer
xProp->getPropertyValue( PROPERTY_NAME ) >>= sName;
OUString sPrevious = aHierarchicalName.makeStringAndClear();
- aHierarchicalName.append( sName ).append( "/" ).append( sPrevious );
+ aHierarchicalName.append( sName + "/" + sPrevious );
}
}
OUString sHierarchicalName( aHierarchicalName.makeStringAndClear() );
@@ -177,7 +186,7 @@ Any SAL_CALL OContentHelper::execute( const Command& aCommand, sal_Int32 /*Comma
{
OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -195,7 +204,7 @@ Any SAL_CALL OContentHelper::execute( const Command& aCommand, sal_Int32 /*Comma
{
OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -207,7 +216,7 @@ Any SAL_CALL OContentHelper::execute( const Command& aCommand, sal_Int32 /*Comma
{
OSL_FAIL( "No properties!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -233,7 +242,7 @@ Any SAL_CALL OContentHelper::execute( const Command& aCommand, sal_Int32 /*Comma
OSL_FAIL( "Content::execute - unsupported command!" );
ucbhelper::cancelCommandExecution(
- makeAny( UnsupportedCommandException(
+ Any( UnsupportedCommandException(
OUString(),
static_cast< cppu::OWeakObject * >( this ) ) ),
Environment );
@@ -332,6 +341,7 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue
osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
Sequence< Any > aRet( rValues.getLength() );
+ auto aRetRange = asNonConstRange(aRet);
Sequence< PropertyChangeEvent > aChanges( rValues.getLength() );
sal_Int32 nChanged = 0;
@@ -350,7 +360,7 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue
if ( rValue.Name == "ContentType" || rValue.Name == "IsDocument" || rValue.Name == "IsFolder" )
{
// Read-only property!
- aRet[ n ] <<= IllegalAccessException("Property is read-only!",
+ aRetRange[ n ] <<= IllegalAccessException("Property is read-only!",
static_cast< cppu::OWeakObject * >( this ) );
}
else if ( rValue.Name == "Title" )
@@ -374,7 +384,7 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue
}
catch( const Exception& )
{
- OSL_FAIL( "OContentHelper::setPropertyValues('Title'): caught an exception while renaming!" );
+ TOOLS_WARN_EXCEPTION( "dbaccess", "OContentHelper::setPropertyValues('Title'): caught an exception while renaming!" );
}
}
else
@@ -384,14 +394,14 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue
}
else
{
- aRet[ n ] <<= IllegalTypeException("Property value has wrong type!",
+ aRetRange[ n ] <<= IllegalTypeException("Property value has wrong type!",
static_cast< cppu::OWeakObject * >( this ) );
}
}
else
{
- aRet[ n ] <<= Exception("No property set for storing the value!",
+ aRetRange[ n ] <<= Exception("No property set for storing the value!",
static_cast< cppu::OWeakObject * >( this ) );
}
}
@@ -474,7 +484,7 @@ Reference< XRow > OContentHelper::getPropertyValues( const Sequence< Property >&
// @@@ Append other properties supported directly.
}
- return Reference< XRow >( xRow.get() );
+ return xRow;
}
void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent >& evt ) const
@@ -485,18 +495,9 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
return;
// First, notify listeners interested in changes of every property.
- OInterfaceContainerHelper* pAllPropsContainer = m_aPropertyChangeListeners.getContainer( OUString() );
+ comphelper::OInterfaceContainerHelper3<XPropertiesChangeListener>* pAllPropsContainer = m_aPropertyChangeListeners.getContainer( OUString() );
if ( pAllPropsContainer )
- {
- OInterfaceIteratorHelper aIter( *pAllPropsContainer );
- while ( aIter.hasMoreElements() )
- {
- // Propagate event.
- Reference< XPropertiesChangeListener > xListener( aIter.next(), UNO_QUERY );
- if ( xListener.is() )
- xListener->propertiesChange( evt );
- }
- }
+ pAllPropsContainer->notifyEach( &XPropertiesChangeListener::propertiesChange, evt );
typedef std::map< XPropertiesChangeListener*, Sequence< PropertyChangeEvent > > PropertiesEventListenerMap;
PropertiesEventListenerMap aListeners;
@@ -508,15 +509,15 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
const PropertyChangeEvent& rEvent = *propertyChangeEvent;
const OUString& rName = rEvent.PropertyName;
- OInterfaceContainerHelper* pPropsContainer = m_aPropertyChangeListeners.getContainer( rName );
+ comphelper::OInterfaceContainerHelper3<XPropertiesChangeListener>* pPropsContainer = m_aPropertyChangeListeners.getContainer( rName );
if ( pPropsContainer )
{
- OInterfaceIteratorHelper aIter( *pPropsContainer );
+ comphelper::OInterfaceIteratorHelper3 aIter( *pPropsContainer );
while ( aIter.hasMoreElements() )
{
Sequence< PropertyChangeEvent >* propertyEvents;
- XPropertiesChangeListener* pListener = static_cast< XPropertiesChangeListener * >( aIter.next() );
+ XPropertiesChangeListener* pListener = aIter.next().get();
PropertiesEventListenerMap::iterator it = aListeners.find( pListener );
if ( it == aListeners.end() )
{
@@ -527,7 +528,7 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
else
propertyEvents = &(*it).second;
- (*propertyEvents)[n] = rEvent;
+ propertyEvents->getArray()[n] = rEvent;
}
}
}
@@ -543,15 +544,6 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
}
}
-// css::lang::XUnoTunnel
-sal_Int64 OContentHelper::getSomething( const Sequence< sal_Int8 > & rId )
-{
- if (isUnoTunnelId<OContentHelper>(rId))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
-
Reference< XInterface > SAL_CALL OContentHelper::getParent( )
{
::osl::MutexGuard aGuard(m_aMutex);
@@ -571,14 +563,14 @@ void OContentHelper::impl_rename_throw(const OUString& _sNewName,bool _bNotify )
return;
try
{
- Sequence< PropertyChangeEvent > aChanges( 1 );
-
- aChanges[0].Source = static_cast< cppu::OWeakObject * >( this );
- aChanges[0].Further = false;
- aChanges[0].PropertyName = PROPERTY_NAME;
- aChanges[0].PropertyHandle = PROPERTY_ID_NAME;
- aChanges[0].OldValue <<= m_pImpl->m_aProps.aTitle;
- aChanges[0].NewValue <<= _sNewName;
+ Sequence<PropertyChangeEvent> aChanges{
+ { /* Source */ static_cast<cppu::OWeakObject*>(this),
+ /* PropertyName */ PROPERTY_NAME,
+ /* Further */ false,
+ /* PropertyHandle */ PROPERTY_ID_NAME,
+ /* OldValue */ Any(m_pImpl->m_aProps.aTitle),
+ /* NewValue */ Any(_sNewName) }
+ };
aGuard.clear();
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index e54712ff9ae5..818e70b5433b 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -43,13 +43,12 @@
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
-#include <comphelper/documentinfo.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/types.hxx>
#include <comphelper/processfactory.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/signaturestate.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/file.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
@@ -59,11 +58,11 @@
#include <i18nlangtag/languagetag.hxx>
#include <algorithm>
+#include <utility>
using namespace css;
using namespace ::com::sun::star::document;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;
@@ -72,9 +71,7 @@ using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::view;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::script;
using namespace ::cppu;
@@ -354,14 +351,11 @@ void SAL_CALL DocumentStorageAccess::disposing( const css::lang::EventObject& So
// ODatabaseModelImpl
ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _rxContext, ODatabaseContext& _rDBContext )
- :m_xModel()
- ,m_xDataSource()
- ,m_aContainer(4)
+ :m_aContainer()
,m_aMacroMode( *this )
,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE )
,m_rDBContext( _rDBContext )
,m_refCount(0)
- ,m_aEmbeddedMacros()
,m_bModificationLock( false )
,m_bDocumentInitialized( false )
,m_nScriptingSignatureState(SignatureState::UNKNOWN)
@@ -373,34 +367,29 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _r
,m_bModified(false)
,m_bDocumentReadOnly(false)
,m_bMacroCallsSeenWhileLoading(false)
- ,m_pSharedConnectionManager(nullptr)
,m_nControllerLockCount(0)
{
// some kind of default
m_sConnectURL = "jdbc:";
- m_aTableFilter.realloc(1);
- m_aTableFilter[0] = "%";
+ m_aTableFilter = { "%" };
impl_construct_nothrow();
}
ODatabaseModelImpl::ODatabaseModelImpl(
- const OUString& _rRegistrationName,
+ OUString _sRegistrationName,
const Reference< XComponentContext >& _rxContext,
ODatabaseContext& _rDBContext
)
- :m_xModel()
- ,m_xDataSource()
- ,m_aContainer(4)
+ :m_aContainer()
,m_aMacroMode( *this )
,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE )
,m_rDBContext( _rDBContext )
,m_refCount(0)
- ,m_aEmbeddedMacros()
,m_bModificationLock( false )
,m_bDocumentInitialized( false )
,m_nScriptingSignatureState(SignatureState::UNKNOWN)
,m_aContext( _rxContext )
- ,m_sName(_rRegistrationName)
+ ,m_sName(std::move(_sRegistrationName))
,m_nLoginTimeout(0)
,m_bReadOnly(false)
,m_bPasswordRequired(false)
@@ -408,7 +397,6 @@ ODatabaseModelImpl::ODatabaseModelImpl(
,m_bModified(false)
,m_bDocumentReadOnly(false)
,m_bMacroCallsSeenWhileLoading(false)
- ,m_pSharedConnectionManager(nullptr)
,m_nControllerLockCount(0)
{
impl_construct_nothrow();
@@ -449,7 +437,7 @@ void ODatabaseModelImpl::impl_construct_nothrow()
pSettings->ValueType,
PropertyAttribute::BOUND | PropertyAttribute::MAYBEDEFAULT | PropertyAttribute::MAYBEVOID
);
- xSettingsSet->insert( makeAny( aProperty ) );
+ xSettingsSet->insert( Any( aProperty ) );
}
else
{
@@ -475,10 +463,10 @@ namespace
const char* pAsciiName( nullptr );
switch ( _eType )
{
- case ODatabaseModelImpl::E_FORM: pAsciiName = "forms"; break;
- case ODatabaseModelImpl::E_REPORT: pAsciiName = "reports"; break;
- case ODatabaseModelImpl::E_QUERY: pAsciiName = "queries"; break;
- case ODatabaseModelImpl::E_TABLE: pAsciiName = "tables"; break;
+ case ODatabaseModelImpl::ObjectType::Form: pAsciiName = "forms"; break;
+ case ODatabaseModelImpl::ObjectType::Report: pAsciiName = "reports"; break;
+ case ODatabaseModelImpl::ObjectType::Query: pAsciiName = "queries"; break;
+ case ODatabaseModelImpl::ObjectType::Table: pAsciiName = "tables"; break;
default:
throw RuntimeException();
}
@@ -568,8 +556,8 @@ bool ODatabaseModelImpl::objectHasMacros( const Reference< XStorage >& _rxContai
void ODatabaseModelImpl::reset()
{
m_bReadOnly = false;
- std::vector< TContentPtr > aEmptyContainers( 4 );
- m_aContainer.swap( aEmptyContainers );
+ for (auto & i : m_aContainer)
+ i.reset();
if ( m_pStorageAccess.is() )
{
@@ -631,7 +619,6 @@ void ODatabaseModelImpl::clearConnections()
}
}
- m_pSharedConnectionManager = nullptr;
m_xSharedConnectionManager = nullptr;
}
@@ -658,7 +645,8 @@ void ODatabaseModelImpl::dispose()
if ( elem )
elem->m_pDataSource = nullptr;
}
- m_aContainer.clear();
+ for (auto & i : m_aContainer)
+ i.reset();
clearConnections();
@@ -774,9 +762,7 @@ Reference< XStorage > const & ODatabaseModelImpl::getOrCreateRootStorage()
if ( aSource.hasValue() )
{
- Sequence< Any > aStorageCreationArgs(2);
- aStorageCreationArgs[0] = aSource;
- aStorageCreationArgs[1] <<= ElementModes::READWRITE;
+ Sequence< Any > aStorageCreationArgs{ aSource, Any(ElementModes::READWRITE) };
Reference< XStorage > xDocumentStorage;
OUString sURL;
@@ -791,7 +777,7 @@ Reference< XStorage > const & ODatabaseModelImpl::getOrCreateRootStorage()
catch( const Exception& )
{
m_bDocumentReadOnly = true;
- aStorageCreationArgs[1] <<= ElementModes::READ;
+ aStorageCreationArgs.getArray()[1] <<= ElementModes::READ;
try
{
xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), UNO_QUERY_THROW );
@@ -844,7 +830,7 @@ bool ODatabaseModelImpl::commitEmbeddedStorage( bool _bPreventRootCommits )
bool ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference< XStorage >& _rxStorage )
{
bool bTryToPreserveScriptSignature = false;
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
OUString sTmpFileUrl = aTempFile.GetURL();
SignatureState aSignatureState = getScriptingSignatureState();
@@ -898,7 +884,7 @@ bool ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference<
uno::Reference<embed::XStorage> xTargetMetaInf
= _rxStorage->openStorageElement("META-INF", embed::ElementModes::READWRITE);
- if (xMetaInf.is() && xTargetMetaInf.is())
+ if (xMetaInf.is() && xTargetMetaInf.is() && xMetaInf->hasByName(aScriptSignName))
{
xMetaInf->copyElementTo(aScriptSignName, xTargetMetaInf, aScriptSignName);
@@ -987,7 +973,7 @@ Reference< XModel > ODatabaseModelImpl::createNewModel_deliverOwnership()
try
{
Reference< XGlobalEventBroadcaster > xModelCollection = theGlobalEventBroadcaster::get( m_aContext );
- xModelCollection->insert( makeAny( xModel ) );
+ xModelCollection->insert( Any( xModel ) );
}
catch( const Exception& )
{
@@ -1043,68 +1029,68 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
static const AsciiPropertyValue aKnownSettings[] =
{
// known JDBC settings
- AsciiPropertyValue( "JavaDriverClass", makeAny( OUString() ) ),
- AsciiPropertyValue( "JavaDriverClassPath", makeAny( OUString() ) ),
- AsciiPropertyValue( "IgnoreCurrency", makeAny( false ) ),
+ AsciiPropertyValue( "JavaDriverClass", Any( OUString() ) ),
+ AsciiPropertyValue( "JavaDriverClassPath", Any( OUString() ) ),
+ AsciiPropertyValue( "IgnoreCurrency", Any( false ) ),
// known settings for file-based drivers
- AsciiPropertyValue( "Extension", makeAny( OUString() ) ),
- AsciiPropertyValue( "CharSet", makeAny( OUString() ) ),
- AsciiPropertyValue( "HeaderLine", makeAny( true ) ),
- AsciiPropertyValue( "FieldDelimiter", makeAny( OUString( "," ) ) ),
- AsciiPropertyValue( "StringDelimiter", makeAny( OUString( "\"" ) ) ),
- AsciiPropertyValue( "DecimalDelimiter", makeAny( OUString( "." ) ) ),
- AsciiPropertyValue( "ThousandDelimiter", makeAny( OUString() ) ),
- AsciiPropertyValue( "ShowDeleted", makeAny( false ) ),
+ AsciiPropertyValue( "Extension", Any( OUString() ) ),
+ AsciiPropertyValue( "CharSet", Any( OUString() ) ),
+ AsciiPropertyValue( "HeaderLine", Any( true ) ),
+ AsciiPropertyValue( "FieldDelimiter", Any( OUString( "," ) ) ),
+ AsciiPropertyValue( "StringDelimiter", Any( OUString( "\"" ) ) ),
+ AsciiPropertyValue( "DecimalDelimiter", Any( OUString( "." ) ) ),
+ AsciiPropertyValue( "ThousandDelimiter", Any( OUString() ) ),
+ AsciiPropertyValue( "ShowDeleted", Any( false ) ),
// known ODBC settings
- AsciiPropertyValue( "SystemDriverSettings", makeAny( OUString() ) ),
- AsciiPropertyValue( "UseCatalog", makeAny( false ) ),
- AsciiPropertyValue( "TypeInfoSettings", makeAny( Sequence< Any >()) ),
+ AsciiPropertyValue( "SystemDriverSettings", Any( OUString() ) ),
+ AsciiPropertyValue( "UseCatalog", Any( false ) ),
+ AsciiPropertyValue( "TypeInfoSettings", Any( Sequence< Any >()) ),
// settings related to auto increment handling
- AsciiPropertyValue( "AutoIncrementCreation", makeAny( OUString() ) ),
- AsciiPropertyValue( "AutoRetrievingStatement", makeAny( OUString() ) ),
- AsciiPropertyValue( "IsAutoRetrievingEnabled", makeAny( false ) ),
+ AsciiPropertyValue( "AutoIncrementCreation", Any( OUString() ) ),
+ AsciiPropertyValue( "AutoRetrievingStatement", Any( OUString() ) ),
+ AsciiPropertyValue( "IsAutoRetrievingEnabled", Any( false ) ),
// known LDAP driver settings
- AsciiPropertyValue( "HostName", makeAny( OUString() ) ),
- AsciiPropertyValue( "PortNumber", makeAny( sal_Int32(389) ) ),
- AsciiPropertyValue( "BaseDN", makeAny( OUString() ) ),
- AsciiPropertyValue( "MaxRowCount", makeAny( sal_Int32(100) ) ),
+ AsciiPropertyValue( "HostName", Any( OUString() ) ),
+ AsciiPropertyValue( "PortNumber", Any( sal_Int32(389) ) ),
+ AsciiPropertyValue( "BaseDN", Any( OUString() ) ),
+ AsciiPropertyValue( "MaxRowCount", Any( sal_Int32(100) ) ),
// known MySQLNative driver settings
- AsciiPropertyValue( "LocalSocket", makeAny( OUString() ) ),
- AsciiPropertyValue( "NamedPipe", makeAny( OUString() ) ),
+ AsciiPropertyValue( "LocalSocket", Any( OUString() ) ),
+ AsciiPropertyValue( "NamedPipe", Any( OUString() ) ),
// misc known driver settings
- AsciiPropertyValue( "ParameterNameSubstitution", makeAny( false ) ),
- AsciiPropertyValue( "AddIndexAppendix", makeAny( true ) ),
- AsciiPropertyValue( "IgnoreDriverPrivileges", makeAny( true ) ),
+ AsciiPropertyValue( "ParameterNameSubstitution", Any( false ) ),
+ AsciiPropertyValue( "AddIndexAppendix", Any( true ) ),
+ AsciiPropertyValue( "IgnoreDriverPrivileges", Any( true ) ),
AsciiPropertyValue( "ImplicitCatalogRestriction", ::cppu::UnoType< OUString >::get() ),
AsciiPropertyValue( "ImplicitSchemaRestriction", ::cppu::UnoType< OUString >::get() ),
AsciiPropertyValue( "PrimaryKeySupport", ::cppu::UnoType< sal_Bool >::get() ),
- AsciiPropertyValue( "ShowColumnDescription", makeAny( false ) ),
+ AsciiPropertyValue( "ShowColumnDescription", Any( false ) ),
// known SDB level settings
- AsciiPropertyValue( "NoNameLengthLimit", makeAny( false ) ),
- AsciiPropertyValue( "AppendTableAliasName", makeAny( false ) ),
- AsciiPropertyValue( "GenerateASBeforeCorrelationName", makeAny( false ) ),
- AsciiPropertyValue( "ColumnAliasInOrderBy", makeAny( true ) ),
- AsciiPropertyValue( "EnableSQL92Check", makeAny( false ) ),
- AsciiPropertyValue( "BooleanComparisonMode", makeAny( BooleanComparisonMode::EQUAL_INTEGER ) ),
- AsciiPropertyValue( "TableTypeFilterMode", makeAny( sal_Int32(3) ) ),
- AsciiPropertyValue( "RespectDriverResultSetType", makeAny( false ) ),
- AsciiPropertyValue( "UseSchemaInSelect", makeAny( true ) ),
- AsciiPropertyValue( "UseCatalogInSelect", makeAny( true ) ),
- AsciiPropertyValue( "EnableOuterJoinEscape", makeAny( true ) ),
- AsciiPropertyValue( "PreferDosLikeLineEnds", makeAny( false ) ),
- AsciiPropertyValue( "FormsCheckRequiredFields", makeAny( true ) ),
- AsciiPropertyValue( "EscapeDateTime", makeAny( true ) ),
+ AsciiPropertyValue( "NoNameLengthLimit", Any( false ) ),
+ AsciiPropertyValue( "AppendTableAliasName", Any( false ) ),
+ AsciiPropertyValue( "GenerateASBeforeCorrelationName", Any( false ) ),
+ AsciiPropertyValue( "ColumnAliasInOrderBy", Any( true ) ),
+ AsciiPropertyValue( "EnableSQL92Check", Any( false ) ),
+ AsciiPropertyValue( "BooleanComparisonMode", Any( BooleanComparisonMode::EQUAL_INTEGER ) ),
+ AsciiPropertyValue( "TableTypeFilterMode", Any( sal_Int32(3) ) ),
+ AsciiPropertyValue( "RespectDriverResultSetType", Any( false ) ),
+ AsciiPropertyValue( "UseSchemaInSelect", Any( true ) ),
+ AsciiPropertyValue( "UseCatalogInSelect", Any( true ) ),
+ AsciiPropertyValue( "EnableOuterJoinEscape", Any( true ) ),
+ AsciiPropertyValue( "PreferDosLikeLineEnds", Any( false ) ),
+ AsciiPropertyValue( "FormsCheckRequiredFields", Any( true ) ),
+ AsciiPropertyValue( "EscapeDateTime", Any( true ) ),
// known services to handle database tasks
- AsciiPropertyValue( "TableAlterationServiceName", makeAny( OUString() ) ),
- AsciiPropertyValue( "TableRenameServiceName", makeAny( OUString() ) ),
- AsciiPropertyValue( "ViewAlterationServiceName", makeAny( OUString() ) ),
- AsciiPropertyValue( "ViewAccessServiceName", makeAny( OUString() ) ),
- AsciiPropertyValue( "CommandDefinitions", makeAny( OUString() ) ),
- AsciiPropertyValue( "Forms", makeAny( OUString() ) ),
- AsciiPropertyValue( "Reports", makeAny( OUString() ) ),
- AsciiPropertyValue( "KeyAlterationServiceName", makeAny( OUString() ) ),
- AsciiPropertyValue( "IndexAlterationServiceName", makeAny( OUString() ) ),
+ AsciiPropertyValue( "TableAlterationServiceName", Any( OUString() ) ),
+ AsciiPropertyValue( "TableRenameServiceName", Any( OUString() ) ),
+ AsciiPropertyValue( "ViewAlterationServiceName", Any( OUString() ) ),
+ AsciiPropertyValue( "ViewAccessServiceName", Any( OUString() ) ),
+ AsciiPropertyValue( "CommandDefinitions", Any( OUString() ) ),
+ AsciiPropertyValue( "Forms", Any( OUString() ) ),
+ AsciiPropertyValue( "Reports", Any( OUString() ) ),
+ AsciiPropertyValue( "KeyAlterationServiceName", Any( OUString() ) ),
+ AsciiPropertyValue( "IndexAlterationServiceName", Any( OUString() ) ),
AsciiPropertyValue()
};
@@ -1113,7 +1099,6 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings()
TContentPtr& ODatabaseModelImpl::getObjectContainer( ObjectType _eType )
{
- OSL_PRECOND( _eType >= E_FORM && _eType <= E_TABLE, "ODatabaseModelImpl::getObjectContainer: illegal index!" );
TContentPtr& rContentPtr = m_aContainer[ _eType ];
if ( !rContentPtr )
@@ -1134,7 +1119,8 @@ bool ODatabaseModelImpl::checkMacrosOnLoading()
{
Reference< XInteractionHandler > xInteraction;
xInteraction = m_aMediaDescriptor.getOrDefault( "InteractionHandler", xInteraction );
- return m_aMacroMode.checkMacrosOnLoading( xInteraction );
+ const bool bHasMacros = m_aMacroMode.hasMacros();
+ return m_aMacroMode.checkMacrosOnLoading(xInteraction, false /*HasValidContentSignature*/, bHasMacros);
}
void ODatabaseModelImpl::resetMacroExecutionMode()
@@ -1205,7 +1191,7 @@ namespace
if ( xModify.is() && !_bListen && _inout_rListener.is() )
{
- xModify->removeModifyListener( _inout_rListener.get() );
+ xModify->removeModifyListener( _inout_rListener );
}
if ( _inout_rListener.is() )
@@ -1217,7 +1203,7 @@ namespace
if ( xModify.is() && _bListen )
{
_inout_rListener = new ::sfx2::DocumentStorageModifyListener( _rDocument, _rMutex );
- xModify->addModifyListener( _inout_rListener.get() );
+ xModify->addModifyListener( _inout_rListener );
}
}
}
@@ -1332,17 +1318,17 @@ ODatabaseModelImpl::EmbeddedMacros ODatabaseModelImpl::determineEmbeddedMacros()
{
if ( ::sfx2::DocumentMacroMode::storageHasMacros( getOrCreateRootStorage() ) )
{
- m_aEmbeddedMacros = eDocumentWideMacros;
+ m_aEmbeddedMacros = EmbeddedMacros::DocumentWide;
}
- else if ( lcl_hasObjectsWithMacros_nothrow( *this, E_FORM )
- || lcl_hasObjectsWithMacros_nothrow( *this, E_REPORT )
+ else if ( lcl_hasObjectsWithMacros_nothrow( *this, ObjectType::Form )
+ || lcl_hasObjectsWithMacros_nothrow( *this, ObjectType::Report )
)
{
- m_aEmbeddedMacros = eSubDocumentMacros;
+ m_aEmbeddedMacros = EmbeddedMacros::SubDocument;
}
else
{
- m_aEmbeddedMacros = eNoMacros;
+ m_aEmbeddedMacros = EmbeddedMacros::NONE;
}
}
return *m_aEmbeddedMacros;
@@ -1351,7 +1337,7 @@ ODatabaseModelImpl::EmbeddedMacros ODatabaseModelImpl::determineEmbeddedMacros()
bool ODatabaseModelImpl::documentStorageHasMacros() const
{
const_cast< ODatabaseModelImpl* >( this )->determineEmbeddedMacros();
- return ( *m_aEmbeddedMacros != eNoMacros );
+ return ( *m_aEmbeddedMacros != EmbeddedMacros::NONE );
}
bool ODatabaseModelImpl::macroCallsSeenWhileLoading() const
@@ -1369,7 +1355,8 @@ SignatureState ODatabaseModelImpl::getScriptingSignatureState()
return m_nScriptingSignatureState;
}
-bool ODatabaseModelImpl::hasTrustedScriptingSignature(bool bAllowUIToAddAuthor)
+bool ODatabaseModelImpl::hasTrustedScriptingSignature(
+ const css::uno::Reference<css::task::XInteractionHandler>& _rxInteraction)
{
bool bResult = false;
@@ -1384,7 +1371,7 @@ bool ODatabaseModelImpl::hasTrustedScriptingSignature(bool bAllowUIToAddAuthor)
uno::Reference<security::XDocumentDigitalSignatures> xSigner(
security::DocumentDigitalSignatures::createWithVersion(
comphelper::getProcessComponentContext(), aODFVersion));
- uno::Sequence<security::DocumentSignatureInformation> aInfo
+ const uno::Sequence<security::DocumentSignatureInformation> aInfo
= xSigner->verifyScriptingContentSignatures(xStorage,
uno::Reference<io::XInputStream>());
@@ -1401,20 +1388,15 @@ bool ODatabaseModelImpl::hasTrustedScriptingSignature(bool bAllowUIToAddAuthor)
});
}
- if (!bResult && bAllowUIToAddAuthor)
+ if (!bResult && _rxInteraction)
{
- Reference<XInteractionHandler> xInteraction;
- xInteraction = m_aMediaDescriptor.getOrDefault("InteractionHandler", xInteraction);
- if (xInteraction.is())
- {
- task::DocumentMacroConfirmationRequest aRequest;
- aRequest.DocumentURL = m_sDocFileLocation;
- aRequest.DocumentStorage = xStorage;
- aRequest.DocumentSignatureInformation = aInfo;
- aRequest.DocumentVersion = aODFVersion;
- aRequest.Classification = task::InteractionClassification_QUERY;
- bResult = SfxMedium::CallApproveHandler(xInteraction, uno::makeAny(aRequest), true);
- }
+ task::DocumentMacroConfirmationRequest aRequest;
+ aRequest.DocumentURL = m_sDocFileLocation;
+ aRequest.DocumentStorage = xStorage;
+ aRequest.DocumentSignatureInformation = aInfo;
+ aRequest.DocumentVersion = aODFVersion;
+ aRequest.Classification = task::InteractionClassification_QUERY;
+ bResult = SfxMedium::CallApproveHandler(_rxInteraction, uno::Any(aRequest), true);
}
}
catch (uno::Exception&)
@@ -1429,8 +1411,8 @@ void ODatabaseModelImpl::storageIsModified()
setModified( true );
}
-ModelDependentComponent::ModelDependentComponent( const ::rtl::Reference< ODatabaseModelImpl >& _model )
- :m_pImpl( _model )
+ModelDependentComponent::ModelDependentComponent( ::rtl::Reference< ODatabaseModelImpl > _model )
+ :m_pImpl(std::move( _model ))
{
}
diff --git a/dbaccess/source/core/dataaccess/SharedConnection.cxx b/dbaccess/source/core/dataaccess/SharedConnection.cxx
index 93bd17ff71af..d893a8e298b3 100644
--- a/dbaccess/source/core/dataaccess/SharedConnection.cxx
+++ b/dbaccess/source/core/dataaccess/SharedConnection.cxx
@@ -28,130 +28,127 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace connectivity;
-OSharedConnection::OSharedConnection(Reference< XAggregation >& _rxProxyConnection)
- : OSharedConnection_BASE(m_aMutex)
+OSharedConnection::OSharedConnection(Reference<XAggregation>& _rxProxyConnection)
+ : OSharedConnection_BASE(m_aMutex)
{
- setDelegation(_rxProxyConnection,m_refCount);
+ setDelegation(_rxProxyConnection, m_refCount);
}
-OSharedConnection::~OSharedConnection()
-{
-}
+OSharedConnection::~OSharedConnection() {}
void SAL_CALL OSharedConnection::disposing()
{
- OSharedConnection_BASE::disposing();
OConnectionWrapper::disposing();
+ OSharedConnection_BASE::disposing();
}
-Reference< XStatement > SAL_CALL OSharedConnection::createStatement( )
+Reference<XStatement> SAL_CALL OSharedConnection::createStatement()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->createStatement();
}
-Reference< XPreparedStatement > SAL_CALL OSharedConnection::prepareStatement( const OUString& sql )
+Reference<XPreparedStatement> SAL_CALL OSharedConnection::prepareStatement(const OUString& sql)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->prepareStatement(sql);
}
-Reference< XPreparedStatement > SAL_CALL OSharedConnection::prepareCall( const OUString& sql )
+Reference<XPreparedStatement> SAL_CALL OSharedConnection::prepareCall(const OUString& sql)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->prepareCall(sql);
}
-OUString SAL_CALL OSharedConnection::nativeSQL( const OUString& sql )
+OUString SAL_CALL OSharedConnection::nativeSQL(const OUString& sql)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->nativeSQL(sql);
}
-sal_Bool SAL_CALL OSharedConnection::getAutoCommit( )
+sal_Bool SAL_CALL OSharedConnection::getAutoCommit()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getAutoCommit();
}
-void SAL_CALL OSharedConnection::commit( )
+void SAL_CALL OSharedConnection::commit()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
m_xConnection->commit();
}
-void SAL_CALL OSharedConnection::rollback( )
+void SAL_CALL OSharedConnection::rollback()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
m_xConnection->rollback();
}
-sal_Bool SAL_CALL OSharedConnection::isClosed( )
+sal_Bool SAL_CALL OSharedConnection::isClosed()
{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( !m_xConnection.is() )
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if (!m_xConnection.is())
return true;
return m_xConnection->isClosed();
}
-Reference< XDatabaseMetaData > SAL_CALL OSharedConnection::getMetaData( )
+Reference<XDatabaseMetaData> SAL_CALL OSharedConnection::getMetaData()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
-
return m_xConnection->getMetaData();
}
-sal_Bool SAL_CALL OSharedConnection::isReadOnly( )
+sal_Bool SAL_CALL OSharedConnection::isReadOnly()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->isReadOnly();
}
-OUString SAL_CALL OSharedConnection::getCatalog( )
+OUString SAL_CALL OSharedConnection::getCatalog()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getCatalog();
}
-sal_Int32 SAL_CALL OSharedConnection::getTransactionIsolation( )
+sal_Int32 SAL_CALL OSharedConnection::getTransactionIsolation()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getTransactionIsolation();
}
-Reference< css::container::XNameAccess > SAL_CALL OSharedConnection::getTypeMap( )
+Reference<css::container::XNameAccess> SAL_CALL OSharedConnection::getTypeMap()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getTypeMap();
}
-IMPLEMENT_GET_IMPLEMENTATION_ID( OSharedConnection )
+IMPLEMENT_GET_IMPLEMENTATION_ID(OSharedConnection)
-} // namespace dbaccess
+} // namespace dbaccess
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/SharedConnection.hxx b/dbaccess/source/core/dataaccess/SharedConnection.hxx
index 6121d3d37532..2c88e58fd55d 100644
--- a/dbaccess/source/core/dataaccess/SharedConnection.hxx
+++ b/dbaccess/source/core/dataaccess/SharedConnection.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_SHAREDCONNECTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_SHAREDCONNECTION_HXX
+#pragma once
#include <connectivity/ConnectionWrapper.hxx>
#include <connectivity/CommonTools.hxx>
@@ -35,11 +34,10 @@ namespace dbaccess
// datasource is asked for not isolated connection.
typedef ::cppu::WeakComponentImplHelper< css::sdbc::XConnection
> OSharedConnection_BASE;
- typedef ::connectivity::OConnectionWrapper OSharedConnection_BASE2;
class OSharedConnection : public ::cppu::BaseMutex
, public OSharedConnection_BASE
- , public OSharedConnection_BASE2
+ , public ::connectivity::OConnectionWrapper
{
protected:
virtual void SAL_CALL disposing() override;
@@ -49,13 +47,13 @@ namespace dbaccess
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
- virtual void SAL_CALL acquire() throw() override { OSharedConnection_BASE::acquire(); }
- virtual void SAL_CALL release() throw() override { OSharedConnection_BASE::release(); }
+ virtual void SAL_CALL acquire() noexcept override { OSharedConnection_BASE::acquire(); }
+ virtual void SAL_CALL release() noexcept override { OSharedConnection_BASE::release(); }
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override
{
return ::comphelper::concatSequences(
OSharedConnection_BASE::getTypes(),
- OSharedConnection_BASE2::getTypes()
+ ::connectivity::OConnectionWrapper::getTypes()
);
}
@@ -63,7 +61,7 @@ namespace dbaccess
{
css::uno::Any aReturn = OSharedConnection_BASE::queryInterface(_rType);
if ( !aReturn.hasValue() )
- aReturn = OSharedConnection_BASE2::queryInterface(_rType);
+ aReturn = ::connectivity::OConnectionWrapper::queryInterface(_rType);
return aReturn;
}
@@ -116,6 +114,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_SHAREDCONNECTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
index 647aaf557f97..a03caea57e93 100644
--- a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
@@ -19,6 +19,7 @@
#include <bookmarkcontainer.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <comphelper/enumhelper.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
@@ -45,12 +46,12 @@ OBookmarkContainer::OBookmarkContainer(OWeakObject& _rParent, Mutex& _rMutex)
}
-void SAL_CALL OBookmarkContainer::acquire( ) throw()
+void SAL_CALL OBookmarkContainer::acquire( ) noexcept
{
m_rParent.acquire();
}
-void SAL_CALL OBookmarkContainer::release( ) throw()
+void SAL_CALL OBookmarkContainer::release( ) noexcept
{
m_rParent.release();
}
@@ -96,10 +97,8 @@ void SAL_CALL OBookmarkContainer::insertByName( const OUString& _rName, const An
// notify the listeners
if (m_aContainerListeners.getLength())
{
- ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), Any());
- OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners);
- while (aListenerIterator.hasMoreElements())
- static_cast< XContainerListener* >(aListenerIterator.next())->elementInserted(aEvent);
+ ContainerEvent aEvent(*this, Any(_rName), Any(sNewLink), Any());
+ m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
}
}
@@ -126,10 +125,8 @@ void SAL_CALL OBookmarkContainer::removeByName( const OUString& _rName )
// notify the listeners
if (m_aContainerListeners.getLength())
{
- ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sOldBookmark), Any());
- OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners);
- while (aListenerIterator.hasMoreElements())
- static_cast< XContainerListener* >(aListenerIterator.next())->elementRemoved(aEvent);
+ ContainerEvent aEvent(*this, Any(_rName), Any(sOldBookmark), Any());
+ m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent );
}
}
@@ -161,10 +158,8 @@ void SAL_CALL OBookmarkContainer::replaceByName( const OUString& _rName, const A
aGuard.clear();
if (m_aContainerListeners.getLength())
{
- ContainerEvent aEvent(*this, makeAny(_rName), makeAny(sNewLink), makeAny(sOldLink));
- OInterfaceIteratorHelper2 aListenerIterator(m_aContainerListeners);
- while (aListenerIterator.hasMoreElements())
- static_cast< XContainerListener* >(aListenerIterator.next())->elementReplaced(aEvent);
+ ContainerEvent aEvent(*this, Any(_rName), Any(sNewLink), Any(sOldLink));
+ m_aContainerListeners.notifyEach( &XContainerListener::elementReplaced, aEvent );
}
}
@@ -185,7 +180,6 @@ void SAL_CALL OBookmarkContainer::removeContainerListener( const Reference< XCon
// XElementAccess
Type SAL_CALL OBookmarkContainer::getElementType( )
{
- MutexGuard aGuard(m_rMutex);
return ::cppu::UnoType<OUString>::get();
}
@@ -213,10 +207,10 @@ Any SAL_CALL OBookmarkContainer::getByIndex( sal_Int32 _nIndex )
{
MutexGuard aGuard(m_rMutex);
- if ((_nIndex < 0) || (_nIndex >= static_cast<sal_Int32>(m_aBookmarksIndexed.size())))
+ if ((_nIndex < 0) || (o3tl::make_unsigned(_nIndex) >= m_aBookmarksIndexed.size()))
throw IndexOutOfBoundsException();
- return makeAny(m_aBookmarksIndexed[_nIndex]->second);
+ return Any(m_aBookmarksIndexed[_nIndex]->second);
}
Any SAL_CALL OBookmarkContainer::getByName( const OUString& _rName )
@@ -226,7 +220,7 @@ Any SAL_CALL OBookmarkContainer::getByName( const OUString& _rName )
if (!checkExistence(_rName))
throw NoSuchElementException();
- return makeAny(m_aBookmarks[_rName]);
+ return Any(m_aBookmarks[_rName]);
}
Sequence< OUString > SAL_CALL OBookmarkContainer::getElementNames( )
diff --git a/dbaccess/source/core/dataaccess/commandcontainer.cxx b/dbaccess/source/core/dataaccess/commandcontainer.cxx
index 55087272b992..7f646c61722e 100644
--- a/dbaccess/source/core/dataaccess/commandcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/commandcontainer.cxx
@@ -24,11 +24,7 @@
#include <com/sun/star/sdb/CommandDefinition.hpp>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::ucb;
-using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -52,7 +48,13 @@ OCommandContainer::~OCommandContainer()
}
IMPLEMENT_FORWARD_XINTERFACE2( OCommandContainer,ODefinitionContainer,OCommandContainer_BASE)
-IMPLEMENT_GETTYPES2(OCommandContainer,ODefinitionContainer,OCommandContainer_BASE);
+css::uno::Sequence< css::uno::Type > OCommandContainer::getTypes()
+{
+ return ::comphelper::concatSequences(
+ ODefinitionContainer::getTypes( ),
+ OCommandContainer_BASE::getTypes( )
+ );
+}
css::uno::Sequence<sal_Int8> OCommandContainer::getImplementationId()
{
diff --git a/dbaccess/source/core/dataaccess/commandcontainer.hxx b/dbaccess/source/core/dataaccess/commandcontainer.hxx
index d0a1deca85dd..3ea36f64808b 100644
--- a/dbaccess/source/core/dataaccess/commandcontainer.hxx
+++ b/dbaccess/source/core/dataaccess/commandcontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDCONTAINER_HXX
+#pragma once
#include <definitioncontainer.hxx>
@@ -70,6 +69,4 @@ protected:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDCONTAINER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.cxx b/dbaccess/source/core/dataaccess/commanddefinition.cxx
index 41ce139a8dc1..b3f4fa8b0ead 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.cxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.cxx
@@ -18,16 +18,14 @@
*/
#include "commanddefinition.hxx"
-#include <apitools.hxx>
#include <stringconstants.hxx>
+#include <strings.hxx>
#include <com/sun/star/container/ElementExistException.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
@@ -81,9 +79,30 @@ css::uno::Sequence<sal_Int8> OCommandDefinition::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES2(OCommandDefinition,OCommandDefinition_Base,OComponentDefinition);
+css::uno::Sequence< css::uno::Type > OCommandDefinition::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OCommandDefinition_Base::getTypes( ),
+ OComponentDefinition::getTypes( )
+ );
+}
IMPLEMENT_FORWARD_XINTERFACE2( OCommandDefinition,OComponentDefinition,OCommandDefinition_Base)
-IMPLEMENT_PROPERTYCONTAINER_DEFAULTS2(OCommandDefinition,OCommandDefinition_PROP)
+css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OCommandDefinition::getPropertySetInfo()
+{
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+::cppu::IPropertyArrayHelper& OCommandDefinition::getInfoHelper()
+{
+ return *OCommandDefinition_PROP::getArrayHelper();
+}
+::cppu::IPropertyArrayHelper* OCommandDefinition::createArrayHelper( ) const
+{
+ css::uno::Sequence< css::beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
OUString SAL_CALL OCommandDefinition::getImplementationName()
{
@@ -105,9 +124,9 @@ void SAL_CALL OCommandDefinition::rename( const OUString& newName )
{
sal_Int32 nHandle = PROPERTY_ID_NAME;
osl::ClearableGuard< osl::Mutex > aGuard(m_aMutex);
- Any aOld = makeAny(m_pImpl->m_aProps.aTitle);
+ Any aOld(m_pImpl->m_aProps.aTitle);
aGuard.clear();
- Any aNew = makeAny(newName);
+ Any aNew(newName);
fire(&nHandle, &aNew, &aOld, 1, true );
m_pImpl->m_aProps.aTitle = newName;
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.hxx b/dbaccess/source/core/dataaccess/commanddefinition.hxx
index 112a0eaa2b7c..ed348a8899b8 100644
--- a/dbaccess/source/core/dataaccess/commanddefinition.hxx
+++ b/dbaccess/source/core/dataaccess/commanddefinition.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
+#pragma once
#include <commandbase.hxx>
#include <apitools.hxx>
@@ -123,6 +122,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_COMMANDDEFINITION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx
index 2754a2c7d56e..fa4c934a056e 100644
--- a/dbaccess/source/core/dataaccess/connection.cxx
+++ b/dbaccess/source/core/dataaccess/connection.cxx
@@ -24,6 +24,7 @@
#include "connection.hxx"
#include "datasource.hxx"
#include <strings.hrc>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <statement.hxx>
#include <preparedstatement.hxx>
@@ -38,7 +39,7 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <connectivity/dbtools.hxx>
#include <connectivity/dbmetadata.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <comphelper/sequence.hxx>
#include <comphelper/types.hxx>
@@ -46,7 +47,6 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdb::application;
using namespace ::com::sun::star::sdbc;
@@ -86,7 +86,7 @@ Sequence< OUString > OConnection::getSupportedServiceNames( )
{
sal_Int32 nLen = aSupported.getLength();
aSupported.realloc( nLen + 1 );
- aSupported[ nLen ] = SERVICE_SDB_CONNECTION;
+ aSupported.getArray()[ nLen ] = SERVICE_SDB_CONNECTION;
}
return aSupported;
@@ -274,7 +274,7 @@ OConnection::OConnection(ODatabaseSource& _rDB
try
{
Reference< XProxyFactory > xProxyFactory = ProxyFactory::create( m_aContext );
- Reference<XAggregation> xAgg = xProxyFactory->createProxy(_rxMaster.get());
+ Reference<XAggregation> xAgg = xProxyFactory->createProxy(_rxMaster);
setDelegation(xAgg,m_refCount);
OSL_ENSURE(m_xConnection.is(), "OConnection::OConnection : invalid master connection !");
}
@@ -426,13 +426,13 @@ Any OConnection::queryInterface( const Type & rType )
return aReturn;
}
-void OConnection::acquire() throw ()
+void OConnection::acquire() noexcept
{
// include this one when you want to see who calls it (call graph)
OSubComponent::acquire();
}
-void OConnection::release() throw ()
+void OConnection::release() noexcept
{
// include this one when you want to see who calls it (call graph)
OSubComponent::release();
@@ -628,9 +628,8 @@ Reference< XInterface > SAL_CALL OConnection::createInstance( const OUString& _s
TSupportServices::const_iterator aFind = m_aSupportServices.find(_sServiceSpecifier);
if ( aFind == m_aSupportServices.end() )
{
- Sequence<Any> aArgs(1);
Reference<XConnection> xMy(this);
- aArgs[0] <<= NamedValue("ActiveConnection",makeAny(xMy));
+ Sequence<Any> aArgs{ Any(NamedValue("ActiveConnection",Any(xMy))) };
aFind = m_aSupportServices.emplace(
_sServiceSpecifier,
m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sServiceSpecifier, aArgs, m_aContext)
@@ -750,7 +749,7 @@ void OConnection::impl_checkTableQueryNames_nothrow()
try
{
Reference< XNameAccess > xTables( getTables() );
- Sequence< OUString > aTableNames( xTables->getElementNames() );
+ const Sequence< OUString > aTableNames( xTables->getElementNames() );
std::set< OUString > aSortedTableNames( aTableNames.begin(), aTableNames.end() );
Reference< XNameAccess > xQueries( getQueries() );
diff --git a/dbaccess/source/core/dataaccess/connection.hxx b/dbaccess/source/core/dataaccess/connection.hxx
index e5537da68843..4ecfa7d709dd 100644
--- a/dbaccess/source/core/dataaccess/connection.hxx
+++ b/dbaccess/source/core/dataaccess/connection.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_CONNECTION_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_CONNECTION_HXX
+#pragma once
#include <sal/config.h>
@@ -116,8 +115,8 @@ public:
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw( ) override;
- virtual void SAL_CALL release() throw( ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// OComponentHelper
virtual void SAL_CALL disposing() override;
@@ -227,6 +226,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_CONNECTION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
index d35d6ac00e55..ef5239a6793f 100644
--- a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
+++ b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
@@ -35,7 +35,6 @@
#include <comphelper/uno3.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <rtl/ref.hxx>
namespace
{
@@ -112,48 +111,29 @@ namespace
// </properties>
};
-#define REGISTER_PROPERTY( propname, member ) \
- registerProperty( PROPERTY_##propname, PROPERTY_ID_##propname, PropertyAttribute::BOUND, &member, cppu::UnoType<decltype(member)>::get() )
-
DataAccessDescriptor::DataAccessDescriptor()
- :DataAccessDescriptor_MutexBase()
- ,DataAccessDescriptor_TypeBase()
- ,DataAccessDescriptor_PropertyBase( m_aBHelper )
- ,m_sDataSourceName()
- ,m_sDatabaseLocation()
- ,m_sConnectionResource()
- ,m_aConnectionInfo()
- ,m_xActiveConnection()
- ,m_sCommand()
+ :DataAccessDescriptor_PropertyBase( m_aBHelper )
,m_nCommandType( CommandType::COMMAND )
- ,m_sFilter()
- ,m_sOrder()
- ,m_sHavingClause()
- ,m_sGroupBy()
,m_bEscapeProcessing( true )
- ,m_xResultSet()
- ,m_aSelection()
,m_bBookmarkSelection( true )
- ,m_sColumnName()
- ,m_xColumn()
{
- REGISTER_PROPERTY( DATASOURCENAME, m_sDataSourceName );
- REGISTER_PROPERTY( DATABASE_LOCATION, m_sDatabaseLocation );
- REGISTER_PROPERTY( CONNECTION_RESOURCE, m_sConnectionResource );
- REGISTER_PROPERTY( CONNECTION_INFO, m_aConnectionInfo );
- REGISTER_PROPERTY( ACTIVE_CONNECTION, m_xActiveConnection );
- REGISTER_PROPERTY( COMMAND, m_sCommand );
- REGISTER_PROPERTY( COMMAND_TYPE, m_nCommandType );
- REGISTER_PROPERTY( FILTER, m_sFilter );
- REGISTER_PROPERTY( ORDER, m_sOrder );
- REGISTER_PROPERTY( HAVING_CLAUSE, m_sHavingClause );
- REGISTER_PROPERTY( GROUP_BY, m_sGroupBy );
- REGISTER_PROPERTY( ESCAPE_PROCESSING, m_bEscapeProcessing );
- REGISTER_PROPERTY( RESULT_SET, m_xResultSet );
- REGISTER_PROPERTY( SELECTION, m_aSelection );
- REGISTER_PROPERTY( BOOKMARK_SELECTION, m_bBookmarkSelection );
- REGISTER_PROPERTY( COLUMN_NAME, m_sColumnName );
- REGISTER_PROPERTY( COLUMN, m_xColumn );
+ registerProperty(PROPERTY_DATASOURCENAME, PROPERTY_ID_DATASOURCENAME, PropertyAttribute::BOUND, &m_sDataSourceName , cppu::UnoType<decltype(m_sDataSourceName )>::get());
+ registerProperty(PROPERTY_DATABASE_LOCATION, PROPERTY_ID_DATABASE_LOCATION, PropertyAttribute::BOUND, &m_sDatabaseLocation , cppu::UnoType<decltype(m_sDatabaseLocation )>::get());
+ registerProperty(PROPERTY_CONNECTION_RESOURCE, PROPERTY_ID_CONNECTION_RESOURCE, PropertyAttribute::BOUND, &m_sConnectionResource , cppu::UnoType<decltype(m_sConnectionResource )>::get());
+ registerProperty(PROPERTY_CONNECTION_INFO, PROPERTY_ID_CONNECTION_INFO, PropertyAttribute::BOUND, &m_aConnectionInfo , cppu::UnoType<decltype(m_aConnectionInfo )>::get());
+ registerProperty(PROPERTY_ACTIVE_CONNECTION, PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::BOUND, &m_xActiveConnection , cppu::UnoType<decltype(m_xActiveConnection )>::get());
+ registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND, &m_sCommand , cppu::UnoType<decltype(m_sCommand )>::get());
+ registerProperty(PROPERTY_COMMAND_TYPE, PROPERTY_ID_COMMAND_TYPE, PropertyAttribute::BOUND, &m_nCommandType , cppu::UnoType<decltype(m_nCommandType )>::get());
+ registerProperty(PROPERTY_FILTER, PROPERTY_ID_FILTER, PropertyAttribute::BOUND, &m_sFilter , cppu::UnoType<decltype(m_sFilter )>::get());
+ registerProperty(PROPERTY_ORDER, PROPERTY_ID_ORDER, PropertyAttribute::BOUND, &m_sOrder , cppu::UnoType<decltype(m_sOrder )>::get());
+ registerProperty(PROPERTY_HAVING_CLAUSE, PROPERTY_ID_HAVING_CLAUSE, PropertyAttribute::BOUND, &m_sHavingClause , cppu::UnoType<decltype(m_sHavingClause )>::get());
+ registerProperty(PROPERTY_GROUP_BY, PROPERTY_ID_GROUP_BY, PropertyAttribute::BOUND, &m_sGroupBy , cppu::UnoType<decltype(m_sGroupBy )>::get());
+ registerProperty(PROPERTY_ESCAPE_PROCESSING, PROPERTY_ID_ESCAPE_PROCESSING, PropertyAttribute::BOUND, &m_bEscapeProcessing , cppu::UnoType<decltype(m_bEscapeProcessing )>::get());
+ registerProperty(PROPERTY_RESULT_SET, PROPERTY_ID_RESULT_SET, PropertyAttribute::BOUND, &m_xResultSet , cppu::UnoType<decltype(m_xResultSet )>::get());
+ registerProperty(PROPERTY_SELECTION, PROPERTY_ID_SELECTION, PropertyAttribute::BOUND, &m_aSelection , cppu::UnoType<decltype(m_aSelection )>::get());
+ registerProperty(PROPERTY_BOOKMARK_SELECTION, PROPERTY_ID_BOOKMARK_SELECTION, PropertyAttribute::BOUND, &m_bBookmarkSelection , cppu::UnoType<decltype(m_bBookmarkSelection )>::get());
+ registerProperty(PROPERTY_COLUMN_NAME, PROPERTY_ID_COLUMN_NAME, PropertyAttribute::BOUND, &m_sColumnName , cppu::UnoType<decltype(m_sColumnName )>::get());
+ registerProperty(PROPERTY_COLUMN, PROPERTY_ID_COLUMN, PropertyAttribute::BOUND, &m_xColumn , cppu::UnoType<decltype(m_xColumn )>::get());
}
DataAccessDescriptor::~DataAccessDescriptor()
@@ -236,18 +216,6 @@ namespace
return new DataAccessDescriptor();
}
-struct Instance {
- explicit Instance():
- instance(new DataAccessDescriptorFactory())
- {}
-
- rtl::Reference<cppu::OWeakObject> instance;
-};
-
-struct Singleton:
- public rtl::Static<Instance, Singleton>
-{};
-
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
@@ -255,7 +223,7 @@ com_sun_star_comp_dba_DataAccessDescriptorFactory(
css::uno::XComponentContext *,
css::uno::Sequence<css::uno::Any> const &)
{
- return cppu::acquire(Singleton::get().instance.get());
+ return cppu::acquire(new DataAccessDescriptorFactory());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index c7ddce73b48a..54c2ae37f356 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -20,6 +20,7 @@
#include <config_features.h>
#include <strings.hrc>
+#include <strings.hxx>
#include <core_resource.hxx>
#include <databasecontext.hxx>
#include "databaseregistrations.hxx"
@@ -52,14 +53,15 @@
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/weak.hxx>
#include <rtl/uri.hxx>
#include <sal/log.hxx>
#include <svl/filenotation.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/urlobj.hxx>
#include <ucbhelper/content.hxx>
+#include <rtl/ref.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <vector>
@@ -72,7 +74,6 @@ using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::registry;
using namespace ::com::sun::star;
using namespace ::cppu;
using namespace ::osl;
@@ -175,12 +176,7 @@ ODatabaseContext::ODatabaseContext( const Reference< XComponentContext >& _rxCon
#endif
osl_atomic_increment( &m_refCount );
- {
- m_xDBRegistrationAggregate.set( createDataSourceRegistrations( m_aContext ), UNO_SET_THROW );
- m_xDatabaseRegistrations.set( m_xDBRegistrationAggregate, UNO_QUERY_THROW );
-
- m_xDBRegistrationAggregate->setDelegator( *this );
- }
+ m_xDatabaseRegistrations = createDataSourceRegistrations( m_aContext );
osl_atomic_decrement( &m_refCount );
}
@@ -191,31 +187,13 @@ ODatabaseContext::~ODatabaseContext()
#endif
m_xDatabaseDocumentLoader.clear();
- m_xDBRegistrationAggregate->setDelegator( nullptr );
- m_xDBRegistrationAggregate.clear();
m_xDatabaseRegistrations.clear();
}
-// Helper
-OUString ODatabaseContext::getImplementationName_static()
-{
- return "com.sun.star.comp.dba.ODatabaseContext";
-}
-
-Reference< XInterface > ODatabaseContext::Create(const Reference< XComponentContext >& _rxContext)
-{
- return *( new ODatabaseContext( _rxContext ) );
-}
-
-Sequence< OUString > ODatabaseContext::getSupportedServiceNames_static()
-{
- return { "com.sun.star.sdb.DatabaseContext" };
-}
-
// XServiceInfo
OUString ODatabaseContext::getImplementationName( )
{
- return getImplementationName_static();
+ return "com.sun.star.comp.dba.ODatabaseContext";
}
sal_Bool ODatabaseContext::supportsService( const OUString& _rServiceName )
@@ -225,7 +203,7 @@ sal_Bool ODatabaseContext::supportsService( const OUString& _rServiceName )
Sequence< OUString > ODatabaseContext::getSupportedServiceNames( )
{
- return getSupportedServiceNames_static();
+ return { "com.sun.star.sdb.DatabaseContext" };
}
Reference< XInterface > ODatabaseContext::impl_createNewDataSource()
@@ -233,7 +211,7 @@ Reference< XInterface > ODatabaseContext::impl_createNewDataSource()
::rtl::Reference pImpl( new ODatabaseModelImpl( m_aContext, *this ) );
Reference< XDataSource > xDataSource( pImpl->getOrCreateDataSource() );
- return xDataSource.get();
+ return xDataSource;
}
Reference< XInterface > SAL_CALL ODatabaseContext::createInstance( )
@@ -328,10 +306,11 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa
OUString sErrorMessage( DBA_RES( RID_STR_FILE_DOES_NOT_EXIST ) );
::svt::OFileNotation aTransformer( _sURL );
- SQLException aError;
- aError.Message = sErrorMessage.replaceAll( "$file$", aTransformer.get( ::svt::OFileNotation::N_SYSTEM ) );
+ SQLException aError(sErrorMessage.replaceAll(
+ "$file$", aTransformer.get(::svt::OFileNotation::N_SYSTEM)),
+ {}, {}, 0, {});
- throw WrappedTargetException( _sURL, *this, makeAny( aError ) );
+ throw WrappedTargetException( _sURL, *this, Any( aError ) );
}
throw WrappedTargetException( _sURL, *this, ::cppu::getCaughtException() );
}
@@ -388,7 +367,7 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa
setTransientProperties( _sURL, *pModelImpl );
- return pModelImpl->getOrCreateDataSource().get();
+ return pModelImpl->getOrCreateDataSource();
}
void ODatabaseContext::appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel)
@@ -454,7 +433,7 @@ void ODatabaseContext::registerObject(const OUString& _rName, const Reference< X
}
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rName), makeAny(_rxObject), Any());
+ ContainerEvent aEvent(static_cast<XContainer*>(this), Any(_rName), Any(_rxObject), Any());
m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
}
@@ -473,7 +452,7 @@ void ODatabaseContext::storeTransientProperties( ODatabaseModelImpl& _rModelImpl
if (xSetInfo.is())
aProperties = xSetInfo->getProperties();
- for ( const Property& rProperty : std::as_const(aProperties) )
+ for (const Property& rProperty : aProperties)
{
if ( ( ( rProperty.Attributes & PropertyAttribute::TRANSIENT) != 0 )
&& ( ( rProperty.Attributes & PropertyAttribute::READONLY) == 0 )
@@ -542,7 +521,7 @@ void ODatabaseContext::revokeObject(const OUString& _rName)
m_aDatabaseObjects.erase( aExistent );
// notify our container listeners
- ContainerEvent aEvent( *this, makeAny( _rName ), Any(), Any() );
+ ContainerEvent aEvent( *this, Any( _rName ), Any(), Any() );
aGuard.clear();
m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent );
}
@@ -625,7 +604,7 @@ Any ODatabaseContext::getByName(const OUString& _rName)
{
Reference< XInterface > xExistent = getObject( _rName );
if ( xExistent.is() )
- return makeAny( xExistent );
+ return Any( xExistent );
// see whether this is a registered name
OUString sURL;
@@ -642,7 +621,7 @@ Any ODatabaseContext::getByName(const OUString& _rName)
if ( !xExistent.is() )
// try to load this as URL
xExistent = loadObjectFromURL( _rName, sURL );
- return makeAny( xExistent );
+ return Any( xExistent );
}
catch (const NoSuchElementException&)
{ // let these exceptions through
@@ -721,21 +700,6 @@ void ODatabaseContext::databaseDocumentURLChange( const OUString& _rOldURL, cons
m_aDatabaseObjects.erase( oldPos );
}
-sal_Int64 SAL_CALL ODatabaseContext::getSomething( const Sequence< sal_Int8 >& rId )
-{
- if (isUnoTunnelId<ODatabaseContext>(rId))
- return reinterpret_cast<sal_Int64>(this);
-
- return 0;
-}
-
-Sequence< sal_Int8 > ODatabaseContext::getUnoTunnelId()
-{
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
-}
-
void ODatabaseContext::onBasicManagerCreated( const Reference< XModel >& _rxForDocument, BasicManager& _rBasicManager )
{
#if !HAVE_FEATURE_SCRIPTING
@@ -754,10 +718,18 @@ void ODatabaseContext::onBasicManagerCreated( const Reference< XModel >& _rxForD
// ... whose BasicManager has just been created, then add the global DatabaseDocument variable to its scope.
if ( xDatabaseDocument.is() )
- _rBasicManager.SetGlobalUNOConstant( "ThisDatabaseDocument", makeAny( xDatabaseDocument ) );
+ _rBasicManager.SetGlobalUNOConstant( "ThisDatabaseDocument", Any( xDatabaseDocument ) );
#endif
}
} // namespace dbaccess
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_comp_dba_ODatabaseContext_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
+{
+ return cppu::acquire(new dbaccess::ODatabaseContext(context));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 4eac4796982b..204bad556e5d 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -24,8 +24,11 @@
#include <databasecontext.hxx>
#include "documentcontainer.hxx"
#include <sdbcoretools.hxx>
+#include <strings.hxx>
#include <recovery/dbdocrecovery.hxx>
+#include <officecfg/Office/Common.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
@@ -40,8 +43,6 @@
#include <com/sun/star/lang/NoSupportException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/script/provider/theMasterScriptProviderFactory.hpp>
-#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
-#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
@@ -61,8 +62,8 @@
#include <comphelper/genericpropertyset.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/numberedcollection.hxx>
+#include <comphelper/servicehelper.hxx>
#include <comphelper/storagehelper.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/propertysetinfo.hxx>
#include <comphelper/types.hxx>
@@ -72,9 +73,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <framework/titlehelper.hxx>
#include <unotools/saveopt.hxx>
-#include <unotools/tempfile.hxx>
-#include <tools/diagnose_ex.h>
-#include <osl/file.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <vcl/GraphicObject.hxx>
@@ -198,39 +197,24 @@ Any SAL_CALL ODatabaseDocument::queryInterface( const Type& _rType )
)
return Any();
- Any aReturn = ODatabaseDocument_OfficeDocument::queryInterface(_rType);
- if (!aReturn.hasValue())
- aReturn = ODatabaseDocument_Title::queryInterface(_rType);
- return aReturn;
-}
-
-void SAL_CALL ODatabaseDocument::acquire( ) throw ()
-{
- ODatabaseDocument_OfficeDocument::acquire();
-}
-
-void SAL_CALL ODatabaseDocument::release( ) throw ()
-{
- ODatabaseDocument_OfficeDocument::release();
+ return ODatabaseDocument_OfficeDocument::queryInterface(_rType);
}
Sequence< Type > SAL_CALL ODatabaseDocument::getTypes( )
{
- Sequence< Type > aTypes = ::comphelper::concatSequences(
- ODatabaseDocument_OfficeDocument::getTypes(),
- ODatabaseDocument_Title::getTypes()
- );
+ Sequence< Type > aTypes = ODatabaseDocument_OfficeDocument::getTypes();
// strip XEmbeddedScripts and XScriptInvocationContext if we have any form/report
// which already contains macros. In this case, the database document itself is not
// allowed to contain macros, too.
if ( !m_bAllowDocumentScripting )
{
- auto newEnd = std::remove_if( aTypes.begin(), aTypes.end(),
+ auto [begin, end] = asNonConstRange(aTypes);
+ auto newEnd = std::remove_if( begin, end,
[](const Type& t)
{ return t == cppu::UnoType<XEmbeddedScripts>::get() ||
t == cppu::UnoType<XScriptInvocationContext>::get();} );
- aTypes.realloc( std::distance(aTypes.begin(), newEnd) );
+ aTypes.realloc( std::distance(begin, newEnd) );
}
return aTypes;
@@ -280,7 +264,7 @@ namespace
sal_Int32 nLength = _rCallArgs.getLength();
_rCallArgs.realloc( nLength + 1 );
- _rCallArgs[ nLength ] <<= xStatusIndicator;
+ _rCallArgs.getArray()[ nLength ] <<= xStatusIndicator;
}
void lcl_extractAndStartStatusIndicator( const ::comphelper::NamedValueCollection& _rArguments, Reference< XStatusIndicator >& _rxStatusIndicator,
@@ -296,7 +280,7 @@ namespace
sal_Int32 nLength = _rCallArgs.getLength();
_rCallArgs.realloc( nLength + 1 );
- _rCallArgs[ nLength ] <<= _rxStatusIndicator;
+ _rCallArgs.getArray()[ nLength ] <<= _rxStatusIndicator;
}
catch( const Exception& )
{
@@ -306,17 +290,17 @@ namespace
Sequence< PropertyValue > lcl_appendFileNameToDescriptor( const ::comphelper::NamedValueCollection& _rDescriptor, const OUString& _rURL )
{
+ if ( _rURL.isEmpty() )
+ return _rDescriptor.getPropertyValues();
+
::comphelper::NamedValueCollection aMutableDescriptor( _rDescriptor );
- if ( !_rURL.isEmpty() )
- {
- aMutableDescriptor.put( "FileName", _rURL );
- aMutableDescriptor.put( "URL", _rURL );
- }
+ aMutableDescriptor.put( "FileName", _rURL );
+ aMutableDescriptor.put( "URL", _rURL );
return aMutableDescriptor.getPropertyValues();
}
}
-const char sPictures[] = "Pictures";
+constexpr OUString sPictures = u"Pictures"_ustr;
// base documents seem to have a different behaviour to other documents, the
// root storage contents at least seem to be re-used over different saves, thus if there is a
@@ -434,9 +418,8 @@ namespace
{ OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
{ OUString("StreamName"), 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
{ OUString("UsePrettyPrinting"), 0, ::cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
- {OUString("TargetStorage"), 0, cppu::UnoType<embed::XStorage>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
- {OUString("StreamRelPath"), 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
- { OUString(), 0, css::uno::Type(), 0, 0 }
+ { OUString("TargetStorage"), 0, cppu::UnoType<embed::XStorage>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
+ { OUString("StreamRelPath"), 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
};
}
@@ -452,12 +435,12 @@ void ODatabaseDocument::impl_import_nolck_throw( const Reference< XComponentCont
if (sBaseURI.isEmpty())
sBaseURI = _rResource.getOrDefault("URL",OUString());
assert(!sBaseURI.isEmpty()); // needed for relative URLs
- xInfoSet->setPropertyValue("BaseURI", uno::makeAny(sBaseURI));
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
+ xInfoSet->setPropertyValue("BaseURI", uno::Any(sBaseURI));
+ xInfoSet->setPropertyValue("StreamName", uno::Any(OUString("content.xml")));
const sal_Int32 nCount = aFilterCreationArgs.getLength();
aFilterCreationArgs.realloc(nCount + 1);
- aFilterCreationArgs[nCount] <<= xInfoSet;
+ aFilterCreationArgs.getArray()[nCount] <<= xInfoSet;
Reference< XImporter > xImporter(
_rContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.sdb.DBFilter", aFilterCreationArgs, _rContext),
@@ -776,7 +759,7 @@ bool ODatabaseDocument::impl_attachResource( const OUString& i_rLogicalDocumentU
// determine whether the document as a whole, or sub documents, have macros. Especially the latter
// controls the availability of our XEmbeddedScripts and XScriptInvocationContext interfaces, and we
// should know this before anybody actually uses the object.
- m_bAllowDocumentScripting = ( m_pImpl->determineEmbeddedMacros() != ODatabaseModelImpl::eSubDocumentMacros );
+ m_bAllowDocumentScripting = ( m_pImpl->determineEmbeddedMacros() != ODatabaseModelImpl::EmbeddedMacros::SubDocument );
_rDocGuard.clear();
// <- SYNCHRONIZED
@@ -798,6 +781,15 @@ Sequence< PropertyValue > SAL_CALL ODatabaseDocument::getArgs( )
return m_pImpl->getMediaDescriptor().getPropertyValues();
}
+Sequence< PropertyValue > SAL_CALL ODatabaseDocument::getArgs2( const ::css::uno::Sequence< ::rtl::OUString >& requestedArgs )
+{
+ DocumentGuard aGuard( *this, DocumentGuard::MethodWithoutInit );
+ std::vector<PropertyValue> aRet;
+ for (const auto & rArgName : requestedArgs)
+ aRet.push_back(PropertyValue(rArgName, 0, m_pImpl->getMediaDescriptor().get(rArgName), PropertyState_DIRECT_VALUE));
+ return comphelper::containerToSequence(aRet);
+}
+
void SAL_CALL ODatabaseDocument::setArgs(const Sequence<beans::PropertyValue>& /* aArgs */)
{
throw NoSupportException();
@@ -855,7 +847,7 @@ void SAL_CALL ODatabaseDocument::disconnectController( const Reference< XControl
if ( bNotifyViewClosed )
m_aEventNotifier.notifyDocumentEvent( "OnViewClosed", Reference< XController2 >( _xController, UNO_QUERY ) );
- if ( !(bLastControllerGone && !bIsClosing) )
+ if ( !bLastControllerGone || bIsClosing )
return;
// if this was the last view, close the document as a whole
@@ -992,11 +984,11 @@ void SAL_CALL ODatabaseDocument::store( )
// allowed to leave
throw;
}
- impl_throwIOExceptionCausedBySave_throw( aError, OUString() );
+ impl_throwIOExceptionCausedBySave_throw( aError, {} );
}
}
-void ODatabaseDocument::impl_throwIOExceptionCausedBySave_throw( const Any& i_rError, const OUString& i_rTargetURL ) const
+void ODatabaseDocument::impl_throwIOExceptionCausedBySave_throw( const Any& i_rError, std::u16string_view i_rTargetURL ) const
{
OUString sErrorMessage = extractExceptionMessage( m_pImpl->m_aContext, i_rError );
sErrorMessage = ResourceManager::loadString(
@@ -1021,7 +1013,7 @@ void ODatabaseDocument::impl_storeAs_throw( const OUString& _rURL, const ::comph
if ( !bIsInitializationProcess )
{
_rGuard.clear();
- m_aEventNotifier.notifyDocumentEvent( _eType == SAVE ? "OnSave" : "OnSaveAs", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEvent( _eType == SAVE ? "OnSave" : "OnSaveAs", nullptr, Any( _rURL ) );
_rGuard.reset();
}
@@ -1081,13 +1073,13 @@ void ODatabaseDocument::impl_storeAs_throw( const OUString& _rURL, const ::comph
catch( const IOException& )
{
if ( !bIsInitializationProcess )
- m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveFailed" : "OnSaveAsFailed", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveFailed" : "OnSaveAsFailed", nullptr, Any( _rURL ) );
throw;
}
catch( const RuntimeException& )
{
if ( !bIsInitializationProcess )
- m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveFailed" : "OnSaveAsFailed", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveFailed" : "OnSaveAsFailed", nullptr, Any( _rURL ) );
throw;
}
catch( const Exception& )
@@ -1096,14 +1088,14 @@ void ODatabaseDocument::impl_storeAs_throw( const OUString& _rURL, const ::comph
// notify the failure
if ( !bIsInitializationProcess )
- m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveFailed" : "OnSaveAsFailed", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveFailed" : "OnSaveAsFailed", nullptr, Any( _rURL ) );
impl_throwIOExceptionCausedBySave_throw( aError, _rURL );
}
// notify the document event
if ( !bIsInitializationProcess )
- m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveDone" : "OnSaveAsDone", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEventAsync( _eType == SAVE ? "OnSaveDone" : "OnSaveAsDone", nullptr, Any( _rURL ) );
// reset our "modified" flag, and clear the guard
impl_setModified_nothrow( false, _rGuard );
@@ -1123,9 +1115,7 @@ Reference< XStorage > ODatabaseDocument::impl_createStorageFor_throw( const OUSt
{
xTruncate->truncate();
}
- Sequence<Any> aParam(2);
- aParam[0] <<= xStream;
- aParam[1] <<= ElementModes::READWRITE | ElementModes::TRUNCATE;
+ Sequence<Any> aParam{ Any(xStream), Any(ElementModes::READWRITE | ElementModes::TRUNCATE) };
Reference< XSingleServiceFactory > xStorageFactory( m_pImpl->createStorageFactory(), UNO_SET_THROW );
return Reference< XStorage >( xStorageFactory->createInstanceWithArguments( aParam ), UNO_QUERY_THROW );
@@ -1245,7 +1235,7 @@ void SAL_CALL ODatabaseDocument::storeToURL( const OUString& _rURL, const Sequen
{
aGuard.clear();
- m_aEventNotifier.notifyDocumentEvent( "OnSaveTo", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEvent( "OnSaveTo", nullptr, Any( _rURL ) );
aGuard.reset();
}
@@ -1277,7 +1267,7 @@ void SAL_CALL ODatabaseDocument::storeToURL( const OUString& _rURL, const Sequen
impl_throwIOExceptionCausedBySave_throw( aError, _rURL );
}
- m_aEventNotifier.notifyDocumentEventAsync( "OnSaveToDone", nullptr, makeAny( _rURL ) );
+ m_aEventNotifier.notifyDocumentEventAsync( "OnSaveToDone", nullptr, Any( _rURL ) );
}
// XModifyBroadcaster
@@ -1407,10 +1397,10 @@ void ODatabaseDocument::clearObjectContainer( WeakReference< XNameAccess >& _rxC
Reference< XNameAccess > ODatabaseDocument::impl_getDocumentContainer_throw( ODatabaseModelImpl::ObjectType _eType )
{
- if ( ( _eType != ODatabaseModelImpl::E_FORM ) && ( _eType != ODatabaseModelImpl::E_REPORT ) )
+ if ( ( _eType != ODatabaseModelImpl::ObjectType::Form ) && ( _eType != ODatabaseModelImpl::ObjectType::Report ) )
throw IllegalArgumentException();
- bool bFormsContainer = _eType == ODatabaseModelImpl::E_FORM;
+ bool bFormsContainer = _eType == ODatabaseModelImpl::ObjectType::Form;
WeakReference< XNameAccess >& rContainerRef( bFormsContainer ? m_xForms : m_xReports );
Reference< XNameAccess > xContainer = rContainerRef;
@@ -1424,8 +1414,7 @@ Reference< XNameAccess > ODatabaseDocument::impl_getDocumentContainer_throw( ODa
aValue >>= sSupportService;
if ( !sSupportService.isEmpty() )
{
- Sequence<Any> aArgs(1);
- aArgs[0] <<= NamedValue("DatabaseDocument",makeAny(xMy));
+ Sequence<Any> aArgs{ Any(NamedValue("DatabaseDocument",Any(xMy))) };
xContainer.set(
m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(sSupportService, aArgs, m_pImpl->m_aContext),
UNO_QUERY);
@@ -1502,7 +1491,7 @@ void SAL_CALL ODatabaseDocument::close(sal_Bool bDeliverOwnership)
{
// allow listeners to veto
lang::EventObject aEvent( *this );
- m_aCloseListener.forEach< XCloseListener >(
+ m_aCloseListener.forEach(
[&aEvent, &bDeliverOwnership] (uno::Reference<XCloseListener> const& xListener) {
return xListener->queryClosing(aEvent, bDeliverOwnership);
});
@@ -1544,13 +1533,13 @@ void SAL_CALL ODatabaseDocument::removeCloseListener( const Reference< css::util
Reference< XNameAccess > SAL_CALL ODatabaseDocument::getFormDocuments( )
{
DocumentGuard aGuard( *this, DocumentGuard::MethodUsedDuringInit );
- return impl_getDocumentContainer_throw( ODatabaseModelImpl::E_FORM );
+ return impl_getDocumentContainer_throw( ODatabaseModelImpl::ObjectType::Form );
}
Reference< XNameAccess > SAL_CALL ODatabaseDocument::getReportDocuments( )
{
DocumentGuard aGuard( *this, DocumentGuard::MethodUsedDuringInit );
- return impl_getDocumentContainer_throw( ODatabaseModelImpl::E_REPORT );
+ return impl_getDocumentContainer_throw( ODatabaseModelImpl::ObjectType::Report );
}
void ODatabaseDocument::WriteThroughComponent( const Reference< XComponent >& xComponent, const char* pStreamName,
@@ -1576,8 +1565,8 @@ void ODatabaseDocument::WriteThroughComponent( const Reference< XComponent >& xC
xSeek->seek(0);
Reference< XPropertySet > xStreamProp( xOutputStream, UNO_QUERY_THROW );
- xStreamProp->setPropertyValue( INFO_MEDIATYPE, makeAny( OUString( "text/xml" ) ) );
- xStreamProp->setPropertyValue( "Compressed", makeAny( true ) );
+ xStreamProp->setPropertyValue( INFO_MEDIATYPE, Any( OUString( "text/xml" ) ) );
+ xStreamProp->setPropertyValue( "Compressed", Any( true ) );
// write the stuff
WriteThroughComponent( xOutputStream, xComponent, pServiceName, _rArguments, rMediaDesc );
@@ -1599,9 +1588,10 @@ void ODatabaseDocument::WriteThroughComponent( const Reference< XOutputStream >&
// prepare arguments (prepend doc handler to given arguments)
Sequence<Any> aArgs( 1 + _rArguments.getLength() );
- aArgs[0] <<= xSaxWriter;
+ auto pArgs = aArgs.getArray();
+ pArgs[0] <<= xSaxWriter;
for ( sal_Int32 i = 0; i < _rArguments.getLength(); ++i )
- aArgs[ i+1 ] = _rArguments[i];
+ pArgs[ i+1 ] = _rArguments[i];
// get filter component
Reference< XExporter > xExporter( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(OUString::createFromAscii(pServiceName), aArgs, m_pImpl->m_aContext), UNO_QUERY_THROW );
@@ -1622,18 +1612,17 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
- SvtSaveOptions aSaveOpt;
- xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(aSaveOpt.IsPrettyPrinting()));
- if ( aSaveOpt.IsSaveRelFSys() )
+ xInfoSet->setPropertyValue("UsePrettyPrinting", uno::Any(officecfg::Office::Common::Save::Document::PrettyPrinting::get()));
+ if ( officecfg::Office::Common::Save::URL::FileSystem::get() )
{
OUString sBaseURI = _rMediaDescriptor.getOrDefault("BaseURI", OUString());
if (sBaseURI.isEmpty())
sBaseURI = _rMediaDescriptor.getOrDefault("URL",OUString());
- xInfoSet->setPropertyValue("BaseURI", uno::makeAny(sBaseURI));
+ xInfoSet->setPropertyValue("BaseURI", uno::Any(sBaseURI));
}
// Set TargetStorage, so it doesn't have to be re-constructed based on possibly empty URL.
- xInfoSet->setPropertyValue("TargetStorage", uno::makeAny(m_pImpl->getRootStorage()));
+ xInfoSet->setPropertyValue("TargetStorage", uno::Any(m_pImpl->getRootStorage()));
// Set StreamRelPath, in case this document is an embedded one.
OUString sStreamRelPath;
@@ -1647,18 +1636,18 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
sStreamRelPath = sStreamRelPath.copy(1);
}
if (!sStreamRelPath.isEmpty())
- xInfoSet->setPropertyValue("StreamRelPath", uno::makeAny(sStreamRelPath));
+ xInfoSet->setPropertyValue("StreamRelPath", uno::Any(sStreamRelPath));
sal_Int32 nArgsLen = aDelegatorArguments.getLength();
aDelegatorArguments.realloc(nArgsLen+1);
- aDelegatorArguments[nArgsLen++] <<= xInfoSet;
+ aDelegatorArguments.getArray()[nArgsLen++] <<= xInfoSet;
Reference< XPropertySet > xProp( _rxTargetStorage, UNO_QUERY_THROW );
- xProp->setPropertyValue( INFO_MEDIATYPE, makeAny( OUString(MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII) ) );
+ xProp->setPropertyValue( INFO_MEDIATYPE, Any( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII ) );
OUString aVersion;
SvtSaveOptions::ODFSaneDefaultVersion const nDefVersion =
- aSaveOpt.GetODFSaneDefaultVersion();
+ GetODFSaneDefaultVersion();
// older versions can not have this property set,
// it exists only starting from ODF1.2
if (nDefVersion >= SvtSaveOptions::ODFSVER_013)
@@ -1674,7 +1663,7 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
{
try
{
- xProp->setPropertyValue("Version" , uno::makeAny(aVersion));
+ xProp->setPropertyValue("Version" , uno::Any(aVersion));
}
catch (const uno::Exception&)
{
@@ -1687,11 +1676,11 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
Sequence< PropertyValue > aMediaDescriptor;
_rMediaDescriptor >>= aMediaDescriptor;
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("settings.xml")));
+ xInfoSet->setPropertyValue("StreamName", uno::Any(OUString("settings.xml")));
WriteThroughComponent( xComponent, "settings.xml", "com.sun.star.comp.sdb.XMLSettingsExporter",
aDelegatorArguments, aMediaDescriptor, _rxTargetStorage );
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
+ xInfoSet->setPropertyValue("StreamName", uno::Any(OUString("content.xml")));
WriteThroughComponent( xComponent, "content.xml", "com.sun.star.comp.sdb.DBExportFilter",
aDelegatorArguments, aMediaDescriptor, _rxTargetStorage );
@@ -1772,7 +1761,7 @@ void ODatabaseDocument::impl_notifyStorageChange_nolck_nothrow( const Reference<
{
Reference< XInterface > xMe( *this );
- m_aStorageListeners.forEach< XStorageChangeListener >(
+ m_aStorageListeners.forEach(
[&xMe, &xNewRootStorage] (uno::Reference<XStorageChangeListener> const& xListener) {
return xListener->notifyStorageChange(xMe, xNewRootStorage);
});
@@ -1864,6 +1853,11 @@ void ODatabaseDocument::disposing()
void SAL_CALL ODatabaseDocument::dispose( )
{
::cppu::WeakComponentImplHelperBase::dispose();
+ m_xTitleHelper.clear();
+ m_xModuleManager.clear();
+ m_pEventExecutor.clear();
+ m_xCurrentController.clear();
+ m_xUIConfigurationManager.clear();
}
void SAL_CALL ODatabaseDocument::addEventListener( const Reference< lang::XEventListener >& _xListener )
@@ -1906,7 +1900,6 @@ comphelper::PropertyMapEntry const aEmbeddedImportInfoMap[] =
{OUString("StreamRelPath"), 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
{OUString("StreamName"), 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
{OUString("SourceStorage"), 0, cppu::UnoType<embed::XStorage>::get(), beans::PropertyAttribute::MAYBEVOID, 0},
- {OUString(), 0, css::uno::Type(), 0, 0}
};
}
@@ -1915,13 +1908,11 @@ void SAL_CALL ODatabaseDocument::loadFromStorage(const Reference<XStorage>& xSto
DocumentGuard aGuard(*this, DocumentGuard::InitMethod);
uno::Reference<beans::XPropertySet> xInfoSet(comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(aEmbeddedImportInfoMap)));
- comphelper::NamedValueCollection aDescriptor(rMediaDescriptor);
- xInfoSet->setPropertyValue("StreamRelPath", uno::makeAny(aDescriptor.getOrDefault("HierarchicalDocumentName", OUString())));
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
- xInfoSet->setPropertyValue("SourceStorage", uno::makeAny(xStorage));
+ xInfoSet->setPropertyValue("StreamRelPath", uno::Any(comphelper::NamedValueCollection::getOrDefault(rMediaDescriptor, u"HierarchicalDocumentName", OUString())));
+ xInfoSet->setPropertyValue("StreamName", uno::Any(OUString("content.xml")));
+ xInfoSet->setPropertyValue("SourceStorage", uno::Any(xStorage));
- uno::Sequence<uno::Any> aFilterCreationArgs(1);
- aFilterCreationArgs[0] <<= xInfoSet;
+ uno::Sequence<uno::Any> aFilterCreationArgs{ Any(xInfoSet) };
uno::Reference<document::XImporter> xImporter(m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.sdb.DBFilter", aFilterCreationArgs, m_pImpl->m_aContext), uno::UNO_QUERY_THROW);
@@ -2034,7 +2025,7 @@ struct CreateAny
{
Any operator() (const Reference<XController>& lhs) const
{
- return makeAny(lhs);
+ return Any(lhs);
}
};
@@ -2091,10 +2082,7 @@ Reference< XTitle > const & ODatabaseDocument::impl_getTitleHelper_throw()
Reference< XUntitledNumbers > xDesktop(Desktop::create(m_pImpl->m_aContext), uno::UNO_QUERY_THROW);
Reference< frame::XModel > xThis (getThis(), uno::UNO_QUERY_THROW);
- ::framework::TitleHelper* pHelper = new ::framework::TitleHelper(m_pImpl->m_aContext);
- m_xTitleHelper.set(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
- pHelper->setOwner (xThis );
- pHelper->connectWithUntitledNumbers (xDesktop);
+ m_xTitleHelper = new ::framework::TitleHelper(m_pImpl->m_aContext, xThis, xDesktop);
}
return m_xTitleHelper;
@@ -2106,23 +2094,17 @@ uno::Reference< frame::XUntitledNumbers > ODatabaseDocument::impl_getUntitledHel
m_xModuleManager.set( ModuleManager::create(m_pImpl->m_aContext) );
OUString sModuleId;
- try
- {
- sModuleId = m_xModuleManager->identify( _xComponent );
- }
- catch(const uno::Exception&)
- {
- }
+ if (_xComponent.is())
+ sModuleId = m_xModuleManager->identify(_xComponent);
+
uno::Reference< frame::XUntitledNumbers > xNumberedControllers;
TNumberedController::const_iterator aFind = m_aNumberedControllers.find(sModuleId);
if ( aFind == m_aNumberedControllers.end() )
{
- uno::Reference< frame::XModel > xThis(static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW);
- ::comphelper::NumberedCollection* pHelper = new ::comphelper::NumberedCollection();
- xNumberedControllers.set(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW);
-
- pHelper->setOwner (xThis);
+ rtl::Reference<::comphelper::NumberedCollection> pHelper = new ::comphelper::NumberedCollection();
+ xNumberedControllers = pHelper;
+ pHelper->setOwner(uno::Reference< frame::XModel >(this));
m_aNumberedControllers.emplace( sModuleId,xNumberedControllers );
}
@@ -2203,11 +2185,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
com_sun_star_comp_dba_ODatabaseDocument(css::uno::XComponentContext* context,
css::uno::Sequence<css::uno::Any> const &)
{
- Reference<XUnoTunnel> xDBContextTunnel(DatabaseContext::create(context), UNO_QUERY_THROW);
- dbaccess::ODatabaseContext* pContext = reinterpret_cast<dbaccess::ODatabaseContext*>(
- xDBContextTunnel->getSomething(
- dbaccess::ODatabaseContext::getUnoTunnelId()));
-
+ Reference<XInterface> xDBContextTunnel(DatabaseContext::create(context), UNO_QUERY_THROW);
+ rtl::Reference<dbaccess::ODatabaseContext> pContext
+ = dynamic_cast<dbaccess::ODatabaseContext*>(xDBContextTunnel.get());
+ assert(pContext);
+
rtl::Reference pImpl(
new dbaccess::ODatabaseModelImpl(context, *pContext));
css::uno::Reference<XInterface> inst(pImpl->createNewModel_deliverOwnership());
diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx
index 8adb30c541a1..6278aa039a63 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.hxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEDOCUMENT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEDOCUMENT_HXX
+#pragma once
#include <sal/config.h>
@@ -29,7 +28,7 @@
#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
#include <com/sun/star/frame/DoubleInitializationException.hpp>
-#include <com/sun/star/frame/XModel2.hpp>
+#include <com/sun/star/frame/XModel3.hpp>
#include <com/sun/star/frame/XTitle.hpp>
#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
#include <com/sun/star/frame/XUntitledNumbers.hpp>
@@ -58,6 +57,7 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/util/XModifiable.hpp>
+#include <comphelper/interfacecontainer3.hxx>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/implbase3.hxx>
#include <rtl/ref.hxx>
@@ -131,7 +131,7 @@ private:
};
// ODatabaseDocument
-typedef cppu::PartialWeakComponentImplHelper< css::frame::XModel2
+typedef cppu::PartialWeakComponentImplHelper< css::frame::XModel3
, css::util::XModifiable
, css::frame::XStorable
, css::document::XEventBroadcaster
@@ -148,16 +148,13 @@ typedef cppu::PartialWeakComponentImplHelper< css::frame::XModel2
, css::document::XEventsSupplier
, css::frame::XLoadable
, css::document::XDocumentRecovery
+ , css::frame::XTitle
+ , css::frame::XTitleChangeBroadcaster
+ , css::frame::XUntitledNumbers
> ODatabaseDocument_OfficeDocument;
-typedef ::cppu::ImplHelper3< css::frame::XTitle
- , css::frame::XTitleChangeBroadcaster
- , css::frame::XUntitledNumbers
- > ODatabaseDocument_Title;
-
class ODatabaseDocument :public ModelDependentComponent // ModelDependentComponent must be first!
,public ODatabaseDocument_OfficeDocument
- ,public ODatabaseDocument_Title
{
enum InitState
{
@@ -169,9 +166,9 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe
typedef std::map< OUString, css::uno::Reference< css::frame::XUntitledNumbers > > TNumberedController;
css::uno::Reference< css::ui::XUIConfigurationManager2> m_xUIConfigurationManager;
- ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aCloseListener;
- ::comphelper::OInterfaceContainerHelper2 m_aStorageListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> m_aModifyListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XCloseListener> m_aCloseListener;
+ ::comphelper::OInterfaceContainerHelper3<css::document::XStorageChangeListener> m_aStorageListeners;
std::unique_ptr<DocumentEvents> m_pEventContainer;
::rtl::Reference< DocumentEventExecutor > m_pEventExecutor;
@@ -287,7 +284,7 @@ protected:
public:
struct FactoryAccess { friend class ODatabaseModelImpl; private: FactoryAccess() { } };
- static ODatabaseDocument* createDatabaseDocument( const ::rtl::Reference<ODatabaseModelImpl>& _pImpl, FactoryAccess /*accessControl*/ )
+ static rtl::Reference<ODatabaseDocument> createDatabaseDocument( const ::rtl::Reference<ODatabaseModelImpl>& _pImpl, FactoryAccess /*accessControl*/ )
{
return new ODatabaseDocument( _pImpl );
}
@@ -299,8 +296,6 @@ public:
// XInterface
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) override;
- virtual void SAL_CALL acquire( ) throw () override;
- virtual void SAL_CALL release( ) throw () override;
// XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
@@ -331,6 +326,9 @@ public:
virtual css::uno::Reference< css::frame::XController2 > SAL_CALL createViewController( const OUString& ViewName, const css::uno::Sequence< css::beans::PropertyValue >& Arguments, const css::uno::Reference< css::frame::XFrame >& Frame ) override ;
virtual void SAL_CALL setArgs(const css::uno::Sequence<css::beans::PropertyValue>& aArgs) override;
+ // XModel3
+ virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL getArgs2( const ::css::uno::Sequence< ::rtl::OUString >& requestedArgs ) override;
+
// XStorable
virtual sal_Bool SAL_CALL hasLocation( ) override ;
virtual OUString SAL_CALL getLocation( ) override ;
@@ -626,7 +624,7 @@ private:
*/
void impl_throwIOExceptionCausedBySave_throw(
const css::uno::Any& i_rError,
- const OUString& i_rTargetURL
+ std::u16string_view i_rTargetURL
) const;
};
@@ -746,6 +744,5 @@ private:
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEDOCUMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
index c147f99ec694..3b19de41c366 100644
--- a/dbaccess/source/core/dataaccess/databaseregistrations.cxx
+++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
@@ -26,8 +26,8 @@
#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
#include <cppuhelper/basemutex.hxx>
-#include <comphelper/interfacecontainer2.hxx>
-#include <cppuhelper/implbase1.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <cppuhelper/implbase.hxx>
#include <osl/diagnose.h>
#include <unotools/pathoptions.hxx>
#include <tools/urlobj.hxx>
@@ -39,7 +39,7 @@ namespace dbaccess
{
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::container::NoSuchElementException;
@@ -51,24 +51,13 @@ namespace dbaccess
using ::com::sun::star::sdb::DatabaseRegistrationEvent;
using ::com::sun::star::uno::XAggregation;
- static OUString getConfigurationRootPath()
- {
- return "org.openoffice.Office.DataAccess/RegisteredNames";
- }
-
- static OUString getLocationNodeName()
- {
- return "Location";
- }
-
- static OUString getNameNodeName()
- {
- return "Name";
- }
+ constexpr OUString CONF_ROOT_PATH = u"org.openoffice.Office.DataAccess/RegisteredNames"_ustr;
+ constexpr OUString LOCATION = u"Location"_ustr;
+ constexpr OUString NAME = u"Name"_ustr;
// DatabaseRegistrations - declaration
- typedef ::cppu::WeakAggImplHelper1 < XDatabaseRegistrations
- > DatabaseRegistrations_Base;
+ typedef ::cppu::WeakImplHelper< XDatabaseRegistrations
+ > DatabaseRegistrations_Base;
namespace {
@@ -94,13 +83,13 @@ namespace dbaccess
private:
void
- impl_checkValidName_common(const OUString& _rName);
+ impl_checkValidName_common(std::u16string_view _rName);
::utl::OConfigurationNode
impl_checkValidName_throw_must_exist(const OUString& _rName);
::utl::OConfigurationNode
impl_checkValidName_throw_must_not_exist(const OUString& _rName);
- void impl_checkValidLocation_throw( const OUString& _rLocation );
+ void impl_checkValidLocation_throw( std::u16string_view _rLocation );
/** retrieves the configuration node whose "Name" sub node has the given value
@@ -131,12 +120,12 @@ namespace dbaccess
::utl::OConfigurationNode
- impl_getNodeForName_nothrow(const OUString& _rName);
+ impl_getNodeForName_nothrow(std::u16string_view _rName);
private:
Reference<XComponentContext> m_aContext;
::utl::OConfigurationTreeRoot m_aConfigurationRoot;
- ::comphelper::OInterfaceContainerHelper2 m_aRegistrationListeners;
+ ::comphelper::OInterfaceContainerHelper3<XDatabaseRegistrationsListener> m_aRegistrationListeners;
};
}
@@ -144,18 +133,17 @@ namespace dbaccess
// DatabaseRegistrations - implementation
DatabaseRegistrations::DatabaseRegistrations( const Reference<XComponentContext> & _rxContext )
:m_aContext( _rxContext )
- ,m_aConfigurationRoot()
,m_aRegistrationListeners( m_aMutex )
{
m_aConfigurationRoot = ::utl::OConfigurationTreeRoot::createWithComponentContext(
- m_aContext, getConfigurationRootPath() );
+ m_aContext, CONF_ROOT_PATH );
}
DatabaseRegistrations::~DatabaseRegistrations()
{
}
- ::utl::OConfigurationNode DatabaseRegistrations::impl_getNodeForName_nothrow( const OUString& _rName )
+ ::utl::OConfigurationNode DatabaseRegistrations::impl_getNodeForName_nothrow( std::u16string_view _rName )
{
const Sequence< OUString > aNames( m_aConfigurationRoot.getNodeNames() );
for ( auto const & nodeName : aNames )
@@ -163,7 +151,7 @@ namespace dbaccess
::utl::OConfigurationNode aNodeForName = m_aConfigurationRoot.openNode( nodeName );
OUString sTestName;
- OSL_VERIFY( aNodeForName.getNodeValue( getNameNodeName() ) >>= sTestName );
+ OSL_VERIFY( aNodeForName.getNodeValue( NAME ) >>= sTestName );
if ( sTestName == _rName )
return aNodeForName;
}
@@ -197,16 +185,16 @@ namespace dbaccess
}
::utl::OConfigurationNode aNewNode( m_aConfigurationRoot.createNode( sNewNodeName ) );
- aNewNode.setNodeValue( getNameNodeName(), makeAny( _rName ) );
+ aNewNode.setNodeValue( NAME, Any( _rName ) );
return aNewNode;
}
- void DatabaseRegistrations::impl_checkValidName_common(const OUString& _rName)
+ void DatabaseRegistrations::impl_checkValidName_common(std::u16string_view _rName)
{
if ( !m_aConfigurationRoot.isValid() )
throw RuntimeException( OUString(), *this );
- if ( _rName.isEmpty() )
+ if ( _rName.empty() )
throw IllegalArgumentException( OUString(), *this, 1 );
}
@@ -222,9 +210,9 @@ namespace dbaccess
return impl_getNodeForName_throw_must_not_exist(_rName);
}
- void DatabaseRegistrations::impl_checkValidLocation_throw( const OUString& _rLocation )
+ void DatabaseRegistrations::impl_checkValidLocation_throw( std::u16string_view _rLocation )
{
- if ( _rLocation.isEmpty() )
+ if ( _rLocation.empty() )
throw IllegalArgumentException( OUString(), *this, 2 );
INetURLObject aURL( _rLocation );
@@ -252,7 +240,7 @@ namespace dbaccess
for ( auto const & name : aProgrammaticNames )
{
::utl::OConfigurationNode aRegistrationNode = m_aConfigurationRoot.openNode( name );
- OSL_VERIFY( aRegistrationNode.getNodeValue( getNameNodeName() ) >>= *pDisplayName );
+ OSL_VERIFY( aRegistrationNode.getNodeValue( NAME ) >>= *pDisplayName );
++pDisplayName;
}
@@ -266,7 +254,7 @@ namespace dbaccess
::utl::OConfigurationNode aNodeForName = impl_checkValidName_throw_must_exist(Name);
OUString sLocation;
- OSL_VERIFY( aNodeForName.getNodeValue( getLocationNodeName() ) >>= sLocation );
+ OSL_VERIFY( aNodeForName.getNodeValue( LOCATION ) >>= sLocation );
sLocation = SvtPathOptions().SubstituteVariable( sLocation );
return sLocation;
@@ -281,7 +269,7 @@ namespace dbaccess
::utl::OConfigurationNode aDataSourceRegistration = impl_checkValidName_throw_must_not_exist(Name);
// register
- aDataSourceRegistration.setNodeValue( getLocationNodeName(), makeAny( Location ) );
+ aDataSourceRegistration.setNodeValue( LOCATION, Any( Location ) );
m_aConfigurationRoot.commit();
// notify
@@ -299,7 +287,7 @@ namespace dbaccess
// obtain properties for notification
OUString sLocation;
- OSL_VERIFY( aNodeForName.getNodeValue( getLocationNodeName() ) >>= sLocation );
+ OSL_VERIFY( aNodeForName.getNodeValue( LOCATION ) >>= sLocation );
// revoke
if ( aNodeForName.isReadonly()
@@ -328,10 +316,10 @@ namespace dbaccess
// obtain properties for notification
OUString sOldLocation;
- OSL_VERIFY( aDataSourceRegistration.getNodeValue( getLocationNodeName() ) >>= sOldLocation );
+ OSL_VERIFY( aDataSourceRegistration.getNodeValue( LOCATION ) >>= sOldLocation );
// change
- aDataSourceRegistration.setNodeValue( getLocationNodeName(), makeAny( NewLocation ) );
+ aDataSourceRegistration.setNodeValue( LOCATION, Any( NewLocation ) );
m_aConfigurationRoot.commit();
// notify
@@ -360,7 +348,7 @@ namespace dbaccess
}
// DatabaseRegistrations - factory
- Reference< XAggregation > createDataSourceRegistrations( const Reference<XComponentContext> & _rxContext )
+ Reference< XDatabaseRegistrations > createDataSourceRegistrations( const Reference<XComponentContext> & _rxContext )
{
return new DatabaseRegistrations( _rxContext );
}
diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.hxx b/dbaccess/source/core/dataaccess/databaseregistrations.hxx
index 5e6680cc3f13..52def1de5aa2 100644
--- a/dbaccess/source/core/dataaccess/databaseregistrations.hxx
+++ b/dbaccess/source/core/dataaccess/databaseregistrations.hxx
@@ -17,20 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEREGISTRATIONS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEREGISTRATIONS_HXX
+#pragma once
#include <com/sun/star/uno/XAggregation.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
namespace dbaccess
{
-
- css::uno::Reference< css::uno::XAggregation >
- createDataSourceRegistrations( const css::uno::Reference< css::uno::XComponentContext >& _rxContext );
+css::uno::Reference<css::sdb::XDatabaseRegistrations>
+createDataSourceRegistrations(const css::uno::Reference<css::uno::XComponentContext>& _rxContext);
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATABASEREGISTRATIONS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 002d01b21bb2..fbb0ac1bd86b 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -22,6 +22,7 @@
#include <stringconstants.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
#include "connection.hxx"
#include "SharedConnection.hxx"
#include "databasedocument.hxx"
@@ -54,14 +55,13 @@
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
#include <cppuhelper/typeprovider.hxx>
-#include <tools/diagnose_ex.h>
+#include <officecfg/Office/Common.hxx>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <osl/process.h>
#include <sal/log.hxx>
-#include <svtools/miscopt.hxx>
#include <tools/urlobj.hxx>
#include <unotools/sharedunocomponent.hxx>
-#include <rtl/digest.h>
#include <algorithm>
#include <iterator>
@@ -180,7 +180,7 @@ void SAL_CALL FlushNotificationAdapter::disposing( const EventObject& Source )
}
OAuthenticationContinuation::OAuthenticationContinuation()
- :m_bRemberPassword(true), // TODO: a meaningful default
+ :m_bRememberPassword(true), // TODO: a meaningful default
m_bCanSetUserName(true)
{
}
@@ -219,14 +219,13 @@ void SAL_CALL OAuthenticationContinuation::setPassword( const OUString& _rPasswo
Sequence< RememberAuthentication > SAL_CALL OAuthenticationContinuation::getRememberPasswordModes( RememberAuthentication& _reDefault )
{
- Sequence< RememberAuthentication > aReturn(1);
- _reDefault = aReturn[0] = RememberAuthentication_SESSION;
- return aReturn;
+ _reDefault = RememberAuthentication_SESSION;
+ return { _reDefault };
}
void SAL_CALL OAuthenticationContinuation::setRememberPassword( RememberAuthentication _eRemember )
{
- m_bRemberPassword = (RememberAuthentication_NO != _eRemember);
+ m_bRememberPassword = (RememberAuthentication_NO != _eRemember);
}
sal_Bool SAL_CALL OAuthenticationContinuation::canSetAccount( )
@@ -241,10 +240,8 @@ void SAL_CALL OAuthenticationContinuation::setAccount( const OUString& )
Sequence< RememberAuthentication > SAL_CALL OAuthenticationContinuation::getRememberAccountModes( RememberAuthentication& _reDefault )
{
- Sequence < RememberAuthentication > aReturn(1);
- aReturn[0] = RememberAuthentication_NO;
_reDefault = RememberAuthentication_NO;
- return aReturn;
+ return { RememberAuthentication_NO };
}
void SAL_CALL OAuthenticationContinuation::setRememberAccount( RememberAuthentication /*Remember*/ )
@@ -252,69 +249,6 @@ void SAL_CALL OAuthenticationContinuation::setRememberAccount( RememberAuthentic
SAL_WARN("dbaccess","OAuthenticationContinuation::setRememberAccount: not supported!");
}
-namespace {
-
-/** The class OSharedConnectionManager implements a structure to share connections.
- It owns the master connections which will be disposed when the last connection proxy is gone.
-*/
-// need to hold the digest
-struct TDigestHolder
-{
- sal_uInt8 m_pBuffer[RTL_DIGEST_LENGTH_SHA1];
- TDigestHolder()
- {
- m_pBuffer[0] = 0;
- }
-
-};
-
-}
-
-class OSharedConnectionManager : public ::cppu::WeakImplHelper< XEventListener >
-{
-
- // contains the currently used master connections
- struct TConnectionHolder
- {
- Reference< XConnection > xMasterConnection;
- oslInterlockedCount nALiveCount;
- };
-
- // the less-compare functor, used for the stl::map
- struct TDigestLess
- {
- bool operator() (const TDigestHolder& x, const TDigestHolder& y) const
- {
- sal_uInt32 i;
- for(i=0;i < RTL_DIGEST_LENGTH_SHA1 && (x.m_pBuffer[i] >= y.m_pBuffer[i]); ++i)
- ;
- return i < RTL_DIGEST_LENGTH_SHA1;
- }
- };
-
- typedef std::map< TDigestHolder,TConnectionHolder,TDigestLess> TConnectionMap; // holds the master connections
- typedef std::map< Reference< XConnection >,TConnectionMap::iterator> TSharedConnectionMap;// holds the shared connections
-
- ::osl::Mutex m_aMutex;
- TConnectionMap m_aConnections; // remember the master connection in conjunction with the digest
- TSharedConnectionMap m_aSharedConnection; // the shared connections with conjunction with an iterator into the connections map
- Reference< XProxyFactory > m_xProxyFactory;
-
-protected:
- virtual ~OSharedConnectionManager() override;
-
-public:
- explicit OSharedConnectionManager(const Reference< XComponentContext >& _rxContext);
-
- void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
- Reference<XConnection> getConnection( const OUString& url,
- const OUString& user,
- const OUString& password,
- const Sequence< PropertyValue >& _aInfo,
- ODatabaseSource* _pDataSource);
- void addEventListener(const Reference<XConnection>& _rxConnection, TConnectionMap::iterator const & _rIter);
-};
-
OSharedConnectionManager::OSharedConnectionManager(const Reference< XComponentContext >& _rxContext)
{
m_xProxyFactory.set( ProxyFactory::create( _rxContext ) );
@@ -352,10 +286,11 @@ Reference<XConnection> OSharedConnectionManager::getConnection( const OUString&
Sequence< PropertyValue > aInfoCopy(_aInfo);
sal_Int32 nPos = aInfoCopy.getLength();
aInfoCopy.realloc( nPos + 2 );
- aInfoCopy[nPos].Name = "TableFilter";
- aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableFilter;
- aInfoCopy[nPos].Name = "TableTypeFilter";
- aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableTypeFilter;
+ auto pInfoCopy = aInfoCopy.getArray();
+ pInfoCopy[nPos].Name = "TableFilter";
+ pInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableFilter;
+ pInfoCopy[nPos].Name = "TableTypeFilter";
+ pInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableTypeFilter;
OUString sUser = user;
OUString sPassword = password;
@@ -381,7 +316,7 @@ Reference<XConnection> OSharedConnectionManager::getConnection( const OUString&
Reference<XConnection> xRet;
if ( aIter->second.xMasterConnection.is() )
{
- Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(aIter->second.xMasterConnection.get());
+ Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(aIter->second.xMasterConnection);
xRet = new OSharedConnection(xConProxy);
m_aSharedConnection.emplace(xRet,aIter);
addEventListener(xRet,aIter);
@@ -531,12 +466,12 @@ Any ODatabaseSource::queryInterface( const Type & rType )
return aIface;
}
-void ODatabaseSource::acquire() throw ()
+void ODatabaseSource::acquire() noexcept
{
ODatabaseSource_Base::acquire();
}
-void ODatabaseSource::release() throw ()
+void ODatabaseSource::release() noexcept
{
ODatabaseSource_Base::release();
}
@@ -609,17 +544,15 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
if ( xModel)
{
//See ODbTypeWizDialogSetup::SaveDatabaseDocument
- ::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
- aArgs.get("IgnoreFirebirdMigration") >>= bIgnoreMigration;
+ ::comphelper::NamedValueCollection::get(xModel->getArgs(), u"IgnoreFirebirdMigration") >>= bIgnoreMigration;
}
else
{
//ignore when we don't have a model. E.g. Mailmerge, data sources, fields...
bIgnoreMigration = true;
}
- SvtMiscOptions aMiscOptions;
- if (!aMiscOptions.IsExperimentalMode())
+ if (!officecfg::Office::Common::Misc::ExperimentalMode::get())
bIgnoreMigration = true;
if(!bIgnoreMigration && m_pImpl->m_sConnectURL == "sdbc:embedded:hsqldb")
@@ -645,7 +578,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
if (bNeedMigration)
{
// back up content xml file if migration was successful
- constexpr char BACKUP_XML_NAME[] = "content_before_migration.xml";
+ static constexpr OUString BACKUP_XML_NAME = u"content_before_migration.xml"_ustr;
try
{
if(xRootStorage->isStreamElement(BACKUP_XML_NAME))
@@ -680,7 +613,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
sPwd = m_pImpl->m_aPassword;
}
- const char* pExceptionMessageId = RID_STR_COULDNOTCONNECT_UNSPECIFIED;
+ TranslateId pExceptionMessageId = RID_STR_COULDNOTCONNECT_UNSPECIFIED;
if (xManager.is())
{
sal_Int32 nAdditionalArgs(0);
@@ -688,17 +621,18 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
if (!sPwd.isEmpty()) ++nAdditionalArgs;
Sequence< PropertyValue > aUserPwd(nAdditionalArgs);
+ auto aUserPwdRange = asNonConstRange(aUserPwd);
sal_Int32 nArgPos = 0;
if (!sUser.isEmpty())
{
- aUserPwd[ nArgPos ].Name = "user";
- aUserPwd[ nArgPos ].Value <<= sUser;
+ aUserPwdRange[ nArgPos ].Name = "user";
+ aUserPwdRange[ nArgPos ].Value <<= sUser;
++nArgPos;
}
if (!sPwd.isEmpty())
{
- aUserPwd[ nArgPos ].Name = "password";
- aUserPwd[ nArgPos ].Value <<= sPwd;
+ aUserPwdRange[ nArgPos ].Name = "password";
+ aUserPwdRange[ nArgPos ].Value <<= sPwd;
}
Reference< XDriver > xDriver;
try
@@ -733,16 +667,17 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
{
sal_Int32 nCount = aDriverInfo.getLength();
aDriverInfo.realloc(nCount + 3 );
+ auto pDriverInfo = aDriverInfo.getArray();
- aDriverInfo[nCount].Name = "URL";
- aDriverInfo[nCount++].Value <<= m_pImpl->getURL();
+ pDriverInfo[nCount].Name = "URL";
+ pDriverInfo[nCount++].Value <<= m_pImpl->getURL();
- aDriverInfo[nCount].Name = "Storage";
+ pDriverInfo[nCount].Name = "Storage";
Reference< css::document::XDocumentSubStorageSupplier> xDocSup( m_pImpl->getDocumentSubStorageSupplier() );
- aDriverInfo[nCount++].Value <<= xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE);
+ pDriverInfo[nCount++].Value <<= xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE);
- aDriverInfo[nCount].Name = "Document";
- aDriverInfo[nCount++].Value <<= getDatabaseDocument();
+ pDriverInfo[nCount].Name = "Document";
+ pDriverInfo[nCount++].Value <<= getDatabaseDocument();
}
if (nAdditionalArgs)
xReturn = xManager->getConnectionWithInfo(m_pImpl->m_sConnectURL, ::comphelper::concatSequences(aUserPwd,aDriverInfo));
@@ -767,11 +702,11 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
OUString sMessage = DBA_RES(pExceptionMessageId)
.replaceAll("$name$", m_pImpl->m_sConnectURL);
- SQLContext aContext;
- aContext.Message = DBA_RES(RID_STR_CONNECTION_REQUEST).
- replaceFirst("$name$", m_pImpl->m_sConnectURL);
+ SQLContext aContext(
+ DBA_RES(RID_STR_CONNECTION_REQUEST).replaceFirst("$name$", m_pImpl->m_sConnectURL),
+ {}, {}, 0, {}, {});
- throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), makeAny( aContext ) );
+ throwGenericSQLException( sMessage, static_cast< XDataSource* >( this ), Any( aContext ) );
}
#if ENABLE_FIREBIRD_SDBC
@@ -797,21 +732,26 @@ Reference< XPropertySetInfo > ODatabaseSource::getPropertySetInfo()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* ODatabaseSource::createArrayHelper( ) const
{
- BEGIN_PROPERTY_HELPER(13)
- DECL_PROP1(INFO, Sequence< PropertyValue >, BOUND);
- DECL_PROP1_BOOL(ISPASSWORDREQUIRED, BOUND);
- DECL_PROP1_BOOL(ISREADONLY, READONLY);
- DECL_PROP1(LAYOUTINFORMATION, Sequence< PropertyValue >, BOUND);
- DECL_PROP1(NAME, OUString, READONLY);
- DECL_PROP2_IFACE(NUMBERFORMATSSUPPLIER, XNumberFormatsSupplier, READONLY, TRANSIENT);
- DECL_PROP1(PASSWORD, OUString, TRANSIENT);
- DECL_PROP2_IFACE(SETTINGS, XPropertySet, BOUND, READONLY);
- DECL_PROP1_BOOL(SUPPRESSVERSIONCL, BOUND);
- DECL_PROP1(TABLEFILTER, Sequence< OUString >,BOUND);
- DECL_PROP1(TABLETYPEFILTER, Sequence< OUString >,BOUND);
- DECL_PROP1(URL, OUString, BOUND);
- DECL_PROP1(USER, OUString, BOUND);
- END_PROPERTY_HELPER();
+ return new ::cppu::OPropertyArrayHelper
+ {
+ {
+ // a change here means a change should also been done in OApplicationController::disposing()
+ { PROPERTY_INFO, PROPERTY_ID_INFO, cppu::UnoType<Sequence< PropertyValue >>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_ISPASSWORDREQUIRED, PROPERTY_ID_ISPASSWORDREQUIRED, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_ISREADONLY, PROPERTY_ID_ISREADONLY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, cppu::UnoType<Sequence< PropertyValue >>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_NAME, PROPERTY_ID_NAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_NUMBERFORMATSSUPPLIER, PROPERTY_ID_NUMBERFORMATSSUPPLIER, cppu::UnoType<XNumberFormatsSupplier>::get(),
+ css::beans::PropertyAttribute::READONLY | css::beans::PropertyAttribute::TRANSIENT },
+ { PROPERTY_PASSWORD, PROPERTY_ID_PASSWORD, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::TRANSIENT },
+ { PROPERTY_SETTINGS, PROPERTY_ID_SETTINGS, cppu::UnoType<XPropertySet>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::READONLY },
+ { PROPERTY_SUPPRESSVERSIONCL, PROPERTY_ID_SUPPRESSVERSIONCL, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_TABLEFILTER, PROPERTY_ID_TABLEFILTER, cppu::UnoType<Sequence< OUString >>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_TABLETYPEFILTER, PROPERTY_ID_TABLETYPEFILTER, cppu::UnoType<Sequence< OUString >>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_URL, PROPERTY_ID_URL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND },
+ { PROPERTY_USER, PROPERTY_ID_USER, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND }
+ }
+ };
}
// cppu::OPropertySetHelper
@@ -858,7 +798,7 @@ sal_Bool ODatabaseSource::convertFastPropertyValue(Any & rConvertedValue, Any &
if (!(rValue >>= aValues))
throw IllegalArgumentException();
- for ( auto const & checkName : std::as_const(aValues) )
+ for (auto const& checkName : aValues)
{
if ( checkName.Name.isEmpty() )
throw IllegalArgumentException();
@@ -870,7 +810,7 @@ sal_Bool ODatabaseSource::convertFastPropertyValue(Any & rConvertedValue, Any &
{
const PropertyValue* pInfoIter = aSettings.getConstArray();
const PropertyValue* checkValue = aValues.getConstArray();
- for ( ;!bModified && checkValue != aValues.end() ; ++checkValue,++pInfoIter)
+ for ( ;!bModified && checkValue != std::cend(aValues) ; ++checkValue,++pInfoIter)
{
bModified = checkValue->Name != pInfoIter->Name;
if ( !bModified )
@@ -1050,13 +990,15 @@ void ODatabaseSource::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) con
// transform them so that only property values which fulfill certain
// criteria survive
Sequence< PropertyValue > aNonDefaultOrUserDefined( aValues.getLength() );
+ auto [begin, end] = asNonConstRange(aValues);
+ auto pCopyStart = aNonDefaultOrUserDefined.getArray();
const PropertyValue* pCopyEnd = std::remove_copy_if(
- aValues.begin(),
- aValues.end(),
- aNonDefaultOrUserDefined.getArray(),
+ begin,
+ end,
+ pCopyStart,
IsDefaultAndNotRemoveable( aPropertyAttributes )
);
- aNonDefaultOrUserDefined.realloc( pCopyEnd - aNonDefaultOrUserDefined.getArray() );
+ aNonDefaultOrUserDefined.realloc( pCopyEnd - pCopyStart );
rValue <<= aNonDefaultOrUserDefined;
}
catch( const Exception& )
@@ -1138,8 +1080,8 @@ Reference< XConnection > ODatabaseSource::connectWithCompletion( const Reference
// build an interaction request
// two continuations (Ok and Cancel)
- OInteractionAbort* pAbort = new OInteractionAbort;
- OAuthenticationContinuation* pAuthenticate = new OAuthenticationContinuation;
+ rtl::Reference<OInteractionAbort> pAbort = new OInteractionAbort;
+ rtl::Reference<OAuthenticationContinuation> pAuthenticate = new OAuthenticationContinuation;
// the name which should be referred in the login dialog
OUString sServerName( m_pImpl->m_sName );
@@ -1154,8 +1096,7 @@ Reference< XConnection > ODatabaseSource::connectWithCompletion( const Reference
aRequest.HasUserName = aRequest.HasPassword = true;
aRequest.UserName = m_pImpl->m_sUser;
aRequest.Password = m_pImpl->m_sFailedPassword.isEmpty() ? m_pImpl->m_aPassword : m_pImpl->m_sFailedPassword;
- OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest));
- Reference< XInteractionRequest > xRequest(pRequest);
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
pRequest->addContinuation(pAbort);
pRequest->addContinuation(pAuthenticate);
@@ -1163,7 +1104,7 @@ Reference< XConnection > ODatabaseSource::connectWithCompletion( const Reference
// handle the request
try
{
- _rxHandler->handle(xRequest);
+ _rxHandler->handle(pRequest);
}
catch(Exception&)
{
@@ -1230,10 +1171,9 @@ Reference< XConnection > ODatabaseSource::getConnection(const OUString& user, co
{ // create a new proxy for the connection
if ( !m_pImpl->m_xSharedConnectionManager.is() )
{
- m_pImpl->m_pSharedConnectionManager = new OSharedConnectionManager( m_pImpl->m_aContext );
- m_pImpl->m_xSharedConnectionManager = m_pImpl->m_pSharedConnectionManager;
+ m_pImpl->m_xSharedConnectionManager = new OSharedConnectionManager( m_pImpl->m_aContext );
}
- xConn = m_pImpl->m_pSharedConnectionManager->getConnection(
+ xConn = m_pImpl->m_xSharedConnectionManager->getConnection(
m_pImpl->m_sConnectURL, user, password, m_pImpl->m_xSettings->getPropertyValues(), this );
}
@@ -1270,14 +1210,13 @@ Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( )
aValue >>= sSupportService;
if ( !sSupportService.isEmpty() )
{
- Sequence<Any> aArgs(1);
- aArgs[0] <<= NamedValue("DataSource",makeAny(xMy));
+ Sequence<Any> aArgs{ Any(NamedValue("DataSource",Any(xMy))) };
xContainer.set( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(sSupportService, aArgs, m_pImpl->m_aContext), UNO_QUERY);
}
}
if ( !xContainer.is() )
{
- TContentPtr& rContainerData( m_pImpl->getObjectContainer( ODatabaseModelImpl::E_QUERY ) );
+ TContentPtr& rContainerData( m_pImpl->getObjectContainer( ODatabaseModelImpl::ObjectType::Query ) );
xContainer = new OCommandContainer( m_pImpl->m_aContext, *this, rContainerData, false );
}
m_pImpl->m_xCommandDefinitions = xContainer;
@@ -1293,7 +1232,7 @@ Reference< XNameAccess > ODatabaseSource::getTables()
Reference< XNameAccess > xContainer = m_pImpl->m_xTableDefinitions;
if ( !xContainer.is() )
{
- TContentPtr& rContainerData( m_pImpl->getObjectContainer( ODatabaseModelImpl::E_TABLE ) );
+ TContentPtr& rContainerData( m_pImpl->getObjectContainer( ODatabaseModelImpl::ObjectType::Table ) );
xContainer = new OCommandContainer( m_pImpl->m_aContext, *this, rContainerData, true );
m_pImpl->m_xTableDefinitions = xContainer;
}
diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx
index b9d8e8bbf407..5b5985eacd72 100644
--- a/dbaccess/source/core/dataaccess/datasource.hxx
+++ b/dbaccess/source/core/dataaccess/datasource.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATASOURCE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DATASOURCE_HXX
+#pragma once
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -31,6 +30,7 @@
#include <com/sun/star/document/XEventListener.hpp>
#include <com/sun/star/util/XFlushable.hpp>
#include <cppuhelper/propshlp.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <comphelper/proparrhlp.hxx>
#include <cppuhelper/weakref.hxx>
#include <cppuhelper/compbase.hxx>
@@ -84,7 +84,7 @@ private:
using ODatabaseSource_Base::rBHelper;
// note: this thing uses the ref-count of "this", see OBookmarkContainer::acquire!
OBookmarkContainer m_Bookmarks;
- ::comphelper::OInterfaceContainerHelper2 m_aFlushListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::util::XFlushListener> m_aFlushListeners;
private:
virtual ~ODatabaseSource() override;
@@ -122,8 +122,8 @@ public:
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw( ) override;
- virtual void SAL_CALL release() throw( ) override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -217,6 +217,4 @@ protected:
} // namespace dbaccess
-#endif // _DBA_COREDATAACCESS_DATALINK_HXX_
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index dd099c81fa05..807dc5ec98c3 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -18,11 +18,12 @@
*/
#include <definitioncontainer.hxx>
-#include <apitools.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <comphelper/enumhelper.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -32,7 +33,6 @@
#include <com/sun/star/sdb/ErrorCondition.hpp>
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
#include <rtl/ref.hxx>
using namespace ::com::sun::star::uno;
@@ -135,7 +135,14 @@ ODefinitionContainer::~ODefinitionContainer()
}
IMPLEMENT_FORWARD_XINTERFACE2( ODefinitionContainer,OContentHelper,ODefinitionContainer_Base)
-IMPLEMENT_GETTYPES2(ODefinitionContainer,OContentHelper,ODefinitionContainer_Base);
+css::uno::Sequence< css::uno::Type > ODefinitionContainer::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OContentHelper::getTypes( ),
+ ODefinitionContainer_Base::getTypes( )
+ );
+}
+
css::uno::Sequence<sal_Int8> ODefinitionContainer::getImplementationId()
{
@@ -265,7 +272,7 @@ namespace
if ( eVetoDetails >>= aWrappedError )
throw aWrappedError;
- throw WrappedTargetException( xVeto->getReason(), Listener.get(), eVetoDetails );
+ throw WrappedTargetException( xVeto->getReason(), Listener, eVetoDetails );
}
};
}
@@ -280,7 +287,7 @@ void ODefinitionContainer::notifyByName( ResettableMutexGuard& _rGuard, const OU
if ( !rContainer.getLength() )
return;
- ContainerEvent aEvent( *this, makeAny( _rName ), makeAny( _xNewElement ), makeAny( _xOldElement ) );
+ ContainerEvent aEvent( *this, Any( _rName ), Any( _xNewElement ), Any( _xOldElement ) );
_rGuard.clear();
switch ( _eOperation )
@@ -366,7 +373,7 @@ Any SAL_CALL ODefinitionContainer::getByIndex( sal_Int32 _nIndex )
{
MutexGuard aGuard(m_aMutex);
- if ((_nIndex < 0) || (_nIndex >= static_cast<sal_Int32>(m_aDocuments.size())))
+ if ((_nIndex < 0) || (o3tl::make_unsigned(_nIndex) >= m_aDocuments.size()))
throw IndexOutOfBoundsException();
Documents::iterator aPos = m_aDocuments[_nIndex];
@@ -379,14 +386,14 @@ Any SAL_CALL ODefinitionContainer::getByIndex( sal_Int32 _nIndex )
// and update the name-access map
}
- return makeAny(xProp);
+ return Any(xProp);
}
Any SAL_CALL ODefinitionContainer::getByName( const OUString& _rName )
{
MutexGuard aGuard(m_aMutex);
- return makeAny( implGetByName( _rName, true ) );
+ return Any( implGetByName( _rName, true ) );
}
Reference< XContent > ODefinitionContainer::implGetByName(const OUString& _rName, bool _bReadIfNecessary)
@@ -526,7 +533,7 @@ void ODefinitionContainer::implAppend(const OUString& _rName, const Reference< X
// #i44786#
lcl_ensureName( _rxNewObject, _rName );
- ::rtl::Reference< OContentHelper > pContent = comphelper::getUnoTunnelImplementation<OContentHelper>( _rxNewObject );
+ ::rtl::Reference< OContentHelper > pContent = dynamic_cast<OContentHelper*>( _rxNewObject.get() );
if ( pContent.is() )
{
TContentPtr pImpl = pContent->getImpl();
@@ -585,7 +592,7 @@ void ODefinitionContainer::approveNewObject(const OUString& _sName,const Referen
DBA_RES( RID_STR_NAME_ALREADY_USED ),
*this );
- ::rtl::Reference< OContentHelper > pContent( comphelper::getUnoTunnelImplementation<OContentHelper>( _rxObject ) );
+ ::rtl::Reference< OContentHelper > pContent( dynamic_cast<OContentHelper*>( _rxObject.get() ) );
if ( !pContent.is() )
throw IllegalArgumentException(
DBA_RES( RID_STR_OBJECT_CONTAINER_MISMATCH ),
@@ -601,10 +608,11 @@ void ODefinitionContainer::approveNewObject(const OUString& _sName,const Referen
// XPropertyChangeListener
void SAL_CALL ODefinitionContainer::propertyChange( const PropertyChangeEvent& evt )
{
- MutexGuard aGuard(m_aMutex);
- if( !(evt.PropertyName == PROPERTY_NAME || evt.PropertyName == "Title") )
+ if( evt.PropertyName != PROPERTY_NAME && evt.PropertyName != "Title" )
return;
+ MutexGuard aGuard(m_aMutex);
+
m_bInPropertyChange = true;
try
{
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 9d88d27222f5..48971a3c74f5 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -34,6 +34,7 @@
#include <connectivity/sqlerror.hxx>
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/propertysequence.hxx>
#include <comphelper/servicehelper.hxx>
@@ -41,6 +42,7 @@
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -50,7 +52,6 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::io;
using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
@@ -115,14 +116,47 @@ css::uno::Sequence<sal_Int8> ODocumentContainer::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES3(ODocumentContainer,ODefinitionContainer,OPropertyStateContainer,ODocumentContainer_Base);
-IMPLEMENT_SERVICE_INFO_IMPLNAME(ODocumentContainer, "com.sun.star.comp.dba.ODocumentContainer");
-IMPLEMENT_SERVICE_INFO_SUPPORTS(ODocumentContainer);
-IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(ODocumentContainer)
+css::uno::Sequence< css::uno::Type > ODocumentContainer::getTypes()
+{
+ return ::comphelper::concatSequences(
+ ODefinitionContainer::getTypes( ),
+ OPropertyStateContainer::getTypes( ),
+ ODocumentContainer_Base::getTypes( )
+ );
+}
+OUString SAL_CALL ODocumentContainer::getImplementationName()
+ {
+ return "com.sun.star.comp.dba.ODocumentContainer";
+ };
+sal_Bool SAL_CALL ODocumentContainer::supportsService(const OUString& _rServiceName)
+ {
+ const css::uno::Sequence< OUString > aSupported(getSupportedServiceNames());
+ for (const OUString& s : aSupported)
+ if (s == _rServiceName)
+ return true;
+
+ return false;
+ };
+css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL ODocumentContainer::getPropertySetInfo()
+{
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+::cppu::IPropertyArrayHelper& ODocumentContainer::getInfoHelper()
+{
+ return *ODocumentContainer::getArrayHelper();
+}
+::cppu::IPropertyArrayHelper* ODocumentContainer::createArrayHelper( ) const
+{
+ css::uno::Sequence< css::beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
Sequence< OUString > SAL_CALL ODocumentContainer::getSupportedServiceNames( )
{
- return { m_bFormsContainer ? OUString(SERVICE_NAME_FORM_COLLECTION) : OUString(SERVICE_NAME_REPORT_COLLECTION) };
+ return { m_bFormsContainer ? SERVICE_NAME_FORM_COLLECTION : SERVICE_NAME_REPORT_COLLECTION };
}
OUString ODocumentContainer::determineContentType() const
@@ -218,9 +252,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
const bool bNeedClassID = !aClassID.hasElements() && sURL.isEmpty() ;
if ( xCopyFrom.is() )
{
- Sequence<Any> aIni(2);
- aIni[0] <<= getContainerStorage();
- aIni[1] <<= sPersistentName;
+ Sequence<Any> aIni{ Any(getContainerStorage()), Any(sPersistentName) };
Command aCommand;
aCommand.Name = "copyTo";
aCommand.Argument <<= aIni;
@@ -279,8 +311,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
if ( !sURL.isEmpty() )
{
- Sequence<Any> aIni(2);
- aIni[0] <<= sURL;
+ Sequence<Any> aIni{ Any(sURL) };
Command aCommand;
aCommand.Name = "insert";
aCommand.Argument <<= aIni;
@@ -361,7 +392,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
Reference<XContent > xNew(xORB->createInstanceWithArguments(sServiceName,aArguments),UNO_QUERY);
Reference<XNameContainer> xNameContainer(xContent,UNO_QUERY);
if ( xNameContainer.is() )
- xNameContainer->insertByName(*elements,makeAny(xNew));
+ xNameContainer->insertByName(*elements,Any(xNew));
}
}
}
@@ -372,11 +403,12 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
Sequence< OUString > SAL_CALL ODocumentContainer::getAvailableServiceNames( )
{
- Sequence< OUString > aSe(3);
- aSe[0] = SERVICE_SDB_DOCUMENTDEFINITION;
- aSe[1] = SERVICE_NAME_FORM_COLLECTION;
- aSe[2] = SERVICE_NAME_REPORT_COLLECTION;
- return aSe;
+ return
+ {
+ SERVICE_SDB_DOCUMENTDEFINITION,
+ SERVICE_NAME_FORM_COLLECTION,
+ SERVICE_NAME_REPORT_COLLECTION
+ };
}
Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 CommandId, const Reference< XCommandEnvironment >& Environment )
@@ -390,7 +422,7 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
{
OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -412,12 +444,12 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
aOpenCommand,
Environment );
aRet <<= xSet;
- }
+ }
else
{
// Unsupported.
ucbhelper::cancelCommandExecution(
- makeAny( UnsupportedOpenModeException(
+ Any( UnsupportedOpenModeException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
sal_Int16( aOpenCommand.Mode ) ) ),
@@ -434,7 +466,7 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
{
OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -460,10 +492,10 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
namespace
{
- bool lcl_queryContent(const OUString& _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,OUString& _sSimpleName)
+ bool lcl_queryContent(std::u16string_view _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,OUString& _sSimpleName)
{
sal_Int32 nIndex = 0;
- OUString sName = _sName.getToken(0,'/',nIndex);
+ OUString sName( o3tl::getToken(_sName,0,'/',nIndex) );
bool bRet = _xNameContainer->hasByName(sName);
if ( bRet )
{
@@ -471,7 +503,7 @@ namespace
_rRet = _xNameContainer->getByName(_sSimpleName);
while ( nIndex != -1 && bRet )
{
- sName = _sName.getToken(0,'/',nIndex);
+ sName = o3tl::getToken(_sName,0,'/',nIndex);
_xNameContainer.set(_rRet,UNO_QUERY);
bRet = _xNameContainer.is();
if ( bRet )
@@ -579,7 +611,7 @@ void SAL_CALL ODocumentContainer::insertByHierarchicalName( const OUString& _sNa
sal_Int32 index = sName.getLength();
OUString sMessage(
DBA_RES(RID_STR_NO_SUB_FOLDER).replaceFirst("$folder$",
- _sName.getToken(0,'/',index)));
+ o3tl::getToken(_sName, 0,'/',index)));
throw IllegalArgumentException( sMessage, *this, 1 );
}
@@ -635,7 +667,7 @@ OUString SAL_CALL ODocumentContainer::composeHierarchicalName( const OUString& i
::rtl::Reference<OContentHelper> pContent;
try
{
- pContent = comphelper::getUnoTunnelImplementation<OContentHelper>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ));
+ pContent = dynamic_cast<OContentHelper*>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ).get());
}
catch(const Exception&)
{
@@ -679,7 +711,7 @@ void SAL_CALL ODocumentContainer::revert( )
Reference< XStorage> ODocumentContainer::getContainerStorage() const
{
return m_pImpl->m_pDataSource
- ? m_pImpl->m_pDataSource->getStorage( m_bFormsContainer ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT )
+ ? m_pImpl->m_pDataSource->getStorage( m_bFormsContainer ? ODatabaseModelImpl::ObjectType::Form : ODatabaseModelImpl::ObjectType::Report )
: Reference< XStorage>();
}
@@ -718,8 +750,8 @@ void SAL_CALL ODocumentContainer::rename( const OUString& newName )
return;
sal_Int32 nHandle = PROPERTY_ID_NAME;
- Any aOld = makeAny(m_pImpl->m_aProps.aTitle);
- Any aNew = makeAny(newName);
+ Any aOld(m_pImpl->m_aProps.aTitle);
+ Any aNew(newName);
aGuard.clear();
fire(&nHandle, &aNew, &aOld, 1, true );
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.hxx b/dbaccess/source/core/dataaccess/documentcontainer.hxx
index f704011f8025..d47709e80a33 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.hxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTCONTAINER_HXX
+#pragma once
#include <definitioncontainer.hxx>
#include <cppuhelper/implbase5.hxx>
@@ -135,6 +134,4 @@ protected:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTCONTAINER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 40fddc4dec36..227bde4cde1b 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -21,16 +21,19 @@
#include <ModelImpl.hxx>
#include <stringconstants.hxx>
#include <sdbcoretools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
+#include <comphelper/compbase.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/classids.hxx>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/types.hxx>
#include <com/sun/star/frame/XUntitledNumbers.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XModel.hpp>
@@ -75,6 +78,7 @@
#include <com/sun/star/view/XViewSettingsSupplier.hpp>
#include <core_resource.hxx>
#include <strings.hrc>
+#include <strings.hxx>
#include <com/sun/star/task/XInteractionApprove.hpp>
#include <com/sun/star/task/XInteractionDisapprove.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -144,22 +148,20 @@ namespace dbaccess
}
// OEmbedObjectHolder
- typedef ::cppu::WeakComponentImplHelper< embed::XStateChangeListener > TEmbedObjectHolder;
+ typedef ::comphelper::WeakComponentImplHelper< embed::XStateChangeListener > TEmbedObjectHolder;
namespace {
- class OEmbedObjectHolder : public ::cppu::BaseMutex
- ,public TEmbedObjectHolder
+ class OEmbedObjectHolder : public TEmbedObjectHolder
{
Reference< XEmbeddedObject > m_xBroadCaster;
ODocumentDefinition* m_pDefinition;
bool m_bInStateChange;
protected:
- virtual void SAL_CALL disposing() override;
+ virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
public:
OEmbedObjectHolder(const Reference< XEmbeddedObject >& _xBroadCaster,ODocumentDefinition* _pDefinition)
- : TEmbedObjectHolder(m_aMutex)
- ,m_xBroadCaster(_xBroadCaster)
+ : m_xBroadCaster(_xBroadCaster)
,m_pDefinition(_pDefinition)
,m_bInStateChange(false)
{
@@ -178,7 +180,7 @@ namespace dbaccess
}
- void SAL_CALL OEmbedObjectHolder::disposing()
+ void OEmbedObjectHolder::disposing(std::unique_lock<std::mutex>& /*rGuard*/)
{
if ( m_xBroadCaster.is() )
m_xBroadCaster->removeStateChangeListener(this);
@@ -474,21 +476,28 @@ css::uno::Sequence<sal_Int8> ODocumentDefinition::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
-IMPLEMENT_GETTYPES3(ODocumentDefinition,OContentHelper,OPropertyStateContainer,ODocumentDefinition_Base);
+css::uno::Sequence< css::uno::Type > ODocumentDefinition::getTypes()
+{
+ return ::comphelper::concatSequences(
+ OContentHelper::getTypes( ),
+ OPropertyStateContainer::getTypes( ),
+ ODocumentDefinition_Base::getTypes( )
+ );
+}
IMPLEMENT_FORWARD_XINTERFACE3( ODocumentDefinition,OContentHelper,OPropertyStateContainer,ODocumentDefinition_Base)
void ODocumentDefinition::registerProperties()
{
-#define REGISTER_PROPERTY( name, location ) \
- registerProperty( PROPERTY_##name, PROPERTY_ID_##name, PropertyAttribute::READONLY, &location, cppu::UnoType<decltype(location)>::get() );
+ registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::CONSTRAINED | PropertyAttribute::BOUND | PropertyAttribute::READONLY,
+ &m_pImpl->m_aProps.aTitle, cppu::UnoType<decltype(m_pImpl->m_aProps.aTitle)>::get());
+
+ registerProperty(PROPERTY_AS_TEMPLATE, PROPERTY_ID_AS_TEMPLATE, PropertyAttribute::READONLY, &m_pImpl->m_aProps.bAsTemplate,
+ cppu::UnoType<decltype(m_pImpl->m_aProps.bAsTemplate)>::get());
-#define REGISTER_PROPERTY_BV( name, location ) \
- registerProperty( PROPERTY_##name, PROPERTY_ID_##name, PropertyAttribute::CONSTRAINED | PropertyAttribute::BOUND | PropertyAttribute::READONLY, &location, cppu::UnoType<decltype(location)>::get() );
+ registerProperty(PROPERTY_PERSISTENT_NAME, PROPERTY_ID_PERSISTENT_NAME, PropertyAttribute::READONLY, &m_pImpl->m_aProps.sPersistentName,
+ cppu::UnoType<decltype(m_pImpl->m_aProps.sPersistentName)>::get());
- REGISTER_PROPERTY_BV( NAME, m_pImpl->m_aProps.aTitle );
- REGISTER_PROPERTY ( AS_TEMPLATE, m_pImpl->m_aProps.bAsTemplate );
- REGISTER_PROPERTY ( PERSISTENT_NAME, m_pImpl->m_aProps.sPersistentName );
- REGISTER_PROPERTY ( IS_FORM, m_bForm );
+ registerProperty(PROPERTY_IS_FORM, PROPERTY_ID_IS_FORM, PropertyAttribute::READONLY, &m_bForm, cppu::UnoType<decltype(m_bForm)>::get());
}
void SAL_CALL ODocumentDefinition::getFastPropertyValue( Any& o_rValue, sal_Int32 i_nHandle ) const
@@ -498,11 +507,8 @@ void SAL_CALL ODocumentDefinition::getFastPropertyValue( Any& o_rValue, sal_Int3
OUString sPersistentPath;
if ( !m_pImpl->m_aProps.sPersistentName.isEmpty() )
{
- OUStringBuffer aBuffer;
- aBuffer.append( ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) );
- aBuffer.append( '/' );
- aBuffer.append( m_pImpl->m_aProps.sPersistentName );
- sPersistentPath = aBuffer.makeStringAndClear();
+ sPersistentPath = ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::ObjectType::Form : ODatabaseModelImpl::ObjectType::Report )
+ + "/" + m_pImpl->m_aProps.sPersistentName;
}
o_rValue <<= sPersistentPath;
return;
@@ -529,11 +535,10 @@ IPropertyArrayHelper* ODocumentDefinition::createArrayHelper( ) const
describeProperties( aProps );
// properties not maintained by our base class
- Sequence< Property > aManualProps( 1 );
- aManualProps[0].Name = PROPERTY_PERSISTENT_PATH;
- aManualProps[0].Handle = PROPERTY_ID_PERSISTENT_PATH;
- aManualProps[0].Type = ::cppu::UnoType<OUString>::get();
- aManualProps[0].Attributes = PropertyAttribute::READONLY;
+ Sequence< Property > aManualProps{ { /* Name */ PROPERTY_PERSISTENT_PATH,
+ /* Handle */ PROPERTY_ID_PERSISTENT_PATH,
+ /* Type */ ::cppu::UnoType<OUString>::get(),
+ /* Attributes */ PropertyAttribute::READONLY } };
return new OPropertyArrayHelper( ::comphelper::concatSequences( aProps, aManualProps ) );
}
@@ -596,7 +601,7 @@ void ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow( const bool i_bR
// ensure that we ourself are kept alive as long as the embedded object's frame is
// opened
- LifetimeCoupler::couple( *this, xFrame.get() );
+ LifetimeCoupler::couple( *this, xFrame );
// init the edit view
if ( m_bForm && m_bOpenInDesign && !i_bReactivated )
@@ -715,14 +720,14 @@ void ODocumentDefinition::impl_initFormEditView( const Reference< XController >&
LayoutManagerLock aLockLayout( _rxController );
// setting of the visual properties
- xViewSettings->setPropertyValue("ShowRulers",makeAny(true));
- xViewSettings->setPropertyValue("ShowVertRuler",makeAny(true));
- xViewSettings->setPropertyValue("ShowHoriRuler",makeAny(true));
- xViewSettings->setPropertyValue("IsRasterVisible",makeAny(true));
- xViewSettings->setPropertyValue("IsSnapToRaster",makeAny(true));
- xViewSettings->setPropertyValue("ShowOnlineLayout",makeAny(true));
- xViewSettings->setPropertyValue("RasterSubdivisionX",makeAny(sal_Int32(5)));
- xViewSettings->setPropertyValue("RasterSubdivisionY",makeAny(sal_Int32(5)));
+ xViewSettings->setPropertyValue("ShowRulers",Any(true));
+ xViewSettings->setPropertyValue("ShowVertRuler",Any(true));
+ xViewSettings->setPropertyValue("ShowHoriRuler",Any(true));
+ xViewSettings->setPropertyValue("IsRasterVisible",Any(true));
+ xViewSettings->setPropertyValue("IsSnapToRaster",Any(true));
+ xViewSettings->setPropertyValue("ShowOnlineLayout",Any(true));
+ xViewSettings->setPropertyValue("RasterSubdivisionX",Any(sal_Int32(5)));
+ xViewSettings->setPropertyValue("RasterSubdivisionY",Any(sal_Int32(5)));
}
catch( const Exception& )
{
@@ -846,7 +851,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
// So, in such a case, and with 2. above, we would silently execute those macros,
// regardless of the global security settings - which would be a security issue, of
// course.
- if ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::eNoMacros )
+ if ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::EmbeddedMacros::NONE )
{
// this is case 2. from above
// So, pass a USE_CONFIG to the to-be-loaded document. This means that
@@ -876,14 +881,14 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
{
// not supported
ucbhelper::cancelCommandExecution(
- makeAny( UnsupportedOpenModeException(
+ Any( UnsupportedOpenModeException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
sal_Int16( nOpenMode ) ) ),
_rxEnvironment );
// Unreachable
OSL_FAIL( "unreachable" );
- }
+ }
OSL_ENSURE( !m_pImpl->m_aProps.sPersistentName.isEmpty(),
"ODocumentDefinition::onCommandOpenSomething: no persistent name - cannot load!" );
@@ -924,8 +929,8 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
xReportEngine->setReportDefinition(xReportDefinition);
xReportEngine->setActiveConnection(m_xLastKnownConnection);
if ( bOpenHidden )
- return makeAny( xReportEngine->createDocumentModel() );
- return makeAny( xReportEngine->createDocumentAlive( nullptr ) );
+ return Any( xReportEngine->createDocumentModel() );
+ return Any( xReportEngine->createDocumentAlive( nullptr ) );
}
if ( _bActivate && !bOpenHidden )
@@ -937,13 +942,13 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
else
{
// ensure that we ourself are kept alive as long as the document is open
- LifetimeCoupler::couple( *this, xModel.get() );
+ LifetimeCoupler::couple( *this, xModel );
}
if ( !m_bForm && m_pImpl->m_aProps.bAsTemplate && !m_bOpenInDesign )
ODocumentDefinition::fillReportData( m_aContext, getComponent(), xConnection );
- return makeAny( xModel );
+ return Any( xModel );
}
Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 CommandId, const Reference< XCommandEnvironment >& Environment )
@@ -990,7 +995,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co
if ( !bIsAliveNewStyleReport )
{
impl_onActivateEmbeddedObject_nothrow( true );
- return makeAny( getComponent() );
+ return Any( getComponent() );
}
}
}
@@ -1011,7 +1016,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co
{
OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -1037,7 +1042,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co
{
OSL_FAIL( "Wrong argument count!" );
ucbhelper::cancelCommandExecution(
- makeAny( IllegalArgumentException(
+ Any( IllegalArgumentException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
-1 ) ),
@@ -1108,7 +1113,7 @@ namespace
try
{
Reference< XPropertySet > xFormProps( xForm, UNO_QUERY_THROW );
- xFormProps->setPropertyValue( PROPERTY_DATASOURCENAME, makeAny( OUString() ) );
+ xFormProps->setPropertyValue( PROPERTY_DATASOURCENAME, Any( OUString() ) );
}
catch( const Exception& )
{
@@ -1154,7 +1159,7 @@ void ODocumentDefinition::onCommandInsert( const OUString& _sURL, const Referenc
Sequence<OUString> aProps { PROPERTY_URL };
ucbhelper::cancelCommandExecution(
- makeAny( MissingPropertiesException(
+ Any( MissingPropertiesException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
aProps ) ),
@@ -1168,9 +1173,9 @@ void ODocumentDefinition::onCommandInsert( const OUString& _sURL, const Referenc
if ( xStorage.is() )
{
Reference< XEmbeddedObjectCreator> xEmbedFactory = EmbeddedObjectCreator::create(m_aContext);
- Sequence<PropertyValue> aEmpty,aMediaDesc(1);
- aMediaDesc[0].Name = PROPERTY_URL;
- aMediaDesc[0].Value <<= _sURL;
+ Sequence<PropertyValue> aEmpty;
+ Sequence<PropertyValue> aMediaDesc{ comphelper::makePropertyValue(PROPERTY_URL,
+ _sURL) };
m_xEmbeddedObject.set(xEmbedFactory->createInstanceInitFromMediaDescriptor( xStorage
,m_pImpl->m_aProps.sPersistentName
,aMediaDesc
@@ -1224,11 +1229,10 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw
}
aRequest.Content.set(m_xParentContainer,UNO_QUERY);
- OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest));
- Reference< XInteractionRequest > xRequest(pRequest);
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
// two continuations allowed: OK and Cancel
- ODocumentSaveContinuation* pDocuSave = nullptr;
+ rtl::Reference<ODocumentSaveContinuation> pDocuSave;
if ( m_pImpl->m_aProps.aTitle.isEmpty() )
{
@@ -1237,21 +1241,21 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw
}
if ( _bApprove )
{
- OInteraction< XInteractionApprove >* pApprove = new OInteraction< XInteractionApprove >;
+ rtl::Reference<OInteraction< XInteractionApprove >> pApprove = new OInteraction< XInteractionApprove >;
pRequest->addContinuation(pApprove);
}
- OInteraction< XInteractionDisapprove >* pDisApprove = new OInteraction< XInteractionDisapprove >;
+ rtl::Reference<OInteraction< XInteractionDisapprove >> pDisApprove = new OInteraction< XInteractionDisapprove >;
pRequest->addContinuation(pDisApprove);
- OInteractionAbort* pAbort = new OInteractionAbort;
+ rtl::Reference<OInteractionAbort> pAbort = new OInteractionAbort;
pRequest->addContinuation(pAbort);
Reference<XWindow> xDialogParent(rDialogParent, UNO_QUERY);
// create the handler, let it handle the request
Reference<XInteractionHandler2> xHandler(InteractionHandler::createWithParent(m_aContext, xDialogParent));
- xHandler->handle(xRequest);
+ xHandler->handle(pRequest);
if ( pAbort->wasSelected() )
return false;
@@ -1266,7 +1270,7 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw
m_pImpl->m_aProps.aTitle = pDocuSave->getName();
Reference< XContent> xContent = this;
- xNC->insertByName(pDocuSave->getName(),makeAny(xContent));
+ xNC->insertByName(pDocuSave->getName(),Any(xContent));
updateDocumentTitle();
}
@@ -1282,7 +1286,7 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw
}
catch(const Exception&)
{
- OSL_FAIL("ODocumentDefinition::save: caught an Exception (tried to let the InteractionHandler handle it)!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "ODocumentDefinition::save: caught an Exception (tried to let the InteractionHandler handle it)!");
}
return true;
}
@@ -1311,20 +1315,19 @@ void ODocumentDefinition::saveAs()
aRequest.Name = m_pImpl->m_aProps.aTitle;
aRequest.Content.set(m_xParentContainer,UNO_QUERY);
- OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest));
- Reference< XInteractionRequest > xRequest(pRequest);
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
// two continuations allowed: OK and Cancel
- ODocumentSaveContinuation* pDocuSave = new ODocumentSaveContinuation;
+ rtl::Reference<ODocumentSaveContinuation> pDocuSave = new ODocumentSaveContinuation;
pRequest->addContinuation(pDocuSave);
- OInteraction< XInteractionDisapprove >* pDisApprove = new OInteraction< XInteractionDisapprove >;
+ rtl::Reference<OInteraction< XInteractionDisapprove >> pDisApprove = new OInteraction< XInteractionDisapprove >;
pRequest->addContinuation(pDisApprove);
- OInteractionAbort* pAbort = new OInteractionAbort;
+ rtl::Reference<OInteractionAbort> pAbort = new OInteractionAbort;
pRequest->addContinuation(pAbort);
// create the handler, let it handle the request
Reference< XInteractionHandler2 > xHandler( InteractionHandler::createWithParent(m_aContext, nullptr) );
- xHandler->handle(xRequest);
+ xHandler->handle(pRequest);
if ( pAbort->wasSelected() )
return;
@@ -1358,7 +1361,7 @@ void ODocumentDefinition::saveAs()
Reference< XMultiServiceFactory > xORB( m_xParentContainer, UNO_QUERY_THROW );
Reference< XInterface > xComponent( xORB->createInstanceWithArguments( SERVICE_SDB_DOCUMENTDEFINITION, aArguments ) );
Reference< XNameContainer > xNameContainer( m_xParentContainer, UNO_QUERY_THROW );
- xNameContainer->insertByName( sOldName, makeAny( xComponent ) );
+ xNameContainer->insertByName( sOldName, Any( xComponent ) );
}
catch(const Exception&)
{
@@ -1376,7 +1379,7 @@ void ODocumentDefinition::saveAs()
}
catch(const Exception&)
{
- OSL_FAIL("ODocumentDefinition::save: caught an Exception (tried to let the InteractionHandler handle it)!");
+ TOOLS_WARN_EXCEPTION( "dbaccess", "ODocumentDefinition::save: caught an Exception (tried to let the InteractionHandler handle it)!");
}
}
@@ -1384,7 +1387,7 @@ namespace
{
void lcl_putLoadArgs( ::comphelper::NamedValueCollection& _io_rArgs, const optional_bool& _bSuppressMacros, const optional_bool& _bReadOnly )
{
- if ( !!_bSuppressMacros )
+ if ( _bSuppressMacros.has_value() )
{
if ( *_bSuppressMacros )
{
@@ -1401,7 +1404,7 @@ namespace
}
}
- if ( !!_bReadOnly )
+ if ( _bReadOnly.has_value() )
_io_rArgs.put( "ReadOnly", *_bReadOnly );
}
}
@@ -1427,7 +1430,7 @@ namespace
bool ODocumentDefinition::objectSupportsEmbeddedScripts() const
{
bool bAllowDocumentMacros = !m_pImpl->m_pDataSource
- || ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::eSubDocumentMacros );
+ || ( m_pImpl->m_pDataSource->determineEmbeddedMacros() == ODatabaseModelImpl::EmbeddedMacros::SubDocument );
// if *any* of the objects of the database document already has macros, we
// continue to allow it to have them, until the user does a migration.
@@ -1446,16 +1449,14 @@ void ODocumentDefinition::separateOpenCommandArguments( const Sequence< Property
{
::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments );
- const char* const pObjectDescriptorArgs[] =
- {
- "RecoveryStorage"
- };
- for (const char* pObjectDescriptorArg : pObjectDescriptorArgs)
+ static const std::u16string_view sObjectDescriptorArgs[] = { u"RecoveryStorage" };
+ for (const auto& rObjectDescriptorArg : sObjectDescriptorArgs)
{
- if ( aOpenCommandArguments.has( pObjectDescriptorArg ) )
+ const OUString sObjectDescriptorArg(rObjectDescriptorArg);
+ if ( aOpenCommandArguments.has( sObjectDescriptorArg ) )
{
- o_rEmbeddedObjectDescriptor.put( pObjectDescriptorArg, aOpenCommandArguments.get( pObjectDescriptorArg ) );
- aOpenCommandArguments.remove( pObjectDescriptorArg );
+ o_rEmbeddedObjectDescriptor.put( sObjectDescriptorArg, aOpenCommandArguments.get( sObjectDescriptorArg ) );
+ aOpenCommandArguments.remove( sObjectDescriptorArg );
}
}
@@ -1473,7 +1474,7 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC
}
m_pInterceptor = new OInterceptor( this );
- Reference<XDispatchProviderInterceptor> xInterceptor = m_pInterceptor.get();
+ Reference<XDispatchProviderInterceptor> xInterceptor = m_pInterceptor;
::comphelper::NamedValueCollection aEmbeddedDescriptor;
aEmbeddedDescriptor.put( "OutplaceDispatchInterceptor", xInterceptor );
@@ -1565,9 +1566,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_
Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(sReportEngineServiceName);
if ( !xEnumDrivers.is() || !xEnumDrivers->hasMoreElements() )
{
- css::io::WrongFormatException aWFE;
- aWFE.Message = DBA_RES( RID_STR_MISSING_EXTENSION );
- throw aWFE;
+ throw css::io::WrongFormatException(DBA_RES(RID_STR_MISSING_EXTENSION));
}
}
if ( !aClassID.hasElements() )
@@ -1601,8 +1600,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_
{
m_pClientHelper = new OEmbeddedClientHelper;
}
- Reference<XEmbeddedClient> xClient = m_pClientHelper.get();
- m_xEmbeddedObject->setClientSite(xClient);
+ m_xEmbeddedObject->setClientSite(m_pClientHelper);
m_xEmbeddedObject->changeState(EmbedStates::RUNNING);
if ( bSetSize )
{
@@ -1623,8 +1621,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& i_
{
m_pClientHelper = new OEmbeddedClientHelper;
}
- Reference<XEmbeddedClient> xClient = m_pClientHelper.get();
- m_xEmbeddedObject->setClientSite(xClient);
+ m_xEmbeddedObject->setClientSite(m_pClientHelper);
Sequence< PropertyValue > aEmbeddedObjectDescriptor;
Sequence< PropertyValue > aLoadArgs( fillLoadArgs(
@@ -1896,11 +1893,7 @@ OUString SAL_CALL ODocumentDefinition::getHierarchicalName()
OUString SAL_CALL ODocumentDefinition::composeHierarchicalName( const OUString& i_rRelativeName )
{
- OUStringBuffer aBuffer;
- aBuffer.append( getHierarchicalName() );
- aBuffer.append( '/' );
- aBuffer.append( i_rRelativeName );
- return aBuffer.makeStringAndClear();
+ return getHierarchicalName() + "/" + i_rRelativeName;
}
void SAL_CALL ODocumentDefinition::rename( const OUString& _rNewName )
@@ -1931,7 +1924,7 @@ void SAL_CALL ODocumentDefinition::rename( const OUString& _rNewName )
Reference< XStorage> ODocumentDefinition::getContainerStorage() const
{
return m_pImpl->m_pDataSource
- ? m_pImpl->m_pDataSource->getStorage( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT )
+ ? m_pImpl->m_pDataSource->getStorage( m_bForm ? ODatabaseModelImpl::ObjectType::Form : ODatabaseModelImpl::ObjectType::Report )
: Reference< XStorage>();
}
@@ -2015,9 +2008,9 @@ void ODocumentDefinition::fillReportData( const Reference< XComponentContext >&
}));
try
{
- Reference< XJobExecutor > xExecuteable(
+ Reference< XJobExecutor > xExecutable(
_rContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.wizards.report.CallReportWizard", aArgs, _rContext), UNO_QUERY_THROW );
- xExecuteable->trigger( "fill" );
+ xExecutable->trigger( "fill" );
}
catch( const Exception& )
{
@@ -2081,8 +2074,8 @@ void ODocumentDefinition::firePropertyChange( sal_Int32 i_nHandle, const Any& i_
NameChangeNotifier::NameChangeNotifier( ODocumentDefinition& i_rDocumentDefinition, const OUString& i_rNewName,
::osl::ResettableMutexGuard& i_rClearForNotify )
:m_rDocumentDefinition( i_rDocumentDefinition )
- ,m_aOldValue( makeAny( i_rDocumentDefinition.getCurrentName() ) )
- ,m_aNewValue( makeAny( i_rNewName ) )
+ ,m_aOldValue( Any( i_rDocumentDefinition.getCurrentName() ) )
+ ,m_aNewValue( Any( i_rNewName ) )
,m_rClearForNotify( i_rClearForNotify )
{
impl_fireEvent_throw( true );
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx
index 9910d61d8d02..5569276d4a7d 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.hxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTDEFINITION_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTDEFINITION_HXX
+#pragma once
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/implbase4.hxx>
@@ -208,7 +207,7 @@ private:
@throws css::uno::RuntimeException
*/
static void impl_removeFrameFromDesktop_throw(
- const css::uno::Reference< css::uno::XComponentContext >& _rContxt,
+ const css::uno::Reference< css::uno::XComponentContext >& _rContext,
const css::uno::Reference< css::frame::XFrame >& _rxFrame
);
@@ -354,6 +353,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTDEFINITION_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/documenteventexecutor.cxx b/dbaccess/source/core/dataaccess/documenteventexecutor.cxx
index 3d16ee6ebb79..e1cb9f3f4e57 100644
--- a/dbaccess/source/core/dataaccess/documenteventexecutor.cxx
+++ b/dbaccess/source/core/dataaccess/documenteventexecutor.cxx
@@ -27,7 +27,7 @@
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/weakref.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
namespace dbaccess
@@ -57,24 +57,14 @@ namespace dbaccess
using namespace ::com::sun::star;
- // DocumentEventExecutor_Data
- struct DocumentEventExecutor_Data
- {
- WeakReference< XEventsSupplier > xDocument;
- Reference< XURLTransformer > xURLTransformer;
-
- explicit DocumentEventExecutor_Data( const Reference< XEventsSupplier >& _rxDocument )
- :xDocument( _rxDocument )
- {
- }
- };
-
namespace
{
- void lcl_dispatchScriptURL_throw( DocumentEventExecutor_Data const & _rDocExecData,
+ void lcl_dispatchScriptURL_throw(
+ css::uno::WeakReference< css::document::XEventsSupplier > const & xWeakDocument,
+ css::uno::Reference< css::util::XURLTransformer > const & xURLTransformer,
const OUString& _rScriptURL, const DocumentEvent& _rTrigger )
{
- Reference< XModel > xDocument( _rDocExecData.xDocument.get(), UNO_QUERY_THROW );
+ Reference< XModel > xDocument( xWeakDocument.get(), UNO_QUERY_THROW );
Reference< XController > xController( xDocument->getCurrentController() );
Reference< XDispatchProvider > xDispProv;
@@ -88,8 +78,8 @@ namespace dbaccess
URL aScriptURL;
aScriptURL.Complete = _rScriptURL;
- if ( _rDocExecData.xURLTransformer.is() )
- _rDocExecData.xURLTransformer->parseStrict( aScriptURL );
+ if ( xURLTransformer.is() )
+ xURLTransformer->parseStrict( aScriptURL );
// unfortunately, executing a script can trigger all kind of complex stuff, and unfortunately, not
// every component involved into this properly cares for thread safety. To be on the safe side,
@@ -113,7 +103,7 @@ namespace dbaccess
// DocumentEventExecutor
DocumentEventExecutor::DocumentEventExecutor( const Reference<XComponentContext> & _rContext,
const Reference< XEventsSupplier >& _rxDocument )
- :m_pData( new DocumentEventExecutor_Data( _rxDocument ) )
+ :mxDocument( _rxDocument )
{
Reference< XDocumentEventBroadcaster > xBroadcaster( _rxDocument, UNO_QUERY_THROW );
@@ -125,7 +115,7 @@ namespace dbaccess
try
{
- m_pData->xURLTransformer = URLTransformer::create(_rContext);
+ mxURLTransformer = URLTransformer::create(_rContext);
}
catch( const Exception& )
{
@@ -139,8 +129,8 @@ namespace dbaccess
void SAL_CALL DocumentEventExecutor::documentEventOccured( const DocumentEvent& Event )
{
- Reference< XEventsSupplier > xEventsSupplier( m_pData->xDocument.get(), UNO_QUERY );
- if ( !xEventsSupplier.is() )
+ Reference< XEventsSupplier > xEventsSupplier( mxDocument.get(), UNO_QUERY );
+ if ( !xEventsSupplier )
{
OSL_FAIL( "DocumentEventExecutor::documentEventOccurred: no document anymore, but still being notified?" );
return;
@@ -179,7 +169,7 @@ namespace dbaccess
if ( bDispatchScriptURL && bNonEmptyScript )
{
- lcl_dispatchScriptURL_throw( *m_pData, sScript, Event );
+ lcl_dispatchScriptURL_throw( mxDocument, mxURLTransformer, sScript, Event );
}
}
catch( const RuntimeException& ) { throw; }
diff --git a/dbaccess/source/core/dataaccess/documenteventexecutor.hxx b/dbaccess/source/core/dataaccess/documenteventexecutor.hxx
index 5246984ce97e..58aee4bcd590 100644
--- a/dbaccess/source/core/dataaccess/documenteventexecutor.hxx
+++ b/dbaccess/source/core/dataaccess/documenteventexecutor.hxx
@@ -17,22 +17,19 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTEXECUTOR_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTEXECUTOR_HXX
+#pragma once
#include <com/sun/star/document/XDocumentEventListener.hpp>
#include <com/sun/star/document/XEventsSupplier.hpp>
#include <cppuhelper/implbase.hxx>
-
-#include <memory>
+#include <cppuhelper/weakref.hxx>
namespace com::sun::star::uno { class XComponentContext; }
+namespace com::sun::star::util { class XURLTransformer; }
namespace dbaccess
{
-
- struct DocumentEventExecutor_Data;
// DocumentEventExecutor
typedef ::cppu::WeakImplHelper < css::document::XDocumentEventListener
> DocumentEventExecutor_Base;
@@ -52,11 +49,10 @@ namespace dbaccess
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
private:
- std::unique_ptr< DocumentEventExecutor_Data > m_pData;
+ css::uno::WeakReference< css::document::XEventsSupplier > mxDocument;
+ css::uno::Reference< css::util::XURLTransformer > mxURLTransformer;
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTEXECUTOR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
index 16b46ad6ddf8..475b16c0b551 100644
--- a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
+++ b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
@@ -22,9 +22,10 @@
#include <com/sun/star/frame/DoubleInitializationException.hpp>
#include <comphelper/asyncnotification.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <cppuhelper/weak.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <vcl/svapp.hxx>
namespace dbaccess
{
@@ -51,8 +52,8 @@ namespace dbaccess
bool m_bInitialized;
bool m_bDisposed;
std::shared_ptr<::comphelper::AsyncEventNotifierAutoJoin> m_pEventBroadcaster;
- ::comphelper::OInterfaceContainerHelper2 m_aLegacyEventListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aDocumentEventListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::document::XEventListener> m_aLegacyEventListeners;
+ ::comphelper::OInterfaceContainerHelper3<XDocumentEventListener> m_aDocumentEventListeners;
public:
DocumentEventNotifier_Impl( ::cppu::OWeakObject& _rBroadcasterDocument, ::osl::Mutex& _rMutex )
@@ -67,8 +68,8 @@ namespace dbaccess
}
// IEventProcessor
- virtual void SAL_CALL acquire() throw () override;
- virtual void SAL_CALL release() throw () override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
void addLegacyEventListener( const Reference< document::XEventListener >& Listener )
{
@@ -121,12 +122,12 @@ namespace dbaccess
void impl_notifyEventAsync_nothrow( const DocumentEvent& _rEvent );
};
- void SAL_CALL DocumentEventNotifier_Impl::acquire() throw ()
+ void SAL_CALL DocumentEventNotifier_Impl::acquire() noexcept
{
osl_atomic_increment( &m_refCount );
}
- void SAL_CALL DocumentEventNotifier_Impl::release() throw ()
+ void SAL_CALL DocumentEventNotifier_Impl::release() noexcept
{
if ( 0 == osl_atomic_decrement( &m_refCount ) )
delete this;
@@ -141,21 +142,24 @@ namespace dbaccess
{
m_pEventBroadcaster->removeEventsForProcessor( this );
m_pEventBroadcaster->terminate();
- //TODO: a protocol is missing how to join with the thread before
- // exit(3), to ensure the thread is no longer relying on any
- // infrastructure while that infrastructure is being shut down
- // in atexit handlers; simply calling join here leads to
- // deadlock, as this thread holds the solar mutex while the
- // other thread is typically blocked waiting for the solar mutex
- // For now, use newAutoJoinAsyncEventNotifier which is
- // better than nothing.
- m_pEventBroadcaster.reset();
}
+ auto xEventBroadcaster = std::exchange(m_pEventBroadcaster, {});
+
lang::EventObject aEvent( m_rDocument );
aGuard.clear();
// <-- SYNCHRONIZED
+ if (xEventBroadcaster)
+ {
+ comphelper::SolarMutex& rSolarMutex = Application::GetSolarMutex();
+ // unblock threads blocked on that so we can join
+ sal_uInt32 nLockCount = (rSolarMutex.IsCurrentThread()) ? rSolarMutex.release(true) : 0;
+ xEventBroadcaster->join();
+ if (nLockCount)
+ rSolarMutex.acquire(nLockCount);
+ xEventBroadcaster.reset();
+ }
m_aLegacyEventListeners.disposeAndClear( aEvent );
m_aDocumentEventListeners.disposeAndClear( aEvent );
diff --git a/dbaccess/source/core/dataaccess/documenteventnotifier.hxx b/dbaccess/source/core/dataaccess/documenteventnotifier.hxx
index cc655268f8c1..6f3bffc4cf54 100644
--- a/dbaccess/source/core/dataaccess/documenteventnotifier.hxx
+++ b/dbaccess/source/core/dataaccess/documenteventnotifier.hxx
@@ -18,8 +18,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTNOTIFIER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTNOTIFIER_HXX
+#pragma once
#include <com/sun/star/document/XEventListener.hpp>
#include <com/sun/star/document/XDocumentEventListener.hpp>
@@ -126,6 +125,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTNOTIFIER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/documentevents.cxx b/dbaccess/source/core/dataaccess/documentevents.cxx
index d3c6a03ceeec..6dbe9ad5965d 100644
--- a/dbaccess/source/core/dataaccess/documentevents.cxx
+++ b/dbaccess/source/core/dataaccess/documentevents.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/sequence.hxx>
@@ -35,23 +36,6 @@ namespace dbaccess
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Type;
- // DocumentEvents_Data
- struct DocumentEvents_Data
- {
- ::cppu::OWeakObject& rParent;
- ::osl::Mutex& rMutex;
- DocumentEventsData& rEventsData;
-
- DocumentEvents_Data( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, DocumentEventsData& _rEventsData )
- :rParent( _rParent )
- ,rMutex( _rMutex )
- ,rEventsData( _rEventsData )
- {
- }
- DocumentEvents_Data(const DocumentEvents_Data&) = delete;
- const DocumentEvents_Data& operator=(const DocumentEvents_Data&) = delete;
- };
-
namespace {
// helper
@@ -96,15 +80,15 @@ namespace dbaccess
// DocumentEvents
DocumentEvents::DocumentEvents( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, DocumentEventsData& _rEventsData )
- :m_pData( new DocumentEvents_Data( _rParent, _rMutex, _rEventsData ) )
+ :mrParent(_rParent), mrMutex(_rMutex), mrEventsData(_rEventsData)
{
const DocumentEventData* pEventData = lcl_getDocumentEventData();
while ( pEventData->pAsciiEventName )
{
OUString sEventName = OUString::createFromAscii( pEventData->pAsciiEventName );
- DocumentEventsData::const_iterator existingPos = m_pData->rEventsData.find( sEventName );
- if ( existingPos == m_pData->rEventsData.end() )
- m_pData->rEventsData[ sEventName ] = Sequence< PropertyValue >();
+ DocumentEventsData::const_iterator existingPos = mrEventsData.find( sEventName );
+ if ( existingPos == mrEventsData.end() )
+ mrEventsData[ sEventName ] = Sequence< PropertyValue >();
++pEventData;
}
}
@@ -113,22 +97,22 @@ namespace dbaccess
{
}
- void SAL_CALL DocumentEvents::acquire() throw()
+ void SAL_CALL DocumentEvents::acquire() noexcept
{
- m_pData->rParent.acquire();
+ mrParent.acquire();
}
- void SAL_CALL DocumentEvents::release() throw()
+ void SAL_CALL DocumentEvents::release() noexcept
{
- m_pData->rParent.release();
+ mrParent.release();
}
- bool DocumentEvents::needsSynchronousNotification( const OUString& _rEventName )
+ bool DocumentEvents::needsSynchronousNotification( std::u16string_view _rEventName )
{
const DocumentEventData* pEventData = lcl_getDocumentEventData();
while ( pEventData->pAsciiEventName )
{
- if ( _rEventName.equalsAscii( pEventData->pAsciiEventName ) )
+ if ( o3tl::equalsAscii( _rEventName, pEventData->pAsciiEventName ) )
return pEventData->bNeedsSyncNotify;
++pEventData;
}
@@ -139,10 +123,10 @@ namespace dbaccess
void SAL_CALL DocumentEvents::replaceByName( const OUString& Name, const Any& Element )
{
- ::osl::MutexGuard aGuard( m_pData->rMutex );
+ ::osl::MutexGuard aGuard( mrMutex );
- DocumentEventsData::iterator elementPos = m_pData->rEventsData.find( Name );
- if ( elementPos == m_pData->rEventsData.end() )
+ DocumentEventsData::iterator elementPos = mrEventsData.find( Name );
+ if ( elementPos == mrEventsData.end() )
throw NoSuchElementException( Name, *this );
Sequence< PropertyValue > aEventDescriptor;
@@ -172,10 +156,10 @@ namespace dbaccess
Any SAL_CALL DocumentEvents::getByName( const OUString& Name )
{
- ::osl::MutexGuard aGuard( m_pData->rMutex );
+ ::osl::MutexGuard aGuard( mrMutex );
- DocumentEventsData::const_iterator elementPos = m_pData->rEventsData.find( Name );
- if ( elementPos == m_pData->rEventsData.end() )
+ DocumentEventsData::const_iterator elementPos = mrEventsData.find( Name );
+ if ( elementPos == mrEventsData.end() )
throw NoSuchElementException( Name, *this );
Any aReturn;
@@ -187,16 +171,16 @@ namespace dbaccess
Sequence< OUString > SAL_CALL DocumentEvents::getElementNames( )
{
- ::osl::MutexGuard aGuard( m_pData->rMutex );
+ ::osl::MutexGuard aGuard( mrMutex );
- return comphelper::mapKeysToSequence( m_pData->rEventsData );
+ return comphelper::mapKeysToSequence( mrEventsData );
}
sal_Bool SAL_CALL DocumentEvents::hasByName( const OUString& Name )
{
- ::osl::MutexGuard aGuard( m_pData->rMutex );
+ ::osl::MutexGuard aGuard( mrMutex );
- return m_pData->rEventsData.find( Name ) != m_pData->rEventsData.end();
+ return mrEventsData.find( Name ) != mrEventsData.end();
}
Type SAL_CALL DocumentEvents::getElementType( )
@@ -206,8 +190,8 @@ namespace dbaccess
sal_Bool SAL_CALL DocumentEvents::hasElements( )
{
- ::osl::MutexGuard aGuard( m_pData->rMutex );
- return !m_pData->rEventsData.empty();
+ ::osl::MutexGuard aGuard( mrMutex );
+ return !mrEventsData.empty();
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/dataaccess/intercept.cxx b/dbaccess/source/core/dataaccess/intercept.cxx
index 3b42df4ed6a1..26b85cbb8f3b 100644
--- a/dbaccess/source/core/dataaccess/intercept.cxx
+++ b/dbaccess/source/core/dataaccess/intercept.cxx
@@ -20,7 +20,7 @@
#include "intercept.hxx"
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <memory>
@@ -28,13 +28,11 @@ namespace dbaccess
{
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::embed;
using namespace ::com::sun::star::container;
using namespace ::comphelper;
using namespace ::cppu;
@@ -65,17 +63,14 @@ void OInterceptor::dispose()
OInterceptor::OInterceptor( ODocumentDefinition* _pContentHolder )
:m_pContentHolder( _pContentHolder )
- ,m_aInterceptedURL(7)
+ ,m_aInterceptedURL{ /* DISPATCH_SAVEAS */ ".uno:SaveAs",
+ /* DISPATCH_SAVE */ ".uno:Save",
+ /* DISPATCH_CLOSEDOC */ ".uno:CloseDoc",
+ /* DISPATCH_CLOSEWIN */ ".uno:CloseWin",
+ /* DISPATCH_CLOSEFRAME */ ".uno:CloseFrame",
+ /* DISPATCH_RELOAD */ ".uno:Reload" }
{
-
OSL_ENSURE(DISPATCH_RELOAD < m_aInterceptedURL.getLength(),"Illegal size.");
-
- m_aInterceptedURL[DISPATCH_SAVEAS] = ".uno:SaveAs";
- m_aInterceptedURL[DISPATCH_SAVE] = ".uno:Save";
- m_aInterceptedURL[DISPATCH_CLOSEDOC] = ".uno:CloseDoc";
- m_aInterceptedURL[DISPATCH_CLOSEWIN] = ".uno:CloseWin";
- m_aInterceptedURL[DISPATCH_CLOSEFRAME] = ".uno:CloseFrame";
- m_aInterceptedURL[DISPATCH_RELOAD] = ".uno:Reload";
}
@@ -131,7 +126,7 @@ void SAL_CALL OInterceptor::dispatch( const URL& URL,const Sequence<PropertyValu
{
if ( aNewArgs[nInd].Name == "SaveTo" )
{
- aNewArgs[nInd].Value <<= true;
+ aNewArgs.getArray()[nInd].Value <<= true;
break;
}
nInd++;
@@ -140,8 +135,9 @@ void SAL_CALL OInterceptor::dispatch( const URL& URL,const Sequence<PropertyValu
if ( nInd == aNewArgs.getLength() )
{
aNewArgs.realloc( nInd + 1 );
- aNewArgs[nInd].Name = "SaveTo";
- aNewArgs[nInd].Value <<= true;
+ auto pNewArgs = aNewArgs.getArray();
+ pNewArgs[nInd].Name = "SaveTo";
+ pNewArgs[nInd].Value <<= true;
}
Reference< XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(URL, "_self", 0 );
@@ -210,7 +206,7 @@ void SAL_CALL OInterceptor::addStatusListener(
{
osl::MutexGuard aGuard(m_aMutex);
if(!m_pStatCL)
- m_pStatCL.reset( new PropertyChangeListenerContainer(m_aMutex) );
+ m_pStatCL.reset( new StatusListenerContainer(m_aMutex) );
}
m_pStatCL->addInterface(URL.Complete,Control);
@@ -227,7 +223,7 @@ void SAL_CALL OInterceptor::addStatusListener(
{
osl::MutexGuard aGuard(m_aMutex);
if(!m_pStatCL)
- m_pStatCL.reset( new PropertyChangeListenerContainer(m_aMutex) );
+ m_pStatCL.reset( new StatusListenerContainer(m_aMutex) );
}
m_pStatCL->addInterface(URL.Complete,Control);
@@ -251,7 +247,7 @@ void SAL_CALL OInterceptor::addStatusListener(
{
osl::MutexGuard aGuard(m_aMutex);
if(!m_pStatCL)
- m_pStatCL.reset( new PropertyChangeListenerContainer(m_aMutex) );
+ m_pStatCL.reset( new StatusListenerContainer(m_aMutex) );
}
m_pStatCL->addInterface(URL.Complete,Control);
@@ -305,13 +301,13 @@ Reference< XDispatch > SAL_CALL OInterceptor::queryDispatch( const URL& URL,cons
Sequence< Reference< XDispatch > > SAL_CALL OInterceptor::queryDispatches( const Sequence<DispatchDescriptor >& Requests )
{
- Sequence< Reference< XDispatch > > aRet;
osl::MutexGuard aGuard(m_aMutex);
- if(m_xSlaveDispatchProvider.is())
- aRet = m_xSlaveDispatchProvider->queryDispatches(Requests);
- else
- aRet.realloc(Requests.getLength());
+ typedef Sequence<Reference<XDispatch>> DispatchSeq;
+ DispatchSeq aRet = m_xSlaveDispatchProvider.is() ?
+ m_xSlaveDispatchProvider->queryDispatches(Requests) :
+ DispatchSeq(Requests.getLength());
+ auto aRetRange = asNonConstRange(aRet);
for(sal_Int32 i = 0; i < Requests.getLength(); ++i)
{
const OUString* pIter = m_aInterceptedURL.getConstArray();
@@ -320,7 +316,7 @@ Sequence< Reference< XDispatch > > SAL_CALL OInterceptor::queryDispatches( cons
{
if ( Requests[i].FeatureURL.Complete == *pIter )
{
- aRet[i] = static_cast<XDispatch*>(this);
+ aRetRange[i] = static_cast<XDispatch*>(this);
break;
}
}
diff --git a/dbaccess/source/core/dataaccess/intercept.hxx b/dbaccess/source/core/dataaccess/intercept.hxx
index c7ddd3d217ab..7ce53752f19d 100644
--- a/dbaccess/source/core/dataaccess/intercept.hxx
+++ b/dbaccess/source/core/dataaccess/intercept.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_INTERCEPT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_INTERCEPT_HXX
+#pragma once
#include <osl/mutex.hxx>
#include <cppuhelper/implbase.hxx>
@@ -104,11 +103,11 @@ private:
css::uno::Sequence< OUString > m_aInterceptedURL;
- std::unique_ptr<PropertyChangeListenerContainer> m_pStatCL;
+ typedef comphelper::OMultiTypeInterfaceContainerHelperVar3<css::frame::XStatusListener, OUString>
+ StatusListenerContainer;
+ std::unique_ptr<StatusListenerContainer> m_pStatCL;
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_INTERCEPT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
index 52d6bd6a2b91..495f4868851e 100644
--- a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
+++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
@@ -17,82 +17,38 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <utility>
#include <vector>
-#include <ucbhelper/contentidentifier.hxx>
-
#include "myucp_datasupplier.hxx"
#include <ContentHelper.hxx>
#include <com/sun/star/ucb/IllegalIdentifierException.hpp>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::container;
-// @@@ Adjust namespace name.
using namespace dbaccess;
-// @@@ Adjust namespace name.
-namespace dbaccess
-{
-
-namespace {
-
-// struct ResultListEntry.
-struct ResultListEntry
-{
- OUString aId;
- Reference< XContentIdentifier > xId;
- ::rtl::Reference< OContentHelper > xContent;
- Reference< XRow > xRow;
- const ContentProperties& rData;
-
- explicit ResultListEntry(const ContentProperties& rEntry) : rData( rEntry ) {}
-};
-
-}
-
-// struct DataSupplier_Impl.
-struct DataSupplier_Impl
-{
- osl::Mutex m_aMutex;
- std::vector< std::unique_ptr<ResultListEntry> > m_aResults;
- rtl::Reference< ODocumentContainer > m_xContent;
- bool m_bCountFinal;
-
- explicit DataSupplier_Impl(const rtl::Reference< ODocumentContainer >& rContent)
- : m_xContent(rContent)
- , m_bCountFinal(false)
- {
- }
-};
-
-}
-
-// DataSupplier Implementation.
DataSupplier::DataSupplier( const rtl::Reference< ODocumentContainer >& rContent )
-: m_pImpl( new DataSupplier_Impl( rContent ) )
+: m_xContent( rContent )
{
-
}
DataSupplier::~DataSupplier()
{
-
}
OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() )
+ if ( static_cast<size_t>(nIndex) < m_aResults.size() )
{
- OUString aId = m_pImpl->m_aResults[ nIndex ]->aId;
+ OUString aId = m_aResults[ nIndex ]->aId;
if ( !aId.isEmpty() )
{
// Already cached.
@@ -102,14 +58,14 @@ OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
if ( getResult( nIndex ) )
{
- OUString aId = m_pImpl->m_xContent->getIdentifier()->getContentIdentifier();
+ OUString aId = m_xContent->getIdentifier()->getContentIdentifier();
if ( !aId.isEmpty() )
aId += "/";
- aId += m_pImpl->m_aResults[ nIndex ]->rData.aTitle;
+ aId += m_aResults[ nIndex ]->rData.aTitle;
- m_pImpl->m_aResults[ nIndex ]->aId = aId;
+ m_aResults[ nIndex ]->aId = aId;
return aId;
}
return OUString();
@@ -118,11 +74,11 @@ OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex )
Reference< XContentIdentifier >
DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() )
+ if ( static_cast<size_t>(nIndex) < m_aResults.size() )
{
- Reference< XContentIdentifier > xId = m_pImpl->m_aResults[ nIndex ]->xId;
+ Reference< XContentIdentifier > xId = m_aResults[ nIndex ]->xId;
if ( xId.is() )
{
// Already cached.
@@ -134,7 +90,7 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
if ( !aId.isEmpty() )
{
Reference< XContentIdentifier > xId = new ::ucbhelper::ContentIdentifier( aId );
- m_pImpl->m_aResults[ nIndex ]->xId = xId;
+ m_aResults[ nIndex ]->xId = xId;
return xId;
}
return Reference< XContentIdentifier >();
@@ -143,11 +99,11 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex )
Reference< XContent >
DataSupplier::queryContent( sal_uInt32 _nIndex )
{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(_nIndex) < m_pImpl->m_aResults.size() )
+ if ( static_cast<size_t>(_nIndex) < m_aResults.size() )
{
- Reference< XContent > xContent = m_pImpl->m_aResults[ _nIndex ]->xContent.get();
+ Reference< XContent > xContent = m_aResults[ _nIndex ]->xContent;
if ( xContent.is() )
{
// Already cached.
@@ -164,9 +120,9 @@ DataSupplier::queryContent( sal_uInt32 _nIndex )
OUString sName = xId->getContentIdentifier();
sName = sName.copy(sName.lastIndexOf('/')+1);
- m_pImpl->m_aResults[ _nIndex ]->xContent = m_pImpl->m_xContent->getContent(sName);
+ m_aResults[ _nIndex ]->xContent = m_xContent->getContent(sName);
- xContent = m_pImpl->m_aResults[ _nIndex ]->xContent.get();
+ xContent = m_aResults[ _nIndex ]->xContent.get();
return xContent;
}
@@ -179,9 +135,9 @@ DataSupplier::queryContent( sal_uInt32 _nIndex )
bool DataSupplier::getResult( sal_uInt32 nIndex )
{
- osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() )
+ if ( static_cast<size_t>(nIndex) < m_aResults.size() )
{
// Result already present.
return true;
@@ -189,25 +145,25 @@ bool DataSupplier::getResult( sal_uInt32 nIndex )
// Result not (yet) present.
- if ( m_pImpl->m_bCountFinal )
+ if ( m_bCountFinal )
return false;
// Try to obtain result...
- sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
+ sal_uInt32 nOldCount = m_aResults.size();
bool bFound = false;
sal_uInt32 nPos = nOldCount;
// @@@ Obtain data and put it into result list...
- Sequence< OUString> aSeq = m_pImpl->m_xContent->getElementNames();
+ Sequence< OUString> aSeq = m_xContent->getElementNames();
if ( nIndex < sal::static_int_cast< sal_uInt32 >( aSeq.getLength() ) )
{
const OUString* pIter = aSeq.getConstArray();
const OUString* pEnd = pIter + aSeq.getLength();
for(pIter = pIter + nPos;pIter != pEnd;++pIter,++nPos)
{
- m_pImpl->m_aResults.emplace_back(
- new ResultListEntry( m_pImpl->m_xContent->getContent(*pIter)->getContentProperties() ) );
+ m_aResults.emplace_back(
+ new ResultListEntry( m_xContent->getContent(*pIter)->getContentProperties() ) );
if ( nPos == nIndex )
{
@@ -219,19 +175,18 @@ bool DataSupplier::getResult( sal_uInt32 nIndex )
}
if ( !bFound )
- m_pImpl->m_bCountFinal = true;
+ m_bCountFinal = true;
- rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get();
+ rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet();
if ( xResultSet.is() )
{
// Callbacks follow!
aGuard.clear();
- if ( static_cast<size_t>(nOldCount) < m_pImpl->m_aResults.size() )
- xResultSet->rowCountChanged(
- nOldCount, m_pImpl->m_aResults.size() );
+ if ( static_cast<size_t>(nOldCount) < m_aResults.size() )
+ xResultSet->rowCountChanged( nOldCount, m_aResults.size() );
- if ( m_pImpl->m_bCountFinal )
+ if ( m_bCountFinal )
xResultSet->rowCountFinal();
}
@@ -240,57 +195,56 @@ bool DataSupplier::getResult( sal_uInt32 nIndex )
sal_uInt32 DataSupplier::totalCount()
{
- osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex );
- if ( m_pImpl->m_bCountFinal )
- return m_pImpl->m_aResults.size();
+ if ( m_bCountFinal )
+ return m_aResults.size();
- sal_uInt32 nOldCount = m_pImpl->m_aResults.size();
+ sal_uInt32 nOldCount = m_aResults.size();
// @@@ Obtain data and put it into result list...
- Sequence< OUString> aSeq = m_pImpl->m_xContent->getElementNames();
+ Sequence< OUString> aSeq = m_xContent->getElementNames();
const OUString* pIter = aSeq.getConstArray();
const OUString* pEnd = pIter + aSeq.getLength();
for(;pIter != pEnd;++pIter)
- m_pImpl->m_aResults.emplace_back(
- new ResultListEntry( m_pImpl->m_xContent->getContent(*pIter)->getContentProperties() ) );
+ m_aResults.emplace_back(
+ new ResultListEntry( m_xContent->getContent(*pIter)->getContentProperties() ) );
- m_pImpl->m_bCountFinal = true;
+ m_bCountFinal = true;
- rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet().get();
+ rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet();
if ( xResultSet.is() )
{
// Callbacks follow!
aGuard.clear();
- if ( static_cast<size_t>(nOldCount) < m_pImpl->m_aResults.size() )
- xResultSet->rowCountChanged(
- nOldCount, m_pImpl->m_aResults.size() );
+ if ( static_cast<size_t>(nOldCount) < m_aResults.size() )
+ xResultSet->rowCountChanged( nOldCount, m_aResults.size() );
xResultSet->rowCountFinal();
}
- return m_pImpl->m_aResults.size();
+ return m_aResults.size();
}
sal_uInt32 DataSupplier::currentCount()
{
- return m_pImpl->m_aResults.size();
+ return m_aResults.size();
}
bool DataSupplier::isCountFinal()
{
- return m_pImpl->m_bCountFinal;
+ return m_bCountFinal;
}
Reference< XRow >
DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() )
+ if ( static_cast<size_t>(nIndex) < m_aResults.size() )
{
- Reference< XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xRow;
+ Reference< XRow > xRow = m_aResults[ nIndex ]->xRow;
if ( xRow.is() )
{
// Already cached.
@@ -300,11 +254,11 @@ DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
if ( getResult( nIndex ) )
{
- if ( !m_pImpl->m_aResults[ nIndex ]->xContent.is() )
+ if ( !m_aResults[ nIndex ]->xContent.is() )
queryContent(nIndex);
- Reference< XRow > xRow = m_pImpl->m_aResults[ nIndex ]->xContent->getPropertyValues(getResultSet()->getProperties());
- m_pImpl->m_aResults[ nIndex ]->xRow = xRow;
+ Reference< XRow > xRow = m_aResults[ nIndex ]->xContent->getPropertyValues(getResultSet()->getProperties());
+ m_aResults[ nIndex ]->xRow = xRow;
return xRow;
}
@@ -313,10 +267,10 @@ DataSupplier::queryPropertyValues( sal_uInt32 nIndex )
void DataSupplier::releasePropertyValues( sal_uInt32 nIndex )
{
- osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
+ osl::Guard< osl::Mutex > aGuard( m_aMutex );
- if ( static_cast<size_t>(nIndex) < m_pImpl->m_aResults.size() )
- m_pImpl->m_aResults[ nIndex ]->xRow.clear();
+ if ( static_cast<size_t>(nIndex) < m_aResults.size() )
+ m_aResults[ nIndex ]->xRow.clear();
}
void DataSupplier::close()
diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
index 8806371d1dbc..65a45ad7fef6 100644
--- a/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
+++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
@@ -17,49 +17,59 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_DATASUPPLIER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_DATASUPPLIER_HXX
+#pragma once
#include <rtl/ref.hxx>
+#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/resultset.hxx>
#include "documentcontainer.hxx"
#include <memory>
-namespace dbaccess {
+namespace dbaccess
+{
+struct ResultListEntry
+{
+ OUString aId;
+ css::uno::Reference<css::ucb::XContentIdentifier> xId;
+ ::rtl::Reference<OContentHelper> xContent;
+ css::uno::Reference<css::sdbc::XRow> xRow;
+ const ContentProperties& rData;
-struct DataSupplier_Impl;
+ explicit ResultListEntry(const ContentProperties& rEntry)
+ : rData(rEntry)
+ {
+ }
+};
class DataSupplier : public ucbhelper::ResultSetDataSupplier
{
- std::unique_ptr<DataSupplier_Impl> m_pImpl;
+ osl::Mutex m_aMutex;
+ std::vector<std::unique_ptr<ResultListEntry>> m_aResults;
+ rtl::Reference<ODocumentContainer> m_xContent;
+ bool m_bCountFinal = false;
public:
- explicit DataSupplier( const rtl::Reference< ODocumentContainer >& rxContent );
+ explicit DataSupplier(const rtl::Reference<ODocumentContainer>& rxContent);
virtual ~DataSupplier() override;
- virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) override;
- virtual css::uno::Reference< css::ucb::XContentIdentifier >
- queryContentIdentifier( sal_uInt32 nIndex ) override;
- virtual css::uno::Reference< css::ucb::XContent >
- queryContent( sal_uInt32 nIndex ) override;
+ virtual OUString queryContentIdentifierString(sal_uInt32 nIndex) override;
+ virtual css::uno::Reference<css::ucb::XContentIdentifier>
+ queryContentIdentifier(sal_uInt32 nIndex) override;
+ virtual css::uno::Reference<css::ucb::XContent> queryContent(sal_uInt32 nIndex) override;
- virtual bool getResult( sal_uInt32 nIndex ) override;
+ virtual bool getResult(sal_uInt32 nIndex) override;
virtual sal_uInt32 totalCount() override;
virtual sal_uInt32 currentCount() override;
virtual bool isCountFinal() override;
- virtual css::uno::Reference< css::sdbc::XRow >
- queryPropertyValues( sal_uInt32 nIndex ) override;
- virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
+ virtual css::uno::Reference<css::sdbc::XRow> queryPropertyValues(sal_uInt32 nIndex) override;
+ virtual void releasePropertyValues(sal_uInt32 nIndex) override;
virtual void close() override;
virtual void validate() override;
};
-
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_DATASUPPLIER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/dataaccess/myucp_resultset.cxx b/dbaccess/source/core/dataaccess/myucp_resultset.cxx
index 67c1ad7c8b4b..9ba383e0aa18 100644
--- a/dbaccess/source/core/dataaccess/myucp_resultset.cxx
+++ b/dbaccess/source/core/dataaccess/myucp_resultset.cxx
@@ -26,14 +26,13 @@
*************************************************************************/
+#include <utility>
+
#include "myucp_datasupplier.hxx"
#include "myucp_resultset.hxx"
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::container;
@@ -42,11 +41,11 @@ using namespace dbaccess;
// DynamicResultSet Implementation.
DynamicResultSet::DynamicResultSet(
const Reference< XComponentContext >& rxContext,
- const rtl::Reference< ODocumentContainer >& rxContent,
+ rtl::Reference< ODocumentContainer > xContent,
const OpenCommandArgument2& rCommand,
const Reference< XCommandEnvironment >& rxEnv )
:ResultSetImplHelper( rxContext, rCommand )
- ,m_xContent(rxContent)
+ ,m_xContent(std::move(xContent))
,m_xEnv( rxEnv )
{
}
diff --git a/dbaccess/source/core/dataaccess/myucp_resultset.hxx b/dbaccess/source/core/dataaccess/myucp_resultset.hxx
index 6556ff76f572..220bdf0a70b7 100644
--- a/dbaccess/source/core/dataaccess/myucp_resultset.hxx
+++ b/dbaccess/source/core/dataaccess/myucp_resultset.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_RESULTSET_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_RESULTSET_HXX
+#pragma once
#include <rtl/ref.hxx>
#include <ucbhelper/resultsethelper.hxx>
@@ -40,13 +39,11 @@ private:
public:
DynamicResultSet(
const css::uno::Reference< css::uno::XComponentContext >& rxContext,
- const rtl::Reference< ODocumentContainer >& rxContent,
+ rtl::Reference< ODocumentContainer > xContent,
const css::ucb::OpenCommandArgument2& rCommand,
const css::uno::Reference< css::ucb::XCommandEnvironment >& rxEnv );
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_MYUCP_RESULTSET_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/ContainerMediator.hxx b/dbaccess/source/core/inc/ContainerMediator.hxx
index 8d1bf9d8d752..37bfc0ebac1a 100644
--- a/dbaccess/source/core/inc/ContainerMediator.hxx
+++ b/dbaccess/source/core/inc/ContainerMediator.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERMEDIATOR_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERMEDIATOR_HXX
+#pragma once
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -77,6 +76,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERMEDIATOR_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/ContentHelper.hxx b/dbaccess/source/core/inc/ContentHelper.hxx
index 87686496a77d..d60521a4328d 100644
--- a/dbaccess/source/core/inc/ContentHelper.hxx
+++ b/dbaccess/source/core/inc/ContentHelper.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTENTHELPER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTENTHELPER_HXX
+#pragma once
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/ucb/XCommandProcessor.hpp>
@@ -26,11 +25,11 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/multiinterfacecontainer3.hxx>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/sdbcx/XRename.hpp>
@@ -72,7 +71,7 @@ namespace dbaccess
typedef std::shared_ptr<OContentHelper_Impl> TContentPtr;
- typedef cppu::OMultiTypeInterfaceContainerHelperVar<OUString>
+ typedef comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XPropertiesChangeListener, OUString>
PropertyChangeListenerContainer;
typedef ::cppu::WeakComponentImplHelper< css::ucb::XContent
, css::ucb::XCommandProcessor
@@ -80,7 +79,6 @@ namespace dbaccess
, css::beans::XPropertiesChangeNotifier
, css::beans::XPropertyContainer
, css::lang::XInitialization
- , css::lang::XUnoTunnel
, css::container::XChild
, css::sdbcx::XRename
> OContentHelper_COMPBASE;
@@ -94,7 +92,7 @@ namespace dbaccess
void impl_rename_throw(const OUString& _sNewName,bool _bNotify = true);
protected:
- ::comphelper::OInterfaceContainerHelper2 m_aContentListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::ucb::XContentEventListener> m_aContentListeners;
PropertyChangeListenerContainer m_aPropertyChangeListeners;
css::uno::Reference< css::uno::XInterface >
m_xParentContainer;
@@ -122,7 +120,7 @@ namespace dbaccess
OContentHelper( const css::uno::Reference< css::uno::XComponentContext >& _xORB
,const css::uno::Reference< css::uno::XInterface >& _xParentContainer
- ,const TContentPtr& _pImpl
+ ,TContentPtr _pImpl
);
// css::lang::XTypeProvider
@@ -155,10 +153,6 @@ namespace dbaccess
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
// css::container::XChild
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
@@ -180,6 +174,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTENTHELPER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/DatabaseDataProvider.hxx b/dbaccess/source/core/inc/DatabaseDataProvider.hxx
index 68c066412a20..8c2029634b8a 100644
--- a/dbaccess/source/core/inc/DatabaseDataProvider.hxx
+++ b/dbaccess/source/core/inc/DatabaseDataProvider.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DATABASEDATAPROVIDER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DATABASEDATAPROVIDER_HXX
+#pragma once
#include <sal/config.h>
@@ -52,20 +51,12 @@ class DatabaseDataProvider: private ::cppu::BaseMutex,
public:
explicit DatabaseDataProvider(css::uno::Reference< css::uno::XComponentContext > const & context);
- // css::lang::XServiceInfo - static methods
- /// @throws css::uno::RuntimeException
- static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
- /// @throws css::uno::RuntimeException
- static OUString getImplementationName_Static();
- static css::uno::Reference< css::uno::XInterface >
- Create(css::uno::Reference< css::uno::XComponentContext > const & context);
-
private:
// css::uno::XInterface:
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override;
- virtual void SAL_CALL acquire() throw () override
+ virtual void SAL_CALL acquire() noexcept override
{ TDatabaseDataProvider::acquire(); }
- virtual void SAL_CALL release() throw () override
+ virtual void SAL_CALL release() noexcept override
{ TDatabaseDataProvider::release(); }
// css::lang::XServiceInfo
@@ -82,7 +73,7 @@ private:
virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
createDataSequenceByValueArray(
- const OUString& aRole, const OUString & aRangeRepresentation) override;
+ const OUString& aRole, const OUString & aRangeRepresentation, const OUString& aRoleQualifier) override;
virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override;
@@ -229,7 +220,7 @@ private:
::osl::MutexGuard aGuard(m_aMutex);
if ( _member != Value )
{
- prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
+ prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
_member = Value;
}
}
@@ -268,6 +259,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_DATABASEDATAPROVIDER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/FilteredContainer.hxx b/dbaccess/source/core/inc/FilteredContainer.hxx
index b07892731f3f..968f3a1d622b 100644
--- a/dbaccess/source/core/inc/FilteredContainer.hxx
+++ b/dbaccess/source/core/inc/FilteredContainer.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_FILTEREDCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_FILTEREDCONTAINER_HXX
+#pragma once
#include <sal/config.h>
@@ -134,6 +133,4 @@ namespace dbaccess
};
} // namespace
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_FILTEREDCONTAINER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/ModelImpl.hxx b/dbaccess/source/core/inc/ModelImpl.hxx
index c67e67d57905..2fc19830ca42 100644
--- a/dbaccess/source/core/inc/ModelImpl.hxx
+++ b/dbaccess/source/core/inc/ModelImpl.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_MODELIMPL_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_MODELIMPL_HXX
+#pragma once
#include "ContentHelper.hxx"
#include "documentevents.hxx"
@@ -28,18 +27,23 @@
#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/reflection/ProxyFactory.hpp>
#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/weakref.hxx>
#include <vcl/svapp.hxx>
#include <sfx2/docmacromode.hxx>
#include <sfx2/docstoragemodifylistener.hxx>
#include <unotools/sharedunocomponent.hxx>
+#include <rtl/digest.h>
#include <rtl/ref.hxx>
+#include <o3tl/enumarray.hxx>
namespace comphelper
{
@@ -85,35 +89,95 @@ struct AsciiPropertyValue
}
};
-class ODatabaseContext;
-class OSharedConnectionManager;
-
// ODatabaseModelImpl
typedef ::utl::SharedUNOComponent< css::embed::XStorage > SharedStorage;
class ODatabaseContext;
class DocumentStorageAccess;
-class OSharedConnectionManager;
+class ODatabaseSource;
+
+
+/** The class OSharedConnectionManager implements a structure to share connections.
+ It owns the master connections which will be disposed when the last connection proxy is gone.
+*/
+// need to hold the digest
+struct TDigestHolder
+{
+ sal_uInt8 m_pBuffer[RTL_DIGEST_LENGTH_SHA1];
+ TDigestHolder()
+ {
+ m_pBuffer[0] = 0;
+ }
+
+};
+
+class OSharedConnectionManager : public ::cppu::WeakImplHelper< css::lang::XEventListener >
+{
+ // contains the currently used master connections
+ struct TConnectionHolder
+ {
+ css::uno::Reference< css::sdbc::XConnection > xMasterConnection;
+ oslInterlockedCount nALiveCount;
+ };
+
+ // the less-compare functor, used for the stl::map
+ struct TDigestLess
+ {
+ bool operator() (const TDigestHolder& x, const TDigestHolder& y) const
+ {
+ sal_uInt32 i;
+ for(i=0;i < RTL_DIGEST_LENGTH_SHA1 && (x.m_pBuffer[i] >= y.m_pBuffer[i]); ++i)
+ ;
+ return i < RTL_DIGEST_LENGTH_SHA1;
+ }
+ };
+
+ typedef std::map< TDigestHolder,TConnectionHolder,TDigestLess> TConnectionMap; // holds the master connections
+ typedef std::map< css::uno::Reference< css::sdbc::XConnection >,TConnectionMap::iterator> TSharedConnectionMap;// holds the shared connections
+
+ ::osl::Mutex m_aMutex;
+ TConnectionMap m_aConnections; // remember the master connection in conjunction with the digest
+ TSharedConnectionMap m_aSharedConnection; // the shared connections with conjunction with an iterator into the connections map
+ css::uno::Reference< css::reflection::XProxyFactory > m_xProxyFactory;
+
+protected:
+ virtual ~OSharedConnectionManager() override;
+
+public:
+ explicit OSharedConnectionManager(const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
+
+ void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+ css::uno::Reference< css::sdbc::XConnection > getConnection( const OUString& url,
+ const OUString& user,
+ const OUString& password,
+ const css::uno::Sequence< css::beans::PropertyValue >& _aInfo,
+ ODatabaseSource* _pDataSource);
+ void addEventListener(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection, TConnectionMap::iterator const & _rIter);
+};
+
+
class ODatabaseModelImpl :public ::sfx2::IMacroDocumentAccess
,public ::sfx2::IModifiableDocument
{
public:
- enum ObjectType
+
+ enum class ObjectType
{
- E_FORM = 0,
- E_REPORT = 1,
- E_QUERY = 2,
- E_TABLE = 3
+ Form = 0,
+ Report = 1,
+ Query = 2,
+ Table = 3,
+ LAST = Table
};
- enum EmbeddedMacros
+ enum class EmbeddedMacros
{
// the database document (storage) itself contains macros
- eDocumentWideMacros,
+ DocumentWide,
// there are sub document( storage)s containing macros
- eSubDocumentMacros,
+ SubDocument,
// there are no known macro( storage)s
- eNoMacros
+ NONE
};
private:
@@ -121,7 +185,7 @@ private:
css::uno::WeakReference< css::sdbc::XDataSource > m_xDataSource;
rtl::Reference<DocumentStorageAccess> m_pStorageAccess;
- std::vector< TContentPtr > m_aContainer; // one for each ObjectType
+ o3tl::enumarray< ObjectType, TContentPtr > m_aContainer; // one for each ObjectType
::sfx2::DocumentMacroMode m_aMacroMode;
sal_Int16 m_nImposedMacroExecMode;
@@ -188,9 +252,7 @@ public:
m_xSettings;
css::uno::Sequence< OUString > m_aTableFilter;
css::uno::Sequence< OUString > m_aTableTypeFilter;
- OSharedConnectionManager* m_pSharedConnectionManager;
- css::uno::Reference< css::lang::XEventListener >
- m_xSharedConnectionManager;
+ rtl::Reference< OSharedConnectionManager > m_xSharedConnectionManager;
css::uno::Reference<css::awt::XWindow>
m_xDialogParent;
sal_uInt16 m_nControllerLockCount;
@@ -222,7 +284,7 @@ public:
virtual ~ODatabaseModelImpl();
ODatabaseModelImpl(
- const OUString& _rRegistrationName,
+ OUString _sRegistrationName,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
ODatabaseContext& _rDBContext
);
@@ -417,7 +479,8 @@ public:
virtual bool macroCallsSeenWhileLoading() const override;
virtual css::uno::Reference< css::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const override;
virtual SignatureState getScriptingSignatureState() override;
- virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) override;
+ virtual bool hasTrustedScriptingSignature(
+ const css::uno::Reference<css::task::XInteractionHandler>& _rxInteraction) override;
// IModifiableDocument
virtual void storageIsModified() override;
@@ -452,7 +515,7 @@ protected:
::osl::Mutex m_aMutex; // only use this to init WeakComponentImplHelper
protected:
- explicit ModelDependentComponent( const ::rtl::Reference< ODatabaseModelImpl >& _model );
+ explicit ModelDependentComponent( ::rtl::Reference< ODatabaseModelImpl > _model );
virtual ~ModelDependentComponent();
/** returns the component itself
@@ -540,6 +603,4 @@ public:
} // namespace dbaccess
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/PropertyForward.hxx b/dbaccess/source/core/inc/PropertyForward.hxx
index 1b20e76e9c6f..daf31758d000 100644
--- a/dbaccess/source/core/inc/PropertyForward.hxx
+++ b/dbaccess/source/core/inc/PropertyForward.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_PROPERTYFORWARD_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_PROPERTYFORWARD_HXX
+#pragma once
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -50,7 +49,7 @@ namespace dbaccess
public:
OPropertyForward( const css::uno::Reference< css::beans::XPropertySet>& _xSource,
const css::uno::Reference< css::container::XNameAccess>& _xDestContainer,
- const OUString& _sName,
+ OUString _sName,
const std::vector< OUString >& _aPropertyList
);
@@ -67,6 +66,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_PROPERTYFORWARD_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/RefreshListener.hxx b/dbaccess/source/core/inc/RefreshListener.hxx
index 37c6ea511bc5..03836c308f2b 100644
--- a/dbaccess/source/core/inc/RefreshListener.hxx
+++ b/dbaccess/source/core/inc/RefreshListener.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_REFRESHLISTENER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_REFRESHLISTENER_HXX
+#pragma once
#include <com/sun/star/uno/Reference.h>
@@ -40,6 +39,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_REFRESHLISTENER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
index be2f48fdb30d..fdde2d451d17 100644
--- a/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
+++ b/dbaccess/source/core/inc/SingleSelectQueryComposer.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_SINGLESELECTQUERYCOMPOSER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_SINGLESELECTQUERYCOMPOSER_HXX
+#pragma once
#include <com/sun/star/sdb/XParametersSupplier.hpp>
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
@@ -77,6 +76,7 @@ namespace dbaccess
typedef std::function<const ::connectivity::OSQLParseNode*(::connectivity::OSQLParseTreeIterator *)>
TGetParseNode;
::svxform::OSystemParseContext m_aParseContext;
+ ::svxform::ONeutralParseContext m_aNeutralContext;
::connectivity::OSQLParser m_aSqlParser;
::connectivity::OSQLParseTreeIterator m_aSqlIterator; // the iterator for the complete statement
::connectivity::OSQLParseTreeIterator m_aAdditiveIterator; // the iterator for the "additive statement" (means without the clauses of the elementary statement)
@@ -219,7 +219,10 @@ namespace dbaccess
// XServiceInfo
DECLARE_SERVICE_INFO();
- DECLARE_PROPERTYCONTAINER_DEFAULTS();
+ virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
+
// css::sdb::XSingleSelectQueryComposer
virtual OUString SAL_CALL getElementaryQuery() override;
@@ -257,6 +260,5 @@ namespace dbaccess
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getParameters( ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_SINGLESELECTQUERYCOMPOSER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/TableDeco.hxx b/dbaccess/source/core/inc/TableDeco.hxx
index f7bec41b9d28..93a974dac4a4 100644
--- a/dbaccess/source/core/inc/TableDeco.hxx
+++ b/dbaccess/source/core/inc/TableDeco.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
+#pragma once
#include <memory>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
@@ -62,7 +61,6 @@ namespace dbaccess
,public ODBTableDecorator_PROP
{
void fillPrivileges() const;
- protected:
css::uno::Reference< css::container::XContainerListener > m_xColumnMediator;
css::uno::Reference< css::sdbcx::XColumnsSupplier > m_xTable;
css::uno::Reference< css::container::XNameAccess > m_xColumnDefinitions;
@@ -76,8 +74,9 @@ namespace dbaccess
// note: this thing uses the ref-count of "this", see OCollection::acquire()!
std::unique_ptr<::connectivity::sdbcx::OCollection> m_pColumns;
+ protected:
// IColumnFactory
- virtual OColumn* createColumn(const OUString& _rName) const override;
+ virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
virtual void columnDropped(const OUString& _sName) override;
@@ -121,8 +120,8 @@ namespace dbaccess
//XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
//XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
@@ -146,7 +145,7 @@ namespace dbaccess
virtual void SAL_CALL setName( const OUString& aName ) override;
// css::lang::XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
+ static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
// XColumnsSupplier
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override;
@@ -161,6 +160,5 @@ namespace dbaccess
using ODataSettings::getFastPropertyValue;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLEDECO_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/View.hxx b/dbaccess/source/core/inc/View.hxx
index 93985e068a74..d3889ff56d00 100644
--- a/dbaccess/source/core/inc/View.hxx
+++ b/dbaccess/source/core/inc/View.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEW_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEW_HXX
+#pragma once
#include <connectivity/sdbcx/VView.hxx>
@@ -69,6 +68,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEW_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/bookmarkcontainer.hxx b/dbaccess/source/core/inc/bookmarkcontainer.hxx
index 10da82a6ced3..464192542499 100644
--- a/dbaccess/source/core/inc/bookmarkcontainer.hxx
+++ b/dbaccess/source/core/inc/bookmarkcontainer.hxx
@@ -17,15 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_BOOKMARKCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_BOOKMARKCONTAINER_HXX
+#pragma once
#include <sal/config.h>
#include <map>
#include <vector>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <cppuhelper/implbase.hxx>
#include <osl/mutex.hxx>
#include <com/sun/star/container/XChild.hpp>
@@ -59,7 +58,7 @@ class OBookmarkContainer final
MapIteratorVector m_aBookmarksIndexed; // for index access to the
::cppu::OWeakObject& m_rParent; // for the ref counting
- ::comphelper::OInterfaceContainerHelper2
+ ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener>
m_aContainerListeners;
::osl::Mutex& m_rMutex;
@@ -79,8 +78,8 @@ public:
virtual ~OBookmarkContainer() override;
// css::uno::XInterface
- virtual void SAL_CALL acquire( ) throw() override;
- virtual void SAL_CALL release( ) throw() override;
+ virtual void SAL_CALL acquire( ) noexcept override;
+ virtual void SAL_CALL release( ) noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -146,6 +145,4 @@ inline bool OBookmarkContainer::checkExistence(const OUString& _rName)
} // namespace dbaccess
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/callablestatement.hxx b/dbaccess/source/core/inc/callablestatement.hxx
index 9ca89317c5d8..58e21189aa59 100644
--- a/dbaccess/source/core/inc/callablestatement.hxx
+++ b/dbaccess/source/core/inc/callablestatement.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CALLABLESTATEMENT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_CALLABLESTATEMENT_HXX
+#pragma once
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XOutParameters.hpp>
@@ -43,8 +42,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -77,6 +76,5 @@ namespace dbaccess
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CALLABLESTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/column.hxx b/dbaccess/source/core/inc/column.hxx
index 3744715c7d6f..eae96fba3fd6 100644
--- a/dbaccess/source/core/inc/column.hxx
+++ b/dbaccess/source/core/inc/column.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMN_HXX
+#pragma once
#include "columnsettings.hxx"
@@ -68,8 +67,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::beans::XPropertySet
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
@@ -98,7 +97,7 @@ namespace dbaccess
public:
/** creates an OColumn object which should represent the column with a given name
*/
- virtual OColumn*
+ virtual rtl::Reference<OColumn>
createColumn( const OUString& _rName ) const = 0;
/** creates a column descriptor object.
@@ -129,7 +128,6 @@ namespace dbaccess
{
OContainerMediator* m_pMediator;
- protected:
// comes from the driver can be null
css::uno::Reference< css::container::XNameAccess > m_xDrvColumns;
css::uno::WeakReference< css::uno::XInterface > m_xParent;
@@ -140,6 +138,7 @@ namespace dbaccess
bool m_bAddColumn : 1;
bool m_bDropColumn : 1;
+ protected:
virtual void impl_refresh() override;
virtual connectivity::sdbcx::ObjectType createObject(const OUString& _rName) override;
virtual css::uno::Reference< css::beans::XPropertySet > createDescriptor() override;
@@ -179,7 +178,7 @@ namespace dbaccess
OColumns(
::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
- const css::uno::Reference< css::container::XNameAccess >& _rxDrvColumns,
+ css::uno::Reference< css::container::XNameAccess > _xDrvColumns,
bool _bCaseSensitive,
const std::vector< OUString> &_rVector,
IColumnFactory* _pColFactory,
@@ -191,8 +190,8 @@ namespace dbaccess
//XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override { OColumns_BASE::acquire(); }
- virtual void SAL_CALL release() throw() override { OColumns_BASE::release(); }
+ virtual void SAL_CALL acquire() noexcept override { OColumns_BASE::acquire(); }
+ virtual void SAL_CALL release() noexcept override { OColumns_BASE::release(); }
//XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
@@ -214,6 +213,5 @@ namespace dbaccess
using OColumns_BASE::setParent;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMN_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/columnsettings.hxx b/dbaccess/source/core/inc/columnsettings.hxx
index 29a93effadf4..6b6c5d4c16ec 100644
--- a/dbaccess/source/core/inc/columnsettings.hxx
+++ b/dbaccess/source/core/inc/columnsettings.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMNSETTINGS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMNSETTINGS_HXX
+#pragma once
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -86,6 +85,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_COLUMNSETTINGS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/commandbase.hxx b/dbaccess/source/core/inc/commandbase.hxx
index 725e348760ef..1a0bd91d83d6 100644
--- a/dbaccess/source/core/inc/commandbase.hxx
+++ b/dbaccess/source/core/inc/commandbase.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_COMMANDBASE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_COMMANDBASE_HXX
+#pragma once
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -48,6 +47,4 @@ protected:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_COMMANDBASE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/composertools.hxx b/dbaccess/source/core/inc/composertools.hxx
index d0bfdc3ff7d6..337064757300 100644
--- a/dbaccess/source/core/inc/composertools.hxx
+++ b/dbaccess/source/core/inc/composertools.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_COMPOSERTOOLS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_COMPOSERTOOLS_HXX
+#pragma once
#include <rtl/ustrbuf.hxx>
#include <osl/diagnose.h>
@@ -119,6 +118,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_COMPOSERTOOLS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/containerapprove.hxx b/dbaccess/source/core/inc/containerapprove.hxx
index d350470adac0..f780e224affd 100644
--- a/dbaccess/source/core/inc/containerapprove.hxx
+++ b/dbaccess/source/core/inc/containerapprove.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERAPPROVE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERAPPROVE_HXX
+#pragma once
#include <rtl/ustring.hxx>
@@ -55,6 +54,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_CONTAINERAPPROVE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/databasecontext.hxx b/dbaccess/source/core/inc/databasecontext.hxx
index 0c1848042b26..d94df018d1c0 100644
--- a/dbaccess/source/core/inc/databasecontext.hxx
+++ b/dbaccess/source/core/inc/databasecontext.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DATABASECONTEXT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DATABASECONTEXT_HXX
+#pragma once
#include <sal/config.h>
@@ -29,7 +28,6 @@
#include "ModelImpl.hxx"
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/sdb/XDatabaseContext.hpp>
#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
#include <com/sun/star/uno/XAggregation.hpp>
@@ -56,7 +54,6 @@ class DatabaseDocumentLoader;
typedef ::cppu::WeakComponentImplHelper< css::lang::XServiceInfo
, css::sdb::XDatabaseContext
- , css::lang::XUnoTunnel
> DatabaseAccessContext_Base;
class ODatabaseContext :public DatabaseAccessContext_Base
@@ -85,13 +82,10 @@ private:
BasicDLL m_aBasicDLL;
#endif
-protected:
::osl::Mutex m_aMutex;
css::uno::Reference< css::uno::XComponentContext >
m_aContext;
- css::uno::Reference< css::uno::XAggregation >
- m_xDBRegistrationAggregate;
css::uno::Reference< css::sdb::XDatabaseRegistrations >
m_xDatabaseRegistrations;
@@ -106,7 +100,7 @@ protected:
// recreated afterwards. So it's our (the context's) responsibility to store the session-persistent
// properties.
- ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener> m_aContainerListeners;
rtl::Reference<DatabaseDocumentLoader> m_xDatabaseDocumentLoader;
public:
@@ -125,14 +119,6 @@ public:
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
- // XServiceInfo - static methods
- /// @throws css::uno::RuntimeException
- static css::uno::Sequence< OUString > getSupportedServiceNames_static();
- /// @throws css::uno::RuntimeException
- static OUString getImplementationName_static();
- static css::uno::Reference< css::uno::XInterface >
- Create(const css::uno::Reference< css::uno::XComponentContext >&);
-
// XElementAccess
virtual css::uno::Type SAL_CALL getElementType( ) override;
virtual sal_Bool SAL_CALL hasElements( ) override;
@@ -165,10 +151,6 @@ public:
virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
-
void registerDatabaseDocument( ODatabaseModelImpl& _rModelImpl);
void revokeDatabaseDocument( const ODatabaseModelImpl& _rModelImpl);
void databaseDocumentURLChange(const OUString& _sOldName, const OUString& _sNewName);
@@ -186,6 +168,4 @@ private:
} // namespace dbaccess
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/datasettings.hxx b/dbaccess/source/core/inc/datasettings.hxx
index 9b6a7f686434..8e24ebb714de 100644
--- a/dbaccess/source/core/inc/datasettings.hxx
+++ b/dbaccess/source/core/inc/datasettings.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DATASETTINGS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DATASETTINGS_HXX
+#pragma once
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <rtl/ustring.hxx>
@@ -75,6 +74,4 @@ protected:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_DATASETTINGS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/definitioncolumn.hxx b/dbaccess/source/core/inc/definitioncolumn.hxx
index 69d2c3c8490d..b4c0a5c081a6 100644
--- a/dbaccess/source/core/inc/definitioncolumn.hxx
+++ b/dbaccess/source/core/inc/definitioncolumn.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCOLUMN_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCOLUMN_HXX
+#pragma once
#include "column.hxx"
#include "columnsettings.hxx"
@@ -152,7 +151,7 @@ namespace dbaccess
OQueryColumn(
const css::uno::Reference< css::beans::XPropertySet>& _rxParserColumn,
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
- const OUString &i_sLabel
+ OUString i_sLabel
);
// XTypeProvider
@@ -273,7 +272,7 @@ namespace dbaccess
public:
OTableColumnWrapper( const css::uno::Reference< css::beans::XPropertySet >& rCol,
- const css::uno::Reference< css::beans::XPropertySet >& rColDefintion,
+ const css::uno::Reference< css::beans::XPropertySet >& rColDefinition,
const bool _bPureWrap );
// css::lang::XTypeProvider
@@ -288,6 +287,5 @@ namespace dbaccess
virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCOLUMN_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/definitioncontainer.hxx b/dbaccess/source/core/inc/definitioncontainer.hxx
index 98a4c3f140a3..02f145776c8f 100644
--- a/dbaccess/source/core/inc/definitioncontainer.hxx
+++ b/dbaccess/source/core/inc/definitioncontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCONTAINER_HXX
+#pragma once
#include <sal/config.h>
@@ -37,6 +36,7 @@
#include "ContentHelper.hxx"
#include "containerapprove.hxx"
#include <comphelper/uno3.hxx>
+#include <comphelper/interfacecontainer2.hxx>
namespace dbaccess
{
@@ -130,7 +130,7 @@ protected:
with a new one), this new element must pass our own internal approval, plus the approval
given here.
*/
- void setElementApproval( PContainerApprove _pElementApproval ) { m_pElementApproval = _pElementApproval; }
+ void setElementApproval(const PContainerApprove& _pElementApproval ) { m_pElementApproval = _pElementApproval; }
const PContainerApprove& getElementApproval() const { return m_pElementApproval; }
protected:
@@ -320,6 +320,4 @@ private:
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_DEFINITIONCONTAINER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/documentevents.hxx b/dbaccess/source/core/inc/documentevents.hxx
index 9a04074a3c68..224fc407d2fe 100644
--- a/dbaccess/source/core/inc/documentevents.hxx
+++ b/dbaccess/source/core/inc/documentevents.hxx
@@ -17,15 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_DOCUMENTEVENTS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_DOCUMENTEVENTS_HXX
+#pragma once
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <cppuhelper/implbase.hxx>
-#include <memory>
#include <map>
namespace dbaccess
@@ -34,9 +32,6 @@ namespace dbaccess
typedef std::map< OUString, css::uno::Sequence< css::beans::PropertyValue > >
DocumentEventsData;
- // DocumentEvents
- struct DocumentEvents_Data;
-
typedef ::cppu::WeakImplHelper< css::container::XNameReplace
> DocumentEvents_Base;
@@ -49,11 +44,11 @@ namespace dbaccess
DocumentEvents(const DocumentEvents&) = delete;
const DocumentEvents& operator=(const DocumentEvents&) = delete;
- static bool needsSynchronousNotification( const OUString& _rEventName );
+ static bool needsSynchronousNotification( std::u16string_view _rEventName );
// XInterface
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// XNameReplace
virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override;
@@ -68,11 +63,11 @@ namespace dbaccess
virtual sal_Bool SAL_CALL hasElements( ) override;
private:
- std::unique_ptr< DocumentEvents_Data > m_pData;
+ ::cppu::OWeakObject& mrParent;
+ ::osl::Mutex& mrMutex;
+ DocumentEventsData& mrEventsData;
};
} // namespace dbaccess
-#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/migrwarndlg.hxx b/dbaccess/source/core/inc/migrwarndlg.hxx
index e01c2b9f0099..24bacf300101 100644
--- a/dbaccess/source/core/inc/migrwarndlg.hxx
+++ b/dbaccess/source/core/inc/migrwarndlg.hxx
@@ -6,8 +6,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
+#pragma once
#include <vcl/weld.hxx>
@@ -22,6 +21,4 @@ public:
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_WARNDLG_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/object.hxx b/dbaccess/source/core/inc/object.hxx
deleted file mode 100644
index a6f08560941b..000000000000
--- a/dbaccess/source/core/inc/object.hxx
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECT_HXX
-
-enum ObjectType
-{
- dbaTable,
- dbaQuery,
- dbaForm,
- dbaReport
-};
-
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/objectnameapproval.hxx b/dbaccess/source/core/inc/objectnameapproval.hxx
index 6e0ce4577b03..e503c347ea4e 100644
--- a/dbaccess/source/core/inc/objectnameapproval.hxx
+++ b/dbaccess/source/core/inc/objectnameapproval.hxx
@@ -17,19 +17,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECTNAMEAPPROVAL_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECTNAMEAPPROVAL_HXX
+#pragma once
#include <memory>
#include "containerapprove.hxx"
-
+#include <cppuhelper/weakref.hxx>
#include <com/sun/star/sdbc/XConnection.hpp>
namespace dbaccess
{
// ObjectNameApproval
- struct ObjectNameApproval_Impl;
/** implementation of the IContainerApprove interface which approves
elements for insertion into a query or tables container.
@@ -41,7 +39,8 @@ namespace dbaccess
*/
class ObjectNameApproval : public IContainerApprove
{
- std::unique_ptr< ObjectNameApproval_Impl > m_pImpl;
+ css::uno::WeakReference< css::sdbc::XConnection > mxConnection;
+ sal_Int32 mnCommandType;
public:
enum ObjectType
@@ -73,6 +72,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_OBJECTNAMEAPPROVAL_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/preparedstatement.hxx b/dbaccess/source/core/inc/preparedstatement.hxx
index d8e0f5b6a7b5..cea06d79a81e 100644
--- a/dbaccess/source/core/inc/preparedstatement.hxx
+++ b/dbaccess/source/core/inc/preparedstatement.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_PREPAREDSTATEMENT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_PREPAREDSTATEMENT_HXX
+#pragma once
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdbc/XPreparedStatement.hpp>
@@ -53,8 +52,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// css::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
@@ -102,6 +101,5 @@ namespace dbaccess
virtual void SAL_CALL clearParameters( ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_PREPAREDSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/querycomposer.hxx b/dbaccess/source/core/inc/querycomposer.hxx
index 1e5ef2ab07ec..c5d764d98cf8 100644
--- a/dbaccess/source/core/inc/querycomposer.hxx
+++ b/dbaccess/source/core/inc/querycomposer.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCOMPOSER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCOMPOSER_HXX
+#pragma once
#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
#include <com/sun/star/sdb/XParametersSupplier.hpp>
@@ -63,8 +62,8 @@ namespace dbaccess
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
@@ -88,6 +87,5 @@ namespace dbaccess
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getParameters( ) override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCOMPOSER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/querycontainer.hxx b/dbaccess/source/core/inc/querycontainer.hxx
index 0aeb806aed7c..a04a1ddf3d31 100644
--- a/dbaccess/source/core/inc/querycontainer.hxx
+++ b/dbaccess/source/core/inc/querycontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCONTAINER_HXX
+#pragma once
#include <cppuhelper/implbase5.hxx>
#include <connectivity/CommonTools.hxx>
@@ -163,6 +162,4 @@ namespace dbaccess
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_QUERYCONTAINER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx b/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx
index c5dadce4549d..4f0f68d306c9 100644
--- a/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx
+++ b/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx
@@ -17,21 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_RECOVERY_DBDOCRECOVERY_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_RECOVERY_DBDOCRECOVERY_HXX
+#pragma once
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <vector>
-#include <memory>
namespace dbaccess
{
// DatabaseDocumentRecovery
- struct DatabaseDocumentRecovery_Data;
class DatabaseDocumentRecovery
{
public:
@@ -64,11 +61,9 @@ namespace dbaccess
);
private:
- const std::unique_ptr< DatabaseDocumentRecovery_Data > m_pData;
+ css::uno::Reference<css::uno::XComponentContext> mxContext;
};
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_RECOVERY_DBDOCRECOVERY_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/sdbcoretools.hxx b/dbaccess/source/core/inc/sdbcoretools.hxx
index 41097c676f58..5b100dcf1783 100644
--- a/dbaccess/source/core/inc/sdbcoretools.hxx
+++ b/dbaccess/source/core/inc/sdbcoretools.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_SDBCORETOOLS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_SDBCORETOOLS_HXX
+#pragma once
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -53,6 +52,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_SDBCORETOOLS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/statement.hxx b/dbaccess/source/core/inc/statement.hxx
index 2024bb0de81e..f437040682fb 100644
--- a/dbaccess/source/core/inc/statement.hxx
+++ b/dbaccess/source/core/inc/statement.hxx
@@ -16,8 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
+#pragma once
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdbc/XStatement.hpp>
@@ -71,8 +70,8 @@ public:
// css::uno::XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- virtual void SAL_CALL acquire() throw() override;
- virtual void SAL_CALL release() throw() override;
+ virtual void SAL_CALL acquire() noexcept override;
+ virtual void SAL_CALL release() noexcept override;
// OComponentHelper
virtual void SAL_CALL disposing() override;
@@ -177,6 +176,4 @@ private:
bool impl_ensureComposer_nothrow() const;
};
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_STATEMENT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/table.hxx b/dbaccess/source/core/inc/table.hxx
index ec851f3b50d6..6c71e7447653 100644
--- a/dbaccess/source/core/inc/table.hxx
+++ b/dbaccess/source/core/inc/table.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLE_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLE_HXX
+#pragma once
#include <com/sun/star/sdbc/XConnection.hpp>
@@ -45,7 +44,6 @@ namespace dbaccess
private:
::rtl::Reference< OContainerMediator > m_pColumnMediator;
- protected:
css::uno::Reference< css::container::XNameAccess > m_xColumnDefinitions;
css::uno::Reference< css::container::XNameAccess > m_xDriverColumns;
@@ -53,11 +51,12 @@ namespace dbaccess
sal_Int32 m_nPrivileges;
// </properties>
+ protected:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const override;
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
// IColumnFactory
- virtual OColumn* createColumn(const OUString& _rName) const override;
+ virtual rtl::Reference<OColumn> createColumn(const OUString& _rName) const override;
virtual css::uno::Reference< css::beans::XPropertySet > createColumnDescriptor() override;
virtual void columnAppended( const css::uno::Reference< css::beans::XPropertySet >& _rxSourceDescriptor ) override;
virtual void columnDropped(const OUString& _sName) override;
@@ -115,7 +114,6 @@ namespace dbaccess
//XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
- static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
// css::lang::XServiceInfo
DECLARE_SERVICE_INFO();
@@ -129,14 +127,10 @@ namespace dbaccess
// css::sdbcx::XAlterTable,
virtual void SAL_CALL alterColumnByName( const OUString& _rName, const css::uno::Reference< css::beans::XPropertySet >& _rxDescriptor ) override;
- // css::lang::XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
private:
using OTable_Base::createArrayHelper;
using OTable_Base::getFastPropertyValue;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/tablecontainer.hxx b/dbaccess/source/core/inc/tablecontainer.hxx
index bc5a38818104..44358e4e20e2 100644
--- a/dbaccess/source/core/inc/tablecontainer.hxx
+++ b/dbaccess/source/core/inc/tablecontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLECONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLECONTAINER_HXX
+#pragma once
#include <sal/config.h>
@@ -69,8 +68,8 @@ namespace dbaccess
virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
public:
- virtual void SAL_CALL acquire() throw() override { OFilteredContainer::acquire();}
- virtual void SAL_CALL release() throw() override { OFilteredContainer::release();}
+ virtual void SAL_CALL acquire() noexcept override { OFilteredContainer::acquire();}
+ virtual void SAL_CALL release() noexcept override { OFilteredContainer::release();}
/** ctor of the container. The parent has to support the <type scope="css::sdbc">XConnection</type>
interface.<BR>
@@ -93,6 +92,5 @@ namespace dbaccess
virtual ~OTableContainer() override;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLECONTAINER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/veto.hxx b/dbaccess/source/core/inc/veto.hxx
index 63a0748b24af..ec44172f70d4 100644
--- a/dbaccess/source/core/inc/veto.hxx
+++ b/dbaccess/source/core/inc/veto.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_VETO_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_VETO_HXX
+#pragma once
#include <com/sun/star/util/XVeto.hpp>
@@ -38,7 +37,7 @@ namespace dbaccess
const css::uno::Any m_aDetails;
public:
- Veto( const css::uno::Any& _rDetails );
+ Veto( css::uno::Any _aDetails );
virtual OUString SAL_CALL getReason() override;
virtual css::uno::Any SAL_CALL getDetails() override;
@@ -53,6 +52,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_VETO_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/inc/viewcontainer.hxx b/dbaccess/source/core/inc/viewcontainer.hxx
index 12d7f74805fb..2f7f48cec155 100644
--- a/dbaccess/source/core/inc/viewcontainer.hxx
+++ b/dbaccess/source/core/inc/viewcontainer.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEWCONTAINER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEWCONTAINER_HXX
+#pragma once
#include <sal/config.h>
@@ -68,8 +67,8 @@ namespace dbaccess
virtual OUString getTableTypeRestriction() const override;
private:
- virtual void SAL_CALL acquire() throw() override { OFilteredContainer::acquire();}
- virtual void SAL_CALL release() throw() override { OFilteredContainer::release();}
+ virtual void SAL_CALL acquire() noexcept override { OFilteredContainer::acquire();}
+ virtual void SAL_CALL release() noexcept override { OFilteredContainer::release();}
// css::lang::XServiceInfo
DECLARE_SERVICE_INFO();
@@ -91,6 +90,5 @@ namespace dbaccess
bool m_bInElementRemoved;
};
}
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEWCONTAINER_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/ContainerMediator.cxx b/dbaccess/source/core/misc/ContainerMediator.cxx
index 338858c87e76..0ee0d2e1f93c 100644
--- a/dbaccess/source/core/misc/ContainerMediator.cxx
+++ b/dbaccess/source/core/misc/ContainerMediator.cxx
@@ -25,7 +25,7 @@
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
#include <com/sun/star/sdbcx/XRename.hpp>
#include <comphelper/property.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -222,8 +222,7 @@ void OContainerMediator::notifyElementCreated( const OUString& _sName, const Ref
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
- ::rtl::Reference pForward( new OPropertyForward( _xDest, m_xSettings, _sName, aPropertyList ) );
- m_aForwardList[ _sName ] = pForward;
+ m_aForwardList[_sName].set(new OPropertyForward(_xDest, m_xSettings, _sName, aPropertyList));
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
index b5179e57b32f..d2aa735fa8ba 100644
--- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx
+++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx
@@ -23,9 +23,8 @@
#include <comphelper/types.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <connectivity/FValue.hxx>
-#include <rtl/math.hxx>
#include <sal/macros.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
@@ -38,6 +37,7 @@
#include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <com/sun/star/chart/XChartDataArray.hpp>
+#include <utility>
#include <vector>
// TODO: update for new HavingClause-aware FilterManager
@@ -52,7 +52,6 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex
::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >(
context, IMPLEMENTS_PROPERTY_SET, uno::Sequence< OUString >()),
m_aParameterManager( m_aMutex, context ),
- m_aFilterManager(),
m_xContext(context),
m_CommandType(sdb::CommandType::COMMAND), // #i94114
m_RowLimit(0),
@@ -71,8 +70,8 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex
uno::Reference<beans::XPropertySet> xProp(static_cast< ::cppu::OWeakObject* >( this ),uno::UNO_QUERY);
m_aFilterManager.initialize( m_xAggregateSet );
m_aParameterManager.initialize( xProp, m_xAggregate );
- m_xAggregateSet->setPropertyValue(PROPERTY_COMMAND_TYPE,uno::makeAny(m_CommandType));
- m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,uno::makeAny(m_EscapeProcessing));
+ m_xAggregateSet->setPropertyValue(PROPERTY_COMMAND_TYPE,uno::Any(m_CommandType));
+ m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,uno::Any(m_EscapeProcessing));
}
osl_atomic_decrement( &m_refCount );
}
@@ -80,7 +79,7 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex
void SAL_CALL DatabaseDataProvider::disposing()
{
m_aParameterManager.dispose(); // (to free any references it may have to me)
- m_aFilterManager.dispose(); // (dito)
+ m_aFilterManager.dispose(); // (ditto)
m_xParent.clear();
m_xAggregateSet.clear();
@@ -96,15 +95,10 @@ uno::Any DatabaseDataProvider::queryInterface(uno::Type const & type)
return TDatabaseDataProvider::queryInterface(type);
}
-OUString DatabaseDataProvider::getImplementationName_Static( )
-{
- return "com.sun.star.comp.dbaccess.DatabaseDataProvider";
-}
-
// XServiceInfo
OUString SAL_CALL DatabaseDataProvider::getImplementationName( )
{
- return getImplementationName_Static();
+ return "com.sun.star.comp.dbaccess.DatabaseDataProvider";
}
sal_Bool SAL_CALL DatabaseDataProvider::supportsService( const OUString& _rServiceName )
@@ -112,19 +106,9 @@ sal_Bool SAL_CALL DatabaseDataProvider::supportsService( const OUString& _rServi
return cppu::supportsService(this, _rServiceName);
}
-uno::Sequence< OUString > DatabaseDataProvider::getSupportedServiceNames_Static( )
-{
- return { "com.sun.star.chart2.data.DatabaseDataProvider" };
-}
-
uno::Sequence< OUString > SAL_CALL DatabaseDataProvider::getSupportedServiceNames( )
{
- return getSupportedServiceNames_Static();
-}
-
-uno::Reference< uno::XInterface > DatabaseDataProvider::Create(uno::Reference< uno::XComponentContext > const & context)
-{
- return *(new DatabaseDataProvider(context)) ;
+ return { "com.sun.star.chart2.data.DatabaseDataProvider" };
}
// lang::XInitialization:
@@ -140,7 +124,7 @@ void SAL_CALL DatabaseDataProvider::initialize(const uno::Sequence< uno::Any > &
else if ( !m_xHandler.is() )
(*pIter) >>= m_xHandler;
}
- m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, uno::makeAny( m_xActiveConnection ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, uno::Any( m_xActiveConnection ) );
}
// chart2::data::XDataProvider:
@@ -218,9 +202,8 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat
uno::Reference< lang::XInitialization> xIni(m_xInternal,uno::UNO_QUERY);
if ( xIni.is() )
{
- uno::Sequence< uno::Any > aInitArgs(1);
- beans::NamedValue aParam("CreateDefaultData",uno::makeAny(true));
- aInitArgs[0] <<= aParam;
+ beans::NamedValue aParam("CreateDefaultData",uno::Any(true));
+ uno::Sequence< uno::Any > aInitArgs{ uno::Any(aParam) };
xIni->initialize(aInitArgs);
}
}
@@ -233,9 +216,9 @@ uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArgum
{
::comphelper::NamedValueCollection aArguments;
aArguments.put( "CellRangeRepresentation", uno::Any( OUString( "all" ) ) );
- aArguments.put( "DataRowSource", uno::makeAny( chart::ChartDataRowSource_COLUMNS ) );
+ aArguments.put( "DataRowSource", uno::Any( chart::ChartDataRowSource_COLUMNS ) );
// internal data always contains labels
- aArguments.put( "FirstCellAsLabel", uno::makeAny( true ) );
+ aArguments.put( "FirstCellAsLabel", uno::Any( true ) );
bool bHasCategories = false;
if( _xDataSource.is())
@@ -259,7 +242,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL DatabaseDataProvider::detectArgum
}
}
}
- aArguments.put( "HasCategories", uno::makeAny( bHasCategories ) );
+ aArguments.put( "HasCategories", uno::Any( bHasCategories ) );
return aArguments.getPropertyValues();
}
@@ -273,7 +256,7 @@ uno::Any DatabaseDataProvider::impl_getNumberFormatKey_nothrow(const OUString &
std::map< OUString,css::uno::Any>::const_iterator aFind = m_aNumberFormats.find(_sRangeRepresentation);
if ( aFind != m_aNumberFormats.end() )
return aFind->second;
- return uno::makeAny(sal_Int32(0));
+ return uno::Any(sal_Int32(0));
}
uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::createDataSequenceByRangeRepresentation(const OUString & _sRangeRepresentation)
@@ -281,7 +264,7 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::cre
osl::MutexGuard g(m_aMutex);
uno::Reference< chart2::data::XDataSequence > xData = m_xInternal->createDataSequenceByRangeRepresentation(_sRangeRepresentation);
uno::Reference<beans::XPropertySet> xProp(xData,uno::UNO_QUERY);
- static const char s_sNumberFormatKey[] = "NumberFormatKey";
+ static constexpr OUString s_sNumberFormatKey = u"NumberFormatKey"_ustr;
if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(s_sNumberFormatKey) )
{
xProp->setPropertyValue(s_sNumberFormatKey,impl_getNumberFormatKey_nothrow(_sRangeRepresentation));
@@ -291,7 +274,7 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::cre
uno::Reference<chart2::data::XDataSequence>
SAL_CALL DatabaseDataProvider::createDataSequenceByValueArray(
- const OUString& /*aRole*/, const OUString& /*aRangeRepresentation*/ )
+ const OUString& /*aRole*/, const OUString& /*aRangeRepresentation*/, const OUString& /*aRoleQualifier*/ )
{
return uno::Reference<chart2::data::XDataSequence>();
}
@@ -462,7 +445,7 @@ void SAL_CALL DatabaseDataProvider::setCommand(const OUString & the_value)
{
osl::MutexGuard g(m_aMutex);
impl_invalidateParameter_nothrow();
- m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND, uno::Any( the_value ) );
}
set(PROPERTY_COMMAND,the_value,m_Command);
}
@@ -477,7 +460,7 @@ void SAL_CALL DatabaseDataProvider::setCommandType(::sal_Int32 the_value)
{
{
osl::MutexGuard g(m_aMutex);
- m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND_TYPE, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_COMMAND_TYPE, uno::Any( the_value ) );
}
set(PROPERTY_COMMAND_TYPE,the_value,m_CommandType);
}
@@ -507,7 +490,7 @@ void SAL_CALL DatabaseDataProvider::setApplyFilter( sal_Bool the_value )
{
{
osl::MutexGuard g(m_aMutex);
- m_xAggregateSet->setPropertyValue( PROPERTY_APPLYFILTER, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_APPLYFILTER, uno::Any( the_value ) );
}
set(PROPERTY_APPLYFILTER,static_cast<bool>(the_value),m_ApplyFilter);
}
@@ -522,7 +505,7 @@ void SAL_CALL DatabaseDataProvider::setHavingClause( const OUString& the_value )
{
{
osl::MutexGuard g(m_aMutex);
- m_xAggregateSet->setPropertyValue( PROPERTY_HAVING_CLAUSE, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_HAVING_CLAUSE, uno::Any( the_value ) );
}
set(PROPERTY_HAVING_CLAUSE,the_value,m_HavingClause);
}
@@ -537,7 +520,7 @@ void SAL_CALL DatabaseDataProvider::setGroupBy( const OUString& the_value )
{
{
osl::MutexGuard g(m_aMutex);
- m_xAggregateSet->setPropertyValue( PROPERTY_GROUP_BY, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_GROUP_BY, uno::Any( the_value ) );
}
set(PROPERTY_GROUP_BY,the_value,m_GroupBy);
}
@@ -552,7 +535,7 @@ void SAL_CALL DatabaseDataProvider::setOrder( const OUString& the_value )
{
{
osl::MutexGuard g(m_aMutex);
- m_xAggregateSet->setPropertyValue( PROPERTY_ORDER, uno::makeAny( the_value ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_ORDER, uno::Any( the_value ) );
}
set(PROPERTY_ORDER,the_value,m_Order);
}
@@ -612,13 +595,12 @@ namespace
sal_Int32 nDataType;
ColumnDescription()
- :sName()
- ,nResultSetPosition( 0 )
+ :nResultSetPosition( 0 )
,nDataType( sdbc::DataType::VARCHAR )
{
}
- explicit ColumnDescription( const OUString& i_rName )
- :sName( i_rName )
+ explicit ColumnDescription( OUString i_sName )
+ :sName(std::move( i_sName ))
,nResultSetPosition( 0 )
,nDataType( sdbc::DataType::VARCHAR )
{
@@ -677,7 +659,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
{
const sal_Int32 nAssumedRowSetColumnIndex = _bHasCategories ? 1 : 0;
if ( nAssumedRowSetColumnIndex < aRowSetColumnNames.getLength() )
- aImposedColumnNames[0] = aRowSetColumnNames[ nAssumedRowSetColumnIndex ];
+ aImposedColumnNames.getArray()[0] = aRowSetColumnNames[ nAssumedRowSetColumnIndex ];
}
const sal_Int32 nCount = aImposedColumnNames.getLength();
@@ -753,11 +735,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
aValue.fill( column.nResultSetPosition, column.nDataType, xRow );
if ( aValue.isNull() )
- {
- double nValue;
- ::rtl::math::setNan( &nValue );
- aRow.push_back( nValue );
- }
+ aRow.push_back( std::numeric_limits<double>::quiet_NaN() );
else
aRow.push_back( aValue.getDouble() );
}
@@ -778,7 +756,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
{
aRowLabels.push_back(OUString::number(h+1));
std::vector< double > aRow;
- const sal_Int32 nSize = SAL_N_ELEMENTS(fDefaultData);
+ const sal_Int32 nSize = std::size(fDefaultData);
for (size_t j = 0; j < (aColumns.size()-1); ++j,++k)
{
if ( k >= nSize )
@@ -815,7 +793,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor
void DatabaseDataProvider::impl_fillRowSet_throw()
{
- m_xAggregateSet->setPropertyValue( PROPERTY_FILTER, uno::makeAny( getFilter() ) );
+ m_xAggregateSet->setPropertyValue( PROPERTY_FILTER, uno::Any( getFilter() ) );
uno::Reference< sdbc::XParameters> xParam(m_xRowSet,uno::UNO_QUERY_THROW);
xParam->clearParameters( );
}
@@ -1077,4 +1055,13 @@ void DatabaseDataProvider::impl_invalidateParameter_nothrow()
} // namespace dbaccess
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_comp_dbaccess_DatabaseDataProvider_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
+{
+ return cppu::acquire(new dbaccess::DatabaseDataProvider(context));
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/PropertyForward.cxx b/dbaccess/source/core/misc/PropertyForward.cxx
index 239bd422fd41..07e1068f695f 100644
--- a/dbaccess/source/core/misc/PropertyForward.cxx
+++ b/dbaccess/source/core/misc/PropertyForward.cxx
@@ -24,7 +24,8 @@
#include <com/sun/star/sdbcx/XAppend.hpp>
#include <comphelper/property.hxx>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -37,10 +38,10 @@ namespace dbaccess
OPropertyForward::OPropertyForward( const Reference< XPropertySet>& _xSource, const Reference< XNameAccess>& _xDestContainer,
- const OUString& _sName, const std::vector< OUString>& _aPropertyList )
+ OUString _sName, const std::vector< OUString>& _aPropertyList )
:m_xSource( _xSource, UNO_SET_THROW )
,m_xDestContainer( _xDestContainer, UNO_SET_THROW )
- ,m_sName( _sName )
+ ,m_sName(std::move( _sName ))
,m_bInInsert( false )
{
diff --git a/dbaccess/source/core/misc/apitools.cxx b/dbaccess/source/core/misc/apitools.cxx
index c080979ba042..384d5962bd2d 100644
--- a/dbaccess/source/core/misc/apitools.cxx
+++ b/dbaccess/source/core/misc/apitools.cxx
@@ -29,7 +29,7 @@ using namespace osl;
// various helper functions
// OSubComponent
OSubComponent::OSubComponent(Mutex& _rMutex, const Reference< XInterface > & xParent)
- :OComponentHelper(_rMutex)
+ :WeakComponentImplHelper(_rMutex)
,m_xParent(xParent)
{
@@ -41,74 +41,51 @@ OSubComponent::~OSubComponent()
}
-// css::lang::XTypeProvider
-Sequence< Type > OSubComponent::getTypes()
-{
- OTypeCollection aTypes(cppu::UnoType<XComponent>::get(),
- cppu::UnoType<XTypeProvider>::get(),
- cppu::UnoType<XWeak>::get());
-
- return aTypes.getTypes();
-}
-
// XInterface
-void OSubComponent::release() throw ( )
+void OSubComponent::release() noexcept
{
- Reference< XInterface > x( xDelegator );
- if (! x.is())
+ if (osl_atomic_decrement( &m_refCount ) == 0 )
{
- if (osl_atomic_decrement( &m_refCount ) == 0 )
+ if (! rBHelper.bDisposed)
{
- if (! rBHelper.bDisposed)
+ // *before* again incrementing our ref count, ensure that our weak connection point
+ // will not create references to us anymore (via XAdapter::queryAdapted)
+ disposeWeakConnectionPoint();
+
+ Reference< XInterface > xHoldAlive( *this );
+ // remember the parent
+ Reference< XInterface > xParent;
{
- // *before* again incrementing our ref count, ensure that our weak connection point
- // will not create references to us anymore (via XAdapter::queryAdapted)
- disposeWeakConnectionPoint();
-
- Reference< XInterface > xHoldAlive( *this );
- // remember the parent
- Reference< XInterface > xParent;
- {
- MutexGuard aGuard( rBHelper.rMutex );
- xParent = m_xParent;
- m_xParent = nullptr;
- }
-
- SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (before dispose)!" );
-
- // First dispose
- dispose();
-
- // only the alive ref holds the object
- SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (after dispose)!" );
-
- // release the parent in the ~
- if (xParent.is())
- {
- MutexGuard aGuard( rBHelper.rMutex );
- m_xParent = xParent;
- }
-
- // destroy the object if xHoldAlive decrement the refcount to 0
- return;
+ MutexGuard aGuard( rBHelper.rMutex );
+ xParent = m_xParent;
+ m_xParent = nullptr;
}
- }
- // restore the reference count
- osl_atomic_increment( &m_refCount );
- }
- // as we cover the job of the componenthelper we use the ...
- OWeakAggObject::release();
-}
+ SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (before dispose)!" );
-Any OSubComponent::queryInterface( const Type & rType )
-{
- Any aReturn;
- if (!rType.equals(cppu::UnoType<XAggregation>::get()))
- aReturn = OComponentHelper::queryInterface(rType);
+ // First dispose
+ dispose();
+
+ // only the alive ref holds the object
+ SAL_WARN_IF( m_refCount != 1, "dbaccess.core", "OSubComponent::release: invalid ref count (after dispose)!" );
+
+ // release the parent in the ~
+ if (xParent.is())
+ {
+ MutexGuard aGuard( rBHelper.rMutex );
+ m_xParent = xParent;
+ }
+
+ // destroy the object if xHoldAlive decrement the refcount to 0
+ return;
+ }
+ }
+ // restore the reference count
+ osl_atomic_increment( &m_refCount );
- return aReturn;
+ // as we cover the job of the WeakComponentImplHelper we use the ...
+ OWeakObject::release();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 8256f370cce3..6a081c47a1f7 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -17,13 +17,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_java.h>
#include <dsntypes.hxx>
#include <unotools/confignode.hxx>
+#include <o3tl/safeint.hxx>
+#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
-#include <svtools/miscopt.hxx>
#include <tools/wldcrd.hxx>
#include <osl/file.hxx>
+#include <officecfg/Office/Common.hxx>
#include <comphelper/string.hxx>
+#include <utility>
namespace dbaccess
{
@@ -31,17 +35,16 @@ namespace dbaccess
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::lang;
namespace
{
- void lcl_extractHostAndPort(const OUString& _sUrl,OUString& _sHostname,sal_Int32& _nPortNumber)
+ void lcl_extractHostAndPort(std::u16string_view _sUrl, OUString& _sHostname, sal_Int32& _nPortNumber)
{
if ( comphelper::string::getTokenCount(_sUrl, ':') >= 2 )
{
sal_Int32 nPos {0};
- _sHostname = _sUrl.getToken(0, ':', nPos);
- _nPortNumber = _sUrl.getToken(0, ':', nPos).toInt32();
+ _sHostname = o3tl::getToken(_sUrl, 0, ':', nPos);
+ _nPortNumber = o3tl::toInt32(o3tl::getToken(_sUrl, 0, ':', nPos));
}
}
}
@@ -72,18 +75,18 @@ ODsnTypeCollection::~ODsnTypeCollection()
#endif
}
-OUString ODsnTypeCollection::getTypeDisplayName(const OUString& _sURL) const
+OUString ODsnTypeCollection::getTypeDisplayName(std::u16string_view _sURL) const
{
return m_aDriverConfig.getDriverTypeDisplayName(_sURL);
}
-OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const
+OUString ODsnTypeCollection::cutPrefix(std::u16string_view _sURL) const
{
OUString sRet;
OUString sOldPattern;
// on Windows or with gen rendering, the urls may begin with an ~
- const OUString& sCleanURL = comphelper::string::stripStart(_sURL, '~');
+ std::u16string_view sCleanURL = comphelper::string::stripStart(_sURL, '~');
for (auto const& dsnPrefix : m_aDsnPrefixes)
{
@@ -94,8 +97,8 @@ OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const
// foo*
// that is, the very concept of "prefix" applies.
OUString prefix(comphelper::string::stripEnd(dsnPrefix, '*'));
- OSL_ENSURE(prefix.getLength() <= sCleanURL.getLength(), "How can A match B when A shorter than B?");
- sRet = sCleanURL.copy(prefix.getLength());
+ OSL_ENSURE(o3tl::make_unsigned(prefix.getLength()) <= sCleanURL.size(), "How can A match B when A shorter than B?");
+ sRet = sCleanURL.substr(prefix.getLength());
sOldPattern = dsnPrefix;
}
}
@@ -103,7 +106,7 @@ OUString ODsnTypeCollection::cutPrefix(const OUString& _sURL) const
return sRet;
}
-OUString ODsnTypeCollection::getPrefix(const OUString& _sURL) const
+OUString ODsnTypeCollection::getPrefix(std::u16string_view _sURL) const
{
OUString sRet;
OUString sOldPattern;
@@ -116,7 +119,7 @@ OUString ODsnTypeCollection::getPrefix(const OUString& _sURL) const
// foo*
// that is, the very concept of "prefix" applies.
sRet = comphelper::string::stripEnd(dsnPrefix, '*');
- OSL_ENSURE(sRet.getLength() <= _sURL.getLength(), "How can A match B when A shorter than B?");
+ OSL_ENSURE(sRet.getLength() <= static_cast<sal_Int32>(_sURL.size()), "How can A match B when A shorter than B?");
sOldPattern = dsnPrefix;
}
}
@@ -130,7 +133,7 @@ bool ODsnTypeCollection::hasDriver( const char* _pAsciiPattern ) const
return !sPrefix.isEmpty();
}
-bool ODsnTypeCollection::isConnectionUrlRequired(const OUString& _sURL) const
+bool ODsnTypeCollection::isConnectionUrlRequired(std::u16string_view _sURL) const
{
OUString sRet;
OUString sOldPattern;
@@ -146,13 +149,13 @@ bool ODsnTypeCollection::isConnectionUrlRequired(const OUString& _sURL) const
return !sRet.isEmpty() && sRet[sRet.getLength()-1] == '*';
}
-OUString ODsnTypeCollection::getMediaType(const OUString& _sURL) const
+OUString ODsnTypeCollection::getMediaType(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
return aFeatures.getOrDefault("MediaType",OUString());
}
-OUString ODsnTypeCollection::getDatasourcePrefixFromMediaType(const OUString& _sMediaType,const OUString& _sExtension)
+OUString ODsnTypeCollection::getDatasourcePrefixFromMediaType(std::u16string_view _sMediaType,std::u16string_view _sExtension)
{
OUString sURL, sFallbackURL;
const uno::Sequence< OUString > aURLs = m_aDriverConfig.getURLs();
@@ -169,7 +172,7 @@ OUString ODsnTypeCollection::getDatasourcePrefixFromMediaType(const OUString& _s
sURL = *pIter;
break;
}
- if ( sFileExtension.isEmpty() && !_sExtension.isEmpty() )
+ if ( sFileExtension.isEmpty() && !_sExtension.empty() )
sFallbackURL = *pIter;
}
}
@@ -225,8 +228,7 @@ void ODsnTypeCollection::extractHostNamePort(const OUString& _rDsn,OUString& _sD
_rsHostname = sUrl.getToken(0,'/');
_sDatabaseName = sUrl.copy(sUrl.lastIndexOf('/')+1);
}
- else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=")
- || _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=") )
+ else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:"))
{
OUString sNewFileName;
if ( ::osl::FileBase::getFileURLFromSystemPath( sUrl, sNewFileName ) == ::osl::FileBase::E_None )
@@ -236,64 +238,63 @@ void ODsnTypeCollection::extractHostNamePort(const OUString& _rDsn,OUString& _sD
}
}
-OUString ODsnTypeCollection::getJavaDriverClass(const OUString& _sURL) const
+OUString ODsnTypeCollection::getJavaDriverClass(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getProperties(_sURL);
return aFeatures.getOrDefault("JavaDriverClass",OUString());
}
-bool ODsnTypeCollection::isFileSystemBased(const OUString& _sURL) const
+bool ODsnTypeCollection::isFileSystemBased(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
return aFeatures.getOrDefault("FileSystemBased",false);
}
-bool ODsnTypeCollection::supportsTableCreation(const OUString& _sURL) const
+bool ODsnTypeCollection::supportsTableCreation(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
return aFeatures.getOrDefault("SupportsTableCreation",false);
}
-bool ODsnTypeCollection::supportsColumnDescription(const OUString& _sURL) const
+bool ODsnTypeCollection::supportsColumnDescription(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
return aFeatures.getOrDefault("SupportsColumnDescription",false);
}
-bool ODsnTypeCollection::supportsBrowsing(const OUString& _sURL) const
+bool ODsnTypeCollection::supportsBrowsing(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
return aFeatures.getOrDefault("SupportsBrowsing",false);
}
-bool ODsnTypeCollection::supportsDBCreation(const OUString& _sURL) const
+bool ODsnTypeCollection::supportsDBCreation(std::u16string_view _sURL) const
{
const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
return aFeatures.getOrDefault("SupportsDBCreation",false);
}
-Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( const OUString& _sURL ) const
+Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( std::u16string_view _sURL ) const
{
const ::comphelper::NamedValueCollection& aProperties = m_aDriverConfig.getProperties(_sURL);
return aProperties.getPropertyValues();
}
-bool ODsnTypeCollection::isEmbeddedDatabase( const OUString& _sURL )
+bool ODsnTypeCollection::isEmbeddedDatabase( std::u16string_view _sURL )
{
- return _sURL.startsWith( "sdbc:embedded:" );
+ return o3tl::starts_with( _sURL, u"sdbc:embedded:" );
}
OUString ODsnTypeCollection::getEmbeddedDatabase()
{
- SvtMiscOptions aMiscOptions;
- if (aMiscOptions.IsExperimentalMode())
+ if (!HAVE_FEATURE_JAVA || officecfg::Office::Common::Misc::ExperimentalMode::get())
return "sdbc:embedded:firebird";
else
return "sdbc:embedded:hsqldb";
}
-DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
+DATASOURCE_TYPE ODsnTypeCollection::determineType(std::u16string_view _rDsn) const
{
OUString sDsn(comphelper::string::stripEnd(_rDsn, '*'));
sal_Int32 nSeparator = sDsn.indexOf(u':');
@@ -321,6 +322,9 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
if (sDsn.equalsIgnoreAsciiCase("sdbc:embedded:firebird"))
return DST_EMBEDDED_FIREBIRD;
+ if (sDsn.startsWithIgnoreAsciiCase("sdbc:embedded:"))
+ return DST_EMBEDDED_UNKNOWN;
+
// find second :
nSeparator = sDsn.indexOf(u':', nSeparator + 1);
if (-1 == nSeparator)
@@ -334,10 +338,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
{
if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:"))
{
- if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;"))
- return DST_MSACCESS_2007;
- else
- return DST_MSACCESS;
+ return DST_MSACCESS;
}
return DST_ADO;
}
@@ -348,8 +349,8 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
const DATASOURCE_TYPE eType;
const bool bMatchComplete;
- KnownPrefix( const OUString &_s, const DATASOURCE_TYPE _t, const bool _m )
- :sPrefix( _s )
+ KnownPrefix( OUString _s, const DATASOURCE_TYPE _t, const bool _m )
+ :sPrefix(std::move( _s ))
,eType ( _t )
,bMatchComplete( _m )
{
@@ -404,7 +405,7 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const
return DST_UNKNOWN;
}
-void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16>& _rOutPathIds) const
+void ODsnTypeCollection::fillPageIds(std::u16string_view _sURL,std::vector<sal_Int16>& _rOutPathIds) const
{
DATASOURCE_TYPE eType = determineType(_sURL);
switch(eType)
@@ -443,11 +444,13 @@ void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16
case DST_ORACLE_JDBC:
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ORACLE);
break;
+ case DST_POSTGRES:
+ _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_POSTGRES);
+ break;
case DST_LDAP:
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_LDAP);
break;
case DST_MSACCESS:
- case DST_MSACCESS_2007:
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MSACCESS);
break;
case DST_OUTLOOKEXP:
@@ -461,6 +464,7 @@ void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16
case DST_MACAB:
case DST_EMBEDDED_HSQLDB:
case DST_EMBEDDED_FIREBIRD:
+ case DST_EMBEDDED_UNKNOWN:
break;
default:
_rOutPathIds.push_back(PAGE_DBSETUPWIZARD_USERDEFINED);
@@ -468,7 +472,7 @@ void ODsnTypeCollection::fillPageIds(const OUString& _sURL,std::vector<sal_Int16
}
}
-OUString ODsnTypeCollection::getType(const OUString& _sURL) const
+OUString ODsnTypeCollection::getType(std::u16string_view _sURL) const
{
OUString sOldPattern;
for (auto const& dsnPrefix : m_aDsnPrefixes)
@@ -482,7 +486,7 @@ OUString ODsnTypeCollection::getType(const OUString& _sURL) const
return sOldPattern;
}
-sal_Int32 ODsnTypeCollection::getIndexOf(const OUString& _sURL) const
+sal_Int32 ODsnTypeCollection::getIndexOf(std::u16string_view _sURL) const
{
sal_Int32 nRet = -1;
OUString sOldPattern;
diff --git a/dbaccess/source/core/misc/objectnameapproval.cxx b/dbaccess/source/core/misc/objectnameapproval.cxx
index 3ec15caaa4fd..fa03e81e3d09 100644
--- a/dbaccess/source/core/misc/objectnameapproval.cxx
+++ b/dbaccess/source/core/misc/objectnameapproval.cxx
@@ -23,35 +23,23 @@
#include <com/sun/star/sdb/tools/XConnectionTools.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
-#include <cppuhelper/weakref.hxx>
-
namespace dbaccess
{
using ::com::sun::star::sdbc::XConnection;
- using ::com::sun::star::uno::WeakReference;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::lang::DisposedException;
using ::com::sun::star::sdb::tools::XConnectionTools;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::sdb::tools::XObjectNames;
- using ::com::sun::star::uno::XInterface;
namespace CommandType = com::sun::star::sdb::CommandType;
- // ObjectNameApproval_Impl
- struct ObjectNameApproval_Impl
- {
- WeakReference< XConnection > aConnection;
- sal_Int32 nCommandType;
- };
-
// ObjectNameApproval
ObjectNameApproval::ObjectNameApproval( const Reference< XConnection >& _rxConnection, ObjectType _eType )
- :m_pImpl( new ObjectNameApproval_Impl )
{
- m_pImpl->aConnection = _rxConnection;
- m_pImpl->nCommandType = _eType == TypeQuery ? CommandType::QUERY : CommandType::TABLE;
+ mxConnection = _rxConnection;
+ mnCommandType = _eType == TypeQuery ? CommandType::QUERY : CommandType::TABLE;
}
ObjectNameApproval::~ObjectNameApproval()
@@ -60,13 +48,13 @@ namespace dbaccess
void ObjectNameApproval::approveElement( const OUString& _rName )
{
- Reference< XConnection > xConnection( m_pImpl->aConnection );
+ Reference< XConnection > xConnection( mxConnection );
if ( !xConnection.is() )
throw DisposedException();
Reference< XConnectionTools > xConnectionTools( xConnection, UNO_QUERY_THROW );
Reference< XObjectNames > xObjectNames( xConnectionTools->getObjectNames(), css::uno::UNO_SET_THROW );
- xObjectNames->checkNameForCreate( m_pImpl->nCommandType, _rName );
+ xObjectNames->checkNameForCreate( mnCommandType, _rName );
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/misc/sdbcoretools.cxx b/dbaccess/source/core/misc/sdbcoretools.cxx
index 70de1d1944ef..7856a1484591 100644
--- a/dbaccess/source/core/misc/sdbcoretools.cxx
+++ b/dbaccess/source/core/misc/sdbcoretools.cxx
@@ -27,19 +27,16 @@
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <comphelper/interaction.hxx>
#include <rtl/ref.hxx>
-#include <rtl/ustrbuf.hxx>
namespace dbaccess
{
using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::io;
- using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::task;
@@ -80,8 +77,8 @@ namespace dbaccess
::rtl::Reference pRequest( new ::comphelper::OInteractionRequest( _rError ) );
::rtl::Reference pApprove( new ::comphelper::OInteractionApprove );
- pRequest->addContinuation( pApprove.get() );
- Optional< OUString > aMessage = xStringResolver->getStringFromInformationalRequest( pRequest.get() );
+ pRequest->addContinuation( pApprove );
+ Optional< OUString > aMessage = xStringResolver->getStringFromInformationalRequest( pRequest );
if ( aMessage.IsPresent )
sDisplayMessage = aMessage.Value;
}
@@ -95,12 +92,9 @@ namespace dbaccess
Exception aExcept;
_rError >>= aExcept;
- OUStringBuffer aBuffer;
- aBuffer.append( _rError.getValueTypeName() );
- aBuffer.append( ":\n" );
- aBuffer.append( aExcept.Message );
-
- sDisplayMessage = aBuffer.makeStringAndClear();
+ sDisplayMessage = _rError.getValueTypeName() +
+ ":\n" +
+ aExcept.Message;
}
return sDisplayMessage;
diff --git a/dbaccess/source/core/misc/services.cxx b/dbaccess/source/core/misc/services.cxx
deleted file mode 100644
index c45c1673b03e..000000000000
--- a/dbaccess/source/core/misc/services.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implementationentry.hxx>
-#include <DatabaseDataProvider.hxx>
-
-#include <databasecontext.hxx>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-
-namespace dba{
- ::cppu::ImplementationEntry const entries[] = {
- {
- &::dbaccess::DatabaseDataProvider::Create,
- &::dbaccess::DatabaseDataProvider::getImplementationName_Static,
- &::dbaccess::DatabaseDataProvider::getSupportedServiceNames_Static,
- &cppu::createSingleComponentFactory, nullptr, 0
- },
-
- {
- &dbaccess::ODatabaseContext::Create,
- &dbaccess::ODatabaseContext::getImplementationName_static,
- &dbaccess::ODatabaseContext::getSupportedServiceNames_static,
- &cppu::createOneInstanceComponentFactory, nullptr, 0
- },
-
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
- };
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* dba_component_getFactory(
- const char* pImplementationName,
- void* pServiceManager,
- void* pRegistryKey)
-{
- return cppu::component_getFactoryHelper(
- pImplementationName, pServiceManager, pRegistryKey, dba::entries);
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/misc/veto.cxx b/dbaccess/source/core/misc/veto.cxx
index d2596d4e1e11..07aa9567ec46 100644
--- a/dbaccess/source/core/misc/veto.cxx
+++ b/dbaccess/source/core/misc/veto.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <utility>
#include <veto.hxx>
namespace dbaccess
@@ -25,8 +26,8 @@ namespace dbaccess
using ::com::sun::star::uno::Any;
// Veto
- Veto::Veto( const Any& _rDetails )
- :m_aDetails( _rDetails )
+ Veto::Veto( Any _aDetails )
+ :m_aDetails(std::move( _aDetails ))
{
}
diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx
index ab5947d91261..eead0c2c7910 100644
--- a/dbaccess/source/core/recovery/dbdocrecovery.cxx
+++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx
@@ -28,9 +28,10 @@
#include <com/sun/star/io/TextInputStream.hpp>
#include <com/sun/star/util/XModifiable.hpp>
+#include <o3tl/string_view.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -65,30 +66,30 @@ namespace dbaccess
o_rBuffer.append( sal_Unicode( i_rComponentDesc.second.bForEditing ? '1' : '0' ) );
}
- bool lcl_extractCompDesc( const OUString& i_rIniLine, OUString& o_rStorName, SubComponentDescriptor& o_rCompDesc )
+ bool lcl_extractCompDesc( std::u16string_view i_rIniLine, OUString& o_rStorName, SubComponentDescriptor& o_rCompDesc )
{
- const sal_Int32 nEqualSignPos = i_rIniLine.indexOf( '=' );
- if ( nEqualSignPos < 1 )
+ const size_t nEqualSignPos = i_rIniLine.find( '=' );
+ if ( nEqualSignPos == 0 || nEqualSignPos == std::u16string_view::npos )
{
OSL_FAIL( "lcl_extractCompDesc: invalid map file entry - unexpected pos of '='" );
return false;
}
- o_rStorName = i_rIniLine.copy( 0, nEqualSignPos );
+ o_rStorName = i_rIniLine.substr( 0, nEqualSignPos );
- const sal_Int32 nCommaPos = i_rIniLine.lastIndexOf( ',' );
- if ( nCommaPos != i_rIniLine.getLength() - 2 )
+ const size_t nCommaPos = i_rIniLine.rfind( ',' );
+ if ( nCommaPos != i_rIniLine.size() - 2 )
{
OSL_FAIL( "lcl_extractCompDesc: invalid map file entry - unexpected pos of ','" );
return false;
}
- o_rCompDesc.sName = i_rIniLine.copy( nEqualSignPos + 1, nCommaPos - nEqualSignPos - 1 );
+ o_rCompDesc.sName = i_rIniLine.substr( nEqualSignPos + 1, nCommaPos - nEqualSignPos - 1 );
o_rCompDesc.bForEditing = ( i_rIniLine[ nCommaPos + 1 ] == '1' );
return true;
}
- const char sRecoveryDataSubStorageName[] = "recovery";
+ constexpr OUString sRecoveryDataSubStorageName = u"recovery"_ustr;
- const char sObjectMapStreamName[] = "storage-component-map.ini";
+ constexpr OUString sObjectMapStreamName = u"storage-component-map.ini"_ustr;
void lcl_writeObjectMap_throw( const Reference<XComponentContext> & i_rContext, const Reference< XStorage >& i_rStorage,
const MapStringToCompDesc& i_mapStorageToCompDesc )
@@ -112,12 +113,12 @@ namespace dbaccess
aTextOutput.writeLine();
}
- bool lcl_isSectionStart( const OUString& i_rIniLine, OUString& o_rSectionName )
+ bool lcl_isSectionStart( std::u16string_view i_rIniLine, OUString& o_rSectionName )
{
- const sal_Int32 nLen = i_rIniLine.getLength();
- if ( i_rIniLine.startsWith("[") && i_rIniLine.endsWith("]") )
+ const size_t nLen = i_rIniLine.size();
+ if ( o3tl::starts_with(i_rIniLine, u"[") && o3tl::ends_with(i_rIniLine, u"]") )
{
- o_rSectionName = i_rIniLine.copy( 1, nLen -2 );
+ o_rSectionName = i_rIniLine.substr( 1, nLen -2 );
return true;
}
return false;
@@ -194,20 +195,9 @@ namespace dbaccess
}
}
- // DatabaseDocumentRecovery_Data
- struct DatabaseDocumentRecovery_Data
- {
- const Reference<XComponentContext> aContext;
-
- explicit DatabaseDocumentRecovery_Data( const Reference<XComponentContext> & i_rContext )
- :aContext( i_rContext )
- {
- }
- };
-
// DatabaseDocumentRecovery
DatabaseDocumentRecovery::DatabaseDocumentRecovery( const Reference<XComponentContext> & i_rContext )
- :m_pData( new DatabaseDocumentRecovery_Data( i_rContext ) )
+ : mxContext( i_rContext )
{
}
@@ -243,7 +233,7 @@ namespace dbaccess
for ( auto const & component : aComponents )
{
- SubComponentRecovery aComponentRecovery( m_pData->aContext, xDatabaseUI, component );
+ SubComponentRecovery aComponentRecovery( mxContext, xDatabaseUI, component );
aComponentRecovery.saveToRecoveryStorage( xRecoveryStorage, aMapCompDescs );
}
}
@@ -252,7 +242,7 @@ namespace dbaccess
{
Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement(
SubComponentRecovery::getComponentsStorageName( elem.first ), ElementModes::WRITE | ElementModes::NOCREATE ) );
- lcl_writeObjectMap_throw( m_pData->aContext, xComponentsStor, elem.second );
+ lcl_writeObjectMap_throw( mxContext, xComponentsStor, elem.second );
tools::stor::commitStorageIfWriteable( xComponentsStor );
}
}
@@ -284,7 +274,7 @@ namespace dbaccess
Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement(
SubComponentRecovery::getComponentsStorageName( aKnownType ), ElementModes::READ ) );
- lcl_readObjectMap_throw( m_pData->aContext, xComponentsStor, aMapCompDescs[ aKnownType ] );
+ lcl_readObjectMap_throw( mxContext, xComponentsStor, aMapCompDescs[ aKnownType ] );
xComponentsStor->dispose();
}
@@ -318,7 +308,7 @@ namespace dbaccess
// recover the single component
Reference< XStorage > xCompStor( xComponentsStor->openStorageElement( elem.first, ElementModes::READ ) );
- SubComponentRecovery aComponentRecovery( m_pData->aContext, xDocumentUI, eComponentType );
+ SubComponentRecovery aComponentRecovery( mxContext, xDocumentUI, eComponentType );
Reference< XComponent > xSubComponent( aComponentRecovery.recoverFromStorage( xCompStor, sComponentName, elem.second.bForEditing ) );
// at the moment, we only store, during session save, sub components which are modified. So, set this
diff --git a/dbaccess/source/core/recovery/settingsimport.cxx b/dbaccess/source/core/recovery/settingsimport.cxx
index b64787aa82a4..00db4ddf3bab 100644
--- a/dbaccess/source/core/recovery/settingsimport.cxx
+++ b/dbaccess/source/core/recovery/settingsimport.cxx
@@ -19,7 +19,7 @@
#include "settingsimport.hxx"
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
#include <sax/tools/converter.hxx>
#include <xmloff/xmltoken.hxx>
@@ -54,7 +54,7 @@ namespace dbaccess
{
}
- void SettingsImport::characters( const OUString& i_rCharacters )
+ void SettingsImport::characters( std::u16string_view i_rCharacters )
{
m_aCharacters.append( i_rCharacters );
}
@@ -139,7 +139,7 @@ namespace dbaccess
o_rValue.clear();
// the characters building up th evalue
- const OUString sValue = getAccumulatedCharacters().toString();
+ std::u16string_view sValue = getAccumulatedCharacters();
const OUString& rItemType( getItemType() );
ENSURE_OR_RETURN_VOID( !rItemType.isEmpty(), "no item type -> no item value" );
@@ -170,7 +170,7 @@ namespace dbaccess
}
else if ( ::xmloff::token::IsXMLToken( rItemType, ::xmloff::token::XML_STRING ) )
{
- o_rValue <<= sValue;
+ o_rValue <<= OUString(sValue);
}
else
{
diff --git a/dbaccess/source/core/recovery/settingsimport.hxx b/dbaccess/source/core/recovery/settingsimport.hxx
index c698263adc8a..bc29bd727b8f 100644
--- a/dbaccess/source/core/recovery/settingsimport.hxx
+++ b/dbaccess/source/core/recovery/settingsimport.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SETTINGSIMPORT_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SETTINGSIMPORT_HXX
+#pragma once
#include <com/sun/star/xml/sax/XAttributeList.hpp>
@@ -49,7 +48,7 @@ namespace dbaccess
const css::uno::Reference< css::xml::sax::XAttributeList >& i_rAttributes
);
virtual void endElement();
- void characters( const OUString& i_rCharacters );
+ void characters( std::u16string_view i_rCharacters );
protected:
virtual ~SettingsImport() override;
@@ -161,6 +160,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SETTINGSIMPORT_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/storagestream.cxx b/dbaccess/source/core/recovery/storagestream.cxx
index 2831f406bbf7..613bfb729903 100644
--- a/dbaccess/source/core/recovery/storagestream.cxx
+++ b/dbaccess/source/core/recovery/storagestream.cxx
@@ -21,13 +21,12 @@
#include <com/sun/star/embed/ElementModes.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::embed::XStorage;
using ::com::sun::star::io::XStream;
diff --git a/dbaccess/source/core/recovery/storagestream.hxx b/dbaccess/source/core/recovery/storagestream.hxx
index 6dffdf7a175e..64c7e369dd1e 100644
--- a/dbaccess/source/core/recovery/storagestream.hxx
+++ b/dbaccess/source/core/recovery/storagestream.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGESTREAM_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGESTREAM_HXX
+#pragma once
#include <com/sun/star/embed/XStorage.hpp>
@@ -49,6 +48,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGESTREAM_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/storagetextstream.cxx b/dbaccess/source/core/recovery/storagetextstream.cxx
index 6ea4ef005320..a60890fa8555 100644
--- a/dbaccess/source/core/recovery/storagetextstream.cxx
+++ b/dbaccess/source/core/recovery/storagetextstream.cxx
@@ -28,15 +28,8 @@ namespace dbaccess
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::embed::XStorage;
using ::com::sun::star::io::TextOutputStream;
- using ::com::sun::star::io::XTextOutputStream2;
- // StorageTextOutputStream_Data
- struct StorageTextOutputStream_Data
- {
- Reference< XTextOutputStream2 > xTextOutput;
- };
-
- const char sLineFeed[] = "\n";
+ constexpr OUString sLineFeed = u"\n"_ustr;
// StorageTextOutputStream
StorageTextOutputStream::StorageTextOutputStream( const Reference<XComponentContext>& i_rContext,
@@ -44,11 +37,10 @@ namespace dbaccess
const OUString& i_rStreamName
)
:StorageOutputStream( i_rParentStorage, i_rStreamName )
- ,m_pData( new StorageTextOutputStream_Data )
{
- m_pData->xTextOutput = TextOutputStream::create( i_rContext );
- m_pData->xTextOutput->setEncoding( "UTF-8" );
- m_pData->xTextOutput->setOutputStream( getOutputStream() );
+ mxTextOutput = TextOutputStream::create( i_rContext );
+ mxTextOutput->setEncoding( "UTF-8" );
+ mxTextOutput->setOutputStream( getOutputStream() );
}
StorageTextOutputStream::~StorageTextOutputStream()
@@ -57,13 +49,13 @@ namespace dbaccess
void StorageTextOutputStream::writeLine( const OUString& i_rLine )
{
- m_pData->xTextOutput->writeString( i_rLine );
- m_pData->xTextOutput->writeString( sLineFeed );
+ mxTextOutput->writeString( i_rLine );
+ mxTextOutput->writeString( sLineFeed );
}
void StorageTextOutputStream::writeLine()
{
- m_pData->xTextOutput->writeString( sLineFeed );
+ mxTextOutput->writeString( sLineFeed );
}
} // namespace dbaccess
diff --git a/dbaccess/source/core/recovery/storagetextstream.hxx b/dbaccess/source/core/recovery/storagetextstream.hxx
index 5d7c889862e2..31bef3d83bd8 100644
--- a/dbaccess/source/core/recovery/storagetextstream.hxx
+++ b/dbaccess/source/core/recovery/storagetextstream.hxx
@@ -17,20 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGETEXTSTREAM_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGETEXTSTREAM_HXX
+#pragma once
#include "storagestream.hxx"
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <memory>
+namespace com::sun::star::io { class XTextOutputStream2; }
namespace dbaccess
{
// StorageTextStream
- struct StorageTextOutputStream_Data;
class StorageTextOutputStream : public StorageOutputStream
{
public:
@@ -45,11 +43,9 @@ namespace dbaccess
void writeLine();
private:
- std::unique_ptr< StorageTextOutputStream_Data > m_pData;
- };
+ css::uno::Reference< css::io::XTextOutputStream2 > mxTextOutput;
+ };
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGETEXTSTREAM_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/storagexmlstream.cxx b/dbaccess/source/core/recovery/storagexmlstream.cxx
index c04eff6f8912..e828ac73d38d 100644
--- a/dbaccess/source/core/recovery/storagexmlstream.cxx
+++ b/dbaccess/source/core/recovery/storagexmlstream.cxx
@@ -25,10 +25,7 @@
#include <com/sun/star/xml/sax/Writer.hpp>
#include <rtl/ref.hxx>
-#include <tools/diagnose_ex.h>
-#include <xmloff/attrlist.hxx>
-
-#include <stack>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
@@ -43,28 +40,19 @@ namespace dbaccess
using ::com::sun::star::xml::sax::Parser;
using ::com::sun::star::xml::sax::InputSource;
- // StorageXMLOutputStream_Data
- struct StorageXMLOutputStream_Data
- {
- Reference< XDocumentHandler > xHandler;
- std::stack< OUString > aElements;
- ::rtl::Reference< SvXMLAttributeList > xAttributes;
- };
-
// StorageXMLOutputStream
StorageXMLOutputStream::StorageXMLOutputStream( const Reference<XComponentContext>& i_rContext,
const Reference< XStorage >& i_rParentStorage,
const OUString& i_rStreamName )
:StorageOutputStream( i_rParentStorage, i_rStreamName )
- ,m_pData( new StorageXMLOutputStream_Data )
{
const Reference< XWriter > xSaxWriter = Writer::create( i_rContext );
xSaxWriter->setOutputStream( getOutputStream() );
- m_pData->xHandler.set( xSaxWriter, UNO_QUERY_THROW );
- m_pData->xHandler->startDocument();
+ mxHandler.set( xSaxWriter, UNO_QUERY_THROW );
+ mxHandler->startDocument();
- m_pData->xAttributes = new SvXMLAttributeList;
+ mxAttributes = new comphelper::AttributeList;
}
StorageXMLOutputStream::~StorageXMLOutputStream()
@@ -73,48 +61,48 @@ namespace dbaccess
void StorageXMLOutputStream::close()
{
- ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "illegal document handler" );
- m_pData->xHandler->endDocument();
+ ENSURE_OR_RETURN_VOID( mxHandler.is(), "illegal document handler" );
+ mxHandler->endDocument();
// do not call the base class, it would call closeOutput on the output stream, which is already done by
// endDocument
}
void StorageXMLOutputStream::addAttribute( const OUString& i_rName, const OUString& i_rValue ) const
{
- m_pData->xAttributes->AddAttribute( i_rName, i_rValue );
+ mxAttributes->AddAttribute( i_rName, i_rValue );
}
- void StorageXMLOutputStream::startElement( const OUString& i_rElementName ) const
+ void StorageXMLOutputStream::startElement( const OUString& i_rElementName )
{
- ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
+ ENSURE_OR_RETURN_VOID( mxHandler.is(), "no document handler" );
- m_pData->xHandler->startElement( i_rElementName, m_pData->xAttributes.get() );
- m_pData->xAttributes = new SvXMLAttributeList;
- m_pData->aElements.push( i_rElementName );
+ mxHandler->startElement( i_rElementName, mxAttributes );
+ mxAttributes = new comphelper::AttributeList;
+ maElements.push( i_rElementName );
}
- void StorageXMLOutputStream::endElement() const
+ void StorageXMLOutputStream::endElement()
{
- ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
- ENSURE_OR_RETURN_VOID( !m_pData->aElements.empty(), "no element on the stack" );
+ ENSURE_OR_RETURN_VOID( mxHandler.is(), "no document handler" );
+ ENSURE_OR_RETURN_VOID( !maElements.empty(), "no element on the stack" );
- const OUString sElementName( m_pData->aElements.top() );
- m_pData->xHandler->endElement( sElementName );
- m_pData->aElements.pop();
+ const OUString sElementName( maElements.top() );
+ mxHandler->endElement( sElementName );
+ maElements.pop();
}
void StorageXMLOutputStream::ignorableWhitespace( const OUString& i_rWhitespace ) const
{
- ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
+ ENSURE_OR_RETURN_VOID( mxHandler.is(), "no document handler" );
- m_pData->xHandler->ignorableWhitespace( i_rWhitespace );
+ mxHandler->ignorableWhitespace( i_rWhitespace );
}
void StorageXMLOutputStream::characters( const OUString& i_rCharacters ) const
{
- ENSURE_OR_RETURN_VOID( m_pData->xHandler.is(), "no document handler" );
+ ENSURE_OR_RETURN_VOID( mxHandler.is(), "no document handler" );
- m_pData->xHandler->characters( i_rCharacters );
+ mxHandler->characters( i_rCharacters );
}
// StorageXMLInputStream
diff --git a/dbaccess/source/core/recovery/storagexmlstream.hxx b/dbaccess/source/core/recovery/storagexmlstream.hxx
index ca0f3d3433a2..8a340b6fea0c 100644
--- a/dbaccess/source/core/recovery/storagexmlstream.hxx
+++ b/dbaccess/source/core/recovery/storagexmlstream.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGEXMLSTREAM_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGEXMLSTREAM_HXX
+#pragma once
#include "storagestream.hxx"
@@ -26,14 +25,13 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-
-#include <memory>
+#include <comphelper/attributelist.hxx>
+#include <rtl/ref.hxx>
+#include <stack>
namespace dbaccess
{
- // StorageXMLOutputStream
- struct StorageXMLOutputStream_Data;
class StorageXMLOutputStream : public StorageOutputStream
{
public:
@@ -48,8 +46,8 @@ namespace dbaccess
void addAttribute( const OUString& i_rName, const OUString& i_rValue ) const;
- void startElement( const OUString& i_rElementName ) const;
- void endElement() const;
+ void startElement( const OUString& i_rElementName );
+ void endElement();
void ignorableWhitespace( const OUString& i_rWhitespace ) const;
void characters( const OUString& i_rCharacters ) const;
@@ -59,7 +57,9 @@ namespace dbaccess
StorageXMLOutputStream& operator=( const StorageXMLOutputStream& ) = delete;
private:
- std::unique_ptr< StorageXMLOutputStream_Data > m_pData;
+ css::uno::Reference< css::xml::sax::XDocumentHandler > mxHandler;
+ std::stack< OUString > maElements;
+ ::rtl::Reference<comphelper::AttributeList> mxAttributes;
};
class StorageXMLInputStream
@@ -86,6 +86,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_STORAGEXMLSTREAM_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/subcomponentloader.cxx b/dbaccess/source/core/recovery/subcomponentloader.cxx
index 3393c3d13d08..a416b997fa38 100644
--- a/dbaccess/source/core/recovery/subcomponentloader.cxx
+++ b/dbaccess/source/core/recovery/subcomponentloader.cxx
@@ -22,7 +22,7 @@
#include <com/sun/star/ucb/Command.hpp>
#include <com/sun/star/frame/XController2.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaccess
{
diff --git a/dbaccess/source/core/recovery/subcomponentloader.hxx b/dbaccess/source/core/recovery/subcomponentloader.hxx
index a8f12071f7c1..4ab8678809a4 100644
--- a/dbaccess/source/core/recovery/subcomponentloader.hxx
+++ b/dbaccess/source/core/recovery/subcomponentloader.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTLOADER_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTLOADER_HXX
+#pragma once
#include <com/sun/star/awt/XWindowListener.hpp>
#include <com/sun/star/frame/XController.hpp>
@@ -69,6 +68,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTLOADER_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx
index ab16ee9e2c04..3a7a30d016f0 100644
--- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx
+++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx
@@ -36,7 +36,7 @@
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/implbase.hxx>
#include <connectivity/dbtools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
#include <xmloff/XMLSettingsExportContext.hxx>
#include <xmloff/SettingsExportHelper.hxx>
@@ -47,12 +47,10 @@ namespace dbaccess
{
using css::uno::Reference;
- using css::uno::XInterface;
using css::uno::UNO_QUERY;
using css::uno::UNO_QUERY_THROW;
using css::uno::UNO_SET_THROW;
using css::uno::Exception;
- using css::uno::RuntimeException;
using css::uno::Any;
using css::uno::Sequence;
using css::uno::XComponentContext;
@@ -160,8 +158,8 @@ namespace dbaccess
return xCommandProcessor;
}
- const char sSettingsStreamName[] = "settings.xml";
- const char sCurrentQueryDesignName[] = "ooo:current-query-design";
+ constexpr OUString sSettingsStreamName = u"settings.xml"_ustr;
+ constexpr OUString sCurrentQueryDesignName = u"ooo:current-query-design"_ustr;
}
namespace {
@@ -170,7 +168,7 @@ namespace dbaccess
class SettingsExportContext : public ::xmloff::XMLSettingsExportContext
{
public:
- SettingsExportContext( const Reference<XComponentContext>& i_rContext, const StorageXMLOutputStream& i_rDelegator )
+ SettingsExportContext( const Reference<XComponentContext>& i_rContext, StorageXMLOutputStream& i_rDelegator )
:m_rContext( i_rContext )
,m_rDelegator( i_rDelegator )
,m_aNamespace( ::xmloff::token::GetXMLToken( ::xmloff::token::XML_NP_CONFIG ) )
@@ -199,7 +197,7 @@ namespace dbaccess
private:
const Reference<XComponentContext>& m_rContext;
- const StorageXMLOutputStream& m_rDelegator;
+ StorageXMLOutputStream& m_rDelegator;
const OUString m_aNamespace;
};
@@ -382,7 +380,7 @@ namespace dbaccess
// find a free sub storage name, and create Yet Another Sub Storage
const OUString& rBaseName( lcl_getComponentStorageBaseName( m_eType ) );
- const OUString sStorName = ::dbtools::createUniqueName( xComponentsStorage.get(), rBaseName );
+ const OUString sStorName = ::dbtools::createUniqueName( xComponentsStorage, rBaseName );
const Reference< XStorage > xObjectStor( xComponentsStorage->openStorageElement(
sStorName, ElementModes::READWRITE ), UNO_SET_THROW );
@@ -480,7 +478,7 @@ namespace dbaccess
StorageXMLOutputStream aDesignOutput( m_rContext, i_rObjectStorage, sSettingsStreamName );
SettingsExportContext aSettingsExportContext( m_rContext, aDesignOutput );
- const OUString sWhitespace( " " );
+ static constexpr OUString sWhitespace( u" "_ustr );
aDesignOutput.startElement( "office:settings" );
aDesignOutput.ignorableWhitespace( sWhitespace );
@@ -560,7 +558,7 @@ namespace dbaccess
StorageXMLInputStream aDesignInput( m_rContext, i_rRecoveryStorage, sSettingsStreamName );
::rtl::Reference< SettingsDocumentHandler > pDocHandler( new SettingsDocumentHandler );
- aDesignInput.import( pDocHandler.get() );
+ aDesignInput.import( pDocHandler );
const ::comphelper::NamedValueCollection& rSettings( pDocHandler->getSettings() );
const Any& aCurrentQueryDesign = rSettings.get( sCurrentQueryDesignName );
diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.hxx b/dbaccess/source/core/recovery/subcomponentrecovery.hxx
index 9881778002fe..ee41a32dfc89 100644
--- a/dbaccess/source/core/recovery/subcomponentrecovery.hxx
+++ b/dbaccess/source/core/recovery/subcomponentrecovery.hxx
@@ -17,14 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTRECOVERY_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTRECOVERY_HXX
+#pragma once
#include "subcomponents.hxx"
#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <utility>
namespace dbaccess
{
@@ -36,10 +36,10 @@ namespace dbaccess
SubComponentRecovery(
const css::uno::Reference< css::uno::XComponentContext >& i_rContext,
const css::uno::Reference< css::sdb::application::XDatabaseDocumentUI >& i_rController,
- const css::uno::Reference< css::lang::XComponent >& i_rComponent )
+ css::uno::Reference< css::lang::XComponent > i_xComponent )
:m_rContext( i_rContext )
,m_xDocumentUI( i_rController, css::uno::UNO_SET_THROW )
- ,m_xComponent( i_rComponent )
+ ,m_xComponent(std::move( i_xComponent ))
,m_eType( UNKNOWN )
,m_aCompDesc()
{
@@ -112,6 +112,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTRECOVERY_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/recovery/subcomponents.hxx b/dbaccess/source/core/recovery/subcomponents.hxx
index 029b31c9527c..5e4173605045 100644
--- a/dbaccess/source/core/recovery/subcomponents.hxx
+++ b/dbaccess/source/core/recovery/subcomponents.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTS_HXX
-#define INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTS_HXX
+#pragma once
#include <com/sun/star/sdb/application/DatabaseObject.hpp>
@@ -59,6 +58,4 @@ namespace dbaccess
} // namespace dbaccess
-#endif // INCLUDED_DBACCESS_SOURCE_CORE_RECOVERY_SUBCOMPONENTS_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/resource/core_resource.cxx b/dbaccess/source/core/resource/core_resource.cxx
index 34ab1b0ba829..fdef07e1f8f8 100644
--- a/dbaccess/source/core/resource/core_resource.cxx
+++ b/dbaccess/source/core/resource/core_resource.cxx
@@ -21,31 +21,15 @@
#include <unotools/resmgr.hxx>
-// ---- needed as long as we have no contexts for components ---
-#include <rtl/instance.hxx>
-
namespace dbaccess
{
- // ResourceManager
- namespace
- {
- // access safety
- struct theResourceManagerMutex : public rtl::Static< osl::Mutex, theResourceManagerMutex > {};
- }
-
- OUString ResourceManager::loadString(const char* pResId)
+ OUString ResourceManager::loadString(TranslateId pResId)
{
return Translate::get(pResId, Translate::Create("dba"));
}
- OUString ResourceManager::loadString(const char* pResId, const char* _pPlaceholderAscii, const OUString& _rReplace)
- {
- OUString sString(loadString(pResId));
- return sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii), _rReplace );
- }
-
- OUString ResourceManager::loadString(const char* pResId, const char* _pPlaceholderAscii1, const OUString& _rReplace1,
- const char* _pPlaceholderAscii2, const OUString& _rReplace2)
+ OUString ResourceManager::loadString(TranslateId pResId, const char* _pPlaceholderAscii1, std::u16string_view _rReplace1,
+ const char* _pPlaceholderAscii2, std::u16string_view _rReplace2)
{
OUString sString(loadString(pResId));
sString = sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii1), _rReplace1 );