tdf#170842 - Check for missing table style info on plain database ranges

Change-Id: I8bed747726bd729fcef9b3845c8ba3e62f2ca2a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211786
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Tested-by: Jenkins
This commit is contained in:
Andreas Heinisch
2026-10-05 21:15:16 +02:00
parent 06b74e4af3
commit 970058a668
4 changed files with 25 additions and 8 deletions
+1
View File
@@ -32,6 +32,7 @@ public:
void testTokenIndex();
void testTotalsRow();
void testContainsHeader();
void testTdf170842_TableStylePropertiesPlainRange();
protected:
~DatabaseRange() {}
+1
View File
@@ -51,6 +51,7 @@ public:
CPPUNIT_TEST(testTokenIndex);
CPPUNIT_TEST(testTotalsRow);
CPPUNIT_TEST(testContainsHeader);
CPPUNIT_TEST(testTdf170842_TableStylePropertiesPlainRange);
// XCellRangeReferrer
CPPUNIT_TEST(testGetReferredCells);
+12 -8
View File
@@ -2129,14 +2129,18 @@ uno::Any SAL_CALL ScDatabaseRangeObj::getPropertyValue( const OUString& aPropert
{
const ScTableStyleParam* pTableStyleInfo = GetDBData_Impl()->GetTableStyleInfo();
bool bVal = false;
if (aPropertyName == SC_UNONAME_ROW_STRIPES)
bVal = pTableStyleInfo->mbRowStripes;
else if (aPropertyName == SC_UNONAME_COL_STRIPES)
bVal = pTableStyleInfo->mbColumnStripes;
else if (aPropertyName == SC_UNONAME_FIRST_COL)
bVal = pTableStyleInfo->mbFirstColumn;
else if (aPropertyName == SC_UNONAME_LAST_COL)
bVal = pTableStyleInfo->mbLastColumn;
// tdf#170842 - check for missing table style info on plain database ranges
if (pTableStyleInfo)
{
if (aPropertyName == SC_UNONAME_ROW_STRIPES)
bVal = pTableStyleInfo->mbRowStripes;
else if (aPropertyName == SC_UNONAME_COL_STRIPES)
bVal = pTableStyleInfo->mbColumnStripes;
else if (aPropertyName == SC_UNONAME_FIRST_COL)
bVal = pTableStyleInfo->mbFirstColumn;
else if (aPropertyName == SC_UNONAME_LAST_COL)
bVal = pTableStyleInfo->mbLastColumn;
}
aRet <<= bVal;
}
+11
View File
@@ -214,6 +214,17 @@ void DatabaseRange::testContainsHeader()
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bContainsHeader);
CPPUNIT_ASSERT_MESSAGE("Value of ContainsHeader wasn't changed", !bContainsHeader);
}
void DatabaseRange::testTdf170842_TableStylePropertiesPlainRange()
{
uno::Reference<beans::XPropertySet> xDatabaseRange(init(u"DataArea"_ustr), UNO_QUERY_THROW);
// Without the fix in place, this test would have crashed here
xDatabaseRange->getPropertyValue(u"UseRowStripes"_ustr);
xDatabaseRange->getPropertyValue(u"UseColStripes"_ustr);
xDatabaseRange->getPropertyValue(u"UseFirstColumnFormatting"_ustr);
xDatabaseRange->getPropertyValue(u"UseLastColumnFormatting"_ustr);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */