summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/qa/data/hidden-row.odsbin0 -> 7684 bytes
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx35
-rw-r--r--sc/source/ui/view/tabview.cxx3
3 files changed, 37 insertions, 1 deletions
diff --git a/desktop/qa/data/hidden-row.ods b/desktop/qa/data/hidden-row.ods
new file mode 100644
index 000000000000..25fe89865d9e
--- /dev/null
+++ b/desktop/qa/data/hidden-row.ods
Binary files differ
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index a562ab2f8b21..51b927223081 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -80,6 +80,7 @@ public:
void testPasteWriter();
void testPasteWriterJPEG();
void testRowColumnHeaders();
+ void testHiddenRowHeaders();
void testCellCursor();
void testCommandResult();
void testWriterComments();
@@ -101,6 +102,7 @@ public:
CPPUNIT_TEST(testPasteWriter);
CPPUNIT_TEST(testPasteWriterJPEG);
CPPUNIT_TEST(testRowColumnHeaders);
+ CPPUNIT_TEST(testHiddenRowHeaders);
CPPUNIT_TEST(testCellCursor);
CPPUNIT_TEST(testCommandResult);
CPPUNIT_TEST(testWriterComments);
@@ -548,6 +550,39 @@ void DesktopLOKTest::testRowColumnHeaders()
}
}
+void DesktopLOKTest::testHiddenRowHeaders()
+{
+ LibLODocument_Impl* pDocument = loadDoc("hidden-row.ods");
+
+ pDocument->pClass->initializeForRendering(pDocument, nullptr);
+
+ boost::property_tree::ptree aTree;
+ char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders");
+ std::stringstream aStream(pJSON);
+ free(pJSON);
+ CPPUNIT_ASSERT(!aStream.str().empty());
+
+ boost::property_tree::read_json(aStream, aTree);
+ sal_Int32 nPrevious = 0;
+ bool bFirst = true;
+ for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows"))
+ {
+ sal_Int32 nSize = OString(rValue.second.get<std::string>("size").c_str()).toInt32();
+ CPPUNIT_ASSERT(nSize > 0);
+
+ if (bFirst)
+ bFirst = false;
+ else
+ {
+ // nSize was 509, nPrevious was 254, i.e. hidden row wasn't reported as 0 height.
+ CPPUNIT_ASSERT_EQUAL(nPrevious, nSize);
+ break;
+ }
+
+ nPrevious = nSize;
+ }
+}
+
void DesktopLOKTest::testCellCursor()
{
LibLODocument_Impl* pDocument = loadDoc("search.ods");
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 791851622e22..9f5d69928057 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2326,7 +2326,8 @@ OUString ScTabView::getRowColumnHeaders(const Rectangle& rRectangle)
long nTotalPixels = 0;
for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
{
- sal_uInt16 nSize = pDoc->GetOriginalHeight(nRow, aViewData.GetTabNo());
+ // nSize will be 0 for hidden rows.
+ sal_uInt16 nSize = pDoc->GetRowHeight(nRow, aViewData.GetTabNo());
long nSizePixels = ScViewData::ToPixel(nSize, aViewData.GetPPTY());
OUString aText = pRowBar[SC_SPLIT_BOTTOM]->GetEntryText(nRow);