[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Apr 28 07:45:37 UTC 2016
sw/qa/extras/rtfexport/data/pgndec.rtf | 23 +++++++++++++++++++++++
sw/qa/extras/rtfexport/rtfexport.cxx | 6 ++++++
writerfilter/source/dmapper/DomainMapper.cxx | 4 ++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 7 ++++++-
4 files changed, 39 insertions(+), 1 deletion(-)
New commits:
commit b94d753ac9e3894da055d31bbb7bb20e11b97b5a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Apr 23 20:34:57 2016 +0200
Related: tdf#65642 RTF filter: import \pgndec
This as a side effect also implements support for DOCX <w:pgNumType
w:fmt="decimal" .../>.
Change-Id: I747c3f610dc13f614b6f962c2a498c987765ebb6
Reviewed-on: https://gerrit.libreoffice.org/24457
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/qa/extras/rtfexport/data/pgndec.rtf b/sw/qa/extras/rtfexport/data/pgndec.rtf
new file mode 100644
index 0000000..7f38c69
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/pgndec.rtf
@@ -0,0 +1,23 @@
+{\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\pgndec
+{\field\fldedit
+{\*\fldinst
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid525329 PAGE \\* MERGEFORMAT }
+}
+{\fldrslt
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid9597790 1}
+}
+}
+{\rtlch\fcs1 \af31507 \ltrch\fcs0 \insrsid13321744
+\par }
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index c08a47a..37a7018 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1025,6 +1025,12 @@ DECLARE_RTFEXPORT_TEST(testPgnlcrm, "pgnlcrm.rtf")
CPPUNIT_ASSERT_EQUAL(style::NumberingType::ROMAN_LOWER, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType"));
}
+DECLARE_RTFEXPORT_TEST(testPgndec, "pgndec.rtf")
+{
+ // The second page's numbering type: this was style::NumberingType::ROMAN_LOWER.
+ CPPUNIT_ASSERT_EQUAL(style::NumberingType::ARABIC, getProperty<sal_Int16>(getStyles("PageStyles")->getByName("Converted1"), "NumberingType"));
+}
+
DECLARE_RTFEXPORT_TEST(testTdf98806, "tdf98806.rtf")
{
uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 6a9cc8f..acc320a 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -989,6 +989,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
{
switch (nIntValue)
{
+ case NS_ooxml::LN_Value_ST_NumberFormat_decimal:
+ // 1, 2, ...
+ pSectionContext->SetPageNumberType(style::NumberingType::ARABIC);
+ break;
case NS_ooxml::LN_Value_ST_NumberFormat_upperLetter:
// A, B, ...
pSectionContext->SetPageNumberType(style::NumberingType::CHARS_UPPER_LETTER_N);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 459f0a1..9559e8d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3281,7 +3281,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_formProt, pValue);
}
break;
- case RTF_PGNDEC:
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.
@@ -3623,6 +3622,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_PGNDEC:
+ {
+ auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_decimal);
+ 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) << "'");
More information about the Libreoffice-commits
mailing list