diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-01-26 23:25:22 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-01-26 23:25:22 +0100 |
commit | 61d77a767a0d519201f3a8554b343bce881c5991 (patch) | |
tree | 23ca6cde1c86316f380d575d67f5291a9a662241 /dbaccess/source/ui/app/AppControllerGen.cxx | |
parent | autorecovery: mav sanctioned the approach of the (now so-called) RecoveryStorage (diff) | |
download | core-61d77a767a0d519201f3a8554b343bce881c5991.tar.gz core-61d77a767a0d519201f3a8554b343bce881c5991.zip |
autorecovery: introduce createComponent/WithArguments at the XDatabaseDocumentUI interface
Diffstat (limited to 'dbaccess/source/ui/app/AppControllerGen.cxx')
-rw-r--r-- | dbaccess/source/ui/app/AppControllerGen.cxx | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index d919d1457331..6ae9d59c7eda 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -458,7 +458,7 @@ namespace } // ----------------------------------------------------------------------------- -void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::rtl::OUString& _rObjectName ) +void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::boost::optional< ::rtl::OUString >& i_rObjectName ) { // ensure we're connected if ( !isConnected() ) @@ -475,6 +475,9 @@ void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int ) throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); + if ( !i_rObjectName ) + return; + // ensure an existing object Reference< XNameAccess > xContainer( getElements( lcl_objectType2ElementType( _nObjectType ) ) ); if ( !xContainer.is() ) @@ -487,19 +490,19 @@ void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int { case DatabaseObject::TABLE: case DatabaseObject::QUERY: - bExistentObject = xContainer->hasByName( _rObjectName ); + bExistentObject = xContainer->hasByName( *i_rObjectName ); break; case DatabaseObject::FORM: case DatabaseObject::REPORT: { Reference< XHierarchicalNameAccess > xHierarchy( xContainer, UNO_QUERY_THROW ); - bExistentObject = xHierarchy->hasByHierarchicalName( _rObjectName ); + bExistentObject = xHierarchy->hasByHierarchicalName( *i_rObjectName ); } break; } if ( !bExistentObject ) - throw NoSuchElementException( _rObjectName, *this ); + throw NoSuchElementException( *i_rObjectName, *this ); } // ----------------------------------------------------------------------------- @@ -530,6 +533,28 @@ Reference< XComponent > SAL_CALL OApplicationController::loadComponentWithArgume } // ----------------------------------------------------------------------------- +Reference< XComponent > SAL_CALL OApplicationController::createComponent( ::sal_Int32 i_nObjectType ) throw (IllegalArgumentException, SQLException, RuntimeException) +{ + return createComponentWithArguments( i_nObjectType, Sequence< PropertyValue >() ); +} + +// ----------------------------------------------------------------------------- +Reference< XComponent > SAL_CALL OApplicationController::createComponentWithArguments( ::sal_Int32 i_nObjectType, const Sequence< PropertyValue >& i_rArguments ) throw (IllegalArgumentException, SQLException, RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( getMutex() ); + + impl_validateObjectTypeAndName_throw( i_nObjectType, ::boost::optional< ::rtl::OUString >() ); + + Reference< XComponent > xComponent( newElement( + lcl_objectType2ElementType( i_nObjectType ), + ::comphelper::NamedValueCollection( i_rArguments ) + ) ); + + return xComponent; +} + +// ----------------------------------------------------------------------------- void SAL_CALL OApplicationController::registerContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException) { if ( _Interceptor.is() ) |