[Libreoffice-commits] core.git: sw/qa writerfilter/source

PriyankaGaikwad priyanka.gaikwad at synerzip.com
Mon Jul 21 08:32:54 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo80902.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |   10 ++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx |   16 +++++++++++++++-
 writerfilter/source/dmapper/PropertyMap.cxx  |    4 ++++
 4 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 8e71604ebde7092dc026521fc5a414686777cb38
Author: PriyankaGaikwad <priyanka.gaikwad at synerzip.com>
Date:   Fri Jul 11 12:00:30 2014 +0530

    fdo#80902: Document grid type is not rendered properly
    
    XML difference :
    In document.xml
    Original :
      <w:docGrid w:type="lines" w:linePitch="360"/>
    Roundtrip :
      <w:docGrid w:type="default" w:linePitch="360" w:charSpace="0"/>
    
    Document grid type is not set properly while import.
    
    Change-Id: I68ec778c3138b37ad96f69942361a73ed0e85d71

diff --git a/sw/qa/extras/ooxmlexport/data/fdo80902.docx b/sw/qa/extras/ooxmlexport/data/fdo80902.docx
new file mode 100644
index 0000000..73a927f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo80902.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index f22b96c..eac281a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3420,6 +3420,16 @@ DECLARE_OOXMLEXPORT_TEST(testFdo80997, "fdo80997.docx")
     uno::Reference< text::XTextRange > xText = getRun( xParagraph, 1, " text");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFdo80902, "fdo80902.docx")
+{
+    // The problem was that the docGrid type was set as default so fix it for other grid type
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+       return;
+
+    assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:docGrid", "type", "lines");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 27bda6e..23ffe2a 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -896,7 +896,21 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
         {
             if (pSectionContext != NULL)
             {
-                pSectionContext->SetGridType(nIntValue);
+                switch( nIntValue )
+                {
+                    case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_default:
+                    case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_snapToChars:
+                        pSectionContext->SetGridType( 0 );
+                        break;
+                    case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_lines:
+                        pSectionContext->SetGridType( 1 );
+                        break;
+                    case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_linesAndChars:
+                        pSectionContext->SetGridType( 2 );
+                        break;
+                    default :
+                        OSL_FAIL("unknown SwTextGrid value");
+                }
             }
         }
         break;
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 1fe256f..1743d32 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1049,6 +1049,10 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
         operator[](PROP_GRID_LINES) =
                 uno::makeAny( static_cast<sal_Int16>(nTextAreaHeight/nGridLinePitch));
 
+        // PROP_GRID_MODE
+        operator[]( PROP_GRID_MODE) =
+                uno::makeAny( static_cast<sal_Int16> (m_nGridType) );
+
         sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
         //todo: is '0' the right index here?
         const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(OUString::number(0, 16));


More information about the Libreoffice-commits mailing list