summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-11-04 17:09:06 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-11-04 17:57:44 +0100
commit4bfa4a69a89337f1839a310a2fe83caf82e37df5 (patch)
tree76aff813668e14c621703a7f95f54076c732b622 /sw
parent46a470a2ca10721dbaab7867bf4929da4b9d99a0 (diff)
DOCX filter: handle CT_Ind_rightChars and CT_PPrBase_snapToGrid
Also, add InteropGrabBag support to bCs, themeFill, themeFillShade and w:ind's right attribute. Change-Id: I0d6ad0ef062218e71d7c71f99c56dd680b6930de
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx8
-rw-r--r--sw/source/filter/ww8/docxtablestyleexport.cxx37
2 files changed, 42 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ed0b0005368c..91dd0266ecdb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1349,6 +1349,14 @@ DECLARE_OOXML_TEST(testQuicktables, "quicktables.docx")
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar3']/w:rPr/w:rFonts", "cstheme", "majorBidi");
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar3']/w:rPr/w:color", "themeTint", "80");
CPPUNIT_ASSERT(getXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar3']/w:tblStylePr[@w:type='firstRow']/w:rPr/w:color", "themeShade").equalsIgnoreAsciiCase("BF"));
+
+ // Calendar4.
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:pPr/w:snapToGrid", "val", "0");
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:rPr/w:bCs", 1);
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar4']/w:tcPr/w:shd", "themeFill", "accent1");
+ 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");
}
DECLARE_OOXML_TEST(testSmartart, "smartart.docx")
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index 8e468f006c7a..8a1510de1b11 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -158,6 +158,10 @@ void lcl_TableStyleShd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
pAttributeList->add(FSNS(XML_w, XML_color), msfilter::util::ConvertColor(rShd[i].Value.get<sal_Int32>(), /*bAutoColor =*/ true));
else if (rShd[i].Name == "fill")
pAttributeList->add(FSNS(XML_w, XML_fill), msfilter::util::ConvertColor(rShd[i].Value.get<sal_Int32>(), /*bAutoColor =*/ true));
+ else if (rShd[i].Name == "themeFill")
+ pAttributeList->add(FSNS(XML_w, XML_themeFill), OUStringToOString(rShd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+ else if (rShd[i].Name == "themeFillShade")
+ pAttributeList->add(FSNS(XML_w, XML_themeFillShade), OUStringToOString(rShd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
}
sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
pSerializer->singleElementNS(XML_w, XML_shd, xAttributeList);
@@ -255,6 +259,24 @@ void lcl_TableStylePSpacing(sax_fastparser::FSHelperPtr pSerializer, uno::Sequen
pSerializer->singleElementNS(XML_w, XML_spacing, xAttributeList);
}
+/// Export of w:ind in a table style's pPr.
+void lcl_TableStylePInd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rInd)
+{
+ if (!rInd.hasElements())
+ return;
+
+ sax_fastparser::FastAttributeList* pAttributeList = pSerializer->createAttrList();
+ for (sal_Int32 i = 0; i < rInd.getLength(); ++i)
+ {
+ if (rInd[i].Name == "rightChars")
+ pAttributeList->add(FSNS(XML_w, XML_rightChars), OUStringToOString(rInd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+ else if (rInd[i].Name == "right")
+ pAttributeList->add(FSNS(XML_w, XML_right), OUStringToOString(rInd[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8).getStr());
+ }
+ sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList);
+ pSerializer->singleElementNS(XML_w, XML_ind, xAttributeList);
+}
+
/// Export of w:tblInd in a table style.
void lcl_TableStyleTblInd(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<beans::PropertyValue>& rTblInd)
{
@@ -293,7 +315,7 @@ void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
pSerializer->startElementNS(XML_w, XML_rPr, FSEND);
uno::Sequence<beans::PropertyValue> aRFonts, aLang, aColor;
- OUString aB, aI, aSz, aSzCs, aCaps, aSmallCaps, aSpacing;
+ OUString aB, aBCs, aI, aSz, aSzCs, aCaps, aSmallCaps, aSpacing;
for (sal_Int32 i = 0; i < rRPr.getLength(); ++i)
{
if (rRPr[i].Name == "rFonts")
@@ -302,6 +324,8 @@ void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
aLang = rRPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
else if (rRPr[i].Name == "b")
aB = rRPr[i].Value.get<OUString>();
+ else if (rRPr[i].Name == "bCs")
+ aBCs = rRPr[i].Value.get<OUString>();
else if (rRPr[i].Name == "i")
aI = rRPr[i].Value.get<OUString>();
else if (rRPr[i].Name == "color")
@@ -320,6 +344,7 @@ void lcl_TableStyleRPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
lcl_TableStyleRRFonts(pSerializer, aRFonts);
lcl_TableStyleRLang(pSerializer, aLang);
lcl_handleBoolean(aB, XML_b, pSerializer);
+ lcl_handleBoolean(aBCs, XML_bCs, pSerializer);
lcl_handleBoolean(aI, XML_i, pSerializer);
lcl_handleBoolean(aCaps, XML_caps, pSerializer);
lcl_handleBoolean(aSmallCaps, XML_smallCaps, pSerializer);
@@ -348,20 +373,26 @@ void lcl_TableStylePPr(sax_fastparser::FSHelperPtr pSerializer, uno::Sequence<be
pSerializer->startElementNS(XML_w, XML_pPr, FSEND);
- uno::Sequence<beans::PropertyValue> aSpacing;
+ uno::Sequence<beans::PropertyValue> aSpacing, aInd;
bool bWordWrap = false;
- OUString aJc;
+ OUString aJc, aSnapToGrid;
for (sal_Int32 i = 0; i < rPPr.getLength(); ++i)
{
if (rPPr[i].Name == "spacing")
aSpacing = rPPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
+ else if (rPPr[i].Name == "ind")
+ aInd = rPPr[i].Value.get< uno::Sequence<beans::PropertyValue> >();
else if (rPPr[i].Name == "wordWrap")
bWordWrap = true;
else if (rPPr[i].Name == "jc")
aJc = rPPr[i].Value.get<OUString>();
+ else if (rPPr[i].Name == "snapToGrid")
+ aSnapToGrid = rPPr[i].Value.get<OUString>();
}
if (bWordWrap)
pSerializer->singleElementNS(XML_w, XML_wordWrap, FSEND);
+ lcl_TableStylePInd(pSerializer, aInd);
+ lcl_handleBoolean(aSnapToGrid, XML_snapToGrid, pSerializer);
lcl_TableStylePSpacing(pSerializer, aSpacing);
if (!aJc.isEmpty())
pSerializer->singleElementNS(XML_w, XML_jc,