[Libreoffice-commits] .: sc/source xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 22 05:29:48 PDT 2012


 sc/source/ui/view/cellsh3.cxx                               |    3 -
 xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx |   27 +++++++++---
 xmloff/source/draw/ximpshap.cxx                             |    2 
 3 files changed, 23 insertions(+), 9 deletions(-)

New commits:
commit cfacb2d111b5319f5e5c494e1cf6426277e88b59
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Oct 22 13:26:47 2012 +0100

    accelerate shape import & export by more sensible XInterface handling.
    
    Instead of converting both XInterfaces (again) to a root XInterface
    inside the Reference == operator - we ensure that we have done this on
    insertion, and do a fast pointer compare; saves ~40% of load time on
    some docs, and more on save.
    
    Change-Id: Ic3c97dd731ffb3854ebc135f416f6032d87b9d15

diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index c0c4ad9..967bb8f 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -109,9 +109,6 @@ void ScCellShell::Execute( SfxRequest& rReq )
 
     switch ( nSlot )
     {
-
-
-
         case SID_ATTR_SIZE://XXX ???
             break;
 
diff --git a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
index 4e9a715..4b1d133 100644
--- a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
+++ b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
@@ -20,6 +20,7 @@
 
 #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
 
+using namespace ::com::sun::star;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::XInterface;
 using ::rtl::OUString;
@@ -37,8 +38,12 @@ UnoInterfaceToUniqueIdentifierMapper::UnoInterfaceToUniqueIdentifierMapper()
 */
 const OUString& UnoInterfaceToUniqueIdentifierMapper::registerReference( const Reference< XInterface >& rInterface )
 {
+    // Be certain that the references we store in our table are to the
+    // leading / primary XInterface - cf. findReference
+    uno::Reference< uno::XInterface > xRef( rInterface, uno::UNO_QUERY );
+
     IdMap_t::const_iterator aIter;
-    if( findReference( rInterface, aIter ) )
+    if( findReference( xRef, aIter ) )
     {
         return (*aIter).first;
     }
@@ -46,7 +51,7 @@ const OUString& UnoInterfaceToUniqueIdentifierMapper::registerReference( const R
     {
         OUString aId( "id" );
         aId += OUString::valueOf( mnNextId++ );
-        return (*maEntries.insert( IdMap_t::value_type( aId, rInterface ) ).first).first;
+        return (*maEntries.insert( IdMap_t::value_type( aId, xRef ) ).first).first;
     }
 }
 
@@ -58,7 +63,12 @@ const OUString& UnoInterfaceToUniqueIdentifierMapper::registerReference( const R
 bool UnoInterfaceToUniqueIdentifierMapper::registerReference( const OUString& rIdentifier, const Reference< XInterface >& rInterface )
 {
     IdMap_t::const_iterator aIter;
-    if( findReference( rInterface, aIter ) )
+
+    // Be certain that the references we store in our table are to the
+    // leading / primary XInterface - cf. findReference
+    uno::Reference< uno::XInterface > xRef( rInterface, uno::UNO_QUERY );
+
+    if( findReference( xRef, aIter ) )
     {
         return rIdentifier != (*aIter).first;
     }
@@ -68,7 +78,7 @@ bool UnoInterfaceToUniqueIdentifierMapper::registerReference( const OUString& rI
     }
     else
     {
-        maEntries.insert( IdMap_t::value_type( rIdentifier, rInterface ) );
+        maEntries.insert( IdMap_t::value_type( rIdentifier, xRef ) );
 
         // see if this is a reference like something we would generate in the future
         const sal_Unicode *p = rIdentifier.getStr();
@@ -138,11 +148,18 @@ const Reference< XInterface >& UnoInterfaceToUniqueIdentifierMapper::getReferenc
 
 bool UnoInterfaceToUniqueIdentifierMapper::findReference( const Reference< XInterface >& rInterface, IdMap_t::const_iterator& rIter ) const
 {
+    uno::Reference< uno::XInterface > xRef( rInterface, uno::UNO_QUERY );
+
     rIter = maEntries.begin();
+
     const IdMap_t::const_iterator aEnd( maEntries.end() );
     while( rIter != aEnd )
     {
-        if( (*rIter).second == rInterface )
+        // The Reference == operator, does a repeated queryInterface on
+        // this to ensure we got the right XInterface base-class. However,
+        // we can be sure that this has been done already by the time we
+        // get to here.
+        if( (*rIter).second.get() == xRef.get() )
             return true;
 
         rIter++;
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index a7434c0..989892d 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -470,7 +470,7 @@ void SdXMLShapeContext::AddShape(uno::Reference< drawing::XShape >& xShape)
 
         if( !maShapeId.isEmpty() )
         {
-            uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
+            uno::Reference< uno::XInterface > xRef( static_cast<uno::XInterface *>(xShape.get()) );
             GetImport().getInterfaceToIdentifierMapper().registerReference( maShapeId, xRef );
         }
 


More information about the Libreoffice-commits mailing list