offapi/com/sun/star/text/BaseFrameProperties.idl |    6 ++++
 sw/qa/core/unocore/unocore.cxx                   |   28 +++++++++++++++++++++++
 sw/source/core/unocore/unomap1.cxx               |    1 
 3 files changed, 35 insertions(+)

New commits:
commit fd3d4d894d96f16a28d5b58c5bcf5a44fb83617f
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Jan 25 09:27:28 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Jan 25 12:40:04 2023 +0000

    sw: add UNO API for multi-page fly frames
    
    This exposes the internal property added in
    0bb90afaeb193181d7b98b79e962549d8a1dd85a (sw: add document model for
    multi-page fly frames, 2023-01-24) on the UNO API.
    
    Change-Id: If9acd2d2130f727bc9481980445c0da01be04729
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146124
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/offapi/com/sun/star/text/BaseFrameProperties.idl 
b/offapi/com/sun/star/text/BaseFrameProperties.idl
index 3108067a0ad5..9b82601c896e 100644
--- a/offapi/com/sun/star/text/BaseFrameProperties.idl
+++ b/offapi/com/sun/star/text/BaseFrameProperties.idl
@@ -373,6 +373,12 @@ published service BaseFrameProperties
     */
     [optional, property] boolean Decorative;
 
+    /** If `TRUE`, the frame is allowed to be split at page breaks.
+
+        @since LibreOffice 7.6
+     */
+    [optional, property] boolean IsSplitAllowed;
+
 };
 
 
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index 0c2da1b0524a..d17b1e19940a 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -28,6 +28,7 @@
 #include <ndtxt.hxx>
 #include <textlinebreak.hxx>
 #include <textcontentcontrol.hxx>
+#include <frmmgr.hxx>
 
 using namespace ::com::sun::star;
 
@@ -902,6 +903,33 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testParagraphMarkerFormattedRun)
         getXPath(pXmlDoc, "//SwParaPortion/SwLineLayout/SwFieldPortion", 
"font-weight"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testFlySplit)
+{
+    // Given a document with a fly frame:
+    createSwDoc();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+    SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT, nullptr);
+    RndStdIds eAnchor = RndStdIds::FLY_AT_PARA;
+    aMgr.InsertFlyFrame(eAnchor, aMgr.GetPos(), aMgr.GetSize());
+    uno::Reference<text::XTextFramesSupplier> xDocument(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> 
xFrame(xDocument->getTextFrames()->getByName("Frame1"),
+                                               uno::UNO_QUERY);
+    bool bIsSplitAllowed{};
+    // Without the accompanying fix in place, this test would have failed with:
+    // An uncaught exception of type 
com.sun.star.beans.UnknownPropertyException
+    // - Unknown property: IsSplitAllowed
+    // i.e. the property was missing.
+    xFrame->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed;
+    CPPUNIT_ASSERT(!bIsSplitAllowed);
+
+    // When marking it as IsSplitAllowed=true:
+    xFrame->setPropertyValue("IsSplitAllowed", uno::Any(true));
+
+    // Then make sure that IsSplitAllowed is true when asking back:
+    xFrame->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed;
+    CPPUNIT_ASSERT(bIsSplitAllowed);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unomap1.cxx 
b/sw/source/core/unocore/unomap1.cxx
index e5fcd7779607..2d4dc92af0cd 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -772,6 +772,7 @@ o3tl::span<const SfxItemPropertyMapEntry> 
SwUnoPropertyMapProvider::GetFrameProp
         { UNO_NAME_SIZE_TYPE, RES_FRM_SIZE,           
cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE,   
MID_FRMSIZE_SIZE_TYPE  },
         { UNO_NAME_WIDTH_TYPE, RES_FRM_SIZE,          
cppu::UnoType<sal_Int16>::get()  ,         PROPERTY_NONE,   
MID_FRMSIZE_WIDTH_TYPE },
         { UNO_NAME_WRITING_MODE, RES_FRAMEDIR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 },
+        { UNO_NAME_IS_SPLIT_ALLOWED, RES_FLY_SPLIT, 
cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, 0 },
 
         // added FillProperties for SW, same as FILL_PROPERTIES in svx
         // but need own defines in Writer due to later association of strings

Reply via email to