From 1b9c7dae5a62c91e51a03f3d5a1c452a494a08d0 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Thu, 6 Sep 2012 19:38:11 -0300 Subject: More OUString cleanup in vbahelper Change-Id: Ibf1661c612486a3d5259d0e78dd03294d5eeef76 Reviewed-on: https://gerrit.libreoffice.org/576 Reviewed-by: Olivier Hallot Tested-by: Olivier Hallot --- vbahelper/source/vbahelper/vbacommandbars.cxx | 38 ++++++++--------- vbahelper/source/vbahelper/vbadialogbase.cxx | 4 +- vbahelper/source/vbahelper/vbadocumentbase.cxx | 48 ++++++++++------------ vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 11 ++--- vbahelper/source/vbahelper/vbafontbase.cxx | 20 ++++----- 5 files changed, 57 insertions(+), 64 deletions(-) (limited to 'vbahelper/source') diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx index 72c60a05c875..e8a200044d24 100644 --- a/vbahelper/source/vbahelper/vbacommandbars.cxx +++ b/vbahelper/source/vbahelper/vbacommandbars.cxx @@ -39,7 +39,7 @@ class CommandBarEnumeration : public CommandBarEnumeration_BASE uno::Reference< XHelperInterface > m_xParent; uno::Reference< uno::XComponentContext > m_xContext; VbaCommandBarHelperRef m_pCBarHelper; - uno::Sequence< rtl::OUString > m_sNames; + uno::Sequence< OUString > m_sNames; sal_Int32 m_nCurrentPosition; public: CommandBarEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, VbaCommandBarHelperRef pHelper) throw ( uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_pCBarHelper( pHelper ) , m_nCurrentPosition( 0 ) @@ -58,7 +58,7 @@ public: // FIXME: should be add menubar if( hasMoreElements() ) { - rtl::OUString sResourceUrl( m_sNames[ m_nCurrentPosition++ ] ); + OUString sResourceUrl( m_sNames[ m_nCurrentPosition++ ] ); if( sResourceUrl.indexOf( "private:resource/toolbar/" ) != -1 ) { uno::Reference< container::XIndexAccess > xCBarSetting = m_pCBarHelper->getSettings( sResourceUrl ); @@ -100,9 +100,9 @@ uno::Any ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) { // aSource should be a name at this time, because of the class is API wrapper. - rtl::OUString sResourceUrl; + OUString sResourceUrl; uno::Reference< container::XIndexAccess > xBarSettings; - rtl::OUString sBarName; + OUString sBarName; sal_Bool bMenu = sal_False; uno::Any aRet; @@ -114,7 +114,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Worksheet Menu Bar") ) ) { // spreadsheet menu bar - sResourceUrl = rtl::OUString( ITEM_MENUBAR_URL ); + sResourceUrl = ITEM_MENUBAR_URL; bMenu = sal_True; } else if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Cell") ) ) @@ -128,7 +128,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) if( sBarName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("Menu Bar") ) ) { // text processor menu bar - sResourceUrl = rtl::OUString( ITEM_MENUBAR_URL ); + sResourceUrl = ITEM_MENUBAR_URL; bMenu = sal_True; } } @@ -148,7 +148,7 @@ ScVbaCommandBars::createCollectionObject( const uno::Any& aSource ) } if( !aRet.hasValue() ) - throw uno::RuntimeException( rtl::OUString( "Toolbar do not exist" ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( "Toolbar do not exist" , uno::Reference< uno::XInterface >() ); return aRet; } @@ -160,20 +160,20 @@ ScVbaCommandBars::Add( const css::uno::Any& Name, const css::uno::Any& /*Positio // FIXME: only support to add Toolbar // Position - MsoBar MenuBar - sal_Bool // Currently only the Name is supported. - rtl::OUString sName; + OUString sName; if( Name.hasValue() ) Name >>= sName; - rtl::OUString sResourceUrl; + OUString sResourceUrl; if( !sName.isEmpty() ) { sResourceUrl = m_pCBarHelper->findToolbarByName( m_xNameAccess, sName ); if( !sResourceUrl.isEmpty() ) - throw uno::RuntimeException( rtl::OUString( "Toolbar exists" ), uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( "Toolbar exists" , uno::Reference< uno::XInterface >() ); } else { - sName = rtl::OUString( "Custom1" ); + sName = "Custom1"; } sResourceUrl = VbaCommandBarHelper::generateCustomURL(); @@ -187,7 +187,7 @@ ScVbaCommandBars::getCount() throw(css::uno::RuntimeException) { // Filter out all toolbars from the window collection sal_Int32 nCount = 1; // there is a Menubar in OOo - uno::Sequence< ::rtl::OUString > allNames = m_xNameAccess->getElementNames(); + uno::Sequence< ::OUString > allNames = m_xNameAccess->getElementNames(); for( sal_Int32 i = 0; i < allNames.getLength(); i++ ) { if(allNames[i].indexOf( "private:resource/toolbar/" ) != -1 ) @@ -214,9 +214,9 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th { uno::Any aSource; if( m_pCBarHelper->getModuleId() == "com.sun.star.sheet.SpreadsheetDocument" ) - aSource <<= rtl::OUString("Worksheet Menu Bar"); + aSource <<= OUString("Worksheet Menu Bar"); else if( m_pCBarHelper->getModuleId() == "com.sun.star.text.TextDocument" ) - aSource <<= rtl::OUString("Menu Bar"); + aSource <<= OUString("Menu Bar"); if( aSource.hasValue() ) return createCollectionObject( aSource ); } @@ -224,20 +224,20 @@ ScVbaCommandBars::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) th } // XHelperInterface -rtl::OUString +OUString ScVbaCommandBars::getServiceImplName() { - return rtl::OUString("ScVbaCommandBars"); + return OUString("ScVbaCommandBars"); } -uno::Sequence +uno::Sequence ScVbaCommandBars::getServiceNames() { - static uno::Sequence< rtl::OUString > aServiceNames; + static uno::Sequence< OUString > aServiceNames; if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); - aServiceNames[ 0 ] = rtl::OUString( "ooo.vba.CommandBars" ); + aServiceNames[ 0 ] = "ooo.vba.CommandBars"; } return aServiceNames; } diff --git a/vbahelper/source/vbahelper/vbadialogbase.cxx b/vbahelper/source/vbahelper/vbadialogbase.cxx index 48dcc037f03f..ffee84eee758 100644 --- a/vbahelper/source/vbahelper/vbadialogbase.cxx +++ b/vbahelper/source/vbahelper/vbadialogbase.cxx @@ -24,13 +24,13 @@ using namespace ::com::sun::star; sal_Bool SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException ) { - rtl::OUString aURL; + OUString aURL; if ( m_xModel.is() ) { aURL = mapIndexToName( mnIndex ); if( aURL.isEmpty() ) throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ), + " Unable to open the specified dialog ", uno::Reference< XInterface > () ); uno::Sequence< beans::PropertyValue > dispatchProps(0); diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index e1ed9f07d996..f3883f5fb683 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -55,10 +55,10 @@ VbaDocumentBase::VbaDocumentBase( uno::Sequence< uno::Any> const & args, { } -::rtl::OUString +OUString VbaDocumentBase::getName() throw (uno::RuntimeException) { - rtl::OUString sName = getModel()->getURL(); + OUString sName = getModel()->getURL(); if ( !sName.isEmpty() ) { @@ -73,12 +73,12 @@ VbaDocumentBase::getName() throw (uno::RuntimeException) } return sName; } -::rtl::OUString +OUString VbaDocumentBase::getPath() throw (uno::RuntimeException) { INetURLObject aURL( getModel()->getURL() ); - rtl::OUString sURL = aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ); - rtl::OUString sPath; + OUString sURL = aURL.GetMainURL( INetURLObject::DECODE_TO_IURI ); + OUString sPath; if( !sURL.isEmpty() ) { sURL = sURL.copy( 0, sURL.getLength() - aURL.GetLastName().getLength() - 1 ); @@ -87,10 +87,10 @@ VbaDocumentBase::getPath() throw (uno::RuntimeException) return sPath; } -::rtl::OUString +OUString VbaDocumentBase::getFullName() throw (uno::RuntimeException) { - rtl::OUString sPath = getName(); + OUString sPath = getName(); //::osl::File::getSystemPathFromFileURL( getModel()->getURL(), sPath ); return sPath; } @@ -100,7 +100,7 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, const uno::Any &rRouteArg ) throw (uno::RuntimeException) { sal_Bool bSaveChanges = sal_False; - rtl::OUString aFileName; + OUString aFileName; sal_Bool bRouteWorkbook = sal_True; rSaveArg >>= bSaveChanges; @@ -113,9 +113,7 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, { if( xStorable->isReadonly() ) { - throw uno::RuntimeException(::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "Unable to save to a read only file ") ), - uno::Reference< XInterface >() ); + throw uno::RuntimeException("Unable to save to a read only file ", uno::Reference< XInterface >() ); } if( bFileName ) xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) ); @@ -136,11 +134,11 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create(mxContext) ); util::URL aURL; - aURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc" ) ); + aURL.Complete = ".uno:CloseDoc"; xURLTransformer->parseStrict( aURL ); uno::Reference< css::frame::XDispatch > xDispatch( - xDispatchProvider->queryDispatch( aURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), 0 ), + xDispatchProvider->queryDispatch( aURL, "_self" , 0 ), uno::UNO_SET_THROW ); xDispatch->dispatch( aURL, uno::Sequence< beans::PropertyValue >() ); bUIClose = sal_True; @@ -193,30 +191,28 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, void VbaDocumentBase::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException) { - rtl::OUString rPassword; + OUString rPassword; uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); OSL_TRACE("Workbook::Protect stub"); if( aPassword >>= rPassword ) xProt->protect( rPassword ); else - xProt->protect( rtl::OUString() ); + xProt->protect( OUString() ); } void VbaDocumentBase::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException) { - rtl::OUString rPassword; + OUString rPassword; uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); if( !xProt->isProtected() ) - throw uno::RuntimeException(::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "File is already unprotected" ) ), - uno::Reference< XInterface >() ); + throw uno::RuntimeException("File is already unprotected", uno::Reference< XInterface >() ); else { if( aPassword >>= rPassword ) xProt->unprotect( rPassword ); else - xProt->unprotect( rtl::OUString() ); + xProt->unprotect( OUString() ); } } @@ -236,7 +232,7 @@ VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException) { uno::Any aCaught( ::cppu::getCaughtException() ); throw lang::WrappedTargetRuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't change modified state of model!" ) ), + "Can't change modified state of model!", uno::Reference< uno::XInterface >(), aCaught ); } @@ -252,7 +248,7 @@ VbaDocumentBase::getSaved() throw (uno::RuntimeException) void VbaDocumentBase::Save() throw (uno::RuntimeException) { - rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Save")); + OUString url(".uno:Save"); uno::Reference< frame::XModel > xModel = getModel(); dispatchRequests(xModel,url); } @@ -284,16 +280,16 @@ VbaDocumentBase::getVBProject() throw (uno::RuntimeException) return uno::Any( mxVBProject ); } -rtl::OUString +OUString VbaDocumentBase::getServiceImplName() { - return rtl::OUString( "VbaDocumentBase" ); + return OUString( "VbaDocumentBase" ); } -uno::Sequence< rtl::OUString > +uno::Sequence< OUString > VbaDocumentBase::getServiceNames() { - static uno::Sequence< rtl::OUString > aServiceNames; + static uno::Sequence< OUString > aServiceNames; if ( aServiceNames.getLength() == 0 ) { aServiceNames.realloc( 1 ); diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index f671c1180d59..7938b704fcf7 100644 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -28,9 +28,6 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - // ============================================================================ VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs, const uno::Reference< uno::XComponentContext >& /*xContext*/ ) : @@ -96,7 +93,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, cons const EventHandlerInfo& rInfo = getEventHandlerInfo( aEventQueue.front().mnEventId ); uno::Sequence< uno::Any > aEventArgs = aEventQueue.front().maArgs; aEventQueue.pop_front(); - OSL_TRACE( "VbaEventsHelperBase::processVbaEvent( \"%s\" )", ::rtl::OUStringToOString( rInfo.maMacroName, RTL_TEXTENCODING_UTF8 ).getStr() ); + OSL_TRACE( "VbaEventsHelperBase::processVbaEvent( \"%s\" )", OUStringToOString( rInfo.maMacroName, RTL_TEXTENCODING_UTF8 ).getStr() ); /* Let derived classes prepare the event, they may add new events for next iteration. If false is returned, the event handler must not be @@ -143,7 +140,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, cons void SAL_CALL VbaEventsHelperBase::notifyEvent( const document::EventObject& rEvent ) throw (uno::RuntimeException) { - OSL_TRACE( "VbaEventsHelperBase::notifyEvent( \"%s\" )", ::rtl::OUStringToOString( rEvent.EventName, RTL_TEXTENCODING_UTF8 ).getStr() ); + OSL_TRACE( "VbaEventsHelperBase::notifyEvent( \"%s\" )", OUStringToOString( rEvent.EventName, RTL_TEXTENCODING_UTF8 ).getStr() ); if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ) ) stopListening(); } @@ -290,7 +287,7 @@ void VbaEventsHelperBase::ensureVBALibrary() throw (uno::RuntimeException) throw uno::RuntimeException(); uno::Reference< beans::XPropertySet > xModelProps( mxModel, uno::UNO_QUERY_THROW ); uno::Reference< container::XNameAccess > xBasicLibs( xModelProps->getPropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicLibraries" ) ) ), uno::UNO_QUERY_THROW ); + "BasicLibraries" ), uno::UNO_QUERY_THROW ); mxModuleInfos.set( xBasicLibs->getByName( maLibraryName ), uno::UNO_QUERY_THROW ); // listen to changes in the VBA source code uno::Reference< util::XChangesNotifier > xChangesNotifier( mxModuleInfos, uno::UNO_QUERY_THROW ); @@ -324,7 +321,7 @@ sal_Int32 VbaEventsHelperBase::getModuleType( const OUString& rModuleName ) thro throw uno::RuntimeException(); } -VbaEventsHelperBase::ModulePathMap& VbaEventsHelperBase::updateModulePathMap( const ::rtl::OUString& rModuleName ) throw (uno::RuntimeException) +VbaEventsHelperBase::ModulePathMap& VbaEventsHelperBase::updateModulePathMap( const OUString& rModuleName ) throw (uno::RuntimeException) { // get type of the specified module (throws on error) sal_Int32 nModuleType = getModuleType( rModuleName ); diff --git a/vbahelper/source/vbahelper/vbafontbase.cxx b/vbahelper/source/vbahelper/vbafontbase.cxx index cfc1b39980a5..ad0ce5d81aea 100644 --- a/vbahelper/source/vbahelper/vbafontbase.cxx +++ b/vbahelper/source/vbahelper/vbafontbase.cxx @@ -29,7 +29,7 @@ using namespace ::com::sun::star; // form controls use other property name as the remaining OOo API #define VBAFONTBASE_PROPNAME( ascii_normal, ascii_control ) \ - mbFormControl ? rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ascii_control ) ) : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ascii_normal ) ) + mbFormControl ? OUString( ascii_control ) : OUString( ascii_normal ) VbaFontBase::VbaFontBase( const uno::Reference< XHelperInterface >& xParent, @@ -65,8 +65,8 @@ VbaFontBase::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeExcept nValue = SUPERSCRIPT; nValue2 = SUPERSCRIPTHEIGHT; } - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); + mxFont->setPropertyValue( "CharEscapement" , ( uno::Any )nValue ); + mxFont->setPropertyValue( "CharEscapementHeight" , ( uno::Any )nValue2 ); } uno::Any SAL_CALL @@ -75,7 +75,7 @@ VbaFontBase::getSuperscript() throw ( uno::RuntimeException ) short nValue = NORMAL; // not supported in form controls if( !mbFormControl ) - mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; + mxFont->getPropertyValue( "CharEscapement" ) >>= nValue; return uno::makeAny( ( nValue == SUPERSCRIPT ) ); } @@ -97,8 +97,8 @@ VbaFontBase::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeExceptio nValue2 = SUBSCRIPTHEIGHT; } - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); + mxFont->setPropertyValue( "CharEscapementHeight" , ( uno::Any )nValue2 ); + mxFont->setPropertyValue( "CharEscapement" , ( uno::Any )nValue ); } @@ -108,7 +108,7 @@ VbaFontBase::getSubscript() throw ( uno::RuntimeException ) short nValue = NORMAL; // not supported in form controls if( !mbFormControl ) - mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; + mxFont->getPropertyValue( "CharEscapement" ) >>= nValue; return uno::makeAny( ( nValue == SUBSCRIPT ) ); } @@ -211,13 +211,13 @@ void SAL_CALL VbaFontBase::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException ) { if( !mbFormControl ) - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), aValue ); + mxFont->setPropertyValue( "CharShadowed" , aValue ); } uno::Any SAL_CALL VbaFontBase::getShadow() throw (uno::RuntimeException) { - return mbFormControl ? uno::Any( false ) : mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) ); + return mbFormControl ? uno::Any( false ) : mxFont->getPropertyValue( "CharShadowed" ); } void SAL_CALL @@ -242,7 +242,7 @@ VbaFontBase::getItalic() throw ( uno::RuntimeException ) void SAL_CALL VbaFontBase::setName( const uno::Any& aValue ) throw ( uno::RuntimeException ) { - rtl::OUString sString; + OUString sString; aValue >>= sString; mxFont->setPropertyValue( VBAFONTBASE_PROPNAME( "CharFontName", "FontName" ), aValue ); } -- cgit v1.2.3