diff options
-rw-r--r-- | oox/source/ppt/presentationfragmenthandler.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index c9deec076edc..43b7f105a1c4 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -110,15 +110,17 @@ static void lcl_setBookmark(uno::Reference<drawing::XShape>& rShape, std::vector<SlidePersistPtr>& rSlidePersist) { OUString aBookmark; - sal_Int32 nPageNumber; static const OUStringLiteral sSlideName = u"#page"; uno::Reference<beans::XPropertySet> xPropSet(rShape, uno::UNO_QUERY); xPropSet->getPropertyValue("Bookmark") >>= aBookmark; - nPageNumber = o3tl::toInt32(aBookmark.subView(sSlideName.getLength())); - Reference<XDrawPage> xDrawPage(rSlidePersist[nPageNumber - 1]->getPage()); - Reference<container::XNamed> xNamed(xDrawPage, UNO_QUERY_THROW); - aBookmark = xNamed->getName(); - xPropSet->setPropertyValue("Bookmark", Any(aBookmark)); + if (aBookmark.startsWith(sSlideName)) + { + sal_Int32 nPageNumber = o3tl::toInt32(aBookmark.subView(sSlideName.getLength())); + Reference<XDrawPage> xDrawPage(rSlidePersist[nPageNumber - 1]->getPage()); + Reference<container::XNamed> xNamed(xDrawPage, UNO_QUERY_THROW); + aBookmark = xNamed->getName(); + xPropSet->setPropertyValue("Bookmark", Any(aBookmark)); + } } static void ResolveShapeBookmark(std::vector<SlidePersistPtr>& rSlidePersist) |