[Libreoffice-commits] core.git: offapi/com sw/inc sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 30 14:00:15 UTC 2019
offapi/com/sun/star/text/TextFrame.idl | 8 ++++++++
sw/inc/unoframe.hxx | 1 +
sw/qa/extras/odfexport/data/user-field-decl-fly.odt |binary
sw/qa/extras/odfexport/odfexport.cxx | 9 +++++++++
sw/source/core/unocore/unoframe.cxx | 12 ++++++++++++
sw/source/core/unocore/unomapproperties.hxx | 1 +
6 files changed, 31 insertions(+)
New commits:
commit 6f179ce5c5469d1c53e4bb7736384b2d9ce51926
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu May 30 14:56:40 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu May 30 15:59:03 2019 +0200
ODT export: fix lost <text:user-field-decl> for fields in frames in headers
This is similar to commit 6bb241ccc61c6904efec95978fa17e33c0eb1df3 (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/73205
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
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
new file mode 100644
index 000000000000..2ffe3ae55532
Binary files /dev/null and b/sw/qa/extras/odfexport/data/user-field-decl-fly.odt differ
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}, \
More information about the Libreoffice-commits
mailing list