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 testTokenIndex();
void testTotalsRow(); void testTotalsRow();
void testContainsHeader(); void testContainsHeader();
void testTdf170842_TableStylePropertiesPlainRange();
protected: protected:
~DatabaseRange() {} ~DatabaseRange() {}
+1
View File
@@ -51,6 +51,7 @@ public:
CPPUNIT_TEST(testTokenIndex); CPPUNIT_TEST(testTokenIndex);
CPPUNIT_TEST(testTotalsRow); CPPUNIT_TEST(testTotalsRow);
CPPUNIT_TEST(testContainsHeader); CPPUNIT_TEST(testContainsHeader);
CPPUNIT_TEST(testTdf170842_TableStylePropertiesPlainRange);
// XCellRangeReferrer // XCellRangeReferrer
CPPUNIT_TEST(testGetReferredCells); 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(); const ScTableStyleParam* pTableStyleInfo = GetDBData_Impl()->GetTableStyleInfo();
bool bVal = false; bool bVal = false;
if (aPropertyName == SC_UNONAME_ROW_STRIPES) // tdf#170842 - check for missing table style info on plain database ranges
bVal = pTableStyleInfo->mbRowStripes; if (pTableStyleInfo)
else if (aPropertyName == SC_UNONAME_COL_STRIPES) {
bVal = pTableStyleInfo->mbColumnStripes; if (aPropertyName == SC_UNONAME_ROW_STRIPES)
else if (aPropertyName == SC_UNONAME_FIRST_COL) bVal = pTableStyleInfo->mbRowStripes;
bVal = pTableStyleInfo->mbFirstColumn; else if (aPropertyName == SC_UNONAME_COL_STRIPES)
else if (aPropertyName == SC_UNONAME_LAST_COL) bVal = pTableStyleInfo->mbColumnStripes;
bVal = pTableStyleInfo->mbLastColumn; else if (aPropertyName == SC_UNONAME_FIRST_COL)
bVal = pTableStyleInfo->mbFirstColumn;
else if (aPropertyName == SC_UNONAME_LAST_COL)
bVal = pTableStyleInfo->mbLastColumn;
}
aRet <<= bVal; aRet <<= bVal;
} }
+11
View File
@@ -214,6 +214,17 @@ void DatabaseRange::testContainsHeader()
CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bContainsHeader); CPPUNIT_ASSERT(xDatabaseRange->getPropertyValue(propName) >>= bContainsHeader);
CPPUNIT_ASSERT_MESSAGE("Value of ContainsHeader wasn't changed", !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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */