summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Co <rattles2013@gmail.com>2013-07-03 12:28:12 +0300
committerMiklos Vajna <vmiklos@suse.cz>2013-07-04 10:14:03 +0200
commit7baf286555396416ac30a473dd1e50a878cef011 (patch)
tree7de2247d86cb1747122c76b9867aa4210c4d9dc2
parent0f4348f49b864d13c6381d4d2dc4d1af4ab618fb (diff)
fdo#66543: fixed line number attribute START VALUE wasnt imported and exported
Change-Id: I09e0356f994f5eb328f741723ac7dbfea51419ed Reviewed-on: https://gerrit.libreoffice.org/4693
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo66543.docxbin0 -> 16196 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx12
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx14
-rw-r--r--writerfilter/source/dmapper/PropertyMap.cxx2
4 files changed, 26 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo66543.docx b/sw/qa/extras/ooxmlexport/data/fdo66543.docx
new file mode 100644
index 000000000000..585eb41e4216
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo66543.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index db12382b32e2..84470813673e 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 c7bc9d37d29c..de0783bae4de 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 a26fc18a3600..cfa2d88a214f 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& )
{