diff options
Diffstat (limited to 'fpicker/source/win32')
-rw-r--r-- | fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx | 16 | ||||
-rw-r--r-- | fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx | 3 | ||||
-rw-r--r-- | fpicker/source/win32/folderpicker/MtaFop.cxx | 10 | ||||
-rw-r--r-- | fpicker/source/win32/misc/resourceprovider.cxx | 60 | ||||
-rw-r--r-- | fpicker/source/win32/misc/resourceprovider.hxx | 13 |
5 files changed, 25 insertions, 77 deletions
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx index e7a6697d4fb8..c3ce95a8054b 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx @@ -491,9 +491,9 @@ static const ::sal_Int32 GROUP_IMAGETEMPLATE = 3; static const ::sal_Int32 GROUP_CHECKBOXES = 4; -static void setLabelToControl(CResourceProvider& rResourceProvider, TFileDialogCustomize iCustom, sal_uInt16 nControlId) +static void setLabelToControl(TFileDialogCustomize iCustom, sal_uInt16 nControlId) { - OUString aLabel = rResourceProvider.getResString(nControlId); + OUString aLabel = CResourceProvider::getResString(nControlId); aLabel = SOfficeToWindowsLabel(aLabel); iCustom->SetControlLabel(nControlId, reinterpret_cast<PCWSTR>(aLabel.getStr()) ); } @@ -577,42 +577,42 @@ void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_I { nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION; iCustom->AddCheckButton (nControlId, L"Auto Extension", true); - setLabelToControl(m_ResProvider, iCustom, nControlId); + setLabelToControl(iCustom, nControlId); } if ((nFeatures & FEATURE_PASSWORD) == FEATURE_PASSWORD) { nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PASSWORD; iCustom->AddCheckButton (nControlId, L"Password", false); - setLabelToControl(m_ResProvider, iCustom, nControlId); + setLabelToControl(iCustom, nControlId); } if ((nFeatures & FEATURE_READONLY) == FEATURE_READONLY) { nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_READONLY; iCustom->AddCheckButton (nControlId, L"Readonly", false); - setLabelToControl(m_ResProvider, iCustom, nControlId); + setLabelToControl(iCustom, nControlId); } if ((nFeatures & FEATURE_FILTEROPTIONS) == FEATURE_FILTEROPTIONS) { nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS; iCustom->AddCheckButton (nControlId, L"Filter Options", false); - setLabelToControl(m_ResProvider, iCustom, nControlId); + setLabelToControl(iCustom, nControlId); } if ((nFeatures & FEATURE_LINK) == FEATURE_LINK) { nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK; iCustom->AddCheckButton (nControlId, L"Link", false); - setLabelToControl(m_ResProvider, iCustom, nControlId); + setLabelToControl(iCustom, nControlId); } if ((nFeatures & FEATURE_SELECTION) == FEATURE_SELECTION) { nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION; iCustom->AddCheckButton (nControlId, L"Selection", false); - setLabelToControl(m_ResProvider, iCustom, nControlId); + setLabelToControl(iCustom, nControlId); } /* can be ignored ... new COM dialog supports preview native now ! diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx index b7ea4de5fc0e..70272ad8c1c0 100644 --- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx +++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx @@ -316,9 +316,6 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex OUString m_sFilename; - - // Resource provider - CResourceProvider m_ResProvider; }; } // namespace vista diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx index 43908c947020..5e5de9f612c4 100644 --- a/fpicker/source/win32/folderpicker/MtaFop.cxx +++ b/fpicker/source/win32/folderpicker/MtaFop.cxx @@ -138,14 +138,8 @@ CMtaFolderPicker::CMtaFolderPicker( sal_uInt32 Flags ) : m_bi.lpfn = CMtaFolderPicker::FolderPickerCallback; m_bi.lParam = reinterpret_cast< LPARAM >( this ); - - // read the default strings for title and - // description from a resource file - - CResourceProvider ResProvider; - - m_dialogTitle = ResProvider.getResString(FOLDERPICKER_TITLE); - m_Description = ResProvider.getResString(FOLDER_PICKER_DEF_DESCRIPTION); + m_dialogTitle = CResourceProvider::getResString(FOLDERPICKER_TITLE); + m_Description = CResourceProvider::getResString(FOLDER_PICKER_DEF_DESCRIPTION); // signals that the thread was successfully set up m_hEvtThrdReady = CreateEventA( diff --git a/fpicker/source/win32/misc/resourceprovider.cxx b/fpicker/source/win32/misc/resourceprovider.cxx index 12a733ec01d1..118d7ab932f5 100644 --- a/fpicker/source/win32/misc/resourceprovider.cxx +++ b/fpicker/source/win32/misc/resourceprovider.cxx @@ -25,13 +25,14 @@ #include <rtl/ustrbuf.hxx> #include "resourceprovider.hxx" #include <osl/mutex.hxx> -#include <vcl/fpicker.hrc> +#include <fpicker/fpicker.hrc> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> -#include <tools/simplerm.hxx> +#include <tools/resmgr.hxx> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> +#include "fpsofficeResMgr.hxx" using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds; @@ -44,7 +45,7 @@ using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds; struct Entry { sal_Int32 ctrlId; - sal_Int16 resId; + const char* resId; }; Entry const CtrlIdToResIdTable[] = { @@ -65,68 +66,33 @@ Entry const CtrlIdToResIdTable[] = { const sal_Int32 SIZE_TABLE = SAL_N_ELEMENTS( CtrlIdToResIdTable ); -sal_Int16 CtrlIdToResId( sal_Int32 aControlId ) +const char* CtrlIdToResId( sal_Int32 aControlId ) { - sal_Int16 aResId = -1; + const char* pResId = nullptr; for ( sal_Int32 i = 0; i < SIZE_TABLE; i++ ) { if ( CtrlIdToResIdTable[i].ctrlId == aControlId ) { - aResId = CtrlIdToResIdTable[i].resId; + pResId = CtrlIdToResIdTable[i].resId; break; } } - return aResId; + return pResId; } -class CResourceProvider_Impl +namespace CResourceProvider { -public: - - - CResourceProvider_Impl( ) - { - const SolarMutexGuard aGuard; - m_ResMgr = o3tl::make_unique<SimpleResMgr>( - "fps_office", Application::GetSettings().GetUILanguageTag()); - } - OUString getResString( sal_Int16 aId ) { OUString aResOUString; - - try - { - // translate the control id to a resource id - sal_Int16 aResId = CtrlIdToResId( aId ); - - if ( aResId > -1 ) - aResOUString = m_ResMgr->ReadString( aResId ); - } - catch(...) - { - } - + // translate the control id to a resource id + const char *pResId = CtrlIdToResId(aId); + if (pResId) + aResOUString = FpsResId(pResId); return aResOUString; } - -public: - std::unique_ptr<SimpleResMgr> m_ResMgr; -}; - -CResourceProvider::CResourceProvider( ) : - m_pImpl( o3tl::make_unique<CResourceProvider_Impl>() ) -{ -} - -CResourceProvider::~CResourceProvider( ) -{} - -OUString CResourceProvider::getResString( sal_Int16 aId ) -{ - return m_pImpl->getResString( aId ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/win32/misc/resourceprovider.hxx b/fpicker/source/win32/misc/resourceprovider.hxx index 8d515cbeb20b..a611d1aaf195 100644 --- a/fpicker/source/win32/misc/resourceprovider.hxx +++ b/fpicker/source/win32/misc/resourceprovider.hxx @@ -29,18 +29,9 @@ #include <rtl/ustring.hxx> -class CResourceProvider_Impl; - -class CResourceProvider +namespace CResourceProvider { -public: - CResourceProvider( ); - ~CResourceProvider( ); - - OUString getResString( sal_Int16 aId ); - -private: - std::unique_ptr<CResourceProvider_Impl> m_pImpl; + OUString getResString(sal_Int16 aId); }; #endif |