[Libreoffice] Lotuswordpro : Found duplicate if expressions in xfbookmarkref.cxx:75:85

Julien Nabet serval2412 at yahoo.fr
Sat Jun 4 15:59:00 PDT 2011


Hello,

Here is the part of code :
     if( m_eRefType == enumXFBookmarkNone )
         return;
     else if( m_eRefType == enumXFBookmarkPage )        // <-- Line 75
     {
         pAttrList->AddAttribute( A2OUSTR("text:reference-format"), 
A2OUSTR("page") );
         pAttrList->AddAttribute( A2OUSTR("text:ref-name"), m_strBookmark );
     }
     else if( m_eRefType == enumXFBookmarkChapter )
     {
         pAttrList->AddAttribute( A2OUSTR("text:reference-format"), 
A2OUSTR("chapter") );
         pAttrList->AddAttribute( A2OUSTR("text:ref-name"), m_strBookmark );
     }
     else if( m_eRefType == enumXFBookmarkPage )     // <-- Line 85
     {
         pAttrList->AddAttribute( A2OUSTR("text:reference-format"), 
A2OUSTR("text") );
         pAttrList->AddAttribute( A2OUSTR("text:ref-name"), m_strBookmark );

     }
     else if( m_eRefType == enumXFBookmarkDir )
     {
         pAttrList->AddAttribute( A2OUSTR("text:reference-format"), 
A2OUSTR("direction") );
         pAttrList->AddAttribute( A2OUSTR("text:ref-name"), m_strBookmark );
     }
     else if( m_eRefType == enumXFBookmarkDef )
     {
         pAttrList->AddAttribute( A2OUSTR("text:ref-name"), m_strBookmark );
     }

With opengrok, I found in xfdefs.hxx, this :
  enum enumXFBookmarkRef
{
   enumXFBookmarkNone, // Found this one
   enumXFBookmarkPage, // Found this one and line 75 seems ok
   enumXFBookmarkChapter, // Found this one
   enumXFBookmarkDir, // Found this one
   enumXFBookmarkDef // Found this one but seems incomplete
};

Just a guess, perhaps it needs this patch :
diff --git a/lotuswordpro/source/filter/xfilter/xfbookmarkref.cxx 
b/lotuswordpro/source/filter/xfilter/xfbookmarkref.cxx
index 251274f..d5c2bb4 100644
--- a/lotuswordpro/source/filter/xfilter/xfbookmarkref.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfbookmarkref.cxx
@@ -82,12 +82,6 @@ void XFBookmarkRef::ToXml(IXFStream *pStrm)
          pAttrList->AddAttribute( A2OUSTR("text:reference-format"), 
A2OUSTR("chapter") );
          pAttrList->AddAttribute( A2OUSTR("text:ref-name"), 
m_strBookmark );
      }
-    else if( m_eRefType == enumXFBookmarkPage )
-    {
-        pAttrList->AddAttribute( A2OUSTR("text:reference-format"), 
A2OUSTR("text") );
-        pAttrList->AddAttribute( A2OUSTR("text:ref-name"), m_strBookmark );
-
-    }
      else if( m_eRefType == enumXFBookmarkDir )
      {
          pAttrList->AddAttribute( A2OUSTR("text:reference-format"), 
A2OUSTR("direction") );
@@ -95,6 +89,7 @@ void XFBookmarkRef::ToXml(IXFStream *pStrm)
      }
      else if( m_eRefType == enumXFBookmarkDef )
      {
+        pAttrList->AddAttribute( A2OUSTR("text:reference-format"), 
A2OUSTR("text") );
          pAttrList->AddAttribute( A2OUSTR("text:ref-name"), 
m_strBookmark );
      }
      pStrm->StartElement( A2OUSTR("text:bookmark-ref") );

Someone to comment ? If it's ok, I can, of course, commit this and push 
it in master.

Julien.


More information about the LibreOffice mailing list