diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-10-25 15:30:53 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-10-25 16:57:08 +0200 |
commit | 3c38e8f8ac99fe3a28e41751eb48d4cff764389f (patch) | |
tree | 5b31181a1db9b288ae7bf8e701cf190433de7202 | |
parent | 71adf4e972b3e8a32f60e2edf31bfbba3be28dca (diff) |
writerfilter: store some of the values directly in TablePropertiesHandler
During table style import, TablePropertiesHandler may decide to not
handle an sprm, then the caller will try the next handler. When we do
this, instead of just returning, still store the values in
InteropGrabBag (if necessary), as they logically belong here.
Change-Id: Idd052854cbef8046f0a24556cfe1536d2646f94e
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 41 | ||||
-rw-r--r-- | writerfilter/source/dmapper/TablePropertiesHandler.cxx | 19 |
2 files changed, 56 insertions, 4 deletions
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index f53e129ad762..10ef55375085 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -487,6 +487,14 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val) } break; case NS_ooxml::LN_CT_Style_customStyle: + if(m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE) + { + TableStyleSheetEntry* pTableEntry = static_cast<TableStyleSheetEntry *>(m_pImpl->m_pCurrentEntry.get()); + beans::PropertyValue aValue; + aValue.Name = "customStyle"; + aValue.Value = uno::makeAny(sal_Bool(nIntValue != 0)); + pTableEntry->AppendInteropGrabBag(aValue); + } break; case NS_ooxml::LN_CT_Style_styleId: m_pImpl->m_pCurrentEntry->sStyleIdentifierI = sValue; @@ -560,6 +568,14 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) break; case NS_ooxml::LN_CT_Style_basedOn: m_pImpl->m_pCurrentEntry->sBaseStyleIdentifier = sStringValue; + if(m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE) + { + TableStyleSheetEntry* pTableEntry = static_cast<TableStyleSheetEntry *>(m_pImpl->m_pCurrentEntry.get()); + beans::PropertyValue aValue; + aValue.Name = "basedOn"; + aValue.Value = uno::makeAny(sStringValue); + pTableEntry->AppendInteropGrabBag(aValue); + } break; case NS_ooxml::LN_CT_Style_next: m_pImpl->m_pCurrentEntry->sNextStyleIdentifier = sStringValue; @@ -568,18 +584,37 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_CT_Style_link: case NS_ooxml::LN_CT_Style_autoRedefine: case NS_ooxml::LN_CT_Style_hidden: - case NS_ooxml::LN_CT_Style_uiPriority: case NS_ooxml::LN_CT_Style_semiHidden: case NS_ooxml::LN_CT_Style_unhideWhenUsed: - case NS_ooxml::LN_CT_Style_qFormat: case NS_ooxml::LN_CT_Style_locked: case NS_ooxml::LN_CT_Style_personal: case NS_ooxml::LN_CT_Style_personalCompose: case NS_ooxml::LN_CT_Style_personalReply: - case NS_ooxml::LN_CT_Style_rsid: case NS_ooxml::LN_CT_Style_trPr: case NS_ooxml::LN_CT_Style_tcPr: break; + case NS_ooxml::LN_CT_Style_rsid: + case NS_ooxml::LN_CT_Style_qFormat: + case NS_ooxml::LN_CT_Style_uiPriority: + if(m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE) + { + TableStyleSheetEntry* pTableEntry = static_cast<TableStyleSheetEntry *>(m_pImpl->m_pCurrentEntry.get()); + beans::PropertyValue aValue; + if (nSprmId == NS_ooxml::LN_CT_Style_rsid) + { + aValue.Name = "rsid"; + aValue.Value = uno::makeAny(nIntValue); + } + else if (nSprmId == NS_ooxml::LN_CT_Style_qFormat) + aValue.Name = "qFormat"; + else + { + aValue.Name = "uiPriority"; + aValue.Value = uno::makeAny(nIntValue); + } + pTableEntry->AppendInteropGrabBag(aValue); + } + break; case NS_ooxml::LN_CT_Style_tblPr: //contains table properties case NS_ooxml::LN_CT_Style_tblStylePr: //contains to table properties case NS_ooxml::LN_CT_TblPrBase_tblInd: //table properties - at least width value and type diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx index 3749a87ee60b..5f1c37bb4e6e 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx @@ -278,7 +278,24 @@ namespace dmapper { } } break; - default: bRet = false; + default: + // Not handled here, give the next handler a chance. + bRet = false; + // However, these logically belong here, so save the value if necessary. + switch (nSprmId) + { + case NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize: + case NS_ooxml::LN_CT_TblPrBase_tblStyleColBandSize: + if (m_pCurrentInteropGrabBag) + { + beans::PropertyValue aValue; + aValue.Name = (nSprmId == NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize ? OUString("tblStyleRowBandSize") : OUString("tblStyleColBandSize")); + aValue.Value = uno::makeAny(nIntValue); + m_pCurrentInteropGrabBag->push_back(aValue); + } + break; + } + break; } #ifdef DEBUG_DOMAINMAPPER |