diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 3b45568e7d24..7c6cea0482d3 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3511,6 +3511,8 @@ namespace xmloff::token {
XML_FILL_USE_SLIDE_BACKGROUND,
+ XML_MAY_BREAK_BETWEEN_PAGES,
+
XML_TOKEN_END
};
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index c0658b570f5d..f0e242081ae0 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -3477,13 +3477,19 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
-
+
+
+
+
+
+
+
diff --git a/xmloff/qa/unit/data/floattable.fodt b/xmloff/qa/unit/data/floattable.fodt
new file mode 100644
index 000000000000..927d14b757e9
--- /dev/null
+++ b/xmloff/qa/unit/data/floattable.fodt
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A1A2anchor text
+
+
+
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index 5dfd52010a09..ded7196be09b 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -17,6 +17,7 @@
#include
#include
#include
+#include
#include
#include
@@ -956,6 +957,56 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testThemeExport)
"#c0c0c0");
}
+CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFloatingTableExport)
+{
+ // Given a document with a floating table:
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ // Insert a table:
+ uno::Sequence aArgs = {
+ comphelper::makePropertyValue("Rows", static_cast(1)),
+ comphelper::makePropertyValue("Columns", static_cast(1)),
+ };
+ dispatchCommand(mxComponent, ".uno:InsertTable", aArgs);
+ // Select it:
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ // Wrap in a fly:
+ aArgs = {
+ comphelper::makePropertyValue("AnchorType", static_cast(0)),
+ };
+ dispatchCommand(mxComponent, ".uno:InsertFrame", aArgs);
+ // Mark it as a floating table:
+ uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference xFrame(
+ xTextFramesSupplier->getTextFrames()->getByName("Frame1"), uno::UNO_QUERY);
+ xFrame->setPropertyValue("IsSplitAllowed", uno::Any(true));
+
+ // When saving to ODT:
+ save("writer8");
+
+ // Then make sure we write a floating table, not a textframe containing a table:
+ xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
+ // Without the accompanying fix in place, this test would have failed with:
+ // - XPath '//draw:frame' no attribute 'may-break-between-pages' exist
+ // i.e. no floating table was exported.
+ assertXPath(pXmlDoc, "//draw:frame", "may-break-between-pages", "true");
+}
+
+CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFloatingTableImport)
+{
+ // Given a document with a floating table (loext:may-break-between-pages="true"), when importing
+ // that document:
+ loadFromURL(u"floattable.fodt");
+
+ // Then make sure that the matching text frame property is set:
+ uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference xFrame(
+ xTextFramesSupplier->getTextFrames()->getByName("Frame1"), uno::UNO_QUERY);
+ bool bIsSplitAllowed = false;
+ // Without the accompanying fix in place, this test would have failed, the property was false.
+ xFrame->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed;
+ CPPUNIT_ASSERT(bIsSplitAllowed);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 78ef34951013..7eb6f14eee54 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3514,6 +3514,8 @@ namespace xmloff::token {
TOKEN("fill-use-slide-background", XML_FILL_USE_SLIDE_BACKGROUND),
+ TOKEN("may-break-between-pages", XML_MAY_BREAK_BETWEEN_PAGES),
+
#if OSL_DEBUG_LEVEL > 0
{ 0, nullptr, std::nullopt, XML_TOKEN_END }
#else
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index ad0754acfca2..bd145b5213cd 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -370,6 +370,7 @@ class XMLTextFrameContext_Impl : public SvXMLImportContext
bool bOwnBase64Stream : 1;
bool mbMultipleContent : 1; // This context is created based on a multiple content (image)
bool m_isDecorative = false;
+ bool m_isSplitAllowed = false;
void Create();
@@ -687,6 +688,11 @@ void XMLTextFrameContext_Impl::Create()
xPropSet->setPropertyValue("Decorative", uno::Any(true));
}
+ if (m_isSplitAllowed && xPropSetInfo->hasPropertyByName("IsSplitAllowed"))
+ {
+ xPropSet->setPropertyValue("IsSplitAllowed", uno::Any(true));
+ }
+
if( XML_TEXT_FRAME_OBJECT != nType &&
XML_TEXT_FRAME_OBJECT_OLE != nType &&
XML_TEXT_FRAME_APPLET != nType &&
@@ -1073,6 +1079,10 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
case XML_ELEMENT(DRAW, XML_DECORATIVE):
::sax::Converter::convertBool(m_isDecorative, aIter.toString());
break;
+ case XML_ELEMENT(LO_EXT, XML_MAY_BREAK_BETWEEN_PAGES):
+ case XML_ELEMENT(DRAW, XML_MAY_BREAK_BETWEEN_PAGES):
+ sax::Converter::convertBool(m_isSplitAllowed, aIter.toString());
+ break;
default:
SAL_INFO("xmloff", "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(aIter.getToken()) << " value=" << aIter.toString());
}
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 4775fbad9152..4b930e73a0b6 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -3015,6 +3015,12 @@ XMLShapeExportFlags XMLTextParagraphExport::addTextFrameAttributes(
GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_DECORATIVE, XML_TRUE);
}
+ if (xPropSetInfo->hasPropertyByName("IsSplitAllowed")
+ && rPropSet->getPropertyValue("IsSplitAllowed").get())
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_MAY_BREAK_BETWEEN_PAGES, XML_TRUE);
+ }
+
return nShapeFeatures;
}
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 74a725d91b30..576efe9b8bd5 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -3255,4 +3255,5 @@ plain-text
alias
tag
fill-use-slide-background
+may-break-between-pages
TOKEN_END_DUMMY