fdo#76741 [DOCX] Table Alignment and width type
There are two issue related to table in the saved(exported) file - the table alignment in saved file is "left" instead of "center" - the table width type in properties is "auto" instead of "dxa" In the issue file alignment was specified in w:tblpXSpec="center" and so were missed at import. Added support to fetch HORI_ORIENT from frame properties if its not set in Table Properties The ::GetTablePageSize returns 0 if the table width is FIXED. Modified it to return the tableWidth in such case. Conflicts: writerfilter/source/dmapper/DomainMapperTableHandler.cxx Reviewed on: https://gerrit.libreoffice.org/8846 Change-Id: I02a3af5e9d8ef3746c4d6bec0a07a24e01cc12a4
This commit is contained in:
parent
8a3eeff238
commit
c1e563f6ef
BIN
sw/qa/extras/ooxmlexport/data/fdo76741.docx
Normal file
BIN
sw/qa/extras/ooxmlexport/data/fdo76741.docx
Normal file
Binary file not shown.
@ -2360,11 +2360,34 @@ DECLARE_OOXMLEXPORT_TEST(testSegFaultWhileSave, "test_segfault_while_save.docx")
|
||||
|
||||
DECLARE_OOXMLEXPORT_TEST(fdo69656, "Table_cell_auto_width_fdo69656.docx")
|
||||
{
|
||||
// Changed the UT to check "dxa" instead of "auto"
|
||||
// For this particular issue file few cells have width type "auto"
|
||||
// LO supports VARIABLE and FIXED width type.
|
||||
// If type is VARIABLE LO calculates width as percent of PageSize
|
||||
// Else if the width is fixed it uses the width value.
|
||||
// After changes for fdo76741 the fixed width is exported as "dxa" for DOCX
|
||||
|
||||
// Check for the width type of table and its cells.
|
||||
xmlDocPtr pXmlDoc = parseExport();
|
||||
if (!pXmlDoc)
|
||||
return;
|
||||
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW","type","auto");
|
||||
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW","type","dxa");
|
||||
}
|
||||
|
||||
DECLARE_OOXMLEXPORT_TEST(testFdo76741, "fdo76741.docx")
|
||||
{
|
||||
|
||||
// There are two issue related to table in the saved(exported) file
|
||||
// - the table alignment in saved file is "left" instead of "center"
|
||||
// - the table width type in properties is "auto" instead of "dxa"
|
||||
|
||||
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
|
||||
|
||||
if (!pXmlDoc)
|
||||
return;
|
||||
assertXPath(pXmlDoc, "//w:jc", "val", "center");
|
||||
assertXPath(pXmlDoc, "//w:tblW", "w", "10081");
|
||||
assertXPath(pXmlDoc, "//w:tblW", "type", "dxa");
|
||||
}
|
||||
|
||||
DECLARE_OOXMLEXPORT_TEST(testFdo73541,"fdo73541.docx")
|
||||
|
@ -2382,6 +2382,11 @@ void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner * pTableT
|
||||
nPageSize /= 100;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// As the table width is not relative, the TablePageSize equals its width
|
||||
nPageSize = nTblSz;
|
||||
}
|
||||
|
||||
rPageSize = nPageSize;
|
||||
rRelBoxSize = bRelBoxSize;
|
||||
|
@ -307,6 +307,20 @@ bool lcl_extractTableBorderProperty(PropertyMapPtr pTableProperties, const Prope
|
||||
|
||||
}
|
||||
|
||||
bool lcl_extractHoriOrient(uno::Sequence<beans::PropertyValue>& rFrameProperties, sal_Int32& nHoriOrient)
|
||||
{
|
||||
// Shifts the frame left by the given value.
|
||||
for (sal_Int32 i = 0; i < rFrameProperties.getLength(); ++i)
|
||||
{
|
||||
if (rFrameProperties[i].Name == "HoriOrient")
|
||||
{
|
||||
nHoriOrient = rFrameProperties[i].Value.get<sal_Int32>();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void lcl_DecrementHoriOrientPosition(uno::Sequence<beans::PropertyValue>& rFrameProperties, sal_Int32 nAmount)
|
||||
{
|
||||
// Shifts the frame left by the given value.
|
||||
@ -543,7 +557,9 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
|
||||
}
|
||||
|
||||
sal_Int32 nHoriOrient = text::HoriOrientation::LEFT_AND_WIDTH;
|
||||
m_aTableProperties->getValue( TablePropertyMap::HORI_ORIENT, nHoriOrient ) ;
|
||||
// Fetch Horizontal Orientation in rFrameProperties if not set in m_aTableProperties
|
||||
if ( !m_aTableProperties->getValue( TablePropertyMap::HORI_ORIENT, nHoriOrient ) )
|
||||
lcl_extractHoriOrient( rFrameProperties, nHoriOrient );
|
||||
m_aTableProperties->Insert( PROP_HORI_ORIENT, uno::makeAny( sal_Int16(nHoriOrient) ) );
|
||||
//fill default value - if not available
|
||||
const PropertyMap::const_iterator aRepeatIter =
|
||||
|
Loading…
x
Reference in New Issue
Block a user