summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYogeshBharate <yogesh.bharate@synerzip.com>2013-10-11 19:08:06 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-10-16 09:08:12 +0000
commit764432e36a19f8fd45538f5506f043a624ce2f5c (patch)
treedf91eb6c8c217b4a652068c46042d2b8cbfff736
parent7a3381c2a80de38b513e6e2b455ca5d3c70274c8 (diff)
Code changes & unit tests for fixing multicolumn section separator line issue
Problem Description: In case of multicolumn sections, separator line was getting added during export to docx. Unit test cases added to verify the code changes. Change-Id: Id65ac4d3878eed298882c85082cec9575f914d83 Reviewed-on: https://gerrit.libreoffice.org/6211 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/ooxmlimport/data/multi-column-separator-with-line.docxbin0 -> 11618 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx16
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx1
4 files changed, 19 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/multi-column-separator-with-line.docx b/sw/qa/extras/ooxmlimport/data/multi-column-separator-with-line.docx
new file mode 100644
index 000000000000..c19ed697b55c
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/multi-column-separator-with-line.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 1f7e831dc691..d80188156447 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -139,6 +139,7 @@ public:
void testChartProp();
void testBnc779620();
void testFdo43093();
+ void testMultiColumnSeparator();
CPPUNIT_TEST_SUITE(Test);
#if !defined(WNT)
@@ -242,6 +243,7 @@ void Test::run()
{"chart-prop.docx", &Test::testChartProp},
{"bnc779620.docx", &Test::testBnc779620},
{"fdo43093.docx", &Test::testFdo43093},
+ {"multi-column-separator-with-line.docx", &Test::testMultiColumnSeparator},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1570,6 +1572,9 @@ void Test::testDefaultSectBreakCols()
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xPageStyle, "TextColumns");
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount());
+ // Check for the Column Separator value.It should be FALSE as the document does not contain separator line.
+ bool bValue = getProperty< bool >(xTextColumns, "SeparatorLineIsOn");
+ CPPUNIT_ASSERT(!bValue) ;
}
void Test::testFdo69636()
@@ -1635,6 +1640,17 @@ void Test::testFdo43093()
}
+void Test::testMultiColumnSeparator()
+{
+ uno::Reference<beans::XPropertySet> xTextSection = getProperty< uno::Reference<beans::XPropertySet> >(getParagraph(1, "First data."), "TextSection");
+ CPPUNIT_ASSERT(xTextSection.is());
+ uno::Reference<text::XTextColumns> xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xTextSection, "TextColumns");
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xTextColumns->getColumnCount());
+ // Check for the Column Separator value.It should be TRUE as the document contains separator line.
+ bool bValue = getProperty< bool >(xTextColumns, "SeparatorLineIsOn");
+ CPPUNIT_ASSERT(bValue);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7c4b19e8211f..5821bfc168d1 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5886,7 +5886,8 @@ void DocxAttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol&
pColsAttrList->add( FSNS( XML_w, XML_equalWidth ), pEquals );
- bool bHasSep = COLADJ_NONE == rCol.GetLineAdj( );
+ bool bHasSep = (COLADJ_NONE != rCol.GetLineAdj());
+
pColsAttrList->add( FSNS( XML_w, XML_sep ), bHasSep ? "true" : "false" );
// Write the element
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 928a64c81596..ad74662202f6 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3105,6 +3105,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
{
pSectionContext->SetColumnCount( (sal_Int16)pSectHdl->GetNum() - 1 );
pSectionContext->SetColumnDistance( pSectHdl->GetSpace() );
+ pSectionContext->SetSeparatorLine( pSectHdl->IsSeparator() );
}
}
}