tdf#168607 writerfilter: import PROP_TAB_STOP_DISTANCE as uInt16

MS Word reads a -1 value as the maximum value,
and outputs it as 65535.

The unit test has a value of 65536 (max + 1)
which MS Word treats as zero.

If we add a typical tabstop value (say 1000) to the max value,
then MS Word treats it as 1000.

This does NOT work the way that convertTwipToMm100_Limited suggests.
MS Word is NOT ignoring values over 0x8000/SAL_MAX_INT16.
It simply imports the number as a uInt16 and uses whatever that is.

make CppunitTest_sw_ooxmlexport27 \
    CPPUNIT_TEST_NAME=testTdf168607_tabstopZero

Change-Id: I837fc3f59d5f303100e97885f756aa66a6f579d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209281
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
This commit is contained in:
Justin Luth
2026-08-19 01:23:19 +02:00
parent 44c92622d2
commit 1888a96efb
3 changed files with 4 additions and 4 deletions
@@ -26,6 +26,7 @@
#include <rtl/ustring.hxx>
#include <sfx2/zoomitem.hxx>
#include <tools/UnitConversion.hxx>
#include <com/sun/star/text/ParagraphHyphenationKeepType.hpp>
#include <com/sun/star/text/XDependentTextField.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
@@ -40,7 +41,6 @@
#include <comphelper/sequence.hxx>
#include <ooxml/OOXMLPropertySet.hxx>
#include "ConversionHelper.hxx"
#include "DomainMapper.hxx"
#include "util.hxx"
#include <SwXDocumentSettings.hxx>
@@ -271,7 +271,7 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
resolveSprmProps(*this, rSprm);
break;
case NS_ooxml::LN_CT_Settings_defaultTabStop: // 92505;
m_nDefaultTabStop = nIntValue;
m_nDefaultTabStop = static_cast<sal_uInt16>(nIntValue);
break;
case NS_ooxml::LN_CT_Settings_linkStyles: // 92663;
{
@@ -480,7 +480,7 @@ void SettingsTable::lcl_entry(const writerfilter::Reference<Properties>::Pointer
//returns default TabStop in 1/100th mm
int SettingsTable::GetDefaultTabStop() const
{
return ConversionHelper::convertTwipToMm100_Limited(m_nDefaultTabStop);
return convertTwipToMm100(m_nDefaultTabStop);
}
bool SettingsTable::GetLinkStyles() const
@@ -123,7 +123,7 @@ private:
// Table
virtual void lcl_entry(const writerfilter::Reference<Properties>::Pointer_t& ref) override;
int m_nDefaultTabStop;
sal_uInt16 m_nDefaultTabStop;
bool m_bRecordChanges;
bool m_bShowInsDelChanges;