[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Jul 8 04:49:18 PDT 2014


 sw/source/filter/ww8/ww8par.cxx |   14 +++++++++++++-
 sw/source/filter/ww8/ww8par.hxx |    2 ++
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit d791e45741a7ff36c0942a600d2ee0c7fabcd06a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Feb 4 16:02:49 2014 +0100

    DOC import: fix nested comments
    
    See 2.9.70 (FBKF) in the spec, the ibkl field should be used to find the
    position in PlcfBkf.
    
    Previously we assumed that PlcfBkl and PlcfBkf is parallel for
    annotations, as but that's not true for nested comments.
    
    Change-Id: I76a6a757b41d2f9b7fe7fe9c9e01a92c251f7b32
    (cherry picked from commit 5cfda4f4de8da82485e27b1f0f0d94211d3b4d95)
    Reviewed-on: https://gerrit.libreoffice.org/10138
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index ed42bf4..0ba789b 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2162,7 +2162,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
             if (nAtnIndex != -1)
             {
                 WW8_CP nStart = GetAnnotationStart(nAtnIndex);
-                WW8_CP nEnd = GetAnnotationEnd(nAtnIndex);
+                WW8_CP nEnd = GetAnnotationEnd(GetAnnotationEndIndex(nAtnIndex));
                 sal_Int32 nLen = nEnd - nStart;
                 if( nLen )
                  {
@@ -5951,6 +5951,18 @@ int SwWW8ImplReader::GetAnnotationIndex(sal_uInt32 nTag)
     return -1;
 }
 
+sal_uInt16 SwWW8ImplReader::GetAnnotationEndIndex(sal_uInt16 nStart)
+{
+    WW8_CP nStartAkt;
+    void* p;
+    if (mpAtnStarts->GetData(nStart, nStartAkt, p) && p)
+    {
+        // p is an FBKF, and its first 2 bytes is the ibkl member, which is the end index.
+        return SVBT16ToShort(*((SVBT16*)p));
+    }
+    return nStart;
+}
+
 WW8_CP SwWW8ImplReader::GetAnnotationStart(int nIndex)
 {
     if (!mpAtnStarts.get() && pWwFib->lcbPlcfAtnbkf)
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 772da4c..9434c2e 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1635,6 +1635,8 @@ private:
 
     const OUString* GetAnnotationAuthor(sal_uInt16 nIdx);
     int GetAnnotationIndex(sal_uInt32 nTag);
+    /// Return the end index based on the start one.
+    sal_uInt16 GetAnnotationEndIndex(sal_uInt16 nStart);
     WW8_CP GetAnnotationStart(int nIndex);
     WW8_CP GetAnnotationEnd(int nIndex);
 


More information about the Libreoffice-commits mailing list