diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-19 13:18:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-05 09:39:11 +0200 |
commit | 14cfff500e93f0d6cbf8412065feea85c01ea81d (patch) | |
tree | 76e3fb8fbf2b0d8a12c8406d8cf994ea6a37aaff /dbaccess | |
parent | d924ce30e0ca260682bd2aed192b8b1b2ca3e7c0 (diff) |
Pass context and resource string down to boost::locale separately
because this is often on a hot path, and we can avoid the splitting and
joining of strings like this.
Change-Id: Ia36047209368ca53431178c2e8723a18cfe8260a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119220
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
40 files changed, 85 insertions, 75 deletions
diff --git a/dbaccess/inc/core_resource.hxx b/dbaccess/inc/core_resource.hxx index 0e1e80ee3efd..0e70aabefea6 100644 --- a/dbaccess/inc/core_resource.hxx +++ b/dbaccess/inc/core_resource.hxx @@ -22,6 +22,7 @@ #include <rtl/ustring.hxx> #include "dbadllapi.hxx" +#include <unotools/resmgr.hxx> #define DBA_RES( id ) ::dbaccess::ResourceManager::loadString( id ) #define DBA_RES_PARAM( id, ascii, replace ) ::dbaccess::ResourceManager::loadString( id, ascii, replace ) @@ -40,7 +41,7 @@ namespace dbaccess public: /** loads the string with the specified resource id */ - static OUString loadString(const char* pResId); + static OUString loadString(TranslateId pResId); /** loads a string from the resource file, substituting a placeholder with a given string @@ -52,7 +53,7 @@ namespace dbaccess the string which should substitute the placeholder */ static OUString loadString( - const char* pResId, + TranslateId pResId, const char* _pPlaceholderAscii, std::u16string_view _rReplace ); @@ -71,7 +72,7 @@ namespace dbaccess the string which should substitute the second placeholder */ static OUString loadString( - const char* pResId, + TranslateId pResId, const char* _pPlaceholderAscii1, std::u16string_view _rReplace1, const char* _pPlaceholderAscii2, diff --git a/dbaccess/inc/query.hrc b/dbaccess/inc/query.hrc index fe4042517603..e4c034ded11c 100644 --- a/dbaccess/inc/query.hrc +++ b/dbaccess/inc/query.hrc @@ -19,9 +19,9 @@ #ifndef INCLUDED_VCL_INC_PRINTACCESSORYVIEW_HRC #define INCLUDED_VCL_INC_PRINTACCESSORYVIEW_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -const char* RSC_QUERY_OBJECT_TYPE[] = +const TranslateId RSC_QUERY_OBJECT_TYPE[] = { NC_("RSC_QUERY_OBJECT_TYPE", "The table view"), NC_("RSC_QUERY_OBJECT_TYPE", "The query"), diff --git a/dbaccess/inc/strings.hrc b/dbaccess/inc/strings.hrc index 2ccc5a666717..3fe6a7207dac 100644 --- a/dbaccess/inc/strings.hrc +++ b/dbaccess/inc/strings.hrc @@ -19,7 +19,9 @@ #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_CORE_RESOURCE_HRC #define INCLUDED_DBACCESS_SOURCE_CORE_INC_CORE_RESOURCE_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#include <unotools/resmgr.hxx> + +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) #define RID_STR_CONNECTION_INVALID NC_("RID_STR_CONNECTION_INVALID", "No connection could be established.") #define RID_STR_TABLE_IS_FILTERED NC_("RID_STR_TABLE_IS_FILTERED", "The table $name$ already exists. It is not visible because it has been filtered out.") diff --git a/dbaccess/inc/templwin.hrc b/dbaccess/inc/templwin.hrc index 0147a694ff5b..052883d37926 100644 --- a/dbaccess/inc/templwin.hrc +++ b/dbaccess/inc/templwin.hrc @@ -20,8 +20,9 @@ #pragma once #include <utility> +#include <unotools/resmgr.hxx> -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) #define DI_TITLE 1 #define DI_FROM 2 @@ -36,7 +37,7 @@ #define DI_THEME 11 #define DI_SIZE 12 -const std::pair<const char*, int> STRARY_SVT_DOCINFO[] = +const std::pair<TranslateId, int> STRARY_SVT_DOCINFO[] = { { NC_("STRARY_SVT_DOCINFO", "Title") , DI_TITLE }, { NC_("STRARY_SVT_DOCINFO", "By") , DI_FROM }, diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 83a45afa3e2d..4f499eccc263 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -676,7 +676,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString sPwd = m_pImpl->m_aPassword; } - const char* pExceptionMessageId = RID_STR_COULDNOTCONNECT_UNSPECIFIED; + TranslateId pExceptionMessageId = RID_STR_COULDNOTCONNECT_UNSPECIFIED; if (xManager.is()) { sal_Int32 nAdditionalArgs(0); diff --git a/dbaccess/source/core/resource/core_resource.cxx b/dbaccess/source/core/resource/core_resource.cxx index cecf7d3b4773..ecf73939eec2 100644 --- a/dbaccess/source/core/resource/core_resource.cxx +++ b/dbaccess/source/core/resource/core_resource.cxx @@ -33,18 +33,18 @@ namespace dbaccess struct theResourceManagerMutex : public rtl::Static< osl::Mutex, theResourceManagerMutex > {}; } - OUString ResourceManager::loadString(const char* pResId) + OUString ResourceManager::loadString(TranslateId pResId) { return Translate::get(pResId, Translate::Create("dba")); } - OUString ResourceManager::loadString(const char* pResId, const char* _pPlaceholderAscii, std::u16string_view _rReplace) + OUString ResourceManager::loadString(TranslateId pResId, const char* _pPlaceholderAscii, std::u16string_view _rReplace) { OUString sString(loadString(pResId)); return sString.replaceFirst( OUString::createFromAscii(_pPlaceholderAscii), _rReplace ); } - OUString ResourceManager::loadString(const char* pResId, const char* _pPlaceholderAscii1, std::u16string_view _rReplace1, + OUString ResourceManager::loadString(TranslateId pResId, const char* _pPlaceholderAscii1, std::u16string_view _rReplace1, const char* _pPlaceholderAscii2, std::u16string_view _rReplace2) { OUString sString(loadString(pResId)); diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx index 6c56c6052282..6e995354e4f6 100644 --- a/dbaccess/source/ui/app/AppDetailView.cxx +++ b/dbaccess/source/ui/app/AppDetailView.cxx @@ -50,7 +50,7 @@ using namespace ::com::sun::star::beans; using ::com::sun::star::util::URL; using ::com::sun::star::sdb::application::NamedDatabaseObject; -TaskEntry::TaskEntry( const char* _pAsciiUNOCommand, const char* _pHelpID, const char* pTitleResourceID, bool _bHideWhenDisabled ) +TaskEntry::TaskEntry( const char* _pAsciiUNOCommand, TranslateId _pHelpID, TranslateId pTitleResourceID, bool _bHideWhenDisabled ) :sUNOCommand( OUString::createFromAscii( _pAsciiUNOCommand ) ) ,pHelpID( _pHelpID ) ,sTitle( DBA_RES(pTitleResourceID) ) @@ -60,7 +60,7 @@ TaskEntry::TaskEntry( const char* _pAsciiUNOCommand, const char* _pHelpID, const void OTasksWindow::updateHelpText() { - const char* pHelpTextId = nullptr; + TranslateId pHelpTextId; int nCurEntry = m_xTreeView->get_selected_index(); if (nCurEntry != -1) pHelpTextId = reinterpret_cast<TaskEntry*>(m_xTreeView->get_id(nCurEntry).toUInt64())->pHelpID; @@ -135,7 +135,7 @@ OTasksWindow::~OTasksWindow() Clear(); } -void OTasksWindow::setHelpText(const char* pId) +void OTasksWindow::setHelpText(TranslateId pId) { if (pId) m_xHelpText->set_text(DBA_RES(pId)); @@ -208,7 +208,7 @@ OApplicationDetailView::OApplicationDetailView(weld::Container* pParent, OAppBor , m_xTasksParent(m_xBuilder->weld_container("tasks")) , m_xContainerParent(m_xBuilder->weld_container("container")) , m_xTasks(new dbaui::OTitleWindow(m_xTasksParent.get(), STR_TASKS)) - , m_xTitleContainer(new dbaui::OTitleWindow(m_xContainerParent.get(), nullptr)) + , m_xTitleContainer(new dbaui::OTitleWindow(m_xContainerParent.get(), TranslateId())) , m_rBorderWin(rBorder) { m_xControlHelper = std::make_shared<OAppDetailPageHelper>(m_xTitleContainer->getChildContainer(), m_rBorderWin, ePreviewMode); diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx index 58b382800865..f074df4401f7 100644 --- a/dbaccess/source/ui/app/AppDetailView.hxx +++ b/dbaccess/source/ui/app/AppDetailView.hxx @@ -40,14 +40,14 @@ namespace dbaui struct TaskEntry { OUString sUNOCommand; - const char* pHelpID; + TranslateId pHelpID; OUString sTitle; bool bHideWhenDisabled; // TODO: we should be consistent in the task pane and the menus/toolbars: // If an entry is disabled in the latter, it should also be disabled in the former. // If an entry is *hidden* in the former, it should also be hidden in the latter. - TaskEntry( const char* _pAsciiUNOCommand, const char* pHelpID, const char* pTitleResourceID, bool _bHideWhenDisabled = false ); + TaskEntry( const char* _pAsciiUNOCommand, TranslateId pHelpID, TranslateId pTitleResourceID, bool _bHideWhenDisabled = false ); }; typedef std::vector< TaskEntry > TaskEntryList; @@ -56,7 +56,7 @@ namespace dbaui /// the tasks available in the pane TaskEntryList aTasks; /// the resource ID for the title of the pane - const char* pTitleId; + TranslateId pTitleId; }; class OTasksWindow final : public OChildWindow @@ -89,7 +89,7 @@ namespace dbaui void fillTaskEntryList( const TaskEntryList& _rList ); void Clear(); - void setHelpText(const char* pId); + void setHelpText(TranslateId pId); }; class OApplicationDetailView final : public IClipboardTest diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx index 0ae6f1eff01b..ff9e35ab9cd3 100644 --- a/dbaccess/source/ui/app/AppIconControl.cxx +++ b/dbaccess/source/ui/app/AppIconControl.cxx @@ -71,7 +71,7 @@ void OApplicationIconControl::Fill() { static const struct CategoryDescriptor { - const char* pLabelResId; + TranslateId pLabelResId; ElementType eType; const char* aImageResId; } aCategories[] = { { RID_STR_TABLES_CONTAINER, E_TABLE, BMP_TABLEFOLDER_TREE_L }, diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx index 9927b49b2956..d5e604394b2f 100644 --- a/dbaccess/source/ui/app/AppTitleWindow.cxx +++ b/dbaccess/source/ui/app/AppTitleWindow.cxx @@ -23,7 +23,7 @@ namespace dbaui { -OTitleWindow::OTitleWindow(weld::Container* pParent, const char* pTitleId) +OTitleWindow::OTitleWindow(weld::Container* pParent, TranslateId pTitleId) : m_xBuilder(Application::CreateBuilder(pParent, "dbaccess/ui/titlewindow.ui")) , m_xContainer(m_xBuilder->weld_container("TitleWindow")) , m_xTitleFrame(m_xBuilder->weld_container("titleparent")) @@ -46,7 +46,7 @@ void OTitleWindow::setChildWindow(const std::shared_ptr<OChildWindow>& rChild) m_xChild = rChild; } -void OTitleWindow::setTitle(const char* pTitleId) +void OTitleWindow::setTitle(TranslateId pTitleId) { if (!pTitleId) return; diff --git a/dbaccess/source/ui/app/AppTitleWindow.hxx b/dbaccess/source/ui/app/AppTitleWindow.hxx index 161e21e5c3fe..d57f5241650f 100644 --- a/dbaccess/source/ui/app/AppTitleWindow.hxx +++ b/dbaccess/source/ui/app/AppTitleWindow.hxx @@ -19,6 +19,7 @@ #pragma once #include <ChildWindow.hxx> +#include <unotools/resmgr.hxx> namespace dbaui { @@ -32,7 +33,7 @@ namespace dbaui std::shared_ptr<OChildWindow> m_xChild; public: - OTitleWindow(weld::Container* pParent, const char* pTitleId); + OTitleWindow(weld::Container* pParent, TranslateId pTitleId); ~OTitleWindow(); void GrabFocus(); @@ -59,7 +60,7 @@ namespace dbaui @param pTitleId The resource id of the title text. */ - void setTitle(const char* pTitleId); + void setTitle(TranslateId pTitleId); }; } // namespace dbaui diff --git a/dbaccess/source/ui/control/FieldControls.cxx b/dbaccess/source/ui/control/FieldControls.cxx index 866014a99f2d..3f3553d56ee9 100644 --- a/dbaccess/source/ui/control/FieldControls.cxx +++ b/dbaccess/source/ui/control/FieldControls.cxx @@ -25,7 +25,7 @@ namespace dbaui { OPropColumnEditCtrl::OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry, OUString const & _rAllowedChars, - const char* pHelpId, + TranslateId pHelpId, short nPosition) : OSQLNameEntry(std::move(xEntry), _rAllowedChars) , m_nPos(nPosition) @@ -33,7 +33,7 @@ OPropColumnEditCtrl::OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry, m_strHelpText = DBA_RES(pHelpId); } -OPropEditCtrl::OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, const char* pHelpId, short nPosition) +OPropEditCtrl::OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, TranslateId pHelpId, short nPosition) : OWidgetBase(xEntry.get()) , m_xEntry(std::move(xEntry)) , m_nPos(nPosition) @@ -41,7 +41,7 @@ OPropEditCtrl::OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, const char* pH m_strHelpText = DBA_RES(pHelpId); } -OPropNumericEditCtrl::OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, const char* pHelpId, short nPosition) +OPropNumericEditCtrl::OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, TranslateId pHelpId, short nPosition) : OWidgetBase(xSpinButton.get()) , m_xSpinButton(std::move(xSpinButton)) , m_nPos(nPosition) @@ -49,7 +49,7 @@ OPropNumericEditCtrl::OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSp m_strHelpText = DBA_RES(pHelpId); } -OPropListBoxCtrl::OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, const char* pHelpId, short nPosition) +OPropListBoxCtrl::OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, TranslateId pHelpId, short nPosition) : OWidgetBase(xComboBox.get()) , m_xComboBox(std::move(xComboBox)) , m_nPos(nPosition) diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index 9009d0b467c3..ef67b373e6d8 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -607,7 +607,7 @@ void OFieldDescControl::InitializeControl(weld::Widget* pControl,const OString& } } -std::unique_ptr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const OString& rId, const char* pHelpId, short _nProperty, const OString& _sHelpId) +std::unique_ptr<OPropNumericEditCtrl> OFieldDescControl::CreateNumericControl(const OString& rId, TranslateId pHelpId, short _nProperty, const OString& _sHelpId) { auto xControl = std::make_unique<OPropNumericEditCtrl>( m_xBuilder->weld_spin_button(rId), pHelpId, _nProperty); diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx index 5082abf9ed98..1450ece5b454 100644 --- a/dbaccess/source/ui/dlg/ConnectionPage.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx @@ -255,7 +255,7 @@ namespace dbaui } #endif - const char* pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; + TranslateId pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error; OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); aMsg.run(); diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx index bee1b1f11493..8f57c24f99eb 100644 --- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx @@ -58,16 +58,16 @@ namespace dbaui std::unique_ptr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateUserDefinedTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet) { - return std::make_unique<OConnectionTabPageSetup>(pPage, pController, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, nullptr, nullptr, STR_COMMONURL); + return std::make_unique<OConnectionTabPageSetup>(pPage, pController, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, TranslateId(), TranslateId(), STR_COMMONURL); } - OConnectionTabPageSetup::OConnectionTabPageSetup(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs, const char* pHelpTextResId, const char* pHeaderResId, const char* pUrlResId) + OConnectionTabPageSetup::OConnectionTabPageSetup(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs, TranslateId pHelpTextResId, TranslateId pHeaderResId, TranslateId pUrlResId) : OConnectionHelper(pPage, pController, _rUIXMLDescription, _rId, _rCoreAttrs) , m_xHelpText(m_xBuilder->weld_label("helptext")) , m_xHeaderText(m_xBuilder->weld_label("header")) { - if (pHelpTextResId != nullptr) + if (pHelpTextResId) { OUString sHelpText = DBA_RES(pHelpTextResId); m_xHelpText->set_label(sHelpText); @@ -75,10 +75,10 @@ namespace dbaui else m_xHelpText->hide(); - if (pHeaderResId != nullptr) + if (pHeaderResId) m_xHeaderText->set_label(DBA_RES(pHeaderResId)); - if (pUrlResId != nullptr) + if (pUrlResId) { OUString sLabelText = DBA_RES(pUrlResId); m_xFT_Connection->set_label(sLabelText); diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx index b04fb194d36d..0039a7160a6e 100644 --- a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx +++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx @@ -18,9 +18,10 @@ */ #pragma once -#include "ConnectionHelper.hxx" +#include "ConnectionHelper.hxx" #include "adminpages.hxx" +#include <unotools/resmgr.hxx> namespace dbaui { @@ -38,7 +39,7 @@ namespace dbaui DECL_LINK(OnEditModified, weld::Entry&, void); public: - OConnectionTabPageSetup(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs, const char* pHelpTextResId, const char* pHeaderResId, const char* pUrlResId); + OConnectionTabPageSetup(weld::Container* pPage, weld::DialogController* pController, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs, TranslateId pHelpTextResId, TranslateId pHeaderResId, TranslateId pUrlResId); virtual ~OConnectionTabPageSetup() override; static std::unique_ptr<OGenericAdministrationPage> CreateDbaseTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet); diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index a15c011f3734..ffbde972ff08 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -324,7 +324,7 @@ using namespace ::com::sun::star; } // OMySQLJDBCConnectionPageSetup - OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, const char* pDefaultPortResId, const char* pHelpTextResId, const char* pHeaderTextResId, const char* pDriverClassId) + OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, TranslateId pDefaultPortResId, TranslateId pHelpTextResId, TranslateId pHeaderTextResId, TranslateId pDriverClassId) : OGenericAdministrationPage(pPage, pController, "dbaccess/ui/specialjdbcconnectionpage.ui", "SpecialJDBCConnectionPage", _rCoreAttrs) , m_nPortId(_nPortId) , m_xHeaderText(m_xBuilder->weld_label("header")) @@ -479,7 +479,7 @@ using namespace ::com::sun::star; { } #endif - const char *pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; + TranslateId pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error; OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); aMsg.run(); @@ -591,7 +591,7 @@ using namespace ::com::sun::star; { } #endif - const char* pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; + TranslateId pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error; OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); aMsg.run(); diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx index 64fa848c855f..8bc367602fd9 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx @@ -123,10 +123,10 @@ namespace dbaui OGeneralSpecialJDBCConnectionPageSetup(weld::Container* pPage, weld::DialogController* pController , const SfxItemSet& _rCoreAttrs , sal_uInt16 _nPortId - , const char* pDefaultPortResId - , const char* pHelpTextResId - , const char* pHeaderTextResId - , const char* pDriverClassId ); + , TranslateId pDefaultPortResId + , TranslateId pHelpTextResId + , TranslateId pHeaderTextResId + , TranslateId pDriverClassId ); virtual ~OGeneralSpecialJDBCConnectionPageSetup() override; static std::unique_ptr<OGenericAdministrationPage> CreateMySQLJDBCTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet ); static std::unique_ptr<OGenericAdministrationPage> CreateOracleJDBCTabPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& _rAttrSet ); diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index 0c79cf0c9bae..3b528ba0b070 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -80,7 +80,7 @@ void ODbAdminDialog::PageCreated(const OString& rId, SfxTabPage& _rPage) SfxTabDialogController::PageCreated(rId, _rPage); } -void ODbAdminDialog::addDetailPage(const OString& rPageId, const char* pTextId, CreateTabPage pCreateFunc) +void ODbAdminDialog::addDetailPage(const OString& rPageId, TranslateId pTextId, CreateTabPage pCreateFunc) { AddTabPage(rPageId, DBA_RES(pTextId), pCreateFunc); } diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx index d39fd3c79c29..942584a9a739 100644 --- a/dbaccess/source/ui/dlg/dbwiz.cxx +++ b/dbaccess/source/ui/dlg/dbwiz.cxx @@ -214,7 +214,7 @@ void ODbTypeWizDialog::clearPassword() std::unique_ptr<BuilderPage> ODbTypeWizDialog::createPage(WizardState _nState) { - const char* pStringId = STR_PAGETITLE_ADVANCED; + TranslateId pStringId = STR_PAGETITLE_ADVANCED; std::unique_ptr<BuilderPage> xPage; OString sIdent(OString::number(_nState)); diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx index 8b74872d904f..8a06d7de1c18 100644 --- a/dbaccess/source/ui/dlg/detailpages.cxx +++ b/dbaccess/source/ui/dlg/detailpages.cxx @@ -469,7 +469,7 @@ namespace dbaui { } #endif - const char* pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; + TranslateId pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error; OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); aMsg.run(); diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 27eb77dc78ab..e3bacdefbc73 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -181,7 +181,7 @@ namespace dbaui if ( eMessage != m_eLastMessage ) { - const char* pResId = nullptr; + TranslateId pResId; if ( smUnsupportedType == eMessage ) pResId = STR_UNSUPPORTED_DATASOURCE_TYPE; OUString sMessage; diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx index 42024d9cf078..f5610156c6a5 100644 --- a/dbaccess/source/ui/dlg/sqlmessage.cxx +++ b/dbaccess/source/ui/dlg/sqlmessage.cxx @@ -66,7 +66,7 @@ namespace private: OUString m_label; public: - explicit LabelProvider(const char* labelResourceID) + explicit LabelProvider(TranslateId labelResourceID) : m_label(DBA_RES(labelResourceID)) { } @@ -121,7 +121,7 @@ namespace std::shared_ptr< LabelProvider > const & getLabelProvider( SQLExceptionInfo::TYPE _eType, bool _bSubLabel ) const { std::shared_ptr< LabelProvider >* ppProvider( &m_pErrorLabel ); - const char* pLabelID( STR_EXCEPTION_ERROR ); + TranslateId pLabelID( STR_EXCEPTION_ERROR ); switch ( _eType ) { diff --git a/dbaccess/source/ui/inc/FieldControls.hxx b/dbaccess/source/ui/inc/FieldControls.hxx index d0fca32a61b8..7eb88ec4e077 100644 --- a/dbaccess/source/ui/inc/FieldControls.hxx +++ b/dbaccess/source/ui/inc/FieldControls.hxx @@ -19,6 +19,7 @@ #pragma once #include "SqlNameEdit.hxx" +#include <unotools/resmgr.hxx> namespace dbaui { @@ -28,7 +29,7 @@ namespace dbaui short m_nPos; OUString m_strHelpText; public: - OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry, OUString const & _rAllowedChars, const char* pHelpId, short nPosition); + OPropColumnEditCtrl(std::unique_ptr<weld::Entry> xEntry, OUString const & _rAllowedChars, TranslateId pHelpId, short nPosition); short GetPos() const { return m_nPos; } const OUString& GetHelp() const { return m_strHelpText; } @@ -41,7 +42,7 @@ namespace dbaui OUString m_strHelpText; public: - OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, const char* pHelpId, short nPosition); + OPropEditCtrl(std::unique_ptr<weld::Entry> xEntry, TranslateId pHelpId, short nPosition); void set_text(const OUString& rText) { m_xEntry->set_text(rText); } OUString get_text() const { return m_xEntry->get_text(); } @@ -61,7 +62,7 @@ namespace dbaui OUString m_strHelpText; public: - OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, const char* pHelpId, short nPosition); + OPropNumericEditCtrl(std::unique_ptr<weld::SpinButton> xSpinButton, TranslateId pHelpId, short nPosition); void set_text(const OUString& rText) { m_xSpinButton->set_text(rText); } OUString get_text() const { return m_xSpinButton->get_text(); } @@ -87,7 +88,7 @@ namespace dbaui OUString m_strHelpText; public: - OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, const char* pHelpId, short nPosition); + OPropListBoxCtrl(std::unique_ptr<weld::ComboBox> xComboBox, TranslateId pHelpId, short nPosition); virtual ~OPropListBoxCtrl() override { m_xComboBox->clear(); diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx index 8288ae3155e9..478a41070f73 100644 --- a/dbaccess/source/ui/inc/FieldDescControl.hxx +++ b/dbaccess/source/ui/inc/FieldDescControl.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> #include <com/sun/star/util/XNumberFormatter.hpp> #include "TypeInfo.hxx" +#include <unotools/resmgr.hxx> // field description columns of a table #define FIELD_NAME 1 @@ -116,7 +117,7 @@ namespace dbaui void UpdateFormatSample(OFieldDescription const * pFieldDescr); bool isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const; - std::unique_ptr<OPropNumericEditCtrl> CreateNumericControl(const OString& rId, const char* pHelpId, short _nProperty, const OString& _sHelpId); + std::unique_ptr<OPropNumericEditCtrl> CreateNumericControl(const OString& rId, TranslateId pHelpId, short _nProperty, const OString& _sHelpId); void InitializeControl(weld::Widget* _pControl,const OString& _sHelpId); void InitializeControl(OPropListBoxCtrl* _pControl,const OString& _sHelpId,bool _bAddChangeHandler); diff --git a/dbaccess/source/ui/inc/GeneralUndo.hxx b/dbaccess/source/ui/inc/GeneralUndo.hxx index e99ff2c4f330..1bbb593e333d 100644 --- a/dbaccess/source/ui/inc/GeneralUndo.hxx +++ b/dbaccess/source/ui/inc/GeneralUndo.hxx @@ -31,7 +31,7 @@ namespace dbaui OUString m_strComment; // undo, redo comment public: - OCommentUndoAction(const char* pCommentID) { m_strComment = DBA_RES(pCommentID); } + OCommentUndoAction(TranslateId pCommentID) { m_strComment = DBA_RES(pCommentID); } virtual OUString GetComment() const override { return m_strComment; } }; diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx index 71bdc92c35da..0a0918ab99b0 100644 --- a/dbaccess/source/ui/inc/UITools.hxx +++ b/dbaccess/source/ui/inc/UITools.hxx @@ -24,6 +24,7 @@ #include <editeng/svxenum.hxx> #include <vcl/taskpanelist.hxx> #include <connectivity/dbtools.hxx> +#include <unotools/resmgr.hxx> #include <memory> #include <string_view> @@ -310,7 +311,7 @@ namespace dbaui @return RET_YES, RET_NO, RET_ALL */ - sal_Int32 askForUserAction(weld::Window* pParent, const char* pTitle, const char* pText, bool bAll, std::u16string_view rName); + sal_Int32 askForUserAction(weld::Window* pParent, TranslateId pTitle, TranslateId pText, bool bAll, std::u16string_view rName); /** creates a new view from a query or table @param _sName diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx index fb948f940fb8..8caf3c129102 100644 --- a/dbaccess/source/ui/inc/dbadmin.hxx +++ b/dbaccess/source/ui/inc/dbadmin.hxx @@ -22,6 +22,7 @@ #include <sfx2/tabdlg.hxx> #include <dsntypes.hxx> #include "IItemSetHelper.hxx" +#include <unotools/resmgr.hxx> #include <memory> namespace com::sun::star { @@ -88,7 +89,7 @@ public: private: // adds a new detail page and remove all the old ones - void addDetailPage(const OString& rPageId, const char* pTextId, CreateTabPage pCreateFunc); + void addDetailPage(const OString& rPageId, TranslateId pTextId, CreateTabPage pCreateFunc); virtual void PageCreated(const OString& rId, SfxTabPage& _rPage) override; virtual short Ok() override; diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 2ef0c8d44553..5caf0fb4e32d 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1145,7 +1145,7 @@ TOTypeInfoSP queryTypeInfoByType(sal_Int32 _nDataType,const OTypeInfoMap& _rType return pTypeInfo; } -sal_Int32 askForUserAction(weld::Window* pParent, const char* pTitle, const char* pText, bool _bAll, std::u16string_view _sName) +sal_Int32 askForUserAction(weld::Window* pParent, TranslateId pTitle, TranslateId pText, bool _bAll, std::u16string_view _sName) { SolarMutexGuard aGuard; OUString aMsg = DBA_RES(pText); diff --git a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx index 601d25f9c01c..13262f570290 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx +++ b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx @@ -37,7 +37,7 @@ namespace dbaui virtual void Redo() override = 0; public: - OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, const char* pCommentID); + OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, TranslateId pCommentID); virtual ~OQueryDesignFieldUndoAct() override; void SetColumnPosition(sal_uInt16 _nColumnPosition) @@ -90,7 +90,7 @@ namespace dbaui OTableFieldDescRef pDescr; // the deleted column description public: - OTabFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, const char* pCommentID) : OQueryDesignFieldUndoAct(pSelBrwBox, pCommentID) { } + OTabFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, TranslateId pCommentID) : OQueryDesignFieldUndoAct(pSelBrwBox, pCommentID) { } void SetTabFieldDescr(OTableFieldDescRef const & pDescription) { pDescr = pDescription; } }; diff --git a/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx index d3ce81bde0c6..8a87423930a7 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx +++ b/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx @@ -32,7 +32,7 @@ namespace dbaui VclPtr<OJoinTableView> m_pOwner; // in this container it all happens public: - OQueryDesignUndoAction(OJoinTableView* pOwner, const char* pCommentID) : OCommentUndoAction(pCommentID), m_pOwner(pOwner) { } + OQueryDesignUndoAction(OJoinTableView* pOwner, TranslateId pCommentID) : OCommentUndoAction(pCommentID), m_pOwner(pOwner) { } }; } diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index cc2bcf2828d4..1d0664305452 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -2361,7 +2361,7 @@ namespace OUString getParseErrorMessage( SqlParseError _eErrorCode ) { - const char* pResId; + TranslateId pResId; switch (_eErrorCode) { case eIllegalJoin: diff --git a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx index 33cafc1509d7..e3b6cd0e94bb 100644 --- a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx +++ b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx @@ -35,7 +35,7 @@ OQueryTabConnUndoAction::~OQueryTabConnUndoAction() } } -OQueryTabConnUndoAction::OQueryTabConnUndoAction(OQueryTableView* pOwner, const char* pCommentID) +OQueryTabConnUndoAction::OQueryTabConnUndoAction(OQueryTableView* pOwner, TranslateId pCommentID) : OQueryDesignUndoAction(pOwner, pCommentID) , m_pConnection(nullptr) , m_bOwnerOfConn(false) diff --git a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx index 3ccb80bf67f1..21077074ee84 100644 --- a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx +++ b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.hxx @@ -34,7 +34,7 @@ namespace dbaui // am I the only owner of the connection? (changes with every redo and undo) public: - OQueryTabConnUndoAction(OQueryTableView* pOwner, const char* pCommentID); + OQueryTabConnUndoAction(OQueryTableView* pOwner, TranslateId pCommentID); virtual ~OQueryTabConnUndoAction() override; virtual void Undo() override = 0; diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx index 3171c8789dcb..d3bc756c07f0 100644 --- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx +++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.cxx @@ -25,7 +25,7 @@ #include <QueryTableView.hxx> using namespace dbaui; -OQueryDesignFieldUndoAct::OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, const char* pCommentID) +OQueryDesignFieldUndoAct::OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, TranslateId pCommentID) : OCommentUndoAction(pCommentID) , pOwner(pSelBrwBox) , m_nColumnPosition(BROWSER_INVALIDID) @@ -37,7 +37,7 @@ OQueryDesignFieldUndoAct::~OQueryDesignFieldUndoAct() pOwner = nullptr; } -OQueryTabWinUndoAct::OQueryTabWinUndoAct(OQueryTableView* pOwner, const char* pCommentID) +OQueryTabWinUndoAct::OQueryTabWinUndoAct(OQueryTableView* pOwner, TranslateId pCommentID) : OQueryDesignUndoAction(pOwner, pCommentID) , m_pTabWin(nullptr) , m_bOwnerOfObjects(false) diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx index 992a6ff0f2b6..9b433054288e 100644 --- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx +++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx @@ -39,7 +39,7 @@ namespace dbaui // am I the only owner of the managed objects? (changes with every redo or undo) public: - OQueryTabWinUndoAct(OQueryTableView* pOwner, const char* pCommentID); + OQueryTabWinUndoAct(OQueryTableView* pOwner, TranslateId pCommentID); virtual ~OQueryTabWinUndoAct() override; void SetOwnership(bool bTakeIt) { m_bOwnerOfObjects = bTakeIt; } diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index aa9145d5cb7a..8070df7a5f90 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -119,7 +119,7 @@ namespace dbaui namespace { - OUString lcl_getObjectResourceString(const char* pResId, sal_Int32 _nCommandType) + OUString lcl_getObjectResourceString(TranslateId pResId, sal_Int32 _nCommandType) { OUString sMessageText = DBA_RES(pResId); OUString sObjectType = DBA_RES(RSC_QUERY_OBJECT_TYPE[_nCommandType]); diff --git a/dbaccess/source/ui/querydesign/querydlg.cxx b/dbaccess/source/ui/querydesign/querydlg.cxx index 91631f9f3b93..5a21998d9946 100644 --- a/dbaccess/source/ui/querydesign/querydlg.cxx +++ b/dbaccess/source/ui/querydesign/querydlg.cxx @@ -150,7 +150,7 @@ IMPL_LINK_NOARG( DlgQryJoin, LBChangeHdl, weld::ComboBox&, void ) OUString sFirstWinName = m_pConnData->getReferencingTable()->GetWinName(); OUString sSecondWinName = m_pConnData->getReferencedTable()->GetWinName(); const EJoinType eOldJoinType = eJoinType; - const char* pResId = nullptr; + TranslateId pResId; const sal_Int32 nPos = m_xLB_JoinType->get_active(); const sal_Int32 nJoinType = m_xLB_JoinType->get_id(nPos).toInt32(); bool bAddHint = true; diff --git a/dbaccess/source/ui/tabledesign/TableUndo.cxx b/dbaccess/source/ui/tabledesign/TableUndo.cxx index 3a2ea9783879..4ef28032795e 100644 --- a/dbaccess/source/ui/tabledesign/TableUndo.cxx +++ b/dbaccess/source/ui/tabledesign/TableUndo.cxx @@ -30,7 +30,7 @@ using namespace dbaui; using namespace ::svt; -OTableDesignUndoAct::OTableDesignUndoAct(OTableRowView* pOwner, const char* pCommentID) +OTableDesignUndoAct::OTableDesignUndoAct(OTableRowView* pOwner, TranslateId pCommentID) : OCommentUndoAction(pCommentID) , m_pTabDgnCtrl(pOwner) { @@ -106,7 +106,7 @@ void OTableDesignCellUndoAct::Redo() OTableDesignUndoAct::Redo(); } -OTableEditorUndoAct::OTableEditorUndoAct(OTableEditorCtrl* pOwner, const char* pCommentID) +OTableEditorUndoAct::OTableEditorUndoAct(OTableEditorCtrl* pOwner, TranslateId pCommentID) : OTableDesignUndoAct(pOwner, pCommentID) , pTabEdCtrl(pOwner) { diff --git a/dbaccess/source/ui/tabledesign/TableUndo.hxx b/dbaccess/source/ui/tabledesign/TableUndo.hxx index 6a0eeae16529..2bd25f9d6447 100644 --- a/dbaccess/source/ui/tabledesign/TableUndo.hxx +++ b/dbaccess/source/ui/tabledesign/TableUndo.hxx @@ -39,7 +39,7 @@ namespace dbaui virtual void Undo() override; virtual void Redo() override; public: - OTableDesignUndoAct(OTableRowView* pOwner, const char* pCommentID); + OTableDesignUndoAct(OTableRowView* pOwner, TranslateId pCommentID); virtual ~OTableDesignUndoAct() override; }; @@ -50,7 +50,7 @@ namespace dbaui VclPtr<OTableEditorCtrl> pTabEdCtrl; public: - OTableEditorUndoAct(OTableEditorCtrl* pOwner, const char* pCommentID); + OTableEditorUndoAct(OTableEditorCtrl* pOwner, TranslateId pCommentID); virtual ~OTableEditorUndoAct() override; }; |