Kaydet (Commit) 8e71604e authored tarafından PriyankaGaikwad's avatar PriyankaGaikwad Kaydeden (comit) Luboš Luňák

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
üst aa7d58a1
...@@ -3420,6 +3420,16 @@ DECLARE_OOXMLEXPORT_TEST(testFdo80997, "fdo80997.docx") ...@@ -3420,6 +3420,16 @@ DECLARE_OOXMLEXPORT_TEST(testFdo80997, "fdo80997.docx")
uno::Reference< text::XTextRange > xText = getRun( xParagraph, 1, " text"); 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(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -896,7 +896,21 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) ...@@ -896,7 +896,21 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
{ {
if (pSectionContext != NULL) 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; break;
......
...@@ -1049,6 +1049,10 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) ...@@ -1049,6 +1049,10 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
operator[](PROP_GRID_LINES) = operator[](PROP_GRID_LINES) =
uno::makeAny( static_cast<sal_Int16>(nTextAreaHeight/nGridLinePitch)); 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 sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
//todo: is '0' the right index here? //todo: is '0' the right index here?
const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(OUString::number(0, 16)); const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(OUString::number(0, 16));
......
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