ooo-build r13688 - trunk/patches/dev300



Author: ameliaw
Date: Wed Aug 27 03:43:42 2008
New Revision: 13688
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13688&view=rev

Log:
import the content of TOX in sw model



Added:
   trunk/patches/dev300/sw-filter-import-TOX.diff

Added: trunk/patches/dev300/sw-filter-import-TOX.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/sw-filter-import-TOX.diff	Wed Aug 27 03:43:42 2008
@@ -0,0 +1,152 @@
+diff -uNr ../dev300-m21-orig/sw/inc/doc.hxx sw/inc/doc.hxx
+--- ../dev300-m21-orig/sw/inc/doc.hxx	2008-06-13 17:26:11.000000000 +0800
++++ sw/inc/doc.hxx	2008-08-18 17:19:02.000000000 +0800
+@@ -476,6 +476,7 @@
+     bool mbInReading             : 1;    // TRUE: Dokument wird gerade gelesen
+     bool mbInXMLImport           : 1;    // TRUE: During xml import, attribute portion building is not necessary
+     bool mbUpdateTOX             : 1;    // TRUE: nach Dokument laden die TOX Updaten
++    bool mbUpdatePgNumOfTOX      : 1;    // True: only update page number of TOX
+     bool mbInLoadAsynchron       : 1;    // TRUE: Dokument wird gerade asynchron geladen
+     bool mbHTMLMode              : 1;    // TRUE: Dokument ist im HTMLMode
+     bool mbInCallModified        : 1;    // TRUE: im Set/Reset-Modified Link
+@@ -1416,6 +1417,9 @@
+     void SetUpdateTOX( bool bFlag = true )     { mbUpdateTOX = bFlag; }
+     bool IsUpdateTOX() const                   { return mbUpdateTOX; }
+ 
++	void SetUpdatePgNumOfTOX( bool bFlag = true )	{ mbUpdateTOX = mbUpdatePgNumOfTOX = bFlag; }
++	bool IsUpdatePgNumOfTOX() const			{ return mbUpdatePgNumOfTOX; }
++
+ 	const String&	GetTOIAutoMarkURL() const {return sTOIAutoMarkURL;}
+ 	void			SetTOIAutoMarkURL(const String& rSet)  {sTOIAutoMarkURL = rSet;}
+ 	void 			ApplyAutoMark();
+diff -uNr ../dev300-m21-orig/sw/source/core/doc/docnew.cxx sw/source/core/doc/docnew.cxx
+--- ../dev300-m21-orig/sw/source/core/doc/docnew.cxx	2008-06-13 17:35:05.000000000 +0800
++++ sw/source/core/doc/docnew.cxx	2008-08-18 17:20:00.000000000 +0800
+@@ -260,6 +260,7 @@
+ 	mbInReading =
+     mbInXMLImport =
+ 	mbUpdateTOX =
++	mbUpdatePgNumOfTOX =
+ 	mbInLoadAsynchron =
+ 	mbHTMLMode =
+ 	mbInCallModified =
+diff -uNr ../dev300-m21-orig/sw/source/core/doc/doctxm.cxx sw/source/core/doc/doctxm.cxx
+--- ../dev300-m21-orig/sw/source/core/doc/doctxm.cxx	2008-06-13 17:36:06.000000000 +0800
++++ sw/source/core/doc/doctxm.cxx	2008-08-20 17:48:43.000000000 +0800
+@@ -940,10 +940,13 @@
+ 		pDoc->CorrAbs( aSttIdx, aEndIdx, aPos, TRUE );
+ 
+ 		// delete all before
+-		DelFlyInRange( aSttIdx, aEndIdx );
+-		_DelBookmarks( aSttIdx, aEndIdx );
++		if ( !pDoc->IsUpdatePgNumOfTOX() )
++		{
++			DelFlyInRange( aSttIdx, aEndIdx );
++			_DelBookmarks( aSttIdx, aEndIdx );
+ 
+-		pDoc->GetNodes().Delete( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() );
++			pDoc->GetNodes().Delete( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() );
++		}
+ 
+ 	}
+ 
+@@ -1023,7 +1026,24 @@
+ 		aStrArr.Insert( pStr, nCnt );
+ 	}
+ 
++	SwNodeIndex aStartIdx( *pSectNd , 1 );
++	SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() );
++	for (ULONG nPos = 0 ; nPos < aEndIdx.GetIndex()-aStartIdx.GetIndex() ; nPos++ )
++	{
++		SwNodeIndex aPosIdx( aStartIdx, nPos );
++		SwTxtNode * pTxtNd = (SwTxtNode*)aPosIdx.GetNode().GetCntntNode();
++		if ( pTxtNd && ( pTxtNd->GetTxt().Len() == 0 ) && (pTxtNd->IsNumbered() ))
++		{
++			pDoc->GetNodes().Delete( aPosIdx, aEndIdx.GetIndex() - aPosIdx.GetIndex()-1 );
++			break;
++		}
++	}
++
+ 	SwNodeIndex aInsPos( *pFirstEmptyNd, 1 );
++	SwNodeIndex aTmpInsPos( *pSectNd, 1 );
++	if ( pDoc->IsUpdatePgNumOfTOX() )
++		aInsPos = aTmpInsPos;
++
+ 	for( nCnt = 0; nCnt < aSortArr.Count(); ++nCnt )
+ 	{
+ 		::SetProgressState( 0, pDoc->GetDocShell() );
+@@ -1040,7 +1060,18 @@
+ 		}
+ 
+ 		// Generierung: dynamische TabStops setzen
+-		SwTxtNode* pTOXNd = pDoc->GetNodes().MakeTxtNode( aInsPos , pColl );
++		//SwTxtNode* pTOXNd = pDoc->GetNodes().MakeTxtNode( aInsPos , pColl );
++		SwTxtNode* pTOXNd;
++		SwNodeIndex aInx( aInsPos, nCnt );
++		if ( pDoc->IsUpdatePgNumOfTOX() )
++		{
++                        pTOXNd = (SwTxtNode*)aInx.GetNode().GetCntntNode();
++			if ( pTOXNd && (0 == pTOXNd->GetTxt().Len()))
++                                continue;
++		}
++		else
++			pTOXNd = pDoc->GetNodes().MakeTxtNode( aInsPos , pColl );
++
+ 		aSortArr[ nCnt ]->pTOXNd = pTOXNd;
+ 
+ 		// Generierung: Form auswerten und Platzhalter
+diff -uNr ../dev300-m21-orig/sw/source/filter/ww8/ww8par5.cxx sw/source/filter/ww8/ww8par5.cxx
+--- ../dev300-m21-orig/sw/source/filter/ww8/ww8par5.cxx	2008-07-15 17:32:27.000000000 +0800
++++ sw/source/filter/ww8/ww8par5.cxx	2008-08-18 17:28:59.000000000 +0800
+@@ -684,6 +684,12 @@
+         nRet = maFieldStack.back().mnFieldId;
+         switch (nRet)
+         {
++	    case 8: // TOX_INDEX
++	    case 13: // TOX_CONTENT
++	    { // tox hack!!!!
++		pPaM->Move(fnMoveForward);
++	    }
++
+             case 88:
+                 pCtrlStck->SetAttr(*pPaM->GetPoint(),RES_TXTATR_INETFMT);
+             break;
+@@ -704,6 +710,9 @@
+ {
+     switch (nFieldCode)
+     {
++	case 8:
++	case 13: // HACK allow recursive field in TOC...
++
+         case 36:
+         case 68:
+         case 79:
+@@ -3165,7 +3174,8 @@
+     } // ToxBase fertig
+ 
+     // Update fuer TOX anstossen
+-    rDoc.SetUpdateTOX(true);
++    //rDoc.SetUpdateTOX(true);
++    rDoc.SetUpdatePgNumOfTOX( true );
+ 
+     // #i21237#
+     // propagate tab stops from paragraph styles used in TOX to
+@@ -3204,6 +3214,8 @@
+ 
+     rDoc.InsertTableOf(*pPaM->GetPoint(), *aFltTOX.GetBase());
+ 
++    pPaM->Move(fnMoveBackward); // move into TOC section...
++
+     //inserting a toc inserts a section before this point, so adjust pos
+     //for future page/section segment insertion
+     SwPaM aRegion(*pPaM);
+@@ -3230,7 +3242,8 @@
+ 
+     if (!maApos.back()) //a para end in apo doesn't count
+         bWasParaEnd = true;
+-    return FLD_OK;
++//    return FLD_OK;
++    return FLD_TEXT; // HACK so now import the TOC stored in the DOC stream...
+ }
+ 
+ eF_ResT SwWW8ImplReader::Read_F_Shape(WW8FieldDesc* /*pF*/, String& /*rStr*/)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]