diff options
author | Oliver-Rainer Wittmann <orw@apache.org> | 2014-06-26 09:24:49 +0000 |
---|---|---|
committer | Oliver-Rainer Wittmann <orw@apache.org> | 2014-06-26 09:24:49 +0000 |
commit | 785b8653be59823eb9cc4efe49f4b87e2b545d33 (patch) | |
tree | 4cabdd13da0ae787ebf080228971f62e19627a6e /sw | |
parent | 368b3a6660e8623e43529e21e41fbce1192e6a92 (diff) |
125122: WW8 import: Handle nested TOX fields
- only the content of nested TOX fields is imported, no TOX field itself
Notes
Notes:
merged as: e28797356f34253bcbe7237d7bfdbcda2a3f5b3c
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 14 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 66 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 6 |
4 files changed, 54 insertions, 37 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 690a06600f91..14046d527c5e 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3724,8 +3724,9 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage, , nIdctHint(0) , bBidi(false) , bReadTable(false) - , mbLoadingTOCCache(false) - , mbLoadingTOCHyperlink(false) + , mbLoadingTOXCache(false) + , mnEmbeddedTOXLevel(0) + , mbLoadingTOXHyperlink(false) , mpPosAfterTOC(0) , mbCareFirstParaEndInToc(false) , mbCareLastParaEndInToc(false) diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index bc04b2891d99..e3a862cf447b 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1216,10 +1216,12 @@ private: boost::shared_ptr<SwPaM> mpTableEndPaM; WW8PLCFx_Cp_FKP* pFirstTablePap; - // Indicate that currently on loading a TOC, managed by Read_F_TOX() and End_Field() - bool mbLoadingTOCCache; - // Indicate that current on loading a hyperlink, which is inside a TOC; Managed by Read_F_Hyperlink() and End_Field() - bool mbLoadingTOCHyperlink; + // Indicate that currently on loading a TOX, managed by Read_F_TOX() and End_Field() + bool mbLoadingTOXCache; + int mnEmbeddedTOXLevel; + + // Indicate that current on loading a hyperlink, which is inside a TOX; Managed by Read_F_Hyperlink() and End_Field() + bool mbLoadingTOXHyperlink; // a document position recorded the after-position of TOC section, managed by Read_F_TOX() and End_Field() SwPaM* mpPosAfterTOC; @@ -1289,12 +1291,10 @@ private: void ImportTox( int nFldId, String aStr ); void EndSprm( sal_uInt16 nId ); - // --> OD 2010-05-06 #i103711# - // --> OD 2010-05-11 #i105414# + void NewAttr( const SfxPoolItem& rAttr, const bool bFirstLineOfStSet = false, const bool bLeftIndentSet = false ); - // <-- bool GetFontParams(sal_uInt16, FontFamily&, String&, FontPitch&, rtl_TextEncoding&); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 8bffc4b7089f..9cfa7494b646 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -706,41 +706,48 @@ sal_uInt16 SwWW8ImplReader::End_Field() } } break; - // Doing corresponding status management for TOC field, index field, hyperlink field and page reference field + // Doing corresponding status management for TOX field, index field, hyperlink field and page reference field case 13://TOX case 8://index - if (mbLoadingTOCCache) + if ( mbLoadingTOXCache ) { - maTOXEndCps.insert(nCP); - mbLoadingTOCCache = false; - if ( pPaM->End() && - pPaM->End()->nNode.GetNode().GetTxtNode() && - pPaM->End()->nNode.GetNode().GetTxtNode()->Len() == 0 ) + if ( mnEmbeddedTOXLevel > 0 ) { - JoinNode(*pPaM); + --mnEmbeddedTOXLevel; } else { + maTOXEndCps.insert( nCP ); + mbLoadingTOXCache = false; + if ( pPaM->End() + && pPaM->End()->nNode.GetNode().GetTxtNode() + && pPaM->End()->nNode.GetNode().GetTxtNode()->Len() == 0 ) + { + JoinNode( *pPaM ); + } + else + { mbCareLastParaEndInToc = true; - } + } - if (mpPosAfterTOC) - { - *pPaM = *mpPosAfterTOC; - delete mpPosAfterTOC; - mpPosAfterTOC = 0; + if ( mpPosAfterTOC ) + { + *pPaM = *mpPosAfterTOC; + delete mpPosAfterTOC; + mpPosAfterTOC = 0; + } } } break; case 37://REF - if (mbLoadingTOCCache && !mbLoadingTOCHyperlink) + if (mbLoadingTOXCache && !mbLoadingTOXHyperlink) { pCtrlStck->SetAttr(*pPaM->GetPoint(),RES_TXTATR_INETFMT); } break; case 88: - if (mbLoadingTOCHyperlink) - mbLoadingTOCHyperlink = false; + if (mbLoadingTOXHyperlink) + mbLoadingTOXHyperlink = false; pCtrlStck->SetAttr(*pPaM->GetPoint(),RES_TXTATR_INETFMT); break; case 36: @@ -2170,13 +2177,13 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, String& rStr ) const String sName(GetMappedBookmark(sOrigName)); - // loading page reference field in TOC - if (mbLoadingTOCCache ) + // loading page reference field in TOX + if (mbLoadingTOXCache ) { // insert page ref representation as plain text --> return FLD_TEXT // if there is no hyperlink settings for current toc and referenced bookmark is available, // assign link to current ref area - if ( !mbLoadingTOCHyperlink && sName.Len() > 0 ) + if ( !mbLoadingTOXHyperlink && sName.Len() > 0 ) { // #120879# add cross reference bookmark name prefix, if it matches internal TOC bookmark naming convention String sBookmarkName; @@ -3024,7 +3031,16 @@ sal_uInt16 lcl_GetMaxValidWordTOCLevel(const SwForm &rForm) eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr ) { - mbLoadingTOCCache = true; + if ( !mbLoadingTOXCache ) + { + mbLoadingTOXCache = true; + } + else + { + // Embedded TOX --> continue reading its content, but no further TOX field + ++mnEmbeddedTOXLevel; + return FLD_TEXT; + } if (pF->nLRes < 3) return FLD_TEXT; // ignore (#i25440#) @@ -3610,9 +3626,9 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr ) pReffedStck->aReferencedTOCBookmarks.insert( sMark ); } - if (mbLoadingTOCCache) + if (mbLoadingTOXCache) { - mbLoadingTOCHyperlink = true;//on loading a TOC field nested hyperlink field + mbLoadingTOXHyperlink = true;//on loading a TOX field nested hyperlink field } } break; @@ -3639,8 +3655,8 @@ eF_ResT SwWW8ImplReader::Read_F_Hyperlink( WW8FieldDesc* /*pF*/, String& rStr ) ( sURL += INET_MARK_TOKEN ) += sMark; SwFmtINetFmt aURL( sURL, sTarget ); - // If on loading TOC field, change the default style into the "index link" - if (mbLoadingTOCCache) + // If on loading TOX field, change the default style into the "index link" + if (mbLoadingTOXCache) { String sLinkStyle = String::CreateFromAscii("Index Link"); sal_uInt16 nPoolId = diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 9ef115fd0be5..36fc49904281 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -3909,11 +3909,11 @@ void SwWW8ImplReader::Read_CColl( sal_uInt16, const sal_uInt8* pData, short nLen || pCollA[nId].bColl ) // oder Para-Style ? return; // dann ignorieren - // if current on loading a TOC field, and current trying to apply a hyperlink character style, - // just ignore. For the hyperlinks inside TOC in MS Word is not same with a common hyperlink + // if current on loading a TOX field, and current trying to apply a hyperlink character style, + // just ignore. For the hyperlinks inside TOX in MS Word is not same with a common hyperlink // Character styles: without underline and blue font color. And such type style will be applied in others // processes. - if (mbLoadingTOCCache && pCollA[nId].GetWWStyleId() == ww::stiHyperlink) + if (mbLoadingTOXCache && pCollA[nId].GetWWStyleId() == ww::stiHyperlink) { return; } |