sc/qa/unit/subsequent_export-test.cxx |    3 ++-
 sc/source/filter/excel/xestring.cxx   |    3 +--
 sc/source/filter/excel/xetable.cxx    |   17 +++++++++++------
 3 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit 14279955b467241a70b61f993c334757c2b4a756
Author: Katarina Behrens <[email protected]>
Date:   Thu Nov 5 17:57:07 2015 +0100

    tdf#92296: Fix off-by-one formatting of text runs on OOXML export
    
    This essentially reverts commit 8865ed2efecd03722d10e522265f31c99b13b2bb
    and implements a different fix for tdf#90812:
    If the formatting of entire cell is uniform, remove formatting of the
    leading text run and create corresponding cell style. In all other cases,
    write out formattings for each individual run.
    
    Change-Id: I7724b7a474f773f2cdc39e9150d843642fb05bbe
    Reviewed-on: https://gerrit.libreoffice.org/19811
    Reviewed-by: Eike Rathke <[email protected]>
    Tested-by: Eike Rathke <[email protected]>
    
    Related tdf#92296, tdf#90812: Make this test more strict
    
    i.e. not only make sure that rPr is there, but also test the text
    chunk has the right font colour ( it went off-by-one in regression
    caused by the fix of tdf#90812 )
    
    Change-Id: I3788a845393686ed621743e117b7eb439e38e0b3
    Reviewed-on: https://gerrit.libreoffice.org/22420
    Tested-by: Jenkins <[email protected]>
    Reviewed-by: David Tardon <[email protected]>

diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index b1db159..eb0865e 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -2640,7 +2640,8 @@ void ScExportTest::testSheetRunParagraphProperty()
     xmlDocPtr pDoc = XPathHelper::parseExport(&(*xDocSh), m_xSFactory, 
"xl/sharedStrings.xml", XLSX);
     CPPUNIT_ASSERT(pDoc);
 
-    assertXPath(pDoc, "/x:sst/x:si/x:r[1]/x:rPr[1]", 1);
+    OUString aColor = getXPath(pDoc, "/x:sst/x:si/x:r[1]/x:rPr[1]/x:color", 
"rgb");
+    CPPUNIT_ASSERT_EQUAL(OUString("FFFF0000"), aColor);
 
     xDocSh->DoClose();
 }
diff --git a/sc/source/filter/excel/xestring.cxx 
b/sc/source/filter/excel/xestring.cxx
index 0e1a127..2e716b0 100644
--- a/sc/source/filter/excel/xestring.cxx
+++ b/sc/source/filter/excel/xestring.cxx
@@ -427,10 +427,9 @@ void XclExpString::WriteXml( XclExpXmlStream& rStrm ) const
         const XclExpFont* pFont = NULL;
         for ( ; aIt != aEnd; ++aIt )
         {
-            // pFont getting first then pass it to run otherwise pFont is NULL.
-            pFont = rFonts.GetFont( aIt->mnFontIdx );
             nStart = lcl_WriteRun( rStrm, GetUnicodeBuffer(),
                     nStart, aIt->mnChar-nStart, pFont );
+            pFont = rFonts.GetFont( aIt->mnFontIdx );
         }
         lcl_WriteRun( rStrm, GetUnicodeBuffer(),
                 nStart, GetUnicodeBuffer().size() - nStart, pFont );
diff --git a/sc/source/filter/excel/xetable.cxx 
b/sc/source/filter/excel/xetable.cxx
index 8422ef6..21f0aa9 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -723,13 +723,18 @@ void XclExpLabelCell::Init( const XclExpRoot& rRoot,
     mxText = xText;
     mnSstIndex = 0;
 
-    // create the cell format
-    sal_uInt16 nXclFont = mxText->RemoveLeadingFont();
-    if( GetXFId() == EXC_XFID_NOTFOUND )
+    const XclFormatRunVec& rFormats = mxText->GetFormats();
+    // Create the cell format and remove formatting of the leading run
+    // if the entire string is equally formatted
+    if( rFormats.size() == 1 )
     {
-        OSL_ENSURE( nXclFont != EXC_FONT_NOTFOUND, "XclExpLabelCell::Init - 
leading font not found" );
-        bool bForceLineBreak = mxText->IsWrapped();
-        SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, 
ApiScriptType::WEAK, nXclFont, bForceLineBreak ) );
+        sal_uInt16 nXclFont = mxText->RemoveLeadingFont();
+        if( GetXFId() == EXC_XFID_NOTFOUND )
+        {
+            OSL_ENSURE( nXclFont != EXC_FONT_NOTFOUND, "XclExpLabelCell::Init 
- leading font not found" );
+            bool bForceLineBreak = mxText->IsWrapped();
+            SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, 
ApiScriptType::WEAK, nXclFont, bForceLineBreak ) );
+        }
     }
 
     // get auto-wrap attribute from cell format
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to