diff options
Diffstat (limited to 'dbaccess/source/ui/misc/databaseobjectview.cxx')
-rw-r--r-- | dbaccess/source/ui/misc/databaseobjectview.cxx | 77 |
1 files changed, 33 insertions, 44 deletions
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 49d3cfe5591a..112c79947393 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -31,7 +31,8 @@ #include <connectivity/dbtools.hxx> #include <osl/diagnose.h> #include <toolkit/helper/vclunohelper.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> +#include <utility> #include <vcl/window.hxx> namespace dbaui @@ -51,12 +52,11 @@ namespace dbaui DatabaseObjectView::DatabaseObjectView( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame, - const OUString& _rComponentURL ) + OUString _sComponentURL ) :m_xORB ( _rxORB ) ,m_xParentFrame ( _rxParentFrame ) - ,m_xFrameLoader ( ) ,m_xApplication ( _rxApplication ) - ,m_sComponentURL ( _rComponentURL ) + ,m_sComponentURL (std::move( _sComponentURL )) { OSL_ENSURE( m_xORB.is(), "DatabaseObjectView::DatabaseObjectView: invalid service factory!" ); OSL_ENSURE( m_xApplication.is(), "DatabaseObjectView::DatabaseObjectView: invalid connection!" ); @@ -72,7 +72,7 @@ namespace dbaui Reference< XComponent > DatabaseObjectView::createNew( const Reference< XDataSource >& _xDataSource, const ::comphelper::NamedValueCollection& i_rDispatchArgs ) { - return doCreateView( makeAny( _xDataSource ), OUString(), i_rDispatchArgs ); + return doCreateView( Any( _xDataSource ), OUString(), i_rDispatchArgs ); } Reference< XComponent > DatabaseObjectView::openExisting( const Any& _rDataSource, const OUString& _rName, @@ -104,21 +104,10 @@ namespace dbaui if ( !m_xFrameLoader.is() ) { Reference< XSingleServiceFactory > xFact = TaskCreator::create(m_xORB); - Sequence< Any > lArgs(3); - NamedValue aProp; - sal_Int32 nArg = 0; - - aProp.Name = "ParentFrame"; - aProp.Value <<= m_xParentFrame; - lArgs[nArg++] <<= aProp; - - aProp.Name = "TopWindow"; - aProp.Value <<= true; - lArgs[nArg++] <<= aProp; - - aProp.Name = "SupportPersistentWindowState"; - aProp.Value <<= true; - lArgs[nArg++] <<= aProp; + Sequence< Any > lArgs{ Any(NamedValue(u"ParentFrame"_ustr, Any(m_xParentFrame))), + Any(NamedValue(u"TopWindow"_ustr, Any(true))), + Any(NamedValue(u"SupportPersistentWindowState"_ustr, + Any(true))) }; m_xFrameLoader.set(xFact->createInstanceWithArguments(lArgs), UNO_QUERY_THROW); @@ -135,7 +124,7 @@ namespace dbaui Reference< XComponentLoader > xFrameLoader( m_xFrameLoader, UNO_SET_THROW ); xReturn = xFrameLoader->loadComponentFromURL( m_sComponentURL, - "_self", + u"_self"_ustr, 0, i_rDispatchArgs.getPropertyValues() ); @@ -158,20 +147,20 @@ namespace dbaui Reference<XDataSource> xDataSource; if ( _aDataSource >>= sDataSource ) { - i_rDispatchArgs.put( OUString(PROPERTY_DATASOURCENAME), sDataSource ); + i_rDispatchArgs.put( PROPERTY_DATASOURCENAME, sDataSource ); } else if ( _aDataSource >>= xDataSource ) { - i_rDispatchArgs.put( OUString(PROPERTY_DATASOURCE), xDataSource ); + i_rDispatchArgs.put( PROPERTY_DATASOURCE, xDataSource ); } - i_rDispatchArgs.put( OUString(PROPERTY_ACTIVE_CONNECTION), getConnection() ); + i_rDispatchArgs.put( PROPERTY_ACTIVE_CONNECTION, getConnection() ); } // QueryDesigner QueryDesigner::QueryDesigner( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame, bool _bCreateView ) - :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, _bCreateView ? OUString(URL_COMPONENT_VIEWDESIGN) : OUString(URL_COMPONENT_QUERYDESIGN) ) + :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN ) ,m_nCommandType( _bCreateView ? CommandType::TABLE : CommandType::QUERY ) { } @@ -185,22 +174,22 @@ namespace dbaui const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( PROPERTY_GRAPHICAL_DESIGN, true ); const bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && !bGraphicalDesign; - i_rDispatchArgs.put( OUString(PROPERTY_COMMAND_TYPE), m_nCommandType ); + i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, m_nCommandType ); if ( bIncludeQueryName ) { - i_rDispatchArgs.put( OUString(PROPERTY_COMMAND), _rObjectName ); + i_rDispatchArgs.put( PROPERTY_COMMAND, _rObjectName ); } if ( bEditViewAsSQLCommand ) { - i_rDispatchArgs.put( OUString(PROPERTY_ESCAPE_PROCESSING), false ); + i_rDispatchArgs.put( PROPERTY_ESCAPE_PROCESSING, false ); } } // TableDesigner TableDesigner::TableDesigner( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame ) - :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< OUString >( URL_COMPONENT_TABLEDESIGN ) ) + :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, URL_COMPONENT_TABLEDESIGN ) { } @@ -211,7 +200,7 @@ namespace dbaui if ( !_rObjectName.isEmpty() ) { - i_rDispatchArgs.put( OUString(PROPERTY_CURRENTTABLE), _rObjectName ); + i_rDispatchArgs.put( PROPERTY_CURRENTTABLE, _rObjectName ); } } @@ -254,7 +243,7 @@ namespace dbaui // ResultSetBrowser ResultSetBrowser::ResultSetBrowser( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame, bool _bTable ) - :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast < OUString >( URL_COMPONENT_DATASOURCEBROWSER ) ) + :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, URL_COMPONENT_DATASOURCEBROWSER ) ,m_bTable(_bTable) { } @@ -264,27 +253,27 @@ namespace dbaui { DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rQualifiedName ); OSL_ENSURE( !_rQualifiedName.isEmpty(),"A Table name must be set"); - OUString sCatalog; - OUString sSchema; - OUString sTable; - if ( m_bTable ) - ::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::EComposeRule::InDataManipulation ); - - i_rDispatchArgs.put( OUString(PROPERTY_COMMAND_TYPE), (m_bTable ? CommandType::TABLE : CommandType::QUERY) ); - i_rDispatchArgs.put( OUString(PROPERTY_COMMAND), _rQualifiedName ); - i_rDispatchArgs.put( OUString(PROPERTY_ENABLE_BROWSER), false ); + i_rDispatchArgs.put( PROPERTY_COMMAND, _rQualifiedName ); + i_rDispatchArgs.put( PROPERTY_ENABLE_BROWSER, false ); if ( m_bTable ) { - i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_CATALOGNAME), sCatalog ); - i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_SCHEMANAME), sSchema ); - i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_TABLENAME), sTable ); + OUString sCatalog; + OUString sSchema; + OUString sTable; + ::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::EComposeRule::InDataManipulation ); + i_rDispatchArgs.put( PROPERTY_UPDATE_CATALOGNAME, sCatalog ); + i_rDispatchArgs.put( PROPERTY_UPDATE_SCHEMANAME, sSchema ); + i_rDispatchArgs.put( PROPERTY_UPDATE_TABLENAME, sTable ); + i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, CommandType::TABLE ); } + else + i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, CommandType::QUERY ); } // RelationDesigner RelationDesigner::RelationDesigner( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame ) - :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< OUString >( URL_COMPONENT_RELATIONDESIGN ) ) + :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, URL_COMPONENT_RELATIONDESIGN ) { } } // namespace dbaui |