diff options
author | PriyankaGaikwad <priyanka.gaikwad@synerzip.com> | 2014-07-11 12:00:30 +0530 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2014-07-21 17:30:50 +0200 |
commit | 8e71604ebde7092dc026521fc5a414686777cb38 (patch) | |
tree | 100f523bb09c9b4bd1905389504fc827ea3e7ec7 | |
parent | aa7d58a1e6e6f809a5372d893b70fc298a240676 (diff) |
fdo#80902: Document grid type is not rendered properly
XML difference :
In document.xml
Original :
<w:docGrid w:type="lines" w:linePitch="360"/>
Roundtrip :
<w:docGrid w:type="default" w:linePitch="360" w:charSpace="0"/>
Document grid type is not set properly while import.
Change-Id: I68ec778c3138b37ad96f69942361a73ed0e85d71
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo80902.docx | bin | 0 -> 10795 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 16 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 4 |
4 files changed, 29 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo80902.docx b/sw/qa/extras/ooxmlexport/data/fdo80902.docx Binary files differnew file mode 100644 index 000000000000..73a927f9a3cb --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo80902.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index f22b96caba40..eac281a13577 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3420,6 +3420,16 @@ DECLARE_OOXMLEXPORT_TEST(testFdo80997, "fdo80997.docx") uno::Reference< text::XTextRange > xText = getRun( xParagraph, 1, " text"); } +DECLARE_OOXMLEXPORT_TEST(testFdo80902, "fdo80902.docx") +{ + // The problem was that the docGrid type was set as default so fix it for other grid type + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + + assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:docGrid", "type", "lines"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 27bda6efe4ba..23ffe2a333ae 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -896,7 +896,21 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) { if (pSectionContext != NULL) { - pSectionContext->SetGridType(nIntValue); + switch( nIntValue ) + { + case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_default: + case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_snapToChars: + pSectionContext->SetGridType( 0 ); + break; + case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_lines: + pSectionContext->SetGridType( 1 ); + break; + case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_linesAndChars: + pSectionContext->SetGridType( 2 ); + break; + default : + OSL_FAIL("unknown SwTextGrid value"); + } } } break; diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 1fe256f1817f..1743d328c05e 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1049,6 +1049,10 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) operator[](PROP_GRID_LINES) = uno::makeAny( static_cast<sal_Int16>(nTextAreaHeight/nGridLinePitch)); + // PROP_GRID_MODE + operator[]( PROP_GRID_MODE) = + uno::makeAny( static_cast<sal_Int16> (m_nGridType) ); + sal_Int32 nCharWidth = 423; //240 twip/ 12 pt //todo: is '0' the right index here? const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(OUString::number(0, 16)); |