tdf#96854 - De-static-ize last used option for copy/move sheet
Change-Id: Iafb12b51f166f9485f1658c406a98e5db5b246ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159292
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index 489a3e8..beb0530 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -45,6 +45,8 @@ enum ScViewOption
VOPT_ANCHOR,
VOPT_PAGEBREAKS,
VOPT_SUMMARY,
// tdf#96854 - move/copy sheet dialog: last used option for action (true: copy, false: move)
VOPT_COPY_SHEET,
VOPT_THEMEDCURSOR,
};
diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx
index 80d8915..a91f0ce 100644
--- a/sc/source/core/tool/viewopti.cxx
+++ b/sc/source/core/tool/viewopti.cxx
@@ -107,6 +107,7 @@ void ScViewOptions::SetDefaults()
aOptArr[ VOPT_ANCHOR ] = true;
aOptArr[ VOPT_PAGEBREAKS ] = true;
aOptArr[ VOPT_SUMMARY ] = true;
aOptArr[ VOPT_COPY_SHEET ] = false;
aOptArr[ VOPT_THEMEDCURSOR ] = false;
aModeArr[VOBJ_TYPE_OLE ] = VOBJ_MODE_SHOW;
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index 665d3cd..c6e89ab 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -61,9 +61,6 @@ private:
bool bRenameTable:1;
bool mbEverEdited:1;
// tdf#96854 - remember last used option for copy/move sheet
static bool mbRememeberedCopy;
std::unique_ptr<weld::RadioButton> m_xBtnMove;
std::unique_ptr<weld::RadioButton> m_xBtnCopy;
std::unique_ptr<weld::Label> m_xFtDoc;
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index 12c4e4d..afacdc4 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -26,9 +26,7 @@
#include <scresid.hxx>
#include <comphelper/lok.hxx>
#include <utility>
// tdf#96854 - remember last used option for copy/move sheet
bool ScMoveTableDlg::mbRememeberedCopy = false;
#include <tabvwsh.hxx>
ScMoveTableDlg::ScMoveTableDlg(weld::Window* pParent, OUString aDefault)
: GenericDialogController(pParent, "modules/scalc/ui/movecopysheet.ui", "MoveCopySheetDialog")
@@ -193,8 +191,11 @@ void ScMoveTableDlg::Init()
m_xEdTabName->connect_changed(LINK(this, ScMoveTableDlg, CheckNameHdl));
// tdf#96854 - remember last used option for copy/move sheet
m_xBtnMove->set_active(!mbRememeberedCopy);
m_xBtnCopy->set_active(mbRememeberedCopy);
const bool bIsCopyActive
= ScTabViewShell::GetActiveViewShell()->GetViewData().GetOptions().GetOption(
VOPT_COPY_SHEET);
m_xBtnMove->set_active(!bIsCopyActive);
m_xBtnCopy->set_active(bIsCopyActive);
m_xEdTabName->set_sensitive(false);
m_xFtWarn->hide();
InitDocListBox();
@@ -250,7 +251,10 @@ void ScMoveTableDlg::SetOkBtnLabel()
// tdf#139464 Write "Copy" or "Move" on OK button
m_xBtnOk->set_label(bIsCopyActive ? m_xBtnCopy->get_label() : m_xBtnMove->get_label());
// tdf#96854 - remember last used option for copy/move sheet
mbRememeberedCopy = bIsCopyActive;
ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell();
ScViewOptions aViewOpt(pScViewShell->GetViewData().GetOptions());
aViewOpt.SetOption(VOPT_COPY_SHEET, bIsCopyActive);
pScViewShell->GetViewData().SetOptions(aViewOpt);
}
// Handler: