[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source sd/qa
Tibor Nagy (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 20 07:45:15 UTC 2021
oox/source/ppt/pptshape.cxx | 7 ++++---
sd/qa/unit/data/pptx/tdf142648.pptx |binary
sd/qa/unit/export-tests-ooxml1.cxx | 23 +++++++++++++++++++++++
3 files changed, 27 insertions(+), 3 deletions(-)
New commits:
commit 0b327b69ef78a7565625dabbe8dcf0140884fe26
Author: Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Wed Jul 7 10:10:21 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Aug 20 09:44:37 2021 +0200
tdf#142648 PPTX: import long slide names to avoid broken link export
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 <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120750
Tested-by: Jenkins
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 563454aaaf66..b72e6d854fc6 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -346,9 +346,10 @@ void PPTShape::addShape(
Reference<drawing::XDrawPagesSupplier> xDPS(rFilterBase.getModel(), uno::UNO_QUERY_THROW);
Reference<drawing::XDrawPages> 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)
{
diff --git a/sd/qa/unit/data/pptx/tdf142648.pptx b/sd/qa/unit/data/pptx/tdf142648.pptx
new file mode 100644
index 000000000000..fc470530fc94
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf142648.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 34d9c9865b70..59848719adf0 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -61,6 +61,7 @@ using namespace css;
class SdOOXMLExportTest1 : public SdModelTestBaseXML
{
public:
+ void testTdf142648();
void testTdf47365();
void testTdf125071();
void testTdf54037();
@@ -122,6 +123,7 @@ public:
CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
+ CPPUNIT_TEST(testTdf142648);
CPPUNIT_TEST(testTdf47365);
CPPUNIT_TEST(testTdf125071);
CPPUNIT_TEST(testTdf54037);
@@ -210,6 +212,27 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal, sal_uInt32 nId
}
+void SdOOXMLExportTest1::testTdf142648()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142648.pptx"), PPTX );
+ utl::TempFile tempFile;
+
+ uno::Reference<drawing::XDrawPagesSupplier> xDPS(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPages> xDrawPages(xDPS->getDrawPages(), uno::UNO_SET_THROW);
+ uno::Reference<drawing::XDrawPage> xDrawPage;
+ xDrawPages->getByIndex(0) >>= xDrawPage;
+ uno::Reference<container::XNamed> xNamed(xDrawPage, uno::UNO_QUERY_THROW);
+ xNamed->setName("#Slide 1");
+
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+ xDocShRef->DoClose();
+
+ xmlDocUniquePtr pRelsDoc = parseExport(tempFile, "ppt/slides/_rels/slide2.xml.rels");
+
+ assertXPath(pRelsDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target",
+ "slide1.xml");
+}
+
void SdOOXMLExportTest1::testTdf47365()
{
sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/loopNoPause.pptx"), PPTX );
More information about the Libreoffice-commits
mailing list