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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 20 12:22:36 UTC 2020


 filter/source/msfilter/msdffimp.cxx  |   13 +++++----
 include/filter/msfilter/msdffimp.hxx |    8 ++---
 xmloff/source/draw/eventimp.cxx      |   49 ++++++++++++++++-------------------
 3 files changed, 34 insertions(+), 36 deletions(-)

New commits:
commit 1bad449a6a2427a2c9d217a3f84d9b350b28c0b3
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Fri Nov 20 08:39:39 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Nov 20 13:22:04 2020 +0100

    fastparser in SdXMLEventContext
    
    Change-Id: I52eb0ef77c54386a9774f746caba4b05785937aa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106214
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx
index 9d6415cfe013..9f0e79bef84a 100644
--- a/xmloff/source/draw/eventimp.cxx
+++ b/xmloff/source/draw/eventimp.cxx
@@ -86,7 +86,9 @@ public:
 
     SdXMLEventContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList, const Reference< XShape >& rxShape );
 
-    virtual SvXMLImportContextRef CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName,    const Reference< 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;
     virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
 };
 
@@ -94,38 +96,27 @@ class XMLEventSoundContext : public SvXMLImportContext
 {
 public:
 
-    XMLEventSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent );
+    XMLEventSoundContext( SvXMLImport& rImport, const Reference< XFastAttributeList >& xAttrList, SdXMLEventContext* pParent );
 };
 
 }
 
-XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent )
-: SvXMLImportContext( rImp, nPrfx, rLocalName )
+XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImp, const Reference< XFastAttributeList >& xAttrList, SdXMLEventContext* pParent )
+: SvXMLImportContext( rImp )
 {
-    if( !(pParent && nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_SOUND )) )
-        return;
-
-    const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
-    for(sal_Int16 i=0; i < nAttrCount; i++)
+    for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
     {
-        OUString sAttrName = xAttrList->getNameByIndex( i );
-        OUString aAttrLocalName;
-        sal_uInt16 nAttrPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aAttrLocalName );
-        OUString sValue = xAttrList->getValueByIndex( i );
-
-        switch( nAttrPrefix )
+        OUString sValue = aIter.toString();
+        switch( aIter.getToken() )
         {
-        case XML_NAMESPACE_XLINK:
-            if( IsXMLToken( aAttrLocalName, XML_HREF ) )
-            {
+            case XML_ELEMENT(XLINK, XML_HREF):
                 pParent->maData.msSoundURL = rImp.GetAbsoluteReference(sValue);
-            }
-            break;
-        case XML_NAMESPACE_PRESENTATION:
-            if( IsXMLToken( aAttrLocalName, XML_PLAY_FULL ) )
-            {
+                break;
+            case XML_ELEMENT(PRESENTATION, XML_PLAY_FULL):
                 pParent->maData.mbPlayFull = IsXMLToken( sValue, XML_TRUE );
-            }
+                break;
+            default:
+                XMLOFF_WARN_UNKNOWN("xmloff", aIter);
         }
     }
 }
@@ -236,9 +227,15 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp,  sal_uInt16 nPrfx, cons
         maData.mbValid = !sEventName.isEmpty();
 }
 
-SvXMLImportContextRef SdXMLEventContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList>& xAttrList )
+css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLEventContext::createFastChildContext(
+    sal_Int32 nElement,
+    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
 {
-    return new XMLEventSoundContext( GetImport(), nPrefix, rLocalName, xAttrList, this );
+    if( nElement == XML_ELEMENT(PRESENTATION, XML_SOUND) )
+        return new XMLEventSoundContext( GetImport(), xAttrList, this );
+    else
+        XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
+    return nullptr;
 }
 
 void SdXMLEventContext::endFastElement(sal_Int32 )
commit b5724a53b4f3e53768429544f604cd374ed49a0c
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Nov 19 14:56:03 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Nov 20 13:21:53 2020 +0100

    Lengths passed into the SvxMSDffManager::Get*Data functions are all sal_uInt32
    
    (i.e., rLength obtained from SvxMSDffManager::ReadCommonRecordHeader)
    
    Change-Id: I04b51cb7e6cb771d89d07a86c00ee9fdaa72aaa6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106176
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 0af775d32df3..199b668a1ddc 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5946,14 +5946,15 @@ void SvxMSDffManager::GetCtrlData(sal_uInt32 nOffsDggL)
 
 // from here on: Drawing Group Container  i.e. document-wide valid data
 
-void SvxMSDffManager::GetDrawingGroupContainerData( SvStream& rSt, sal_uLong nLenDgg )
+void SvxMSDffManager::GetDrawingGroupContainerData( SvStream& rSt, sal_uInt32 nLenDgg )
 {
     sal_uInt8   nVer;
     sal_uInt16 nInst;
     sal_uInt16 nFbt;
     sal_uInt32 nLength;
 
-    sal_uLong nLenBStoreCont = 0, nLenFBSE = 0, nRead = 0;
+    sal_uInt32 nLenBStoreCont = 0, nLenFBSE = 0;
+    sal_uLong nRead = 0;
 
     // search for a  BStore Container
     bool bOk = true;
@@ -6033,7 +6034,7 @@ void SvxMSDffManager::GetDrawingGroupContainerData( SvStream& rSt, sal_uLong nLe
 // from now on: Drawing Container  which means Pages (Sheet, Slide) - wide valid data
 //                      =================               ======
 
-void SvxMSDffManager::GetDrawingContainerData( SvStream& rSt, sal_uLong nLenDg,
+void SvxMSDffManager::GetDrawingContainerData( SvStream& rSt, sal_uInt32 nLenDg,
                                                sal_uInt16 nDrawingContainerId )
 {
     sal_uInt8 nVer;sal_uInt16 nInst;sal_uInt16 nFbt;sal_uInt32 nLength;
@@ -6070,7 +6071,7 @@ void SvxMSDffManager::GetDrawingContainerData( SvStream& rSt, sal_uLong nLenDg,
 }
 
 bool SvxMSDffManager::GetShapeGroupContainerData( SvStream& rSt,
-                                                  sal_uLong nLenShapeGroupCont,
+                                                  sal_uInt32 nLenShapeGroupCont,
                                                   bool bPatriarch,
                                                   sal_uInt16 nDrawingContainerId )
 {
@@ -6113,7 +6114,7 @@ bool SvxMSDffManager::GetShapeGroupContainerData( SvStream& rSt,
 }
 
 bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
-                                             sal_uLong nLenShapeCont,
+                                             sal_uInt32 nLenShapeCont,
                                              sal_uLong nPosGroup,
                                              sal_uInt16 nDrawingContainerId )
 {
@@ -6123,7 +6124,7 @@ bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
     // We are in a shape container (possibly more than one per shape group) and we now
     // have to fetch the shape id and file position (to be able to access them again later)
     // and the first BStore reference (if present).
-    sal_uLong nLenShapePropTbl = 0;
+    sal_uInt32 nLenShapePropTbl = 0;
     sal_uLong nReadSpCont = 0;
 
     // Store file offset of the shape containers or respectively the group(!).
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index 2c72722e9cf8..dc171b3e60da 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -464,20 +464,20 @@ protected:
 
     void GetCtrlData(sal_uInt32 nOffsDgg);
     void GetDrawingGroupContainerData( SvStream& rSt,
-                                       sal_uLong nLenDgg );
+                                       sal_uInt32 nLenDgg );
     // Add internal drawing container id as parameter to the sub methods of
     // reading the control information about the drawing objects.
     // The drawing container id is used to distinguish the text ids of drawing
     // objects in different drawing containers.
     void GetDrawingContainerData( SvStream& rSt,
-                                  sal_uLong nLenDg,
+                                  sal_uInt32 nLenDg,
                                   sal_uInt16 nDrawingContainerId );
     bool GetShapeGroupContainerData( SvStream& rSt,
-                                     sal_uLong nLenShapeGroupCont,
+                                     sal_uInt32 nLenShapeGroupCont,
                                      bool bPatriarch,
                                      sal_uInt16 nDrawingContainerId );
     bool GetShapeContainerData( SvStream& rSt,
-                                sal_uLong nLenShapeCont,
+                                sal_uInt32 nLenShapeCont,
                                 sal_uLong nPosGroup,
                                 sal_uInt16 nDrawingContainerId );
 


More information about the Libreoffice-commits mailing list