summaryrefslogtreecommitdiff
path: root/dbaccess/source/core/dataaccess
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/core/dataaccess')
-rw-r--r--dbaccess/source/core/dataaccess/ComponentDefinition.cxx5
-rw-r--r--dbaccess/source/core/dataaccess/ContentHelper.cxx49
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx183
-rw-r--r--dbaccess/source/core/dataaccess/SharedConnection.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/SharedConnection.hxx7
-rw-r--r--dbaccess/source/core/dataaccess/bookmarkcontainer.cxx26
-rw-r--r--dbaccess/source/core/dataaccess/commandcontainer.cxx4
-rw-r--r--dbaccess/source/core/dataaccess/commanddefinition.cxx8
-rw-r--r--dbaccess/source/core/dataaccess/connection.cxx6
-rw-r--r--dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx1
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx43
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx124
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.hxx11
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.cxx51
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.hxx4
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx138
-rw-r--r--dbaccess/source/core/dataaccess/definitioncontainer.cxx18
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx29
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx79
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.hxx2
-rw-r--r--dbaccess/source/core/dataaccess/documenteventexecutor.cxx34
-rw-r--r--dbaccess/source/core/dataaccess/documenteventexecutor.hxx9
-rw-r--r--dbaccess/source/core/dataaccess/documenteventnotifier.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/documentevents.cxx58
-rw-r--r--dbaccess/source/core/dataaccess/intercept.cxx21
-rw-r--r--dbaccess/source/core/dataaccess/intercept.hxx4
-rw-r--r--dbaccess/source/core/dataaccess/myucp_datasupplier.cxx146
-rw-r--r--dbaccess/source/core/dataaccess/myucp_datasupplier.hxx20
-rw-r--r--dbaccess/source/core/dataaccess/myucp_resultset.cxx9
-rw-r--r--dbaccess/source/core/dataaccess/myucp_resultset.hxx2
30 files changed, 438 insertions, 657 deletions
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx
index 258cfc473a90..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;
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index bbf910cbf641..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 <tools/diagnose_ex.h>
-#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)
{
}
@@ -105,12 +103,6 @@ css::uno::Sequence< OUString > SAL_CALL OContentHelper::getSupportedServiceNames
}
-css::uno::Sequence<sal_Int8> OContentHelper::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit aId;
- return aId.getSeq();
-}
-
css::uno::Sequence<sal_Int8> OContentHelper::getImplementationId()
{
return css::uno::Sequence<sal_Int8>();
@@ -194,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 ) ),
@@ -212,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 ) ),
@@ -224,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 ) ),
@@ -250,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 );
@@ -503,16 +495,9 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
return;
// First, notify listeners interested in changes of every property.
- comphelper::OInterfaceContainerHelper2* pAllPropsContainer = m_aPropertyChangeListeners.getContainer( OUString() );
+ comphelper::OInterfaceContainerHelper3<XPropertiesChangeListener>* pAllPropsContainer = m_aPropertyChangeListeners.getContainer( OUString() );
if ( pAllPropsContainer )
- {
- comphelper::OInterfaceIteratorHelper2 aIter( *pAllPropsContainer );
- while ( aIter.hasMoreElements() )
- {
- // Propagate event.
- static_cast< XPropertiesChangeListener* >( aIter.next() )->propertiesChange( evt );
- }
- }
+ pAllPropsContainer->notifyEach( &XPropertiesChangeListener::propertiesChange, evt );
typedef std::map< XPropertiesChangeListener*, Sequence< PropertyChangeEvent > > PropertiesEventListenerMap;
PropertiesEventListenerMap aListeners;
@@ -524,15 +509,15 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
const PropertyChangeEvent& rEvent = *propertyChangeEvent;
const OUString& rName = rEvent.PropertyName;
- comphelper::OInterfaceContainerHelper2* pPropsContainer = m_aPropertyChangeListeners.getContainer( rName );
+ comphelper::OInterfaceContainerHelper3<XPropertiesChangeListener>* pPropsContainer = m_aPropertyChangeListeners.getContainer( rName );
if ( pPropsContainer )
{
- comphelper::OInterfaceIteratorHelper2 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() )
{
@@ -559,12 +544,6 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
}
}
-// css::lang::XUnoTunnel
-sal_Int64 OContentHelper::getSomething( const Sequence< sal_Int8 > & rId )
-{
- return comphelper::getSomethingImpl(rId, this);
-}
-
Reference< XInterface > SAL_CALL OContentHelper::getParent( )
{
::osl::MutexGuard aGuard(m_aMutex);
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 49a74717e559..818e70b5433b 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -48,7 +48,7 @@
#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>
@@ -58,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;
@@ -71,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;
@@ -353,7 +351,7 @@ void SAL_CALL DocumentStorageAccess::disposing( const css::lang::EventObject& So
// ODatabaseModelImpl
ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _rxContext, ODatabaseContext& _rDBContext )
- :m_aContainer(4)
+ :m_aContainer()
,m_aMacroMode( *this )
,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE )
,m_rDBContext( _rDBContext )
@@ -369,7 +367,6 @@ 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
@@ -379,11 +376,11 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _r
}
ODatabaseModelImpl::ODatabaseModelImpl(
- const OUString& _rRegistrationName,
+ OUString _sRegistrationName,
const Reference< XComponentContext >& _rxContext,
ODatabaseContext& _rDBContext
)
- :m_aContainer(4)
+ :m_aContainer()
,m_aMacroMode( *this )
,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE )
,m_rDBContext( _rDBContext )
@@ -392,7 +389,7 @@ ODatabaseModelImpl::ODatabaseModelImpl(
,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)
@@ -400,7 +397,6 @@ ODatabaseModelImpl::ODatabaseModelImpl(
,m_bModified(false)
,m_bDocumentReadOnly(false)
,m_bMacroCallsSeenWhileLoading(false)
- ,m_pSharedConnectionManager(nullptr)
,m_nControllerLockCount(0)
{
impl_construct_nothrow();
@@ -441,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
{
@@ -467,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();
}
@@ -560,7 +556,8 @@ bool ODatabaseModelImpl::objectHasMacros( const Reference< XStorage >& _rxContai
void ODatabaseModelImpl::reset()
{
m_bReadOnly = false;
- std::vector<TContentPtr>(4).swap(m_aContainer);
+ for (auto & i : m_aContainer)
+ i.reset();
if ( m_pStorageAccess.is() )
{
@@ -622,7 +619,6 @@ void ODatabaseModelImpl::clearConnections()
}
}
- m_pSharedConnectionManager = nullptr;
m_xSharedConnectionManager = nullptr;
}
@@ -649,7 +645,8 @@ void ODatabaseModelImpl::dispose()
if ( elem )
elem->m_pDataSource = nullptr;
}
- m_aContainer.clear();
+ for (auto & i : m_aContainer)
+ i.reset();
clearConnections();
@@ -833,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();
@@ -887,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);
@@ -976,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& )
{
@@ -1032,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()
};
@@ -1102,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 )
@@ -1123,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()
@@ -1321,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;
@@ -1340,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
@@ -1358,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;
@@ -1390,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&)
@@ -1418,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 31a8e68ba7b1..d893a8e298b3 100644
--- a/dbaccess/source/core/dataaccess/SharedConnection.cxx
+++ b/dbaccess/source/core/dataaccess/SharedConnection.cxx
@@ -38,8 +38,8 @@ OSharedConnection::~OSharedConnection() {}
void SAL_CALL OSharedConnection::disposing()
{
- OSharedConnection_BASE::disposing();
OConnectionWrapper::disposing();
+ OSharedConnection_BASE::disposing();
}
Reference<XStatement> SAL_CALL OSharedConnection::createStatement()
diff --git a/dbaccess/source/core/dataaccess/SharedConnection.hxx b/dbaccess/source/core/dataaccess/SharedConnection.hxx
index ea6e961cf19d..2c88e58fd55d 100644
--- a/dbaccess/source/core/dataaccess/SharedConnection.hxx
+++ b/dbaccess/source/core/dataaccess/SharedConnection.hxx
@@ -34,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;
@@ -54,7 +53,7 @@ namespace dbaccess
{
return ::comphelper::concatSequences(
OSharedConnection_BASE::getTypes(),
- OSharedConnection_BASE2::getTypes()
+ ::connectivity::OConnectionWrapper::getTypes()
);
}
@@ -62,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;
}
diff --git a/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx b/dbaccess/source/core/dataaccess/bookmarkcontainer.cxx
index bee7a0cbb7b9..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>
@@ -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());
- OInterfaceIteratorHelper3 aListenerIterator(m_aContainerListeners);
- while (aListenerIterator.hasMoreElements())
- 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());
- OInterfaceIteratorHelper3 aListenerIterator(m_aContainerListeners);
- while (aListenerIterator.hasMoreElements())
- 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));
- OInterfaceIteratorHelper3 aListenerIterator(m_aContainerListeners);
- while (aListenerIterator.hasMoreElements())
- 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 8afb81520e2d..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;
diff --git a/dbaccess/source/core/dataaccess/commanddefinition.cxx b/dbaccess/source/core/dataaccess/commanddefinition.cxx
index f460911f3392..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;
@@ -126,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/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx
index 0da533536a9d..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;
@@ -629,7 +629,7 @@ Reference< XInterface > SAL_CALL OConnection::createInstance( const OUString& _s
if ( aFind == m_aSupportServices.end() )
{
Reference<XConnection> xMy(this);
- Sequence<Any> aArgs{ Any(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)
diff --git a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
index 97a8f5b9fb86..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
{
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 79c657db3054..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"
@@ -57,7 +58,7 @@
#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>
@@ -73,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;
@@ -176,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 );
}
@@ -192,8 +187,6 @@ ODatabaseContext::~ODatabaseContext()
#endif
m_xDatabaseDocumentLoader.clear();
- m_xDBRegistrationAggregate->setDelegator( nullptr );
- m_xDBRegistrationAggregate.clear();
m_xDatabaseRegistrations.clear();
}
@@ -313,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() );
}
@@ -439,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 );
}
@@ -458,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 )
@@ -527,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 );
}
@@ -610,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;
@@ -627,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
@@ -706,17 +700,6 @@ void ODatabaseContext::databaseDocumentURLChange( const OUString& _rOldURL, cons
m_aDatabaseObjects.erase( oldPos );
}
-sal_Int64 SAL_CALL ODatabaseContext::getSomething( const Sequence< sal_Int8 >& rId )
-{
- return comphelper::getSomethingImpl(rId, this);
-}
-
-Sequence< sal_Int8 > ODatabaseContext::getUnoTunnelId()
-{
- static const comphelper::UnoIdInit implId;
- return implId.getSeq();
-}
-
void ODatabaseContext::onBasicManagerCreated( const Reference< XModel >& _rxForDocument, BasicManager& _rBasicManager )
{
#if !HAVE_FEATURE_SCRIPTING
@@ -735,7 +718,7 @@ 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
}
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index b8b352a3a59c..204bad556e5d 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -24,9 +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>
@@ -71,7 +73,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <framework/titlehelper.hxx>
#include <unotools/saveopt.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <vcl/GraphicObject.hxx>
@@ -195,28 +197,12 @@ 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( ) noexcept
-{
- ODatabaseDocument_OfficeDocument::acquire();
-}
-
-void SAL_CALL ODatabaseDocument::release( ) noexcept
-{
- 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
@@ -304,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();
}
}
-constexpr OUStringLiteral sPictures = u"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
@@ -432,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},
};
}
@@ -450,8 +435,8 @@ 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);
@@ -774,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
@@ -1028,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();
}
@@ -1088,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& )
@@ -1103,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 );
@@ -1250,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();
}
@@ -1282,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
@@ -1412,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;
@@ -1429,7 +1414,7 @@ Reference< XNameAccess > ODatabaseDocument::impl_getDocumentContainer_throw( ODa
aValue >>= sSupportService;
if ( !sSupportService.isEmpty() )
{
- Sequence<Any> aArgs{ Any(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);
@@ -1548,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,
@@ -1580,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 );
@@ -1627,17 +1612,17 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
- xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(officecfg::Office::Common::Save::Document::PrettyPrinting::get()));
+ 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;
@@ -1651,14 +1636,14 @@ 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.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 =
@@ -1678,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&)
{
@@ -1691,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 );
@@ -1868,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 )
@@ -1910,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}
};
}
@@ -1919,10 +1908,9 @@ 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{ Any(xInfoSet) };
@@ -2037,7 +2025,7 @@ struct CreateAny
{
Any operator() (const Reference<XController>& lhs) const
{
- return makeAny(lhs);
+ return Any(lhs);
}
};
@@ -2106,13 +2094,9 @@ 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);
@@ -2201,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
- = comphelper::getFromUnoTunnel<dbaccess::ODatabaseContext>(xDBContextTunnel);
+ 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 bd458d1b9259..6278aa039a63 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.hxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.hxx
@@ -148,16 +148,13 @@ typedef cppu::PartialWeakComponentImplHelper< css::frame::XModel3
, 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
{
@@ -299,8 +296,6 @@ public:
// XInterface
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type& _rType) 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;
diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
index bd215b397852..3b19de41c366 100644
--- a/dbaccess/source/core/dataaccess/databaseregistrations.cxx
+++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
@@ -27,7 +27,7 @@
#include <cppuhelper/basemutex.hxx>
#include <comphelper/interfacecontainer3.hxx>
-#include <cppuhelper/implbase1.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 {
@@ -100,7 +89,7 @@ namespace dbaccess
::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
@@ -147,7 +136,7 @@ namespace dbaccess
,m_aRegistrationListeners( m_aMutex )
{
m_aConfigurationRoot = ::utl::OConfigurationTreeRoot::createWithComponentContext(
- m_aContext, getConfigurationRootPath() );
+ m_aContext, CONF_ROOT_PATH );
}
DatabaseRegistrations::~DatabaseRegistrations()
@@ -162,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;
}
@@ -196,7 +185,7 @@ namespace dbaccess
}
::utl::OConfigurationNode aNewNode( m_aConfigurationRoot.createNode( sNewNodeName ) );
- aNewNode.setNodeValue( getNameNodeName(), makeAny( _rName ) );
+ aNewNode.setNodeValue( NAME, Any( _rName ) );
return aNewNode;
}
@@ -221,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 );
@@ -251,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;
}
@@ -265,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;
@@ -280,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
@@ -298,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()
@@ -327,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
@@ -359,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 709bc9f98490..52def1de5aa2 100644
--- a/dbaccess/source/core/dataaccess/databaseregistrations.hxx
+++ b/dbaccess/source/core/dataaccess/databaseregistrations.hxx
@@ -20,11 +20,11 @@
#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>
+css::uno::Reference<css::sdb::XDatabaseRegistrations>
createDataSourceRegistrations(const css::uno::Reference<css::uno::XComponentContext>& _rxContext);
} // namespace dbaccess
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 45ad2e500d8b..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"
@@ -55,13 +56,12 @@
#include <connectivity/dbtools.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <officecfg/Office/Common.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <osl/process.h>
#include <sal/log.hxx>
#include <tools/urlobj.hxx>
#include <unotools/sharedunocomponent.hxx>
-#include <rtl/digest.h>
#include <algorithm>
#include <iterator>
@@ -249,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 ) );
@@ -607,8 +544,7 @@ 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
{
@@ -642,7 +578,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString
if (bNeedMigration)
{
// back up content xml file if migration was successful
- static constexpr OUStringLiteral BACKUP_XML_NAME = u"content_before_migration.xml";
+ static constexpr OUString BACKUP_XML_NAME = u"content_before_migration.xml"_ustr;
try
{
if(xRootStorage->isStreamElement(BACKUP_XML_NAME))
@@ -766,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
@@ -796,25 +732,26 @@ Reference< XPropertySetInfo > ODatabaseSource::getPropertySetInfo()
// comphelper::OPropertyArrayUsageHelper
::cppu::IPropertyArrayHelper* ODatabaseSource::createArrayHelper( ) const
{
- css::uno::Sequence< css::beans::Property> aDescriptor(13);
- css::beans::Property* pDesc = aDescriptor.getArray();
- sal_Int32 nPos = 0;
- pDesc[nPos++] = css::beans::Property(PROPERTY_INFO, PROPERTY_ID_INFO, cppu::UnoType<Sequence< PropertyValue >>::get(), css::beans::PropertyAttribute::BOUND);
- pDesc[nPos++] = css::beans::Property(PROPERTY_ISPASSWORDREQUIRED, PROPERTY_ID_ISPASSWORDREQUIRED, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::BOUND);
- pDesc[nPos++] = css::beans::Property(PROPERTY_ISREADONLY, PROPERTY_ID_ISREADONLY, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::READONLY);
- pDesc[nPos++] = css::beans::Property(PROPERTY_LAYOUTINFORMATION, PROPERTY_ID_LAYOUTINFORMATION, cppu::UnoType<Sequence< PropertyValue >>::get(), css::beans::PropertyAttribute::BOUND);
- pDesc[nPos++] = css::beans::Property(PROPERTY_NAME, PROPERTY_ID_NAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY);
- pDesc[nPos++] = css::beans::Property(PROPERTY_NUMBERFORMATSSUPPLIER, PROPERTY_ID_NUMBERFORMATSSUPPLIER,
- cppu::UnoType<XNumberFormatsSupplier>::get(), css::beans::PropertyAttribute::READONLY | css::beans::PropertyAttribute::TRANSIENT);
- pDesc[nPos++] = css::beans::Property(PROPERTY_PASSWORD, PROPERTY_ID_PASSWORD, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::TRANSIENT);
- pDesc[nPos++] = css::beans::Property(PROPERTY_SETTINGS, PROPERTY_ID_SETTINGS, cppu::UnoType<XPropertySet>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::READONLY);
- pDesc[nPos++] = css::beans::Property(PROPERTY_SUPPRESSVERSIONCL, PROPERTY_ID_SUPPRESSVERSIONCL, cppu::UnoType<bool>::get(), css::beans::PropertyAttribute::BOUND);
- pDesc[nPos++] = css::beans::Property(PROPERTY_TABLEFILTER, PROPERTY_ID_TABLEFILTER, cppu::UnoType<Sequence< OUString >>::get(), css::beans::PropertyAttribute::BOUND);
- pDesc[nPos++] = css::beans::Property(PROPERTY_TABLETYPEFILTER, PROPERTY_ID_TABLETYPEFILTER, cppu::UnoType<Sequence< OUString >>::get(), css::beans::PropertyAttribute::BOUND);
- pDesc[nPos++] = css::beans::Property(PROPERTY_URL, PROPERTY_ID_URL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND);
- pDesc[nPos++] = css::beans::Property(PROPERTY_USER, PROPERTY_ID_USER, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND);
- OSL_ENSURE(nPos == aDescriptor.getLength(), "forgot to adjust the count ?");
- return new ::cppu::OPropertyArrayHelper(aDescriptor);
+ 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
@@ -861,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();
@@ -1159,7 +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;
- rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(makeAny(aRequest));
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
pRequest->addContinuation(pAbort);
pRequest->addContinuation(pAuthenticate);
@@ -1234,14 +1171,9 @@ Reference< XConnection > ODatabaseSource::getConnection(const OUString& user, co
{ // create a new proxy for the connection
if ( !m_pImpl->m_xSharedConnectionManager.is() )
{
- // TODO ideally we could just have one field, but to make that work
- // we'd need to move OSharedConnectionManager into its own file and header
- rtl::Reference<OSharedConnectionManager> manager =
- new OSharedConnectionManager( m_pImpl->m_aContext );
- m_pImpl->m_pSharedConnectionManager = manager.get();
- 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 );
}
@@ -1278,13 +1210,13 @@ Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( )
aValue >>= sSupportService;
if ( !sSupportService.isEmpty() )
{
- Sequence<Any> aArgs{ Any(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;
@@ -1300,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/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index 53824f87388f..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;
@@ -287,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 )
@@ -373,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];
@@ -386,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)
@@ -533,7 +533,7 @@ void ODefinitionContainer::implAppend(const OUString& _rName, const Reference< X
// #i44786#
lcl_ensureName( _rxNewObject, _rName );
- ::rtl::Reference< OContentHelper > pContent = comphelper::getFromUnoTunnel<OContentHelper>( _rxNewObject );
+ ::rtl::Reference< OContentHelper > pContent = dynamic_cast<OContentHelper*>( _rxNewObject.get() );
if ( pContent.is() )
{
TContentPtr pImpl = pContent->getImpl();
@@ -592,7 +592,7 @@ void ODefinitionContainer::approveNewObject(const OUString& _sName,const Referen
DBA_RES( RID_STR_NAME_ALREADY_USED ),
*this );
- ::rtl::Reference< OContentHelper > pContent( comphelper::getFromUnoTunnel<OContentHelper>( _rxObject ) );
+ ::rtl::Reference< OContentHelper > pContent( dynamic_cast<OContentHelper*>( _rxObject.get() ) );
if ( !pContent.is() )
throw IllegalArgumentException(
DBA_RES( RID_STR_OBJECT_CONTAINER_MISMATCH ),
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index f878e7b57ee7..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;
@@ -155,7 +156,7 @@ css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL ODocumentContainer
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
@@ -391,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));
}
}
}
@@ -421,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 ) ),
@@ -448,7 +449,7 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
{
// Unsupported.
ucbhelper::cancelCommandExecution(
- makeAny( UnsupportedOpenModeException(
+ Any( UnsupportedOpenModeException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
sal_Int16( aOpenCommand.Mode ) ) ),
@@ -465,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 ) ),
@@ -491,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 )
{
@@ -502,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 )
@@ -610,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 );
}
@@ -666,7 +667,7 @@ OUString SAL_CALL ODocumentContainer::composeHierarchicalName( const OUString& i
::rtl::Reference<OContentHelper> pContent;
try
{
- pContent = comphelper::getFromUnoTunnel<OContentHelper>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ));
+ pContent = dynamic_cast<OContentHelper*>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ).get());
}
catch(const Exception&)
{
@@ -710,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>();
}
@@ -749,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/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index e4dc881a1a63..227bde4cde1b 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -21,8 +21,9 @@
#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>
@@ -32,6 +33,7 @@
#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>
@@ -76,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>
@@ -145,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)
{
@@ -179,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);
@@ -506,7 +507,7 @@ void SAL_CALL ODocumentDefinition::getFastPropertyValue( Any& o_rValue, sal_Int3
OUString sPersistentPath;
if ( !m_pImpl->m_aProps.sPersistentName.isEmpty() )
{
- sPersistentPath = ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT )
+ sPersistentPath = ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::ObjectType::Form : ODatabaseModelImpl::ObjectType::Report )
+ "/" + m_pImpl->m_aProps.sPersistentName;
}
o_rValue <<= sPersistentPath;
@@ -719,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& )
{
@@ -850,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
@@ -880,7 +881,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
{
// not supported
ucbhelper::cancelCommandExecution(
- makeAny( UnsupportedOpenModeException(
+ Any( UnsupportedOpenModeException(
OUString(),
static_cast< cppu::OWeakObject * >( this ),
sal_Int16( nOpenMode ) ) ),
@@ -928,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 )
@@ -947,7 +948,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
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 )
@@ -994,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() );
}
}
}
@@ -1015,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 ) ),
@@ -1041,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 ) ),
@@ -1112,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& )
{
@@ -1158,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 ) ),
@@ -1228,7 +1229,7 @@ bool ODocumentDefinition::save(bool _bApprove, const css::uno::Reference<css::aw
}
aRequest.Content.set(m_xParentContainer,UNO_QUERY);
- rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(makeAny(aRequest));
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
// two continuations allowed: OK and Cancel
rtl::Reference<ODocumentSaveContinuation> pDocuSave;
@@ -1269,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();
}
@@ -1314,7 +1315,7 @@ void ODocumentDefinition::saveAs()
aRequest.Name = m_pImpl->m_aProps.aTitle;
aRequest.Content.set(m_xParentContainer,UNO_QUERY);
- rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(makeAny(aRequest));
+ rtl::Reference<OInteractionRequest> pRequest = new OInteractionRequest(Any(aRequest));
// some knittings
// two continuations allowed: OK and Cancel
rtl::Reference<ODocumentSaveContinuation> pDocuSave = new ODocumentSaveContinuation;
@@ -1360,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&)
{
@@ -1386,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 )
{
@@ -1403,7 +1404,7 @@ namespace
}
}
- if ( !!_bReadOnly )
+ if ( _bReadOnly.has_value() )
_io_rArgs.put( "ReadOnly", *_bReadOnly );
}
}
@@ -1429,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.
@@ -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() )
@@ -1925,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>();
}
@@ -2075,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 389ab601f2ab..5569276d4a7d 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.hxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx
@@ -207,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
);
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 90dc9083c4a3..58aee4bcd590 100644
--- a/dbaccess/source/core/dataaccess/documenteventexecutor.hxx
+++ b/dbaccess/source/core/dataaccess/documenteventexecutor.hxx
@@ -23,15 +23,13 @@
#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;
@@ -51,7 +49,8 @@ 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
diff --git a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
index 6a7088f95787..475b16c0b551 100644
--- a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
+++ b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
@@ -24,7 +24,7 @@
#include <comphelper/asyncnotification.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
diff --git a/dbaccess/source/core/dataaccess/documentevents.cxx b/dbaccess/source/core/dataaccess/documentevents.cxx
index cd4428775e03..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;
}
}
@@ -115,20 +99,20 @@ namespace dbaccess
void SAL_CALL DocumentEvents::acquire() noexcept
{
- m_pData->rParent.acquire();
+ mrParent.acquire();
}
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 3e7f309976f9..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;
@@ -208,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);
@@ -225,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);
@@ -249,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);
@@ -303,14 +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());
- auto aRetRange = asNonConstRange(aRet);
+ 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();
diff --git a/dbaccess/source/core/dataaccess/intercept.hxx b/dbaccess/source/core/dataaccess/intercept.hxx
index 16077c3c9e52..7ce53752f19d 100644
--- a/dbaccess/source/core/dataaccess/intercept.hxx
+++ b/dbaccess/source/core/dataaccess/intercept.hxx
@@ -103,7 +103,9 @@ 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
diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
index e0d32d56971b..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;
+ 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,7 +175,7 @@ bool DataSupplier::getResult( sal_uInt32 nIndex )
}
if ( !bFound )
- m_pImpl->m_bCountFinal = true;
+ m_bCountFinal = true;
rtl::Reference< ::ucbhelper::ResultSet > xResultSet = getResultSet();
if ( xResultSet.is() )
@@ -227,11 +183,10 @@ bool DataSupplier::getResult( sal_uInt32 nIndex )
// 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,22 +195,22 @@ 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();
if ( xResultSet.is() )
@@ -263,34 +218,33 @@ sal_uInt32 DataSupplier::totalCount()
// 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 8083f5ef59fa..65a45ad7fef6 100644
--- a/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
+++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
@@ -20,17 +20,33 @@
#pragma once
#include <rtl/ref.hxx>
+#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/resultset.hxx>
#include "documentcontainer.hxx"
#include <memory>
namespace dbaccess
{
-struct DataSupplier_Impl;
+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;
+
+ 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);
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 ae269ffb8ac9..220bdf0a70b7 100644
--- a/dbaccess/source/core/dataaccess/myucp_resultset.hxx
+++ b/dbaccess/source/core/dataaccess/myucp_resultset.hxx
@@ -39,7 +39,7 @@ 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 );
};