diff options
-rw-r--r-- | offapi/com/sun/star/text/TextFrame.idl | 8 | ||||
-rw-r--r-- | sw/inc/unoframe.hxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/data/user-field-decl-fly.odt | bin | 0 -> 9167 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/unocore/unoframe.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/unocore/unomapproperties.hxx | 1 |
6 files changed, 31 insertions, 0 deletions
diff --git a/offapi/com/sun/star/text/TextFrame.idl b/offapi/com/sun/star/text/TextFrame.idl index 68a73141b1fd..44f4139d92f7 100644 --- a/offapi/com/sun/star/text/TextFrame.idl +++ b/offapi/com/sun/star/text/TextFrame.idl @@ -142,6 +142,14 @@ published service TextFrame @since LibreOffice 4.3 */ [optional, property] com::sun::star::drawing::TextVerticalAdjust TextVerticalAdjust; + + /** Parent text of this text frame. + + This might be a header text, body text, etc. + + @since LibreOffice 6.3 + */ + [optional, readonly, property] com::sun::star::text::XText ParentText; }; diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index 8751e7806480..207fbaac7414 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -75,6 +75,7 @@ private: sal_Int64 m_nDrawAspect; sal_Int64 m_nVisibleAreaWidth; sal_Int64 m_nVisibleAreaHeight; + css::uno::Reference<css::text::XText> m_xParentText; protected: css::uno::Reference< css::beans::XPropertySet > mxStyleData; diff --git a/sw/qa/extras/odfexport/data/user-field-decl-fly.odt b/sw/qa/extras/odfexport/data/user-field-decl-fly.odt Binary files differnew file mode 100644 index 000000000000..2ffe3ae55532 --- /dev/null +++ b/sw/qa/extras/odfexport/data/user-field-decl-fly.odt diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 8725efcc500b..4c17893e2310 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -260,6 +260,15 @@ DECLARE_ODFEXPORT_TEST(testUserFieldDecl, "user-field-decl.odt") assertXPath(pXmlDoc, "//style:header/text:user-field-decls/text:user-field-decl", 2); } +DECLARE_ODFEXPORT_TEST(testUserFieldDeclFly, "user-field-decl-fly.odt") +{ + if (xmlDocPtr pXmlDoc = parseExport("styles.xml")) + // Without the accompanying fix in place, this test would have failed with 'Expected: 2; + // Actual: 1', i.e. the in-textframe field had no declaration (in the header), while the + // outside-textframe one had the declaration. + assertXPath(pXmlDoc, "//style:header/text:user-field-decls/text:user-field-decl", 2); +} + DECLARE_ODFEXPORT_TEST(testFramebackgrounds, "framebackgrounds.odt") { //Counting the Number of Frames and checking with the expected count diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index b9806727394e..ea377f2e058e 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2239,6 +2239,18 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) aAny <<= awt::Size( aMM100Size.Width(), aMM100Size.Height() ); } } + else if(pEntry->nWID == FN_UNO_PARENT_TEXT) + { + if (!m_xParentText.is()) + { + const SwPosition* pContentAnchor = pFormat->GetAnchor().GetContentAnchor(); + if (pContentAnchor) + { + m_xParentText = sw::CreateParentXText(*pFormat->GetDoc(), *pContentAnchor); + } + } + aAny <<= m_xParentText; + } else { // standard UNO API read attributes diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx index 2c95e73326b3..549f97cbee70 100644 --- a/sw/source/core/unocore/unomapproperties.hxx +++ b/sw/source/core/unocore/unomapproperties.hxx @@ -322,6 +322,7 @@ { OUString(UNO_NAME_Z_ORDER), FN_UNO_Z_ORDER, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, 0}, \ { OUString(UNO_NAME_IS_FOLLOWING_TEXT_FLOW), RES_FOLLOW_TEXT_FLOW, cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_FOLLOW_TEXT_FLOW}, \ { OUString(UNO_NAME_IS_LAYOUT_IN_CELL), RES_FOLLOW_TEXT_FLOW, cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_FTF_LAYOUT_IN_CELL}, \ + { OUString(UNO_NAME_PARENT_TEXT), FN_UNO_PARENT_TEXT, cppu::UnoType<text::XText>::get(), PropertyAttribute::MAYBEVOID | PropertyAttribute::READONLY, 0 }, \ { OUString(UNO_NAME_WRAP_INFLUENCE_ON_POSITION), RES_WRAP_INFLUENCE_ON_OBJPOS, cppu::UnoType<sal_Int8>::get(), PROPERTY_NONE, MID_WRAP_INFLUENCE}, \ { OUString(UNO_NAME_TITLE), FN_UNO_TITLE, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, \ { OUString(UNO_NAME_DESCRIPTION), FN_UNO_DESCRIPTION, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0}, \ |