summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2013-11-06 15:11:05 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-11-06 16:53:55 +0100
commiteb3942a24918e9537c85cc79a405fff8c167d456 (patch)
tree15a394bb662c062511a3276cf39cc3d380ef6730 /sw
parente2790597d9cd534321bf95cb72dcad13e405cc47 (diff)
DOCX export of para style's qFormat, rsid and friends
Change-Id: I4ed35f2b497fec96d012303001d4861768daef6a
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx5
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx37
-rw-r--r--sw/source/filter/ww8/docxtablestyleexport.cxx23
3 files changed, 49 insertions, 16 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 6aeae7b3c970..1355f51fb710 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1299,6 +1299,11 @@ DECLARE_OOXML_TEST(testStyleInheritance, "style-inheritance.docx")
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:tblPr/w:tblCellMar/w:left", "w", "108");
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:semiHidden", 1);
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:unhideWhenUsed", 1);
+
+ // Additional para style properties should be also roundtripped.
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListParagraph']/w:uiPriority", "val", "34");
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:qFormat", 1);
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:rsid", "val", "00780346");
}
DECLARE_OOXML_TEST(testCalendar1, "calendar1.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 755f606ac841..8f5859fee635 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3609,6 +3609,43 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
FSNS( XML_w, XML_val ), OUStringToOString( OUString( rName ), RTL_TEXTENCODING_UTF8 ).getStr(),
FSEND );
+ if (eType == STYLE_TYPE_PARA)
+ {
+ const SwFmt* pFmt = m_rExport.pStyles->GetSwFmt(nId);
+ uno::Any aAny;
+ pFmt->GetGrabBagItem(aAny);
+ const uno::Sequence<beans::PropertyValue>& rGrabBag = aAny.get< uno::Sequence<beans::PropertyValue> >();
+
+ bool bQFormat = false, bUnhideWhenUsed = false;
+ OUString aRsid, aUiPriority;
+ for (sal_Int32 i = 0; i < rGrabBag.getLength(); ++i)
+ {
+ if (rGrabBag[i].Name == "uiPriority")
+ aUiPriority = rGrabBag[i].Value.get<OUString>();
+ else if (rGrabBag[i].Name == "qFormat")
+ bQFormat = true;
+ else if (rGrabBag[i].Name == "rsid")
+ aRsid = rGrabBag[i].Value.get<OUString>();
+ else if (rGrabBag[i].Name == "unhideWhenUsed")
+ bUnhideWhenUsed = true;
+ else
+ SAL_WARN("sw.ww8", "Unhandled style property: " << rGrabBag[i].Name);
+ }
+
+ if (!aUiPriority.isEmpty())
+ m_pSerializer->singleElementNS(XML_w, XML_uiPriority,
+ FSNS(XML_w, XML_val), OUStringToOString(aUiPriority, RTL_TEXTENCODING_UTF8).getStr(),
+ FSEND);
+ if (bQFormat)
+ m_pSerializer->singleElementNS(XML_w, XML_qFormat, FSEND);
+ if (bUnhideWhenUsed)
+ m_pSerializer->singleElementNS(XML_w, XML_unhideWhenUsed, FSEND);
+ if (!aRsid.isEmpty())
+ m_pSerializer->singleElementNS(XML_w, XML_rsid,
+ FSNS(XML_w, XML_val), OUStringToOString(aRsid, RTL_TEXTENCODING_UTF8).getStr(),
+ FSEND);
+ }
+
if ( nBase != 0x0FFF && eType != STYLE_TYPE_LIST)
{
m_pSerializer->singleElementNS( XML_w, XML_basedOn,
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index 61eea423b73b..3fc7246e8ad0 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -14,7 +14,6 @@
#include <oox/token/tokens.hxx>
#include <comphelper/sequenceashashmap.hxx>
-#include <comphelper/string.hxx>
#include <rtl/strbuf.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -538,8 +537,7 @@ void DocxTableStyleExport::Impl::tableStyleTblStylePr(uno::Sequence<beans::Prope
void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>& rStyle)
{
bool bDefault = false, bCustomStyle = false, bQFormat = false, bSemiHidden = false, bUnhideWhenUsed = false;
- OUString aStyleId, aName, aBasedOn;
- sal_Int32 nUiPriority = 0, nRsid = 0;
+ OUString aStyleId, aName, aBasedOn, aRsid, aUiPriority;
uno::Sequence<beans::PropertyValue> aPPr, aRPr, aTblPr, aTcPr;
std::vector< uno::Sequence<beans::PropertyValue> > aTblStylePrs;
for (sal_Int32 i = 0; i < rStyle.getLength(); ++i)
@@ -555,7 +553,7 @@ void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>&
else if (rStyle[i].Name == "basedOn")
aBasedOn = rStyle[i].Value.get<OUString>();
else if (rStyle[i].Name == "uiPriority")
- nUiPriority = rStyle[i].Value.get<sal_Int32>();
+ aUiPriority = rStyle[i].Value.get<OUString>();
else if (rStyle[i].Name == "qFormat")
bQFormat = true;
else if (rStyle[i].Name == "semiHidden")
@@ -563,7 +561,7 @@ void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>&
else if (rStyle[i].Name == "unhideWhenUsed")
bUnhideWhenUsed = true;
else if (rStyle[i].Name == "rsid")
- nRsid = rStyle[i].Value.get<sal_Int32>();
+ aRsid = rStyle[i].Value.get<OUString>();
else if (rStyle[i].Name == "pPr")
aPPr = rStyle[i].Value.get< uno::Sequence<beans::PropertyValue> >();
else if (rStyle[i].Name == "rPr")
@@ -594,9 +592,9 @@ void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>&
m_pSerializer->singleElementNS(XML_w, XML_basedOn,
FSNS(XML_w, XML_val), OUStringToOString(aBasedOn, RTL_TEXTENCODING_UTF8).getStr(),
FSEND);
- if (nUiPriority)
+ if (!aUiPriority.isEmpty())
m_pSerializer->singleElementNS(XML_w, XML_uiPriority,
- FSNS(XML_w, XML_val), OString::number(nUiPriority),
+ FSNS(XML_w, XML_val), OUStringToOString(aUiPriority, RTL_TEXTENCODING_UTF8).getStr(),
FSEND);
if (bQFormat)
m_pSerializer->singleElementNS(XML_w, XML_qFormat, FSEND);
@@ -604,17 +602,10 @@ void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>&
m_pSerializer->singleElementNS(XML_w, XML_semiHidden, FSEND);
if (bUnhideWhenUsed)
m_pSerializer->singleElementNS(XML_w, XML_unhideWhenUsed, FSEND);
- if (nRsid)
- {
- // We want the rsid as a hex string, but always with the length of 8.
- OStringBuffer aBuf = OString::number(nRsid, 16);
- OStringBuffer aStr;
- comphelper::string::padToLength(aStr, 8 - aBuf.getLength(), '0');
- aStr.append(aBuf.getStr());
+ if (!aRsid.isEmpty())
m_pSerializer->singleElementNS(XML_w, XML_rsid,
- FSNS(XML_w, XML_val), aStr.getStr(),
+ FSNS(XML_w, XML_val), OUStringToOString(aRsid, RTL_TEXTENCODING_UTF8).getStr(),
FSEND);
- }
tableStylePPr(aPPr);
tableStyleRPr(aRPr);