summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2021-03-23 12:18:43 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-03-26 16:56:58 +0100
commitadbfe9ee7a79eb81e4591f4b8c15d92044c7a07c (patch)
tree2cea42ffb49736a17a1b414d989c85c9d6bbd2e0
parentbf71581e49130e25a5f8961902ae38e87a8248e9 (diff)
tdf#125936 writerfilter: treat escapement in numbering like styles
deferCharacterProperties wasn't occurring in the numbering import (and so it was affecting the first run of the body text). But just like character styles, it would be better to just consider this auto-superscript instead of to defer it and calculate based on the fontsize - since that really isn't known until layout time, and so only works with direct formating. cherry-picked from 7.2's 2a7617653fb3d31e44e5cbcf8daf4b4c2a24e2c8 Change-Id: I9ce5a31c173089603316f4c3389e5f2e5dbe165a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112987 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113076
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf125936_numberingSuperscript.docxbin0 -> 25589 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport16.cxx6
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx10
-rw-r--r--writerfilter/source/dmapper/DomainMapper.hxx1
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx1
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx3
6 files changed, 19 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf125936_numberingSuperscript.docx b/sw/qa/extras/ooxmlexport/data/tdf125936_numberingSuperscript.docx
new file mode 100644
index 000000000000..eb856fb3b02e
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf125936_numberingSuperscript.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 71e313d4c545..db0d3c4141e1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -43,6 +43,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138892_noNumbering, "tdf138892_noNumbering.docx"
CPPUNIT_ASSERT_MESSAGE("Para3: <blank line>", getProperty<OUString>(getParagraph(3), "NumberingStyleName").isEmpty());
}
+DECLARE_OOXMLEXPORT_TEST(testTdf125936_numberingSuperscript, "tdf125936_numberingSuperscript.docx")
+{
+ // Without the fix, the first character run was superscripted.
+ CPPUNIT_ASSERT_EQUAL( sal_Int16(0), getProperty<sal_Int16>(getRun(getParagraph(1), 1, "A-570-108"), "CharEscapement") );
+}
+
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134619_numberingProps, "tdf134619_numberingProps.doc")
{
// Get the third paragraph's numbering style's 1st level's bullet size
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index d7f14e534d48..703f23a762fa 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1766,7 +1766,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
// The spec says 0 is the same as the lack of the value, so don't parse that.
if ( nIntValue )
{
- if ( !IsStyleSheetImport() )
+ if (!IsStyleSheetImport() && !IsNumberingImport())
m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue ));
else
{
@@ -3615,10 +3615,11 @@ void DomainMapper::lcl_table(Id name, writerfilter::Reference<Table>::Pointer_t
break;
case NS_ooxml::LN_NUMBERING:
{
-
+ m_pImpl->SetNumberingImport(true);
//the same for list tables
ref->resolve( *m_pImpl->GetListTable() );
m_pImpl->GetListTable( )->CreateNumberingRules( );
+ m_pImpl->SetNumberingImport(false);
}
break;
case NS_ooxml::LN_THEMETABLE:
@@ -3940,6 +3941,11 @@ bool DomainMapper::IsStyleSheetImport() const
return m_pImpl->IsStyleSheetImport();
}
+bool DomainMapper::IsNumberingImport() const
+{
+ return m_pImpl->IsNumberingImport();
+}
+
void DomainMapper::enableInteropGrabBag(const OUString& aName)
{
m_pImpl->m_aInteropGrabBagName = aName;
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx
index 179f06ccd77c..4f0741d2b77e 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -113,6 +113,7 @@ public:
bool IsInHeaderFooter() const;
bool IsInTable() const;
bool IsStyleSheetImport() const;
+ bool IsNumberingImport() const;
bool IsInShape() const;
void hasControls( const bool bSet ) { mbHasControls = bSet; }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index d0d5a9fa5b0d..036d4d4096a7 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -271,6 +271,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_sCurrentParaStyleName(),
m_sDefaultParaStyleName(),
m_bInStyleSheetImport( false ),
+ m_bInNumberingImport(false),
m_bInAnyTableImport( false ),
m_eInHeaderFooterImport( HeaderFooterImportState::none ),
m_bDiscardHeaderFooter( false ),
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index c423c9de5fe8..4cb460927660 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -508,6 +508,7 @@ private:
OUString m_sCurrentParaStyleName; //highly inaccurate. Overwritten by "overlapping" paragraphs like comments, flys.
OUString m_sDefaultParaStyleName; //caches the ConvertedStyleName of the default paragraph style
bool m_bInStyleSheetImport; //in import of fonts, styles, lists or lfos
+ bool m_bInNumberingImport; //in import of numbering (i.e. numbering.xml)
bool m_bInAnyTableImport; //in import of fonts, styles, lists or lfos
enum class HeaderFooterImportState
{
@@ -761,6 +762,8 @@ public:
css::uno::Any GetAnyProperty(PropertyIds eId, const PropertyMapPtr& rContext);
void SetStyleSheetImport( bool bSet ) { m_bInStyleSheetImport = bSet;}
bool IsStyleSheetImport()const { return m_bInStyleSheetImport;}
+ void SetNumberingImport( bool bSet ) { m_bInNumberingImport = bSet;}
+ bool IsNumberingImport() const { return m_bInNumberingImport;}
void SetAnyTableImport( bool bSet ) { m_bInAnyTableImport = bSet;}
bool IsAnyTableImport()const { return m_bInAnyTableImport;}
bool IsInShape()const { return m_aAnchoredStack.size() > 0;}