diff options
author | Oliver-Rainer Wittmann <orw@apache.org> | 2012-11-22 11:14:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-24 09:18:32 +0100 |
commit | 679faffc68bb854af0f55d0f218698e2f372f00b (patch) | |
tree | 5490b0b79b6e647e02b89f495a6bf542d1e6352d /sw/source/filter/ww1/fltshell.cxx | |
parent | 87858e043fe089a816a5787c356c94e7abbddd45 (diff) |
Resolves: #i120879# import "Microsoft Word TOC bookmarks" as...
cross reference bookmarks and suppress the import of unreferenced ones.
Review by: zhengfan
(cherry picked from commit e3a34e95823105fda68fd29a4ded22a9d52523fb)
Conflicts:
sw/source/core/crsr/crossrefbookmark.cxx
sw/source/core/inc/crossrefbookmark.hxx
sw/source/filter/inc/fltshell.hxx
sw/source/filter/ww1/fltshell.cxx
sw/source/filter/ww8/ww8par.cxx
sw/source/filter/ww8/ww8par.hxx
sw/source/filter/ww8/ww8par5.cxx
Change-Id: I5898cbd33c9a17b9517040e19ca8eda4355a1eac
also remove symbol-visibility problems in IDocumentMarkAccess.hxx
(cherry picked from commit de9ea83df087ba3f8e614a69e8b18403d54b9589)
Conflicts:
sw/inc/IDocumentMarkAccess.hxx
Change-Id: I2f51cc4412525c6e62d120df5c7fe1c223e35972
Diffstat (limited to 'sw/source/filter/ww1/fltshell.cxx')
-rw-r--r-- | sw/source/filter/ww1/fltshell.cxx | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 1a8b816d6525..9735f8e0aa54 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -549,40 +549,36 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, break; case RES_FLTR_NUMRULE_NUM: break; - case RES_FLTR_BOOKMARK: // eigentlich nur fuer den Ende-Stack + case RES_FLTR_BOOKMARK: { SwFltBookmark* pB = (SwFltBookmark*)rEntry.pAttr; const OUString& rName = ((SwFltBookmark*)rEntry.pAttr)->GetName(); if (IsFlagSet(BOOK_TO_VAR_REF)) { - if (pB->IsPgRef() && !pB->IsRef()) - { - // XRefs und Bookmarks sind bereits geUpcased - MakeBookRegionOrPoint(rEntry, pDoc, aRegion, sal_True); - pDoc->InsertPoolItem(aRegion, SwFmtRefMark(rName), 0); - } - else if( !pB->IsOnlyRef() ) + SwFieldType* pFT = pDoc->GetFldType(RES_SETEXPFLD, rName, false); + if (!pFT) { - SwFieldType* pFT = pDoc->GetFldType(RES_SETEXPFLD, rName, false); - if (!pFT) - { // FieldType anlegen - SwSetExpFieldType aS(pDoc, rName, nsSwGetSetExpType::GSE_STRING); - pFT = pDoc->InsertFldType(aS); - } - SwSetExpField aFld((SwSetExpFieldType*)pFT, - pB->GetValSys()); - aFld.SetSubType( nsSwExtendedSubType::SUB_INVISIBLE ); - MakePoint(rEntry, pDoc, aRegion); - pDoc->InsertPoolItem(aRegion, SwFmtFld(aFld), 0); - MoveAttrs( *(aRegion.GetPoint()) ); + SwSetExpFieldType aS(pDoc, rName, nsSwGetSetExpType::GSE_STRING); + pFT = pDoc->InsertFldType(aS); } + SwSetExpField aFld((SwSetExpFieldType*)pFT, pB->GetValSys()); + aFld.SetSubType( nsSwExtendedSubType::SUB_INVISIBLE ); + MakePoint(rEntry, pDoc, aRegion); + pDoc->InsertPoolItem(aRegion, SwFmtFld(aFld), 0); + MoveAttrs( *(aRegion.GetPoint()) ); } - if( !pB->IsOnlyRef() && - ( !IsFlagSet(HYPO) || IsFlagSet(BOOK_AND_REF) ) && !rEntry.bConsumedByField) + if ( ( !IsFlagSet(HYPO) || IsFlagSet(BOOK_AND_REF) ) && + !rEntry.bConsumedByField ) { MakeBookRegionOrPoint(rEntry, pDoc, aRegion, sal_True); - pDoc->getIDocumentMarkAccess()->makeMark( aRegion, rName, IDocumentMarkAccess::BOOKMARK); + // #i120879# - create a cross reference heading bookmark if appropriate. + const IDocumentMarkAccess::MarkType eBookmarkType = + ( pB->IsTOCBookmark() && + IDocumentMarkAccess::IsLegalPaMForCrossRefHeadingBookmark( aRegion ) ) + ? IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK + : IDocumentMarkAccess::BOOKMARK; + pDoc->getIDocumentMarkAccess()->makeMark( aRegion, rName, eBookmarkType ); } } break; @@ -928,32 +924,39 @@ SfxPoolItem* SwFltRedline::Clone( SfxItemPool* ) const //------ hier stehen die Methoden von SwFltBookmark ----------- SwFltBookmark::SwFltBookmark( const OUString& rNa, const OUString& rVa, - long nHand, sal_Bool bOnlyR ) - : SfxPoolItem(RES_FLTR_BOOKMARK), nHandle(nHand), aName(rNa), aVal(rVa), - bOnlyRef(bOnlyR), bRef(sal_False), bPgRef(sal_False) -{ - // eSrc: CHARSET_DONTKNOW fuer keine UEbersetzung bei operator << - // Upcase wird immer gemacht. - // bei XXXStack.NewAttr(...) wird nie eine UEbersetzung vorgenommen. - // ansonsten: uebergebener Src-Charset fuer aName - // im Filter eingestellter Src-Charset fuer aVal ( Text ) + long nHand, const bool bIsTOCBookmark ) + : SfxPoolItem( RES_FLTR_BOOKMARK ) + , mnHandle( nHand ) + , maName( rNa ) + , maVal( rVa ) + , mbIsTOCBookmark( bIsTOCBookmark ) +{ + // eSrc: CHARSET_DONTKNOW fuer keine UEbersetzung bei operator << + // Upcase wird immer gemacht. + // bei XXXStack.NewAttr(...) wird nie eine UEbersetzung vorgenommen. + // ansonsten: uebergebener Src-Charset fuer aName + // im Filter eingestellter Src-Charset fuer aVal ( Text ) + + if ( IsTOCBookmark() ) + { + maName = IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix(); + maName += rNa; + } } SwFltBookmark::SwFltBookmark(const SwFltBookmark& rCpy) - : SfxPoolItem(RES_FLTR_BOOKMARK), - nHandle(rCpy.nHandle), - aName(rCpy.aName), - aVal(rCpy.aVal), - bOnlyRef(rCpy.bOnlyRef), - bRef(rCpy.bRef), - bPgRef(rCpy.bPgRef) + : SfxPoolItem( RES_FLTR_BOOKMARK ) + , mnHandle( rCpy.mnHandle ) + , maName( rCpy.maName ) + , maVal( rCpy.maVal ) + , mbIsTOCBookmark( rCpy.mbIsTOCBookmark ) { } int SwFltBookmark::operator==(const SfxPoolItem& rItem) const { - return (aName == ((SwFltBookmark&)rItem).aName) - && (nHandle == ((SwFltBookmark&)rItem).nHandle); + return ( maName == ((SwFltBookmark&)rItem).maName) + && (mnHandle == ((SwFltBookmark&)rItem).mnHandle); } SfxPoolItem* SwFltBookmark::Clone(SfxItemPool*) const @@ -1255,8 +1258,8 @@ SwFltShell& SwFltShell::SetStyle( sal_uInt16 nStyle ) SwFltShell& SwFltShell::operator << (SwFltBookmark& aBook) { - aBook.aName = ConvertUStr(aBook.aName); - aBook.aVal = QuoteStr(aBook.aVal); + aBook.maName = ConvertUStr( aBook.maName ); + aBook.maVal = QuoteStr(aBook.maVal); aEndStack.NewAttr(*pPaM->GetPoint(), aBook); return *this; } |