From 97eb8a6e0eb830f37dcba64a51d725aab4c5ff53 Mon Sep 17 00:00:00 2001 From: Jean-Noël Rouvignac Date: Wed, 30 Jan 2013 11:44:23 +0100 Subject: Removed several useless macros: A2OU, A2S, C2U, C2S, OUSTR, OUSTRING MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie859cb2dfdc7103c379fce56be88eef8fe390afd Reviewed-on: https://gerrit.libreoffice.org/1924 Tested-by: Luboš Luňák Reviewed-by: Luboš Luňák --- forms/source/xforms/binding.cxx | 29 +++++++++++----------- forms/source/xforms/computedexpression.cxx | 8 +++--- forms/source/xforms/convert.cxx | 4 +-- forms/source/xforms/model.cxx | 2 +- forms/source/xforms/model_helper.hxx | 2 +- forms/source/xforms/model_ui.cxx | 40 +++++++++++++++--------------- forms/source/xforms/pathexpression.cxx | 2 +- forms/source/xforms/resourcehelper.cxx | 12 ++++----- forms/source/xforms/submission.cxx | 14 +++++------ forms/source/xforms/unohelper.hxx | 2 -- 10 files changed, 55 insertions(+), 60 deletions(-) (limited to 'forms') diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx index a97ac8e245b4..dfcbe0d95d05 100644 --- a/forms/source/xforms/binding.cxx +++ b/forms/source/xforms/binding.cxx @@ -103,7 +103,7 @@ using com::sun::star::xsd::XDataType; -#define EXCEPT(msg) OUSTRING(msg),static_cast(this) +#define EXCEPT(msg) OUString(msg),static_cast(this) #define HANDLE_BindingID 0 #define HANDLE_BindingExpression 1 @@ -473,7 +473,7 @@ bool Binding::getExternalData() const { Reference< XPropertySet > xModelProps( mxModel, UNO_QUERY_THROW ); OSL_VERIFY( - xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExternalData" ) ) ) >>= bExternalData ); + xModelProps->getPropertyValue( "ExternalData" ) >>= bExternalData ); } catch( const Exception& ) { @@ -524,17 +524,17 @@ static void lcl_addListenerToNode( Reference xNode, Reference xTarget( xNode, UNO_QUERY ); if( xTarget.is() ) { - xTarget->addEventListener( OUSTRING("DOMCharacterDataModified"), + xTarget->addEventListener( "DOMCharacterDataModified", xListener, false ); - xTarget->addEventListener( OUSTRING("DOMCharacterDataModified"), + xTarget->addEventListener( "DOMCharacterDataModified", xListener, true ); - xTarget->addEventListener( OUSTRING("DOMAttrModified"), + xTarget->addEventListener( "DOMAttrModified", xListener, false ); - xTarget->addEventListener( OUSTRING("DOMAttrModified"), + xTarget->addEventListener( "DOMAttrModified", xListener, true ); - xTarget->addEventListener( OUSTRING("DOMAttrModified"), + xTarget->addEventListener( "DOMAttrModified", xListener, true ); - xTarget->addEventListener( OUSTRING("xforms-generic"), + xTarget->addEventListener( "xforms-generic", xListener, true ); } } @@ -545,15 +545,15 @@ static void lcl_removeListenerFromNode( Reference xNode, Reference xTarget( xNode, UNO_QUERY ); if( xTarget.is() ) { - xTarget->removeEventListener( OUSTRING("DOMCharacterDataModified"), + xTarget->removeEventListener( "DOMCharacterDataModified", xListener, false ); - xTarget->removeEventListener( OUSTRING("DOMCharacterDataModified"), + xTarget->removeEventListener( "DOMCharacterDataModified", xListener, true ); - xTarget->removeEventListener( OUSTRING("DOMAttrModified"), + xTarget->removeEventListener( "DOMAttrModified", xListener, false ); - xTarget->removeEventListener( OUSTRING("DOMAttrModified"), + xTarget->removeEventListener( "DOMAttrModified", xListener, true ); - xTarget->removeEventListener( OUSTRING("xforms-generic"), + xTarget->removeEventListener( "xforms-generic", xListener, true ); } } @@ -1018,8 +1018,7 @@ void Binding::_checkBindingID() if( msBindingID.isEmpty() ) { // no binding ID? then make one up! - OUString sIDPrefix = getResource( RID_STR_XFORMS_BINDING_UI_NAME ); - sIDPrefix += rtl::OUString(" "); + OUString sIDPrefix = getResource( RID_STR_XFORMS_BINDING_UI_NAME ) + " "; sal_Int32 nNumber = 0; OUString sName; do diff --git a/forms/source/xforms/computedexpression.cxx b/forms/source/xforms/computedexpression.cxx index f23a54613d81..362921c8808e 100644 --- a/forms/source/xforms/computedexpression.cxx +++ b/forms/source/xforms/computedexpression.cxx @@ -195,22 +195,22 @@ Reference ComputedExpression::_getXPathAPI(const xforms::EvaluationCo { // create XPath API, then register namespaces Reference xXPath( createInstance( - OUSTRING( "com.sun.star.xml.xpath.XPathAPI" ) ), + "com.sun.star.xml.xpath.XPathAPI" ), UNO_QUERY_THROW ); OSL_ENSURE( xXPath.is(), "cannot get XPath API" ); // register xforms extension# Sequence< Any > aSequence(2); NamedValue aValue; - aValue.Name = OUSTRING("Model"); + aValue.Name = "Model"; aValue.Value <<= aContext.mxModel; aSequence[0] <<= aValue; - aValue.Name = OUSTRING("ContextNode"); + aValue.Name = "ContextNode"; aValue.Value <<= aContext.mxContextNode; aSequence[1] <<= aValue; Reference aFactory = comphelper::getProcessServiceFactory(); Reference< XXPathExtension > aExtension( aFactory->createInstanceWithArguments( - OUSTRING( "com.sun.star.comp.xml.xpath.XFormsExtension"), aSequence), UNO_QUERY_THROW); + "com.sun.star.comp.xml.xpath.XFormsExtension", aSequence), UNO_QUERY_THROW); xXPath->registerExtensionInstance(aExtension); // register namespaces diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx index 8ac5265fe721..2cf40983b873 100644 --- a/forms/source/xforms/convert.cxx +++ b/forms/source/xforms/convert.cxx @@ -209,12 +209,12 @@ namespace // ------------------------------------------------------------------------ OUString lcl_toXSD_bool( const Any& rAny ) - { bool b = false; rAny >>= b; return b ? OUSTRING("true") : OUSTRING("false"); } + { bool b = false; rAny >>= b; return b ? OUString("true") : OUString("false"); } // ------------------------------------------------------------------------ Any lcl_toAny_bool( const OUString& rStr ) { - bool b = ( rStr == OUSTRING("true") || rStr == OUSTRING("1") ); + bool b = ( rStr == "true" || rStr == "1" ); return makeAny( b ); } diff --git a/forms/source/xforms/model.cxx b/forms/source/xforms/model.cxx index 34f1ab2a29b4..bce0c0368b9c 100644 --- a/forms/source/xforms/model.cxx +++ b/forms/source/xforms/model.cxx @@ -160,7 +160,7 @@ EvaluationContext Model::getEvaluationContext() if( ! xElement.is() ) { xElement = Reference( - xInstance->createElement( OUSTRING("instanceData") ), + xInstance->createElement( "instanceData" ), UNO_QUERY_THROW ); Reference( xInstance, UNO_QUERY_THROW)->appendChild( xElement ); } diff --git a/forms/source/xforms/model_helper.hxx b/forms/source/xforms/model_helper.hxx index 2ccb15c21b81..35fa556af8af 100644 --- a/forms/source/xforms/model_helper.hxx +++ b/forms/source/xforms/model_helper.hxx @@ -119,7 +119,7 @@ public: virtual bool isValid( const T& t ) const { const com::sun::star::beans::PropertyValue* pValues = t.getConstArray(); - rtl::OUString sInstance( OUSTRING("Instance") ); + rtl::OUString sInstance( "Instance" ); sal_Bool bFound = sal_False; for( sal_Int32 i = 0; ( ! bFound ) && ( i < t.getLength() ); i++ ) { diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx index d6bceaeeb89a..d0bfb79ec265 100644 --- a/forms/source/xforms/model_ui.cxx +++ b/forms/source/xforms/model_ui.cxx @@ -77,7 +77,7 @@ OUString Model::getDefaultServiceNameForNode( const XNode_t& xNode ) throw( RuntimeException ) { // determine service for control. string/text field is default. - OUString sService = OUSTRING("com.sun.star.form.component.TextField"); + OUString sService = "com.sun.star.form.component.TextField"; // query repository for suitable type OSL_ENSURE( mxDataTypes.is(), "no type repository?" ); @@ -90,12 +90,12 @@ OUString Model::getDefaultServiceNameForNode( const XNode_t& xNode ) switch( mxDataTypes->getDataType( sTypeName )->getTypeClass() ) { case com::sun::star::xsd::DataTypeClass::BOOLEAN: - sService = OUSTRING("com.sun.star.form.component.CheckBox"); + sService = "com.sun.star.form.component.CheckBox"; break; case com::sun::star::xsd::DataTypeClass::DOUBLE: case com::sun::star::xsd::DataTypeClass::DECIMAL: case com::sun::star::xsd::DataTypeClass::FLOAT: - sService = OUSTRING("com.sun.star.form.component.NumericField"); + sService = "com.sun.star.form.component.NumericField"; break; case com::sun::star::xsd::DataTypeClass::STRING: @@ -178,7 +178,7 @@ static void lcl_OutInstance( OUStringBuffer& rBuffer, if( xDoc != pModel->getDefaultInstance() ) { - rBuffer.insert( 0, OUSTRING("')") ); + rBuffer.insert( 0, "')" ); // iterate over instances, and find the right one OUString sInstanceName; @@ -200,7 +200,7 @@ static void lcl_OutInstance( OUStringBuffer& rBuffer, } rBuffer.insert( 0, sInstanceName ); - rBuffer.insert( 0, OUSTRING("instance('") ); + rBuffer.insert( 0, "instance('" ); } } @@ -231,7 +231,7 @@ OUString Model::getDefaultBindingExpressionForNode( case NodeType_TEXT_NODE: lcl_OutPosition( aBuffer, xCurrent ); - aBuffer.insert( 0, OUSTRING("text()") ); + aBuffer.insert( 0, "text()" ); break; case NodeType_ATTRIBUTE_NODE: @@ -356,17 +356,17 @@ OUString Model::getBindingName( const XPropertySet_t& xBinding, throw( RuntimeException ) { OUString sID; - xBinding->getPropertyValue( OUSTRING("BindingID" ) ) >>= sID; + xBinding->getPropertyValue( "BindingID" ) >>= sID; OUString sExpression; - xBinding->getPropertyValue( OUSTRING("BindingExpression" ) ) >>= sExpression; + xBinding->getPropertyValue( "BindingExpression" ) >>= sExpression; OUStringBuffer aBuffer; if( !sID.isEmpty() ) { aBuffer.append( sID ); - aBuffer.append( OUSTRING(" (" )); + aBuffer.append( " (" ); aBuffer.append( sExpression ); - aBuffer.append( OUSTRING(")" )); + aBuffer.append( ")" ); } else aBuffer.append( sExpression ); @@ -379,7 +379,7 @@ OUString Model::getSubmissionName( const XPropertySet_t& xSubmission, throw( RuntimeException ) { OUString sID; - xSubmission->getPropertyValue( OUSTRING("ID") ) >>= sID; + xSubmission->getPropertyValue( "ID" ) >>= sID; return sID; } @@ -421,7 +421,7 @@ Model::XDocument_t Model::newInstance( const rtl::OUString& sName, DBG_ASSERT( xInstance.is(), "failed to create DOM instance" ); Reference( xInstance, UNO_QUERY_THROW )->appendChild( - Reference( xInstance->createElement( OUSTRING("instanceData") ), + Reference( xInstance->createElement( "instanceData" ), UNO_QUERY_THROW ) ); Sequence aSequence; @@ -474,13 +474,13 @@ void Model::renameInstance( const rtl::OUString& sFrom, PropertyValue* pSeq = aSeq.getArray(); sal_Int32 nLength = aSeq.getLength(); - sal_Int32 nProp = lcl_findProp( pSeq, nLength, OUSTRING("ID") ); + sal_Int32 nProp = lcl_findProp( pSeq, nLength, "ID" ); if( nProp == -1 ) { // add name property aSeq.realloc( nLength + 1 ); pSeq = aSeq.getArray(); - pSeq[ nLength ].Name = OUSTRING("ID"); + pSeq[ nLength ].Name = "ID"; nProp = nLength; } @@ -488,12 +488,12 @@ void Model::renameInstance( const rtl::OUString& sFrom, pSeq[ nProp ].Value <<= sTo; // change url - nProp = lcl_findProp( pSeq, nLength, OUSTRING("URL") ); + nProp = lcl_findProp( pSeq, nLength, "URL" ); if(nProp != -1) pSeq[ nProp ].Value <<= sURL; // change urlonce - nProp = lcl_findProp( pSeq, nLength, OUSTRING("URLOnce") ); + nProp = lcl_findProp( pSeq, nLength, "URLOnce" ); if(nProp != -1) pSeq[ nProp ].Value <<= bURLOnce; @@ -839,7 +839,7 @@ static OUString lcl_serializeForDisplay( const Reference& xNodes ) // copy stream into buffer Reference xTextInputStream( - createInstance( OUSTRING("com.sun.star.io.TextInputStream") ), + createInstance( "com.sun.star.io.TextInputStream" ), UNO_QUERY ); Reference( xTextInputStream, UNO_QUERY_THROW ) ->setInputStream( aSerialization.getInputStream() ); @@ -884,8 +884,8 @@ static OUString lcl_serializeForDisplay( const Reference& xResult { case XPathObjectType_XPATH_BOOLEAN: aBuffer.append( xResult->getBoolean() - ? OUSTRING("true") - : OUSTRING("false") ); + ? OUString("true") + : OUString("false") ); break; case XPathObjectType_XPATH_STRING: @@ -1044,7 +1044,7 @@ void xforms::setInstanceData( #define PROP(NAME) \ if( p##NAME != NULL ) \ { \ - pSequence[ nIndex ].Name = OUSTRING(#NAME); \ + pSequence[ nIndex ].Name = OUString(#NAME); \ pSequence[ nIndex ].Value <<= *p##NAME; \ nIndex++; \ } diff --git a/forms/source/xforms/pathexpression.cxx b/forms/source/xforms/pathexpression.cxx index 028cabe58f46..256f11ce895c 100644 --- a/forms/source/xforms/pathexpression.cxx +++ b/forms/source/xforms/pathexpression.cxx @@ -93,7 +93,7 @@ const rtl::OUString PathExpression::_getExpressionForEvaluation() const { OUString sExpr = ComputedExpression::_getExpressionForEvaluation(); if( sExpr.isEmpty()) - sExpr = OUSTRING("."); + sExpr = "."; return sExpr; } diff --git a/forms/source/xforms/resourcehelper.cxx b/forms/source/xforms/resourcehelper.cxx index 2a16c509647e..a39f767e7fa6 100644 --- a/forms/source/xforms/resourcehelper.cxx +++ b/forms/source/xforms/resourcehelper.cxx @@ -26,8 +26,6 @@ using rtl::OUString; -#define OUSTRING(x) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x)) - namespace xforms { @@ -59,11 +57,11 @@ OUString getResource( sal_uInt16 nResourceId, // use old style String class for search and replace, so we don't have to // code this again. - String sString( sResource ); - sString.SearchAndReplaceAll( String(OUSTRING("$1")), String(rInfo1) ); - sString.SearchAndReplaceAll( String(OUSTRING("$2")), String(rInfo2) ); - sString.SearchAndReplaceAll( String(OUSTRING("$3")), String(rInfo3) ); - return OUString( sString ); + OUString sString( sResource ); + sString.replaceAll( "$1", rInfo1 ); + sString.replaceAll( "$2", rInfo2 ); + sString.replaceAll( "$3", rInfo3 ); + return sString; } } // namespace xforms diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx index 08485811dac3..305045b355a9 100644 --- a/forms/source/xforms/submission.cxx +++ b/forms/source/xforms/submission.cxx @@ -97,7 +97,7 @@ Submission::Submission() : mbOmitXmlDeclaration(), mbStandalone(), msCDataSectionElement(), - msReplace( OUSTRING("none") ), + msReplace( "none" ), msSeparator(), msIncludeNamespacePrefixes(), m_aFactory(comphelper::getProcessServiceFactory()) @@ -293,7 +293,7 @@ bool Submission::doSubmit( const Reference< XInteractionHandler >& xHandler ) } else { - aExpression.setExpression( OUSTRING( "/" ) ); + aExpression.setExpression( "/" ); aEvalContext = Model::getModel( mxModel )->getEvaluationContext(); } aExpression.evaluate( aEvalContext ); @@ -482,11 +482,11 @@ sal_Int64 SAL_CALL Submission::getSomething( static OUString lcl_message( const OUString& rID, const OUString& rText ) { OUStringBuffer aMessage; - aMessage.append( OUSTRING("XForms submission '") ); + aMessage.append( "XForms submission '" ); aMessage.append( rID ); - aMessage.append( OUSTRING("' failed") ); + aMessage.append( "' failed" ); aMessage.append( rText ); - aMessage.append( OUSTRING(".") ); + aMessage.append( "." ); return aMessage.makeStringAndClear(); } @@ -516,7 +516,7 @@ void SAL_CALL Submission::submitWithInteraction( if( ! bValid ) { InvalidDataOnSubmitException aInvalidDataException( - lcl_message(sID, OUSTRING(" due to invalid data") ), *this ); + lcl_message(sID, " due to invalid data" ), *this ); if( _rxHandler.is() ) { @@ -567,7 +567,7 @@ void SAL_CALL Submission::submitWithInteraction( { // exception caught: re-throw as wrapped target exception throw WrappedTargetException( - lcl_message( sID, OUSTRING(" due to exception being thrown") ), + lcl_message( sID, " due to exception being thrown" ), *this, makeAny( e ) ); } diff --git a/forms/source/xforms/unohelper.hxx b/forms/source/xforms/unohelper.hxx index a6b4e0c4e510..41e78fde5b9c 100644 --- a/forms/source/xforms/unohelper.hxx +++ b/forms/source/xforms/unohelper.hxx @@ -32,8 +32,6 @@ namespace com { namespace sun { namespace star { } } } -#define OUSTRING(msg) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( msg ) ) - namespace xforms { -- cgit