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

Miklos Vajna vmiklos at collabora.co.uk
Tue Nov 5 11:13:00 CET 2013


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx               |    1 +
 sw/source/filter/ww8/docxtablestyleexport.cxx          |   11 +++++++----
 writerfilter/source/dmapper/TablePropertiesHandler.cxx |    5 +++++
 3 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit ebf3df49118dad83acaf045b71815d7900289046
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 5 11:01:38 2013 +0100

    DOCX filter: handle tcMar inside tblStylePr
    
    Change-Id: Ifc7694b39337fb9824c2b57083fee101d48f6b84

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 91dd026..dcb106c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1357,6 +1357,7 @@ DECLARE_OOXML_TEST(testQuicktables, "quicktables.docx")
     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tcPr/w:shd", "themeFillShade", "80");
     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tblStylePr[@w:type='firstCol']/w:pPr/w:ind", "rightChars", "0");
     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tblStylePr[@w:type='firstCol']/w:pPr/w:ind", "right", "144");
+    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tblStylePr[@w:type='band2Horz']/w:tcPr/w:tcMar/w:bottom", "w", "86");
 }
 
 DECLARE_OOXML_TEST(testSmartart, "smartart.docx")
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index 8a1510d..4cc4174 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -71,12 +71,12 @@ DocxStringTokenMap const aTblCellMarTokens[] = {
 };
 
 /// Export of w:tblCellMar in a table style.
-void lcl_TableStyleTblCellMar(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rTblCellMar)
+void lcl_TableStyleTblCellMar(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rTblCellMar, sal_Int32 nType = XML_tblCellMar)
 {
     if (!rTblCellMar.hasElements())
         return;
 
-    pSerializer->startElementNS(XML_w, XML_tblCellMar, FSEND);
+    pSerializer->startElementNS(XML_w, nType, FSEND);
     for (sal_Int32 i = 0; i < rTblCellMar.getLength(); ++i)
     {
         if (sal_Int32 nToken = DocxStringGetToken(aTblCellMarTokens, rTblCellMar[i].Name))
@@ -88,7 +88,7 @@ void lcl_TableStyleTblCellMar(sax_fastparser::FSHelperPtr pSerializer, uno::Sequ
                     FSEND);
         }
     }
-    pSerializer->endElementNS(XML_w, XML_tblCellMar);
+    pSerializer->endElementNS(XML_w, nType);
 }
 
 static DocxStringTokenMap const aTcBorderTokens[] = {
@@ -448,7 +448,7 @@ void lcl_TableStyleTcPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<b
 
     pSerializer->startElementNS(XML_w, XML_tcPr, FSEND);
 
-    uno::Sequence<beans::PropertyValue> aShd, aTcBorders;
+    uno::Sequence<beans::PropertyValue> aShd, aTcBorders, aTcMar;
     OUString aVAlign;
     for (sal_Int32 i = 0; i < rTcPr.getLength(); ++i)
     {
@@ -456,10 +456,13 @@ void lcl_TableStyleTcPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<b
             aShd = rTcPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
         else if (rTcPr[i].Name == "tcBorders")
             aTcBorders = rTcPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
+        else if (rTcPr[i].Name == "tcMar")
+            aTcMar = rTcPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
         else if (rTcPr[i].Name == "vAlign")
             aVAlign = rTcPr[i].Value.get<OUString>();
     }
     lcl_TableStyleTcBorders(pSerializer, aTcBorders);
+    lcl_TableStyleTblCellMar(pSerializer, aTcMar, XML_tcMar);
     lcl_TableStyleShd(pSerializer, aShd);
     if (!aVAlign.isEmpty())
         pSerializer->singleElementNS(XML_w, XML_vAlign,
diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index 824cd0b..6854f92 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -211,12 +211,17 @@ namespace dmapper {
             }
             break;
             case NS_ooxml::LN_CT_TcPrBase_tcMar:
+            //
                 {
                     writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
                     if (pProperties.get())
                     {
                         CellMarginHandlerPtr pCellMarginHandler(new CellMarginHandler);
+                        if (m_pCurrentInteropGrabBag)
+                            pCellMarginHandler->enableInteropGrabBag("tcMar");
                         pProperties->resolve(*pCellMarginHandler);
+                        if (m_pCurrentInteropGrabBag)
+                            m_pCurrentInteropGrabBag->push_back(pCellMarginHandler->getInteropGrabBag());
                         TablePropertyMapPtr pCellProperties(new TablePropertyMap);
                         if (pCellMarginHandler->m_bTopMarginValid)
                             pCellProperties->Insert(PROP_TOP_BORDER_DISTANCE, uno::makeAny(pCellMarginHandler->m_nTopMargin));


More information about the Libreoffice-commits mailing list