Tag: cws_src680_dba24c User: fs Date: 2007-09-18 13:42:10+0000 Modified: dba/dbaccess/source/ui/dlg/sqlmessage.cxx
Log: #i81095# when displaying strings in the primary dialog, then strip the vendor identifier '[OOoBase]', if applicable File Changes: Directory: /dba/dbaccess/source/ui/dlg/ ======================================= File [changed]: sqlmessage.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/sqlmessage.cxx?r1=1.27&r2=1.27.38.1 Delta lines: +30 -3 -------------------- --- sqlmessage.cxx 2007-07-06 08:19:33+0000 1.27 +++ sqlmessage.cxx 2007-09-18 13:42:07+0000 1.27.38.1 @@ -4,9 +4,9 @@ * * $RCSfile: sqlmessage.cxx,v $ * - * $Revision: 1.27 $ + * $Revision: 1.27.38.1 $ * - * last change: $Author: rt $ $Date: 2007/07/06 08:19:33 $ + * last change: $Author: fs $ $Date: 2007/09/18 13:42:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -63,6 +63,9 @@ #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> #endif +#ifndef CONNECTIVITY_SQLERROR_HXX +#include <connectivity/sqlerror.hxx> +#endif #ifndef _SV_MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif @@ -263,6 +266,28 @@ typedef ::std::vector< ExceptionDisplayInfo > ExceptionDisplayChain; //------------------------------------------------------------------------------ + /// strips the [OOoBase] vendor identifier from the given error message, if applicable + ::rtl::OUString lcl_stripOOoBaseVendor( const ::rtl::OUString& _rErrorMessage ) + { + ::rtl::OUString sErrorMessage( _rErrorMessage ); + + const ::rtl::OUString sVendorIdentifier( ::connectivity::SQLError::getMessagePrefix() ); + if ( sErrorMessage.indexOf( sVendorIdentifier ) == 0 ) + { + // characters to strip + sal_Int32 nStripLen( sVendorIdentifier.getLength() ); + // usually, there should be a whitespace between the vendor and the real message + while ( ( sErrorMessage.getLength() > nStripLen ) + && ( sErrorMessage[nStripLen] == ' ' ) + ) + ++nStripLen; + sErrorMessage = sErrorMessage.copy( nStripLen ); + } + + return sErrorMessage; + } + + //------------------------------------------------------------------------------ void lcl_buildExceptionChain( const SQLExceptionInfo& _rErrorInfo, const ProviderFactory& _rFactory, ExceptionDisplayChain& _out_rChain ) { { @@ -532,6 +557,7 @@ // primary text lcl_positionInAppFont( *this, m_aTitle, TEXT_POS_X, OUTER_MARGIN, DIALOG_WIDTH - TEXT_POS_X - 2 * OUTER_MARGIN, 16 ); + sPrimary = lcl_stripOOoBaseVendor( sPrimary ); m_aTitle.SetText( sPrimary ); m_aTitle.Show(); @@ -539,6 +565,7 @@ // secondary text (if applicable) m_aMessage.SetStyle( m_aMessage.GetStyle() | WB_NOLABEL ); + sSecondary = lcl_stripOOoBaseVendor( sSecondary ); m_aMessage.SetText( sSecondary ); lcl_positionInAppFont( *this, m_aMessage, TEXT_POS_X, OUTER_MARGIN + 16 + 3, DIALOG_WIDTH - TEXT_POS_X - 2 * OUTER_MARGIN, 8 ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
