From 7eb0e52527e729a21973e70d5be8e0a6779ec748 Mon Sep 17 00:00:00 2001 From: Tibor Nagy Date: Wed, 7 Jul 2021 10:10:21 +0200 Subject: tdf#142648 PPTX: import long slide names to avoid broken link export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PPTX import renames the slides using their short title text. Apply this for the titles with 64 or more characters, too, abbreviating the title text instead of using the default slide name "page1", "page2" etc., because the default slide names result broken hyperlinks during the PPTX export. To test the fix manually, create a new hyperlink using text selection and Insert Hyperlink (Ctrl-K), clicking on Target in Document button on the Document pane, and selecting a slide name. Note: the problem still exists for the duplicated or newly inserted slides, which get default slide names. Change-Id: Iec1fab5a2ee862353766ed7e13b1501b3a325d0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118548 Tested-by: László Németh Reviewed-by: László Németh --- oox/source/ppt/pptshape.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'oox') diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index 8b25523e5c3d..4b735ea59c01 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -439,9 +439,10 @@ void PPTShape::addShape( Reference xDPS(rFilterBase.getModel(), uno::UNO_QUERY_THROW); Reference xDrawPages(xDPS->getDrawPages(), uno::UNO_SET_THROW); sal_uInt32 nMaxPages = xDrawPages->getCount(); - bool bUseTitleAsSlideName = !aTitleText.isEmpty() && - // just a magic value, but we don't want to set slide names which are too long - aTitleText.getLength() < 64; + // just a magic value but we don't want to drop out slide names which are too long + if (aTitleText.getLength() > 63) + aTitleText = aTitleText.copy(0, 63); + bool bUseTitleAsSlideName = !aTitleText.isEmpty(); // check duplicated title name if (bUseTitleAsSlideName) { -- cgit