[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sw/source
Oliver-Rainer Wittmann
orw at apache.org
Thu Jun 26 03:08:08 PDT 2014
sw/source/filter/ww8/ww8par.cxx | 5 +-
sw/source/filter/ww8/ww8par.hxx | 14 ++++----
sw/source/filter/ww8/ww8par5.cxx | 66 ++++++++++++++++++++++++---------------
sw/source/filter/ww8/ww8par6.cxx | 6 +--
4 files changed, 54 insertions(+), 37 deletions(-)
New commits:
commit 785b8653be59823eb9cc4efe49f4b87e2b545d33
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Thu Jun 26 09:24:49 2014 +0000
125122: WW8 import: Handle nested TOX fields
- only the content of nested TOX fields is imported, no TOX field itself
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 690a066..14046d5 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 bc04b28..e3a862c 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 8bffc4b..9cfa749 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 9ef115f..36fc499 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;
}
More information about the Libreoffice-commits
mailing list