From 2155e04d6343638ca9815d394cbc4f78c2b17c3a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 18 May 2017 21:14:00 +0100 Subject: make string translation loading more uniform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit change various ResId classes that use conversion operator to OUString to functions that return a OUString drop various defines drop unnecessary toString calls Change-Id: Ibeccdf2b91a46a2ed5b4b74e6024e301a023bc92 Reviewed-on: https://gerrit.libreoffice.org/37817 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- filter/source/graphicfilter/eps/eps.cxx | 2 +- .../source/xsltdialog/xmlfiltersettingsdialog.cxx | 45 ++++++++++++---------- 2 files changed, 26 insertions(+), 21 deletions(-) (limited to 'filter') diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index dc9112c74a12..cad566aeb667 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -446,7 +446,7 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter pResMgr = ResMgr::CreateResMgr( "eps", Application::GetSettings().GetUILanguageTag() ); if( pResMgr ) { - ScopedVclPtrInstance< InfoBox > aInfoBox( nullptr, ResId(KEY_VERSION_CHECK, *pResMgr).toString() ); + ScopedVclPtrInstance< InfoBox > aInfoBox( nullptr, ResId(KEY_VERSION_CHECK, *pResMgr) ); aInfoBox->Execute(); delete pResMgr; } diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 6bcd6f24fc7e..31051679b3c5 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -84,8 +84,13 @@ EnsureResMgr::~EnsureResMgr() pXSLTResMgr = nullptr; } -#define RESID(x) ResId(x, *getXSLTDialogResMgr()) -#define RESIDSTR(x) RESID(x).toString() +namespace +{ + OUString XsltResId(sal_uInt16 nId) + { + return ResId(nId, *getXSLTDialogResMgr()); + } +} XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent, const css::uno::Reference& rxContext, @@ -109,7 +114,7 @@ XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent, m_pFilterListBox->SetSelectHdl( LINK( this, XMLFilterSettingsDialog, SelectionChangedHdl_Impl ) ); m_pFilterListBox->SetDeselectHdl( LINK( this, XMLFilterSettingsDialog, SelectionChangedHdl_Impl ) ); m_pFilterListBox->SetDoubleClickHdl( LINK( this, XMLFilterSettingsDialog, DoubleClickHdl_Impl ) ); - m_pFilterListBox->SetAccessibleName(RESIDSTR(STR_XML_FILTER_LISTBOX)); + m_pFilterListBox->SetAccessibleName(XsltResId(STR_XML_FILTER_LISTBOX)); m_pFilterListBox->SetHelpId(m_pCtrlFilterList->GetHelpId()); m_pPBNew->SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); @@ -248,13 +253,13 @@ void XMLFilterSettingsDialog::onNew() filter_info_impl aTempInfo; // create a unique filter name - aTempInfo.maFilterName = createUniqueFilterName(RESIDSTR(STR_DEFAULT_FILTER_NAME)); + aTempInfo.maFilterName = createUniqueFilterName(XsltResId(STR_DEFAULT_FILTER_NAME)); // init default extension aTempInfo.maExtension = STR_DEFAULT_EXTENSION; // set default ui name - aTempInfo.maInterfaceName = createUniqueInterfaceName(RESIDSTR(STR_DEFAULT_UI_NAME)); + aTempInfo.maInterfaceName = createUniqueInterfaceName(XsltResId(STR_DEFAULT_UI_NAME)); // set default application aTempInfo.maDocumentService = "com.sun.star.text.TextDocument"; @@ -802,7 +807,7 @@ void XMLFilterSettingsDialog::onDelete() filter_info_impl* pInfo = static_cast(pEntry->GetUserData()); OUString aPlaceHolder( "%s" ); - OUString aMessage(RESIDSTR(STR_WARN_DELETE)); + OUString aMessage(XsltResId(STR_WARN_DELETE)); aMessage = aMessage.replaceFirst( aPlaceHolder, pInfo->maFilterName ); ScopedVclPtrInstance< WarningBox > aWarnBox(this, (WinBits)(WB_YES_NO | WB_DEF_YES), aMessage ); @@ -904,7 +909,7 @@ void XMLFilterSettingsDialog::onSave() css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION ); OUString aExtensions( "*.jar" ); - OUString aFilterName(RESIDSTR(STR_FILTER_PACKAGE)); + OUString aFilterName(XsltResId(STR_FILTER_PACKAGE)); aFilterName += " (" + aExtensions + ")"; aDlg.AddFilter( aFilterName, aExtensions ); @@ -921,13 +926,13 @@ void XMLFilterSettingsDialog::onSave() OUString aMsg; if( nFilters > 0 ) { - aMsg = RESIDSTR(STR_FILTERS_HAVE_BEEN_SAVED); + aMsg = XsltResId(STR_FILTERS_HAVE_BEEN_SAVED); aMsg = aMsg.replaceFirst( sPlaceholder, OUString::number( nFilters ) ); aMsg = aMsg.replaceFirst( sPlaceholder, aURL.GetName() ); } else { - aMsg = RESIDSTR(STR_FILTER_HAS_BEEN_SAVED); + aMsg = XsltResId(STR_FILTER_HAS_BEEN_SAVED); aMsg = aMsg.replaceFirst( sPlaceholder, (*aFilters.begin())->maFilterName ); aMsg = aMsg.replaceFirst( sPlaceholder, aURL.GetName() ); } @@ -946,7 +951,7 @@ void XMLFilterSettingsDialog::onOpen() css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE ); OUString aExtensions( "*.jar" ); - OUString aFilterName(RESIDSTR(STR_FILTER_PACKAGE)); + OUString aFilterName(XsltResId(STR_FILTER_PACKAGE)); aFilterName += " (" + aExtensions + ")"; aDlg.AddFilter( aFilterName, aExtensions ); @@ -981,18 +986,18 @@ void XMLFilterSettingsDialog::onOpen() if( nFilters == 0 ) { INetURLObject aURLObj( aURL ); - aMsg = RESIDSTR(STR_NO_FILTERS_FOUND); + aMsg = XsltResId(STR_NO_FILTERS_FOUND); aMsg = aMsg.replaceFirst( sPlaceholder, aURLObj.GetName() ); } else if( nFilters == 1 ) { - aMsg = RESIDSTR(STR_FILTER_INSTALLED); + aMsg = XsltResId(STR_FILTER_INSTALLED); aMsg = aMsg.replaceFirst( sPlaceholder, aFilterName ); } else { - aMsg = RESIDSTR(STR_FILTERS_INSTALLED); + aMsg = XsltResId(STR_FILTERS_INSTALLED); aMsg = aMsg.replaceFirst( sPlaceholder, OUString::number( nFilters ) ); } @@ -1306,7 +1311,7 @@ OUString getApplicationUIName( const OUString& rServiceName ) } else { - OUString aRet = RESIDSTR(STR_UNKNOWN_APPLICATION); + OUString aRet = XsltResId(STR_UNKNOWN_APPLICATION); if( !rServiceName.isEmpty() ) { aRet += " (" + rServiceName + ")"; @@ -1410,8 +1415,8 @@ XMLFilterListBox::XMLFilterListBox(Window* pParent, SvxPathControl* pPathControl m_pHeaderBar->SetEndDragHdl( LINK( this, XMLFilterListBox, HeaderEndDrag_Impl ) ); - OUString aStr1(RESIDSTR(STR_COLUMN_HEADER_NAME)); - OUString aStr2(RESIDSTR(STR_COLUMN_HEADER_TYPE)); + OUString aStr1(XsltResId(STR_COLUMN_HEADER_NAME)); + OUString aStr2(XsltResId(STR_COLUMN_HEADER_TYPE)); long nTabSize = aBoxSize.Width() / 2; @@ -1510,20 +1515,20 @@ OUString XMLFilterListBox::getEntryString( const filter_info_impl* pInfo ) { if( pInfo->maFlags & 2 ) { - aEntryStr += RESIDSTR(STR_IMPORT_EXPORT); + aEntryStr += XsltResId(STR_IMPORT_EXPORT); } else { - aEntryStr += RESIDSTR(STR_IMPORT_ONLY); + aEntryStr += XsltResId(STR_IMPORT_ONLY); } } else if( pInfo->maFlags & 2 ) { - aEntryStr += RESIDSTR(STR_EXPORT_ONLY); + aEntryStr += XsltResId(STR_EXPORT_ONLY); } else { - aEntryStr += RESIDSTR(STR_UNDEFINED_FILTER); + aEntryStr += XsltResId(STR_UNDEFINED_FILTER); } return aEntryStr; -- cgit