[ooo-build-commit] .: sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Sep 13 08:18:50 PDT 2010


 sw/source/filter/rtf/rtfatr.cxx |   12 +++---
 sw/source/filter/rtf/rtfnum.cxx |   78 ++++++++++++----------------------------
 2 files changed, 31 insertions(+), 59 deletions(-)

New commits:
commit 1ccbb5d782056eeaf0c50333eed49ded73acfc5f
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Mon Sep 13 17:15:50 2010 +0200

    sw-rtf-num-fix.diff:Fixes for RTF numbering export
    
    n#569266

diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx
index 4a3f53a..ad21e39 100644
--- a/sw/source/filter/rtf/rtfatr.cxx
+++ b/sw/source/filter/rtf/rtfatr.cxx
@@ -438,15 +438,15 @@ bool SwFmtToSet(SwRTFWriter& rWrt, const SwFmt& rFmt, SfxItemSet &rSet)
                 }
 
                 const SwNumFmt* pNFmt = &rWrt.pDoc->GetOutlineNumRule()->Get( static_cast<USHORT>(nLvl) );
-                if( pNFmt->GetAbsLSpace() )
+                if( pNFmt->GetIndentAt() )
                 {
                     SfxItemSet aSet( *rFmt.GetAttrSet().GetPool(),
                                     rFmt.GetAttrSet().GetRanges() );
                     aSet.SetParent( &rFmt.GetAttrSet() );
                     SvxLRSpaceItem aLR( (SvxLRSpaceItem&)aSet.Get( RES_LR_SPACE ) );
 
-                    aLR.SetTxtLeft( aLR.GetTxtLeft() + pNFmt->GetAbsLSpace() );
-                    aLR.SetTxtFirstLineOfst( pNFmt->GetFirstLineOffset() );
+                    aLR.SetTxtLeft( aLR.GetTxtLeft() + pNFmt->GetIndentAt() );
+                    aLR.SetTxtFirstLineOfst( pNFmt->GetFirstLineIndent() );
 
                     aSet.Put(aLR);
                     rSet.Put(aSet);
@@ -1210,7 +1210,7 @@ static Writer& OutRTF_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
     }
 
     // gibt es harte Attributierung ?
-    if( bNewFmts && pNd->HasSwAttrSet())
+    if( pNd->HasSwAttrSet() )
     {
         rRTFWrt.pFlyFmt = 0;
 
@@ -1233,9 +1233,9 @@ static Writer& OutRTF_SwTxtNode( Writer& rWrt, SwCntntNode& rNode )
             SfxItemSet aSet( rNdSet );
             SvxLRSpaceItem aLR( (SvxLRSpaceItem&)rNdSet.Get( RES_LR_SPACE ) );
 
-            aLR.SetTxtLeft( aLR.GetTxtLeft() + pFmt->GetAbsLSpace() );
+            aLR.SetTxtLeft( aLR.GetTxtLeft() + pFmt->GetIndentAt() );
             if( MAXLEVEL > pNd->GetActualListLevel() )
-                aLR.SetTxtFirstLineOfst( pFmt->GetFirstLineOffset() );
+                aLR.SetTxtFirstLineOfst( pFmt->GetFirstLineIndent() );
             else
                 aSet.ClearItem( RES_PARATR_NUMRULE );
             aSet.Put( aLR );
diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx
index 3d77f13..c8aa398 100644
--- a/sw/source/filter/rtf/rtfnum.cxx
+++ b/sw/source/filter/rtf/rtfnum.cxx
@@ -1,29 +1,3 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
@@ -43,6 +17,7 @@
 #include <editeng/colritem.hxx>
 #include <editeng/udlnitem.hxx>
 #include <editeng/wrlmitem.hxx>
+#include <editeng/numitem.hxx>
 #include <shellio.hxx>
 #include <fltini.hxx>
 #include <swtypes.hxx>
@@ -72,7 +47,7 @@ void lcl_ExpandNumFmts( SwNumRule& rRule )
         if( !rRule.GetNumFmt( n ) )
         {
             SwNumFmt aNumFmt( rRule.Get( 0 ));
-            aNumFmt.SetAbsLSpace( aNumFmt.GetAbsLSpace() * ( n + 1 ) );
+            aNumFmt.SetIndentAt( aNumFmt.GetIndentAt() * ( n + 1 ) );
             rRule.Set( n, aNumFmt );
         }
 }
@@ -99,13 +74,13 @@ void SwRTFParser::ReadListLevel( SwNumRule& rRule, BYTE nNumLvl )
     int nLvlTxtLevel = 0, nLvlNumberLevel = 0;
     String sLvlText, sLvlNumber;
     SwNumFmt* pCurNumFmt;
-    String aStringFollow = aEmptyStr;
+    SvxNumberFormat::SvxNumLabelFollowedBy eFollowedBy = SvxNumberFormat::NOTHING;
 
     if( MAXLEVEL >= nNumLvl )
     {
         pCurNumFmt = (SwNumFmt*)rRule.GetNumFmt( nNumLvl );
-        pCurNumFmt->SetAbsLSpace( 0 );
-        pCurNumFmt->SetFirstLineOffset( 0 );
+        pCurNumFmt->SetIndentAt( 0 );
+        pCurNumFmt->SetFirstLineIndent( 0 );
     }
     else
         pCurNumFmt = 0;
@@ -210,17 +185,16 @@ void SwRTFParser::ReadListLevel( SwNumRule& rRule, BYTE nNumLvl )
             break;
 
         case RTF_LEVELFOLLOW:
-          /* removed; waiting for swnum02 to be integrated!
+          /* removed; waiting for swnum02 to be integrated! */
             switch (nTokenValue)
             {
             case 0:
-                aStringFollow=String('\t');
+                eFollowedBy = SvxNumberFormat::LISTTAB;
                 break;
             case 1:
-                aStringFollow=String(' ');
+                eFollowedBy = SvxNumberFormat::SPACE;
                 break;
             }
-            */
             break;
 
         case RTF_LEVELOLD:
@@ -244,8 +218,8 @@ void SwRTFParser::ReadListLevel( SwNumRule& rRule, BYTE nNumLvl )
                 // and put the current "LRSpace" into the set
                 {
                     SvxLRSpaceItem aLR( RES_LR_SPACE );
-                    aLR.SetTxtLeft( pCurNumFmt->GetAbsLSpace() );
-                    aLR.SetTxtFirstLineOfst(pCurNumFmt->GetFirstLineOffset());
+                    aLR.SetTxtLeft( pCurNumFmt->GetIndentAt() );
+                    aLR.SetTxtFirstLineOfst(pCurNumFmt->GetFirstLineIndent());
                     aSet.Put( aLR );
                 }
 
@@ -264,8 +238,9 @@ void SwRTFParser::ReadListLevel( SwNumRule& rRule, BYTE nNumLvl )
                         FALSE, &pItem ))
                 {
                     const SvxLRSpaceItem& rLR = *(SvxLRSpaceItem*)pItem;
-                    pCurNumFmt->SetAbsLSpace( static_cast< short >(rLR.GetTxtLeft()) );
-                    pCurNumFmt->SetFirstLineOffset( rLR.GetTxtFirstLineOfst());
+                    pCurNumFmt->SetListtabPos( rLR.GetTxtLeft( ) );
+                    pCurNumFmt->SetIndentAt( rLR.GetTxtLeft() );
+                    pCurNumFmt->SetFirstLineIndent( rLR.GetTxtFirstLineOfst());
                 }
 
                 // dann aus der Vorlage den Font holen
@@ -306,16 +281,13 @@ void SwRTFParser::ReadListLevel( SwNumRule& rRule, BYTE nNumLvl )
             pCurNumFmt->SetSuffix( sLvlText );
         }
 
-        String newSuffix=pCurNumFmt->GetSuffix();
-        newSuffix+=aStringFollow;
-        pCurNumFmt->SetSuffix(newSuffix);
-        /* removed; waiting for swnum02 to be integrated!
-        if (aStringFollow.GetChar(0)=='\t' && !pCurNumFmt->IsItemize())
+        /* removed; waiting for swnum02 to be integrated!*/
+        pCurNumFmt->SetLabelFollowedBy( eFollowedBy );
+        if (eFollowedBy == SvxNumberFormat::LISTTAB && !pCurNumFmt->IsItemize())
         {
-            pCurNumFmt->SetAbsLSpace(0);
-            pCurNumFmt->SetFirstLineOffset(0);
+            pCurNumFmt->SetIndentAt(0);
+            pCurNumFmt->SetFirstLineIndent(0);
         }
-        */
     }
 
     SkipToken( -1 );
@@ -380,7 +352,7 @@ void SwRTFParser::ReadListTable()
 
                 String sTmp( String::CreateFromAscii(
                     RTL_CONSTASCII_STRINGPARAM( RTF_NUMRULE_NAME " 1" )));
-                aEntry.nListDocPos = pDoc->MakeNumRule( sTmp );
+                aEntry.nListDocPos = pDoc->MakeNumRule( sTmp, 0, FALSE, SvxNumberFormat::LABEL_ALIGNMENT );
                 pCurRule = pDoc->GetNumRuleTbl()[ aEntry.nListDocPos ];
                 // --> OD 2008-07-08 #i91400#
                 pCurRule->SetName( pDoc->GetUniqueNumRuleName( &sTmp, FALSE ),
@@ -1011,8 +983,8 @@ NUMATTR_SETUNDERLINE:
         case RTF_PNINDENT:
             if( 0 > short( nTokenValue ) )
                 nTokenValue = - (short)nTokenValue;
-            pCurNumFmt->SetFirstLineOffset( - short( nTokenValue ));
-            pCurNumFmt->SetAbsLSpace( (nLevel + 1 ) * USHORT( nTokenValue ));
+            pCurNumFmt->SetFirstLineIndent( - nTokenValue );
+            pCurNumFmt->SetIndentAt( (nLevel + 1 ) * nTokenValue );
             break;
         case RTF_PNSP:
             pCurNumFmt->SetCharTextDistance( USHORT( nTokenValue ));
@@ -1288,8 +1260,8 @@ void SwRTFWriter::OutRTFListTab()
             }
 
             Strm() << OOO_STRING_SVTOOLS_RTF_FI;
-            OutLong( rFmt.GetFirstLineOffset() ) << OOO_STRING_SVTOOLS_RTF_LI;
-            OutLong( rFmt.GetAbsLSpace() );
+            OutLong( rFmt.GetFirstLineIndent() ) << OOO_STRING_SVTOOLS_RTF_LI;
+            OutLong( rFmt.GetIndentAt() );
 
             Strm() << '}';
 
@@ -1401,9 +1373,9 @@ BOOL SwRTFWriter::OutListNum( const SwTxtNode& rNd )
         SfxItemSet aSet( *rNdSet.GetPool(), rNdSet.GetRanges() );
         aSet.SetParent( &rNdSet );
         SvxLRSpaceItem aLR( (SvxLRSpaceItem&)rNdSet.Get( RES_LR_SPACE ) );
-        aLR.SetTxtLeft( aLR.GetTxtLeft() + pFmt->GetAbsLSpace() );
+        aLR.SetTxtLeft( aLR.GetTxtLeft() + pFmt->GetIndentAt() );
 
-        aLR.SetTxtFirstLineOfst( pFmt->GetFirstLineOffset() );
+        aLR.SetTxtFirstLineOfst( pFmt->GetFirstLineIndent() );
         if ( bExportNumRule )
             Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LISTTEXT << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN << ' ';
 


More information about the ooo-build-commit mailing list