summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/Library_cui.mk1
-rw-r--r--cui/UIConfig_cui.mk2
-rw-r--r--cui/inc/bitmaps.hlst2
-rw-r--r--cui/source/dialogs/querydialog.cxx39
-rw-r--r--cui/source/factory/dlgfact.cxx22
-rw-r--r--cui/source/factory/dlgfact.hxx5
-rw-r--r--cui/source/inc/querydialog.hxx38
-rw-r--r--cui/uiconfig/ui/querydialog.ui (renamed from cui/uiconfig/ui/querysetinsmodedialog.ui)64
-rw-r--r--icon-themes/colibre/res/query.png (renamed from icon-themes/colibre/res/queryinsmode.png)bin3560 -> 3560 bytes
-rw-r--r--include/vcl/abstdlg.hxx13
-rw-r--r--solenv/sanitizers/ui/cui.false1
-rw-r--r--sw/inc/bitmaps.hlst2
-rw-r--r--sw/inc/strings.hrc4
-rw-r--r--sw/source/uibase/wrtsh/select.cxx54
-rw-r--r--vcl/qt5/QtInstanceBuilder.cxx2
15 files changed, 182 insertions, 67 deletions
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 71a53ef3928d..383574c2e481 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -144,6 +144,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/dialogs/screenshotannotationdlg \
cui/source/dialogs/pastedlg \
cui/source/dialogs/postdlg \
+ cui/source/dialogs/querydialog \
cui/source/dialogs/QrCodeGenDialog \
cui/source/dialogs/GraphicTestsDialog \
cui/source/dialogs/ImageViewerDialog \
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index b78aa328667f..e17527985f13 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -187,12 +187,12 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/querydeletehatchdialog \
cui/uiconfig/ui/querydeletelineenddialog \
cui/uiconfig/ui/querydeletelinestyledialog \
+ cui/uiconfig/ui/querydialog \
cui/uiconfig/ui/queryduplicatedialog \
cui/uiconfig/ui/querynoloadedfiledialog \
cui/uiconfig/ui/querynosavefiledialog \
cui/uiconfig/ui/querysavelistdialog \
cui/uiconfig/ui/queryupdategalleryfilelistdialog \
- cui/uiconfig/ui/querysetinsmodedialog \
cui/uiconfig/ui/recordnumberdialog \
cui/uiconfig/ui/rotationtabpage \
cui/uiconfig/ui/scriptorganizer \
diff --git a/cui/inc/bitmaps.hlst b/cui/inc/bitmaps.hlst
index d064f7aee321..e118dc05d86a 100644
--- a/cui/inc/bitmaps.hlst
+++ b/cui/inc/bitmaps.hlst
@@ -89,4 +89,6 @@ inline constexpr OUString RID_SVXBMP_TOTD_DRAW = u"res/tipoftheday_d.png"_ustr;
inline constexpr OUString RID_SVXBMP_TOTD_IMPRESS = u"res/tipoftheday_i.png"_ustr;
inline constexpr OUString RID_SVXBMP_TOTD_SOFFICE = u"res/tipoftheday.png"_ustr;
+inline constexpr OUString RID_CUIBMP_QUERY = u"res/query.png"_ustr;
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/dialogs/querydialog.cxx b/cui/source/dialogs/querydialog.cxx
new file mode 100644
index 000000000000..ee7dc109707b
--- /dev/null
+++ b/cui/source/dialogs/querydialog.cxx
@@ -0,0 +1,39 @@
+/* -*- 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 <querydialog.hxx>
+#include <bitmaps.hlst>
+
+QueryDialog::QueryDialog(weld::Window* pParent, const OUString& sTitle, const OUString& sText,
+ const OUString& sQuestion, bool bShowAgain)
+ : GenericDialogController(pParent, u"cui/ui/querydialog.ui"_ustr, u"QueryDialog"_ustr)
+ , m_pTitle(m_xBuilder->weld_label(u"lbTitle"_ustr))
+ , m_pText(m_xBuilder->weld_label(u"lbText"_ustr))
+ , m_pQuestion(m_xBuilder->weld_label(u"lbQuestion"_ustr))
+ , m_pImage(m_xBuilder->weld_image(u"imQuery"_ustr))
+ , m_pCheckBox(m_xBuilder->weld_check_button(u"cbDontShowAgain"_ustr))
+{
+ m_pTitle->set_label(sTitle);
+ m_pText->set_label(sText);
+ m_pQuestion->set_label(sQuestion);
+ m_pImage->set_from_icon_name(RID_CUIBMP_QUERY);
+
+ if (!bShowAgain)
+ m_pCheckBox->hide();
+}
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 91cae1fd5eea..f9927251748e 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -98,6 +98,7 @@
#include <DiagramDialog.hxx>
#include <fileextcheckdlg.hxx>
#include <TextColumnsPage.hxx>
+#include <querydialog.hxx>
#include <MacroManagerDialog.hxx>
@@ -1607,4 +1608,25 @@ AbstractDialogFactory_Impl::CreateFileExtCheckDialog(weld::Window* pParent, cons
}
#endif
+namespace
+{
+class AbstractQueryDialog_Impl final
+ : public vcl::AbstractDialogImpl_Async<AbstractQueryDialog,
+ QueryDialog>
+{
+public:
+ using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
+ bool ShowAgain() const override { return m_pDlg->ShowAgain(); }
+};
+}
+
+VclPtr<AbstractQueryDialog>
+AbstractDialogFactory_Impl::CreateQueryDialog(
+ weld::Window* pParent,
+ const OUString& sTitle, const OUString& sText, const OUString& sQuestion,
+ bool bShowAgain)
+{
+ return VclPtr<AbstractQueryDialog_Impl>::Create(pParent, sTitle, sText, sQuestion, bShowAgain);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index caea8f6ee3ad..333b9f7fe230 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -223,6 +223,11 @@ public:
weld::Window* pParent,
SdrObjGroup& rDiagram) override;
+ virtual VclPtr<AbstractQueryDialog> CreateQueryDialog(
+ weld::Window* pParent,
+ const OUString& sTitle, const OUString& sText, const OUString& sQuestion,
+ bool bShowAgain) override;
+
#ifdef _WIN32
virtual VclPtr<VclAbstractDialog> CreateFileExtCheckDialog(weld::Window* pParent,
const OUString& sTitle,
diff --git a/cui/source/inc/querydialog.hxx b/cui/source/inc/querydialog.hxx
new file mode 100644
index 000000000000..0db70d8f6146
--- /dev/null
+++ b/cui/source/inc/querydialog.hxx
@@ -0,0 +1,38 @@
+/* -*- 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 .
+ */
+#pragma once
+
+#include <vcl/weld.hxx>
+
+class QueryDialog final : public weld::GenericDialogController
+{
+private:
+ std::unique_ptr<weld::Label> m_pTitle;
+ std::unique_ptr<weld::Label> m_pText;
+ std::unique_ptr<weld::Label> m_pQuestion;
+ std::unique_ptr<weld::Image> m_pImage;
+ std::unique_ptr<weld::CheckButton> m_pCheckBox;
+
+public:
+ QueryDialog(weld::Window* pParent, const OUString& sTitle, const OUString& sText,
+ const OUString& sQuestion, bool bShowAgain = true);
+ bool ShowAgain() const { return m_pCheckBox->get_active(); }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/uiconfig/ui/querysetinsmodedialog.ui b/cui/uiconfig/ui/querydialog.ui
index 89b62be01eb2..4c40e9b53990 100644
--- a/cui/uiconfig/ui/querysetinsmodedialog.ui
+++ b/cui/uiconfig/ui/querydialog.ui
@@ -2,9 +2,8 @@
<!-- Generated with glade 3.40.0 -->
<interface domain="cui">
<requires lib="gtk+" version="3.20"/>
- <object class="GtkDialog" id="SetInsModeDialog">
+ <object class="GtkDialog" id="QueryDialog">
<property name="can-focus">False</property>
- <property name="title" translatable="yes" context="SetInsModeDialog|Dialog_Title">Confirm overwrite mode</property>
<property name="resizable">False</property>
<property name="type-hint">dialog</property>
<child internal-child="vbox">
@@ -23,7 +22,7 @@
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="btnNo">
- <property name="label" translatable="yes" context="SetInsModeDialog|Button_No">No</property>
+ <property name="label" translatable="yes" context="QueryDialog|Button_No">No</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
@@ -36,7 +35,7 @@
</child>
<child>
<object class="GtkButton" id="btnYes">
- <property name="label" translatable="yes" context="SetInsModeDialog|Button_Yes">Yes</property>
+ <property name="label" translatable="yes" context="QueryDialog|Button_Yes">Yes</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
@@ -66,13 +65,16 @@
<object class="GtkLabel" id="lbTitle">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="hexpand">False</property>
- <property name="label" translatable="yes" context="SetInsModeDialog|Label_Title">You are switching to the overwrite mode</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1"/>
</attributes>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="lbTitle-atkobject">
+ <property name="AtkObject::accessible-role">static</property>
+ </object>
+ </child>
</object>
<packing>
<property name="left-attach">1</property>
@@ -84,11 +86,15 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">False</property>
- <property name="label" translatable="yes" context="SetInsModeDialog|Label_Info">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.</property>
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
<property name="max-width-chars">40</property>
<property name="xalign">0</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="lbText-atkobject">
+ <property name="AtkObject::accessible-role">static</property>
+ </object>
+ </child>
</object>
<packing>
<property name="left-attach">1</property>
@@ -100,9 +106,13 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="valign">start</property>
- <property name="label" translatable="yes" context="SetInsModeDialog|Label_Question">Do you want to continue?</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="lbQuestion-atkobject">
+ <property name="AtkObject::accessible-role">static</property>
+ </object>
+ </child>
</object>
<packing>
<property name="left-attach">1</property>
@@ -110,23 +120,13 @@
</packing>
</child>
<child>
- <object class="GtkImage" id="imSetInsMode">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
- </object>
- <packing>
- <property name="left-attach">0</property>
- <property name="top-attach">1</property>
- <property name="height">2</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="cbDontShowAgain">
- <property name="label" translatable="yes" context="SetInsModeDialog|Checkbox">Do not show again</property>
+ <property name="label" translatable="yes" context="QueryDialog|Checkbox">Do show again</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
- <property name="hexpand">True</property>
+ <property name="halign">start</property>
+ <property name="active">True</property>
<property name="draw-indicator">True</property>
</object>
<packing>
@@ -135,10 +135,24 @@
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
+ <object class="GtkImage" id="imQuery">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="pixel-size">150</property>
+ <property name="icon_size">0</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="imQuery-atkobject">
+ <property name="AtkObject::accessible-role">dialog</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ <property name="height">4</property>
+ </packing>
</child>
</object>
<packing>
diff --git a/icon-themes/colibre/res/queryinsmode.png b/icon-themes/colibre/res/query.png
index 029c7570a7bf..029c7570a7bf 100644
--- a/icon-themes/colibre/res/queryinsmode.png
+++ b/icon-themes/colibre/res/query.png
Binary files differ
diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx
index 1a6a83fc77ef..659babc6aab6 100644
--- a/include/vcl/abstdlg.hxx
+++ b/include/vcl/abstdlg.hxx
@@ -157,6 +157,14 @@ protected:
virtual ~AbstractDiagramDialog() override = default;
};
+class VCL_DLLPUBLIC AbstractQueryDialog : public VclAbstractDialog
+{
+protected:
+ virtual ~AbstractQueryDialog() override = default;
+public:
+ virtual bool ShowAgain() const = 0;
+};
+
class VCL_DLLPUBLIC VclAbstractDialogFactory
{
public:
@@ -200,6 +208,11 @@ public:
weld::Window* pParent,
SdrObjGroup& rDiagram) = 0;
+ virtual VclPtr<AbstractQueryDialog> CreateQueryDialog(
+ weld::Window* pParent,
+ const OUString& sTitle, const OUString& sText, const OUString& sQuestion,
+ bool bShowAgain) = 0;
+
#ifdef _WIN32
virtual VclPtr<VclAbstractDialog>
CreateFileExtCheckDialog(weld::Window* _pParent, const OUString& sTitle, const OUString& sMsg)
diff --git a/solenv/sanitizers/ui/cui.false b/solenv/sanitizers/ui/cui.false
index f779cafe8ce0..fcd145e35547 100644
--- a/solenv/sanitizers/ui/cui.false
+++ b/solenv/sanitizers/ui/cui.false
@@ -2,4 +2,3 @@ cui/uiconfig/ui/aboutdialog.ui://GtkImage[@id='imAbout'] no-labelled-by
cui/uiconfig/ui/aboutdialog.ui://GtkImage[@id='imBrand'] no-labelled-by
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='lbAbout'] orphan-label
cui/uiconfig/ui/aboutdialog.ui://GtkLabel[@id='lbCopyright'] orphan-label
-cui/uiconfig/ui/querysetinsmodedialog.ui://GtkImage[@id='imSetInsMode'] no-labelled-by
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;
}
diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index 2977131d827f..6b0322b9ed70 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -67,7 +67,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile)
u"cui/ui/password.ui"_ustr,
u"cui/ui/pastespecial.ui"_ustr,
u"cui/ui/qrcodegen.ui"_ustr,
- u"cui/ui/querysetinsmodedialog.ui"_ustr,
+ u"cui/ui/querydialog.ui"_ustr,
u"cui/ui/securityoptionsdialog.ui"_ustr,
u"cui/ui/splitcellsdialog.ui"_ustr,
u"cui/ui/tipofthedaydialog.ui"_ustr,