summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTünde Tóth <tundeth@gmail.com>2019-09-24 14:29:44 +0200
committerLászló Németh <nemeth@numbertext.org>2019-09-30 13:00:09 +0200
commit97fba7ebf350adcec6baa6c4a863d058fb90406a (patch)
tree66648244e3d3a60dcfc972b346aaaefc89b58a21 /sw
parenta0f46953883aadab1ae7cae5641d3fc1a6089f81 (diff)
tdf#127733 DOCX export: fix internal hyperlinks to chart target
Hyperlinks to internal chart targets didn't work after export. Change-Id: I724c6af8fd7f1961260b82331b9f62d8cbd88f25 Reviewed-on: https://gerrit.libreoffice.org/79456 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/internal_hyperlink_ole.odtbin0 -> 13400 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx11
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx2
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx11
5 files changed, 24 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/internal_hyperlink_ole.odt b/sw/qa/extras/ooxmlexport/data/internal_hyperlink_ole.odt
new file mode 100644
index 000000000000..844cf1be6580
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/internal_hyperlink_ole.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 33d767e0bd81..b95f0083e10e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -782,6 +782,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127732, "internal_hyperlink_frame.odt")
CPPUNIT_ASSERT_EQUAL(anchor, bookmarkName);
}
+DECLARE_OOXMLEXPORT_TEST(testTdf127733, "internal_hyperlink_ole.odt")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+
+ OUString bookmarkName = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/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 b6f83787b673..3a7555ee305f 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("|ole") && !sMark.endsWith("|region"))
+ if (sMark.indexOf(' ') != -1 && !sMark.endsWith("|table") && !sMark.endsWith("|region"))
{
// 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 528cd498017b..7edf472786f1 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") )
+ if ( !sRefType.isEmpty() && (sRefType == "outline" || sRefType == "graphic" || sRefType == "frame" || sRefType == "ole") )
{
for ( const auto& rBookmarkPair : GetExport().m_aImplicitBookmarks )
{
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 222466d8eb1e..bec217c60ddb 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3104,6 +3104,17 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL)
noBookmark = true;
}
}
+ else if( sCmp == "ole" )
+ {
+ SwNodeIndex* pIdx;
+ OUString aName(BookmarkToWriter(aURL.copy(0, nPos)));
+ const SwFlyFrameFormat* pFormat = m_pDoc->FindFlyByName(aName, SwNodeType::Ole);
+ if (pFormat && nullptr != (pIdx = const_cast<SwNodeIndex*>(pFormat->GetContent().GetContentIdx())))
+ {
+ nIdx = pIdx->GetNext()->GetIndex();
+ noBookmark = true;
+ }
+ }
if (noBookmark)
{
aBookmarkPair aImplicitBookmark;