diff options
Diffstat (limited to 'sw/source/core/text/itrform2.cxx')
-rw-r--r-- | sw/source/core/text/itrform2.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 8563c6c22d7d..d5928c3e77e1 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -987,6 +987,13 @@ bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) co return true; } + const SwPaM aPam(*pTextNode, nEnd, *pTextNode, nStart); + static sal_Unicode const aForbidden[] = { + CH_TXTATR_BREAKWORD, + 0 + }; + const OUString aText = comphelper::string::removeAny(aPam.GetText(), aForbidden); + std::unique_ptr<vcl::PDFWriter::AnyWidget> pDescriptor; switch (pContentControl->GetType()) { @@ -1010,9 +1017,13 @@ bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) co pDescriptor = std::make_unique<vcl::PDFWriter::ListBoxWidget>(); auto pListWidget = static_cast<vcl::PDFWriter::ListBoxWidget*>(pDescriptor.get()); pListWidget->DropDown = true; + sal_Int32 nIndex = 0; for (const auto& rItem : pContentControl->GetListItems()) { pListWidget->Entries.push_back(rItem.m_aDisplayText); + if (rItem.m_aDisplayText == aText) + pListWidget->SelectedEntries.push_back(nIndex); + ++nIndex; } break; } @@ -1059,15 +1070,7 @@ bool SwContentControlPortion::DescribePDFControl(const SwTextPaintInfo& rInf) co } // Map the text of the content control to the descriptor's text. - SwPosition aPoint(*pTextNode, nStart); - SwPosition aMark(*pTextNode, nEnd); - SwPaM aPam(aMark, aPoint); - OUString aText = aPam.GetText(); - static sal_Unicode const aForbidden[] = { - CH_TXTATR_BREAKWORD, - 0 - }; - pDescriptor->Text = comphelper::string::removeAny(aText, aForbidden); + pDescriptor->Text = aText; // Calculate the bounding rectangle of this content control, which can be one or more layout // portions in one or more lines. |