[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Aug 6 08:47:02 PDT 2014
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 19 +++++++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 33 +++++++++++++++++++++++
sw/source/filter/ww8/docxtablestyleexport.cxx | 36 ++++++++++++++++++++++++++
sw/source/filter/ww8/docxtablestyleexport.hxx | 3 ++
4 files changed, 90 insertions(+), 1 deletion(-)
New commits:
commit 994cca6b4d090abf7b262ab8b16a46528bef6c21
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Aug 6 16:56:54 2014 +0200
DOCX export: handle <w:cnfStyle> row property
Change-Id: Ice1cf2ce078b130130c44952ec2be0f8642f21a8
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d595af3..b242714 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1980,6 +1980,25 @@ DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, "table-theme-preservation.d
// check that one cell attribute present in the original document has been preserved
assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/*", 1);
+ // Check that w:cnfStyle row, cell and paragraph property is preserved.
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "val", "100000000000");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "firstRow", "1");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "lastRow", "0");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "firstColumn", "0");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:trPr/w:cnfStyle", "lastColumn", "0");
+
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "val", "001000000000");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "oddVBand", "0");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "evenVBand", "0");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "oddHBand", "0");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc/w:tcPr/w:cnfStyle", "evenHBand", "0");
+
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "val", "100000000000");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "firstRowFirstColumn", "0");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "firstRowLastColumn", "0");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "lastRowFirstColumn", "0");
+ assertXPath(pXmlDocument, "//w:tbl/w:tr[1]/w:tc[2]/w:p/w:pPr/w:cnfStyle", "lastRowLastColumn", "0");
+
}
DECLARE_OOXMLEXPORT_TEST(testcantSplit, "2_table_doc.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3db0385..92b7b1e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2921,6 +2921,20 @@ void DocxAttributeOutput::StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t p
TableHeight( pTableTextNodeInfoInner );
TableCanSplit( pTableTextNodeInfoInner );
+ const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox();
+ const SwTableLine* pTableLine = pTableBox->GetUpper();
+ if (const SfxGrabBagItem* pItem = sw::util::HasItem<SfxGrabBagItem>(pTableLine->GetFrmFmt()->GetAttrSet(), RES_FRMATR_GRABBAG))
+ {
+ const std::map<OUString, uno::Any>& rGrabBag = pItem->GetGrabBag();
+ std::map<OUString, uno::Any>::const_iterator it = rGrabBag.find("RowCnfStyle");
+ if (it != rGrabBag.cend())
+ {
+ uno::Sequence<beans::PropertyValue> aAttributes = it->second.get< uno::Sequence<beans::PropertyValue> >();
+ m_pTableStyleExport->CnfStyle(aAttributes);
+ }
+ }
+
+
m_pSerializer->endElementNS( XML_w, XML_trPr );
}
commit dbaff6d0b62426ef76acb0a08140eab1371381be
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Aug 6 16:43:50 2014 +0200
DOCX export: handle <w:cnfStyle> cell property
Change-Id: I7ff2411aed76aa74c8c0d111962773e7af12a7df
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c199240..3db0385 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 e431da9..6c038cd 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 78d5209..4b6e037 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();
commit ccd1eb4a023219cfea46c259972af168b3431de4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Aug 6 16:09:55 2014 +0200
DOCX export: handle <w:cnfStyle> paragraph property
Change-Id: I9654da23886d52968c3c95300cc7ad4f772cbb8d
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6ab6bde..c199240 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7817,8 +7817,44 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem)
SAL_INFO("sw.ww8", "DocxAttributeOutput::ParaGrabBag: unhandled SdtPr grab bag property " << aPropertyValue.Name);
}
}
+ 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);
+ }
else
- SAL_INFO("sw.ww8", "DocxAttributeOutput::ParaGrabBag: unhandled grab bag property " << i->first );
+ SAL_WARN("sw.ww8", "DocxAttributeOutput::ParaGrabBag: unhandled grab bag property " << i->first );
}
}
More information about the Libreoffice-commits
mailing list