summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorJian Hong Cheng <chengjh@apache.org>2012-09-12 04:50:38 +0000
committerJian Hong Cheng <chengjh@apache.org>2012-09-12 04:50:38 +0000
commit6b6ccbcac76eb416b4ece896714d20280761598b (patch)
treee389436d1bdf790ca17669123f174754e3b2607e /sw/source/core
parentdaa4da26a7ba0c58c79af69fc6624729f7b22c10 (diff)
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>
Notes
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/fields/chpfld.cxx39
1 files changed, 29 insertions, 10 deletions
diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx
index 96d7813d6db6..c01e65ca12b3 100644
--- a/sw/source/core/fields/chpfld.cxx
+++ b/sw/source/core/fields/chpfld.cxx
@@ -138,6 +138,35 @@ void SwChapterField::ChangeExpansion(const SwFrm* pFrm,
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(const SwTxtNode &rTxtNd, sal_Bool bSrchNum)
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(const SwTxtNode &rTxtNd, sal_Bool bSrchNum)
if( ' ' > sTitle.GetChar( i ) )
sTitle.Erase( i--, 1 );
}
- else
- {
- sNumber = aEmptyStr;
- sTitle = aEmptyStr;
- sPost = aEmptyStr;
- sPre = aEmptyStr;
}
}