[Libreoffice-commits] core.git: 2 commits - sw/qa sw/source writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Nov 7 11:31:07 CET 2013
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 3 ++
sw/source/filter/ww8/docxattributeoutput.cxx | 18 ++++++++++---
writerfilter/source/dmapper/StyleSheetTable.cxx | 33 ++++++++++++++++++------
3 files changed, 43 insertions(+), 11 deletions(-)
New commits:
commit 98fd70592463ac6cc4df3bb535230780d44b9fbc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Nov 7 11:19:05 2013 +0100
DOCX filter: roundtrip paragraph style lock
Change-Id: Id656e48c1600bb7b04e8566d5c0f3297f80a89d9
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a9e5624..974be7e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1306,6 +1306,7 @@ DECLARE_OOXML_TEST(testStyleInheritance, "style-inheritance.docx")
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");
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading1']/w:locked", 1);
}
DECLARE_OOXML_TEST(testCalendar1, "calendar1.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2782d4c..d51fb00 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3616,7 +3616,7 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
pFmt->GetGrabBagItem(aAny);
const uno::Sequence<beans::PropertyValue>& rGrabBag = aAny.get< uno::Sequence<beans::PropertyValue> >();
- bool bQFormat = false, bUnhideWhenUsed = false;
+ bool bQFormat = false, bUnhideWhenUsed = false, bLocked = false;
OUString aLink, aRsid, aUiPriority;
for (sal_Int32 i = 0; i < rGrabBag.getLength(); ++i)
{
@@ -3630,6 +3630,8 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
aRsid = rGrabBag[i].Value.get<OUString>();
else if (rGrabBag[i].Name == "unhideWhenUsed")
bUnhideWhenUsed = true;
+ else if (rGrabBag[i].Name == "locked")
+ bLocked = true;
else
SAL_WARN("sw.ww8", "Unhandled style property: " << rGrabBag[i].Name);
}
@@ -3646,6 +3648,8 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
m_pSerializer->singleElementNS(XML_w, XML_link,
FSNS(XML_w, XML_val), OUStringToOString(aLink, RTL_TEXTENCODING_UTF8).getStr(),
FSEND);
+ if (bLocked)
+ m_pSerializer->singleElementNS(XML_w, XML_locked, 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 741dd9f..1092bac 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -590,7 +590,6 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm)
case NS_ooxml::LN_CT_Style_aliases:
case NS_ooxml::LN_CT_Style_autoRedefine:
case NS_ooxml::LN_CT_Style_hidden:
- case NS_ooxml::LN_CT_Style_locked:
case NS_ooxml::LN_CT_Style_personal:
case NS_ooxml::LN_CT_Style_personalCompose:
case NS_ooxml::LN_CT_Style_personalReply:
@@ -616,6 +615,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm)
case NS_ooxml::LN_CT_Style_unhideWhenUsed:
case NS_ooxml::LN_CT_Style_uiPriority:
case NS_ooxml::LN_CT_Style_link:
+ case NS_ooxml::LN_CT_Style_locked:
if(m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE || m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_PARA)
{
StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry;
@@ -655,6 +655,9 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm)
aValue.Value = uno::makeAny(sStringValue);
}
break;
+ case NS_ooxml::LN_CT_Style_locked:
+ aValue.Name = "locked";
+ break;
default:
break;
}
commit fc46d7f60b5cd8901115769f44b054da8b2a3100
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Nov 7 11:08:10 2013 +0100
DOCX filter: roundtrip paragraph style link
Change-Id: Ide29e98b73410d8917742f2eeb15bdcbd9de87cc
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d137de54..a9e5624 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 bd49937..2782d4c 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 85626e1..741dd9f 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;
More information about the Libreoffice-commits
mailing list