sw/qa/extras/ooxmlexport/data/tdf146984_anchorInShape.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx                 |   11 +++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx               |    2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 949b2bbbaaa9bd21b6882dab49ea2018a08d2362
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Wed Mar 15 07:54:53 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Mar 15 13:54:37 2023 +0000

    tdf#146984 writerfilter inline_inline: no break in shape
    
    Change-Id: I94efea80df1fee9ecd338bfec3430edfdf418e3c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148918
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf146984_anchorInShape.docx 
b/sw/qa/extras/ooxmlexport/data/tdf146984_anchorInShape.docx
new file mode 100644
index 000000000000..38fcaf9abeb9
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf146984_anchorInShape.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index c30e555ae15e..b19c196016b2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -135,6 +135,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104394_lostTextbox, 
"tdf104394_lostTextbox.docx"
     CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf146984_anchorInShape, 
"tdf146984_anchorInShape.docx")
+{
+    // This was only one page b/c the page break was missing.
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+
+    const auto& pLayout = parseLayoutDump();
+    // There are shapes on both pages - these should be non-zero numbers
+    assertXPath(pLayout, "//page[1]//anchored", 3);
+    assertXPath(pLayout, "//page[2]//anchored", 2);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf154129_framePr1, "tdf154129_framePr1.docx")
 {
     for (size_t i = 1; i < 4; ++i)
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 800ae2525060..9db58e721a1b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2569,7 +2569,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
             break;
         //tdf112342: Break before images as well, if there are page break
         if (m_pImpl->isBreakDeferred(BreakType::PAGE_BREAK)
-            && nSprmId == NS_ooxml::LN_inline_inline)
+            && nSprmId == NS_ooxml::LN_inline_inline && !m_pImpl->IsInShape())
         {
             if (m_pImpl->GetIsFirstParagraphInSection() || 
!m_pImpl->IsFirstRun())
             {

Reply via email to