summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-11-24 08:41:07 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-11-24 10:05:38 +0100
commita596070f8ac11ed0cd22baf55704037a6b8d9c4d (patch)
tree1d0e0ad758de16f109810207e1e4bfdd341e1f9e
parent9b5b313a2f2980f9a10295aabdd696f58af03302 (diff)
sw floattable, per-frame wrap-on-all-pages mode: add UNO API
This exposes the internal property SwFormatWrapTextAtFlyStart on the UNO API. We need this, because otherwise the ODT filter can't read/write it. Change-Id: I67d3c28e3531b19183f8361a6df87b7a4ca84294 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159888 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--offapi/com/sun/star/text/BaseFrameProperties.idl6
-rw-r--r--sw/inc/unoprnms.hxx1
-rw-r--r--sw/qa/core/unocore/unocore.cxx27
-rw-r--r--sw/source/core/unocore/unoframe.cxx10
-rw-r--r--sw/source/core/unocore/unomap1.cxx1
5 files changed, 45 insertions, 0 deletions
diff --git a/offapi/com/sun/star/text/BaseFrameProperties.idl b/offapi/com/sun/star/text/BaseFrameProperties.idl
index 9b82601c896e..84c78732e8b3 100644
--- a/offapi/com/sun/star/text/BaseFrameProperties.idl
+++ b/offapi/com/sun/star/text/BaseFrameProperties.idl
@@ -379,6 +379,12 @@ published service BaseFrameProperties
*/
[optional, property] boolean IsSplitAllowed;
+ /** If `TRUE`, text wraps around a split fly on all pages.
+
+ @since LibreOffice 24.2
+ */
+ [optional, property] boolean WrapTextAtFlyStart;
+
};
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index e83b1b601ef4..2c98a87dba5a 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -760,6 +760,7 @@ inline constexpr OUString UNO_NAME_PARA_IS_CONNECT_BORDER = u"ParaIsConnectBorde
inline constexpr OUString UNO_NAME_ITEMS = u"Items"_ustr;
inline constexpr OUString UNO_NAME_SELITEM = u"SelectedItem"_ustr;
inline constexpr OUString UNO_NAME_IS_SPLIT_ALLOWED = u"IsSplitAllowed"_ustr;
+inline constexpr OUString UNO_NAME_WRAP_TEXT_AT_FLY_START = u"WrapTextAtFlyStart"_ustr;
inline constexpr OUString UNO_NAME_HAS_TEXT_CHANGES_ONLY = u"HasTextChangesOnly"_ustr;
inline constexpr OUString UNO_NAME_CHAR_HIDDEN = u"CharHidden"_ustr;
inline constexpr OUString UNO_NAME_IS_FOLLOWING_TEXT_FLOW = u"IsFollowingTextFlow"_ustr;
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index 00c61a042b77..381fe0dab3e2 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -1031,6 +1031,33 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf108272Crash)
createSwDoc("tdf108272-1-minimal.docx");
}
+CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testWrapTextAtFlyStart)
+{
+ // 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 bWrapTextAtFlyStart{};
+ // Without the accompanying fix in place, this test would have failed with:
+ // An uncaught exception of type com.sun.star.beans.UnknownPropertyException
+ // - Unknown property: WrapTextAtFlyStart
+ // i.e. the property was missing.
+ xFrame->getPropertyValue("WrapTextAtFlyStart") >>= bWrapTextAtFlyStart;
+ CPPUNIT_ASSERT(!bWrapTextAtFlyStart);
+
+ // When marking it as WrapTextAtFlyStart=true:
+ xFrame->setPropertyValue("WrapTextAtFlyStart", uno::Any(true));
+
+ // Then make sure that WrapTextAtFlyStart is true when asking back:
+ xFrame->getPropertyValue("WrapTextAtFlyStart") >>= bWrapTextAtFlyStart;
+ CPPUNIT_ASSERT(bWrapTextAtFlyStart);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 632b57698702..7880a749b95c 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -135,6 +135,7 @@
#include <swunohelper.hxx>
#include <fefly.hxx>
#include <formatflysplit.hxx>
+#include <formatwraptextatflystart.hxx>
using namespace ::com::sun::star;
@@ -971,6 +972,15 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
rToSet.Put(aSplit);
}
+ const ::uno::Any* pWrapTextAtFlyStart = nullptr;
+ GetProperty(RES_WRAP_TEXT_AT_FLY_START, 0, pWrapTextAtFlyStart);
+ if (pWrapTextAtFlyStart)
+ {
+ SwFormatWrapTextAtFlyStart aWrapTextAtFlyStart(true);
+ bRet &= aWrapTextAtFlyStart.PutValue(*pWrapTextAtFlyStart, 0);
+ rToSet.Put(aWrapTextAtFlyStart);
+ }
+
return bRet;
}
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 2db6cadc4d3f..ee4422a22e9d 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -802,6 +802,7 @@ std::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetFramePrope
{ 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 },
+ { UNO_NAME_WRAP_TEXT_AT_FLY_START, RES_WRAP_TEXT_AT_FLY_START, 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