download.lst                                     |   10 -
 sc/inc/table.hxx                                 |    2 
 sc/source/core/data/document.cxx                 |   12 +
 sc/source/core/data/table2.cxx                   |   15 ++
 svx/source/xml/xmlgrhlp.cxx                      |    3 
 sw/inc/swrect.hxx                                |    3 
 sw/qa/extras/layout/data/keep-with-next-fly.fodt |  146 +++++++++++++++++++++++
 sw/qa/extras/layout/layout.cxx                   |   52 ++++++++
 sw/source/core/bastyp/swrect.cxx                 |   12 +
 sw/source/core/layout/flowfrm.cxx                |   12 +
 sw/source/core/text/xmldump.cxx                  |   23 +--
 11 files changed, 266 insertions(+), 24 deletions(-)

New commits:
commit bd4adff19560c49a76f7ed1b32eca13feff74d9e
Author:     Michael Stahl <[email protected]>
AuthorDate: Mon Feb 21 11:33:21 2022 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Feb 21 18:08:37 2022 +0100

    libxml2: upgrade to release 2.9.13
    
    Fixes CVE-2022-23308
    
    Change-Id: I1b3bf5cf58d7d1f39c224b0d898176c95107fbf5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130241
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit d50a7151431335d1431bccef000ae39f84bdf135)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130259
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/download.lst b/download.lst
index 3c783ed0ddf7..0b627e58771c 100644
--- a/download.lst
+++ b/download.lst
@@ -156,9 +156,9 @@ export LIBTOMMATH_SHA256SUM := 
083daa92d8ee6f4af96a6143b12d7fc8fe1a547e14f862304
 export LIBTOMMATH_TARBALL := ltm-1.0.zip
 export XMLSEC_SHA256SUM := 
13eec4811ea30e3f0e16a734d1dbf7f9d246a71d540b48d143a07b489f6222d4
 export XMLSEC_TARBALL := xmlsec1-1.2.28.tar.gz
-export LIBXML_SHA256SUM := 
c8d6681e38c56f172892c85ddc0852e1fd4b53b4209e7f4ebf17f7e2eae71d92
-export LIBXML_VERSION_MICRO := 12
-export LIBXML_TARBALL := libxml2-2.9.$(LIBXML_VERSION_MICRO).tar.gz
+export LIBXML_SHA256SUM := 
276130602d12fe484ecc03447ee5e759d0465558fbc9d6bd144e3745306ebf0e
+export LIBXML_VERSION_MICRO := 13
+export LIBXML_TARBALL := libxml2-2.9.$(LIBXML_VERSION_MICRO).tar.xz
 export LIBXSLT_SHA256SUM := 
8247f33e9a872c6ac859aa45018bc4c4d00b97e2feac9eebc10c93ce1f34dd79
 export LIBXSLT_VERSION_MICRO := 35
 export LIBXSLT_TARBALL := libxslt-1.1.$(LIBXSLT_VERSION_MICRO).tar.xz
commit 1ffcabd14194b1fdd6708d5623104e6e8fcaf106
Author:     Luboš Luňák <[email protected]>
AuthorDate: Thu Feb 17 15:27:59 2022 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Feb 21 17:09:26 2022 +0100

    fix range checking in calls like ScDocument::GetNote()
    
    Change-Id: I5612e765b3484b0515f4a16030ee19133ae3126a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130076
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <[email protected]>
    (cherry picked from commit 957d99a539df6e21fd40370938ca5dab1613cf8c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130105
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit 77bef67094579e7d0d2a515f5f8a5def8abe49e8)

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index b2fca017608f..96702d1213e0 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -461,6 +461,8 @@ public:
     void        GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
 
     std::unique_ptr<ScPostIt> ReleaseNote( SCCOL nCol, SCROW nRow );
+    ScPostIt*                 GetNote( SCCOL nCol, SCROW nRow );
+    void                      SetNote( SCCOL nCol, SCROW nRow, 
std::unique_ptr<ScPostIt> pNote );
 
     size_t GetNoteCount( SCCOL nCol ) const;
     SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 106360e2a14d..725f6918411a 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6494,9 +6494,8 @@ ScPostIt* ScDocument::GetNote(const ScAddress& rPos)
 
 ScPostIt* ScDocument::GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab)
 {
-    if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) &&
-        nCol < maTabs[nTab]->GetAllocatedColumnsCount())
-        return maTabs[nTab]->aCol[nCol].GetCellNote(nRow);
+    if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
+        return maTabs[nTab]->GetNote(nCol, nRow);
     else
         return nullptr;
 
@@ -6509,7 +6508,8 @@ void ScDocument::SetNote(const ScAddress& rPos, 
std::unique_ptr<ScPostIt> pNote)
 
 void ScDocument::SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, 
std::unique_ptr<ScPostIt> pNote)
 {
-    return maTabs[nTab]->CreateColumnIfNotExists(nCol).SetCellNote(nRow, 
std::move(pNote));
+    if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
+        maTabs[nTab]->SetNote(nCol, nRow, std::move(pNote));
 }
 
 bool ScDocument::HasNote(const ScAddress& rPos) const
@@ -6542,6 +6542,9 @@ bool ScDocument::HasColNotes(SCCOL nCol, SCTAB nTab) const
     if (!pTab)
         return false;
 
+    if (nCol >= pTab->GetAllocatedColumnsCount())
+        return false;
+
     return pTab->aCol[nCol].HasCellNotes();
 }
 
@@ -6585,6 +6588,7 @@ ScPostIt* ScDocument::GetOrCreateNote(const ScAddress& 
rPos)
     else
         return CreateNote(rPos);
 }
+
 ScPostIt* ScDocument::CreateNote(const ScAddress& rPos)
 {
     ScPostIt* pPostIt = new ScPostIt(*this, rPos);
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 3d1a1aabad37..2085e623f932 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1651,6 +1651,21 @@ std::unique_ptr<ScPostIt> ScTable::ReleaseNote( SCCOL 
nCol, SCROW nRow )
     return aCol[nCol].ReleaseNote(nRow);
 }
 
+ScPostIt* ScTable::GetNote( SCCOL nCol, SCROW nRow )
+{
+    if (!ValidCol(nCol) || nCol >= GetAllocatedColumnsCount())
+        return nullptr;
+    return aCol[nCol].GetCellNote(nRow);
+}
+
+void ScTable::SetNote( SCCOL nCol, SCROW nRow, std::unique_ptr<ScPostIt> pNote 
)
+{
+    if (!ValidColRow(nCol, nRow))
+        return;
+
+    CreateColumnIfNotExists(nCol).SetCellNote(nRow, std::move(pNote));
+}
+
 size_t ScTable::GetNoteCount( SCCOL nCol ) const
 {
     if (!ValidCol(nCol) || nCol >= GetAllocatedColumnsCount())
commit bee7912d6130a01cc9c0d55576974ea4d9f18d91
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Feb 19 16:53:58 2022 +0000
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Feb 21 17:09:26 2022 +0100

    upgrade to expat 2.4.6
    
    CVE-2022-25235
    CVE-2022-25236
    CVE-2022-25313
    CVE-2022-25314
    CVE-2022-25315
    
    Change-Id: I1cb0449411fe938fe47ab47cead685fd04e137dd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130157
    Reviewed-by: Michael Stahl <[email protected]>
    Reviewed-by: Xisco Fauli <[email protected]>
    Reviewed-by: Christian Lohmaier <[email protected]>
    Tested-by: Christian Lohmaier <[email protected]>

diff --git a/download.lst b/download.lst
index daa41034720c..3c783ed0ddf7 100644
--- a/download.lst
+++ b/download.lst
@@ -40,8 +40,8 @@ export EPUBGEN_TARBALL := libepubgen-0.1.1.tar.xz
 export ETONYEK_SHA256SUM := 
e61677e8799ce6e55b25afc11aa5339113f6a49cff031f336e32fa58635b1a4a
 export ETONYEK_VERSION_MICRO := 9
 export ETONYEK_TARBALL := libetonyek-0.1.$(ETONYEK_VERSION_MICRO).tar.xz
-export EXPAT_SHA256SUM := 
5963005ff8720735beb2d2db669afc681adcbcb43dd1eb397d5c2dd7adbc631f
-export EXPAT_TARBALL := expat-2.4.4.tar.gz
+export EXPAT_SHA256SUM := 
de55794b7a9bc214852fdc075beaaecd854efe1361597e6268ee87946951289b
+export EXPAT_TARBALL := expat-2.4.6.tar.xz
 export FIREBIRD_SHA256SUM := 
6994be3555e23226630c587444be19d309b25b0fcf1f87df3b4e3f88943e5860
 export FIREBIRD_TARBALL := Firebird-3.0.0.32483-0.tar.bz2
 export FONTCONFIG_SHA256SUM := 
cf0c30807d08f6a28ab46c61b8dbd55c97d2f292cf88f3a07d3384687f31f017
commit 5350aaaff6742abdf631b805510578e961982b49
Author:     Michael Stahl <[email protected]>
AuthorDate: Wed Feb 16 17:32:15 2022 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Feb 21 17:09:26 2022 +0100

    sw: layout: allow keep-with-next paragraph with fly to move back
    
    The problem is that a paragraph that has the fo:keep-with-next="always"
    and also a fly anchored at-char or at-para with style:flow-with-text="true"
    will never move to the previous page, even with space available.
    
    In SwContentFrame::MakeAll() it will first MoveBwd() and then go into
    the special case "if ( bKeep && bMoveable )" which calls Calc() on the
    next frame.
    
    But this fails to move the next frame because of 
SwFlowFrame::IsPrevObjMove()
    finding the fly with a mis-matching mpVertPosOrientFrame - that will not
    be fixed until the first SwContentFrame::MakeAll() is done and
    SwObjectFormatter::FormatObjsAtFrame() is called.
    
    But SwContentFrame::MakeAll() first detects that the frame is not on
    the same page as the next one despite bKeep, so it MoveFwd() again.
    
    This happens already in OOo 3.3.
    
    IsJoinLocked() should be a reasonably good heuristic for "is the
    previous frame being formatted".
    
    Change-Id: I86996dcb3d0c46fcb99ec9ad463569abbb8b99f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130033
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 38e7c18188f1c5310898181db87686774be3c040)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130014
    Reviewed-by: Thorsten Behrens <[email protected]>
    (cherry picked from commit 58c28725b2b34941ae4f6afa7689c0d0ebde0be7)

diff --git a/sw/qa/extras/layout/data/keep-with-next-fly.fodt 
b/sw/qa/extras/layout/data/keep-with-next-fly.fodt
new file mode 100644
index 000000000000..13d6785f4e1f
--- /dev/null
+++ b/sw/qa/extras/layout/data/keep-with-next-fly.fodt
@@ -0,0 +1,146 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<office:document xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns
 :config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
 n:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:xforms="http://www.w3.org/2002/xforms"; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:creation-date>2022-02-16T15:01:24.088191425</meta:creation-date><dc:date>2022-02-16T15:16:50.103419678</dc:date><meta:editing-duration>PT15M29S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic
 meta:table-count="0" meta:image-count="1" meta:object-count="0" 
meta:page-count="2" meta:paragraph-count="1" meta:word-count="5" 
meta:character-count="26" 
meta:non-whitespace-character-count="22"/><meta:generator>LibreOfficeDev/7.4.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/16748887dd277bd63034e07b5e2a86740235b315</meta:generator></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation 
Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Lohit Devanagari1" svg:font-family="'Lohit 
Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Source Han Serif CN" svg:font-family="'Source 
Han Serif CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <draw:gradient draw:name="gradient" draw:style="linear" 
draw:start-color="#000000" draw:end-color="#ffffff" draw:start-intensity="100%" 
draw:end-intensity="100%" draw:angle="0deg" draw:border="0%"/>
+  <draw:hatch draw:name="hatch" draw:style="single" draw:color="#3465a4" 
draw:distance="0.02cm" draw:rotation="0"/>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" 
draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" 
draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" 
draw:start-line-spacing-vertical="0.283cm" 
draw:end-line-spacing-horizontal="0.283cm" 
draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" 
style:line-break="strict" style:writing-mode="lr-tb" 
style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" loext:color-lum-mod="100%" loext:color-lum-off="0%" 
style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" 
fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han 
Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" 
style:country-asian="CN" style:font-name-complex="Lohit Devanagari1" 
style:font-size-complex="12pt" style:language-complex="hi" 
style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" 
fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" 
style:punctuation-wrap="hanging" style:line-break="strict" 
style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" 
loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" 
fo:language="de" fo:country="DE" style:letter-kerning="true" 
style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" 
style:language-asian="zh" style:country-asian="CN" 
style:font-name-complex="Lohit Devanagari1" style:font-size-complex="12pt" 
style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" 
fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" 
loext:hyphenation-no-caps="false"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" 
style:class="text"/>
+  <style:style style:name="Graphics" style:family="graphic">
+   <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" 
svg:y="0cm" style:wrap="dynamic" style:number-wrapped-paragraphs="no-limit" 
style:wrap-contour="false" style:vertical-pos="top" 
style:vertical-rel="paragraph" style:horizontal-pos="center" 
style:horizontal-rel="paragraph"/>
+  </style:style>
+  <text:outline-style style:name="Outline">
+   <text:outline-level-style text:level="1" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="2" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="3" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="4" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="5" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="6" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="7" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="8" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="9" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+   <text:outline-level-style text:level="10" style:num-format="">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab"/>
+    </style:list-level-properties>
+   </text:outline-level-style>
+  </text:outline-style>
+  <text:notes-configuration text:note-class="footnote" style:num-format="1" 
text:start-value="0" text:footnotes-position="page" 
text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" 
text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" 
text:offset="0.499cm" style:num-format="1" text:number-position="left" 
text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Standard" style:master-page-name="">
+   <loext:graphic-properties draw:fill-gradient-name="gradient" 
draw:fill-hatch-name="hatch"/>
+   <style:paragraph-properties style:page-number="auto" fo:break-before="auto" 
fo:break-after="auto"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="P2" style:family="paragraph" 
style:parent-style-name="Standard" style:master-page-name="">
+   <loext:graphic-properties draw:fill-gradient-name="gradient" 
draw:fill-hatch-name="hatch"/>
+   <style:paragraph-properties style:page-number="auto" fo:break-before="auto" 
fo:break-after="auto" fo:keep-with-next="always"/>
+   <style:text-properties/>
+  </style:style>
+  <style:style style:name="fr1" style:family="graphic" 
style:parent-style-name="Graphics">
+   <style:graphic-properties style:horizontal-pos="center" 
style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm, 0cm, 
0cm, 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" 
draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" 
draw:image-opacity="100%" draw:color-mode="standard" 
style:flow-with-text="true"/>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="10.5cm" 
fo:page-height="14.801cm" style:num-format="1" 
style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" 
fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" 
style:footnote-max-height="0cm" loext:margin-gutter="0cm">
+    <style:footnote-sep style:width="0.018cm" 
style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" 
style:line-style="solid" style:adjustment="left" style:rel-width="25%" 
style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+  <number:number-style style:name="N0">
+   <number:number number:min-integer-digits="1"/>
+  </number:number-style>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text text:use-soft-page-breaks="true">
+   <text:variable-decls>
+    <text:variable-decl office:value-type="float" text:name="abc"/>
+   </text:variable-decls>
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" 
text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls>
+   <text:p text:style-name="P1"><text:variable-set text:name="abc" 
text:formula="ooow:1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
 office:value-type="float" office:value="INF" style:data-style-name="N0">** 
Expression is faulty **</text:variable-set></text:p>
+   <text:p text:style-name="P2"><draw:frame draw:style-name="fr1" 
draw:name="Image1" text:anchor-type="char" svg:width="0.503cm" 
svg:height="0.503cm" draw:z-index="0"><draw:image draw:mime-type="image/png">
+      
<office:binary-data>iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAABGdBTUEAANbY1E9YMgAAABl0
+       RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFpSURBVHjaYvz//z8DtQBAADER
+       o+jjZGuibAQIICZiDOK/cgzFwEnrV/4HYXS1AAHERIxBR58yMiAb2DtzM1b1AAHERIxBIIBu
+       IDYAEEBMxBjE0bgdxcBL3vcZLl16jaEPIICYiDFIU9MSw8BeoeUYhgEEEBMxBnFx8WE1EN3L
+       AAHERIxBIECMgQABxAhKtPgM+vbtE9xmGP/69eMMP+o9wWLW0kD9OlYM/LlHGQECiAndoKg/
+       USgGgTTmdS8C0yA+zIUgdeguBAggljtWdQwMVkDXACWMjd0ZXRun/Id5DWTA9C23GSaVxoEN
+       zISoARvoamnBYF2/hPHs2Z3/z0JdDhBADCBvIuPkhsn/QeDr14//QWwQjY0PVYeiFyCA8OaA
+       3cdPoEQAiI8PAAQQEwMVAUAAsWATBAX0jx9fsWrAJQ4CAAGE1TBQwOMC9+9fwikHEEBYDQPF
+       IAzIe8TglEMHAAHESM2SFiDAADEwCe4BJwcYAAAAAElFTkSuQmCC
+      </office:binary-data>
+     </draw:image>
+    </draw:frame><text:soft-page-break/></text:p>
+   <text:p text:style-name="Standard"/>
+  </office:text>
+ </office:body>
+</office:document>
\ No newline at end of file
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index dd3094ec888d..fd654cb3289d 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3097,6 +3097,58 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf115094)
     CPPUNIT_ASSERT_LESS(nTopOfB2Anchored, nTopOfB2);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testKeepWithNextPlusFlyFollowTextFlow)
+{
+    createDoc("keep-with-next-fly.fodt");
+
+    {
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        // 3 text frames on page 1
+        assertXPath(pXmlDoc, "/root/page[1]/body/infos/bounds", "bottom", 
"7540");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/infos/bounds", 
"height", "276");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/infos/bounds", 
"height", "276");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/anchored/fly", 1);
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly/infos/bounds", "top", "1694");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/infos/bounds", 
"height", "276");
+        assertXPath(pXmlDoc, "/root/page", 1);
+        discardDumpedLayout();
+    }
+
+    lcl_dispatchCommand(mxComponent, ".uno:Fieldnames", {});
+    Scheduler::ProcessEventsToIdle();
+
+    {
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        // 1 text frame on page 1, and some empty space
+        assertXPath(pXmlDoc, "/root/page[1]/body/infos/bounds", "bottom", 
"7540");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/infos/bounds", 
"height", "5796");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/infos/bounds", 
"bottom", "7213");
+        // 2 text frames on page 2
+        assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/infos/bounds", 
"height", "276");
+        assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly", 1);
+        assertXPath(pXmlDoc, 
"/root/page[2]/body/txt[1]/anchored/fly/infos/bounds", "top", "10093");
+        assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/infos/bounds", 
"height", "276");
+        assertXPath(pXmlDoc, "/root/page", 2);
+        discardDumpedLayout();
+    }
+
+    lcl_dispatchCommand(mxComponent, ".uno:Fieldnames", {});
+    Scheduler::ProcessEventsToIdle();
+
+    {
+        xmlDocPtr pXmlDoc = parseLayoutDump();
+        // 3 text frames on page 1
+        assertXPath(pXmlDoc, "/root/page[1]/body/infos/bounds", "bottom", 
"7540");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[1]/infos/bounds", 
"height", "276");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/infos/bounds", 
"height", "276");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[2]/anchored/fly", 1);
+        assertXPath(pXmlDoc, 
"/root/page[1]/body/txt[2]/anchored/fly/infos/bounds", "top", "1694");
+        assertXPath(pXmlDoc, "/root/page[1]/body/txt[3]/infos/bounds", 
"height", "276");
+        assertXPath(pXmlDoc, "/root/page", 1);
+        discardDumpedLayout();
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122607)
 {
     createDoc("tdf122607.odt");
diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index d416b637c02f..2cf8ba751b7a 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1080,6 +1080,18 @@ bool SwFlowFrame::IsPrevObjMove() const
         OSL_ENSURE( SwFlowFrame::CastFlowFrame( pPre ), "new flowfrm?" );
         if( SwFlowFrame::CastFlowFrame( pPre )->IsAnFollow( this ) )
             return false;
+        if (SwFlowFrame::CastFlowFrame(pPre)->IsJoinLocked())
+        {
+            SwBorderAttrAccess baa(SwFrame::GetCache(), pPre);
+            SwBorderAttrs const& rAttrs(*baa.Get());
+            if 
(SwFlowFrame::CastFlowFrame(pPre)->IsKeep(rAttrs.GetAttrSet().GetKeep(), 
pPre->GetBreakItem()))
+            {   // pPre is currently being formatted - maybe it moved back but
+                // its objects still have the old page's body as
+                // mpVertPosOrientFrame and SwContentFrame::MakeAll() is 
calling
+                // pNxt->Calc() in this case so allow this frame to move back
+                return false; // too, else pPre is forced to move forward 
again.
+            }
+        }
         SwLayoutFrame* pPreUp = pPre->GetUpper();
         // If the upper is a SectionFrame, or a column of a SectionFrame, we're
         // allowed to protrude out of it.  However, we need to respect the
commit a043f8435985fd2b8e29e3ae33e2dc6e4a29f7bc
Author:     Jan-Marek Glogowski <[email protected]>
AuthorDate: Thu Mar 5 20:49:55 2020 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Feb 21 17:09:25 2022 +0100

    Dump some more layout info as Xml
    
    Change-Id: Ia82d545e4c5d4507899d123eba9d4b2efded992d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90125
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <[email protected]>
    (cherry picked from commit 36f0a04d3caa176b20dccb10ff0bbcfb5cb8d893)

diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx
index 69b1f2ad781a..6cde3c3f01e7 100644
--- a/sw/inc/swrect.hxx
+++ b/sw/inc/swrect.hxx
@@ -26,6 +26,7 @@
 #include "swdllapi.h"
 
 class SvStream;
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
 
 /// *Of course* Writer needs its own rectangles.
 /// This is half-open so m_Point.X() + m_Size.getWidth() is *not* included.
@@ -104,7 +105,7 @@ public:
 
     // Output operator for debugging.
     friend SvStream& WriteSwRect( SvStream &rStream, const SwRect &rRect );
-
+    void dumpAsXmlAttributes(xmlTextWriterPtr writer) const;
 
     void Top_(      const long nTop );
     void Bottom_(   const long nBottom );
diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx
index 1d53e6e7a71e..884c155003e2 100644
--- a/sw/source/core/bastyp/swrect.cxx
+++ b/sw/source/core/bastyp/swrect.cxx
@@ -19,6 +19,8 @@
 
 #include <swrect.hxx>
 
+#include <libxml/xmlwriter.h>
+
 #ifdef DBG_UTIL
 #include <tools/stream.hxx>
 #endif
@@ -218,6 +220,16 @@ void SwRect::SetUpperRightCorner(  const Point& rNew )
 void SwRect::SetLowerLeftCorner(  const Point& rNew )
     { m_Point = Point(rNew.X(), rNew.Y() - m_Size.getHeight()); }
 
+void SwRect::dumpAsXmlAttributes(xmlTextWriterPtr writer) const
+{
+    xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("left"), "%li", Left());
+    xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("top"), "%li", Top());
+    xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("width"), "%li", 
Width());
+    xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("height"), "%li", 
Height());
+    xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("bottom"), "%li", 
Bottom());
+    xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("right"), "%li", 
Right());
+}
+
 #ifdef DBG_UTIL
 SvStream& WriteSwRect(SvStream &rStream, const SwRect &rRect)
 {
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 4538362da8d5..3a93b1f25121 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -344,6 +344,12 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const
             xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidLayout"), 
BAD_CAST(OString::boolean(!pPageFrame->IsInvalidLayout()).getStr()));
             xmlTextWriterWriteAttribute(writer, BAD_CAST("ValidContent"), 
BAD_CAST(OString::boolean(!pPageFrame->IsInvalidContent()).getStr()));
             xmlTextWriterEndElement(writer);
+            xmlTextWriterStartElement(writer, BAD_CAST("page_info"));
+            xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("phyNum"), 
"%d", pPageFrame->GetPhyPageNum());
+            xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("virtNum"), 
"%d", pPageFrame->GetVirtPageNum());
+            OUString aFormatName = pPageFrame->GetPageDesc()->GetName();
+            xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("pageDesc"), 
"%s", BAD_CAST(OUStringToOString(aFormatName, RTL_TEXTENCODING_UTF8).getStr()));
+            xmlTextWriterEndElement(writer);
         }
 
         if (IsTextFrame())
@@ -422,22 +428,16 @@ void SwFrame::dumpInfosAsXml( xmlTextWriterPtr writer ) 
const
 {
     // output the Frame
     xmlTextWriterStartElement( writer, BAD_CAST( "bounds" ) );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", 
getFrameArea().Left() );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", 
getFrameArea().Top() );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", 
getFrameArea().Width() );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", 
getFrameArea().Height() );
+    getFrameArea().dumpAsXmlAttributes(writer);
     xmlTextWriterWriteAttribute(writer, BAD_CAST("mbFixSize"), 
BAD_CAST(OString::boolean(HasFixSize()).getStr()));
     xmlTextWriterWriteAttribute(writer, BAD_CAST("mbValidPos"), 
BAD_CAST(OString::boolean(isFrameAreaPositionValid()).getStr()));
     xmlTextWriterWriteAttribute(writer, BAD_CAST("mbValidSize"), 
BAD_CAST(OString::boolean(isFrameAreaSizeValid()).getStr()));
     xmlTextWriterWriteAttribute(writer, BAD_CAST("mbValidPrtArea"), 
BAD_CAST(OString::boolean(isFramePrintAreaValid()).getStr()));
     xmlTextWriterEndElement( writer );
 
-    // output the Prt
+    // output the print area
     xmlTextWriterStartElement( writer, BAD_CAST( "prtBounds" ) );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", 
getFramePrintArea().Left() );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", 
getFramePrintArea().Top() );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", 
getFramePrintArea().Width() );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", 
getFramePrintArea().Height() );
+    getFramePrintArea().dumpAsXmlAttributes(writer);
     xmlTextWriterEndElement( writer );
 }
 
@@ -516,10 +516,7 @@ void SwAnchoredObject::dumpAsXml( xmlTextWriterPtr writer 
) const
     xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "ptr" ), "%p", this );
 
     xmlTextWriterStartElement( writer, BAD_CAST( "bounds" ) );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "left" ), "%ld", 
GetObjBoundRect().Left() );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "top" ), "%ld", 
GetObjBoundRect().Top() );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "width" ), "%ld", 
GetObjBoundRect().Width() );
-    xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "height" ), "%ld", 
GetObjBoundRect().Height() );
+    GetObjBoundRect().dumpAsXmlAttributes(writer);
     xmlTextWriterEndElement( writer );
 
     if (const SdrObject* pObject = GetDrawObj())
commit 1f0af2b92d908e76588672713e85c847f36a5da8
Author:     Michael Stahl <[email protected]>
AuthorDate: Wed May 20 15:06:44 2020 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Thu Feb 17 22:02:01 2022 +0100

    tdf#41995: sxx: ODF export: save SVG to ODF 1.2 as well
    
    ... and SVM into ODF 1.2 Extended (compatibility mode).
    
    Change-Id: I2056ddac40570fdf69178349ff546cd313709b25
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94575
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit d407019a69773156b0bb9ef0b4a775f67830949e)

diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 14f9313c625d..c45e64b6d22e 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -663,7 +663,8 @@ OUString 
SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::X
                     // into an svm. slight catch22 here, since strict ODF
                     // conformance _recommends_ svg - then again, most old
                     // ODF consumers are believed to be OOo
-                    if (SvtSaveOptions().GetODFDefaultVersion() <= 
SvtSaveOptions::ODFVER_012)
+                    if (SvtSaveOptions().GetODFSaneDefaultVersion() < 
SvtSaveOptions::ODFSVER_012
+                        || SvtSaveOptions().GetODFSaneDefaultVersion() == 
SvtSaveOptions::ODFSVER_012_EXT_COMPAT)
                     {
                         bUseGfxLink = false;
                         aExtension = ".svm";

Reply via email to