[Libreoffice-commits] core.git: oox/source sc/qa

yogesh.bharate001 yogesh.bharate at synerzip.com
Thu Apr 30 05:23:08 PDT 2015


 oox/source/export/drawingml.cxx                    |   12 ++++++++++
 sc/qa/unit/data/xlsx/textbox-CharKerningSpace.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx              |   23 +++++++++++++++++++++
 3 files changed, 35 insertions(+)

New commits:
commit b29483560306e6a6fec8dfe2c8622060b0ef2cd1
Author: yogesh.bharate001 <yogesh.bharate at synerzip.com>
Date:   Thu Apr 30 16:17:31 2015 +0530

    tdf#90955: CharKerning i.e spc is not exported after RT.
    
    Problem Description:
    - CharKerning i.e spacing between characters/letter is not exported
    after roundtrip.
    
    XML Difference:
    Original:
    <a:rPr lang="en-IN" sz="6000" b="1" kern="0" spc="2000" baseline="0">
    
    After Roundtrip:
    <a:rPr b="1" lang="en-IN" sz="6000" strike="noStrike">
    
    spc is missing after RT.
    
    Change-Id: I8bcefd6f0d0e3a1825618bece6f563792633a272
    Solution: added support for spc.
    Reviewed-on: https://gerrit.libreoffice.org/15575
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7862bf8..484c90b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1183,10 +1183,21 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
     const char* cap = NULL;
     sal_Int32 nSize = 1800;
     sal_Int32 nCharEscapement = 0;
+    sal_Int32 nCharKerning = 0;
 
     if( GETA( CharHeight ) )
         nSize = (sal_Int32) (100*(*static_cast<float const *>(mAny.getValue())));
 
+     if( GETA( CharKerning ) )
+        nCharKerning = (sal_Int32)(*static_cast<short const *>(mAny.getValue()));
+    /**  While setting values in propertymap,
+    *    CharKerning converted using GetTextSpacingPoint
+    *    i.e set @ http://opengrok.libreoffice.org/xref/core/oox/source/drawingml/textcharacterproperties.cxx#129
+    *    therefore to get original value CharKerning need to be convert.
+    *    http://opengrok.libreoffice.org/xref/core/oox/source/drawingml/drawingmltypes.cxx#95
+    **/
+    nCharKerning = ((nCharKerning * 720)-360) / 254;
+
     if ( ( bComplex && GETA( CharWeightComplex ) ) || GETA( CharWeight ) )
     {
         if ( *static_cast<float const *>(mAny.getValue()) >= awt::FontWeight::SEMIBOLD )
@@ -1324,6 +1335,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
                           XML_i, italic,
                           XML_lang, usLanguage.isEmpty() ? NULL : USS( usLanguage ),
                           XML_sz, IS( nSize ),
+                          XML_spc, nCharKerning > 0 ? IS(nCharKerning) : NULL,
                           XML_strike, strikeout,
                           XML_u, underline,
                           XML_baseline, nCharEscapement == 0 ? NULL : IS( nCharEscapement*1000 ),
diff --git a/sc/qa/unit/data/xlsx/textbox-CharKerningSpace.xlsx b/sc/qa/unit/data/xlsx/textbox-CharKerningSpace.xlsx
new file mode 100644
index 0000000..64b6856
Binary files /dev/null and b/sc/qa/unit/data/xlsx/textbox-CharKerningSpace.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index cd3e07b..4494755 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -139,6 +139,7 @@ public:
     void testSheetLocalRangeNameXLS();
     void testSheetTextBoxHyperlink();
     void testFontSize();
+    void testSheetCharacterKerningSpace();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -188,6 +189,7 @@ public:
     CPPUNIT_TEST(testSheetLocalRangeNameXLS);
     CPPUNIT_TEST(testSheetTextBoxHyperlink);
     CPPUNIT_TEST(testFontSize);
+    CPPUNIT_TEST(testSheetCharacterKerningSpace);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2551,6 +2553,27 @@ void ScExportTest::testFontSize()
     CPPUNIT_ASSERT_EQUAL(OUString("1800"), fontSize);
 }
 
+void ScExportTest::testSheetCharacterKerningSpace()
+{
+    ScDocShellRef xShell = loadDoc("textbox-CharKerningSpace.", XLSX);
+    CPPUNIT_ASSERT(xShell.Is());
+
+    ScDocShellRef xDocSh = saveAndReload(&(*xShell), XLSX);
+    CPPUNIT_ASSERT(xDocSh.Is());
+
+    xmlDocPtr pDoc = XPathHelper::parseExport(&(*xDocSh), m_xSFactory, "xl/drawings/drawing1.xml", XLSX);
+    CPPUNIT_ASSERT(pDoc);
+
+    OUString CharKerningSpace = getXPath(pDoc,
+        "/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody[1]/a:p[1]/a:r[1]/a:rPr[1]","spc");
+
+    // make sure that the CharKerning is 1997.
+    CPPUNIT_ASSERT_EQUAL(OUString("1997"), CharKerningSpace);
+
+    xDocSh->DoClose();
+}
+
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list