[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - sw/source xmloff/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 24 09:29:13 UTC 2021


 sw/source/uibase/shells/drwbassh.cxx                |   31 +++++++++++++++++---
 xmloff/source/text/XMLTextFrameHyperlinkContext.cxx |   17 ++++++++--
 2 files changed, 40 insertions(+), 8 deletions(-)

New commits:
commit 96e106495a45fbb3d70e1266a95f5e31703abb83
Author:     Samuel Mehrbrodt <samuel.mehrbrodt at allotropia.de>
AuthorDate: Mon Aug 23 10:17:56 2021 +0200
Commit:     Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Tue Aug 24 11:28:37 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>
    (cherry picked from commit 75cd2b0fa71c73ae815b80d8e42328024ea63555)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120935
    Tested-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>

diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index e5b4bb177ae0..924877a876a5 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -799,11 +799,34 @@ 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 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 278d6d953205..3901a010fbd9 100644
--- a/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
+++ b/xmloff/source/text/XMLTextFrameHyperlinkContext.cxx
@@ -113,14 +113,23 @@ SvXMLImportContextRef XMLTextFrameHyperlinkContext::CreateChildContext(
     SvXMLImportContext *pContext = nullptr;
     XMLTextFrameContext *pTextFrameContext = nullptr;
 
-    if( XML_NAMESPACE_DRAW == nPrefix )
+    if( XML_NAMESPACE_DRAW == nPrefix || XML_NAMESPACE_DR3D == nPrefix)
     {
-        if( IsXMLToken( rLocalName, XML_FRAME ) )
+        if( XML_NAMESPACE_DRAW == nPrefix && IsXMLToken( rLocalName, XML_FRAME ) )
             pTextFrameContext = new XMLTextFrameContext( GetImport(), nPrefix,
                                                 rLocalName, xAttrList,
                                                 eDefaultAnchorType );
-        else if (IsXMLToken(rLocalName, XML_CUSTOM_SHAPE) || IsXMLToken(rLocalName, XML_PATH)
-                 || IsXMLToken(rLocalName, XML_ELLIPSE) || IsXMLToken(rLocalName, XML_LINE))
+        else if ((XML_NAMESPACE_DRAW == nPrefix && (
+                     IsXMLToken(rLocalName, XML_CUSTOM_SHAPE) || IsXMLToken(rLocalName, XML_PATH)
+                     || IsXMLToken(rLocalName, XML_ELLIPSE) || IsXMLToken(rLocalName, XML_LINE)
+                     || IsXMLToken(rLocalName, XML_RECT) || IsXMLToken(rLocalName, XML_CAPTION)
+                     || IsXMLToken(rLocalName, XML_POLYGON) || IsXMLToken(rLocalName, XML_POLYLINE)
+                     || IsXMLToken(rLocalName, XML_MEASURE) || IsXMLToken(rLocalName, XML_CIRCLE)
+                     || IsXMLToken(rLocalName, XML_CONNECTOR) || IsXMLToken(rLocalName, XML_CONTROL)
+                     || IsXMLToken(rLocalName, XML_PAGE_THUMBNAIL) || IsXMLToken(rLocalName, XML_G)
+                 ))
+                 || (XML_NAMESPACE_DR3D == nPrefix && IsXMLToken(rLocalName, XML_SCENE))
+             )
         {
             Reference<XShapes> xShapes;
             SvXMLShapeContext* pShapeContext


More information about the Libreoffice-commits mailing list