summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-05-24 11:00:11 +0200
committerMiklos Vajna <vmiklos@collabora.com>2023-05-24 12:38:09 +0200
commit08fa2903df1a7cf9a1647fcf967e4c8b57dad793 (patch)
tree498ae2d00dba08ca65d913a113d204e158cc53fc /xmloff
parent0ce9c61f35151f115b42e24fabe6f7bae5ee8783 (diff)
sw floattable: add a DoNotBreakWrappedTables compat flag
RTF doesn't break floating table across pages, and there is a matching DOCX compat flag to handle such documents. We can ignore floating table info on the model as a workaround, but that would mean the info is lost on save, so that's not ideal. Instead add a new compat flag that disables fly split at a layout level, which allows both not splitting tables & retaining the model-level info. This commit does the doc model, UNO API, layout & ODT filter, the Word filters are not yet updated. This compat flag is probably quite rare, so introduce a mechanism to only write the compat flag when it's true: this way the majority of the documents don't need to say anything about it and we can assume "false" for them. Also fix two missing xmlTextWriterEndElement() calls in the xml dumper. Change-Id: I32321ec204d7bfe011fcf024b97c906da0db8aae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152190 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmluconv.cxx25
1 files changed, 19 insertions, 6 deletions
diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx
index 7c16b202681f..a95de5ecb66c 100644
--- a/xmloff/source/core/xmluconv.cxx
+++ b/xmloff/source/core/xmluconv.cxx
@@ -49,6 +49,7 @@
#include <basegfx/vector/b3dvector.hxx>
#include <sax/tools/converter.hxx>
+#include <comphelper/sequence.hxx>
using namespace com::sun::star;
@@ -778,7 +779,8 @@ void SvXMLUnitConverter::convertNumLetterSync( OUStringBuffer& rBuffer,
}
void SvXMLUnitConverter::convertPropertySet(uno::Sequence<beans::PropertyValue>& rProps,
- const uno::Reference<beans::XPropertySet>& aProperties)
+ const uno::Reference<beans::XPropertySet>& aProperties,
+ const std::initializer_list<std::u16string_view>* pOmitFalseValues)
{
uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = aProperties->getPropertySetInfo();
if (!xPropertySetInfo.is())
@@ -787,14 +789,25 @@ void SvXMLUnitConverter::convertPropertySet(uno::Sequence<beans::PropertyValue>&
const uno::Sequence< beans::Property > aProps = xPropertySetInfo->getProperties();
if (aProps.hasElements())
{
- rProps.realloc(aProps.getLength());
- beans::PropertyValue* pProps = rProps.getArray();
+ std::vector<beans::PropertyValue> aPropsVec;
for (const auto& rProp : aProps)
{
- pProps->Name = rProp.Name;
- pProps->Value = aProperties->getPropertyValue(rProp.Name);
- ++pProps;
+ uno::Any aPropertyValue = aProperties->getPropertyValue(rProp.Name);
+ if (pOmitFalseValues && aPropertyValue.has<bool>() && !aPropertyValue.get<bool>())
+ {
+ const std::initializer_list<std::u16string_view>& rOmitFalseValues = *pOmitFalseValues;
+ if (std::find(rOmitFalseValues.begin(), rOmitFalseValues.end(), rProp.Name) != rOmitFalseValues.end())
+ {
+ continue;
+ }
+ }
+
+ beans::PropertyValue aValue;
+ aValue.Name = rProp.Name;
+ aValue.Value = aPropertyValue;
+ aPropsVec.push_back(aValue);
}
+ rProps = comphelper::containerToSequence(aPropsVec);
}
}