diff options
author | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-03-19 17:10:24 +0100 |
---|---|---|
committer | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-03-20 10:28:23 +0100 |
commit | 692fd140706c9366ee46c651813887c67d5b4a97 (patch) | |
tree | b2218160872c437da6f6bcbbf9844aea05126a99 /writerfilter | |
parent | f79f3e072c2ff2f4624c2ec4c577d400733584a5 (diff) |
fdo#76327: only enclose the checkbox in the sdt block.
The exporter writes the sdt blocks enclosing an entire paragraph, but
that's not the proper behaviour in all cases. The documents that mix
checkboxes and text in the same paragraph export the text inside the
sdt box and that's incorrect.
We have added code to be able to write sdt blocks that enclose
paragraphs or text runs, depending on the type of block. We have
applied it to checkboxes now.
There are two sets of properties in DocxAttributeOutput that store
sdt properties for the text run and for the paragraph. We have
modified the method WriteParagraphSdt to be generic enough to support
both cases. To write the sdt block enclosing the text run we used
parser marks.
We have renamed the property id PROP_PARA_SDTPR to the more generic
name PROP_SDTPR.
Checkbox unit test was modified to match the new structure of the
generated document.
Change-Id: I81ffe0062e1a5f80fc4638f7ee454a9bc18e63ee
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyIds.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SdtHelper.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SdtHelper.hxx | 1 |
5 files changed, 13 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 0b6283025050..85cbcec2fd59 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2654,8 +2654,12 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) { // there are unsupported SDT properties in the document // save them in the paragraph interop grab bag + OUString sName = m_pImpl->m_pSdtHelper->getInteropGrabBagName(); uno::Any aPropValue = uno::makeAny(m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear()); - m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)->Insert(PROP_PARA_SDTPR, aPropValue, true, PARA_GRAB_BAG); + if(sName == "ooxml:CT_SdtPr_checkbox") + m_pImpl->GetTopContextOfType(CONTEXT_CHARACTER)->Insert(PROP_SDTPR, aPropValue, true, CHAR_GRAB_BAG); + else + m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)->Insert(PROP_SDTPR, aPropValue, true, PARA_GRAB_BAG); } else if (len == 1 && sText[0] == 0x03) { diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index a26cdf9d93b9..8bdba4e404b3 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -387,7 +387,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_CHAR_NUMSPACING_TEXT_EFFECT : sName = "CharNumSpacingTextEffect"; break; case PROP_CHAR_STYLISTICSETS_TEXT_EFFECT : sName = "CharStylisticSetsTextEffect"; break; case PROP_CHAR_CNTXTALTS_TEXT_EFFECT : sName = "CharCntxtAltsTextEffect"; break; - case PROP_PARA_SDTPR : sName = "ParaSdtPr"; break; + case PROP_SDTPR : sName = "SdtPr"; break; } ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt = m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 6370a1d6be83..1d29c0b1c497 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -359,7 +359,7 @@ enum PropertyIds ,PROP_CHAR_NUMSPACING_TEXT_EFFECT ,PROP_CHAR_STYLISTICSETS_TEXT_EFFECT ,PROP_CHAR_CNTXTALTS_TEXT_EFFECT - ,PROP_PARA_SDTPR + ,PROP_SDTPR }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index 32691d96a811..2ff928bd89cf 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -223,6 +223,11 @@ bool SdtHelper::isInteropGrabBagEnabled() return !m_sGrabBagName.isEmpty(); } +OUString SdtHelper::getInteropGrabBagName() +{ + return m_sGrabBagName; +} + } // namespace dmapper } // namespace writerfilter diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx index 95f655939c0b..8f70de9fba10 100644 --- a/writerfilter/source/dmapper/SdtHelper.hxx +++ b/writerfilter/source/dmapper/SdtHelper.hxx @@ -88,6 +88,7 @@ public: com::sun::star::beans::PropertyValue getInteropGrabBagAndClear(); void enableInteropGrabBag(const OUString& rName); bool isInteropGrabBagEnabled(); + OUString getInteropGrabBagName(); }; } // namespace dmapper |