sw/qa/extras/ooxmlexport/data/tdf99602_subscript_charStyleSize.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx                          |    9 
+++++++++
 writerfilter/source/dmapper/DomainMapper.cxx                        |    3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 2c2bc4f58233e88d59577a6fb49661955a7b50e2
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Thu Oct 3 12:37:20 2019 +0300
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Oct 7 09:36:54 2019 +0200

    related tdf#99602 writerfilter: deferredCharProps unhandled in Styles
    
    ...so don't add deferred properties during style import.
    Otherwise, the first paragraph picks up those attributes and
    applies them.
    
    Regression from 2012 - only affects subscript/superscript.
    
    Truly fixing 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, the deferred
    property needs to be percentized based on SOMETHING, and then
    at appendText time the fontsize needs to be determined.
    If escapement is inherited from a style, then the escapement needs
    to be converted BACK into pointsize (based on style charsize),
    and then the final percentage can be calculated and
    directly applied. Yuck. I'm inclined to treat charstyle
    escapement like pre-2012, which just assigned default
    values and ignored the actual/given amount.
    
    Change-Id: I8e3783533ec18740e1c7d0b36c58b6c7e8ce107f
    Reviewed-on: https://gerrit.libreoffice.org/80178
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    (cherry picked from commit 8eb0d8daa526d1c53363954d4d8730cad55f1910)
    Reviewed-on: https://gerrit.libreoffice.org/80202
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf99602_subscript_charStyleSize.docx 
b/sw/qa/extras/ooxmlexport/data/tdf99602_subscript_charStyleSize.docx
new file mode 100644
index 000000000000..6283b8de73ac
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf99602_subscript_charStyleSize.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index f81a52e852c8..9a5c10f01748 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -101,6 +101,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127316_autoEscapement, 
"tdf127316_autoEscapement
     CPPUNIT_ASSERT_DOUBLES_EQUAL(33.f, getProperty<float>(getRun(xPara, 2), 
"CharEscapement"), 20);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf99602_subscript_charStyleSize, 
"tdf99602_subscript_charStyleSize.docx")
+{
+    uno::Reference<text::XTextRange> xPara = getParagraph(1);
+    // The word "Base" should not be subscripted.
+    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.f, getProperty<float>(getRun(xPara, 1), 
"CharEscapement"), 0);
+    // The word "Subscript" should be 48pt, subscripted by 25% (12pt).
+    //CPPUNIT_ASSERT_DOUBLES_EQUAL( 25.f, getProperty<float>(getRun(xPara, 2), 
"CharEscapement"), 1);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf124637_sectionMargin, 
"tdf124637_sectionMargin.docx")
 {
     uno::Reference<text::XTextSectionsSupplier> 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index ffcc6f4d7064..22625bcfac17 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1702,7 +1702,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
         break;
     case NS_ooxml::LN_EG_RPrBase_position:
         // The spec says 0 is the same as the lack of the value, so don't 
parse that.
-        if (nIntValue)
+        // FIXME: StyleSheets don't currently process 
deferredCharacterProperties - so position is lost in charStyles
+        if ( nIntValue && !IsStyleSheetImport() )
             m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue 
));
         break;
     case NS_ooxml::LN_EG_RPrBase_spacing:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to