include/xmloff/xmlimppr.hxx                     |   13 +
 include/xmloff/xmlprcon.hxx                     |   11 +
 xmloff/inc/PageMasterImportContext.hxx          |    6 
 xmloff/source/style/PageHeaderFooterContext.cxx |   34 +--
 xmloff/source/style/PageHeaderFooterContext.hxx |   13 -
 xmloff/source/style/PageMasterImportContext.cxx |   27 +-
 xmloff/source/style/PagePropertySetContext.cxx  |    7 
 xmloff/source/style/PagePropertySetContext.hxx  |    5 
 xmloff/source/style/xmlimppr.cxx                |  222 ++++++++++++++++++++++++
 xmloff/source/style/xmlprcon.cxx                |   20 ++
 xmloff/source/style/xmlstyle.cxx                |   16 -
 11 files changed, 311 insertions(+), 63 deletions(-)

New commits:
commit 041fd5a6b8c1f0002cfc693ef66daf28a86df371
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Aug 25 09:24:22 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 25 12:57:43 2020 +0200

    use more fastparser in PageStyleContext
    
    Change-Id: I1de96a68881e5f035c34136cd3ad89fa7cad29ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101310
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/xmloff/xmlimppr.hxx b/include/xmloff/xmlimppr.hxx
index 5f5a72d17cb3..3694219d353b 100644
--- a/include/xmloff/xmlimppr.hxx
+++ b/include/xmloff/xmlimppr.hxx
@@ -37,6 +37,7 @@ namespace com::sun::star::uno { class Any; }
 namespace com::sun::star::uno { template <typename > class Reference; }
 namespace com::sun::star::uno { template <typename > class Sequence; }
 namespace com::sun::star::xml::sax { class XAttributeList; }
+namespace com::sun::star::xml::sax { class XFastAttributeList; }
 
 struct XMLPropertyState;
 class XMLPropertySetMapper;
@@ -96,6 +97,18 @@ public:
             sal_uInt32 nPropType,
             sal_Int32 nStartIdx, sal_Int32 nEndIdx ) const;
 
+    /** fills the given itemset with the attributes in the given list
+      * the map is only searched within the range
+      * [nStartIdx, nEndIdx[
+      */
+    void importXML(
+            ::std::vector< XMLPropertyState >& rProperties,
+            const css::uno::Reference< css::xml::sax::XFastAttributeList >& 
xAttrList,
+            const SvXMLUnitConverter& rUnitConverter,
+            const SvXMLNamespaceMap& rNamespaceMap,
+            sal_uInt32 nPropType,
+            sal_Int32 nStartIdx, sal_Int32 nEndIdx ) const;
+
     /** this method is called for every item that has the 
MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
     virtual bool handleSpecialItem(
             XMLPropertyState& rProperty,
diff --git a/include/xmloff/xmlprcon.hxx b/include/xmloff/xmlprcon.hxx
index a0219b3742d9..97d9487716dc 100644
--- a/include/xmloff/xmlprcon.hxx
+++ b/include/xmloff/xmlprcon.hxx
@@ -47,8 +47,19 @@ public:
             const rtl::Reference < SvXMLImportPropertyMapper > &rMap,
               sal_Int32 nStartIdx = -1, sal_Int32 nEndIdx = -1 );
 
+    SvXMLPropertySetContext(
+            SvXMLImport& rImport, sal_Int32 nElement,
+            const css::uno::Reference< css::xml::sax::XFastAttributeList >& 
xAttrList,
+            sal_uInt32 nFamily,
+            ::std::vector< XMLPropertyState > &rProps,
+            const rtl::Reference < SvXMLImportPropertyMapper > &rMap,
+              sal_Int32 nStartIdx = -1, sal_Int32 nEndIdx = -1 );
+
     virtual ~SvXMLPropertySetContext() override;
 
+    virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
+        const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) 
override {}
+
     virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
                                      const OUString& rLocalName,
                                      const css::uno::Reference< 
css::xml::sax::XAttributeList >& xAttrList ) override;
diff --git a/xmloff/inc/PageMasterImportContext.hxx 
b/xmloff/inc/PageMasterImportContext.hxx
index a60522249759..158c7ce29503 100644
--- a/xmloff/inc/PageMasterImportContext.hxx
+++ b/xmloff/inc/PageMasterImportContext.hxx
@@ -42,10 +42,8 @@ public:
             bool bDefaultStyle);
     virtual ~PageStyleContext() override;
 
-    virtual SvXMLImportContextRef CreateChildContext(
-            sal_uInt16 nPrefix,
-            const OUString& rLocalName,
-            const css::uno::Reference< css::xml::sax::XAttributeList > & 
xAttrList ) override;
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL 
createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& AttrList ) override;
 
     // don't call this
     virtual void FillPropertySet(
diff --git a/xmloff/source/style/PageHeaderFooterContext.cxx 
b/xmloff/source/style/PageHeaderFooterContext.cxx
index 3b7a64b71664..231ce63b1269 100644
--- a/xmloff/source/style/PageHeaderFooterContext.cxx
+++ b/xmloff/source/style/PageHeaderFooterContext.cxx
@@ -23,20 +23,18 @@
 #include <xmloff/xmltypes.hxx>
 #include <xmloff/xmlimppr.hxx>
 #include "PagePropertySetContext.hxx"
+#include <sal/log.hxx>
 
 using namespace com::sun::star;
 using ::xmloff::token::IsXMLToken;
 using ::xmloff::token::XML_HEADER_FOOTER_PROPERTIES;
 
 PageHeaderFooterContext::PageHeaderFooterContext( SvXMLImport& rImport,
-                                      sal_uInt16 nPrfx,
-                                      const OUString& rLName,
-                                      const css::uno::Reference< 
css::xml::sax::XAttributeList>&,
                                       ::std::vector< XMLPropertyState > & 
rTempProperties,
                                       const rtl::Reference < 
SvXMLImportPropertyMapper > &rTempMap,
                                       sal_Int32 nStart, sal_Int32 nEnd,
                                       const bool bTempHeader ) :
-    SvXMLImportContext( rImport, nPrfx, rLName ),
+    SvXMLImportContext( rImport ),
     rProperties(rTempProperties),
     nStartIndex(nStart),
     nEndIndex(nEnd),
@@ -49,29 +47,25 @@ PageHeaderFooterContext::~PageHeaderFooterContext()
 {
 }
 
-SvXMLImportContextRef PageHeaderFooterContext::CreateChildContext( sal_uInt16 
nPrefix,
-                                            const OUString& rLName,
-                                            const css::uno::Reference< 
css::xml::sax::XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > 
PageHeaderFooterContext::createFastChildContext(
+    sal_Int32 nElement,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
-    SvXMLImportContextRef xContext;
-
-    if( XML_NAMESPACE_STYLE == nPrefix && IsXMLToken( rLName, 
XML_HEADER_FOOTER_PROPERTIES ) )
+    if( nElement == XML_ELEMENT(STYLE, XML_HEADER_FOOTER_PROPERTIES) )
     {
         PageContextType aType = Header;
         if (!bHeader)
             aType = Footer;
-        xContext = new PagePropertySetContext( GetImport(), nPrefix,
-                                                rLName, xAttrList,
-                                                XML_TYPE_PROP_HEADER_FOOTER,
-                                                rProperties,
-                                                rMap,  nStartIndex, nEndIndex, 
aType);
+        return new PagePropertySetContext( GetImport(), nElement,
+                                           xAttrList,
+                                           XML_TYPE_PROP_HEADER_FOOTER,
+                                           rProperties,
+                                           rMap,  nStartIndex, nEndIndex, 
aType);
     }
+    else
+        SAL_WARN("xmloff", "unknown element " << 
SvXMLImport::getPrefixAndNameFromToken(nElement));
 
-    return xContext;
-}
-
-void PageHeaderFooterContext::EndElement()
-{
+    return nullptr;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/PageHeaderFooterContext.hxx 
b/xmloff/source/style/PageHeaderFooterContext.hxx
index 596c596d97b4..b72f3f011dfa 100644
--- a/xmloff/source/style/PageHeaderFooterContext.hxx
+++ b/xmloff/source/style/PageHeaderFooterContext.hxx
@@ -32,9 +32,7 @@ class PageHeaderFooterContext : public SvXMLImportContext
 
 public:
 
-    PageHeaderFooterContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
-                       const OUString& rLName,
-                       const 
css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList,
+    PageHeaderFooterContext( SvXMLImport& rImport,
                         ::std::vector< XMLPropertyState > & rProperties,
                         const rtl::Reference < SvXMLImportPropertyMapper > 
&rMap,
                         sal_Int32 nStartIndex, sal_Int32 nEndIndex,
@@ -42,11 +40,12 @@ public:
 
     virtual ~PageHeaderFooterContext() override;
 
-    virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix,
-                                     const OUString& rLocalName,
-                                     const 
css::uno::Reference<css::xml::sax::XAttributeList>& xAttrList ) override;
+    virtual void SAL_CALL startFastElement( sal_Int32 /*nElement*/,
+        const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) 
override {}
+
+    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL 
createFastChildContext(
+        sal_Int32 nElement, const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& AttrList ) override;
 
-    virtual void EndElement() override;
 };
 
 #endif
diff --git a/xmloff/source/style/PageMasterImportContext.cxx 
b/xmloff/source/style/PageMasterImportContext.cxx
index 8e2caba9eb90..00cf0656d532 100644
--- a/xmloff/source/style/PageMasterImportContext.cxx
+++ b/xmloff/source/style/PageMasterImportContext.cxx
@@ -75,16 +75,14 @@ PageStyleContext::~PageStyleContext()
 {
 }
 
-SvXMLImportContextRef PageStyleContext::CreateChildContext(
-        sal_uInt16 nPrefix,
-        const OUString& rLocalName,
-        const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > 
PageStyleContext::createFastChildContext(
+    sal_Int32 nElement,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
-    if( XML_NAMESPACE_STYLE == nPrefix &&
-        ((IsXMLToken(rLocalName, XML_HEADER_STYLE )) ||
-         (IsXMLToken(rLocalName, XML_FOOTER_STYLE )) ) )
+    if( nElement == XML_ELEMENT(STYLE, XML_HEADER_STYLE) ||
+        nElement == XML_ELEMENT(STYLE, XML_FOOTER_STYLE) )
     {
-        bool bHeader = IsXMLToken(rLocalName, XML_HEADER_STYLE);
+        bool bHeader = nElement == XML_ELEMENT(STYLE, XML_HEADER_STYLE);
         rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
             GetStyles()->GetImportPropertyMapper( GetFamily() );
         if( xImpPrMap.is() )
@@ -119,13 +117,12 @@ SvXMLImportContextRef 
PageStyleContext::CreateChildContext(
             }
             if (!bEnd)
                 nEndIndex = nIndex;
-            return new PageHeaderFooterContext(GetImport(), nPrefix, 
rLocalName,
-                            xAttrList, GetProperties(), xImpPrMap, 
nStartIndex, nEndIndex, bHeader);
+            return new PageHeaderFooterContext(GetImport(),
+                            GetProperties(), xImpPrMap, nStartIndex, 
nEndIndex, bHeader);
         }
     }
 
-    if( XML_NAMESPACE_STYLE == nPrefix &&
-        IsXMLToken(rLocalName, XML_PAGE_LAYOUT_PROPERTIES) )
+    if( nElement == XML_ELEMENT(STYLE, XML_PAGE_LAYOUT_PROPERTIES) )
     {
         rtl::Reference < SvXMLImportPropertyMapper > xImpPrMap =
             GetStyles()->GetImportPropertyMapper( GetFamily() );
@@ -148,15 +145,15 @@ SvXMLImportContextRef 
PageStyleContext::CreateChildContext(
             }
             if (!bEnd)
                 nEndIndex = nIndex;
-            return new PagePropertySetContext( GetImport(), nPrefix,
-                                                    rLocalName, xAttrList,
+            return new PagePropertySetContext( GetImport(), nElement,
+                                                    xAttrList,
                                                     XML_TYPE_PROP_PAGE_LAYOUT,
                                                     GetProperties(),
                                                     xImpPrMap, 0, nEndIndex, 
Page);
         }
     }
 
-    return XMLPropStyleContext::CreateChildContext(nPrefix, rLocalName, 
xAttrList);
+    return XMLPropStyleContext::createFastChildContext(nElement, xAttrList);
 }
 
 void PageStyleContext::FillPropertySet(const 
uno::Reference<beans::XPropertySet > &)
diff --git a/xmloff/source/style/PagePropertySetContext.cxx 
b/xmloff/source/style/PagePropertySetContext.cxx
index 6c46c174671e..24fbe25bf8c1 100644
--- a/xmloff/source/style/PagePropertySetContext.cxx
+++ b/xmloff/source/style/PagePropertySetContext.cxx
@@ -31,15 +31,14 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star;
 
 PagePropertySetContext::PagePropertySetContext(
-                 SvXMLImport& rImport, sal_uInt16 nPrfx,
-                 const OUString& rLName,
-                 const Reference< xml::sax::XAttributeList > & xAttrList,
+                 SvXMLImport& rImport, sal_Int32 nElement,
+                 const Reference< xml::sax::XFastAttributeList > & xAttrList,
                  sal_uInt32 nFam,
                  ::std::vector< XMLPropertyState > &rProps,
                  const rtl::Reference < SvXMLImportPropertyMapper > &rMap,
                  sal_Int32 nStartIndex, sal_Int32 nEndIndex,
                  const PageContextType aTempType ) :
-    SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
+    SvXMLPropertySetContext( rImport, nElement, xAttrList, nFam,
                              rProps, rMap, nStartIndex, nEndIndex )
 {
     aType = aTempType;
diff --git a/xmloff/source/style/PagePropertySetContext.hxx 
b/xmloff/source/style/PagePropertySetContext.hxx
index 31b4d7341300..b44828b9130a 100644
--- a/xmloff/source/style/PagePropertySetContext.hxx
+++ b/xmloff/source/style/PagePropertySetContext.hxx
@@ -34,9 +34,8 @@ class PagePropertySetContext : public SvXMLPropertySetContext
     PageContextType aType;
 
 public:
-    PagePropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
-                const OUString& rLName,
-                 const css::uno::Reference< css::xml::sax::XAttributeList >& 
xAttrList,
+    PagePropertySetContext( SvXMLImport& rImport, sal_Int32 nElement,
+                 const css::uno::Reference< css::xml::sax::XFastAttributeList 
>& xAttrList,
                  sal_uInt32 nFam,
                  ::std::vector< XMLPropertyState > &rProps,
                  const rtl::Reference < SvXMLImportPropertyMapper > &rMap,
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
index 9941c26581bb..bcd2b4491989 100644
--- a/xmloff/source/style/xmlimppr.cxx
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -318,6 +318,228 @@ void SvXMLImportPropertyMapper::importXML(
     finished( rProperties, nStartIdx, nEndIdx );
 }
 
+/** fills the given itemset with the attributes in the given list */
+void SvXMLImportPropertyMapper::importXML(
+        vector< XMLPropertyState >& rProperties,
+        const Reference< XFastAttributeList >& xAttrList,
+        const SvXMLUnitConverter& rUnitConverter,
+        const SvXMLNamespaceMap& rNamespaceMap,
+        sal_uInt32 nPropType,
+        sal_Int32 nStartIdx,
+        sal_Int32 nEndIdx ) const
+{
+    Reference< XNameContainer > xAttrContainer;
+
+    if( -1 == nStartIdx )
+        nStartIdx = 0;
+    if( -1 == nEndIdx )
+        nEndIdx = maPropMapper->GetEntryCount();
+    for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
+    {
+        sal_Int32 nToken = aIter.getToken();
+        const OUString aPrefix = 
SvXMLImport::getNamespacePrefixFromToken(nToken, &rNamespaceMap);
+        const OUString aNamespaceURI = 
SvXMLImport::getNamespaceURIFromToken(nToken);
+        OUString sAttrName = SvXMLImport::getNameFromToken( nToken );
+        if ( !aPrefix.isEmpty() )
+            sAttrName = aPrefix + SvXMLImport::aNamespaceSeparator + sAttrName;
+        OUString aLocalName;
+        sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( 
sAttrName, &aLocalName );
+
+//        const OUString& rAttrName = xAttrList->getNameByIndex( i );
+//        OUString aLocalName, aPrefix, aNamespace;
+//        sal_uInt16 nPrefix = rNamespaceMap.GetKeyByAttrName( rAttrName, 
&aPrefix,
+//                                                    &aLocalName, &aNamespace 
);
+
+        if( XML_NAMESPACE_XMLNS == nPrefix )
+            continue;
+
+        const OUString sValue = aIter.toString();
+
+        // index of actual property map entry
+        // This looks very strange, but it works well:
+        // If the start index is 0, the new value will become -1, and
+        // GetEntryIndex will start searching with position 0.
+        // Otherwise GetEntryIndex will start with the next position specified.
+        sal_Int32 nIndex =  nStartIdx - 1;
+        sal_uInt32 nFlags = 0;  // flags of actual property map entry
+        bool bFound = false;
+
+        // for better error reporting: this should be set true if no
+        // warning is needed
+        bool bNoWarning = false;
+        bool bAlienImport = false;
+
+        do
+        {
+            // find an entry for this attribute
+            nIndex = maPropMapper->GetEntryIndex( nPrefix, aLocalName,
+                                                  nPropType, nIndex );
+
+            if( nIndex > -1 && nIndex < nEndIdx  )
+            {
+                // 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) )
+                {
+                    bAlienImport = true;
+                    nIndex = -1;
+                }
+                else
+                {
+                    if( ( nFlags & MID_FLAG_ELEMENT_ITEM_IMPORT ) == 0 )
+                    {
+                        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 )
+                        {
+                            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 ))
+                                {
+                                    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();
+
+                            bSet = handleSpecialItem( aNewProperty, 
rProperties,
+                                                      sValue, rUnitConverter,
+                                                         rNamespaceMap );
+
+                            // 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;
+
+                        // 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) )
+                            {
+                                Sequence<OUString> aSeq(2);
+                                aSeq[0] = sAttrName;
+                                aSeq[1] = sValue;
+                                rImport.SetError( XMLERROR_FLAG_WARNING |
+                                                  XMLERROR_STYLE_ATTR_VALUE,
+                                                  aSeq );
+                            }
+                        }
+                    }
+                    bFound = true;
+                    continue;
+                }
+            }
+
+            if( !bFound )
+            {
+                SAL_INFO_IF((XML_NAMESPACE_NONE != nPrefix) &&
+                            !(XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) &&
+                            !bAlienImport, "xmloff.style",
+                            "unknown attribute: \"" << sAttrName << "\"");
+                if( (XML_NAMESPACE_UNKNOWN_FLAG & nPrefix) || 
(XML_NAMESPACE_NONE == nPrefix) || bAlienImport )
+                {
+                    if( !xAttrContainer.is() )
+                    {
+                        // add an unknown attribute container to the properties
+                        Reference< XNameContainer > xNew( 
SvUnoAttributeContainer_CreateInstance(), UNO_QUERY );
+                        xAttrContainer = xNew;
+
+                        // find map entry and create new property state
+                        if( -1 == nIndex )
+                        {
+                            switch( nPropType )
+                            {
+                                case XML_TYPE_PROP_CHART:
+                                    nIndex = maPropMapper->FindEntryIndex( 
"ChartUserDefinedAttributes", XML_NAMESPACE_TEXT, GetXMLToken(XML_XMLNS) );
+                                    break;
+                                case XML_TYPE_PROP_PARAGRAPH:
+                                    nIndex = maPropMapper->FindEntryIndex( 
"ParaUserDefinedAttributes", XML_NAMESPACE_TEXT, GetXMLToken(XML_XMLNS) );
+                                    break;
+                                case  XML_TYPE_PROP_TEXT:
+                                    nIndex = maPropMapper->FindEntryIndex( 
"TextUserDefinedAttributes", XML_NAMESPACE_TEXT, GetXMLToken(XML_XMLNS) );
+                                    break;
+                                default:
+                                    break;
+                            }
+                            // other property type or property not found
+                            if( -1 == nIndex )
+                                nIndex = maPropMapper->FindEntryIndex( 
"UserDefinedAttributes", XML_NAMESPACE_TEXT, GetXMLToken(XML_XMLNS) );
+                        }
+
+                        // #106963#; use userdefined attribute only if it is 
in the specified property range
+                        if( nIndex != -1 && nIndex >= nStartIdx && nIndex < 
nEndIdx)
+                        {
+                            XMLPropertyState aNewProperty( nIndex, 
Any(xAttrContainer) );
+
+                            // push it on our stack so we export it later
+                            rProperties.push_back( aNewProperty );
+                        }
+                    }
+
+                    if( xAttrContainer.is() )
+                    {
+                        AttributeData aData;
+                        aData.Type = GetXMLToken( XML_CDATA );
+                        aData.Value = sValue;
+
+                        OUStringBuffer sName;
+                        if( XML_NAMESPACE_NONE != nPrefix )
+                        {
+                            sName.append( aPrefix );
+                            sName.append( ':' );
+                            aData.Namespace = aNamespaceURI;
+                        }
+
+                        sName.append( aLocalName );
+
+                        xAttrContainer->insertByName( 
sName.makeStringAndClear(), Any(aData) );
+                    }
+                }
+            }
+        }
+        while( ( nIndex >= 0 && nIndex + 1 < nEndIdx ) && (( nFlags & 
MID_FLAG_MULTI_PROPERTY ) != 0 ) );
+    }
+
+    finished( rProperties, nStartIdx, nEndIdx );
+}
+
 /** this method is called for every item that has the 
MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
 bool SvXMLImportPropertyMapper::handleSpecialItem(
         XMLPropertyState& rProperty,
diff --git a/xmloff/source/style/xmlprcon.cxx b/xmloff/source/style/xmlprcon.cxx
index 813dcb3b3dcd..40073803e993 100644
--- a/xmloff/source/style/xmlprcon.cxx
+++ b/xmloff/source/style/xmlprcon.cxx
@@ -48,6 +48,26 @@ SvXMLPropertySetContext::SvXMLPropertySetContext(
                         mnStartIdx, mnEndIdx );
 }
 
+SvXMLPropertySetContext::SvXMLPropertySetContext(
+    SvXMLImport& rImp, sal_Int32 /*nElement*/,
+    const uno::Reference< xml::sax::XFastAttributeList >& xAttrList,
+    sal_uInt32 nFam,
+    vector< XMLPropertyState > &rProps,
+    const rtl::Reference < SvXMLImportPropertyMapper >  &rMap,
+    sal_Int32 nSIdx, sal_Int32 nEIdx )
+:   SvXMLImportContext( rImp )
+,   mnStartIdx( nSIdx )
+,   mnEndIdx( nEIdx )
+,   mnFamily( nFam )
+,   mrProperties( rProps )
+,   mxMapper( rMap )
+{
+    mxMapper->importXML( mrProperties, xAttrList,
+                        GetImport().GetMM100UnitConverter(),
+                        GetImport().GetNamespaceMap(), mnFamily,
+                        mnStartIdx, mnEndIdx );
+}
+
 SvXMLPropertySetContext::~SvXMLPropertySetContext()
 {
 }
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index 73b5236a14c4..e5dbf53b7361 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -436,6 +436,12 @@ SvXMLStyleContext 
*SvXMLStylesContext::CreateStyleChildContext(
             pStyle = new PageStyleContext( GetImport(), nElement, xAttrList, 
*this, bDefaultStyle );
         }
         break;
+        case XML_ELEMENT(TEXT, XML_LIST_STYLE):
+            pStyle = new SvxXMLListStyleContext( GetImport(), nElement, 
xAttrList );
+            break;
+        case XML_ELEMENT(TEXT, XML_OUTLINE_STYLE):
+            pStyle = new SvxXMLListStyleContext( GetImport(), nElement, 
xAttrList, true );
+            break;
 
         // FillStyles
 
@@ -513,16 +519,6 @@ SvXMLStyleContext 
*SvXMLStylesContext::CreateStyleChildContext( sal_uInt16 p_nPr
                                                     rLocalName, xAttrList );
             }
             break;
-            case XML_TOK_TEXT_LIST_STYLE:
-                pStyle = new SvxXMLListStyleContext( GetImport(), p_nPrefix,
-                                                    rLocalName, xAttrList );
-                break;
-            case XML_TOK_TEXT_OUTLINE:
-                pStyle = new SvxXMLListStyleContext( GetImport(), p_nPrefix,
-                                                    rLocalName, xAttrList, 
true );
-                break;
-
-
         }
     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to