Kaydet (Commit) 6f179ce5 authored tarafından Miklos Vajna's avatar Miklos Vajna

ODT export: fix lost <text:user-field-decl> for fields in frames in headers

This is similar to commit 6bb241cc (ODT
export: fix lost <text:user-field-decl> for fields in tables in headers,
2019-05-29), but here the container we want to ignore (between the
header and the field) is a text frame, not a table cell.

Change-Id: I6e8006fbd666802070cfeb88ca4528c66cc6d559
Reviewed-on: https://gerrit.libreoffice.org/73205Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
üst 831de14f
......@@ -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;
};
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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}, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment