Kaydet (Commit) 764432e3 authored tarafından YogeshBharate's avatar YogeshBharate Kaydeden (comit) Miklos Vajna

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/6211Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 7a3381c2
...@@ -139,6 +139,7 @@ public: ...@@ -139,6 +139,7 @@ public:
void testChartProp(); void testChartProp();
void testBnc779620(); void testBnc779620();
void testFdo43093(); void testFdo43093();
void testMultiColumnSeparator();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(WNT) #if !defined(WNT)
...@@ -242,6 +243,7 @@ void Test::run() ...@@ -242,6 +243,7 @@ void Test::run()
{"chart-prop.docx", &Test::testChartProp}, {"chart-prop.docx", &Test::testChartProp},
{"bnc779620.docx", &Test::testBnc779620}, {"bnc779620.docx", &Test::testBnc779620},
{"fdo43093.docx", &Test::testFdo43093}, {"fdo43093.docx", &Test::testFdo43093},
{"multi-column-separator-with-line.docx", &Test::testMultiColumnSeparator},
}; };
header(); header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
...@@ -1570,6 +1572,9 @@ void Test::testDefaultSectBreakCols() ...@@ -1570,6 +1572,9 @@ void Test::testDefaultSectBreakCols()
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xPageStyle, "TextColumns"); xTextColumns = getProperty< uno::Reference<text::XTextColumns> >(xPageStyle, "TextColumns");
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount()); 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() void Test::testFdo69636()
...@@ -1635,6 +1640,17 @@ void Test::testFdo43093() ...@@ -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_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -5886,7 +5886,8 @@ void DocxAttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol& ...@@ -5886,7 +5886,8 @@ void DocxAttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol&
pColsAttrList->add( FSNS( XML_w, XML_equalWidth ), pEquals ); 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" ); pColsAttrList->add( FSNS( XML_w, XML_sep ), bHasSep ? "true" : "false" );
// Write the element // Write the element
......
...@@ -3105,6 +3105,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType ...@@ -3105,6 +3105,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
{ {
pSectionContext->SetColumnCount( (sal_Int16)pSectHdl->GetNum() - 1 ); pSectionContext->SetColumnCount( (sal_Int16)pSectHdl->GetNum() - 1 );
pSectionContext->SetColumnDistance( pSectHdl->GetSpace() ); pSectionContext->SetColumnDistance( pSectHdl->GetSpace() );
pSectionContext->SetSeparatorLine( pSectHdl->IsSeparator() );
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment