From aeffd7f25f6bf664ee5536942bd48407447867f7 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 4 Nov 2011 21:49:28 +0000 Subject: move required resources down from fpicker & svtools into vcl --- vcl/AllLangResTarget_vcl.mk | 1 + vcl/inc/svids.hrc | 19 ++++ vcl/source/src/fpicker.src | 92 +++++++++++++++++ vcl/unx/gtk/fpicker/resourceprovider.cxx | 165 +++++++------------------------ 4 files changed, 147 insertions(+), 130 deletions(-) create mode 100644 vcl/source/src/fpicker.src (limited to 'vcl') diff --git a/vcl/AllLangResTarget_vcl.mk b/vcl/AllLangResTarget_vcl.mk index b84b9aad4398..7534c264054e 100644 --- a/vcl/AllLangResTarget_vcl.mk +++ b/vcl/AllLangResTarget_vcl.mk @@ -49,6 +49,7 @@ $(eval $(call gb_SrsTarget_add_files,vcl/source/src,\ vcl/source/src/print.src \ vcl/source/src/stdtext.src \ vcl/source/src/units.src \ + vcl/source/src/fpicker.src \ )) diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc index bc76c70e1ebe..dc16ab1d53e4 100644 --- a/vcl/inc/svids.hrc +++ b/vcl/inc/svids.hrc @@ -195,6 +195,25 @@ #define SV_STDTEXT_ALLFILETYPES 10207 #define SV_STDTEXT_LAST SV_STDTEXT_ALLFILETYPES +#define STR_FPICKER_AUTO_EXTENSION 10300 +#define STR_FPICKER_PASSWORD 10301 +#define STR_FPICKER_FILTER_OPTIONS 10302 +#define STR_FPICKER_READONLY 10303 +#define STR_FPICKER_INSERT_AS_LINK 10304 +#define STR_FPICKER_SHOW_PREVIEW 10305 +#define STR_FPICKER_PLAY 10306 +#define STR_FPICKER_VERSION 10307 +#define STR_FPICKER_TEMPLATES 10308 +#define STR_FPICKER_IMAGE_TEMPLATE 10309 +#define STR_FPICKER_SELECTION 10310 +#define STR_FPICKER_FOLDER_DEFAULT_TITLE 10311 +#define STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION 10312 +#define STR_FPICKER_ALREADYEXISTOVERWRITE 10313 +#define STR_FPICKER_ALLFORMATS 10314 +#define STR_FPICKER_OPEN 10315 +#define STR_FPICKER_SAVE 10316 +#define STR_FPICKER_TYPE 10317 + #define SV_ACCESSERROR_FIRST SV_ACCESSERROR_WRONG_VERSION #define SV_ACCESSERROR_WRONG_VERSION 10500 #define SV_ACCESSERROR_BRIDGE_MSG 10501 diff --git a/vcl/source/src/fpicker.src b/vcl/source/src/fpicker.src new file mode 100644 index 000000000000..ce660441ab7a --- /dev/null +++ b/vcl/source/src/fpicker.src @@ -0,0 +1,92 @@ +#include + +String STR_FPICKER_AUTO_EXTENSION +{ + Text [ en-US ] = "~Automatic file name extension" ; +}; + +String STR_FPICKER_PASSWORD +{ + Text [ en-US ] = "Save with pass~word" ; +}; + +String STR_FPICKER_FILTER_OPTIONS +{ + Text [ en-US ] = "~Edit filter settings"; +}; + +String STR_FPICKER_READONLY +{ + Text [ en-US ] = "~Read-only" ; +}; + +String STR_FPICKER_INSERT_AS_LINK +{ + Text [ en-US ] = "~Link" ; +}; + +String STR_FPICKER_SHOW_PREVIEW +{ + Text [ en-US ] = "Pr~eview" ; +}; + +String STR_FPICKER_PLAY +{ + Text [ en-US ] = "~Play" ; +}; + +String STR_FPICKER_VERSION +{ + Text [ en-US ] = "~Version:"; +}; + +String STR_FPICKER_TEMPLATES +{ + Text [ en-US ] = "S~tyles:" ; +}; + +String STR_FPICKER_IMAGE_TEMPLATE +{ + Text [ en-US ] = "Style:"; +}; + +String STR_FPICKER_SELECTION +{ + Text [ en-US ] = "~Selection" ; +}; + +String STR_FPICKER_FOLDER_DEFAULT_TITLE +{ + Text [ en-US ] = "Select Path" ; +}; + +String STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION +{ + Text [ en-US ] = "Please select a folder."; +}; + +String STR_FPICKER_ALREADYEXISTOVERWRITE +{ + Text [ en-US ] = "A file named \"$filename$\" already exists.\n\nDo you want to replace it?" ; +}; + +String STR_FPICKER_ALLFORMATS +{ + Text [ en-US ] = "All Formats" ; +}; + +String STR_FPICKER_OPEN +{ + Text [ en-US ] = "Open" ; +}; + +String STR_FPICKER_SAVE +{ + Text [ en-US ] = "Save" ; +}; + +String STR_FPICKER_TYPE +{ + Text [ en-US ] = "File ~type" ; +}; + diff --git a/vcl/unx/gtk/fpicker/resourceprovider.cxx b/vcl/unx/gtk/fpicker/resourceprovider.cxx index 70a3e68ecd05..5d19d789afc9 100644 --- a/vcl/unx/gtk/fpicker/resourceprovider.cxx +++ b/vcl/unx/gtk/fpicker/resourceprovider.cxx @@ -26,199 +26,104 @@ * ************************************************************************/ -//------------------------------------------------------------------------ -// includes -//------------------------------------------------------------------------ #include -#include #include "resourceprovider.hxx" -#include #include #include #include #include -#include -#include +#include "svids.hrc" +#include "svdata.hxx" -//------------------------------------------------------------ -// namespace directives -//------------------------------------------------------------ - -using rtl::OUString; using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds; -//------------------------------------------------------------ -// -//------------------------------------------------------------ - -static const char* RES_NAME = "fps_office"; -static const char* OTHER_RES_NAME = "svt"; - -//------------------------------------------------------------ -// we have to translate control ids to resource ids -//------------------------------------------------------------ - -struct _Entry +//--------------------------------------- +// translate control ids to resource ids +//--------------------------------------- +static const struct { sal_Int32 ctrlId; sal_Int16 resId; +} CtrlIdToResIdTable[] = { + { CHECKBOX_AUTOEXTENSION, STR_FPICKER_AUTO_EXTENSION }, + { CHECKBOX_PASSWORD, STR_FPICKER_PASSWORD }, + { CHECKBOX_FILTEROPTIONS, STR_FPICKER_FILTER_OPTIONS }, + { CHECKBOX_READONLY, STR_FPICKER_READONLY }, + { CHECKBOX_LINK, STR_FPICKER_INSERT_AS_LINK }, + { CHECKBOX_PREVIEW, STR_FPICKER_SHOW_PREVIEW }, + { PUSHBUTTON_PLAY, STR_FPICKER_PLAY }, + { LISTBOX_VERSION_LABEL, STR_FPICKER_VERSION }, + { LISTBOX_TEMPLATE_LABEL, STR_FPICKER_TEMPLATES }, + { LISTBOX_IMAGE_TEMPLATE_LABEL, STR_FPICKER_IMAGE_TEMPLATE }, + { CHECKBOX_SELECTION, STR_FPICKER_SELECTION }, + { FOLDERPICKER_TITLE, STR_FPICKER_FOLDER_DEFAULT_TITLE }, + { FOLDER_PICKER_DEF_DESCRIPTION, STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION }, + { FILE_PICKER_OVERWRITE, STR_FPICKER_ALREADYEXISTOVERWRITE }, + { FILE_PICKER_ALLFORMATS, STR_FPICKER_ALLFORMATS }, + { FILE_PICKER_TITLE_OPEN, STR_FPICKER_OPEN }, + { FILE_PICKER_TITLE_SAVE, STR_FPICKER_SAVE }, + { FILE_PICKER_FILE_TYPE, STR_FPICKER_TYPE } }; -_Entry CtrlIdToResIdTable[] = { - { CHECKBOX_AUTOEXTENSION, STR_SVT_FILEPICKER_AUTO_EXTENSION }, - { CHECKBOX_PASSWORD, STR_SVT_FILEPICKER_PASSWORD }, - { CHECKBOX_FILTEROPTIONS, STR_SVT_FILEPICKER_FILTER_OPTIONS }, - { CHECKBOX_READONLY, STR_SVT_FILEPICKER_READONLY }, - { CHECKBOX_LINK, STR_SVT_FILEPICKER_INSERT_AS_LINK }, - { CHECKBOX_PREVIEW, STR_SVT_FILEPICKER_SHOW_PREVIEW }, - { PUSHBUTTON_PLAY, STR_SVT_FILEPICKER_PLAY }, - { LISTBOX_VERSION_LABEL, STR_SVT_FILEPICKER_VERSION }, - { LISTBOX_TEMPLATE_LABEL, STR_SVT_FILEPICKER_TEMPLATES }, - { LISTBOX_IMAGE_TEMPLATE_LABEL, STR_SVT_FILEPICKER_IMAGE_TEMPLATE }, - { CHECKBOX_SELECTION, STR_SVT_FILEPICKER_SELECTION }, - { FOLDERPICKER_TITLE, STR_SVT_FOLDERPICKER_DEFAULT_TITLE }, - { FOLDER_PICKER_DEF_DESCRIPTION, STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION }, - { FILE_PICKER_OVERWRITE, STR_SVT_ALREADYEXISTOVERWRITE }, - { FILE_PICKER_ALLFORMATS, STR_SVT_ALLFORMATS } -}; - -_Entry OtherCtrlIdToResIdTable[] = { - { 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 ) +static sal_Int16 CtrlIdToResId( sal_Int32 aControlId ) { - sal_Int16 aResId = -1; - - for ( sal_Int32 i = 0; i < SIZE_TABLE; i++ ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( CtrlIdToResIdTable ); i++ ) { if ( CtrlIdToResIdTable[i].ctrlId == aControlId ) - { - aResId = CtrlIdToResIdTable[i].resId; - break; - } + return CtrlIdToResIdTable[i].resId; } - - return aResId; + return -1; } -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; - break; - } - } - - return aResId; -} - -//------------------------------------------------------------ -// -//------------------------------------------------------------ - class CResourceProvider_Impl { public: - - //------------------------------------- - // - //------------------------------------- - CResourceProvider_Impl( ) { - m_ResMgr = ResMgr::CreateResMgr( RES_NAME ); - m_OtherResMgr = ResMgr::CreateResMgr( OTHER_RES_NAME ); + m_ResMgr = ImplGetResMgr(); } - //------------------------------------- - // - //------------------------------------- - ~CResourceProvider_Impl( ) { delete m_ResMgr; - delete m_OtherResMgr; } - //------------------------------------- - // - //------------------------------------- - - OUString getResString( sal_Int16 aId ) + rtl::OUString getResString( sal_Int16 aId ) { - String aResString; - OUString aResOUString; + OSL_ASSERT( m_ResMgr ); + String aResString; try { - OSL_ASSERT( m_ResMgr && m_OtherResMgr ); - // translate the control id to a resource id sal_Int16 aResId = CtrlIdToResId( aId ); if ( aResId > -1 ) aResString = String( ResId( aResId, *m_ResMgr ) ); - else - { - aResId = OtherCtrlIdToResId( aId ); - if ( aResId > -1 ) - aResString = String( ResId( aResId, *m_OtherResMgr ) ); - } - if ( aResId > -1 ) - aResOUString = OUString( aResString ); } catch(...) { } - return aResOUString; + return rtl::OUString( aResString ); } public: ResMgr* m_ResMgr; - ResMgr* m_OtherResMgr; }; -//------------------------------------------------------------ -// -//------------------------------------------------------------ - CResourceProvider::CResourceProvider( ) : m_pImpl( new CResourceProvider_Impl() ) { } -//------------------------------------------------------------ -// -//------------------------------------------------------------ - CResourceProvider::~CResourceProvider( ) { delete m_pImpl; } -//------------------------------------------------------------ -// -//------------------------------------------------------------ - -OUString CResourceProvider::getResString( sal_Int32 aId ) +rtl::OUString CResourceProvider::getResString( sal_Int32 aId ) { return m_pImpl->getResString( aId ).replace('~', '_'); } -- cgit v1.2.3