sw/qa/extras/ooxmlexport/data/fdo66543.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 ++++++++++++ writerfilter/source/dmapper/DomainMapper.cxx | 14 +++++++++++++- writerfilter/source/dmapper/PropertyMap.cxx | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-)
New commits: commit 7baf286555396416ac30a473dd1e50a878cef011 Author: Adam Co <rattles2...@gmail.com> Date: Wed Jul 3 12:28:12 2013 +0300 fdo#66543: fixed line number attribute START VALUE wasnt imported and exported Change-Id: I09e0356f994f5eb328f741723ac7dbfea51419ed Reviewed-on: https://gerrit.libreoffice.org/4693 diff --git a/sw/qa/extras/ooxmlexport/data/fdo66543.docx b/sw/qa/extras/ooxmlexport/data/fdo66543.docx new file mode 100644 index 0000000..585eb41 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo66543.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index db12382..8447081 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextFramesSupplier.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include <com/sun/star/text/XTextSection.hpp> #include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/table/BorderLine2.hpp> @@ -85,6 +86,7 @@ public: void testFdo64238_b(); void testFdo56679(); void testFdo65400(); + void testFdo66543(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -144,6 +146,7 @@ void Test::run() {"fdo64238_b.docx", &Test::testFdo64238_b}, {"fdo56679.docx", &Test::testFdo56679}, {"fdo65400.docx", &Test::testFdo65400}, + {"fdo66543.docx", &Test::testFdo66543}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -878,6 +881,15 @@ void Test::testFdo65400() CPPUNIT_ASSERT_EQUAL( sal_Int32( 0xd8d8d8 ), getProperty< sal_Int32 >( shaded, "CharBackColor" )); } +void Test::testFdo66543() +{ + // The problem was that when importing DOCX with 'line numbers' - the 'start value' was imported + // but nothing was done with it. + + uno::Reference< text::XTextRange > paragraph1 = getParagraph( 1 ); + CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), getProperty< sal_Int32 >( paragraph1, "ParaLineNumberStartValue" )); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index c7bc9d3..de0783b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1376,16 +1376,28 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) { case NS_ooxml::LN_CT_LineNumber_countBy: aSettings.nInterval = nIntValue; + OSL_ENSURE(pSectionContext, "SectionContext unavailable!"); + if( pSectionContext ) + pSectionContext->SetLnnMod( nIntValue ); break; case NS_ooxml::LN_CT_LineNumber_start: aSettings.nStartValue = nIntValue; // todo: has to be set at (each) first paragraph + OSL_ENSURE(pSectionContext, "SectionContext unavailable!"); + if( pSectionContext ) + pSectionContext->SetLnnMin( nIntValue ); break; case NS_ooxml::LN_CT_LineNumber_distance: aSettings.nDistance = ConversionHelper::convertTwipToMM100( nIntValue ); + OSL_ENSURE(pSectionContext, "SectionContext unavailable!"); + if( pSectionContext ) + pSectionContext->SetdxaLnn( nIntValue ); break; case NS_ooxml::LN_CT_LineNumber_restart: //page:empty, probably 0,section:1,continuous:2; aSettings.bRestartAtEachPage = nIntValue < 1; + OSL_ENSURE(pSectionContext, "SectionContext unavailable!"); + if( pSectionContext ) + pSectionContext->SetLnc( nIntValue ); break; default:; } @@ -2537,7 +2549,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType case NS_sprm::LN_SLnnMin: // sprmSLnnMin OSL_ENSURE(pSectionContext, "SectionContext unavailable!"); if( pSectionContext ) - pSectionContext->SetLnnMin( nIntValue ); + pSectionContext->SetLnnMin( nIntValue + 1 ); // Sending '+1' because the value of 'sprmSLnnMin' is one less than the starting value for line numbers. break; case NS_sprm::LN_SGprfIhdt: diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index a26fc18..cfa2d88 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -842,7 +842,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) //set the start value at the beginning of the document xRangeProperties = uno::Reference< beans::XPropertySet >( rDM_Impl.GetTextDocument()->getText()->getStart(), uno::UNO_QUERY_THROW ); } - xRangeProperties->setPropertyValue( rPropNameSupplier.GetName( PROP_PARA_LINE_NUMBER_START_VALUE ), uno::makeAny( m_nLnnMin + 1 )); + xRangeProperties->setPropertyValue( rPropNameSupplier.GetName( PROP_PARA_LINE_NUMBER_START_VALUE ), uno::makeAny( m_nLnnMin )); } catch( const uno::Exception& ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits