diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-11-07 11:08:10 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-11-07 11:30:42 +0100 |
commit | fc46d7f60b5cd8901115769f44b054da8b2a3100 (patch) | |
tree | 913a2798eeda86658fb813b371a4eca72f1aa66d | |
parent | 0121f632ef72bbdb0167ec8520a9bdf0a275274e (diff) |
DOCX filter: roundtrip paragraph style link
Change-Id: Ide29e98b73410d8917742f2eeb15bdcbd9de87cc
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 28 |
3 files changed, 33 insertions, 9 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index d137de545f12..a9e562454ad3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -1304,6 +1304,8 @@ DECLARE_OOXML_TEST(testStyleInheritance, "style-inheritance.docx") 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"); + + assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading1']/w:link", "val", "Heading1Char"); } DECLARE_OOXML_TEST(testCalendar1, "calendar1.docx") diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index bd49937610ed..2782d4cfde32 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3617,17 +3617,19 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType, const uno::Sequence<beans::PropertyValue>& rGrabBag = aAny.get< uno::Sequence<beans::PropertyValue> >(); bool bQFormat = false, bUnhideWhenUsed = false; - OUString aRsid, aUiPriority; + OUString aLink, 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 == "link") + aLink = rGrabBag[i].Value.get<OUString>(); else if (rGrabBag[i].Name == "rsid") aRsid = rGrabBag[i].Value.get<OUString>(); - else if (rGrabBag[i].Name == "unhideWhenUsed") - bUnhideWhenUsed = true; + else if (rGrabBag[i].Name == "unhideWhenUsed") + bUnhideWhenUsed = true; else SAL_WARN("sw.ww8", "Unhandled style property: " << rGrabBag[i].Name); } @@ -3640,6 +3642,10 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType, m_pSerializer->singleElementNS(XML_w, XML_qFormat, FSEND); if (bUnhideWhenUsed) m_pSerializer->singleElementNS(XML_w, XML_unhideWhenUsed, FSEND); + if (!aLink.isEmpty()) + m_pSerializer->singleElementNS(XML_w, XML_link, + FSNS(XML_w, XML_val), OUStringToOString(aLink, RTL_TEXTENCODING_UTF8).getStr(), + FSEND); if (!aRsid.isEmpty()) m_pSerializer->singleElementNS(XML_w, XML_rsid, FSNS(XML_w, XML_val), OUStringToOString(aRsid, RTL_TEXTENCODING_UTF8).getStr(), diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 85626e1d4b25..741dd9ff6868 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -588,7 +588,6 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) m_pImpl->m_pCurrentEntry->sNextStyleIdentifier = sStringValue; break; case NS_ooxml::LN_CT_Style_aliases: - case NS_ooxml::LN_CT_Style_link: case NS_ooxml::LN_CT_Style_autoRedefine: case NS_ooxml::LN_CT_Style_hidden: case NS_ooxml::LN_CT_Style_locked: @@ -616,11 +615,14 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_CT_Style_semiHidden: case NS_ooxml::LN_CT_Style_unhideWhenUsed: case NS_ooxml::LN_CT_Style_uiPriority: + case NS_ooxml::LN_CT_Style_link: if(m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE || m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_PARA) { StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry; beans::PropertyValue aValue; - if (nSprmId == NS_ooxml::LN_CT_Style_rsid) + switch (nSprmId) + { + case NS_ooxml::LN_CT_Style_rsid: { // We want the rsid as a hex string, but always with the length of 8. OUStringBuffer aBuf = OUString::number(nIntValue, 16); @@ -631,17 +633,31 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) aValue.Name = "rsid"; aValue.Value = uno::makeAny(aStr.makeStringAndClear()); } - else if (nSprmId == NS_ooxml::LN_CT_Style_qFormat) + break; + case NS_ooxml::LN_CT_Style_qFormat: aValue.Name = "qFormat"; - else if (nSprmId == NS_ooxml::LN_CT_Style_semiHidden) + break; + case NS_ooxml::LN_CT_Style_semiHidden: aValue.Name = "semiHidden"; - else if (nSprmId == NS_ooxml::LN_CT_Style_unhideWhenUsed) + break; + case NS_ooxml::LN_CT_Style_unhideWhenUsed: aValue.Name = "unhideWhenUsed"; - else + break; + case NS_ooxml::LN_CT_Style_uiPriority: { aValue.Name = "uiPriority"; aValue.Value = uno::makeAny(OUString::number(nIntValue)); } + break; + case NS_ooxml::LN_CT_Style_link: + { + aValue.Name = "link"; + aValue.Value = uno::makeAny(sStringValue); + } + break; + default: + break; + } pEntry->AppendInteropGrabBag(aValue); } break; |