summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-08-06 16:43:50 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-08-06 17:24:19 +0200
commitdbaff6d0b62426ef76acb0a08140eab1371381be (patch)
treebcc763496e6cd5e3f144fa34e7f1141f711e0753
parentccd1eb4a023219cfea46c259972af168b3431de4 (diff)
DOCX export: handle <w:cnfStyle> cell property
Change-Id: I7ff2411aed76aa74c8c0d111962773e7af12a7df
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx47
-rw-r--r--sw/source/filter/ww8/docxtablestyleexport.cxx36
-rw-r--r--sw/source/filter/ww8/docxtablestyleexport.hxx3
3 files changed, 53 insertions, 33 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c199240ec823..3db0385d4ef7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2783,6 +2783,18 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point
FSEND );
}
+ if (const SfxGrabBagItem* pItem = sw::util::HasItem<SfxGrabBagItem>(pTblBox->GetFrmFmt()->GetAttrSet(), RES_FRMATR_GRABBAG))
+ {
+ const std::map<OUString, uno::Any>& rGrabBag = pItem->GetGrabBag();
+ std::map<OUString, uno::Any>::const_iterator it = rGrabBag.find("CellCnfStyle");
+ if (it != rGrabBag.cend())
+ {
+ uno::Sequence<beans::PropertyValue> aAttributes = it->second.get< uno::Sequence<beans::PropertyValue> >();
+ m_pTableStyleExport->CnfStyle(aAttributes);
+ }
+ }
+
+
const SvxBoxItem& rBox = pTblBox->GetFrmFmt( )->GetBox( );
const SvxBoxItem& rDefaultBox = (*tableFirstCells.rbegin())->getTableBox( )->GetFrmFmt( )->GetBox( );
{
@@ -7819,39 +7831,8 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem)
}
else if (i->first == "ParaCnfStyle")
{
- FastAttributeList* pAttributeList = m_pSerializer->createAttrList();
- uno::Sequence<beans::PropertyValue> aAttributeList = i->second.get< uno::Sequence<beans::PropertyValue> >();
-
- for (sal_Int32 j = 0; j < aAttributeList.getLength(); ++j)
- {
- if (aAttributeList[j].Name == "val")
- pAttributeList->add(FSNS(XML_w, XML_val), rtl::OUStringToOString(aAttributeList[j].Value.get<OUString>(), RTL_TEXTENCODING_UTF8));
- else
- {
- static DocxStringTokenMap const aTokens[] =
- {
- {"firstRow", XML_firstRow},
- {"lastRow", XML_lastRow},
- {"firstColumn", XML_firstColumn},
- {"lastColumn", XML_lastColumn},
- {"oddVBand", XML_oddVBand},
- {"evenVBand", XML_evenVBand},
- {"oddHBand", XML_oddHBand},
- {"evenHBand", XML_evenHBand},
- {"firstRowFirstColumn", XML_firstRowFirstColumn},
- {"firstRowLastColumn", XML_firstRowLastColumn},
- {"lastRowFirstColumn", XML_lastRowFirstColumn},
- {"lastRowLastColumn", XML_lastRowLastColumn},
- {0, 0}
- };
-
- if (sal_Int32 nToken = DocxStringGetToken(aTokens, aAttributeList[j].Name))
- pAttributeList->add(FSNS(XML_w, nToken), rtl::OUStringToOString(aAttributeList[j].Value.get<OUString>(), RTL_TEXTENCODING_UTF8));
- }
- }
-
- XFastAttributeListRef xAttributeList(pAttributeList);
- m_pSerializer->singleElementNS(XML_w, XML_cnfStyle, xAttributeList);
+ uno::Sequence<beans::PropertyValue> aAttributes = i->second.get< uno::Sequence<beans::PropertyValue> >();
+ m_pTableStyleExport->CnfStyle(aAttributes);
}
else
SAL_WARN("sw.ww8", "DocxAttributeOutput::ParaGrabBag: unhandled grab bag property " << i->first );
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index e431da9420fb..6c038cd263a6 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -72,6 +72,42 @@ void DocxTableStyleExport::CharFormat(css::uno::Sequence<css::beans::PropertyVal
m_pImpl->tableStyleRPr(rRPr);
}
+void DocxTableStyleExport::CnfStyle(uno::Sequence<beans::PropertyValue>& rAttributeList)
+{
+ sax_fastparser::FastAttributeList* pAttributeList = m_pImpl->m_pSerializer->createAttrList();
+
+ for (sal_Int32 j = 0; j < rAttributeList.getLength(); ++j)
+ {
+ if (rAttributeList[j].Name == "val")
+ pAttributeList->add(FSNS(XML_w, XML_val), rtl::OUStringToOString(rAttributeList[j].Value.get<OUString>(), RTL_TEXTENCODING_UTF8));
+ else
+ {
+ static DocxStringTokenMap const aTokens[] =
+ {
+ {"firstRow", XML_firstRow},
+ {"lastRow", XML_lastRow},
+ {"firstColumn", XML_firstColumn},
+ {"lastColumn", XML_lastColumn},
+ {"oddVBand", XML_oddVBand},
+ {"evenVBand", XML_evenVBand},
+ {"oddHBand", XML_oddHBand},
+ {"evenHBand", XML_evenHBand},
+ {"firstRowFirstColumn", XML_firstRowFirstColumn},
+ {"firstRowLastColumn", XML_firstRowLastColumn},
+ {"lastRowFirstColumn", XML_lastRowFirstColumn},
+ {"lastRowLastColumn", XML_lastRowLastColumn},
+ {0, 0}
+ };
+
+ if (sal_Int32 nToken = DocxStringGetToken(aTokens, rAttributeList[j].Name))
+ pAttributeList->add(FSNS(XML_w, nToken), rtl::OUStringToOString(rAttributeList[j].Value.get<OUString>(), RTL_TEXTENCODING_UTF8));
+ }
+ }
+
+ sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
+ m_pImpl->m_pSerializer->singleElementNS(XML_w, XML_cnfStyle, xAttributeList);
+}
+
void DocxTableStyleExport::TableStyles(sal_uInt16 nCountStylesToWrite)
{
// Do we have table styles from InteropGrabBag available?
diff --git a/sw/source/filter/ww8/docxtablestyleexport.hxx b/sw/source/filter/ww8/docxtablestyleexport.hxx
index 78d520951aca..4b6e037222c5 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.hxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.hxx
@@ -29,6 +29,9 @@ public:
/// Writes <w:rPr>...</w:rPr> based on grab-bagged character properties.
void CharFormat(css::uno::Sequence<css::beans::PropertyValue>& rRPr);
+ /// Writes <w:cnfStyle .../> based on grab-bagged para, cell or row properties.
+ void CnfStyle(css::uno::Sequence<css::beans::PropertyValue>& rAttributeList);
+
void SetSerializer(sax_fastparser::FSHelperPtr pSerializer);
DocxTableStyleExport(SwDoc* pDoc, sax_fastparser::FSHelperPtr pSerializer);
~DocxTableStyleExport();