tdf#171527 docx export: allow flies inside framePr

Normally, MS Word does not allow a fly
to be anchored inside of a fly.

But framePr is different.
It is a paragraph property, not a container.

So remove the restriction that forced inline flies.
It looks like a copy/paste
during the original implementation in tdf#78590.

make CppunitTest_sw_ooxmlexport13 CPPUNIT_TEST_NAME=testFlyInFly

Change-Id: Ie3c52f905dd709ce79a8fb5abd9476b475d82bdd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202890
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
This commit is contained in:
Justin Luth
2026-03-28 00:00:00 +01:00
parent 51cd5a9ad4
commit afe2550dbd
2 changed files with 9 additions and 4 deletions
+9 -3
View File
@@ -23,6 +23,7 @@
#include <comphelper/sequenceashashmap.hxx>
#include <editsh.hxx>
#include <fmtanchr.hxx>
#include <frmatr.hxx>
#include <frameformats.hxx>
#include <unotxdoc.hxx>
@@ -35,19 +36,24 @@ public:
Test() : SwModelTestBase(u"/sw/qa/extras/ooxmlexport/data/"_ustr) {}
};
// TODO: the re-import doesn't work just yet, but that isn't a regression...
CPPUNIT_TEST_FIXTURE(Test, testFlyInFly)
{
createSwDoc("ooo39250-1-min.rtf");
save(TestFilter::DOCX);
saveAndReload(TestFilter::DOCX);
// check that anchor of text frame is in other text frame
uno::Reference<text::XTextContent> const xAnchored(getShape(3), uno::UNO_QUERY);
CPPUNIT_ASSERT(xAnchored.is());
CPPUNIT_ASSERT_EQUAL(u"Frame1"_ustr/*generated name*/, uno::Reference<container::XNamed>(xAnchored, uno::UNO_QUERY_THROW)->getName());
// generated name
OUString sName = uno::Reference<container::XNamed>(xAnchored, uno::UNO_QUERY_THROW)->getName();
CPPUNIT_ASSERT(sName == u"Frame1" || sName == u"Frame 1");
uno::Reference<text::XText> const xAnchorText(xAnchored->getAnchor()->getText());
uno::Reference<text::XTextFrame> const xAnchorFrame(xAnchorText, uno::UNO_QUERY);
CPPUNIT_ASSERT(xAnchorFrame.is());
CPPUNIT_ASSERT_EQUAL(u"Frame3"_ustr, uno::Reference<container::XNamed>(xAnchorFrame, uno::UNO_QUERY_THROW)->getName());
// All frames are floating frames - not inline
for (auto& pSpz : *getSwDoc()->GetSpzFrameFormats())
CPPUNIT_ASSERT(RndStdIds::FLY_AS_CHAR != pSpz->GetAnchor().GetAnchorId());
}
DECLARE_OOXMLEXPORT_TEST(testTdf125778_lostPageBreakTOX, "tdf125778_lostPageBreakTOX.docx")
-1
View File
@@ -1742,7 +1742,6 @@ void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame)
ExportDataSaveRestore aDataGuard(m_pImpl->getExport(), nStt, nEnd, pParentFrame);
m_pImpl->setBodyPrAttrList(sax_fastparser::FastSerializerHelper::createAttrList().get());
::comphelper::FlagRestorationGuard const g(m_pImpl->m_bFlyFrameGraphic, true);
comphelper::ValueRestorationGuard vg(m_pImpl->getExport().m_nTextTyp, TXT_TXTBOX);
m_pImpl->getExport().WriteText();
}