diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-08-01 13:50:45 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-08-02 10:36:07 +0200 |
commit | 13fac4894f752e922727c6f22c6303712e06ba12 (patch) | |
tree | 5689829e917927bb13461d91988ec99e461f1831 /accessibility | |
parent | 13cadf3fe38daa0b4cfddcfa68ec8631bc85f44a (diff) |
normalize resource locale ctor construction mechanisms
make them all the same and share std::locales more
various OModuleClient, etc, classes go away
Change-Id: I7e3ff01a69332eeacd22e3078f66a60318de62d5
Reviewed-on: https://gerrit.libreoffice.org/40634
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'accessibility')
8 files changed, 14 insertions, 78 deletions
diff --git a/accessibility/inc/helper/accresmgr.hxx b/accessibility/inc/helper/accresmgr.hxx index 24fa1cfa4721..a9aac50a141b 100644 --- a/accessibility/inc/helper/accresmgr.hxx +++ b/accessibility/inc/helper/accresmgr.hxx @@ -22,41 +22,7 @@ #include <rtl/ustring.hxx> -#define TK_RES_STRING(id) ::accessibility::TkResMgr::loadString(id) - -// TkResMgr - -namespace accessibility -{ - -class TkResMgr -{ - static std::locale* m_pImpl; - -private: - // no instantiation allowed - TkResMgr() = delete; - ~TkResMgr() { } - - // we'll instantiate one static member of the following class, - // which in its dtor ensures that m_pImpl will be deleted - class EnsureDelete - { - public: - EnsureDelete() { } - ~EnsureDelete(); - }; - friend class EnsureDelete; - -protected: - static void ensureImplExists(); - -public: - // loads the string with the specified resource id - static OUString loadString(const char *pResId); -}; - -} +OUString AccResId(const char* pId); #endif // INCLUDED_ACCESSIBILITY_INC_HELPER_ACCRESMGR_HXX diff --git a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx index b2741e246df1..221dd742b3d3 100644 --- a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx +++ b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx @@ -113,8 +113,8 @@ namespace accessibility SolarMethodGuard aGuard(getMutex()); ensureIsAlive(); - return TK_RES_STRING(RID_STR_ACC_COLUMN_NUM).replaceAll("%COLUMNNUMBER", OUString::number(getColumnPos()-1)) + ", " - + TK_RES_STRING(RID_STR_ACC_ROW_NUM).replaceAll("%ROWNUMBER", OUString::number(getRowPos())); + return AccResId(RID_STR_ACC_COLUMN_NUM).replaceAll("%COLUMNNUMBER", OUString::number(getColumnPos()-1)) + ", " + + AccResId(RID_STR_ACC_ROW_NUM).replaceAll("%ROWNUMBER", OUString::number(getRowPos())); } css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleRelationSet() diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index 2eef354aa240..bd996fded674 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -822,8 +822,8 @@ namespace accessibility { if( pEntry->HasChildren() || pEntry->HasChildrenOnDemand() ) return getListBox()->IsExpanded( pEntry ) ? - TK_RES_STRING(STR_SVT_ACC_ACTION_COLLAPSE) : - TK_RES_STRING(STR_SVT_ACC_ACTION_EXPAND); + AccResId(STR_SVT_ACC_ACTION_COLLAPSE) : + AccResId(STR_SVT_ACC_ACTION_EXPAND); return OUString(); } diff --git a/accessibility/source/helper/accresmgr.cxx b/accessibility/source/helper/accresmgr.cxx index 7ffcafb3080f..7bf55e120737 100644 --- a/accessibility/source/helper/accresmgr.cxx +++ b/accessibility/source/helper/accresmgr.cxx @@ -20,40 +20,10 @@ #include <helper/accresmgr.hxx> #include <unotools/resmgr.hxx> -using namespace accessibility; - -// TkResMgr - -std::locale* TkResMgr::m_pImpl = nullptr; - -TkResMgr::EnsureDelete::~EnsureDelete() +OUString AccResId(const char* pId) { - delete TkResMgr::m_pImpl; -} - -void TkResMgr::ensureImplExists() -{ - if (m_pImpl) - return; - - m_pImpl = new std::locale(Translate::Create("acc")); - - if (m_pImpl) - { - // now that we have a impl class, make sure it's deleted on unloading the library - static TkResMgr::EnsureDelete s_aDeleteTheImplClass; - } -} - -OUString TkResMgr::loadString(const char *pResId) -{ - OUString sReturn; - - ensureImplExists(); - if (m_pImpl) - sReturn = Translate::get(pResId, *m_pImpl); - - return sReturn; + static std::locale loc = Translate::Create("acc"); + return Translate::get(pId, loc); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx index f26e56d972cb..c95004327f86 100644 --- a/accessibility/source/standard/vclxaccessiblebutton.cxx +++ b/accessibility/source/standard/vclxaccessiblebutton.cxx @@ -149,7 +149,7 @@ OUString VCLXAccessibleButton::getAccessibleName( ) if ( nLength == 3 ) { // it's a browse button - aName = TK_RES_STRING( RID_STR_ACC_NAME_BROWSEBUTTON ); + aName = AccResId( RID_STR_ACC_NAME_BROWSEBUTTON ); } else { diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx index 0e01a6680e82..f8243bfc7254 100644 --- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx +++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx @@ -218,9 +218,9 @@ OUString VCLXAccessibleCheckBox::getAccessibleActionDescription ( sal_Int32 nInd throw IndexOutOfBoundsException(); if(IsChecked()) - return TK_RES_STRING( RID_STR_ACC_ACTION_UNCHECK ); + return AccResId( RID_STR_ACC_ACTION_UNCHECK ); else - return TK_RES_STRING( RID_STR_ACC_ACTION_CHECK ); + return AccResId( RID_STR_ACC_ACTION_CHECK ); } diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx index 8624de5b6c4d..bb83d7ac832d 100644 --- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx +++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx @@ -265,9 +265,9 @@ OUString VCLXAccessibleScrollBar::getAccessibleName( ) if ( pVCLXScrollBar ) { if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::HORIZONTAL ) - aName = TK_RES_STRING( RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL ); + aName = AccResId( RID_STR_ACC_SCROLLBAR_NAME_HORIZONTAL ); else if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::VERTICAL ) - aName = TK_RES_STRING( RID_STR_ACC_SCROLLBAR_NAME_VERTICAL ); + aName = AccResId( RID_STR_ACC_SCROLLBAR_NAME_VERTICAL ); } return aName; } diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index 2a575760dd12..5dbc3b4d1050 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -359,7 +359,7 @@ OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleDescription( ) if (m_nRole == AccessibleRole::PANEL && getAccessibleChildCount() > 0) { - return TK_RES_STRING( RID_STR_ACC_PANEL_DESCRIPTION ); + return AccResId( RID_STR_ACC_PANEL_DESCRIPTION ); } else { |