Kaydet (Commit) 91b18cee authored tarafından Miklos Vajna's avatar Miklos Vajna

Related: tdf#65642 RTF filter: import \pgnlcrm

This as a side effect also implements support for DOCX <w:pgNumType
w:fmt="lowerRoman" .../>.

Change-Id: Ifb524b25236a8bc774690266a4fa205154204109
Reviewed-on: https://gerrit.libreoffice.org/24273Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 13758a3d
{\rtf1
\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0
{\field\fldedit
{\*\fldinst
{ PAGE \\* MERGEFORMAT }
}
{\fldrslt
{1}
}
}
\sect
\sectd\pgnrestart\pgnlcrm
{\field\fldedit
{\*\fldinst
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid525329 PAGE \\* MERGEFORMAT }
}
{\fldrslt
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid9597790 i}
}
}
{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid13321744
\par }
}
......@@ -1019,6 +1019,12 @@ DECLARE_RTFEXPORT_TEST(testPgnucrm, "pgnucrm.rtf")
CPPUNIT_ASSERT_EQUAL(style::NumberingType::ROMAN_UPPER, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType"));
}
DECLARE_RTFEXPORT_TEST(testPgnlcrm, "pgnlcrm.rtf")
{
// The second page's numbering type: this was style::NumberingType::ARABIC.
CPPUNIT_ASSERT_EQUAL(style::NumberingType::ROMAN_LOWER, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType"));
}
DECLARE_RTFEXPORT_TEST(testTdf98806, "tdf98806.rtf")
{
uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
......
......@@ -1001,6 +1001,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
// I, II, ...
pSectionContext->SetPageNumberType(style::NumberingType::ROMAN_UPPER);
break;
case NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman:
// i, ii, ...
pSectionContext->SetPageNumberType(style::NumberingType::ROMAN_LOWER);
break;
}
}
break;
......
......@@ -3278,7 +3278,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
}
break;
case RTF_PGNDEC:
case RTF_PGNLCRM:
case RTF_PGNBIDIA:
case RTF_PGNBIDIB:
// These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment.
......@@ -3614,6 +3613,12 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue);
}
break;
case RTF_PGNLCRM:
{
auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman);
lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue);
}
break;
default:
{
SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment