summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-04-27 14:50:05 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-04-28 07:35:43 +0000
commitb9dbeb401b1f8f9b89a1ab477a566cbf42967c8a (patch)
treec5ef359621b9e0bc5b8236cf08bb1cf92b2c314c /writerfilter
parentec1a2322b862468621ce45500d74dac252bf1714 (diff)
Resolves: tdf#99498 don't overwrite trwWidth value if set on a table
Reviewed-on: https://gerrit.libreoffice.org/24430 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit b71f470e370c1819cba99abe5ef654d28bbf8749) Change-Id: Ia39da999a2de1ca2b8bec5fc7f35d2f9ffe2dd19 Reviewed-on: https://gerrit.libreoffice.org/24434 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index bb1991d95d98..26e70aed0736 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1374,10 +1374,14 @@ void RTFDocumentImpl::prepareProperties(
}
// Table width.
- auto pUnitValue = std::make_shared<RTFValue>(3);
- lcl_putNestedAttribute(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_type, pUnitValue);
- auto pWValue = std::make_shared<RTFValue>(nCurrentCellX);
- lcl_putNestedAttribute(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_w, pWValue);
+ RTFValue::Pointer_t const pTableWidthProps = rState.aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblW);
+ if (!pTableWidthProps.get())
+ {
+ auto pUnitValue = std::make_shared<RTFValue>(3);
+ lcl_putNestedAttribute(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_type, pUnitValue);
+ auto pWValue = std::make_shared<RTFValue>(nCurrentCellX);
+ lcl_putNestedAttribute(rState.aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_w, pWValue);
+ }
auto pRowValue = std::make_shared<RTFValue>(1);
if (nCells > 0)
@@ -4810,6 +4814,12 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
lcl_putNestedSprm(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_right, std::make_shared<RTFValue>(aAttributes));
}
break;
+ case RTF_TRFTSWIDTH:
+ lcl_putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_type, pIntValue);
+ break;
+ case RTF_TRWWIDTH:
+ lcl_putNestedAttribute(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_w, pIntValue);
+ break;
default:
{
SAL_INFO("writerfilter", "TODO handle value '" << lcl_RtfToString(nKeyword) << "'");