From 77fd448d0990adc79406e13a127b2b1834984b71 Mon Sep 17 00:00:00 2001 From: Jean-Noël Rouvignac Date: Fri, 1 Feb 2013 09:33:19 +0100 Subject: Removed several useless macros: UNISTRING, USTR, USTR_ASCII, ASCII_STR, ASCII_STRING, CONST_ASCII, ASCSTR, ASCII, DEFINE_CONST_UNICODE, DEFINE_CONST_OUSTRING Change-Id: I96d690bf9f9b319e9eeafcf218ec5ce87f21215f Reviewed-on: https://gerrit.libreoffice.org/1954 Reviewed-by: Tor Lillqvist Tested-by: Tor Lillqvist --- sfx2/source/doc/QuerySaveDocument.cxx | 5 ++--- sfx2/source/doc/docfile.cxx | 7 +++---- sfx2/source/doc/docfilt.cxx | 6 +++--- sfx2/source/doc/objmisc.cxx | 6 +++--- sfx2/source/doc/objserv.cxx | 3 +-- sfx2/source/doc/objstor.cxx | 6 +++--- sfx2/source/doc/printhelper.cxx | 16 ++++++++-------- sfx2/source/doc/templatedlg.cxx | 2 +- 8 files changed, 24 insertions(+), 27 deletions(-) (limited to 'sfx2/source/doc') diff --git a/sfx2/source/doc/QuerySaveDocument.cxx b/sfx2/source/doc/QuerySaveDocument.cxx index 49448eb5fe9e..7b24f7d55e15 100644 --- a/sfx2/source/doc/QuerySaveDocument.cxx +++ b/sfx2/source/doc/QuerySaveDocument.cxx @@ -32,9 +32,8 @@ short ExecuteQuerySaveDocument(Window* _pParent,const String& _rTitle) { // don't block Desktop::terminate() if there's no user to ask return RET_NO; } - String aText( SfxResId(STR_QUERY_SAVE_DOCUMENT).toString() ); - aText.SearchAndReplace( DEFINE_CONST_UNICODE( "$(DOC)" ), - _rTitle ); + OUString aText( SfxResId(STR_QUERY_SAVE_DOCUMENT).toString() ); + aText = aText.replaceFirst( "$(DOC)", _rTitle ); QueryBox aQBox( _pParent, WB_YES_NO_CANCEL | WB_DEF_YES, aText ); aQBox.SetText(SfxResId(STR_QUERY_SAVE_DOCUMENT_TITLE).toString()); // Window title aQBox.SetButtonText( BUTTONID_NO, SfxResId(STR_NOSAVEANDCLOSE).toString() ); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 907e0134d938..5cab6ced56d3 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1348,7 +1348,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf util::RevisionTag& rTag = pImp->aVersions[nVersion]; { // Open SubStorage for all versions - uno::Reference < embed::XStorage > xSub = pImp->xStorage->openStorageElement( DEFINE_CONST_UNICODE( "Versions" ), + uno::Reference < embed::XStorage > xSub = pImp->xStorage->openStorageElement( "Versions", embed::ElementModes::READ ); DBG_ASSERT( xSub.is(), "Version list, but no Versions!" ); @@ -2173,7 +2173,7 @@ void SfxMedium::DoBackup_Impl() // save as ".bak" file INetURLObject aDest( aBakDir ); aDest.insertName( aSource.getName() ); - aDest.setExtension( DEFINE_CONST_UNICODE( "bak" ) ); + aDest.setExtension( "bak" ); String aFileName = aDest.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); // create a content for the source file @@ -3162,8 +3162,7 @@ sal_uInt16 SfxMedium::AddVersion_Impl( util::RevisionTag& rRevision ) if ( aLongs[nKey] > ( sal_uIntPtr ) nKey+1 ) break; - String aRevName = DEFINE_CONST_UNICODE( "Version" ); - aRevName += String::CreateFromInt32( nKey + 1 ); + OUString aRevName = "Version" + OUString::number( nKey + 1 ); pImp->aVersions.realloc( nLength+1 ); rRevision.Identifier = aRevName; pImp->aVersions[nLength] = rRevision; diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index f7d47e839573..1028f85a5a92 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -63,13 +63,13 @@ SfxFilter::SfxFilter( const String &rName, String aShort, aLong; String aRet; sal_uInt16 nMaxLength = USHRT_MAX; - String aTest; + OUString aTest; sal_uInt16 nPos = 0; while( ( aRet = aExts.GetToken( nPos++, ';' ) ).Len() ) { aTest = aRet; - aTest.SearchAndReplace( DEFINE_CONST_UNICODE( "*." ), String() ); - if( aTest.Len() <= nMaxLength ) + aTest = aTest.replaceFirst( "*." , "" ); + if( aTest.getLength() <= nMaxLength ) { if( aShort.Len() ) aShort += ';'; aShort += aRet; diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index e7edadcaa681..7190f73591f5 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -747,7 +747,7 @@ void SfxObjectShell::SetTitle String X(const String &rRet) { if ( !rRet.Len() ) - return DEFINE_CONST_UNICODE( "-empty-" ); + return String( "-empty-" ); return rRet; } #else @@ -817,7 +817,7 @@ String SfxObjectShell::GetTitle { static sal_Bool bRecur = sal_False; if ( bRecur ) - return DEFINE_CONST_UNICODE( "-not available-" ); + return String( "-not available-" ); bRecur = sal_True; String aTitle; @@ -909,7 +909,7 @@ String SfxObjectShell::GetTitle String aComplete( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); if( aComplete.Len() > nMaxLength ) { - String aRet( DEFINE_CONST_UNICODE( "..." ) ); + String aRet( "..." ); aRet += aComplete.Copy( aComplete.Len() - nMaxLength + 3, nMaxLength - 3 ); return X( aRet ); } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index afb115bc3bc6..73611c25d5c4 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -486,8 +486,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) } else { - aURL = DEFINE_CONST_UNICODE( "private:factory/" ); - aURL += rtl::OUString::createFromAscii( GetFactory().GetShortName() ); + aURL = "private:factory/" + OUString::createFromAscii( GetFactory().GetShortName() ); aTitle = GetTitle(); } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 1a03a3bd0ad7..2fa99cbe058a 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -500,7 +500,7 @@ sal_Bool SfxObjectShell::DoInitNew( SfxMedium* pMed ) TransformItems( SID_OPENDOC, *pSet, aArgs ); sal_Int32 nLength = aArgs.getLength(); aArgs.realloc( nLength + 1 ); - aArgs[nLength].Name = DEFINE_CONST_UNICODE("Title"); + aArgs[nLength].Name = "Title"; aArgs[nLength].Value <<= ::rtl::OUString( GetTitle( SFX_TITLE_DETECT ) ); xModel->attachResource( ::rtl::OUString(), aArgs ); impl_addToModelCollection(xModel); @@ -2142,7 +2142,7 @@ sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium, bool bInsert ) uno::Reference< lang::XMultiServiceFactory > xMan = ::comphelper::getProcessServiceFactory(); uno::Reference < lang::XMultiServiceFactory > xFilterFact ( - xMan->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.document.FilterFactory" ) ), uno::UNO_QUERY ); + xMan->createInstance( "com.sun.star.document.FilterFactory" ), uno::UNO_QUERY ); uno::Sequence < beans::PropertyValue > aProps; uno::Reference < container::XNameAccess > xFilters ( xFilterFact, uno::UNO_QUERY ); @@ -2254,7 +2254,7 @@ sal_Bool SfxObjectShell::ExportTo( SfxMedium& rMedium ) { uno::Reference< lang::XMultiServiceFactory > xMan = ::comphelper::getProcessServiceFactory(); uno::Reference < lang::XMultiServiceFactory > xFilterFact ( - xMan->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.document.FilterFactory" ) ), uno::UNO_QUERY ); + xMan->createInstance( "com.sun.star.document.FilterFactory" ), uno::UNO_QUERY ); uno::Sequence < beans::PropertyValue > aProps; uno::Reference < container::XNameAccess > xFilters ( xFilterFact, uno::UNO_QUERY ); diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index fdc01f6fe892..77f89faed106 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -274,31 +274,31 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro uno::Sequence< beans::PropertyValue > aPrinter(8); - aPrinter.getArray()[7].Name = DEFINE_CONST_UNICODE( "CanSetPaperSize" ); + aPrinter.getArray()[7].Name = "CanSetPaperSize"; aPrinter.getArray()[7].Value <<= ( pPrinter->HasSupport( SUPPORT_SET_PAPERSIZE ) ); - aPrinter.getArray()[6].Name = DEFINE_CONST_UNICODE( "CanSetPaperFormat" ); + aPrinter.getArray()[6].Name = "CanSetPaperFormat"; aPrinter.getArray()[6].Value <<= ( pPrinter->HasSupport( SUPPORT_SET_PAPER ) ); - aPrinter.getArray()[5].Name = DEFINE_CONST_UNICODE( "CanSetPaperOrientation" ); + aPrinter.getArray()[5].Name = "CanSetPaperOrientation"; aPrinter.getArray()[5].Value <<= ( pPrinter->HasSupport( SUPPORT_SET_ORIENTATION ) ); - aPrinter.getArray()[4].Name = DEFINE_CONST_UNICODE( "IsBusy" ); + aPrinter.getArray()[4].Name = "IsBusy"; aPrinter.getArray()[4].Value <<= ( pPrinter->IsPrinting() ); - aPrinter.getArray()[3].Name = DEFINE_CONST_UNICODE( "PaperSize" ); + aPrinter.getArray()[3].Name = "PaperSize"; awt::Size aSize = impl_Size_Object2Struct(pPrinter->GetPaperSize() ); aPrinter.getArray()[3].Value <<= aSize; - aPrinter.getArray()[2].Name = DEFINE_CONST_UNICODE( "PaperFormat" ); + aPrinter.getArray()[2].Name = "PaperFormat"; view::PaperFormat eFormat = convertToPaperFormat(pPrinter->GetPaper()); aPrinter.getArray()[2].Value <<= eFormat; - aPrinter.getArray()[1].Name = DEFINE_CONST_UNICODE( "PaperOrientation" ); + aPrinter.getArray()[1].Name = "PaperOrientation"; view::PaperOrientation eOrient = (view::PaperOrientation)pPrinter->GetOrientation(); aPrinter.getArray()[1].Value <<= eOrient; - aPrinter.getArray()[0].Name = DEFINE_CONST_UNICODE( "Name" ); + aPrinter.getArray()[0].Name = "Name"; String sStringTemp = pPrinter->GetName() ; aPrinter.getArray()[0].Value <<= ::rtl::OUString( sStringTemp ); diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 8bb8035f018b..d78cbafc2295 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -760,7 +760,7 @@ void SfxTemplateManagerDlg::OnTemplateImport () // add "All" filter aFileDlg.AddFilter( String(SfxResId( STR_SFX_FILTERNAME_ALL) ), - DEFINE_CONST_UNICODE(FILEDIALOG_FILTER_ALL) ); + OUString(FILEDIALOG_FILTER_ALL) ); // add template filter OUString sFilterExt; -- cgit