tdf#104081 RTF import: handle \htmautsp
It's the opposite of OOXML's <w:doNotUseHTMLParagraphAutoSpacing/>, so the default is different. Also adapt the fdo82006 bugdoc where the original bugdoc contained this flag, but the testcase did not. Change-Id: I2fd757a8f95be9b1bee63570c9f587c17d3b22bc Reviewed-on: https://gerrit.libreoffice.org/34507 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
{\rtf1
|
{\rtf1\htmautsp
|
||||||
\pard\plain
|
\pard\plain
|
||||||
\ql \sb100\sa100\sbauto1\saauto1 hello\par
|
\ql \sb100\sa100\sbauto1\saauto1 hello\par
|
||||||
}
|
}
|
||||||
|
4
sw/qa/extras/rtfexport/data/tdf104081.rtf
Normal file
4
sw/qa/extras/rtfexport/data/tdf104081.rtf
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{\rtf1
|
||||||
|
\pard\plain
|
||||||
|
\ql \sb100\sa100\sbauto1\saauto1 hello\par
|
||||||
|
}
|
@@ -892,6 +892,13 @@ DECLARE_RTFEXPORT_TEST(testFdo82006, "fdo82006.rtf")
|
|||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(280)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLARE_RTFEXPORT_TEST(testTdf104081, "tdf104081.rtf")
|
||||||
|
{
|
||||||
|
// These were 494 (280 twips), as \htmautsp was ignored.
|
||||||
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)), getProperty<sal_Int32>(getParagraph(1), "ParaTopMargin"));
|
||||||
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(100)), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
|
||||||
|
}
|
||||||
|
|
||||||
DECLARE_RTFEXPORT_TEST(testTdf88583, "tdf88583.odt")
|
DECLARE_RTFEXPORT_TEST(testTdf88583, "tdf88583.odt")
|
||||||
{
|
{
|
||||||
// This was FillStyle_NONE, as background color was missing from the color table during export.
|
// This was FillStyle_NONE, as background color was missing from the color table during export.
|
||||||
|
@@ -601,7 +601,7 @@ public:
|
|||||||
SettingsTablePtr const & GetSettingsTable()
|
SettingsTablePtr const & GetSettingsTable()
|
||||||
{
|
{
|
||||||
if( !m_pSettingsTable )
|
if( !m_pSettingsTable )
|
||||||
m_pSettingsTable.reset( new SettingsTable );
|
m_pSettingsTable.reset(new SettingsTable(m_rDMapper));
|
||||||
return m_pSettingsTable;
|
return m_pSettingsTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include <comphelper/sequence.hxx>
|
#include <comphelper/sequence.hxx>
|
||||||
#include <ooxml/resourceids.hxx>
|
#include <ooxml/resourceids.hxx>
|
||||||
#include <ConversionHelper.hxx>
|
#include <ConversionHelper.hxx>
|
||||||
|
#include <DomainMapper.hxx>
|
||||||
#include "util.hxx"
|
#include "util.hxx"
|
||||||
|
|
||||||
using namespace com::sun::star;
|
using namespace com::sun::star;
|
||||||
@@ -99,12 +100,14 @@ struct SettingsTable_Impl
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsTable::SettingsTable()
|
SettingsTable::SettingsTable(const DomainMapper& rDomainMapper)
|
||||||
: LoggedProperties("SettingsTable")
|
: LoggedProperties("SettingsTable")
|
||||||
, LoggedTable("SettingsTable")
|
, LoggedTable("SettingsTable")
|
||||||
, m_pImpl( new SettingsTable_Impl )
|
, m_pImpl( new SettingsTable_Impl )
|
||||||
{
|
{
|
||||||
|
// HTML paragraph auto-spacing is opt-in for RTF, opt-out for OOXML.
|
||||||
|
if (rDomainMapper.IsRTFImport())
|
||||||
|
m_pImpl->m_bDoNotUseHTMLParagraphAutoSpacing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsTable::~SettingsTable()
|
SettingsTable::~SettingsTable()
|
||||||
|
@@ -45,7 +45,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
|
|||||||
std::unique_ptr<SettingsTable_Impl> m_pImpl;
|
std::unique_ptr<SettingsTable_Impl> m_pImpl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SettingsTable();
|
SettingsTable(const DomainMapper& rDomainMapper);
|
||||||
virtual ~SettingsTable() override;
|
virtual ~SettingsTable() override;
|
||||||
|
|
||||||
//returns default TabStop in 1/100th mm
|
//returns default TabStop in 1/100th mm
|
||||||
|
@@ -1069,6 +1069,9 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
|
|||||||
putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue);
|
putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case RTF_HTMAUTSP:
|
||||||
|
m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Compat_doNotUseHTMLParagraphAutoSpacing, std::make_shared<RTFValue>(0));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
SAL_INFO("writerfilter", "TODO handle flag '" << keywordToString(nKeyword) << "'");
|
SAL_INFO("writerfilter", "TODO handle flag '" << keywordToString(nKeyword) << "'");
|
||||||
|
Reference in New Issue
Block a user