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

Miklos Vajna vmiklos at collabora.co.uk
Tue Feb 4 07:07:55 PST 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 5cfda4f4de8da82485e27b1f0f0d94211d3b4d95
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

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 9db79eb..e978d76 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2175,7 +2175,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 )
                  {
@@ -5938,6 +5938,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 aaf1b44..c4425cc 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