diff --git a/cui/inc/bitmaps.hlst b/cui/inc/bitmaps.hlst index e118dc05d86a..4bfbb4faf3f8 100644 --- a/cui/inc/bitmaps.hlst +++ b/cui/inc/bitmaps.hlst @@ -90,5 +90,6 @@ inline constexpr OUString RID_SVXBMP_TOTD_IMPRESS = u"res/tipoftheday_i.png"_ust inline constexpr OUString RID_SVXBMP_TOTD_SOFFICE = u"res/tipoftheday.png"_ustr; inline constexpr OUString RID_CUIBMP_QUERY = u"res/query.png"_ustr; +inline constexpr OUString RID_CUIBMP_WARN = u"res/warn.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 index 22f94d0e1854..543da6c4b135 100644 --- a/cui/source/dialogs/querydialog.cxx +++ b/cui/source/dialogs/querydialog.cxx @@ -53,6 +53,10 @@ void QueryDialog::SetYesLabel(const OUString& rLabel) void QueryDialog::SetNoLabel(const OUString& rLabel) { m_pNoLarge->set_label(rLabel); - m_pNoLarge->set_visible(true); + m_pNoLarge->set_visible(!rLabel.isEmpty()); m_pNo->set_visible(false); -} \ No newline at end of file +} + +void QueryDialog::SetTypeWarn() { m_pImage->set_from_icon_name(RID_CUIBMP_WARN); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index a9e9136520b1..290f48598c8a 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1560,6 +1560,7 @@ public: bool DontShowAgain() const override { return m_pDlg->DontShowAgain(); } void SetYesLabel(const OUString& sLabel) override { m_pDlg->SetYesLabel(sLabel); } void SetNoLabel(const OUString& sLabel) override { m_pDlg->SetNoLabel(sLabel); } + void SetTypeWarn() override { m_pDlg->SetTypeWarn(); } }; } diff --git a/cui/source/inc/querydialog.hxx b/cui/source/inc/querydialog.hxx index 6cff7842b99f..cba7ed7e54cc 100644 --- a/cui/source/inc/querydialog.hxx +++ b/cui/source/inc/querydialog.hxx @@ -43,7 +43,8 @@ public: const OUString& sQuestion, bool bHideShowAgain = false); bool DontShowAgain() const { return m_pCheckBox->get_active(); } void SetYesLabel(const OUString& rLabel); - void SetNoLabel(const OUString& rLabel); + void SetNoLabel(const OUString& rLabel); //empty to hide the button + void SetTypeWarn(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/icon-themes/colibre/help/warning_large.png b/icon-themes/colibre/res/warn.png similarity index 100% rename from icon-themes/colibre/help/warning_large.png rename to icon-themes/colibre/res/warn.png diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index 7e52666e235e..fc072c8c8511 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -165,6 +165,7 @@ public: virtual bool DontShowAgain() const = 0; virtual void SetYesLabel(const OUString& sLabel) = 0; virtual void SetNoLabel(const OUString& sLabel) = 0; + virtual void SetTypeWarn() = 0; }; class VCL_DLLPUBLIC VclAbstractDialogFactory diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 7967955c1733..67753a417102 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -513,7 +513,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/miscdlgs/datatableview \ sc/source/ui/miscdlgs/highred \ sc/source/ui/miscdlgs/mergecellsdialog \ - sc/source/ui/miscdlgs/onlyactivesheetsaveddlg \ sc/source/ui/miscdlgs/optsolver \ sc/source/ui/miscdlgs/protectiondlg \ sc/source/ui/miscdlgs/duplicaterecordsdlg \ diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 6a3ade902228..2b508d492154 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -189,7 +189,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/multipleoperationsdialog \ sc/uiconfig/scalc/ui/navigatorpanel \ sc/uiconfig/scalc/ui/nosolutiondialog \ - sc/uiconfig/scalc/ui/onlyactivesheetsaveddialog \ sc/uiconfig/scalc/ui/optcalculatepage \ sc/uiconfig/scalc/ui/optchangespage \ sc/uiconfig/scalc/ui/optcompatibilitypage \ diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 3c1b6bc5cb0b..e0c92b8ac4d1 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -607,6 +607,11 @@ #define STR_SHEET_VIEW_DEFAULT_VIEW_NAME NC_("STR_SHEET_VIEW_DEFAULT_VIEW_NAME", "Default View") #define STR_SHEET_VIEW_TEMPORARY_NAME_TEMPLATE NC_("STR_SHEET_VIEW_TEMPORARY_NAME_TEMPLATE", "Temporary View %1") +#define STR_WARN_ONLYACTIVESHEET_TITLE NC_("STR_WARN_ONLYACTIVESHEET_TITLE", "Warning") +#define STR_WARN_ONLYACTIVESHEET_TEXT NC_("STR_WARN_ONLYACTIVESHEET_TEXT", "Only the active sheet was saved.") +#define STR_WARN_ONLYACTIVESHEET_QUEST NC_("STR_WARN_ONLYACTIVESHEET_QUEST", "Your are saving in the CSV text format, which means multiple sheets cannot be handled.") +#define STR_WARN_ONLYACTIVESHEET_BUTTON NC_("STR_WARN_ONLYACTIVESHEET_BUTTON", "Okay") + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/onlyactivesheetsaveddlg.hxx b/sc/source/ui/inc/onlyactivesheetsaveddlg.hxx deleted file mode 100644 index 8f3bc217ad4f..000000000000 --- a/sc/source/ui/inc/onlyactivesheetsaveddlg.hxx +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- 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 -#include -#include - -class ScOnlyActiveSheetSavedDlg : public weld::GenericDialogController -{ -private: - std::unique_ptr m_xWarningOnBox; - -public: - ScOnlyActiveSheetSavedDlg(weld::Window* pParent); - /** Opens dialog if IsDialogEnabled() returns true. - @descr If after executing the dialog the checkbox "Do not show again" is set, - the method DisableDialog() will be called. */ - virtual short run() override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/miscdlgs/onlyactivesheetsaveddlg.cxx b/sc/source/ui/miscdlgs/onlyactivesheetsaveddlg.cxx deleted file mode 100644 index 26bcde863f08..000000000000 --- a/sc/source/ui/miscdlgs/onlyactivesheetsaveddlg.cxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- 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 -#include -#include - -#include -#include -#include - -ScOnlyActiveSheetSavedDlg::ScOnlyActiveSheetSavedDlg(weld::Window* pParent) - : GenericDialogController(pParent, u"modules/scalc/ui/onlyactivesheetsaveddialog.ui"_ustr, - u"OnlyActiveSheetSavedDialog"_ustr) - , m_xWarningOnBox(m_xBuilder->weld_check_button("cbShow")) -{ - m_xDialog->set_default_response(RET_YES); -} - -short ScOnlyActiveSheetSavedDlg::run() -{ - short nRet = RET_YES; - ScModule* pScMod = ScModule::get(); - assert(pScMod); - if (pScMod->GetInputOptions().GetWarnActiveSheet()) - { - m_xDialog->run(); - if (!m_xWarningOnBox->get_active()) - { - ScInputOptions aInputOpt(pScMod->GetInputOptions()); - aInputOpt.SetWarnActiveSheet(false); - pScMod->SetInputOptions(aInputOpt); - } - } - return nRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabvwshh.cxx b/sc/source/ui/view/tabvwshh.cxx index 12503cb908bc..33f8eec4d761 100644 --- a/sc/source/ui/view/tabvwshh.cxx +++ b/sc/source/ui/view/tabvwshh.cxx @@ -28,16 +28,18 @@ #include #include #include +#include #include #include #include #include +#include #include +#include #include #include #include -#include #include @@ -263,8 +265,17 @@ bool ScTabViewShell::ExecuteRetypePassDlg(ScPasswordHash eDesiredHash) void ScTabViewShell::ExecuteOnlyActiveSheetSavedDlg() { - ScOnlyActiveSheetSavedDlg aDlg(GetFrameWeld()); - aDlg.run(); + VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); + auto pDlg(pFact->CreateQueryDialog( + GetFrameWeld(), ScResId(STR_WARN_ONLYACTIVESHEET_TITLE), + ScResId(STR_WARN_ONLYACTIVESHEET_TEXT), ScResId(STR_WARN_ONLYACTIVESHEET_QUEST), true)); + OUString sLabel; + sLabel.clear(); + pDlg->SetNoLabel(sLabel); //empty to hide the button + sLabel = ScResId(STR_WARN_ONLYACTIVESHEET_BUTTON); + pDlg->SetYesLabel(sLabel); + pDlg->SetTypeWarn(); + pDlg->Execute(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/uiconfig/scalc/ui/onlyactivesheetsaveddialog.ui b/sc/uiconfig/scalc/ui/onlyactivesheetsaveddialog.ui deleted file mode 100644 index 7167588ae610..000000000000 --- a/sc/uiconfig/scalc/ui/onlyactivesheetsaveddialog.ui +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - False - 12 - False - True - dialog - - - False - vertical - 2 - - - False - True - end - - - _Show this message again - True - True - False - True - True - True - - - True - True - 0 - True - - - - - _OK - True - True - True - True - True - - - False - True - 1 - - - - - False - False - 0 - - - - - - True - False - - - True - False - 12 - Warning - - - - - - - static - - - - - 1 - 0 - - - - - True - False - - - 1 - 1 - - - - - True - False - True - Only the active sheet was saved. - - - static - - - - - 1 - 2 - - - - - True - False - center - center - 12 - help/warning_large.png - - - Warning image - - - - - 0 - 0 - 3 - - - - - True - True - 1 - - - - - - btnOk - - -