diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-08-23 17:24:40 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-08-23 20:07:33 +0200 |
commit | 1a9e0d78edd9808030c5a7b6511a915f742fb67b (patch) | |
tree | b8d2b70884343e6afe649fd8c8cc47610073c465 /writerfilter | |
parent | 03e2d2a906288f520a4b046d5b96dfba759b27b0 (diff) |
tdf#119809: FILESAVE DOCX The combo box ActiveX control is lost
The problem was with the empty combobox. The implemenation before this
commit imported a combobox only when the combobox had any item.
Reviewed-on: https://gerrit.libreoffice.org/78024
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 3ceefe9abff98fc24ffb5e8e405f4999faddc351)
Change-Id: I945098277d1ed34c65b43f0f6ad8eb361cf41b53
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SdtHelper.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SdtHelper.hxx | 5 |
3 files changed, 11 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 0c788dbb9c41..e408b74df7e0 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1016,7 +1016,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) else m_pImpl->setSdtEndDeferred(true); - if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty()) + if (m_pImpl->m_pSdtHelper->isInsideDropDownControl()) m_pImpl->m_pSdtHelper->createDropDownControl(); else if (m_pImpl->m_pSdtHelper->validateDateFormat()) m_pImpl->m_pSdtHelper->createDateContentControl(); @@ -2393,6 +2393,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) case NS_ooxml::LN_CT_SdtPr_dropDownList: case NS_ooxml::LN_CT_SdtPr_comboBox: { + m_pImpl->m_pSdtHelper->setInsideDropDownControl(true); writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if (pProperties.get() != nullptr) pProperties->resolve(*this); @@ -3167,7 +3168,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) } bool bNewLine = len == 1 && (sText[0] == 0x0d || sText[0] == 0x07); - if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty()) + if (m_pImpl->m_pSdtHelper->isInsideDropDownControl()) { if (bNewLine) // Dropdown control has single-line texts, so in case of newline, create the control. diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index 5e56340e0b80..a2f9c8131375 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -72,6 +72,7 @@ static awt::Size lcl_getOptimalWidth(const StyleSheetTablePtr& pStyleSheet, OUSt SdtHelper::SdtHelper(DomainMapper_Impl& rDM_Impl) : m_rDM_Impl(rDM_Impl) + , m_bInsideDropDownControl(false) , m_bHasElements(false) , m_bOutsideAParagraph(false) { @@ -81,6 +82,7 @@ SdtHelper::~SdtHelper() = default; void SdtHelper::createDropDownControl() { + assert(m_bInsideDropDownControl); OUString aDefaultText = m_aSdtTexts.makeStringAndClear(); uno::Reference<awt::XControlModel> xControlModel(m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.form.component.ComboBox"), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY); @@ -91,6 +93,7 @@ void SdtHelper::createDropDownControl() createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), aDefaultText, m_aDropDownItems), xControlModel, uno::Sequence<beans::PropertyValue>()); m_aDropDownItems.clear(); + m_bInsideDropDownControl = false; } bool SdtHelper::validateDateFormat() diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx index 8f8f3ef9ba7b..c01a87570a4a 100644 --- a/writerfilter/source/dmapper/SdtHelper.hxx +++ b/writerfilter/source/dmapper/SdtHelper.hxx @@ -51,6 +51,8 @@ class SdtHelper final : public virtual SvRefBase /// Items of the drop-down control. std::vector<OUString> m_aDropDownItems; + /// Indicator of a drop-down control + bool m_bInsideDropDownControl; /// Pieces of the default text -- currently used only by the dropdown control. OUStringBuffer m_aSdtTexts; /// Date ISO string contained in the w:date element, used by the date control. @@ -121,6 +123,9 @@ public: return m_bOutsideAParagraph; } + bool isInsideDropDownControl() const { return m_bInsideDropDownControl; } + void setInsideDropDownControl(bool bInside) { m_bInsideDropDownControl = bInside; } + /// Create drop-down control from w:sdt's w:dropDownList. void createDropDownControl(); /// Create date control from w:sdt's w:date. |