[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source
Pallavi Jadhav
pallavi.jadhav at synerzip.com
Tue Feb 25 01:14:25 PST 2014
sw/qa/extras/ooxmlexport/data/FDO74105.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 15 +++++++++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 13 +++++++++----
writerfilter/source/dmapper/NumberingManager.cxx | 12 ++++++++++++
4 files changed, 36 insertions(+), 4 deletions(-)
New commits:
commit 01826dc12550e7a4204034f7876c593726525b54
Author: Pallavi Jadhav <pallavi.jadhav at synerzip.com>
Date: Tue Jan 28 11:42:53 2014 +0530
fdo#74105 : Prservation of Numbered lists-Starting with Value '0'
Issue :
- DOCX containing Numbered lists- Strating with
value '0' is not preserved after RT.
- LO exports document with Numbered lists starting
from '1' instead of '0'.
- LO "Import" and "Export" need fixes.
- If LO will imports correctly, export will get
correct value.
Implentation :
- Added code at Import and Export side.
- Added Export Unit test case to check that
<w:start> is not present in numbering.xml
for 0th level.
NOTE : <w:start> is optional. If not mentioned
Numbered lists starts from '0'.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7710
Change-Id: I30910c41fd188f30a1723cf8e07be5ea1cde1be0
diff --git a/sw/qa/extras/ooxmlexport/data/FDO74105.docx b/sw/qa/extras/ooxmlexport/data/FDO74105.docx
new file mode 100644
index 0000000..4299cf9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/FDO74105.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d7692ac..7b7c904 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3498,6 +3498,21 @@ DECLARE_OOXMLEXPORT_TEST(testEmbeddedXlsx, "embedded-xlsx.docx")
CPPUNIT_ASSERT_EQUAL(2, nImageFiles);
}
+DECLARE_OOXMLEXPORT_TEST(testNumberedLists_StartingWithZero, "FDO74105.docx")
+{
+ /* Issue : Numbered lists Starting with value '0' is not preserved after RT.
+ * In numbering.xml, an XML tag <w:start> is optional. If not mentioned,
+ * the Numbered list should start from 0.
+ * Problem was LO was writing <w:start> for all levels 0-8 with default value "1".
+ */
+ xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
+ if (!pXmlDoc)
+ return;
+
+ // Check that we do _not_ export w:start for <w:lvl w:ilvl="0">.
+ assertXPath(pXmlDoc, "w:numbering/w:abstractNum[1]/w:lvl[1]/w:start", 0);
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6414d04..77a0aed 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4434,10 +4434,15 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel,
FSNS( XML_w, XML_ilvl ), OString::number( nLevel ).getStr(),
FSEND );
- // start with the nStart value
- m_pSerializer->singleElementNS( XML_w, XML_start,
- FSNS( XML_w, XML_val ), OString::number( nStart ).getStr(),
- FSEND );
+ // start with the nStart value. Do not write w:start if Numbered Lists
+ // starts from zero.As it's an optional parameter.
+ // refer ECMA 376 Second edition Part-1
+ if(!(0 == nLevel && 0 == nStart))
+ {
+ m_pSerializer->singleElementNS( XML_w, XML_start,
+ FSNS( XML_w, XML_val ), OString::number( nStart ).getStr(),
+ FSEND );
+ }
// format
OString aFmt( impl_NumberingType( nNumberingType ) );
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 60582c8..98d9c44 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -829,6 +829,7 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal )
void ListsManager::lcl_sprm( Sprm& rSprm )
{
+ static bool bIsStartVisited = false;
//fill the attributes of the style sheet
sal_uInt32 nSprmId = rSprm.getId();
if( m_pCurrentDefinition.get() ||
@@ -952,11 +953,22 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
}
break;
case NS_ooxml::LN_CT_Lvl_start:
+ if (m_pCurrentDefinition->GetCurrentLevel().get())
+ m_pCurrentDefinition->GetCurrentLevel( )->SetValue( nSprmId, nIntValue );
+ bIsStartVisited = true;
+ break;
case NS_ooxml::LN_CT_Lvl_numFmt:
case NS_ooxml::LN_CT_Lvl_isLgl:
case NS_ooxml::LN_CT_Lvl_legacy:
if (m_pCurrentDefinition->GetCurrentLevel().get())
+ {
m_pCurrentDefinition->GetCurrentLevel( )->SetValue( nSprmId, nIntValue );
+ if( false == bIsStartVisited )
+ {
+ m_pCurrentDefinition->GetCurrentLevel( )->SetValue( NS_ooxml::LN_CT_Lvl_start, 0 );
+ bIsStartVisited = true;
+ }
+ }
break;
case NS_ooxml::LN_CT_Lvl_suff:
{
More information about the Libreoffice-commits
mailing list