summaryrefslogtreecommitdiff
path: root/dbaccess/source/core/dataaccess/documentcontainer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/core/dataaccess/documentcontainer.cxx')
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx108
1 files changed, 28 insertions, 80 deletions
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index d9427eff0463..bdec740dc305 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,64 +29,30 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef _DBA_COREDATAACCESS_DOCUMENTCONTAINER_HXX_
#include "documentcontainer.hxx"
-#endif
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
#include "dbastrings.hrc"
-#endif
-#ifndef _DBA_COREDATAACCESS_DOCUMENTDEFINITION_HXX_
#include "documentdefinition.hxx"
-#endif
-#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_OPENMODE_HPP_
#include <com/sun/star/ucb/OpenMode.hpp>
-#endif
-#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
#include <connectivity/dbtools.hxx>
-#endif
-#ifndef DBA_UCPRESULTSET_HXX
#include "myucp_resultset.hxx"
-#endif
-#ifndef _UCBHELPER_CANCELCOMMANDEXECUTION_HXX_
#include <ucbhelper/cancelcommandexecution.hxx>
-#endif
-#ifndef _COM_SUN_STAR_UCB_UNSUPPORTEDOPENMODEEXCEPTION_HPP_
#include <com/sun/star/ucb/UnsupportedOpenModeException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UCB_INSERTCOMMANDARGUMENT_HPP_
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_ERRORCONDITION_HPP_
#include <com/sun/star/sdb/ErrorCondition.hpp>
-#endif
-#ifndef _DBA_COREDATAACCESS_DATASOURCE_HXX_
#include "datasource.hxx"
-#endif
#include <comphelper/classids.hxx>
-#ifndef _COMPHELPER_MIMECONFIGHELPER_HXX_
#include <comphelper/mimeconfighelper.hxx>
-#endif
-#ifndef INCLUDED_COMPHELPER_STRING_HXX
#include <comphelper/string.hxx>
-#endif
-#ifndef CONNECTIVITY_SQLERROR_HXX
#include <connectivity/sqlerror.hxx>
-#endif
#include "core_resource.hxx"
#include "core_resource.hrc"
#include <comphelper/namedvaluecollection.hxx>
#include <vcl/svapp.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <comphelper/namedvaluecollection.hxx>
using namespace ::com::sun::star::uno;
@@ -101,10 +68,8 @@ using namespace ::osl;
using namespace ::comphelper;
using namespace ::cppu;
-//........................................................................
namespace dbaccess
{
-//........................................................................
//==========================================================================
//= LocalNameApproval
@@ -125,7 +90,6 @@ public:
void SAL_CALL approveElement( const ::rtl::OUString& _rName, const Reference< XInterface >& _rxElement );
};
-//--------------------------------------------------------------------------
void SAL_CALL LocalNameApproval::approveElement( const ::rtl::OUString& _rName, const Reference< XInterface >& /*_rxElement*/ )
{
if ( _rName.indexOf( '/' ) != -1 )
@@ -140,7 +104,7 @@ void SAL_CALL LocalNameApproval::approveElement( const ::rtl::OUString& _rName,
//= ODocumentContainer
//==========================================================================
DBG_NAME(ODocumentContainer)
-//--------------------------------------------------------------------------
+
ODocumentContainer::ODocumentContainer(const Reference< XMultiServiceFactory >& _xORB
,const Reference< XInterface >& _xParentContainer
,const TContentPtr& _pImpl
@@ -157,7 +121,6 @@ ODocumentContainer::ODocumentContainer(const Reference< XMultiServiceFactory >&
setElementApproval( PContainerApprove( new LocalNameApproval ( _xORB ) ) );
}
-//--------------------------------------------------------------------------
ODocumentContainer::~ODocumentContainer()
{
DBG_DTOR(ODocumentContainer, NULL);
@@ -168,7 +131,7 @@ ODocumentContainer::~ODocumentContainer()
dispose();
}
}
-// -----------------------------------------------------------------------------
+
IMPLEMENT_FORWARD_XINTERFACE3( ODocumentContainer,ODefinitionContainer,ODocumentContainer_Base,OPropertyStateContainer)
IMPLEMENT_TYPEPROVIDER3(ODocumentContainer,ODefinitionContainer,OPropertyStateContainer,ODocumentContainer_Base);
IMPLEMENT_SERVICE_INFO_IMPLNAME(ODocumentContainer, "com.sun.star.comp.dba.ODocumentContainer");
@@ -182,13 +145,11 @@ Sequence< ::rtl::OUString > SAL_CALL ODocumentContainer::getSupportedServiceName
return aSupported;
}
-// -----------------------------------------------------------------------------
::rtl::OUString ODocumentContainer::determineContentType() const
{
return ::rtl::OUString();
}
-//--------------------------------------------------------------------------
Reference< XContent > ODocumentContainer::createObject( const ::rtl::OUString& _rName)
{
const ODefinitionContainer_Impl& rDefinitions( getDefinitions() );
@@ -198,7 +159,7 @@ Reference< XContent > ODocumentContainer::createObject( const ::rtl::OUString& _
return new ODocumentContainer( m_aContext.getLegacyServiceFactory(), *this, aFind->second, m_bFormsContainer );
return new ODocumentDefinition( *this, m_aContext.getLegacyServiceFactory(), aFind->second, m_bFormsContainer );
}
-// -----------------------------------------------------------------------------
+
Reference< XInterface > SAL_CALL ODocumentContainer::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (Exception, RuntimeException)
{
return createInstanceWithArguments( aServiceSpecifier, Sequence< Any >() );
@@ -217,7 +178,6 @@ namespace
}
}
-// -----------------------------------------------------------------------------
Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& _aArguments ) throw (Exception, RuntimeException)
{
Reference< XInterface > xRet;
@@ -226,7 +186,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
{
MutexGuard aGuard(m_aMutex);
- // extrat known arguments
+ // extract known arguments
::rtl::OUString sName, sPersistentName, sURL, sMediaType, sDocServiceName;
Reference< XCommandProcessor > xCopyFrom;
Reference< XConnection > xConnection;
@@ -271,7 +231,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
if ( bNew )
{
const static ::rtl::OUString sBaseName(RTL_CONSTASCII_USTRINGPARAM("Obj"));
- // -----------------------------------------------------------------------------
+
sPersistentName = sBaseName;
sPersistentName += ::rtl::OUString::valueOf(sal_Int32(rDefinitions.size() + 1));
Reference<XNameAccess> xElements(getContainerStorage(),UNO_QUERY);
@@ -353,8 +313,6 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
xCommandProcessor->execute(aCommand,-1,Reference< XCommandEnvironment >());
}
}
-
- // xRet = xContent;
}
else if ( ServiceSpecifier == SERVICE_NAME_FORM_COLLECTION || SERVICE_NAME_REPORT_COLLECTION == ServiceSpecifier )
{
@@ -442,7 +400,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments
xRet = xContent;
return xRet;
}
-// -----------------------------------------------------------------------------
+
Sequence< ::rtl::OUString > SAL_CALL ODocumentContainer::getAvailableServiceNames( ) throw (RuntimeException)
{
Sequence< ::rtl::OUString > aSe(3);
@@ -451,7 +409,7 @@ Sequence< ::rtl::OUString > SAL_CALL ODocumentContainer::getAvailableServiceName
aSe[2] = SERVICE_NAME_REPORT_COLLECTION;
return aSe;
}
-// -----------------------------------------------------------------------------
+
Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 CommandId, const Reference< XCommandEnvironment >& Environment ) throw (Exception, CommandAbortedException, RuntimeException)
{
Any aRet;
@@ -463,7 +421,7 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
OpenCommandArgument2 aOpenCommand;
if ( !( aCommand.Argument >>= aOpenCommand ) )
{
- OSL_ENSURE( sal_False, "Wrong argument type!" );
+ OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
makeAny( IllegalArgumentException(
rtl::OUString(),
@@ -509,7 +467,7 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
InsertCommandArgument arg;
if ( !( aCommand.Argument >>= arg ) )
{
- OSL_ENSURE( sal_False, "Wrong argument type!" );
+ OSL_FAIL( "Wrong argument type!" );
ucbhelper::cancelCommandExecution(
makeAny( IllegalArgumentException(
rtl::OUString(),
@@ -536,7 +494,7 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com
aRet = OContentHelper::execute(aCommand,CommandId,Environment);
return aRet;
}
-// -----------------------------------------------------------------------------
+
namespace
{
sal_Bool lcl_queryContent(const ::rtl::OUString& _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,::rtl::OUString& _sSimpleName)
@@ -569,13 +527,13 @@ namespace
return bRet;
}
}
-// -----------------------------------------------------------------------------
+
Reference< XComponent > SAL_CALL ODocumentContainer::loadComponentFromURL( const ::rtl::OUString& _sURL
, const ::rtl::OUString& /*TargetFrameName*/
, sal_Int32 /*SearchFlags*/
, const Sequence< PropertyValue >& Arguments ) throw (IOException, IllegalArgumentException, RuntimeException)
{
- vos::OGuard aSolarGuard(Application::GetSolarMutex());
+ ::SolarMutexGuard aSolarGuard;
MutexGuard aGuard(m_aMutex);
Reference< XComponent > xComp;
@@ -608,18 +566,17 @@ Reference< XComponent > SAL_CALL ODocumentContainer::loadComponentFromURL( const
xComp.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()),UNO_QUERY);
}
}
- catch(NoSuchElementException)
+ catch(const NoSuchElementException&)
{
throw IllegalArgumentException();
}
- catch(WrappedTargetException e)
+ catch(const WrappedTargetException&)
{
- // throw IllegalArgumentException();
throw;
}
return xComp;
}
-// -----------------------------------------------------------------------------
+
Any SAL_CALL ODocumentContainer::getByHierarchicalName( const ::rtl::OUString& _sName ) throw (NoSuchElementException, RuntimeException)
{
MutexGuard aGuard(m_aMutex);
@@ -630,7 +587,7 @@ Any SAL_CALL ODocumentContainer::getByHierarchicalName( const ::rtl::OUString& _
return aContent;
throw NoSuchElementException(_sName,*this);
}
-// -----------------------------------------------------------------------------
+
sal_Bool SAL_CALL ODocumentContainer::hasByHierarchicalName( const ::rtl::OUString& _sName ) throw (RuntimeException)
{
MutexGuard aGuard(m_aMutex);
@@ -639,7 +596,7 @@ sal_Bool SAL_CALL ODocumentContainer::hasByHierarchicalName( const ::rtl::OUStri
::rtl::OUString sName;
return lcl_queryContent(_sName,xNameContainer,aContent,sName);
}
-// -----------------------------------------------------------------------------
+
// XHierarchicalNameContainer
void SAL_CALL ODocumentContainer::insertByHierarchicalName( const ::rtl::OUString& _sName, const Any& _aElement ) throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
@@ -664,7 +621,7 @@ void SAL_CALL ODocumentContainer::insertByHierarchicalName( const ::rtl::OUStrin
xNameContainer->insertByName(sName,_aElement);
}
-// -----------------------------------------------------------------------------
+
void SAL_CALL ODocumentContainer::removeByHierarchicalName( const ::rtl::OUString& _sName ) throw (NoSuchElementException, WrappedTargetException, RuntimeException)
{
if ( !_sName.getLength() )
@@ -679,7 +636,7 @@ void SAL_CALL ODocumentContainer::removeByHierarchicalName( const ::rtl::OUStrin
xNameContainer->removeByName(sName);
}
-// -----------------------------------------------------------------------------
+
// XHierarchicalNameReplace
void SAL_CALL ODocumentContainer::replaceByHierarchicalName( const ::rtl::OUString& _sName, const Any& _aElement ) throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
{
@@ -697,14 +654,12 @@ void SAL_CALL ODocumentContainer::replaceByHierarchicalName( const ::rtl::OUStri
xNameContainer->replaceByName(sName,_aElement);
}
-// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL ODocumentContainer::getHierarchicalName() throw (RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
return impl_getHierarchicalName( false );
}
-// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL ODocumentContainer::composeHierarchicalName( const ::rtl::OUString& i_rRelativeName ) throw (IllegalArgumentException, NoSupportException, RuntimeException)
{
::rtl::OUStringBuffer aBuffer;
@@ -714,7 +669,6 @@ void SAL_CALL ODocumentContainer::replaceByHierarchicalName( const ::rtl::OUStri
return aBuffer.makeStringAndClear();
}
-// -----------------------------------------------------------------------------
::rtl::Reference<OContentHelper> ODocumentContainer::getContent(const ::rtl::OUString& _sName) const
{
::rtl::Reference<OContentHelper> pContent = NULL;
@@ -724,17 +678,17 @@ void SAL_CALL ODocumentContainer::replaceByHierarchicalName( const ::rtl::OUStri
if ( xUnoTunnel.is() )
pContent = reinterpret_cast<OContentHelper*>(xUnoTunnel->getSomething(OContentHelper::getUnoTunnelImplementationId()));
}
- catch(Exception)
+ catch(const Exception&)
{
}
return pContent;
}
-// -----------------------------------------------------------------------------
+
void ODocumentContainer::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, Any& _rDefault ) const
{
_rDefault.clear();
}
-// -----------------------------------------------------------------------------
+
void SAL_CALL ODocumentContainer::commit( ) throw (::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
{
MutexGuard aGuard(m_aMutex);
@@ -750,7 +704,7 @@ void SAL_CALL ODocumentContainer::commit( ) throw (::com::sun::star::io::IOExce
if ( xTrans.is() )
xTrans->commit();
}
-// -----------------------------------------------------------------------------
+
void SAL_CALL ODocumentContainer::revert( ) throw (::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
{
MutexGuard aGuard(m_aMutex);
@@ -766,7 +720,7 @@ void SAL_CALL ODocumentContainer::revert( ) throw (::com::sun::star::io::IOExce
if ( xTrans.is() )
xTrans->revert();
}
-// -----------------------------------------------------------------------------
+
Reference< XStorage> ODocumentContainer::getContainerStorage() const
{
return m_pImpl->m_pDataSource
@@ -774,7 +728,6 @@ Reference< XStorage> ODocumentContainer::getContainerStorage() const
: Reference< XStorage>();
}
-// -----------------------------------------------------------------------------
void SAL_CALL ODocumentContainer::removeByName( const ::rtl::OUString& _rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
{
ResettableMutexGuard aGuard(m_aMutex);
@@ -798,12 +751,9 @@ void SAL_CALL ODocumentContainer::removeByName( const ::rtl::OUString& _rName )
// do the removal
implRemove(_rName);
- // disposeComponent(xContent); // no dispose here, the object may be inserted again under a different name
-
notifyByName( aGuard, _rName, NULL, NULL, E_REMOVED, ContainerListemers );
}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
+
void SAL_CALL ODocumentContainer::rename( const ::rtl::OUString& newName ) throw (SQLException, ElementExistException, RuntimeException)
{
try
@@ -827,7 +777,5 @@ void SAL_CALL ODocumentContainer::rename( const ::rtl::OUString& newName ) throw
}
}
-//........................................................................
} // namespace dbaccess
-//........................................................................
-
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */