diff options
Diffstat (limited to 'fpicker/source')
-rw-r--r-- | fpicker/source/aqua/resourceprovider.hxx | 8 | ||||
-rw-r--r-- | fpicker/source/aqua/resourceprovider.mm | 100 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.hrc | 19 | ||||
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.src | 92 | ||||
-rw-r--r-- | fpicker/source/office/PlacesListBox.cxx | 2 | ||||
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.hxx | 6 | ||||
-rw-r--r-- | fpicker/source/office/fpsofficeResMgr.hxx | 47 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 24 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.hrc | 38 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.src | 101 | ||||
-rw-r--r-- | fpicker/source/office/iodlgimp.cxx | 35 | ||||
-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 |
16 files changed, 64 insertions, 510 deletions
diff --git a/fpicker/source/aqua/resourceprovider.hxx b/fpicker/source/aqua/resourceprovider.hxx index 63fb47e8ad5f..44454c8e0954 100644 --- a/fpicker/source/aqua/resourceprovider.hxx +++ b/fpicker/source/aqua/resourceprovider.hxx @@ -38,18 +38,10 @@ #define FILE_PICKER_FILE_TYPE 504 #define FILE_PICKER_OVERWRITE 505 -class CResourceProvider_Impl; - class CResourceProvider { public: - CResourceProvider( ); - ~CResourceProvider( ); - NSString* getResString( sal_Int32 aId ); - -private: - std::unique_ptr<CResourceProvider_Impl> m_pImpl; }; #endif diff --git a/fpicker/source/aqua/resourceprovider.mm b/fpicker/source/aqua/resourceprovider.mm index f1c9023a1cfd..6942d0fe9fda 100644 --- a/fpicker/source/aqua/resourceprovider.mm +++ b/fpicker/source/aqua/resourceprovider.mm @@ -23,29 +23,31 @@ #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> #include <osl/mutex.hxx> -#include <vcl/fpicker.hrc> +#include <fpicker/fpicker.hrc> #include <vcl/svapp.hxx> #include <tools/resmgr.hxx> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> -#include <svtools/filedlg2.hrc> #include "NSString_OOoAdditions.hxx" - +#include "fpsofficeResMgr.hxx" #include "resourceprovider.hxx" using rtl::OUString; using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds; -static const char* const RES_NAME = "fps_office"; -static const char* const OTHER_RES_NAME = "svt"; - // we have to translate control ids to resource ids struct Entry { sal_Int32 ctrlId; + const char* resId; +}; + +struct OldEntry +{ + sal_Int32 ctrlId; sal_Int16 resId; }; @@ -64,110 +66,48 @@ Entry const CtrlIdToResIdTable[] = { { FOLDERPICKER_TITLE, STR_SVT_FOLDERPICKER_DEFAULT_TITLE }, { FOLDER_PICKER_DEF_DESCRIPTION, STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION }, { FILE_PICKER_OVERWRITE, STR_SVT_ALREADYEXISTOVERWRITE }, - { LISTBOX_FILTER_LABEL, STR_SVT_FILEPICKER_FILTER_TITLE} -}; - -Entry const OtherCtrlIdToResIdTable[] = { + { LISTBOX_FILTER_LABEL, STR_SVT_FILEPICKER_FILTER_TITLE}, { FILE_PICKER_TITLE_OPEN, STR_FILEDLG_OPEN }, { FILE_PICKER_TITLE_SAVE, STR_FILEDLG_SAVE }, { FILE_PICKER_FILE_TYPE, STR_FILEDLG_TYPE } }; const sal_Int32 SIZE_TABLE = SAL_N_ELEMENTS( CtrlIdToResIdTable ); -const sal_Int32 OTHER_SIZE_TABLE = SAL_N_ELEMENTS( OtherCtrlIdToResIdTable ); -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; - break; - } - } - - return aResId; -} - -sal_Int16 OtherCtrlIdToResId( sal_Int32 aControlId ) -{ - sal_Int16 aResId = -1; - - for ( sal_Int32 i = 0; i < OTHER_SIZE_TABLE; i++ ) - { - if ( OtherCtrlIdToResIdTable[i].ctrlId == aControlId ) - { - aResId = OtherCtrlIdToResIdTable[i].resId; + pResId = CtrlIdToResIdTable[i].resId; break; } } - return aResId; + return pResId; } -class CResourceProvider_Impl +namespace CResourceProvider_Impl { -public: - CResourceProvider_Impl( ) - { - m_ResMgr = ResMgr::CreateResMgr( RES_NAME ); - m_OtherResMgr = ResMgr::CreateResMgr( OTHER_RES_NAME ); - } - - ~CResourceProvider_Impl( ) - { - delete m_ResMgr; - delete m_OtherResMgr; - } - - NSString* getResString( sal_Int16 aId ) + NSString* getResString(sal_Int16 aId) { OUString aResString; - const SolarMutexGuard aGuard; - - try - { - OSL_ASSERT( m_ResMgr && m_OtherResMgr ); - - // translate the control id to a resource id - sal_Int16 aResId = CtrlIdToResId( aId ); - if ( aResId > -1 ) - aResString = ResId( aResId, *m_ResMgr ); - else - { - aResId = OtherCtrlIdToResId( aId ); - if ( aResId > -1 ) { - aResString = ResId( aResId, *m_OtherResMgr ); - } - } - } - catch(...) - { - } + // translate the control id to a resource id + const char* pResId = CtrlIdToResId(aId); + if (pResId) + aResString = FpsResId(pResId); return [NSString stringWithOUString:aResString]; } - -public: - ResMgr* m_ResMgr; - ResMgr* m_OtherResMgr; }; -CResourceProvider::CResourceProvider( ) : - m_pImpl( o3tl::make_unique<CResourceProvider_Impl>() ) -{ -} - -CResourceProvider::~CResourceProvider( ) -{} - NSString* CResourceProvider::getResString( sal_Int32 aId ) { - NSString* sImmutable = m_pImpl->getResString( aId ); + NSString* sImmutable = CResourceProvider_Impl::getResString(aId); NSMutableString *sMutableString = [NSMutableString stringWithString:sImmutable]; [sMutableString replaceOccurrencesOfString:@"~" withString:@"" options:0 range:NSMakeRange(0, [sMutableString length])]; diff --git a/fpicker/source/office/OfficeFilePicker.hrc b/fpicker/source/office/OfficeFilePicker.hrc deleted file mode 100644 index c61593f4193f..000000000000 --- a/fpicker/source/office/OfficeFilePicker.hrc +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -#ifndef INCLUDED_FPICKER_SOURCE_OFFICE_OFFICEFILEPICKER_HRC -#define INCLUDED_FPICKER_SOURCE_OFFICE_OFFICEFILEPICKER_HRC - -#include <vcl/fpicker.hrc> - -#define STR_SVT_NEW_FOLDER (RID_FPICKER_START+19) -#define RID_FILEOPEN_NOTEXISTENTFILE (RID_FPICKER_START+24) -#define STR_SVT_NOREMOVABLEDEVICE (RID_FPICKER_START+25) - -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/OfficeFilePicker.src b/fpicker/source/office/OfficeFilePicker.src deleted file mode 100644 index 4f6fe4b764b9..000000000000 --- a/fpicker/source/office/OfficeFilePicker.src +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "OfficeFilePicker.hrc" - -String STR_SVT_FILEPICKER_AUTO_EXTENSION -{ - Text [ en-US ] = "~Automatic file name extension" ; -}; - -String STR_SVT_FILEPICKER_PASSWORD -{ - Text [ en-US ] = "Save with pass~word" ; -}; - -String STR_SVT_FILEPICKER_FILTER_OPTIONS -{ - Text [ en-US ] = "~Edit filter settings"; -}; - -String STR_SVT_FILEPICKER_READONLY -{ - Text [ en-US ] = "~Read-only" ; -}; - -String STR_SVT_FILEPICKER_INSERT_AS_LINK -{ - Text [ en-US ] = "~Link" ; -}; - -String STR_SVT_FILEPICKER_SHOW_PREVIEW -{ - Text [ en-US ] = "Pr~eview" ; -}; - -String STR_SVT_FILEPICKER_PLAY -{ - Text [ en-US ] = "~Play" ; -}; - -String STR_SVT_FILEPICKER_VERSION -{ - Text [ en-US ] = "~Version:"; -}; - -String STR_SVT_FILEPICKER_TEMPLATES -{ - Text [ en-US ] = "S~tyles:" ; -}; - -String STR_SVT_FILEPICKER_IMAGE_TEMPLATE -{ - Text [ en-US ] = "Style:"; -}; - -String STR_SVT_FILEPICKER_SELECTION -{ - Text [ en-US ] = "~Selection" ; -}; - -String STR_SVT_FILEPICKER_FILTER_TITLE -{ - Text [ en-US ] = "File ~type:" ; -}; - -String STR_SVT_FOLDERPICKER_DEFAULT_TITLE -{ - Text [ en-US ] = "Select Path" ; -}; - -String STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION -{ - Text [ en-US ] = "Please select a folder."; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx index f42a0440154a..c0bbc68235eb 100644 --- a/fpicker/source/office/PlacesListBox.cxx +++ b/fpicker/source/office/PlacesListBox.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <iodlg.hrc> +#include <strings.hrc> #include <PlacesListBox.hxx> #include <svtools/PlaceEditDialog.hxx> diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx index 36dbe624ccb1..1b92732e3239 100644 --- a/fpicker/source/office/RemoteFilesDialog.hxx +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -20,12 +20,11 @@ #include <svtools/fileview.hxx> #include <vcl/errinf.hxx> -#include <tools/resid.hxx> #include <unotools/viewoptions.hxx> #include <vcl/button.hxx> -#include <vcl/fpicker.hrc> +#include <fpicker/fpicker.hrc> #include <vcl/menubtn.hxx> #include <vcl/dialog.hxx> #include <vcl/vclptr.hxx> @@ -42,9 +41,8 @@ #include "fpdialogbase.hxx" #include "fpsofficeResMgr.hxx" -#include "OfficeFilePicker.hrc" #include "QueryFolderName.hxx" -#include "iodlg.hrc" +#include "strings.hrc" using namespace ::com::sun::star::beans; using namespace ::com::sun::star::task; diff --git a/fpicker/source/office/fpsofficeResMgr.hxx b/fpicker/source/office/fpsofficeResMgr.hxx deleted file mode 100644 index 0fcbe4cab629..000000000000 --- a/fpicker/source/office/fpsofficeResMgr.hxx +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -#ifndef INCLUDED_FPICKER_SOURCE_OFFICE_FPSOFFICERESMGR_HXX -#define INCLUDED_FPICKER_SOURCE_OFFICE_FPSOFFICERESMGR_HXX - -#include <rtl/instance.hxx> -#include <osl/getglobalmutex.hxx> -#include <tools/resmgr.hxx> - -namespace fpicker -{ - struct ResMgrHolder - { - ResMgr * operator ()() - { - return ResMgr::CreateResMgr ("fps_office"); - } - - static ResMgr * getOrCreate() - { - return rtl_Instance< - ResMgr, ResMgrHolder, - osl::MutexGuard, osl::GetGlobalMutex >::create ( - ResMgrHolder(), osl::GetGlobalMutex()); - } - }; - - struct SvtResId : public ResId - { - explicit SvtResId (sal_uInt16 nId) : ResId (nId, *ResMgrHolder::getOrCreate()) {} - }; -} - -inline OUString FpsResId(sal_uInt16 nId) -{ - return fpicker::SvtResId(nId); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index df21d5f00d7f..3415f2e2d06c 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -42,10 +42,10 @@ #include "svtools/treelistentry.hxx" #include <toolkit/helper/vclunohelper.hxx> +#include "fpicker/fpicker.hrc" #include "svtools/helpid.hrc" -#include <svtools/svtools.hrc> -#include "OfficeFilePicker.hrc" -#include "iodlg.hrc" +#include <svtools/strings.hrc> +#include "strings.hrc" #include "bitmaps.hlst" #include "asyncfilepicker.hxx" #include "iodlgimp.hxx" @@ -646,26 +646,26 @@ void SvtFileDialog::Init_Impl AddControls_Impl( ); // adjust the labels to the mode - sal_uInt16 nResId = STR_EXPLORERFILE_OPEN; - sal_uInt16 nButtonResId = 0; + const char* pResId = STR_EXPLORERFILE_OPEN; + const char* pButtonResId = nullptr; if ( nStyle & PickerFlags::SaveAs ) { - nResId = STR_EXPLORERFILE_SAVE; - nButtonResId = STR_EXPLORERFILE_BUTTONSAVE; + pResId = STR_EXPLORERFILE_SAVE; + pButtonResId = STR_EXPLORERFILE_BUTTONSAVE; } if ( nStyle & PickerFlags::PathDialog ) { pImpl->_pFtFileName->SetText( FpsResId( STR_PATHNAME ) ); - nResId = STR_PATHSELECT; - nButtonResId = STR_BUTTONSELECT; + pResId = STR_PATHSELECT; + pButtonResId = STR_BUTTONSELECT; } - SetText( FpsResId( nResId ) ); + SetText( FpsResId( pResId ) ); - if ( nButtonResId ) - pImpl->_pBtnFileOpen->SetText( FpsResId( nButtonResId ) ); + if ( pButtonResId ) + pImpl->_pBtnFileOpen->SetText( FpsResId( pButtonResId ) ); if ( FILEDLG_TYPE_FILEDLG != pImpl->_eDlgType ) { diff --git a/fpicker/source/office/iodlg.hrc b/fpicker/source/office/iodlg.hrc deleted file mode 100644 index 467114efb2f9..000000000000 --- a/fpicker/source/office/iodlg.hrc +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FPICKER_SOURCE_OFFICE_IODLG_HRC -#define INCLUDED_FPICKER_SOURCE_OFFICE_IODLG_HRC - -#include "svtools/helpid.hrc" -#include <vcl/fpicker.hrc> - -#define STR_EXPLORERFILE_OPEN (RID_FPICKER_START+31) -#define STR_EXPLORERFILE_SAVE (RID_FPICKER_START+32) -#define STR_EXPLORERFILE_BUTTONSAVE (RID_FPICKER_START+33) -#define STR_PATHNAME (RID_FPICKER_START+34) -#define STR_PATHSELECT (RID_FPICKER_START+35) -#define STR_BUTTONSELECT (RID_FPICKER_START+36) -#define STR_PREVIEW (RID_FPICKER_START+38) -#define STR_DEFAULT_DIRECTORY (RID_FPICKER_START+39) -#define STR_PLACES_TITLE (RID_FPICKER_START+40) - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlg.src b/fpicker/source/office/iodlg.src deleted file mode 100644 index 74408ad7aaac..000000000000 --- a/fpicker/source/office/iodlg.src +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "svtools/helpid.hrc" -#include "svtools/svtools.hrc" -#include "iodlg.hrc" -#include "OfficeFilePicker.hrc" - -// strings ******************************************************************* - -String STR_EXPLORERFILE_OPEN -{ - Text [ en-US ] = "Open" ; -}; -String STR_EXPLORERFILE_SAVE -{ - Text [ en-US ] = "Save as" ; -}; -String STR_EXPLORERFILE_BUTTONSAVE -{ - Text [ en-US ] = "~Save" ; -}; -String STR_PATHNAME -{ - Text [ en-US ] = "~Path:" ; -}; -String STR_PATHSELECT -{ - Text [ en-US ] = "Select path" ; -}; -String STR_BUTTONSELECT -{ - Text [ en-US ] = "~Select"; -}; -String STR_PREVIEW -{ - Text [ en-US ] = "File Preview"; -}; -String STR_DEFAULT_DIRECTORY -{ - Text [ en-US ] = "My Documents" ; -}; -String STR_PLACES_TITLE -{ - Text [ en-US ] = "Places" ; -}; - -String RID_FILEOPEN_NOTEXISTENTFILE -{ - Text [ en-US ] = "The file $name$ does not exist.\nMake sure you have entered the correct file name."; -}; - -String STR_FILTERNAME_ALL -{ - Text [ en-US ] = "All files" ; -}; - -String STR_SVT_ALREADYEXISTOVERWRITE -{ - Text [ en-US ] = "A file named \"$filename$\" already exists.\n\nDo you want to replace it?" ; -}; - -String STR_SVT_DELETESERVICE -{ - Text [ en-US ] = "Are you sure you want to delete the service?\n\"$servicename$\"" ; -}; - -String STR_SVT_ROOTLABEL -{ - Text [ en-US ] = "Root" ; -}; - -String STR_SVT_NEW_FOLDER -{ - Text [ en-US ] = "Folder" ; -}; - -String STR_SVT_NOREMOVABLEDEVICE -{ - Text [ en-US ] = "No removable storage device detected.\nMake sure it is plugged in properly and try again." ; -}; - -//******************************************************************** EOF - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx index e45764e7782e..9ee48838fc54 100644 --- a/fpicker/source/office/iodlgimp.cxx +++ b/fpicker/source/office/iodlgimp.cxx @@ -20,6 +20,7 @@ #include "iodlgimp.hxx" #include "svtools/headbar.hxx" #include <tools/debug.hxx> +#include <tools/resmgr.hxx> #include <tools/urlobj.hxx> #include <vcl/menu.hxx> #include <vcl/msgbox.hxx> @@ -31,45 +32,17 @@ #include "svtools/fileview.hxx" #include "svtools/inettbc.hxx" #include "iodlg.hxx" -#include "iodlg.hrc" +#include "strings.hrc" #include "bitmaps.hlst" #include "svtools/imagemgr.hxx" #include <unotools/localfilehelper.hxx> #include "unotools/useroptions.hxx" -#include "rtl/instance.hxx" -#include <osl/getglobalmutex.hxx> #include <svl/svl.hrc> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::utl; - -// ResMgrHolder / SvtSimpleResId - -namespace -{ - struct ResMgrHolder - { - ResMgr * operator ()() - { - return ResMgr::CreateResMgr ("svl"); - } - static ResMgr * getOrCreate() - { - return rtl_Instance< - ResMgr, ResMgrHolder, - osl::MutexGuard, osl::GetGlobalMutex >::create ( - ResMgrHolder(), osl::GetGlobalMutex()); - } - }; - - struct SvtSimpleResId : public ResId - { - explicit SvtSimpleResId (sal_uInt16 nId) : ResId (nId, *ResMgrHolder::getOrCreate()) {} - }; -} - SvtFileDialogFilter_Impl::SvtFileDialogFilter_Impl( const OUString& rName, const OUString& rType ) :m_aName( rName ) ,m_aType( rType ) @@ -171,13 +144,13 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu ) if ( nCount == 1 ) { // adjust the title of the top level entry (the workspace) - _pMenu->SetItemText( --nItemId, SvtSimpleResId(STR_SVT_MIMETYPE_CNT_FSYSBOX).toString() ); + std::locale loc = Translate::Create("svl", Application::GetSettings().GetUILanguageTag()); + _pMenu->SetItemText(--nItemId, Translate::get(STR_SVT_MIMETYPE_CNT_FSYSBOX, loc)); } --nCount; } } - void SvtUpButton_Impl::Select() { sal_uInt16 nId = GetCurItemId(); 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 |