[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/source

Michael Stahl Michael.Stahl at cib.de
Thu Jul 5 12:55:37 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 088d73b863b151ca11e23fd924c8d5a86c074e47
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/56937
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index 865bac95bb24..17ec3f67059f 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -173,6 +173,7 @@ public:
         OSL_ENSURE( nCnt < aHiddenChg.size(),"No HiddenChg today!");
         return aHiddenChg[ nCnt ];
     }
+    sal_Int32 NextHiddenChg(sal_Int32 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 4adfddceef88..437b80b3794e 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -939,6 +939,10 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf )
     const sal_Int32 nNextDir = pScriptInfo->NextDirChg( rInf.GetIdx() );
     nNextChg = std::min( nNextChg, nNextDir );
 
+    // hidden change (potentially via bookmark):
+    const sal_Int32 nNextHidden = pScriptInfo->NextHiddenChg(rInf.GetIdx());
+    nNextChg = std::min( nNextChg, nNextHidden );
+
     // Turbo boost:
     // We assume that a font's characters are not larger than twice
     // as wide as heigh.
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 66d86985e653..5a415e11da9d 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1287,6 +1287,18 @@ sal_uInt8 SwScriptInfo::DirType(const sal_Int32 nPos) const
     return 0;
 }
 
+sal_Int32 SwScriptInfo::NextHiddenChg(sal_Int32 const nPos) const
+{
+    for (auto const it : aHiddenChg)
+    {
+        if (nPos < it)
+        {
+            return it;
+        }
+    }
+    return 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