incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chen...@apache.org
Subject svn commit: r1383789 - /incubator/ooo/trunk/main/sw/source/core/fields/chpfld.cxx
Date Wed, 12 Sep 2012 05:50:38 GMT
Author: chengjh
Date: Wed Sep 12 05:50:38 2012
New Revision: 1383789

URL: http://svn.apache.org/viewvc?rev=1383789&view=rev
Log:
Fix issue i120759: Bookmark value changed when opening the doc file

* sw/source/core/fields/chpfld.cxx
   MS Word Binary compatibility

Patch by: Fan Zheng,<zheng.easyfan@gmail.com>
Found by: dongjun zong,<zongdj001@gmail.com>
Review by: Jian Hong Cheng,<chengjh@apache.org>

Modified:
    incubator/ooo/trunk/main/sw/source/core/fields/chpfld.cxx

Modified: incubator/ooo/trunk/main/sw/source/core/fields/chpfld.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/fields/chpfld.cxx?rev=1383789&r1=1383788&r2=1383789&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/core/fields/chpfld.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/core/fields/chpfld.cxx Wed Sep 12 05:50:38 2012
@@ -138,6 +138,35 @@ void SwChapterField::ChangeExpansion(con
 
 void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum)
 {
+	//i120759,this function is for both the reference chapter field and normal chapter field
+	//bSrchNum can distinguish the two types,to the latter type,the outline num rule is must...
+	sNumber = aEmptyStr;
+	sTitle = aEmptyStr;
+	sPost = aEmptyStr;
+	sPre = aEmptyStr;
+	//The reference chapter field of normal num rule will be handled in this code segment
+	if (bSrchNum && !rTxtNd.IsOutline())
+	{
+		SwNumRule* pRule(rTxtNd.GetNumRule());
+		if (rTxtNd.IsCountedInList() && pRule)
+		{
+			sNumber = rTxtNd.GetNumString(false);
+			const SwNumFmt& rNFmt = pRule->Get(static_cast<unsigned short>(rTxtNd.GetActualListLevel()));
+			sPost = rNFmt.GetSuffix();
+			sPre = rNFmt.GetPrefix();
+		}
+		else
+		{			
+			sNumber = String("??", RTL_TEXTENCODING_ASCII_US);
+		}
+		sTitle = rTxtNd.GetExpandTxt();
+
+		for( xub_StrLen i = 0; i < sTitle.Len(); ++i )
+			if( ' ' > sTitle.GetChar( i ) )
+				sTitle.Erase( i--, 1 );	
+	}else
+	{
+	//End
 	SwDoc* pDoc = (SwDoc*)rTxtNd.GetDoc();
 	const SwTxtNode *pTxtNd = rTxtNd.FindOutlineNodeOfLevel( nLevel );
 	if( pTxtNd )
@@ -197,13 +226,9 @@ void SwChapterField::ChangeExpansion(con
                 sPost = rNFmt.GetSuffix();
                 sPre = rNFmt.GetPrefix();
             }
-            else
-                sPost = aEmptyStr, sPre = aEmptyStr;
         }
         else
         {
-            sPost = aEmptyStr;
-            sPre = aEmptyStr;
             sNumber = String("??", RTL_TEXTENCODING_ASCII_US);
         }
 
@@ -213,12 +238,6 @@ void SwChapterField::ChangeExpansion(con
 			if( ' ' > sTitle.GetChar( i ) )
 				sTitle.Erase( i--, 1 );
 	}
-	else
-	{
-		sNumber = aEmptyStr;
-		sTitle = aEmptyStr;
-		sPost = aEmptyStr;
-		sPre = aEmptyStr;
 	}
 }
 



Mime
View raw message