[Libreoffice-commits] core.git: sw/source xmloff/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 23 09:59:21 UTC 2021


 sw/source/uibase/shells/drwbassh.cxx                |   32 +++++++++++++++++---
 xmloff/source/text/XMLTextFrameHyperlinkContext.cxx |   11 ++++++
 2 files changed, 39 insertions(+), 4 deletions(-)

New commits:
commit 75cd2b0fa71c73ae815b80d8e42328024ea63555
Author:     Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
AuthorDate: Mon Aug 23 10:17:56 2021 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
CommitDate: Mon Aug 23 11:58:48 2021 +0200

    tdf#143736 Load hyperlink from more shapes
    
    And limit the shape types which can have a hyperlink to those known to work.
    
    Change-Id: I3d3522bea1e756dad8ddc2041e6588a367f42a7c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120861
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>

diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index f6e077520719..d0f1a5900e5d 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -856,11 +856,35 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet)
             {
                 if (pSdrView->GetMarkedObjectCount() != 1)
                     rSet.DisableItem(nWhich);
-                else if (nWhich == SID_OPEN_HYPERLINK || nWhich == SID_REMOVE_HYPERLINK
-                         || nWhich == SID_EDIT_HYPERLINK || nWhich == SID_COPY_HYPERLINK_LOCATION)
+
+                const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+                SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+                sal_uInt16 nObjType = pObj->GetObjIdentifier();
+
+                // Only enable hyperlink for the following types
+                switch (nObjType)
+                {
+                    case OBJ_PATHFILL:
+                    case OBJ_SECT:
+                    case OBJ_LINE:
+                    case OBJ_CUSTOMSHAPE:
+                    case OBJ_TEXT:
+                    case OBJ_RECT:
+                    case OBJ_CAPTION:
+                    case OBJ_POLY:
+                    case OBJ_PLIN:
+                    case E3D_SCENE_ID:
+                    case OBJ_MEASURE:
+                    case OBJ_EDGE:
+                        break;
+                    default:
+                        rSet.DisableItem(nWhich);
+                        break;
+                }
+
+                if (nWhich == SID_OPEN_HYPERLINK || nWhich == SID_REMOVE_HYPERLINK
+                    || nWhich == SID_EDIT_HYPERLINK || nWhich == SID_COPY_HYPERLINK_LOCATION)
                 {
-                    const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
-                    SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
                     if (pObj->getHyperlink().isEmpty())
                         rSet.DisableItem(nWhich);
                 }
diff --git a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
index 7a1146ac8125..64e16f1470d6 100644
--- a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
+++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
@@ -115,6 +115,17 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameHyperlinkC
         case XML_ELEMENT(DRAW, XML_PATH):
         case XML_ELEMENT(DRAW, XML_ELLIPSE):
         case XML_ELEMENT(DRAW, XML_LINE):
+        case XML_ELEMENT(DRAW, XML_RECT):
+        case XML_ELEMENT(DRAW, XML_CAPTION):
+        case XML_ELEMENT(DRAW, XML_POLYGON):
+        case XML_ELEMENT(DRAW, XML_POLYLINE):
+        case XML_ELEMENT(DRAW, XML_MEASURE):
+        case XML_ELEMENT(DRAW, XML_CIRCLE):
+        case XML_ELEMENT(DRAW, XML_CONNECTOR):
+        case XML_ELEMENT(DRAW, XML_CONTROL):
+        case XML_ELEMENT(DRAW, XML_PAGE_THUMBNAIL):
+        case XML_ELEMENT(DRAW, XML_G):
+        case XML_ELEMENT(DR3D, XML_SCENE):
         {
             Reference<XShapes> xShapes;
             SvXMLShapeContext* pShapeContext = XMLShapeImportHelper::CreateGroupChildContext(


More information about the Libreoffice-commits mailing list