sw/qa/extras/ww8import/data/fdo68963.doc |binary sw/qa/extras/ww8import/ww8import.cxx | 2 ++ sw/source/core/crsr/crossrefbookmark.cxx | 2 +- sw/source/filter/ww8/ww8par5.cxx | 11 ++++++++++- 4 files changed, 13 insertions(+), 2 deletions(-)
New commits: commit 2ad285eacda91bb95ec2fbb44ce6fa0b4d50f817 Author: Justin Luth <justin_l...@sil.org> Date: Tue Mar 10 10:15:44 2015 +0300 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. Updated the test document to include even more combinations of cross-references and numbered heading references. Change-Id: I3d60d2b528ebfa1ffb108bbfc9e7db2c604af49b Reviewed-on: https://gerrit.libreoffice.org/14822 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ww8import/data/fdo68963.doc b/sw/qa/extras/ww8import/data/fdo68963.doc index 4b331f0..b31741f 100644 Binary files a/sw/qa/extras/ww8import/data/fdo68963.doc and b/sw/qa/extras/ww8import/data/fdo68963.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 8ba9466..0c0da88 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -521,6 +521,8 @@ DECLARE_WW8IMPORT_TEST(testfdo68963, "fdo68963.doc") // The problem was that the text was not displayed. CPPUNIT_ASSERT ( !parseDump("/root/page/body/tab/row[2]/cell[1]/txt/Special", "rText").isEmpty() ); CPPUNIT_ASSERT_EQUAL( OUString("Topic 1"), parseDump("/root/page/body/tab/row[2]/cell[1]/txt/Special", "rText") ); + // all crossreference bookmarks should have a target. Shouldn't be any "Reference source not found" in the xml + CPPUNIT_ASSERT ( -1 == parseDump("/root/page/body/txt[24]/Special[2]","rText").indexOf("Reference source not found")); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/crsr/crossrefbookmark.cxx b/sw/source/core/crsr/crossrefbookmark.cxx index 700a3f2..67a25d0 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 555413a..5e48540 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -101,7 +101,7 @@ namespace // #120879# - helper method to identify a bookmark name to match the internal TOC bookmark naming convention bool IsTOCBookmarkName(const OUString& rName) { - return rName.startsWith("_Toc") || rName.startsWith(IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()); + return rName.startsWith("_Toc") || rName.startsWith(IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()+"_Toc"); } OUString EnsureTOCBookmarkName(const OUString& rName) @@ -1969,6 +1969,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( static_cast<SwGetRefFieldType*>(rDoc.getIDocumentFieldsAccess().GetSysFldType( RES_GETREFFLD )), sBkmName,REF_BOOKMARK,0,eFormat); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits