[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source
Vinaya Mandke
vinaya.mandke at synerzip.com
Sun Apr 13 23:50:24 PDT 2014
sw/qa/extras/ooxmlexport/data/fdo76741.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 25 ++++++++++++++-
sw/source/filter/ww8/wrtww8.cxx | 5 +++
writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 18 ++++++++++
4 files changed, 46 insertions(+), 2 deletions(-)
New commits:
commit c1e563f6efd09cd3463f1b92a3022ae288c92087
Author: Vinaya Mandke <vinaya.mandke at synerzip.com>
Date: Fri Apr 4 15:07:52 2014 +0530
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
diff --git a/sw/qa/extras/ooxmlexport/data/fdo76741.docx b/sw/qa/extras/ooxmlexport/data/fdo76741.docx
new file mode 100644
index 0000000..abe9985
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76741.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d13bb70..413e4fc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -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")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index fdb323c..c05aa512 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -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;
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 336514b..0292c58 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -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 =
More information about the Libreoffice-commits
mailing list