diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/internal_hyperlink_region.odt | bin | 0 -> 8744 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 15 |
5 files changed, 28 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/internal_hyperlink_region.odt b/sw/qa/extras/ooxmlexport/data/internal_hyperlink_region.odt Binary files differnew file mode 100644 index 000000000000..abec2c5a8fc8 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/internal_hyperlink_region.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index b95f0083e10e..d13b7bf90144 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -793,6 +793,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127733, "internal_hyperlink_ole.odt") CPPUNIT_ASSERT_EQUAL(anchor, bookmarkName); } +DECLARE_OOXMLEXPORT_TEST(testTdf127734, "internal_hyperlink_region.odt") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + + OUString bookmarkName = getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:bookmarkStart", "name"); + OUString anchor = getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink", "anchor"); + CPPUNIT_ASSERT_EQUAL(anchor, bookmarkName); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3a7555ee305f..f9f7c3c94c14 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2914,7 +2914,7 @@ bool DocxAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarge } } } - if (sMark.indexOf(' ') != -1 && !sMark.endsWith("|table") && !sMark.endsWith("|region")) + if (sMark.indexOf(' ') != -1 && !sMark.endsWith("|table")) { // Spaces are prohibited in bookmark name. sMark = sMark.replace(' ', '_'); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 7edf472786f1..b80f94656704 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -917,7 +917,7 @@ bool AttributeOutputBase::AnalyzeURL( const OUString& rUrl, const OUString& /*rT OUString()); // #i21465# Only interested in outline references - if ( !sRefType.isEmpty() && (sRefType == "outline" || sRefType == "graphic" || sRefType == "frame" || sRefType == "ole") ) + if ( !sRefType.isEmpty() && (sRefType == "outline" || sRefType == "graphic" || sRefType == "frame" || sRefType == "ole" || sRefType == "region") ) { for ( const auto& rBookmarkPair : GetExport().m_aImplicitBookmarks ) { diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index bec217c60ddb..fcb168f68bf1 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3115,6 +3115,21 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL) noBookmark = true; } } + else if( sCmp == "region" ) + { + SwNodeIndex* pIdx; + OUString aName(BookmarkToWriter(aURL.copy(0, nPos))); + for (const SwSectionFormat* pFormat : m_pDoc->GetSections()) + { + if (aName == pFormat->GetSection()->GetSectionName() + && nullptr != (pIdx = const_cast<SwNodeIndex*>(pFormat->GetContent().GetContentIdx()))) + { + nIdx = pIdx->GetIndex() + 1; + noBookmark = true; + break; + } + } + } if (noBookmark) { aBookmarkPair aImplicitBookmark; |