summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data/textfield-getanchor-gettext-in-footer.odtbin0 -> 8966 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx13
-rw-r--r--sw/source/core/unocore/unoobj2.cxx16
3 files changed, 26 insertions, 3 deletions
diff --git a/sw/qa/extras/uiwriter/data/textfield-getanchor-gettext-in-footer.odt b/sw/qa/extras/uiwriter/data/textfield-getanchor-gettext-in-footer.odt
new file mode 100644
index 000000000000..5089ae8afb5e
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/textfield-getanchor-gettext-in-footer.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index a0d5f66549a0..8cbfc338e013 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -194,6 +194,7 @@ public:
void testShapeTextboxAutosize();
void testFdo82191();
void testCommentedWord();
+ void testTextFieldGetAnchorGetTextInFooter();
void testChineseConversionBlank();
void testChineseConversionNonChineseText();
void testChineseConversionTraditionalToSimplified();
@@ -400,6 +401,7 @@ public:
CPPUNIT_TEST(testShapeTextboxAutosize);
CPPUNIT_TEST(testFdo82191);
CPPUNIT_TEST(testCommentedWord);
+ CPPUNIT_TEST(testTextFieldGetAnchorGetTextInFooter);
CPPUNIT_TEST(testChineseConversionBlank);
CPPUNIT_TEST(testChineseConversionNonChineseText);
CPPUNIT_TEST(testChineseConversionTraditionalToSimplified);
@@ -1428,6 +1430,17 @@ void SwUiWriterTest::testCommentedWord()
CPPUNIT_ASSERT_EQUAL(OUString("word"), xField->getAnchor()->getString());
}
+void SwUiWriterTest::testTextFieldGetAnchorGetTextInFooter() {
+ createDoc("textfield-getanchor-gettext-in-footer.odt");
+
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+ uno::Reference<text::XTextContent> xField(xFields->nextElement(), uno::UNO_QUERY);
+
+ OUString value = xField->getAnchor()->getText()->getString();
+ CPPUNIT_ASSERT_EQUAL(OUString("userfield_in_footer"), value );
+}
// Chinese conversion tests
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 66588a58919d..a4708d249970 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1111,15 +1111,25 @@ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos)
for(size_t i = 0; i < nPDescCount; i++)
{
const SwPageDesc& rDesc = rDoc.GetPageDesc( i );
+
const SwFrameFormat* pFrameFormatMaster = &rDesc.GetMaster();
const SwFrameFormat* pFrameFormatLeft = &rDesc.GetLeft();
+ const SwFrameFormat* pFrameFormatFirstMaster = &rDesc.GetFirstMaster();
+ const SwFrameFormat* pFrameFormatFirstLeft = &rDesc.GetFirstLeft();
SwFrameFormat* pHeadFootFormat = nullptr;
if (!lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrameFormatMaster,
- pHeadFootFormat))
+ pHeadFootFormat))
{
- lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrameFormatLeft,
- pHeadFootFormat);
+ if (!lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrameFormatLeft,
+ pHeadFootFormat))
+ {
+ if (!lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrameFormatFirstMaster,
+ pHeadFootFormat))
+ {
+ lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrameFormatFirstLeft, pHeadFootFormat);
+ }
+ }
}
if (pHeadFootFormat)