summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/tiledrendering/data/split-panes.odsbin0 -> 8685 bytes
-rw-r--r--sc/qa/unit/tiledrendering/data/split-panes.xlsxbin0 -> 8224 bytes
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering2.cxx36
-rw-r--r--sc/source/ui/view/viewdata.cxx26
4 files changed, 54 insertions, 8 deletions
diff --git a/sc/qa/unit/tiledrendering/data/split-panes.ods b/sc/qa/unit/tiledrendering/data/split-panes.ods
new file mode 100644
index 000000000000..f34df2ebd901
--- /dev/null
+++ b/sc/qa/unit/tiledrendering/data/split-panes.ods
Binary files differ
diff --git a/sc/qa/unit/tiledrendering/data/split-panes.xlsx b/sc/qa/unit/tiledrendering/data/split-panes.xlsx
new file mode 100644
index 000000000000..5687f7c0872f
--- /dev/null
+++ b/sc/qa/unit/tiledrendering/data/split-panes.xlsx
Binary files differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering2.cxx b/sc/qa/unit/tiledrendering/tiledrendering2.cxx
index 41fdcb17b936..ff6ed1881542 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering2.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering2.cxx
@@ -165,6 +165,42 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testCool11739LocaleDialogFieldUnit)
CPPUNIT_ASSERT_EQUAL(FieldUnit::CM, eMetric);
}
+CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSplitPanes)
+{
+ createDoc("split-panes.ods");
+
+ save(u"calc8"_ustr);
+
+ xmlDocUniquePtr pSettings = parseExport(u"settings.xml"_ustr);
+ CPPUNIT_ASSERT(pSettings);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 0
+ // - Actual : 2
+ assertXPathContent(pSettings,
+ "/office:document-settings/office:settings/config:config-item-set[1]/"
+ "config:config-item-map-indexed/config:config-item-map-entry/"
+ "config:config-item-map-named/config:config-item-map-entry/"
+ "config:config-item[@config:name='VerticalSplitMode']",
+ u"0");
+}
+
+CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSplitPanesXLSX)
+{
+ createDoc("split-panes.xlsx");
+
+ save(u"Calc Office Open XML"_ustr);
+
+ xmlDocUniquePtr pSheet = parseExport(u"xl/worksheets/sheet1.xml"_ustr);
+ CPPUNIT_ASSERT(pSheet);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: topRight
+ // - Actual : bottomRight
+ // which also results in invalid XLSX
+ assertXPath(pSheet, "/x:worksheet/x:sheetViews/x:sheetView/x:pane", "activePane", u"topRight");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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)
{