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

Michael Stahl mstahl at redhat.com
Tue Jul 19 13:07:40 UTC 2016


 xmloff/source/forms/elementexport.cxx  |    2 +-
 xmloff/source/forms/propertyimport.cxx |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit fbb3b60cdb7a22595eec80232bb3ccd83781cf00
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 19 14:58:09 2016 +0200

    xmloff: forms export: convert one xlink:href to relative
    
    Mostly in forms directory the URLs are converted to relative via
    exportRelativeTargetLocation(), but not in this one case on the
    form:connection-resource element.  Let's make this consistent.
    
    Change-Id: I9252d2686d04c273261b95966a5cf4e9bcbc0bca

diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 1de42c2..36bfcd4 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -2065,7 +2065,7 @@ namespace xmloff
                 AddAttribute(
                     OAttributeMetaData::getCommonControlAttributeNamespace(CCAFlags::TargetLocation),
                     OAttributeMetaData::getCommonControlAttributeName(CCAFlags::TargetLocation),
-                    sPropValue);
+                    m_rContext.getGlobalContext().GetRelativeReference(sPropValue));
             if ( m_rContext.getGlobalContext().GetAttrList().getLength() )
             {
                 SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, xmloff::token::XML_CONNECTION_RESOURCE, true, true);
commit c49b87ac140f3f2c79c8211f38cd86118022bdce
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 19 14:50:18 2016 +0200

    xmloff: forms import: convert relative xlink:href to absolute
    
    There is currently only one place in the forms directory that converts
    relative hyperlinks to absolute on import, in
    OURLReferenceImport::handleAttribute(), but there are other elements
    that have xlink:href attribute as well, such as form:form.
    
    The export of form:form xlink:href does convert absolute to relative,
    in exportTargetLocationAttribute(), but if the model URL is actually
    already relative it will be converted to absolute instead, oddly enough.
    This leads to different absolute href attributes, depending on the
    directory where the file is exported, as can be observed with e.g.
    ooo95698-1.odt and fdo40634-2.odt.
    
    Let's apply a big hammer and make all "href" attributes absolute on
    import.
    
    Change-Id: I39d05707f3a8a899c7bbde8d9c0e2bc006c39e12

diff --git a/xmloff/source/forms/propertyimport.cxx b/xmloff/source/forms/propertyimport.cxx
index fa92c1c..33ac8ac 100644
--- a/xmloff/source/forms/propertyimport.cxx
+++ b/xmloff/source/forms/propertyimport.cxx
@@ -323,7 +323,16 @@ bool OPropertyImport::handleAttribute(sal_uInt16 /*_nNamespaceKey*/, const OUStr
         aNewValue.Name = pProperty->sPropertyName;
 
         // convert the value string into the target type
-        aNewValue.Value = PropertyConversion::convertString(pProperty->aPropertyType, _rValue, pProperty->pEnumMap, pProperty->bInverseSemantics);
+        if (token::IsXMLToken(_rLocalName, token::XML_HREF))
+        {
+            aNewValue.Value <<= m_rContext.getGlobalContext().GetAbsoluteReference(_rValue);
+        }
+        else
+        {
+            aNewValue.Value = PropertyConversion::convertString(
+                pProperty->aPropertyType, _rValue, pProperty->pEnumMap,
+                pProperty->bInverseSemantics);
+        }
         implPushBackPropertyValue( aNewValue );
         return true;
     }


More information about the Libreoffice-commits mailing list