diff options
author | Justin Luth <justin_luth@sil.org> | 2015-03-14 18:40:24 +0300 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2015-03-20 18:56:47 +0000 |
commit | 18b9bb8bafc3946305e2b011f5f100cb34fea959 (patch) | |
tree | 625fb488d667d8c89c194bc20b8c7cdb0a308046 | |
parent | 715a945721ffe3920dc13aa98f4cbfe3841b1c87 (diff) |
tdf#89482 fix __refheading__ regression, set only CrossRefs as TOC.
bugfix tdf#68963 marked all __refheading__ bookmarks at TOC, but
those crossreferences were deleted if they are not recorded in
aReferencedTOCBookmarks. Redesigned the fix to include _Toc in the
crossreference name that is auto-generated, which is how MSWord
differentiates the markers.y
Change-Id: Ie11b90b1b933d275e4d59ee89f22ff527eb6c2ba
Reviewed-on: https://gerrit.libreoffice.org/14870
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | sw/source/core/crsr/crossrefbookmark.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/sw/source/core/crsr/crossrefbookmark.cxx b/sw/source/core/crsr/crossrefbookmark.cxx index 700a3f217c12..67a25d07520c 100644 --- a/sw/source/core/crsr/crossrefbookmark.cxx +++ b/sw/source/core/crsr/crossrefbookmark.cxx @@ -72,7 +72,7 @@ namespace sw { namespace mark const vcl::KeyCode& rCode, const OUString& rName, const OUString& rShortName) - : CrossRefBookmark(rPaM, rCode, rName, rShortName, IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()) + : CrossRefBookmark(rPaM, rCode, rName, rShortName, IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()+"_Toc") { } bool CrossRefHeadingBookmark::IsLegalName(const OUString& rName) diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 246d3f6b9c93..bbde7d79ee1e 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -102,7 +102,7 @@ namespace // #120879# - helper method to identify a bookmark name to match the internal TOC bookmark naming convention bool IsTOCBookmarkName( const ::rtl::OUString& rName ) { - return rName.startsWith("_Toc") || rName.startsWith(IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()); + return rName.startsWith("_Toc") || rName.startsWith(IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()+"_Toc"); } ::rtl::OUString EnsureTOCBookmarkName( const ::rtl::OUString& rName ) @@ -1970,6 +1970,15 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, OUString& rStr ) OUString sBkmName(GetMappedBookmark(sOrigBkmName)); + // #i120879# add cross reference bookmark name prefix, if it + // matches internal TOC bookmark naming convention + if ( IsTOCBookmarkName( sBkmName ) ) + { + sBkmName = EnsureTOCBookmarkName(sBkmName); + // track <sBookmarkName> as referenced TOC bookmark. + pReffedStck->aReferencedTOCBookmarks.insert( sBkmName ); + } + SwGetRefField aFld( (SwGetRefFieldType*)rDoc.getIDocumentFieldsAccess().GetSysFldType( RES_GETREFFLD ), sBkmName,REF_BOOKMARK,0,eFormat); |