diff options
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 26 |
2 files changed, 19 insertions, 9 deletions
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 91a1143f2695..2c73556bac87 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -386,7 +386,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - VclPtr<AbstractScInsertCellDlg> pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), bTheFlag)); + VclPtr<AbstractScInsertCellDlg> pDlg(pFact->CreateScInsertCellDlg(pTabViewShell->GetFrameWeld(), GetViewData(), bTheFlag)); pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){ if (nResult == RET_OK) { diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 68c4a9b736d6..380b9d0b0cc0 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -4384,16 +4384,27 @@ void ScViewData::OverrideWithLOKFreeze(ScSplitMode& eExHSplitMode, ScSplitMode& SCCOL& nExFixPosX, SCROW& nExFixPosY, tools::Long& nExHSplitPos, tools::Long& nExVSplitPos, SCTAB nForTab) const { - SCCOL nFreezeCol = mrDoc.GetLOKFreezeCol(nForTab); - SCROW nFreezeRow = mrDoc.GetLOKFreezeRow(nForTab); + // split mode to potentially use based on original: if it was split, use split mode to preserve that, otherwise use freeze + // whether there is actual split/freeze will depend on GetLOKFreezeCol/Row + const ScSplitMode aExSplitMode = (eExHSplitMode == SC_SPLIT_NORMAL || eExVSplitMode == SC_SPLIT_NORMAL) ? SC_SPLIT_NORMAL : SC_SPLIT_FIX; + + // initialize split modes and positions in case no split/freeze is set + eExHSplitMode = SC_SPLIT_NONE; + eExVSplitMode = SC_SPLIT_NONE; + nExFixPosX = 0; + nExFixPosY = 0; + nExHSplitPos = 0; + nExVSplitPos = 0; bool bConvertToScrPosX = false; bool bConvertToScrPosY = false; - if (nFreezeCol >= 0) + SCCOL nFreezeCol = mrDoc.GetLOKFreezeCol(nForTab); + SCROW nFreezeRow = mrDoc.GetLOKFreezeRow(nForTab); + + if (nFreezeCol > 0) { - if (eExHSplitMode == SC_SPLIT_NONE) - eExHSplitMode = SC_SPLIT_FIX; + eExHSplitMode = aExSplitMode; if (eExHSplitMode == SC_SPLIT_FIX) { @@ -4404,10 +4415,9 @@ void ScViewData::OverrideWithLOKFreeze(ScSplitMode& eExHSplitMode, ScSplitMode& bConvertToScrPosX = true; } - if (nFreezeRow >= 0) + if (nFreezeRow > 0) { - if (eExVSplitMode == SC_SPLIT_NONE) - eExVSplitMode = SC_SPLIT_FIX; + eExVSplitMode = aExSplitMode; if (eExVSplitMode == SC_SPLIT_FIX) { |