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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 2 06:29:17 UTC 2020


 include/xmloff/contextid.hxx     |    5 -
 xmloff/source/style/xmlimppr.cxx |  137 ++++++++++++++++++---------------------
 2 files changed, 64 insertions(+), 78 deletions(-)

New commits:
commit 17d6ee0c45dcaff8aa12f7b975587820be62b7c8
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Sep 1 15:57:02 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 2 08:28:34 2020 +0200

    remove dead CTF_ALIEN_ATTRIBUTE_IMPORT
    
    ever since
        commit 9a081484321b3f42bee3b43d18c4bd75b9603b01
        Date:   Fri Sep 14 13:42:47 2012 +0200
        fdo#49571: ODF import: ignore "text:enable-numbering" attribute
    
    Change-Id: Id90b9aa0feafc3d7427558d3a2394c4958111434
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101849
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/contextid.hxx b/include/xmloff/contextid.hxx
index bf6cb1e4c134..654641f320e8 100644
--- a/include/xmloff/contextid.hxx
+++ b/include/xmloff/contextid.hxx
@@ -38,11 +38,6 @@
 
 #define CTF_FORMS_DATA_STYLE                ( XML_FORM_CTF_START +  0 )
 
-/** use together with MID_FLAG_NO_PROPERTY to import the specified
-    attribute into the alien attribute container */
-
-#define CTF_ALIEN_ATTRIBUTE_IMPORT  0x00007fff
-
 #endif // INCLUDED_XMLOFF_CONTEXTID_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
index adc23848b542..8607e9c9fa2d 100644
--- a/xmloff/source/style/xmlimppr.cxx
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -183,7 +183,6 @@ void SvXMLImportPropertyMapper::importXMLAttribute(
     // for better error reporting: this should be set true if no
     // warning is needed
     bool bNoWarning = false;
-    bool bAlienImport = false;
 
     do
     {
@@ -196,100 +195,92 @@ void SvXMLImportPropertyMapper::importXMLAttribute(
             // create a XMLPropertyState with an empty value
 
             nFlags = maPropMapper->GetEntryFlags( nIndex );
-            if( (( nFlags & MID_FLAG_NO_PROPERTY ) == MID_FLAG_NO_PROPERTY) && (maPropMapper->GetEntryContextId( nIndex ) == CTF_ALIEN_ATTRIBUTE_IMPORT) )
+            if( ( nFlags & MID_FLAG_ELEMENT_ITEM_IMPORT ) == 0 )
             {
-                bAlienImport = true;
-                nIndex = -1;
-            }
-            else
-            {
-                if( ( nFlags & MID_FLAG_ELEMENT_ITEM_IMPORT ) == 0 )
-                {
-                    XMLPropertyState aNewProperty( nIndex );
-                    sal_Int32 nReference = -1;
+                XMLPropertyState aNewProperty( nIndex );
+                sal_Int32 nReference = -1;
 
-                    // if this is a multi attribute check if another attribute already set
-                    // this any. If so use this as an initial value
-                    if( ( nFlags & MID_FLAG_MERGE_PROPERTY ) != 0 )
+                // if this is a multi attribute check if another attribute already set
+                // this any. If so use this as an initial value
+                if( ( nFlags & MID_FLAG_MERGE_PROPERTY ) != 0 )
+                {
+                    const OUString aAPIName( maPropMapper->GetEntryAPIName( nIndex ) );
+                    const sal_Int32 nSize = rProperties.size();
+                    for( nReference = 0; nReference < nSize; nReference++ )
                     {
-                        const OUString aAPIName( maPropMapper->GetEntryAPIName( nIndex ) );
-                        const sal_Int32 nSize = rProperties.size();
-                        for( nReference = 0; nReference < nSize; nReference++ )
+                        sal_Int32 nRefIdx = rProperties[nReference].mnIndex;
+                        if( (nRefIdx != -1) && (nIndex != nRefIdx) &&
+                            (maPropMapper->GetEntryAPIName( nRefIdx ) == aAPIName ))
                         {
-                            sal_Int32 nRefIdx = rProperties[nReference].mnIndex;
-                            if( (nRefIdx != -1) && (nIndex != nRefIdx) &&
-                                (maPropMapper->GetEntryAPIName( nRefIdx ) == aAPIName ))
-                            {
-                                aNewProperty = rProperties[nReference];
-                                aNewProperty.mnIndex = nIndex;
-                                break;
-                            }
+                            aNewProperty = rProperties[nReference];
+                            aNewProperty.mnIndex = nIndex;
+                            break;
                         }
-
-                        if( nReference == nSize )
-                            nReference = -1;
                     }
 
-                    bool bSet = false;
-                    if( ( nFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) == 0 )
-                    {
-                        // let the XMLPropertySetMapper decide how to import the value
-                        bSet = maPropMapper->importXML( sValue, aNewProperty,
-                                                 rUnitConverter );
-                    }
-                    else
-                    {
-                        sal_uInt32 nOldSize = rProperties.size();
+                    if( nReference == nSize )
+                        nReference = -1;
+                }
+
+                bool bSet = false;
+                if( ( nFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) == 0 )
+                {
+                    // let the XMLPropertySetMapper decide how to import the value
+                    bSet = maPropMapper->importXML( sValue, aNewProperty,
+                                             rUnitConverter );
+                }
+                else
+                {
+                    sal_uInt32 nOldSize = rProperties.size();
 
-                        bSet = handleSpecialItem( aNewProperty, rProperties,
-                                                  sValue, rUnitConverter,
-                                                     rNamespaceMap );
+                    bSet = handleSpecialItem( aNewProperty, rProperties,
+                                              sValue, rUnitConverter,
+                                                 rNamespaceMap );
 
-                        // no warning if handleSpecialItem added properties
-                        bNoWarning |= ( nOldSize != rProperties.size() );
-                    }
+                    // no warning if handleSpecialItem added properties
+                    bNoWarning |= ( nOldSize != rProperties.size() );
+                }
 
-                    // no warning if we found could set the item. This
-                    // 'remembers' bSet across multi properties.
-                    bNoWarning |= bSet;
+                // no warning if we found could set the item. This
+                // 'remembers' bSet across multi properties.
+                bNoWarning |= bSet;
 
-                    // store the property in the given vector
-                    if( bSet )
-                    {
-                        if( nReference == -1 )
-                            rProperties.push_back( aNewProperty );
-                        else
-                            rProperties[nReference] = aNewProperty;
-                    }
+                // store the property in the given vector
+                if( bSet )
+                {
+                    if( nReference == -1 )
+                        rProperties.push_back( aNewProperty );
                     else
+                        rProperties[nReference] = aNewProperty;
+                }
+                else
+                {
+                    // warn about unknown value. Unless it's a
+                    // multi property: Then we get another chance
+                    // to set the value.
+                    if( !bNoWarning &&
+                        ((nFlags & MID_FLAG_MULTI_PROPERTY) == 0) )
                     {
-                        // warn about unknown value. Unless it's a
-                        // multi property: Then we get another chance
-                        // to set the value.
-                        if( !bNoWarning &&
-                            ((nFlags & MID_FLAG_MULTI_PROPERTY) == 0) )
-                        {
-                            Sequence<OUString> aSeq(2);
-                            aSeq[0] = sAttrName;
-                            aSeq[1] = sValue;
-                            rImport.SetError( XMLERROR_FLAG_WARNING |
-                                              XMLERROR_STYLE_ATTR_VALUE,
-                                              aSeq );
-                        }
+                        Sequence<OUString> aSeq(2);
+                        aSeq[0] = sAttrName;
+                        aSeq[1] = sValue;
+                        rImport.SetError( XMLERROR_FLAG_WARNING |
+                                          XMLERROR_STYLE_ATTR_VALUE,
+                                          aSeq );
                     }
                 }
-                bFound = true;
-                continue;
             }
+            bFound = true;
+            continue;
         }
 
         if( !bFound )
         {
             SAL_INFO_IF((XML_NAMESPACE_NONE != nPrefix) &&
-                        !(XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) &&
-                        !bAlienImport, "xmloff.style",
+                        !(XML_NAMESPACE_UNKNOWN_FLAG & nPrefix),
+                        "xmloff.style",
                         "unknown attribute: \"" << sAttrName << "\"");
-            if( (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) || (XML_NAMESPACE_NONE == nPrefix) || bAlienImport )
+            if( (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) || (XML_NAMESPACE_NONE == nPrefix) )
             {
                 if( !xAttrContainer.is() )
                 {


More information about the Libreoffice-commits mailing list