summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorHeiko Tietze <tietze.heiko@gmail.com>2025-01-21 13:11:58 +0100
committerHeiko Tietze <heiko.tietze@documentfoundation.org>2025-01-22 11:40:06 +0100
commit35487636dad444773f543db52db32abd4e490aa7 (patch)
tree5296a6990ede0fa3ac403d918b32299508f70072 /sw
parent1103b0bd28bb244386106c1561a8bc6022b4096c (diff)
More flexible query dialog
Modifies and reverts a52bc9b5d6f86b6919931db21d83834d6c14e955 and 8b84691d5e2c02429c53fe9a8dc2f20e39a9d35c Prerequiste for tdf#164586 Change-Id: If35a94ce25c634a6d583aeb8188d2f9ed75bc0fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180547 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/bitmaps.hlst2
-rw-r--r--sw/inc/strings.hrc4
-rw-r--r--sw/source/uibase/wrtsh/select.cxx54
3 files changed, 21 insertions, 39 deletions
diff --git a/sw/inc/bitmaps.hlst b/sw/inc/bitmaps.hlst
index 465e1c8bbb9f..11b0dab2d566 100644
--- a/sw/inc/bitmaps.hlst
+++ b/sw/inc/bitmaps.hlst
@@ -115,8 +115,6 @@ inline constexpr OUString RID_BMP_PREVIEW_FALLBACK = u"sw/res/image-example.png"
inline constexpr OUString RID_BMP_A11Y_CHECK_ISSUES_NOT_FOUND = u"svx/res/a11y_check_issues_not_found.png"_ustr;
inline constexpr OUString RID_BMP_A11Y_CHECK_ISSUES_FOUND = u"svx/res/a11y_check_issues_found.png"_ustr;
-inline constexpr OUString RID_BMP_QUERYINSMODE = u"res/queryinsmode.png"_ustr;
-
inline constexpr OUString RID_SVXBMP_LOCKED = u"res/locked.png"_ustr;
inline constexpr OUString RID_SVXBMP_UNLOCKED = u"res/unlocked.png"_ustr;
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index a6ce4cad0a5a..633efd926094 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1548,6 +1548,10 @@
#define STR_UNDO_MAKE_FOOTNOTES_ENDNOTES NC_("STR_UNDO_MAKE_FOOTNOTES_ENDNOTES", "Make all footnotes endnotes")
#define STR_UNDO_MAKE_ENDNOTES_FOOTNOTES NC_("STR_UNDO_MAKE_ENDNOTES_FOOTNOTES", "Make all endnotes footnotes")
+// To translators: title, text, question for confirmation whether to switch overwrite mode on
+#define STR_QUERY_INSMODE_TITLE NC_("STR_QUERY_INSMODE_TITLE", "You are switching to the overwrite mode")
+#define STR_QUERY_INSMODE_TEXT NC_("STR_QUERY_INSMODE_TEXT", "The overwrite mode allows to type over text. It is indicated by a block cursor and at the statusbar. Press Insert again to switch back.")
+#define STR_QUERY_INSMODE_QUESTION NC_("STR_QUERY_INSMODE_QUESTION", "Do you want to continue?")
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index fc502783003b..701cb23d487a 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -41,11 +41,8 @@
#include <vcl/uitest/logger.hxx>
#include <vcl/uitest/eventdescription.hxx>
-#include <vcl/weld.hxx>
-#include <vcl/builder.hxx>
#include <officecfg/Office/Common.hxx>
-#include <unotools/configmgr.hxx>
-#include <bitmaps.hlst>
+#include <strings.hrc>
#include <svx/svdview.hxx>
@@ -724,44 +721,27 @@ void SwWrtShell::ImplSetInsMode(bool bOn)
Invalidate();
}
-namespace
-{
- class QuerySetInsModeDialog : public weld::GenericDialogController
- {
- std::unique_ptr<weld::Image> m_xImage;
- std::unique_ptr<weld::CheckButton> m_xCheckBox;
- public:
- QuerySetInsModeDialog(weld::Window* pParent)
- : GenericDialogController(pParent, u"cui/ui/querysetinsmodedialog.ui"_ustr, u"SetInsModeDialog"_ustr)
- , m_xImage(m_xBuilder->weld_image(u"imSetInsMode"_ustr))
- , m_xCheckBox(m_xBuilder->weld_check_button(u"cbDontShowAgain"_ustr))
- {
- m_xImage->set_from_icon_name(RID_BMP_QUERYINSMODE);
- }
- bool GetDoNotShowAgain() const
- {
- return m_xCheckBox->get_active();
- }
- };
-}
-
void SwWrtShell::SetInsMode( bool bOn )
{
const bool bDoAsk = officecfg::Office::Common::Misc::QuerySetInsMode::get();
if (!bOn && bDoAsk)
{
- auto xDialog = std::make_shared<QuerySetInsModeDialog>(GetView().GetFrameWeld());
- weld::DialogController::runAsync(xDialog, [this, bOn, xDialog](sal_Int32 nResult){
-
- std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
- comphelper::ConfigurationChanges::create());
- officecfg::Office::Common::Misc::QuerySetInsMode::set(!xDialog->GetDoNotShowAgain(), xChanges);
- xChanges->commit();
-
- if ( nResult == static_cast<int>(RET_NO) )
- return;
-
- ImplSetInsMode(bOn);
+ VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create();
+ auto pDlg = pFact->CreateQueryDialog(
+ GetView().GetFrameWeld(), SwResId(STR_QUERY_INSMODE_TITLE),
+ SwResId(STR_QUERY_INSMODE_TEXT), SwResId(STR_QUERY_INSMODE_QUESTION), true);
+ pDlg->StartExecuteAsync( [this, pDlg] (sal_Int32 nResult)->void
+ {
+ if (pDlg->ShowAgain() == false)
+ {
+ std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Misc::QuerySetInsMode::set(false, xChanges);
+ xChanges->commit();
+ }
+ if (nResult == RET_YES)
+ ImplSetInsMode(false);
+ pDlg->disposeOnce();
});
return;
}