[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa writerfilter/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 25 09:04:35 UTC 2021


 sw/qa/extras/ooxmlexport/data/tdf125936_numberingSuperscript.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx                        |    6 ++++++
 writerfilter/source/dmapper/DomainMapper.cxx                      |   10 ++++++++--
 writerfilter/source/dmapper/DomainMapper.hxx                      |    1 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx                 |    1 +
 writerfilter/source/dmapper/DomainMapper_Impl.hxx                 |    3 +++
 6 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 9436ab24a7d08540a7c192df86956d53673c9a08
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Tue Mar 23 12:18:43 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Mar 25 10:04:01 2021 +0100

    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.
    
    Change-Id: I9ce5a31c173089603316f4c3389e5f2e5dbe165a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112987
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

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
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf125936_numberingSuperscript.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index a397bb073ecf..2a1784d32ac1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -50,6 +50,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf140668, "tdf140668.docx")
     CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+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 f229b200d1ef..4a1481f3ea44 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1802,7 +1802,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 if (!m_pImpl->IsDocDefaultsImport())
             {
@@ -3666,10 +3666,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:
@@ -4001,6 +4002,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 46bbd2b39018..4e47dd70a441 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -114,6 +114,7 @@ public:
     bool IsInTable() const;
     void SetDocDefaultsImport(bool bSet);
     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 ee7cf88dfbc8..7cda0e0df1dc 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -299,6 +299,7 @@ DomainMapper_Impl::DomainMapper_Impl(
         m_sDefaultParaStyleName(),
         m_bInDocDefaultsImport(false),
         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 cd318ab054fa..6dbf46952d6a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -510,6 +510,7 @@ private:
     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_bInNumberingImport; //in import of numbering (i.e. numbering.xml)
     bool                            m_bInAnyTableImport; //in import of fonts, styles, lists or lfos
     enum class HeaderFooterImportState
     {
@@ -770,6 +771,8 @@ public:
     bool        IsDocDefaultsImport()const { return m_bInDocDefaultsImport;}
     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;}


More information about the Libreoffice-commits mailing list