summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorbruh <randomforest33@gmail.com>2025-01-20 19:56:25 +0530
committerMike Kaganski <mike.kaganski@collabora.com>2025-01-24 19:18:02 +0100
commita88b3da5b01403ba593423821843a0dacda158ec (patch)
tree3e07e98c8312f50628d148dd1a8be604b46cca04 /cui
parent577c47a279b4307a563f8387a16b354a470e6830 (diff)
tdf#158280 Replace usage of InputDialog with SvxNameDialog
Change-Id: Ic70a88f391f1aca9dd7d8429cb1af9678654820e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180514 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/MacroManagerDialog.cxx33
1 files changed, 20 insertions, 13 deletions
diff --git a/cui/source/dialogs/MacroManagerDialog.cxx b/cui/source/dialogs/MacroManagerDialog.cxx
index ebc07902dcb3..11240cc3c4dc 100644
--- a/cui/source/dialogs/MacroManagerDialog.cxx
+++ b/cui/source/dialogs/MacroManagerDialog.cxx
@@ -41,6 +41,7 @@
#include <unotools/viewoptions.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/weldutils.hxx>
+#include <dlgname.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
@@ -1228,22 +1229,28 @@ void MacroManagerDialog::BasicScriptsCreateLibrary(const basctl::ScriptDocument&
aLibName = CuiResId(STR_LIBRARY) + OUString::number(++i))
;
- InputDialog aInputDlg(m_xDialog.get(), CuiResId(STR_INPUTDIALOG_NEWLIBRARYLABEL));
- aInputDlg.set_title(CuiResId(STR_INPUTDIALOG_NEWLIBRARYTITLE));
- aInputDlg.SetEntryText(aLibName);
- aInputDlg.HideHelpBtn();
- aInputDlg.setCheckEntry([&](OUString sNewName) {
- if (sNewName.isEmpty() || rDocument.hasLibrary(basctl::E_SCRIPTS, sNewName)
- || rDocument.hasLibrary(basctl::E_DIALOGS, sNewName) || sNewName.getLength() > 30
- || !basctl::IsValidSbxName(sNewName))
- return false;
- return true;
- });
+ OUString aDesc = CuiResId(STR_INPUTDIALOG_NEWLIBRARYLABEL);
- if (!aInputDlg.run())
+ SvxNameDialog aNameDialog(m_xDialog.get(), aLibName, aDesc,
+ CuiResId(STR_INPUTDIALOG_NEWLIBRARYTITLE));
+
+ aNameDialog.SetCheckNameHdl(Link<SvxNameDialog&, bool>(
+ static_cast<void*>(const_cast<basctl::ScriptDocument*>(&rDocument)),
+ [](void* param, SvxNameDialog& dialog) -> bool {
+ const basctl::ScriptDocument& rDoc = *static_cast<const basctl::ScriptDocument*>(param);
+ OUString sNewName = dialog.GetName();
+ if (sNewName.isEmpty() || rDoc.hasLibrary(basctl::E_SCRIPTS, sNewName)
+ || rDoc.hasLibrary(basctl::E_DIALOGS, sNewName) || sNewName.getLength() > 30
+ || !basctl::IsValidSbxName(sNewName))
+ return false;
+ return true;
+ }));
+ ;
+
+ if (aNameDialog.run() != RET_OK)
return;
- aLibName = aInputDlg.GetEntryText();
+ aLibName = aNameDialog.GetName();
try
{