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

Michael Stahl Michael.Stahl at cib.de
Fri Jul 6 08:24:34 UTC 2018


 sw/source/core/inc/scriptinfo.hxx |    1 +
 sw/source/core/text/itrform2.cxx  |    4 ++++
 sw/source/core/text/porlay.cxx    |   12 ++++++++++++
 3 files changed, 17 insertions(+)

New commits:
commit bf4d4a9cad6664bd5772618e31e998942caef77e
Author: Michael Stahl <Michael.Stahl at cib.de>
Date:   Wed Jul 4 12:53:56 2018 +0200

    tdf#101856 sw: hidden bookmark portions in SwTextFormatter::NewTextPortion()
    
    All other hidden-text features already have a AUTOFMT hint or a TXTFIELD
    hint, so the SwAttrIter already creates new portions for them.
    
    The bookmarks aren't considered by SwTextFormatter currently, but
    SwScriptInfo already has all of the required info.
    
    Change-Id: I451ce331110aa58df8955e1a3ffa339e6f905b22
    Reviewed-on: https://gerrit.libreoffice.org/56959
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index aab651e1511d..e3b532783439 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -177,6 +177,7 @@ public:
         assert(nCnt < m_HiddenChg.size());
         return m_HiddenChg[ nCnt ];
     }
+    TextFrameIndex NextHiddenChg(TextFrameIndex nPos) const;
     static void CalcHiddenRanges(const SwTextNode& rNode, MultiSelection& rHiddenMulti);
     static void selectHiddenTextProperty(const SwTextNode& rNode, MultiSelection &rHiddenMulti);
     static void selectRedLineDeleted(const SwTextNode& rNode, MultiSelection &rHiddenMulti, bool bSelect=true);
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 3949fc35bb71..2df29c9e8ff8 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -958,6 +958,10 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf )
     const TextFrameIndex nNextDir = m_pScriptInfo->NextDirChg(rInf.GetIdx());
     nNextChg = std::min( nNextChg, nNextDir );
 
+    // hidden change (potentially via bookmark):
+    const TextFrameIndex nNextHidden = m_pScriptInfo->NextHiddenChg(rInf.GetIdx());
+    nNextChg = std::min( nNextChg, nNextHidden );
+
     // 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 7d5b87b8437a..a5391aa817a6 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1450,6 +1450,18 @@ sal_uInt8 SwScriptInfo::DirType(const TextFrameIndex nPos) const
     return 0;
 }
 
+TextFrameIndex SwScriptInfo::NextHiddenChg(TextFrameIndex const nPos) const
+{
+    for (auto const it : m_HiddenChg)
+    {
+        if (nPos < it)
+        {
+            return it;
+        }
+    }
+    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