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.kaganski@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 00a276222a2f78d760db33f3880cd71f227823a2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188217
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Michael Stahl
2025-07-23 17:19:24 +02:00
parent b2dcf38fdb
commit bee609cf3d
6 changed files with 14 additions and 11 deletions
+3
View File
@@ -59,6 +59,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);
+2 -2
View File
@@ -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")
-3
View File
@@ -174,9 +174,6 @@ namespace
}
}
#define UNO_TABLE_COLUMN_SUM 10000
static bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine)
{
rSvxLine.SetColor(Color(ColorTransparency, rLine.Color));
-1
View File
@@ -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 ))
{
@@ -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++;
}
@@ -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));