sw/inc/swtypes.hxx | 3 +++ sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 4 ++-- sw/source/core/unocore/unotbl.cxx | 3 --- sw/source/ui/vba/vbatablehelper.cxx | 1 - sw/source/writerfilter/dmapper/DomainMapperTableManager.cxx | 7 ++++--- sw/source/writerfilter/dmapper/TableManager.cxx | 7 +++++-- 6 files changed, 14 insertions(+), 11 deletions(-)
New commits: commit 00a276222a2f78d760db33f3880cd71f227823a2 Author: Michael Stahl <michael.st...@collabora.com> AuthorDate: Tue Jul 22 12:51:31 2025 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Jul 23 11:01:48 2025 +0200 sw,writerfilter: move UNO_TABLE_COLUMN_SUM to swtypes.hxx Change-Id: I0e9a5e0e7916d91d791b0b68fa0a5d27fe2a811f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188157 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx index f692dc91a0b1..86f827160e9d 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -61,6 +61,9 @@ constexpr SwTwips cMinHdFtHeight = 56; // ~1mm #define MINFLY 23 // Minimal size for FlyFrames. #define MINLAY 23 // Minimal size for other Frames. +/// hard-coded value of read-only TableColumnRelativeSum property +constexpr SwTwips UNO_TABLE_COLUMN_SUM{10000}; + // Default column distance of two text columns corresponds to 0.3 cm. constexpr SwTwips DEF_GUTTER_WIDTH = o3tl::toTwips(3, o3tl::Length::mm); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 384551f3f806..50efc407cfec 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -612,8 +612,8 @@ DECLARE_OOXMLEXPORT_TEST(testN785767, "n785767.docx") uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows(); // Check the A1 and B1 cells, the width of both of them was the default value (10000 / 9, as there were 9 cells in the row). - CPPUNIT_ASSERT_MESSAGE("A1 must not have default width", sal_Int16(10000 / 9) != getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), u"TableColumnSeparators"_ustr)[0].Position); - CPPUNIT_ASSERT_MESSAGE("B1 must not have default width", sal_Int16(10000 / 9) != getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), u"TableColumnSeparators"_ustr)[0].Position); + CPPUNIT_ASSERT_MESSAGE("A1 must not have default width", sal_Int16(UNO_TABLE_COLUMN_SUM / 9) != getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), u"TableColumnSeparators"_ustr)[0].Position); + CPPUNIT_ASSERT_MESSAGE("B1 must not have default width", sal_Int16(UNO_TABLE_COLUMN_SUM / 9) != getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), u"TableColumnSeparators"_ustr)[0].Position); } DECLARE_OOXMLEXPORT_TEST(testFineTableDash, "tableborder-finedash.docx") diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 536a492d4aec..4debb88473a2 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -173,9 +173,6 @@ namespace } } -#define UNO_TABLE_COLUMN_SUM 10000 - - static bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine) { rSvxLine.SetColor(Color(ColorTransparency, rLine.Color)); diff --git a/sw/source/ui/vba/vbatablehelper.cxx b/sw/source/ui/vba/vbatablehelper.cxx index a5908635b9f8..b7d793345662 100644 --- a/sw/source/ui/vba/vbatablehelper.cxx +++ b/sw/source/ui/vba/vbatablehelper.cxx @@ -27,7 +27,6 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; -#define UNO_TABLE_COLUMN_SUM 10000 SwVbaTableHelper::SwVbaTableHelper( uno::Reference< text::XTextTable > xTextTable ) : mxTextTable(std::move( xTextTable )) { diff --git a/sw/source/writerfilter/dmapper/DomainMapperTableManager.cxx b/sw/source/writerfilter/dmapper/DomainMapperTableManager.cxx index 312d2abf10b3..b51bbc6cdf79 100644 --- a/sw/source/writerfilter/dmapper/DomainMapperTableManager.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapperTableManager.cxx @@ -21,6 +21,7 @@ #include "ConversionHelper.hxx" #include "MeasureHandler.hxx" #include "TagLogger.hxx" +#include <swtypes.hxx> #include <com/sun/star/text/SizeType.hpp> #include <com/sun/star/text/TableColumnSeparator.hpp> #include <com/sun/star/text/WritingMode2.hpp> @@ -322,7 +323,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm) { // Contains unit and value, but unit is not interesting for // us, later we'll just distribute these values in a - // 0..10000 scale. + // 0..UNO_TABLE_COLUMN_SUM scale. writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties ) { @@ -725,7 +726,7 @@ void DomainMapperTableManager::endOfRowAction() if (nFullWidthRelative == 0) throw o3tl::divide_by_zero(); - nRelPos = (fGridWidth * 10000) / nFullWidthRelative; + nRelPos = (fGridWidth * UNO_TABLE_COLUMN_SUM) / nFullWidthRelative; } pSeparators[nBorder].Position = rtl::math::round(nRelPos + nLastRelPos); @@ -818,7 +819,7 @@ void DomainMapperTableManager::endOfRowAction() for (size_t i = 0; i < nWidthsBound; ++i) { nSum += (*pCellWidths)[i]; - pSeparators[nPos].Position = (nSum * 10000) / nFullWidthRelative; // Relative position + pSeparators[nPos].Position = (nSum * UNO_TABLE_COLUMN_SUM) / nFullWidthRelative; // Relative position pSeparators[nPos].IsVisible = true; nPos++; } diff --git a/sw/source/writerfilter/dmapper/TableManager.cxx b/sw/source/writerfilter/dmapper/TableManager.cxx index 54aa10765f59..8d3dc62b4d16 100644 --- a/sw/source/writerfilter/dmapper/TableManager.cxx +++ b/sw/source/writerfilter/dmapper/TableManager.cxx @@ -23,6 +23,9 @@ #include "DomainMapperTableHandler.hxx" #include "DomainMapper_Impl.hxx" #include "util.hxx" + +#include <swtypes.hxx> + #include <comphelper/sequence.hxx> #include <comphelper/diagnose_ex.hxx> #include <com/sun/star/text/TableColumnSeparator.hpp> @@ -446,8 +449,8 @@ void TableManager::HandleSmallerRows() static_cast<sal_Int16>(::rtl::math::round(pos)), sep.IsVisible }; }) }; - // TODO replace magic number - it->Position = ::rtl::math::round(10000 * double(nRowWidth) / nMaxRowWidth); + it->Position = ::rtl::math::round(UNO_TABLE_COLUMN_SUM * double(nRowWidth) + / nMaxRowWidth); it->IsVisible = true; pRowData->getProperties()->Insert(PROP_TABLE_COLUMN_SEPARATORS, uno::Any(newSeps));