diff options
Diffstat (limited to 'dbaccess/source/ui/misc/linkeddocuments.cxx')
-rw-r--r-- | dbaccess/source/ui/misc/linkeddocuments.cxx | 99 |
1 files changed, 45 insertions, 54 deletions
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index 13effe4ccd93..03b44d955de2 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -20,7 +20,7 @@ #include <core_resource.hxx> #include <linkeddocuments.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <unotools/confignode.hxx> #include <comphelper/classids.hxx> #include <comphelper/namedvaluecollection.hxx> @@ -38,6 +38,7 @@ #include <browserids.hxx> #include <com/sun/star/container/XHierarchicalNameContainer.hpp> #include <comphelper/mimeconfighelper.hxx> +#include <utility> #include <vcl/weld.hxx> #include <cppuhelper/exc_hlp.hxx> @@ -51,13 +52,10 @@ namespace dbaui using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::util; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb::application; using namespace ::com::sun::star::task; - using namespace ::svt; namespace { @@ -65,24 +63,22 @@ namespace dbaui sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 ) { - Sequence< sal_Int8 > aResult( 16 ); - aResult[0] = static_cast<sal_Int8>(n1 >> 24); - aResult[1] = static_cast<sal_Int8>(( n1 << 8 ) >> 24); - aResult[2] = static_cast<sal_Int8>(( n1 << 16 ) >> 24); - aResult[3] = static_cast<sal_Int8>(( n1 << 24 ) >> 24); - aResult[4] = static_cast<sal_Int8>(n2 >> 8); - aResult[5] = static_cast<sal_Int8>(( n2 << 8 ) >> 8); - aResult[6] = static_cast<sal_Int8>(n3 >> 8); - aResult[7] = static_cast<sal_Int8>(( n3 << 8 ) >> 8); - aResult[8] = b8; - aResult[9] = b9; - aResult[10] = b10; - aResult[11] = b11; - aResult[12] = b12; - aResult[13] = b13; - aResult[14] = b14; - aResult[15] = b15; - + Sequence< sal_Int8 > aResult{ /* [ 0] */ static_cast<sal_Int8>(n1 >> 24), + /* [ 1] */ static_cast<sal_Int8>(( n1 << 8 ) >> 24), + /* [ 2] */ static_cast<sal_Int8>(( n1 << 16 ) >> 24), + /* [ 3] */ static_cast<sal_Int8>(( n1 << 24 ) >> 24), + /* [ 4] */ static_cast<sal_Int8>(n2 >> 8), + /* [ 5] */ static_cast<sal_Int8>(( n2 << 8 ) >> 8), + /* [ 6] */ static_cast<sal_Int8>(n3 >> 8), + /* [ 7] */ static_cast<sal_Int8>(( n3 << 8 ) >> 8), + /* [ 8] */ static_cast<sal_Int8>(b8), + /* [ 9] */ static_cast<sal_Int8>(b9), + /* [10] */ static_cast<sal_Int8>(b10), + /* [11] */ static_cast<sal_Int8>(b11), + /* [12] */ static_cast<sal_Int8>(b12), + /* [13] */ static_cast<sal_Int8>(b13), + /* [14] */ static_cast<sal_Int8>(b14), + /* [15] */ static_cast<sal_Int8>(b15) }; return aResult; } } @@ -90,13 +86,13 @@ namespace dbaui // OLinkedDocumentsAccess OLinkedDocumentsAccess::OLinkedDocumentsAccess( weld::Window* pDialogParent, const Reference< XDatabaseDocumentUI >& i_rDocumentUI, const Reference< XComponentContext >& _rxContext, const Reference< XNameAccess >& _rxContainer, - const Reference< XConnection>& _xConnection, const OUString& _sDataSourceName ) + const Reference< XConnection>& _xConnection, OUString _sDataSourceName ) :m_xContext(_rxContext) ,m_xDocumentContainer(_rxContainer) ,m_xConnection(_xConnection) ,m_xDocumentUI( i_rDocumentUI ) ,m_pDialogParent(pDialogParent) - ,m_sDataSourceName(_sDataSourceName) + ,m_sDataSourceName(std::move(_sDataSourceName)) { OSL_ENSURE(m_xContext.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid service factory!"); assert(m_pDialogParent && "OLinkedDocumentsAccess::OLinkedDocumentsAccess: really need a dialog parent!"); @@ -119,15 +115,15 @@ namespace dbaui OUString sOpenMode; switch ( _eOpenMode ) { - case E_OPEN_NORMAL: + case ElementOpenMode::Normal: sOpenMode = "open"; break; - case E_OPEN_FOR_MAIL: - aArguments.put( "Hidden", true ); + case ElementOpenMode::Mail: + aArguments.put( u"Hidden"_ustr, true ); [[fallthrough]]; - case E_OPEN_DESIGN: + case ElementOpenMode::Design: sOpenMode = "openDesign"; break; @@ -135,9 +131,9 @@ namespace dbaui OSL_FAIL( "OLinkedDocumentsAccess::implOpen: invalid open mode!" ); break; } - aArguments.put( "OpenMode", sOpenMode ); + aArguments.put( u"OpenMode"_ustr, sOpenMode ); - aArguments.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection ); + aArguments.put( PROPERTY_ACTIVE_CONNECTION, m_xConnection ); Reference<XHierarchicalNameContainer> xHier(m_xDocumentContainer,UNO_QUERY); if ( xHier.is() && xHier->hasByHierarchicalName(_rLinkName) ) @@ -157,18 +153,18 @@ namespace dbaui try { ::comphelper::NamedValueCollection aArgs; - aArgs.put( "DataSourceName", m_sDataSourceName ); + aArgs.put( u"DataSourceName"_ustr, m_sDataSourceName ); if ( m_xConnection.is() ) - aArgs.put( "ActiveConnection", m_xConnection ); + aArgs.put( u"ActiveConnection"_ustr, m_xConnection ); if ( !_rObjectName.isEmpty() && ( _nCommandType != -1 ) ) { - aArgs.put( "CommandType", _nCommandType ); - aArgs.put( "Command", _rObjectName ); + aArgs.put( u"CommandType"_ustr, _nCommandType ); + aArgs.put( u"Command"_ustr, _rObjectName ); } - aArgs.put( "DocumentUI", m_xDocumentUI ); + aArgs.put( u"DocumentUI"_ustr, m_xDocumentUI ); Reference< XJobExecutor > xWizard; { @@ -180,7 +176,7 @@ namespace dbaui ), UNO_QUERY_THROW ); } - xWizard->trigger( "start" ); + xWizard->trigger( u"start"_ustr ); ::comphelper::disposeComponent( xWizard ); } catch(const Exception&) @@ -211,9 +207,9 @@ namespace dbaui OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::newDocument: invalid document container!"); // determine the class ID to use for the new document Sequence<sal_Int8> aClassId; - if ( !i_rCreationArgs.has( "ClassID" ) - && !i_rCreationArgs.has( "MediaType" ) - && !i_rCreationArgs.has( "DocumentServiceName" ) + if ( !i_rCreationArgs.has( u"ClassID"_ustr ) + && !i_rCreationArgs.has( u"MediaType"_ustr ) + && !i_rCreationArgs.has( u"DocumentServiceName"_ustr ) ) { switch ( i_nActionID ) @@ -252,15 +248,15 @@ namespace dbaui { ::comphelper::NamedValueCollection aCreationArgs( i_rCreationArgs ); if ( aClassId.hasElements() ) - aCreationArgs.put( "ClassID", aClassId ); - aCreationArgs.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection ); + aCreationArgs.put( u"ClassID"_ustr, aClassId ); + aCreationArgs.put( PROPERTY_ACTIVE_CONNECTION, m_xConnection ); // separate values which are real creation args from args relevant for opening the doc ::comphelper::NamedValueCollection aCommandArgs; - if ( aCreationArgs.has( "Hidden" ) ) + if ( aCreationArgs.has( u"Hidden"_ustr ) ) { - aCommandArgs.put( "Hidden", aCreationArgs.get( "Hidden" ) ); - aCreationArgs.remove( "Hidden" ); + aCommandArgs.put( u"Hidden"_ustr, aCreationArgs.get( u"Hidden"_ustr ) ); + aCreationArgs.remove( u"Hidden"_ustr ); } Reference< XCommandProcessor > xContent( xORB->createInstanceWithArguments( @@ -274,7 +270,7 @@ namespace dbaui // put the OpenMode into the OpenArgs OpenCommandArgument aOpenModeArg; aOpenModeArg.Mode = OpenMode::DOCUMENT; - aCommandArgs.put( "OpenMode", aOpenModeArg ); + aCommandArgs.put( u"OpenMode"_ustr, aOpenModeArg ); Command aCommand; aCommand.Name = "openDesign"; @@ -304,16 +300,13 @@ namespace dbaui OUString sMessage = DBA_RES(STR_COULDNOTOPEN_LINKEDDOC); sMessage = sMessage.replaceFirst("$file$",_rLinkName); - css::sdbc::SQLException aSQLException; - aSQLException.Message = sMessage; + css::sdbc::SQLException aSQLException(sMessage, {}, {}, 0, {}); aInfo = dbtools::SQLExceptionInfo(aSQLException); } } catch(const css::io::WrongFormatException &e) { - css::sdbc::SQLException aSQLException; - aSQLException.Message = e.Message; - aSQLException.Context = e.Context; + css::sdbc::SQLException aSQLException(e.Message, e.Context, {}, 0, {}); aInfo = dbtools::SQLExceptionInfo(aSQLException); // more like a hack, insert an empty message @@ -331,13 +324,11 @@ namespace dbaui css::sdbc::SQLException a; if ( !(aAny >>= a) || (a.ErrorCode != dbtools::ParameterInteractionCancelled) ) { - css::sdbc::SQLException aSQLException; - aSQLException.Message = e.Message; - aSQLException.Context = e.Context; + css::sdbc::SQLException aSQLException(e.Message, e.Context, {}, 0, {}); aInfo = dbtools::SQLExceptionInfo(aSQLException); // more like a hack, insert an empty message - aInfo.prepend(" \n"); + aInfo.prepend(u" \n"_ustr); OUString sMessage = DBA_RES(STR_COULDNOTOPEN_LINKEDDOC); sMessage = sMessage.replaceFirst("$file$",_rLinkName); |