diff options
Diffstat (limited to 'xmloff/source')
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 3 | ||||
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 41 | ||||
-rw-r--r-- | xmloff/source/token/tokens.txt | 2 |
3 files changed, 46 insertions, 0 deletions
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 34ae9d98cb71..2839bd0d1832 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3490,6 +3490,9 @@ namespace xmloff::token { TOKEN("color-lum-mod", XML_COLOR_LUM_MOD ), TOKEN("color-lum-off", XML_COLOR_LUM_OFF ), + TOKEN("content-control", XML_CONTENT_CONTROL ), + TOKEN("showing-place-holder", XML_SHOWING_PLACE_HOLDER ), + #if OSL_DEBUG_LEVEL > 0 { 0, nullptr, std::nullopt, XML_TOKEN_END } diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index b813885f0812..5b8c07b70919 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2212,6 +2212,10 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( { exportMeta(xPropSet, bAutoStyles, bIsProgress, rPrevCharIsSpace); } + else if (sType == "ContentControl") + { + ExportContentControl(xPropSet, bAutoStyles, bIsProgress, rPrevCharIsSpace); + } else if (sType == gsTextFieldStart) { Reference< css::text::XFormField > xFormField(xPropSet->getPropertyValue(gsBookmark), UNO_QUERY); @@ -3868,6 +3872,43 @@ void XMLTextParagraphExport::exportMeta( exportTextRangeEnumeration(xTextEnum, i_bAutoStyles, i_isProgress, rPrevCharIsSpace); } +void XMLTextParagraphExport::ExportContentControl( + const uno::Reference<beans::XPropertySet>& xPortion, bool bAutoStyles, bool isProgress, + bool& rPrevCharIsSpace) +{ + // Do not export the element in the autostyle case. + bool bExport = !bAutoStyles; + if (!(GetExport().getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)) + { + bExport = false; + } + + uno::Reference<text::XTextContent> xTextContent(xPortion->getPropertyValue("ContentControl"), + uno::UNO_QUERY_THROW); + uno::Reference<container::XEnumerationAccess> xEA(xTextContent, uno::UNO_QUERY_THROW); + uno::Reference<container::XEnumeration> xTextEnum = xEA->createEnumeration(); + + if (bExport) + { + uno::Reference<beans::XPropertySet> xPropertySet(xTextContent, uno::UNO_QUERY_THROW); + bool bShowingPlaceHolder = false; + xPropertySet->getPropertyValue("ShowingPlaceHolder") >>= bShowingPlaceHolder; + if (bShowingPlaceHolder) + { + OUStringBuffer aBuffer; + sax::Converter::convertBool(aBuffer, bShowingPlaceHolder); + GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_SHOWING_PLACE_HOLDER, + aBuffer.makeStringAndClear()); + } + } + + SvXMLElementExport aElem(GetExport(), bExport, XML_NAMESPACE_LO_EXT, XML_CONTENT_CONTROL, false, + false); + + // Recurse to export content. + exportTextRangeEnumeration(xTextEnum, bAutoStyles, isProgress, rPrevCharIsSpace); +} + void XMLTextParagraphExport::PreventExportOfControlsInMuteSections( const Reference<XIndexAccess> & rShapes, const rtl::Reference<xmloff::OFormLayerXMLExport>& xFormExport ) diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index da3080aad63a..1a8d60b4ec1b 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -3233,4 +3233,6 @@ hlink folHlink color-lum-mod color-lum-off +content-control +showing-place-holder TOKEN_END_DUMMY |