[Libreoffice-commits] core.git: sw/qa writerfilter/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Thu Feb 25 09:57:47 UTC 2021
sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 4 ++++
writerfilter/source/dmapper/DomainMapper.cxx | 9 ++++++++-
writerfilter/source/dmapper/DomainMapper.hxx | 1 +
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 1 +
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 3 +++
writerfilter/source/dmapper/StyleSheetTable.cxx | 10 ++++++++++
6 files changed, 27 insertions(+), 1 deletion(-)
New commits:
commit 861ca1f5030f2f6b7fbdc3bb3ded3d11130673ed
Author: Justin Luth <justin_luth at sil.org>
AuthorDate: Wed Feb 24 10:07:08 2021 +0200
Commit: Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Thu Feb 25 10:57:04 2021 +0100
tdf#140572 writerfilter: ignore position in docDefaults
Despite the documentation saying that anything in docDefaults
should apply everywhere unless it is overridden in a higher
priority style, the subscript/superscript setting in
docDefaults seems to be ignored. Makes sense in a way,
but perhaps document those exceptions?
I looked for documentation in both "docDefaults" and "position"
and didn't see anything suggesting why it is ignored.
Change-Id: If676415b112921e4cb8f7306b8c8ad93a6fd8cde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111442
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 6da14ef1a005..046721c53f59 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -18,6 +18,7 @@
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
#include <com/sun/star/text/XTextTable.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <editeng/escapementitem.hxx>
constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/ooxmlexport/data/";
@@ -111,6 +112,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFooterMarginLost, "footer-margin-lost.do
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf140572_docDefault_superscript, "tdf140572_docDefault_superscript.docx")
{
// A round-trip was crashing.
+
+ // Without the fix, everything was DFLT_ESC_AUTO_SUPER (default superscript)
+ CPPUNIT_ASSERT_EQUAL( sal_Int16(0), getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharEscapement") );
}
DECLARE_OOXMLEXPORT_TEST(testTdf138953, "croppedAndRotated.odt")
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index a3b04a014ca8..964abf0e58fd 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1811,8 +1811,10 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
{
if ( !IsStyleSheetImport() )
m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue ));
- else
+ else if (!m_pImpl->IsDocDefaultsImport())
{
+ // For some undocumented reason, MS Word seems to ignore this in docDefaults
+
// DON'T FIXME: Truly calculating this for Character Styles will be tricky,
// because it depends on the final fontsize - regardless of
// where it is set. So at the style level,
@@ -4023,6 +4025,11 @@ OUString DomainMapper::GetListStyleName(sal_Int32 nListId) const
return m_pImpl->GetListStyleName( nListId );
}
+void DomainMapper::SetDocDefaultsImport(bool bSet)
+{
+ m_pImpl->SetDocDefaultsImport(bSet);
+}
+
bool DomainMapper::IsStyleSheetImport() const
{
return m_pImpl->IsStyleSheetImport();
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx
index d2e08a0041aa..46bbd2b39018 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -112,6 +112,7 @@ public:
bool IsInHeaderFooter() const;
bool IsInTable() const;
+ void SetDocDefaultsImport(bool bSet);
bool IsStyleSheetImport() const;
bool IsInShape() const;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index d0ddb431c4d7..8ace7179ad18 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -299,6 +299,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_pLastCharacterContext(),
m_sCurrentParaStyleName(),
m_sDefaultParaStyleName(),
+ m_bInDocDefaultsImport(false),
m_bInStyleSheetImport( false ),
m_bInAnyTableImport( false ),
m_eInHeaderFooterImport( HeaderFooterImportState::none ),
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 1a6d27381db0..581d2dba6692 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -519,6 +519,7 @@ private:
::std::vector<DeletableTabStop> m_aCurrentTabStops;
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_bInDocDefaultsImport;
bool m_bInStyleSheetImport; //in import of fonts, styles, lists or lfos
bool m_bInAnyTableImport; //in import of fonts, styles, lists or lfos
enum class HeaderFooterImportState
@@ -780,6 +781,8 @@ public:
css::uno::Any GetPropertyFromCharStyleSheet(PropertyIds eId, const PropertyMapPtr& rContext);
// get property first from the given context, or secondly via inheritance from styles/docDefaults
css::uno::Any GetAnyProperty(PropertyIds eId, const PropertyMapPtr& rContext);
+ void SetDocDefaultsImport( bool bSet ) { m_bInDocDefaultsImport = bSet;}
+ bool IsDocDefaultsImport()const { return m_bInDocDefaultsImport;}
void SetStyleSheetImport( bool bSet ) { m_bInStyleSheetImport = bSet;}
bool IsStyleSheetImport()const { return m_bInStyleSheetImport;}
void SetAnyTableImport( bool bSet ) { m_bInAnyTableImport = bSet;}
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 731facdaff84..083288bc16b6 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -689,6 +689,9 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm)
}
case NS_ooxml::LN_CT_PPrDefault_pPr:
case NS_ooxml::LN_CT_DocDefaults_pPrDefault:
+ if (nSprmId == NS_ooxml::LN_CT_DocDefaults_pPrDefault)
+ m_pImpl->m_rDMapper.SetDocDefaultsImport(true);
+
m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pDefaultParaProps );
resolveSprmProps( m_pImpl->m_rDMapper, rSprm );
if ( nSprmId == NS_ooxml::LN_CT_DocDefaults_pPrDefault && m_pImpl->m_pDefaultParaProps &&
@@ -699,13 +702,20 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm)
m_pImpl->m_rDMapper.PopStyleSheetProperties();
applyDefaults( true );
m_pImpl->m_bHasImportedDefaultParaProps = true;
+ if (nSprmId == NS_ooxml::LN_CT_DocDefaults_pPrDefault)
+ m_pImpl->m_rDMapper.SetDocDefaultsImport(false);
break;
case NS_ooxml::LN_CT_RPrDefault_rPr:
case NS_ooxml::LN_CT_DocDefaults_rPrDefault:
+ if (nSprmId == NS_ooxml::LN_CT_DocDefaults_rPrDefault)
+ m_pImpl->m_rDMapper.SetDocDefaultsImport(true);
+
m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pDefaultCharProps );
resolveSprmProps( m_pImpl->m_rDMapper, rSprm );
m_pImpl->m_rDMapper.PopStyleSheetProperties();
applyDefaults( false );
+ if (nSprmId == NS_ooxml::LN_CT_DocDefaults_rPrDefault)
+ m_pImpl->m_rDMapper.SetDocDefaultsImport(false);
break;
case NS_ooxml::LN_CT_TblPrBase_jc: //table alignment - row properties!
m_pImpl->m_pCurrentEntry->pProperties->Insert( PROP_HORI_ORIENT,
More information about the Libreoffice-commits
mailing list