diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-10-25 18:03:52 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-10-25 18:23:00 +0200 |
commit | 718f155caacb2e969df7afcfc41ab3b207dba484 (patch) | |
tree | 62691bbfa96fa83b880916fcd0bba2c2c5c2b0c4 /sw | |
parent | a2799e77012263f0bdce55b69488bdded6f88887 (diff) |
DOCX export: table style export: initial cell hangling
Change-Id: I83ca33d87a016f8634ca6a87b81df20f6b4e0e30
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index dd2819347570..ea5b60932468 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2717,6 +2717,22 @@ void lcl_TableStyleTblCellMar(sax_fastparser::FSHelperPtr pSerializer, uno::Sequ pSerializer->endElementNS(XML_w, XML_tblCellMar); } +/// Export of w:shd in a table style. +void lcl_TableStyleShd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rShd) +{ + if (!rShd.hasElements()) + return; + + sax_fastparser::FastAttributeList* pAttributeList = pSerializer->createAttrList(); + for (sal_Int32 i = 0; i < rShd.getLength(); ++i) + { + if (rShd[i].Name == "val") + pAttributeList->add(FSNS(XML_w, XML_val), OUStringToOString(rShd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr()); + } + XFastAttributeListRef xAttributeList(pAttributeList); + pSerializer->singleElementNS(XML_w, XML_shd, xAttributeList); +} + /// Export of w:tblInd in a table style. void lcl_TableStyleTblInd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rTblInd) { @@ -2770,12 +2786,31 @@ void lcl_TableStyleTblPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence< pSerializer->endElementNS(XML_w, XML_tblPr); } +/// Export of w:tcPr in a table style. +void lcl_TableStyleTcPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rTcPr) +{ + if (!rTcPr.hasElements()) + return; + + pSerializer->startElementNS(XML_w, XML_tcPr, FSEND); + + uno::Sequence<beans::PropertyValue> aShd; + for (sal_Int32 i = 0; i < rTcPr.getLength(); ++i) + { + if (rTcPr[i].Name == "shd") + aShd = rTcPr[i].Value.get< uno::Sequence<beans::PropertyValue> >(); + } + lcl_TableStyleShd(pSerializer, aShd); + + pSerializer->endElementNS(XML_w, XML_tcPr); +} + void DocxAttributeOutput::TableStyle(uno::Sequence<beans::PropertyValue>& rStyle) { bool bDefault = false, bCustomStyle = false, bQFormat = false; OUString aStyleId, aName, aBasedOn; sal_Int32 nUiPriority = 0, nRsid = 0; - uno::Sequence<beans::PropertyValue> aTblPr; + uno::Sequence<beans::PropertyValue> aTblPr, aTcPr; for (sal_Int32 i = 0; i < rStyle.getLength(); ++i) { if (rStyle[i].Name == "default") @@ -2796,6 +2831,8 @@ void DocxAttributeOutput::TableStyle(uno::Sequence<beans::PropertyValue>& rStyle nRsid = rStyle[i].Value.get<sal_Int32>(); else if (rStyle[i].Name == "tblPr") aTblPr = rStyle[i].Value.get< uno::Sequence<beans::PropertyValue> >(); + else if (rStyle[i].Name == "tcPr") + aTcPr = rStyle[i].Value.get< uno::Sequence<beans::PropertyValue> >(); } sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); @@ -2835,6 +2872,7 @@ void DocxAttributeOutput::TableStyle(uno::Sequence<beans::PropertyValue>& rStyle } lcl_TableStyleTblPr(m_pSerializer, aTblPr); + lcl_TableStyleTcPr(m_pSerializer, aTcPr); m_pSerializer->endElementNS(XML_w, XML_style); } |