[ooo-build-commit] patches/dev300

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Wed Oct 21 08:59:01 PDT 2009


 patches/dev300/field-patch.diff |   61 ++++++++++++++++++++++++++++------------
 1 file changed, 43 insertions(+), 18 deletions(-)

New commits:
commit 8141b9b156039cee4a43b53125e37d4e0e3cebb3
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Wed Oct 21 17:58:33 2009 +0200

    Fix for n#546416
    
    There was a problem in the way fields were exported to .doc with two
    consecutive text fields.
    
    * patches/dev300/field-patch.diff:

diff --git a/patches/dev300/field-patch.diff b/patches/dev300/field-patch.diff
index 26a3746..738879b 100644
--- a/patches/dev300/field-patch.diff
+++ b/patches/dev300/field-patch.diff
@@ -1205,10 +1205,11 @@ diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/core/unocore/uno
 -        throw uno::RuntimeException();
 +        throw uno::RuntimeException(  );
  }
-diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/wrtw8nds.cxx sw/source/filter/ww8/wrtw8nds.cxx
---- sw/source/filter/ww8/wrtw8nds.cxx	2009-10-09 14:55:24.000000000 +0200
-+++ sw/source/filter/ww8/wrtw8nds.cxx	2009-10-09 10:53:45.000000000 +0200
-@@ -110,8 +110,48 @@
+diff --git sw/source/filter/ww8/wrtw8nds.cxx sw/source/filter/ww8/wrtw8nds.cxx
+index b861862..2280b2b 100644
+--- sw/source/filter/ww8/wrtw8nds.cxx
++++ sw/source/filter/ww8/wrtw8nds.cxx
+@@ -110,8 +110,48 @@ using namespace ::com::sun::star;
  using namespace ::com::sun::star::i18n;
  using namespace sw::util;
  using namespace sw::types;
@@ -1257,14 +1258,36 @@ diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/wrtw8
  /*  */
  
  MSWordAttrIter::MSWordAttrIter( MSWordExportBase& rExport )
-@@ -266,19 +306,17 @@
+@@ -262,22 +302,40 @@ SwAttrIter::SwAttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) :
+     nAktSwPos = SearchNext(1);
+ }
+ 
++xub_StrLen lcl_getMinPos( xub_StrLen pos1, xub_StrLen pos2 )
++{
++    xub_StrLen min = STRING_NOTFOUND;
++    if ( pos1 == STRING_NOTFOUND && pos2 != STRING_NOTFOUND )
++        min = pos2;
++    else if ( pos2 == STRING_NOTFOUND && pos1 != STRING_NOTFOUND )
++        min = pos1;
++    else if ( pos2 != STRING_NOTFOUND && pos2 != STRING_NOTFOUND )
++    {
++        if ( pos1 < pos2 )
++            min = pos1;
++        else
++            min = pos2;
++    }
++
++    return min;
++}
++
+ xub_StrLen SwAttrIter::SearchNext( xub_StrLen nStartPos )
  {
      xub_StrLen nPos;
      xub_StrLen nMinPos = STRING_MAXLEN;
 +    xub_StrLen i=0;
 +
      const String aTxt = rNd.GetTxt();
-     xub_StrLen pos = aTxt.Search(CH_TXT_ATR_FIELDSTART, nStartPos);
+-    xub_StrLen pos = aTxt.Search(CH_TXT_ATR_FIELDSTART, nStartPos);
 -    if( pos==STRING_NOTFOUND )
 -    {
 -        pos = aTxt.Search(CH_TXT_ATR_FIELDEND, nStartPos);
@@ -1272,19 +1295,21 @@ diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/wrtw8
 -            pos = aTxt.Search(CH_TXT_ATR_FORMELEMENT, nStartPos);
 -    }
 -    if( pos!=STRING_NOTFOUND )
-+	if (pos==STRING_NOTFOUND) 
-+		pos=aTxt.Search(CH_TXT_ATR_FIELDEND, nStartPos);
-+	if (pos==STRING_NOTFOUND) 
-+		pos=aTxt.Search(CH_TXT_ATR_FORMELEMENT, nStartPos);
-+	if (pos!=STRING_NOTFOUND)  
-         nMinPos=pos;
+-        nMinPos=pos;
++    xub_StrLen fieldEndPos = aTxt.Search(CH_TXT_ATR_FIELDEND, nStartPos);
++    xub_StrLen fieldStartPos = aTxt.Search(CH_TXT_ATR_FIELDSTART, nStartPos);
++    xub_StrLen formElementPos = aTxt.Search(CH_TXT_ATR_FORMELEMENT, nStartPos);
  
 -    xub_StrLen i=0;
--
++    xub_StrLen pos = lcl_getMinPos( fieldEndPos, fieldStartPos );
++    pos = lcl_getMinPos( pos, formElementPos );
++
++	if (pos!=STRING_NOTFOUND)  
++        nMinPos=pos;
+ 
      // first the redline, then the attributes
      if( pCurRedline )
-     {
-@@ -1704,12 +1742,14 @@
+@@ -1704,12 +1762,14 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
                  ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
                  OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
  
@@ -1304,7 +1329,7 @@ diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/wrtw8
              }
              else if ( ch == CH_TXT_ATR_FIELDEND )
              {
-@@ -1717,8 +1757,8 @@
+@@ -1717,8 +1777,8 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
                  ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
                  OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
  
@@ -1315,7 +1340,7 @@ diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/wrtw8
                      AppendBookmark( pFieldmark->GetName(), false );
              }
              else if ( ch == CH_TXT_ATR_FORMELEMENT )
-@@ -1727,13 +1767,18 @@
+@@ -1727,13 +1787,18 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
                  ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
                  OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
  
@@ -1335,7 +1360,7 @@ diff -urN '--exclude=unxlngi6.pro' '--exclude=*.orig' sw/source/filter/ww8/wrtw8
                      WriteFormData( *pFieldmark );
 -                OutputField( NULL, ww::eFORMCHECKBOX, String(), WRITEFIELD_CMD_END | WRITEFIELD_CLOSE );
 -                if ( pFieldmark )
-+                OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CMD_END | WRITEFIELD_CLOSE );
++                OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CLOSE );
 +                if ( isEcma )
                      AppendBookmark( pFieldmark->GetName(), false );
              }


More information about the ooo-build-commit mailing list