[Libreoffice-commits] core.git: sw/qa writerfilter/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 11 08:13:50 UTC 2020
sw/qa/extras/rtfexport/rtfexport4.cxx | 3 +++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
New commits:
commit 46187510e383d62ee7bae8f8332322d7c3b0c61e
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Wed Sep 9 18:40:20 2020 +0300
Commit: Justin Luth <justin_luth at sil.org>
CommitDate: Fri Sep 11 10:13:12 2020 +0200
tdf#136587 rtf writerfilter: don't deduplicate yourself
The default style was not being imported because it
was based on itself, and therefore deduplicated itself away,
or something like that.
Probably this is the only scenario that truly would
end up deduplicating itself, but I made it generic
just in case. Why not?
Change-Id: I621092bf2e067933b5d23d27689a5d3a7f8cf2bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102328
Tested-by: Jenkins
Tested-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Reviewed-by: Justin Luth <justin_luth at sil.org>
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx
index 3ae227ab819a..dbf8cf016ff9 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -338,6 +338,9 @@ DECLARE_RTFEXPORT_TEST(testTdf136587_noStyleName, "tdf136587_noStyleName.rtf")
uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER),
getProperty<sal_Int16>(xStyleProps, "ParaAdjust"));
+
+ xStyleProps.set(paragraphStyles->getByName("Default Paragraph Style"), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(32.0f, getProperty<float>(xStyleProps, "CharHeight"));
}
CPPUNIT_TEST_FIXTURE(Test, testPageBorder)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index cf757dd58737..7edeccdcb4e7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2093,6 +2093,7 @@ RTFReferenceTable::Entries_t RTFDocumentImpl::deduplicateStyleTable()
for (auto const& it : m_aStyleTableEntries)
{
auto pStyle = it.second;
+ ret[it.first] = pStyle;
// ugly downcasts here, but can't easily replace the members with
// RTFReferenceProperties because dmapper wants SvRef<Properties> anyway
RTFValue::Pointer_t const pBasedOn(
@@ -2101,6 +2102,10 @@ RTFReferenceTable::Entries_t RTFDocumentImpl::deduplicateStyleTable()
if (pBasedOn)
{
int const nBasedOn(pBasedOn->getInt());
+ // don't deduplicate yourself - especially a potential problem for the default style.
+ if (it.first == nBasedOn)
+ continue;
+
auto const itParent(m_aStyleTableEntries.find(nBasedOn)); // definition as read!
if (itParent != m_aStyleTableEntries.end())
{
@@ -2120,14 +2125,13 @@ RTFReferenceTable::Entries_t RTFDocumentImpl::deduplicateStyleTable()
static_cast<RTFReferenceProperties&>(*itParent->second).getAttributes(),
nStyleType));
- pStyle = new RTFReferenceProperties(attributes, sprms);
+ ret[it.first] = new RTFReferenceProperties(attributes, sprms);
}
else
{
SAL_WARN("writerfilter.rtf", "parent style not found: " << nBasedOn);
}
}
- ret[it.first] = pStyle;
}
assert(ret.size() == m_aStyleTableEntries.size());
return ret;
More information about the Libreoffice-commits
mailing list