[Libreoffice-commits] .: 7 commits - sw/inc sw/source

Christina Rossmanith crossmanith at kemper.freedesktop.org
Sat Jun 4 23:44:12 PDT 2011


 sw/inc/doc.hxx                     |    5 
 sw/source/core/bastyp/calc.cxx     |    9 
 sw/source/core/doc/docglbl.cxx     |  514 +++++++------------------------------
 sw/source/core/docnode/section.cxx |   18 -
 sw/source/filter/html/htmltab.cxx  |  117 +++-----
 sw/source/filter/html/svxcss1.cxx  |    9 
 sw/source/filter/html/swhtml.hxx   |   45 +--
 sw/source/filter/ww8/types.hxx     |    6 
 sw/source/filter/ww8/typessw.hxx   |   46 ---
 sw/source/ui/uiview/view2.cxx      |    2 
 10 files changed, 192 insertions(+), 579 deletions(-)

New commits:
commit 2a05677aabf77bfffe3517d9a7515060b611d999
Author: Christina Rossmanith <ChrRossmanith at web.de>
Date:   Tue May 31 13:55:41 2011 +0200

    Duplicate code: join ImportFrom and InsertFrom

diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 5483aa6..6498ddc 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -2035,7 +2035,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe
                     else
                     {
                         ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
-                        nErrno = pDocSh->InsertFrom( *pMedium ) ? 0 : ERR_SWG_READ_ERROR;
+                        nErrno = pDocSh->ImportFrom( *pMedium, true ) ? 0 : ERR_SWG_READ_ERROR;
                     }
 
                 }
commit 14797f1b19afeff9e46ec8689ae5655558336011
Author: Christina Rossmanith <ChrRossmanith at web.de>
Date:   Thu May 26 17:06:40 2011 +0200

    Removed source/filter/ww8/typessw.hxx and #include

diff --git a/sw/source/filter/ww8/types.hxx b/sw/source/filter/ww8/types.hxx
index af9df20..43fc7f9 100644
--- a/sw/source/filter/ww8/types.hxx
+++ b/sw/source/filter/ww8/types.hxx
@@ -31,12 +31,6 @@
 
 #include <vector>
 
-//if part of OOo
-#include "typessw.hxx"
-//else
-//include standalonetypes.hxx
-//endif
-
 namespace ww
 {
     typedef std::vector<sal_uInt8> bytes;
diff --git a/sw/source/filter/ww8/typessw.hxx b/sw/source/filter/ww8/typessw.hxx
deleted file mode 100644
index 0c35a3b..0000000
--- a/sw/source/filter/ww8/typessw.hxx
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef WW_TYPESSW
-#define WW_TYPESSW
-
-#include <sal/types.h>
-
-namespace ww
-{
-    typedef sal_Int8 sal_Int8;
-    typedef sal_Int16 sal_Int16;
-    typedef sal_Int32 sal_Int32;
-    typedef sal_uInt8 sal_uInt8;
-    typedef sal_uInt16 sal_uInt16;
-    typedef sal_uInt32 sal_uInt32;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 66a1f224d6ef5bff3184086aee35be0f6170ced1
Author: Christina Rossmanith <ChrRossmanith at web.de>
Date:   Thu May 26 17:03:18 2011 +0200

    Replaced sal_Bool with bool

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index e19f7d1..da05449 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -669,7 +669,7 @@ private:
 
     // Create sub-documents according to the given collection.
     // If no collection is given, take chapter style of the 1st level.
-    sal_Bool SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOutline,
+    bool SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline,
                         const SwTxtFmtColl* pSplitColl, int nOutlineLevel = 0 );
 
     // Update charts of given table.
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 517efc4..2344488 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -71,23 +71,23 @@ enum SwSplitDocType
 sal_Bool SwDoc::GenerateGlobalDoc( const String& rPath,
                                    const SwTxtFmtColl* pSplitColl )
 {
-    return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, sal_False, pSplitColl, 0 );
+    return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, false, pSplitColl, 0 );
 }
 
 sal_Bool SwDoc::GenerateGlobalDoc( const String& rPath, int nOutlineLevel )
 {
-    return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, sal_True, 0, nOutlineLevel );
+    return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, true, 0, nOutlineLevel );
 }
 
 sal_Bool SwDoc::GenerateHTMLDoc( const String& rPath, int nOutlineLevel )
 {
-    return SplitDoc( SPLITDOC_TO_HTML, rPath, sal_True, 0, nOutlineLevel );
+    return SplitDoc( SPLITDOC_TO_HTML, rPath, true, 0, nOutlineLevel );
 }
 
 sal_Bool SwDoc::GenerateHTMLDoc( const String& rPath,
                                  const SwTxtFmtColl* pSplitColl )
 {
-    return SplitDoc( SPLITDOC_TO_HTML, rPath, sal_False, pSplitColl, 0 );
+    return SplitDoc( SPLITDOC_TO_HTML, rPath, false, pSplitColl, 0 );
 }
 
 // two helpers for outline mode
@@ -159,7 +159,7 @@ SwNodePtr GetEndNode( const SwOutlineNodes* pOutlNds, const SwTxtFmtColl* pSplit
     return 0;
 }
 
-sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOutline, const SwTxtFmtColl* pSplitColl, int nOutlineLevel )
+bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, bool bOutline, const SwTxtFmtColl* pSplitColl, int nOutlineLevel )
 {
     // ueber alle Node der Vorlage Iterieren und dafuer einzelne
     // Dokumente erzeugen und in diesem gegen
@@ -169,7 +169,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
     // Am Ende wird dieses Doc als GlobalDoc/HTML-Doc gespreichert.
     if( !pDocShell || !pDocShell->GetMedium() ||
         ( SPLITDOC_TO_GLOBALDOC == eDocType && get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) )
-        return sal_False;
+        return false;
 
     sal_uInt16 nOutl = 0;
     SwOutlineNodes* pOutlNds = (SwOutlineNodes*)&GetNodes().GetOutLineNds();
@@ -191,7 +191,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
             if( !pOutlNds->Count() )
             {
                 delete pOutlNds;
-                return sal_False;
+                return false;
             }
         }
     }
@@ -207,7 +207,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
             }
 
         if( !pSplitColl )
-            return sal_False;
+            return false;
     }
     }
 
@@ -227,7 +227,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
     }
 
     if( !pFilter )
-        return sal_False;
+        return false;
 
     // Undo/Redline aufjedenfall abschalten
     GetIDocumentUndoRedo().DoUndo(false);
@@ -444,7 +444,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
                             if( pSectNd->GetIndex() + 1 ==
                                     pStartNd->GetIndex() )
                             {
-                                sal_Bool bMvIdx = aEndIdx == *pSectEnd;
+                                bool bMvIdx = aEndIdx == *pSectEnd;
                                 DelSectionFmt( pSectNd->GetSection().GetFmt() );
                                 if( bMvIdx )
                                     aEndIdx--;
commit 99dd430d885b0f99902e0587076954978ad9c672
Author: Christina Rossmanith <ChrRossmanith at web.de>
Date:   Thu May 26 16:58:59 2011 +0200

    __cdecl -> SAL_CALL

diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 2bd18ed..6bf8e26 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -167,14 +167,7 @@ const sal_Int32 coContFlags =
 
 
 extern "C" {
-static int
-#if defined( WNT )
- __cdecl
-#endif
-#if defined( ICC )
- _Optlink
-#endif
-    OperatorCompare( const void *pFirst, const void *pSecond)
+static int SAL_CALL OperatorCompare( const void *pFirst, const void *pSecond)
 {
     int nRet = 0;
     if( CALC_NAME == ((_CalcOp*)pFirst)->eOp )
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 9dd4632..4d72c1c 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -906,14 +906,7 @@ sal_Bool SwSectionFmt::GetInfo( SfxPoolItem& rInfo ) const
 
 extern "C" {
 
-    int
-#if defined( WNT )
-     __cdecl
-#endif
-#if defined( ICC )
-     _Optlink
-#endif
-        lcl_SectionCmpPos( const void *pFirst, const void *pSecond)
+    int SAL_CALL lcl_SectionCmpPos( const void *pFirst, const void *pSecond)
     {
         const SwSectionFmt* pFSectFmt = (*(SwSectionPtr*)pFirst)->GetFmt();
         const SwSectionFmt* pSSectFmt = (*(SwSectionPtr*)pSecond)->GetFmt();
@@ -925,14 +918,7 @@ extern "C" {
                       pSSectFmt->GetCntnt(sal_False).GetCntntIdx()->GetIndex();
     }
 
-    int
-#if defined( WNT )
-     __cdecl
-#endif
-#if defined( ICC )
-     _Optlink
-#endif
-        lcl_SectionCmpNm( const void *pFirst, const void *pSecond)
+    int SAL_CALL lcl_SectionCmpNm( const void *pFirst, const void *pSecond)
     {
         const SwSectionPtr pFSect = *(SwSectionPtr*)pFirst;
         const SwSectionPtr pSSect = *(SwSectionPtr*)pSecond;
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 9359a29..117ef4e 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -3172,14 +3172,7 @@ static int bSortedPropFns = sal_False;
 
 extern "C"
 {
-static int
-#if defined( WNT )
- __cdecl
-#endif
-#if defined( ICC )
- _Optlink
-#endif
-    CSS1PropEntryCompare( const void *pFirst, const void *pSecond)
+static int SAL_CALL CSS1PropEntryCompare( const void *pFirst, const void *pSecond)
 {
     int nRet;
     if( ((CSS1PropEntry*)pFirst)->pFunc )
commit dfdd863c8efaaf21ac6da0074a61cc14f2a78fd8
Author: Christina Rossmanith <ChrRossmanith at web.de>
Date:   Tue May 17 21:18:20 2011 +0200

    Renamed SttNd to StartNd

diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index cb066c7..517efc4 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -91,7 +91,7 @@ sal_Bool SwDoc::GenerateHTMLDoc( const String& rPath,
 }
 
 // two helpers for outline mode
-SwNodePtr GetSttNode( SwOutlineNodes* pOutlNds, int nOutlineLevel, sal_uInt16* nOutl )
+SwNodePtr GetStartNode( SwOutlineNodes* pOutlNds, int nOutlineLevel, sal_uInt16* nOutl )
 {
     SwNodePtr pNd;
 
@@ -124,7 +124,7 @@ SwNodePtr GetEndNode( SwOutlineNodes* pOutlNds, int nOutlineLevel, sal_uInt16* n
 }
 
 // two helpers for collection mode
-SwNodePtr GetSttNode( const SwOutlineNodes* pOutlNds, const SwTxtFmtColl* pSplitColl, sal_uInt16* nOutl )
+SwNodePtr GetStartNode( const SwOutlineNodes* pOutlNds, const SwTxtFmtColl* pSplitColl, sal_uInt16* nOutl )
 {
     SwNodePtr pNd;
     for( ; *nOutl < pOutlNds->Count(); ++(*nOutl) )
@@ -173,7 +173,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
 
     sal_uInt16 nOutl = 0;
     SwOutlineNodes* pOutlNds = (SwOutlineNodes*)&GetNodes().GetOutLineNds();
-    SwNodePtr pSttNd;
+    SwNodePtr pStartNd;
 
     if ( !bOutline) {
     if( pSplitColl )
@@ -260,11 +260,11 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
 
     do {
         if( bOutline )
-            pSttNd = GetSttNode( pOutlNds, nOutlineLevel, &nOutl );
+            pStartNd = GetStartNode( pOutlNds, nOutlineLevel, &nOutl );
         else
-            pSttNd = GetSttNode( pOutlNds, pSplitColl, &nOutl );
+            pStartNd = GetStartNode( pOutlNds, pSplitColl, &nOutl );
 
-        if( pSttNd )
+        if( pStartNd )
         {
             SwNodePtr pEndNd;
             if( bOutline )
@@ -276,7 +276,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
 
             // die Nodes komplett rausschreiben
             String sFileName;
-            if( pSttNd->GetIndex() + 1 < aEndIdx.GetIndex() )
+            if( pStartNd->GetIndex() + 1 < aEndIdx.GetIndex() )
             {
                 SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL ));
                 if( xDocSh->DoInitNew( 0 ) )
@@ -303,7 +303,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
                     String sTitle( xDocProps->getTitle() );
                     if( sTitle.Len() )
                         sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ));
-                    sTitle += ((SwTxtNode*)pSttNd)->GetExpandTxt();
+                    sTitle += ((SwTxtNode*)pStartNd)->GetExpandTxt();
                     xDocProps->setTitle( sTitle );
 
                     // Vorlagen ersetzen
@@ -313,7 +313,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
                     if( pOutlineRule )
                         pDoc->SetOutlineNumRule( *pOutlineRule );
 
-                    SwNodeRange aRg( *pSttNd, 0, aEndIdx.GetNode() );
+                    SwNodeRange aRg( *pStartNd, 0, aEndIdx.GetNode() );
                     SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() );
                     GetNodes()._Copy( aRg, aTmpIdx, sal_False );
 
@@ -364,10 +364,10 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
                         // loesche alle Nodes im Bereich und setze im "Start-
                         // Node" den Link auf das gespeicherte Doc
                         sal_uLong nNodeDiff = aEndIdx.GetIndex() -
-                                            pSttNd->GetIndex() - 1;
+                                            pStartNd->GetIndex() - 1;
                         if( nNodeDiff )
                         {
-                            SwPaM aTmp( *pSttNd, aEndIdx.GetNode(), 1, -1 );
+                            SwPaM aTmp( *pStartNd, aEndIdx.GetNode(), 1, -1 );
                             aTmp.GetPoint()->nContent.Assign( 0, 0 );
                             aTmp.GetMark()->nContent.Assign( 0, 0 );
                             SwNodeIndex aSIdx( aTmp.GetMark()->nNode );
@@ -409,13 +409,13 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
 
                         // dann setze im StartNode noch den Link:
                         SwFmtINetFmt aINet( sFileName , aEmptyStr );
-                        SwTxtNode* pTNd = (SwTxtNode*)pSttNd;
+                        SwTxtNode* pTNd = (SwTxtNode*)pStartNd;
                         pTNd->InsertItem( aINet, 0, pTNd->GetTxt().Len() );
 
                         // wenn der nicht mehr gefunden wird, kann das nur
                         // ein Bug sein!
-                        if( !pOutlNds->Seek_Entry( pSttNd, &nOutl ))
-                            pSttNd = 0;
+                        if( !pOutlNds->Seek_Entry( pStartNd, &nOutl ))
+                            pStartNd = 0;
                         ++nOutl;
                     }
                     break;
@@ -436,13 +436,13 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
                         // JP 06.07.99 - Bug 67361 - is any Section ends or
                         // starts in the new sectionrange, they must end or
                         // start before or behind the range!
-                        SwSectionNode* pSectNd = pSttNd->FindSectionNode();
+                        SwSectionNode* pSectNd = pStartNd->FindSectionNode();
                         while( pSectNd && pSectNd->EndOfSectionIndex()
                                 <= aEndIdx.GetIndex() )
                         {
                             const SwNode* pSectEnd = pSectNd->EndOfSectionNode();
                             if( pSectNd->GetIndex() + 1 ==
-                                    pSttNd->GetIndex() )
+                                    pStartNd->GetIndex() )
                             {
                                 sal_Bool bMvIdx = aEndIdx == *pSectEnd;
                                 DelSectionFmt( pSectNd->GetSection().GetFmt() );
@@ -451,16 +451,16 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
                             }
                             else
                             {
-                                SwNodeRange aRg( *pSttNd, *pSectEnd );
+                                SwNodeRange aRg( *pStartNd, *pSectEnd );
                                 SwNodeIndex aIdx( *pSectEnd, 1 );
                                 GetNodes()._MoveNodes( aRg, GetNodes(), aIdx );
                             }
-                            pSectNd = pSttNd->FindSectionNode();
+                            pSectNd = pStartNd->FindSectionNode();
                         }
 
                         pSectNd = aEndIdx.GetNode().FindSectionNode();
                         while( pSectNd && pSectNd->GetIndex() >
-                                pSttNd->GetIndex() )
+                                pStartNd->GetIndex() )
                         {
                             // #i15712# don't attempt to split sections if
                             // they are fully enclosed in [pSectNd,aEndIdx].
@@ -471,12 +471,12 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
                                 GetNodes()._MoveNodes( aRg, GetNodes(), aIdx );
                             }
 
-                            pSectNd = pSttNd->FindSectionNode();
+                            pSectNd = pStartNd->FindSectionNode();
                         }
 
                         // -> #i26762#
                         // Ensure order of start and end of section is sane.
-                        SwNodeIndex aStartIdx(*pSttNd);
+                        SwNodeIndex aStartIdx(*pStartNd);
 
                         if (aEndIdx >= aStartIdx)
                         {
@@ -496,7 +496,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOu
                 }
             }
         }
-    } while( pSttNd );
+    } while( pStartNd );
 
     if( pOutlNds != &GetNodes().GetOutLineNds() )
         delete pOutlNds;
commit 1411d54aac67b48d4e32957a54106833c0600145
Author: Christina Rossmanith <ChrRossmanith at web.de>
Date:   Thu May 12 10:07:33 2011 +0200

    Translated comments

diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index cffc633..7b2e2c6 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -89,7 +89,7 @@ static HTMLOptionEnum aHTMLTblVAlignTable[] =
 
 /*  */
 
-// Die Optionen eines Table-Tags
+// table tags options
 
 struct HTMLTableOptions
 {
@@ -123,11 +123,11 @@ struct HTMLTableOptions
 
 class _HTMLTableContext
 {
-    SwHTMLNumRuleInfo aNumRuleInfo;	// Vor der Tabelle gueltige Numerierung
+    SwHTMLNumRuleInfo aNumRuleInfo;	// Numbering valid before the table
 
-    SwTableNode *pTblNd;			// der Tabellen-Node
-    SwFrmFmt *pFrmFmt;              // der Fly frame::Frame, in dem die Tabelle steht
-    SwPosition *pPos;				// die Position hinter der Tabelle
+    SwTableNode *pTblNd;			// table node
+    SwFrmFmt *pFrmFmt;              // der Fly frame::Frame, containing the table
+    SwPosition *pPos;				// position behind the table
 
     sal_uInt16 nContextStAttrMin;
     sal_uInt16 nContextStMin;
@@ -138,7 +138,7 @@ class _HTMLTableContext
 
 public:
 
-    _HTMLAttrTable aAttrTab;		// und die Attribute
+    _HTMLAttrTable aAttrTab;		// attributes
 
     _HTMLTableContext( SwPosition *pPs, sal_uInt16 nCntxtStMin,
                        sal_uInt16 nCntxtStAttrMin ) :
@@ -176,16 +176,16 @@ public:
 
 /*  */
 
-// der Inhalt einer Zelle ist eine verkettete Liste mit SwStartNodes und
+// Cell content is a linked list with SwStartNodes and
 // HTMLTables.
 
 class HTMLTableCnts
 {
-    HTMLTableCnts *pNext;				// der naechste Inhalt
+    HTMLTableCnts *pNext;				// next content
 
-    // von den beiden naechsten Pointern darf nur einer gesetzt sein!
-    const SwStartNode *pStartNode;		// ein Abastz
-    HTMLTable *pTable;					// eine Tabelle
+    // Only one of the next two pointers must be set!
+    const SwStartNode *pStartNode;		// a paragraph
+    HTMLTable *pTable;					// a table
 
     SwHTMLTableLayoutCnts* pLayoutInfo;
 
@@ -198,17 +198,17 @@ public:
     HTMLTableCnts( const SwStartNode* pStNd );
     HTMLTableCnts( HTMLTable* pTab );
 
-    ~HTMLTableCnts();					// nur in ~HTMLTableCell erlaubt
+    ~HTMLTableCnts();					// only allowed in ~HTMLTableCell
 
-    // Ermitteln des SwStartNode bzw. der HTMLTable
+    // Determine SwStartNode and HTMLTable respectively
     const SwStartNode *GetStartNode() const { return pStartNode; }
     const HTMLTable *GetTable() const { return pTable; }
     HTMLTable *GetTable() { return pTable; }
 
-    // hinzufuegen eines neuen Knotens am Listenende
+    // Add a new node at the end of the list
     void Add( HTMLTableCnts* pNewCnts );
 
-    // Ermitteln des naechsten Knotens
+    // Determine next node
     const HTMLTableCnts *Next() const { return pNext; }
     HTMLTableCnts *Next() { return pNext; }
 
@@ -221,24 +221,23 @@ public:
 
 /*  */
 
-// Eine Zelle der HTML-Tabelle
-
+// Cell of a HTML table
 class HTMLTableCell
 {
-    // !!!ACHTUNG!!!!! Fuer jeden neuen Pointer muss die SetProtected-
-    // Methode (und natuerlich der Destruktor) bearbeitet werden.
-    HTMLTableCnts *pContents;  		// der Inhalt der Zelle
-    SvxBrushItem *pBGBrush;	   		// Hintergrund der Zelle
-    // !!!ACHTUNG!!!!!
+    // !!!ATTENTION!!!!! For each new pointer the SetProtected
+    // method (and the dtor) has to be executed.
+    HTMLTableCnts *pContents;  		// cell content
+    SvxBrushItem *pBGBrush;	   		// cell background
+    // !!!ATTENTION!!!!!
 
     sal_uInt32 nNumFmt;
-    sal_uInt16 nRowSpan;				// ROWSPAN der Zelle
-    sal_uInt16 nColSpan;	  			// COLSPAN der Zelle
-    sal_uInt16 nWidth;					// WIDTH der Zelle
+    sal_uInt16 nRowSpan;				// cell ROWSPAN
+    sal_uInt16 nColSpan;	  			// cell COLSPAN
+    sal_uInt16 nWidth;					// cell WIDTH
     double nValue;
-    sal_Int16 eVertOri;         // vertikale Ausrichtung der Zelle
-    sal_Bool bProtected : 1;			// Zelle darf nicht belegt werden
-    sal_Bool bRelWidth : 1;				// nWidth ist %-Angabe
+    sal_Int16 eVertOri;         // vertical alignment of the cell
+    sal_Bool bProtected : 1;			// cell must not filled
+    sal_Bool bRelWidth : 1;				// nWidth is given in %
     sal_Bool bHasNumFmt : 1;
     sal_Bool bHasValue : 1;
     sal_Bool bNoWrap : 1;
@@ -246,25 +245,25 @@ class HTMLTableCell
 
 public:
 
-    HTMLTableCell();				// neue Zellen sind immer leer
+    HTMLTableCell();				// new cells always empty
 
-    ~HTMLTableCell();				// nur in ~HTMLTableRow erlaubt
+    ~HTMLTableCell();				// only allowed in ~HTMLTableRow
 
-    // Belegen einer nicht-leeren Zelle
+    // Fill a not empty cell
     void Set( HTMLTableCnts *pCnts, sal_uInt16 nRSpan, sal_uInt16 nCSpan,
               sal_Int16 eVertOri, SvxBrushItem *pBGBrush,
               sal_Bool bHasNumFmt, sal_uInt32 nNumFmt,
               sal_Bool bHasValue, double nValue, sal_Bool bNoWrap, sal_Bool bCovered );
 
-    // Schuetzen einer leeren 1x1-Zelle
+    // Protect an empty 1x1 cell
     void SetProtected();
 
-    // Setzen/Ermitteln des Inhalts einer Zelle
+    // Set/Get cell content
     void SetContents( HTMLTableCnts *pCnts ) { pContents = pCnts; }
     const HTMLTableCnts *GetContents() const { return pContents; }
     HTMLTableCnts *GetContents() { return pContents; }
 
-    // ROWSPAN/COLSPAN der Zelle Setzen/Ermitteln
+    // Set/Get cell ROWSPAN/COLSPAN
     void SetRowSpan( sal_uInt16 nRSpan ) { nRowSpan = nRSpan; }
     sal_uInt16 GetRowSpan() const { return nRowSpan; }
 
@@ -280,7 +279,7 @@ public:
 
     sal_Int16 GetVertOri() const { return eVertOri; }
 
-    // Ist die Zelle belegt oder geschuetzt?
+    // Is the cell filled or protected ?
     sal_Bool IsUsed() const { return pContents!=0 || bProtected; }
 
     SwHTMLTableLayoutCell *CreateLayoutInfo();
@@ -290,41 +289,38 @@ public:
 
 /*  */
 
-// Eine Zeile der HTML-Tabelle
-
+// Row of a HTML table
 typedef HTMLTableCell* HTMLTableCellPtr;
 SV_DECL_PTRARR_DEL(HTMLTableCells,HTMLTableCellPtr,5,5)
 
 class HTMLTableRow
 {
-    HTMLTableCells *pCells;				// die Zellen der Zeile
+    HTMLTableCells *pCells;				// cells of the row
 
     sal_Bool bIsEndOfGroup : 1;
     sal_Bool bSplitable : 1;
 
-    sal_uInt16 nHeight;						// Optionen von <TR>/<TD>
-    sal_uInt16 nEmptyRows;					// wieviele Leere Zeilen folgen
+    sal_uInt16 nHeight;						// options of <TR>/<TD>
+    sal_uInt16 nEmptyRows;					// number of empty rows are following
 
     SvxAdjust eAdjust;
     sal_Int16 eVertOri;
-    SvxBrushItem *pBGBrush;	   			// Hintergrund der Zelle aus STYLE
+    SvxBrushItem *pBGBrush;	   			// background of cell from STYLE
 
 public:
 
-    sal_Bool bBottomBorder;					// kommt hinter der Zeile eine Linie?
+    sal_Bool bBottomBorder;					// Is there a line after the row?
 
-    HTMLTableRow( sal_uInt16 nCells=0 );	// die Zellen der Zeile sind leer
+    HTMLTableRow( sal_uInt16 nCells=0 );	// cells of the row are empty
 
     ~HTMLTableRow();
 
     inline void SetHeight( sal_uInt16 nHeight );
     sal_uInt16 GetHeight() const { return nHeight; }
 
-    // Ermitteln einer Zelle
     inline HTMLTableCell *GetCell( sal_uInt16 nCell ) const;
     inline const HTMLTableCells *GetCells() const { return pCells; }
 
-
     inline void SetAdjust( SvxAdjust eAdj ) { eAdjust = eAdj; }
     inline SvxAdjust GetAdjust() const { return eAdjust; }
 
@@ -340,25 +336,23 @@ public:
     void IncEmptyRows() { nEmptyRows++; }
     sal_uInt16 GetEmptyRows() const { return nEmptyRows; }
 
-    // Expandieren einer Zeile durch hinzufuegen leerer Zellen
+    // Expand row by adding empty cells
     void Expand( sal_uInt16 nCells, sal_Bool bOneCell=sal_False );
 
-    // Verkuerzen einer Zeile durch loesen von leeren Zellen
+    // Shrink row by deleting empty cells
     void Shrink( sal_uInt16 nCells );
 
     void SetSplitable( sal_Bool bSet ) { bSplitable = bSet; }
     sal_Bool IsSplitable() const { return bSplitable; }
 };
 
-/*  */
-
-// Eine Spalte der HTML-Tabelle
 
+// Column of a HTML table
 class HTMLTableColumn
 {
     sal_Bool bIsEndOfGroup;
 
-    sal_uInt16 nWidth;						// Optionen von <COL>
+    sal_uInt16 nWidth;						// options of <COL>
     sal_Bool bRelWidth;
 
     SvxAdjust eAdjust;
@@ -371,7 +365,7 @@ class HTMLTableColumn
 
 public:
 
-    sal_Bool bLeftBorder; 					// kommt vor der Spalte eine Linie
+    sal_Bool bLeftBorder; 					// is there a line before the column
 
     HTMLTableColumn();
 
@@ -394,10 +388,8 @@ public:
     SwHTMLTableLayoutColumn *CreateLayoutInfo();
 };
 
-/*  */
-
-// eine HTML-Tabelle
 
+// HTML table
 typedef HTMLTableRow* HTMLTableRowPtr;
 SV_DECL_PTRARR_DEL(HTMLTableRows,HTMLTableRowPtr,5,5)
 
@@ -413,16 +405,15 @@ class HTMLTable
     String aClass;
     String aDir;
 
-    SdrObjects *pResizeDrawObjs;// SDR-Objekte
-    SvUShorts *pDrawObjPrcWidths;	// Spalte des Zeichen-Objekts und dessen
-                                    // relative Breite
+    SdrObjects *pResizeDrawObjs;// SDR objects
+    SvUShorts *pDrawObjPrcWidths;	// column of draw object and its rel. width
 
-    HTMLTableRows *pRows;			// die Zeilen der Tabelle
-    HTMLTableColumns *pColumns;     // die Spalten der Tabelle
+    HTMLTableRows *pRows;			// table rows
+    HTMLTableColumns *pColumns;     // table columns
 
-    sal_uInt16 nRows;					// Anzahl Zeilen
-    sal_uInt16 nCols;       			// Anzahl Spalten
-    sal_uInt16 nFilledCols;				// Anzahl tatsaechlich gefuellter Spalten
+    sal_uInt16 nRows;					// number of rows
+    sal_uInt16 nCols;       			// number of columns
+    sal_uInt16 nFilledCols;				// number of filled columns
 
     sal_uInt16 nCurRow;					// aktuelle Zeile
     sal_uInt16 nCurCol;     			// aktuelle Spalte
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index ab5eb53..a2b895c 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -781,7 +781,7 @@ private:
     // ein Event an ein VC-Control anhaengen (htmlform.cxx)
     void InsertBasicCtrlEvent( sal_uInt16 nEvent, const String& rName );
 
-    // Einfuegen von Styles
+    // Inserting styles
 
     // <STYLE>
     void NewStyle();
@@ -796,9 +796,9 @@ private:
                              const String *pLang=0, const String *pDir=0 );
 
 
-    // Einfuegen von Controls und ::com::sun::star::form::Forms (htmlform.cxx)
+    // Inserting Controls and ::com::sun::star::form::Forms (htmlform.cxx)
 
-    // Ein Draw-Objekt in das Dokuement eintragen
+    // Insert draw object into document
     void InsertDrawObject( SdrObject* pNewDrawObj, const Size& rSpace,
                            sal_Int16 eVertOri,
                            sal_Int16 eHoriOri,
@@ -827,12 +827,10 @@ private:
     void RegisterDrawObjectToTable( HTMLTable *pCurTable, SdrObject* pObj,
                                     sal_uInt8 nWidth );
 
-
-    // eine neue Form beginnen
     void NewForm( sal_Bool bAppend=sal_True );
     void EndForm( sal_Bool bAppend=sal_True );
 
-    // die Einfuege-Methoden fuer <INPUT>, <TEXTAREA> und <SELECT>
+    // Insert methods for <INPUT>, <TEXTAREA> und <SELECT>
     void InsertInput();
 
     void NewTextArea();
@@ -844,23 +842,21 @@ private:
     void InsertSelectText();
     void EndSelect();
 
-    // Einfuegen von Tabellen (htmltab.cxx)
-
-public:			// wird in Tabellen benoetigt
+    // Inserting tables (htmltab.cxx)
+public:
 
-    // einen Boxen-Inhalt hinter dem angegebenen Node einfuegen
+    // Insert box content after the given node
     const SwStartNode *InsertTableSection( const SwStartNode *pPrevStNd );
 
-    // Einen Boxen-Inhalt am Ende der Tabelle einfuegen, in der der PaM
-    // steht un den PaM in die Zelle schieben
+    // Insert box content at the end of the table containing the PaM
+    // and move the PaM into the cell
     const SwStartNode *InsertTableSection( sal_uInt16 nPoolId );
 
-    // Einfeuge-Methoden fuer die diversen Tabellen-Tags
+    // Insert methods for various table tags
     HTMLTableCnts *InsertTableContents( sal_Bool bHead );
 
 private:
-    // Eine Section fuer die voruebergende Aufnahme der Tabellen-Ueberschrift
-    // anlegen
+    // Create a section for the temporary storage of the table caption
     SwStartNode *InsertTempTableCaptionSection();
 
     void BuildTableCell( HTMLTable *pTable, sal_Bool bReadOptions, sal_Bool bHead );
@@ -876,7 +872,7 @@ private:
                            sal_Bool bHasToFlow = sal_False );
 
 
-    // sonstiges ...
+    // misc ...
 
     void ParseMoreMetaOptions();
 
@@ -895,19 +891,18 @@ private:
     SwNodeIndex *GetFootEndNoteSection( const String& rName );
     void DeleteFootEndNoteImpl();
 
-    // Line-Break am Ende eines Absatzes entfernen
     xub_StrLen StripTrailingLF();
 
-    // Einen leeren Absatz an der PaM-Position entfernen
+    // Remove empty paragraph at the PaM position
     void StripTrailingPara();
 
-    // sind im aktuellen Absatz Fly-Frames vorhanden?
+    // Are there fly frames in the current paragraph?
     sal_Bool HasCurrentParaFlys( sal_Bool bNoSurroundOnly = sal_False,
                              sal_Bool bSurroundOnly = sal_False ) const;
 
-public:			// wird in Tabellen benoetigt
+public:			// used in tables
 
-    // generieren eines BrushItems (mit new) oder 0
+    // Create brush item (with new) or 0
     SvxBrushItem* CreateBrushItem( const Color *pColor,
                                    const String &rImageURL,
                                    const String &rStyle,
@@ -915,11 +910,11 @@ public:			// wird in Tabellen benoetigt
                                    const String &rClass );
 
 protected:
-    // wird fuer jedes Token gerufen, das in CallParser erkannt wird
+    // Executed for each token recognized by CallParser
     virtual void NextToken( int nToken );
     virtual ~SwHTMLParser();
 
-    // wird das Dok geloescht, ist auch der Parser zu loeschen
+    // If the document is removed, remove the parser as well
     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
 
     virtual void AddMetaUserDefined( ::rtl::OUString const & i_rMetaName );
@@ -933,12 +928,12 @@ public:
                     SfxMedium* pMed = 0, sal_Bool bReadUTF8 = sal_False,
                     sal_Bool bIgnoreHTMLComments = sal_False );
 
-    virtual SvParserState CallParser();   // Aufruf des Parsers
+    virtual SvParserState CallParser();
 
 
     sal_uInt16 ToTwips( sal_uInt16 nPixel ) const;
 
-    // fuers asynchrone lesen aus dem SvStream
+    // for reading asynchronously from SvStream
     virtual void Continue( int nToken );
 
     virtual bool ParseMetaOptions( const ::com::sun::star::uno::Reference<
commit 737de89555bd9d1510bb214b6250c902601f68c8
Author: Christina Rossmanith <ChrRossmanith at web.de>
Date:   Thu May 12 10:02:23 2011 +0200

    Cleaning SplitDoc

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 72df51d..e19f7d1 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -669,9 +669,8 @@ private:
 
     // Create sub-documents according to the given collection.
     // If no collection is given, take chapter style of the 1st level.
-    sal_Bool SplitDoc( sal_uInt16 eDocType, const String& rPath,
-                        const SwTxtFmtColl* pSplitColl );
-    sal_Bool SplitDoc( sal_uInt16 eDocType, const String& rPath, int nOutlineLevel = 0 ); 
+    sal_Bool SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOutline,
+                        const SwTxtFmtColl* pSplitColl, int nOutlineLevel = 0 );
 
     // Update charts of given table.
     void _UpdateCharts( const SwTable& rTbl, ViewShell& rVSh ) const;
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 2d6dee0..cb066c7 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -69,30 +69,97 @@ enum SwSplitDocType
 };
 
 sal_Bool SwDoc::GenerateGlobalDoc( const String& rPath,
-                                const SwTxtFmtColl* pSplitColl )
+                                   const SwTxtFmtColl* pSplitColl )
 {
-    return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, pSplitColl );
+    return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, sal_False, pSplitColl, 0 );
 }
 
-//#outline level,add by zhaojianwei
 sal_Bool SwDoc::GenerateGlobalDoc( const String& rPath, int nOutlineLevel )
 {
-    return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, nOutlineLevel );
+    return SplitDoc( SPLITDOC_TO_GLOBALDOC, rPath, sal_True, 0, nOutlineLevel );
 }
+
 sal_Bool SwDoc::GenerateHTMLDoc( const String& rPath, int nOutlineLevel )
 {
-    return SplitDoc( SPLITDOC_TO_HTML, rPath, nOutlineLevel );
+    return SplitDoc( SPLITDOC_TO_HTML, rPath, sal_True, 0, nOutlineLevel );
 }
-//<-end,zhaojianwei
 
 sal_Bool SwDoc::GenerateHTMLDoc( const String& rPath,
-                                const SwTxtFmtColl* pSplitColl )
+                                 const SwTxtFmtColl* pSplitColl )
+{
+    return SplitDoc( SPLITDOC_TO_HTML, rPath, sal_False, pSplitColl, 0 );
+}
+
+// two helpers for outline mode
+SwNodePtr GetSttNode( SwOutlineNodes* pOutlNds, int nOutlineLevel, sal_uInt16* nOutl )
+{
+    SwNodePtr pNd;
+
+    for( ; *nOutl < pOutlNds->Count(); ++(*nOutl) )
+        if( ( pNd = pOutlNds->GetObject( *nOutl ))->GetTxtNode()->GetAttrOutlineLevel() == nOutlineLevel && !pNd->FindTableNode() )
+        {
+            return pNd;
+        }
+
+    return 0;
+}
+
+SwNodePtr GetEndNode( SwOutlineNodes* pOutlNds, int nOutlineLevel, sal_uInt16* nOutl )
+{
+    SwNodePtr pNd;
+
+    for( ++(*nOutl); (*nOutl) < pOutlNds->Count(); ++(*nOutl) )
+    {
+        pNd = pOutlNds->GetObject( *nOutl );
+
+        const int nLevel = pNd->GetTxtNode()->GetAttrOutlineLevel();
+
+        if( ( 0 < nLevel && nLevel <= nOutlineLevel ) &&
+            !pNd->FindTableNode() )
+        {
+            return pNd;
+        }
+    }
+    return 0;
+}
+
+// two helpers for collection mode
+SwNodePtr GetSttNode( const SwOutlineNodes* pOutlNds, const SwTxtFmtColl* pSplitColl, sal_uInt16* nOutl )
+{
+    SwNodePtr pNd;
+    for( ; *nOutl < pOutlNds->Count(); ++(*nOutl) )
+        if( ( pNd = pOutlNds->GetObject( *nOutl ))->GetTxtNode()->
+                    GetTxtColl() == pSplitColl &&
+            !pNd->FindTableNode() )
+        {
+            return pNd;
+        }
+    return 0;
+}
+
+SwNodePtr GetEndNode( const SwOutlineNodes* pOutlNds, const SwTxtFmtColl* pSplitColl, sal_uInt16* nOutl )
 {
-    return SplitDoc( SPLITDOC_TO_HTML, rPath, pSplitColl );
+    SwNodePtr pNd;
+
+    for( ++(*nOutl); *nOutl < pOutlNds->Count(); ++(*nOutl) )
+    {
+        pNd = pOutlNds->GetObject( *nOutl );
+        SwTxtFmtColl* pTColl = pNd->GetTxtNode()->GetTxtColl();
+
+        if( ( pTColl == pSplitColl ||
+              (   pSplitColl->GetAttrOutlineLevel() > 0 &&
+                  pTColl->GetAttrOutlineLevel() > 0	  &&
+                  pTColl->GetAttrOutlineLevel() <
+                  pSplitColl->GetAttrOutlineLevel() )) &&
+            !pNd->FindTableNode() )
+        {
+            return pNd;
+        }
+    }
+    return 0;
 }
 
-sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath,
-                        const SwTxtFmtColl* pSplitColl )
+sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, sal_Bool bOutline, const SwTxtFmtColl* pSplitColl, int nOutlineLevel )
 {
     // ueber alle Node der Vorlage Iterieren und dafuer einzelne
     // Dokumente erzeugen und in diesem gegen
@@ -108,6 +175,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath,
     SwOutlineNodes* pOutlNds = (SwOutlineNodes*)&GetNodes().GetOutLineNds();
     SwNodePtr pSttNd;
 
+    if ( !bOutline) {
     if( pSplitColl )
     {
         // wenn keine OutlineNumerierung ist, dann benutze eigenes Array
@@ -141,6 +209,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath,
         if( !pSplitColl )
             return sal_False;
     }
+    }
 
     const SfxFilter* pFilter;
     switch( eDocType )
@@ -190,38 +259,18 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath,
         ++nOutl;
 
     do {
-        pSttNd = 0;
-
-        SwNodePtr pNd;
-        for( ; nOutl < pOutlNds->Count(); ++nOutl )
-            if( ( pNd = pOutlNds->GetObject( nOutl ))->GetTxtNode()->
-                    GetTxtColl() == pSplitColl &&
-                !pNd->FindTableNode() )
-            {
-                pSttNd = pNd;
-                break;
-            }
+        if( bOutline )
+            pSttNd = GetSttNode( pOutlNds, nOutlineLevel, &nOutl );
+        else
+            pSttNd = GetSttNode( pOutlNds, pSplitColl, &nOutl );
 
         if( pSttNd )
         {
-            SwNodePtr pEndNd = 0;
-            for( ++nOutl; nOutl < pOutlNds->Count(); ++nOutl )
-            {
-                pNd = pOutlNds->GetObject( nOutl );
-                SwTxtFmtColl* pTColl = pNd->GetTxtNode()->GetTxtColl();
-
-                if( ( pTColl == pSplitColl ||
-                    (   pSplitColl->GetAttrOutlineLevel() > 0 &&
-                        pTColl->GetAttrOutlineLevel() > 0	  &&	
-                        pTColl->GetAttrOutlineLevel() <
-                        pSplitColl->GetAttrOutlineLevel() )) &&
-                    !pNd->FindTableNode() )			//<-end,zhaojianwei
-                {
-                    pEndNd = pNd;
-
-                    break;
-                }
-            }
+            SwNodePtr pEndNd;
+            if( bOutline )
+                pEndNd = GetEndNode( pOutlNds, nOutlineLevel, &nOutl );
+            else
+                pEndNd = GetEndNode( pOutlNds, pSplitColl, &nOutl );
             SwNodeIndex aEndIdx( pEndNd ? *pEndNd
                                         : GetNodes().GetEndOfContent() );
 
@@ -293,7 +342,6 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath,
                     if( SPLITDOC_TO_HTML == eDocType &&
                         pDoc->GetSpzFrmFmts()->Count() )
                     {
-                        /* SfxViewFrame* pFrame = */
                             SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
                     }
                     xDocSh->DoSaveAs( *pTmpMed );
@@ -484,344 +532,4 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath,
     return pRet && pRet->GetValue();
 }
 
-//#outline level,add by zhaojianwei
-sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, int nOutlineLevel )
-{
-    if( !pDocShell || !pDocShell->GetMedium() ||
-        ( SPLITDOC_TO_GLOBALDOC == eDocType && get(IDocumentSettingAccess::GLOBAL_DOCUMENT) ) )
-        return sal_False;
-
-    sal_uInt16 nOutl = 0;
-    SwOutlineNodes* pOutlNds = (SwOutlineNodes*)&GetNodes().GetOutLineNds();
-    SwNodePtr pSttNd;
-
-    const SfxFilter* pFilter;
-    switch( eDocType )
-    {
-    case SPLITDOC_TO_HTML:
-        pFilter = SwIoSystem::GetFilterOfFormat( String::CreateFromAscii(
-                            RTL_CONSTASCII_STRINGPARAM( "HTML" )));
-        break;
-
-    default:
-        pFilter = SwIoSystem::GetFilterOfFormat(
-                                    String::CreateFromAscii( FILTER_XML ));
-        eDocType = SPLITDOC_TO_GLOBALDOC;
-        break;
-    }
-
-    if( !pFilter )
-        return sal_False;
-
-    // Undo/Redline aufjedenfall abschalten
-    GetIDocumentUndoRedo().DoUndo(false);
-    SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON));
-
-    String sExt( pFilter->GetSuffixes().GetToken(0, ',') );
-    if( !sExt.Len() )
-        sExt.AssignAscii( "sxw" );
-    if( '.' != sExt.GetChar( 0 ) )
-        sExt.Insert( '.', 0 );
-
-    INetURLObject aEntry(rPath);
-    String sLeading(aEntry.GetBase());
-    aEntry.removeSegment();
-    String sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
-    utl::TempFile aTemp(sLeading,&sExt,&sPath );
-    aTemp.EnableKillingFile();
-
-    DateTime aTmplDate;
-    {
-        Time a2Min( 0 ); a2Min.SetMin( 2 );
-        aTmplDate += a2Min;
-    }
-
-
-    // alle Ungueltigen ueberspringen
-    while( nOutl < pOutlNds->Count() &&
-        pOutlNds->GetObject( nOutl )->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
-        ++nOutl;
-
-    do {
-        pSttNd = 0;
-
-        SwNodePtr pNd;
-        for( ; nOutl < pOutlNds->Count(); ++nOutl )
-            if( ( pNd = pOutlNds->GetObject( nOutl ))->GetTxtNode()->GetAttrOutlineLevel() == nOutlineLevel &&
-                !pNd->FindTableNode() )
-            {
-                pSttNd = pNd;
-                break;
-            }
-
-        if( pSttNd )
-        {
-            SwNodePtr pEndNd = 0;
-            for( ++nOutl; nOutl < pOutlNds->Count(); ++nOutl )
-            {
-                pNd = pOutlNds->GetObject( nOutl );
-
-                const int nLevel = pNd->GetTxtNode()->GetAttrOutlineLevel();
-                
-                if( ( 0 < nLevel && nLevel <= nOutlineLevel ) &&
-                    !pNd->FindTableNode() )
-                {
-                    pEndNd = pNd;
-
-                    break;
-                }
-            }
-            SwNodeIndex aEndIdx( pEndNd ? *pEndNd
-                                        : GetNodes().GetEndOfContent() );
-
-            String sFileName;
-            if( pSttNd->GetIndex() + 1 < aEndIdx.GetIndex() )
-            {
-                SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL ));
-                if( xDocSh->DoInitNew( 0 ) )
-                {
-                    SwDoc* pDoc = ((SwDocShell*)(&xDocSh))->GetDoc();
-
-                    uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
-                        ((SwDocShell*)(&xDocSh))->GetModel(),
-                        uno::UNO_QUERY_THROW);
-                    uno::Reference<document::XDocumentProperties> xDocProps(
-                        xDPS->getDocumentProperties());
-                    OSL_ENSURE(xDocProps.is(), "Doc has no DocumentProperties");
-                    // the GlobalDoc is the template
-                    xDocProps->setTemplateName(aEmptyStr);
-                    ::util::DateTime uDT(aTmplDate.Get100Sec(),
-                        aTmplDate.GetSec(), aTmplDate.GetMin(),
-                        aTmplDate.GetHour(), aTmplDate.GetDay(),
-                        aTmplDate.GetMonth(), aTmplDate.GetYear());
-                    xDocProps->setTemplateDate(uDT);
-                    xDocProps->setTemplateURL(rPath);
-                    //JP 14.06.99: Set the text of the "split para" as title
-                    //				from the new doc. Is the current doc has
-                    //				a title, insert it at begin.
-                    String sTitle( xDocProps->getTitle() );
-                    if( sTitle.Len() )
-                        sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ));
-                    sTitle += ((SwTxtNode*)pSttNd)->GetExpandTxt();
-                    xDocProps->setTitle( sTitle );
-
-                    // Vorlagen ersetzen
-                    pDoc->ReplaceStyles( *this );
-
-                    // KapitelNumerierung uebernehmen
-                    if( pOutlineRule )
-                        pDoc->SetOutlineNumRule( *pOutlineRule );
-
-                    SwNodeRange aRg( *pSttNd, 0, aEndIdx.GetNode() );
-                    SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() );
-                    GetNodes()._Copy( aRg, aTmpIdx, sal_False );
-
-                    // den initialen TextNode loeschen
-                    SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 2 );
-                    if( aIdx.GetIndex() + 1 !=
-                        pDoc->GetNodes().GetEndOfContent().GetIndex() )
-                        pDoc->GetNodes().Delete( aIdx, 1 );
-
-                    // alle Flys in dem Bereich
-                    CopyFlyInFlyImpl( aRg, 0, aIdx );
-
-
-                    // und noch alle Bookmarks
-                    // ?????
-
-                    utl::TempFile aTempFile2(sLeading,&sExt,&sPath );
-                    sFileName = aTempFile2.GetURL();
-                    SfxMedium* pTmpMed = new SfxMedium( sFileName,
-                                                STREAM_STD_READWRITE, sal_True );
-                    pTmpMed->SetFilter( pFilter );
-
-                    // fuer den HTML-Filter mussen wir aber ein Layout
-                    // haben, damit Textrahmen/Controls/OLE-Objecte korrekt
-                    // als Grafik exportiert werden koennen.
-                    if( SPLITDOC_TO_HTML == eDocType &&
-                        pDoc->GetSpzFrmFmts()->Count() )
-                    {
-                            SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
-                    }
-                    xDocSh->DoSaveAs( *pTmpMed );
-                    xDocSh->DoSaveCompleted( pTmpMed );
-
-                    // beim Fehler wird keine FileLinkSection eingefuegt
-                    if( xDocSh->GetError() )
-                        sFileName.Erase();
-                }
-                xDocSh->DoClose();
-            }
-
-            // dann koennen ja die Bereiche eingefuegt werden
-            if( sFileName.Len() )
-            {
-                switch( eDocType )
-                {
-                case SPLITDOC_TO_HTML:
-                    {
-                        // loesche alle Nodes im Bereich und setze im "Start-
-                        // Node" den Link auf das gespeicherte Doc
-                        sal_uLong nNodeDiff = aEndIdx.GetIndex() -
-                                            pSttNd->GetIndex() - 1;
-                        if( nNodeDiff )
-                        {
-                            SwPaM aTmp( *pSttNd, aEndIdx.GetNode(), 1, -1 );
-                            aTmp.GetPoint()->nContent.Assign( 0, 0 );
-                            aTmp.GetMark()->nContent.Assign( 0, 0 );
-                            SwNodeIndex aSIdx( aTmp.GetMark()->nNode );
-                            SwNodeIndex aEIdx( aTmp.GetPoint()->nNode );
-
-                            // versuche hinters Ende zu verschieben
-                            if( !aTmp.Move( fnMoveForward, fnGoNode ) )
-                            {
-                                // na gut, dann an den Anfang
-                                aTmp.Exchange();
-                                if( !aTmp.Move( fnMoveBackward, fnGoNode ))
-                                {
-                                    OSL_FAIL( "kein Node mehr vorhanden" );
-                                }
-                            }
-                                // Bookmarks usw. verschieben
-                            CorrAbs( aSIdx, aEIdx, *aTmp.GetPoint(), sal_True);
-
-                            // stehen noch FlyFrames rum, loesche auch diese
-                            for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
-                            {
-                                SwFrmFmt* pFly = (*GetSpzFrmFmts())[n];
-                                const SwFmtAnchor* pAnchor = &pFly->GetAnchor();
-                                SwPosition const*const pAPos =
-                                    pAnchor->GetCntntAnchor();
-                                if (pAPos &&
-                                    ((FLY_AT_PARA == pAnchor->GetAnchorId()) ||
-                                     (FLY_AT_CHAR == pAnchor->GetAnchorId())) &&
-                                    aSIdx <= pAPos->nNode &&
-                                    pAPos->nNode < aEIdx )
-                                {
-                                    DelLayoutFmt( pFly );
-                                    --n;
-                                }
-                            }
-
-                            GetNodes().Delete( aSIdx, nNodeDiff );
-                        }
-
-                        // dann setze im StartNode noch den Link:
-                        SwFmtINetFmt aINet( sFileName , aEmptyStr );
-                        SwTxtNode* pTNd = (SwTxtNode*)pSttNd;
-                        pTNd->InsertItem( aINet, 0, pTNd->GetTxt().Len() );
-
-                        // wenn der nicht mehr gefunden wird, kann das nur
-                        // ein Bug sein!
-                        if( !pOutlNds->Seek_Entry( pSttNd, &nOutl ))
-                            pSttNd = 0;
-                        ++nOutl;
-                    }
-                    break;
-
-                default:
-                    {
-                        String sNm( INetURLObject( sFileName ).GetName() );
-                        SwSectionData aSectData( FILE_LINK_SECTION,
-                                        GetUniqueSectionName( &sNm ));
-                        SwSectionFmt* pFmt = MakeSectionFmt( 0 );
-                        aSectData.SetLinkFileName(sFileName);
-                        aSectData.SetProtectFlag(true);
-
-                        aEndIdx--;	// im InsertSection ist Ende inclusive
-                        while( aEndIdx.GetNode().IsStartNode() )
-                            aEndIdx--;
-
-                        // JP 06.07.99 - Bug 67361 - is any Section ends or
-                        // starts in the new sectionrange, they must end or
-                        // start before or behind the range!
-                        SwSectionNode* pSectNd = pSttNd->FindSectionNode();
-                        while( pSectNd && pSectNd->EndOfSectionIndex()
-                                <= aEndIdx.GetIndex() )
-                        {
-                            const SwNode* pSectEnd = pSectNd->EndOfSectionNode();
-                            if( pSectNd->GetIndex() + 1 ==
-                                    pSttNd->GetIndex() )
-                            {
-                                sal_Bool bMvIdx = aEndIdx == *pSectEnd;
-                                DelSectionFmt( pSectNd->GetSection().GetFmt() );
-                                if( bMvIdx )
-                                    aEndIdx--;
-                            }
-                            else
-                            {
-                                SwNodeRange aRg( *pSttNd, *pSectEnd );
-                                SwNodeIndex aIdx( *pSectEnd, 1 );
-                                GetNodes()._MoveNodes( aRg, GetNodes(), aIdx );
-                            }
-                            pSectNd = pSttNd->FindSectionNode();
-                        }
-
-                        pSectNd = aEndIdx.GetNode().FindSectionNode();
-                        while( pSectNd && pSectNd->GetIndex() >
-                                pSttNd->GetIndex() )
-                        {
-                            if( aEndIdx < pSectNd->EndOfSectionIndex() )
-                            {
-                                SwNodeRange aRg( *pSectNd, 1, aEndIdx, 1 );
-                                SwNodeIndex aIdx( *pSectNd );
-                                GetNodes()._MoveNodes( aRg, GetNodes(), aIdx );
-                            }
-
-                            pSectNd = pSttNd->FindSectionNode();
-                        }
-
-                        SwNodeIndex aStartIdx(*pSttNd);
-
-                        if (aEndIdx >= aStartIdx)
-                        {
-                            pSectNd = GetNodes().InsertTextSection(aStartIdx,
-                                *pFmt, aSectData, 0, &aEndIdx, false);
-                        }
-                        else
-                        {
-                            pSectNd = GetNodes().InsertTextSection(aEndIdx,
-                                *pFmt, aSectData, 0, &aStartIdx, false);
-                        }
-
-                        pSectNd->GetSection().CreateLink( CREATE_CONNECT );
-                    }
-                    break;
-                }
-            }
-        }
-    } while( pSttNd );
-
-    if( pOutlNds != &GetNodes().GetOutLineNds() )
-        delete pOutlNds;
-
-    switch( eDocType )
-    {
-    case SPLITDOC_TO_HTML:
-        if( get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
-        {
-            while( GetSections().Count() )
-                DelSectionFmt( GetSections()[ 0 ] );
-
-            SfxFilterContainer* pFCntnr = pDocShell->GetFactory().GetFilterContainer();
-            pFilter = pFCntnr->GetFilter4EA( pFilter->GetTypeName(), SFX_FILTER_EXPORT );
-        }
-        break;
-
-//	case SPLITDOC_TO_GLOBALDOC:
-    default:
-        set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true);
-        set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, false);
-    }
-
-    SfxRequest aReq( SID_SAVEASDOC, SFX_CALLMODE_SYNCHRON, GetAttrPool() );
-    aReq.AppendItem( SfxStringItem( SID_FILE_NAME, rPath ) );
-    aReq.AppendItem( SfxBoolItem( SID_SAVETO, sal_True ) );
-    if(pFilter)
-        aReq.AppendItem( SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) );
-    const SfxBoolItem *pRet = (const SfxBoolItem*)pDocShell->ExecuteSlot( aReq );
-
-    return pRet && pRet->GetValue();
-}//<-end,zhaojianwei
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list