[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

Nikhil Walvekar nikhil.walvekar at synerzip.com
Wed Mar 5 00:48:52 PST 2014


 sw/qa/extras/inc/swmodeltestbase.hxx                       |   17 ++++++++++
 sw/qa/extras/ooxmlexport/data/fdo73596_AlphaSeparator.docx |binary
 sw/qa/extras/ooxmlexport/data/fdo73596_RunInStyle.docx     |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                   |   21 +++++++++++++
 sw/source/filter/ww8/ww8atr.cxx                            |    2 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx          |   13 +++++++-
 6 files changed, 52 insertions(+), 1 deletion(-)

New commits:
commit d043c9e3be791993348afaba6effdc3731f7c33d
Author: Nikhil Walvekar <nikhil.walvekar at synerzip.com>
Date:   Mon Feb 17 20:46:18 2014 +0530

    fdo#73596 Added support to import and export \r,\h Index flags.
    
    This supports \r flag run-in type index. If \r is specified then we don't
    have to write \e flag (separator char).
    \h is Alphabetic separator, where indexes are grouped as per starting
    character.
    
    Change-Id: I690b29cef3d24b2a71b01f1deef0e418162d71aa
    Reviewed-on: https://gerrit.libreoffice.org/8099
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 5be397a..cb15d69 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -580,6 +580,23 @@ protected:
                                      nNumberOfNodes, xmlXPathNodeSetGetLength(pXmlNodes));
     }
 
+
+    /**
+     * Assert that rXPath exists, and returns exactly nNumberOfNodes nodes.
+     * Useful for checking that we do _not_ export some node (nNumberOfNodes == 0).
+     */
+    void assertXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath, const OUString& rContent)
+    {
+        xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
+
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(OString("XPath '" + rXPath + "' not found").getStr(),
+                                     1, xmlXPathNodeSetGetLength(pXmlNodes));
+
+        xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
+        OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content));
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("XPath contents do not match",rContent,contents);
+    }
+
     /**
      * Assert that rXPath exists, and has exactly nNumberOfChildNodes child nodes.
      * Useful for checking that we do have a no child nodes to a specific node (nNumberOfChildNodes == 0).
diff --git a/sw/qa/extras/ooxmlexport/data/fdo73596_AlphaSeparator.docx b/sw/qa/extras/ooxmlexport/data/fdo73596_AlphaSeparator.docx
new file mode 100644
index 0000000..892bc55
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo73596_AlphaSeparator.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/fdo73596_RunInStyle.docx b/sw/qa/extras/ooxmlexport/data/fdo73596_RunInStyle.docx
new file mode 100644
index 0000000..8f1863b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo73596_RunInStyle.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 06b6fa5..f885438 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2348,6 +2348,27 @@ DECLARE_OOXMLEXPORT_TEST(testFdo73541,"fdo73541.docx")
     assertXPath(pXmlDoc, "/w:settings/w:mirrorMargins");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo73596_RunInStyle,"fdo73596_RunInStyle.docx")
+{
+    // INDEX should be preserved.
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:instrText[1]"," INDEX \\e \"");
+}
+
+DECLARE_OOXMLEXPORT_TEST(testfdo73596_AlphaSeparator,"fdo73596_AlphaSeparator.docx")
+{
+    // INDEX flag \h "A" should be preserved.
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:instrText[1]");
+    xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
+    OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content));
+    CPPUNIT_ASSERT(contents.match(" INDEX \\h \"A\" \\e \""));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFDO74106, "FDO74106.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 5263dcf..0109d87 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2102,7 +2102,9 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
                 if (nsSwTOIOptions::TOI_ALPHA_DELIMITTER & pTOX->GetOptions())
                     sStr += "\\h \"A\" ";
 
+                if (!pTOX->GetTOXForm().IsCommaSeparated())
                 {
+                    // In case of Run-in style no separators are added.
                     OUString aFillTxt;
                     for (sal_uInt8 n = 1; n <= 3; ++n)
                     {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 25daf87..3501098 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2944,20 +2944,31 @@ void DomainMapper_Impl::handleIndex
     uno::Reference< beans::XPropertySet > xTOC;
     m_bStartTOC = true;
     m_bStartIndex = true;
+    OUString sValue;
+
     if (m_xTextFactory.is())
         xTOC.set(
                 m_xTextFactory->createInstance(
                 sTOCServiceName),
                 uno::UNO_QUERY_THROW);
     if (xTOC.is())
+    {
         xTOC->setPropertyValue(rPropNameSupplier.GetName( PROP_TITLE ), uno::makeAny(OUString()));
 
+        if( lcl_FindInCommand( pContext->GetCommand(), 'r', sValue ))
+        {
+            xTOC->setPropertyValue("IsCommaSeparated", uno::makeAny(true));
+        }
+        if( lcl_FindInCommand( pContext->GetCommand(), 'h', sValue ))
+        {
+            xTOC->setPropertyValue("UseAlphabeticalSeparators", uno::makeAny(true));
+        }
+    }
     pContext->SetTOC( xTOC );
 
     uno::Reference< text::XTextContent > xToInsert( xTOC, uno::UNO_QUERY );
     appendTextContent(xToInsert, uno::Sequence< beans::PropertyValue >() );
 
-    OUString sValue;
     if( lcl_FindInCommand( pContext->GetCommand(), 'c', sValue ))
     {
         sValue = sValue.replaceAll("\"", "");


More information about the Libreoffice-commits mailing list