[Libreoffice-commits] core.git: sw/qa sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 30 13:20:11 UTC 2020


 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx |    2 +-
 sw/source/core/inc/scriptinfo.hxx          |    1 +
 sw/source/core/text/itrform2.cxx           |    4 ++++
 sw/source/core/text/porlay.cxx             |   12 ++++++++++++
 4 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 2817f07fdd942cea6574043971534bf089b527ce
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Jan 23 18:36:40 2020 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Jan 30 14:19:27 2020 +0100

    tdf#45589 sw: split text portions at bookmarks
    
    Always create the portion, not just when the IsViewMetaChars is active.
    
    This has the advantage that nothing has to be invalidated when toggling,
    and the disadvantage that kerning at bookmark positions will never
    happen.
    
    Change-Id: I78943f337eef5c64cff33f6df6ff1a10acb1b8bc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87363
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 23449e274557..27c66c141357 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -499,7 +499,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf124594, "tdf124594.docx")
     // only "Er horte leise Schritte hinter", which means the 1st line of the 2nd paragraph was
     // split into two by a Special portion, i.e. the top margin of the shape was too large.
     assertXPath(pDump, "/root/page/body/txt[2]/Text[1]", "Portion",
-                "Er horte leise Schritte hinter sich. Das bedeutete nichts Gutes. Wer wurde ihm ");
+                "Er horte leise Schritte hinter sich. Das bedeutete nichts Gutes. Wer wu"); // ... until the bookmark.
 }
 
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTextInput, "textinput.odt")
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index e70ded7166b0..6d7ad0f4dfff 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -181,6 +181,7 @@ public:
         return m_HiddenChg[ nCnt ];
     }
     TextFrameIndex NextHiddenChg(TextFrameIndex nPos) const;
+    TextFrameIndex NextBookmark(TextFrameIndex nPos) const;
     static void CalcHiddenRanges(const SwTextNode& rNode,
             MultiSelection& rHiddenMulti,
             std::vector<std::pair<sw::mark::IBookmark const*, MarkKind>> * pBookmarks);
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index e7d375299c26..3285f7f5ede9 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -962,6 +962,10 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf )
     const TextFrameIndex nNextHidden = m_pScriptInfo->NextHiddenChg(rInf.GetIdx());
     nNextChg = std::min( nNextChg, nNextHidden );
 
+    // bookmarks
+    const TextFrameIndex nNextBookmark = m_pScriptInfo->NextBookmark(rInf.GetIdx());
+    nNextChg = std::min(nNextChg, nNextBookmark);
+
     // Turbo boost:
     // We assume that font characters are not larger than twice
     // as wide as height.
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index b6f70e7da060..aa0bbf6860c3 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1674,6 +1674,18 @@ TextFrameIndex SwScriptInfo::NextHiddenChg(TextFrameIndex const nPos) const
     return TextFrameIndex(COMPLETE_STRING);
 }
 
+TextFrameIndex SwScriptInfo::NextBookmark(TextFrameIndex const nPos) const
+{
+    for (auto const& it : m_Bookmarks)
+    {
+        if (nPos < it.first)
+        {
+            return it.first;
+        }
+    }
+    return TextFrameIndex(COMPLETE_STRING);
+}
+
 // Takes a string and replaced the hidden ranges with cChar.
 sal_Int32 SwScriptInfo::MaskHiddenRanges( const SwTextNode& rNode, OUStringBuffer & rText,
                                        const sal_Int32 nStt, const sal_Int32 nEnd,


More information about the Libreoffice-commits mailing list